Merge branch 'develop' into formAddPropertyMB

This commit is contained in:
lamrani abdelwadoud 2023-08-02 11:52:56 +02:00 committed by GitHub
commit 01efddbc23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
425 changed files with 5006 additions and 3500 deletions

View file

@ -21,7 +21,7 @@ services:
addons:
mariadb: '10.4'
mariadb: '10.5'
env:
@ -374,7 +374,9 @@ script:
- |
echo "Upgrading Dolibarr"
# Ensure we catch errors. Set this to +e if you want to go to the end to see log files.
# Ensure we catch errors with -e. Set this to +e if you want to go to the end to see log files.
# Note: We keep +e because with pgsql, one of upgrade process fails even if migration seems ok, so
# I disable stop on error to be able to continue.
set +e
cd htdocs/install
php upgrade.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360.log
@ -467,13 +469,13 @@ script:
- |
echo "Unit testing"
# Ensure we catch errors. Set this to +e instead of -e if you want to go to the end to see dolibarr.log file.
set +e
# Ensure we catch errors with -e. Set this to +e instead of -e if you want to go to the end to see dolibarr.log file.
set -e
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
phpunitresult=$?
echo "Phpunit return code = $phpunitresult"
set +e
after_script:
- |
echo "After script - Output last lines of dolibarr.log"

View file

@ -52,7 +52,7 @@ bacon, dasprid, swiss-qr-bill, kmukku, symfony/validator
JS libraries:
Ace 1.4.14 BSD Yes JS library to get code syntaxique coloration in a textarea.
ChartJS 3.7.1 MIT License Yes JS library for graph
CKEditor 4.18 LGPL-2.1+ Yes Editor WYSIWYG
CKEditor 4.22.1 LGPL-2.1+ Yes Editor WYSIWYG
jQuery 3.6.4 MIT License Yes JS library
jQuery UI 1.13.2 GPL and MIT License Yes JS library plugin UI
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css

View file

