Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop_NEW_decrease_stock_expedition_classify
Conflicts: htdocs/expedition/class/expedition.class.php htdocs/product/stock/replenish.php
This commit is contained in:
commit
e74e70287f
1
.gitignore
vendored
1
.gitignore
vendored
@ -19,6 +19,7 @@ Thumbs.db
|
||||
# Vagrant generated files
|
||||
.vagrant
|
||||
# Composer installed repositories
|
||||
composer.lock
|
||||
/htdocs/includes/**/.git
|
||||
# Composer autoloader and unwanted files
|
||||
htdocs/includes/autoload.php
|
||||
|
||||
@ -9,6 +9,7 @@ filter:
|
||||
- dev/*
|
||||
- doc/*
|
||||
- test/*
|
||||
- htdocs/includes/*
|
||||
paths:
|
||||
- htdocs/*
|
||||
- scripts/*
|
||||
|
||||
@ -27,7 +27,7 @@ PHPExcel 1.8.1 LGPL-2.1+ Yes
|
||||
php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
|
||||
PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service
|
||||
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
|
||||
Restler 3.0 LGPL-3+ Yes Library to develop REST Web services
|
||||
Restler 3.0.0RC6 LGPL-3+ Yes Library to develop REST Web services
|
||||
TCPDF 6.2.12 LGPL-3+ Yes PDF generation
|
||||
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
|
||||
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP
|
||||
|
||||
@ -6,8 +6,8 @@ WARNING:
|
||||
|
||||
Do not try to make any Dolibarr upgrade if you are running Mysql version 5.5.40.
|
||||
Mysql version 5.5.40 has a very critical bug making your data beeing definitely lost.
|
||||
You may also experience troubles with Mysql 5.5.41/42/43 with error "Lost connection"
|
||||
during migration.
|
||||
You may also experience troubles with Mysql 5.5.41/42/43 with error "Lost connection" during
|
||||
migration.
|
||||
Upgrading to any other version or any other database system is abolutely required BEFORE trying
|
||||
make a Dolibarr upgrade.
|
||||
|
||||
@ -25,6 +25,8 @@ Dolibarr 4.0 should be compatible with PHP 7 but more feedbacks are still expect
|
||||
Following changes may create regression for some external modules, but were necessary to make
|
||||
Dolibarr better:
|
||||
- Function log() of class CommandeFournisseur has been removed. Using it is no more required.
|
||||
- Class Resource was renamed into DolResource to avoid conflict with a reserved PHP word.
|
||||
- Method commonobject->add_thumb() has been renamed into commonobject->addThumbs().
|
||||
- Method select_type_comptes_financiers() has been renamed into selectTypeOfBankAccount()
|
||||
- Property ->client that was deprecated 6 years ago, is replaced in all core code with ->thirdparty.
|
||||
- File '/core/tpl/document_actions_pre_headers.tpl.php' were renamed into '/core/actions_linkedfiles.inc.php'.
|
||||
@ -33,7 +35,6 @@ So if you included it into your module, change your code like this to be compati
|
||||
if (! $res) include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 3.9.1 compared to 3.9.* *****
|
||||
FIX: #3815 Call to undefined function local_by_date()
|
||||
FIX: #4424 Missing email of user popup in supplier orders area
|
||||
|
||||
@ -32,7 +32,7 @@ AppPublisherURL=http://www.nltechno.com
|
||||
AppSupportURL=http://www.dolibarr.org
|
||||
AppUpdatesURL=http://www.dolibarr.org
|
||||
AppComments=DoliWamp includes Dolibarr, Apache, PHP and Mysql softwares.
|
||||
AppCopyright=Copyright (C) 2008-2015 Laurent Destailleur, NLTechno
|
||||
AppCopyright=Copyright (C) 2008-2016 Laurent Destailleur, NLTechno
|
||||
DefaultDirName=c:\dolibarr
|
||||
DefaultGroupName=Dolibarr
|
||||
;LicenseFile=COPYING
|
||||
@ -80,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.2.11\logs"
|
||||
Name: "{app}\bin\apache\apache2.4.9\logs"
|
||||
|
||||
[Files]
|
||||
; Stop/start
|
||||
@ -101,10 +101,10 @@ Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversi
|
||||
; 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 or 5.1.36
|
||||
; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45 or 5.1.36
|
||||
Source: "C:\Program Files\Wamp\apps\phpmyadmin3.2.0.1\*.*"; DestDir: "{app}\apps\phpmyadmin3.2.0.1"; Flags: ignoreversion recursesubdirs; Excludes: "config.inc.php,wampserver.conf,*.log,*_log,darkblue_orange"
|
||||
Source: "C:\Program Files\Wamp\bin\apache\apache2.2.11\*.*"; DestDir: "{app}\bin\apache\apache2.2.11"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
|
||||
Source: "C:\Program Files\Wamp\bin\php\php5.3.0\*.*"; DestDir: "{app}\bin\php\php5.3.0"; 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:\Program Files\Wamp\apps\phpmyadmin4.1.14\*.*"; DestDir: "{app}\apps\phpmyadmin4.1.14"; Flags: ignoreversion recursesubdirs; Excludes: "config.inc.php,wampserver.conf,*.log,*_log,darkblue_orange"
|
||||
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:\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:\Program Files\Wamp\bin\mysql\mysql5.6.17\*.*"; DestDir: "{app}\bin\mysql\mysql5.6.17"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe"
|
||||
; Mysql data files (does not overwrite if exists)
|
||||
Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db"
|
||||
; Dolibarr
|
||||
@ -116,10 +116,10 @@ Source: "*.*"; DestDir: "{app}\www\dolibarr"; Flags: ignoreversion; Excludes: ".
|
||||
; Config files
|
||||
Source: "build\exe\doliwamp\phpmyadmin.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\dolibarr.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\config.inc.php.install"; DestDir: "{app}\apps\phpmyadmin3.2.0.1"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.2.11\conf"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php5.3.0"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\config.inc.php.install"; DestDir: "{app}\apps\phpmyadmin4.1.14"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.9\conf"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.5.12"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php5.6.17"; 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;
|
||||
@ -195,10 +195,10 @@ end;
|
||||
procedure InitializeWizard();
|
||||
begin
|
||||
//version des applis, a modifier pour chaque version de WampServer 2
|
||||
apacheVersion := '2.2.11';
|
||||
phpVersion := '5.3.0' ;
|
||||
mysqlVersion := '5.0.45';
|
||||
phpmyadminVersion := '3.2.0.1';
|
||||
apacheVersion := '2.4.9';
|
||||
phpVersion := '5.5.12' ;
|
||||
mysqlVersion := '5.6.17';
|
||||
phpmyadminVersion := '4.1.14';
|
||||
|
||||
smtpServer := 'localhost';
|
||||
apachePort := '80';
|
||||
@ -329,10 +329,10 @@ begin
|
||||
winPath := ExpandConstant('{win}');
|
||||
pathWithSlashes := path;
|
||||
StringChange (pathWithSlashes, '\','/');
|
||||
datadirold := pathWithSlashes+'/bin/mysql/mysql5.0.45/data';
|
||||
datadirold := pathWithSlashes+'/bin/mysql/mysql5.6.17/data';
|
||||
datadirnew := pathWithSlashes+'/bin/mysql/data';
|
||||
exedirold := pathWithSlashes+'/bin/mysql/mysql5.0.45';
|
||||
exedirnew := pathWithSlashes+'/bin/mysql/mysql5.0.45';
|
||||
exedirold := pathWithSlashes+'/bin/mysql/mysql5.6.17';
|
||||
exedirnew := pathWithSlashes+'/bin/mysql/mysql5.6.17';
|
||||
|
||||
// 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.
|
||||
@ -663,6 +663,7 @@ begin
|
||||
//installDir et version de php
|
||||
StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
|
||||
StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
|
||||
StringChangeEx (srcContents, 'WAMPMYSQLVERSION', myport, True);
|
||||
|
||||
SaveStringToFile(destFile,srcContents, False);
|
||||
end
|
||||
@ -1002,7 +1003,7 @@ Filename: "{app}\rundoliwamp.bat"; Description: {cm:LaunchNow}; Flags: shellexec
|
||||
|
||||
[UninstallDelete]
|
||||
Type: files; Name: "{app}\*.*"
|
||||
Type: files; Name: "{app}\bin\mysql\mysql5.0.45\*.*"
|
||||
Type: files; Name: "{app}\bin\mysql\mysql5.6.17\*.*"
|
||||
Type: filesandordirs; Name: "{app}\alias"
|
||||
Type: filesandordirs; Name: "{app}\apps"
|
||||
Type: filesandordirs; Name: "{app}\bin\apache"
|
||||
|
||||
@ -69,7 +69,7 @@ port=WAMPMYSQLPORT
|
||||
|
||||
|
||||
#Path to installation directory. All paths are usually resolved relative to this.
|
||||
basedir=WAMPROOT/bin/mysql/mysql5.0.45
|
||||
basedir=WAMPROOT/bin/mysql/mysqlWAMPMYSQLVERSION
|
||||
|
||||
#log file
|
||||
log-error=WAMPROOT/logs/mysql.log
|
||||
@ -226,7 +226,7 @@ port=WAMPMYSQLPORT
|
||||
|
||||
|
||||
#Path to installation directory. All paths are usually resolved relative to this.
|
||||
basedir=WAMPROOT/bin/mysql/mysql5.0.45
|
||||
basedir=WAMPROOT/bin/mysql/mysql5.6.17
|
||||
|
||||
#log file
|
||||
log-error=WAMPROOT/logs/mysql.log
|
||||
|
||||
@ -379,7 +379,7 @@ if ($nboftargetok) {
|
||||
|
||||
print 'Run git tag -a -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n";
|
||||
$ret=`git tag -a -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD" 2>&1`;
|
||||
if ($ret =~ /already exists/)
|
||||
if ($ret =~ /(already exists|existe déjà)/)
|
||||
{
|
||||
print "WARNING: Tag ".$MAJOR.'.'.$MINOR.'.'.$BUILD." already exists. Overwrite (y/N) ? ";
|
||||
$QUESTIONOVERWRITETAG=<STDIN>;
|
||||
@ -595,9 +595,12 @@ if ($nboftargetok) {
|
||||
if ($target eq 'TGZ')
|
||||
{
|
||||
$NEWDESTI=$DESTI;
|
||||
mkdir($DESTI.'/standard');
|
||||
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
|
||||
|
||||
if ($NEWPUBLISH =~ /stable/)
|
||||
{
|
||||
mkdir($DESTI.'/standard');
|
||||
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
|
||||
}
|
||||
|
||||
print "Remove target $FILENAMETGZ.tgz...\n";
|
||||
unlink("$NEWDESTI/$FILENAMETGZ.tgz");
|
||||
|
||||
@ -624,8 +627,11 @@ if ($nboftargetok) {
|
||||
if ($target eq 'XZ')
|
||||
{
|
||||
$NEWDESTI=$DESTI;
|
||||
mkdir($DESTI.'/standard');
|
||||
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
|
||||
if ($NEWPUBLISH =~ /stable/)
|
||||
{
|
||||
mkdir($DESTI.'/standard');
|
||||
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
|
||||
}
|
||||
|
||||
print "Remove target $FILENAMEXZ.xz...\n";
|
||||
unlink("$NEWDESTI/$FILENAMEXZ.xz");
|
||||
@ -658,8 +664,11 @@ if ($nboftargetok) {
|
||||
if ($target eq 'ZIP')
|
||||
{
|
||||
$NEWDESTI=$DESTI;
|
||||
mkdir($DESTI.'/standard');
|
||||
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
|
||||
if ($NEWPUBLISH =~ /stable/)
|
||||
{
|
||||
mkdir($DESTI.'/standard');
|
||||
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
|
||||
}
|
||||
|
||||
print "Remove target $FILENAMEZIP.zip...\n";
|
||||
unlink("$NEWDESTI/$FILENAMEZIP.zip");
|
||||
@ -696,8 +705,11 @@ if ($nboftargetok) {
|
||||
if ($target =~ /FEDO/i) { $subdir="package_rpm_redhat-fedora"; }
|
||||
if ($target =~ /MAND/i) { $subdir="package_rpm_mandriva"; }
|
||||
if ($target =~ /OPEN/i) { $subdir="package_rpm_opensuse"; }
|
||||
mkdir($DESTI.'/'.$subdir);
|
||||
if (-d $DESTI.'/'.$subdir) { $NEWDESTI=$DESTI.'/'.$subdir; }
|
||||
if ($NEWPUBLISH =~ /stable/)
|
||||
{
|
||||
mkdir($DESTI.'/'.$subdir);
|
||||
if (-d $DESTI.'/'.$subdir) { $NEWDESTI=$DESTI.'/'.$subdir; }
|
||||
}
|
||||
|
||||
if ($RPMDIR eq "") { $RPMDIR=$ENV{'HOME'}."/rpmbuild"; }
|
||||
|
||||
@ -779,8 +791,11 @@ if ($nboftargetok) {
|
||||
if ($target eq 'DEB')
|
||||
{
|
||||
$NEWDESTI=$DESTI;
|
||||
mkdir($DESTI.'/package_debian-ubuntu');
|
||||
if (-d $DESTI.'/package_debian-ubuntu') { $NEWDESTI=$DESTI.'/package_debian-ubuntu'; }
|
||||
if ($NEWPUBLISH =~ /stable/)
|
||||
{
|
||||
mkdir($DESTI.'/package_debian-ubuntu');
|
||||
if (-d $DESTI.'/package_debian-ubuntu') { $NEWDESTI=$DESTI.'/package_debian-ubuntu'; }
|
||||
}
|
||||
|
||||
$olddir=getcwd();
|
||||
|
||||
@ -979,8 +994,11 @@ if ($nboftargetok) {
|
||||
if ($target eq 'APS')
|
||||
{
|
||||
$NEWDESTI=$DESTI;
|
||||
mkdir($DESTI.'/package_aps');
|
||||
if (-d $DESTI.'/package_aps') { $NEWDESTI=$DESTI.'/package_aps'; }
|
||||
if ($NEWPUBLISH =~ /stable/)
|
||||
{
|
||||
mkdir($DESTI.'/package_aps');
|
||||
if (-d $DESTI.'/package_aps') { $NEWDESTI=$DESTI.'/package_aps'; }
|
||||
}
|
||||
|
||||
$newbuild = $BUILD;
|
||||
$newbuild =~ s/(dev|alpha)/0/gi; # dev
|
||||
@ -1062,8 +1080,11 @@ if ($nboftargetok) {
|
||||
if ($target eq 'EXEDOLIWAMP')
|
||||
{
|
||||
$NEWDESTI=$DESTI;
|
||||
mkdir($DESTI.'/package_windows');
|
||||
if (-d $DESTI.'/package_windows') { $NEWDESTI=$DESTI.'/package_windows'; }
|
||||
if ($NEWPUBLISH =~ /stable/)
|
||||
{
|
||||
mkdir($DESTI.'/package_windows');
|
||||
if (-d $DESTI.'/package_windows') { $NEWDESTI=$DESTI.'/package_windows'; }
|
||||
}
|
||||
|
||||
print "Remove target $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe...\n";
|
||||
unlink "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe";
|
||||
@ -1195,8 +1216,8 @@ if ($nboftargetok) {
|
||||
|
||||
$command="rsync -s -e 'ssh' \"$file\" \"".$destFolder."\"";
|
||||
print "$command\n";
|
||||
my $ret=`$command 2>&1`;
|
||||
print "$ret\n";
|
||||
my $ret2=`$command 2>&1`;
|
||||
print "$ret2\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
"mike42/escpos-php": "dev-master",
|
||||
"mobiledetect/mobiledetectlib": "2.8.17",
|
||||
"phpoffice/phpexcel": "1.8.1",
|
||||
"restler/framework": "^3.0",
|
||||
"restler/framework": "3.0.0-RC6",
|
||||
"tecnickcom/tcpdf": "6.2.12"
|
||||
},
|
||||
"require-dev": {
|
||||
|
||||
420
composer.lock
generated
420
composer.lock
generated
@ -1,420 +0,0 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "c2b53c577364dbe3a56137043081b511",
|
||||
"content-hash": "8f7a86cfbc13f45e13b73c49531818cb",
|
||||
"packages": [
|
||||
{
|
||||
"name": "ccampbell/chromephp",
|
||||
"version": "4.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ccampbell/chromephp.git",
|
||||
"reference": "c3c297615d48ae5b2a86a82311152d1ed095fcef"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ccampbell/chromephp/zipball/c3c297615d48ae5b2a86a82311152d1ed095fcef",
|
||||
"reference": "c3c297615d48ae5b2a86a82311152d1ed095fcef",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.0.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"ChromePhp": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"Apache-2.0"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Craig Campbell",
|
||||
"email": "iamcraigcampbell@gmail.com",
|
||||
"homepage": "http://craig.is",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Log variables to the Chrome console (via Chrome Logger Google Chrome extension).",
|
||||
"homepage": "http://github.com/ccampbell/chromephp",
|
||||
"keywords": [
|
||||
"log",
|
||||
"logging"
|
||||
],
|
||||
"time": "2013-06-26 03:44:33"
|
||||
},
|
||||
{
|
||||
"name": "ckeditor/ckeditor",
|
||||
"version": "dev-full/stable",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ckeditor/ckeditor-releases.git",
|
||||
"reference": "e3eb254641c4c349ffc19e49bd4a1a6831b5b6d0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ckeditor/ckeditor-releases/zipball/e3eb254641c4c349ffc19e49bd4a1a6831b5b6d0",
|
||||
"reference": "e3eb254641c4c349ffc19e49bd4a1a6831b5b6d0",
|
||||
"shasum": ""
|
||||
},
|
||||
"type": "library",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"GPL-2.0+",
|
||||
"LGPL-2.1+",
|
||||
"MPL-1.1+"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "CKSource",
|
||||
"homepage": "http://cksource.com"
|
||||
}
|
||||
],
|
||||
"description": "JavaScript WYSIWYG web text editor.",
|
||||
"homepage": "http://ckeditor.com",
|
||||
"keywords": [
|
||||
"CKEditor",
|
||||
"editor",
|
||||
"fckeditor",
|
||||
"html",
|
||||
"javascript",
|
||||
"richtext",
|
||||
"text",
|
||||
"wysiwyg"
|
||||
],
|
||||
"time": "2016-03-31 16:19:25"
|
||||
},
|
||||
{
|
||||
"name": "mike42/escpos-php",
|
||||
"version": "dev-master",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mike42/escpos-php.git",
|
||||
"reference": "96f05cbf460f5b67c2184ee4e91aedfbcedeb788"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mike42/escpos-php/zipball/96f05cbf460f5b67c2184ee4e91aedfbcedeb788",
|
||||
"reference": "96f05cbf460f5b67c2184ee4e91aedfbcedeb788",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.5.*"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Mike42\\": "src/Mike42"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Roni Saha",
|
||||
"email": "roni.cse@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Michael Billington",
|
||||
"email": "michael.billington@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Gergely Radics",
|
||||
"email": "gerifield@ustream.tv"
|
||||
},
|
||||
{
|
||||
"name": "Warren Doyle",
|
||||
"email": "w.doyle@fuelled.co"
|
||||
},
|
||||
{
|
||||
"name": "vharo",
|
||||
"email": "vharo@geepok.com"
|
||||
}
|
||||
],
|
||||
"description": "Thermal receipt printer library, for use with ESC/POS compatible printers",
|
||||
"homepage": "https://github.com/mike42/escpos-php",
|
||||
"keywords": [
|
||||
"ESC-POS",
|
||||
"driver",
|
||||
"escpos",
|
||||
"print",
|
||||
"receipt"
|
||||
],
|
||||
"time": "2016-03-27 23:08:27"
|
||||
},
|
||||
{
|
||||
"name": "mobiledetect/mobiledetectlib",
|
||||
"version": "2.8.17",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/serbanghita/Mobile-Detect.git",
|
||||
"reference": "b87da5f63a76e9615a0c74fcf168657b1ea7e41d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/b87da5f63a76e9615a0c74fcf168657b1ea7e41d",
|
||||
"reference": "b87da5f63a76e9615a0c74fcf168657b1ea7e41d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"codeclimate/php-test-reporter": "dev-master",
|
||||
"johnkary/phpunit-speedtrap": "~1.0@dev",
|
||||
"phpunit/phpunit": "*"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"Mobile_Detect.php"
|
||||
],
|
||||
"psr-0": {
|
||||
"Detection": "namespaced/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Serban Ghita",
|
||||
"email": "serbanghita@gmail.com",
|
||||
"homepage": "http://mobiledetect.net",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Mobile_Detect is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.",
|
||||
"homepage": "https://github.com/serbanghita/Mobile-Detect",
|
||||
"keywords": [
|
||||
"detect mobile devices",
|
||||
"mobile",
|
||||
"mobile detect",
|
||||
"mobile detector",
|
||||
"php mobile detect"
|
||||
],
|
||||
"time": "2015-09-17 14:45:21"
|
||||
},
|
||||
{
|
||||
"name": "phpoffice/phpexcel",
|
||||
"version": "1.8.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHPOffice/PHPExcel.git",
|
||||
"reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/372c7cbb695a6f6f1e62649381aeaa37e7e70b32",
|
||||
"reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-xml": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"php": ">=5.2.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"PHPExcel": "Classes/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"LGPL"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Maarten Balliauw",
|
||||
"homepage": "http://blog.maartenballiauw.be"
|
||||
},
|
||||
{
|
||||
"name": "Mark Baker"
|
||||
},
|
||||
{
|
||||
"name": "Franck Lefevre",
|
||||
"homepage": "http://blog.rootslabs.net"
|
||||
},
|
||||
{
|
||||
"name": "Erik Tilt"
|
||||
}
|
||||
],
|
||||
"description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
|
||||
"homepage": "http://phpexcel.codeplex.com",
|
||||
"keywords": [
|
||||
"OpenXML",
|
||||
"excel",
|
||||
"php",
|
||||
"spreadsheet",
|
||||
"xls",
|
||||
"xlsx"
|
||||
],
|
||||
"time": "2015-05-01 07:00:55"
|
||||
},
|
||||
{
|
||||
"name": "restler/framework",
|
||||
"version": "3.0.0",
|
||||
"target-dir": "Luracast/Restler",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Luracast/Restler-Framework.git",
|
||||
"reference": "6ee10b3e5dbc6376916fed55ec2340a37cce436b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Luracast/Restler-Framework/zipball/6ee10b3e5dbc6376916fed55ec2340a37cce436b",
|
||||
"reference": "6ee10b3e5dbc6376916fed55ec2340a37cce436b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"replace": {
|
||||
"luracast/restler": "3.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"bshaffer/oauth2-server-php": "v1.0",
|
||||
"luracast/explorer": "*",
|
||||
"mustache/mustache": "dev-master",
|
||||
"rodneyrehm/plist": "dev-master",
|
||||
"symfony/yaml": "*",
|
||||
"twig/twig": "v1.13.0",
|
||||
"zendframework/zendamf": "dev-master"
|
||||
},
|
||||
"suggest": {
|
||||
"bshaffer/oauth2-server-php": "Restler can provide OAuth2 authentication using this library (see require-dev for details)",
|
||||
"luracast/explorer": "Restler's very own api explorer (see require-dev for details)",
|
||||
"mustache/mustache": "Restler can render HtmlView using mustache/handlebar templates (see require-dev for details)",
|
||||
"rodneyrehm/plist": "Restler supports tho Apple plist xml format (see require-dev for details)",
|
||||
"symfony/yaml": "Restler can produce content in yaml format as well (see require-dev for details)",
|
||||
"twig/twig": "Restler can render HtmlView using twig templates (see require-dev for details)",
|
||||
"zendframework/zendamf": "Support for the amf document format (see require-dev for details)"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"master": "v3.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Luracast\\Restler": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"LGPL-2.1"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Luracast",
|
||||
"email": "arul@luracast.com"
|
||||
},
|
||||
{
|
||||
"name": "Nick nickl- Lombard",
|
||||
"email": "github@jigsoft.co.za"
|
||||
}
|
||||
],
|
||||
"description": "Just the Restler Framework without the tests and examples",
|
||||
"homepage": "http://luracast.com/products/restler/",
|
||||
"keywords": [
|
||||
"api",
|
||||
"framework",
|
||||
"rest",
|
||||
"server"
|
||||
],
|
||||
"time": "2015-08-04 07:52:49"
|
||||
},
|
||||
{
|
||||
"name": "tecnickcom/tcpdf",
|
||||
"version": "6.2.12",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tecnickcom/TCPDF.git",
|
||||
"reference": "2f732eaa91b5665274689b1d40b285a7bacdc37f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/2f732eaa91b5665274689b1d40b285a7bacdc37f",
|
||||
"reference": "2f732eaa91b5665274689b1d40b285a7bacdc37f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"fonts",
|
||||
"config",
|
||||
"include",
|
||||
"tcpdf.php",
|
||||
"tcpdf_parser.php",
|
||||
"tcpdf_import.php",
|
||||
"tcpdf_barcodes_1d.php",
|
||||
"tcpdf_barcodes_2d.php",
|
||||
"include/tcpdf_colors.php",
|
||||
"include/tcpdf_filters.php",
|
||||
"include/tcpdf_font_data.php",
|
||||
"include/tcpdf_fonts.php",
|
||||
"include/tcpdf_images.php",
|
||||
"include/tcpdf_static.php",
|
||||
"include/barcodes/datamatrix.php",
|
||||
"include/barcodes/pdf417.php",
|
||||
"include/barcodes/qrcode.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"LGPLv3"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicola Asuni",
|
||||
"email": "info@tecnick.com",
|
||||
"homepage": "http://nicolaasuni.tecnick.com"
|
||||
}
|
||||
],
|
||||
"description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
|
||||
"homepage": "http://www.tcpdf.org/",
|
||||
"keywords": [
|
||||
"PDFD32000-2008",
|
||||
"TCPDF",
|
||||
"barcodes",
|
||||
"datamatrix",
|
||||
"pdf",
|
||||
"pdf417",
|
||||
"qrcode"
|
||||
],
|
||||
"time": "2015-09-12 10:08:34"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": {
|
||||
"ckeditor/ckeditor": 20,
|
||||
"mike42/escpos-php": 20
|
||||
},
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": ">=5.3.0",
|
||||
"ext-curl": "*"
|
||||
},
|
||||
"platform-dev": []
|
||||
}
|
||||
@ -280,7 +280,7 @@ if ($resql)
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||
|
||||
|
||||
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 251 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 37 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 96 KiB |
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -48,6 +49,8 @@ if ($user->societe_id > 0)
|
||||
if (! $user->rights->accounting->chartofaccount)
|
||||
accessforbidden();
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'sortorder');
|
||||
$limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
@ -55,7 +58,7 @@ $page = GETPOST("page", 'int');
|
||||
if ($page == - 1) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortfield)
|
||||
@ -63,13 +66,31 @@ if (! $sortfield)
|
||||
if (! $sortorder)
|
||||
$sortorder = "ASC";
|
||||
|
||||
if ($action == 'delete') {
|
||||
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteAccount'), $langs->trans('ConfirmDeleteAccount'), 'confirm_delete', '', 0, 1);
|
||||
print $formconfirm;
|
||||
}
|
||||
|
||||
$accounting = new AccountingAccount($db);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction')) { $massaction=''; }
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_account = "";
|
||||
$search_label = "";
|
||||
$search_accountparent = "";
|
||||
$search_pcgtype = "";
|
||||
$search_pcgsubtype = "";
|
||||
}
|
||||
|
||||
if ($action == 'disable') {
|
||||
if ($accounting->fetch($id)) {
|
||||
$result = $accounting->account_desactivate($id);
|
||||
@ -89,21 +110,18 @@ if ($action == 'disable') {
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_account = "";
|
||||
$search_label = "";
|
||||
$search_accountparent = "";
|
||||
$search_pcgtype = "";
|
||||
$search_pcgsubtype = "";
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("ListAccounts"));
|
||||
|
||||
if ($action == 'delete') {
|
||||
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteAccount'), $langs->trans('ConfirmDeleteAccount'), 'confirm_delete', '', 0, 1);
|
||||
print $formconfirm;
|
||||
}
|
||||
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active, ";
|
||||
@ -128,8 +146,16 @@ if (strlen(trim($search_pcgtype))) {
|
||||
if (strlen(trim($search_pcgsubtype))) {
|
||||
$sql .= " AND aa.pcg_subtype like '%" . $search_pcgsubtype . "%'";
|
||||
}
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
dol_syslog('accountancy/admin/account.php:: $sql=' . $sql);
|
||||
@ -138,7 +164,15 @@ $result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num);
|
||||
$params='';
|
||||
if ($search_account != "") $params.= '&search_account='.urlencode($search_account);
|
||||
if ($search_label != "") $params.= '&search_label='.urlencode($search_label);
|
||||
if ($search_accountparent != "") $params.= '&search_accountparent='.urlencode($search_accountparent);
|
||||
if ($search_pcgtype != "") $params.= '&search_pcgtype='.urlencode($search_pcgtype);
|
||||
if ($search_pcgsubtype != "") $params.= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords);
|
||||
|
||||
$i = 0;
|
||||
|
||||
@ -147,19 +181,20 @@ if ($result) {
|
||||
print '<br/>';
|
||||
|
||||
print '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
|
||||
print '<a class="butAction" href="./categories.php">' . $langs->trans("ApplyMassCategories") . '</a>';
|
||||
// print '<a class="butAction" href="./importaccounts.php">' . $langs->trans("ImportAccount") . '</a>';
|
||||
// print '<a class="butAction" href="./productaccount.php">' . $langs->trans("CheckProductAccountancyCode") . '</a>';
|
||||
print '<br/><br/>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("AccountNumber"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "aa.label", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Accountparent"), $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Pcgtype"), $_SERVER["PHP_SELF"], "aa.pcg_type", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Pcgsubtype"), $_SERVER["PHP_SELF"], "aa.pcg_subtype", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Activated"), $_SERVER["PHP_SELF"], "aa.active", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("AccountNumber"), $_SERVER["PHP_SELF"], "aa.account_number", "", $params, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "aa.label", "", $params, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Accountparent"), $_SERVER["PHP_SELF"], "aa.account_parent", "", $params, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Pcgtype"), $_SERVER["PHP_SELF"], "aa.pcg_type", "", $params, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Pcgsubtype"), $_SERVER["PHP_SELF"], "aa.pcg_subtype", "", $params, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Activated"), $_SERVER["PHP_SELF"], "aa.active", "", $params, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $params, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
@ -76,19 +76,17 @@ if ($action == 'add') {
|
||||
|
||||
$res = $object->create($user);
|
||||
|
||||
if ($res == 0) {
|
||||
} else {
|
||||
if ($res == - 3) {
|
||||
$error = 1;
|
||||
$action = "create";
|
||||
}
|
||||
if ($res == - 4) {
|
||||
$error = 2;
|
||||
$action = "create";
|
||||
}
|
||||
if ($res == - 3) {
|
||||
$error = 1;
|
||||
$action = "create";
|
||||
}
|
||||
if ($res == - 4) {
|
||||
$error = 2;
|
||||
$action = "create";
|
||||
}
|
||||
}
|
||||
Header("Location: account.php");
|
||||
header("Location: account.php");
|
||||
exit;
|
||||
} else if ($action == 'edit') {
|
||||
if (! GETPOST('cancel', 'alpha')) {
|
||||
$result = $object->fetch($id);
|
||||
@ -134,7 +132,8 @@ if ($action == 'add') {
|
||||
$result = $object->delete($user);
|
||||
|
||||
if ($result > 0) {
|
||||
Header("Location: account.php");
|
||||
header("Location: account.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
157
htdocs/accountancy/admin/categories.php
Normal file
157
htdocs/accountancy/admin/categories.php
Normal file
@ -0,0 +1,157 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/categories.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page to assign mass categories to accounts
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancycategory.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
|
||||
$error = 0;
|
||||
|
||||
// Langs
|
||||
$langs->load("bills");
|
||||
$langs->load("accountancy");
|
||||
|
||||
$mesg = '';
|
||||
$action = GETPOST('action');
|
||||
$cat_id = GETPOST('account_category');
|
||||
$selectcpt = GETPOST('cpt_bk');
|
||||
$cpt_id = GETPOST('cptid');
|
||||
|
||||
if($cat_id == 0){
|
||||
$cat_id = null;
|
||||
}
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$cancel = GETPOST('cancel');
|
||||
|
||||
// Security check
|
||||
if (! $user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$AccCat = new AccountancyCategory($db);
|
||||
|
||||
// si ajout de comptes
|
||||
if(!empty($selectcpt)){
|
||||
$cpts = array();
|
||||
$i = 0;
|
||||
foreach ($selectcpt as $selectedOption){
|
||||
$cpts[$i] = "'".$selectedOption."'";
|
||||
$i++;
|
||||
}
|
||||
|
||||
if($AccCat->updateAccAcc($cat_id, $cpts)){
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
}else{
|
||||
setEventMessages($langs->trans('errors'), null, 'errors');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if ($action == 'delete') {
|
||||
if($cpt_id){
|
||||
if($AccCat->deleteCptCat($cpt_id)){
|
||||
setEventMessages($langs->trans('Deleted'), null, 'mesgs');
|
||||
}else{
|
||||
setEventMessages($langs->trans('errors'), null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
llxheader('', $langs->trans('AccountAccounting'));
|
||||
|
||||
$formaccounting = new FormAccounting($db);
|
||||
$form = new Form($db);
|
||||
|
||||
print load_fiche_titre($langs->trans('Categories'));
|
||||
|
||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="display">';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
// Category
|
||||
print '<tr><td>' . $langs->trans("AccountingCategory") . '</td>';
|
||||
print '<td>';
|
||||
$formaccounting->select_accounting_category($cat_id, 'account_category', 1);
|
||||
print '<input class="button" type="submit" value="' . $langs->trans("Display") . '">';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
if(!empty($cat_id)){
|
||||
$obj = $AccCat->getCptBK($cat_id);
|
||||
print '<tr><td>' . $langs->trans("AddCompteFromBK") . '</td>';
|
||||
print '<td>';
|
||||
if(!empty($obj)){
|
||||
print '<select size="'.count($obj).'" name="cpt_bk[]" multiple>';
|
||||
foreach ( $obj as $cpt ) {
|
||||
print '<option value="'.length_accountg($cpt->numero_compte).'">' . length_accountg($cpt->numero_compte) . ' ('.$cpt->label_compte.' '.$cpt->doc_ref.')</option>';
|
||||
|
||||
}
|
||||
print '</select> - <input class="button" type="submit" id="" class="action-delete" value="' . $langs->trans("add") . '"> ';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '</form>';
|
||||
|
||||
if ($action == 'display' || $action == 'delete') {
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre"><th class="liste_titre">'.$langs->trans("Numerocompte").'</th><th class="liste_titre">'.$langs->trans("Description").'</th><th class="liste_titre" width="60" align="center">Action</th></tr>';
|
||||
|
||||
if(!empty($cat_id)){
|
||||
$obj = $AccCat->display($cat_id);
|
||||
$j=1;
|
||||
if(!empty($obj)){
|
||||
foreach ( $obj as $cpt ) {
|
||||
$var = ! $var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>' . length_accountg($cpt->account_number) . '</td>';
|
||||
print '<td>' . $cpt->label . '</td>';
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?account_category=$cat_id&cptid=".$cpt->rowid, $langs->trans("DeleteCptCategory"), $langs->trans("ConfirmDeleteCptCategory"), "delete", '', 0, "action-delete".$j);
|
||||
print '<td><input class="button" type="button" id="action-delete'.$j.'" value="' . $langs->trans("Delete") . '"></td>';
|
||||
print "</tr>\n";
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -27,6 +27,18 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php';
|
||||
|
||||
$action = GETPOST('action');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield="f.rowid"; // Set here default search field
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("compta");
|
||||
|
||||
@ -54,6 +66,8 @@ $object = new Fiscalyear($db);
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -66,11 +80,20 @@ $title = $langs->trans('FiscalYears');
|
||||
|
||||
llxHeader('', $title, LOG_ERR);
|
||||
|
||||
print load_fiche_titre($langs->trans('FiscalYears'));
|
||||
|
||||
$sql = "SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut, f.entity";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_fiscalyear as f";
|
||||
$sql .= " WHERE f.entity = " . $conf->entity;
|
||||
$sql.=$db->order($sortfield,$sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
@ -78,6 +101,9 @@ if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$i = 0;
|
||||
|
||||
$title = $langs->trans('FiscalYears');
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit, 1);
|
||||
|
||||
// Load attribute_label
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
/* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.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
|
||||
@ -53,6 +53,7 @@ $object = new Fiscalyear($db);
|
||||
$date_start = dol_mktime(0, 0, 0, GETPOST('fiscalyearmonth', 'int'), GETPOST('fiscalyearday', 'int'), GETPOST('fiscalyearyear', 'int'));
|
||||
$date_end = dol_mktime(0, 0, 0, GETPOST('fiscalyearendmonth', 'int'), GETPOST('fiscalyearendday', 'int'), GETPOST('fiscalyearendyear', 'int'));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -143,10 +144,8 @@ llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
/*
|
||||
* Action create
|
||||
*/
|
||||
if ($action == 'create') {
|
||||
if ($action == 'create')
|
||||
{
|
||||
print load_fiche_titre($langs->trans("NewFiscalYear"));
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
||||
@ -172,7 +171,7 @@ if ($action == 'create') {
|
||||
|
||||
// Statut
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">' . $langs->trans("Statut") . '</td>';
|
||||
print '<td class="fieldrequired">' . $langs->trans("Status") . '</td>';
|
||||
print '<td class="valeur">';
|
||||
print $form->selectarray('statut', $statut2label, GETPOST('statut'));
|
||||
print '</td></tr>';
|
||||
@ -205,8 +204,8 @@ if ($action == 'create') {
|
||||
|
||||
// Ref
|
||||
print "<tr>";
|
||||
print '<td width="20%">' . $langs->trans("Ref") . '</td><td>';
|
||||
print $object->rowid;
|
||||
print '<td class="titlefield">' . $langs->trans("Ref") . '</td><td>';
|
||||
print $object->ref;
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
@ -252,11 +251,11 @@ if ($action == 'create') {
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/fiscalyear.php">' . $langs->trans("BackToList") . '</a>';
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/accountancy/admin/fiscalyear.php">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">' . $langs->trans("Ref") . '</td><td width="50%">';
|
||||
print $object->rowid;
|
||||
print $object->ref;
|
||||
print '</td><td width="25%">';
|
||||
print $linkback;
|
||||
print '</td></tr>';
|
||||
@ -270,16 +269,16 @@ if ($action == 'create') {
|
||||
|
||||
// Date start
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey("Date", 'date_start', $object->date_start, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker');
|
||||
print $form->editfieldkey("DateStart", 'date_start', $object->date_start, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker');
|
||||
print '</td><td colspan="2">';
|
||||
print $form->editfieldval("Date", 'date_start', $object->date_start, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker');
|
||||
print $form->editfieldval("DateStart", 'date_start', $object->date_start, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker');
|
||||
print '</td></tr>';
|
||||
|
||||
// Date end
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey("Date", 'date_end', $object->date_end, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker');
|
||||
print $form->editfieldkey("DateEnd", 'date_end', $object->date_end, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker');
|
||||
print '</td><td colspan="2">';
|
||||
print $form->editfieldval("Date", 'date_end', $object->date_end, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker');
|
||||
print $form->editfieldval("DateEnd", 'date_end', $object->date_end, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker');
|
||||
print '</td></tr>';
|
||||
|
||||
// Statut
|
||||
|
||||
@ -56,8 +56,9 @@ $list = array (
|
||||
);
|
||||
|
||||
$list_account = array (
|
||||
'ACCOUNTING_ACCOUNT_CUSTOMER',
|
||||
'ACCOUNTING_ACCOUNT_SUPPLIER',
|
||||
'ACCOUNTING_ACCOUNT_CUSTOMER',
|
||||
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
|
||||
'ACCOUNTING_PRODUCT_BUY_ACCOUNT',
|
||||
'ACCOUNTING_PRODUCT_SOLD_ACCOUNT',
|
||||
'ACCOUNTING_SERVICE_BUY_ACCOUNT',
|
||||
@ -67,7 +68,6 @@ $list_account = array (
|
||||
'ACCOUNTING_VAT_PAY_ACCOUNT',
|
||||
'ACCOUNTING_ACCOUNT_SUSPENSE',
|
||||
'ACCOUNTING_ACCOUNT_TRANSFER_CASH',
|
||||
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
|
||||
'DONATION_ACCOUNTINGACCOUNT'
|
||||
);
|
||||
|
||||
@ -219,10 +219,9 @@ print "<td>" . $langs->trans("Selectchartofaccounts") . "</td>";
|
||||
print "<td>";
|
||||
print '<select class="flat" name="chartofaccounts" id="chartofaccounts">';
|
||||
|
||||
$sql = "SELECT rowid, pcg_version, fk_pays, label, active";
|
||||
$sql = "SELECT rowid, pcg_version, label, active";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system";
|
||||
$sql .= " WHERE active = 1";
|
||||
$sql .= " AND fk_pays = " . $mysoc->country_id;
|
||||
|
||||
dol_syslog('accountancy/admin/index.php:: $sql=' . $sql);
|
||||
$resql = $db->query($sql);
|
||||
@ -238,7 +237,7 @@ if ($resql) {
|
||||
|
||||
print '<option value="' . $row[0] . '"';
|
||||
print $conf->global->CHARTOFACCOUNTS == $row[0] ? ' selected' : '';
|
||||
print '>' . $row[1] . ' - ' . $row[3] . '</option>';
|
||||
print '>' . $row[1] . ' - ' . $row[2] . '</option>';
|
||||
|
||||
$i ++;
|
||||
}
|
||||
|
||||
@ -1,31 +1,32 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/journal.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Setup page to configure accounting expert module
|
||||
*/
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Setup page to configure accounting expert module
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
@ -48,24 +49,44 @@ $list = array (
|
||||
'ACCOUNTING_PURCHASE_JOURNAL',
|
||||
'ACCOUNTING_SOCIAL_JOURNAL',
|
||||
'ACCOUNTING_MISCELLANEOUS_JOURNAL',
|
||||
'ACCOUNTING_EXPENSEREPORT_JOURNAL'
|
||||
'ACCOUNTING_EXPENSEREPORT_JOURNAL'
|
||||
);
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
*/
|
||||
|
||||
if ($action == 'update') {
|
||||
$error = 0;
|
||||
|
||||
foreach ( $list as $constname ) {
|
||||
|
||||
// Save vars
|
||||
foreach ($list as $constname)
|
||||
{
|
||||
$constvalue = GETPOST($constname, 'alpha');
|
||||
|
||||
|
||||
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Save bank account journals
|
||||
$arrayofbankaccount = GETPOST('bank_account', 'array');
|
||||
foreach($arrayofbankaccount as $key => $code)
|
||||
{
|
||||
$bankaccount = new Account($db);
|
||||
$res = $bankaccount->fetch($key);
|
||||
if ($res > 0)
|
||||
{
|
||||
$bankaccount->accountancy_journal = $code;
|
||||
$bankaccount->update($user);
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
@ -75,7 +96,7 @@ if ($action == 'update') {
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
@ -99,13 +120,13 @@ print "</tr>\n";
|
||||
|
||||
foreach ( $list as $key ) {
|
||||
$var = ! $var;
|
||||
|
||||
|
||||
print '<tr ' . $bc[$var] . ' class="value">';
|
||||
|
||||
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
print '<td width="50%"><label for="' . $key . '">' . $label . '</label></td>';
|
||||
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
print '<input type="text" size="20" id="' . $key . '" name="' . $key . '" value="' . $conf->global->$key . '">';
|
||||
@ -118,11 +139,11 @@ print '<br>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">' . $langs->trans('JournalFinancial') . '</td>';
|
||||
print '<td colspan="3">' . $langs->trans('JournalFinancial') . ' ('.$langs->trans('Opened').')</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Bank account
|
||||
$sql = "SELECT rowid, label, accountancy_journal";
|
||||
$sql = "SELECT rowid, label, number, accountancy_journal";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "bank_account";
|
||||
$sql .= " WHERE entity = " . $conf->entity;
|
||||
$sql .= " AND clos = 0";
|
||||
@ -132,29 +153,41 @@ $resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$numr = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
|
||||
if ($numr > 0)
|
||||
|
||||
while ( $i < $numr ) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$bankaccountstatic=new Account($db);
|
||||
|
||||
while ( $i < $numr ) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$var = ! $var;
|
||||
$var = ! $var;
|
||||
|
||||
print '<tr ' . $bc[$var] . ' class="value">';
|
||||
$bankaccountstatic->id = $objp->rowid;
|
||||
$bankaccountstatic->label = $objp->label;
|
||||
$bankaccountstatic->number = $objp->number;
|
||||
$bankaccountstatic->accountancy_journal = $objp->accountancy_journal;
|
||||
|
||||
// Param
|
||||
print '<td width="50%"><label for="' . $objp->rowid . '">' . $langs->trans("Journal") . ' - ' . $objp->label . '</label></td>';
|
||||
print '<tr ' . $bc[$var] . ' class="value">';
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
print '<input type="text" size="20" id="' . $objp->rowid . '" name="' . $objp->label . '" value="' . $objp->accountancy_journal . '" disabled>';
|
||||
print '</td></tr>';
|
||||
// Param
|
||||
print '<td width="50%"><label for="' . $objp->rowid . '">' . $langs->trans("Journal");
|
||||
print ' - '.$bankaccountstatic->getNomUrl(1);
|
||||
print '</label></td>';
|
||||
|
||||
$i ++;
|
||||
}
|
||||
} else
|
||||
// Value
|
||||
print '<td>';
|
||||
print '<input type="text" size="20" id="' . $objp->rowid . '" name="bank_account['.$objp->rowid.']" value="' . $objp->accountancy_journal . '">';
|
||||
print '</td></tr>';
|
||||
|
||||
$i ++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
|
||||
@ -100,9 +100,11 @@ if (! empty($search_accountancy_code_end)) {
|
||||
$options .= '&search_accountancy_code_end=' . $search_accountancy_code_end;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
if ($action == 'export_csv') {
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$journal = 'bookkepping';
|
||||
@ -157,14 +159,26 @@ else {
|
||||
print '<div class="inline-block divButAction"><input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" /></div>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="liste_titre">';
|
||||
print $langs->trans('DateStart') . ': ';
|
||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
||||
print $langs->trans('DateEnd') . ': ';
|
||||
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
$moreforfilter='';
|
||||
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('DateStart') . ': ';
|
||||
$moreforfilter.=$form->select_date($search_date_start, 'date_start', 0, 0, 1, '', 1, 0, 1);
|
||||
$moreforfilter.=$langs->trans('DateEnd') . ': ';
|
||||
$moreforfilter.=$form->select_date($search_date_end, 'date_end', 0, 0, 1, '', 1, 0, 1);
|
||||
$moreforfilter.='</div>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $sortfield, $sortorder);
|
||||
|
||||
@ -87,24 +87,8 @@ $formventilation = new FormVentilation($db);
|
||||
$formother = new FormOther($db);
|
||||
$form = new Form($db);
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_mvt_num = '';
|
||||
$search_doc_type = '';
|
||||
$search_doc_ref = '';
|
||||
$search_doc_date = '';
|
||||
$search_accountancy_code = '';
|
||||
$search_accountancy_code_start = '';
|
||||
$search_accountancy_code_end = '';
|
||||
$search_accountancy_aux_code = '';
|
||||
$search_accountancy_aux_code_start = '';
|
||||
$search_accountancy_aux_code_end = '';
|
||||
$search_mvt_label = '';
|
||||
$search_direction = '';
|
||||
$search_ledger_code = '';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (empty($search_date_start)) {
|
||||
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
||||
@ -178,9 +162,30 @@ if (! empty($search_mvt_num)) {
|
||||
$options .= '&search_mvt_num=' . $search_mvt_num;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_mvt_num = '';
|
||||
$search_doc_type = '';
|
||||
$search_doc_ref = '';
|
||||
$search_doc_date = '';
|
||||
$search_accountancy_code = '';
|
||||
$search_accountancy_code_start = '';
|
||||
$search_accountancy_code_end = '';
|
||||
$search_accountancy_aux_code = '';
|
||||
$search_accountancy_aux_code_start = '';
|
||||
$search_accountancy_aux_code_end = '';
|
||||
$search_mvt_label = '';
|
||||
$search_direction = '';
|
||||
$search_ledger_code = '';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
}
|
||||
|
||||
if ($action == 'delbookkeeping') {
|
||||
|
||||
$import_key = GETPOST('importkey', 'alpha');
|
||||
@ -193,7 +198,8 @@ if ($action == 'delbookkeeping') {
|
||||
Header("Location: list.php");
|
||||
exit();
|
||||
}
|
||||
} elseif ($action == 'delbookkeepingyearconfirm') {
|
||||
}
|
||||
if ($action == 'delbookkeepingyearconfirm') {
|
||||
|
||||
$delyear = GETPOST('delyear', 'int');
|
||||
|
||||
@ -205,7 +211,8 @@ if ($action == 'delbookkeeping') {
|
||||
Header("Location: list.php");
|
||||
exit();
|
||||
}
|
||||
} elseif ($action == 'delmouvconfirm') {
|
||||
}
|
||||
if ($action == 'delmouvconfirm') {
|
||||
|
||||
$mvt_num = GETPOST('mvt_num', 'int');
|
||||
|
||||
@ -217,7 +224,8 @@ if ($action == 'delbookkeeping') {
|
||||
Header("Location: list.php");
|
||||
exit();
|
||||
}
|
||||
} elseif ($action == 'export_csv') {
|
||||
}
|
||||
if ($action == 'export_csv') {
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php';
|
||||
|
||||
@ -311,168 +319,166 @@ if ($action == 'delbookkeeping') {
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
else {
|
||||
|
||||
$title_page = $langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end);
|
||||
$title_page = $langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end);
|
||||
|
||||
llxHeader('', $title_page);
|
||||
llxHeader('', $title_page);
|
||||
|
||||
/*
|
||||
* List
|
||||
*/
|
||||
// List
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
|
||||
if ($nbtotalofrecords < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
$result = $object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter);
|
||||
if ($result < 0) {
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
|
||||
if ($nbtotalofrecords < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
if ($action == 'delmouv') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1);
|
||||
print $formconfirm;
|
||||
}
|
||||
if ($action == 'delbookkeepingyear') {
|
||||
|
||||
$form_question = array ();
|
||||
$delyear = GETPOST('delyear');
|
||||
|
||||
if (empty($delyear)) {
|
||||
$delyear = dol_print_date(dol_now(), '%Y');
|
||||
}
|
||||
$year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
|
||||
|
||||
$form_question['delyear'] = array (
|
||||
'name' => 'delyear',
|
||||
'type' => 'select',
|
||||
'label' => $langs->trans('DelYear'),
|
||||
'values' => $year_array,
|
||||
'default' => $delyear
|
||||
);
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1);
|
||||
print $formconfirm;
|
||||
}
|
||||
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords);
|
||||
|
||||
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||
print '<div class="tabsAction">' . "\n";
|
||||
print '<div class="inline-block divButAction"><input type="submit" name="button_delmvt" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" /></div>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "bk_label_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="GET">';
|
||||
print '<td><input type="text" name="search_mvt_num" size="6" value="' . $search_mvt_num . '"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
print $langs->trans('From') . ': ';
|
||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
||||
print '<br>';
|
||||
print $langs->trans('to') . ': ';
|
||||
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
||||
print '</td>';
|
||||
print '<td><input type="text" name="search_doc_ref" size="8" value="' . $search_doc_ref . '"></td>';
|
||||
print '<td>';
|
||||
print $langs->trans('From');
|
||||
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
|
||||
print '<br>';
|
||||
print $langs->trans('to');
|
||||
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $langs->trans('From');
|
||||
print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||
print '<br>';
|
||||
print $langs->trans('to');
|
||||
print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" size=6 class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="right"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
||||
print '<td align="right" colspan="2" class="liste_titre">';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
|
||||
print ' ';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
$var = True;
|
||||
|
||||
$total_debit = 0;
|
||||
$total_credit = 0;
|
||||
|
||||
foreach ( $object->lines as $line ) {
|
||||
$var = ! $var;
|
||||
|
||||
$total_debit += $line->debit;
|
||||
$total_credit += $line->credit;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td><a href="./card.php?piece_num=' . $line->piece_num . '">' . $line->piece_num . '</a></td>';
|
||||
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
|
||||
print '<td>' . $line->doc_ref . '</td>';
|
||||
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
||||
print '<td>' . length_accounta($line->code_tiers) . '</td>';
|
||||
print '<td>' . $line->label_compte . '</td>';
|
||||
print '<td align="right">' . price($line->debit) . '</td>';
|
||||
print '<td align="right">' . price($line->credit) . '</td>';
|
||||
print '<td align="center">' . $line->code_journal . '</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a> ';
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $options . '&page=' . $page . '">' . img_delete() . '</a>';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="6"></td>';
|
||||
print '<td align="right">';
|
||||
print price($total_debit);
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print price($total_credit);
|
||||
print '</td>';
|
||||
print '<td colspan="2"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>";
|
||||
print '</form>';
|
||||
|
||||
llxFooter();
|
||||
}
|
||||
|
||||
$result = $object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
if ($action == 'delmouv') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1);
|
||||
print $formconfirm;
|
||||
}
|
||||
if ($action == 'delbookkeepingyear') {
|
||||
|
||||
$form_question = array ();
|
||||
$delyear = GETPOST('delyear');
|
||||
|
||||
if (empty($delyear)) {
|
||||
$delyear = dol_print_date(dol_now(), '%Y');
|
||||
}
|
||||
$year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
|
||||
|
||||
$form_question['delyear'] = array (
|
||||
'name' => 'delyear',
|
||||
'type' => 'select',
|
||||
'label' => $langs->trans('DelYear'),
|
||||
'values' => $year_array,
|
||||
'default' => $delyear
|
||||
);
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1);
|
||||
print $formconfirm;
|
||||
}
|
||||
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords);
|
||||
|
||||
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||
print '<div class="tabsAction">' . "\n";
|
||||
print '<div class="inline-block divButAction"><input type="submit" name="button_delmvt" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" /></div>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "bk_label_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="GET">';
|
||||
print '<td><input type="text" name="search_mvt_num" size="6" value="' . $search_mvt_num . '"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
print $langs->trans('From') . ': ';
|
||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
||||
print '<br>';
|
||||
print $langs->trans('to') . ': ';
|
||||
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
||||
print '</td>';
|
||||
print '<td><input type="text" name="search_doc_ref" size="8" value="' . $search_doc_ref . '"></td>';
|
||||
print '<td>';
|
||||
print $langs->trans('From');
|
||||
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
|
||||
print '<br>';
|
||||
print $langs->trans('to');
|
||||
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $langs->trans('From');
|
||||
print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||
print '<br>';
|
||||
print $langs->trans('to');
|
||||
print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="right"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
||||
print '<td align="right" colspan="2" class="liste_titre">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
$var = True;
|
||||
|
||||
$total_debit = 0;
|
||||
$total_credit = 0;
|
||||
|
||||
foreach ( $object->lines as $line ) {
|
||||
$var = ! $var;
|
||||
|
||||
$total_debit += $line->debit;
|
||||
$total_credit += $line->credit;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td><a href="./card.php?piece_num=' . $line->piece_num . '">' . $line->piece_num . '</a></td>';
|
||||
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
|
||||
print '<td>' . $line->doc_ref . '</td>';
|
||||
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
||||
print '<td>' . length_accounta($line->code_tiers) . '</td>';
|
||||
print '<td>' . $line->label_compte . '</td>';
|
||||
print '<td align="right">' . price($line->debit) . '</td>';
|
||||
print '<td align="right">' . price($line->credit) . '</td>';
|
||||
print '<td align="center">' . $line->code_journal . '</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a> ';
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $options . '&page=' . $page . '">' . img_delete() . '</a>';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="6"></td>';
|
||||
print '<td align="right">';
|
||||
print price($total_debit);
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print price($total_credit);
|
||||
print '</td>';
|
||||
print '<td colspan="2"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>";
|
||||
print '</form>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
|
||||
$db->close();
|
||||
@ -19,7 +19,7 @@
|
||||
/**
|
||||
* \file htdocs/accountancy/class/accountancycategory.class.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief File of class to manage categories of an accounting account_category
|
||||
* \brief File of class to manage categories of an accounting category_type
|
||||
*/
|
||||
|
||||
// Class
|
||||
@ -243,7 +243,7 @@ class AccountancyCategory
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.code, c.label, c.account_category ";
|
||||
$sql = "SELECT c.rowid, c.code, c.label, c.category_type ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co";
|
||||
$sql.= " WHERE c.active = 1 AND c.fk_country = co.rowid";
|
||||
$sql.= " AND co.code = '".$mysoc->country_code."'";
|
||||
@ -343,7 +343,7 @@ class AccountancyCategory
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
|
||||
$sql.= " WHERE c.active = 1 AND c.account_category = 1 ";
|
||||
$sql.= " WHERE c.active = 1 AND c.category_type = 1 ";
|
||||
$sql.= " AND c.fk_country = ".$mysoc->country_id;
|
||||
$sql.= " ORDER BY c.position ASC";
|
||||
}
|
||||
@ -351,7 +351,7 @@ class AccountancyCategory
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co";
|
||||
$sql.= " WHERE c.active = 1 AND c.account_category = 1 AND c.fk_country = co.rowid";
|
||||
$sql.= " WHERE c.active = 1 AND c.category_type = 1 AND c.fk_country = co.rowid";
|
||||
$sql.= " AND co.code = '".$mysoc->country_code."'";
|
||||
$sql.= " ORDER BY c.position ASC";
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ class FormVentilation extends Form
|
||||
$options[$select_value_out] = $label;
|
||||
}
|
||||
|
||||
$out .= Form::selectarray($htmlname, $options, $selected, $showempty);
|
||||
$out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300');
|
||||
$this->db->free($resql);
|
||||
return $out;
|
||||
}
|
||||
@ -264,7 +264,7 @@ class FormVentilation extends Form
|
||||
|
||||
// Build select
|
||||
$out = ajax_combobox($htmlname, $event);
|
||||
$out .= Form::selectarray($htmlname, $aux_account, $selectid, $showempty);
|
||||
$out .= Form::selectarray($htmlname, $aux_account, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300');
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -238,7 +238,7 @@ if ($result) {
|
||||
$paymentsalstatic->ref = $links[$key]['url_id'];
|
||||
$paymentsalstatic->label = $links[$key]['label'];
|
||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2);
|
||||
$tabtp[$obj->rowid][$account_employee ] += $obj->amount;
|
||||
$tabtp[$obj->rowid][$account_employee] += $obj->amount;
|
||||
} else if ($links[$key]['type'] == 'banktransfert') {
|
||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("BankTransfer");
|
||||
$tabtp[$obj->rowid][$account_transfer] += $obj->amount;
|
||||
@ -418,12 +418,27 @@ if ($action == 'export_csv') {
|
||||
foreach ( $tabpay as $key => $val ) {
|
||||
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
|
||||
|
||||
$reflabel = $val["ref"];
|
||||
if ($reflabel == '(SupplierInvoicePayment)') {
|
||||
$reflabel = $langs->trans('Supplier');
|
||||
}
|
||||
if ($reflabel == '(CustomerInvoicePayment)') {
|
||||
$reflabel = $langs->trans('Customer');
|
||||
}
|
||||
if ($reflabel == '(SocialContributionPayment)') {
|
||||
$reflabel = $langs->trans('SocialContribution');
|
||||
}
|
||||
if ($reflabel == '(DonationPayment)') {
|
||||
$reflabel = $langs->trans('Donation');
|
||||
}
|
||||
if ($reflabel == '(SubscriptionPayment)') {
|
||||
$reflabel = $langs->trans('Donation');
|
||||
}
|
||||
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
|
||||
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
|
||||
|
||||
// Bank
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print $date . $sep;
|
||||
@ -432,8 +447,12 @@ if ($action == 'export_csv') {
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'C' : 'D') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print $val["type_payment"] . $sep;
|
||||
print utf8_decode($val["ref"]) . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print $langs->trans('Bank')." - ". utf8_decode($val["ref"]) . $sep;
|
||||
} else {
|
||||
print $langs->trans("Bank") .' - '.utf8_decode($companystatic->name) . $sep;
|
||||
}
|
||||
print utf8_decode($reflabel) . $sep;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
@ -443,33 +462,45 @@ if ($action == 'export_csv') {
|
||||
if ($mt) {
|
||||
print $date . $sep;
|
||||
print $journal . $sep;
|
||||
if ($val["lib"] == '(SupplierInvoicePayment)') {
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
|
||||
} else {
|
||||
if ($tabtype[$key] == 'payment') {
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep;
|
||||
print length_accounta(html_entity_decode($k)) . $sep;
|
||||
} else if ($tabtype[$key] == 'payment_supplier') {
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
|
||||
print length_accounta(html_entity_decode($k)) . $sep;
|
||||
} else {
|
||||
print length_accountg(html_entity_decode($k)) . $sep;
|
||||
print $sep;
|
||||
}
|
||||
print length_accounta(html_entity_decode($k)) . $sep;
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print $val["type_payment"] . $sep;
|
||||
print utf8_decode($val["ref"]) . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print $langs->trans('ThirdParty')." - ". utf8_decode($val["ref"]) . $sep;
|
||||
} else {
|
||||
print $langs->trans('ThirdParty')." - ". utf8_decode($companystatic->name) . $sep;
|
||||
}
|
||||
print utf8_decode($reflabel) . $sep;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print $date . $sep;
|
||||
print $journal . $sep;
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . $sep;
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print $val["type_payment"] . $sep;
|
||||
print utf8_decode($val["ref"]) . $sep;
|
||||
print "\n";
|
||||
print $date . $sep;
|
||||
print $journal . $sep;
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . $sep;
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print $langs->trans('ThirdParty')." - ". utf8_decode($val["ref"]) . $sep;
|
||||
} else {
|
||||
print $langs->trans('ThirdParty')." - ". utf8_decode($companystatic->name) . $sep;
|
||||
}
|
||||
print utf8_decode($reflabel) . $sep;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Model Classic Export
|
||||
foreach ( $tabpay as $key => $val ) {
|
||||
@ -480,6 +511,7 @@ if ($action == 'export_csv') {
|
||||
|
||||
// Bank
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print '"' . $journal . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["type_payment"] . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
@ -488,7 +520,6 @@ if ($action == 'export_csv') {
|
||||
} else {
|
||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
}
|
||||
// print '"' . $langs->trans("Bank") . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||
print "\n";
|
||||
@ -498,10 +529,10 @@ if ($action == 'export_csv') {
|
||||
if (is_array($tabtp[$key])) {
|
||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '"' . $journal . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["type_payment"] . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
// print '"' . $companystatic->name . '"' . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($val["ref"]) . '"' . $sep;
|
||||
} else {
|
||||
@ -514,10 +545,10 @@ if ($action == 'export_csv') {
|
||||
}
|
||||
} else {
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print '"' . $journal . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
||||
// print '"' . $langs->trans("Bank") . '"' . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($val["ref"]) . '"' . $sep;
|
||||
} else {
|
||||
@ -599,6 +630,9 @@ else {
|
||||
if ($reflabel == '(DonationPayment)') {
|
||||
$reflabel = $langs->trans('Donation');
|
||||
}
|
||||
if ($reflabel == '(SubscriptionPayment)') {
|
||||
$reflabel = $langs->trans('SubscriptionPayment');
|
||||
}
|
||||
|
||||
// Bank
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
|
||||
@ -48,7 +48,7 @@ abstract class ActionsAdherentCardCommon
|
||||
|
||||
|
||||
/**
|
||||
* Instantiation of DAO class
|
||||
* Instantiation of DAO class. Init ->object
|
||||
*
|
||||
* @return int 0
|
||||
* @deprecated Using getInstanceDao should not be used.
|
||||
@ -83,18 +83,18 @@ abstract class ActionsAdherentCardCommon
|
||||
*/
|
||||
function getObject($id)
|
||||
{
|
||||
$ret = $this->getInstanceDao();
|
||||
//$ret = $this->getInstanceDao();
|
||||
|
||||
if (is_object($this->object) && method_exists($this->object,'fetch'))
|
||||
/*if (is_object($this->object) && method_exists($this->object,'fetch'))
|
||||
{
|
||||
if (! empty($id)) $this->object->fetch($id);
|
||||
}
|
||||
else
|
||||
{
|
||||
{*/
|
||||
$object = new Adherent($this->db);
|
||||
if (! empty($id)) $object->fetch($id);
|
||||
$this->object = $object;
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -121,11 +121,11 @@ abstract class ActionsAdherentCardCommon
|
||||
|
||||
// Creation user
|
||||
$nuser = new User($this->db);
|
||||
$result=$nuser->create_from_member($this->object,$_POST["login"]);
|
||||
$result=$nuser->create_from_member($this->object,GETPOST("login"));
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$result2=$nuser->setPassword($user,$_POST["password"],0,1,1);
|
||||
$result2=$nuser->setPassword($user,GETPOST("password"),0,1,1);
|
||||
if ($result2)
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -424,13 +424,14 @@ abstract class ActionsAdherentCardCommon
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->object->country_code = $obj->code;
|
||||
$this->object->country = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
$this->object->country_code = $obj->code;
|
||||
$this->object->country = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1577,7 +1577,7 @@ class Adherent extends CommonObject
|
||||
|
||||
if ($withpicto) $result.=($link.img_object('', $picto, 'class="classfortooltip"').$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
$result.=$link.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$linkend;
|
||||
$result.=$link.(($withpicto != 2) ? ($maxlen?dol_trunc($this->ref,$maxlen):$this->ref) : '').$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -28,6 +28,7 @@ require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
|
||||
$langs->load("members");
|
||||
$langs->load("companies");
|
||||
@ -43,6 +44,14 @@ $search_ref=GETPOST("search_ref");
|
||||
$search_lastname=GETPOST("search_lastname");
|
||||
$search_firstname=GETPOST("search_firstname");
|
||||
$search_login=GETPOST("search_login");
|
||||
$search_address=GETPOST("search_address");
|
||||
$search_zip=GETPOST("search_zip");
|
||||
$search_town=GETPOST("search_town");
|
||||
$search_state=GETPOST("search_state");
|
||||
$search_country=GETPOST("search_country");
|
||||
$search_phone=GETPOST("search_phone");
|
||||
$search_phone_perso=GETPOST("search_phone_perso");
|
||||
$search_phone_mobile=GETPOST("search_phone_mobile");
|
||||
$type=GETPOST("type");
|
||||
$search_email=GETPOST("search_email");
|
||||
$search_categ = GETPOST("search_categ",'int');
|
||||
@ -50,6 +59,8 @@ $catid = GETPOST("catid",'int');
|
||||
$sall=GETPOST("sall");
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
|
||||
if ($statut < -1) $statut = '';
|
||||
|
||||
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
@ -61,31 +72,22 @@ $pagenext = $page + 1;
|
||||
if (! $sortorder) { $sortorder=($filter=='outofdate'?"DESC":"ASC"); }
|
||||
if (! $sortfield) { $sortfield=($filter=='outofdate'?"d.datefin":"d.lastname"); }
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search="";
|
||||
$search_ref="";
|
||||
$search_lastname="";
|
||||
$search_firstname="";
|
||||
$search_login="";
|
||||
$type="";
|
||||
$search_email="";
|
||||
$search_categ="";
|
||||
$catid="";
|
||||
$sall="";
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('memberlist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('adherent');
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'd.rowid'=>'Ref',
|
||||
//'d.ref'=>'Ref',
|
||||
'd.lastname'=>'Lastname',
|
||||
'd.firstname'=>'Firstname',
|
||||
'd.societe'=>"Company",
|
||||
'd.login'=>'Login',
|
||||
'd.societe'=>"Company",
|
||||
'd.email'=>'EMail',
|
||||
'd.address'=>'Address',
|
||||
'd.zip'=>'Zip',
|
||||
@ -93,7 +95,79 @@ $fieldstosearchall = array(
|
||||
'd.note_public'=>'NotePublic',
|
||||
'd.note_private'=>'NotePrivate',
|
||||
);
|
||||
|
||||
$arrayfields=array(
|
||||
'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
||||
'd.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
|
||||
'd.company'=>array('label'=>$langs->trans("Company"), 'checked'=>1),
|
||||
'd.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1),
|
||||
'd.morphy'=>array('label'=>$langs->trans("MorPhy"), 'checked'=>1),
|
||||
't.libelle'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
|
||||
'd.email'=>array('label'=>$langs->trans("Email"), 'checked'=>1),
|
||||
'd.address'=>array('label'=>$langs->trans("Address"), 'checked'=>0),
|
||||
'd.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0),
|
||||
'd.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0),
|
||||
'd.phone'=>array('label'=>$langs->trans("Phone"), 'checked'=>0),
|
||||
'd.phone_perso'=>array('label'=>$langs->trans("PhonePerso"), 'checked'=>0),
|
||||
'd.phone_mobile'=>array('label'=>$langs->trans("PhoneMobile"), 'checked'=>0),
|
||||
'state.nom'=>array('label'=>$langs->trans("State"), 'checked'=>0),
|
||||
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
|
||||
/*'d.note_public'=>array('label'=>$langs->trans("NotePublic"), 'checked'=>0),
|
||||
'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/
|
||||
'd.datefin'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>500),
|
||||
'd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000)
|
||||
);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction')) { $massaction=''; }
|
||||
|
||||
$parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search="";
|
||||
$search_ref="";
|
||||
$search_lastname="";
|
||||
$search_firstname="";
|
||||
$search_login="";
|
||||
$search_company="";
|
||||
$type="";
|
||||
$search_email="";
|
||||
$search_address="";
|
||||
$search_zip="";
|
||||
$search_town="";
|
||||
$search_state="";
|
||||
$search_country='';
|
||||
$search_phone='';
|
||||
$search_phone_perso='';
|
||||
$search_phone_mobile='';
|
||||
$search_morphy="";
|
||||
$search_categ="";
|
||||
$catid="";
|
||||
$sall="";
|
||||
$statut='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -109,9 +183,11 @@ llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adhé
|
||||
$now=dol_now();
|
||||
|
||||
$sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company, d.fk_soc,";
|
||||
$sql.= " d.datefin,";
|
||||
$sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
|
||||
$sql.= " t.libelle as type, t.cotisation";
|
||||
$sql.= " d.datefin, d.address, d.zip, d.town, d.state_id, d.country,";
|
||||
$sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,";
|
||||
$sql.= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
|
||||
$sql.= " t.libelle as type, t.cotisation,";
|
||||
$sql.= " state.code_departement as state_code, state.nom as state_name";
|
||||
// Add fields for extrafields
|
||||
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
|
||||
// Add fields from hooks
|
||||
@ -119,7 +195,10 @@ $parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d";
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)";
|
||||
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member"; // We need this table joined to the select in order to filter by categ
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = d.country)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = d.state_id)";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql.= " WHERE d.fk_adherent_type = t.rowid ";
|
||||
if ($catid > 0) $sql.= " AND cm.fk_categorie = ".$db->escape($catid);
|
||||
@ -129,7 +208,7 @@ if ($search_categ == -2) $sql.= " AND cm.fk_categorie IS NULL";
|
||||
$sql.= " AND d.entity IN (".getEntity('adherent', 1).")";
|
||||
if ($sall) $sql.=natural_search(array_keys($fieldstosearchall), $sall);
|
||||
if ($type > 0) $sql.=" AND t.rowid=".$db->escape($type);
|
||||
if (isset($_GET["statut"]) || isset($_POST["statut"])) $sql.=" AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
|
||||
if ($statut != '') $sql.=" AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
|
||||
if ($search_ref)
|
||||
{
|
||||
if (is_numeric($search_ref)) $sql.= " AND (d.rowid = ".$db->escape($search_ref).")";
|
||||
@ -138,12 +217,31 @@ if ($search_ref)
|
||||
if ($search_lastname) $sql.= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname);
|
||||
if ($search_login) $sql.= natural_search("d.login", $search_login);
|
||||
if ($search_email) $sql.= natural_search("d.email", $search_email);
|
||||
if ($search_town) $sql.= natural_search("d.town",$search_town);
|
||||
if ($search_zip) $sql.= natural_search("d.zip",$search_zip);
|
||||
if ($search_state) $sql.= natural_search("state.nom",$search_state);
|
||||
if ($search_country) $sql .= " AND d.country IN (".$search_country.')';
|
||||
if ($filter == 'uptodate') $sql.=" AND datefin >= '".$db->idate($now)."'";
|
||||
if ($filter == 'outofdate') $sql.=" AND (datefin IS NULL OR datefin < '".$db->idate($now)."')";
|
||||
|
||||
// Add where from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
// Count total nb of records with no order and no limits
|
||||
@ -187,14 +285,35 @@ if ($resql)
|
||||
}
|
||||
|
||||
$param='';
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($statut != "") $param.="&statut=".$statut;
|
||||
if ($search_nom) $param.="&search_nom=".$search_nom;
|
||||
if ($search_login) $param.="&search_login=".$search_login;
|
||||
if ($search_email) $param.="&search_email=".$search_email;
|
||||
if ($filter) $param.="&filter=".$filter;
|
||||
if ($type > 0) $param.="&type=".$type;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($statut != "") $param.="&statut=".urlencode($statut);
|
||||
if ($search_ref) $param.="&search_ref=".urlencode($search_ref);
|
||||
if ($search_nom) $param.="&search_nom=".urlencode($search_nom);
|
||||
if ($search_firstname) $param.="&search_firstname=".urlencode($search_firstname);
|
||||
if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname);
|
||||
if ($search_login) $param.="&search_login=".urlencode($search_login);
|
||||
if ($search_email) $param.="&search_email=".urlencode($search_email);
|
||||
if ($search_company) $param.="&search_company=".urlencode($search_company);
|
||||
if ($search_address != '') $param.= "&search_address=".urlencode($search_address);
|
||||
if ($search_town != '') $param.= "&search_town=".urlencode($search_town);
|
||||
if ($search_zip != '') $param.= "&search_zip=".urlencode($search_zip);
|
||||
if ($search_state != '') $param.= "&search_state=".urlencode($search_state);
|
||||
if ($search_country != '') $param.= "&search_country=".urlencode($search_country);
|
||||
if ($search_phone != '') $param.= "&search_phone=".urlencode($search_phone);
|
||||
if ($search_phone_perso != '') $param.= "&search_phone_perso=".urlencode($search_phone_perso);
|
||||
if ($search_phone_mobile != '') $param.= "&search_phone_mobile=".urlencode($search_phone_mobile);
|
||||
if ($filter) $param.="&filter=".urlencode($filter);
|
||||
if ($type > 0) $param.="&type=".urlencode($type);
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
// Add $param from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||
}
|
||||
|
||||
//$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -222,96 +341,259 @@ if ($resql)
|
||||
$moreforfilter.=$formother->select_categories(Categorie::TYPE_MEMBER,$search_categ,'search_categ',1);
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
else $moreforfilter = $hookmanager->resPrint;
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">';
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
||||
{
|
||||
print '<td width="5" align="center"> </td>';
|
||||
print '<td colspan="1" align="center">'.$langs->trans("NumberingShort").'</td>';
|
||||
}
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"t.libelle",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder);
|
||||
|
||||
$parameters=array();
|
||||
if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'],$_SERVER["PHP_SELF"],'d.rowid','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'],$_SERVER["PHP_SELF"],'d.firstname','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'],$_SERVER["PHP_SELF"],'d.lastname','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.company']['checked'])) print_liste_field_titre($arrayfields['d.company']['label'],$_SERVER["PHP_SELF"],'d.societe','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'],$_SERVER["PHP_SELF"],'d.login','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.morphy']['checked'])) print_liste_field_titre($arrayfields['d.morphy']['label'],$_SERVER["PHP_SELF"],'d.morphy','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.libelle']['checked'])) print_liste_field_titre($arrayfields['t.libelle']['label'],$_SERVER["PHP_SELF"],'t.libelle','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.address']['checked'])) print_liste_field_titre($arrayfields['d.address']['label'],$_SERVER["PHP_SELF"],'d.address','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.zip']['checked'])) print_liste_field_titre($arrayfields['d.zip']['label'],$_SERVER["PHP_SELF"],'d.zip','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.town']['checked'])) print_liste_field_titre($arrayfields['d.town']['label'],$_SERVER["PHP_SELF"],'d.town','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.phone']['checked'])) print_liste_field_titre($arrayfields['d.phone']['label'],$_SERVER["PHP_SELF"],'d.phone','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.phone_perso']['checked'])) print_liste_field_titre($arrayfields['d.phone_perso']['label'],$_SERVER["PHP_SELF"],'d.phone_perso','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['d.phone_mobile']['label'],$_SERVER["PHP_SELF"],'d.phone_mobile','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.email']['checked'])) print_liste_field_titre($arrayfields['d.email']['label'],$_SERVER["PHP_SELF"],'d.email','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.datefin']['checked'])) print_liste_field_titre($arrayfields['d.datefin']['label'],$_SERVER["PHP_SELF"],'d.datefin','',$param,'align="center"',$sortfield,$sortorder);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Hook fields
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("EndSubscription"),$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans(""),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
if (! empty($arrayfields['d.datec']['checked'])) print_liste_field_titre($arrayfields['d.datec']['label'],$_SERVER["PHP_SELF"],"d.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.tms']['checked'])) print_liste_field_titre($arrayfields['d.tms']['label'],$_SERVER["PHP_SELF"],"d.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.statut']['checked'])) print_liste_field_titre($arrayfields['d.statut']['label'],$_SERVER["PHP_SELF"],"d.statut","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
// Line for filters fields
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print '<td class="liste_titre"> </td>';
|
||||
// Line numbering
|
||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
||||
{
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
|
||||
// Ref
|
||||
if (! empty($arrayfields['d.ref']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_ref" value="'.$search_ref.'" size="4"></td>';
|
||||
if (! empty($arrayfields['d.firstname']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_ref" value="'.$search_firstname.'" size="6"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.lastname']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_lastname" value="'.$search_lastname.'" size="6"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.company']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_company" value="'.$search_company.'" size="6"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.login']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_login" value="'.$search_login.'" size="6"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.morphy']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['t.libelle']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
$listetype=$membertypestatic->liste_array();
|
||||
print $form->selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 32);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.address']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_address" value="'.$search_address.'" size="5"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.zip']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_zip" value="'.$search_zip.'" size="5"></td>';
|
||||
}
|
||||
if (! empty($arrayfields['d.town']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_town" value="'.$search_town.'" size="5"></td>';
|
||||
}
|
||||
// State
|
||||
if (! empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat searchstring" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Country
|
||||
if (! empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->select_country($search_country,'search_country','',0,'maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
// Phone pro
|
||||
if (! empty($arrayfields['d.phone']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_phone" value="'.$search_phone.'" size="5"></td>';
|
||||
}
|
||||
// Phone perso
|
||||
if (! empty($arrayfields['d.phone_perso']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_phone_perso" value="'.$search_phone_perso.'" size="5"></td>';
|
||||
}
|
||||
// Phone mobile
|
||||
if (! empty($arrayfields['d.phone_mobile']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_phone_mobile" value="'.$search_phone_mobile.'" size="5"></td>';
|
||||
}
|
||||
// Email
|
||||
if (! empty($arrayfields['d.email']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_email" value="'.$search_email.'" size="5"></td>';
|
||||
}
|
||||
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_lastname" value="'.$search_lastname.'" size="12"></td>';
|
||||
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_login" value="'.$search_login.'" size="7"></td>';
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
$listetype=$membertypestatic->liste_array();
|
||||
print $form->selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 32);
|
||||
if (! empty($arrayfields['d.datefin']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '</td>';
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
$typeofextrafield=$extrafields->attribute_type[$key];
|
||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$searchclass='';
|
||||
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
||||
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
||||
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (! empty($arrayfields['d.datec']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['d.tms']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['d.statut']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre maxwidthonsmartphone" align="right">';
|
||||
$liststatus=array(
|
||||
'-1'=>$langs->trans("Draft"),
|
||||
'1'=>$langs->trans("Validated"),
|
||||
'0'=>$langs->trans("Resiliated")
|
||||
);
|
||||
print $form->selectarray('statut', $liststatus, $statut, -2);
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre"> </td>';
|
||||
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_email" value="'.$search_email.'" size="12"></td>';
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Status
|
||||
print '<td class="liste_titre"> </td>';
|
||||
|
||||
// Action column
|
||||
print '<td class="liste_titre" colspan="2" align="right">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$datefin=$db->jdate($objp->datefin);
|
||||
$memberstatic->id=$objp->rowid;
|
||||
$memberstatic->ref=$objp->rowid;
|
||||
$memberstatic->lastname=$objp->lastname;
|
||||
$memberstatic->firstname=$objp->firstname;
|
||||
$memberstatic->statut=$objp->statut;
|
||||
$datefin=$db->jdate($obj->datefin);
|
||||
$memberstatic->id=$obj->rowid;
|
||||
$memberstatic->ref=$obj->rowid;
|
||||
$memberstatic->lastname=$obj->lastname;
|
||||
$memberstatic->firstname=$obj->firstname;
|
||||
$memberstatic->societe=$obj->company;
|
||||
$memberstatic->statut=$obj->statut;
|
||||
$memberstatic->datefin= $datefin;
|
||||
|
||||
if (! empty($objp->fk_soc)) {
|
||||
$memberstatic->socid = $objp->fk_soc;
|
||||
$memberstatic->fetch_thirdparty();
|
||||
$memberstatic->socid = $obj->fk_soc;
|
||||
|
||||
if (! empty($obj->fk_soc)) {
|
||||
$memberstatic->fetch_thirdparty();
|
||||
$companyname=$memberstatic->thirdparty->name;
|
||||
} else {
|
||||
$companyname=$objp->company;
|
||||
$companyname=$obj->company;
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
@ -322,85 +604,212 @@ if ($resql)
|
||||
print '<td align="center">'.($i+1).'</td>';
|
||||
}
|
||||
|
||||
// Ref
|
||||
print "<td>";
|
||||
print $memberstatic->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
|
||||
// Ref
|
||||
if (! empty($arrayfields['d.ref']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
print $memberstatic->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
}
|
||||
// Lastname
|
||||
print "<td><a href=\"card.php?rowid=$objp->rowid\">";
|
||||
print ((! empty($objp->lastname) || ! empty($objp->firstname)) ? dol_trunc($memberstatic->getFullName($langs)) : '');
|
||||
print (((! empty($objp->lastname) || ! empty($objp->firstname)) && ! empty($companyname)) ? ' / ' : '');
|
||||
print (! empty($companyname) ? dol_trunc($companyname, 32) : '');
|
||||
print "</a></td>\n";
|
||||
|
||||
// Login
|
||||
print "<td>".$objp->login."</td>\n";
|
||||
|
||||
// Type
|
||||
$membertypestatic->id=$objp->type_id;
|
||||
$membertypestatic->libelle=$objp->type;
|
||||
print '<td class="nowrap">';
|
||||
print $membertypestatic->getNomUrl(1,32);
|
||||
print '</td>';
|
||||
|
||||
// Moral/Physique
|
||||
print "<td>".$memberstatic->getmorphylib($objp->morphy)."</td>\n";
|
||||
|
||||
if (! empty($arrayfields['d.lastname']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
print $obj->lastname;
|
||||
print "</td>\n";
|
||||
}
|
||||
// Firstname
|
||||
if (! empty($arrayfields['d.firstname']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
print $obj->firstname;
|
||||
print "</td>\n";
|
||||
}
|
||||
// Company
|
||||
if (! empty($arrayfields['d.company']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
print $companyname;
|
||||
print "</td>\n";
|
||||
}
|
||||
// Login
|
||||
if (! empty($arrayfields['d.login']['checked']))
|
||||
{
|
||||
print "<td>".$obj->login."</td>\n";
|
||||
}
|
||||
// Moral/Physique
|
||||
if (! empty($arrayfields['d.morphy']['checked']))
|
||||
{
|
||||
print "<td>".$memberstatic->getmorphylib($obj->morphy)."</td>\n";
|
||||
}
|
||||
// Type label
|
||||
if (! empty($arrayfields['t.libelle']['checked']))
|
||||
{
|
||||
$membertypestatic->id=$obj->type_id;
|
||||
$membertypestatic->libelle=$obj->type;
|
||||
print '<td class="nowrap">';
|
||||
print $membertypestatic->getNomUrl(1,32);
|
||||
print '</td>';
|
||||
}
|
||||
// Address
|
||||
if (! empty($arrayfields['d.address']['checked']))
|
||||
{
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->address;
|
||||
print '</td>';
|
||||
}
|
||||
// Zip
|
||||
if (! empty($arrayfields['d.zip']['checked']))
|
||||
{
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->zip;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Town
|
||||
if (! empty($arrayfields['d.town']['checked']))
|
||||
{
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->town;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// State
|
||||
if (! empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
print "<td>".$obj->state_name."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Country
|
||||
if (! empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
$tmparray=getCountry($obj->country,'all');
|
||||
print $tmparray['label'];
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Phone pro
|
||||
if (! empty($arrayfields['d.phone']['checked']))
|
||||
{
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->phone;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Phone perso
|
||||
if (! empty($arrayfields['d.phone_perso']['checked']))
|
||||
{
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->phone_perso;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Phone mobile
|
||||
if (! empty($arrayfields['d.phone_mobile']['checked']))
|
||||
{
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->phone_mobile;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// EMail
|
||||
print "<td>".dol_print_email($objp->email,0,0,1)."</td>\n";
|
||||
|
||||
$parameters=array('obj' => $obj);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Statut
|
||||
print '<td class="nowrap">';
|
||||
print $memberstatic->LibStatut($objp->statut,$objp->cotisation,$datefin,2);
|
||||
print "</td>";
|
||||
|
||||
if (! empty($arrayfields['d.email']['checked']))
|
||||
{
|
||||
print "<td>".dol_print_email($obj->email,0,0,1)."</td>\n";
|
||||
}
|
||||
// End of subscription date
|
||||
if ($datefin)
|
||||
$datefin=$db->jdate($obj->datefin);
|
||||
if (! empty($arrayfields['d.datefin']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($datefin,'day');
|
||||
if ($memberstatic->hasDelay()) {
|
||||
print " ".img_warning($langs->trans("SubscriptionLate"));
|
||||
}
|
||||
print '</td>';
|
||||
if ($datefin)
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($datefin,'day');
|
||||
if ($memberstatic->hasDelay()) {
|
||||
print " ".img_warning($langs->trans("SubscriptionLate"));
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="left" class="nowrap">';
|
||||
if ($obj->cotisation == 'yes')
|
||||
{
|
||||
print $langs->trans("SubscriptionNotReceived");
|
||||
if ($obj->statut > 0) print " ".img_warning();
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
print '<td align="left" class="nowrap">';
|
||||
if ($objp->cotisation == 'yes')
|
||||
{
|
||||
print $langs->trans("SubscriptionNotReceived");
|
||||
if ($objp->statut > 0) print " ".img_warning();
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
print '<td';
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
if ($align) print ' align="'.$align.'"';
|
||||
print '>';
|
||||
$tmpkey='options_'.$key;
|
||||
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Actions
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (! empty($arrayfields['d.datec']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['d.tms']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['d.statut']['checked']))
|
||||
{
|
||||
print '<td align="right" class="nowrap">';
|
||||
print $memberstatic->LibStatut($obj->statut,$obj->cotisation,$datefin,2);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Action column
|
||||
print '<td align="center">';
|
||||
if ($user->rights->adherent->creer)
|
||||
{
|
||||
print "<a href=\"card.php?rowid=".$objp->rowid."&action=edit&backtopage=1\">".img_edit()."</a>";
|
||||
print "<a href=\"card.php?rowid=".$obj->rowid."&action=edit&backtopage=1\">".img_edit()."</a>";
|
||||
}
|
||||
print ' ';
|
||||
if ($user->rights->adherent->supprimer && $objp->statut == -1)
|
||||
if ($user->rights->adherent->supprimer && $obj->statut == -1)
|
||||
{
|
||||
print "<a href=\"card.php?rowid=".$objp->rowid."&action=delete&backtopage=1\">".img_picto($langs->trans("Delete"),'disable.png')."</a>";
|
||||
print "<a href=\"card.php?rowid=".$obj->rowid."&action=delete&backtopage=1\">".img_picto($langs->trans("Delete"),'disable.png')."</a>";
|
||||
}
|
||||
if ($user->rights->adherent->supprimer && $objp->statut == 1)
|
||||
if ($user->rights->adherent->supprimer && $obj->statut == 1)
|
||||
{
|
||||
print "<a href=\"card.php?rowid=".$objp->rowid."&action=resign&backtopage=1\">".img_picto($langs->trans("Resiliate"),'disable.png')."</a>";
|
||||
print "<a href=\"card.php?rowid=".$obj->rowid."&action=resign&backtopage=1\">".img_picto($langs->trans("Resiliate"),'disable.png')."</a>";
|
||||
}
|
||||
print "</td>";
|
||||
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -62,21 +62,12 @@ if ($action == 'setcoder')
|
||||
}
|
||||
else if ($action == 'update')
|
||||
{
|
||||
if (GETPOST('submit_GENBARCODE_LOCATION'))
|
||||
{
|
||||
$location = GETPOST('GENBARCODE_LOCATION','alpha');
|
||||
$res = dolibarr_set_const($db, "GENBARCODE_LOCATION",$location,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
if (GETPOST('submit_PRODUIT_DEFAULT_BARCODE_TYPE'))
|
||||
{
|
||||
$coder_id = GETPOST('PRODUIT_DEFAULT_BARCODE_TYPE','alpha');
|
||||
$res = dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $coder_id,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
if (GETPOST('submit_GENBARCODE_BARCODETYPE_THIRDPARTY'))
|
||||
{
|
||||
$coder_id = GETPOST('GENBARCODE_BARCODETYPE_THIRDPARTY','alpha');
|
||||
$res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
$location = GETPOST('GENBARCODE_LOCATION','alpha');
|
||||
$res = dolibarr_set_const($db, "GENBARCODE_LOCATION",$location,'chaine',0,'',$conf->entity);
|
||||
$coder_id = GETPOST('PRODUIT_DEFAULT_BARCODE_TYPE','alpha');
|
||||
$res = dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $coder_id,'chaine',0,'',$conf->entity);
|
||||
$coder_id = GETPOST('GENBARCODE_BARCODETYPE_THIRDPARTY','alpha');
|
||||
$res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
else if ($action == 'updateengine')
|
||||
{
|
||||
@ -195,9 +186,9 @@ $var=true;
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans("BarcodeEncodeModule"),'','');
|
||||
|
||||
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"updateengine\">";
|
||||
//print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
|
||||
//print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
//print "<input type=\"hidden\" name=\"action\" value=\"updateengine\">";
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
@ -261,7 +252,7 @@ if ($resql)
|
||||
// Build barcode on disk (not used, this is done to make debug easier)
|
||||
$result=$module->writeBarCode($obj->example,$obj->encoding,'Y');
|
||||
// Generate on the fly and output barcode with generator
|
||||
$url=DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($obj->coder).'&code='.urlencode($obj->example).'&encoding='.urlencode($obj->encoding);
|
||||
$url=DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($obj->coder).'&code='.urlencode($obj->example).'&encoding='.urlencode($obj->encoding);
|
||||
//print $url;
|
||||
print '<img src="'.$url.'" title="'.$obj->example.'" border="0">';
|
||||
}
|
||||
@ -296,7 +287,7 @@ if (empty($conf->use_javascript_ajax))
|
||||
// TODO Implement code behind action updateengine
|
||||
//print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"></div>';
|
||||
}
|
||||
print '</form>';
|
||||
//print '</form>';
|
||||
|
||||
print "<br>";
|
||||
|
||||
@ -331,9 +322,7 @@ if (! isset($_SERVER['WINDIR']))
|
||||
$langs->load("errors");
|
||||
print '<br><font class="error">'.$langs->trans("ErrorFileNotFound",$conf->global->GENBARCODE_LOCATION).'</font>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td width="60" align="center"><input type="submit" class="button" name="submit_GENBARCODE_LOCATION" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Module products
|
||||
@ -344,10 +333,7 @@ if (! empty($conf->product->enabled))
|
||||
print '<td>'.$langs->trans("SetDefaultBarcodeTypeProducts").'</td>';
|
||||
print '<td width="60" align="right">';
|
||||
$formbarcode->select_barcode_type($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE,"PRODUIT_DEFAULT_BARCODE_TYPE",1);
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" name="submit_PRODUIT_DEFAULT_BARCODE_TYPE" value="'.$langs->trans("Modify").'">';
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Module thirdparty
|
||||
@ -358,13 +344,13 @@ if (! empty($conf->societe->enabled))
|
||||
print '<td>'.$langs->trans("SetDefaultBarcodeTypeThirdParties").'</td>';
|
||||
print '<td width="60" align="right">';
|
||||
print $formbarcode->select_barcode_type($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY,"GENBARCODE_BARCODETYPE_THIRDPARTY",1);
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" name="submit_GENBARCODE_BARCODETYPE_THIRDPARTY" value="'.$langs->trans("Modify").'">';
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print '<div class="tabsAction">';
|
||||
print '<input type="submit" class="button" name="submit_GENBARCODE_BARCODETYPE_THIRDPARTY" value="'.$langs->trans("Modify").'">';
|
||||
print "</div>";
|
||||
print '</form>';
|
||||
|
||||
print '<br>';
|
||||
@ -419,13 +405,13 @@ if ($conf->produit->enabled)
|
||||
|
||||
if ($conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file")
|
||||
{
|
||||
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproductoff&value='.$file.'">';
|
||||
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproductoff&value='.$file.'">';
|
||||
print img_picto($langs->trans("Activated"),'switch_on');
|
||||
print '</a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproducton&value='.$file.'">';
|
||||
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproducton&value='.$file.'">';
|
||||
print img_picto($langs->trans("Disabled"),'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
@ -442,7 +428,7 @@ if ($conf->produit->enabled)
|
||||
print "</table>\n";
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
//print '</form>';
|
||||
|
||||
print "<br>";
|
||||
|
||||
|
||||
@ -731,7 +731,9 @@ else
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("CompanyCurrency").'</td><td>';
|
||||
print currency_name($conf->currency,1);
|
||||
print ' ('.$langs->getCurrencySymbol($conf->currency).')';
|
||||
print ' ('.$conf->currency;
|
||||
print ($conf->currency != $langs->getCurrencySymbol($conf->currency) ? ' - '.$langs->getCurrencySymbol($conf->currency) : '');
|
||||
print ')';
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
|
||||
@ -188,8 +188,8 @@ $tabsql[27]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREF
|
||||
$tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
|
||||
$tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
|
||||
$tabsql[30]= "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
|
||||
$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, c.code as country_code, c.label as country, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_pays=c.rowid and c.active=1";
|
||||
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
||||
$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s";
|
||||
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
||||
$tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department";
|
||||
$tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
|
||||
|
||||
@ -226,7 +226,7 @@ $tabsqlsort[28]="country ASC, code ASC";
|
||||
$tabsqlsort[29]="position ASC";
|
||||
$tabsqlsort[30]="code ASC";
|
||||
$tabsqlsort[31]="pcg_version ASC";
|
||||
$tabsqlsort[32]="code ASC, label ASC";
|
||||
$tabsqlsort[32]="position ASC";
|
||||
$tabsqlsort[33]="code ASC";
|
||||
$tabsqlsort[34]="code ASC";
|
||||
|
||||
@ -262,8 +262,8 @@ $tabfield[27]= "code,libelle";
|
||||
$tabfield[28]= "code,label,affect,delay,newbymonth,country_id,country";
|
||||
$tabfield[29]= "code,label,percent,position";
|
||||
$tabfield[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||
$tabfield[31]= "pcg_version,country_id,country,label";
|
||||
$tabfield[32]= "code,label,range,position,country_id,country";
|
||||
$tabfield[31]= "pcg_version,label";
|
||||
$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
|
||||
$tabfield[33]= "code,label";
|
||||
$tabfield[34]= "code,label";
|
||||
|
||||
@ -299,8 +299,8 @@ $tabfieldvalue[27]= "code,libelle";
|
||||
$tabfieldvalue[28]= "code,label,affect,delay,newbymonth,country";
|
||||
$tabfieldvalue[29]= "code,label,percent,position";
|
||||
$tabfieldvalue[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||
$tabfieldvalue[31]= "pcg_version,country,label";
|
||||
$tabfieldvalue[32]= "code,label,range_account,position,country";
|
||||
$tabfieldvalue[31]= "pcg_version,label";
|
||||
$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country";
|
||||
$tabfieldvalue[33]= "code,label";
|
||||
$tabfieldvalue[34]= "code,label";
|
||||
|
||||
@ -336,8 +336,8 @@ $tabfieldinsert[27]= "code,libelle";
|
||||
$tabfieldinsert[28]= "code,label,affect,delay,newbymonth,fk_country";
|
||||
$tabfieldinsert[29]= "code,label,percent,position";
|
||||
$tabfieldinsert[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||
$tabfieldinsert[31]= "pcg_version,fk_pays,label";
|
||||
$tabfieldinsert[32]= "code,label,range_account,position,fk_country";
|
||||
$tabfieldinsert[31]= "pcg_version,label";
|
||||
$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
|
||||
$tabfieldinsert[33]= "code,label";
|
||||
$tabfieldinsert[34]= "code,label";
|
||||
|
||||
@ -524,6 +524,7 @@ if ($id == 11)
|
||||
'propal' => $langs->trans('Proposal'),
|
||||
'commande' => $langs->trans('Order'),
|
||||
'facture' => $langs->trans('Bill'),
|
||||
'resource' => $langs->trans('Resource'),
|
||||
// 'facture_fourn' => $langs->trans('SupplierBill'),
|
||||
'fichinter' => $langs->trans('InterventionCard')
|
||||
);
|
||||
@ -585,6 +586,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
|
||||
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
|
||||
if ($value == 'color' && empty($_POST['color'])) continue;
|
||||
if ($value == 'formula' && empty($_POST['formula'])) continue;
|
||||
if ((! isset($_POST[$value]) || $_POST[$value]=='')
|
||||
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy'))) // Fields that are not mandatory
|
||||
)
|
||||
@ -605,6 +607,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
if ($fieldnamekey == 'unicode') $fieldnamekey = 'Unicode';
|
||||
if ($fieldnamekey == 'deductible') $fieldnamekey = 'Deductible';
|
||||
if ($fieldnamekey == 'sortorder') $fieldnamekey = 'SortOrder';
|
||||
if ($fieldnamekey == 'category_type') $fieldnamekey = 'Calculated';
|
||||
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
}
|
||||
@ -999,6 +1002,9 @@ if ($id)
|
||||
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
|
||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
|
||||
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
|
||||
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
||||
if ($fieldlist[$field]=='formula') { $valuetoshow=$langs->trans("Formula"); }
|
||||
|
||||
if ($id == 2) // Special cas for state page
|
||||
{
|
||||
@ -1064,7 +1070,7 @@ if ($id)
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
|
||||
|
||||
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates')
|
||||
{
|
||||
print '<tr><td colspan="8">* '.$langs->trans("AvailableVariables").": ";
|
||||
@ -1167,6 +1173,9 @@ if ($id)
|
||||
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
|
||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
|
||||
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
|
||||
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
||||
if ($fieldlist[$field]=='formula') { $valuetoshow=$langs->trans("Formula"); }
|
||||
|
||||
// Affiche nom du champ
|
||||
if ($showfield)
|
||||
@ -1248,7 +1257,7 @@ if ($id)
|
||||
$valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country);
|
||||
}
|
||||
}
|
||||
else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm' || $fieldlist[$field] == 'deductible') {
|
||||
else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
|
||||
$valuetoshow=yn($valuetoshow);
|
||||
$align="center";
|
||||
}
|
||||
@ -1618,7 +1627,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
print 'user<input type="hidden" name="type" value="user">';
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'fdm' || $fieldlist[$field] == 'deductible') {
|
||||
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'fdm' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
|
||||
print '<td>';
|
||||
print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1);
|
||||
print '</td>';
|
||||
@ -1697,7 +1706,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
if ($fieldlist[$field]=='position') $size='size="4" ';
|
||||
if ($fieldlist[$field]=='libelle') $size='centpercent';
|
||||
if ($fieldlist[$field]=='tracking') $class='centpercent';
|
||||
if ($fieldlist[$field]=='sortorder') $size='size="2" ';
|
||||
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
|
||||
print '<input type="text" '.$size.' class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -189,7 +189,19 @@ else
|
||||
show_skin(null,1);
|
||||
print '<br>'."\n";
|
||||
|
||||
print load_fiche_titre($langs->trans("TestSubmitForm"),'(mode='.$mode.')','');
|
||||
$listofmodes=array('dolibarr_mailings','dolibarr_notes','dolibarr_details','Full');
|
||||
$linkstomode='';
|
||||
foreach($listofmodes as $newmode)
|
||||
{
|
||||
if ($linkstomode) $linkstomode.=' - ';
|
||||
$linkstomode.='<a href="'.$_SERVER["PHP_SELF"].'?mode='.$newmode.'">';
|
||||
if ($mode == $newmode) $linkstomode.='<strong>';
|
||||
$linkstomode.=$newmode;
|
||||
if ($mode == $newmode) $linkstomode.='</strong>';
|
||||
$linkstomode.='</a>';
|
||||
}
|
||||
$linkstomode.='';
|
||||
print load_fiche_titre($langs->trans("TestSubmitForm"),$linkstomode,'');
|
||||
print '<input type="hidden" name="mode" value="'.dol_escape_htmltag($mode).'">';
|
||||
$uselocalbrowser=true;
|
||||
$readonly=($mode=='dolibarr_readonly'?1:0);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
/* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.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
|
||||
@ -26,6 +26,7 @@ require '../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("loan");
|
||||
@ -76,6 +77,7 @@ if ($action == 'update')
|
||||
llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans('ConfigLoan'),$linkback,'title_setup');
|
||||
@ -104,7 +106,14 @@ foreach ($list as $key)
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print $formaccountancy->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -75,6 +75,7 @@ if ($action == 'update')
|
||||
$menu->perms=$_POST['perms'];
|
||||
$menu->target=$_POST['target'];
|
||||
$menu->user=$_POST['user'];
|
||||
$menu->fk_menu=$_POST['fk_menu'];
|
||||
$result=$menu->update($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -275,6 +276,8 @@ if ($action == 'create')
|
||||
print '<form action="./edit.php?action=add&menuId='.$_GET['menuId'].'" method="post" name="formmenucreate">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Id
|
||||
@ -368,8 +371,10 @@ if ($action == 'create')
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
// Boutons
|
||||
print '<br><div class="center">';
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
@ -387,6 +392,8 @@ elseif ($action == 'edit')
|
||||
print '<input type="hidden" name="handler_origine" value="'.$menu_handler.'">';
|
||||
print '<input type="hidden" name="menuId" value="'.$_GET['menuId'].'">';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$menu = new Menubase($db);
|
||||
@ -416,9 +423,9 @@ elseif ($action == 'edit')
|
||||
|
||||
// MenuId Parent
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent').'</td>';
|
||||
print '<td><input type="text" name="fk_menu" value="'.$menu->fk_menu.'" size=10></td>';
|
||||
//$menu_handler
|
||||
//print '<td><input type="text" size="50" name="handler" value="all"></td>';
|
||||
print '<td>'.$menu->fk_menu.'</td>';
|
||||
print '<td>'.$langs->trans('DetailMenuIdParent').'</td></tr>';
|
||||
|
||||
// Niveau
|
||||
@ -454,8 +461,10 @@ elseif ($action == 'edit')
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
// Bouton
|
||||
print '<br><div class="center">';
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
|
||||
@ -63,6 +63,7 @@ if ($action == 'update')
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"],'chaine',0,'',$conf->entity);
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||
exit;
|
||||
@ -94,6 +95,13 @@ $form=new Form($db);
|
||||
$formother=new FormOther($db);
|
||||
$formadmin=new FormAdmin($db);
|
||||
|
||||
$arraydetailsforpdffoot = array(
|
||||
0 => $langs->trans('NoDetails'),
|
||||
1 => $langs->trans('DisplayCompanyInfo'),
|
||||
2 => $langs->trans('DisplayManagersInfo'),
|
||||
3 => $langs->trans('DisplayCompanyInfoAndManagers')
|
||||
);
|
||||
|
||||
print load_fiche_titre($langs->trans("PDF"),'','title_setup');
|
||||
|
||||
print $langs->trans("PDFDesc")."<br>\n";
|
||||
@ -253,7 +261,11 @@ if ($action == 'edit') // Edit
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td>';
|
||||
print $form->selectyesno('MAIN_PDF_USE_ISO_LOCATION',(! empty($conf->global->MAIN_PDF_USE_ISO_LOCATION))?$conf->global->MAIN_PDF_USE_ISO_LOCATION:0,1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td colspan="2">';
|
||||
print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -455,6 +467,11 @@ else // Show
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td colspan="2">';
|
||||
print yn($conf->global->MAIN_PDF_USE_ISO_LOCATION,1);
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td colspan="2">';
|
||||
print $arraydetailsforpdffoot[$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS];
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
@ -119,19 +119,19 @@ function create_script_table($list)
|
||||
global $sortby,$bc,$langs;
|
||||
$var=true;
|
||||
|
||||
if (isset($_GET['order']) && ($_GET['order'] == "asc" || $_GET['order'] =="desc")) {
|
||||
$order = $_GET['order'];
|
||||
if (GETPOT('order') == "asc" || GETPOST('order') =="desc") {
|
||||
$order = GETPOST('order');
|
||||
} else {
|
||||
$order = "asc";
|
||||
}
|
||||
|
||||
if (isset($_GET['sort'])) {
|
||||
switch ($_GET['sort']) {
|
||||
if (GETPOST('order')) {
|
||||
switch (GETPOST('order')) {
|
||||
case "mtime":
|
||||
case "size":
|
||||
case "reloads":
|
||||
case "hits":
|
||||
$sortby = $_GET['sort'];
|
||||
$sortby = GETPOST('sort');
|
||||
($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare'));
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -318,7 +318,7 @@ function backup_tables($outputfile, $tables='*')
|
||||
$columns = count($row);
|
||||
for($j=0; $j<$columns; $j++) {
|
||||
// Processing each columns of the row to ensure that we correctly save the value (eg: add quotes for string - in fact we add quotes for everything, it's easier)
|
||||
if ($row[$j] == null and !is_string($row[$j])) {
|
||||
if ($row[$j] == null && !is_string($row[$j])) {
|
||||
// IMPORTANT: if the field is NULL we set it NULL
|
||||
$row[$j] = 'NULL';
|
||||
} elseif(is_string($row[$j]) && $row[$j] == '') {
|
||||
|
||||
@ -417,14 +417,7 @@ if ($id)
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates' && $action == 'edit')
|
||||
{
|
||||
fieldList($fieldlist,$obj,$tabname[$id],'hide');
|
||||
}
|
||||
else
|
||||
{
|
||||
fieldList($fieldlist,$obj,$tabname[$id],'add');
|
||||
}
|
||||
fieldListWebsites($fieldlist,$obj,$tabname[$id],'add');
|
||||
}
|
||||
|
||||
if ($id == 4) print '<td></td>';
|
||||
@ -487,46 +480,9 @@ if ($id)
|
||||
*/
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); }
|
||||
if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); }
|
||||
if ($fieldlist[$field]=='taux') {
|
||||
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow=$langs->trans("Rate");
|
||||
else $valuetoshow=$langs->trans("Amount");
|
||||
$align='right';
|
||||
}
|
||||
if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$langs->trans("UseLocalTax")." 2"; $align="center"; $sortable=0; }
|
||||
if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2"; $sortable=0; }
|
||||
if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$langs->trans("UseLocalTax")." 3"; $align="center"; $sortable=0; }
|
||||
if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3"; $sortable=0; }
|
||||
if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); }
|
||||
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
|
||||
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
|
||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
|
||||
{
|
||||
$valuetoshow=$langs->trans("Label");
|
||||
if ($id != 25) $valuetoshow.="*";
|
||||
}
|
||||
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; }
|
||||
if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); }
|
||||
if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=$langs->trans("NPR"); $align="center"; }
|
||||
if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); }
|
||||
if ($fieldlist[$field]=='fdm') { $valuetoshow=$langs->trans("AtEndOfMonth"); }
|
||||
if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); }
|
||||
if ($fieldlist[$field]=='width') { $valuetoshow=$langs->trans("Width"); }
|
||||
if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); }
|
||||
if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); }
|
||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
||||
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
|
||||
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); $sortable=0; }
|
||||
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); $sortable=0; }
|
||||
if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
|
||||
if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountsparent"); }
|
||||
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); }
|
||||
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
|
||||
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
|
||||
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
|
||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||
|
||||
// Affiche nom du champ
|
||||
if ($showfield)
|
||||
@ -534,8 +490,6 @@ if ($id)
|
||||
print getTitleFieldOfList($valuetoshow,0,$_SERVER["PHP_SELF"],($sortable?$fieldlist[$field]:''),($page?'page='.$page.'&':'').'&id='.$id,"","align=".$align,$sortfield,$sortorder);
|
||||
}
|
||||
}
|
||||
// Favorite - Only activated on country dictionary
|
||||
if ($id == 4) print getTitleFieldOfList($langs->trans("Favorite"),0,$_SERVER["PHP_SELF"],"favorite",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder);
|
||||
|
||||
print getTitleFieldOfList($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"status",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder);
|
||||
print getTitleFieldOfList('');
|
||||
@ -562,7 +516,7 @@ if ($id)
|
||||
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
|
||||
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit');
|
||||
if (empty($reshook)) fieldListWebsites($fieldlist,$obj,$tabname[$id],'edit');
|
||||
|
||||
print '<td colspan="3" align="right"><a name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"> </a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print ' <input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
|
||||
@ -582,172 +536,6 @@ if ($id)
|
||||
$showfield=1;
|
||||
$align="left";
|
||||
$valuetoshow=$obj->$fieldlist[$field];
|
||||
if ($value == 'type_template')
|
||||
{
|
||||
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
||||
}
|
||||
if ($value == 'element')
|
||||
{
|
||||
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
||||
}
|
||||
else if ($value == 'source')
|
||||
{
|
||||
$valuetoshow = isset($sourceList[$valuetoshow])?$sourceList[$valuetoshow]:$valuetoshow;
|
||||
}
|
||||
else if ($valuetoshow=='all') {
|
||||
$valuetoshow=$langs->trans('All');
|
||||
}
|
||||
else if ($fieldlist[$field]=='country') {
|
||||
if (empty($obj->country_code))
|
||||
{
|
||||
$valuetoshow='-';
|
||||
}
|
||||
else
|
||||
{
|
||||
$key=$langs->trans("Country".strtoupper($obj->country_code));
|
||||
$valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country);
|
||||
}
|
||||
}
|
||||
else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm' || $fieldlist[$field] == 'deductible') {
|
||||
$valuetoshow=yn($valuetoshow);
|
||||
$align="center";
|
||||
}
|
||||
else if ($fieldlist[$field]=='price' || preg_match('/^amount/i',$fieldlist[$field])) {
|
||||
$valuetoshow=price($valuetoshow);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle_facture') {
|
||||
$langs->load("bills");
|
||||
$key=$langs->trans("PaymentCondition".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "PaymentCondition".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
$valuetoshow=nl2br($valuetoshow);
|
||||
}
|
||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') {
|
||||
$key=$langs->trans("Country".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_availability') {
|
||||
$langs->load("propal");
|
||||
$key=$langs->trans("AvailabilityType".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "AvailabilityType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_actioncomm') {
|
||||
$key=$langs->trans("Action".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if (! empty($obj->code_iso) && $fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_currencies') {
|
||||
$key=$langs->trans("Currency".strtoupper($obj->code_iso));
|
||||
$valuetoshow=($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_typent') {
|
||||
$key=$langs->trans(strtoupper($obj->code));
|
||||
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_prospectlevel') {
|
||||
$key=$langs->trans(strtoupper($obj->code));
|
||||
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_civility') {
|
||||
$key=$langs->trans("Civility".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_type_contact') {
|
||||
$langs->load('agenda');
|
||||
$key=$langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_payment_term') {
|
||||
$langs->load("bills");
|
||||
$key=$langs->trans("PaymentConditionShort".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paiement') {
|
||||
$langs->load("bills");
|
||||
$key=$langs->trans("PaymentType".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_reason') {
|
||||
$key=$langs->trans("DemandReasonType".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_method') {
|
||||
$langs->load("orders");
|
||||
$key=$langs->trans($obj->code);
|
||||
$valuetoshow=($obj->code && $key != $obj->code)?$key:$obj->$fieldlist[$field];
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_shipment_mode') {
|
||||
$langs->load("sendings");
|
||||
$key=$langs->trans("SendingMethod".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "SendingMethod".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field] == 'libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paper_format')
|
||||
{
|
||||
$key = $langs->trans('PaperFormat'.strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees')
|
||||
{
|
||||
$langs->load('trips');
|
||||
$key = $langs->trans(strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') {
|
||||
$showfield=0;
|
||||
}
|
||||
else if ($fieldlist[$field]=='unicode') {
|
||||
$valuetoshow = $langs->getCurrencySymbol($obj->code,1);
|
||||
}
|
||||
else if ($fieldlist[$field]=='label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') {
|
||||
$langs->load("products");
|
||||
$valuetoshow=$langs->trans($obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='short_label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') {
|
||||
$langs->load("products");
|
||||
$valuetoshow = $langs->trans($obj->$fieldlist[$field]);
|
||||
}
|
||||
else if (($fieldlist[$field] == 'unit') && ($tabname[$id] == MAIN_DB_PREFIX.'c_paper_format'))
|
||||
{
|
||||
$key = $langs->trans('SizeUnit'.strtolower($obj->unit));
|
||||
$valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->$fieldlist[$field]);
|
||||
}
|
||||
|
||||
else if ($fieldlist[$field]=='localtax1_type') {
|
||||
if ($obj->localtax1 != 0)
|
||||
$valuetoshow=$localtax_typeList[$valuetoshow];
|
||||
else
|
||||
$valuetoshow = '';
|
||||
$align="center";
|
||||
}
|
||||
else if ($fieldlist[$field]=='localtax2_type') {
|
||||
if ($obj->localtax2 != 0)
|
||||
$valuetoshow=$localtax_typeList[$valuetoshow];
|
||||
else
|
||||
$valuetoshow = '';
|
||||
$align="center";
|
||||
}
|
||||
else if ($fieldlist[$field]=='localtax1') {
|
||||
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
|
||||
if ($obj->localtax1 == 0)
|
||||
$valuetoshow = '';
|
||||
$align="right";
|
||||
}
|
||||
else if ($fieldlist[$field]=='localtax2') {
|
||||
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
|
||||
if ($obj->localtax2 == 0)
|
||||
$valuetoshow = '';
|
||||
$align="right";
|
||||
}
|
||||
else if (in_array($fieldlist[$field],array('taux','localtax1','localtax2')))
|
||||
{
|
||||
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
|
||||
$align="right";
|
||||
}
|
||||
else if (in_array($fieldlist[$field],array('recuperableonly')))
|
||||
{
|
||||
$align="center";
|
||||
}
|
||||
else if ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') {
|
||||
$valuetoshow = length_accountg($valuetoshow);
|
||||
}
|
||||
|
||||
// Show value for field
|
||||
if ($showfield) print '<td align="'.$align.'">'.$valuetoshow.'</td>';
|
||||
@ -757,16 +545,6 @@ if ($id)
|
||||
// Can an entry be erased or disabled ?
|
||||
$iserasable=1;$isdisable=1; // true by default
|
||||
|
||||
if (isset($obj->code) && $id != 10)
|
||||
{
|
||||
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $isdisable = 0; }
|
||||
else if ($obj->code == 'RECEP') { $iserasable = 0; $isdisable = 0; }
|
||||
else if ($obj->code == 'EF0') { $iserasable = 0; $isdisable = 0; }
|
||||
}
|
||||
|
||||
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) { $iserasable=0; }
|
||||
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $isdisable=0; $isdisable = 0; }
|
||||
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'').'&id='.$id.'&';
|
||||
|
||||
// Favorite
|
||||
@ -823,7 +601,7 @@ $db->close();
|
||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||
* @return void
|
||||
*/
|
||||
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
function fieldListWebsites($fieldlist, $obj='', $tabname='', $context='')
|
||||
{
|
||||
global $conf,$langs,$db;
|
||||
global $form;
|
||||
|
||||
@ -150,12 +150,30 @@ $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToM
|
||||
print load_fiche_titre($langs->trans("ApiSetup"),$linkback,'title_setup');
|
||||
|
||||
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
// Show message
|
||||
print '<br>';
|
||||
$message='';
|
||||
$url='<a href="'.$urlwithroot.'/api/index.php/login?login='.urlencode($user->login).'&password=yourpassword" target="_blank">'.$urlwithroot.'/api/index.php/login?login='.urlencode($user->login).'&password=yourpassword</a>';
|
||||
$message.=$langs->trans("UrlToGetKeyToUseAPIs").':<br>';
|
||||
$message.=img_picto('','object_globe.png').' '.$url;
|
||||
print $message;
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
print $langs->trans("ListOfAvailableAPIs").':<br>';
|
||||
foreach($listofapis['v1'] as $key => $val)
|
||||
{
|
||||
if ($key == 'login') continue;
|
||||
if ($key)
|
||||
{
|
||||
//print $key.' - '.$val['classname'].' - '.$val['fullpath']." - ".DOL_MAIN_URL_ROOT.'/api/index.php/'.strtolower(preg_replace('/Api$/','',$val['classname']))."/xxx<br>\n";
|
||||
$url=DOL_MAIN_URL_ROOT.'/api/index.php/'.$key;
|
||||
$url=$urlwithroot.'/api/index.php/'.$key;
|
||||
$url.='?api_key=token';
|
||||
print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
|
||||
|
||||
}
|
||||
|
||||
@ -167,6 +167,8 @@ class DolibarrApiInit extends DolibarrApi
|
||||
*/
|
||||
public function login($login, $password, $entity = 0) {
|
||||
|
||||
global $conf, $dolibarr_main_authentication, $dolibarr_auto_user;
|
||||
|
||||
// Authentication mode
|
||||
if (empty($dolibarr_main_authentication))
|
||||
$dolibarr_main_authentication = 'http,dolibarr';
|
||||
|
||||
@ -70,6 +70,7 @@ class DolibarrApiAccess implements iAuthenticate
|
||||
{
|
||||
global $db;
|
||||
|
||||
$login = '';
|
||||
$stored_key = '';
|
||||
|
||||
$userClass = Defaults::$userIdentifierClass;
|
||||
@ -95,11 +96,15 @@ class DolibarrApiAccess implements iAuthenticate
|
||||
throw new RestException(503, 'Error when fetching user api_key :'.$db->error_msg);
|
||||
}
|
||||
|
||||
if ( $stored_key != $_GET['api_key']) {
|
||||
if ($stored_key != $_GET['api_key']) {
|
||||
$userClass::setCacheIdentifier($_GET['api_key']);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! $login)
|
||||
{
|
||||
throw new RestException(503, 'Error when searching logn user fro mapi key');
|
||||
}
|
||||
$fuser = new User($db);
|
||||
if(! $fuser->fetch('',$login)) {
|
||||
throw new RestException(503, 'Error when fetching user :'.$fuser->error);
|
||||
@ -116,16 +121,13 @@ class DolibarrApiAccess implements iAuthenticate
|
||||
else
|
||||
{
|
||||
throw new RestException(401, "Failed to login to API. No parameter 'api_key' provided");
|
||||
//dol_syslog("Failed to login to API. No parameter key provided", LOG_DEBUG);
|
||||
//return false;
|
||||
}
|
||||
|
||||
$userClass::setCacheIdentifier(static::$role);
|
||||
Resources::$accessControlFunction = 'DolibarrApiAccess::verifyAccess';
|
||||
|
||||
$requirefortest = static::$requires;
|
||||
if (! is_array($requirefortest)) $requirefortest=explode(',',$requirefortest);
|
||||
return in_array(static::$role, (array) static::$requirefortest) || static::$role == 'admin';
|
||||
$userClass::setCacheIdentifier(static::$role);
|
||||
Resources::$accessControlFunction = 'DolibarrApiAccess::verifyAccess';
|
||||
$requirefortest = static::$requires;
|
||||
if (! is_array($requirefortest)) $requirefortest=explode(',',$requirefortest);
|
||||
return in_array(static::$role, (array) $requirefortest) || static::$role == 'admin';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -141,6 +141,8 @@ foreach ($modulesdir as $dir)
|
||||
|
||||
// TODO If not found, redirect to explorer
|
||||
|
||||
|
||||
// Call API (we suppose we found it)
|
||||
$api->r->handle();
|
||||
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ top_htmlhead('','',0,0,'',$arrayofcss);
|
||||
<div class="conteneur_img_droite">
|
||||
|
||||
<div class="menu_principal hideonsmartphone">
|
||||
<div class="logo"><?php print '<img class="logopos" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode('/thumbs/'.$mysoc->logo_small).'">'; ?></div>
|
||||
<div class="logo"><?php print '<img class="logopos" alt="Logo company" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode('/thumbs/'.$mysoc->logo_small).'">'; ?></div>
|
||||
</div>
|
||||
|
||||
<div class="contenu">
|
||||
|
||||
@ -45,6 +45,7 @@ class CategoryApi extends DolibarrApi
|
||||
2 => 'customer',
|
||||
3 => 'member',
|
||||
4 => 'contact',
|
||||
5 => 'account',
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.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
|
||||
@ -49,6 +49,8 @@ class Categorie extends CommonObject
|
||||
const TYPE_MEMBER = 3;
|
||||
const TYPE_CONTACT = 4;
|
||||
const TYPE_USER = 4; // categorie contact and user are same
|
||||
// bank account
|
||||
const TYPE_ACCOUNT = 5;
|
||||
|
||||
/**
|
||||
* @var array ID mapping from type string
|
||||
@ -62,6 +64,7 @@ class Categorie extends CommonObject
|
||||
'member' => 3,
|
||||
'contact' => 4,
|
||||
'user' => 4,
|
||||
'account' => 5,
|
||||
);
|
||||
/**
|
||||
* @var array Foreign keys mapping from type string
|
||||
@ -75,6 +78,7 @@ class Categorie extends CommonObject
|
||||
'member' => 'member',
|
||||
'contact' => 'socpeople',
|
||||
'user' => 'user',
|
||||
'account' => 'account',
|
||||
);
|
||||
/**
|
||||
* @var array Category tables mapping from type string
|
||||
@ -88,6 +92,7 @@ class Categorie extends CommonObject
|
||||
'member' => 'member',
|
||||
'contact' => 'contact',
|
||||
'user' => 'user',
|
||||
'account' => 'account',
|
||||
);
|
||||
/**
|
||||
* @var array Object class mapping from type string
|
||||
@ -101,6 +106,7 @@ class Categorie extends CommonObject
|
||||
'member' => 'Adherent',
|
||||
'contact' => 'Contact',
|
||||
'user' => 'User',
|
||||
'account' => 'Account',
|
||||
);
|
||||
/**
|
||||
* @var array Object table mapping from type string
|
||||
@ -114,6 +120,7 @@ class Categorie extends CommonObject
|
||||
'member' => 'adherent',
|
||||
'contact' => 'socpeople',
|
||||
'user' => 'user',
|
||||
'account' => 'bank_account',
|
||||
);
|
||||
|
||||
public $element='category';
|
||||
@ -138,6 +145,8 @@ class Categorie extends CommonObject
|
||||
* @see Categorie::TYPE_CUSTOMER
|
||||
* @see Categorie::TYPE_MEMBER
|
||||
* @see Categorie::TYPE_CONTACT
|
||||
* @see Categorie::TYPE_USER
|
||||
* @see Categorie::TYPE_ACCOUNT
|
||||
*/
|
||||
var $type;
|
||||
|
||||
|
||||
@ -53,6 +53,7 @@ elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCateg
|
||||
elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoriesArea");
|
||||
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoriesArea");
|
||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactsCategoriesArea");
|
||||
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesArea");
|
||||
else $title=$langs->trans("CategoriesArea");
|
||||
|
||||
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
|
||||
|
||||
@ -93,12 +93,13 @@ $form = new Form($db);
|
||||
|
||||
if ($object->id)
|
||||
{
|
||||
$title=$langs->trans("ProductsCategoryShort");
|
||||
if ($type == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductsCategoryShort");
|
||||
elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCategoryShort");
|
||||
elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort");
|
||||
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
|
||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||
else $title=$langs->trans("Category");
|
||||
|
||||
$head = categories_prepare_head($object,$type);
|
||||
dol_fiche_head($head, 'photos', $title, 0, 'category');
|
||||
|
||||
@ -149,6 +149,7 @@ elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCateg
|
||||
elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort");
|
||||
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
|
||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||
else $title=$langs->trans("Category");
|
||||
|
||||
$head = categories_prepare_head($object,$type);
|
||||
|
||||
@ -107,7 +107,14 @@ if ($id > 0 && $removeelem > 0)
|
||||
$tmpobject = new Contact($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
$elementtype = 'contact';
|
||||
}
|
||||
}
|
||||
else if ($type == Categorie::TYPE_ACCOUNT && $user->rights->banque->configurer)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
$tmpobject = new Account($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
$elementtype = 'account';
|
||||
}
|
||||
|
||||
$result=$object->del_type($tmpobject,$elementtype);
|
||||
if ($result < 0) dol_print_error('',$object->error);
|
||||
@ -169,6 +176,7 @@ elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCateg
|
||||
elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort");
|
||||
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
|
||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||
else $title=$langs->trans("Category");
|
||||
|
||||
$head = categories_prepare_head($object,$type);
|
||||
@ -580,6 +588,59 @@ if($object->type == Categorie::TYPE_CONTACT)
|
||||
}
|
||||
}
|
||||
|
||||
// List of accounts
|
||||
if ($object->type == Categorie::TYPE_ACCOUNT)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
$accounts = $object->getObjectsInCateg("account");
|
||||
if ($accounts < 0)
|
||||
{
|
||||
dol_print_error($db, $accounts->error, $accounts->errors);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<br>";
|
||||
print "<table class='noborder' width='100%'>\n";
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Account")."</td></tr>\n";
|
||||
|
||||
if (count($accounts) > 0)
|
||||
{
|
||||
$var=true;
|
||||
foreach ($accounts as $key => $account)
|
||||
{
|
||||
$var=!$var;
|
||||
print "\t<tr ".$bc[$var].">\n";
|
||||
print '<td class="nowrap" valign="top">';
|
||||
print $account->getNomUrl(1,0);
|
||||
print "</td>\n";
|
||||
print '<td valign="top">'.$account->bank."</td>\n";
|
||||
print '<td valign="top">'.$account->number."</td>\n";
|
||||
// Link to delete from category
|
||||
print '<td align="right">';
|
||||
$typeid=$object->type;
|
||||
$permission=0;
|
||||
if ($typeid == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer);
|
||||
if ($typeid == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer;
|
||||
if ($typeid == Categorie::TYPE_ACCOUNT) $permission=$user->rights->banque->configurer;
|
||||
if ($permission)
|
||||
{
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&type=".$typeid."&removeelem=".$account->id."'>";
|
||||
print img_delete($langs->trans("DeleteFromCat")).' ';
|
||||
print $langs->trans("DeleteFromCat")."</a>";
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr ".$bc[false].'><td colspan="3">'.$langs->trans("ThisCategoryHasNoAccount")."</td></tr>";
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
|
||||
@ -1173,7 +1173,7 @@ if ($id > 0)
|
||||
// Clone event
|
||||
if($action == 'clone')
|
||||
{
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . GETPOST('id'), $langs->trans('CloneAction'), $langs->trans('ConfirmCloneAction', $object->label), 'confirm_clone', $formquestion, 'yes', 1);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . GETPOST('id'), $langs->trans('CloneAction'), $langs->trans('ConfirmCloneEvent', $object->label), 'confirm_clone', $formquestion, 'yes', 1);
|
||||
|
||||
print $formconfirm;
|
||||
}
|
||||
|
||||
@ -308,8 +308,8 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ActionsOwnedByShort"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("");
|
||||
print "</tr>\n";
|
||||
|
||||
@ -432,7 +432,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
|
||||
// Status/Percent
|
||||
print '<td align="right" class="nowrap">'.$actionstatic->LibStatut($obj->percent,6).'</td>';
|
||||
print '<td align="center" class="nowrap">'.$actionstatic->LibStatut($obj->percent,6).'</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
|
||||
@ -961,82 +961,84 @@ if ($id > 0)
|
||||
* Barre d'actions
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if (! empty($conf->propal->enabled) && $user->rights->propal->creer && $object->status==1)
|
||||
{
|
||||
$langs->load("propal");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddProp").'</a></div>';
|
||||
}
|
||||
|
||||
if (! empty($conf->commande->enabled) && $user->rights->commande->creer && $object->status==1)
|
||||
{
|
||||
$langs->load("orders");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddOrder").'</a></div>';
|
||||
}
|
||||
|
||||
if ($user->rights->contrat->creer && $object->status==1)
|
||||
{
|
||||
$langs->load("contracts");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddContract").'</a></div>';
|
||||
}
|
||||
|
||||
if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer && $object->status==1)
|
||||
{
|
||||
$langs->load("fichinter");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddIntervention").'</a></div>';
|
||||
}
|
||||
|
||||
// Add invoice
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
if (! empty($conf->deplacement->enabled) && $object->status==1)
|
||||
{
|
||||
$langs->load("trips");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/deplacement/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddTrip").'</a></div>';
|
||||
}
|
||||
|
||||
if (! empty($conf->facture->enabled))
|
||||
{
|
||||
if ($user->rights->facture->creer && $object->status==1)
|
||||
{
|
||||
$langs->load("bills");
|
||||
$langs->load("orders");
|
||||
|
||||
if (! empty($conf->commande->enabled))
|
||||
{
|
||||
if (! empty($orders2invoice) && $orders2invoice > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$object->id.'">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
}
|
||||
|
||||
if ($object->client != 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add action
|
||||
if (! empty($conf->agenda->enabled) && ! empty($conf->global->MAIN_REPEATTASKONEACHTAB))
|
||||
{
|
||||
if ($user->rights->agenda->myactions->create)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddAction").'</a></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddAction").'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (! empty($conf->propal->enabled) && $user->rights->propal->creer && $object->status==1)
|
||||
{
|
||||
$langs->load("propal");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddProp").'</a></div>';
|
||||
}
|
||||
|
||||
if (! empty($conf->commande->enabled) && $user->rights->commande->creer && $object->status==1)
|
||||
{
|
||||
$langs->load("orders");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddOrder").'</a></div>';
|
||||
}
|
||||
|
||||
if ($user->rights->contrat->creer && $object->status==1)
|
||||
{
|
||||
$langs->load("contracts");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddContract").'</a></div>';
|
||||
}
|
||||
|
||||
if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer && $object->status==1)
|
||||
{
|
||||
$langs->load("fichinter");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddIntervention").'</a></div>';
|
||||
}
|
||||
|
||||
// Add invoice
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
if (! empty($conf->deplacement->enabled) && $object->status==1)
|
||||
{
|
||||
$langs->load("trips");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/deplacement/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddTrip").'</a></div>';
|
||||
}
|
||||
|
||||
if (! empty($conf->facture->enabled))
|
||||
{
|
||||
if ($user->rights->facture->creer && $object->status==1)
|
||||
{
|
||||
$langs->load("bills");
|
||||
$langs->load("orders");
|
||||
|
||||
if (! empty($conf->commande->enabled))
|
||||
{
|
||||
if (! empty($orders2invoice) && $orders2invoice > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$object->id.'">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
}
|
||||
|
||||
if ($object->client != 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add action
|
||||
if (! empty($conf->agenda->enabled) && ! empty($conf->global->MAIN_REPEATTASKONEACHTAB))
|
||||
{
|
||||
if ($user->rights->agenda->myactions->create)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddAction").'</a></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddAction").'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB))
|
||||
|
||||
@ -87,6 +87,11 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
{
|
||||
$listofsearchfields['search_customer_order']=array('text'=>'CustomerOrder');
|
||||
}
|
||||
// Search supplier proposal
|
||||
if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
|
||||
{
|
||||
$listofsearchfields['search_supplier_proposal']=array('text'=>'SupplierProposalShort');
|
||||
}
|
||||
// Search supplier order
|
||||
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire)
|
||||
{
|
||||
@ -100,12 +105,7 @@ if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire)
|
||||
// Search contract
|
||||
if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
|
||||
{
|
||||
$listofsearchfields['search_contract']=array('text'=>'Contrat');
|
||||
}
|
||||
// Search supplier proposal
|
||||
if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
|
||||
{
|
||||
$listofsearchfields['search_supplier_proposal']=array('text'=>'SupplierProposalShort');
|
||||
$listofsearchfields['search_contract']=array('text'=>'Contract');
|
||||
}
|
||||
|
||||
if (count($listofsearchfields))
|
||||
@ -197,7 +197,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
||||
else
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoProposal").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="3">'.$langs->trans("NoProposal").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
|
||||
@ -277,7 +277,7 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos
|
||||
else
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoProposal").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="3">'.$langs->trans("NoProposal").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
|
||||
@ -357,7 +357,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
else
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoOrder").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="3">'.$langs->trans("NoOrder").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
|
||||
@ -438,7 +438,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande
|
||||
else
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoSupplierOrder").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="3">'.$langs->trans("NoSupplierOrder").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
|
||||
|
||||
979
htdocs/comm/mailing/advtargetemailing.php
Normal file
979
htdocs/comm/mailing/advtargetemailing.php
Normal file
@ -0,0 +1,979 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@uers.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/comm/mailing/advtargetemailing.php
|
||||
* \ingroup mailing
|
||||
* \brief Page to define emailing targets
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/comm/mailing/class/mailing.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/emailing.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/comm/mailing/class/advtargetemailing.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/comm/mailing/class/html.formadvtargetemailing.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/modules/mailings/advthirdparties.modules.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
|
||||
// Translations
|
||||
$langs->load("mails");
|
||||
$langs->load("companies");
|
||||
if (! empty($conf->categorie->enabled)) {
|
||||
$langs->load("categories");
|
||||
}
|
||||
|
||||
// Security check
|
||||
if (! $user->rights->mailing->lire || $user->societe_id > 0)
|
||||
accessforbidden();
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
if ($page == - 1) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder)
|
||||
$sortorder = "ASC";
|
||||
if (! $sortfield)
|
||||
$sortfield = "email";
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$action = GETPOST("action");
|
||||
$search_nom = GETPOST("search_nom");
|
||||
$search_prenom = GETPOST("search_prenom");
|
||||
$search_email = GETPOST("search_email");
|
||||
$template_id = GETPOST('template_id', 'int');
|
||||
|
||||
// Do we click on purge search criteria ?
|
||||
if (GETPOST("button_removefilter_x")) {
|
||||
$search_nom = '';
|
||||
$search_prenom = '';
|
||||
$search_email = '';
|
||||
}
|
||||
|
||||
$array_query = array ();
|
||||
|
||||
$object = new Mailing($db);
|
||||
$advTarget = new AdvanceTargetingMailing($db);
|
||||
if (empty($template_id)) {
|
||||
$advTarget->fk_mailing = $id;
|
||||
$result = $advTarget->fetch_by_mailing();
|
||||
} else {
|
||||
$result = $advTarget->fetch($template_id);
|
||||
}
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessage($advTarget->error, 'errors');
|
||||
} else {
|
||||
if (! empty($advTarget->id)) {
|
||||
$array_query = json_decode($advTarget->filtervalue, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'loadfilter') {
|
||||
if (! empty($template_id)) {
|
||||
$result = $advTarget->fetch($template_id);
|
||||
if ($result < 0) {
|
||||
setEventMessage($advTarget->error, 'errors');
|
||||
} else {
|
||||
if (! empty($advTarget->id)) {
|
||||
$array_query = json_decode($advTarget->filtervalue, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'add') {
|
||||
|
||||
$user_contact_query = false;
|
||||
|
||||
$array_query = array ();
|
||||
|
||||
// Get extra fields
|
||||
|
||||
foreach ( $_POST as $key => $value ) {
|
||||
// print '$key='.$key.' $value='.$value.'<BR>';
|
||||
if (preg_match("/^options_.*(?<!_cnct)$/", $key)) {
|
||||
// Special case for start date come with 3 inputs day, month, year
|
||||
if (preg_match("/st_dt/", $key)) {
|
||||
$dtarr = array ();
|
||||
$dtarr = explode('_', $key);
|
||||
if (! array_key_exists('options_' . $dtarr[1] . '_st_dt', $array_query)) {
|
||||
$array_query['options_' . $dtarr[1] . '_st_dt'] = dol_mktime(0, 0, 0, GETPOST('options_' . $dtarr[1] . '_st_dtmonth', 'int'), GETPOST('options_' . $dtarr[1] . '_st_dtday', 'int'), GETPOST('options_' . $dtarr[1] . '_st_dtyear', 'int'));
|
||||
}
|
||||
} elseif (preg_match("/end_dt/", $key)) {
|
||||
// Special case for end date come with 3 inputs day, month, year
|
||||
$dtarr = array ();
|
||||
$dtarr = explode('_', $key);
|
||||
if (! array_key_exists('options_' . $dtarr[1] . '_end_dt', $array_query)) {
|
||||
$array_query['options_' . $dtarr[1] . '_end_dt'] = dol_mktime(0, 0, 0, GETPOST('options_' . $dtarr[1] . '_end_dtmonth', 'int'), GETPOST('options_' . $dtarr[1] . '_end_dtday', 'int'), GETPOST('options_' . $dtarr[1] . '_end_dtyear', 'int'));
|
||||
}
|
||||
} else {
|
||||
$array_query[$key] = GETPOST($key);
|
||||
}
|
||||
}
|
||||
if (preg_match("/^options_.*_cnct/", $key)) {
|
||||
$user_contact_query = true;
|
||||
// Special case for start date come with 3 inputs day, month, year
|
||||
if (preg_match("/st_dt/", $key)) {
|
||||
$dtarr = array ();
|
||||
$dtarr = explode('_', $key);
|
||||
if (! array_key_exists('options_' . $dtarr[1] . '_st_dt' . '_cnct', $array_query)) {
|
||||
$array_query['options_' . $dtarr[1] . '_st_dt' . '_cnct'] = dol_mktime(0, 0, 0, GETPOST('options_' . $dtarr[1] . '_st_dtmonth' . '_cnct', 'int'), GETPOST('options_' . $dtarr[1] . '_st_dtday' . '_cnct', 'int'), GETPOST('options_' . $dtarr[1] . '_st_dtyear' . '_cnct', 'int'));
|
||||
}
|
||||
} elseif (preg_match("/end_dt/", $key)) {
|
||||
// Special case for end date come with 3 inputs day, month, year
|
||||
$dtarr = array ();
|
||||
$dtarr = explode('_', $key);
|
||||
if (! array_key_exists('options_' . $dtarr[1] . '_end_dt' . '_cnct', $array_query)) {
|
||||
$array_query['options_' . $dtarr[1] . '_end_dt' . '_cnct'] = dol_mktime(0, 0, 0, GETPOST('options_' . $dtarr[1] . '_end_dtmonth' . '_cnct', 'int'), GETPOST('options_' . $dtarr[1] . '_end_dtday' . '_cnct', 'int'), GETPOST('options_' . $dtarr[1] . '_end_dtyear' . '_cnct', 'int'));
|
||||
}
|
||||
} else {
|
||||
$array_query[$key] = GETPOST($key);
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match("/^cust_/", $key)) {
|
||||
$array_query[$key] = GETPOST($key);
|
||||
}
|
||||
|
||||
if (preg_match("/^contact_/", $key)) {
|
||||
|
||||
$array_query[$key] = GETPOST($key);
|
||||
|
||||
$specials_date_key = array (
|
||||
'contact_update_st_dt',
|
||||
'contact_update_end_dt',
|
||||
'contact_create_st_dt',
|
||||
'contact_create_end_dt'
|
||||
);
|
||||
foreach ( $specials_date_key as $date_key ) {
|
||||
if ($key == $date_key) {
|
||||
$dt = GETPOST($date_key);
|
||||
if (! empty($dt)) {
|
||||
$array_query[$key] = dol_mktime(0, 0, 0, GETPOST($date_key . 'month', 'int'), GETPOST($date_key . 'day', 'int'), GETPOST($date_key . 'year', 'int'));
|
||||
} else {
|
||||
$array_query[$key] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($array_query[$key])) {
|
||||
$user_contact_query = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match("/^type_of_target/", $key)) {
|
||||
$array_query[$key] = GETPOST($key);
|
||||
}
|
||||
}
|
||||
|
||||
// if ($array_query ['type_of_target'] == 1 || $array_query ['type_of_target'] == 3) {
|
||||
$result = $advTarget->query_thirdparty($array_query);
|
||||
if ($result < 0) {
|
||||
setEventMessage($advTarget->error, 'errors');
|
||||
}
|
||||
/*} else {
|
||||
$advTarget->thirdparty_lines = array ();
|
||||
}*/
|
||||
|
||||
if ($user_contact_query && ($array_query['type_of_target'] == 1 || $array_query['type_of_target'] == 2)) {
|
||||
$result = $advTarget->query_contact($array_query);
|
||||
if ($result < 0) {
|
||||
setEventMessage($advTarget->error, 'errors');
|
||||
}
|
||||
// If use contact but no result use artefact to so not use socid into add_to_target
|
||||
if (count($advTarget->contact_lines) == 0) {
|
||||
$advTarget->contact_lines = array (
|
||||
0
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$advTarget->contact_lines = array ();
|
||||
}
|
||||
|
||||
if ((count($advTarget->thirdparty_lines) > 0) || (count($advTarget->contact_lines) > 0)) {
|
||||
// Add targets into database
|
||||
$obj = new mailing_advthirdparties($db);
|
||||
$result = $obj->add_to_target($id, $advTarget->thirdparty_lines, $array_query['type_of_target'], $advTarget->contact_lines);
|
||||
} else {
|
||||
$result = 0;
|
||||
}
|
||||
|
||||
if ($result > 0) {
|
||||
$query_temlate_id = '';
|
||||
if (! empty($template_id)) {
|
||||
$query_temlate_id = '&template_id=' . $template_id;
|
||||
}
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id . $query_temlate_id);
|
||||
exit();
|
||||
}
|
||||
if ($result == 0) {
|
||||
setEventMessage($langs->trans("WarningNoEMailsAdded"), 'warnings');
|
||||
}
|
||||
if ($result < 0) {
|
||||
setEventMessage($obj->error, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'clear') {
|
||||
// Chargement de la classe
|
||||
$classname = "MailingTargets";
|
||||
$obj = new $classname($db);
|
||||
$obj->clear_target($id);
|
||||
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id);
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($action == 'savefilter' || $action == 'createfilter') {
|
||||
|
||||
$template_name = GETPOST('template_name');
|
||||
$error = 0;
|
||||
|
||||
if ($action == 'createfilter' && empty($template_name)) {
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->trans('AdvTgtOrCreateNewFilter')), 'errors');
|
||||
$error ++;
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
|
||||
$array_query = array ();
|
||||
|
||||
// Get extra fields
|
||||
foreach ( $_POST as $key => $value ) {
|
||||
if (preg_match("/^options_.*(?<!_cnct)$/", $key)) {
|
||||
// Special case for start date come with 3 inputs day, month, year
|
||||
if (preg_match("/st_dt/", $key)) {
|
||||
$dtarr = array ();
|
||||
$dtarr = explode('_', $key);
|
||||
if (! array_key_exists('options_' . $dtarr[1] . '_st_dt', $array_query)) {
|
||||
$array_query['options_' . $dtarr[1] . '_st_dt'] = dol_mktime(0, 0, 0, GETPOST('options_' . $dtarr[1] . '_st_dtmonth', 'int'), GETPOST('options_' . $dtarr[1] . '_st_dtday', 'int'), GETPOST('options_' . $dtarr[1] . '_st_dtyear', 'int'));
|
||||
}
|
||||
} elseif (preg_match("/end_dt/", $key)) {
|
||||
// Special case for end date come with 3 inputs day, month, year
|
||||
$dtarr = array ();
|
||||
$dtarr = explode('_', $key);
|
||||
if (! array_key_exists('options_' . $dtarr[1] . '_end_dt', $array_query)) {
|
||||
$array_query['options_' . $dtarr[1] . '_end_dt'] = dol_mktime(0, 0, 0, GETPOST('options_' . $dtarr[1] . '_end_dtmonth', 'int'), GETPOST('options_' . $dtarr[1] . '_end_dtday', 'int'), GETPOST('options_' . $dtarr[1] . '_end_dtyear', 'int'));
|
||||
// print $array_query['options_'.$dtarr[1].'_end_dt'];
|
||||
// 01/02/1013=1361228400
|
||||
}
|
||||
} else {
|
||||
$array_query[$key] = GETPOST($key);
|
||||
}
|
||||
}
|
||||
if (preg_match("/^options_.*_cnct/", $key)) {
|
||||
// Special case for start date come with 3 inputs day, month, year
|
||||
if (preg_match("/st_dt/", $key)) {
|
||||
$dtarr = array ();
|
||||
$dtarr = explode('_', $key);
|
||||
if (! array_key_exists('options_' . $dtarr[1] . '_st_dt' . '_cnct', $array_query)) {
|
||||
$array_query['options_' . $dtarr[1] . '_st_dt' . '_cnct'] = dol_mktime(0, 0, 0, GETPOST('options_' . $dtarr[1] . '_st_dtmonth' . '_cnct', 'int'), GETPOST('options_' . $dtarr[1] . '_st_dtday' . '_cnct', 'int'), GETPOST('options_' . $dtarr[1] . '_st_dtyear' . '_cnct', 'int'));
|
||||
}
|
||||
} elseif (preg_match("/end_dt/", $key)) {
|
||||
// Special case for end date come with 3 inputs day, month, year
|
||||
$dtarr = array ();
|
||||
$dtarr = explode('_', $key);
|
||||
if (! array_key_exists('options_' . $dtarr[1] . '_end_dt' . '_cnct', $array_query)) {
|
||||
$array_query['options_' . $dtarr[1] . '_end_dt' . '_cnct'] = dol_mktime(0, 0, 0, GETPOST('options_' . $dtarr[1] . '_end_dtmonth' . '_cnct', 'int'), GETPOST('options_' . $dtarr[1] . '_end_dtday' . '_cnct', 'int'), GETPOST('options_' . $dtarr[1] . '_end_dtyear' . '_cnct', 'int'));
|
||||
// print $array_query['cnct_options_'.$dtarr[1].'_end_dt'];
|
||||
// 01/02/1013=1361228400
|
||||
}
|
||||
} else {
|
||||
$array_query[$key] = GETPOST($key);
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match("/^cust_/", $key)) {
|
||||
$array_query[$key] = GETPOST($key);
|
||||
}
|
||||
|
||||
if (preg_match("/^contact_/", $key)) {
|
||||
|
||||
$array_query[$key] = GETPOST($key);
|
||||
|
||||
$specials_date_key = array (
|
||||
'contact_update_st_dt',
|
||||
'contact_update_end_dt',
|
||||
'contact_create_st_dt',
|
||||
'contact_create_end_dt'
|
||||
);
|
||||
foreach ( $specials_date_key as $date_key ) {
|
||||
if ($key == $date_key) {
|
||||
$dt = GETPOST($date_key);
|
||||
if (! empty($dt)) {
|
||||
$array_query[$key] = dol_mktime(0, 0, 0, GETPOST($date_key . 'month', 'int'), GETPOST($date_key . 'day', 'int'), GETPOST($date_key . 'year', 'int'));
|
||||
} else {
|
||||
$array_query[$key] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match("/^type_of_target/", $key)) {
|
||||
$array_query[$key] = GETPOST($key);
|
||||
}
|
||||
}
|
||||
$advTarget->filtervalue = json_encode($array_query);
|
||||
|
||||
if ($action == 'createfilter') {
|
||||
$advTarget->name = $template_name;
|
||||
$result = $advTarget->create($user);
|
||||
if ($result < 0) {
|
||||
setEventMessage($advTarget->error, 'errors');
|
||||
}
|
||||
} elseif ($action == 'savefilter') {
|
||||
$result = $advTarget->update($user);
|
||||
if ($result < 0) {
|
||||
setEventMessage($advTarget->error, 'errors');
|
||||
}
|
||||
}
|
||||
$template_id = $advTarget->id;
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'deletefilter') {
|
||||
$result = $advTarget->delete($user);
|
||||
if ($result < 0) {
|
||||
setEventMessage($advTarget->error, 'errors');
|
||||
}
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id);
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($action == 'delete') {
|
||||
// Ici, rowid indique le destinataire et id le mailing
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "mailing_cibles WHERE rowid=" . $rowid;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
if (! empty($id)) {
|
||||
$classname = "MailingTargets";
|
||||
$obj = new $classname($db);
|
||||
$obj->update_nb($id);
|
||||
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id);
|
||||
exit();
|
||||
} else {
|
||||
header("Location: liste.php");
|
||||
exit();
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST["button_removefilter"]) {
|
||||
$search_nom = '';
|
||||
$search_prenom = '';
|
||||
$search_email = '';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$extrajs = array (
|
||||
'/includes/jquery/plugins/multiselect/js/ui.multiselect.js'
|
||||
);
|
||||
$extracss = array (
|
||||
'/includes/jquery/plugins/multiselect/css/ui.multiselect.css',
|
||||
);
|
||||
|
||||
llxHeader('', $langs->trans("MailAdvTargetRecipients"), '', '', '', '', $extrajs, $extracss);
|
||||
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
$(document).ready(function() {
|
||||
|
||||
// Click Function
|
||||
$(":button[name=addcontact]").click(function() {
|
||||
$(":hidden[name=action]").val("add");
|
||||
$("#find_customer").submit();
|
||||
});
|
||||
|
||||
$(":button[name=loadfilter]").click(function() {
|
||||
$(":hidden[name=action]").val("loadfilter");
|
||||
$("#find_customer").submit();
|
||||
});
|
||||
|
||||
$(":button[name=deletefilter]").click(function() {
|
||||
$(":hidden[name=action]").val("deletefilter");
|
||||
$("#find_customer").submit();
|
||||
});
|
||||
|
||||
$(":button[name=savefilter]").click(function() {
|
||||
$(":hidden[name=action]").val("savefilter");
|
||||
$("#find_customer").submit();
|
||||
});
|
||||
|
||||
$(":button[name=createfilter]").click(function() {
|
||||
$(":hidden[name=action]").val("createfilter");
|
||||
$("#find_customer").submit();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
$form = new Form($db);
|
||||
$formadvtargetemaling = new FormAdvTargetEmailing($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
if ($object->fetch($id) >= 0) {
|
||||
|
||||
$head = emailing_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'advtargets', $langs->trans("Mailing"), 0, 'email');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/comm/mailing/liste.php">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
print '<tr><td width="25%">' . $langs->trans("Ref") . '</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($object, 'id', $linkback);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td width="25%">' . $langs->trans("MailTitle") . '</td><td colspan="3">' . $object->titre . '</td></tr>';
|
||||
|
||||
print '<tr><td width="25%">' . $langs->trans("MailFrom") . '</td><td colspan="3">' . dol_print_email($object->email_from, 0, 0, 0, 0, 1) . '</td></tr>';
|
||||
|
||||
// Errors to
|
||||
print '<tr><td width="25%">' . $langs->trans("MailErrorsTo") . '</td><td colspan="3">' . dol_print_email($object->email_errorsto, 0, 0, 0, 0, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td width="25%">' . $langs->trans("Status") . '</td><td colspan="3">' . $object->getLibStatut(4) . '</td></tr>';
|
||||
|
||||
// Nb of distinct emails
|
||||
print '<tr><td width="25%">';
|
||||
print $langs->trans("TotalNbOfDistinctRecipients");
|
||||
print '</td><td colspan="3">';
|
||||
$nbemail = ($object->nbemail ? $object->nbemail : '0');
|
||||
if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) {
|
||||
$text = $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB);
|
||||
print $form->textwithpicto($nbemail, $text, 1, 'warning');
|
||||
} else {
|
||||
print $nbemail;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print "</div>";
|
||||
|
||||
// Show email selectors
|
||||
if ($object->statut == 0 && $user->rights->mailing->creer) {
|
||||
print_fiche_titre($langs->trans("AdvTgtTitle"));
|
||||
|
||||
print '<div class="tabBar">' . "\n";
|
||||
print '<form name="find_customer" id="find_customer" action="' . $_SERVER['PHP_SELF'] . '?id=' . $id . '" method="POST">' . "\n";
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">' . "\n";
|
||||
print '<input type="hidden" name="action" value="">' . "\n";
|
||||
print '<table class="border" width="100%">' . "\n";
|
||||
|
||||
print '<tr>' . "\n";
|
||||
print '<td colspan="3" align="right">' . "\n";
|
||||
|
||||
print '<input type="button" name="addcontact" id="addcontact" value="' . $langs->trans('AdvTgtAddContact') . '" class="butAction"/>' . "\n";
|
||||
|
||||
print '</td>' . "\n";
|
||||
print '</tr>' . "\n";
|
||||
|
||||
print '<tr><td>' . $langs->trans('AdvTgtNameTemplate') . '</td><td>';
|
||||
if (! empty($template_id)) {
|
||||
$default_template = $template_id;
|
||||
} else {
|
||||
$default_template = $advTarget->id;
|
||||
}
|
||||
print $formadvtargetemaling->selectAdvtargetemailingTemplate('template_id', $default_template);
|
||||
print '<input type="button" name="loadfilter" id="loadfilter" value="' . $langs->trans('AdvTgtLoadFilter') . '" class="butAction"/>';
|
||||
print '<input type="button" name="deletefilter" id="deletefilter" value="' . $langs->trans('AdvTgtDeleteFilter') . '" class="butAction"/>';
|
||||
print '<input type="button" name="savefilter" id="savefilter" value="' . $langs->trans('AdvTgtSaveFilter') . '" class="butAction"/>';
|
||||
print $langs->trans('AdvTgtOrCreateNewFilter');
|
||||
print '<input type="text" name="template_name" id="template_name" value=""/>';
|
||||
print '<input type="button" name="createfilter" id="createfilter" value="' . $langs->trans('AdvTgtCreateFilter') . '" class="butAction"/>';
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
print '<tr><td>' . $langs->trans('AdvTgtTypeOfIncude') . '</td><td>';
|
||||
print $form->selectarray('type_of_target', $advTarget->select_target_type, $array_query['type_of_target']);
|
||||
print '</td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtTypeOfIncudeHelp"), 1, 'help');
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Customer name
|
||||
print '<tr><td>' . $langs->trans('ThirdPartyName');
|
||||
if (! empty($array_query['cust_name'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td><input type="text" name="cust_name" value="' . $array_query['cust_name'] . '"/></td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Code Client
|
||||
print '<tr><td>' . $langs->trans('CustomerCode');
|
||||
if (! empty($array_query['cust_code'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td><input type="text" name="cust_code" value="' . $array_query['cust_code'] . '"/></td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Address Client
|
||||
print '<tr><td>' . $langs->trans('Address');
|
||||
if (! empty($array_query['cust_adress'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td><input type="text" name="cust_adress" value="' . $array_query['cust_adress'] . '"/></td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Zip Client
|
||||
print '<tr><td>' . $langs->trans('Zip');
|
||||
if (! empty($array_query['cust_zip'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td><input type="text" name="cust_zip" value="' . $array_query['cust_zip'] . '"/></td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// City Client
|
||||
print '<tr><td>' . $langs->trans('Town');
|
||||
if (! empty($array_query['cust_city'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td><input type="text" name="cust_city" value="' . $array_query['cust_city'] . '"/></td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Customer Country
|
||||
print '<tr><td>' . $langs->trans("Country");
|
||||
if (count($array_query['cust_country']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print $formadvtargetemaling->multiselectCountry('cust_country', $array_query['cust_country']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// State Customer
|
||||
print '<tr><td>' . $langs->trans('Status') . ' ' . $langs->trans('ThirdParty');
|
||||
if (count($array_query['cust_status']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>';
|
||||
print $formadvtargetemaling->advMultiselectarray('cust_status', array (
|
||||
'0' => $langs->trans('ActivityCeased'),
|
||||
'1' => $langs->trans('InActivity')
|
||||
), $array_query['cust_status']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Mother Company
|
||||
print '<tr><td>' . $langs->trans("Maison mère");
|
||||
if (! empty($array_query['cust_mothercompany'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print '<input type="text" name="cust_mothercompany" value="' . $array_query['cust_mothercompany'] . '"/>';
|
||||
print '</td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Prospect/Customer
|
||||
$selected = $array_query['cust_typecust'];
|
||||
print '<tr><td>' . $langs->trans('ProspectCustomer') . ' ' . $langs->trans('ThirdParty');
|
||||
if (count($array_query['cust_typecust']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>';
|
||||
$options_array = array (
|
||||
2 => $langs->trans('Prospect'),
|
||||
3 => $langs->trans('ProspectCustomer'),
|
||||
1 => $langs->trans('Customer'),
|
||||
0 => $langs->trans('NorProspectNorCustomer')
|
||||
);
|
||||
print $formadvtargetemaling->advMultiselectarray('cust_typecust', $options_array, $array_query['cust_typecust']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Prospection status
|
||||
print '<tr><td>' . $langs->trans('ProspectLevel');
|
||||
if (count($array_query['cust_prospect_status']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>';
|
||||
print $formadvtargetemaling->multiselectProspectionStatus($array_query['cust_prospect_status'], 'cust_prospect_status', 1);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Prospection comm status
|
||||
print '<tr><td>' . $langs->trans('StatusProsp');
|
||||
if (count($array_query['cust_comm_status']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>';
|
||||
print $formadvtargetemaling->advMultiselectarray('cust_comm_status', $advTarget->type_statuscommprospect, $array_query['cust_comm_status']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Customer Type
|
||||
print '<tr><td>' . $langs->trans("ThirdPartyType");
|
||||
if (count($array_query['cust_typeent']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print $formadvtargetemaling->advMultiselectarray('cust_typeent', $formcompany->typent_array(0, " AND id <> 0"), $array_query['cust_typeent']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Staff number
|
||||
print '<td>' . $langs->trans("Staff");
|
||||
if (count($array_query['cust_effectif_id']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>';
|
||||
print $formadvtargetemaling->advMultiselectarray("cust_effectif_id", $formcompany->effectif_array(0, " AND id <> 0"), $array_query['cust_effectif_id']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Sales manager
|
||||
print '<tr><td>' . $langs->trans("SalesRepresentatives");
|
||||
if (count($array_query['cust_saleman']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print $formadvtargetemaling->multiselectselectSalesRepresentatives('cust_saleman', $array_query['cust_saleman'], $user);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Customer Default Langauge
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) {
|
||||
|
||||
print '<tr><td>' . $langs->trans("DefaultLang");
|
||||
if (count($array_query['cust_language']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print $formadvtargetemaling->multiselectselectLanguage('cust_language', $array_query['cust_language']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
}
|
||||
|
||||
if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
|
||||
// Customer Categories
|
||||
print '<tr><td>' . $langs->trans("CustomersCategoryShort");
|
||||
if (count($array_query['cust_categ']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print $formadvtargetemaling->multiselectCustomerCategories('cust_categ', $array_query['cust_categ']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
}
|
||||
|
||||
// Standard Extrafield feature
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
|
||||
// fetch optionals attributes and labels
|
||||
dol_include_once('/core/class/extrafields.class.php');
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('societe');
|
||||
foreach ( $extralabels as $key => $val ) {
|
||||
if ($key != 'ts_nameextra' && $key != 'ts_payeur') {
|
||||
print '<tr><td>' . $extrafields->attribute_label[$key];
|
||||
if (! empty($array_query['options_' . $key]) || (is_array($array_query['options_' . $key]) && count($array_query['options_' . $key]) > 0)) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>';
|
||||
if (($extrafields->attribute_type[$key] == 'varchar') || ($extrafields->attribute_type[$key] == 'text')) {
|
||||
print '<input type="text" name="options_' . $key . '"/></td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||
} elseif (($extrafields->attribute_type[$key] == 'int') || ($extrafields->attribute_type[$key] == 'double')) {
|
||||
print $langs->trans("AdvTgtMinVal") . '<input type="text" name="options' . $key . '_min"/>';
|
||||
print $langs->trans("AdvTgtMaxVal") . '<input type="text" name="options' . $key . '_max"/>';
|
||||
print '</td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help');
|
||||
} elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) {
|
||||
|
||||
print '<table class="nobordernopadding"><tr>';
|
||||
print '<td>' . $langs->trans("AdvTgtStartDt") . '</td><td>';
|
||||
print $form->select_date('', 'options_' . $key . '_st_dt');
|
||||
print '</td><td>' . $langs->trans("AdvTgtEndDt") . '</td><td>';
|
||||
print $form->select_date('', 'options_' . $key . '_end_dt');
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help');
|
||||
} elseif (($extrafields->attribute_type[$key] == 'boolean')) {
|
||||
print $form->selectarray('options_' . $key, array (
|
||||
'' => '',
|
||||
'1' => $langs->trans('Yes'),
|
||||
'0' => $langs->trans('No')
|
||||
), $array_query['options_' . $key]);
|
||||
print '</td><td>' . "\n";
|
||||
} elseif (($extrafields->attribute_type[$key] == 'select')) {
|
||||
print $formadvtargetemaling->advMultiselectarray('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]);
|
||||
print '</td><td>' . "\n";
|
||||
} elseif (($extrafields->attribute_type[$key] == 'sellist')) {
|
||||
print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]);
|
||||
print '</td><td>' . "\n";
|
||||
} else {
|
||||
|
||||
print '<table class="nobordernopadding"><tr>';
|
||||
print '<td></td><td>';
|
||||
if (is_array($array_query['options_' . $key])) {
|
||||
print $extrafields->showInputField($key, implode(',', $array_query['options_' . $key]));
|
||||
} else {
|
||||
print $extrafields->showInputField($key, $array_query['options_' . $key]);
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td><td>' . "\n";
|
||||
}
|
||||
print '</td></tr>' . "\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$std_soc = new Societe($db);
|
||||
$action_search = 'query';
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
|
||||
$hookmanager = new HookManager($db);
|
||||
$hookmanager->initHooks(array (
|
||||
'thirdpartycard'
|
||||
));
|
||||
if (! empty($advTarget->id)) {
|
||||
$parameters = array (
|
||||
'array_query' => $advTarget->filtervalue
|
||||
);
|
||||
}
|
||||
// Module extrafield feature
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $std_soc, $action_search);
|
||||
}
|
||||
|
||||
// State Contact
|
||||
print '<tr><td>' . $langs->trans('Status') . ' ' . $langs->trans('Contact');
|
||||
if (count($array_query['contact_status']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>';
|
||||
print $formadvtargetemaling->advMultiselectarray('contact_status', array (
|
||||
'0' => $langs->trans('ActivityCeased'),
|
||||
'1' => $langs->trans('InActivity')
|
||||
), $array_query['contact_status']);
|
||||
print '</td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtContactHelp"), 1, 'help');
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Civility
|
||||
print '<tr><td width="15%">' . $langs->trans("UserTitle");
|
||||
if (count($array_query['contact_civility']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>';
|
||||
print $formadvtargetemaling->multiselectCivility('contact_civility', $array_query['contact_civility']);
|
||||
print '</td></tr>';
|
||||
|
||||
// contact name
|
||||
print '<tr><td>' . $langs->trans('Contact') . ' ' . $langs->trans('Lastname');
|
||||
if (! empty($array_query['contact_lastname'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td><input type="text" name="contact_lastname" value="' . $array_query['contact_lastname'] . '"/></td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||
print '</td></tr>' . "\n";
|
||||
print '<tr><td>' . $langs->trans('Contact') . ' ' . $langs->trans('Firstname');
|
||||
if (! empty($array_query['contact_firstname'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td><input type="text" name="contact_firstname" value="' . $array_query['contact_firstname'] . '"/></td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Contact Country
|
||||
print '<tr><td>' . $langs->trans('Contact') . ' ' . $langs->trans("Country");
|
||||
if (count($array_query['contact_country']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print $formadvtargetemaling->multiselectCountry('contact_country', $array_query['contact_country']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Never send mass mailing
|
||||
print '<tr><td>' . $langs->trans('Contact') . ' ' . $langs->trans("No_Email");
|
||||
if (! empty($array_query['contact_no_email'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print $form->selectarray('contact_no_email', array (
|
||||
'' => '',
|
||||
'1' => $langs->trans('Yes'),
|
||||
'0' => $langs->trans('No')
|
||||
), $array_query['contact_no_email']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Contact Date Create
|
||||
print '<tr><td>' . $langs->trans('Contact') . ' ' . $langs->trans("DateCreation");
|
||||
if (! empty($array_query['contact_create_st_dt'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print '<table class="nobordernopadding"><tr>';
|
||||
print '<td>' . $langs->trans("AdvTgtStartDt") . '</td><td>';
|
||||
print $form->select_date($array_query['contact_create_st_dt'], 'contact_create_st_dt', 0, 0, 1, 'find_customer', 1, 1);
|
||||
print '</td><td>' . $langs->trans("AdvTgtEndDt") . '</td><td>';
|
||||
print $form->select_date($array_query['contact_create_end_dt'], 'contact_create_end_dt', 0, 0, 1, 'find_customer', 1, 1);
|
||||
print '</td></tr></table>';
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
// Contact update Create
|
||||
print '<tr><td>' . $langs->trans('Contact') . ' ' . $langs->trans("DateLastModification");
|
||||
if (! empty($array_query['contact_update_st_dt'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print '<table class="nobordernopadding"><tr>';
|
||||
print '<td>' . $langs->trans("AdvTgtStartDt") . '</td><td>';
|
||||
print $form->select_date($array_query['contact_update_st_dt'], 'contact_update_st_dt', 0, 0, 1, 'find_customer', 1, 1);
|
||||
print '</td><td>' . $langs->trans("AdvTgtEndDt") . '</td><td>';
|
||||
print $form->select_date($array_query['contact_update_end_dt'], 'contact_update_end_dt', 0, 0, 1, 'find_customer', 1, 1);
|
||||
print '</td></tr></table>';
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
|
||||
// Customer Categories
|
||||
print '<tr><td>' . $langs->trans("ContactCategoriesShort");
|
||||
if (count($array_query['contact_categ']) > 0) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>' . "\n";
|
||||
print $formadvtargetemaling->multiselectContactCategories('contact_categ', $array_query['contact_categ']);
|
||||
print '</td><td>' . "\n";
|
||||
print '</td></tr>' . "\n";
|
||||
}
|
||||
|
||||
// Standard Extrafield feature
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
|
||||
// fetch optionals attributes and labels
|
||||
dol_include_once('/core/class/extrafields.class.php');
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('socpeople');
|
||||
foreach ( $extralabels as $key => $val ) {
|
||||
|
||||
print '<tr><td>' . $extrafields->attribute_label[$key];
|
||||
if ($array_query['options_' . $key . '_cnct'] != '' || (is_array($array_query['options_' . $key . '_cnct']) && count($array_query['options_' . $key . '_cnct']) > 0)) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
print '</td><td>';
|
||||
if (($extrafields->attribute_type[$key] == 'varchar') || ($extrafields->attribute_type[$key] == 'text')) {
|
||||
print '<input type="text" name="options_' . $key . '_cnct"/></td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||
} elseif (($extrafields->attribute_type[$key] == 'int') || ($extrafields->attribute_type[$key] == 'double')) {
|
||||
print $langs->trans("AdvTgtMinVal") . '<input type="text" name="options' . $key . '_min_cnct"/>';
|
||||
print $langs->trans("AdvTgtMaxVal") . '<input type="text" name="options' . $key . '_max_cnct"/>';
|
||||
print '</td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help');
|
||||
} elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) {
|
||||
|
||||
print '<table class="nobordernopadding"><tr>';
|
||||
print '<td>' . $langs->trans("AdvTgtStartDt") . '</td><td>';
|
||||
print $form->select_date('', 'options_' . $key . '_st_dt' . '_cnct');
|
||||
print '</td><td>' . $langs->trans("AdvTgtEndDt") . '</td><td>';
|
||||
print $form->select_date('', 'options_' . $key . '_end_dt' . '_cnct');
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help');
|
||||
} elseif (($extrafields->attribute_type[$key] == 'boolean')) {
|
||||
print $form->selectarray('options_' . $key . '_cnct', array (
|
||||
'' => '',
|
||||
'1' => $langs->trans('Yes'),
|
||||
'0' => $langs->trans('No')
|
||||
), $array_query['options_' . $key . '_cnct']);
|
||||
print '</td><td>' . "\n";
|
||||
} elseif (($extrafields->attribute_type[$key] == 'select')) {
|
||||
print $formadvtargetemaling->advMultiselectarray('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']);
|
||||
print '</td><td>' . "\n";
|
||||
} elseif (($extrafields->attribute_type[$key] == 'sellist')) {
|
||||
print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']);
|
||||
print '</td><td>' . "\n";
|
||||
} else {
|
||||
|
||||
print '<table class="nobordernopadding"><tr>';
|
||||
print '<td></td><td>';
|
||||
if (is_array($array_query['options_' . $key . '_cnct'])) {
|
||||
print $extrafields->showInputField($key, implode(',', $array_query['options_' . $key . '_cnct']), '', '_cnct');
|
||||
} else {
|
||||
print $extrafields->showInputField($key, $array_query['options_' . $key . '_cnct'], '', '_cnct');
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td><td>' . "\n";
|
||||
}
|
||||
print '</td></tr>' . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr>' . "\n";
|
||||
print '<td colspan="3" align="right">' . "\n";
|
||||
|
||||
print '<input type="button" name="addcontact" id="addcontact" value="' . $langs->trans('AdvTgtAddContact') . '" class="butAction"/>' . "\n";
|
||||
|
||||
print '</td>' . "\n";
|
||||
print '</tr>' . "\n";
|
||||
print '</table>' . "\n";
|
||||
print '</form>' . "\n";
|
||||
print '</div>' . "\n";
|
||||
|
||||
print '<form action="' . $_SERVER['PHP_SELF'] . '?action=clear&id=' . $object->id . '" method="POST">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print_titre($langs->trans("ToClearAllRecipientsClickHere"));
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" align="right"><input type="submit" class="button" value="' . $langs->trans("TargetsReset") . '"></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
if (empty($conf->mailchimp->enabled) || (! empty($conf->mailchimp->enabled) && $object->statut != 3))
|
||||
{
|
||||
// List of recipients (TODO Move code of page cibles.php into a .tpl.php file and make an include here to avoid duplicate content)
|
||||
}
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -948,7 +948,7 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
print '<br><br></div>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
// Affichage formulaire de TEST
|
||||
@ -1052,20 +1052,25 @@ else
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">'.$object->id.'</td></tr>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($object,'id', $linkback);
|
||||
print '</td></tr>';
|
||||
|
||||
// Topic
|
||||
print '<tr><td width="25%">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
|
||||
// From
|
||||
print '<tr><td width="25%">'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($object->email_from,0,0,0,0,1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($object->email_from,0,0,0,0,1).'</td></tr>';
|
||||
// To
|
||||
print '<tr><td width="25%">'.$langs->trans("MailErrorsTo").'</td><td colspan="3">'.dol_print_email($object->email_errorsto,0,0,0,0,1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td colspan="3">'.dol_print_email($object->email_errorsto,0,0,0,0,1).'</td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td width="25%">'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4).'</td></tr>';
|
||||
|
||||
// Nb of distinct emails
|
||||
print '<tr><td width="25%">';
|
||||
print '<tr><td>';
|
||||
print $langs->trans("TotalNbOfDistinctRecipients");
|
||||
print '</td><td colspan="3">';
|
||||
$nbemail = ($object->nbemail?$object->nbemail:img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>');
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2015 Laurent Destailleur <eldy@uers.sourceforge.net>
|
||||
* Copyright (C) 2005-2016 Laurent Destailleur <eldy@uers.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
@ -227,7 +227,7 @@ if ($object->fetch($id) >= 0)
|
||||
// Show email selectors
|
||||
if ($allowaddtarget && $user->rights->mailing->creer)
|
||||
{
|
||||
print load_fiche_titre($langs->trans("ToAddRecipientsChooseHere"),($user->admin?info_admin($langs->trans("YouCanAddYourOwnPredefindedListHere"),1):''),'');
|
||||
print load_fiche_titre($langs->trans("ToAddRecipientsChooseHere"), ($user->admin?info_admin($langs->trans("YouCanAddYourOwnPredefindedListHere"),1):''), 'title_generic');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
@ -398,12 +398,12 @@ if ($object->fetch($id) >= 0)
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
|
||||
$cleartext='';
|
||||
if ($allowaddtarget) {
|
||||
$cleartext='<br></div><div>'.$langs->trans("ToClearAllRecipientsClickHere").': '.'<input type="submit" name="clearlist" class="button" value="'.$langs->trans("TargetsReset").'">';
|
||||
$cleartext=$langs->trans("ToClearAllRecipientsClickHere").' '.'<input type="submit" name="clearlist" class="button" value="'.$langs->trans("TargetsReset").'">';
|
||||
}
|
||||
|
||||
print_barre_liste($langs->trans("MailSelectedRecipients").$cleartext,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,"",$num,$nbtotalofrecords,'',0,'','',$limit);
|
||||
|
||||
print_barre_liste($langs->trans("MailSelectedRecipients"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$cleartext,$num,$nbtotalofrecords,'title_generic',0,'','',$limit);
|
||||
|
||||
print '</form>';
|
||||
|
||||
print "\n<!-- Liste destinataires selectionnes -->\n";
|
||||
@ -540,7 +540,7 @@ if ($object->fetch($id) >= 0)
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
//Sreach Icon
|
||||
// Search Icon
|
||||
print '<td align="right">';
|
||||
if ($obj->statut == 0)
|
||||
{
|
||||
|
||||
777
htdocs/comm/mailing/class/advtargetemailing.class.php
Normal file
777
htdocs/comm/mailing/class/advtargetemailing.class.php
Normal file
@ -0,0 +1,777 @@
|
||||
<?php
|
||||
/* Advance Targeting Emailling for mass emailing module
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file comm/mailing/class/advtargetemailing.class.php
|
||||
* \ingroup mailing
|
||||
* \brief This file is an example CRUD class file (Create/Read/Update/Delete)
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage advanced emailing target selector
|
||||
*/
|
||||
class AdvanceTargetingMailing extends CommonObject
|
||||
{
|
||||
|
||||
var $db; //!< To store db handler
|
||||
var $error; //!< To return error code (or message)
|
||||
var $errors = array(); //!< To return several error codes (or messages)
|
||||
var $element='advtargetemailing'; //!< Id that identify managed objects
|
||||
var $table_element='advtargetemailing'; //!< Name of table without prefix where object is stored
|
||||
|
||||
var $id;
|
||||
|
||||
var $name;
|
||||
var $entity;
|
||||
var $fk_mailing;
|
||||
var $filtervalue;
|
||||
var $fk_user_author;
|
||||
var $datec='';
|
||||
var $fk_user_mod;
|
||||
var $tms='';
|
||||
|
||||
var $select_target_type = array();
|
||||
var $type_statuscommprospect=array();
|
||||
var $thirdparty_lines;
|
||||
var $contact_lines;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load('customers');
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
$this->select_target_type = array('2'=>$langs->trans('Contacts'),'1'=>$langs->trans('Contacts').'+'.$langs->trans('ThirdParty'),
|
||||
'3'=>$langs->trans('ThirdParty'),
|
||||
);
|
||||
$this->type_statuscommprospect=array(
|
||||
-1=>$langs->trans("StatusProspect-1"),
|
||||
0=>$langs->trans("StatusProspect0"),
|
||||
1=>$langs->trans("StatusProspect1"),
|
||||
2=>$langs->trans("StatusProspect2"),
|
||||
3=>$langs->trans("StatusProspect3"));
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create object into database
|
||||
*
|
||||
* @param User $user User that creates
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
function create($user, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
if (isset($this->fk_mailing)) $this->fk_mailing=trim($this->fk_mailing);
|
||||
if (isset($this->name)) $this->name=trim($this->name);
|
||||
if (isset($this->filtervalue)) $this->filtervalue=trim($this->filtervalue);
|
||||
if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author);
|
||||
if (isset($this->fk_user_mod)) $this->fk_user_mod=trim($this->fk_user_mod);
|
||||
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."advtargetemailing(";
|
||||
|
||||
$sql.= "name,";
|
||||
$sql.= "entity,";
|
||||
$sql.= "fk_mailing,";
|
||||
$sql.= "filtervalue,";
|
||||
$sql.= "fk_user_author,";
|
||||
$sql.= "datec,";
|
||||
$sql.= "fk_user_mod";
|
||||
|
||||
|
||||
$sql.= ") VALUES (";
|
||||
|
||||
$sql.= " ".(! isset($this->name)?'NULL':"'".$this->db->escape($this->name)."'").",";
|
||||
$sql.= " ".$conf->entity.",";
|
||||
$sql.= " ".(! isset($this->fk_mailing)?'NULL':"'".$this->fk_mailing."'").",";
|
||||
$sql.= " ".(! isset($this->filtervalue)?'NULL':"'".$this->db->escape($this->filtervalue)."'").",";
|
||||
$sql.= " ".$user->id.",";
|
||||
$sql.= " ".$this->db->idate(dol_now()).",";
|
||||
$sql.= " ".$user->id;
|
||||
|
||||
|
||||
$sql.= ")";
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."advtargetemailing");
|
||||
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id)
|
||||
{
|
||||
global $langs;
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
|
||||
$sql.= " t.name,";
|
||||
$sql.= " t.entity,";
|
||||
$sql.= " t.fk_mailing,";
|
||||
$sql.= " t.filtervalue,";
|
||||
$sql.= " t.fk_user_author,";
|
||||
$sql.= " t.datec,";
|
||||
$sql.= " t.fk_user_mod,";
|
||||
$sql.= " t.tms";
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."advtargetemailing as t";
|
||||
$sql.= " WHERE t.rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
$this->name = $obj->name;
|
||||
$this->entity = $obj->entity;
|
||||
$this->fk_mailing = $obj->fk_mailing;
|
||||
$this->filtervalue = $obj->filtervalue;
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
$this->fk_user_mod = $obj->fk_user_mod;
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch_by_mailing($id=0)
|
||||
{
|
||||
global $langs;
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
|
||||
$sql.= " t.name,";
|
||||
$sql.= " t.entity,";
|
||||
$sql.= " t.fk_mailing,";
|
||||
$sql.= " t.filtervalue,";
|
||||
$sql.= " t.fk_user_author,";
|
||||
$sql.= " t.datec,";
|
||||
$sql.= " t.fk_user_mod,";
|
||||
$sql.= " t.tms";
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."advtargetemailing as t";
|
||||
if (!empty($id)) {
|
||||
$sql.= " WHERE t.fk_mailing = ".$id;
|
||||
}else {
|
||||
$sql.= " WHERE t.fk_mailing = ".$this->fk_mailing;
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
$this->name = $obj->name;
|
||||
$this->entity = $obj->entity;
|
||||
$this->fk_mailing = $obj->fk_mailing;
|
||||
$this->filtervalue = $obj->filtervalue;
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
$this->fk_user_mod = $obj->fk_user_mod;
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
* @param User $user User that modifies
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
if (isset($this->fk_mailing)) $this->fk_mailing=trim($this->fk_mailing);
|
||||
if (isset($this->name)) $this->name=trim($this->name);
|
||||
if (isset($this->filtervalue)) $this->filtervalue=trim($this->filtervalue);
|
||||
if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author);
|
||||
if (isset($this->fk_user_mod)) $this->fk_user_mod=trim($this->fk_user_mod);
|
||||
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add a control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."advtargetemailing SET";
|
||||
|
||||
$sql.= " name=".(isset($this->name)?"'".$this->db->escape($this->name)."'":"''").",";
|
||||
$sql.= " entity=".$conf->entity.",";
|
||||
$sql.= " fk_mailing=".(isset($this->fk_mailing)?$this->fk_mailing:"null").",";
|
||||
$sql.= " filtervalue=".(isset($this->filtervalue)?"'".$this->db->escape($this->filtervalue)."'":"null").",";
|
||||
$sql.= " fk_user_mod=".$user->id;
|
||||
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param User $user User that deletes
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($user, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."advtargetemailing";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save query in database to retreive it
|
||||
*
|
||||
* @param User $user User that deletes
|
||||
* @param array $arrayquery All element to Query
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function savequery($user,$arrayquery)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
if (!empty($arrayquery)) {
|
||||
$result=$this->fetch_by_mailing($this->fk_mailing);
|
||||
$this->filtervalue=json_encode($arrayquery);
|
||||
if ($result<0) {
|
||||
return -1;
|
||||
}
|
||||
if (!empty($this->id)) {
|
||||
$this->update($user);
|
||||
}else {
|
||||
$this->create($user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load object in memory from database
|
||||
*
|
||||
* @param array $arrayquery All element to Query
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function query_thirdparty($arrayquery)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "societe as t";
|
||||
$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "societe_extrafields as te ON te.fk_object=t.rowid ";
|
||||
|
||||
$sqlwhere=array();
|
||||
|
||||
$sqlwhere[]= 't.entity IN ('.getEntity('societe',1).')';
|
||||
|
||||
if (count($arrayquery)>0) {
|
||||
|
||||
if (array_key_exists('cust_saleman', $arrayquery)) {
|
||||
$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as saleman ON saleman.fk_soc=t.rowid ";
|
||||
}
|
||||
if (array_key_exists('cust_categ', $arrayquery)) {
|
||||
$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "categorie_societe as custcateg ON custcateg.fk_societe=t.rowid ";
|
||||
}
|
||||
|
||||
if (!empty($arrayquery['cust_name'])) {
|
||||
|
||||
$sqlwhere[]= $this->transformToSQL('t.nom',$arrayquery['cust_name']);
|
||||
}
|
||||
if (!empty($arrayquery['cust_code'])) {
|
||||
$sqlwhere[]= $this->transformToSQL('t.code_client',$arrayquery['cust_code']);
|
||||
}
|
||||
if (!empty($arrayquery['cust_adress'])) {
|
||||
$sqlwhere[]= $this->transformToSQL('t.address',$arrayquery['cust_adress']);
|
||||
}
|
||||
if (!empty($arrayquery['cust_zip'])) {
|
||||
$sqlwhere[]= $this->transformToSQL('t.zip',$arrayquery['cust_zip']);
|
||||
}
|
||||
if (!empty($arrayquery['cust_city'])) {
|
||||
$sqlwhere[]= $this->transformToSQL('t.town',$arrayquery['cust_city']);
|
||||
}
|
||||
if (!empty($arrayquery['cust_mothercompany'])) {
|
||||
$str=$this->transformToSQL('nom',$arrayquery['cust_mothercompany']);
|
||||
$sqlwhere[]= " (t.parent IN (SELECT rowid FROM " . MAIN_DB_PREFIX . "societe WHERE ('.$str.')))";
|
||||
}
|
||||
if (!empty($arrayquery['cust_status']) && count($arrayquery['cust_status'])>0) {
|
||||
$sqlwhere[]= " (t.status IN (".implode(',',$arrayquery['cust_status'])."))";
|
||||
}
|
||||
if (!empty($arrayquery['cust_typecust']) && count($arrayquery['cust_typecust'])>0) {
|
||||
$sqlwhere[]= " (t.client IN (".implode(',',$arrayquery['cust_typecust'])."))";
|
||||
}
|
||||
if (!empty($arrayquery['cust_comm_status']) && count($arrayquery['cust_comm_status']>0)) {
|
||||
$sqlwhere[]= " (t.fk_stcomm IN (".implode(',',$arrayquery['cust_comm_status'])."))";
|
||||
}
|
||||
if (!empty($arrayquery['cust_prospect_status']) && count($arrayquery['cust_prospect_status'])>0) {
|
||||
$sqlwhere[]= " (t.fk_prospectlevel IN ('".implode("','",$arrayquery['cust_prospect_status'])."'))";
|
||||
}
|
||||
if (!empty($arrayquery['cust_typeent']) && count($arrayquery['cust_typeent'])>0) {
|
||||
$sqlwhere[]= " (t.fk_typent IN (".implode(',',$arrayquery['cust_typeent'])."))";
|
||||
}
|
||||
if (!empty($arrayquery['cust_saleman']) && count($arrayquery['cust_saleman'])>0) {
|
||||
$sqlwhere[]= " (saleman.fk_user IN (".implode(',',$arrayquery['cust_saleman'])."))";
|
||||
}
|
||||
if (!empty($arrayquery['cust_country']) && count($arrayquery['cust_country'])>0) {
|
||||
$sqlwhere[]= " (t.fk_pays IN (".implode(',',$arrayquery['cust_country'])."))";
|
||||
}
|
||||
if (!empty($arrayquery['cust_effectif_id']) && count($arrayquery['cust_effectif_id'])>0) {
|
||||
$sqlwhere[]= " (t.fk_effectif IN (".implode(',',$arrayquery['cust_effectif_id'])."))";
|
||||
}
|
||||
if (!empty($arrayquery['cust_categ']) && count($arrayquery['cust_categ'])>0) {
|
||||
$sqlwhere[]= " (custcateg.fk_categorie IN (".implode(',',$arrayquery['cust_categ'])."))";
|
||||
}
|
||||
if (!empty($arrayquery['cust_language']) && count($arrayquery['cust_language'])>0) {
|
||||
$sqlwhere[]= " (t.default_lang IN ('".implode("','",$arrayquery['cust_language'])."'))";
|
||||
}
|
||||
|
||||
//Standard Extrafield feature
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
|
||||
// fetch optionals attributes and labels
|
||||
dol_include_once('/core/class/extrafields.class.php');
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('societe');
|
||||
|
||||
foreach($extralabels as $key=>$val) {
|
||||
|
||||
if (($extrafields->attribute_type[$key] == 'varchar') ||
|
||||
($extrafields->attribute_type[$key] == 'text')) {
|
||||
if (!empty($arrayquery['options_'.$key])) {
|
||||
$sqlwhere[]= " (te.".$key." LIKE '".$arrayquery['options_'.$key]."')";
|
||||
}
|
||||
} elseif (($extrafields->attribute_type[$key] == 'int') ||
|
||||
($extrafields->attribute_type[$key] == 'double')) {
|
||||
if (!empty($arrayquery['options_'.$key.'_max'])) {
|
||||
$sqlwhere[]= " (te.".$key." >= ".$arrayquery['options_'.$key.'_max']." AND te.".$key." <= ".$arrayquery['options_'.$key.'_min'].")";
|
||||
}
|
||||
} else if (($extrafields->attribute_type[$key] == 'date') ||
|
||||
($extrafields->attribute_type[$key] == 'datetime')) {
|
||||
if (!empty($arrayquery['options_'.$key.'_end_dt'])){
|
||||
$sqlwhere[]= " (te.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt'])."' AND te.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt'])."')";
|
||||
}
|
||||
}else if ($extrafields->attribute_type[$key] == 'boolean') {
|
||||
if ($arrayquery['options_'.$key]!=''){
|
||||
$sqlwhere[]= " (te.".$key." = ".$arrayquery['options_'.$key].")";
|
||||
}
|
||||
}else{
|
||||
if (is_array($arrayquery['options_'.$key])) {
|
||||
$sqlwhere[]= " (te.".$key." IN ('".implode("','",$arrayquery['options_'.$key])."'))";
|
||||
} elseif (!empty($arrayquery['options_'.$key])) {
|
||||
$sqlwhere[]= " (te.".$key." LIKE '".$arrayquery['options_'.$key]."')";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (count($sqlwhere)>0) $sql.= " WHERE ".implode(" AND ",$sqlwhere);
|
||||
|
||||
}
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . "::query_thirdparty sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$this->thirdparty_lines = array();
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
if ($num)
|
||||
{
|
||||
while( $i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->thirdparty_lines[$i] = $obj->rowid;
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return $num;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::query_thirdparty " . $this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from database
|
||||
*
|
||||
* @param array $arrayquery All element to Query
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function query_contact($arrayquery)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "socpeople as t";
|
||||
$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "socpeople_extrafields as te ON te.fk_object=t.rowid ";
|
||||
|
||||
$sqlwhere=array();
|
||||
|
||||
$sqlwhere[]= 't.entity IN ('.getEntity('socpeople',1).')';
|
||||
|
||||
if (count($arrayquery)>0) {
|
||||
|
||||
if (array_key_exists('contact_categ', $arrayquery)) {
|
||||
$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "categorie_contact as contactcateg ON contactcateg.fk_socpeople=t.rowid ";
|
||||
}
|
||||
|
||||
if (!empty($arrayquery['contact_lastname'])) {
|
||||
$sqlwhere[]=$this->transformToSQL('t.lastname',$arrayquery['contact_lastname']);
|
||||
}
|
||||
if (!empty($arrayquery['contact_firstname'])) {
|
||||
$sqlwhere[]=$this->transformToSQL('t.firstname',$arrayquery['contact_firstname']);
|
||||
}
|
||||
if (!empty($arrayquery['contact_country']) && count($arrayquery['contact_country'])) {
|
||||
$sqlwhere[]= " (t.fk_pays IN (".implode(',',$arrayquery['contact_country'])."))";
|
||||
}
|
||||
if (!empty($arrayquery['contact_status']) && count($arrayquery['contact_status'])>0) {
|
||||
$sqlwhere[]= " (t.statut IN (".implode(',',$arrayquery['contact_status'])."))";
|
||||
}
|
||||
if (!empty($arrayquery['contact_civility']) && count($arrayquery['contact_civility'])>0) {
|
||||
$sqlwhere[]= " (t.civility IN ('".implode("','",$arrayquery['contact_civility'])."'))";
|
||||
}
|
||||
if ($arrayquery['contact_no_email']!='') {
|
||||
$sqlwhere[]= " (t.no_email='".$arrayquery['contact_no_email']."')";
|
||||
}
|
||||
if ($arrayquery['contact_update_st_dt']!='') {
|
||||
$sqlwhere[]= " (t.tms >= '".$this->db->idate($arrayquery['contact_update_st_dt'])."' AND t.tms <= '".$this->db->idate($arrayquery['contact_update_end_dt'])."')";
|
||||
}
|
||||
if ($arrayquery['contact_create_st_dt']!='') {
|
||||
$sqlwhere[]= " (t.datec >= '".$this->db->idate($arrayquery['contact_create_st_dt'])."' AND t.datec <= '".$this->db->idate($arrayquery['contact_create_end_dt'])."')";
|
||||
}
|
||||
if (!empty($arrayquery['contact_categ']) && count($arrayquery['contact_categ'])>0) {
|
||||
$sqlwhere[]= " (contactcateg.fk_categorie IN (".implode(",",$arrayquery['contact_categ'])."))";
|
||||
}
|
||||
|
||||
//Standard Extrafield feature
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
|
||||
// fetch optionals attributes and labels
|
||||
dol_include_once('/core/class/extrafields.class.php');
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('socpeople');
|
||||
|
||||
foreach($extralabels as $key=>$val) {
|
||||
|
||||
if (($extrafields->attribute_type[$key] == 'varchar') ||
|
||||
($extrafields->attribute_type[$key] == 'text')) {
|
||||
if (!empty($arrayquery['options_'.$key.'_cnct'])) {
|
||||
$sqlwhere[]= " (te.".$key." LIKE '".$arrayquery['options_'.$key.'_cnct']."')";
|
||||
}
|
||||
} elseif (($extrafields->attribute_type[$key] == 'int') ||
|
||||
($extrafields->attribute_type[$key] == 'double')) {
|
||||
if (!empty($arrayquery['options_'.$key.'_max'.'_cnct'])) {
|
||||
$sqlwhere[]= " (te.".$key." >= ".$arrayquery['options_'.$key.'_max'.'_cnct']." AND te.".$key." <= ".$arrayquery['options_'.$key.'_min'.'_cnct'].")";
|
||||
}
|
||||
} else if (($extrafields->attribute_type[$key] == 'date') ||
|
||||
($extrafields->attribute_type[$key] == 'datetime')) {
|
||||
if (!empty($arrayquery['options_'.$key.'_end_dt'.'_cnct'])){
|
||||
$sqlwhere[]= " (te.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt'.'_cnct'])."' AND te.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt'.'_cnct'])."')";
|
||||
}
|
||||
}else if ($extrafields->attribute_type[$key] == 'boolean') {
|
||||
if ($arrayquery['options_'.$key.'_cnct']!=''){
|
||||
if ($arrayquery['options_'.$key.'_cnct']==0) {
|
||||
$sqlwhere[]= " (te.".$key." = ".$arrayquery['options_'.$key.'_cnct']." OR ((te.".$key." IS NULL) AND (te.fk_object IS NOT NULL)))";
|
||||
}else {
|
||||
$sqlwhere[]= " (te.".$key." = ".$arrayquery['options_'.$key.'_cnct'].")";
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if (is_array($arrayquery['options_'.$key.'_cnct'])) {
|
||||
$sqlwhere[]= " (te.".$key." IN ('".implode("','",$arrayquery['options_'.$key.'_cnct'])."'))";
|
||||
} elseif (!empty($arrayquery['options_'.$key.'_cnct'])) {
|
||||
$sqlwhere[]= " (te.".$key." LIKE '".$arrayquery['options_'.$key.'_cnct']."')";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (count($sqlwhere)>0) $sql.= " WHERE ".implode(" AND ",$sqlwhere);
|
||||
|
||||
}
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . "::query_contact sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$this->contact_lines = array();
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
if ($num)
|
||||
{
|
||||
while( $i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->contact_lines[$i] = $obj->rowid;
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return $num;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::query_contact " . $this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parse criteria to return a SQL qury formated
|
||||
*
|
||||
* @param string $column_to_test column to test
|
||||
* @param string $criteria Use %% as magic caracters. For exemple to find all item like <b>jean, joe, jim</b>, you can input <b>j%%</b>, you can also use ; as separator for value,
|
||||
* and use ! for except this value.
|
||||
* For exemple jean;joe;jim%%;!jimo;!jima%> will target all jean, joe, start with jim but not jimo and not everythnig taht start by jima
|
||||
* @return string Sql to use for the where condition
|
||||
*/
|
||||
public function transformToSQL($column_to_test,$criteria) {
|
||||
$return_sql_criteria = '(';
|
||||
|
||||
//This is a multiple value test
|
||||
if (preg_match('/;/',$criteria)) {
|
||||
$return_sql_not_like=array();
|
||||
$return_sql_like=array();
|
||||
|
||||
$criteria_array=explode(';',$criteria);
|
||||
foreach($criteria_array as $inter_criteria) {
|
||||
if (preg_match('/!/',$inter_criteria)) {
|
||||
$return_sql_not_like[]= '('.$column_to_test.' NOT LIKE \''.str_replace('!', '', $inter_criteria).'\')';
|
||||
} else {
|
||||
$return_sql_like[]= '('.$column_to_test.' LIKE \''.$inter_criteria.'\')';
|
||||
}
|
||||
}
|
||||
|
||||
if (count($return_sql_like)>0) {
|
||||
$return_sql_criteria .= '(' . implode (' OR ', $return_sql_like) .')';
|
||||
}
|
||||
if (count($return_sql_not_like)>0) {
|
||||
$return_sql_criteria .= ' AND (' . implode (' AND ', $return_sql_not_like).')';
|
||||
}
|
||||
|
||||
}else {
|
||||
$return_sql_criteria .= $column_to_test . ' LIKE \''.$this->db->escape($criteria).'\'';
|
||||
}
|
||||
|
||||
$return_sql_criteria .= ')';
|
||||
|
||||
return $return_sql_criteria;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
505
htdocs/comm/mailing/class/html.formadvtargetemailing.class.php
Normal file
505
htdocs/comm/mailing/class/html.formadvtargetemailing.class.php
Normal file
@ -0,0 +1,505 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file comm/mailing/class/html.formadvtragetemaling.class.php
|
||||
* \ingroup mailing
|
||||
* \brief Fichier de la classe des fonctions predefinie de composants html advtargetemaling
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class to manage building of HTML components
|
||||
*/
|
||||
class FormAdvTargetEmailing extends Form
|
||||
{
|
||||
var $db;
|
||||
var $error;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db handler
|
||||
*/
|
||||
function __construct($db) {
|
||||
global $langs;
|
||||
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche un champs select contenant une liste
|
||||
*
|
||||
* @param array $selected_array à preselectionner
|
||||
* @param string $htmlname select field
|
||||
* @return string select field
|
||||
*/
|
||||
function multiselectProspectionStatus($selected_array = array(), $htmlname = 'cust_prospect_status') {
|
||||
global $conf, $langs;
|
||||
$options_array = array ();
|
||||
|
||||
$sql = "SELECT code, label";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_prospectlevel";
|
||||
$sql .= " WHERE active > 0";
|
||||
$sql .= " ORDER BY sortorder";
|
||||
dol_syslog ( get_class ( $this ) . '::multiselectProspectionStatus sql=' . $sql, LOG_DEBUG );
|
||||
$resql = $this->db->query ( $sql );
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows ( $resql );
|
||||
$i = 0;
|
||||
while ( $i < $num ) {
|
||||
$obj = $this->db->fetch_object ( $resql );
|
||||
|
||||
$level = $langs->trans ( $obj->code );
|
||||
if ($level == $obj->code)
|
||||
$level = $langs->trans ( $obj->label );
|
||||
$options_array [$obj->code] = $level;
|
||||
|
||||
$i ++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error ( $this->db );
|
||||
}
|
||||
return $this->advMultiselectarray ( $htmlname, $options_array, $selected_array );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return combo list of activated countries, into language of user
|
||||
*
|
||||
* @param string $htmlname of html select object
|
||||
* @param array $selected_array or Code or Label of preselected country
|
||||
* @return string HTML string with select
|
||||
*/
|
||||
function multiselectCountry($htmlname = 'country_id', $selected_array=array()) {
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->load("dict");
|
||||
$maxlength = 0;
|
||||
|
||||
$out = '';
|
||||
$countryArray = array();
|
||||
$label = array ();
|
||||
|
||||
$options_array = array();
|
||||
|
||||
$sql = "SELECT rowid, code as code_iso, label";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_country";
|
||||
$sql .= " WHERE active = 1 AND code<>''";
|
||||
$sql .= " ORDER BY code ASC";
|
||||
|
||||
dol_syslog(get_class($this) . "::select_country sql=" . $sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
$foundselected = false;
|
||||
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object ( $resql );
|
||||
$countryArray [$i] ['rowid'] = $obj->rowid;
|
||||
$countryArray [$i] ['code_iso'] = $obj->code_iso;
|
||||
$countryArray [$i] ['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso ) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv ( "Country" . $obj->code_iso ) : ($obj->label != '-' ? $obj->label : ''));
|
||||
$label[$i] = $countryArray[$i]['label'];
|
||||
$i ++;
|
||||
}
|
||||
|
||||
array_multisort($label, SORT_ASC, $countryArray);
|
||||
|
||||
foreach ($countryArray as $row) {
|
||||
$label = dol_trunc($row['label'], $maxlength, 'middle');
|
||||
if ($row['code_iso'])
|
||||
$label .= ' (' . $row['code_iso'] . ')';
|
||||
|
||||
$options_array[$row['rowid']] = $label;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
return $this->advMultiselectarray($htmlname, $options_array, $selected_array);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return select list for categories (to use in form search selectors)
|
||||
*
|
||||
* @param string $htmlname control name
|
||||
* @param array $selected_array array of data
|
||||
* @param User $user User action
|
||||
* @return string combo list code
|
||||
*/
|
||||
function multiselectselectSalesRepresentatives($htmlname, $selected_array, $user) {
|
||||
|
||||
global $conf;
|
||||
|
||||
$options_array = array ();
|
||||
|
||||
$sql_usr = '';
|
||||
$sql_usr .= "SELECT DISTINCT u2.rowid, u2.lastname as name, u2.firstname, u2.login";
|
||||
$sql_usr .= " FROM " . MAIN_DB_PREFIX . "user as u2, " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
|
||||
$sql_usr .= " WHERE u2.entity IN (0," . $conf->entity . ")";
|
||||
$sql_usr .= " AND u2.rowid = sc.fk_user ";
|
||||
|
||||
if (! empty ( $conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX ))
|
||||
$sql_usr .= " AND u2.statut<>0 ";
|
||||
$sql_usr .= " ORDER BY name ASC";
|
||||
// print $sql_usr;exit;
|
||||
|
||||
$resql_usr = $this->db->query ( $sql_usr );
|
||||
if ($resql_usr) {
|
||||
while ( $obj_usr = $this->db->fetch_object ( $resql_usr ) ) {
|
||||
|
||||
$label = $obj_usr->firstname . " " . $obj_usr->name . " (" . $obj_usr->login . ')';
|
||||
|
||||
$options_array [$obj_usr->rowid] = $label;
|
||||
|
||||
}
|
||||
$this->db->free ( $resql_usr );
|
||||
} else {
|
||||
dol_print_error ( $this->db );
|
||||
}
|
||||
|
||||
return $this->advMultiselectarray ( $htmlname, $options_array, $selected_array );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return select list for categories (to use in form search selectors)
|
||||
*
|
||||
* @param string $htmlname of combo list (example: 'search_sale')
|
||||
* @param array $selected_array selected array
|
||||
* @return string combo list code
|
||||
*/
|
||||
function multiselectselectLanguage($htmlname='', $selected_array=array()) {
|
||||
|
||||
global $conf,$langs;
|
||||
|
||||
$options_array = array ();
|
||||
|
||||
$langs_available=$langs->get_available_languages(DOL_DOCUMENT_ROOT,12);
|
||||
|
||||
foreach ($langs_available as $key => $value)
|
||||
{
|
||||
$label = $value;
|
||||
$options_array[$key] = $label;
|
||||
}
|
||||
asort($options_array);
|
||||
return $this->advMultiselectarray($htmlname, $options_array, $selected_array);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return multiselect list of entities for extrafeild type sellist
|
||||
*
|
||||
* @param string $htmlname control name
|
||||
* @param array $sqlqueryparam array
|
||||
* @param array $selected_array array
|
||||
*
|
||||
* @return string HTML combo
|
||||
*/
|
||||
function advMultiselectarraySelllist($htmlname, $sqlqueryparam = array(), $selected_array = array()) {
|
||||
|
||||
if (is_array ( $sqlqueryparam )) {
|
||||
$options_array=array();
|
||||
|
||||
$param_list = array_keys ( $sqlqueryparam );
|
||||
$InfoFieldList = explode ( ":", $param_list [0] );
|
||||
|
||||
// 0 1 : tableName
|
||||
// 1 2 : label field name Nom du champ contenant le libelle
|
||||
// 2 3 : key fields name (if differ of rowid)
|
||||
// 3 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value
|
||||
|
||||
$keyList = 'rowid';
|
||||
|
||||
if (count ( $InfoFieldList ) >= 3) {
|
||||
if (strpos ( $InfoFieldList [3], 'extra.' ) !== false) {
|
||||
$keyList = 'main.' . $InfoFieldList [2] . ' as rowid';
|
||||
} else {
|
||||
$keyList = $InfoFieldList [2] . ' as rowid';
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'SELECT ' . $keyList . ', ' . $InfoFieldList [1];
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList [0];
|
||||
if (! empty ( $InfoFieldList [3] )) {
|
||||
|
||||
// We have to join on extrafield table
|
||||
if (strpos ( $InfoFieldList [3], 'extra' ) !== false) {
|
||||
$sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList [0] . '_extrafields as extra';
|
||||
$sql .= ' WHERE extra.fk_object=main.' . $InfoFieldList [2] . ' AND ' . $InfoFieldList [3];
|
||||
} else {
|
||||
$sql .= ' WHERE ' . $InfoFieldList [3];
|
||||
}
|
||||
}
|
||||
if (! empty($InfoFieldList[1])) {
|
||||
$sql .= " ORDER BY nom";
|
||||
}
|
||||
// $sql.= ' WHERE entity = '.$conf->entity;
|
||||
|
||||
$options_array = array();
|
||||
|
||||
dol_syslog(get_class($this) . "::".__METHOD__,LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ( $i < $num ) {
|
||||
$obj = $this->db->fetch_object ( $resql );
|
||||
$labeltoshow = dol_trunc ( $obj->$InfoFieldList [1], 90 );
|
||||
$options_array[$obj->rowid]=$labeltoshow;
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
$this->db->free ( $resql );
|
||||
}
|
||||
}
|
||||
|
||||
return $this->advMultiselectarray($htmlname, $options_array, $selected_array);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return combo list with people title
|
||||
*
|
||||
* @param string $htmlname Name of HTML select combo field
|
||||
* @param array $selected_array Array
|
||||
* @return string HTML combo
|
||||
*/
|
||||
function multiselectCivility($htmlname='civilite_id',$selected_array = array())
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
$langs->load("dict");
|
||||
|
||||
$options_array=array();
|
||||
|
||||
|
||||
$sql = "SELECT rowid, code, label as civilite, active FROM ".MAIN_DB_PREFIX."c_civility";
|
||||
$sql.= " WHERE active = 1";
|
||||
|
||||
dol_syslog(get_class($this)."::".__METHOD__,LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
|
||||
$label= ($langs->trans("Civility".$obj->code)!="Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->civilite!='-'?$obj->civilite:''));
|
||||
|
||||
|
||||
$options_array[$obj->code]=$label;
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
return $this->advMultiselectarray ( $htmlname, $options_array, $selected_array );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return multiselect list of entities.
|
||||
*
|
||||
* @param string $htmlname select
|
||||
* @param array $options_array to manage
|
||||
* @param array $selected_array to manage
|
||||
* @param int $showempty show empty
|
||||
* @return string HTML combo
|
||||
*/
|
||||
function advMultiselectarray($htmlname, $options_array = array(), $selected_array = array(), $showempty = 0) {
|
||||
global $conf, $langs;
|
||||
|
||||
$return = '';
|
||||
$return .= '<script type="text/javascript" language="javascript">
|
||||
$(document).ready(function() {
|
||||
$.extend($.ui.multiselect.locale, {
|
||||
addAll:\'' . $langs->transnoentities ( "AddAll" ) . '\',
|
||||
removeAll:\'' . $langs->transnoentities ( "RemoveAll" ) . '\',
|
||||
itemsCount:\'' . $langs->transnoentities ( "ItemsCount" ) . '\'
|
||||
});
|
||||
|
||||
$(function(){
|
||||
$("#' . $htmlname . '").addClass("' . $htmlname . '").attr("multiple","multiple").attr("name","' . $htmlname . '[]");
|
||||
$(".multiselect").multiselect({sortable: false, searchable: false});
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$return .= '<select id="' . $htmlname . '" class="multiselect" multiple="multiple" name="' . $htmlname . '[]" style="display: none;">';
|
||||
//$return .= '<select id="' . $htmlname . '" class="multiselect" multiple="multiple" name="' . $htmlname . '[]">';
|
||||
|
||||
if ($showempty)
|
||||
$return .= '<option value=""> </option>';
|
||||
|
||||
// Find if keys is in selected array value
|
||||
if (is_array($selected_array) && count($selected_array)>0) {
|
||||
$intersect_array = array_intersect_key($options_array, array_flip($selected_array));
|
||||
} else {
|
||||
$intersect_array=array();
|
||||
}
|
||||
|
||||
if (count($options_array) > 0) {
|
||||
foreach ($options_array as $keyoption => $valoption) {
|
||||
// If key is in intersect table then it have to e selected
|
||||
$selected = '';
|
||||
if (count ( $intersect_array ) > 0) {
|
||||
if (array_key_exists ( $keyoption, $intersect_array )) {
|
||||
$selected = ' selected="selected"';
|
||||
}
|
||||
}
|
||||
$return .= '<option' . $selected . ' value="' . $keyoption . '">' . $valoption . '</option>';
|
||||
}
|
||||
}
|
||||
|
||||
$return .= '</select>';
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return combo list with customer categories
|
||||
*
|
||||
* @param string $htmlname Name of categorie
|
||||
* @param array $selected_array value selected
|
||||
* @return string HTML combo
|
||||
*/
|
||||
function multiselectCustomerCategories($htmlname='cust_cat',$selected_array = array())
|
||||
{
|
||||
return $this->multiselectCategories($htmlname,$selected_array,2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return combo list with customer contact
|
||||
*
|
||||
* @param string $htmlname Name of categorie
|
||||
* @param array $selected_array value selected
|
||||
* @return string HTML combo
|
||||
*/
|
||||
function multiselectContactCategories($htmlname='contact_cat',$selected_array = array())
|
||||
{
|
||||
return $this->multiselectCategories($htmlname,$selected_array,4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return combo list of categories
|
||||
*
|
||||
* @param string $htmlname Name of categorie
|
||||
* @param array $selected_array value selected
|
||||
* @param int $type type
|
||||
* @return string HTML combo
|
||||
*/
|
||||
public function multiselectCategories($htmlname='',$selected_array = array(), $type=0)
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
$langs->load("dict");
|
||||
|
||||
$options_array=array();
|
||||
|
||||
$sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."categorie";
|
||||
$sql.= " WHERE type=".$type;
|
||||
|
||||
dol_syslog(get_class($this)."::".__METHOD__,LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$options_array[$obj->rowid]=$obj->label;
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
return $this->advMultiselectarray ( $htmlname, $options_array, $selected_array );
|
||||
}
|
||||
|
||||
/**
|
||||
* selectAdvtargetemailingTemplate
|
||||
*
|
||||
* @param string $htmlname control name
|
||||
* @param integer $selected defaut selected
|
||||
* @param integer $showempty empty lines
|
||||
*
|
||||
* @return string HTML combo
|
||||
*/
|
||||
public function selectAdvtargetemailingTemplate($htmlname='template_id',$selected=0,$showempty=0) {
|
||||
global $conf, $user, $langs;
|
||||
|
||||
$out = '';
|
||||
|
||||
$sql = "SELECT c.rowid, c.name, c.fk_mailing";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "advtargetemailing as c";
|
||||
$sql .= " ORDER BY c.name";
|
||||
|
||||
dol_syslog ( get_class ( $this ) . "::".__METHOD__, LOG_DEBUG );
|
||||
$resql = $this->db->query ( $sql );
|
||||
if ($resql) {
|
||||
|
||||
|
||||
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
|
||||
if ($showempty)
|
||||
$out .= '<option value=""></option>';
|
||||
$num = $this->db->num_rows ( $resql );
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ( $i < $num ) {
|
||||
$obj = $this->db->fetch_object ( $resql );
|
||||
$label = $obj->name;
|
||||
if (empty($label)) {
|
||||
$label=$obj->fk_mailing;
|
||||
}
|
||||
|
||||
if ($selected > 0 && $selected == $obj->rowid) {
|
||||
$out .= '<option value="' . $obj->rowid . '" selected="selected">' . $label . '</option>';
|
||||
} else {
|
||||
$out .= '<option value="' . $obj->rowid . '">' . $label . '</option>';
|
||||
}
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
$out .= '</select>';
|
||||
} else {
|
||||
dol_print_error ( $this->db );
|
||||
}
|
||||
$this->db->free ( $resql );
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
@ -780,7 +780,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function create($user, $notrigger=0)
|
||||
{
|
||||
global $langs,$conf,$mysoc,$hookmanager;
|
||||
global $conf,$hookmanager;
|
||||
$error=0;
|
||||
|
||||
$now=dol_now();
|
||||
@ -1080,7 +1080,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function createFromClone($socid=0)
|
||||
{
|
||||
global $db, $user,$langs,$conf,$hookmanager;
|
||||
global $user,$conf,$hookmanager;
|
||||
|
||||
dol_include_once('/projet/class/project.class.php');
|
||||
|
||||
@ -1214,7 +1214,6 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function fetch($rowid,$ref='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
|
||||
$sql.= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht";
|
||||
@ -1508,7 +1507,7 @@ class Propal extends CommonObject
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
global $conf,$langs;
|
||||
global $conf;
|
||||
|
||||
$error=0;
|
||||
$now=dol_now();
|
||||
@ -1868,7 +1867,6 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function reopen($user, $statut, $note='', $notrigger=0)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
$this->statut = $statut;
|
||||
$error=0;
|
||||
@ -1979,7 +1977,7 @@ class Propal extends CommonObject
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
//$ret=$object->fetch($id); // Reload to get new records
|
||||
$this->generateDocument($modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
$this->generateDocument($modelpdf, $outputlangs);
|
||||
}
|
||||
|
||||
// Call trigger
|
||||
@ -2082,7 +2080,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function liste_array($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datep', $sortorder='DESC')
|
||||
{
|
||||
global $conf,$user;
|
||||
global $user;
|
||||
|
||||
$ga = array();
|
||||
|
||||
@ -2247,7 +2245,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function delete($user, $notrigger=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
global $conf;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$error=0;
|
||||
@ -2610,7 +2608,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function initAsSpecimen()
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
global $langs;
|
||||
|
||||
// Charge tableau des produits prodids
|
||||
$prodids = array();
|
||||
@ -2696,7 +2694,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function load_state_board()
|
||||
{
|
||||
global $conf, $user;
|
||||
global $user;
|
||||
|
||||
$this->nb=array();
|
||||
$clause = "WHERE";
|
||||
@ -2741,7 +2739,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function getNextNumRef($soc)
|
||||
{
|
||||
global $conf, $db, $langs;
|
||||
global $conf,$langs;
|
||||
$langs->load("propal");
|
||||
|
||||
if (! empty($conf->global->PROPALE_ADDON))
|
||||
@ -2942,7 +2940,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
global $conf,$langs;
|
||||
|
||||
$langs->load("propale");
|
||||
|
||||
@ -3196,7 +3194,7 @@ class PropaleLigne extends CommonObjectLine
|
||||
*/
|
||||
function insert($notrigger=0)
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
global $conf,$user;
|
||||
|
||||
$error=0;
|
||||
|
||||
@ -3332,7 +3330,7 @@ class PropaleLigne extends CommonObjectLine
|
||||
*/
|
||||
function delete()
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
global $conf,$user;
|
||||
|
||||
$error=0;
|
||||
$this->db->begin();
|
||||
@ -3383,7 +3381,7 @@ class PropaleLigne extends CommonObjectLine
|
||||
*/
|
||||
function update($notrigger=0)
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
global $conf,$user;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
@ -207,9 +207,9 @@ class CommandeApi extends DolibarrApi
|
||||
*/
|
||||
function post($request_data = NULL)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401, "Insuffisant rights");
|
||||
}
|
||||
// Check mandatory fields
|
||||
$result = $this->_validate($request_data);
|
||||
|
||||
@ -224,7 +224,7 @@ class CommandeApi extends DolibarrApi
|
||||
$this->commande->lines = $lines;
|
||||
}
|
||||
if(! $this->commande->create(DolibarrApiAccess::$user) ) {
|
||||
throw new RestException(401);
|
||||
throw new RestException(500, "Error while creating order");
|
||||
}
|
||||
|
||||
return $this->commande->id;
|
||||
|
||||
@ -3,12 +3,13 @@
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -203,7 +204,7 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
function getNextNumRef($soc)
|
||||
{
|
||||
global $db, $langs, $conf;
|
||||
global $langs, $conf;
|
||||
$langs->load("order");
|
||||
|
||||
if (! empty($conf->global->COMMANDE_ADDON))
|
||||
@ -238,7 +239,7 @@ class Commande extends CommonOrder
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error);
|
||||
dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@ -499,7 +500,6 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
function set_reopen($user)
|
||||
{
|
||||
global $conf,$langs;
|
||||
$error=0;
|
||||
|
||||
if ($this->statut != self::STATUS_CANCELED && $this->statut != self::STATUS_CLOSED)
|
||||
@ -559,7 +559,7 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
function cloture($user)
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
@ -696,7 +696,7 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
function create($user, $notrigger=0)
|
||||
{
|
||||
global $conf,$langs,$mysoc,$hookmanager;
|
||||
global $conf,$langs;
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
@ -970,7 +970,7 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
function createFromClone($socid=0)
|
||||
{
|
||||
global $conf,$user,$langs,$hookmanager;
|
||||
global $user,$hookmanager;
|
||||
|
||||
$error=0;
|
||||
|
||||
@ -1060,7 +1060,7 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
function createFromProposal($object)
|
||||
{
|
||||
global $db, $conf,$user,$langs,$hookmanager;
|
||||
global $conf,$user,$hookmanager;
|
||||
|
||||
dol_include_once('/core/class/extrafields.class.php');
|
||||
|
||||
@ -1133,7 +1133,7 @@ class Commande extends CommonOrder
|
||||
// get extrafields from original line
|
||||
$object->fetch_optionals($object->id);
|
||||
|
||||
$e = new ExtraFields($db);
|
||||
$e = new ExtraFields($this->db);
|
||||
$element_extrafields = $e->fetch_name_optionals_label($this->element);
|
||||
|
||||
foreach($object->array_options as $options_key => $value) {
|
||||
@ -1494,7 +1494,6 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
function fetch($id, $ref='', $ref_ext='', $ref_int='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Check parameters
|
||||
if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
|
||||
@ -1850,10 +1849,9 @@ class Commande extends CommonOrder
|
||||
* Note: For a dedicated shipment, the fetch_lines load the qty_asked and qty_shipped. This function return qty_shipped cuulated for order
|
||||
*
|
||||
* @param int $filtre_statut Filter on status
|
||||
* @param int $fk_product Filter on a product
|
||||
* @return int <0 if KO, Nb of lines found if OK
|
||||
*/
|
||||
function loadExpeditions($filtre_statut=-1, $fk_product=0)
|
||||
function loadExpeditions($filtre_statut=-1)
|
||||
{
|
||||
$this->expeditions = array();
|
||||
|
||||
@ -1982,7 +1980,6 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
function deleteline($lineid)
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ($this->statut == self::STATUS_DRAFT)
|
||||
{
|
||||
@ -2261,7 +2258,7 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
function liste_array($shortlist=0, $draft=0, $excluser='', $socid=0, $limit=0, $offset=0, $sortfield='c.date_commande', $sortorder='DESC')
|
||||
{
|
||||
global $conf,$user;
|
||||
global $user;
|
||||
|
||||
$ga = array();
|
||||
|
||||
@ -2429,7 +2426,7 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
function classifyBilled(User $user)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
global $user;
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
@ -2516,7 +2513,7 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0,$txlocaltax2=0.0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $fk_unit=null)
|
||||
{
|
||||
global $conf, $mysoc;
|
||||
global $conf, $mysoc, $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::updateline id=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, date_start=$date_start, date_end=$date_end, type=$type, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, special_code=$special_code");
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
@ -2585,6 +2582,26 @@ class Commande extends CommonOrder
|
||||
$line = new OrderLine($this->db);
|
||||
$line->fetch($rowid);
|
||||
|
||||
if (!empty($line->fk_product))
|
||||
{
|
||||
$product=new Product($this->db);
|
||||
$result=$product->fetch($line->fk_product);
|
||||
$product_type=$product->type;
|
||||
|
||||
if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty)
|
||||
{
|
||||
$this->error=$langs->trans('ErrorStockIsNotEnough');
|
||||
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
unset($_POST['productid']);
|
||||
unset($_POST['tva_tx']);
|
||||
unset($_POST['price_ht']);
|
||||
unset($_POST['qty']);
|
||||
unset($_POST['buying_price']);
|
||||
return self::STOCK_NOT_ENOUGH_FOR_ORDER;
|
||||
}
|
||||
}
|
||||
|
||||
$staticline = clone $line;
|
||||
|
||||
$line->oldline = $staticline;
|
||||
@ -2677,7 +2694,6 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
function update($user=null, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
@ -3184,7 +3200,7 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
function initAsSpecimen()
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
global $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::initAsSpecimen");
|
||||
|
||||
@ -3266,7 +3282,7 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
function load_state_board()
|
||||
{
|
||||
global $conf, $user;
|
||||
global $user;
|
||||
|
||||
$this->nb=array();
|
||||
$clause = "WHERE";
|
||||
|
||||
@ -216,6 +216,11 @@ if (! empty($conf->commande->enabled))
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td colspan="3">'.$langs->trans("NoOrder").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -127,7 +127,7 @@ $arrayfields=array(
|
||||
'c.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'c.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
'c.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||
'e.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)))
|
||||
'c.facture'=>array('label'=>$langs->trans("Billed"), 'checked'=>1, 'position'=>1000, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)))
|
||||
);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
@ -673,6 +673,12 @@ if ($resql)
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
$notshippable=0;
|
||||
$warning = 0;
|
||||
$text_info='';
|
||||
$text_warning='';
|
||||
$nbprod=0;
|
||||
|
||||
if (! empty($arrayfields['c.ref']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
@ -694,17 +700,11 @@ if ($resql)
|
||||
print '</td>';
|
||||
|
||||
// Show shippable Icon (create subloop, so may be slow)
|
||||
if ($conf->stock->enabled)
|
||||
if ($conf->stock->enabled)
|
||||
{
|
||||
$langs->load("stocks");
|
||||
if (($obj->fk_statut > 0) && ($obj->fk_statut < 3))
|
||||
{
|
||||
$notshippable=0;
|
||||
$warning = 0;
|
||||
$text_info='';
|
||||
$text_warning='';
|
||||
$nbprod=0;
|
||||
|
||||
$langs->load("stocks");
|
||||
if (($obj->fk_statut > 0) && ($obj->fk_statut < 3))
|
||||
{
|
||||
$numlines = count($generic_commande->lines); // Loop on each line of order
|
||||
for ($lig=0; $lig < $numlines; $lig++)
|
||||
{
|
||||
@ -712,17 +712,19 @@ if ($resql)
|
||||
{
|
||||
$nbprod++; // order contains real products
|
||||
$generic_product->id = $generic_commande->lines[$lig]->fk_product;
|
||||
|
||||
// Get local and virtual stock and store it into cache
|
||||
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) {
|
||||
$generic_product->load_stock();
|
||||
$generic_product->load_virtual_stock();
|
||||
$generic_product->load_stock('nobatch');
|
||||
//$generic_product->load_virtual_stock(); Already included into load_stock
|
||||
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel;
|
||||
$productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique;
|
||||
} else {
|
||||
$generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'];
|
||||
$generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique;
|
||||
}
|
||||
|
||||
if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) // Default code is when this option is not set, setting it create strange result
|
||||
|
||||
if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) // Default code. Default is when this option is not set, setting it create strange result
|
||||
{
|
||||
$text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 25);
|
||||
$text_info .= ' - '.$langs->trans("Stock").': '.$generic_product->stock_reel;
|
||||
@ -795,7 +797,7 @@ if ($resql)
|
||||
{
|
||||
print $form->textwithtooltip('',$text_info,2,1,$text_icon,'',2);
|
||||
}
|
||||
if ($warning) {
|
||||
if ($warning) { // Always false in default mode
|
||||
print $form->textwithtooltip('', $langs->trans('NotEnoughForAllOrders').'<br>'.$text_warning, 2, 1, img_picto('', 'error'),'',2);
|
||||
}
|
||||
print '</td>';
|
||||
@ -989,6 +991,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['c.facture']['checked']))
|
||||
{
|
||||
print '<td align="center">'.yn($obj->billed).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Action column
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
@ -34,8 +34,9 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formbank.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/lib/accounting.lib.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
||||
if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||
|
||||
$langs->load("banks");
|
||||
$langs->load("bills");
|
||||
@ -131,6 +132,10 @@ if ($_POST["action"] == 'add')
|
||||
$id = $account->create($user);
|
||||
if ($id > 0)
|
||||
{
|
||||
// Category association
|
||||
$categories = GETPOST('categories');
|
||||
$account->setCategories($categories);
|
||||
|
||||
$_GET["id"]=$id; // Force chargement page en mode visu
|
||||
}
|
||||
else {
|
||||
@ -207,6 +212,10 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
||||
$result = $account->update($user);
|
||||
if ($result >= 0)
|
||||
{
|
||||
// Category association
|
||||
$categories = GETPOST('categories');
|
||||
$account->setCategories($categories);
|
||||
|
||||
$_GET["id"]=$_POST["id"]; // Force chargement page en mode visu
|
||||
}
|
||||
else
|
||||
@ -337,6 +346,20 @@ if ($action == 'create')
|
||||
print '<tr><td>'.$langs->trans("Web").'</td>';
|
||||
print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.$_POST["url"].'"></td></tr>';
|
||||
|
||||
// Tags-Categories
|
||||
if ($conf->categorie->enabled)
|
||||
{
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
|
||||
$c = new Categorie($db);
|
||||
$cats = $c->containing($account->id,Categorie::TYPE_ACCOUNT);
|
||||
foreach($cats as $cat) {
|
||||
$arrayselected[] = $cat->id;
|
||||
}
|
||||
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
// Comment
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
|
||||
print '<td colspan="3">';
|
||||
@ -591,6 +614,13 @@ else
|
||||
if ($account->url) print '</a>';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Categories
|
||||
if($conf->categorie->enabled) {
|
||||
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||
print $form->showCategories($account->id,'account',1);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
|
||||
print '<td colspan="3">'.dol_htmlentitiesbr($account->comment).'</td></tr>';
|
||||
|
||||
@ -675,7 +705,13 @@ else
|
||||
print '<table class="border" width="100%">';
|
||||
// Accountancy code
|
||||
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3">'.length_accountg($account->account_number).'</td></tr>';
|
||||
print '<td colspan="3">';
|
||||
if (! empty($conf->accounting->enabled)) {
|
||||
print length_accountg($account->account_number).'</td></tr>';
|
||||
} else {
|
||||
print $account->account_number;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy journal
|
||||
if (! empty($conf->accounting->enabled))
|
||||
@ -828,6 +864,20 @@ else
|
||||
print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.(isset($_POST["url"])?$_POST["url"]:$account->url).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Tags-Categories
|
||||
if ($conf->categorie->enabled)
|
||||
{
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
|
||||
$c = new Categorie($db);
|
||||
$cats = $c->containing($object->id,Categorie::TYPE_ACCOUNT);
|
||||
foreach($cats as $cat) {
|
||||
$arrayselected[] = $cat->id;
|
||||
}
|
||||
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
// Comment
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
|
||||
print '<td colspan="3">';
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -588,7 +589,7 @@ class Account extends CommonObject
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."bank_account");
|
||||
|
||||
$result=$this->update();
|
||||
$result=$this->update($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$accline = new AccountLine($this->db);
|
||||
@ -892,6 +893,49 @@ class Account extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets object to supplied categories.
|
||||
*
|
||||
* Deletes object from existing categories not supplied.
|
||||
* Adds it to non existing supplied categories.
|
||||
* Existing categories are left untouch.
|
||||
*
|
||||
* @param int[]|int $categories Category or categories IDs
|
||||
*/
|
||||
public function setCategories($categories) {
|
||||
// Handle single category
|
||||
if (! is_array($categories)) {
|
||||
$categories = array($categories);
|
||||
}
|
||||
|
||||
// Get current categories
|
||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||
$c = new Categorie($this->db);
|
||||
$existing = $c->containing($this->id, Categorie::TYPE_ACCOUNT, 'id');
|
||||
|
||||
// Diff
|
||||
if (is_array($existing)) {
|
||||
$to_del = array_diff($existing, $categories);
|
||||
$to_add = array_diff($categories, $existing);
|
||||
} else {
|
||||
$to_del = array(); // Nothing to delete
|
||||
$to_add = $categories;
|
||||
}
|
||||
|
||||
// Process
|
||||
foreach($to_del as $del) {
|
||||
if ($c->fetch($del) > 0) {
|
||||
$c->del_type($this, 'account');
|
||||
}
|
||||
}
|
||||
foreach ($to_add as $add) {
|
||||
if ($c->fetch($add) > 0) {
|
||||
$c->add_type($this, 'account');
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete bank account from database
|
||||
@ -1100,15 +1144,19 @@ class Account extends CommonObject
|
||||
*/
|
||||
public static function countAccountToReconcile()
|
||||
{
|
||||
global $db, $conf, $langs;
|
||||
|
||||
if ($user->societe_id) return 0; // protection pour eviter appel par utilisateur externe
|
||||
global $db, $conf, $user;
|
||||
|
||||
//Protection against external users
|
||||
if ($user->societe_id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$nb=0;
|
||||
|
||||
$sql = "SELECT COUNT(ba.rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= " WHERE ba.rappro > 0 and ba.clos = 0";
|
||||
$sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")";
|
||||
if (empty($conf->global->BANK_CAN_RECONCILIATE_CASHACCOUNT)) $sql.= " AND ba.courant != 2";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -136,7 +136,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
|
||||
print '</tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr class="liste_total">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="left" colspan="5">'.$langs->trans("RemainderToPay").'</td>';
|
||||
print '<td align="right" class="nowrap"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
@ -83,6 +83,7 @@ $search_montant_ht = GETPOST('search_montant_ht', 'alpha');
|
||||
$search_montant_ttc = GETPOST('search_montant_ttc', 'alpha');
|
||||
$origin = GETPOST('origin', 'alpha');
|
||||
$originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility
|
||||
$fac_rec=GETPOST('fac_rec','int');
|
||||
|
||||
// PDF
|
||||
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
||||
@ -2082,8 +2083,9 @@ if ($action == 'create')
|
||||
$(document).ready(function() {
|
||||
$("#socid").change(function() {
|
||||
var socid = $(this).val();
|
||||
var fac_rec = $(\'#fac_rec\').val();
|
||||
// reload page
|
||||
window.location.href = "'.$_SERVER["PHP_SELF"].'?action=create&socid="+socid;
|
||||
window.location.href = "'.$_SERVER["PHP_SELF"].'?action=create&socid="+socid+"&fac_rec="+fac_rec;
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
@ -2098,6 +2100,8 @@ if ($action == 'create')
|
||||
$invoice_predefined = new FactureRec($db);
|
||||
$invoice_predefined->fetch(GETPOST('fac_rec','int'));
|
||||
|
||||
$dateinvoice = $invoice_predefined->date_when; // To use next gen date by default later
|
||||
|
||||
$sql = 'SELECT r.rowid, r.titre, r.total_ttc';
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as r';
|
||||
$sql .= ' WHERE r.fk_soc = ' . $invoice_predefined->socid;
|
||||
@ -2111,7 +2115,7 @@ if ($action == 'create')
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<tr><td>' . $langs->trans('CreateFromRepeatableInvoice') . '</td><td>';
|
||||
print '<select class="flat" name="fac_rec">';
|
||||
print '<select class="flat" id="fac_rec" name="fac_rec">';
|
||||
print '<option value="0" selected></option>';
|
||||
while ($i < $num)
|
||||
{
|
||||
@ -2122,7 +2126,22 @@ if ($action == 'create')
|
||||
print '>' . $objp->titre . ' (' . price($objp->total_ttc) . ' ' . $langs->trans("TTC") . ')</option>';
|
||||
$i ++;
|
||||
}
|
||||
print '</select></td></tr>';
|
||||
print '</select>';
|
||||
// Option to reload page to retrieve customer informations. Note, this clear other input
|
||||
if (!empty($conf->global->RELOAD_PAGE_ON_TEMPLATE_CHANGE))
|
||||
{
|
||||
print '<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#fac_rec").change(function() {
|
||||
var fac_rec = $(this).val();
|
||||
var socid = $(\'#socid\').val();
|
||||
// reload page
|
||||
window.location.href = "'.$_SERVER["PHP_SELF"].'?action=create&socid="+socid+"&fac_rec="+fac_rec;
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
@ -2402,7 +2421,7 @@ if ($action == 'create')
|
||||
$langs->load('projects');
|
||||
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">';
|
||||
$numprojet = $formproject->select_projects($socid, $projectid, 'projectid', 0);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id.($fac_rec?'&fac_rec='.$fac_rec:'')).'">' . $langs->trans("AddProject") . '</a>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -3548,7 +3567,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('BankAccount');
|
||||
print '<td>';
|
||||
if (($action != 'editbankaccount') && $user->rights->commande->creer && ! empty($object->brouillon))
|
||||
if (($action != 'editbankaccount') && $user->rights->facture->creer && ! empty($object->brouillon))
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
|
||||
@ -53,7 +53,7 @@ class FactureRec extends CommonInvoice
|
||||
var $propalid;
|
||||
|
||||
var $date_last_gen;
|
||||
var $next_gen;
|
||||
var $date_when;
|
||||
var $nb_gen_done;
|
||||
var $nb_gen_max;
|
||||
|
||||
@ -341,6 +341,17 @@ class FactureRec extends CommonInvoice
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create an array of invoice lines
|
||||
*
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function getLinesArray()
|
||||
{
|
||||
return $this->fetch_lines();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Recupere les lignes de factures predefinies dans this->lines
|
||||
*
|
||||
@ -348,16 +359,23 @@ class FactureRec extends CommonInvoice
|
||||
*/
|
||||
function fetch_lines()
|
||||
{
|
||||
$this->lines=array();
|
||||
|
||||
$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.tva_tx, ';
|
||||
$sql.= ' l.remise, l.remise_percent, l.subprice,';
|
||||
$sql.= ' l.total_ht, l.total_tva, l.total_ttc,';
|
||||
$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_ttc,';
|
||||
//$sql.= ' l.situation_percent, l.fk_prev_id,';
|
||||
//$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,';
|
||||
$sql.= ' l.rang, l.special_code,';
|
||||
//$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_localtax1, l.total_localtax2, l.total_ttc, l.fk_code_ventilation, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,';
|
||||
$sql.= ' l.fk_unit, l.fk_contract_line,';
|
||||
//$sql.= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,';
|
||||
$sql.= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet_rec as l';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
|
||||
$sql.= ' WHERE l.fk_facture = '.$this->id;
|
||||
|
||||
$sql.= ' ORDER BY l.rang';
|
||||
|
||||
dol_syslog('FactureRec::fetch_lines', LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
@ -387,10 +405,6 @@ class FactureRec extends CommonInvoice
|
||||
$line->remise_percent = $objp->remise_percent;
|
||||
$line->fk_remise_except = $objp->fk_remise_except;
|
||||
$line->fk_product = $objp->fk_product;
|
||||
$line->date_start = $objp->date_start;
|
||||
$line->date_end = $objp->date_end;
|
||||
$line->date_start = $objp->date_start;
|
||||
$line->date_end = $objp->date_end;
|
||||
$line->info_bits = $objp->info_bits;
|
||||
$line->total_ht = $objp->total_ht;
|
||||
$line->total_tva = $objp->total_tva;
|
||||
@ -415,7 +429,7 @@ class FactureRec extends CommonInvoice
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error=$this->db-lasterror();
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,13 +7,14 @@
|
||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -280,24 +281,27 @@ class Facture extends CommonInvoice
|
||||
|
||||
$this->socid = $_facrec->socid;
|
||||
|
||||
// Fields coming from GUI (priority on template). TODO Value of template should be used as default value on GUI so we can use here always value from GUI
|
||||
$this->fk_project = GETPOST('projectid','int') > 0 ? GETPOST('projectid','int') : $_facrec->fk_project;
|
||||
$this->fk_account = $_facrec->fk_account;
|
||||
$this->cond_reglement_id = $_facrec->cond_reglement_id;
|
||||
$this->mode_reglement_id = $_facrec->mode_reglement_id;
|
||||
$this->note_public = GETPOST('note_public') ? GETPOST('note_public') : $_facrec->note_public;
|
||||
$this->note_private = GETPOST('note_private') ? GETPOST('note_private') : $_facrec->note_private;
|
||||
$this->modelpdf = GETPOST('model') ? GETPOST('model') : $_facrec->modelpdf;
|
||||
$this->cond_reglement_id = GETPOST('cond_reglement_id') > 0 ? GETPOST('cond_reglement_id') : $_facrec->cond_reglement_id;
|
||||
$this->mode_reglement_id = GETPOST('mode_reglement_id') > 0 ? GETPOST('mode_reglement_id') : $_facrec->mode_reglement_id;
|
||||
$this->fk_account = GETPOST('fk_account') > 0 ? GETPOST('fk_account') : $_facrec->fk_account;
|
||||
|
||||
// Fields always coming from template
|
||||
$this->remise_absolue = $_facrec->remise_absolue;
|
||||
$this->remise_percent = $_facrec->remise_percent;
|
||||
$this->fk_incoterms = $_facrec->fk_incoterms;
|
||||
$this->location_incoterms= $_facrec->location_incoterms;
|
||||
|
||||
$this->note_public = $_facrec->note_public;
|
||||
$this->note_private = $_facrec->note_private;
|
||||
|
||||
// Clean parameters
|
||||
if (! $this->type) $this->type = self::TYPE_STANDARD;
|
||||
$this->ref_client=trim($this->ref_client);
|
||||
$this->note_public=trim($this->note_public);
|
||||
$this->note_private=trim($this->note_private);
|
||||
$this->note_private=dol_concatdesc($facture->note_private, $langs->trans("GeneratedFromRecurringInvoice", $_facrec->ref));
|
||||
$this->note_private=dol_concatdesc($this->note_private, $langs->trans("GeneratedFromRecurringInvoice", $_facrec->ref));
|
||||
|
||||
//if (! $this->remise) $this->remise = 0;
|
||||
if (! $this->mode_reglement_id) $this->mode_reglement_id = 0;
|
||||
@ -730,7 +734,7 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
function createFromClone($socid=0)
|
||||
{
|
||||
global $conf,$user,$langs,$hookmanager;
|
||||
global $user,$hookmanager;
|
||||
|
||||
$error=0;
|
||||
|
||||
@ -845,7 +849,7 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
function createFromOrder($object)
|
||||
{
|
||||
global $conf,$user,$langs,$hookmanager;
|
||||
global $user,$hookmanager;
|
||||
|
||||
$error=0;
|
||||
|
||||
@ -1285,7 +1289,6 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
function update($user=null, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
@ -1678,7 +1681,6 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
function set_paid($user,$close_code='',$close_note='')
|
||||
{
|
||||
global $conf,$langs;
|
||||
$error=0;
|
||||
|
||||
if ($this->paye != 1)
|
||||
@ -1736,7 +1738,6 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
function set_unpaid($user)
|
||||
{
|
||||
global $conf,$langs;
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
@ -1786,9 +1787,6 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
function set_canceled($user,$close_code='',$close_note='')
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$error=0;
|
||||
|
||||
dol_syslog(get_class($this)."::set_canceled rowid=".$this->id, LOG_DEBUG);
|
||||
|
||||
@ -2459,6 +2457,7 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=0, $fk_unit = null)
|
||||
{
|
||||
global $conf,$user;
|
||||
// Deprecation warning
|
||||
if ($label) {
|
||||
dol_syslog(__METHOD__ . ": using line label is deprecated", LOG_WARNING);
|
||||
@ -2537,6 +2536,19 @@ class Facture extends CommonInvoice
|
||||
$line = new FactureLigne($this->db);
|
||||
$line->fetch($rowid);
|
||||
|
||||
if (!empty($line->fk_product))
|
||||
{
|
||||
$product=new Product($this->db);
|
||||
$result=$product->fetch($line->fk_product);
|
||||
$product_type=$product->type;
|
||||
|
||||
if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE) && $product_type == 0 && $product->stock_reel < $qty) {
|
||||
$this->error=$langs->trans('ErrorStockIsNotEnough');
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
|
||||
$staticline = clone $line;
|
||||
|
||||
$line->oldline = $staticline;
|
||||
@ -2589,7 +2601,7 @@ class Facture extends CommonInvoice
|
||||
$this->line->array_options=$array_options;
|
||||
}
|
||||
|
||||
$result=$this->line->update();
|
||||
$result=$this->line->update($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Reorder if child line
|
||||
@ -2650,7 +2662,7 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
function update_percent($line, $percent)
|
||||
{
|
||||
global $mysoc;
|
||||
global $mysoc,$user;
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php');
|
||||
|
||||
@ -2663,7 +2675,7 @@ class Facture extends CommonInvoice
|
||||
$line->total_ttc = $tabprice[2];
|
||||
$line->total_localtax1 = $tabprice[9];
|
||||
$line->total_localtax2 = $tabprice[10];
|
||||
$line->update();
|
||||
$line->update($user);
|
||||
$this->update_price(1);
|
||||
$this->db->commit();
|
||||
}
|
||||
@ -2676,7 +2688,6 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
function deleteline($rowid)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
dol_syslog(get_class($this)."::deleteline rowid=".$rowid, LOG_DEBUG);
|
||||
|
||||
@ -2914,7 +2925,7 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
function getNextNumRef($soc,$mode='next')
|
||||
{
|
||||
global $conf, $db, $langs;
|
||||
global $conf, $langs;
|
||||
$langs->load("bills");
|
||||
|
||||
// Clean parameters (if not defined or using deprecated value)
|
||||
@ -2976,7 +2987,7 @@ class Facture extends CommonInvoice
|
||||
* set up mask.
|
||||
*/
|
||||
if ($mode != 'last' && !$numref) {
|
||||
dol_print_error($db,"Facture::getNextNumRef ".$obj->error);
|
||||
dol_print_error($this->db,"Facture::getNextNumRef ".$obj->error);
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -3290,7 +3301,6 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
function demande_prelevement($fuser, $amount=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$error=0;
|
||||
|
||||
@ -3510,7 +3520,7 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
function initAsSpecimen($option='')
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
global $langs;
|
||||
|
||||
$now=dol_now();
|
||||
$arraynow=dol_getdate($now);
|
||||
@ -3695,7 +3705,7 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
global $conf,$langs;
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
@ -3795,7 +3805,6 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
function setFinal()
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -4259,7 +4268,7 @@ class FactureLigne extends CommonInvoiceLine
|
||||
*/
|
||||
function update($user='',$notrigger=0)
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
global $user,$conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
@ -4385,9 +4394,7 @@ class FactureLigne extends CommonInvoiceLine
|
||||
*/
|
||||
function delete()
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
|
||||
$error=0;
|
||||
global $user;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
|
||||
$langs->load('bills');
|
||||
$langs->load('compta');
|
||||
@ -50,18 +51,29 @@ if ($action == "create" || $action == "add") $objecttype = '';
|
||||
$result = restrictedArea($user, 'facture', $id, $objecttype);
|
||||
$projectid = GETPOST('projectid','int');
|
||||
|
||||
if ($page == -1)
|
||||
{
|
||||
$page = 0 ;
|
||||
}
|
||||
$search_ref=GETPOST('search_ref');
|
||||
$search_societe=GETPOST('search_societe');
|
||||
$search_montant_ht=GETPOST('search_montant_ht');
|
||||
$search_montant_vat=GETPOST('search_montant_vat');
|
||||
$search_montant_ttc=GETPOST('search_montant_ttc');
|
||||
$day=GETPOST('day');
|
||||
$year=GETPOST('year');
|
||||
$month=GETPOST('month');
|
||||
$day_date_when=GETPOST('day_date_when');
|
||||
$year_date_when=GETPOST('year_date_when');
|
||||
$month_date_when=GETPOST('month_date_when');
|
||||
$search_frequency=GETPOST('search_frequency');
|
||||
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
if ($sortorder == "")
|
||||
$sortorder="DESC";
|
||||
|
||||
if ($sortfield == "")
|
||||
$sortfield="f.datef";
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
if (! $sortfield) $sortfield='f.titre';
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$object = new FactureRec($db);
|
||||
if (($id > 0 || $ref) && $action != 'create' && $action != 'add')
|
||||
@ -73,13 +85,45 @@ if (($id > 0 || $ref) && $action != 'create' && $action != 'add')
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('invoicecard','globalcard'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('facturerec');
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
$permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink=$user->rights->facture->creer; // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoedit = $user->rights->facture->creer; // Used by the include of actions_lineupdonw.inc.php
|
||||
|
||||
$arrayfields=array(
|
||||
'f.titre'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
|
||||
'f.total'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
|
||||
'f.tva'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>1),
|
||||
'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>1),
|
||||
'f.frequency'=>array('label'=>$langs->trans("RecurringInvoiceTemplate"), 'checked'=>1),
|
||||
'f.date_last_gen'=>array('label'=>$langs->trans("DateLastGeneration"), 'checked'=>1),
|
||||
'f.date_when'=>array('label'=>$langs->trans("NextDateToExecution"), 'checked'=>1),
|
||||
'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Set note
|
||||
$permissionnote=$user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
||||
@ -101,7 +145,7 @@ if ($action == 'add')
|
||||
$rehour=GETPOST('rehour');
|
||||
$remin=GETPOST('remin');
|
||||
$nb_gen_max=GETPOST('nb_gen_max', 'int');
|
||||
if (empty($nb_gen_max)) $nb_gen_max =0;
|
||||
//if (empty($nb_gen_max)) $nb_gen_max =0;
|
||||
|
||||
if (GETPOST('frequency'))
|
||||
{
|
||||
@ -111,7 +155,7 @@ if ($action == 'add')
|
||||
$action = "create";
|
||||
$error++;
|
||||
}
|
||||
if ($nb_gen_max == '')
|
||||
if ($nb_gen_max === '')
|
||||
{
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->trans("MaxPeriodNumber")), null, 'errors');
|
||||
$action = "create";
|
||||
@ -122,7 +166,8 @@ if ($action == 'add')
|
||||
if (! $error)
|
||||
{
|
||||
$object->titre = GETPOST('titre', 'alpha');
|
||||
$object->note_private = GETPOST('note_private');
|
||||
$object->note_private = GETPOST('note_private');
|
||||
$object->note_public = GETPOST('note_public');
|
||||
$object->usenewprice = GETPOST('usenewprice');
|
||||
|
||||
$object->frequency = $frequency;
|
||||
@ -570,6 +615,24 @@ if ($action == 'addline' && $user->rights->facture->creer)
|
||||
}
|
||||
}
|
||||
|
||||
// Do we click on purge search criteria ?
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref='';
|
||||
$search_societe='';
|
||||
$search_montant_ht='';
|
||||
$search_montant_vat='';
|
||||
$search_montant_ttc='';
|
||||
$day='';
|
||||
$year='';
|
||||
$month='';
|
||||
$day_date_when='';
|
||||
$year_date_when='';
|
||||
$month_date_when='';
|
||||
$search_frequency='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -579,6 +642,7 @@ if ($action == 'addline' && $user->rights->facture->creer)
|
||||
llxHeader('',$langs->trans("RepeatableInvoices"),'ch-facture.html#s-fac-facture-rec');
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$companystatic = new Societe($db);
|
||||
|
||||
$now = dol_now();
|
||||
@ -599,7 +663,9 @@ if ($action == 'create')
|
||||
|
||||
if ($object->fetch($id, $ref) > 0)
|
||||
{
|
||||
print '<form action="fiche-rec.php" method="post">';
|
||||
$result = $object->getLinesArray();
|
||||
|
||||
print '<form action="fiche-rec.php" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="facid" value="'.$object->id.'">';
|
||||
@ -616,20 +682,23 @@ if ($action == 'create')
|
||||
|
||||
// Third party
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Customer").'</td><td>'.$object->thirdparty->getNomUrl(1,'customer').'</td>';
|
||||
print '<td>';
|
||||
print $langs->trans("Comment");
|
||||
print '</td></tr>';
|
||||
print '</tr>';
|
||||
|
||||
// Title
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Title").'</td><td>';
|
||||
print '<input class="flat quatrevingtpercent" type="text" name="titre" value="'.$_POST["titre"].'">';
|
||||
print '</td>';
|
||||
|
||||
// Note
|
||||
print '<td rowspan="'.$rowspan.'" valign="top">';
|
||||
print '<textarea class="flat centpercent" name="note_private" wrap="soft" rows="'.ROWS_4.'"></textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Note public
|
||||
print '<tr><td>'.$langs->trans("NotePublic").'</td><td valign="top">';
|
||||
print '<textarea class="flat centpercent" name="note_public" wrap="soft" rows="'.ROWS_4.'"></textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Note private
|
||||
print '<tr><td>'.$langs->trans("NotePrivate").'</td><td valign="top">';
|
||||
print '<textarea class="flat centpercent" name="note_private" wrap="soft" rows="'.ROWS_4.'"></textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Author
|
||||
print "<tr><td>".$langs->trans("Author")."</td><td>".$user->getFullName($langs)."</td></tr>";
|
||||
|
||||
@ -648,7 +717,7 @@ if ($action == 'create')
|
||||
{
|
||||
$projectid = $object->fk_project;
|
||||
$langs->load('projects');
|
||||
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">';
|
||||
print '<tr><td>' . $langs->trans('Project') . '</td><td>';
|
||||
$numprojet = $formproject->select_projects($socid, $projectid, 'projectid', 0);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
|
||||
print '</td></tr>';
|
||||
@ -707,10 +776,22 @@ if ($action == 'create')
|
||||
|
||||
print load_fiche_titre($title, '', '');
|
||||
|
||||
|
||||
/*
|
||||
* Invoice lines
|
||||
*/
|
||||
print '<table id="tablelines" class="noborder noshadow" width="100%">';
|
||||
// Show object lines
|
||||
if (! empty($object->lines))
|
||||
{
|
||||
$disableedit=1;
|
||||
$disablemove=1;
|
||||
$disableremove=1;
|
||||
$ret = $object->printObjectLines('', $mysoc, $soc, $lineid, 0); // No date selector for template invoice
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
/*
|
||||
print '<table class="notopnoleftnoright" width="100%">';
|
||||
print '<tr><td colspan="3">';
|
||||
|
||||
@ -877,7 +958,8 @@ if ($action == 'create')
|
||||
print $db->error();
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
*/
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
if ($flag_price_may_change)
|
||||
@ -1007,7 +1089,15 @@ else
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Note public
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey($langs->trans("NotePublic"), 'note_public', $object->note_public, $object, $user->rights->facture->creer);
|
||||
print '</td><td colspan="5">';
|
||||
print $form->editfieldval($langs->trans("NotePublic"), 'note_public', $object->note_public, $object, $user->rights->facture->creer, 'textarea:'.ROWS_4.':60');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Note private
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey($langs->trans("NotePrivate"), 'note_private', $object->note_private, $object, $user->rights->facture->creer);
|
||||
print '</td><td colspan="5">';
|
||||
@ -1208,7 +1298,7 @@ else
|
||||
if (! empty($object->lines))
|
||||
{
|
||||
$disableedit=1;
|
||||
$disablemove=1;
|
||||
//$disablemove=1;
|
||||
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 0); // No date selector for template invoice
|
||||
}
|
||||
|
||||
@ -1287,15 +1377,47 @@ else
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
if ($socid) $sql .= " AND s.rowid = ".$socid;
|
||||
if ($search_ref) $sql .= natural_search('f.titre', $search_ref);
|
||||
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
|
||||
if ($search_frequency) $sql .= natural_search('f.frequency', $search_frequency);
|
||||
if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1);
|
||||
if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1);
|
||||
if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
|
||||
if ($month > 0)
|
||||
{
|
||||
if ($year > 0 && empty($day))
|
||||
$sql.= " AND f.date_last_gen BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
|
||||
else if ($year > 0 && ! empty($day))
|
||||
$sql.= " AND f.date_last_gen BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'";
|
||||
else
|
||||
$sql.= " AND date_format(f.date_last_gen, '%m') = '".$month."'";
|
||||
}
|
||||
else if ($year > 0)
|
||||
{
|
||||
$sql.= " AND f.date_last_gen BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
}
|
||||
if ($month_date_when > 0)
|
||||
{
|
||||
if ($year_date_when > 0 && empty($day_date_when))
|
||||
$sql.= " AND f.date_when BETWEEN '".$db->idate(dol_get_first_day($year_date_when,$month_date_when,false))."' AND '".$db->idate(dol_get_last_day($year_date_when,$month_date_when,false))."'";
|
||||
else if ($year_date_when > 0 && ! empty($day_date_when))
|
||||
$sql.= " AND f.date_date_when_reglement BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month_date_when, $day_date_when, $year_date_when))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month_date_when, $day_date_when, $year_date_when))."'";
|
||||
else
|
||||
$sql.= " AND date_format(f.date_when, '%m') = '".$month_date_when."'";
|
||||
}
|
||||
else if ($year_date_when > 0)
|
||||
{
|
||||
$sql.= " AND f.date_when BETWEEN '".$db->idate(dol_get_first_day($year_date_when,1,false))."' AND '".$db->idate(dol_get_last_day($year_date_when,12,false))."'";
|
||||
}
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
$sql.= $db->plimit($limit+1,$offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@ -1305,6 +1427,29 @@ else
|
||||
|
||||
$param='&socid='.$socid;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($day) $param.='&day='.$day;
|
||||
if ($month) $param.='&month='.$month;
|
||||
if ($year) $param.='&year=' .$year;
|
||||
if ($day_date_when) $param.='&day_date_when='.$day_date_when;
|
||||
if ($month_date_when) $param.='&month_date_when='.$month_date_when;
|
||||
if ($year_date_when) $param.='&year_date_when=' .$year_date_when;
|
||||
if ($search_ref) $param.='&search_ref=' .$search_ref;
|
||||
if ($search_societe) $param.='&search_societe=' .$search_societe;
|
||||
if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht;
|
||||
if ($search_montant_vat != '') $param.='&search_montant_vat='.$search_montant_vat;
|
||||
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc;
|
||||
if ($search_frequency) $param.='&search_frequency=' .$search_frequency;
|
||||
if ($option) $param.="&option=".$option;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
// Add $param from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||
}
|
||||
|
||||
$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
|
||||
|
||||
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -1313,25 +1458,133 @@ else
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
|
||||
print_barre_liste($langs->trans("RepeatableInvoices"),$page,$_SERVER['PHP_SELF'],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecord,'title_accountancy.png',0,'','',$limit);
|
||||
|
||||
print_barre_liste($langs->trans("RepeatableInvoices"),$page,$_SERVER['PHP_SELF'],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy.png',0,'','',$limit);
|
||||
|
||||
print $langs->trans("ToCreateAPredefinedInvoice", $langs->transnoentitiesnoconv("ChangeIntoRepeatableInvoice")).'<br><br>';
|
||||
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"));
|
||||
print_liste_field_titre($langs->trans("Company"),$_SERVER['PHP_SELF'],"s.nom","","&socid=$socid","",$sortfiled,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AmountHT"),'','','','','align="right"');
|
||||
print_liste_field_titre($langs->trans("AmountVAT"),'','','','','align="right"');
|
||||
print_liste_field_titre($langs->trans("AmountTTC"),'','','','','align="right"');
|
||||
print_liste_field_titre($langs->trans("RecurringInvoiceTemplate"),'','','','','align="center"');
|
||||
print_liste_field_titre($langs->trans("DateLastGeneration"),'','','','','align="center"');
|
||||
print_liste_field_titre($langs->trans("NextDateToExecution"),'','','','','align="center"');
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER['PHP_SELF'],"f.titre","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER['PHP_SELF'],"s.nom","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AmountHT"),$_SERVER['PHP_SELF'],"f.total","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AmountVAT"),$_SERVER['PHP_SELF'],"f.tva","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER['PHP_SELF'],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RecurringInvoiceTemplate"),$_SERVER['PHP_SELF'],"f.frequency","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateLastGeneration"),$_SERVER['PHP_SELF'],"f.date_last_gen","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("NextDateToExecution"),$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre(''); // Field may contains ling text
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
// Filters lines
|
||||
print '<tr class="liste_titre">';
|
||||
// Ref
|
||||
if (! empty($arrayfields['f.titre']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Thirpdarty
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="8" name="search_societe" value="'.$search_societe.'"></td>';
|
||||
}
|
||||
if (! empty($arrayfields['f.total']['checked']))
|
||||
{
|
||||
// Amount
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="5" name="search_montant_ht" value="'.$search_montant_ht.'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['f.tva']['checked']))
|
||||
{
|
||||
// Amount
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="5" name="search_montant_vat" value="'.$search_montant_vat.'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['f.total_ttc']['checked']))
|
||||
{
|
||||
// Amount
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.$search_montant_ttc.'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['f.frequency']['checked']))
|
||||
{
|
||||
// Amount
|
||||
print '<td class="liste_titre" align="right">';
|
||||
//print '<input class="flat" type="text" size="5" name="search_frequency" value="'.$search_frequency.'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Date invoice
|
||||
if (! empty($arrayfields['f.date_last_gen']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||
$formother->select_year($year?$year:-1,'year',1, 20, 5);
|
||||
print '</td>';
|
||||
}
|
||||
// Date due
|
||||
if (! empty($arrayfields['f.date_when']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day_date_when" value="'.$day_date_when.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month_date_when" value="'.$month_date_when.'">';
|
||||
$formother->select_year($year_date_when?$year_date_when:-1,'year_date_when',1, 20, 5);
|
||||
print '</td>';
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
$typeofextrafield=$extrafields->attribute_type[$key];
|
||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$searchclass='';
|
||||
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
||||
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
||||
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (! empty($arrayfields['f.datec']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['f.tms']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0, 'checkforselect', 1);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$var=true;
|
||||
|
||||
@ -153,6 +153,7 @@ $arrayfields=array(
|
||||
'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
|
||||
'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0),
|
||||
'am'=>array('label'=>$langs->trans("Received"), 'checked'=>0),
|
||||
'rtp'=>array('label'=>$langs->trans("Rest"), 'checked'=>0),
|
||||
'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
'f.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||
@ -694,7 +695,7 @@ if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
||||
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
||||
if ($search_company) $sql .= natural_search('s.nom', $search_company);
|
||||
if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1);
|
||||
if ($search_montant_vat != '') $sql.= natural_search('f.total', $search_montant_vat, 1);
|
||||
if ($search_montant_vat != '') $sql.= natural_search('f.total_vat', $search_montant_vat, 1);
|
||||
if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
|
||||
if ($search_status != '' && $search_status >= 0) $sql.= " AND f.fk_statut = ".$db->escape($search_status);
|
||||
if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode."";
|
||||
@ -997,6 +998,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'],$_SERVER['PHP_SELF'],'f.tva','',$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'],$_SERVER['PHP_SELF'],'f.total_ttc','',$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['am']['checked'])) print_liste_field_titre($arrayfields['am']['label'],$_SERVER['PHP_SELF'],'am','',$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'],$_SERVER['PHP_SELF'],'rtp','',$param,'align="right"',$sortfield,$sortorder);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
@ -1117,6 +1119,11 @@ if ($resql)
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['rtp']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '</td>';
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
@ -1195,6 +1202,7 @@ if ($resql)
|
||||
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
|
||||
$notetoshow=dol_string_nohtmltag(($user->societe_id>0?$obj->note_public:$obj->note_private),1);
|
||||
$paiement = $facturestatic->getSommePaiement();
|
||||
$remaintopay = $obj->total_ttc - $paiement;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
|
||||
@ -1347,6 +1355,14 @@ if ($resql)
|
||||
if (! $i) $totalarray['totalamfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalam'] += $paiement;
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['rtp']['checked']))
|
||||
{
|
||||
print '<td align="right">'.(! empty($remaintopay)?price($remaintopay,0,$langs):' ').'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalrtp'] += $remaintopay;
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
@ -1425,6 +1441,7 @@ if ($resql)
|
||||
elseif ($totalarray['totalvatfield'] == $i) print '<td align="right">'.price($totalarray['totalvat']).'</td>';
|
||||
elseif ($totalarray['totalttcfield'] == $i) print '<td align="right">'.price($totalarray['totalttc']).'</td>';
|
||||
elseif ($totalarray['totalamfield'] == $i) print '<td align="right">'.price($totalarray['totalam']).'</td>';
|
||||
elseif ($totalarray['totalrtpfield'] == $i) print '<td align="right">'.price($totalarray['totalrtp']).'</td>';
|
||||
else print '<td></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
@ -199,7 +199,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="3">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
$db->free($resql);
|
||||
@ -275,7 +275,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="3">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
$db->free($resql);
|
||||
|
||||
@ -382,7 +382,7 @@ print '</tr>';
|
||||
* Charges sociales non deductibles
|
||||
*/
|
||||
|
||||
print '<tr><td colspan="4">'.$langs->trans("SocialContributions").' ('.$langs->trans("Type").' 0)</td></tr>';
|
||||
print '<tr><td colspan="4">'.$langs->trans("SocialContributionsNondeductibles").'</td></tr>';
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES')
|
||||
{
|
||||
@ -456,7 +456,7 @@ print '</tr>';
|
||||
* Charges sociales deductibles
|
||||
*/
|
||||
|
||||
print '<tr><td colspan="4">'.$langs->trans("SocialContributions").' ('.$langs->trans("Type").' 1)</td></tr>';
|
||||
print '<tr><td colspan="4">'.$langs->trans("SocialContributionsDeductibles").'</td></tr>';
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES')
|
||||
{
|
||||
|
||||
@ -181,6 +181,8 @@ report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportl
|
||||
|
||||
// SQL request
|
||||
$catotal=0;
|
||||
$catotal_ht=0;
|
||||
$qtytotal=0;
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES')
|
||||
{
|
||||
@ -401,6 +403,8 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
// Total
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($qtytotal).'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="right">'.price($catotal_ht).'</td>';
|
||||
print '<td align="right">'.price($catotal).'</td>';
|
||||
print '<td> </td>';
|
||||
|
||||
@ -107,6 +107,47 @@ class Contact extends CommonObject
|
||||
$this->db = $db;
|
||||
$this->statut = 1; // By default, status is enabled
|
||||
}
|
||||
|
||||
/**
|
||||
* Load indicators into this->nb for board
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function load_state_board()
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->nb=array();
|
||||
$clause = "WHERE";
|
||||
|
||||
$sql = "SELECT count(sp.rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (sp.fk_soc = s.rowid)";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id)
|
||||
{
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||
$sql.= " WHERE sc.fk_user = " .$user->id;
|
||||
$clause = "AND";
|
||||
}
|
||||
$sql.= ' '.$clause.' s.entity IN ('.getEntity($this->element, 1).')';
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
{
|
||||
$this->nb["contacts"]=$obj->nb;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a contact into database
|
||||
|
||||
@ -273,7 +273,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoContracts").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="3">'.$langs->trans("NoContracts").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
$db->free($resql);
|
||||
|
||||
@ -229,12 +229,13 @@ abstract class CommonObject
|
||||
public $mode_reglement_id;
|
||||
|
||||
/**
|
||||
* @var string Payment terms ID
|
||||
* @var int Payment terms ID
|
||||
* @see setPaymentTerms()
|
||||
*/
|
||||
public $cond_reglement_id;
|
||||
/**
|
||||
* @deprecated
|
||||
* @var int Payment terms ID
|
||||
* @deprecated Kept for compatibility
|
||||
* @see cond_reglement_id;
|
||||
*/
|
||||
public $cond_reglement;
|
||||
@ -3236,7 +3237,9 @@ abstract class CommonObject
|
||||
*/
|
||||
function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0)
|
||||
{
|
||||
global $conf, $hookmanager, $inputalsopricewithtax, $usemargins, $disableedit, $disablemove, $langs, $user;
|
||||
global $conf, $hookmanager, $langs, $user;
|
||||
// TODO We should not use global var for this !
|
||||
global $inputalsopricewithtax, $usemargins, $disableedit, $disablemove, $disableremove;
|
||||
|
||||
// Define usemargins
|
||||
$usemargins=0;
|
||||
@ -3984,7 +3987,7 @@ abstract class CommonObject
|
||||
function call_trigger($trigger_name, $user)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers($trigger_name,$this,$user,$langs,$conf);
|
||||
@ -4248,7 +4251,7 @@ abstract class CommonObject
|
||||
|
||||
if (! empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0; // For avoid conflicts if trigger used
|
||||
|
||||
if (! empty($this->array_options) && !empty($this->array_options["options_$key"]))
|
||||
if (! empty($this->array_options) && isset($this->array_options["options_".$key]))
|
||||
{
|
||||
// Check parameters
|
||||
$langs->load('admin');
|
||||
@ -4256,7 +4259,7 @@ abstract class CommonObject
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
$target_extrafields=$extrafields->fetch_name_optionals_label($this->table_element);
|
||||
|
||||
$value=$this->array_options["options_$key"];
|
||||
$value=$this->array_options["options_".$key];
|
||||
$attributeType = $extrafields->attribute_type[$key];
|
||||
$attributeLabel = $extrafields->attribute_label[$key];
|
||||
$attributeParam = $extrafields->attribute_param[$key];
|
||||
@ -4270,17 +4273,17 @@ abstract class CommonObject
|
||||
}
|
||||
elseif ($value=='')
|
||||
{
|
||||
$this->array_options["options_$key"] = null;
|
||||
$this->array_options["options_".$key] = null;
|
||||
}
|
||||
break;
|
||||
case 'price':
|
||||
$this->array_options["options_$key"] = price2num($this->array_options["options_$key"]);
|
||||
$this->array_options["options_".$key] = price2num($this->array_options["options_".$key]);
|
||||
break;
|
||||
case 'date':
|
||||
$this->array_options["options_$key"]=$this->db->idate($this->array_options["options_$key"]);
|
||||
$this->array_options["options_".$key]=$this->db->idate($this->array_options["options_".$key]);
|
||||
break;
|
||||
case 'datetime':
|
||||
$this->array_options["options_$key"]=$this->db->idate($this->array_options["options_$key"]);
|
||||
$this->array_options["options_".$key]=$this->db->idate($this->array_options["options_".$key]);
|
||||
break;
|
||||
case 'link':
|
||||
$param_list=array_keys($attributeParam ['options']);
|
||||
@ -4292,13 +4295,13 @@ abstract class CommonObject
|
||||
if ($value)
|
||||
{
|
||||
$object->fetch(0,$value);
|
||||
$this->array_options["options_$key"]=$object->id;
|
||||
$this->array_options["options_".$key]=$object->id;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET $key='".$this->db->escape($this->array_options["options_$key"])."'";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET ".$key."='".$this->db->escape($this->array_options["options_".$key])."'";
|
||||
$sql .= " WHERE fk_object = ".$this->id;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
@ -4559,7 +4562,7 @@ abstract class CommonObject
|
||||
$productFournisseur = new ProductFournisseur($this->db);
|
||||
if (($result = $productFournisseur->find_min_price_product_fournisseur($fk_product)) > 0)
|
||||
{
|
||||
$buyPrice = $productFournisseur->fourn_price;
|
||||
$buyPrice = $productFournisseur->fourn_unitprice;
|
||||
}
|
||||
else if ($result < 0)
|
||||
{
|
||||
|
||||
@ -52,7 +52,7 @@ class DolEditor
|
||||
* @param string $content Content of WYSIWIG field
|
||||
* @param int $width Width in pixel of edit area (auto by default)
|
||||
* @param int $height Height in pixel of edit area (200px by default)
|
||||
* @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', ')
|
||||
* @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly')
|
||||
* @param string $toolbarlocation Where bar is stored :
|
||||
* 'In' each window has its own toolbar
|
||||
* 'Out:name' share toolbar into the div called 'name'
|
||||
@ -148,7 +148,10 @@ class DolEditor
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$found=0;
|
||||
$fullpage=False;
|
||||
$disallowAnyContent=empty($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT); // Only predefined list of html tags are allowed
|
||||
|
||||
$found=0;
|
||||
$out='';
|
||||
|
||||
if ($this->tool == 'fckeditor')
|
||||
@ -186,7 +189,8 @@ class DolEditor
|
||||
customConfig : ckeditorConfig,
|
||||
readOnly : '.($this->readonly?'true':'false').',
|
||||
htmlEncodeOutput :'.$htmlencode_force.',
|
||||
allowedContent :'.(empty($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT)?'false':'true').',
|
||||
allowedContent :'.($disallowAnyContent?'false':'true').',
|
||||
fullPage : '.($fullpage?'true':'false').',
|
||||
toolbar: \''.$this->toolbarname.'\',
|
||||
toolbarStartupExpanded: '.($this->toolbarstartexpanded ? 'true' : 'false').',
|
||||
width: '.($this->width ? '\''.$this->width.'\'' : '\'\'').',
|
||||
|
||||
@ -63,7 +63,7 @@ class ExtraFields
|
||||
var $errno;
|
||||
|
||||
var $attribute_hidden;
|
||||
|
||||
|
||||
public static $type2label=array(
|
||||
'varchar'=>'String',
|
||||
'text'=>'TextLong',
|
||||
@ -665,6 +665,7 @@ class ExtraFields
|
||||
$param=$this->attribute_param[$key];
|
||||
$perms=$this->attribute_perms[$key];
|
||||
$list=$this->attribute_list[$key];
|
||||
$hidden=$this->attribute_hidden[$key];
|
||||
|
||||
if (empty($showsize))
|
||||
{
|
||||
@ -686,7 +687,7 @@ class ExtraFields
|
||||
if ($showsize > 48) $showsize=48;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (in_array($type,array('date','datetime')))
|
||||
{
|
||||
$tmp=explode(',',$size);
|
||||
@ -823,7 +824,7 @@ class ExtraFields
|
||||
if (strpos($InfoFieldList[4], '$SEL$')!==false) {
|
||||
$InfoFieldList[4]=str_replace('$SEL$','SELECT',$InfoFieldList[4]);
|
||||
}
|
||||
|
||||
|
||||
// current object id can be use into filter
|
||||
if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) {
|
||||
$InfoFieldList[4]=str_replace('$ID$',$objectid,$InfoFieldList[4]);
|
||||
@ -841,14 +842,14 @@ class ExtraFields
|
||||
$sqlwhere.= ' WHERE '.$InfoFieldList[4];
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$sqlwhere.= ' WHERE 1=1';
|
||||
}
|
||||
// Some tables may have field, some other not. For the moment we disable it.
|
||||
if (in_array($InfoFieldList[0],array('tablewithentity')))
|
||||
if (in_array($InfoFieldList[0],array('tablewithentity')))
|
||||
{
|
||||
$sqlwhere.= ' AND entity = '.$conf->entity;
|
||||
$sqlwhere.= ' AND entity = '.$conf->entity;
|
||||
}
|
||||
$sql.=$sqlwhere;
|
||||
//print $sql;
|
||||
@ -1007,19 +1008,19 @@ class ExtraFields
|
||||
$sql = 'SELECT ' . $keyList;
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0];
|
||||
if (! empty($InfoFieldList[4])) {
|
||||
|
||||
|
||||
// can use SELECT request
|
||||
if (strpos($InfoFieldList[4], '$SEL$')!==false) {
|
||||
$InfoFieldList[4]=str_replace('$SEL$','SELECT',$InfoFieldList[4]);
|
||||
}
|
||||
|
||||
|
||||
// current object id can be use into filter
|
||||
if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) {
|
||||
$InfoFieldList[4]=str_replace('$ID$',$objectid,$InfoFieldList[4]);
|
||||
} else {
|
||||
$InfoFieldList[4]=str_replace('$ID$','0',$InfoFieldList[4]);
|
||||
}
|
||||
|
||||
|
||||
// We have to join on extrafield table
|
||||
if (strpos($InfoFieldList[4], 'extra') !== false) {
|
||||
$sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra';
|
||||
@ -1031,13 +1032,13 @@ class ExtraFields
|
||||
$sqlwhere .= ' WHERE 1=1';
|
||||
}
|
||||
// Some tables may have field, some other not. For the moment we disable it.
|
||||
if (in_array($InfoFieldList[0], array ('tablewithentity')))
|
||||
if (in_array($InfoFieldList[0], array ('tablewithentity')))
|
||||
{
|
||||
$sqlwhere .= ' AND entity = ' . $conf->entity;
|
||||
}
|
||||
// $sql.=preg_replace('/^ AND /','',$sqlwhere);
|
||||
// print $sql;
|
||||
|
||||
|
||||
$sql .= $sqlwhere;
|
||||
dol_syslog(get_class($this) . '::showInputField type=chkbxlst',LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -1143,6 +1144,9 @@ class ExtraFields
|
||||
$out.='Error bad setup of extrafield';
|
||||
}
|
||||
}
|
||||
if (!empty($hidden)) {
|
||||
$out='<input type="hidden" value="'.$value.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'"/>';
|
||||
}
|
||||
/* Add comments
|
||||
if ($type == 'date') $out.=' (YYYY-MM-DD)';
|
||||
elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)';
|
||||
@ -1171,6 +1175,7 @@ class ExtraFields
|
||||
$params=$this->attribute_param[$key];
|
||||
$perms=$this->attribute_perms[$key];
|
||||
$list=$this->attribute_list[$key];
|
||||
$hidden=$this->attribute_hidden[$key];
|
||||
|
||||
$showsize=0;
|
||||
if ($type == 'date')
|
||||
@ -1402,10 +1407,14 @@ class ExtraFields
|
||||
$showsize=round($size);
|
||||
if ($showsize > 48) $showsize=48;
|
||||
}
|
||||
|
||||
|
||||
//print $type.'-'.$size;
|
||||
$out=$value;
|
||||
|
||||
|
||||
if (!empty($hidden)) {
|
||||
$out='';
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -1422,7 +1431,7 @@ class ExtraFields
|
||||
$type=$this->attribute_type[$key];
|
||||
|
||||
$align='';
|
||||
|
||||
|
||||
if ($type == 'date')
|
||||
{
|
||||
$align="center";
|
||||
@ -1451,10 +1460,10 @@ class ExtraFields
|
||||
{
|
||||
$align="center";
|
||||
}
|
||||
|
||||
|
||||
return $align;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return HTML string to print separator extrafield
|
||||
*
|
||||
@ -1534,7 +1543,7 @@ class ExtraFields
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* return array_options array for object by extrafields value (using for data send by forms)
|
||||
*
|
||||
|
||||
@ -39,6 +39,7 @@ class Fiscalyear extends CommonObject
|
||||
var $label;
|
||||
var $date_start;
|
||||
var $date_end;
|
||||
var $datec;
|
||||
var $statut; // 0=open, 1=closed
|
||||
var $entity;
|
||||
|
||||
|
||||
@ -135,6 +135,7 @@ class HookManager
|
||||
$method,
|
||||
array(
|
||||
'addMoreActionsButtons',
|
||||
'addSearchEntry',
|
||||
'addStatisticLine',
|
||||
'deleteFile',
|
||||
'doActions',
|
||||
|
||||
@ -390,6 +390,7 @@ class Form
|
||||
* @param int $noencodehtmltext Do not encode into html entity the htmltext
|
||||
* @return string Code html du tooltip (texte+picto)
|
||||
* @see Use function textwithpicto if you can.
|
||||
* TODO Move this as static as soon as everybody use textwithpicto or @Form::textwithtooltip
|
||||
*/
|
||||
function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 2, $incbefore = '', $noencodehtmltext = 0)
|
||||
{
|
||||
@ -2057,17 +2058,27 @@ class Form
|
||||
{
|
||||
global $langs,$conf;
|
||||
global $price_level, $status, $finished;
|
||||
|
||||
|
||||
$selected_input_value='';
|
||||
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT))
|
||||
{
|
||||
if ($selected > 0)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
$producttmpselect = new Product($this->db);
|
||||
$producttmpselect->fetch($selected);
|
||||
$selected_input_value=$producttmpselect->ref;
|
||||
unset($producttmpselect);
|
||||
}
|
||||
|
||||
if (!empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
|
||||
{
|
||||
print '<input type="hidden" id="idprod" name="idprod" value="0" />';
|
||||
}
|
||||
// mode=2 means suppliers products
|
||||
$urloption=($socid > 0?'socid='.$socid.'&':'').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished;
|
||||
print ajax_autocompleter('', $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
|
||||
print ($hidelabel?'':$langs->trans("RefOrLabel").' : ').'<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'">';
|
||||
print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
|
||||
print ($hidelabel?'':$langs->trans("RefOrLabel").' : ').'<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2089,7 +2100,7 @@ class Form
|
||||
* @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
|
||||
* @param string $filtre Pour filtre sql
|
||||
* @param string $filterkey Filtre des produits
|
||||
* @param int $statut -1=Return all products, 0=Products not on sell, 1=Products on sell
|
||||
* @param int $statut -1=Return all products, 0=Products not on sell, 1=Products on sell (not used here, a filter on tobuy is already hard coded in request)
|
||||
* @param int $outputmode 0=HTML select string, 1=Array
|
||||
* @param int $limit Limit of line number
|
||||
* @return array Array of keys for json
|
||||
@ -2106,7 +2117,7 @@ class Form
|
||||
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration, p.fk_product_type,";
|
||||
$sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,";
|
||||
$sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.fk_soc, s.nom as name,";
|
||||
$sql.= " pfp.supplier_reputation";
|
||||
$sql.= " pfp.supplier_reputation";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
|
||||
if ($socid) $sql.= " AND pfp.fk_soc = ".$socid;
|
||||
@ -2390,10 +2401,10 @@ class Form
|
||||
$form.= $opt;
|
||||
$i++;
|
||||
}
|
||||
$form.= '</select>';
|
||||
|
||||
$this->db->free($result);
|
||||
}
|
||||
|
||||
$form.= '</select>';
|
||||
$this->db->free($result);
|
||||
return $form;
|
||||
}
|
||||
else
|
||||
@ -5239,7 +5250,7 @@ class Form
|
||||
*
|
||||
* @param CommonObject $object Object we want to show links to
|
||||
* @param array $restrictlinksto Restrict links to some elements, for exemple array('order') or array('supplier_order')
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @return string <0 if KO, >0 if OK
|
||||
*/
|
||||
function showLinkToObjectBlock($object, $restrictlinksto=array())
|
||||
{
|
||||
@ -5457,7 +5468,7 @@ class Form
|
||||
* @param int $option 0 return yes/no, 1 return 1/0
|
||||
* @param bool $disabled true or false
|
||||
* @param int $useempty 1=Add empty line
|
||||
* @return mixed See option
|
||||
* @return string See option
|
||||
*/
|
||||
function selectyesno($htmlname,$value='',$option=0,$disabled=false,$useempty='')
|
||||
{
|
||||
@ -5799,7 +5810,7 @@ class Form
|
||||
* @param string $include Array list of groups id to include
|
||||
* @param int $enableonly Array list of groups id to be enabled. All other must be disabled
|
||||
* @param int $force_entity 0 or Id of environment to force
|
||||
* @return void
|
||||
* @return string
|
||||
* @see select_dolusers
|
||||
*/
|
||||
function select_dolgroups($selected='', $htmlname='groupid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0)
|
||||
|
||||
@ -82,7 +82,7 @@ class FormAccounting
|
||||
$sql.= " ORDER BY c.label ASC";
|
||||
}
|
||||
|
||||
dol_syslog("Form::select_accounting_category", LOG_DEBUG);
|
||||
dol_syslog(get_class($this).'::'.__METHOD__, LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -805,6 +805,7 @@ class FormOther
|
||||
$select_week .= '<option value="'.$key.'">';
|
||||
}
|
||||
$select_week .= $val;
|
||||
$select_week .= '</option>';
|
||||
}
|
||||
$select_week .= '</select>';
|
||||
return $select_week;
|
||||
@ -844,6 +845,7 @@ class FormOther
|
||||
$select_month .= '<option value="'.$key.'">';
|
||||
}
|
||||
$select_month .= $val;
|
||||
$select_month .= '</option>';
|
||||
}
|
||||
$select_month .= '</select>';
|
||||
return $select_month;
|
||||
|
||||
@ -138,7 +138,7 @@ class FormProjets
|
||||
$sql.= " WHERE p.entity IN (".getEntity('project', 1).")";
|
||||
if ($projectsListId !== false) $sql.= " AND p.rowid IN (".$projectsListId.")";
|
||||
if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
|
||||
if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
|
||||
if ($socid > 0 && empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
|
||||
if (!empty($filterkey)) {
|
||||
$sql .= ' AND p.title LIKE "%'.$this->db->escape($filterkey).'%"';
|
||||
$sql .= ' OR p.ref LIKE "%'.$this->db->escape($filterkey).'%"';
|
||||
@ -204,7 +204,7 @@ class FormProjets
|
||||
if ($discard_close == 2) $disabled=1;
|
||||
$labeltoshow.=' - '.$langs->trans("Closed");
|
||||
}
|
||||
else if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
|
||||
else if ( empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY) && $socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
|
||||
{
|
||||
$disabled=1;
|
||||
$labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");
|
||||
|
||||
@ -77,7 +77,7 @@ class Interfaces
|
||||
$modules = array();
|
||||
$orders = array();
|
||||
$i=0;
|
||||
|
||||
|
||||
$dirtriggers=array_merge(array('/core/triggers'),$conf->modules_parts['triggers']);
|
||||
foreach($dirtriggers as $reldir)
|
||||
{
|
||||
@ -100,9 +100,9 @@ class Interfaces
|
||||
$part3=$reg[3];
|
||||
|
||||
$nbfile++;
|
||||
|
||||
|
||||
$modName = "Interface".ucfirst($reg[3]);
|
||||
//print "file=$file"; print "modName=$modName"; exit;
|
||||
//print "file=$file - modName=$modName\n";
|
||||
if (in_array($modName,$modules))
|
||||
{
|
||||
$langs->load("errors");
|
||||
@ -111,9 +111,17 @@ class Interfaces
|
||||
}
|
||||
else
|
||||
{
|
||||
include_once $newdir.'/'.$file;
|
||||
try {
|
||||
//print 'Todo for '.$modName." : ".$newdir.'/'.$file."\n";
|
||||
include_once $newdir.'/'.$file;
|
||||
//print 'Done for '.$modName."\n";
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
dol_syslog('ko for '.$modName." ".$e->getMessage()."\n", LOG_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check if trigger file is disabled by name
|
||||
if (preg_match('/NORUN$/i',$file)) continue;
|
||||
// Check if trigger file is for a particular module
|
||||
@ -142,7 +150,7 @@ class Interfaces
|
||||
}
|
||||
|
||||
asort($orders);
|
||||
|
||||
|
||||
// Loop on each trigger
|
||||
foreach ($orders as $key => $value)
|
||||
{
|
||||
|
||||
@ -908,7 +908,8 @@ class Translate
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a currency code into its symbol
|
||||
* Return a currency code into its symbol.
|
||||
* If mb_convert_encoding is not available, return currency code.
|
||||
*
|
||||
* @param string $currency_code Currency code
|
||||
* @param integer $forceloadall 1=Force to load all currencies into cache. We know we need to use all of them. By default read and cache only required currency.
|
||||
|
||||
@ -19,15 +19,20 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
define('NOTOKENRENEWAL',1); // Disables token renewal
|
||||
//define('NOTOKENRENEWAL',1); // Disables token renewal
|
||||
//require '../../../../main.inc.php';
|
||||
require '../../connectors/php/config.php'; // This include the define('NOTOKENRENEWAL',1) and the require main.in.php
|
||||
|
||||
global $Config;
|
||||
|
||||
|
||||
|
||||
require '../../../../main.inc.php';
|
||||
?>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
|
||||
"http://www.w3.org/TR/html4/frameset.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>FCKeditor - Resources Browser</title>
|
||||
<title><?php echo $langs->trans("MediaBrowser").' - '.$Config['UserFilesAbsolutePathRelative']; ?></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script type="text/javascript" src="js/fckxml.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
global $Config ;
|
||||
global $website;
|
||||
|
||||
define('NOTOKENRENEWAL',1); // Disables token renewal
|
||||
|
||||
@ -44,13 +45,15 @@ $Config['Enabled'] = true ;
|
||||
|
||||
|
||||
// Path to user files relative to the document root.
|
||||
$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=fckeditor&file=' ;
|
||||
$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=medias'.(empty($website)?'':'_'.$website).'&file=' ;
|
||||
|
||||
$Config['UserFilesAbsolutePathRelative'] = (empty($website) ? ((!empty($entity) ? '/' . $entity : '') . '/medias/') : ('/websites/'.$website));
|
||||
|
||||
// Fill the following value it you prefer to specify the absolute path for the
|
||||
// user files directory. Useful if you are using a virtual directory, symbolic
|
||||
// link or alias. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
|
||||
// Attention: The above 'UserFilesPath' must point to the same directory.
|
||||
$Config['UserFilesAbsolutePath'] = $dolibarr_main_data_root . (!empty($entity) ? '/' . $entity : '') . '/fckeditor/';
|
||||
$Config['UserFilesAbsolutePath'] = $dolibarr_main_data_root . $Config['UserFilesAbsolutePathRelative'];
|
||||
|
||||
// Due to security issues with Apache modules, it is recommended to leave the
|
||||
// following setting enabled.
|
||||
@ -64,7 +67,7 @@ $Config['SecureImageUploads'] = true;
|
||||
$Config['ConfigAllowedCommands'] = array('QuickUpload', 'FileUpload', 'GetFolders', 'GetFoldersAndFiles', 'CreateFolder');
|
||||
|
||||
// Allowed Resource Types.
|
||||
$Config['ConfigAllowedTypes'] = array('File', 'Image', 'Flash', 'Media');
|
||||
$Config['ConfigAllowedTypes'] = array('File', 'Image', 'Media');
|
||||
|
||||
// For security, HTML is allowed in the first Kb of data for files having the
|
||||
// following extensions only.
|
||||
@ -75,11 +78,19 @@ $Config['HtmlExtensions'] = array("html", "htm", "xml", "xsd", "txt", "js");
|
||||
// If possible, it is recommended to set more restrictive permissions, like 0755.
|
||||
// Set to 0 to disable this feature.
|
||||
// Note: not needed on Windows-based servers.
|
||||
$Config['ChmodOnUpload'] = 0775 ;
|
||||
$newmask = '0644';
|
||||
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
||||
$Config['ChmodOnUpload'] = $newmask;
|
||||
|
||||
// See comments above.
|
||||
// Used when creating folders that does not exist.
|
||||
$Config['ChmodOnFolderCreate'] = 0775 ;
|
||||
$newmask = '0755';
|
||||
$dirmaskdec=octdec($newmask);
|
||||
if (! empty($conf->global->MAIN_UMASK)) $dirmaskdec=octdec($conf->global->MAIN_UMASK);
|
||||
$dirmaskdec |= octdec('0200'); // Set w bit required to be able to create content for recursive subdirs files
|
||||
$newmask = decoct($dirmaskdec);
|
||||
|
||||
$Config['ChmodOnFolderCreate'] = $newmask;
|
||||
|
||||
/*
|
||||
Configuration settings for each Resource Type
|
||||
|
||||
@ -42,7 +42,7 @@ function SendError($number, $text)
|
||||
|
||||
// Check if this uploader has been enabled.
|
||||
if ( !$Config['Enabled'] )
|
||||
SendUploadResults('1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/connectors/php/config.php" file');
|
||||
SendUploadResults('1', '', '', 'This file uploader is disabled. Please check the "filemanagerdol/connectors/php/config.php" file');
|
||||
|
||||
$sCommand = 'QuickUpload' ;
|
||||
|
||||
|
||||
@ -52,7 +52,10 @@ else header('Cache-Control: no-cache');
|
||||
$.fn.select2.locales['xx'] = {
|
||||
formatMatches: function (matches) { return matches + " <?php echo dol_escape_js($langs->trans("Select2ResultFoundUseArrows")); ?>"; },
|
||||
formatNoMatches: function () { return "<?php echo dol_escape_js($langs->trans("Select2NotFound")); ?>"; },
|
||||
formatInputTooShort: function (input, min) { var n = min - input.length; return "<?php echo dol_escape_js($langs->trans("Select2Enter")); ?> " + n + " <?php echo dol_escape_js($langs->trans("Select2MoreCharacters")); ?>"; },
|
||||
formatInputTooShort: function (input, min) { var n = min - input.length;
|
||||
if (n > 1) return "<?php echo dol_escape_js($langs->trans("Select2Enter")); ?> " + n + " <?php echo dol_escape_js($langs->trans("Select2MoreCharacters")); ?>";
|
||||
else return "<?php echo dol_escape_js($langs->trans("Select2Enter")); ?> " + n + " <?php echo dol_escape_js($langs->trans("Select2MoreCharacter")); ?>"
|
||||
},
|
||||
formatLoadMore: function (pageNumber) { return "<?php echo dol_escape_js($langs->trans("Select2LoadingMoreResults")); ?>"; },
|
||||
formatSearching: function () { return "<?php echo dol_escape_js($langs->trans("Select2SearchInProgress")); ?>"; }
|
||||
};
|
||||
|
||||
@ -37,26 +37,26 @@ function admin_accounting_prepare_head(AccountingAccount $object=null)
|
||||
$head = array ();
|
||||
|
||||
$head[$h][0] = dol_buildpath('/accountancy/admin/index.php', 1);
|
||||
$head[$h][1] = $langs->trans("Configuration");
|
||||
$head[$h][1] = $langs->trans("Miscellaneous");
|
||||
$head[$h][2] = 'general';
|
||||
$h ++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_admin');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/journal.php';
|
||||
$head[$h][1] = $langs->trans("Journaux");
|
||||
$head[$h][2] = 'journal';
|
||||
$h ++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/export.php';
|
||||
$head[$h][1] = $langs->trans("Export");
|
||||
$head[$h][1] = $langs->trans("ExportOptions");
|
||||
$head[$h][2] = 'export';
|
||||
$h ++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_admin');
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_admin', 'remove');
|
||||
|
||||
return $head;
|
||||
|
||||
@ -346,7 +346,8 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
|
||||
'DB_ERROR_NO_INDEX_TO_DROP',
|
||||
'DB_ERROR_CANNOT_CREATE', // Qd contrainte deja existante
|
||||
'DB_ERROR_CANT_DROP_PRIMARY_KEY',
|
||||
'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS'
|
||||
'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS',
|
||||
'DB_ERROR_22P02'
|
||||
);
|
||||
if ($okerror == 'none') $okerrors=array();
|
||||
|
||||
@ -928,7 +929,7 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql
|
||||
foreach($objMod->dictionaries['tabcond'] as $val) { $nbtabcond++; $tabcond[] = $val; }
|
||||
if (! empty($objMod->dictionaries['tabhelp'])) foreach($objMod->dictionaries['tabhelp'] as $val) { $nbtabhelp++; $tabhelp[] = $val; }
|
||||
if (! empty($objMod->dictionaries['tabfieldcheck'])) foreach($objMod->dictionaries['tabfieldcheck'] as $val) { $nbtabfieldcheck++; $tabfieldcheck[] = $val; }
|
||||
|
||||
|
||||
if ($nbtabname != $nbtablib || $nbtablib != $nbtabsql || $nbtabsql != $nbtabsqlsort)
|
||||
{
|
||||
print 'Error in descriptor of module '.$const_name.'. Array ->dictionaries has not same number of record for key "tabname", "tablib", "tabsql" and "tabsqlsort"';
|
||||
|
||||
@ -136,7 +136,8 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
||||
minLength: '.$minLength.',
|
||||
select: function( event, ui ) { // Function ran once new value has been selected into javascript combo
|
||||
console.log("Call change on input '.$htmlname.' because of select definition of autocomplete select call on input#search_'.$htmlname.'");
|
||||
$("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
|
||||
console.log("Selected id = "+ui.item.id+" - If this value is null, it means you select a record with key that is null so selection is not effective");
|
||||
$("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
|
||||
// Disable an element
|
||||
if (options.option_disabled) {
|
||||
if (ui.item.disabled) {
|
||||
@ -179,7 +180,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
||||
}
|
||||
});
|
||||
}
|
||||
console.log("ajax_autocompleter new value selected, we trigger change on original component");
|
||||
console.log("ajax_autocompleter new value selected, we trigger change on original component so field #search_'.$htmlname.'");
|
||||
$("#search_'.$htmlname.'").trigger("change"); // We have changed value of the combo select, we must be sure to trigger all js hook binded on this event. This is required to trigger other javascript change method binded on original field by other code.
|
||||
}
|
||||
,delay: 500
|
||||
@ -290,14 +291,15 @@ function ajax_multiautocompleter($htmlname, $fields, $url, $option='', $minLengt
|
||||
needtotrigger="#" + fields[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (needtotrigger != "") // To force select2 to refresh visible content
|
||||
{
|
||||
// We introduce a delay so hand is back to js and all other js change can be done before the trigger that may execute a submit is done
|
||||
// This is required for example when changing zip with autocomplete that change the country
|
||||
jQuery(needtotrigger).delay(500).queue(function() {
|
||||
jQuery(needtotrigger).trigger("change");
|
||||
});
|
||||
|
||||
if (needtotrigger != "") // To force select2 to refresh visible content
|
||||
{
|
||||
// We introduce a delay so hand is back to js and all other js change can be done before the trigger that may execute a submit is done
|
||||
// This is required for example when changing zip with autocomplete that change the country
|
||||
jQuery(needtotrigger).delay(500).queue(function() {
|
||||
jQuery(this).trigger("change");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -38,21 +38,28 @@ function emailing_prepare_head(Mailing $object)
|
||||
$head[$h][1] = $langs->trans("MailCard");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! $user->rights->mailing->mailing_advance->recipient) {
|
||||
return $head;
|
||||
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->mailing->mailing_advance->recipient))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$object->id;
|
||||
$head[$h][1] = $langs->trans("MailRecipients");
|
||||
$head[$h][2] = 'targets';
|
||||
$h++;
|
||||
|
||||
if (! empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR)) // Still need debug
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id;
|
||||
$head[$h][1] = $langs->trans("MailAdvTargetRecipients");
|
||||
$head[$h][2] = 'advtargets';
|
||||
$h++;
|
||||
}
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$object->id;
|
||||
$head[$h][1] = $langs->trans("MailRecipients");
|
||||
$head[$h][2] = 'targets';
|
||||
$h++;
|
||||
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/info.php?id=".$object->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'emailing');
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'emailing','remove');
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
/* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.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
|
||||
@ -67,6 +69,15 @@ function fichinter_prepare_head($object)
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'intervention');
|
||||
|
||||
// Tab to link resources
|
||||
if ($conf->resource->enabled)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=fichinter&element_id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Resources");
|
||||
$head[$h][2] = 'resource';
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$nbNote = 0;
|
||||
|
||||
@ -2213,8 +2213,6 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
// Wrapping for import module
|
||||
else if ($modulepart == 'import')
|
||||
{
|
||||
// Aucun test necessaire car on force le rep de download sur
|
||||
// le rep export qui est propre a l'utilisateur
|
||||
$accessallowed=1;
|
||||
$original_file=$conf->import->dir_temp.'/'.$original_file;
|
||||
}
|
||||
@ -2222,13 +2220,19 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
// Wrapping pour l'editeur wysiwyg
|
||||
else if ($modulepart == 'editor')
|
||||
{
|
||||
// Aucun test necessaire car on force le rep de download sur
|
||||
// le rep export qui est propre a l'utilisateur
|
||||
$accessallowed=1;
|
||||
$original_file=$conf->fckeditor->dir_output.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour les backups
|
||||
|
||||
// Wrapping for miscellaneous medias files
|
||||
elseif ($modulepart == 'medias')
|
||||
{
|
||||
$accessallowed=1;
|
||||
global $dolibarr_main_data_root;
|
||||
$original_file=$dolibarr_main_data_root.'/medias/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping for backups
|
||||
else if ($modulepart == 'systemtools')
|
||||
{
|
||||
if ($fuser->admin)
|
||||
|
||||
@ -2775,7 +2775,7 @@ function dol_print_error($db='',$error='',$errors=null)
|
||||
|
||||
foreach($errors as $msg)
|
||||
{
|
||||
$msg=$langs->trans($msg);
|
||||
if (empty($msg)) continue;
|
||||
if ($_SERVER['DOCUMENT_ROOT']) // Mode web
|
||||
{
|
||||
$out.="<b>".$langs->trans("Message").":</b> ".$msg."<br>\n" ;
|
||||
|
||||
@ -71,7 +71,8 @@ function jsUnEscape($source)
|
||||
|
||||
|
||||
/**
|
||||
* Return list of modules directories
|
||||
* Return list of modules directories. We detect directories that contains a subdirectory /core/modules
|
||||
* We discard directory modules that contains 'disabled' into their name.
|
||||
*
|
||||
* @param string $subdir Sub directory (Example: '/mailings')
|
||||
* @return array Array of directories that can contains module descriptors
|
||||
@ -95,6 +96,8 @@ function dolGetModulesDirs($subdir='')
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (preg_match('/disabled/',$file)) continue; // We discard module if it contains disabled into name.
|
||||
|
||||
if (is_dir($dirroot.'/'.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS' && $file != 'includes')
|
||||
{
|
||||
if (is_dir($dirroot . '/' . $file . '/core/modules'.$subdir.'/'))
|
||||
@ -1963,6 +1966,11 @@ function getElementProperties($element_type)
|
||||
$module='ficheinter';
|
||||
$subelement='fichinter';
|
||||
}
|
||||
if ($element_type == 'dolresource' || $element_type == 'resource') {
|
||||
$classpath = 'resource/class';
|
||||
$module='resource';
|
||||
$subelement='dolresource';
|
||||
}
|
||||
$classfile = strtolower($subelement);
|
||||
$classname = ucfirst($subelement);
|
||||
|
||||
|
||||
@ -803,7 +803,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
||||
// First line of company infos
|
||||
$line1=""; $line2=""; $line3=""; $line4="";
|
||||
|
||||
if ($showdetails)
|
||||
if ($showdetails == 1 || $showdetails == 3)
|
||||
{
|
||||
// Company name
|
||||
if ($fromcompany->name)
|
||||
@ -813,7 +813,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
||||
// Address
|
||||
if ($fromcompany->address)
|
||||
{
|
||||
$line1.=($line1?" - ":"").$fromcompany->address;
|
||||
$line1.=($line1?" - ":"").str_replace("\n", ", ", $fromcompany->address);
|
||||
}
|
||||
// Zip code
|
||||
if ($fromcompany->zip)
|
||||
@ -828,12 +828,12 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
||||
// Phone
|
||||
if ($fromcompany->phone)
|
||||
{
|
||||
$line1.=($line1?" - ":"").$outputlangs->transnoentities("Phone").": ".$fromcompany->phone;
|
||||
$line2.=($line2?" - ":"").$outputlangs->transnoentities("Phone").": ".$fromcompany->phone;
|
||||
}
|
||||
// Fax
|
||||
if ($fromcompany->fax)
|
||||
{
|
||||
$line1.=($line1?" - ":"").$outputlangs->transnoentities("Fax").": ".$fromcompany->fax;
|
||||
$line2.=($line2?" - ":"").$outputlangs->transnoentities("Fax").": ".$fromcompany->fax;
|
||||
}
|
||||
|
||||
// URL
|
||||
@ -847,7 +847,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
||||
$line2.=($line2?" - ":"").$fromcompany->email;
|
||||
}
|
||||
}
|
||||
if ($showdetails || ($fromcompany->country_code == 'DE'))
|
||||
if ($showdetails == 2 || $showdetails == 3 || ($fromcompany->country_code == 'DE'))
|
||||
{
|
||||
// Managers
|
||||
if ($fromcompany->managers)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user