Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into pr/bb2a/21596
This commit is contained in:
commit
be2ecf1c3a
3
.gitignore
vendored
3
.gitignore
vendored
@ -42,6 +42,8 @@ htdocs/includes/sebastian/
|
||||
htdocs/includes/squizlabs/
|
||||
htdocs/includes/webmozart/
|
||||
htdocs/.well-known/apple-developer-merchantid-domain-association
|
||||
/factory/
|
||||
/output/
|
||||
|
||||
# Node Modules
|
||||
build/yarn-error.log
|
||||
@ -55,4 +57,3 @@ yarn.lock
|
||||
package-lock.json
|
||||
|
||||
doc/install.lock
|
||||
/factory/
|
||||
|
||||
@ -52,7 +52,7 @@ Ace 1.4.14 BSD Yes
|
||||
ChartJS 3.7.1 MIT License Yes JS library for graph
|
||||
CKEditor 4.18 LGPL-2.1+ Yes Editor WYSIWYG
|
||||
jQuery 3.6.0 MIT License Yes JS library
|
||||
jQuery UI 1.13.1 GPL and MIT License Yes JS library plugin UI
|
||||
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
|
||||
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
||||
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
|
||||
|
||||
79
ChangeLog
79
ChangeLog
@ -27,7 +27,9 @@ Following changes may create regressions for some external modules, but were nec
|
||||
For users:
|
||||
---------------
|
||||
|
||||
NEW: PHP 8.1 compatibility
|
||||
NEW: PHP 8.1 compatibility.
|
||||
Warning: Application works correctly with PHP8 and 8.1 but you may experience a lot of PHP warning into the PHP server log files (depending
|
||||
on the PHP setup). Removal of all PHP warnings on server side is planned for v17.
|
||||
NEW: Support for recurring purchase invoices.
|
||||
NEW: #20292 Include German public holidays
|
||||
NEW: Can show ZATCA QR-Code on PDFs
|
||||
@ -139,7 +141,7 @@ NEW: Added MMK currency (Myanmar Kyat)
|
||||
|
||||
Modules
|
||||
NEW: Module Partnership Management
|
||||
NEW: Experimental Module Event Organization Management
|
||||
NEW: Module Event Organization Management
|
||||
|
||||
|
||||
For developers or integrators:
|
||||
@ -223,6 +225,79 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* The context hook 'suppliercard' when on the supplier tab of a thirdparty has been renamed into 'thirdpartysupplier'
|
||||
|
||||
|
||||
***** ChangeLog for 15.0.3 compared to 15.0.2 *****
|
||||
|
||||
FIX: 15.0: modules cannot declare more than 1 cron job using the same method with different parameters
|
||||
FIX: 15 fix graph ficheinter status
|
||||
FIX: #18704
|
||||
FIX: #20444
|
||||
FIX: #20448 missing preg_replace for vat rate when adding a free line
|
||||
FIX: #20476 migration postgresql 13.0.x to 14.0.x packaging type
|
||||
FIX: #20487 missing letter D in constant THIRDPARTIES_DISABLE_RELATED_OBJECT_TAB
|
||||
FIX: #20527 Accountancy - Unbalanced entry proposed when an employee are declared on a social contribution
|
||||
FIX: #20621 signature online with proposal with n page.
|
||||
FIX: #20696
|
||||
FIX: #20828
|
||||
FIX: #20886 : manage durations in list_print_total.tpl.php
|
||||
FIX: #20902
|
||||
FIX: #21051
|
||||
FIX: #21093
|
||||
FIX: #21138
|
||||
FIX: #21140
|
||||
FIX: #21174
|
||||
FIX: #21323
|
||||
FIX: #21472 On the bank transfer lists, a change of page switches to the lists of the direct debit module
|
||||
FIX: #21495
|
||||
FIX: #21518
|
||||
FIX: Accountancy - Label of VAT account is empty
|
||||
FIX: Accountancy - Model account list - Problem of CSRF
|
||||
FIX: Accountancy - Partitioning of the entity on an automatic binding
|
||||
FIX: add missing thead, th and id on table
|
||||
FIX: backport commit 5b3fcc5e43979b1b0789bf81fb8f1b2b59c93056, chkbxlst cannot be emptied
|
||||
FIX: Bank account not set when creating invoice from order
|
||||
FIX: Bank transfer - Link on code supplier invoice was bad
|
||||
FIX: Can convert a partially closed down payment when close for
|
||||
FIX: class center linkedObjectblock order date
|
||||
FIX: count elements in invoice list (Issue #21444)
|
||||
FIX: Customer price non numeric warning when 0 vat.
|
||||
FIX: errors in getLinesArray()
|
||||
FIX: False alert of WAF when there is "set" into some URL action=update.
|
||||
FIX: Intervention graph by status on ficheinter Index page
|
||||
FIX: Intervention url link into Commerce index
|
||||
FIX: Fix get origin from other than supplier proposal when add a new supplier proposal
|
||||
FIX: Fix show errors in card
|
||||
FIX: fourn/commande/card.php Added "$object" parameter to $formfile->showdocuments call
|
||||
FIX: french traductions for payment methods
|
||||
FIX: hook for dol_format_address
|
||||
FIX: Index page for "Sales" give wrong URL link to Intervention
|
||||
FIX: issue Dolibarr #21495 for v15
|
||||
FIX: label and get_substitutionarray_each_var_object on ODT generation
|
||||
FIX: load product stock in inventory lines
|
||||
FIX: missing morecss for multiselectarray
|
||||
FIX: missins time spent list menu
|
||||
FIX: new member subscription: bank account and payment mode might be hidden
|
||||
FIX: ODT generation of BOM document
|
||||
FIX: ODT tags for subobjects {object_subobject_yyy} was not working.
|
||||
FIX: qty received label in Squille PDF model
|
||||
FIX: rank duplicate on mass action invoice from multiple orders
|
||||
FIX: regression + add $forceentity parameter
|
||||
FIX: regression PR #20713
|
||||
FIX: security breach if we have same ref number in multiple entities
|
||||
FIX: selection of type of invoice
|
||||
FIX: Send remind to pay invoice only on validated invoices
|
||||
FIX: Show sellist type of extrafield when none category selected
|
||||
FIX: signature online with proposal with n page.
|
||||
FIX: sql error when PRODUCT_USE_SUPPLIER_PACKAGING enabled.
|
||||
FIX: sql order
|
||||
FIX: trash icon on crontask list to do not work
|
||||
FIX: v15 linked object block center order date
|
||||
FIX: Warning on attribut
|
||||
FIX: We must remove empty values of $features array in fetchByProductCombination2ValuePairs() because some products can use only several attributes in their variations and not necessarily all. In this case, fetch doesn't work without my correction
|
||||
FIX: with callback function
|
||||
FIX: xml file for company with special chars in name
|
||||
FIX: Zatca QR code must use company name/vat
|
||||
|
||||
|
||||
***** ChangeLog for 15.0.2 compared to 15.0.1 *****
|
||||
|
||||
FIX: #19777 #20281
|
||||
|
||||
24
build/README
24
build/README
@ -13,32 +13,12 @@ It is here only to build Dolibarr packages, and those generated packages will no
|
||||
|
||||
There are several tools:
|
||||
|
||||
--------------------------------------------------------------------------------------------------
|
||||
|
||||
- To build full Dolibarr packages, launch the script
|
||||
> Launch command perl makepack-dolibarr.pl
|
||||
|
||||
--------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Prerequisites to build tgz, debian and rpm packages:
|
||||
> apt-get install tar dpkg dpatch p7zip-full rpm zip
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------------------------
|
||||
|
||||
Prerequisites to build autoexe DoliWamp package:
|
||||
> apt-get install wine q4wine
|
||||
> Launch "wine cmd" to check a drive Z: pointing to / exists.
|
||||
> Install InnoSetup
|
||||
For example by running isetup-5.5.8.exe (https://www.jrsoftware.org) https://files.jrsoftware.org/is/5/
|
||||
> Install WampServer into "C:\wamp64" to have Apache, PHP and MariaDB
|
||||
For example by running wampserver3.2.0_x64.exe (https://www.wampserver.com).
|
||||
See file build/exe/doliwamp.iss to know the doliwamp version currently setup.
|
||||
> Add path to ISCC into PATH windows var:
|
||||
Launch wine cmd, then regedit and add entry int HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment\PATH
|
||||
> To build manually the .exe from Windows (running from makepack-dolibarr.pl script is however recommanded),
|
||||
open file build/exe/doliwamp.iss and click on button "Compile".
|
||||
The .exe file will be build into directory build.
|
||||
See makepack-howto.txt for prerequisites.
|
||||
|
||||
--------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
#!/bin/bash
|
||||
# Script used by the Dockerfile.
|
||||
# See README.md to know how to create a Dolibarr env with docker
|
||||
|
||||
usermod -u ${HOST_USER_ID} www-data
|
||||
groupmod -g ${HOST_USER_ID} www-data
|
||||
|
||||
2
build/exe/doliwamp/.gitignore
vendored
2
build/exe/doliwamp/.gitignore
vendored
@ -1 +1 @@
|
||||
/doliwamp.tmp.iss
|
||||
/doliwamp.tmp.iss*
|
||||
|
||||
@ -24,7 +24,6 @@ OutputBaseFilename=__FILENAMEEXEDOLIWAMP__
|
||||
;OutputManifestFile=build\doliwampbuild.log
|
||||
; Define full path from which all relative path are defined
|
||||
; You must modify this to put here your dolibarr root directory
|
||||
;SourceDir=Z:\home\ldestailleur\git\dolibarrxxx
|
||||
SourceDir=..\..\..
|
||||
AppId=doliwamp
|
||||
AppPublisher=DoliCloud
|
||||
@ -32,7 +31,7 @@ AppPublisherURL=https://www.dolicloud.com
|
||||
AppSupportURL=https://www.dolibarr.org
|
||||
AppUpdatesURL=https://www.dolibarr.org
|
||||
AppComments=DoliWamp includes Dolibarr, Apache, PHP and Mysql software.
|
||||
AppCopyright=Copyright (C) 2008-2022 Laurent Destailleur (NLTechno), Fabian Rodriguez (Le Goût du Libre)
|
||||
AppCopyright=Copyright (C) 2008-2022 Laurent Destailleur (DoliCloud), Fabian Rodriguez (Le Goût du Libre)
|
||||
DefaultDirName=c:\dolibarr
|
||||
DefaultGroupName=Dolibarr
|
||||
;LicenseFile=COPYING
|
||||
@ -81,7 +80,7 @@ Name: "desktopicon"; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:
|
||||
Name: "{app}\logs"
|
||||
Name: "{app}\tmp"
|
||||
Name: "{app}\dolibarr_documents"
|
||||
Name: "{app}\bin\apache\apache2.4.41\logs"
|
||||
Name: "{app}\bin\apache\apache2.4.51\logs"
|
||||
|
||||
[Files]
|
||||
; Stop/start
|
||||
@ -101,16 +100,10 @@ Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversi
|
||||
|
||||
; Apache, Php, Mysql
|
||||
; Put here path of Wampserver applications
|
||||
; Value OK: apache 2.2.6, php 5.2.5 (5.2.11, 5.3.0 and 5.3.1 fails if php_exif, php_pgsql, php_zip is on), mysql 5.0.45
|
||||
; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45
|
||||
; Value OK: apache 2.4.9, php 5.5.12, mysql 5.0.45 instead of 5.6.17 (wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe)
|
||||
; Value OK: apache 2.4.41, php 7.3.12, mariadb10.4.10 (wampserver3.2.0_x64.exe)
|
||||
;Source: "C:\Program Files\Wamp\bin\apache\apache2.4.9\*.*"; DestDir: "{app}\bin\apache\apache2.4.9"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
|
||||
Source: "C:\wamp64\bin\apache\apache2.4.41\*.*"; DestDir: "{app}\bin\apache\apache2.4.41"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
|
||||
;Source: "C:\Program Files\Wamp\bin\php\php5.5.12\*.*"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log"
|
||||
Source: "C:\wamp64\bin\php\php7.3.12\*.*"; DestDir: "{app}\bin\php\php7.3.12"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log"
|
||||
;Source: "C:\Program Files\Wamp\bin\mysql\mysql5.0.45\*.*"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe"
|
||||
Source: "C:\wamp64\bin\mariadb\mariadb10.4.10\*.*"; DestDir: "{app}\bin\mariadb\mariadb10.4.10"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe"
|
||||
; Value OK: apache 2.4.51, php 7.3.33, mariadb10.6.5 (wampserver3.2.6_x64.exe)
|
||||
Source: "C:\wamp64\bin\apache\apache2.4.51\*.*"; DestDir: "{app}\bin\apache\apache2.4.51"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
|
||||
Source: "C:\wamp64\bin\php\php7.3.33\*.*"; DestDir: "{app}\bin\php\php7.3.33"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log"
|
||||
Source: "C:\wamp64\bin\mariadb\mariadb10.6.5\*.*"; DestDir: "{app}\bin\mariadb\mariadb10.6.5"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe"
|
||||
|
||||
; Mysql data files (does not overwrite if exists)
|
||||
; We must copy them because the tool mysql_install_db.exe to generate them at first install does not return to prompt so make install hang
|
||||
@ -125,12 +118,10 @@ Source: "*.*"; DestDir: "{app}\www\dolibarr"; Flags: ignoreversion; Excludes: ".
|
||||
|
||||
; Config files
|
||||
Source: "build\exe\doliwamp\dolibarr.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion;
|
||||
;Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.9\conf"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.41\conf"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.51\conf"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mariadb\mariadb10.4.10"; Flags: ignoreversion;
|
||||
;Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php7.3.12"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mariadb\mariadb10.6.5"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php7.3.33"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\index.php.install"; DestDir: "{app}\www"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\install.forced.php.install"; DestDir: "{app}\www\dolibarr\htdocs\install"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\openssl.conf"; DestDir: "{app}"; Flags: ignoreversion;
|
||||
@ -236,12 +227,9 @@ procedure InitializeWizard();
|
||||
begin
|
||||
|
||||
//version des applis, a modifier pour chaque version de WampServer 2
|
||||
//apacheVersion := '2.4.9';
|
||||
//phpVersion := '5.5.12' ;
|
||||
apacheVersion := '2.4.41';
|
||||
phpVersion := '7.3.12' ;
|
||||
//mysqlVersion := '5.0.45';
|
||||
mysqlVersion := '10.4.10';
|
||||
apacheVersion := '2.4.51';
|
||||
phpVersion := '7.3.33' ;
|
||||
mysqlVersion := '10.6.5';
|
||||
|
||||
smtpServer := 'localhost';
|
||||
apachePort := '80';
|
||||
@ -375,9 +363,9 @@ begin
|
||||
|
||||
|
||||
// Migration of database
|
||||
// datadir := pathWithSlashes+'/bin/mariadb/marradb10.4.10/data';
|
||||
// exedirold := pathWithSlashes+'/bin/mariadb/marradb10.4.10/';
|
||||
// exedirnew := pathWithSlashes+'/bin/mariadb/marradb10.4.10/';
|
||||
// datadir := pathWithSlashes+'/bin/mariadb/mariadb10.6.5/data';
|
||||
// exedirold := pathWithSlashes+'/bin/mariadb/mariadb10.6.5/';
|
||||
// exedirnew := pathWithSlashes+'/bin/mariadb/mariadb10.6.5/';
|
||||
|
||||
// If we have a new database version, we should only copy old my.ini file into new directory
|
||||
// and change only all basedir= strings to use new version. Like this, data dir is still correct.
|
||||
@ -1027,7 +1015,7 @@ Filename: "{app}\rundoliwamp.bat"; Description: {cm:LaunchNow}; Flags: shellexec
|
||||
|
||||
[UninstallDelete]
|
||||
Type: files; Name: "{app}\*.*"
|
||||
Type: files; Name: "{app}\bin\mariadb\mariadb10.4.10\*.*"
|
||||
Type: files; Name: "{app}\bin\mariadb\mariadb10.6.5\*.*"
|
||||
Type: filesandordirs; Name: "{app}\alias"
|
||||
Type: filesandordirs; Name: "{app}\apps"
|
||||
Type: filesandordirs; Name: "{app}\bin\apache"
|
||||
|
||||
@ -65,7 +65,7 @@ $DIR||='.'; $DIR =~ s/([^\/\\])[\\\/]+$/$1/;
|
||||
|
||||
$SOURCE="$DIR/..";
|
||||
$DESTI="$SOURCE/build";
|
||||
if ($SOURCE !~ /^\//)
|
||||
if ($SOURCE !~ /^\// && $SOURCE !~ /^[a-z]:/i)
|
||||
{
|
||||
print "Error: Launch the script $PROG.$Extension with its full path from /.\n";
|
||||
print "$PROG.$Extension aborted.\n";
|
||||
@ -76,15 +76,23 @@ if (! $ENV{"DESTIBETARC"} || ! $ENV{"DESTISTABLE"})
|
||||
{
|
||||
print "Error: Missing environment variables.\n";
|
||||
print "You must define the environment variable DESTIBETARC and DESTISTABLE to point to the\ndirectories where you want to save the generated packages.\n";
|
||||
print "$PROG.$Extension aborted.\n";
|
||||
print "\n";
|
||||
print "You can set them with\n";
|
||||
print "On Linux:\n";
|
||||
print "export DESTIBETARC='/tmp'; export DESTISTABLE='/tmp';\n";
|
||||
print "On Windows:\n";
|
||||
print "set DESTIBETARC=c:/tmp\n";
|
||||
print "set DESTISTABLE=c:/tmp\n";
|
||||
print "\n";
|
||||
print "Example: DESTIBETARC='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/lastbuild'\n";
|
||||
print "Example: DESTISTABLE='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/stable'\n";
|
||||
print "$PROG.$Extension aborted.\n";
|
||||
sleep 2;
|
||||
exit 1;
|
||||
}
|
||||
if (! -d $ENV{"DESTIBETARC"} || ! -d $ENV{"DESTISTABLE"})
|
||||
{
|
||||
print "Error: Directory of environment variable DESTIBETARC or DESTISTABLE does not exist.\n";
|
||||
print "Error: Directory of environment variable DESTIBETARC ($ENV{'DESTIBETARC'}) or DESTISTABLE ($ENV{'DESTISTABLE'}) does not exist.\n";
|
||||
print "$PROG.$Extension aborted.\n";
|
||||
sleep 2;
|
||||
exit 1;
|
||||
@ -94,7 +102,7 @@ if (! -d $ENV{"DESTIBETARC"} || ! -d $ENV{"DESTISTABLE"})
|
||||
# --------------
|
||||
if ("$^O" =~ /linux/i || (-d "/etc" && -d "/var" && "$^O" !~ /cygwin/i)) { $OS='linux'; $CR=''; }
|
||||
elsif (-d "/etc" && -d "/Users") { $OS='macosx'; $CR=''; }
|
||||
elsif ("$^O" =~ /cygwin/i || "$^O" =~ /win32/i) { $OS='windows'; $CR="\r"; }
|
||||
elsif ("$^O" =~ /cygwin/i || "$^O" =~ /win32/i || "$^O" =~ /msys/i) { $OS='windows'; $CR="\r"; }
|
||||
if (! $OS) {
|
||||
print "Error: Can't detect your OS.\n";
|
||||
print "Can't continue.\n";
|
||||
@ -390,7 +398,7 @@ if ($nboftargetok) {
|
||||
$olddir=getcwd();
|
||||
chdir("$SOURCE");
|
||||
|
||||
print "Clean $SOURCE/htdocs\n";
|
||||
print "Clean $SOURCE/htdocs/includes/autoload.php\n";
|
||||
$ret=`rm -f $SOURCE/htdocs/includes/autoload.php`;
|
||||
|
||||
$ret=`git ls-files . --exclude-standard --others`;
|
||||
@ -1074,28 +1082,52 @@ if ($nboftargetok) {
|
||||
print "Remove target $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe...\n";
|
||||
unlink "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe";
|
||||
|
||||
print "Check that in your Wine setup, you have created a Z: drive that point to your / directory.\n";
|
||||
|
||||
if ($OS eq 'windows') {
|
||||
print "Check that ISCC.exe is in your PATH.\n";
|
||||
} else {
|
||||
print "Check that in your Wine setup, you have created a Z: drive that point to your / directory.\n";
|
||||
}
|
||||
|
||||
$SOURCEBACK=$SOURCE;
|
||||
$SOURCEBACK =~ s/\//\\/g;
|
||||
|
||||
print "Prepare file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss from \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.iss\"\n";
|
||||
$ret=`cat "$SOURCE/build/exe/doliwamp/doliwamp.iss" | sed -e 's/__FILENAMEEXEDOLIWAMP__/$FILENAMEEXEDOLIWAMP/g' > "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`;
|
||||
print "Prepare file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\" from \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.iss\"\n";
|
||||
|
||||
#$ret=`cat "$SOURCE/build/exe/doliwamp/doliwamp.iss" | sed -e 's/__FILENAMEEXEDOLIWAMP__/$FILENAMEEXEDOLIWAMP/g' > "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`;
|
||||
open(IN, '<' . $SOURCE."/build/exe/doliwamp/doliwamp.iss") or die $!;
|
||||
open(OUT, '>' . "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss") or die $!;
|
||||
while(<IN>)
|
||||
{
|
||||
$_ =~ s/__FILENAMEEXEDOLIWAMP__/$FILENAMEEXEDOLIWAMP/g;
|
||||
print OUT $_;
|
||||
}
|
||||
close(IN);
|
||||
close(OUT);
|
||||
|
||||
print "Compil exe $FILENAMEEXEDOLIWAMP.exe file from iss file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\"\n";
|
||||
$cmd= "wine ISCC.exe \"Z:$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\"";
|
||||
print "Compil exe $FILENAMEEXEDOLIWAMP.exe file from iss file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\" on OS $OS\n";
|
||||
|
||||
if ($OS eq 'windows') {
|
||||
$cmd= "ISCC.exe \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\"";
|
||||
} else {
|
||||
#$cmd= "wine ISCC.exe \"Z:$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\"";
|
||||
}
|
||||
print "$cmd\n";
|
||||
$ret= `$cmd`;
|
||||
#print "$ret\n";
|
||||
print "ret=$ret\n";
|
||||
|
||||
# Move to final dir
|
||||
print "Move \"$SOURCE\\build\\$FILENAMEEXEDOLIWAMP.exe\" to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n";
|
||||
rename("$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe","$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe");
|
||||
print "Move $SOURCE/build/$FILENAMEEXEDOLIWAMP.exe to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n";
|
||||
$ret=`mv "$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe" "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"`;
|
||||
|
||||
use File::Copy;
|
||||
|
||||
#$ret=`mv "$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe" "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"`;
|
||||
$ret=move("$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe", "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe");
|
||||
|
||||
print "Remove tmp file $SOURCE/build/exe/doliwamp/doliwamp.tmp.iss\n";
|
||||
$ret=`rm "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`;
|
||||
#$ret=`rm "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`;
|
||||
$ret=unlink("$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss");
|
||||
|
||||
next;
|
||||
}
|
||||
@ -1242,7 +1274,7 @@ if ($nboftargetok) {
|
||||
|
||||
print "\n----- Summary -----\n";
|
||||
foreach my $target (sort keys %CHOOSEDTARGET) {
|
||||
if ($target eq '-CHKSUM') { print "Checksum was generated"; next; }
|
||||
if ($target eq '-CHKSUM') { print "Checksum was generated\n"; next; }
|
||||
if ($CHOOSEDTARGET{$target} < 0) {
|
||||
print "Package $target not built (bad requirement).\n";
|
||||
} else {
|
||||
|
||||
@ -1,7 +1,34 @@
|
||||
----- Dolibarr Makepack How To -----
|
||||
This documentation describe steps to build a BETA or RELEASE versions
|
||||
of Dolibarr. There is a chapter for BETA version and a chapter for
|
||||
RELEASE version.
|
||||
of Dolibarr. There is a chapter for BETA version and a chapter for RELEASE version.
|
||||
|
||||
|
||||
***** Prerequisites For Linux *****
|
||||
|
||||
Prerequisites to build tgz, debian and rpm packages:
|
||||
> apt-get install perl tar dpkg dpatch p7zip-full rpm zip php-cli
|
||||
|
||||
Prerequisites to build autoexe DoliWamp package:
|
||||
> apt-get install wine q4wine
|
||||
> Launch "wine cmd" to check a drive Z: pointing to / exists.
|
||||
> Install InnoSetup
|
||||
For example by running isetup-5.5.8.exe (https://www.jrsoftware.org) https://files.jrsoftware.org/is/5/
|
||||
> Install WampServer into "C:\wamp64" to have Apache, PHP and MariaDB
|
||||
For example by running wampserver3.2.0_x64.exe (https://www.wampserver.com).
|
||||
See file build/exe/doliwamp.iss to know the doliwamp version currently setup.
|
||||
> Add path to ISCC into PATH windows var:
|
||||
Launch wine cmd, then regedit and add entry int HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment\PATH
|
||||
> To build manually the .exe from Windows (running from makepack-dolibarr.pl script is however recommanded),
|
||||
open file build/exe/doliwamp.iss and click on button "Compile".
|
||||
The .exe file will be build into directory build.
|
||||
|
||||
|
||||
***** Prerequisites For Windows *****
|
||||
|
||||
Install Perl
|
||||
Install WampServer-3.2.*-64.exe
|
||||
isetup-5.5.8.exe
|
||||
|
||||
|
||||
***** Actions to do a BETA *****
|
||||
This files describe steps made by Dolibarr packaging team to make a
|
||||
|
||||
@ -67,7 +67,7 @@ Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mbstring
|
||||
Requires: mysql-server, mysql
|
||||
Requires: php-mysqli >= 4.1.0
|
||||
%endif
|
||||
%endif%_datadir/dolibarr/htdocs/eventorganization
|
||||
%endif
|
||||
|
||||
%endif
|
||||
|
||||
|
||||
@ -174,7 +174,7 @@ if [ -s "$mydir/initdemopostsql.sql" ]; then
|
||||
echo A file initdemopostsql.sql was found, we execute it.
|
||||
mysql -P$port $base < "$mydir/initdemopostsql.sql"
|
||||
else
|
||||
echo No file initdemopostsql.sql found, we extra sql action done.
|
||||
echo No file initdemopostsql.sql found, so no extra sql action done.
|
||||
fi
|
||||
|
||||
|
||||
|
||||
BIN
dev/resources/iso-normes/banking/iban_registry_0.pdf
Normal file
BIN
dev/resources/iso-normes/banking/iban_registry_0.pdf
Normal file
Binary file not shown.
@ -4,4 +4,5 @@ terms
|
||||
(en) VAT = Value Added Tax
|
||||
(fr) TVA = Taxe sur la Valeur Ajouté
|
||||
(es) NIF / CIF
|
||||
(de) USt / MwSt
|
||||
(de) USt / MwSt = UmsatzSteuer / Mehrwertsteuer
|
||||
(it) IVA
|
||||
10
dev/resources/iso-normes/tax/world_tax_rates.txt
Normal file
10
dev/resources/iso-normes/tax/world_tax_rates.txt
Normal file
@ -0,0 +1,10 @@
|
||||
VAT Rates
|
||||
---------
|
||||
|
||||
https://www.taxrates.cc/index.html
|
||||
https://en.wikipedia.org/wiki/List_of_countries_by_tax_rates
|
||||
|
||||
For India: VAT=IGST / CGST=Localtax1 / SGST=Localtax2
|
||||
see:
|
||||
https://cleartax.in/s/what-is-sgst-cgst-igst
|
||||
https://www.mastersindia.co/blog/what-is-cgst-sgst-igst-and-ugst/
|
||||
@ -1,8 +0,0 @@
|
||||
VAT Rates
|
||||
---------
|
||||
|
||||
http://www.taxrates.cc/index.html
|
||||
https://en.wikipedia.org/wiki/List_of_countries_by_tax_rates
|
||||
|
||||
For India: VAT=IGST/CGST=Localtax1/SGST=Localtax2: https://cleartax.in/s/what-is-sgst-cgst-igst
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
# Syntax
|
||||
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
|
||||
then
|
||||
echo "Detect .sh and .spec files that does not contains any tab inside"
|
||||
echo "Usage: fixnotabfiles.sh [list|fix]"
|
||||
fi
|
||||
|
||||
|
||||
@ -17,14 +17,14 @@ 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 '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 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep -v 'htdocs\/includes' | 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 "CRLF" | 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 '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 "CRLF" | 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"
|
||||
|
||||
@ -39,13 +39,14 @@ optimize_image()
|
||||
max_input_size=$(expr $max_input_size + $input_file_size)
|
||||
|
||||
if [ "${1##*.}" = "png" ]; then
|
||||
#optipng -o1 -clobber -quiet $1 -out $2.firstpass
|
||||
optipng -o1 -quiet $1 -out $2.firstpass
|
||||
pngcrush -q -rem alla -reduce $2.firstpass $2 >/dev/null
|
||||
rm -fr $2.firstpass
|
||||
#optipng -o1 -clobber -quiet "$1" -out "$2.firstpass"
|
||||
echo optipng -o1 -quiet "$1" -out "$2.firstpass"
|
||||
optipng -o1 -quiet "$1" -out "$2.firstpass"
|
||||
pngcrush -q -rem alla -reduce "$2.firstpass" "$2" >/dev/null
|
||||
rm -fr "$2.firstpass"
|
||||
fi
|
||||
if [ "${1##*.}" = "jpg" -o "${1##*.}" = "jpeg" ]; then
|
||||
jpegtran -copy none -progressive $1 > $2
|
||||
jpegtran -copy none -progressive "$1" > $2
|
||||
fi
|
||||
|
||||
output_file_size=$(stat -c%s "$2")
|
||||
@ -120,8 +121,8 @@ main()
|
||||
|
||||
# Search of all jpg/jpeg/png in $INPUT
|
||||
# We remove images from $OUTPUT if $OUTPUT is a subdirectory of $INPUT
|
||||
echo "Scan $INPUT to find images"
|
||||
IMAGES=$(find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v $OUTPUT)
|
||||
echo "Scan $INPUT to find images with find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v '/gource/' | grep -v '/includes/' | grep -v '/custom/' | grep -v $OUTPUT"
|
||||
IMAGES=$(find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v '/gource/' | grep -v '/includes/' | grep -v '/custom/' | grep -v '/documents/' | grep -v $OUTPUT)
|
||||
|
||||
if [ "$QUIET" == "0" ]; then
|
||||
echo --- Optimizing $INPUT ---
|
||||
@ -135,11 +136,11 @@ main()
|
||||
printf '%*.*s' 0 $((linelength - ${#filename} - ${#sDone} )) "$pad"
|
||||
fi
|
||||
|
||||
optimize_image $CURRENT_IMAGE $OUTPUT/$filename
|
||||
optimize_image "$CURRENT_IMAGE" "$OUTPUT/$filename"
|
||||
|
||||
# Replace file
|
||||
if [[ "$INPLACE" == "1" ]]; then
|
||||
mv $OUTPUT/$filename $CURRENT_IMAGE
|
||||
mv "$OUTPUT/$filename" "$CURRENT_IMAGE"
|
||||
fi
|
||||
|
||||
if [ "$QUIET" == "0" ]; then
|
||||
|
||||
@ -52,8 +52,8 @@ $confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
$chartofaccounts = GETPOST('chartofaccounts', 'int');
|
||||
|
||||
$permissiontoadd = !empty($user->rights->accounting->chartofaccount);
|
||||
$permissiontodelete = !empty($user->rights->accounting->chartofaccount);
|
||||
$permissiontoadd = $user->hasRight('accounting', 'chartofaccount');
|
||||
$permissiontodelete = $user->hasRight('accounting', 'chartofaccount');
|
||||
|
||||
// Security check
|
||||
if ($user->socid > 0) {
|
||||
@ -294,7 +294,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
}
|
||||
|
||||
// List of mass actions available
|
||||
if ($user->rights->accounting->chartofaccount) {
|
||||
if ($user->hasRight('accounting', 'chartofaccount')) {
|
||||
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
}
|
||||
if (in_array($massaction, array('presend', 'predelete', 'closed'))) {
|
||||
@ -590,7 +590,7 @@ if ($resql) {
|
||||
|
||||
// Action
|
||||
print '<td class="center nowraponall">';
|
||||
if ($user->rights->accounting->chartofaccount) {
|
||||
if ($user->hasRight('accounting', 'chartofaccount')) {
|
||||
print '<a class="editfielda" href="./card.php?action=update&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?'.$param).'">';
|
||||
print img_edit();
|
||||
print '</a>';
|
||||
|
||||
@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
if (isModEnabled('accounting')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ $tabrowid[31] = "";
|
||||
|
||||
// Condition to show dictionary in setup page
|
||||
$tabcond = array();
|
||||
$tabcond[31] = !empty($conf->accounting->enabled);
|
||||
$tabcond[31] = isModEnabled('accounting');
|
||||
|
||||
// List of help for fields
|
||||
$tabhelp = array();
|
||||
|
||||
@ -66,7 +66,7 @@ if (GETPOST('cancel', 'alpha')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action == 'add' && $user->rights->accounting->chartofaccount) {
|
||||
if ($action == 'add' && $user->hasRight('accounting', 'chartofaccount')) {
|
||||
if (!$cancel) {
|
||||
if (!$account_number) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors');
|
||||
@ -127,7 +127,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'edit' && $user->rights->accounting->chartofaccount) {
|
||||
} elseif ($action == 'edit' && $user->hasRight('accounting', 'chartofaccount')) {
|
||||
if (!$cancel) {
|
||||
if (!$account_number) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors');
|
||||
@ -184,7 +184,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) {
|
||||
header("Location: ".$urltogo);
|
||||
exit();
|
||||
}
|
||||
} elseif ($action == 'delete' && $user->rights->accounting->chartofaccount) {
|
||||
} elseif ($action == 'delete' && $user->hasRight('accounting', 'chartofaccount')) {
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if (!empty($object->id)) {
|
||||
@ -419,13 +419,13 @@ if ($action == 'create') {
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if (!empty($user->rights->accounting->chartofaccount)) {
|
||||
if ($user->hasRight('accounting', 'chartofaccount')) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=update&token='.newToken().'&id='.$object->id.'">'.$langs->trans('Modify').'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
|
||||
if (!empty($user->rights->accounting->chartofaccount)) {
|
||||
if ($user->hasRight('accounting', 'chartofaccount')) {
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans('Delete').'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';
|
||||
|
||||
@ -111,7 +111,7 @@ $tabrowid[32] = "";
|
||||
|
||||
// Condition to show dictionary in setup page
|
||||
$tabcond = array();
|
||||
$tabcond[32] = !empty($conf->accounting->enabled);
|
||||
$tabcond[32] = isModEnabled('accounting');
|
||||
|
||||
// List of help for fields
|
||||
$tabhelp = array();
|
||||
@ -875,7 +875,7 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co
|
||||
|
||||
$formadmin = new FormAdmin($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
if (isModEnabled('accounting')) {
|
||||
$formaccounting = new FormAccounting($db);
|
||||
}
|
||||
|
||||
|
||||
@ -81,22 +81,22 @@ $list_account[] = '---Others---';
|
||||
$list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_VAT_SOLD_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_VAT_PAY_ACCOUNT';
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
if (isModEnabled('banque')) {
|
||||
$list_account[] = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
|
||||
}
|
||||
if (!empty($conf->don->enabled)) {
|
||||
if (isModEnabled('don')) {
|
||||
$list_account[] = 'DONATION_ACCOUNTINGACCOUNT';
|
||||
}
|
||||
if (!empty($conf->adherent->enabled)) {
|
||||
if (isModEnabled('adherent')) {
|
||||
$list_account[] = 'ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT';
|
||||
}
|
||||
if (!empty($conf->loan->enabled)) {
|
||||
if (isModEnabled('loan')) {
|
||||
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_CAPITAL';
|
||||
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INTEREST';
|
||||
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INSURANCE';
|
||||
}
|
||||
$list_account[] = 'ACCOUNTING_ACCOUNT_SUSPENSE';
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
if (isModEnabled('societe')) {
|
||||
$list_account[] = '---Deposits---';
|
||||
}
|
||||
|
||||
@ -133,6 +133,12 @@ if ($action == 'update') {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$constname = 'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT';
|
||||
$constvalue = GETPOST($constname, 'int');
|
||||
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
@ -155,6 +161,20 @@ if ($action == 'setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT') {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT') {
|
||||
$setDisableAuxiliaryAccountOnSupplierDeposit = GETPOST('value', 'int');
|
||||
$res = dolibarr_set_const($db, "ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnSupplierDeposit, 'yesno', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -266,7 +286,7 @@ print $formaccounting->select_account(getDolGlobalString('ACCOUNTING_ACCOUNT_CUS
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
if (!empty($conf->societe->enabled) && getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT') && getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT') != '-1') {
|
||||
if (isModEnabled('societe') && getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT') && getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT') != '-1') {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>' . img_picto('', 'bill', 'class="pictofixedwidth"') . $langs->trans("UseAuxiliaryAccountOnCustomerDeposit") . '</td>';
|
||||
if (getDolGlobalInt('ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT')) {
|
||||
@ -281,6 +301,33 @@ if (!empty($conf->societe->enabled) && getDolGlobalString('ACCOUNTING_ACCOUNT_CU
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Supplier deposit account
|
||||
print '<tr class="oddeven value">';
|
||||
// Param
|
||||
print '<td>';
|
||||
print img_picto('', 'supplier_invoice', 'class="pictofixedwidth"') . $langs->trans('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT');
|
||||
print '</td>';
|
||||
// Value
|
||||
print '<td class="right">'; // Do not force class=right, or it align also the content of the select box
|
||||
print $formaccounting->select_account(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT'), 'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT', 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
if (!empty($conf->societe->enabled) && getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT') && getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT') != '-1') {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>' . img_picto('', 'supplier_invoice', 'class="pictofixedwidth"') . $langs->trans("UseAuxiliaryAccountOnSupplierDeposit") . '</td>';
|
||||
if (getDolGlobalInt('ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT')) {
|
||||
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT&value=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT&value=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print "</div>\n";
|
||||
|
||||
|
||||
@ -121,7 +121,7 @@ if ($result) {
|
||||
$i = 0;
|
||||
|
||||
|
||||
$addbutton .= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->rights->accounting->fiscalyear->write);
|
||||
$addbutton .= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->hasRight('accounting', 'fiscalyear', 'write'));
|
||||
|
||||
|
||||
$title = $langs->trans('AccountingPeriods');
|
||||
|
||||
@ -299,7 +299,7 @@ if ($action == 'create') {
|
||||
/*
|
||||
* Action bar
|
||||
*/
|
||||
if (!empty($user->rights->accounting->fiscalyear->write)) {
|
||||
if ($user->hasRight('accounting', 'fiscalyear', 'write')) {
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$id.'">'.$langs->trans('Modify').'</a>';
|
||||
|
||||
@ -123,7 +123,7 @@ $tabrowid[35] = "";
|
||||
|
||||
// Condition to show dictionary in setup page
|
||||
$tabcond = array();
|
||||
$tabcond[35] = !empty($conf->accounting->enabled);
|
||||
$tabcond[35] = isModEnabled('accounting');
|
||||
|
||||
// List of help for fields
|
||||
$tabhelp = array();
|
||||
|
||||
@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
if (!empty($conf->categorie->enabled)) {
|
||||
if (isModEnabled('categorie')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ if (!empty($conf->categorie->enabled)) {
|
||||
$langs->loadLangs(array("companies", "compta", "accountancy", "products"));
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->bind->write)) {
|
||||
@ -522,7 +522,7 @@ if ($resql) {
|
||||
|
||||
// Filter on categories
|
||||
$moreforfilter = '';
|
||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
|
||||
if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedwidth"');
|
||||
$categoriesProductArr = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', '', 64, 0, 1);
|
||||
@ -533,7 +533,7 @@ if ($resql) {
|
||||
}
|
||||
|
||||
//Show/hide child products. Hidden by default
|
||||
if (!empty($conf->variants->enabled) && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
|
||||
if (isModEnabled('variants') && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= '<input type="checkbox" id="search_show_childproducts" name="search_show_childproducts"'.($show_childproducts ? 'checked="checked"' : '').'>';
|
||||
$moreforfilter .= ' <label for="search_show_childproducts">'.$langs->trans('ShowChildProducts').'</label>';
|
||||
|
||||
@ -142,7 +142,7 @@ if (!empty($search_ledger_code)) {
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
|
||||
@ -79,7 +79,7 @@ if (!empty($update)) {
|
||||
$object = new BookKeeping($db);
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
|
||||
@ -214,7 +214,7 @@ if (empty($listofformat[$formatexportset])) {
|
||||
|
||||
$error = 0;
|
||||
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
|
||||
@ -187,7 +187,7 @@ if ($search_date_end && empty($search_date_endyear)) {
|
||||
$search_date_endday = $tmparray['mday'];
|
||||
}
|
||||
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
|
||||
@ -863,14 +863,18 @@ class AccountingAccount extends CommonObject
|
||||
if (!empty($buyer->code_compta_product)) {
|
||||
$code_t = $buyer->code_compta_product;
|
||||
$suggestedid = $accountingAccount['thirdparty'];
|
||||
$suggestedaccountingaccountfor = 'thridparty';
|
||||
$suggestedaccountingaccountfor = 'thirdparty';
|
||||
}
|
||||
}
|
||||
|
||||
// Manage Deposit
|
||||
if ($factureDet->desc == "(DEPOSIT)" || $facture->type == $facture::TYPE_DEPOSIT) {
|
||||
$accountdeposittoventilated = new self($this->db);
|
||||
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
|
||||
if ($type=='customer') {
|
||||
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
|
||||
} elseif ($type=='supplier') {
|
||||
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT, 1);
|
||||
}
|
||||
if ($result < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -281,7 +281,7 @@ class AccountingJournal extends CommonObject
|
||||
}
|
||||
|
||||
$label_link = $this->code;
|
||||
if ($withlabel) {
|
||||
if ($withlabel && !empty($this->label)) {
|
||||
$label_link .= ' - '.($nourl ? '<span class="opacitymedium">' : '').$langs->transnoentities($this->label).($nourl ? '</span>' : '');
|
||||
}
|
||||
|
||||
@ -429,7 +429,7 @@ class AccountingJournal extends CommonObject
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
if (empty($conf->asset->enabled)) {
|
||||
if (!isModEnabled('asset')) {
|
||||
return array();
|
||||
}
|
||||
|
||||
@ -867,7 +867,7 @@ class AccountingJournal extends CommonObject
|
||||
}
|
||||
}
|
||||
//
|
||||
// if (!$error_for_line && !empty($conf->asset->enabled) && $this->nature == 1 && $bookkeeping->fk_doc > 0) {
|
||||
// if (!$error_for_line && isModEnabled('asset') && $this->nature == 1 && $bookkeeping->fk_doc > 0) {
|
||||
// // Set last cumulative depreciation
|
||||
// require_once DOL_DOCUMENT_ROOT . '/asset/class/asset.class.php';
|
||||
// $asset = new Asset($this->db);
|
||||
|
||||
@ -57,7 +57,7 @@ $search_date_end = dol_get_last_day($year_end, $month_end);
|
||||
$year_current = $year_start;
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
@ -75,7 +75,7 @@ if (empty($user->rights->accounting->fiscalyear->write)) {
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
if ($action == 'validate_movements_confirm' && !empty($user->rights->accounting->fiscalyear->write)) {
|
||||
if ($action == 'validate_movements_confirm' && $user->hasRight('accounting', 'fiscalyear', 'write')) {
|
||||
$date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
||||
$date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ $codeventil = GETPOST('codeventil', 'int');
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
|
||||
@ -40,7 +40,7 @@ $validatemonth = GETPOST('validatemonth', 'int');
|
||||
$validateyear = GETPOST('validateyear', 'int');
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
@ -77,7 +77,7 @@ $action = GETPOST('action', 'aZ09');
|
||||
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
@ -622,7 +622,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
|
||||
print '</div>';
|
||||
|
||||
|
||||
if (!empty($conf->margin->enabled)) {
|
||||
if (isModEnabled('margin')) {
|
||||
print "<br>\n";
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
@ -85,7 +85,7 @@ if (!$sortorder) {
|
||||
}
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
|
||||
@ -104,7 +104,7 @@ $accountingAccount = new AccountingAccount($db);
|
||||
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
|
||||
@ -42,7 +42,7 @@ $codeventil = GETPOST('codeventil', 'int');
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
|
||||
@ -58,7 +58,7 @@ $year_current = $year_start;
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
|
||||
@ -79,7 +79,7 @@ if (!$sortorder) {
|
||||
}
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
|
||||
@ -97,7 +97,7 @@ $accounting = new AccountingAccount($db);
|
||||
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
|
||||
@ -39,17 +39,17 @@ if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
/*
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
accessforbidden();
|
||||
}
|
||||
*/
|
||||
if (empty($conf->comptabilite->enabled) && empty($conf->accounting->enabled) && empty($conf->asset->enabled) && empty($conf->intracommreport->enabled)) {
|
||||
if (!isModEnabled('comptabilite') && !isModEnabled('accounting') && !isModEnabled('asset') && !isModEnabled('intracommreport')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->compta->resultat->lire) && empty($user->rights->accounting->comptarapport->lire) && empty($user->rights->accounting->mouvements->lire) && empty($user->rights->asset->read) && empty($user->rights->intracommreport->read)) {
|
||||
if (!$user->hasRight('compta', 'resultat', 'lire') && !$user->hasRight('accounting', 'comptarapport', 'lire') && !$user->hasRight('accounting', 'mouvements', 'lire') && !$user->hasRight('asset', 'read') && !$user->hasRight('intracommreport', 'read')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices")."</span>\n";
|
||||
print "<br>";
|
||||
} elseif (!empty($conf->accounting->enabled)) {
|
||||
} elseif (isModEnabled('accounting')) {
|
||||
$step = 0;
|
||||
|
||||
$resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
|
||||
@ -117,7 +117,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
|
||||
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
|
||||
print "<br>\n";
|
||||
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
|
||||
if (!empty($user->rights->accounting->chartofaccount)) {
|
||||
if ($user->hasRight('accounting', 'chartofaccount')) {
|
||||
print "<br>\n"; print "<br>\n";
|
||||
|
||||
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
|
||||
@ -165,7 +165,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
|
||||
if (!empty($conf->tax->enabled)) {
|
||||
if (isModEnabled('tax')) {
|
||||
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
|
||||
@ -173,7 +173,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
}
|
||||
if (!empty($conf->expensereport->enabled)) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
|
||||
if (isModEnabled('expensereport')) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>', $s);
|
||||
@ -212,7 +212,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
|
||||
if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled)) {
|
||||
if (isModEnabled('expensereport')|| isModEnabled('deplacement')) {
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '{s}')."\n";
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong></a>', $s);
|
||||
|
||||
@ -83,7 +83,7 @@ $now = dol_now();
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
|
||||
@ -58,7 +58,7 @@ if ($in_bookkeeping == '') {
|
||||
$now = dol_now();
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
|
||||
@ -61,7 +61,7 @@ $hookmanager->initHooks(array('purchasesjournal'));
|
||||
$parameters = array();
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
@ -405,8 +405,18 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
if (!empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT)) {
|
||||
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT')) {
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
} else {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
}
|
||||
} else {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
}
|
||||
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = $label_account;
|
||||
@ -952,6 +962,13 @@ if (empty($action) || $action == 'view') {
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
if (!empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT)) {
|
||||
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT')) {
|
||||
print length_accounta($tabcompany[$key]['code_compta']);
|
||||
}
|
||||
} elseif (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||
print '<span class="error">' . $langs->trans("ThirdpartyAccountNotDefined") . '</span>';
|
||||
}
|
||||
print '</td>';
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
|
||||
@ -63,7 +63,7 @@ $hookmanager->initHooks(array('sellsjournal'));
|
||||
$parameters = array();
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
|
||||
@ -83,7 +83,7 @@ if (!is_array($journal_data)) {
|
||||
}
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
|
||||
@ -42,7 +42,7 @@ $codeventil = GETPOST('codeventil', 'int');
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
|
||||
@ -89,7 +89,7 @@ if (!$sortorder) {
|
||||
$formaccounting = new FormAccounting($db);
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
|
||||
@ -106,7 +106,7 @@ $accountingAccount = new AccountingAccount($db);
|
||||
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
|
||||
@ -130,7 +130,7 @@ if ($object->id > 0) {
|
||||
|
||||
llxHeader("", $title, $help_url);
|
||||
|
||||
if (!empty($conf->notification->enabled)) {
|
||||
if (isModEnabled('notification')) {
|
||||
$langs->load("mails");
|
||||
}
|
||||
$head = member_prepare_head($object);
|
||||
|
||||
@ -179,7 +179,7 @@ abstract class ActionsAdherentCardCommon
|
||||
|
||||
if ($action == 'view' || $action == 'edit' || $action == 'delete') {
|
||||
// Emailing
|
||||
if (!empty($conf->mailing->enabled)) {
|
||||
if (isModEnabled('mailing')) {
|
||||
$langs->load("mails");
|
||||
$this->tpl['nb_emailing'] = $this->object->getNbOfEMailings();
|
||||
}
|
||||
|
||||
@ -40,6 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
@ -57,7 +58,7 @@ $userid = GETPOST('userid', 'int');
|
||||
$socid = GETPOST('socid', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
if (!empty($conf->mailmanspip->enabled)) {
|
||||
if (isModEnabled('mailmanspip')) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php';
|
||||
|
||||
$langs->load('mailmanspip');
|
||||
@ -277,7 +278,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
// Create new object
|
||||
if ($result > 0 && !$error) {
|
||||
$object->oldcopy = clone $object;
|
||||
$object->oldcopy = dol_clone($object);
|
||||
|
||||
// Change values
|
||||
$object->civility_id = trim(GETPOST("civility_id", 'alphanohtml'));
|
||||
@ -311,8 +312,8 @@ if (empty($reshook)) {
|
||||
//$object->twitter = trim(GETPOST("twitter", 'alpha'));
|
||||
//$object->facebook = trim(GETPOST("facebook", 'alpha'));
|
||||
//$object->linkedin = trim(GETPOST("linkedin", 'alpha'));
|
||||
$object->birth = $birthdate;
|
||||
|
||||
$object->birth = $birthdate;
|
||||
$object->default_lang = GETPOST('default_lang', 'alpha');
|
||||
$object->typeid = GETPOST("typeid", 'int');
|
||||
//$object->note = trim(GETPOST("comment","alpha"));
|
||||
$object->morphy = GETPOST("morphy", 'alpha');
|
||||
@ -457,6 +458,7 @@ if (empty($reshook)) {
|
||||
|
||||
$userid = GETPOST("userid", 'int');
|
||||
$socid = GETPOST("socid", 'int');
|
||||
$default_lang = GETPOST('default_lang', 'alpha');
|
||||
|
||||
$object->civility_id = $civility_id;
|
||||
$object->firstname = $firstname;
|
||||
@ -473,7 +475,7 @@ if (empty($reshook)) {
|
||||
$object->phone_perso = $phone_perso;
|
||||
$object->phone_mobile = $phone_mobile;
|
||||
$object->socialnetworks = array();
|
||||
if (!empty($conf->socialnetworks->enabled)) {
|
||||
if (isModEnabled('socialnetworks')) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') {
|
||||
$object->socialnetworks[$key] = GETPOST("member_".$key, 'alphanohtml');
|
||||
@ -498,7 +500,7 @@ if (empty($reshook)) {
|
||||
$object->user_id = $userid;
|
||||
$object->socid = $socid;
|
||||
$object->public = $public;
|
||||
|
||||
$object->default_lang = $default_lang;
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
if ($ret < 0) {
|
||||
@ -580,36 +582,15 @@ if (empty($reshook)) {
|
||||
$id = $object->id;
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
if ($object->error) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// Auto-create thirdparty on member creation
|
||||
if (!empty($conf->global->ADHERENT_DEFAULT_CREATE_THIRDPARTY)) {
|
||||
if ($result > 0) {
|
||||
// User creation
|
||||
// Create third party out of a member
|
||||
$company = new Societe($db);
|
||||
|
||||
$companyalias = '';
|
||||
$fullname = $object->getFullName($langs);
|
||||
|
||||
if ($object->morphy == 'mor') {
|
||||
$companyname = $object->company;
|
||||
if (!empty($fullname)) {
|
||||
$companyalias = $fullname;
|
||||
}
|
||||
} else {
|
||||
$companyname = $fullname;
|
||||
if (!empty($object->company)) {
|
||||
$companyalias = $object->company;
|
||||
}
|
||||
}
|
||||
|
||||
$result = $company->create_from_member($object, $companyname, $companyalias);
|
||||
|
||||
$result = $company->create_from_member($object);
|
||||
if ($result < 0) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans($company->error), null, 'errors');
|
||||
@ -621,6 +602,11 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
$action = ($result < 0 || !$error) ? '' : 'create';
|
||||
|
||||
if (!$error && $backtopage) {
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes') {
|
||||
@ -894,6 +880,7 @@ if (empty($reshook)) {
|
||||
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$formadmin = new FormAdmin($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
|
||||
$title = $langs->trans("Member")." - ".$langs->trans("Card");
|
||||
@ -1102,7 +1089,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td>';
|
||||
print '<td>'.img_picto('', 'object_phoning_mobile', 'class="pictofixedwidth"').'<input type="text" name="phone_mobile" size="20" value="'.(GETPOSTISSET('phone_mobile') ? GETPOST('phone_mobile', 'alpha') : $object->phone_mobile).'"></td></tr>';
|
||||
|
||||
if (!empty($conf->socialnetworks->enabled)) {
|
||||
if (isModEnabled('socialnetworks')) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (!$value['active']) {
|
||||
break;
|
||||
@ -1123,7 +1110,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Categories
|
||||
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
|
||||
if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
|
||||
print '<tr><td>'.$form->editfieldkey("Categories", 'memcats', '', $object, 0).'</td><td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, 'parent', null, null, 1);
|
||||
print img_picto('', 'category').$form->multiselectarray('memcats', $cate_arbo, GETPOST('memcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
|
||||
@ -1344,7 +1331,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td>';
|
||||
print '<td>'.img_picto('', 'object_phoning_mobile', 'class="pictofixedwidth"').'<input type="text" name="phone_mobile" value="'.(GETPOSTISSET("phone_mobile") ? GETPOST("phone_mobile") : $object->phone_mobile).'"></td></tr>';
|
||||
|
||||
if (!empty($conf->socialnetworks->enabled)) {
|
||||
if (isModEnabled('socialnetworks')) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (!$value['active']) {
|
||||
break;
|
||||
@ -1358,13 +1345,21 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print $form->selectDate(($object->birth ? $object->birth : -1), 'birth', '', '', 1, 'formsoc');
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Default language
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) {
|
||||
print '<tr><td>'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).'</td><td colspan="3">'."\n";
|
||||
print img_picto('', 'language').$formadmin->select_language($object->default_lang, 'default_lang', 0, 0, 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Public profil
|
||||
print "<tr><td>".$langs->trans("Public")."</td><td>\n";
|
||||
print $form->selectyesno("public", (GETPOSTISSET("public") ? GETPOST("public", 'alphanohtml', 2) : $object->public), 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Categories
|
||||
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
|
||||
if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
|
||||
print '<tr><td>'.$form->editfieldkey("Categories", 'memcats', '', $object, 0).'</td>';
|
||||
print '<td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1);
|
||||
@ -1381,7 +1376,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
}
|
||||
|
||||
// Third party Dolibarr
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
if (isModEnabled('societe')) {
|
||||
print '<tr><td>'.$langs->trans("LinkedToDolibarrThirdParty").'</td><td colspan="2" class="valeur">';
|
||||
if ($object->socid) {
|
||||
$company = new Societe($db);
|
||||
@ -1454,12 +1449,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$formquestion = array(
|
||||
array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login)
|
||||
);
|
||||
if (!empty($conf->societe->enabled) && $object->socid > 0) {
|
||||
if (isModEnabled('societe') && $object->socid > 0) {
|
||||
$object->fetch_thirdparty();
|
||||
$formquestion[] = array('label' => $langs->trans("UserWillBe"), 'type' => 'radio', 'name' => 'internalorexternal', 'default'=>'external', 'values' => array('external'=>$langs->trans("External").' - '.$langs->trans("LinkedToDolibarrThirdParty").' '.$object->thirdparty->getNomUrl(1, '', 0, 1), 'internal'=>$langs->trans("Internal")));
|
||||
}
|
||||
$text = '';
|
||||
if (!empty($conf->societe->enabled) && $object->socid <= 0) {
|
||||
if (isModEnabled('societe') && $object->socid <= 0) {
|
||||
$text .= $langs->trans("UserWillBeInternalUser").'<br>';
|
||||
}
|
||||
$text .= $langs->trans("ConfirmCreateLogin");
|
||||
@ -1544,12 +1539,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Create form popup
|
||||
$formquestion = array();
|
||||
if ($object->email) {
|
||||
$formquestion[] = array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL ?true:false));
|
||||
$formquestion[] = array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (getDolGlobalString('ADHERENT_DEFAULT_SENDINFOBYMAIL') ? true : false));
|
||||
}
|
||||
if (!empty($conf->mailman->enabled) && !empty($conf->global->ADHERENT_USE_MAILMAN)) {
|
||||
if (isModEnabled('mailman') && !empty($conf->global->ADHERENT_USE_MAILMAN)) {
|
||||
$formquestion[] = array('type'=>'other', 'label'=>$langs->transnoentitiesnoconv("SynchroMailManEnabled"), 'value'=>'');
|
||||
}
|
||||
if (!empty($conf->mailman->enabled) && !empty($conf->global->ADHERENT_USE_SPIP)) {
|
||||
if (isModEnabled('mailman') && !empty($conf->global->ADHERENT_USE_SPIP)) {
|
||||
$formquestion[] = array('type'=>'other', 'label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"), 'value'=>'');
|
||||
}
|
||||
print $form->formconfirm("card.php?rowid=".$id, $langs->trans("ValidateMember"), $langs->trans("ConfirmValidateMember"), "confirm_valid", $formquestion, 'yes', 1, 220);
|
||||
@ -1575,7 +1570,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$outputlangs->loadLangs(array("main", "members"));
|
||||
// Get email content from template
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION;
|
||||
$labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_CANCELATION');
|
||||
|
||||
if (!empty($labeltouse)) {
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
@ -1697,7 +1692,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
|
||||
$rowspan++;
|
||||
}
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
if (isModEnabled('societe')) {
|
||||
$rowspan++;
|
||||
}
|
||||
|
||||
@ -1788,7 +1783,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
// Tags / Categories
|
||||
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
|
||||
if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
|
||||
@ -1798,6 +1793,19 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Birth Date
|
||||
print '<tr><td class="titlefield">'.$langs->trans("DateOfBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
|
||||
|
||||
// Default language
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
print '<tr><td>'.$langs->trans("DefaultLang").'</td><td>';
|
||||
//$s=picto_from_langcode($object->default_lang);
|
||||
//print ($s?$s.' ':'');
|
||||
$langs->load("languages");
|
||||
$labellang = ($object->default_lang ? $langs->trans('Language_'.$object->default_lang) : '');
|
||||
print picto_from_langcode($object->default_lang, 'class="paddingrightonly saturatemedium opacitylow"');
|
||||
print $labellang;
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Public
|
||||
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
|
||||
|
||||
@ -1805,7 +1813,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
// Third party Dolibarr
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
if (isModEnabled('societe')) {
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->adherent->creer;
|
||||
print $form->editfieldkey('LinkedToDolibarrThirdParty', 'thirdparty', '', $object, $editenable);
|
||||
@ -1943,7 +1951,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
}
|
||||
|
||||
// Create third party
|
||||
if (!empty($conf->societe->enabled) && !$object->socid) {
|
||||
if (isModEnabled('societe') && !$object->socid) {
|
||||
if ($user->rights->societe->creer) {
|
||||
if (Adherent::STATUS_DRAFT != $object->statut) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=create_thirdparty" title="'.dol_escape_htmltag($langs->trans("CreateDolibarrThirdPartyDesc")).'">'.$langs->trans("CreateDolibarrThirdParty").'</a>'."\n";
|
||||
@ -1969,7 +1977,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
}
|
||||
|
||||
// Action SPIP
|
||||
if (!empty($conf->mailmanspip->enabled) && !empty($conf->global->ADHERENT_USE_SPIP)) {
|
||||
if (isModEnabled('mailmanspip') && !empty($conf->global->ADHERENT_USE_SPIP)) {
|
||||
$isinspip = $mailmanspip->is_in_spip($object);
|
||||
|
||||
if ($isinspip == 1) {
|
||||
@ -2026,7 +2034,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
*/
|
||||
|
||||
// Show online payment link
|
||||
$useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled));
|
||||
$useonlinepayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox'));
|
||||
|
||||
if ($useonlinepayment) {
|
||||
print '<br>';
|
||||
|
||||
@ -215,6 +215,12 @@ class Adherent extends CommonObject
|
||||
*/
|
||||
public $public;
|
||||
|
||||
/**
|
||||
* Default language code of member (en_US, ...)
|
||||
* @var string
|
||||
*/
|
||||
public $default_lang;
|
||||
|
||||
/**
|
||||
* @var string photo of member
|
||||
*/
|
||||
@ -328,6 +334,7 @@ class Adherent extends CommonObject
|
||||
'photo' => array('type' => 'varchar(255)', 'label' => 'Photo', 'enabled' => 1, 'visible' => -1, 'position' => 135),
|
||||
'public' => array('type' => 'smallint(6)', 'label' => 'Public', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 145),
|
||||
'datefin' => array('type' => 'datetime', 'label' => 'DateEnd', 'enabled' => 1, 'visible' => -1, 'position' => 150),
|
||||
'default_lang' =>array('type'=>'varchar(6)', 'label'=>'Default lang', 'enabled'=>1, 'visible'=>-1, 'position'=> 153),
|
||||
'note_private' => array('type' => 'text', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 155),
|
||||
'note_public' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 160),
|
||||
'datevalid' => array('type' => 'datetime', 'label' => 'DateValidation', 'enabled' => 1, 'visible' => -1, 'position' => 165),
|
||||
@ -670,11 +677,10 @@ class Adherent extends CommonObject
|
||||
$this->town = ($this->town ? $this->town : $this->town);
|
||||
$this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id);
|
||||
$this->state_id = ($this->state_id > 0 ? $this->state_id : $this->state_id);
|
||||
$this->setUpperOrLowerCase();
|
||||
$this->note_public = ($this->note_public ? $this->note_public : $this->note_public);
|
||||
$this->note_private = ($this->note_private ? $this->note_private : $this->note_private);
|
||||
$this->url = $this->url ?clean_url($this->url, 0) : '';
|
||||
|
||||
$this->setUpperOrLowerCase();
|
||||
// Check parameters
|
||||
if (!empty($conf->global->ADHERENT_MAIL_REQUIRED) && !isValidEMail($this->email)) {
|
||||
$langs->load("errors");
|
||||
@ -711,9 +717,11 @@ class Adherent extends CommonObject
|
||||
$sql .= ", photo = ".($this->photo ? "'".$this->db->escape($this->photo)."'" : "null");
|
||||
$sql .= ", public = '".$this->db->escape($this->public)."'";
|
||||
$sql .= ", statut = ".$this->db->escape($this->statut);
|
||||
$sql .= ", default_lang = ".(!empty($this->default_lang) ? "'".$this->db->escape($this->default_lang)."'" : "null");
|
||||
$sql .= ", fk_adherent_type = ".$this->db->escape($this->typeid);
|
||||
$sql .= ", morphy = '".$this->db->escape($this->morphy)."'";
|
||||
$sql .= ", birth = ".($this->birth ? "'".$this->db->idate($this->birth)."'" : "null");
|
||||
|
||||
if ($this->datefin) {
|
||||
$sql .= ", datefin = '".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription
|
||||
}
|
||||
@ -834,6 +842,8 @@ class Adherent extends CommonObject
|
||||
$luser->office_phone = $this->phone;
|
||||
$luser->user_mobile = $this->phone_mobile;
|
||||
|
||||
$luser->lang = $this->default_lang;
|
||||
|
||||
$luser->fk_member = $this->id;
|
||||
|
||||
$result = $luser->update($user, 0, 1, 1); // Use nosync to 1 to avoid cyclic updates
|
||||
@ -869,6 +879,7 @@ class Adherent extends CommonObject
|
||||
$lthirdparty->state_id = $this->state_id;
|
||||
$lthirdparty->country_id = $this->country_id;
|
||||
//$lthirdparty->phone_mobile=$this->phone_mobile;
|
||||
$lthirdparty->default_lang = $this->default_lang;
|
||||
|
||||
$result = $lthirdparty->update($this->fk_soc, $user, 0, 1, 1, 'update'); // Use sync to 0 to avoid cyclic updates
|
||||
|
||||
@ -961,10 +972,10 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Fonction qui supprime l'adherent et les donnees associees
|
||||
* Fonction to delete a member and its data
|
||||
*
|
||||
* @param int $rowid Id of member to delete
|
||||
* @param User $user User object
|
||||
* @param User $user User object
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @return int <0 if KO, 0=nothing to do, >0 if OK
|
||||
*/
|
||||
@ -1315,7 +1326,7 @@ class Adherent extends CommonObject
|
||||
$sql .= " d.photo, d.fk_adherent_type, d.morphy, d.entity,";
|
||||
$sql .= " d.datec as datec,";
|
||||
$sql .= " d.tms as datem,";
|
||||
$sql .= " d.datefin as datefin,";
|
||||
$sql .= " d.datefin as datefin, d.default_lang,";
|
||||
$sql .= " d.birth as birthday,";
|
||||
$sql .= " d.datevalid as datev,";
|
||||
$sql .= " d.country,";
|
||||
@ -1408,6 +1419,8 @@ class Adherent extends CommonObject
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
$this->birth = $this->db->jdate($obj->birthday);
|
||||
|
||||
$this->default_lang = $obj->default_lang;
|
||||
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->morphy = $obj->morphy;
|
||||
@ -1813,7 +1826,7 @@ class Adherent extends CommonObject
|
||||
if (!$error) {
|
||||
// Create payment line for invoice
|
||||
$paiement_id = $paiement->create($user);
|
||||
if (!$paiement_id > 0) {
|
||||
if (!($paiement_id > 0)) {
|
||||
$this->error = $paiement->error;
|
||||
$this->errors = $paiement->errors;
|
||||
$error++;
|
||||
@ -2557,6 +2570,7 @@ class Adherent extends CommonObject
|
||||
|
||||
$this->datefin = $now;
|
||||
$this->datevalid = $now;
|
||||
$this->default_lang = '';
|
||||
|
||||
$this->typeid = 1; // Id type adherent
|
||||
$this->type = 'Type adherent'; // Libelle type adherent
|
||||
|
||||
@ -440,6 +440,7 @@ class AdherentType extends CommonObject
|
||||
|
||||
/**
|
||||
* Function to delete the member's status
|
||||
* TODO Add param "User $user"
|
||||
*
|
||||
* @return int > 0 if OK, 0 if not found, < 0 if KO
|
||||
*/
|
||||
|
||||
@ -128,7 +128,7 @@ if ($id > 0) {
|
||||
$totalsize += $file['size'];
|
||||
}
|
||||
|
||||
if (!empty($conf->notification->enabled)) {
|
||||
if (isModEnabled('notification')) {
|
||||
$langs->load("mails");
|
||||
}
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ $sortfield = GETPOST('sortfield', 'alphanohtml');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09');
|
||||
|
||||
// Security check
|
||||
if (empty($conf->adherent->enabled)) {
|
||||
if (!isModEnabled('adherent')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->adherent->export)) {
|
||||
|
||||
@ -659,7 +659,7 @@ if ($sall) {
|
||||
|
||||
// Filter on categories
|
||||
$moreforfilter = '';
|
||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
|
||||
if (isModEnabled('categorie') && $user->rights->categorie->lire) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedlength"').$formother->select_categories(Categorie::TYPE_MEMBER, $search_categ, 'search_categ', 1);
|
||||
|
||||
@ -88,7 +88,7 @@ $upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $o
|
||||
if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') != 'member') {
|
||||
accessforbidden('Partnership module is not activated for members');
|
||||
}
|
||||
if (empty($conf->partnership->enabled)) {
|
||||
if (!isModEnabled('partnership')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($permissiontoread)) {
|
||||
|
||||
@ -89,7 +89,7 @@ $arrayfields = array(
|
||||
'd.firstname'=>array('label'=>"Firstname", 'checked'=>1),
|
||||
'd.login'=>array('label'=>"Login", 'checked'=>1),
|
||||
't.libelle'=>array('label'=>"Label", 'checked'=>1),
|
||||
'd.bank'=>array('label'=>"BankAccount", 'checked'=>1, 'enabled'=>(!empty($conf->banque->enabled))),
|
||||
'd.bank'=>array('label'=>"BankAccount", 'checked'=>1, 'enabled'=>(isModEnabled('banque'))),
|
||||
/*'d.note_public'=>array('label'=>"NotePublic", 'checked'=>0),
|
||||
'd.note_private'=>array('label'=>"NotePrivate", 'checked'=>0),*/
|
||||
'c.dateadh'=>array('label'=>"DateSubscription", 'checked'=>1, 'position'=>100),
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2019 Thibault Foucart <support@ptibogxiv.net>
|
||||
* Copyright (C) 2019-2022 Thibault Foucart <support@ptibogxiv.net>
|
||||
* Copyright (C) 2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
|
||||
*
|
||||
@ -41,6 +41,7 @@ $langs->load("members");
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$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');
|
||||
|
||||
$sall = GETPOST("sall", "alpha");
|
||||
@ -141,6 +142,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
|
||||
} else {
|
||||
$sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."adherent_type WHERE libelle='".$db->escape($object->label)."'";
|
||||
$sql .= " WHERE entity IN (".getEntity('member_type').")";
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
@ -169,7 +171,8 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
|
||||
if ($action == 'update' && $user->rights->adherent->configurer) {
|
||||
$object->fetch($rowid);
|
||||
|
||||
$object->oldcopy = clone $object;
|
||||
$object->oldcopy = dol_clone($object);
|
||||
|
||||
$object->label= trim($label);
|
||||
$object->morphy = trim($morphy);
|
||||
$object->status = (int) $status;
|
||||
@ -200,7 +203,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && $user->rights->adherent->configurer) {
|
||||
if ($action == 'confirm_delete' && !empty($user->rights->adherent->configurer)) {
|
||||
$object->fetch($rowid);
|
||||
$res = $object->delete();
|
||||
|
||||
@ -446,7 +449,7 @@ if ($rowid > 0) {
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="tableforfield border centpercent">';
|
||||
|
||||
// Morphy
|
||||
print '<tr><td>'.$langs->trans("MembersNature").'</td><td class="valeur" >'.$object->getmorphylib($object->morphy).'</td>';
|
||||
@ -680,20 +683,23 @@ if ($rowid > 0) {
|
||||
print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < $num && $i < $conf->liste_limit) {
|
||||
$adh = new Adherent($db);
|
||||
|
||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||
while ($i < $imaxinloop) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$datefin = $db->jdate($objp->datefin);
|
||||
|
||||
$adh = new Adherent($db);
|
||||
$adh->lastname = $objp->lastname;
|
||||
$adh->firstname = $objp->firstname;
|
||||
$adh->datefin = $datefin;
|
||||
$adh->need_subscription = $objp->subscription;
|
||||
$adh->statut = $objp->status;
|
||||
|
||||
// Lastname
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Lastname
|
||||
if ($objp->company != '') {
|
||||
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user", 'class="paddingright"').$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->company, 12).'</a></td>'."\n";
|
||||
} else {
|
||||
@ -701,7 +707,7 @@ if ($rowid > 0) {
|
||||
}
|
||||
|
||||
// Login
|
||||
print "<td>".$objp->login."</td>\n";
|
||||
print "<td>".dol_escape_htmltag($objp->login)."</td>\n";
|
||||
|
||||
// Type
|
||||
/*print '<td class="nowrap">';
|
||||
@ -758,11 +764,15 @@ if ($rowid > 0) {
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($i == 0) {
|
||||
print '<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
|
||||
if ($num > $conf->liste_limit) {
|
||||
if ($num > $limit) {
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('members', 'languages'));
|
||||
|
||||
$id = GETPOST('rowid', 'int');
|
||||
$id = GETPOST('rowid', 'int') ? GETPOST('rowid', 'int') : GETPOST('id', 'int');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$ref = GETPOST('ref', 'alphanohtml');
|
||||
@ -61,7 +61,12 @@ if ($cancel == $langs->trans("Cancel")) {
|
||||
if ($action == 'delete' && GETPOST('langtodelete', 'alpha')) {
|
||||
$object = new AdherentType($db);
|
||||
$object->fetch($id);
|
||||
$object->delMultiLangs(GETPOST('langtodelete', 'alpha'), $user);
|
||||
$result = $object->delMultiLangs(GETPOST('langtodelete', 'alpha'), $user);
|
||||
if ($result > 0) {
|
||||
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
||||
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Add translation
|
||||
|
||||
@ -184,7 +184,7 @@ if (!empty($triggers)) {
|
||||
}
|
||||
|
||||
//print 'module='.$module.' code='.$trigger['code'].'<br>';
|
||||
if (!empty($conf->$module->enabled)) {
|
||||
if (isModEnabled('module')) {
|
||||
// Discard special case: If option FICHINTER_CLASSIFY_BILLED is not set, we discard both trigger FICHINTER_CLASSIFY_BILLED and FICHINTER_CLASSIFY_UNBILLED
|
||||
if ($trigger['code'] == 'FICHINTER_CLASSIFY_BILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) {
|
||||
continue;
|
||||
|
||||
@ -66,7 +66,7 @@ if (preg_match('/set_(.*)/', $action, $reg)) {
|
||||
$value = (GETPOST($code) ? GETPOST($code) : 1);
|
||||
|
||||
$res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
|
||||
if (!$res > 0) {
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
@ -86,7 +86,7 @@ if (preg_match('/set_(.*)/', $action, $reg)) {
|
||||
$code = $reg[1];
|
||||
|
||||
$res = dolibarr_del_const($db, $code, $conf->entity);
|
||||
if (!$res > 0) {
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ $job->fetch(0, 'ActionComm', 'sendEmailsReminder');
|
||||
// AGENDA REMINDER EMAIL
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans('AGENDA_REMINDER_EMAIL', $langs->transnoentities("Module2300Name"));
|
||||
if (!empty($conf->cron->enabled)) {
|
||||
if (isModEnabled('cron')) {
|
||||
if (!empty($conf->global->AGENDA_REMINDER_EMAIL)) {
|
||||
if ($job->id > 0) {
|
||||
if ($job->status == $job::STATUS_ENABLED) {
|
||||
@ -219,7 +219,7 @@ print '</td>'."\n";
|
||||
print '<td class="center"> </td>'."\n";
|
||||
print '<td class="right nowraponall">'."\n";
|
||||
|
||||
if (empty($conf->cron->enabled)) {
|
||||
if (!isModEnabled('cron')) {
|
||||
print '<span class="opacitymedium">'.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("Module2300Name")).'</span>';
|
||||
} else {
|
||||
if (empty($conf->global->AGENDA_REMINDER_EMAIL)) {
|
||||
|
||||
@ -190,7 +190,7 @@ foreach ($dirbarcode as $reldir) {
|
||||
|
||||
|
||||
// Select barcode numbering module
|
||||
if ($conf->product->enabled) {
|
||||
if (isModEnabled('product')) {
|
||||
print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("Product").")", '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
@ -252,7 +252,7 @@ if ($conf->product->enabled) {
|
||||
}
|
||||
|
||||
// Select barcode numbering module
|
||||
if ($conf->societe->enabled) {
|
||||
if (isModEnabled('societe')) {
|
||||
print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("ThirdParty").")", '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
@ -396,7 +396,7 @@ if ($resql) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print $langs->trans("ChooseABarCode");
|
||||
print '<span class="opacitymedium">'.$langs->trans("ChooseABarCode").'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -439,7 +439,7 @@ if (!isset($_SERVER['WINDIR'])) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("GenbarcodeLocation").'</td>';
|
||||
print '<td width="60" class="center">';
|
||||
print '<input type="text" size="40" name="GENBARCODE_LOCATION" value="'.$conf->global->GENBARCODE_LOCATION.'">';
|
||||
print '<input type="text" size="40" name="GENBARCODE_LOCATION" value="'.getDolGlobalString('GENBARCODE_LOCATION').'">';
|
||||
if (!empty($conf->global->GENBARCODE_LOCATION) && !@file_exists($conf->global->GENBARCODE_LOCATION)) {
|
||||
$langs->load("errors");
|
||||
print '<br><span class="error">'.$langs->trans("ErrorFileNotFound", $conf->global->GENBARCODE_LOCATION).'</span>';
|
||||
@ -450,7 +450,7 @@ if (!isset($_SERVER['WINDIR'])) {
|
||||
}
|
||||
|
||||
// Module products
|
||||
if (!empty($conf->product->enabled)) {
|
||||
if (isModEnabled('product')) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("SetDefaultBarcodeTypeProducts").'</td>';
|
||||
print '<td width="60" class="right">';
|
||||
@ -461,7 +461,7 @@ if (!empty($conf->product->enabled)) {
|
||||
}
|
||||
|
||||
// Module thirdparty
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
if (isModEnabled('societe')) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("SetDefaultBarcodeTypeThirdParties").'</td>';
|
||||
print '<td width="60" class="right">';
|
||||
|
||||
@ -466,7 +466,7 @@ print '<input class="maxwidth300 widthcentpercentminusx" name="web" id="web" val
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Barcode
|
||||
if (!empty($conf->barcode->enabled)) {
|
||||
if (isModEnabled('barcode')) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<label for="barcode">'.$langs->trans("Gencod").'</label></td><td>';
|
||||
print '<span class="fa fa-barcode pictofixedwidth"></span>';
|
||||
|
||||
@ -142,7 +142,7 @@ if ($action == 'updateMask') {
|
||||
$value = GETPOST('activate_hideClosedServiceByDefault', 'alpha');
|
||||
$res3 = dolibarr_set_const($db, "CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT", $value, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (!$res1 > 0 || !$res2 > 0 || !$res3 > 0) {
|
||||
if (!($res1 > 0) || !($res2 > 0) || !($res3 > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
@ -90,12 +90,12 @@ print '<input type="hidden" name="action" value="set">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td>';
|
||||
print '<td class="right"><input type="submit" class="button button-edit" '.$option.' value="'.$langs->trans("Modify").'"></td>';
|
||||
print '<td class="right"><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td class="nowrap">'.$langs->trans("DEBUGBAR_USE_LOG_FILE").'</td>';
|
||||
print '<td>';
|
||||
print $form->selectyesno('DEBUGBAR_USE_LOG_FILE', $conf->global->DEBUGBAR_USE_LOG_FILE, 1);
|
||||
print $form->selectyesno('DEBUGBAR_USE_LOG_FILE', !empty($conf->global->DEBUGBAR_USE_LOG_FILE), 1);
|
||||
print '</td><td>';
|
||||
print '<span class="opacitymedium"> '.$langs->trans("UsingLogFileShowAllRecordOfSubrequestButIsSlower").'</span>';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -622,34 +622,33 @@ $sourceList = array();
|
||||
if ($id == 11) {
|
||||
$elementList = array(
|
||||
'' => '',
|
||||
'societe' => $langs->trans('ThirdParty'),
|
||||
'agenda' => img_picto('', 'action', 'class="pictofixedwidth"').$langs->trans('Agenda'),
|
||||
'dolresource' => img_picto('', 'resource', 'class="pictofixedwidth"').$langs->trans('Resource'),
|
||||
'societe' => img_picto('', 'company', 'class="pictofixedwidth"').$langs->trans('ThirdParty'),
|
||||
// 'proposal' => $langs->trans('Proposal'),
|
||||
// 'order' => $langs->trans('Order'),
|
||||
// 'invoice' => $langs->trans('Bill'),
|
||||
'supplier_proposal' => $langs->trans('SupplierProposal'),
|
||||
'order_supplier' => $langs->trans('SupplierOrder'),
|
||||
'invoice_supplier' => $langs->trans('SupplierBill'),
|
||||
// 'intervention' => $langs->trans('InterventionCard'),
|
||||
// 'contract' => $langs->trans('Contract'),
|
||||
'project' => $langs->trans('Project'),
|
||||
'project_task' => $langs->trans('Task'),
|
||||
'ticket' => $langs->trans('Ticket'),
|
||||
'agenda' => $langs->trans('Agenda'),
|
||||
'dolresource' => $langs->trans('Resource'),
|
||||
// old deprecated
|
||||
'propal' => $langs->trans('Proposal'),
|
||||
'commande' => $langs->trans('Order'),
|
||||
'facture' => $langs->trans('Bill'),
|
||||
'fichinter' => $langs->trans('InterventionCard'),
|
||||
'contrat' => $langs->trans('Contract'),
|
||||
'project' => img_picto('', 'project', 'class="pictofixedwidth"').$langs->trans('Project'),
|
||||
'project_task' => img_picto('', 'projecttask', 'class="pictofixedwidth"').$langs->trans('Task'),
|
||||
'propal' => img_picto('', 'propal', 'class="pictofixedwidth"').$langs->trans('Proposal'),
|
||||
'commande' => img_picto('', 'order', 'class="pictofixedwidth"').$langs->trans('Order'),
|
||||
'facture' => img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans('Bill'),
|
||||
'fichinter' => img_picto('', 'intervention', 'class="pictofixedwidth"').$langs->trans('InterventionCard'),
|
||||
'contrat' => img_picto('', 'contract', 'class="pictofixedwidth"').$langs->trans('Contract'),
|
||||
'ticket' => img_picto('', 'ticket', 'class="pictofixedwidth"').$langs->trans('Ticket'),
|
||||
'supplier_proposal' => img_picto('', 'supplier_proposal', 'class="pictofixedwidth"').$langs->trans('SupplierProposal'),
|
||||
'order_supplier' => img_picto('', 'supplier_order', 'class="pictofixedwidth"').$langs->trans('SupplierOrder'),
|
||||
'invoice_supplier' => img_picto('', 'supplier_invoice', 'class="pictofixedwidth"').$langs->trans('SupplierBill'),
|
||||
);
|
||||
if (!empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) {
|
||||
$elementList["societe"] = $langs->trans('ThirdParty');
|
||||
if (!empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
$elementList['conferenceorbooth'] = img_picto('', 'eventorganization', 'class="pictofixedwidth"').$langs->trans('ConferenceOrBooth');
|
||||
}
|
||||
|
||||
complete_elementList_with_modules($elementList);
|
||||
|
||||
asort($elementList);
|
||||
//asort($elementList);
|
||||
$sourceList = array(
|
||||
'internal' => $langs->trans('Internal'),
|
||||
'external' => $langs->trans('External')
|
||||
@ -1202,7 +1201,6 @@ if (GETPOST('from')) {
|
||||
if ($action == 'delete') {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'rowid='.urlencode($rowid).'&code='.urlencode($code).$paramwithsearch, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
//var_dump($elementList);
|
||||
|
||||
|
||||
/*
|
||||
@ -1222,14 +1220,16 @@ if ($id > 0) {
|
||||
$sql .= natural_search("code_iso", $search_code);
|
||||
} elseif ($search_code != '' && $id == 28) {
|
||||
$sql .= natural_search("h.code", $search_code);
|
||||
} elseif ($search_code != '' && $id == 32) {
|
||||
} elseif ($search_code != '' && ($id == 7 || $id == 32)) {
|
||||
$sql .= natural_search("a.code", $search_code);
|
||||
} elseif ($search_code != '' && $id == 3) {
|
||||
$sql .= natural_search("r.code_region", $search_code);
|
||||
} elseif ($search_code != '' && $id == 7) {
|
||||
$sql .= natural_search("a.code", $search_code);
|
||||
} elseif ($search_code != '' && $id == 10) {
|
||||
} elseif ($search_code != '' && ($id == 8 || $id == 10)) {
|
||||
$sql .= natural_search("t.code", $search_code);
|
||||
} elseif ($search_code != '' && $id == 1) {
|
||||
$sql .= natural_search("f.code", $search_code);
|
||||
} elseif ($search_code != '' && $id == 2) {
|
||||
$sql .= natural_search("d.code_departement", $search_code);
|
||||
} elseif ($search_code != '' && $id != 9) {
|
||||
$sql .= natural_search("code", $search_code);
|
||||
}
|
||||
@ -1960,7 +1960,7 @@ if ($id > 0) {
|
||||
$valuetoshow = price($valuetoshow);
|
||||
}
|
||||
if ($value == 'private') {
|
||||
$valuetoshow = yn($elementList[$valuetoshow]);
|
||||
$valuetoshow = yn($valuetoshow);
|
||||
} elseif ($value == 'libelle_facture') {
|
||||
$langs->load("bills");
|
||||
$key = $langs->trans("PaymentCondition".strtoupper($obj->code));
|
||||
@ -2375,9 +2375,15 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
print '<td>';
|
||||
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'lang');
|
||||
print '</td>';
|
||||
} elseif (in_array($value, array('element', 'source'))) { //Example: the type and source of the element (for contact types)
|
||||
} elseif (in_array($value, array('element', 'source'))) { // Example: the type and source of the element (for contact types)
|
||||
$tmparray = array();
|
||||
if ($value == 'element') {
|
||||
$tmparray = $elementList;
|
||||
} else {
|
||||
$tmparray = $sourceList;
|
||||
}
|
||||
print '<td>';
|
||||
print $form->selectarray($value, $elementList, (!empty($obj->{$value}) ? $obj->{$value}:''));
|
||||
print $form->selectarray($value, $tmparray, (!empty($obj->{$value}) ? $obj->{$value}:''), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth250');
|
||||
print '</td>';
|
||||
} elseif (in_array($value, array('public', 'use_default'))) {
|
||||
// Fields 0/1 with a combo select Yes/No
|
||||
|
||||
@ -192,7 +192,7 @@ if ($action == 'updateoperation') {
|
||||
$emailcollectoroperation = new EmailCollectorAction($db);
|
||||
$emailcollectoroperation->fetch(GETPOST('rowidoperation2', 'int'));
|
||||
|
||||
$emailcollectoroperation->actionparam = GETPOST('operationparam2', 'restricthtml');
|
||||
$emailcollectoroperation->actionparam = GETPOST('operationparam2', 'alphawithlgt');
|
||||
|
||||
if (in_array($emailcollectoroperation->type, array('loadthirdparty', 'loadandcreatethirdparty'))
|
||||
&& empty($emailcollectoroperation->actionparam)) {
|
||||
@ -378,33 +378,54 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
$connectstringserver = $object->getConnectStringIMAP($usessl);
|
||||
|
||||
try {
|
||||
if ($sourcedir) {
|
||||
//$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir);
|
||||
$connectstringsource = $connectstringserver.$object->getEncodedUtf7($sourcedir);
|
||||
}
|
||||
if ($targetdir) {
|
||||
//$connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir);
|
||||
$connectstringtarget = $connectstringserver.$object->getEncodedUtf7($targetdir);
|
||||
if ($action == 'scan') {
|
||||
try {
|
||||
if ($sourcedir) {
|
||||
//$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir);
|
||||
$connectstringsource = $connectstringserver.$object->getEncodedUtf7($sourcedir);
|
||||
}
|
||||
if ($targetdir) {
|
||||
//$connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir);
|
||||
$connectstringtarget = $connectstringserver.$object->getEncodedUtf7($targetdir);
|
||||
}
|
||||
|
||||
$timeoutconnect = empty($conf->global->MAIN_USE_CONNECT_TIMEOUT) ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT;
|
||||
$timeoutread = empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT) ? 20 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT;
|
||||
|
||||
dol_syslog("imap_open connectstring=".$connectstringsource." login=".$object->login." password=".$object->password." timeoutconnect=".$timeoutconnect." timeoutread=".$timeoutread);
|
||||
|
||||
$result1 = imap_timeout(IMAP_OPENTIMEOUT, $timeoutconnect); // timeout seems ignored with ssl connect
|
||||
$result2 = imap_timeout(IMAP_READTIMEOUT, $timeoutread);
|
||||
$result3 = imap_timeout(IMAP_WRITETIMEOUT, 5);
|
||||
$result4 = imap_timeout(IMAP_CLOSETIMEOUT, 5);
|
||||
|
||||
dol_syslog("result1=".$result1." result2=".$result2." result3=".$result3." result4=".$result4);
|
||||
|
||||
$connection = imap_open($connectstringsource, $object->login, $object->password);
|
||||
|
||||
//dol_syslog("end imap_open connection=".var_export($connection, true));
|
||||
} catch (Exception $e) {
|
||||
print $e->getMessage();
|
||||
}
|
||||
|
||||
$timeoutconnect = empty($conf->global->MAIN_USE_CONNECT_TIMEOUT) ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT;
|
||||
$timeoutread = empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT) ? 20 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT;
|
||||
if (!$connection) {
|
||||
$morehtml .= 'Failed to open IMAP connection '.$connectstringsource;
|
||||
if (function_exists('imap_last_error')) {
|
||||
$morehtml .= '<br>'.imap_last_error();
|
||||
}
|
||||
dol_syslog("Error ".$morehtml, LOG_WARNING);
|
||||
//var_dump(imap_errors())
|
||||
} else {
|
||||
dol_syslog("Imap connected. Now we call imap_num_msg()");
|
||||
$morehtml .= imap_num_msg($connection);
|
||||
}
|
||||
|
||||
dol_syslog("imap_open connectstring=".$connectstringsource." login=".$object->login." password=".$object->password." timeoutconnect=".$timeoutconnect." timeoutread=".$timeoutread);
|
||||
|
||||
$result1 = imap_timeout(IMAP_OPENTIMEOUT, $timeoutconnect); // timeout seems ignored with ssl connect
|
||||
$result2 = imap_timeout(IMAP_READTIMEOUT, $timeoutread);
|
||||
$result3 = imap_timeout(IMAP_WRITETIMEOUT, 5);
|
||||
$result4 = imap_timeout(IMAP_CLOSETIMEOUT, 5);
|
||||
|
||||
dol_syslog("result1=".$result1." result2=".$result2." result3=".$result3." result4=".$result4);
|
||||
|
||||
$connection = imap_open($connectstringsource, $object->login, $object->password);
|
||||
|
||||
//dol_syslog("end imap_open connection=".var_export($connection, true));
|
||||
} catch (Exception $e) {
|
||||
print $e->getMessage();
|
||||
if ($connection) {
|
||||
dol_syslog("Imap close");
|
||||
imap_close($connection);
|
||||
}
|
||||
} else {
|
||||
$morehtml .= '<a class="flat" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=scan&token='.newToken().'">'.img_picto('', 'refresh', 'class="paddingrightonly"').$langs->trans("Refresh").'</a>';
|
||||
}
|
||||
|
||||
$morehtml .= $form->textwithpicto('', 'connect string '.$connectstringserver);
|
||||
@ -412,23 +433,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$morehtml .= 'IMAP functions not available on your PHP. ';
|
||||
}
|
||||
|
||||
if (!$connection) {
|
||||
$morehtml .= 'Failed to open IMAP connection '.$connectstringsource;
|
||||
if (function_exists('imap_last_error')) {
|
||||
$morehtml .= '<br>'.imap_last_error();
|
||||
}
|
||||
dol_syslog("Error ".$morehtml, LOG_WARNING);
|
||||
//var_dump(imap_errors())
|
||||
} else {
|
||||
dol_syslog("Imap connected. Now we call imap_num_msg()");
|
||||
$morehtml .= imap_num_msg($connection);
|
||||
}
|
||||
|
||||
if ($connection) {
|
||||
dol_syslog("Imap close");
|
||||
imap_close($connection);
|
||||
}
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref.'<div class="refidno">'.$morehtml.'</div>', '', 0, '', '', 0, '');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
@ -580,11 +584,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<td>';
|
||||
print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth300', 1);
|
||||
print '</td><td>';
|
||||
print '<input type="text" name="operationparam">';
|
||||
//print '<input type="text" name="operationparam">';
|
||||
$htmltext = $langs->transnoentitiesnoconv("OperationParamDesc");
|
||||
print $form->textwithpicto('<input type="text" name="operationparam">', $htmltext, 1, 'help', '', 0, 2, 'operationparamtt');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$htmltext = $langs->transnoentitiesnoconv("OperationParamDesc");
|
||||
print $form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'operationparamtt');
|
||||
print '</td>';
|
||||
print '<td class="right"><input type="submit" name="addoperation" id="addoperation" class="flat button small" value="'.$langs->trans("Add").'"></td>';
|
||||
print '</tr>';
|
||||
@ -616,12 +620,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '</td>';
|
||||
print '<td class="wordbreak minwidth300 small">';
|
||||
if ($action == 'editoperation' && $ruleaction['id'] == $operationid) {
|
||||
print '<input type="text" class="quatrevingtquinzepercent" name="operationparam2" value="'.$ruleaction['actionparam'].'"><br>';
|
||||
print '<input type="text" class="quatrevingtquinzepercent" name="operationparam2" value="'.dol_escape_htmltag($ruleaction['actionparam']).'"><br>';
|
||||
print '<input type="hidden" name="rowidoperation2" value="'.$ruleaction['id'].'">';
|
||||
print '<input type="submit" class="button small button-save" name="saveoperation2" value="'.$langs->trans("Save").'">';
|
||||
print '<input type="submit" class="button small button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
} else {
|
||||
print $ruleaction['actionparam'];
|
||||
print dol_escape_htmltag($ruleaction['actionparam']);
|
||||
}
|
||||
print '</td>';
|
||||
// Move up/down
|
||||
|
||||
@ -228,14 +228,14 @@ if ($action == 'edit') {
|
||||
|
||||
if ($val['type'] == 'textarea') {
|
||||
print '<textarea class="flat" name="'.$constname.'" id="'.$constname.'" cols="50" rows="5" wrap="soft">' . "\n";
|
||||
print $conf->global->{$constname};
|
||||
print getDolGlobalString($constname);
|
||||
print "</textarea>\n";
|
||||
} elseif ($val['type']== 'html') {
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%');
|
||||
$doleditor = new DolEditor($constname, getDolGlobalString($constname), '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%');
|
||||
$doleditor->Create();
|
||||
} elseif ($val['type'] == 'yesno') {
|
||||
print $form->selectyesno($constname, $conf->global->{$constname}, 1);
|
||||
print $form->selectyesno($constname, getDolGlobalString($constname), 1);
|
||||
} elseif (preg_match('/emailtemplate:/', $val['type'])) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
@ -255,7 +255,7 @@ if ($action == 'edit') {
|
||||
$arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)) . $moreonlabel;
|
||||
}
|
||||
}
|
||||
print $form->selectarray($constname, $arrayofmessagename, $conf->global->{$constname}, 'None', 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print $form->selectarray($constname, $arrayofmessagename, getDolGlobalString($constname), 'None', 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
} elseif (preg_match('/category:/', $val['type'])) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
@ -263,13 +263,13 @@ if ($action == 'edit') {
|
||||
|
||||
$tmp = explode(':', $val['type']);
|
||||
print img_picto('', 'category', 'class="pictofixedwidth"');
|
||||
print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
|
||||
print $formother->select_categories($tmp[1], getDolGlobalString($constname), $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
|
||||
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
$formcompany = new FormCompany($db);
|
||||
print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname, 'customerorprospect', 'form', '', 1);
|
||||
print $formcompany->selectProspectCustomerType(getDolGlobalString($constname), $constname, 'customerorprospect', 'form', '', 1);
|
||||
} elseif ($val['type'] == 'securekey') {
|
||||
print '<input required="required" type="text" class="flat" id="'.$constname.'" name="'.$constname.'" value="'.(GETPOST($constname, 'alpha') ?GETPOST($constname, 'alpha') : $conf->global->{$constname}).'" size="40">';
|
||||
print '<input type="text" class="flat" id="'.$constname.'" name="'.$constname.'" value="'.(GETPOST($constname, 'alpha') ?GETPOST($constname, 'alpha') : getDolGlobalString($constname)).'" size="40">';
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token'.$constname.'" class="linkobject"');
|
||||
}
|
||||
@ -283,7 +283,7 @@ if ($action == 'edit') {
|
||||
$form->select_produits($selected, $constname, '', 0);
|
||||
}
|
||||
} else {
|
||||
print '<input name="' . $constname . '" class="flat ' . (empty($val['css']) ? 'minwidth200' : $val['css']) . '" value="' . $conf->global->{$constname} . '">';
|
||||
print '<input name="' . $constname . '" class="flat ' . (empty($val['css']) ? 'minwidth200' : $val['css']) . '" value="' . getDolGlobalString($constname) . '">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -309,28 +309,28 @@ if ($action == 'edit') {
|
||||
print '</td><td>';
|
||||
|
||||
if ($val['type'] == 'textarea') {
|
||||
print dol_nl2br($conf->global->{$constname});
|
||||
print dol_nl2br(getDolGlobalString($constname));
|
||||
} elseif ($val['type']== 'html') {
|
||||
print $conf->global->{$constname};
|
||||
print getDolGlobalString($constname);
|
||||
} elseif ($val['type'] == 'yesno') {
|
||||
print ajax_constantonoff($constname);
|
||||
} elseif (preg_match('/emailtemplate:/', $val['type'])) {
|
||||
if (!empty($conf->global->{$constname})) {
|
||||
if (getDolGlobalString($constname)) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
|
||||
$tmp = explode(':', $val['type']);
|
||||
|
||||
$template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname});
|
||||
$template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname));
|
||||
if ($template < 0) {
|
||||
setEventMessages(null, $formmail->errors, 'errors');
|
||||
}
|
||||
print $langs->trans($template->label);
|
||||
}
|
||||
} elseif (preg_match('/category:/', $val['type'])) {
|
||||
if (!empty($conf->global->{$constname})) {
|
||||
if (getDolGlobalString($constname)) {
|
||||
$c = new Categorie($db);
|
||||
$result = $c->fetch($conf->global->{$constname});
|
||||
$result = $c->fetch(getDolGlobalString($constname));
|
||||
if ($result < 0) {
|
||||
setEventMessages(null, $c->errors, 'errors');
|
||||
}
|
||||
@ -342,25 +342,25 @@ if ($action == 'edit') {
|
||||
print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
|
||||
}
|
||||
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
|
||||
if ($conf->global->{$constname}==2) {
|
||||
if (getDolGlobalString($constname)==2) {
|
||||
print $langs->trans("Prospect");
|
||||
} elseif ($conf->global->{$constname}==3) {
|
||||
} elseif (getDolGlobalString($constname)==3) {
|
||||
print $langs->trans("ProspectCustomer");
|
||||
} elseif ($conf->global->{$constname}==1) {
|
||||
} elseif (getDolGlobalString($constname)==1) {
|
||||
print $langs->trans("Customer");
|
||||
} elseif ($conf->global->{$constname}==0) {
|
||||
} elseif (getDolGlobalString($constname)==0) {
|
||||
print $langs->trans("NorProspectNorCustomer");
|
||||
}
|
||||
} elseif ($val['type'] == 'product') {
|
||||
$product = new Product($db);
|
||||
$resprod = $product->fetch($conf->global->{$constname});
|
||||
$resprod = $product->fetch(getDolGlobalString($constname));
|
||||
if ($resprod > 0) {
|
||||
print $product->getNomUrl(1);
|
||||
} elseif ($resprod < 0) {
|
||||
setEventMessages(null, $object->errors, "errors");
|
||||
setEventMessages($product->error, $product->errors, "errors");
|
||||
}
|
||||
} else {
|
||||
print $conf->global->{$constname};
|
||||
print getDolGlobalString($constname);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -59,12 +59,12 @@ if ($action == 'set') {
|
||||
|
||||
if (!$error) {
|
||||
$res1 = dolibarr_set_const($db, "GEOIP_VERSION", GETPOST('geoipversion', 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
if (!$res1 > 0) {
|
||||
if (!($res1 > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$res2 = dolibarr_set_const($db, "GEOIPMAXMIND_COUNTRY_DATAFILE", $gimcdf, 'chaine', 0, '', $conf->entity);
|
||||
if (!$res2 > 0) {
|
||||
if (!($res2 > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
@ -141,7 +141,7 @@ if ($action == 'updateMask') {
|
||||
$draft = GETPOST('HOLIDAY_DRAFT_WATERMARK', 'alpha');
|
||||
$res2 = dolibarr_set_const($db, "HOLIDAY_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (!$res1 > 0 || !$res2 > 0) {
|
||||
if (!($res1 > 0) || !($res2 > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
@ -88,7 +88,15 @@ if ($action == 'update' && !$cancel) {
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", GETPOST("MAIN_MAIL_SMTP_PORT", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER", GETPOST("MAIN_MAIL_SMTP_SERVER", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID", GETPOST("MAIN_MAIL_SMTPS_ID", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", GETPOST("MAIN_MAIL_SMTPS_PW", 'none'), 'chaine', 0, '', $conf->entity);
|
||||
if (GETPOSTISSET("MAIN_MAIL_SMTPS_PW")) {
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", GETPOST("MAIN_MAIL_SMTPS_PW", 'none'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (GETPOSTISSET("MAIN_MAIL_SMTPS_AUTH_TYPE")) {
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_AUTH_TYPE", GETPOST("MAIN_MAIL_SMTPS_AUTH_TYPE", 'chaine'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (GETPOSTISSET("MAIN_MAIL_SMTPS_OAUTH_SERVICE")) {
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_OAUTH_SERVICE", GETPOST("MAIN_MAIL_SMTPS_OAUTH_SERVICE", 'chaine'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS", GETPOST("MAIN_MAIL_EMAIL_TLS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS", GETPOST("MAIN_MAIL_EMAIL_STARTTLS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED", GETPOST("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
@ -171,6 +179,24 @@ if (version_compare(phpversion(), '7.0', '>=')) {
|
||||
$listofmethods['swiftmailer'] = 'Swift Mailer socket library';
|
||||
}
|
||||
|
||||
// List of oauth services
|
||||
$oauthservices = array();
|
||||
|
||||
foreach ($conf->global as $key => $val) {
|
||||
if (!empty($val) && preg_match('/^OAUTH_.*_ID$/', $key)) {
|
||||
$key = preg_replace('/^OAUTH_/', '', $key);
|
||||
$key = preg_replace('/_ID$/', '', $key);
|
||||
if (preg_match('/^.*-/', $key)) {
|
||||
$name = preg_replace('/^.*-/', '', $key);
|
||||
} else {
|
||||
$name = $langs->trans("NoName");
|
||||
}
|
||||
$provider = preg_replace('/-.*$/', '', $key);
|
||||
$provider = ucfirst(strtolower($provider));
|
||||
|
||||
$oauthservices[$key] = $name." (".$provider.")";
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'edit') {
|
||||
if ($conf->use_javascript_ajax) {
|
||||
@ -195,6 +221,7 @@ if ($action == 'edit') {
|
||||
jQuery("#MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").prop("disabled", true);
|
||||
jQuery(".smtp_method").hide();
|
||||
jQuery(".dkim").hide();
|
||||
jQuery(".smtp_auth_method").hide();
|
||||
';
|
||||
if ($linuxlike) {
|
||||
print '
|
||||
@ -237,6 +264,7 @@ if ($action == 'edit') {
|
||||
jQuery("#smtp_port_mess").hide();
|
||||
jQuery(".smtp_method").show();
|
||||
jQuery(".dkim").hide();
|
||||
jQuery(".smtp_auth_method").show();
|
||||
}
|
||||
if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'swiftmailer\')
|
||||
{
|
||||
@ -264,12 +292,34 @@ if ($action == 'edit') {
|
||||
jQuery("#smtp_port_mess").hide();
|
||||
jQuery(".smtp_method").show();
|
||||
jQuery(".dkim").show();
|
||||
jQuery(".smtp_auth_method").show();
|
||||
}
|
||||
}
|
||||
function change_smtp_auth_method() {
|
||||
console.log(jQuery("#radio_pw").prop("checked"));
|
||||
if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'smtps\' && jQuery("#radio_oauth").prop("checked")) {
|
||||
jQuery(".smtp_oauth_service").show();
|
||||
jQuery(".smtp_pw").hide();
|
||||
} else if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'swiftmailer\' && jQuery("#radio_oauth").prop("checked")) {
|
||||
jQuery(".smtp_oauth_service").show();
|
||||
jQuery(".smtp_pw").hide();
|
||||
} else if(jQuery("#MAIN_MAIL_SENDMODE").val()==\'mail\'){
|
||||
jQuery(".smtp_oauth_service").hide();
|
||||
jQuery(".smtp_pw").hide();
|
||||
} else {
|
||||
jQuery(".smtp_oauth_service").hide();
|
||||
jQuery(".smtp_pw").show();
|
||||
}
|
||||
}
|
||||
initfields();
|
||||
change_smtp_auth_method();
|
||||
jQuery("#MAIN_MAIL_SENDMODE").change(function() {
|
||||
initfields();
|
||||
change_smtp_auth_method();
|
||||
});
|
||||
jQuery("#radio_pw, #radio_oauth").change(function() {
|
||||
change_smtp_auth_method();
|
||||
});
|
||||
jQuery("#MAIN_MAIL_EMAIL_TLS").change(function() {
|
||||
if (jQuery("#MAIN_MAIL_EMAIL_TLS").val() == 1)
|
||||
jQuery("#MAIN_MAIL_EMAIL_STARTTLS").val(0);
|
||||
@ -413,10 +463,29 @@ if ($action == 'edit') {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
// OAUTH
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) {
|
||||
print '<tr class="oddeven smtp_auth_method"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>';
|
||||
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
|
||||
print '<input type="radio" id="radio_pw" name="MAIN_MAIL_SMTPS_AUTH_TYPE" value="LOGIN"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') == 'LOGIN' ? ' checked' : '').'> ';
|
||||
print '<label for="radio_pw" >'.$langs->trans("UsePassword").'</label>';
|
||||
print ' ';
|
||||
print '<input type="radio" id="radio_oauth" name="MAIN_MAIL_SMTPS_AUTH_TYPE" value="XOAUTH2"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') == 'XOAUTH2' ? ' checked' : '').'> ';
|
||||
print '<label for="radio_oauth" >'.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).'</label>';
|
||||
} else {
|
||||
$value = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE', 'LOGIN');
|
||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||
print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE"), $htmltext, 1, 'superadmin');
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTPS_AUTH_TYPE" name="MAIN_MAIL_SMTPS_AUTH_TYPE" value="'.$value.'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// PW
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) {
|
||||
$mainsmtppw = (!empty($conf->global->MAIN_MAIL_SMTPS_PW) ? $conf->global->MAIN_MAIL_SMTPS_PW : '');
|
||||
print '<tr class="drag drop oddeven"><td>';
|
||||
print '<tr class="drag drop oddeven smtp_pw"><td>';
|
||||
print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_PW"), $langs->trans("WithGMailYouCanCreateADedicatedPassword"));
|
||||
print '</td><td>';
|
||||
// SuperAdministrator access only
|
||||
@ -430,6 +499,24 @@ if ($action == 'edit') {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// OAUTH service provider
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) {
|
||||
print '<tr class="oddeven smtp_oauth_service"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").'</td><td>';
|
||||
|
||||
// SuperAdministrator access only
|
||||
if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity)) {
|
||||
print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE', $oauthservices, $conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE);
|
||||
} else {
|
||||
$text = $oauthservices[$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE];
|
||||
if (empty($text)) {
|
||||
$text = $langs->trans("Undefined");
|
||||
}
|
||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||
print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
|
||||
print '<input type="hidden" name="MAIN_MAIL_SMTPS_OAUTH_SERVICE" value="'.$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE.'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
// TLS
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) {
|
||||
@ -595,29 +682,46 @@ if ($action == 'edit') {
|
||||
print '</td></tr>';
|
||||
|
||||
// Host server
|
||||
if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail')) {
|
||||
if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE') == 'mail')) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td><span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span></td></tr>';
|
||||
} else {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : '').'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
// Port
|
||||
if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail')) {
|
||||
if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE') == 'mail')) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").'</td><td><span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span></td></tr>';
|
||||
} else {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : '').'</td></tr>';
|
||||
}
|
||||
|
||||
// SMTPS ID
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) {
|
||||
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE'), array('smtps', 'swiftmailer'))) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.$conf->global->MAIN_MAIL_SMTPS_ID.'</td></tr>';
|
||||
}
|
||||
|
||||
// AUTH method
|
||||
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE'), array('smtps', 'swiftmailer'))) {
|
||||
$authtype = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE', 'LOGIN');
|
||||
$text = ($authtype === "LOGIN") ? $langs->trans("UsePassword") : ($authtype === "XOAUTH2" ? $langs->trans("UseOauth") : '') ;
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>'.$text.'</td></tr>';
|
||||
}
|
||||
|
||||
// SMTPS PW
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) {
|
||||
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') != "XOAUTH2") {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./', '*', $conf->global->MAIN_MAIL_SMTPS_PW).'</td></tr>';
|
||||
}
|
||||
|
||||
// SMTPS oauth service
|
||||
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') === "XOAUTH2") {
|
||||
$text = $oauthservices[$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE];
|
||||
if (empty($text)) {
|
||||
$text = $langs->trans("Undefined").img_warning();
|
||||
}
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").'</td><td>'.$text.'</td></tr>';
|
||||
}
|
||||
|
||||
// TLS
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) {
|
||||
|
||||
@ -557,6 +557,7 @@ if (!empty($extrafields->attributes[$object->table_element]['computed']) && is_a
|
||||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) {
|
||||
|
||||
@ -178,63 +178,63 @@ $elementList = array();
|
||||
|
||||
$elementList['all'] = '-- '.dol_escape_htmltag($langs->trans("All")).' --';
|
||||
$elementList['none'] = '-- '.dol_escape_htmltag($langs->trans("None")).' --';
|
||||
$elementList['user'] = img_picto('', 'user', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToUser'));
|
||||
$elementList['user'] = img_picto('', 'user', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToUser'));
|
||||
if (!empty($conf->adherent->enabled) && !empty($user->rights->adherent->lire)) {
|
||||
$elementList['member'] = img_picto('', 'object_member', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToMember'));
|
||||
$elementList['member'] = img_picto('', 'object_member', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToMember'));
|
||||
}
|
||||
if (!empty($conf->recruitment->enabled) && !empty($user->rights->recruitment->recruitmentjobposition->read)) {
|
||||
$elementList['recruitmentcandidature_send'] = img_picto('', 'recruitmentcandidature', 'class="paddingright"').dol_escape_htmltag($langs->trans('RecruitmentCandidatures'));
|
||||
$elementList['recruitmentcandidature_send'] = img_picto('', 'recruitmentcandidature', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('RecruitmentCandidatures'));
|
||||
}
|
||||
if (!empty($conf->societe->enabled) && !empty($user->rights->societe->lire)) {
|
||||
$elementList['thirdparty'] = img_picto('', 'company', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToThirdparty'));
|
||||
$elementList['thirdparty'] = img_picto('', 'company', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToThirdparty'));
|
||||
}
|
||||
if (!empty($conf->project->enabled)) {
|
||||
$elementList['project'] = img_picto('', 'project', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToProject'));
|
||||
$elementList['project'] = img_picto('', 'project', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToProject'));
|
||||
}
|
||||
if (!empty($conf->propal->enabled) && !empty($user->rights->propal->lire)) {
|
||||
$elementList['propal_send'] = img_picto('', 'propal', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendProposal'));
|
||||
$elementList['propal_send'] = img_picto('', 'propal', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendProposal'));
|
||||
}
|
||||
if (!empty($conf->commande->enabled) && !empty($user->rights->commande->lire)) {
|
||||
$elementList['order_send'] = img_picto('', 'order', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendOrder'));
|
||||
$elementList['order_send'] = img_picto('', 'order', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendOrder'));
|
||||
}
|
||||
if (isModEnabled('facture') && !empty($user->rights->facture->lire)) {
|
||||
$elementList['facture_send'] = img_picto('', 'bill', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendInvoice'));
|
||||
$elementList['facture_send'] = img_picto('', 'bill', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendInvoice'));
|
||||
}
|
||||
if (!empty($conf->expedition->enabled)) {
|
||||
$elementList['shipping_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendShipment'));
|
||||
$elementList['shipping_send'] = img_picto('', 'dolly', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendShipment'));
|
||||
}
|
||||
if (!empty($conf->reception->enabled)) {
|
||||
$elementList['reception_send'] = img_picto('', 'dollyrevert', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendReception'));
|
||||
$elementList['reception_send'] = img_picto('', 'dollyrevert', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendReception'));
|
||||
}
|
||||
if (!empty($conf->ficheinter->enabled)) {
|
||||
$elementList['fichinter_send'] = img_picto('', 'intervention', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendIntervention'));
|
||||
$elementList['fichinter_send'] = img_picto('', 'intervention', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendIntervention'));
|
||||
}
|
||||
if (!empty($conf->supplier_proposal->enabled)) {
|
||||
$elementList['supplier_proposal_send'] = img_picto('', 'propal', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendSupplierRequestForQuotation'));
|
||||
$elementList['supplier_proposal_send'] = img_picto('', 'propal', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierRequestForQuotation'));
|
||||
}
|
||||
if ((!empty($conf->fournisseur->enabled) && !empty($user->rights->fournisseur->commande->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_order->enabled) && !empty($user->rights->supplier_order->lire))) {
|
||||
$elementList['order_supplier_send'] = img_picto('', 'order', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendSupplierOrder'));
|
||||
$elementList['order_supplier_send'] = img_picto('', 'order', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierOrder'));
|
||||
}
|
||||
if ((!empty($conf->fournisseur->enabled) && !empty($user->rights->fournisseur->facture->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_invoice->enabled) && !empty($user->rights->supplier_invoice->lire))) {
|
||||
$elementList['invoice_supplier_send'] = img_picto('', 'bill', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendSupplierInvoice'));
|
||||
$elementList['invoice_supplier_send'] = img_picto('', 'bill', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierInvoice'));
|
||||
}
|
||||
if (!empty($conf->contrat->enabled) && !empty($user->rights->contrat->lire)) {
|
||||
$elementList['contract'] = img_picto('', 'contract', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendContract'));
|
||||
$elementList['contract'] = img_picto('', 'contract', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendContract'));
|
||||
}
|
||||
if (!empty($conf->ticket->enabled) && !empty($user->rights->ticket->read)) {
|
||||
$elementList['ticket_send'] = img_picto('', 'ticket', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTicket'));
|
||||
$elementList['ticket_send'] = img_picto('', 'ticket', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToTicket'));
|
||||
}
|
||||
if (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire)) {
|
||||
$elementList['expensereport_send'] = img_picto('', 'trip', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTExpenseReport'));
|
||||
$elementList['expensereport_send'] = img_picto('', 'trip', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToExpenseReport'));
|
||||
}
|
||||
if (isModEnabled('agenda')) {
|
||||
$elementList['actioncomm_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventPush'));
|
||||
$elementList['actioncomm_send'] = img_picto('', 'action', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendEventPush'));
|
||||
}
|
||||
if (!empty($conf->eventorganization->enabled) && !empty($user->rights->eventorganization->read)) {
|
||||
$elementList['conferenceorbooth'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization'));
|
||||
$elementList['conferenceorbooth'] = img_picto('', 'action', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization'));
|
||||
}
|
||||
if (!empty($conf->partnership->enabled) && !empty($user->rights->partnership->read)) {
|
||||
$elementList['partnership_send'] = img_picto('', 'partnership', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToPartnership'));
|
||||
$elementList['partnership_send'] = img_picto('', 'partnership', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToPartnership'));
|
||||
}
|
||||
|
||||
$parameters = array('elementList'=>$elementList);
|
||||
|
||||
@ -172,12 +172,12 @@ if ($action == 'add') {
|
||||
$action = 'create';
|
||||
$error++;
|
||||
}
|
||||
if (!$error && GETPOST('menuId') && GETPOST('type') == 'top') {
|
||||
if (!$error && GETPOST('menuId', 'alphanohtml', 3) && GETPOST('type') == 'top') {
|
||||
setEventMessages($langs->trans("ErrorTopMenuMustHaveAParentWithId0"), null, 'errors');
|
||||
$action = 'create';
|
||||
$error++;
|
||||
}
|
||||
if (!$error && !GETPOST('menuId') && GETPOST('type') == 'left') {
|
||||
if (!$error && !GETPOST('menuId', 'alphanohtml', 3) && GETPOST('type') == 'left') {
|
||||
setEventMessages($langs->trans("ErrorLeftMenuMustHaveAParentId"), null, 'errors');
|
||||
$action = 'create';
|
||||
$error++;
|
||||
|
||||
@ -43,10 +43,15 @@ require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("errors", "admin", "modulebuilder"));
|
||||
|
||||
$mode = GETPOSTISSET('mode') ? GETPOST('mode', 'alpha') : (empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ? 'commonkanban' : 'common');
|
||||
if (empty($mode)) {
|
||||
$mode = 'common';
|
||||
// if we set another view list mode, we keep it (till we change one more time)
|
||||
if (GETPOSTISSET('mode')) {
|
||||
$mode = GETPOST('mode', 'alpha');
|
||||
if ($mode =='common' || $mode =='commonkanban')
|
||||
dolibarr_set_const($db, "MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT", $mode, 'chaine', 0, '', $conf->entity);
|
||||
} else {
|
||||
$mode = (empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ? 'commonkanban' : $conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT);
|
||||
}
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$page_y = GETPOST('page_y', 'int');
|
||||
|
||||
@ -62,7 +62,7 @@ if ($action == 'add') { // $provider is OAUTH_XXX
|
||||
setEventMessages($langs->trans("AOAuthEntryForThisProviderAndLabelAlreadyHasAKey"), null, 'errors');
|
||||
$error++;
|
||||
} else {
|
||||
dolibarr_set_const($db, $constname, 'ToComplete', 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, $constname, $langs->trans('ToComplete'), 'chaine', 0, '', $conf->entity);
|
||||
setEventMessages($langs->trans("OAuthProviderAdded"), null);
|
||||
}
|
||||
}
|
||||
@ -78,6 +78,16 @@ if ($action == 'update') {
|
||||
if (!dolibarr_set_const($db, $constvalue.'_SECRET', GETPOST($constvalue.'_ID') ? GETPOST($constvalue.'_SECRET') : '', 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
if (GETPOSTISSET($constvalue.'_URLAUTHORIZE')) {
|
||||
if (!dolibarr_set_const($db, $constvalue.'_URLAUTHORIZE', GETPOST($constvalue.'_URLAUTHORIZE'), 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if (GETPOSTISSET($constvalue.'_SCOPE')) {
|
||||
if (!dolibarr_set_const($db, $constvalue.'_SCOPE', GETPOST($constvalue.'_SCOPE'), 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,11 +157,17 @@ print '<table class="noborder centpercent">';
|
||||
|
||||
$i = 0;
|
||||
|
||||
//var_dump($list);
|
||||
// Define $listinsetup
|
||||
foreach ($conf->global as $key => $val) {
|
||||
if (!empty($val) && preg_match('/^OAUTH_.*_ID$/', $key)) {
|
||||
$provider = preg_replace('/_ID$/', '', $key);
|
||||
$listinsetup[] = array($provider.'_NAME', $provider.'_ID', $provider.'_SECRET', 'OAUTH Provider '.str_replace('OAUTH_', '', $provider));
|
||||
$listinsetup[] = array(
|
||||
$provider.'_NAME',
|
||||
$provider.'_ID',
|
||||
$provider.'_SECRET',
|
||||
$provider.'_URLAUTHORIZE', // For custom oauth links
|
||||
$provider.'_SCOPE' // For custom oauth links
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,12 +194,16 @@ foreach ($listinsetup as $key) {
|
||||
|
||||
$i++;
|
||||
|
||||
print '<tr class="liste_titre'.($i > 1 ? ' liste_titre_add' : '').'">';
|
||||
// Api Name
|
||||
$label = $langs->trans($keyforsupportedoauth2array);
|
||||
print '<tr class="liste_titre'.($i > 1 ? ' liste_titre_add' : '').'">';
|
||||
print '<td>';
|
||||
print img_picto('', $supportedoauth2array[$keyforsupportedoauth2array]['picto'], 'class="pictofixedwidth"');
|
||||
print $label;
|
||||
if ($label == $keyforsupportedoauth2array) {
|
||||
print $supportedoauth2array[$keyforsupportedoauth2array]['name'];
|
||||
} else {
|
||||
print $label;
|
||||
}
|
||||
if ($keyforprovider) {
|
||||
print ' (<b>'.$keyforprovider.'</b>)';
|
||||
} else {
|
||||
@ -201,8 +221,15 @@ foreach ($listinsetup as $key) {
|
||||
$redirect_uri = $urlwithroot.'/core/modules/oauth/'.$supportedoauth2array[$keyforsupportedoauth2array]['callbackfile'].'_oauthcallback.php';
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>';
|
||||
print '<td><input style="width: 80%" type"text" name="uri'.$keyforsupportedoauth2array.'" value="'.$redirect_uri.'">';
|
||||
print '<td><input style="width: 80%" type"text" name="uri'.$keyforsupportedoauth2array.'" value="'.$redirect_uri.'" disabled>';
|
||||
print '</td></tr>';
|
||||
|
||||
if ($keyforsupportedoauth2array == 'OAUTH_OTHER_NAME') {
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td>'.$langs->trans("URLOfServiceForAuthorization").'</td>';
|
||||
print '<td><input style="width: 80%" type"text" name="'.$key[3].'" value="'.getDolGlobalString($key[3]).'" >';
|
||||
print '</td></tr>';
|
||||
}
|
||||
} else {
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>';
|
||||
@ -213,14 +240,32 @@ foreach ($listinsetup as $key) {
|
||||
// Api Id
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td><label for="'.$key[1].'">'.$langs->trans("OAUTH_ID").'</label></td>';
|
||||
print '<td><input type="text" size="100" id="'.$key[1].'" name="'.$key[1].'" value="'.$conf->global->{$key[1]}.'">';
|
||||
print '<td><input type="text" size="100" id="'.$key[1].'" name="'.$key[1].'" value="'.getDolGlobalString($key[1]).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Api Secret
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td><label for="'.$key[2].'">'.$langs->trans("OAUTH_SECRET").'</label></td>';
|
||||
print '<td><input type="password" size="100" id="'.$key[2].'" name="'.$key[2].'" value="'.$conf->global->{$key[2]}.'">';
|
||||
print '<td><input type="password" size="100" id="'.$key[2].'" name="'.$key[2].'" value="'.getDolGlobalString($key[2]).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// TODO Move this into token generation
|
||||
if ($supported) {
|
||||
if ($keyforsupportedoauth2array == 'OAUTH_OTHER_NAME') {
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td>'.$langs->trans("Scopes").'</td>';
|
||||
print '<td>';
|
||||
print '<input style="width: 80%" type"text" name="'.$key[4].'" value="'.getDolGlobalString($key[4]).'" >';
|
||||
print '</td></tr>';
|
||||
} else {
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td>'.$langs->trans("Scopes").'</td>';
|
||||
print '<td>';
|
||||
//print '<input style="width: 80%" type"text" name="'.$key[4].'" value="'.getDolGlobalString($key[4]).'" >';
|
||||
print $supportedoauth2array[$keyforsupportedoauth2array]['defaultscope'];
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>'."\n";
|
||||
|
||||
@ -77,7 +77,7 @@ if ($action == 'setconst' && $user->admin) {
|
||||
$constnote = dol_escape_htmltag($setupconst['note']);
|
||||
|
||||
$result = dolibarr_set_const($db, $constname, $constvalue, $consttype, 0, $constnote, $conf->entity);
|
||||
if (!$result > 0) {
|
||||
if (!($result > 0)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -96,7 +96,7 @@ if ($action == 'setvalue' && $user->admin) {
|
||||
$db->begin();
|
||||
|
||||
$result = dolibarr_set_const($db, $varname, $value, 'chaine', 0, '', $conf->entity);
|
||||
if (!$result > 0) {
|
||||
if (!($result > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -138,11 +138,17 @@ if (GETPOST('error')) {
|
||||
if ($mode == 'setup' && $user->admin) {
|
||||
print '<span class="opacitymedium">'.$langs->trans("OAuthSetupForLogin")."</span><br><br>\n";
|
||||
|
||||
//var_dump($list);
|
||||
// Define $listinsetup
|
||||
foreach ($conf->global as $key => $val) {
|
||||
if (!empty($val) && preg_match('/^OAUTH_.*_ID$/', $key)) {
|
||||
$provider = preg_replace('/_ID$/', '', $key);
|
||||
$listinsetup[] = array($provider.'_NAME', $provider.'_ID', $provider.'_SECRET', 'OAUTH Provider '.str_replace('OAUTH_', '', $provider));
|
||||
$listinsetup[] = array(
|
||||
$provider.'_NAME',
|
||||
$provider.'_ID',
|
||||
$provider.'_SECRET',
|
||||
$provider.'_URLAUTHORIZE', // For custom oauth links
|
||||
$provider.'_SCOPE' // For custom oauth links
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,46 +171,39 @@ if ($mode == 'setup' && $user->admin) {
|
||||
|
||||
$OAUTH_SERVICENAME = (empty($supportedoauth2array[$keyforsupportedoauth2array]['name']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['name'].($keyforprovider ? '-'.$keyforprovider : ''));
|
||||
|
||||
// Define $shortscope, $urltorenew, $urltodelete, $urltocheckperms
|
||||
$shortscope = $supportedoauth2array[$keyforsupportedoauth2array]['defaultscope'];
|
||||
if (getDolGlobalString($key[4])) {
|
||||
$shortscope = getDolGlobalString($key[4]);
|
||||
}
|
||||
$state = $shortscope; // TODO USe a better state
|
||||
|
||||
// Define $urltorenew, $urltodelete, $urltocheckperms
|
||||
// TODO Use array $supportedoauth2array
|
||||
if ($keyforsupportedoauth2array == 'OAUTH_GITHUB_NAME') {
|
||||
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
|
||||
// We pass this param list in to 'state' because we need it before and after the redirect.
|
||||
$shortscope = 'user,public_repo';
|
||||
|
||||
// Note: github does not accept csrf key inside the state parameter (only know values)
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
// Note: github does not accept csrf key inside the state parameter (only known values)
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltocheckperms = 'https://github.com/settings/applications/';
|
||||
} elseif ($keyforsupportedoauth2array == 'OAUTH_GOOGLE_NAME') {
|
||||
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
|
||||
// List of scopes for Google are here: https://developers.google.com/identity/protocols/oauth2/scopes
|
||||
// We pass this key list into the param 'state' because we need it before and after the redirect.
|
||||
$shortscope = 'userinfo_email,userinfo_profile';
|
||||
$shortscope .= ',openid,email,profile'; // For openid connect
|
||||
if (!empty($conf->printing->enabled)) {
|
||||
$shortscope .= ',cloud_print';
|
||||
}
|
||||
if (!empty($conf->global->OAUTH_GOOGLE_GSUITE)) {
|
||||
$shortscope .= ',admin_directory_user';
|
||||
}
|
||||
if (!empty($conf->global->OAUTH_GOOGLE_GMAIL)) {
|
||||
$shortscope.=',gmail_full';
|
||||
}
|
||||
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'-'.$oauthstateanticsrf.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'-'.$oauthstateanticsrf.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltocheckperms = 'https://security.google.com/settings/security/permissions';
|
||||
} elseif ($keyforsupportedoauth2array == 'OAUTH_STRIPE_TEST_NAME') {
|
||||
$shortscope = 'none';
|
||||
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/stripetest_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/stripetest_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = '';
|
||||
$urltocheckperms = '';
|
||||
} elseif ($keyforsupportedoauth2array == 'OAUTH_STRIPE_LIVE_NAME') {
|
||||
$shortscope = 'none';
|
||||
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = '';
|
||||
$urltocheckperms = '';
|
||||
} elseif ($keyforsupportedoauth2array = 'OAUTH_OTHER_NAME') {
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/generic_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = '';
|
||||
$urltocheckperms = '';
|
||||
} else {
|
||||
@ -212,13 +211,13 @@ if ($mode == 'setup' && $user->admin) {
|
||||
$urltodelete = '';
|
||||
$urltocheckperms = '';
|
||||
}
|
||||
$urltorenew .= '&keyforprovider='.$keyforprovider;
|
||||
|
||||
$urltorenew .= '&keyforprovider='.urlencode($keyforprovider);
|
||||
|
||||
// Show value of token
|
||||
$tokenobj = null;
|
||||
// Token
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
|
||||
// Dolibarr storage
|
||||
$storage = new DoliStorage($db, $conf);
|
||||
try {
|
||||
@ -246,7 +245,7 @@ if ($mode == 'setup' && $user->admin) {
|
||||
} elseif ($endoflife == $tokenobj::EOL_UNKNOWN) {
|
||||
$expiredat = $langs->trans("Unknown");
|
||||
} else {
|
||||
$expiredat = dol_print_date($endoflife, "dayhour");
|
||||
$expiredat = dol_print_date($endoflife, "dayhour", 'tzuserrel');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -260,10 +259,16 @@ if ($mode == 'setup' && $user->admin) {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
|
||||
// Api Name
|
||||
$label = $langs->trans($keyforsupportedoauth2array);
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th class="titlefieldcreate">';
|
||||
print img_picto('', $supportedoauth2array[$keyforsupportedoauth2array]['picto'], 'class="pictofixedwidth"');
|
||||
print $langs->trans($keyforsupportedoauth2array);
|
||||
if ($label == $keyforsupportedoauth2array) {
|
||||
print $supportedoauth2array[$keyforsupportedoauth2array]['name'];
|
||||
} else {
|
||||
print $label;
|
||||
}
|
||||
if ($keyforprovider) {
|
||||
print ' (<b>'.$keyforprovider.'</b>)';
|
||||
} else {
|
||||
@ -275,7 +280,7 @@ if ($mode == 'setup' && $user->admin) {
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
print '<td'.(empty($key['required']) ? '' : ' class="required"').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("OAuthIDSecret").'</td>';
|
||||
print '<td>';
|
||||
@ -286,13 +291,13 @@ if ($mode == 'setup' && $user->admin) {
|
||||
print '</tr>'."\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
print '<td'.(empty($key['required']) ? '' : ' class="required"').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("IsTokenGenerated");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (is_object($tokenobj)) {
|
||||
print $langs->trans("HasAccessToken");
|
||||
print $form->textwithpicto(yn(1), $langs->trans("HasAccessToken").' : '.dol_print_date($storage->date_modification, 'dayhour').' state='.dol_escape_htmltag($storage->state));
|
||||
} else {
|
||||
print '<span class="opacitymedium">'.$langs->trans("NoAccessToken").'</span>';
|
||||
}
|
||||
@ -305,7 +310,9 @@ if ($mode == 'setup' && $user->admin) {
|
||||
}
|
||||
// Request remote token
|
||||
if ($urltorenew) {
|
||||
print '<a class="button smallpaddingimp" href="'.$urltorenew.'">'.$langs->trans('RequestAccess').'</a><br>';
|
||||
print '<a class="button smallpaddingimp" href="'.$urltorenew.'">'.$langs->trans('GetAccess').'</a>';
|
||||
print $form->textwithpicto('', $langs->trans('RequestAccess'));
|
||||
print '<br>';
|
||||
}
|
||||
// Check remote access
|
||||
if ($urltocheckperms) {
|
||||
@ -315,7 +322,7 @@ if ($mode == 'setup' && $user->admin) {
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
print '<td'.(empty($key['required']) ? '' : ' class="required"').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("Token").'</td>';
|
||||
print '<td colspan="2">';
|
||||
@ -323,7 +330,7 @@ if ($mode == 'setup' && $user->admin) {
|
||||
if (is_object($tokenobj)) {
|
||||
//var_dump($tokenobj);
|
||||
$tokentoshow = $tokenobj->getAccessToken();
|
||||
print '<span class="" title="'.dol_escape_htmltag($tokentoshow).'">'.showValueWithClipboardCPButton($tokentoshow, 1, dol_trunc($tokentoshow, 32)).'<br>';
|
||||
print '<span class="" title="'.dol_escape_htmltag($tokentoshow).'">'.showValueWithClipboardCPButton($tokentoshow, 1, dol_trunc($tokentoshow, 32)).'</span><br>';
|
||||
//print 'Refresh: '.$tokenobj->getRefreshToken().'<br>';
|
||||
//print 'EndOfLife: '.$tokenobj->getEndOfLife().'<br>';
|
||||
//var_dump($tokenobj->getExtraParams());
|
||||
@ -348,7 +355,7 @@ if ($mode == 'setup' && $user->admin) {
|
||||
|
||||
// Token expired
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
print '<td'.(empty($key['required']) ? '' : ' class="required"').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("TOKEN_EXPIRED");
|
||||
print '</td>';
|
||||
@ -359,7 +366,7 @@ if ($mode == 'setup' && $user->admin) {
|
||||
|
||||
// Token expired at
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
print '<td'.(empty($key['required']) ? '' : ' class="required"').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("TOKEN_EXPIRE_AT");
|
||||
print '</td>';
|
||||
@ -378,8 +385,8 @@ if ($mode == 'setup' && $user->admin) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -183,8 +183,8 @@ if ($action == 'testtemplate' && $user->admin) {
|
||||
// test
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$object = new Facture($db);
|
||||
//$object->initAsSpecimen();
|
||||
$object->fetch(18);
|
||||
$object->initAsSpecimen();
|
||||
//$object->fetch(18);
|
||||
//var_dump($object->lines);
|
||||
$ret = $printer->sendToPrinter($object, $templateid, 1);
|
||||
if ($ret == 0) {
|
||||
|
||||
@ -61,14 +61,17 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
} elseif ($action == 'updateform') {
|
||||
$res1 = 1; $res2 = 1;
|
||||
$res1 = 1; $res2 = 1; $res3 = 1;
|
||||
if (GETPOSTISSET('MAIN_APPLICATION_TITLE')) {
|
||||
$res1 = dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", GETPOST("MAIN_APPLICATION_TITLE", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (GETPOSTISSET('MAIN_SESSION_TIMEOUT')) {
|
||||
$res2 = dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", GETPOST("MAIN_SESSION_TIMEOUT", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if ($res1 && $res2) {
|
||||
if (GETPOSTISSET('MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT')) {
|
||||
$res3 = dolibarr_set_const($db, "MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT", GETPOST("MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT", 'alphanohtml'), 'int', 0, '', $conf->entity);
|
||||
}
|
||||
if ($res1 && $res2 && $res3) {
|
||||
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
@ -174,6 +177,14 @@ print '<input class="flat right width50" name="MAIN_SESSION_TIMEOUT" type="text"
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("MaxNumberOfImagesInGetPost").'</td><td class="right">';
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
print '<input class="flat right width50" name="MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT" type="text" value="'.dol_escape_htmltag($conf->global->MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT).'"> '.strtolower($langs->trans("Images"));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
/*
|
||||
if (empty($conf->global->MAIN_APPLICATION_TITLE)) {
|
||||
$conf->global->MAIN_APPLICATION_TITLE = "";
|
||||
|
||||
@ -643,7 +643,7 @@ print '</tr>'."\n";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("MainDefaultWarehouse").'</td>';
|
||||
print '<td class="right">';
|
||||
print $formproduct->selectWarehouses($conf->global->MAIN_DEFAULT_WAREHOUSE, 'default_warehouse', '', 1, 0, 0, '', 0, 0, array(), 'left reposition');
|
||||
print $formproduct->selectWarehouses(!empty($conf->global->MAIN_DEFAULT_WAREHOUSE) ? $conf->global->MAIN_DEFAULT_WAREHOUSE : -1, 'default_warehouse', '', 1, 0, 0, '', 0, 0, array(), 'left reposition');
|
||||
print '<input type="submit" class="button button-edit small" value="'.$langs->trans("Modify").'">';
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
@ -78,9 +78,10 @@ if ($action == 'updateMask') {
|
||||
$maskconststocktransfer = GETPOST('maskconststocktransfer', 'alpha');
|
||||
$maskstocktransfer = GETPOST('maskStockTransfer', 'alpha');
|
||||
|
||||
if ($maskconststocktransfer) $res = dolibarr_set_const($db, $maskconststocktransfer, $maskstocktransfer, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (!$res > 0) $error++;
|
||||
if ($maskconststocktransfer) {
|
||||
$res = dolibarr_set_const($db, $maskconststocktransfer, $maskstocktransfer, 'chaine', 0, '', $conf->entity);
|
||||
if ($res <= 0) $error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
|
||||
@ -418,6 +418,11 @@ print '<br>';
|
||||
|
||||
print load_fiche_titre($langs->trans("OtherSetup"), '', 'folder');
|
||||
|
||||
print '<strong>MAIN_ALLOW_SVG_FILES_AS_IMAGES</strong> = '.(empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES) ? '0' : $conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES).' <span class="opacitymedium">('.$langs->trans("Recommended").': 0)</span><br>';
|
||||
print '<br>';
|
||||
|
||||
print '<strong>MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE</strong> = '.(empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE).' <span class="opacitymedium">('.$langs->trans("Recommended").': 1)</span><br>';
|
||||
print '<br>';
|
||||
|
||||
//print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: ';
|
||||
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_HASH_ALGO)." ";
|
||||
@ -443,13 +448,7 @@ print '<br>';
|
||||
print '<strong>MAIN_SECURITY_ANTI_SSRF_SERVER_IP</strong> = '.(empty($conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span> <span class="opacitymedium">('.$langs->trans("Recommended").': List of static IPs of server separated with coma - '.$langs->trans("Note").': common loopback ip like 127.*.*.*, [::1] are already added)</span>' : $conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP)."<br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>MAIN_ALLOW_SVG_FILES_AS_IMAGES</strong> = '.(empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES) ? '0' : $conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES).' <span class="opacitymedium">('.$langs->trans("Recommended").': 0)</span><br>';
|
||||
print '<br>';
|
||||
|
||||
print '<strong>MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE</strong> = '.(empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE).' <span class="opacitymedium">('.$langs->trans("Recommended").': 1)</span><br>';
|
||||
print '<br>';
|
||||
|
||||
print '<strong>MAIN_SECURITY_CSRF_WITH_TOKEN</strong> = '.(empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN).' <span class="opacitymedium">('.$langs->trans("Recommended").': 2)</span>'."<br>";
|
||||
print '<strong>MAIN_SECURITY_CSRF_WITH_TOKEN</strong> = '.(empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN).' <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 2)</span>'."<br>";
|
||||
print '<br>';
|
||||
|
||||
print '<br>';
|
||||
@ -458,15 +457,6 @@ print '<br>';
|
||||
|
||||
print load_fiche_titre($langs->trans("OtherSetup").' ('.$langs->trans("Experimental").')', '', 'folder');
|
||||
|
||||
print '<strong>MAIN_RESTRICTHTML_ONLY_VALID_HTML</strong> = '.(empty($conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' ('.$langs->trans("Recommended").': 1)</span>' : $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML)."<br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES</strong> = '.(empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' ('.$langs->trans("Recommended").': 1)</span>' : $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)."<br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL</strong> = '.(empty($conf->global->MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)</span>' : $conf->global->MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL)."<br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>MAIN_EXEC_USE_POPEN</strong> = ';
|
||||
if (empty($conf->global->MAIN_EXEC_USE_POPEN)) {
|
||||
print '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>';
|
||||
@ -483,7 +473,36 @@ if ($execmethod == 2) {
|
||||
print ' ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 1)';
|
||||
print '</span>';
|
||||
}
|
||||
print "<br>";
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<strong>MAIN_RESTRICTHTML_ONLY_VALID_HTML</strong> = '.(empty($conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' ('.$langs->trans("Recommended").': 1)</span>' : $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML)."<br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES</strong> = '.(empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' ('.$langs->trans("Recommended").': 1)</span>' : $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)."<br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL</strong> = '.(empty($conf->global->MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)</span>' : $conf->global->MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL)."<br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>MAIN_SECURITY_FORCECSP</strong> = '.(empty($conf->global->MAIN_SECURITY_FORCECSP) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_FORCECSP).' <span class="opacitymedium">('.$langs->trans("Example").": \"default-src 'self'; img-src *;\")</span><br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>WEBSITE_MAIN_SECURITY_FORCECSP</strong> = '.(empty($conf->global->WEBSITE_MAIN_SECURITY_FORCECSP) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->WEBSITE_MAIN_SECURITY_FORCECSP).' <span class="opacitymedium">('.$langs->trans("Example").": \"default-src 'self'; style-src: https://cdnjs.cloudflare.com https://fonts.googleapis.com; script-src: https://cdn.transifex.com https://www.googletagmanager.com; object-src https://youtube.com; frame-src https://youtube.com; img-src: *;\")</span><br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>MAIN_SECURITY_FORCERP</strong> = '.(empty($conf->global->MAIN_SECURITY_FORCERP) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_FORCERP).' <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or")." \"same-origin\")</span><br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>WEBSITE_MAIN_SECURITY_FORCERP</strong> = '.(empty($conf->global->WEBSITE_MAIN_SECURITY_FORCERP) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->WEBSITE_MAIN_SECURITY_FORCERP).' <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or")." \"strict-origin-when-cross-origin\")</span><br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>WEBSITE_MAIN_SECURITY_FORCESTS</strong> = '.(empty($conf->global->WEBSITE_MAIN_SECURITY_FORCESTS) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->WEBSITE_MAIN_SECURITY_FORCESTS).' <span class="opacitymedium">('.$langs->trans("Example").": \"max-age=31536000; includeSubDomains\")</span><br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>WEBSITE_MAIN_SECURITY_FORCEPP</strong> = '.(empty($conf->global->WEBSITE_MAIN_SECURITY_FORCEPP) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->WEBSITE_MAIN_SECURITY_FORCEPP).' <span class="opacitymedium">('.$langs->trans("Example").": \"camera: 'none'; microphone: 'none';\")</span><br>";
|
||||
print '<br>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
|
||||
@ -168,9 +168,10 @@ print '<td class="liste_titre">';
|
||||
print $langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b><br>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="oddeven nohover"><td style="padding-left: 8px" class="nohover">';
|
||||
print '<tr class="oddeven nohover"><td style="class="nohover">';
|
||||
|
||||
print '<table class="centpercent noborderbottom">';
|
||||
|
||||
print '<tr>';
|
||||
print '<td class="tdtop nopaddingleftimp">';
|
||||
|
||||
@ -195,27 +196,31 @@ print '</fieldset>';
|
||||
print '</div>';
|
||||
|
||||
print '</td>';
|
||||
print '<td class="tdtop nopaddingrightimp">';
|
||||
print '</tr>';
|
||||
|
||||
print '<button id="btn" type="button" onclick="hideoptions()">'.$langs->trans("ShowAdvancedOptions").'</button>';
|
||||
print '<tr>';
|
||||
print '<td class="tdtop nopaddingleftimp">';
|
||||
|
||||
print '<div class="centpercent center"><a id="lnk" href="javascript:hideoptions()"> '.$langs->trans("ShowAdvancedOptions").'...</a></div>';
|
||||
|
||||
print '<script type="text/javascript">
|
||||
|
||||
function hideoptions(){
|
||||
const btn = document.getElementById("btn");
|
||||
const lnk = document.getElementById("lnk");
|
||||
const div = document.getElementById("div_container_sub_exportoptions");
|
||||
|
||||
if (div.style.display === "none") {
|
||||
div.style.display = "block";
|
||||
btn.innerText="'.$langs->trans("HideAdvancedoptions").'";
|
||||
lnk.innerText="'.$langs->trans("HideAdvancedoptions").'";
|
||||
} else {
|
||||
div.style.display = "none";
|
||||
btn.innerText="'.$langs->trans("ShowAdvancedOptions").'";
|
||||
lnk.innerText="'.$langs->trans("ShowAdvancedOptions").'...";
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
|
||||
print '<div id="div_container_sub_exportoptions" style="display: none;">';
|
||||
print '<br>';
|
||||
if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
print "<!-- Fieldset mysqldump -->\n";
|
||||
print '<fieldset id="mysql_options"><legend>'.$langs->trans("MySqlExportParameters").'</legend>';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2014-2022 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -21,6 +21,7 @@
|
||||
* \ingroup member
|
||||
* \brief Page to make mass init of barcode
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
@ -322,26 +323,29 @@ if (isModEnabled('societe')) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print $langs->trans("CurrentlyNWithoutBarCode", $nbthirdpartyno, $nbthirdpartytotal, $langs->transnoentitiesnoconv("ThirdParties")).'<br>'."\n";
|
||||
print $langs->trans("CurrentlyNWithoutBarCode", $nbthirdpartyno, $nbthirdpartytotal, $langs->transnoentitiesnoconv("ThirdParties"))."\n";
|
||||
|
||||
$disabledthirdparty = $disabledthirdparty1 = 0;
|
||||
|
||||
if (is_object($modBarCodeThirdparty)) {
|
||||
print $langs->trans("BarCodeNumberManager").": ";
|
||||
print '<br>'.$langs->trans("BarCodeNumberManager").": ";
|
||||
$objthirdparty = new Societe($db);
|
||||
print '<b>'.(isset($modBarCodeThirdparty->name) ? $modBarCodeThirdparty->name : $modBarCodeThirdparty->nom).'</b> - '.$langs->trans("NextValue").': <b>'.$modBarCodeThirdparty->getNextValue($objthirdparty).'</b><br>';
|
||||
$disabledthirdparty = 0;
|
||||
print '<br>';
|
||||
} else {
|
||||
$disabledthirdparty = 1;
|
||||
$titleno = $langs->trans("NoBarcodeNumberingTemplateDefined");
|
||||
print '<span class="warning">'.$langs->trans("NoBarcodeNumberingTemplateDefined").'</span> (<a href="'.DOL_URL_ROOT.'/admin/barcode.php">'.$langs->trans("ToGenerateCodeDefineAutomaticRuleFirst").'</a>)<br>';
|
||||
print '<div class="warning">'.$langs->trans("NoBarcodeNumberingTemplateDefined");
|
||||
print '<br><a href="'.DOL_URL_ROOT.'/admin/barcode.php">'.$langs->trans("ToGenerateCodeDefineAutomaticRuleFirst").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
if (empty($nbthirdpartyno)) {
|
||||
$disabledthirdparty1 = 1;
|
||||
}
|
||||
|
||||
$moretagsthirdparty1 = (($disabledthirdparty || $disabledthirdparty1) ? ' disabled title="'.dol_escape_htmltag($titleno).'"' : '');
|
||||
print '<br><input class="button button-add" type="submit" id="submitformbarcodethirdpartygen" value="'.$langs->trans("InitEmptyBarCode", $nbno).'"'.$moretagsthirdparty1.'>';
|
||||
print '<br><input class="button button-add" type="submit" id="submitformbarcodethirdpartygen" value="'.$langs->trans("InitEmptyBarCode", $nbthirdpartyno).'"'.$moretagsthirdparty1.'>';
|
||||
$moretagsthirdparty2 = (($nbthirdpartyno == $nbthirdpartytotal) ? ' disabled' : '');
|
||||
print ' ';
|
||||
print '<input type="submit" class="button butActionDelete" name="eraseallthirdpartybarcode" id="eraseallthirdpartybarcode" value="'.$langs->trans("EraseAllCurrentBarCode").'"'.$moretagsthirdparty2.' onClick="return confirm_erase();">';
|
||||
@ -351,7 +355,7 @@ if (isModEnabled('societe')) {
|
||||
|
||||
|
||||
// For products
|
||||
if ($conf->product->enabled || $conf->product->service) {
|
||||
if (isModEnabled('product') || isModEnabled('service')) {
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="mode" value="label">';
|
||||
print '<input type="hidden" name="action" value="initbarcodeproducts">';
|
||||
@ -391,28 +395,30 @@ if ($conf->product->enabled || $conf->product->service) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print $langs->trans("CurrentlyNWithoutBarCode", $nbproductno, $nbproducttotal, $langs->transnoentitiesnoconv("ProductsOrServices")).'<br>'."\n";
|
||||
print $langs->trans("CurrentlyNWithoutBarCode", $nbproductno, $nbproducttotal, $langs->transnoentitiesnoconv("ProductsOrServices"))."\n";
|
||||
|
||||
$disabledproduct = $disabledproduct1 = 0;
|
||||
|
||||
if (is_object($modBarCodeProduct)) {
|
||||
print $langs->trans("BarCodeNumberManager").": ";
|
||||
print '<br>'.$langs->trans("BarCodeNumberManager").": ";
|
||||
$objproduct = new Product($db);
|
||||
print '<b>'.(isset($modBarCodeProduct->name) ? $modBarCodeProduct->name : $modBarCodeProduct->nom).'</b> - '.$langs->trans("NextValue").': <b>'.$modBarCodeProduct->getNextValue($objproduct).'</b><br>';
|
||||
$disabledproduct = 0;
|
||||
print '<br>';
|
||||
} else {
|
||||
$disabledproduct = 1;
|
||||
$titleno = $langs->trans("NoBarcodeNumberingTemplateDefined");
|
||||
print '<span class="warning">'.$langs->trans("NoBarcodeNumberingTemplateDefined").'</span> (<a href="'.DOL_URL_ROOT.'/admin/barcode.php">'.$langs->trans("ToGenerateCodeDefineAutomaticRuleFirst").'</a>)<br>';
|
||||
print '<br><div class="warning">'.$langs->trans("NoBarcodeNumberingTemplateDefined");
|
||||
print '<br><a href="'.DOL_URL_ROOT.'/admin/barcode.php">'.$langs->trans("ToGenerateCodeDefineAutomaticRuleFirst").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
if (empty($nbproductno)) {
|
||||
$disabledproduct1 = 1;
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
//print '<input type="checkbox" id="erasealreadyset" name="erasealreadyset"> '.$langs->trans("ResetBarcodeForAllRecords").'<br>';
|
||||
$moretagsproduct1 = (($disabledproduct || $disabledproduct1) ? ' disabled title="'.dol_escape_htmltag($titleno).'"' : '');
|
||||
print '<input type="submit" class="button" name="submitformbarcodeproductgen" id="submitformbarcodeproductgen" value="'.$langs->trans("InitEmptyBarCode", min($maxperinit, $nbno)).'"'.$moretagsproduct1.'>';
|
||||
print '<input type="submit" class="button" name="submitformbarcodeproductgen" id="submitformbarcodeproductgen" value="'.$langs->trans("InitEmptyBarCode", min($maxperinit, $nbproductno)).'"'.$moretagsproduct1.'>';
|
||||
$moretagsproduct2 = (($nbproductno == $nbproducttotal) ? ' disabled' : '');
|
||||
print ' ';
|
||||
print '<input type="submit" class="button butActionDelete" name="eraseallproductbarcode" id="eraseallproductbarcode" value="'.$langs->trans("EraseAllCurrentBarCode").'"'.$moretagsproduct2.' onClick="return confirm_erase();">';
|
||||
|
||||
@ -203,25 +203,30 @@ if ($action == 'builddoc') {
|
||||
$forceimgscalewidth = (empty($conf->global->BARCODE_FORCEIMGSCALEWIDTH) ? 1 : $conf->global->BARCODE_FORCEIMGSCALEWIDTH);
|
||||
$forceimgscaleheight = (empty($conf->global->BARCODE_FORCEIMGSCALEHEIGHT) ? 1 : $conf->global->BARCODE_FORCEIMGSCALEHEIGHT);
|
||||
|
||||
for ($i = 0; $i < $numberofsticker; $i++) {
|
||||
$arrayofrecords[] = array(
|
||||
'textleft'=>$textleft,
|
||||
'textheader'=>$textheader,
|
||||
'textfooter'=>$textfooter,
|
||||
'textright'=>$textright,
|
||||
'code'=>$code,
|
||||
'encoding'=>$encoding,
|
||||
'is2d'=>$is2d,
|
||||
'photo'=>$barcodeimage // Photo must be a file that exists with format supported by TCPDF
|
||||
);
|
||||
$MAXSTICKERS = 1000;
|
||||
if ($numberofsticker <= $MAXSTICKERS) {
|
||||
for ($i = 0; $i < $numberofsticker; $i++) {
|
||||
$arrayofrecords[] = array(
|
||||
'textleft'=>$textleft,
|
||||
'textheader'=>$textheader,
|
||||
'textfooter'=>$textfooter,
|
||||
'textright'=>$textright,
|
||||
'code'=>$code,
|
||||
'encoding'=>$encoding,
|
||||
'is2d'=>$is2d,
|
||||
'photo'=>$barcodeimage // Photo must be a file that exists with format supported by TCPDF
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$mesg = $langs->trans("ErrorQuantityIsLimitedTo", $MAXSTICKERS);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
$mesg = '';
|
||||
|
||||
// Build and output PDF
|
||||
if ($mode == 'label') {
|
||||
if (!$error && $mode == 'label') {
|
||||
if (!count($arrayofrecords)) {
|
||||
$mesg = $langs->trans("ErrorRecordNotFound");
|
||||
}
|
||||
@ -240,7 +245,7 @@ if ($action == 'builddoc') {
|
||||
}
|
||||
}
|
||||
|
||||
if ($result <= 0 || $mesg) {
|
||||
if ($result <= 0 || $mesg || $error) {
|
||||
if (empty($mesg)) {
|
||||
$mesg = 'Error '.$result;
|
||||
}
|
||||
@ -272,8 +277,6 @@ print '<br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("PageToGenerateBarCodeSheets", $langs->transnoentitiesnoconv("BuildPageToPrint")).'</span><br>';
|
||||
print '<br>';
|
||||
|
||||
dol_htmloutput_errors($mesg);
|
||||
|
||||
//print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'<br>';
|
||||
//print '<br>';
|
||||
|
||||
|
||||
@ -361,11 +361,11 @@ class BlockedLog
|
||||
$this->amounts = $amounts;
|
||||
// date
|
||||
if ($object->element == 'payment' || $object->element == 'payment_supplier') {
|
||||
$this->date_object = $object->datepaye;
|
||||
$this->date_object = empty($object->datepaye) ? $object->date : $object->datepaye;
|
||||
} elseif ($object->element == 'payment_salary') {
|
||||
$this->date_object = $object->datev;
|
||||
} elseif ($object->element == 'payment_donation' || $object->element == 'payment_various') {
|
||||
$this->date_object = $object->datepaid ? $object->datepaid : $object->datep;
|
||||
$this->date_object = empty($object->datepaid) ? $object->datep : $object->datepaid;
|
||||
} elseif ($object->element == 'subscription') {
|
||||
$this->date_object = $object->dateh;
|
||||
} elseif ($object->element == 'cashcontrol') {
|
||||
@ -527,7 +527,7 @@ class BlockedLog
|
||||
|
||||
$totalamount = 0;
|
||||
|
||||
// Loop on each invoice payment amount
|
||||
// Loop on each invoice payment amount (payment_part)
|
||||
if (is_array($object->amounts) && !empty($object->amounts)) {
|
||||
$paymentpartnumber = 0;
|
||||
foreach ($object->amounts as $objid => $amount) {
|
||||
|
||||
@ -181,24 +181,10 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$bomline = new BOMLine($db);
|
||||
$bomline->fk_bom = $id;
|
||||
$bomline->fk_product = $idprod;
|
||||
$bomline->fk_bom_child = $bom_child_id;
|
||||
$bomline->qty = $qty;
|
||||
$bomline->qty_frozen = (int) $qty_frozen;
|
||||
$bomline->disable_stock_change = (int) $disable_stock_change;
|
||||
$bomline->efficiency = $efficiency;
|
||||
$result = $object->addLine($idprod, $qty, $qty_frozen, $disable_stock_change, $efficiency, -1, $bom_child_id, null);
|
||||
|
||||
// Rang to use
|
||||
$rangmax = $object->line_max(0);
|
||||
$ranktouse = $rangmax + 1;
|
||||
|
||||
$bomline->position = ($ranktouse + 1);
|
||||
|
||||
$result = $bomline->create($user);
|
||||
if ($result <= 0) {
|
||||
setEventMessages($bomline->error, $bomline->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = '';
|
||||
} else {
|
||||
unset($_POST['idprod']);
|
||||
@ -207,13 +193,11 @@ if (empty($reshook)) {
|
||||
unset($_POST['disable_stock_change']);
|
||||
|
||||
$object->fetchLines();
|
||||
|
||||
$object->calculateCosts();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add line
|
||||
// Update line
|
||||
if ($action == 'updateline' && $user->rights->bom->write) {
|
||||
$langs->load('errors');
|
||||
$error = 0;
|
||||
@ -229,26 +213,23 @@ if (empty($reshook)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$bomline = new BOMLine($db);
|
||||
$bomline->fetch($lineid);
|
||||
$bomline->qty = $qty;
|
||||
$bomline->qty_frozen = (int) $qty_frozen;
|
||||
$bomline->disable_stock_change = (int) $disable_stock_change;
|
||||
$bomline->efficiency = $efficiency;
|
||||
if (!$error) {
|
||||
$bomline = new BOMLine($db);
|
||||
$bomline->fetch($lineid);
|
||||
|
||||
$result = $bomline->update($user);
|
||||
if ($result <= 0) {
|
||||
setEventMessages($bomline->error, $bomline->errors, 'errors');
|
||||
$action = '';
|
||||
} else {
|
||||
unset($_POST['idprod']);
|
||||
unset($_POST['qty']);
|
||||
unset($_POST['qty_frozen']);
|
||||
unset($_POST['disable_stock_change']);
|
||||
$result = $object->updateLine($lineid, $qty, (int) $qty_frozen, (int) $disable_stock_change, $efficiency, $bomline->position, $bomline->import_key);
|
||||
|
||||
$object->fetchLines();
|
||||
if ($result <= 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = '';
|
||||
} else {
|
||||
unset($_POST['idprod']);
|
||||
unset($_POST['qty']);
|
||||
unset($_POST['qty_frozen']);
|
||||
unset($_POST['disable_stock_change']);
|
||||
|
||||
$object->calculateCosts();
|
||||
$object->fetchLines();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2019 Maxime Kohlhaas <maxime@atm-consulting.fr>
|
||||
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2022 Christian Humpel <christian.humpel@live.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -279,6 +280,177 @@ class Boms extends DolibarrApi
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lines of an BOM
|
||||
*
|
||||
* @param int $id Id of BOM
|
||||
*
|
||||
* @url GET {id}/lines
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getLines($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->bom->read) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->bom->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'BOM not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('bom_bom', $this->bom->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$this->bom->getLinesArray();
|
||||
$result = array();
|
||||
foreach ($this->bom->lines as $line) {
|
||||
array_push($result, $this->_cleanObjectDatas($line));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a line to given BOM
|
||||
*
|
||||
* @param int $id Id of BOM to update
|
||||
* @param array $request_data BOMLine data
|
||||
*
|
||||
* @url POST {id}/lines
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function postLine($id, $request_data = null)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->bom->write) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->bom->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'BOM not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('bom_bom', $this->bom->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$request_data = (object) $request_data;
|
||||
|
||||
$updateRes = $this->bom->addLine(
|
||||
$request_data->fk_product,
|
||||
$request_data->qty,
|
||||
$request_data->qty_frozen,
|
||||
$request_data->disable_stock_change,
|
||||
$request_data->efficiency,
|
||||
$request_data->position,
|
||||
$request_data->fk_bom_child,
|
||||
$request_data->import_key
|
||||
);
|
||||
|
||||
if ($updateRes > 0) {
|
||||
return $updateRes;
|
||||
} else {
|
||||
throw new RestException(400, $this->bom->error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a line to given BOM
|
||||
*
|
||||
* @param int $id Id of BOM to update
|
||||
* @param int $lineid Id of line to update
|
||||
* @param array $request_data BOMLine data
|
||||
*
|
||||
* @url PUT {id}/lines/{lineid}
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
public function putLine($id, $lineid, $request_data = null)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->bom->write) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->bom->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'BOM not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('bom_bom', $this->bom->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$request_data = (object) $request_data;
|
||||
|
||||
$updateRes = $this->bom->updateLine(
|
||||
$lineid,
|
||||
$request_data->qty,
|
||||
$request_data->qty_frozen,
|
||||
$request_data->disable_stock_change,
|
||||
$request_data->efficiency,
|
||||
$request_data->position,
|
||||
$request_data->import_key
|
||||
);
|
||||
|
||||
if ($updateRes > 0) {
|
||||
$result = $this->get($id);
|
||||
unset($result->line);
|
||||
return $this->_cleanObjectDatas($result);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a line to given BOM
|
||||
*
|
||||
*
|
||||
* @param int $id Id of BOM to update
|
||||
* @param int $lineid Id of line to delete
|
||||
*
|
||||
* @url DELETE {id}/lines/{lineid}
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
*/
|
||||
public function deleteLine($id, $lineid)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->bom->write) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->bom->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'BOM not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('bom_bom', $this->bom->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
//Check the rowid is a line of current bom object
|
||||
$lineIdIsFromObject = false;
|
||||
foreach ($this->bom->lines as $bl) {
|
||||
if ($bl->id == $lineid) {
|
||||
$lineIdIsFromObject = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$lineIdIsFromObject) {
|
||||
throw new RestException(500, 'Line to delete (rowid: '.$lineid.') is not a line of BOM (id: '.$this->bom->id.')');
|
||||
}
|
||||
|
||||
$updateRes = $this->bom->deleteline(DolibarrApiAccess::$user, $lineid);
|
||||
if ($updateRes > 0) {
|
||||
return $this->get($id);
|
||||
} else {
|
||||
throw new RestException(405, $this->bom->error);
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
|
||||
@ -96,7 +96,7 @@ class BOM extends CommonObject
|
||||
public $fields = array(
|
||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
|
||||
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5),
|
||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
|
||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1', 'csslist'=>'nowraponall'),
|
||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'2', 'autofocusoncreate'=>1, 'css'=>'minwidth300 maxwidth400', 'csslist'=>'tdoverflowmax200'),
|
||||
'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth175', 'csslist'=>'minwidth175 center'),
|
||||
//'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')),
|
||||
@ -502,6 +502,207 @@ class BOM extends CommonObject
|
||||
//return $this->deleteCommon($user, $notrigger, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an BOM line into database (linked to BOM)
|
||||
*
|
||||
* @param int $fk_product Id of product
|
||||
* @param float $qty Quantity
|
||||
* @param int $qty_frozen Frozen quantity
|
||||
* @param int $disable_stock_change Disable stock change on using in MO
|
||||
* @param float $efficiency Efficiency in MO
|
||||
* @param int $position Position of BOM-Line in BOM-Lines
|
||||
* @param int $fk_bom_child Id of BOM Child
|
||||
* @param string $import_key Import Key
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
public function addLine($fk_product, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $fk_bom_child = null, $import_key = null)
|
||||
{
|
||||
global $mysoc, $conf, $langs, $user;
|
||||
|
||||
$logtext = "::addLine bomid=$this->id, qty=$qty, fk_product=$fk_product, qty_frozen=$qty_frozen, disable_stock_change=$disable_stock_change, efficiency=$efficiency";
|
||||
$logtext .= ", fk_bom_child=$fk_bom_child, import_key=$import_key";
|
||||
dol_syslog(get_class($this).$logtext, LOG_DEBUG);
|
||||
|
||||
if ($this->statut == self::STATUS_DRAFT) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
// Clean parameters
|
||||
if (empty($qty)) {
|
||||
$qty = 0;
|
||||
}
|
||||
if (empty($qty_frozen)) {
|
||||
$qty_frozen = 0;
|
||||
}
|
||||
if (empty($disable_stock_change)) {
|
||||
$disable_stock_change = 0;
|
||||
}
|
||||
if (empty($efficiency)) {
|
||||
$efficiency = 1.0;
|
||||
}
|
||||
if (empty($fk_bom_child)) {
|
||||
$fk_bom_child = null;
|
||||
}
|
||||
if (empty($import_key)) {
|
||||
$import_key = null;
|
||||
}
|
||||
if (empty($position)) {
|
||||
$position = -1;
|
||||
}
|
||||
|
||||
$qty = price2num($qty);
|
||||
$efficiency = price2num($efficiency);
|
||||
$position = price2num($position);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Rank to use
|
||||
$rangMax = $this->line_max();
|
||||
$rankToUse = $position;
|
||||
if ($rankToUse <= 0 or $rankToUse > $rangMax) { // New line after existing lines
|
||||
$rankToUse = $rangMax + 1;
|
||||
} else { // New line between the existing lines
|
||||
foreach ($this->lines as $bl) {
|
||||
if ($bl->position >= $rankToUse) {
|
||||
$bl->position++;
|
||||
$bl->update($user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Insert line
|
||||
$this->line = new BOMLine($this->db);
|
||||
|
||||
$this->line->context = $this->context;
|
||||
|
||||
$this->line->fk_bom = $this->id;
|
||||
$this->line->fk_product = $fk_product;
|
||||
$this->line->qty = $qty;
|
||||
$this->line->qty_frozen = $qty_frozen;
|
||||
$this->line->disable_stock_change = $disable_stock_change;
|
||||
$this->line->efficiency = $efficiency;
|
||||
$this->line->fk_bom_child = $fk_bom_child;
|
||||
$this->line->import_key = $import_key;
|
||||
$this->line->position = $rankToUse;
|
||||
|
||||
$result = $this->line->create($user);
|
||||
|
||||
if ($result > 0) {
|
||||
$this->calculateCosts();
|
||||
$this->db->commit();
|
||||
return $result;
|
||||
} else {
|
||||
$this->error = $this->line->error;
|
||||
dol_syslog(get_class($this)."::addLine error=".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
} else {
|
||||
dol_syslog(get_class($this)."::addLine status of BOM must be Draft to allow use of ->addLine()", LOG_ERR);
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an BOM line into database
|
||||
*
|
||||
* @param int $rowid Id of line to update
|
||||
* @param float $qty Quantity
|
||||
* @param int $qty_frozen Frozen quantity
|
||||
* @param int $disable_stock_change Disable stock change on using in MO
|
||||
* @param float $efficiency Efficiency in MO
|
||||
* @param int $position Position of BOM-Line in BOM-Lines
|
||||
* @param string $import_key Import Key
|
||||
* @return int <0 if KO, Id of updated BOM-Line if OK
|
||||
*/
|
||||
public function updateLine($rowid, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $import_key = null)
|
||||
{
|
||||
global $mysoc, $conf, $langs, $user;
|
||||
|
||||
$logtext = "::updateLine bomid=$this->id, qty=$qty, qty_frozen=$qty_frozen, disable_stock_change=$disable_stock_change, efficiency=$efficiency";
|
||||
$logtext .= ", import_key=$import_key";
|
||||
dol_syslog(get_class($this).$logtext, LOG_DEBUG);
|
||||
|
||||
if ($this->statut == self::STATUS_DRAFT) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
// Clean parameters
|
||||
if (empty($qty)) {
|
||||
$qty = 0;
|
||||
}
|
||||
if (empty($qty_frozen)) {
|
||||
$qty_frozen = 0;
|
||||
}
|
||||
if (empty($disable_stock_change)) {
|
||||
$disable_stock_change = 0;
|
||||
}
|
||||
if (empty($efficiency)) {
|
||||
$efficiency = 1.0;
|
||||
}
|
||||
if (empty($import_key)) {
|
||||
$import_key = null;
|
||||
}
|
||||
if (empty($position)) {
|
||||
$position = -1;
|
||||
}
|
||||
|
||||
$qty = price2num($qty);
|
||||
$efficiency = price2num($efficiency);
|
||||
$position = price2num($position);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
//Fetch current line from the database and then clone the object and set it in $oldline property
|
||||
$line = new BOMLine($this->db);
|
||||
$line->fetch($rowid);
|
||||
$line->fetch_optionals();
|
||||
|
||||
$staticLine = clone $line;
|
||||
$line->oldcopy = $staticLine;
|
||||
$this->line = $line;
|
||||
$this->line->context = $this->context;
|
||||
|
||||
// Rank to use
|
||||
$rankToUse = (int) $position;
|
||||
if ($rankToUse != $line->oldcopy->position) { // check if position have a new value
|
||||
foreach ($this->lines as $bl) {
|
||||
if ($bl->position >= $rankToUse AND $bl->position < ($line->oldcopy->position + 1)) { // move rank up
|
||||
$bl->position++;
|
||||
$bl->update($user);
|
||||
}
|
||||
if ($bl->position <= $rankToUse AND $bl->position > ($line->oldcopy->position)) { // move rank down
|
||||
$bl->position--;
|
||||
$bl->update($user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->line->fk_bom = $this->id;
|
||||
$this->line->qty = $qty;
|
||||
$this->line->qty_frozen = $qty_frozen;
|
||||
$this->line->disable_stock_change = $disable_stock_change;
|
||||
$this->line->efficiency = $efficiency;
|
||||
$this->line->import_key = $import_key;
|
||||
$this->line->position = $rankToUse;
|
||||
|
||||
$result = $this->line->update($user);
|
||||
|
||||
if ($result > 0) {
|
||||
$this->calculateCosts();
|
||||
$this->db->commit();
|
||||
return $result;
|
||||
} else {
|
||||
$this->error = $this->line->error;
|
||||
dol_syslog(get_class($this)."::addLine error=".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
} else {
|
||||
dol_syslog(get_class($this)."::addLine status of BOM must be Draft to allow use of ->addLine()", LOG_ERR);
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a line of object in database
|
||||
*
|
||||
@ -517,7 +718,38 @@ class BOM extends CommonObject
|
||||
return -2;
|
||||
}
|
||||
|
||||
return $this->deleteLineCommon($user, $idline, $notrigger);
|
||||
$this->db->begin();
|
||||
|
||||
//Fetch current line from the database and then clone the object and set it in $oldline property
|
||||
$line = new BOMLine($this->db);
|
||||
$line->fetch($idline);
|
||||
$line->fetch_optionals();
|
||||
|
||||
$staticLine = clone $line;
|
||||
$line->oldcopy = $staticLine;
|
||||
$this->line = $line;
|
||||
$this->line->context = $this->context;
|
||||
|
||||
$result = $this->line->delete($user, $notrigger);
|
||||
|
||||
//Positions (rank) reordering
|
||||
foreach ($this->lines as $bl) {
|
||||
if ($bl->position > ($line->oldcopy->position)) { // move rank down
|
||||
$bl->position--;
|
||||
$bl->update($user);
|
||||
}
|
||||
}
|
||||
|
||||
if ($result > 0) {
|
||||
$this->calculateCosts();
|
||||
$this->db->commit();
|
||||
return $result;
|
||||
} else {
|
||||
$this->error = $this->line->error;
|
||||
dol_syslog(get_class($this)."::addLine error=".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -305,7 +305,8 @@ class Categories extends DolibarrApi
|
||||
Categorie::TYPE_CUSTOMER,
|
||||
Categorie::TYPE_SUPPLIER,
|
||||
Categorie::TYPE_MEMBER,
|
||||
Categorie::TYPE_PROJECT
|
||||
Categorie::TYPE_PROJECT,
|
||||
Categorie::TYPE_KNOWLEDGEMANAGEMENT
|
||||
])) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
@ -322,6 +323,8 @@ class Categories extends DolibarrApi
|
||||
throw new RestException(401);
|
||||
} elseif ($type == Categorie::TYPE_PROJECT && !DolibarrApiAccess::$user->rights->projet->lire) {
|
||||
throw new RestException(401);
|
||||
} elseif ($type == Categorie::TYPE_KNOWLEDGEMANAGEMENT && !DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$categories = $this->category->getListForItem($id, $type, $sortfield, $sortorder, $limit, $page);
|
||||
|
||||
@ -332,6 +332,7 @@ class Categorie extends CommonObject
|
||||
|
||||
// Check parameters
|
||||
if (empty($id) && empty($label) && empty($ref_ext)) {
|
||||
$this->error = "No category to search for";
|
||||
return -1;
|
||||
}
|
||||
if (!is_null($type) && !is_numeric($type)) {
|
||||
@ -389,6 +390,7 @@ class Categorie extends CommonObject
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
$this->error = "No category found";
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
@ -701,13 +703,14 @@ class Categorie extends CommonObject
|
||||
$type = $obj->element;
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this).'::add_type', LOG_DEBUG);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_".(empty($this->MAP_CAT_TABLE[$type]) ? $type : $this->MAP_CAT_TABLE[$type]);
|
||||
$sql .= " (fk_categorie, fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type]).")";
|
||||
$sql .= " VALUES (".((int) $this->id).", ".((int) $obj->id).")";
|
||||
|
||||
dol_syslog(get_class($this).'::add_type', LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
if (!empty($conf->global->CATEGORIE_RECURSIV_ADD)) {
|
||||
$sql = 'SELECT fk_parent FROM '.MAIN_DB_PREFIX.'categorie';
|
||||
|
||||
@ -103,7 +103,7 @@ if ($confirm == 'no') {
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
// Remove element from category
|
||||
if ($id > 0 && $removeelem > 0) {
|
||||
if ($id > 0 && $removeelem > 0 && $action == 'unlink') {
|
||||
if ($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
$tmpobject = new Product($db);
|
||||
@ -521,7 +521,8 @@ if ($type == Categorie::TYPE_PRODUCT) {
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
|
||||
print '<br>';
|
||||
$param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = ''; $newcardbutton = '';
|
||||
$param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = '';
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans("AddProduct"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&categories[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer);
|
||||
print_barre_liste($langs->trans("ProductsAndServices"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'products', 0, $newcardbutton, '', $limit);
|
||||
|
||||
|
||||
@ -544,7 +545,7 @@ if ($type == Categorie::TYPE_PRODUCT) {
|
||||
// Link to delete from category
|
||||
print '<td class="right">';
|
||||
if ($permission) {
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&removeelem=".$prod->id."'>";
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$prod->id."'>";
|
||||
print $langs->trans("DeleteFromCat");
|
||||
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
|
||||
print "</a>";
|
||||
@ -597,7 +598,8 @@ if ($type == Categorie::TYPE_CUSTOMER) {
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
|
||||
print '<br>';
|
||||
$param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($socs); $nbtotalofrecords = ''; $newcardbutton = '';
|
||||
$param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($socs); $nbtotalofrecords = '';
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans("AddThirdParty"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create&client=3&custcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer);
|
||||
print_barre_liste($langs->trans("Customers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit);
|
||||
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
@ -618,7 +620,7 @@ if ($type == Categorie::TYPE_CUSTOMER) {
|
||||
// Link to delete from category
|
||||
print '<td class="right">';
|
||||
if ($permission) {
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&removeelem=".$soc->id."'>";
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$soc->id."'>";
|
||||
print $langs->trans("DeleteFromCat");
|
||||
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
|
||||
print "</a>";
|
||||
@ -671,7 +673,8 @@ if ($type == Categorie::TYPE_SUPPLIER) {
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
|
||||
print '<br>';
|
||||
$param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($socs); $nbtotalofrecords = ''; $newcardbutton = '';
|
||||
$param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($socs); $nbtotalofrecords = '';
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans("AddSupplier"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create&fournisseur=1&suppcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer);
|
||||
print_barre_liste($langs->trans("Suppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit);
|
||||
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
@ -692,7 +695,7 @@ if ($type == Categorie::TYPE_SUPPLIER) {
|
||||
// Link to delete from category
|
||||
print '<td class="right">';
|
||||
if ($permission) {
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&removeelem=".$soc->id."'>";
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$soc->id."'>";
|
||||
print $langs->trans("DeleteFromCat");
|
||||
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
|
||||
print "</a>";
|
||||
@ -748,7 +751,8 @@ if ($type == Categorie::TYPE_MEMBER) {
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
|
||||
print '<br>';
|
||||
$param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = ''; $newcardbutton = '';
|
||||
$param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = '';
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans("AddMember"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create&memcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->adherent->creer);
|
||||
print_barre_liste($langs->trans("Member"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit);
|
||||
|
||||
print "<table class='noborder' width='100%'>\n";
|
||||
@ -772,7 +776,7 @@ if ($type == Categorie::TYPE_MEMBER) {
|
||||
// Link to delete from category
|
||||
print '<td class="right">';
|
||||
if ($permission) {
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&removeelem=".$member->id."'>";
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$member->id."'>";
|
||||
print $langs->trans("DeleteFromCat");
|
||||
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
|
||||
print "</a>";
|
||||
@ -788,7 +792,7 @@ if ($type == Categorie::TYPE_MEMBER) {
|
||||
}
|
||||
}
|
||||
|
||||
// Categorie contact
|
||||
// List of contacts
|
||||
if ($type == Categorie::TYPE_CONTACT) {
|
||||
$permission = $user->rights->societe->creer;
|
||||
|
||||
@ -808,7 +812,7 @@ if ($type == Categorie::TYPE_CONTACT) {
|
||||
print '<input type="hidden" name="action" value="addintocategory">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>';
|
||||
print $langs->trans("AddContactIntoCategory").' ';
|
||||
print $langs->trans("AssignCategoryTo").' ';
|
||||
print $form->selectContacts('', '', 'elemid');
|
||||
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
|
||||
print '</tr>';
|
||||
@ -826,7 +830,7 @@ if ($type == Categorie::TYPE_CONTACT) {
|
||||
$param = '&limit='.$limit.'&id='.$id.'&type='.$type;
|
||||
$num = count($contacts);
|
||||
$nbtotalofrecords = '';
|
||||
$newcardbutton = '';
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans("AddContact"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contact/card.php?action=create&contcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer);
|
||||
$objsoc = new Societe($db);
|
||||
print_barre_liste($langs->trans("Contact"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contact', 0, $newcardbutton, '', $limit);
|
||||
|
||||
@ -853,7 +857,7 @@ if ($type == Categorie::TYPE_CONTACT) {
|
||||
// Link to delete from category
|
||||
print '<td class="right">';
|
||||
if ($permission) {
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&removeelem=".$contact->id."'>";
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$contact->id."'>";
|
||||
print $langs->trans("DeleteFromCat");
|
||||
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
|
||||
print "</a>";
|
||||
@ -931,7 +935,7 @@ if ($type == Categorie::TYPE_ACCOUNT) {
|
||||
// Link to delete from category
|
||||
print '<td class="right">';
|
||||
if ($permission) {
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&removeelem=".$account->id."'>";
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$account->id."'>";
|
||||
print $langs->trans("DeleteFromCat");
|
||||
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
|
||||
print "</a>";
|
||||
@ -1009,7 +1013,7 @@ if ($type == Categorie::TYPE_PROJECT) {
|
||||
// Link to delete from category
|
||||
print '<td class="right">';
|
||||
if ($permission) {
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&removeelem=".$project->id."'>";
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$project->id."'>";
|
||||
print $langs->trans("DeleteFromCat");
|
||||
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
|
||||
print "</a>";
|
||||
@ -1026,7 +1030,7 @@ if ($type == Categorie::TYPE_PROJECT) {
|
||||
}
|
||||
|
||||
// List of users
|
||||
if ($type == Categorie::TYPE_USER) {
|
||||
if ($type == Categorie::TYPE_USER && $user->hasRight("user", "user", "read")) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
|
||||
$users = $object->getObjectsInCateg($type);
|
||||
@ -1081,7 +1085,7 @@ if ($type == Categorie::TYPE_USER) {
|
||||
// Link to delete from category
|
||||
print '<td class="right">';
|
||||
if ($user->rights->user->user->creer) {
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$type."&removeelem=".$userentry->id."'>";
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$type."&action=unlink&token=".newToken()."&removeelem=".$userentry->id."'>";
|
||||
print $langs->trans("DeleteFromCat");
|
||||
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
|
||||
print "</a>";
|
||||
@ -1095,6 +1099,9 @@ if ($type == Categorie::TYPE_USER) {
|
||||
|
||||
print '</form>'."\n";
|
||||
}
|
||||
} else {
|
||||
print_barre_liste($langs->trans("Users"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'user');
|
||||
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -1140,7 +1147,7 @@ if ($type == Categorie::TYPE_WAREHOUSE) {
|
||||
// Link to delete from category
|
||||
print '<td class="right">';
|
||||
if ($permission) {
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&removeelem=".$project->id."'>";
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$project->id."'>";
|
||||
print $langs->trans("DeleteFromCat");
|
||||
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
|
||||
print "</a>";
|
||||
@ -1156,6 +1163,7 @@ if ($type == Categorie::TYPE_WAREHOUSE) {
|
||||
}
|
||||
}
|
||||
|
||||
// List of tickets
|
||||
if ($type == Categorie::TYPE_TICKET) {
|
||||
$permission = ($user->rights->categorie->creer || $user->rights->categorie->creer);
|
||||
|
||||
@ -1212,7 +1220,7 @@ if ($type == Categorie::TYPE_TICKET) {
|
||||
// Link to delete from category
|
||||
print '<td class="right">';
|
||||
if ($permission) {
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&removeelem=".$ticket->id."'>";
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$ticket->id."'>";
|
||||
print $langs->trans("DeleteFromCat");
|
||||
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
|
||||
print "</a>";
|
||||
|
||||
@ -538,7 +538,7 @@ if (empty($reshook) && $action == 'add') {
|
||||
$error++;
|
||||
}
|
||||
// End date
|
||||
$repeateventlimitdate = dol_mktime('23', '59', '59', GETPOSTISSET("limitmonth", 'int') ? GETPOST("limitmonth", 'int') : 01, GETPOSTISSET("limitday", 'int') ? GETPOST("limitday", 'int') : 01, GETPOSTISSET("limityear", 'int') && GETPOST("limityear", 'int') < 2100 ? GETPOST("limityear", 'int') : 2100, $tzforfullday ? $tzforfullday : 'tzuser');
|
||||
$repeateventlimitdate = dol_mktime('23', '59', '59', GETPOSTISSET("limitmonth") ? GETPOST("limitmonth", 'int') : 01, GETPOSTISSET("limitday", 'int') ? GETPOST("limitday", 'int') : 01, GETPOSTISSET("limityear", 'int') && GETPOST("limityear", 'int') < 2100 ? GETPOST("limityear", 'int') : 2100, $tzforfullday ? $tzforfullday : 'tzuser');
|
||||
// Set date of end of event
|
||||
$deltatime = num_between_day($object->datep, $datep);
|
||||
$datef = dol_time_plus_duree($datef, $deltatime, 'd');
|
||||
@ -677,7 +677,7 @@ if (empty($reshook) && $action == 'update') {
|
||||
$object->fetch($id);
|
||||
$object->fetch_optionals();
|
||||
$object->fetch_userassigned();
|
||||
$object->oldcopy = clone $object;
|
||||
$object->oldcopy = dol_clone($object);
|
||||
|
||||
// Clean parameters
|
||||
if ($fulldayevent) {
|
||||
@ -927,7 +927,7 @@ if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes
|
||||
$object->fetch($id);
|
||||
$object->fetch_optionals();
|
||||
$object->fetch_userassigned();
|
||||
$object->oldcopy = clone $object;
|
||||
$object->oldcopy = dol_clone($object);
|
||||
|
||||
if ($user->rights->agenda->myactions->delete
|
||||
|| $user->rights->agenda->allactions->delete) {
|
||||
|
||||
@ -1558,13 +1558,13 @@ class ActionComm extends CommonObject
|
||||
}
|
||||
|
||||
$canread = 0;
|
||||
if ($user->rights->agenda->myactions->read && $this->authorid == $user->id) {
|
||||
if (!empty($user->rights->agenda->myactions->read) && $this->authorid == $user->id) {
|
||||
$canread = 1; // Can read my event
|
||||
}
|
||||
if ($user->rights->agenda->myactions->read && array_key_exists($user->id, $this->userassigned)) {
|
||||
if (!empty($user->rights->agenda->myactions->read) && array_key_exists($user->id, $this->userassigned)) {
|
||||
$canread = 1; // Can read my event i am assigned
|
||||
}
|
||||
if ($user->rights->agenda->allactions->read) {
|
||||
if (!empty($user->rights->agenda->allactions->read)) {
|
||||
$canread = 1; // Can read all event of other
|
||||
}
|
||||
if (!$canread) {
|
||||
|
||||
@ -216,6 +216,11 @@ class CActionComm
|
||||
if ($obj->module == 'shipping' && !empty($conf->expedition->enabled) && !empty($user->rights->expedition->lire)) {
|
||||
$qualified = 1;
|
||||
}
|
||||
// For case module = 'myobject@eventorganization'
|
||||
$tmparray = preg_split("/@/", $obj->module, -1);
|
||||
if (count($tmparray) > 1 && $tmparray[1] == 'eventorganization' && !empty($conf->eventorganization->enabled)) {
|
||||
$qualified = 1;
|
||||
}
|
||||
// For the generic case with type = 'module...' and module = 'myobject@mymodule'
|
||||
$regs = array();
|
||||
if (preg_match('/^module/', $obj->type)) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user