@ -4,16 +4,15 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
## Supported Versions for security reports
| Version | Supported |
| ---------- | ---------------------- |
| <= 17.0.0 | :x: |
| >= 17.0.1 | :white_check_mark: |
| >= develop | :white_check_mark: |
Security report are valid only on current stable version (see https://dolibarr.org web site to get current stable version) or on development version (branch "develop" on https://github.com/Dolibarr/dolibarr).
## Reporting a Vulnerability
To report a vulnerability, for a private report, please use GitHub security advisory at [https://github.com/Dolibarr/dolibarr/security/advisories/new](https://github.com/Dolibarr/dolibarr/security/advisories/new) (if you have permissions).
Alternatively send an email to security@dolibarr.org (for everybody)
To report a vulnerability, for a private report, you can:
- Send your report on [https://app.yogosha.com/cvd/dolibarr/10VxeNx6Ui3rSEhAgX63US](https://app.yogosha.com/cvd/dolibarr/10VxeNx6Ui3rSEhAgX63US) (recommended for everybody)
- Or if you have permissions, use GitHub security advisory at [https://github.com/Dolibarr/dolibarr/security/advisories/new](https://github.com/Dolibarr/dolibarr/security/advisories/new)
- Or send by email to security@dolibarr.org a clear textual description of the report along with steps to reproduce the issue, include attachments such as screenshots or proof of concept code as necessary
## Hunting vulnerabilities on Dolibarr
@ -39,12 +38,12 @@ We are happy to thank everyone who submits valid reports which help us improve t
You must be the first reporter of the vulnerability (duplicate reports are closed).
You must send a clear textual description of the report along with steps to reproduce the issue, include attachments such as screenshots or proof of concept code as necessary.
You must avoid tests that could cause degradation or interruption of our service (refrain from using automated tools, and limit yourself about requests per second), that's why we recommand to install software on your own platform.
You must not leak, manipulate, or destroy any user data of third parties to find your vulnerability.
Reports are processed around once a month.
## Scope for qualified vulnerabilities
ONLY vulnerabilities discovered, when the following setup on test platform is used, are "valid":

View file

@ -13,7 +13,7 @@
# fail2ban-client status web-accesslog-limit403
#
# To test rule file on a existing log file
# fail2ban-regex /var/log/apache2/access.log /etc/fail2ban/filter.d/web-accesslog-limit403.conf
# fail2ban-regex /var/log/apache2/access.log /etc/fail2ban/filter.d/web-accesslog-limit403.conf --print-all-matched
failregex = <HOST> - - .*HTTP/[0-9]+(.[0-9]+)?" 403
ignoreregex =

View file

@ -13,7 +13,7 @@
# fail2ban-client status web-dolibarr-limitpublic
#
# To test rule file on a existing log file
# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-limitpublic.conf
# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-limitpublic.conf --print-all-matched
failregex = ^ [A-Z\s]+ <HOST>\s+--- Access to .*/public/
ignoreregex =

View file

@ -13,7 +13,7 @@
# fail2ban-client status web-dolibarr-rulesbruteforce
#
# To test rule file on a existing log file
# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf
# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf --print-all-matched
failregex = ^ [A-Z\s]+ <HOST>\s+functions_.*::check_user_.* Authentication KO
ignoreregex =

View file

@ -13,7 +13,7 @@
# fail2ban-client status web-dolibarr-rulespassforgotten
#
# To test rule file on a existing log file
# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf
# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf --print-all-matched
failregex = ^ [A-Z\s]+ <HOST>\s+--- Access to .*/passwordforgotten.php - action=buildnewpassword
ignoreregex =

View file

@ -3,10 +3,10 @@ QODANA TUTO
This README explains how to use qodana to generate static analytics reports on the code
Install docker
apt install docker
Install qodana
Install qodana into ~/.loca/bin/qodana
curl -fsSL https://jb.gg/qodana-cli/install | bash
To run inspection on CLI
cd ~/git/dirtoscan

View file

@ -0,0 +1,15 @@
= Install SonarQube locally
Check you are using Install Java SDK 17
java --version must show 61
To install java sdk 17 on ubuntu:
sudo apt update
sudo apt install -y openjdk-17-jdk
Unzip the sonar package into a directory
Edit the file conf/sonar.properties to modify port 9000 and 9001 (already used by Eclipse or xdebug) into 9080 and 9081
Launch sonar with
bin/linux*/sonar.sh console

View file

@ -10,21 +10,21 @@
# Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then
echo "This script detect or clean files with CR+LF into files with LF only. All source files are included, also files into includes."
echo "This script detect or clean files with CR+LF into files with LF only. All source files are included, including files into includes."
echo "Usage: fixdosfiles.sh [list|fix]"
fi
# To detec
if [ "x$1" = "xlist" ]
then
find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v "CRLF" | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF
find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v "CRLF" | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep -v 'htdocs\/includes' | grep CRLF
fi
# To convert
if [ "x$1" = "xfix" ]
then
for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v "CRLF" | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF | awk -F':' '{ print $1 }' `
for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF | awk -F':' '{ print $1 }' `
do
echo "Fix file $fic"
dos2unix "$fic"

View file

@ -100,6 +100,9 @@ if (empty($date_startmonth) || empty($date_endmonth)) {
$pastmonthyear = $dates['pastmonthyear'];
$pastmonth = $dates['pastmonth'];
}
if (getDolGlobalString('ACCOUNTANCY_JOURNAL_USE_CURRENT_MONTH')) {
$pastmonth+=1;
}
if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) { // We define date_start and date_end, only if we did not submit the form
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);

View file

@ -65,6 +65,9 @@ if (empty($reshook)) {
if (!dolibarr_set_const($db, 'LDAP_SERVER_TYPE', GETPOST("type", 'aZ09'), 'chaine', 0, '', $conf->entity)) {
$error++;
}
if (!dolibarr_set_const($db, 'LDAP_USERACCOUNTCONTROL', GETPOST("userAccountControl", 'int'), 'chaine', 0, '', $conf->entity)) {
$error++;
}
if (!dolibarr_set_const($db, 'LDAP_SERVER_PROTOCOLVERSION', GETPOST("LDAP_SERVER_PROTOCOLVERSION", 'aZ09'), 'chaine', 0, '', $conf->entity)) {
$error++;
}
@ -195,6 +198,11 @@ print '<tr class="oddeven"><td>'.$langs->trans("Type").'</td><td>';
print $formldap->selectLdapServerType(getDolGlobalString('LDAP_SERVER_TYPE'), 'type');
print '</td><td>&nbsp;</td></tr>';
// userAccountControl
print '<tr class="oddeven"><td>'.$langs->trans("LDAPUserAccountControl").'</td><td>';
print '<input class="width75" type="text" name="userAccountControl" value="'.getDolGlobalString('LDAP_USERACCOUNTCONTROL', '512').'">';
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPUserAccountControlExample").'</span></td></tr>';
// Version
print '<tr class="oddeven"><td>'.$langs->trans("Version").'</td><td>';
print $formldap->selectLdapServerProtocolVersion(getDolGlobalString('LDAP_SERVER_PROTOCOLVERSION'), 'LDAP_SERVER_PROTOCOLVERSION');

View file

@ -208,6 +208,14 @@ print '<input class="flat right width50" name="MAIN_SECURITY_MAX_ATTACHMENT_ON_F
print '</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("MaxNumberOfFailedAuth").'</td><td class="right">';
print '</td>';
print '<td class="nowrap">';
print '<input class="flat right width50" name="MAIN_SECURITY_MAX_NUMBER_FAILED_AUTH" type="text" value="'.getDolGlobalInt("MAIN_SECURITY_MAX_NUMBER_FAILED_AUTH", 100).'"> '.$langs->trans("FailedAuth");
print '</td>';
print '</tr>';
/*
if (empty($conf->global->MAIN_APPLICATION_TITLE)) {
$conf->global->MAIN_APPLICATION_TITLE = "";

View file

@ -48,6 +48,8 @@ $execmethod = getDolGlobalInt('MAIN_EXEC_USE_POPEN', 1);
* View
*/
$form = new Form($db);
llxHeader();
print load_fiche_titre($langs->trans("Security"), '', 'title_setup');
@ -169,6 +171,12 @@ if (in_array($functiontokeep, $arrayoffunctionsdisabled)) {
print '<span class="opacitymedium">'.$functiontokeep.'</span>';
print '<br>';
$arrayofstreams = stream_get_wrappers();
if (!empty($arrayofstreams)) {
sort($arrayofstreams);
print "<strong>PHP streams</strong> = ".(join(',', $arrayofstreams)).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", 'file,http,https,php').')</span>'."<br>\n";
}
print '<br>';
// XDebug
@ -669,7 +677,7 @@ print '<br>';
print '<strong>WEBSITE_MAIN_SECURITY_FORCESTS</strong> = '.getDolGlobalString('>WEBSITE_MAIN_SECURITY_FORCESTS', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").": \"max-age=31536000; includeSubDomains\")</span><br>";
print '<br>';
print '<strong>WEBSITE_MAIN_SECURITY_FORCEPP</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCEPP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").": \"camera: 'none'; microphone: 'none';\")</span><br>";
print '<strong>WEBSITE_MAIN_SECURITY_FORCEPP</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCEPP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").": \"camera: (); microphone: ();\")</span><br>";
print '<br>';
print '<br>';
@ -678,7 +686,7 @@ print '<br>';
print load_fiche_titre($langs->trans("LimitsAndMitigation"), '', 'folder');
print '<span class="opacitymedium">';
print 'For a higher security, we also recommend to implement limits and mitigation on number of endpoints per minutes for the following URL'."<br>";
print $langs->trans("RecommendMitigationOnURL").'<br>';
print '</span>';
print '<br>';

View file

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2004-2023 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
@ -336,6 +336,14 @@ if ($result) {
// Fields title search
print '<tr class="liste_titre">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch center">';
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
}
print '<td class="liste_titre" width="15%">';
print $form->selectDate($date_start === '' ? -1 : $date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
print $form->selectDate($date_end === '' ? -1 : $date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
@ -370,15 +378,22 @@ if ($result) {
print '</td>';
}
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
}
print "</tr>\n";
print '<tr class="liste_titre">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre('');
}
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "e.dateevent", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Code", $_SERVER["PHP_SELF"], "e.type", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("IP", $_SERVER["PHP_SELF"], "e.ip", "", $param, '', $sortfield, $sortorder);
@ -390,7 +405,10 @@ if ($result) {
if (!empty($arrayfields['e.prefix_session']['checked'])) {
print_liste_field_titre("SuffixSessionName", $_SERVER["PHP_SELF"], "e.prefix_session", "", $param, '', $sortfield, $sortorder);
}
print_liste_field_titre('');
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre('');
}
print "</tr>\n";
while ($i < min($num, $limit)) {
@ -398,20 +416,29 @@ if ($result) {
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">';
$htmltext = '<b>'.$langs->trans("UserAgent").'</b>: '.($obj->user_agent ? dol_string_nohtmltag($obj->user_agent) : $langs->trans("Unknown"));
$htmltext .= '<br><b>'.$langs->trans("SuffixSessionName").' (DOLSESSID_...)</b>: '.($obj->prefix_session ? dol_string_nohtmltag($obj->prefix_session) : $langs->trans("Unknown"));
print $form->textwithpicto('', $htmltext);
print '</td>';
}
// Date
print '<td class="nowrap left">'.dol_print_date($db->jdate($obj->dateevent), '%Y-%m-%d %H:%M:%S', 'tzuserrel').'</td>';
// Code
print '<td>'.$obj->type.'</td>';
print '<td>'.dol_escape_htmltag($obj->type).'</td>';
// IP
print '<td class="nowrap">';
print '<td class="nowraponall">';
print dol_print_ip($obj->ip);
print '</td>';
// Login
print '<td class="nowrap">';
if ($obj->fk_user) {
print '<td class="tdoverflowmax150">';
if ($obj->fk_user > 0) {
$userstatic->id = $obj->fk_user;
$userstatic->login = $obj->login;
$userstatic->admin = $obj->admin;
@ -446,23 +473,25 @@ if ($result) {
if (!empty($arrayfields['e.user_agent']['checked'])) {
// User agent
print '<td>';
print $obj->user_agent;
print dol_escape_htmltag($obj->user_agent);
print '</td>';
}
if (!empty($arrayfields['e.prefix_session']['checked'])) {
// User agent
print '<td>';
print $obj->prefix_session;
print dol_escape_htmltag($obj->prefix_session);
print '</td>';
}
// More informations
print '<td class="right">';
$htmltext = '<b>'.$langs->trans("UserAgent").'</b>: '.($obj->user_agent ? dol_string_nohtmltag($obj->user_agent) : $langs->trans("Unknown"));
$htmltext .= '<br><b>'.$langs->trans("SuffixSessionName").' (DOLSESSID_...)</b>: '.($obj->prefix_session ? dol_string_nohtmltag($obj->prefix_session) : $langs->trans("Unknown"));
print $form->textwithpicto('', $htmltext);
print '</td>';
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="right">';
$htmltext = '<b>'.$langs->trans("UserAgent").'</b>: '.($obj->user_agent ? dol_string_nohtmltag($obj->user_agent) : $langs->trans("Unknown"));
$htmltext .= '<br><b>'.$langs->trans("SuffixSessionName").' (DOLSESSID_...)</b>: '.($obj->prefix_session ? dol_string_nohtmltag($obj->prefix_session) : $langs->trans("Unknown"));
print $form->textwithpicto('', $htmltext);
print '</td>';
}
print "</tr>\n";
$i++;

View file

@ -547,6 +547,17 @@ class Documents extends DolibarrApi
}
$upload_dir = $conf->contrat->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'contract');
} elseif ($modulepart == 'projet' || $modulepart == 'project') {
$modulepart = 'project';
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
$object = new Project($this->db);
$result = $object->fetch($id, $ref);
if (!$result) {
throw new RestException(404, 'Project not found');
}
$upload_dir = $conf->projet->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'project');
} else {
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
}
@ -676,7 +687,7 @@ class Documents extends DolibarrApi
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$object = new CommandeFournisseur($this->db);
} elseif ($modulepart == 'project') {
} elseif ($modulepart == 'projet' || $modulepart == 'project') {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$object = new Project($this->db);
} elseif ($modulepart == 'task' || $modulepart == 'project_task') {

View file

@ -94,6 +94,7 @@ class AssetAccountancyCodes extends CommonObject
$this->accountancy_codes[$mode_key][$field_key] = $accountancy_code;
}
}
return $this->accountancy_codes;
}
/**

View file

@ -334,9 +334,11 @@ if ($resql) {
$resql_supplier_price = $object->db->query($sql_supplier_price);
if ($resql_supplier_price) {
$obj = $object->db->fetch_object($resql_supplier_price);
if (!empty($obj->qty) && !empty($sub_bom_line->qty) && !empty($line->qty)) $line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty;
else $line_cost = $obj->min_price;
if (!empty($obj->qty) && !empty($sub_bom_line->qty) && !empty($line->qty)) {
$line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty;
} else {
$line_cost = $obj->min_price;
}
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price2num($line_cost, 'MT').'</span></td>';
$total_cost+= $line_cost;
}

View file

@ -3448,7 +3448,7 @@ class Propal extends CommonObject
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
* @param User $user Object user
* @param int $mode "opened" for proposal to close, "signed" for proposal to invoice
* @param string $mode "opened" for proposal to close, "signed" for proposal to invoice
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/
public function load_board($user, $mode)

View file

@ -3571,9 +3571,10 @@ class Commande extends CommonOrder
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
* @param User $user Object user
* @param string $mode Mode ('toship', 'tobill', 'shippedtobill')
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/
public function load_board($user)
public function load_board($user, $mode)
{
// phpcs:enable
global $conf, $langs;
@ -3589,18 +3590,48 @@ class Commande extends CommonOrder
}
$sql .= $clause." c.entity IN (".getEntity('commande').")";
//$sql.= " AND c.fk_statut IN (1,2,3) AND c.facture = 0";
$sql .= " AND ((c.fk_statut IN (".self::STATUS_VALIDATED.",".self::STATUS_SHIPMENTONPROCESS.")) OR (c.fk_statut = ".self::STATUS_CLOSED." AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected
if ($mode == 'toship') {
// An order to ship is an open order (validated or in progress)
$sql .= " AND c.fk_statut IN (" . self::STATUS_VALIDATED . "," . self::STATUS_SHIPMENTONPROCESS . ")";
}
if ($mode == 'tobill') {
// An order to bill is an order not already billed
$sql .= " AND c.fk_statut IN (" . self::STATUS_VALIDATED . "," . self::STATUS_SHIPMENTONPROCESS . ", " . self::STATUS_CLOSED . ") AND c.facture = 0";
}
if ($mode == 'shippedtobill') {
// An order shipped and to bill is a delivered order not already billed
$sql .= " AND c.fk_statut IN (" . self::STATUS_CLOSED . ") AND c.facture = 0";
}
if ($user->socid) {
$sql .= " AND c.fk_soc = ".((int) $user->socid);
}
$resql = $this->db->query($sql);
if ($resql) {
$delay_warning = 0;
$label = $labelShort = $url = '';
if ($mode == 'toship') {
$delay_warning = $conf->commande->client->warning_delay / 60 / 60 / 24;
$url = DOL_URL_ROOT.'/commande/list.php?search_status=-2&mainmenu=commercial&leftmenu=orders';
$label = $langs->transnoentitiesnoconv("OrdersToProcess");
$labelShort = $langs->transnoentitiesnoconv("Opened");
}
if ($mode == 'tobill') {
$url = DOL_URL_ROOT.'/commande/list.php?search_status=-3&search_billed=0&mainmenu=commercial&leftmenu=orders';
$label = $langs->trans("OrdersToBill"); // We set here bill but may be billed or ordered
$labelShort = $langs->trans("ToBill");
}
if ($mode == 'shippedtobill') {
$url = DOL_URL_ROOT.'/commande/list.php?search_status=3&search_billed=0&mainmenu=commercial&leftmenu=orders';
$label = $langs->trans("OrdersToBill"); // We set here bill but may be billed or ordered
$labelShort = $langs->trans("StatusOrderDelivered").' '.$langs->trans("and").' '.$langs->trans("ToBill");
}
$response = new WorkboardResponse();
$response->warning_delay = $conf->commande->client->warning_delay / 60 / 60 / 24;
$response->label = $langs->trans("OrdersToProcess");
$response->labelShort = $langs->trans("Opened");
$response->url = DOL_URL_ROOT.'/commande/list.php?search_status=-3&mainmenu=commercial&leftmenu=orders';
$response->warning_delay = $delay_warning;
$response->label = $label;
$response->labelShort = $labelShort;
$response->url = $url;
$response->img = img_object('', "order");
$generic_commande = new Commande($this->db);
@ -3615,7 +3646,7 @@ class Commande extends CommonOrder
$generic_commande->date_livraison = $this->db->jdate($obj->delivery_date);
$generic_commande->delivery_date = $this->db->jdate($obj->delivery_date);
if ($generic_commande->hasDelay()) {
if ($mode == 'toship' && $generic_commande->hasDelay()) {
$response->nbtodolate++;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,263 @@
<?php
/* Copyright (C) 2023 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/facture/agenda-rec.php
* \ingroup facture
* \brief Tab of events on Invoices
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bills", "other"));
// Get parameters
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3);
if (!count($actioncode)) {
$actioncode = '0';
}
} else {
$actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
}
$search_rowid = GETPOST('search_rowid');
$search_agenda_label = GETPOST('search_agenda_label');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortfield) {
$sortfield = 'a.datep,a.id';
}
if (!$sortorder) {
$sortorder = 'DESC,DESC';
}
// Initialize technical objects
$object = new FactureRec($db);
$extrafields = new ExtraFields($db);
$hookmanager->initHooks(array('invoicerecagenda', 'globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->facture->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id;
}
$permissiontoread = $user->hasRight("facture", "lire");
$permissiontoadd = $user->hasRight("facture", "creer");
// Security check
if (!empty($user->socid)) {
$socid = $user->socid;
}
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, 'facture', $object->id, 'facture_rec', '', 'fk_soc', 'rowid', $isdraft);
/*
* Actions
*/
$parameters = array('id'=>$id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
// Cancel
if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$actioncode = '';
$search_agenda_label = '';
}
}
/*
* View
*/
$form = new Form($db);
if ($object->id > 0) {
$title = $langs->trans("Agenda");
//if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
$help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung';
llxHeader('', $title, $help_url);
if (isModEnabled('notification')) {
$langs->load("mails");
}
$head = invoice_rec_prepare_head($object);
print dol_get_fiche_head($head, 'agenda', $langs->trans("RepeatableInvoice"), -1, $object->picto);
// Object card
// ------------------------------------------------------------
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '';
if ($action != 'editref') {
$morehtmlref .= $form->editfieldkey($object->ref, 'ref', $object->ref, $object, 0, '', '', 0, 2);
} else {
$morehtmlref .= $form->editfieldval('', 'ref', $object->ref, $object, 0, 'string');
}
$morehtmlref .= '<div class="refidno">';
// Thirdparty
$morehtmlref .= $object->thirdparty->getNomUrl(1);
// Project
if (isModEnabled('project')) {
$langs->load("projects");
$morehtmlref .= '<br>';
if (0) {
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
}
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
} else {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= $proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
}
}
}
}
$morehtmlref .= '</div>';
$morehtmlright = '';
dol_banner_tab($object, 'ref', $linkback, 1, 'title', 'none', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
$object->info($object->id);
dol_print_object_info($object, 1);
print '</div>';
print dol_get_fiche_end();
// Actions buttons
$objthirdparty = $object;
$objcon = new stdClass();
$out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id);
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
$out .= '&backtopage='.urlencode($urlbacktopage);
$permok = $user->hasRight('paymentbagendaybanktransfer', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {
$out .= '&socid='.urlencode($objthirdparty->id);
}
$out .= (!empty($objcon->id) ? '&contactid='.urlencode($objcon->id) : '');
//$out.=$langs->trans("AddAnAction").' ';
//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
//$out.="</a>";
}
$morehtmlright = '';
//$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id;
//$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1);
//$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
//$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2);
if (isModEnabled('agenda')) {
/*
if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) {
$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
} else {
$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', 0);
}
*/
}
if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) {
print '<br>';
$param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : '');
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit);
}
// Try to know count of actioncomm from cache
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_events_facture_'.$object->id;
$nbEvent = dol_getcache($cachekey);
print_barre_liste($langs->trans("ActionsOnBillRec").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1);
//print_barre_liste($langs->trans("ActionsOnBill"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1);
// List of all actions
$filters = array();
$filters['search_agenda_label'] = $search_agenda_label;
$filters['search_rowid'] = $search_rowid;
// TODO Replace this with same code than into list.php
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, property_exists($object, 'module') ? $object->module : '');
}
}
// End of page
llxFooter();
$db->close();

View file

@ -1224,26 +1224,17 @@ if ($action == 'create') {
//$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->hasRight('facture', 'creer'), 'string', '', 0, 1);
//$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->hasRight('facture', 'creer'), 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
$morehtmlref .= $object->thirdparty->getNomUrl(1, 'customer');
// Project
if (isModEnabled('project')) {
$langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
$morehtmlref .= '<br>';
if ($user->hasRight('facture', 'creer')) {
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
}
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
} else {
if (!empty($object->fk_project)) {
$proj = new Project($db);

View file

@ -3210,7 +3210,7 @@ if ($action == 'create') {
} else {
print '<tr><td class="fieldrequired">'.$langs->trans('Customer').'</td>';
print '<td colspan="2">';
$filter = '((s.client:=:1,3) AND (s.status:=:1))';
$filter = '((s.client:IN:1,2,3) AND (s.status:=:1))';
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company($soc->id, 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
// Option to reload page to retrieve customer informations.
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
@ -3688,7 +3688,7 @@ if ($action == 'create') {
// Payment term
print '<tr><td class="nowrap fieldrequired">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
print img_picto('', 'payment', 'class="pictofixedwidth"');
print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id', 'int') != 0) ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id', -1, 1);
print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id', 'int') != 0) ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id', -1, 1, 0, 'maxwidth500 widthcentpercentminusx');
print '</td></tr>';

View file

@ -1214,6 +1214,7 @@ class FactureRec extends CommonInvoice
return -1;
}
}
return -1;
}
@ -1648,6 +1649,44 @@ class FactureRec extends CommonInvoice
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
}
/**
* Load miscellaneous information for tab "Info"
*
* @param int $id Id of object to load
* @return void
*/
public function info($id)
{
$sql = 'SELECT c.rowid, datec, tms as datem,';
$sql .= ' fk_user_author, fk_user_modif';
$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as c';
$sql .= ' WHERE c.rowid = '.((int) $id);
$result = $this->db->query($sql);
if ($result) {
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
if ($obj->fk_user_author) {
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_modif) {
$muser = new User($this->db);
$muser->fetch($obj->fk_user_modif);
$this->user_modification = $muser;
}
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem);
}
$this->db->free($result);
} else {
dol_print_error($this->db);
}
}
/**
* Initialise an instance with random values.
* Used to build previews or test instances.

View file

@ -92,7 +92,7 @@ print '</a>';
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("AmountToTransfer").'</td>';
print '<td class="right"><span class="amount">';
print '<td class="right"><span class="amount nowraponall">';
print price($bprev->SommeAPrelever('bank-transfer'), '', '', 1, -1, -1, 'auto');
print '</span></td></tr></table></div><br>';

View file

@ -126,7 +126,7 @@ class LignePrelevement
*
* @param int $status Id status
* @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto
* @return string Label
* @return null|string Label
*/
public function LibStatut($status, $mode = 0)
{
@ -160,7 +160,6 @@ class LignePrelevement
return $langs->trans($this->statuts[$status]).' '.img_picto($langs->transnoentitiesnoconv($this->statuts[$status]), 'statut8', 'class="valignmiddle"');
}
}
//return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}

View file

@ -125,19 +125,19 @@ if ($resql) {
//print $st[$row[2]];
print '</td>';
print '<td align="center">';
print '<td align="center nowraponall">';
print $row[1];
print '</td>';
print '<td class="right">';
print '<td class="right nowraponall">';
print round($row[1] / $nbtotal * 100, 2)." %";
print '</td>';
print '<td class="right amount">';
print '<td class="right amount nowraponall">';
print price($row[0]);
print '</td>';
print '<td class="right">';
print '<td class="right nowraponall">';
print round($row[0] / $total * 100, 2)." %";
print '</td>';
@ -147,7 +147,7 @@ if ($resql) {
}
print '<tr class="liste_total"><td class="right">'.$langs->trans("Total").'</td>';
print '<td class="center">'.$nbtotal.'</td><td>&nbsp;</td><td class="right">';
print '<td class="center nowraponall">'.$nbtotal.'</td><td>&nbsp;</td><td class="right nowraponall">';
print price($total);
print '</td><td class="right">&nbsp;</td>';
print "</tr></table>";

View file

@ -501,6 +501,7 @@ class Cchargesociales
return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
}
}
return "";
}

View file

@ -730,8 +730,10 @@ class ChargeSociales extends CommonObject
}
$this->db->free($result);
return 1;
} else {
dol_print_error($this->db);
return -1;
}
}

View file

@ -1552,8 +1552,11 @@ class Contact extends CommonObject
if ($withpicto) {
if ($withpicto < 0) {
$result .= '<!-- picto photo user --><span class="nopadding userimg'.($morecss ? ' '.$morecss : '').'">'.Form::showphoto('contact', $this, 0, 0, 0, 'userphoto'.($withpicto == -3 ? 'small' : ''), 'mini', 0, 1).'</span>';
if ($withpicto != 2 && $withpicto != -2) {
$result .= ' ';
}
} else {
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'"'), 0, 0, $notooltip ? 0 : 1);
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="pictofixedwidth"' : '') : 'class="'.(($withpicto != 2) ? 'pictofixedwidth ' : '').'"'), 0, 0, $notooltip ? 0 : 1);
}
}
if ($withpicto != 2 && $withpicto != -2) {
@ -2210,7 +2213,7 @@ class Contact extends CommonObject
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'thirdparty') && is_object($this->thirdparty)) {
$return .= '<div class="info-box-ref opacitymedium tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>';
$return .= '<div class="info-box-ref tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>';
}
/*if (property_exists($this, 'phone_pro') && !empty($this->phone_pro)) {
$return .= '<br>'.img_picto($langs->trans("Phone"), 'phone');

View file

@ -1347,7 +1347,7 @@ while ($i < $imaxinloop) {
// (Last) Name
if (!empty($arrayfields['p.lastname']['checked'])) {
print '<td class="middle tdoverflowmax150">';
print $contactstatic->getNomUrl(1);
print $contactstatic->getNomUrl(-1);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;

View file

@ -21,21 +21,21 @@
/**
* \file htdocs/core/boxes/box_clients.php
* \ingroup societes
* \brief Module de generation de l'affichage de la box clients
* \brief Module for generating box to show last customers
*/
include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
/**
* Class to manage the box to show last thirdparties
* Class to manage the box to show last customers
*/
class box_clients extends ModeleBoxes
{
public $boxcode = "lastcustomers";
public $boximg = "object_company";
public $boxcode = "lastcustomers";
public $boximg = "object_company";
public $boxlabel = "BoxLastCustomers";
public $depends = array("societe");
public $depends = array("societe");
/**
* @var DoliDB Database handler.

View file

@ -24,14 +24,14 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
/**
* Class to manage the box to show last invoices
* Class to manage the box to show invoices per month graph
*/
class box_graph_invoices_permonth extends ModeleBoxes
{
public $boxcode = "invoicespermonth";
public $boximg = "object_bill";
public $boxcode = "invoicespermonth";
public $boximg = "object_bill";
public $boxlabel = "BoxCustomersInvoicesPerMonth";
public $depends = array("facture");
public $depends = array("facture");
/**
* @var DoliDB Database handler.

View file

@ -34,7 +34,7 @@ class box_mos extends ModeleBoxes
{
public $boxcode = "lastmos";
public $boximg = "object_mrp";
public $boxlabel = "BoxTitleLatestModifiedMOs";
public $boxlabel = "BoxTitleLatestModifiedMos";
public $depends = array("mrp");
/**

View file

@ -2,7 +2,7 @@
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2021 Frederic France <frederic.france@netlogic.fr>
* Copyright (C) 2015-2023 Frederic France <frederic.france@netlogic.fr>
*
* 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
@ -61,8 +61,8 @@ class box_produits extends ModeleBoxes
$this->db = $db;
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
$tmpentry = array('enabled'=>(isModEnabled("product") || isModEnabled("service")), 'perms'=>(!empty($user->rights->produit->lire) || $user->hasRight('service', 'lire')), 'module'=>'product|service');
$listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL'));
$tmpentry = array('enabled'=>(isModEnabled("product") || isModEnabled("service")), 'perms'=>($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire')), 'module'=>'product|service');
$showmode = isVisibleToUserType(($user->socid > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal);
$this->hidden = ($showmode != 1);
}
@ -84,7 +84,7 @@ class box_produits extends ModeleBoxes
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastProducts", $max));
if ($user->rights->produit->lire || $user->hasRight('service', 'lire')) {
if ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire')) {
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.fk_price_expression, p.entity";
$sql .= ", p.accountancy_code_sell";
$sql .= ", p.accountancy_code_sell_intra";
@ -95,10 +95,10 @@ class box_produits extends ModeleBoxes
$sql .= ', p.barcode';
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
$sql .= ' WHERE p.entity IN ('.getEntity($productstatic->element).')';
if (empty($user->rights->produit->lire)) {
if (!$user->hasRight('produit', 'lire')) {
$sql .= ' AND p.fk_product_type != 0';
}
if (empty($user->rights->service->lire)) {
if (!$user->hasRight('service', 'lire')) {
$sql .= ' AND p.fk_product_type != 1';
}
// Add where from hooks

View file

@ -1711,7 +1711,7 @@ class CMailFile
// tls smtp start with no encryption
//if (!empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) && function_exists('openssl_open')) $host='tls://'.$host;
dol_syslog("Try socket connection to host=".$host." port=".$port);
dol_syslog("Try socket connection to host=".$host." port=".$port." timeout=".$timeout);
//See if we can connect to the SMTP server
$errno = 0; $errstr = '';
if ($socket = @fsockopen(

View file

@ -272,7 +272,7 @@ abstract class CommonDocGenerator
'mycompany_idprof5'=>$mysoc->idprof5,
'mycompany_idprof6'=>$mysoc->idprof6,
'mycompany_vatnumber'=>$mysoc->tva_intra,
'mycompany_object'=>$mysoc->object,
'mycompany_socialobject'=>$mysoc->socialobject,
'mycompany_note_private'=>$mysoc->note_private,
//'mycompany_note_public'=>$mysoc->note_public, // Only private not exists for "mysoc" but both for thirdparties
);
@ -516,11 +516,11 @@ abstract class CommonDocGenerator
$array_key.'_incoterms' => (method_exists($object, 'display_incoterms') ? $object->display_incoterms() : ''),
$array_key.'_bank_iban'=>$bank_account->iban,
$array_key.'_bank_bic'=>$bank_account->bic,
$array_key.'_bank_label'=>$bank_account->label,
$array_key.'_bank_number'=>$bank_account->number,
$array_key.'_bank_proprio'=>$bank_account->proprio,
$array_key.'_bank_iban' => (!empty($bank_account) ? $bank_account->iban : ''),
$array_key.'_bank_bic' => (!empty($bank_account) ? $bank_account->bic : ''),
$array_key.'_bank_label' => (!empty($bank_account) ? $bank_account->label : ''),
$array_key.'_bank_number' => (!empty($bank_account) ? $bank_account->number : ''),
$array_key.'_bank_proprio' => (!empty($bank_account) ? $bank_account->proprio : ''),
$array_key.'_total_ht_locale'=>price($object->total_ht, 0, $outputlangs),
$array_key.'_total_vat_locale'=>(!empty($object->total_vat) ?price($object->total_vat, 0, $outputlangs) : price($object->total_tva, 0, $outputlangs)),

View file

@ -56,7 +56,7 @@ abstract class CommonOrder extends CommonObject
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'thirdparty') && is_object($this->thirdparty)) {
$return .= '<br><div class="info-box-ref opacitymedium tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>';
$return .= '<br><div class="info-box-ref tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>';
}
if (property_exists($this, 'total_ht')) {
$return .= '<div class="info-box-ref amount">'.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency).' '.$langs->trans('HT').'</div>';

View file

@ -56,11 +56,13 @@ class DolGeoIP
if ($type == 'country') {
// geoip may have been already included with PEAR
if ($geoipversion == '2' || ($geoipversion != 'php' && !function_exists('geoip_country_code_by_name'))) {
stream_wrapper_restore('phar');
require_once DOL_DOCUMENT_ROOT.'/includes/geoip2/geoip2.phar';
}
} elseif ($type == 'city') {
// geoip may have been already included with PEAR
if ($geoipversion == '2' || ($geoipversion != 'php' && !function_exists('geoip_country_code_by_name'))) {
stream_wrapper_restore('phar');
require_once DOL_DOCUMENT_ROOT.'/includes/geoip2/geoip2.phar';
}
} else {

View file

@ -999,9 +999,9 @@ class ExtraFields
} elseif ($type == 'radio') {
$morecss = 'width25';
} else {
if (empty($size) || round($size) < 12) {
if (empty($size) || round((float) $size) < 12) {
$morecss = 'minwidth100';
} elseif (round($size) <= 48) {
} elseif (round((float) $size) <= 48) {
$morecss = 'minwidth200';
} else {
$morecss = 'minwidth400';

View file

@ -77,7 +77,7 @@ class HookManager
* Then when a hook executeHooks('aMethod'...) is called, the method aMethod found into class will be executed.
*
* @param string[] $arraycontext Array list of searched hooks tab/features. For example: 'thirdpartycard' (for hook methods into page card thirdparty), 'thirdpartydao' (for hook methods into Societe), ...
* @return int|void Always 1
* @return int 0 or 1
*/
public function initHooks($arraycontext)
{
@ -85,7 +85,7 @@ class HookManager
// Test if there is hooks to manage
if (!is_array($conf->modules_parts['hooks']) || empty($conf->modules_parts['hooks'])) {
return;
return 0;
}
// For backward compatibility

View file

@ -1591,9 +1591,9 @@ class Form
if (empty($outputmode)) {
if (in_array($obj->rowid, $selected)) {
$out .= '<option value="' . $obj->rowid . '" selected data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label) . '</option>';
$out .= '<option value="' . $obj->rowid . '" selected data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
} else {
$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label) . '</option>';
$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
}
} else {
array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml));
@ -3547,7 +3547,25 @@ class Form
$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1);
}
$optlabel = $objp->ref;
switch ($objp->fk_product_type) {
case Product::TYPE_PRODUCT:
$picto = 'product';
break;
case Product::TYPE_SERVICE:
$picto = 'service';
break;
default:
$picto = '';
break;
}
if (empty($picto)) {
$optlabel = '';
} else {
$optlabel = img_object('', $picto, 'class="paddingright classfortooltip"', 0, 0, 1);
}
$optlabel .= $objp->ref;
if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
$optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>';
}
@ -8120,19 +8138,23 @@ class Form
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$label = '';
$labelhtml = '';
$tmparray = explode(',', $fieldstoshow);
$oldvalueforshowoncombobox = 0;
foreach ($tmparray as $key => $val) {
$val = preg_replace('/t\./', '', $val);
$label .= (($label && $obj->$val) ? ($oldvalueforshowoncombobox != $objecttmp->fields[$val]['showoncombobox'] ? ' - ' : ' ') : '');
$labelhtml .= (($label && $obj->$val) ? ($oldvalueforshowoncombobox != $objecttmp->fields[$val]['showoncombobox'] ? ' - ' : ' ') : '');
$label .= $obj->$val;
$oldvalueforshowoncombobox = !empty($objecttmp->fields[$val]['showoncombobox']) ? $objecttmp->fields[$val]['showoncombobox'] : 0;
$labelhtml .= $obj->$val;
$oldvalueforshowoncombobox = empty($objecttmp->fields[$val]['showoncombobox']) ? 0 : $objecttmp->fields[$val]['showoncombobox'];
}
if (empty($outputmode)) {
if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) {
$out .= '<option value="' . $obj->rowid . '" selected>' . $label . '</option>';
$out .= '<option value="' . $obj->rowid . '" selected data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
} else {
$out .= '<option value="' . $obj->rowid . '">' . $label . '</option>';
$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
}
} else {
array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label));

View file

@ -753,14 +753,14 @@ class FormCompany extends Form
if ($disabled) {
print ' disabled';
}
print ' selected>' . dol_trunc($obj->name, 24) . '</option>';
print ' selected>' . dol_escape_htmltag($obj->name, 0, 0, '', 0, 1) . '</option>';
$firstCompany = $obj->rowid;
} else {
print '<option value="' . $obj->rowid . '"';
if ($disabled) {
print ' disabled';
}
print '>' . dol_trunc($obj->name, 24) . '</option>';
print '>' . dol_escape_htmltag($obj->name, 0, 0, '', 0, 1) . '</option>';
}
$i++;
}

View file

@ -75,7 +75,7 @@ class FormExpenseReport
}
foreach ($arrayoflabels as $key => $val) {
if ($selected != '' && $selected == $key) {
$html .= '<option value="'.$key.'" selected>';;
$html .= '<option value="'.$key.'" selected>';
} else {
$html .= '<option value="'.$key.'">';
}

View file

@ -825,17 +825,18 @@ class FormOther
/**
* Output a HTML code to select a color. Field will return an hexa color like '334455'.
*
* @param string $set_color Pre-selected color
* @param string $prefix Name of HTML field
* @param string $form_name Deprecated. Not used.
* @param int $showcolorbox 1=Show color code and color box, 0=Show only color code
* @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813')
* @param string $morecss Add css style into input field
* @param string $set_color Pre-selected color
* @param string $prefix Name of HTML field
* @param string $form_name Deprecated. Not used.
* @param int $showcolorbox 1=Show color code and color box, 0=Show only color code
* @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813')
* @param string $morecss Add css style into input field
* @param string $setpropertyonselect Set this property after selecting a color
* @param string $default Default color
* @return string
* @see showColor()
*/
public static function selectColor($set_color = '', $prefix = 'f_color', $form_name = '', $showcolorbox = 1, $arrayofcolors = '', $morecss = '', $setpropertyonselect = '')
public static function selectColor($set_color = '', $prefix = 'f_color', $form_name = '', $showcolorbox = 1, $arrayofcolors = '', $morecss = '', $setpropertyonselect = '', $default = '')
{
// Deprecation warning
if ($form_name) {
@ -847,8 +848,9 @@ class FormOther
$out = '';
if (!is_array($arrayofcolors) || count($arrayofcolors) < 1) {
// Case of selection of any color
$langs->load("other");
if (empty($conf->dol_use_jmobile) && !empty($conf->use_javascript_ajax)) {
if (empty($conf->dol_use_jmobile) && !empty($conf->use_javascript_ajax) && !getDolGlobalInt('MAIN_USE_HTML5_COLOR_SELECTOR')) {
$out .= '<link rel="stylesheet" media="screen" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/css/jPicker-1.1.6.css" />';
$out .= '<script nonce="'.getNonce().'" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/jpicker-1.1.6.js"></script>';
$out .= '<script nonce="'.getNonce().'" type="text/javascript">
@ -913,9 +915,31 @@ class FormOther
);
});
</script>';
$out .= '<input id="colorpicker'.$prefix.'" name="'.$prefix.'" size="6" maxlength="7" class="flat valignmiddle'.($morecss ? ' '.$morecss : '').'" type="text" value="'.dol_escape_htmltag($set_color).'" />';
} else {
$out .= '<input id="colorpicker'.$prefix.'" name="'.$prefix.'" size="6" maxlength="7" class="flat input-nobottom colorselector valignmiddle '.($morecss ? ' '.$morecss : '').'" type="color" value="#'.dol_escape_htmltag($set_color !== '' ? $set_color : $default).'" />';
$out .= '<script nonce="'.getNonce().'" type="text/javascript">
jQuery(document).ready(function(){
var originalhex = null;
jQuery("#colorpicker'.$prefix.'").on(\'change\', function() {
var hex = jQuery("#colorpicker'.$prefix.'").val();
console.log("new color selected in input color "+hex+" setpropertyonselect='.dol_escape_js($setpropertyonselect).'");';
if ($setpropertyonselect) {
$out .= 'if (originalhex == null) {';
$out .= ' originalhex = getComputedStyle(document.querySelector(":root")).getPropertyValue(\'--'.dol_escape_js($setpropertyonselect).'\');';
$out .= ' console.log("original color is saved into originalhex = "+originalhex);';
$out .= '}';
$out .= 'if (hex != null) {';
$out .= ' document.documentElement.style.setProperty(\'--'.dol_escape_js($setpropertyonselect).'\', hex);';
$out .= '}';
}
$out .= '
});
});
</script>';
}
$out .= '<input id="colorpicker'.$prefix.'" name="'.$prefix.'" size="6" maxlength="7" class="flat'.($morecss ? ' '.$morecss : '').'" type="text" value="'.dol_escape_htmltag($set_color).'" />';
} else { // In most cases, this is not used. We used instead function with no specific list of colors
} else {
// In most cases, this is not used. We used instead function with no specific list of colors
if (empty($conf->dol_use_jmobile) && !empty($conf->use_javascript_ajax)) {
$out .= '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.css" type="text/css" media="screen" />';
$out .= '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.js" type="text/javascript"></script>';

View file

@ -1477,10 +1477,20 @@ class FormTicket
print '<input type="submit" class="button" value="'.$langs->trans('Apply').'" name="modelselected" id="modelselected">';
print '</div></td>';
}
// Subject
// Subject/topic
$topic = "";
foreach ($formmail->lines_model as $line) {
if ($this->param['models_id'] == $line->id) {
$topic = $line->topic;
break;
}
}
print '<tr class="email_line"><td>'.$langs->trans('Subject').'</td>';
print '<td><input type="text" class="text minwidth500" name="subject" value="['.getDolGlobalString('MAIN_INFO_SOCIETE_NOM').' - '.$langs->trans("Ticket").' '.$ticketstat->ref.'] '.$langs->trans('TicketNewMessage').'" />';
if (empty($topic)) {
print '<td><input type="text" class="text minwidth500" name="subject" value="['.getDolGlobalString('MAIN_INFO_SOCIETE_NOM').' - '.$langs->trans("Ticket").' '.$ticketstat->ref.'] '.$langs->trans('TicketNewMessage').'" />';
} else {
print '<td><input type="text" class="text minwidth500" name="subject" value="['.getDolGlobalString('MAIN_INFO_SOCIETE_NOM').' - '.$langs->trans("Ticket").' '.$ticketstat->ref.'] '.$topic.'" />';
}
print '</td></tr>';
// Recipients / adressed-to

View file

@ -51,9 +51,9 @@ class DoliDBMysqli extends DoliDB
*
* @param string $type Type of database (mysql, pgsql...)
* @param string $host Address of database server
* @param string $user Nom de l'utilisateur autorise
* @param string $pass Mot de passe
* @param string $name Nom de la database
* @param string $user Name of database user
* @param string $pass Password of database user
* @param string $name Name of database
* @param int $port Port of database server
*/
public function __construct($type, $host, $user, $pass, $name = '', $port = 0)
@ -233,15 +233,16 @@ class DoliDBMysqli extends DoliDB
//mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
// Can also be
// mysqli::init(); mysql::options(MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0'); mysqli::options(MYSQLI_OPT_CONNECT_TIMEOUT, 5);
// return mysqli::real_connect($host, $user, $pass, $db, $port);
$tmp = false;
try {
if (!class_exists('mysqli')) {
dol_print_error('', 'Driver mysqli for PHP not available');
}
$tmp = new mysqli($host, $login, $passwd, $name, $port);
if (strpos($host, 'ssl://') === 0) {
$tmp = new mysqliDoli($host, $login, $passwd, $name, $port);
} else {
$tmp = new mysqli($host, $login, $passwd, $name, $port);
}
} catch (Exception $e) {
dol_syslog(get_class($this)."::connect failed", LOG_DEBUG);
}
@ -341,7 +342,7 @@ class DoliDBMysqli extends DoliDB
$this->lasterror = $this->error();
$this->lasterrno = $this->errno();
if ($conf->global->SYSLOG_LEVEL < LOG_DEBUG) {
if (getDolGlobalInt('SYSLOG_LEVEL') < LOG_DEBUG) {
dol_syslog(get_class($this)."::query SQL Error query: ".$query, LOG_ERR); // Log of request was not yet done previously
}
dol_syslog(get_class($this)."::query SQL Error message: ".$this->lasterrno." ".$this->lasterror, LOG_ERR);
@ -1236,3 +1237,33 @@ class DoliDBMysqli extends DoliDB
return $result;
}
}
/**
* Class to make SSL connection
*/
class mysqliDoli extends mysqli
{
/**
* Constructor.
* This create an opened connexion to a database server and eventually to a database
*
* @param string $host Address of database server
* @param string $user Name of database user
* @param string $pass Password of database user
* @param string $name Name of database
* @param int $port Port of database server
* @param string $socket Socket
*/
public function __construct($host, $user, $pass, $name, $port = 0, $socket = "")
{
$flags = 0;
parent::init();
if (strpos($host, 'ssl://') === 0) {
$host = substr($host, 6);
parent::options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, false);
parent::ssl_set(null, null, "", null, null);
$flags = MYSQLI_CLIENT_SSL;
}
parent::real_connect($host, $user, $pass, $name, $port, $socket, $flags);
}
}

View file

@ -627,7 +627,7 @@ function ajax_event($htmlname, $events)
* @param string $morecss More CSS
* @return string
*/
function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0, $setzeroinsteadofdel = 0, $suffix = '', $mode = '', $morecss = '')
function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0, $setzeroinsteadofdel = 0, $suffix = '', $mode = '', $morecss = 'inline-block')
{
global $conf, $langs, $user;
@ -685,8 +685,8 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
</script>'."\n";
$out .= '<div id="confirm_'.$code.'" title="" style="display: none;"></div>';
$out .= '<span id="set_'.$code.'" class="valignmiddle linkobject '.(!empty($conf->global->$code) ? 'hideobject' : '').'">'.($revertonoff ?img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).'</span>';
$out .= '<span id="del_'.$code.'" class="valignmiddle linkobject '.(!empty($conf->global->$code) ? '' : 'hideobject').'">'.($revertonoff ?img_picto($langs->trans("Disabled"), 'switch_off'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort)).'</span>';
$out .= '<span id="set_'.$code.'" class="valignmiddle inline-block linkobject '.(!empty($conf->global->$code) ? 'hideobject' : '').'">'.($revertonoff ?img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).'</span>';
$out .= '<span id="del_'.$code.'" class="valignmiddle inline-block linkobject '.(!empty($conf->global->$code) ? '' : 'hideobject').'">'.($revertonoff ?img_picto($langs->trans("Disabled"), 'switch_off'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort)).'</span>';
$out .= "\n";
}

View file

@ -1672,8 +1672,12 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$sql .= ", ".MAIN_DB_PREFIX."bom_bom as o";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') {
$sql .= ", ".MAIN_DB_PREFIX."contrat as o";
} elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && (!empty($filterobj->fields['ref']) && is_array($filterobj->fields['ref']) || $filterobj->fields['label'] && is_array($filterobj->fields['label'])) && $filterobj->table_element && $filterobj->element) {
} elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid'])
&& ((!empty($filterobj->fields['ref']) && is_array($filterobj->fields['ref'])) || (!empty($filterobj->fields['label']) && is_array($filterobj->fields['label'])) || (!empty($filterobj->fields['titre']) && is_array($filterobj->fields['titre'])))
&& $filterobj->table_element && $filterobj->element) {
$sql .= ", ".MAIN_DB_PREFIX.$filterobj->table_element." as o";
} elseif (is_object($filterobj)) {
return 'Bad value for $filterobj';
}
$sql .= " WHERE a.entity IN (".getEntity('agenda').")";
@ -1724,12 +1728,16 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
if ($filterobj->id) {
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
}
} elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && (!empty($filterobj->fields['ref']) && is_array($filterobj->fields['ref']) || $filterobj->fields['label'] && is_array($filterobj->fields['label'])) && $filterobj->table_element && $filterobj->element) {
// Generic case
} elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid'])
&& ((!empty($filterobj->fields['ref']) && is_array($filterobj->fields['ref'])) || (!empty($filterobj->fields['label']) && is_array($filterobj->fields['label'])) || (!empty($filterobj->fields['titre']) && is_array($filterobj->fields['titre'])))
&& $filterobj->table_element && $filterobj->element) {
// Generic case (if there is a $filterobj and a field rowid and (ref or label) exists.
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = '".$db->escape($filterobj->element).($module ? "@".$module : "")."'";
if ($filterobj->id) {
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
}
} elseif (is_object($filterobj)) {
return 'Bad value for $filterobj';
}
}

View file

@ -163,7 +163,7 @@ function dol_convertToWord($num, $langs, $currency = '', $centimes = false)
* @param float $numero Number to convert
* @param Translate $langs Language
* @param string $numorcurrency 'number' or 'amount'
* @return string Text of the number or -1 in case TOO LONG (more than 1000000000000.99)
* @return string|int Text of the number or -1 in case TOO LONG (more than 1000000000000.99)
*/
function dolNumberToWord($numero, $langs, $numorcurrency = 'number')
{

View file

@ -250,7 +250,7 @@ function invoice_admin_prepare_head()
*/
function invoice_rec_prepare_head($object)
{
global $db, $langs, $conf;
global $db, $langs, $conf, $user;
$h = 0;
$head = array();
@ -260,6 +260,40 @@ function invoice_rec_prepare_head($object)
$head[$h][2] = 'card';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/agenda-rec.php?id='.$object->id;
$head[$h][1] = $langs->trans("Events");
if (isModEnabled('agenda')&& ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) {
$nbEvent = 0;
// Enable caching of thirdparty count actioncomm
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_events_facturerec_'.$object->id;
$dataretrieved = dol_getcache($cachekey);
if (!is_null($dataretrieved)) {
$nbEvent = $dataretrieved;
} else {
$sql = "SELECT COUNT(id) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm";
$sql .= " WHERE fk_element = ".((int) $object->id);
$sql .= " AND elementtype = 'invoicerec'";
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
$nbEvent = $obj->nb;
} else {
dol_syslog('Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
}
dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result.
}
$head[$h][1] .= '/';
$head[$h][1] .= $langs->trans("Agenda");
if ($nbEvent > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbEvent.'</span>';
}
}
$head[$h][2] = 'agenda';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab

View file

@ -90,7 +90,7 @@ function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1)
if ($mode == 1) {
$out .= "hash('".$securekeyseed."' + '".$type."' + proposal_ref)";
} else {
$out .= '&securekey='.dol_hash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $object->entity), '0');
$out .= '&securekey='.dol_hash($securekeyseed.$type.$ref.(isModEnabled('multicompany') ? (is_null($object) ? '' : $object->entity) : ''), '0');
}
/*
if ($mode == 1) {
@ -129,7 +129,7 @@ function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1)
if ($mode == 1) {
$out .= "hash('".$securekeyseed."' + '".$type."' + contract_ref)";
} else {
$out .= '&securekey='.dol_hash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $object->entity), '0');
$out .= '&securekey='.dol_hash($securekeyseed.$type.$ref.(isModEnabled('multicompany') ? (is_null($object) ? '' : $object->entity) : ''), '0');
}
} elseif ($type == 'fichinter') {
$securekeyseed = isset($conf->global->FICHINTER_ONLINE_SIGNATURE_SECURITY_TOKEN) ? $conf->global->FICHINTER_ONLINE_SIGNATURE_SECURITY_TOKEN : '';
@ -144,13 +144,13 @@ function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1)
if ($mode == 1) {
$out .= "hash('".$securekeyseed."' + '".$type."' + fichinter_ref)";
} else {
$out .= '&securekey='.dol_hash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $object->entity), '0');
$out .= '&securekey='.dol_hash($securekeyseed.$type.$ref.(isModEnabled('multicompany') ? (is_null($object) ? '' : $object->entity) : ''), '0');
}
}
// For multicompany
if (!empty($out) && isModEnabled('multicompany')) {
$out .= "&entity=".$object->entity; // Check the entity because we may have the same reference in several entities
$out .= "&entity=".(is_null($object) ? '' : $object->entity); // Check the entity because we may have the same reference in several entities
}
return $out;

View file

@ -542,14 +542,15 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
// Nothing
} else {
// Show logo
print '<tr class="oddeven"><td class="titlefieldmiddle">'.$langs->trans("EnableShowLogo").'</td><td>';
print '<tr class="oddeven"><td class="titlefieldmiddle">'.$langs->trans("EnableShowLogo").'</td>';
print '<td colspan="'.($colspan - 1).'" class="valignmiddle">';
if ($edit) {
print ajax_constantonoff('MAIN_SHOW_LOGO', array(), null, 0, 0, 1);
//print $form->selectyesno('MAIN_SHOW_LOGO', $conf->global->MAIN_SHOW_LOGO, 1);
} else {
print yn($conf->global->MAIN_SHOW_LOGO);
print yn($conf->global->MAIN_SHOW_LOGO);
}
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes"));
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes"), 1, 'help', 'inline-block');
print '</td>';
print '</tr>';
/*
@ -562,14 +563,14 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
} else {
print '<tr class="oddeven">';
print '<td>'.$langs->trans("UseBorderOnTable").'</td>';
print '<td colspan="'.($colspan - 1).'">';
print '<td colspan="'.($colspan - 1).'" class="valignmiddle">';
if ($edit) {
print ajax_constantonoff('THEME_ELDY_USEBORDERONTABLE', array(), null, 0, 0, 1);
//print $form->selectyesno('THEME_ELDY_USEBORDERONTABLE', $conf->global->THEME_ELDY_USEBORDERONTABLE, 1);
} else {
print yn($conf->global->THEME_ELDY_USEBORDERONTABLE);
}
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes"));
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes"), 1, 'help', 'inline-block');
print '</td>';
print '</tr>';
}
@ -597,12 +598,13 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
print '</td>';*/
} else {
$default = 'ffffff';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("BackgroundColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
//var_dump($conf->global->THEME_ELDY_BACKBODY);
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_BACKBODY) ? $conf->global->THEME_ELDY_BACKBODY : ''), array()), ''), 'THEME_ELDY_BACKBODY', '', 1, '', '', 'colorbackbody').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_BACKBODY) ? $conf->global->THEME_ELDY_BACKBODY : ''), array()), ''), 'THEME_ELDY_BACKBODY', '', 1, '', '', 'colorbackbody', $default).' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), '');
if ($color) {
@ -611,7 +613,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print $langs->trans("Default");
}
}
print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>ffffff</strong> ';
print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
print '</td>';
print '</tr>';
@ -646,7 +648,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TOPMENU_BACK1) ? $conf->global->THEME_ELDY_TOPMENU_BACK1 : ''), array()), ''), 'THEME_ELDY_TOPMENU_BACK1', '', 1, '', '', 'colorbackhmenu1').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TOPMENU_BACK1) ? $conf->global->THEME_ELDY_TOPMENU_BACK1 : ''), array()), ''), 'THEME_ELDY_TOPMENU_BACK1', '', 1, '', '', 'colorbackhmenu1', $default).' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), '');
if ($color) {
@ -690,7 +692,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("LeftMenuBackgroundColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_VERMENU_BACK1) ? $conf->global->THEME_ELDY_VERMENU_BACK1 : ''), array()), ''), 'THEME_ELDY_VERMENU_BACK1', '', 1, '', '', 'colorbackvmenu1').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_VERMENU_BACK1) ? $conf->global->THEME_ELDY_VERMENU_BACK1 : ''), array()), ''), 'THEME_ELDY_VERMENU_BACK1', '', 1, '', '', 'colorbackvmenu1', $default).' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), '');
if ($color) {
@ -714,7 +716,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("TextTitleColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTTITLENOTAB) ? $conf->global->THEME_ELDY_TEXTTITLENOTAB : ''), array()), ''), 'THEME_ELDY_TEXTTITLENOTAB', '', 1, '', '', 'colortexttitlenotab').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTTITLENOTAB) ? $conf->global->THEME_ELDY_TEXTTITLENOTAB : ''), array()), ''), 'THEME_ELDY_TEXTTITLENOTAB', '', 1, '', '', 'colortexttitlenotab', $default).' ';
} else {
print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default"));
}
@ -734,7 +736,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_BACKTITLE1) ? $conf->global->THEME_ELDY_BACKTITLE1 : ''), array()), ''), 'THEME_ELDY_BACKTITLE1', '', 1, '', '', 'colorbacktitle1').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_BACKTITLE1) ? $conf->global->THEME_ELDY_BACKTITLE1 : ''), array()), ''), 'THEME_ELDY_BACKTITLE1', '', 1, '', '', 'colorbacktitle1', $default).' ';
} else {
print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default"));
}
@ -754,7 +756,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("BackgroundTableTitleTextColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTTITLE) ? $conf->global->THEME_ELDY_TEXTTITLE : ''), array()), ''), 'THEME_ELDY_TEXTTITLE', '', 1, '', '', 'colortexttitle').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTTITLE) ? $conf->global->THEME_ELDY_TEXTTITLE : ''), array()), ''), 'THEME_ELDY_TEXTTITLE', '', 1, '', '', 'colortexttitle', $default).' ';
} else {
print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default"));
}
@ -774,7 +776,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("BackgroundTableTitleTextlinkColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTTITLELINK) ? $conf->global->THEME_ELDY_TEXTTITLELINK : ''), array()), ''), 'THEME_ELDY_TEXTTITLELINK', '', 1, '', '', 'colortexttitlelink').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTTITLELINK) ? $conf->global->THEME_ELDY_TEXTTITLELINK : ''), array()), ''), 'THEME_ELDY_TEXTTITLELINK', '', 1, '', '', 'colortexttitlelink', $default).' ';
} else {
print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLELINK, $langs->trans("Default"));
}
@ -795,7 +797,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_LINEIMPAIR1) ? $conf->global->THEME_ELDY_LINEIMPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEIMPAIR1', '', 1, '', '', 'colorbacklineimpair2').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_LINEIMPAIR1) ? $conf->global->THEME_ELDY_LINEIMPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEIMPAIR1', '', 1, '', '', 'colorbacklineimpair2', $default).' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), '');
if ($color) {
@ -819,7 +821,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_LINEPAIR1) ? $conf->global->THEME_ELDY_LINEPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEPAIR1', '', 1, '', '', 'colorbacklinepair2').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_LINEPAIR1) ? $conf->global->THEME_ELDY_LINEPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEPAIR1', '', 1, '', '', 'colorbacklinepair2', $default).' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), '');
if ($color) {
@ -863,7 +865,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("LinkColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTLINK) ? $conf->global->THEME_ELDY_TEXTLINK : ''), array()), ''), 'THEME_ELDY_TEXTLINK', '', 1, '', '', 'colortextlink').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTLINK) ? $conf->global->THEME_ELDY_TEXTLINK : ''), array()), ''), 'THEME_ELDY_TEXTLINK', '', 1, '', '', 'colortextlink', $default).' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), '');
if ($color) {
@ -906,7 +908,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
} else {
$color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_HOVER) ? $conf->global->THEME_ELDY_USE_HOVER : ''), array()), '');
}
print $formother->selectColor($color, 'THEME_ELDY_USE_HOVER', '', 1, '', '', 'colorbacklinepairhover').' ';
print $formother->selectColor($color, 'THEME_ELDY_USE_HOVER', '', 1, '', '', 'colorbacklinepairhover', $default).' ';
} else {
if ($conf->global->THEME_ELDY_USE_HOVER == '1') {
$color = colorArrayToHex(colorStringToArray($colorbacklinepairhover));
@ -954,7 +956,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
} else {
$color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_CHECKED) ? $conf->global->THEME_ELDY_USE_CHECKED : ''), array()), '');
}
print $formother->selectColor($color, 'THEME_ELDY_USE_CHECKED', '', 1, '', '', 'colorbacklinepairchecked').' ';
print $formother->selectColor($color, 'THEME_ELDY_USE_CHECKED', '', 1, '', '', 'colorbacklinepairchecked', $default).' ';
} else {
if ($conf->global->THEME_ELDY_USE_CHECKED == '1') {
$color = 'e6edf0';
@ -1006,7 +1008,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("BtnActionColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_BTNACTION) ? $conf->global->THEME_ELDY_BTNACTION : ''), array()), ''), 'THEME_ELDY_BTNACTION', '', 1, '', '', 'butactionbg').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_BTNACTION) ? $conf->global->THEME_ELDY_BTNACTION : ''), array()), ''), 'THEME_ELDY_BTNACTION', '', 1, '', '', 'butactionbg', $default).' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BTNACTION, array()), '');
if ($color) {
@ -1052,7 +1054,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("TextBtnActionColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTBTNACTION) ? $conf->global->THEME_ELDY_TEXTBTNACTION : ''), array()), ''), 'THEME_ELDY_TEXTBTNACTION', '', 1, '', '', 'textbutaction').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTBTNACTION) ? $conf->global->THEME_ELDY_TEXTBTNACTION : ''), array()), ''), 'THEME_ELDY_TEXTBTNACTION', '', 1, '', '', 'textbutaction', $default).' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTBTNACTION, array()), '');
if ($color) {

View file

@ -51,109 +51,134 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
dol_syslog("functions_dolibarr::check_user_password_dolibarr usertotest=".$usertotest." passwordtotest=".preg_replace('/./', '*', $passwordtotest)." entitytotest=".$entitytotest);
// If test username/password asked, we define $test=false if ko and $login var to login if ok, set also $_SESSION["dol_loginmesg"] if ko
$table = MAIN_DB_PREFIX."user";
$usernamecol1 = 'login';
$usernamecol2 = 'email';
$entitycol = 'entity';
$sql = "SELECT rowid, login, entity, pass, pass_crypted, datestartvalidity, dateendvalidity, flagdelsessionsbefore";
$sql .= " FROM ".$table;
$sql .= " WHERE (".$usernamecol1." = '".$db->escape($usertotest)."'";
if (preg_match('/@/', $usertotest)) {
$sql .= " OR ".$usernamecol2." = '".$db->escape($usertotest)."'";
}
$sql .= ") AND ".$entitycol." IN (0,".($entity ? ((int) $entity) : 1).")";
$sql .= " AND statut = 1";
// Order is required to firstly found the user into entity, then the superadmin.
// For the case (TODO: we must avoid that) a user has renamed its login with same value than a user in entity 0.
$sql .= " ORDER BY entity DESC";
// Note: Test on validity is done later natively with isNotIntoValidityDateRange() by core after calling checkLoginPassEntity() that call this method
// Verification number of USER_LOGIN_FAILED
$dateverificationauth = dol_time_plus_duree(dol_now(), -1, 'd');
$userremoteip = getUserRemoteIP();
$nbevents = 0;
$sql = "SELECT COUNT(e.rowid) as nbevent";
$sql .= " FROM ".MAIN_DB_PREFIX."events as e";
$sql .= " WHERE e.type = 'USER_LOGIN_FAILED'";
$sql .= " AND e.ip = '".$db->escape($userremoteip)."'";
$sql .= " AND e.dateevent > '".$db->idate($dateverificationauth)."'";
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
if ($obj) {
$passclear = $obj->pass;
$passcrypted = $obj->pass_crypted;
$passtyped = $passwordtotest;
$nbevents = $obj->nbevent;
}
}
$passok = false;
if ($nbevents <= getDolGlobalInt("MAIN_SECURITY_MAX_NUMBER_FAILED_AUTH", 100)) {
// If test username/password asked, we define $test=false if ko and $login var to login if ok, set also $_SESSION["dol_loginmesg"] if ko
$table = MAIN_DB_PREFIX."user";
$usernamecol1 = 'login';
$usernamecol2 = 'email';
$entitycol = 'entity';
// Check crypted password
$cryptType = '';
if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) {
$cryptType = $conf->global->DATABASE_PWD_ENCRYPTED;
}
$sql = "SELECT rowid, login, entity, pass, pass_crypted, datestartvalidity, dateendvalidity, flagdelsessionsbefore";
$sql .= " FROM ".$table;
$sql .= " WHERE (".$usernamecol1." = '".$db->escape($usertotest)."'";
if (preg_match('/@/', $usertotest)) {
$sql .= " OR ".$usernamecol2." = '".$db->escape($usertotest)."'";
}
$sql .= ") AND ".$entitycol." IN (0,".($entity ? ((int) $entity) : 1).")";
$sql .= " AND statut = 1";
// Order is required to firstly found the user into entity, then the superadmin.
// For the case (TODO: we must avoid that) a user has renamed its login with same value than a user in entity 0.
$sql .= " ORDER BY entity DESC";
// By default, we use default setup for encryption rule
if (!in_array($cryptType, array('auto'))) {
$cryptType = 'auto';
}
// Check crypted password according to crypt algorithm
if ($cryptType == 'auto') {
if ($passcrypted && dol_verifyHash($passtyped, $passcrypted, '0')) {
$passok = true;
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ok - hash ".$cryptType." of pass is ok");
// Note: Test on validity is done later natively with isNotIntoValidityDateRange() by core after calling checkLoginPassEntity() that call this method
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
if ($obj) {
$passclear = $obj->pass;
$passcrypted = $obj->pass_crypted;
$passtyped = $passwordtotest;
$passok = false;
// Check crypted password
$cryptType = '';
if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) {
$cryptType = $conf->global->DATABASE_PWD_ENCRYPTED;
}
}
// For compatibility with very old versions
if (!$passok) {
if ((!$passcrypted || $passtyped)
&& ($passclear && ($passtyped == $passclear))) {
$passok = true;
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ok - found old pass in database", LOG_WARNING);
// By default, we use default setup for encryption rule
if (!in_array($cryptType, array('auto'))) {
$cryptType = 'auto';
}
// Check crypted password according to crypt algorithm
if ($cryptType == 'auto') {
if ($passcrypted && dol_verifyHash($passtyped, $passcrypted, '0')) {
$passok = true;
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ok - hash ".$cryptType." of pass is ok");
}
}
}
// Password ok ?
if ($passok) {
$login = $obj->login;
// For compatibility with very old versions
if (!$passok) {
if ((!$passcrypted || $passtyped)
&& ($passclear && ($passtyped == $passclear))) {
$passok = true;
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ok - found old pass in database", LOG_WARNING);
}
}
// Password ok ?
if ($passok) {
$login = $obj->login;
} else {
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO bad password for '".$usertotest."', cryptType=".$cryptType, LOG_NOTICE);
sleep(1); // Anti brut force protection. Must be same delay when login is not valid
// Load translation files required by the page
$langs->loadLangs(array('main', 'errors'));
$_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorBadLoginPassword");
}
// We must check entity
if ($passok && isModEnabled('multicompany')) { // We must check entity
global $mc;
if (!isset($mc)) {
!isModEnabled('multicompany'); // Global not available, disable $conf->multicompany->enabled for safety
} else {
$ret = $mc->checkRight($obj->rowid, $entitytotest);
if ($ret < 0) {
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO entity '".$entitytotest."' not allowed for user '".$obj->rowid."'", LOG_NOTICE);
$login = ''; // force authentication failure
if ($mc->db->lasterror()) {
$_SESSION["dol_loginmesg"] = $mc->db->lasterror();
}
}
}
}
} else {
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO bad password for '".$usertotest."', cryptType=".$cryptType, LOG_NOTICE);
sleep(1); // Anti brut force protection. Must be same delay when login is not valid
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO user not found for '".$usertotest."'", LOG_NOTICE);
sleep(1); // Anti brut force protection. Must be same delay when password is not valid
// Load translation files required by the page
$langs->loadLangs(array('main', 'errors'));
$_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorBadLoginPassword");
}
// We must check entity
if ($passok && isModEnabled('multicompany')) { // We must check entity
global $mc;
if (!isset($mc)) {
!isModEnabled('multicompany'); // Global not available, disable $conf->multicompany->enabled for safety
} else {
$ret = $mc->checkRight($obj->rowid, $entitytotest);
if ($ret < 0) {
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO entity '".$entitytotest."' not allowed for user '".$obj->rowid."'", LOG_NOTICE);
$login = ''; // force authentication failure
if ($mc->db->lasterror()) {
$_SESSION["dol_loginmesg"] = $mc->db->lasterror();
}
}
}
}
} else {
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO user not found for '".$usertotest."'", LOG_NOTICE);
sleep(1); // Anti brut force protection. Must be same delay when password is not valid
// Load translation files required by the page
$langs->loadLangs(array('main', 'errors'));
$_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorBadLoginPassword");
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO db error for '".$usertotest."' error=".$db->lasterror(), LOG_ERR);
sleep(1);
$_SESSION["dol_loginmesg"] = $db->lasterror();
}
} else {
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO db error for '".$usertotest."' error=".$db->lasterror(), LOG_ERR);
sleep(1);
$_SESSION["dol_loginmesg"] = $db->lasterror();
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO Too many attempts", LOG_NOTICE);
sleep(1); // Anti brut force protection. Must be same delay when password is not valid
// Load translation files required by the page
$langs->loadLangs(array('main', 'errors'));
$_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorTooManyAttempts");
}
}
return $login;
}

View file

@ -1155,12 +1155,12 @@ function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
$newmenu->add('/admin/system/database.php?mainmenu=home&amp;leftmenu=admintools', $langs->trans('InfoDatabase'), 1);
$newmenu->add("/admin/system/perf.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("InfoPerf"), 1);
$newmenu->add("/admin/system/security.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("InfoSecurity"), 1);
$newmenu->add("/admin/tools/listevents.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("Audit"), 1);
$newmenu->add("/admin/tools/listsessions.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("Sessions"), 1);
$newmenu->add("/admin/tools/dolibarr_export.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("Backup"), 1);
$newmenu->add("/admin/tools/dolibarr_import.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("Restore"), 1);
$newmenu->add("/admin/tools/update.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("MenuUpgrade"), 1);
$newmenu->add("/admin/tools/purge.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("Purge"), 1);
$newmenu->add("/admin/tools/listevents.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("Audit"), 1);
$newmenu->add("/admin/tools/listsessions.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("Sessions"), 1);
$newmenu->add('/admin/system/about.php?mainmenu=home&amp;leftmenu=admintools', $langs->trans('ExternalResources'), 1);
if (isModEnabled('product') || isModEnabled('service')) {

View file

@ -215,6 +215,7 @@ class CommActionRapport
return 1;
}
return 0;
}
/**

View file

@ -706,10 +706,18 @@ class pdf_standard_asset extends ModelePDFAsset
// retrieve global local tax
if ($localtax1_type && $localtax1ligne != 0) {
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
$this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
} else {
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
}
}
if ($localtax2_type && $localtax2ligne != 0) {
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
$this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
} else {
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
}
}
if (($object->lines[$i]->info_bits & 0x01) == 0x01) {

View file

@ -388,6 +388,6 @@ class pdf_ban extends ModeleBankAccountDoc
global $conf;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
//return pdf_pagefoot($pdf,$outputlangs,'BANK_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
return 1;
}
}

View file

@ -566,10 +566,18 @@ class pdf_einstein extends ModelePDFCommandes
// retrieve global local tax
if ($localtax1_type && $localtax1ligne != 0) {
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
$this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
} else {
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
}
}
if ($localtax2_type && $localtax2ligne != 0) {
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
$this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
} else {
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
}
}
if (($object->lines[$i]->info_bits & 0x01) == 0x01) {

View file

@ -784,10 +784,18 @@ class pdf_eratosthene extends ModelePDFCommandes
// retrieve global local tax
if ($localtax1_type && $localtax1ligne != 0) {
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
$this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
} else {
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
}
}
if ($localtax2_type && $localtax2ligne != 0) {
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
$this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
} else {
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
}
}
if (($object->lines[$i]->info_bits & 0x01) == 0x01) {

View file

@ -1109,6 +1109,7 @@ class pdf_standard extends ModeleExpenseReport
$this->error = $this->db->lasterror();
return -1;
}
return -1;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore

View file

@ -363,8 +363,8 @@ class ExportExcel2007 extends ModeleExports
if ($typefield == 'Text' || $typefield == 'TextAuto') {
// If $newvalue start with an equal sign we don't want it to be interpreted as a formula, so we add a '. Such transformation should be
// done by SetCellValueByColumnAndRow but it is not, so we do it ourself.
$newvalue = (dol_substr($newvalue, 0, 1) === '=' ? '\'' : '') . (string) $newvalue;
$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, (string) $newvalue);
$newvalue = (dol_substr($newvalue, 0, 1) === '=' ? '\'' : '') . $newvalue;
$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, $newvalue);
$coord = $this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row + 1)->getCoordinate();
$this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('@');
$this->workbook->getActiveSheet()->getStyle($coord)->getAlignment()->setHorizontal(PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT);

View file

@ -330,12 +330,13 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$object->fetchObjectLinked('', '', '', '');
//print_r($object->linkedObjects['propal']); exit;
$array_propal_object = $object->linkedObjects['propal'];
if (isset($array_propal_object) && is_array($array_propal_object) && count($array_propal_object) > 0) {
$tmparrayofvalue = array_values($array_propal_object);
$propal_object = $tmparrayofvalue[0];
} else {
$propal_object = null;
$propal_object = null;
if (!empty($object->linkedObjects['propal'])) {
$array_propal_object = $object->linkedObjects['propal'];
if (isset($array_propal_object) && is_array($array_propal_object) && count($array_propal_object) > 0) {
$tmparrayofvalue = array_values($array_propal_object);
$propal_object = $tmparrayofvalue[0];
}
}
// Make substitution
@ -411,15 +412,15 @@ class doc_generic_invoice_odt extends ModelePDFFactures
// TODO Search all tags {object_...:xxxx} into template then loop on this found tags to analyze them and the the corresponding
// property of object and use the xxxx to know how to format it.
// Before that, we hard code this substitution as if we have found them into the template.
$tmparray['object_PREVIOUS_MONTH'] = dol_print_date(dol_time_plus_duree($this->date, -1, 'm'), '%m');
$tmparray['object_MONTH'] = dol_print_date($this->date, '%m');
$tmparray['object_NEXT_MONTH'] = dol_print_date(dol_time_plus_duree($this->date, 1, 'm'), '%m');
$tmparray['object_PREVIOUS_MONTH_TEXT'] = dol_print_date(dol_time_plus_duree($this->date, -1, 'm'), '%B');
$tmparray['object_MONTH_TEXT'] = dol_print_date($this->date, '%B');
$tmparray['object_NEXT_MONTH_TEXT'] = dol_print_date(dol_time_plus_duree($this->date, 1, 'm'), '%B');
$tmparray['object_PREVIOUS_YEAR'] = dol_print_date(dol_time_plus_duree($this->date, -1, 'y'), '%Y');
$tmparray['object_YEAR'] = dol_print_date($this->date, '%Y');
$tmparray['object_NEXT_YEAR'] = dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y');
$tmparray['object_PREVIOUS_MONTH'] = dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%m');
$tmparray['object_MONTH'] = dol_print_date($object->date, '%m');
$tmparray['object_NEXT_MONTH'] = dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%m');
$tmparray['object_PREVIOUS_MONTH_TEXT'] = dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%B');
$tmparray['object_MONTH_TEXT'] = dol_print_date($object->date, '%B');
$tmparray['object_NEXT_MONTH_TEXT'] = dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B');
$tmparray['object_PREVIOUS_YEAR'] = dol_print_date(dol_time_plus_duree($object->date, -1, 'y'), '%Y');
$tmparray['object_YEAR'] = dol_print_date($object->date, '%Y');
$tmparray['object_NEXT_YEAR'] = dol_print_date(dol_time_plus_duree($object->date, 1, 'y'), '%Y');
// Call the ODTSubstitution hook
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);

View file

@ -950,10 +950,18 @@ class pdf_sponge extends ModelePDFFactures
// retrieve global local tax
if ($localtax1_type && $localtax1ligne != 0) {
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
$this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
} else {
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
}
}
if ($localtax2_type && $localtax2ligne != 0) {
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
$this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
} else {
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
}
}
if (($object->lines[$i]->info_bits & 0x01) == 0x01) {

View file

@ -158,7 +158,7 @@ class mod_facture_mars extends ModeleNumRefFactures
* @param Societe $objsoc Object third party
* @param Facture $invoice Object invoice
* @param string $mode 'next' for next value or 'last' for last value
* @return string Value if OK, 0 if KO
* @return string|int Value if OK, 0 if KO
*/
public function getNextValue($objsoc, $invoice, $mode = 'next')
{
@ -233,6 +233,7 @@ class mod_facture_mars extends ModeleNumRefFactures
return $prefix.$yymm."-".$num;
} else {
dol_print_error('', 'Bad parameter for getNextValue');
return -1;
}
}

View file

@ -308,5 +308,6 @@ class mailing_advthirdparties extends MailingTargets
$contactstatic->fetch($id);
return $contactstatic->getNomUrl(0, '', 0, '', -1, 1);
}
return "";
}
}

View file

@ -219,7 +219,8 @@ class mailing_contacts1 extends MailingTargets
if ($level == $obj->code) {
$level = $langs->trans($obj->label);
}
$s .= '<option value="prospectslevel'.$obj->code.'">'.$langs->trans("ThirdPartyProspects").' ('.$langs->trans("ProspectLevelShort").'='.$level.')</option>';
$labeltoshow = $langs->trans("ThirdPartyProspects").' <span class="opacitymedium">('.$langs->trans("ProspectLevelShort").'='.$level.')</span>';
$s .= '<option value="prospectslevel'.$obj->code.'" data-html="'.dol_escape_htmltag($labeltoshow).'">'.$labeltoshow.'</option>';
$i++;
}
} else {
@ -311,7 +312,7 @@ class mailing_contacts1 extends MailingTargets
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin = new FormAdmin($this->db);
$s .= img_picto($langs->trans("DefaultLang"), 'language', 'class="pictofixedwidth"');
$s .= $formadmin->select_language($langs->getDefaultLang(1), 'filter_lang', 0, null, $langs->trans("DefaultLang"), 0, 0, '', 0, 0, 0, null, 1);
$s .= $formadmin->select_language(GETPOST('filter_lang', 'aZ09'), 'filter_lang', 0, null, $langs->trans("DefaultLang"), 0, 0, '', 0, 0, 0, null, 1);
}
return $s;
@ -412,7 +413,7 @@ class mailing_contacts1 extends MailingTargets
}
// Filter on language
if (!empty($filter_lang)) {
if (!empty($filter_lang) && $filter_lang != '-1') {
$sql .= " AND sp.default_lang LIKE '".$this->db->escape($filter_lang)."%'";
}
@ -442,8 +443,9 @@ class mailing_contacts1 extends MailingTargets
}
$sql .= " ORDER BY sp.email";
// print "wwwwwwx".$sql;
// Stocke destinataires dans cibles
//print "wwwwwwx".$sql;
// Store recipients in target tables
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);

View file

@ -126,11 +126,11 @@ class mailing_thirdparties extends MailingTargets
$addDescription .= $langs->trans("Disabled");
}
}
if (GETPOST('default_lang', 'alpha')) {
if (GETPOST('default_lang', 'alpha') && GETPOST('default_lang', 'alpha') != '-1') {
$addFilter .= " AND s.default_lang LIKE '".$this->db->escape(GETPOST('default_lang', 'alpha'))."%'";
$addDescription = $langs->trans('DefaultLang')."=";
}
if (GETPOST('filter_lang_thirdparties', 'alpha')) {
if (GETPOST('filter_lang_thirdparties', 'alpha') && GETPOST('filter_lang_thirdparties', 'alpha') != '-1') {
$addFilter .= " AND s.default_lang LIKE '".$this->db->escape(GETPOST('filter_lang_thirdparties', 'alpha'))."%'";
$addDescription = $langs->trans('DefaultLang')."=";
}
@ -280,7 +280,7 @@ class mailing_thirdparties extends MailingTargets
$langs->load("companies");
// filter
$s = '<select id="filter_thirdparties" name="filter_thirdparties" class="flat">';
$s = '<select id="filter_thirdparties" name="filter_thirdparties" class="flat maxwidth200">';
// Show categories
$sql = "SELECT rowid, label, type, visible";
@ -316,10 +316,12 @@ class mailing_thirdparties extends MailingTargets
if ($obj->type == 2) {
$type = $langs->trans("Customer");
}
$s .= '<option value="'.$obj->rowid.'">'.dol_trunc($obj->label, 38, 'middle');
$labeltoshow = $obj->label;
if ($type) {
$s .= ' ('.$type.')';
$labeltoshow .= ' <span class="opacitymedium">('.$type.')</span>';
}
$s .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labeltoshow).'">';
$s .= $labeltoshow;
$s .= '</option>';
$i++;
}
@ -370,7 +372,7 @@ class mailing_thirdparties extends MailingTargets
$formadmin = new FormAdmin($this->db);
$s .= img_picto($langs->trans("DefaultLang"), 'language', 'class="pictofixedwidth"');
//$s .= '<span class="opacitymedium">'.$langs->trans("DefaultLang").':</span> ';
$s .= $formadmin->select_language($langs->getDefaultLang(1), 'filter_lang_thirdparties', 0, null, $langs->trans("DefaultLang"), 0, 0, '', 0, 0, 0, null, 1);
$s .= $formadmin->select_language(GETPOST('filter_lang_thirdparties', 'aZ09'), 'filter_lang_thirdparties', 0, null, $langs->trans("DefaultLang"), 0, 0, '', 0, 0, 0, null, 1);
}
return $s;

View file

@ -20,7 +20,8 @@
/**
* \defgroup api Module Api
* \brief Descriptor file for Api modulee
* \brief Module for API (REST) management
*
* \file htdocs/core/modules/modApi.class.php
* \ingroup api
* \brief Description and activation file for the module Api

View file

@ -89,8 +89,8 @@ class modBom extends DolibarrModules
'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl)
'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode)
'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx)
'css' => array('/bom/css/bom.css.php'), // Set this to relative path of css file if module has its own css file
'js' => array('/bom/js/bom.js.php'), // Set this to relative path of js file if module must load a js on all pages
'css' => array('/bom/css/bom.css.php'), // Set this to relative path of css file if module has its own css file
'js' => array('/bom/js/bom.js.php'), // Set this to relative path of js file if module must load a js on all pages
'hooks' => array('data'=>array('hookcontext1','hookcontext2'), 'entity'=>'0'), // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context 'all'
'moduleforexternal' => 0 // Set this to 1 if feature of module are opened to external users
*/

View file

@ -259,32 +259,32 @@ class modBookCal extends DolibarrModules
$r = 0;
// Add here entries to declare new permissions
/* BEGIN MODULEBUILDER PERMISSIONS */
$this->rights[$r][0] = $this->numero . sprintf('%02d', (0 * 10) + 0 + 1);
$this->rights[$r][0] = $this->numero . sprintf('%02d', (0 * 10) + 1);
$this->rights[$r][1] = 'Read objects of BookCal';
$this->rights[$r][4] = 'availabilities';
$this->rights[$r][5] = 'read';
$r++;
$this->rights[$r][0] = $this->numero . sprintf('%02d', (0 * 10) + 1 + 1);
$this->rights[$r][0] = $this->numero . sprintf('%02d', (0 * 10) + 2);
$this->rights[$r][1] = 'Create/Update objects of BookCal';
$this->rights[$r][4] = 'availabilities';
$this->rights[$r][5] = 'write';
$r++;
$this->rights[$r][0] = $this->numero . sprintf('%02d', (0 * 10) + 2 + 1);
$this->rights[$r][0] = $this->numero . sprintf('%02d', (0 * 10) + 3);
$this->rights[$r][1] = 'Delete objects of BookCal';
$this->rights[$r][4] = 'availabilities';
$this->rights[$r][5] = 'delete';
$r++;
$this->rights[$r][0] = $this->numero . sprintf('%02d', (1 * 10) + 0 + 1);
$this->rights[$r][0] = $this->numero . sprintf('%02d', (1 * 10) + 1);
$this->rights[$r][1] = 'Read Calendar object of BookCal';
$this->rights[$r][4] = 'calendar';
$this->rights[$r][5] = 'read';
$r++;
$this->rights[$r][0] = $this->numero . sprintf('%02d', (1 * 10) + 1 + 1);
$this->rights[$r][0] = $this->numero . sprintf('%02d', (1 * 10) + 2);
$this->rights[$r][1] = 'Create/Update Calendar object of BookCal';
$this->rights[$r][4] = 'calendar';
$this->rights[$r][5] = 'write';
$r++;
$this->rights[$r][0] = $this->numero . sprintf('%02d', (1 * 10) + 2 + 1);
$this->rights[$r][0] = $this->numero . sprintf('%02d', (1 * 10) + 3);
$this->rights[$r][1] = 'Delete Calendar object of BookCal';
$this->rights[$r][4] = 'calendar';
$this->rights[$r][5] = 'delete';

View file

@ -19,11 +19,12 @@
*/
/**
* \defgroup comptabilite Module comptabilite
* \brief Module pour inclure des fonctions de comptabilite (gestion de comptes comptables et rapports)
* \file htdocs/core/modules/modComptabilite.class.php
* \ingroup comptabilite
* \brief Description and activation file for the module simple accountancy
* \defgroup comptabilite Module Comptabilite
* \brief Module to include accounting functions (account management and reporting)
*
* \file htdocs/core/modules/modComptabilite.class.php
* \ingroup comptabilite
* \brief Description and activation file for the module simple accountancy
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';

View file

@ -16,11 +16,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/** \defgroup ecm Module ecm
* \brief Module for ECM (Electronic Content Management)
* \file htdocs/core/modules/modECM.class.php
* \ingroup ecm
* \brief Description and activation file for the module ECM
/**
* \defgroup ecm Module ECM
* \brief Module ECM (Electronic Content Management) to manage Documents
*
* \file htdocs/core/modules/modECM.class.php
* \ingroup ecm
* \brief Description and activation file for the module ECM
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';

View file

@ -16,8 +16,8 @@
*/
/**
* \defgroup emailcollector Module emailcollector
* \brief emailcollector module descriptor.
* \defgroup emailcollector Module Emailcollector
* \brief Module to collect emails
*
* \file htdocs/core/modules/modEmailCollector.class.php
* \ingroup emailcollector

View file

@ -20,11 +20,12 @@
*/
/**
* \defgroup expedition Module shipping
* \brief Module pour gerer les expeditions de produits
* \file htdocs/core/modules/modExpedition.class.php
* \ingroup expedition
* \brief Description and activation file for the module Expedition
* \defgroup expedition Module Shipping
* \brief Module to manage product shipments
*
* \file htdocs/core/modules/modExpedition.class.php
* \ingroup expedition
* \brief Description and activation file for the module Expedition
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';

View file

@ -17,11 +17,12 @@
*/
/**
* \defgroup export Module export
* \brief Module generique pour realiser des exports de donnees en base
* \file htdocs/core/modules/modExport.class.php
* \ingroup export
* \brief Description and activation file for the module export
* \defgroup export Module Export
* \brief Module to manage data exports from Dolibarr database
*
* \file htdocs/core/modules/modExport.class.php
* \ingroup export
* \brief Description and activation file for the module export
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';

View file

@ -21,10 +21,12 @@
*/
/**
* \defgroup fournisseur Module suppliers
* \file htdocs/core/modules/modFournisseur.class.php
* \ingroup fournisseur
* \brief Description and activation file for the module Supplier
* \defgroup fournisseur Module suppliers
* \brief Module to manage suppliers relations and activities
*
* \file htdocs/core/modules/modFournisseur.class.php
* \ingroup fournisseur
* \brief Description and activation file for the module Supplier
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';

View file

@ -17,10 +17,12 @@
*/
/**
* \defgroup HRM Module hrm
* \file htdocs/core/modules/modHRM.class.php
* \ingroup HRM
* \brief Description and activation file for the module HRM
* \defgroup HRM Module hrm
* \brief Module for Human Resource Management (HRM)
*
* \file htdocs/core/modules/modHRM.class.php
* \ingroup HRM
* \brief Description and activation file for the module HRM
*/
include_once DOL_DOCUMENT_ROOT."/core/modules/DolibarrModules.class.php";

View file

@ -23,7 +23,8 @@
/**
* \defgroup holiday Module holiday
* \brief Module de gestion des congés
* \brief Module for leave/vacation management
*
* \file htdocs/core/modules/modHoliday.class.php
* \ingroup holiday
* \brief Description and activation file for the module holiday

View file

@ -86,6 +86,7 @@ class modLdap extends DolibarrModules
12=>array('LDAP_FIELD_FAX', 'chaine', 'facsimiletelephonenumber', '', 0),
13=>array('LDAP_FIELD_MOBILE', 'chaine', 'mobile', '', 0),
14=>array('LDAP_GROUP_FILTER', 'chaine', '&(objectClass=groupOfNames)', '', 0),
15=>array('LDAP_USERACCOUNTCONTROL', 'int', 512, '', 0),
);
// Boxes

View file

@ -20,7 +20,7 @@
/**
* \defgroup mrp Module Mrp
* \brief Mrp module descriptor.
* \brief Module to manage Manufacturing Orders (MO)
*
* \file htdocs/core/modules/modMrp.class.php
* \ingroup mrp

View file

@ -17,11 +17,12 @@
*/
/**
* \defgroup notification Module email notification
* \brief Module pour gerer les notifications (par mail ou autre)
* \file htdocs/core/modules/modNotification.class.php
* \ingroup notification
* \brief Description and activation file for the module Notification
* \defgroup notification Module notification
* \brief Module for managing notifications (by e-mail or other means)
*
* \file htdocs/core/modules/modNotification.class.php
* \ingroup notification
* \brief Description and activation file for the module Notification
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';

View file

@ -16,11 +16,12 @@
*/
/**
* \defgroup reception Module reception
* \brief Module pour gerer les réceptions de produits
* \file htdocs/core/modules/modReception.class.php
* \ingroup reception
* \brief Description and activation file for the module Reception
* \defgroup reception Module Reception
* \brief Module to manage receptions of products
*
* \file htdocs/core/modules/modReception.class.php
* \ingroup reception
* \brief Description and activation file for the module Reception
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';

View file

@ -17,11 +17,12 @@
*/
/**
* \defgroup syslog Module syslog
* \brief Module pour gerer les messages d'erreur dans syslog
* \file htdocs/core/modules/modSyslog.class.php
* \ingroup syslog
* \brief Description and activation file for the module syslog
* \defgroup syslog Module Syslog
* \brief Module to manage error messages in syslog
*
* \file htdocs/core/modules/modSyslog.class.php
* \ingroup syslog
* \brief Description and activation file for the module syslog
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';

View file

@ -18,11 +18,12 @@
*/
/**
* \defgroup user Module user management
* \brief Module pour gerer les utilisateurs
* \file htdocs/core/modules/modUser.class.php
* \ingroup user
* \brief Description and activation file for the module users
* \defgroup user Module user management
* \brief Module to manage users and usergroups
*
* \file htdocs/core/modules/modUser.class.php
* \ingroup user
* \brief Description and activation file for the module users
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';

View file

@ -481,10 +481,20 @@ class pdf_standard extends ModelePDFProduct
}
// retrieve global local tax
if ($localtax1_type && $localtax1ligne != 0)
$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
if ($localtax2_type && $localtax2ligne != 0)
$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
if ($localtax1_type && $localtax1ligne != 0) {
if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
$this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
} else {
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
}
}
if ($localtax2_type && $localtax2ligne != 0) {
if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
$this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
} else {
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
}
}
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0;

View file

@ -1502,8 +1502,10 @@ class pdf_azur extends ModelePDFPropales
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('', 'B', $default_font_size + 3);
$w = 100;
$posy = $this->marge_haute;
$posx = $this->page_largeur - $this->marge_droite - 100;
$posx = $this->page_largeur - $this->marge_droite - $w;
$pdf->SetXY($this->marge_gauche, $posy);

View file

@ -390,6 +390,7 @@ class pdf_cyan extends ModelePDFPropales
$tab_top = 90 + $top_shift;
$tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
$nexY = $tab_top;
// Incoterm
$height_incoterms = 0;
@ -794,10 +795,18 @@ class pdf_cyan extends ModelePDFPropales
// retrieve global local tax
if ($localtax1_type && $localtax1ligne != 0) {
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
$this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
} else {
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
}
}
if ($localtax2_type && $localtax2ligne != 0) {
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
$this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
} else {
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
}
}
if (($object->lines[$i]->info_bits & 0x01) == 0x01) {

View file

@ -704,10 +704,20 @@ class pdf_eagle_proforma extends ModelePDFCommandes
}
// retrieve global local tax
if ($localtax1_type && $localtax1ligne != 0)
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
if ($localtax2_type && $localtax2ligne != 0)
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
if ($localtax1_type && $localtax1ligne != 0) {
if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
$this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
} else {
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
}
}
if ($localtax2_type && $localtax2ligne != 0) {
if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
$this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
} else {
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
}
}
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .= '*';
if (!isset($this->tva[$vatrate])) $this->tva[$vatrate] = 0;

View file

@ -1057,6 +1057,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$this->error = $this->db->lasterror();
return -1;
}
return -1;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore

View file

@ -725,10 +725,18 @@ class pdf_cornas extends ModelePDFSuppliersOrders
// retrieve global local tax
if ($localtax1_type && $localtax1ligne != 0) {
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
$this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
} else {
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
}
}
if ($localtax2_type && $localtax2ligne != 0) {
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
$this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
} else {
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
}
}
if (($object->lines[$i]->info_bits & 0x01) == 0x01) {

View file

@ -603,10 +603,18 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
// retrieve global local tax
if ($localtax1_type && $localtax1ligne != 0) {
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
$this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
} else {
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
}
}
if ($localtax2_type && $localtax2ligne != 0) {
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
$this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
} else {
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
}
}
if (($object->lines[$i]->info_bits & 0x01) == 0x01) {

View file

@ -546,6 +546,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
// Date
$pdf->SetXY($this->page_largeur - $this->marge_droite - 30, $posy);
$pdf->MultiCell(150, 4, date("d").' '.$outputlangs->transnoentitiesnoconv(date("F")).' '.date("Y"), 0, 'L', 1);
return $posy;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore

View file

@ -589,10 +589,18 @@ class pdf_aurore extends ModelePDFSupplierProposal
// retrieve global local tax
if ($localtax1_type && $localtax1ligne != 0) {
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
$this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
} else {
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
}
}
if ($localtax2_type && $localtax2ligne != 0) {
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
$this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
} else {
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
}
}
if (($object->lines[$i]->info_bits & 0x01) == 0x01) {

View file

@ -130,7 +130,7 @@ class mod_takepos_ref_simple extends ModeleNumRefTakepos
* @param Societe $objsoc Object third party
* @param Facture $invoice Object invoice
* @param string $mode 'next' for next value or 'last' for last value
* @return string Next ref value or last ref if $mode is 'last'
* @return string|int Next ref value or last ref if $mode is 'last'
*/
public function getNextValue($objsoc = null, $invoice = null, $mode = 'next')
{
@ -198,6 +198,7 @@ class mod_takepos_ref_simple extends ModeleNumRefTakepos
return $this->prefix.$pos_source.'-'.$yymm.'-'.$num;
} else {
dol_print_error('', 'Bad parameter for getNextValue');
return -1;
}
}

View file

@ -143,7 +143,8 @@ if ($permission) {
<div class="tagtd nowrap noborderbottom">
<?php
$selectedCompany = GETPOSTISSET("newcompany") ? GETPOST("newcompany", 'int') : (empty($object->socid) ? 0 : $object->socid);
$selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); ?>
$selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); // This also print the select component
?>
</div>
<div class="tagtd noborderbottom minwidth500imp">
<?php

View file

@ -89,6 +89,11 @@ class InterfaceLdapsynchro extends DolibarrTriggers
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info);
//For compatibility with Samba 4 AD
if ($ldap->serverType == "activedirectory") {
$info['userAccountControl'] = $conf->global->LDAP_USERACCOUNTCONTROL;
}
$result = $ldap->add($dn, $info, $user);
}
@ -210,6 +215,33 @@ class InterfaceLdapsynchro extends DolibarrTriggers
}
} elseif ($action == 'USER_ENABLEDISABLE') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (intval($conf->global->LDAP_SYNCHRO_ACTIVE) === Ldap::SYNCHRO_DOLIBARR_TO_LDAP && $conf->global->LDAP_SERVER_TYPE == "activedirectory") {
$ldap = new Ldap();
$result = $ldap->connect_bind();
if ($result > 0) {
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info);
$search = "(" . $object->_load_ldap_dn($info, 2) . ")";
$uAC = $ldap->getAttributeValues($search, "userAccountControl");
if ($uAC["count"] == 1) {
$userAccountControl = intval($uAC[0]);
$enabledBitMask = 0x2;
$isEnabled = ($userAccountControl & $enabledBitMask) === 0;
if ($isEnabled && intval($object->statut) === 1) {
$userAccountControl += 2;
} elseif (!$isEnabled && intval($object->statut) === 0) {
$userAccountControl -= 2;
}
$info['userAccountControl'] = $userAccountControl;
$resUpdate = $ldap->update($dn, $info, $user, $dn);
if ($resUpdate < 0) {
$this->error = "ErrorLDAP " . $ldap->error;
}
}
} else {
$this->error = "ErrorLDAP " . $ldap->error;
}
}
} elseif ($action == 'USER_DELETE') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
@ -314,6 +346,15 @@ class InterfaceLdapsynchro extends DolibarrTriggers
$result = $ldap->add($dn, $info, $user);
}
// Avoid Ldap error due to empty member
if (isset($info['member']) && empty($info['member'])) {
unset($info['member']);
}
if ($ldap->serverType == "activedirectory") {
$info['sAMAccountName'] = $object->name;
}
if ($result < 0) {
$this->error = "ErrorLDAP ".$ldap->error;
}

View file

@ -66,10 +66,26 @@ class InterfaceNotification extends DolibarrTriggers
*/
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
global $hookmanager;
if (empty($conf->notification) || !isModEnabled('notification')) {
return 0; // Module not active, we do nothing
}
if (!is_object($hookmanager)) {
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager = new HookManager($this->db);
}
$hookmanager->initHooks(array('notification'));
$parameters = array();
$reshook = $hookmanager->executeHooks('notifsupported', $parameters, $object, $action);
if (empty($reshook)) {
if (!empty($hookmanager->resArray['arrayofnotifsupported'])) {
$this->listofmanagedevents = array_merge($this->listofmanagedevents, $hookmanager->resArray['arrayofnotifsupported']);
}
}
// If the trigger code is not managed by the Notification module
if (!in_array($action, $this->listofmanagedevents)) {
return 0;
@ -83,7 +99,6 @@ class InterfaceNotification extends DolibarrTriggers
return 1;
}
/**
* Return list of events managed by notification module
*

View file

@ -78,7 +78,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('doncard', 'globalcard'));
$hookmanager->initHooks(array($object->element.'card', 'globalcard'));
$upload_dir = $conf->don->dir_output;
@ -440,7 +440,7 @@ if ($action == 'create') {
} else {
print '<td class="fieldrequired">'.$langs->trans('ThirdParty').'</td>';
print '<td>';
$filter = '((s.client:IN:1,3) AND (status:=:1))';
$filter = '((s.client:IN:1,2,3) AND (status:=:1))';
print $form->select_company($soc->id, 'socid', $filter, 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
// Option to reload page to retrieve customer informations. Note, this clear other input
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {

Some files were not shown because too many files have changed in this diff Show more