Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into dev_new_password_extrafeilds_type

This commit is contained in:
florian HENRY 2016-07-07 09:17:39 +02:00
commit 2d932066c7
204 changed files with 3442 additions and 2273 deletions

View File

@ -170,7 +170,7 @@ source_file = htdocs/langs/en_US/interventions.lang
source_lang = en_US source_lang = en_US
type = MOZILLAPROPERTIES type = MOZILLAPROPERTIES
[dolibarr.languages] [dolibarr.languages-not-res]
file_filter = htdocs/langs/<lang>/languages.lang file_filter = htdocs/langs/<lang>/languages.lang
source_file = htdocs/langs/en_US/languages.lang source_file = htdocs/langs/en_US/languages.lang
source_lang = en_US source_lang = en_US

View File

@ -21,10 +21,10 @@ TechnicalParameters=Param
IfFirstInstall=S'il s'agit de la première installation, merci de spécifier ces quelques paramètres techniques. Si vous ne les comprennez pas, êtes non sûr, ou procédez à une mise à jour, laissez les champs avec les valeurs proposées par défaut. IfFirstInstall=S'il s'agit de la première installation, merci de spécifier ces quelques paramètres techniques. Si vous ne les comprennez pas, êtes non sûr, ou procédez à une mise à jour, laissez les champs avec les valeurs proposées par défaut.
; WARNING !!! STRINGS FOR THIS 4 STRINGS MUST BE LOWER THAN 60 CHARACTERS ; WARNING !!! STRINGS FOR THIS 4 STRINGS MUST BE LOWER THAN 70 CHARACTERS
SMTPServer=Serveur SMTP (le votre ou celui de votre FAI, première installation uniquement) : SMTPServer=Serveur SMTP (le votre ou de votre FAI, première installation uniquement):
ApachePort=Port Apache (première installation uniquement, le choix standard est 80) : ApachePort=Port Apache (première installation uniquement, le choix standard est 80):
MySqlPort=Port Mysql (première installation uniquement, le choix standard est 3306) : MySqlPort=Port Mysql (première installation uniquement, le choix standard est 3306):
MySqlPassword=Mot de passe serveur+base MySql de root (première installation uniquement): MySqlPassword=Mot de passe serveur+base MySql de root (première installation uniquement):
FailedToDeleteLock=Echec de la suppression du fichier %1/www/dolibarr/install.lock. Vous pouvez ignorer l'avertissement mais il est possible que vous deviez le supprimer manuellement plus tard. Dans ce cas, cela vous sera signalé. Cliquez sur OK pour continuer... FailedToDeleteLock=Echec de la suppression du fichier %1/www/dolibarr/install.lock. Vous pouvez ignorer l'avertissement mais il est possible que vous deviez le supprimer manuellement plus tard. Dans ce cas, cela vous sera signalé. Cliquez sur OK pour continuer...

View File

@ -1,6 +1,6 @@
Alias /dolibarr "WAMPROOT/www/dolibarr/htdocs/" Alias /dolibarr "WAMPROOT/www/dolibarr/htdocs/"
# NOTE: # NOTE FOR APACHE 2.2:
# To restrict access to dolibarr from outside set lines # To restrict access to dolibarr from outside set lines
# #
# Order Deny,Allow # Order Deny,Allow
@ -12,10 +12,21 @@ Alias /dolibarr "WAMPROOT/www/dolibarr/htdocs/"
# Order Allow,Deny # Order Allow,Deny
# Allow from all # Allow from all
# #
# NOTE FOR APACHE 2.3:
# To restrict access to dolibarr from outside set lines
#
# <RequireAny>
# Require ip 127.0.0.1
# Require host localhost
# <RequireAny>
#
# instead of
#
# Require all granted
#
<Directory "WAMPROOT/www/dolibarr/htdocs/"> <Directory "WAMPROOT/www/dolibarr/htdocs/">
Options Indexes FollowSymLinks MultiViews Options Indexes FollowSymLinks MultiViews
AllowOverride all AllowOverride all
Order Allow,Deny Require all granted
Allow from all
</Directory> </Directory>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

View File

@ -99,13 +99,13 @@ Source: "build\exe\doliwamp\builddemosslfiles.bat.install"; DestDir: "{app}\"; F
Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversion; Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversion;
; PhpMyAdmin, Apache, Php, Mysql ; PhpMyAdmin, Apache, Php, Mysql
; Put here path of Wampserver applications ; 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.6, php 5.2.5 (5.2.11, 5.3.0 and 5.3.1 fails if php_exif, php_pgsql, php_zip is on), mysql 5.0.45
; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45 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
; Value ???: apache 2.4.19, php 5.5.12, mysql 5.6.17 ; Value ???: apache 2.4.19, php 5.5.12, mysql 5.0.45 instead of 5.6.17 (wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe)
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\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\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\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" 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"
; Mysql data files (does not overwrite if exists) ; 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" Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db"
; Dolibarr ; Dolibarr
@ -119,8 +119,8 @@ Source: "build\exe\doliwamp\phpmyadmin.conf.install"; DestDir: "{app}\alias"; Fl
Source: "build\exe\doliwamp\dolibarr.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\phpmyadmin4.1.14"; 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\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\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion;
Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php5.6.17"; Flags: ignoreversion; Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion;
Source: "build\exe\doliwamp\index.php.install"; DestDir: "{app}\www"; 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\install.forced.php.install"; DestDir: "{app}\www\dolibarr\htdocs\install"; Flags: ignoreversion;
Source: "build\exe\doliwamp\openssl.conf"; DestDir: "{app}"; Flags: ignoreversion; Source: "build\exe\doliwamp\openssl.conf"; DestDir: "{app}"; Flags: ignoreversion;
@ -146,6 +146,12 @@ Name: "{userdesktop}\Dolibarr Help center"; Filename: "{app}\rundolihelp.bat"; W
;Name: "{userstartup}\DoliWamp server"; Filename: "{app}\startdoliwamp.bat"; WorkingDir: "{app}"; Flags: runminimized; IconFilename: {app}\www\dolibarr\doc\images\dolibarr.ico ;Name: "{userstartup}\DoliWamp server"; Filename: "{app}\startdoliwamp.bat"; WorkingDir: "{app}"; Flags: runminimized; IconFilename: {app}\www\dolibarr\doc\images\dolibarr.ico
[Registry]
; Add "run as admin" flag. Same than command line: reg add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "<Path to your exe>" /t REG_SZ /d RUNASADMIN
Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\"; ValueType: String; ValueName: "{app}\startdoliwamp.bat"; ValueData: "RUNASADMIN"; Flags: uninsdeletekeyifempty uninsdeletevalue;
Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\"; ValueType: String; ValueName: "{app}\stopdoliwamp.bat"; ValueData: "RUNASADMIN"; Flags: uninsdeletekeyifempty uninsdeletevalue;
[Code] [Code]
//variables globales //variables globales
@ -198,7 +204,7 @@ begin
//version des applis, a modifier pour chaque version de WampServer 2 //version des applis, a modifier pour chaque version de WampServer 2
apacheVersion := '2.4.9'; apacheVersion := '2.4.9';
phpVersion := '5.5.12' ; phpVersion := '5.5.12' ;
mysqlVersion := '5.6.17'; mysqlVersion := '5.0.45';
phpmyadminVersion := '4.1.14'; phpmyadminVersion := '4.1.14';
smtpServer := 'localhost'; smtpServer := 'localhost';
@ -256,14 +262,13 @@ begin
// Prepare an object calle "Page" of type wpInstalling. // Prepare an object calle "Page" of type wpInstalling.
// Object will be show later in NextButtonClick function. // Object will be show later in NextButtonClick function.
Page := CreateInputQueryPage(wpInstalling, Page := CreateInputQueryPage(wpInstalling, CustomMessage('TechnicalParameters'), '', CustomMessage('IfFirstInstall'));
CustomMessage('TechnicalParameters'), '',
CustomMessage('IfFirstInstall'));
// TODO Add control differently if first install or update // TODO Add control differently if first install or update
if firstinstall if firstinstall
then then
begin begin
// False means it's not a password edit
Page.Add(CustomMessage('SMTPServer'), False); Page.Add(CustomMessage('SMTPServer'), False);
Page.Add(CustomMessage('ApachePort'), False); Page.Add(CustomMessage('ApachePort'), False);
Page.Add(CustomMessage('MySqlPort'), False); Page.Add(CustomMessage('MySqlPort'), False);
@ -271,6 +276,7 @@ begin
end end
else else
begin begin
// False means it's not a password edit
Page.Add(CustomMessage('SMTPServer'), False); Page.Add(CustomMessage('SMTPServer'), False);
Page.Add(CustomMessage('ApachePort'), False); Page.Add(CustomMessage('ApachePort'), False);
Page.Add(CustomMessage('MySqlPort'), False); Page.Add(CustomMessage('MySqlPort'), False);
@ -310,8 +316,7 @@ function NextButtonClick(CurPageID: Integer): Boolean;
var myResult: Integer; var myResult: Integer;
var res: Boolean; var res: Boolean;
var paramok: Boolean; var paramok: Boolean;
var datadirold: String; var datadir: String;
var datadirnew: String;
var exedirold: String; var exedirold: String;
var exedirnew: String; var exedirnew: String;
var themessage: String; var themessage: String;
@ -330,10 +335,22 @@ begin
winPath := ExpandConstant('{win}'); winPath := ExpandConstant('{win}');
pathWithSlashes := path; pathWithSlashes := path;
StringChange (pathWithSlashes, '\','/'); StringChange (pathWithSlashes, '\','/');
datadirold := pathWithSlashes+'/bin/mysql/mysql5.6.17/data'; datadir := pathWithSlashes+'/bin/mysql/data';
datadirnew := pathWithSlashes+'/bin/mysql/data'; exedirold := pathWithSlashes+'/bin/mysql/mysql5.0.45';
exedirold := pathWithSlashes+'/bin/mysql/mysql5.6.17'; exedirnew := pathWithSlashes+'/bin/mysql/mysql5.0.45';
exedirnew := pathWithSlashes+'/bin/mysql/mysql5.6.17';
//----------------------------------------------
// Test if msvcr110 DLL has been installed
//----------------------------------------------
if not FileExists ('c:/windows/system32/msvcr110.dll') and not FileExists ('c:/windows/sysWOW64/msvcr110.dll') and not FileExists ('c:/winnt/system32/msvcr110.dll') and not FileExists ('c:/winnt/sysWOW64/msvcr110.dll') then
begin
// TODO Copy file or ask to install package ?
//CustomMessage('YouWillInstallDoliWamp')+#13#13
MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from <a href="http://ccc">http://www.microsoft.com/en-us/download/details.aspx?id=30679</a> then restart DoliWamp installation/upgrade.',mbInformation,MB_OK);
end;
// If we have a new database version, we should only copy old my.ini file into new directory // 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. // and change only all basedir= strings to use new version. Like this, data dir is still correct.
@ -664,7 +681,7 @@ begin
//installDir et version de php //installDir et version de php
StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True); StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True); StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
StringChangeEx (srcContents, 'WAMPMYSQLVERSION', myport, True); StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
SaveStringToFile(destFile,srcContents, False); SaveStringToFile(destFile,srcContents, False);
end end
@ -738,6 +755,7 @@ begin
LoadStringFromFile (srcFile, srcContents); LoadStringFromFile (srcFile, srcContents);
//version de apache et mysql //version de apache et mysql
StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True); StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True); StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True);
@ -746,27 +764,6 @@ begin
//----------------------------------------------
// Create file install_services_auto.bat (always)
//----------------------------------------------
destFile := pathWithSlashes+'/install_services_auto.bat';
srcFile := pathWithSlashes+'/install_services_auto.bat.install';
if FileExists (srcFile) then
begin
LoadStringFromFile (srcFile, srcContents);
//version de apache et mysql
StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True);
SaveStringToFile(destFile,srcContents, False);
end
//---------------------------------------------- //----------------------------------------------
// Create file uninstall_services.bat (always) // Create file uninstall_services.bat (always)
//---------------------------------------------- //----------------------------------------------
@ -779,6 +776,7 @@ begin
LoadStringFromFile (srcFile, srcContents); LoadStringFromFile (srcFile, srcContents);
//version de apache et mysql //version de apache et mysql
StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True); StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True); StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True);
@ -967,7 +965,6 @@ end;
procedure DeinitializeSetup(); procedure DeinitializeSetup();
begin begin
// DeleteFile(path+'\install_services.bat'); // DeleteFile(path+'\install_services.bat');
// DeleteFile(path+'\install_services_auto.bat');
end; end;
@ -1004,7 +1001,7 @@ Filename: "{app}\rundoliwamp.bat"; Description: {cm:LaunchNow}; Flags: shellexec
[UninstallDelete] [UninstallDelete]
Type: files; Name: "{app}\*.*" Type: files; Name: "{app}\*.*"
Type: files; Name: "{app}\bin\mysql\mysql5.6.17\*.*" Type: files; Name: "{app}\bin\mysql\mysql5.0.45\*.*"
Type: filesandordirs; Name: "{app}\alias" Type: filesandordirs; Name: "{app}\alias"
Type: filesandordirs; Name: "{app}\apps" Type: filesandordirs; Name: "{app}\apps"
Type: filesandordirs; Name: "{app}\bin\apache" Type: filesandordirs; Name: "{app}\bin\apache"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -66,19 +66,23 @@ Listen WAMPAPACHEPORT
# #
LoadModule actions_module modules/mod_actions.so LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_digest_module modules/mod_auth_digest.so #LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule authn_anon_module modules/mod_authn_anon.so #LoadModule authn_anon_module modules/mod_authn_anon.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so #LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.so LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_core_module modules/mod_authz_core.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so #LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so #LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so LoadModule autoindex_module modules/mod_autoindex.so
LoadModule buffer_module modules/mod_buffer.so
LoadModule cache_module modules/mod_cache.so
LoadModule cache_disk_module modules/mod_cache_disk.so
#LoadModule cern_meta_module modules/mod_cern_meta.so #LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule cgi_module modules/mod_cgi.so LoadModule cgi_module modules/mod_cgi.so
#LoadModule dav_module modules/mod_dav.so #LoadModule dav_module modules/mod_dav.so
@ -96,23 +100,23 @@ LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so LoadModule mime_module modules/mod_mime.so
#LoadModule mime_magic_module modules/mod_mime_magic.so #LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule negotiation_module modules/mod_negotiation.so
#LoadModule proxy_module modules/mod_proxy.so #LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so #LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_http_module modules/mod_proxy_http.so #LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule speling_module modules/mod_speling.so #LoadModule speling_module modules/mod_speling.so
#LoadModule ssl_module modules/mod_ssl.so
LoadModule status_module modules/mod_status.so LoadModule status_module modules/mod_status.so
#LoadModule unique_id_module modules/mod_unique_id.so #LoadModule unique_id_module modules/mod_unique_id.so
LoadModule userdir_module modules/mod_userdir.so LoadModule userdir_module modules/mod_userdir.so
#LoadModule usertrack_module modules/mod_usertrack.so #LoadModule usertrack_module modules/mod_usertrack.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so LoadModule vhost_alias_module modules/mod_vhost_alias.so
#LoadModule ssl_module modules/mod_ssl.so LoadModule php5_module "WAMPROOT/bin/php/phpWAMPPHPVERSION/php5apache2_4.dll"
LoadModule php5_module "WAMPROOT/bin/php/phpWAMPPHPVERSION/php5apache2_2.dll"
# #
# ExtendedStatus controls whether Apache will generate "full" status # ExtendedStatus controls whether Apache will generate "full" status
@ -123,9 +127,9 @@ ExtendedStatus On
<Location /server-status> <Location /server-status>
SetHandler server-status SetHandler server-status
Order Deny,Allow Require local
Deny from all #Require ip 1.2.3.4
Allow from localhost, 127.0.0.1 #Require host 1.2.3.4
</Location> </Location>
@ -211,9 +215,7 @@ KeepAliveTimeout 30
<Directory /> <Directory />
Options FollowSymLinks Options FollowSymLinks
AllowOverride None AllowOverride None
Order deny,allow Require all denied
Deny from all
Satisfy all
</Directory> </Directory>
# #
@ -253,9 +255,10 @@ KeepAliveTimeout 30
# Controls who can get stuff from this server. # Controls who can get stuff from this server.
# #
# onlineoffline tag - don't remove # onlineoffline tag - don't remove
Order Deny,Allow <RequireAny>
Deny from all Require ip 127.0.0.1
Allow from 127.0.0.1 Require host localhost
</RequireAny>
</Directory> </Directory>
@ -272,8 +275,7 @@ KeepAliveTimeout 30
# viewed by Web clients. # viewed by Web clients.
# #
<FilesMatch "^\.ht"> <FilesMatch "^\.ht">
Order allow,deny Require all denied
Deny from all
</FilesMatch> </FilesMatch>
# #
@ -359,8 +361,7 @@ LogLevel warn
<Directory "cgi-bin"> <Directory "cgi-bin">
AllowOverride None AllowOverride None
Options None Options None
Order allow,deny Require all granted
Allow from all
</Directory> </Directory>
# #
@ -410,7 +411,7 @@ LogLevel warn
# keep browsers from trying to display binary files as though they are # keep browsers from trying to display binary files as though they are
# text. # text.
# #
DefaultType text/plain #DefaultType text/plain
<IfModule mime_module> <IfModule mime_module>
# #

View File

@ -8,6 +8,8 @@ echo ---- Execute install_services.bat >> doliwamp.log 2>>&1
REM NET STOP doliwampapache REM NET STOP doliwampapache
REM NET STOP doliwampmysqld REM NET STOP doliwampmysqld
cd "WAMPROOT"
REM Apache x.x REM Apache x.x
.\bin\apache\apacheWAMPAPACHEVERSION\bin\httpd.exe -k install -n doliwampapache .\bin\apache\apacheWAMPAPACHEVERSION\bin\httpd.exe -k install -n doliwampapache
REM reg add HKLM\SYSTEM\CurrentControlSet\Services\doliwampapache /V Start /t REG_DWORD /d 3 /f REM reg add HKLM\SYSTEM\CurrentControlSet\Services\doliwampapache /V Start /t REG_DWORD /d 3 /f
@ -19,3 +21,5 @@ REM Mysql 5.1+
REM .\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld.exe --install doliwampmysqld REM .\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld.exe --install doliwampmysqld
echo ---- End script >> doliwamp.log 2>>&1 echo ---- End script >> doliwamp.log 2>>&1
REM pause

View File

@ -77,10 +77,6 @@ log-error=WAMPROOT/logs/mysql.log
#Path to the database root #Path to the database root
datadir=WAMPROOT/bin/mysql/data datadir=WAMPROOT/bin/mysql/data
# The default character set that will be used when a new schema or table is
# created and no character set is defined
default-character-set=latin1
# The default storage engine that will be used when create new tables when # The default storage engine that will be used when create new tables when
default-storage-engine=INNODB default-storage-engine=INNODB
@ -101,13 +97,6 @@ max_connections=255
# slowdown instead of a performance improvement. # slowdown instead of a performance improvement.
query_cache_size=8M query_cache_size=8M
# The number of open tables for all threads. Increasing this value
# increases the number of file descriptors that mysqld requires.
# Therefore you have to make sure to set the amount of open files
# allowed to at least 4096 in the variable "open-files-limit" in
# section [mysqld_safe]
table_cache=510
# Maximum size for internal (in-memory) temporary tables. If a table # Maximum size for internal (in-memory) temporary tables. If a table
# grows larger than this value, it is automatically converted to disk # grows larger than this value, it is automatically converted to disk
# based table This limitation is for a single table. There can be many # based table This limitation is for a single table. There can be many
@ -125,18 +114,6 @@ thread_cache_size=12
#*** MyISAM Specific options #*** MyISAM Specific options
# The maximum size of the temporary file MySQL is allowed to use while
# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.
# If the file-size would be bigger than this, the index will be created
# through the key cache (which is slower).
myisam_max_sort_file_size=100G
# If the temporary file used for fast index creation would be bigger
# than using the key cache by the amount specified here, then prefer the
# key cache method. This is mainly used to force long character keys in
# large tables to use the slower key cache method to create the index.
myisam_max_extra_sort_file_size=100G
# If the temporary file used for fast index creation would be bigger # If the temporary file used for fast index creation would be bigger
# than using the key cache by the amount specified here, then prefer the # than using the key cache by the amount specified here, then prefer the
# key cache method. This is mainly used to force long character keys in # key cache method. This is mainly used to force long character keys in
@ -170,13 +147,6 @@ sort_buffer_size=203K
# and speed up some things. # and speed up some things.
#skip-innodb #skip-innodb
# Additional memory pool that is used by InnoDB to store metadata
# information. If InnoDB requires more memory for this purpose it will
# start to allocate it from the OS. As this is fast enough on most
# recent operating systems, you normally do not need to change this
# value. SHOW INNODB STATUS will display the current amount used.
innodb_additional_mem_pool_size=2M
# If set to 1, InnoDB will flush (fsync) the transaction logs to the # If set to 1, InnoDB will flush (fsync) the transaction logs to the
# disk at each commit, which offers full ACID behavior. If you are # disk at each commit, which offers full ACID behavior. If you are
# willing to compromise this safety, and you are running small # willing to compromise this safety, and you are running small
@ -226,7 +196,7 @@ port=WAMPMYSQLPORT
#Path to installation directory. All paths are usually resolved relative to this. #Path to installation directory. All paths are usually resolved relative to this.
basedir=WAMPROOT/bin/mysql/mysql5.6.17 basedir=WAMPROOT/bin/mysql/mysqlWAMPMYSQLVERSION
#log file #log file
log-error=WAMPROOT/logs/mysql.log log-error=WAMPROOT/logs/mysql.log
@ -234,10 +204,6 @@ log-error=WAMPROOT/logs/mysql.log
#Path to the database root #Path to the database root
datadir=WAMPROOT/bin/mysql/data datadir=WAMPROOT/bin/mysql/data
# The default character set that will be used when a new schema or table is
# created and no character set is defined
default-character-set=latin1
# The default storage engine that will be used when create new tables when # The default storage engine that will be used when create new tables when
default-storage-engine=INNODB default-storage-engine=INNODB
@ -258,13 +224,6 @@ max_connections=255
# slowdown instead of a performance improvement. # slowdown instead of a performance improvement.
query_cache_size=8M query_cache_size=8M
# The number of open tables for all threads. Increasing this value
# increases the number of file descriptors that mysqld requires.
# Therefore you have to make sure to set the amount of open files
# allowed to at least 4096 in the variable "open-files-limit" in
# section [mysqld_safe]
table_cache=510
# Maximum size for internal (in-memory) temporary tables. If a table # Maximum size for internal (in-memory) temporary tables. If a table
# grows larger than this value, it is automatically converted to disk # grows larger than this value, it is automatically converted to disk
# based table This limitation is for a single table. There can be many # based table This limitation is for a single table. There can be many
@ -282,18 +241,6 @@ thread_cache_size=12
#*** MyISAM Specific options #*** MyISAM Specific options
# The maximum size of the temporary file MySQL is allowed to use while
# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.
# If the file-size would be bigger than this, the index will be created
# through the key cache (which is slower).
myisam_max_sort_file_size=100G
# If the temporary file used for fast index creation would be bigger
# than using the key cache by the amount specified here, then prefer the
# key cache method. This is mainly used to force long character keys in
# large tables to use the slower key cache method to create the index.
myisam_max_extra_sort_file_size=100G
# If the temporary file used for fast index creation would be bigger # If the temporary file used for fast index creation would be bigger
# than using the key cache by the amount specified here, then prefer the # than using the key cache by the amount specified here, then prefer the
# key cache method. This is mainly used to force long character keys in # key cache method. This is mainly used to force long character keys in
@ -327,13 +274,6 @@ sort_buffer_size=203K
# and speed up some things. # and speed up some things.
#skip-innodb #skip-innodb
# Additional memory pool that is used by InnoDB to store metadata
# information. If InnoDB requires more memory for this purpose it will
# start to allocate it from the OS. As this is fast enough on most
# recent operating systems, you normally do not need to change this
# value. SHOW INNODB STATUS will display the current amount used.
innodb_additional_mem_pool_size=2M
# If set to 1, InnoDB will flush (fsync) the transaction logs to the # If set to 1, InnoDB will flush (fsync) the transaction logs to the
# disk at each commit, which offers full ACID behavior. If you are # disk at each commit, which offers full ACID behavior. If you are
# willing to compromise this safety, and you are running small # willing to compromise this safety, and you are running small

View File

@ -1,22 +1,35 @@
Alias /phpmyadmin "WAMPROOT/apps/phpmyadminWAMPPHPMYADMINVERSION/" Alias /phpmyadmin "WAMPROOT/apps/phpmyadminWAMPPHPMYADMINVERSION/"
# to give access to phpmyadmin from outside # NOTE FOR APACHE 2.2:
# replace the lines # To grant access to dolibarr from outside set lines
# #
# Order Deny,Allow # Order Allow,Deny
# Allow from all
#
# instead of
#
# Order Deny,Allow
# Deny from all # Deny from all
# Allow from 127.0.0.1 # Allow from 127.0.0.1
# #
# by # NOTE FOR APACHE 2.3:
# To grant access to dolibarr from outside set lines
# #
# Order Allow,Deny # Require all granted
# Allow from all #
# instead of
#
# <RequireAny>
# Require ip 127.0.0.1
# Require host localhost
# <RequireAny>
# #
<Directory "WAMPROOT/apps/phpmyadminWAMPPHPMYADMINVERSION/"> <Directory "WAMPROOT/apps/phpmyadminWAMPPHPMYADMINVERSION/">
Options Indexes FollowSymLinks MultiViews Options Indexes FollowSymLinks MultiViews
AllowOverride all AllowOverride all
Order Deny,Allow <RequireAny>
Deny from all Require ip 127.0.0.1
Allow from 127.0.0.1 Require host localhost
</RequireAny>
</Directory> </Directory>

View File

@ -10,9 +10,11 @@ NET START doliwampapache >> doliwamp.log 2>>&1
echo NET START doliwampmysqld >> doliwamp.log 2>>&1 echo NET START doliwampmysqld >> doliwamp.log 2>>&1
NET START doliwampmysqld >> doliwamp.log 2>>&1 NET START doliwampmysqld >> doliwamp.log 2>>&1
REM You can also check logs into c:/dolibarr/logs if start fails
echo Please wait... echo Please wait...
echo ---- End script >> doliwamp.log 2>>&1 echo ---- End script >> doliwamp.log 2>>&1
REM sleep is not a Windows commande REM sleep is not a Windows commande
REM sleep 1 REM sleep 2
ping 1.1.1.1 -n 1 -w 1000 > nul ping 127.0.0.1 -n 2 -w 1000 > nul

View File

@ -13,5 +13,6 @@ echo
echo Running Mysql as user process (this process does not return so we use "start") echo Running Mysql as user process (this process does not return so we use "start")
start WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld-nt.exe --defaults-file=WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\my.ini --console start WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld-nt.exe --defaults-file=WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\my.ini --console
REM start WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld.exe --defaults-file=WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\my.ini --console
pause pause

View File

@ -16,3 +16,5 @@ echo ---- End script >> doliwamp.log 2>>&1
REM sleep is not a Windows command REM sleep is not a Windows command
REM sleep 1 REM sleep 1
ping 1.1.1.1 -n 1 -w 1000 > nul ping 1.1.1.1 -n 1 -w 1000 > nul
REM pause

View File

@ -3,10 +3,19 @@ REM --------------------------------------------------------
REM This script install Apache and Mysql DoliWamp services REM This script install Apache and Mysql DoliWamp services
REM -------------------------------------------------------- REM --------------------------------------------------------
cd "WAMPROOT"
echo ---- Execute uninstall_services.bat >> doliwamp.log 2>>&1 echo ---- Execute uninstall_services.bat >> doliwamp.log 2>>&1
NET STOP doliwampapache NET STOP doliwampapache
.\bin\apache\apacheWAMPAPACHEVERSION\bin\httpd.exe -k uninstall -n doliwampapache .\bin\apache\apacheWAMPAPACHEVERSION\bin\httpd.exe -k uninstall -n doliwampapache
NET STOP doliwampmysqld NET STOP doliwampmysqld
REM Mysql 5.0-
.\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld-nt.exe --remove doliwampmysqld .\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld-nt.exe --remove doliwampmysqld
REM Mysql 5.1+
REM .\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld.exe --remove doliwampmysqld
REM wampmanager.exe -quit -id={doliwampserver} REM wampmanager.exe -quit -id={doliwampserver}
echo ---- End script >> doliwamp.log 2>>&1 echo ---- End script >> doliwamp.log 2>>&1
REM pause

View File

@ -1,2 +1 @@
Order allow,deny Require all granted
Deny from all

View File

@ -90,7 +90,7 @@ class modMyModule extends DolibarrModules
// 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx) // 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx)
// 'css' => array('/mymodule/css/mymodule.css.php'), // Set this to relative path of css file if module has its own css file // 'css' => array('/mymodule/css/mymodule.css.php'), // Set this to relative path of css file if module has its own css file
// 'js' => array('/mymodule/js/mymodule.js'), // Set this to relative path of js file if module must load a js on all pages // 'js' => array('/mymodule/js/mymodule.js'), // Set this to relative path of js file if module must load a js on all pages
// 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module // 'hooks' => array('hookcontext1','hookcontext2',...) // Set here all hooks context managed by module. You can also set hook context 'all'
// 'dir' => array('output' => 'othermodulename'), // To force the default directories names // 'dir' => array('output' => 'othermodulename'), // To force the default directories names
// 'workflow' => array('WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2'=>array('enabled'=>'! empty($conf->module1->enabled) && ! empty($conf->module2->enabled)', 'picto'=>'yourpicto@mymodule')) // Set here all workflow context managed by module // 'workflow' => array('WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2'=>array('enabled'=>'! empty($conf->module1->enabled) && ! empty($conf->module2->enabled)', 'picto'=>'yourpicto@mymodule')) // Set here all workflow context managed by module
// ); // );

View File

@ -324,6 +324,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
if (preg_match('/GlobalVariableUpdaterHelp$/', $value)) $qualifiedforclean=0; if (preg_match('/GlobalVariableUpdaterHelp$/', $value)) $qualifiedforclean=0;
if (preg_match('/OppStatus/', $value)) $qualifiedforclean=0; if (preg_match('/OppStatus/', $value)) $qualifiedforclean=0;
if (preg_match('/AvailabilityType/', $value)) $qualifiedforclean=0; if (preg_match('/AvailabilityType/', $value)) $qualifiedforclean=0;
if (preg_match('/CardProduct/', $value)) $qualifiedforclean=0;
if (preg_match('/sms/i', $value)) $qualifiedforclean=0; if (preg_match('/sms/i', $value)) $qualifiedforclean=0;
if (preg_match('/TF_/i', $value)) $qualifiedforclean=0; if (preg_match('/TF_/i', $value)) $qualifiedforclean=0;

View File

@ -16,9 +16,9 @@
*/ */
/** /**
* \file htdocs/accountancy/admin/categories.php * \file htdocs/accountancy/admin/categories.php
* \ingroup Advanced accountancy * \ingroup Advanced accountancy
* \brief Page to assign mass categories to accounts * \brief Page to assign mass categories to accounts
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
@ -36,10 +36,10 @@ $langs->load("accountancy");
$mesg = ''; $mesg = '';
$action = GETPOST('action'); $action = GETPOST('action');
$cat_id = GETPOST('account_category'); $cat_id = GETPOST('account_category');
$selectcpt = GETPOST('cpt_bk'); $selectcpt = GETPOST('cpt_bk', 'array');
$cpt_id = GETPOST('cptid'); $cpt_id = GETPOST('cptid');
if($cat_id == 0){ if ($cat_id == 0) {
$cat_id = null; $cat_id = null;
} }
@ -54,27 +54,26 @@ if (! $user->admin)
$AccCat = new AccountancyCategory($db); $AccCat = new AccountancyCategory($db);
// si ajout de comptes // si ajout de comptes
if(!empty($selectcpt)){ if (! empty($selectcpt)) {
$cpts = array(); $cpts = array ();
$i = 0; foreach ( $selectcpt as $selectedOption ) {
foreach ($selectcpt as $selectedOption){ if (! array_key_exists($selectedOption, $cpts))
$cpts[$i] = "'".$selectedOption."'"; $cpts[$selectedOption] = "'" . $selectedOption . "'";
$i++;
} }
if($AccCat->updateAccAcc($cat_id, $cpts)){ $return= $AccCat->updateAccAcc($cat_id, $cpts);
if ($return<0) {
setEventMessages($langs->trans('errors'), $AccCat->errors, 'errors');
} else {
setEventMessages($langs->trans('Saved'), null, 'mesgs'); setEventMessages($langs->trans('Saved'), null, 'mesgs');
}else{
setEventMessages($langs->trans('errors'), null, 'errors');
} }
} }
if ($action == 'delete') { if ($action == 'delete') {
if($cpt_id){ if ($cpt_id) {
if($AccCat->deleteCptCat($cpt_id)){ if ($AccCat->deleteCptCat($cpt_id)) {
setEventMessages($langs->trans('Deleted'), null, 'mesgs'); setEventMessages($langs->trans('Deleted'), null, 'mesgs');
}else{ } else {
setEventMessages($langs->trans('errors'), null, 'errors'); setEventMessages($langs->trans('errors'), null, 'errors');
} }
} }
@ -88,63 +87,67 @@ llxheader('', $langs->trans('AccountAccounting'));
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
$form = new Form($db); $form = new Form($db);
print load_fiche_titre($langs->trans('Categories')); print load_fiche_titre($langs->trans('Categories'));
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n"; 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="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="display">'; print '<input type="hidden" name="action" value="display">';
dol_fiche_head(); dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Category // Category
print '<tr><td>' . $langs->trans("AccountingCategory") . '</td>'; print '<tr><td>' . $langs->trans("AccountingCategory") . '</td>';
print '<td>'; print '<td>';
$formaccounting->select_accounting_category($cat_id, 'account_category', 1); $formaccounting->select_accounting_category($cat_id, 'account_category', 1);
print '<input class="button" type="submit" value="' . $langs->trans("Display") . '">'; print '<input class="button" type="submit" value="' . $langs->trans("Display") . '">';
print '</td></tr>'; print '</td></tr>';
if (! empty($cat_id)) {
if(!empty($cat_id)){ $return = $AccCat->getCptBK($cat_id);
$obj = $AccCat->getCptBK($cat_id); if ($return < 0) {
print '<tr><td>' . $langs->trans("AddCompteFromBK") . '</td>'; setEventMessages(null, $AccCat->errors, 'errors');
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 '<tr><td>' . $langs->trans("AddCompteFromBK") . '</td>';
print '<td>';
if (is_array($AccCat->lines_cptbk) && count($AccCat->lines_cptbk) > 0) {
print '<select size="' . count($obj) . '" name="cpt_bk[]" multiple>';
foreach ( $AccCat->lines_cptbk 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>'; print '</table>';
dol_fiche_end(); dol_fiche_end();
print '</form>'; print '</form>';
if ($action == 'display' || $action == 'delete') { if ($action == 'display' || $action == 'delete') {
print '<table class="noborder" width="100%">'; 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>'; 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)){ if (! empty($cat_id)) {
$obj = $AccCat->display($cat_id); $return = $AccCat->display($cat_id);
$j=1; if ($return < 0) {
if(!empty($obj)){ setEventMessages(null, $AccCat->errors, 'errors');
foreach ( $obj as $cpt ) { }
$j = 1;
if (is_array($AccCat->lines_display) && count($AccCat->lines_display) > 0) {
foreach ( $AccCat->lines_display as $cpt ) {
$var = ! $var; $var = ! $var;
print '<tr'. $bc[$var].'>'; print '<tr' . $bc[$var] . '>';
print '<td>' . length_accountg($cpt->account_number) . '</td>'; print '<td>' . length_accountg($cpt->account_number) . '</td>';
print '<td>' . $cpt->label . '</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 $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 '<td><input class="button" type="button" id="action-delete' . $j . '" value="' . $langs->trans("Delete") . '"></td>';
print "</tr>\n"; print "</tr>\n";
$j++; $j ++;
} }
} }
} }

View File

@ -18,9 +18,9 @@
*/ */
/** /**
* \file htdocs/accountancy/bookkeeping/card.php * \file htdocs/accountancy/bookkeeping/card.php
* \ingroup Advanced accountancy * \ingroup Advanced accountancy
* \brief Page to show book-entry * \brief Page to show book-entry
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
@ -346,7 +346,7 @@ if ($action == 'create') {
foreach ( $book->linesmvt as $line ) { foreach ( $book->linesmvt as $line ) {
$var = ! $var; $var = ! $var;
print '<tr'. $bc[$var].'>'; print '<tr' . $bc[$var] . '>';
$total_debit += $line->debit; $total_debit += $line->debit;
$total_credit += $line->credit; $total_credit += $line->credit;
@ -392,15 +392,13 @@ if ($action == 'create') {
if ($total_debit != $total_credit) { if ($total_debit != $total_credit) {
setEventMessages(null, array ( setEventMessages(null, array (
'MvtNotCorrectlyBalanced', $langs->trans('MvtNotCorrectlyBalanced', $total_credit, $total_debit)
$total_credit,
$total_debit
), 'errors'); ), 'errors');
} }
if ($action == "" || $action == 'add') { if ($action == "" || $action == 'add') {
$var = ! $var; $var = ! $var;
print '<tr'. $bc[$var].'>'; print '<tr' . $bc[$var] . '>';
print '<td>'; print '<td>';
print $formventilation->select_account($account_number, 'account_number', 0, array (), 1, 1, ''); print $formventilation->select_account($account_number, 'account_number', 0, array (), 1, 1, '');
print '</td>'; print '</td>';

View File

@ -202,14 +202,22 @@ if ($action == 'delbookkeeping') {
if ($action == 'delbookkeepingyearconfirm') { if ($action == 'delbookkeepingyearconfirm') {
$delyear = GETPOST('delyear', 'int'); $delyear = GETPOST('delyear', 'int');
if ($delyear==-1) {
$delyear=0;
}
$deljournal = GETPOST('deljournal','alpha');
if ($deljournal==-1) {
$deljournal=0;
}
if (! empty($delyear)) {
$result = $object->deleteByYear($delyear); if (! empty($delyear) || ! empty($deljournal)) {
$result = $object->deleteByYearAndJournal($delyear,$deljournal);
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
Header("Location: list.php"); Header("Location: list.php");
exit(); exit;
} }
} }
if ($action == 'delmouvconfirm') { if ($action == 'delmouvconfirm') {
@ -222,7 +230,7 @@ if ($action == 'delmouvconfirm') {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
Header("Location: list.php"); Header("Location: list.php");
exit(); exit;
} }
} }
if ($action == 'export_csv') { if ($action == 'export_csv') {
@ -276,11 +284,13 @@ if ($action == 'delbookkeepingyear') {
$form_question = array (); $form_question = array ();
$delyear = GETPOST('delyear'); $delyear = GETPOST('delyear');
$deljournal = GETPOST('deljournal');
if (empty($delyear)) { if (empty($delyear)) {
$delyear = dol_print_date(dol_now(), '%Y'); $delyear = dol_print_date(dol_now(), '%Y');
} }
$year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array'); $year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
$journal_array = $formventilation->selectjournal_accountancy_bookkepping($deljournal, 'deljournal', 0, 'array');
$form_question['delyear'] = array ( $form_question['delyear'] = array (
'name' => 'delyear', 'name' => 'delyear',
@ -289,6 +299,13 @@ if ($action == 'delbookkeepingyear') {
'values' => $year_array, 'values' => $year_array,
'default' => $delyear 'default' => $delyear
); );
$form_question['deljournal'] = array (
'name' => 'deljournal',
'type' => 'select',
'label' => $langs->trans('DelJournal'),
'values' => $journal_array,
'default' => $deljournal
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1);
print $formconfirm; print $formconfirm;

View File

@ -17,9 +17,9 @@
*/ */
/** /**
* \file htdocs/accountancy/class/accountancycategory.class.php * \file htdocs/accountancy/class/accountancycategory.class.php
* \ingroup Advanced accountancy * \ingroup Advanced accountancy
* \brief File of class to manage categories of an accounting category_type * \brief File of class to manage categories of an accounting category_type
*/ */
// Class // Class
@ -32,18 +32,20 @@ class AccountancyCategory
{ {
private $db; private $db;
public $error; public $error;
public $errors = array(); public $errors = array ();
//public $element='accounting_category'; public $element = 'accounting_category';
//public $table_element='c_accounting_category'; public $table_element = 'c_accounting_category';
public $id; public $id;
public $lines_cptbk;
public $lines_display;
public $sdc;
/** /**
* Constructor * Constructor
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
public function __construct($db) public function __construct($db) {
{
$this->db = $db; $this->db = $db;
return 1; return 1;
@ -52,122 +54,136 @@ class AccountancyCategory
/** /**
* Function to select all accounting accounts from an accounting category * Function to select all accounting accounts from an accounting category
* *
* @param int $id Id * @param int $id Id
* *
* @return int <0 if KO, 0 if not found, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
public function display($id) public function display($id) {
{
$sql = "SELECT t.rowid, t.account_number, t.label"; $sql = "SELECT t.rowid, t.account_number, t.label";
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql.= " WHERE t.fk_accounting_category = " . $id; $sql .= " WHERE t.fk_accounting_category = " . $id;
$this->lines_display = array ();
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$i = 0;
$obj = '';
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
if ($num) { if ($num) {
while ( $i < $num ) { while ( $obj = $this->db->fetch_object($resql) ) {
$obj[$i] = $this->db->fetch_object($resql); $this->lines_display[] = $obj;
$i ++;
} }
} }
return $obj; return $num;
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error " . $this->db->lasterror();
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); $this->errors[] = $this->error;
dol_syslog(__METHOD__ . " " . implode(',' . $this->errors), LOG_ERR);
return -1; return - 1;
} }
} }
/** /**
* Function to select accountiing category of an accounting account present in chart of accounts * Function to select accountiing category of an accounting account present in chart of accounts
* *
* @param int $id Id category * @param int $id Id category
* *
* @return int <0 if KO, 0 if not found, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
public function getCptBK($id) public function getCptBK($id) {
{
global $conf; global $conf;
$sql = "SELECT t.numero_compte, t.label_compte, t.doc_ref"; $sql = "SELECT t.numero_compte, t.label_compte, t.doc_ref";
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
$sql.= " WHERE t.numero_compte NOT IN ("; $sql .= " WHERE t.numero_compte NOT IN (";
$sql.= " SELECT t.account_number"; $sql .= " SELECT t.account_number";
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql.= " WHERE t.fk_accounting_category = " . $id .")"; $sql .= " WHERE t.fk_accounting_category = " . $id . ")";
$sql.= " AND t.numero_compte IN ("; $sql .= " AND t.numero_compte IN (";
$sql.= " SELECT DISTINCT aa.account_number"; $sql .= " SELECT DISTINCT aa.account_number";
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql.= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; $sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql.= " AND aa.active = 1)"; $sql .= " AND aa.active = 1)";
$sql.= " GROUP BY t.numero_compte"; $sql .= " GROUP BY t.numero_compte, t.label_compte, t.doc_ref";
$sql .= " ORDER BY t.numero_compte";
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); $this->lines_CptBk = array ();
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$i = 0;
$obj = '';
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
if ($num) { if ($num) {
while ( $i < $num ) { while ( $obj = $this->db->fetch_object($resql) ) {
$obj[$i] = $this->db->fetch_object($resql); $this->lines_cptbk[] = $obj;
$i ++;
} }
} }
return $obj; return $num;
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error " . $this->db->lasterror();
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); $this->errors[] = $this->error;
dol_syslog(__METHOD__ . " " . implode(',' . $this->errors), LOG_ERR);
return -1; return - 1;
} }
} }
/** /**
* Function to add an accounting account in an accounting category * Function to add an accounting account in an accounting category
* *
* @param int $id_cat Id category * @param int $id_cat Id category
* @param array $cpts list of accounts array * @param array $cpts list of accounts array
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function updateAccAcc($id_cat, $cpts = array()) public function updateAccAcc($id_cat, $cpts = array()) {
{
global $conf; global $conf;
$error = 0; $error = 0;
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account as aa"; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql.= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql.= " AND aa.active = 1";
$sql.= " SET fk_accounting_category=" . $id_cat;
$sql.= " WHERE aa.account_number IN (" . join(',',$cpts) .")";
$this->db->begin();
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); $sql = "SELECT aa.rowid,aa.account_number ";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1";
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) { if (! $resql) {
$error ++; $error ++;
$this->errors[] = "Error " . $this->db->lasterror(); $this->errors[] = "Error " . $this->db->lasterror();
return -1;
}
$this->db->begin();
while ( $obj = $this->db->fetch_object($resql)) {
if (array_key_exists(length_accountg($obj->account_number), $cpts)) {
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account";
$sql .= " SET fk_accounting_category=" . $id_cat;
$sql .= " WHERE rowid=".$obj->rowid;
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) {
$error ++;
$this->errors[] = "Error " . $this->db->lasterror();
}
}
} }
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {
foreach ($this->errors as $errmsg) { foreach ( $this->errors as $errmsg ) {
dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR); dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR);
$this->error.=($this->error ? ', ' . $errmsg : $errmsg); $this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
} }
$this->db->rollback(); $this->db->rollback();
return -1 * $error; return - 1 * $error;
} else { } else {
$this->db->commit(); $this->db->commit();
@ -178,17 +194,16 @@ class AccountancyCategory
/** /**
* Function to delete an accounting account from an accounting category * Function to delete an accounting account from an accounting category
* *
* @param int $cpt_id Id of accounting account * @param int $cpt_id Id of accounting account
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function deleteCptCat($cpt_id) public function deleteCptCat($cpt_id) {
{
$error = 0; $error = 0;
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account as aa"; $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account as aa";
$sql.= " SET fk_accounting_category= 0"; $sql .= " SET fk_accounting_category= 0";
$sql.= " WHERE aa.rowid= " . $cpt_id; $sql .= " WHERE aa.rowid= " . $cpt_id;
$this->db->begin(); $this->db->begin();
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
@ -200,13 +215,13 @@ class AccountancyCategory
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {
foreach ($this->errors as $errmsg) { foreach ( $this->errors as $errmsg ) {
dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR); dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR);
$this->error.=($this->error ? ', ' . $errmsg : $errmsg); $this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
} }
$this->db->rollback(); $this->db->rollback();
return -1 * $error; return - 1 * $error;
} else { } else {
$this->db->commit(); $this->db->commit();
@ -217,57 +232,51 @@ class AccountancyCategory
/** /**
* Function to know all category from accounting account * Function to know all category from accounting account
* *
* @return array Result in table * @return array Result in table
*/ */
public function getCatsCpts() public function getCatsCpts() {
{
global $mysoc; global $mysoc;
$sql = ""; $sql = "";
if (empty($mysoc->country_id) && empty($mysoc->country_code)) if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
{ dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
dol_print_error('','Call to select_accounting_account with mysoc country not yet defined'); exit();
exit; }
}
if (! empty($mysoc->country_id)) if (! empty($mysoc->country_id)) {
{
$sql = "SELECT t.rowid, t.account_number, t.label as name_cpt, cat.code, cat.position, cat.label as name_cat, cat.sens "; $sql = "SELECT t.rowid, t.account_number, t.label as name_cpt, cat.code, cat.position, cat.label as name_cat, cat.sens ";
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t, ".MAIN_DB_PREFIX."c_accounting_category as cat"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t, " . MAIN_DB_PREFIX . "c_accounting_category as cat";
$sql.= " WHERE t.fk_accounting_category IN ( SELECT c.rowid "; $sql .= " WHERE t.fk_accounting_category IN ( SELECT c.rowid ";
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c"; $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
$sql.= " WHERE c.active = 1"; $sql .= " WHERE c.active = 1";
$sql.= " AND c.fk_country = ".$mysoc->country_id.")"; $sql .= " AND c.fk_country = " . $mysoc->country_id . ")";
$sql.= " AND cat.rowid = t.fk_accounting_category"; $sql .= " AND cat.rowid = t.fk_accounting_category";
$sql.= " ORDER BY cat.position ASC"; $sql .= " ORDER BY cat.position ASC";
} } else {
else $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 = "SELECT c.rowid, c.code, c.label, c.category_type "; $sql .= " WHERE c.active = 1 AND c.fk_country = co.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co"; $sql .= " AND co.code = '" . $mysoc->country_code . "'";
$sql.= " WHERE c.active = 1 AND c.fk_country = co.rowid"; $sql .= " ORDER BY c.position ASC";
$sql.= " AND co.code = '".$mysoc->country_code."'"; }
$sql.= " ORDER BY c.position ASC";
}
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$i = 0; $i = 0;
$obj = ''; $obj = '';
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$data = array(); $data = array ();
if ($num) { if ($num) {
while ( $i < $num ) { while ( $obj = $this->db->fetch_object($resql) ) {
$obj = $this->db->fetch_object($resql);
$name_cat = $obj->name_cat; $name_cat = $obj->name_cat;
$data[$name_cat][$i] = array( $data[$name_cat][$i] = array (
'id' => $obj->rowid, 'id' => $obj->rowid,
'code' => $obj->code, 'code' => $obj->code,
'position' => $obj->position, 'position' => $obj->position,
'account_number' => $obj->account_number, 'account_number' => $obj->account_number,
'name_cpt' => $obj->name_cpt, 'name_cpt' => $obj->name_cpt,
'sens' => $obj->sens, 'sens' => $obj->sens
); );
$i ++; $i ++;
} }
} }
@ -276,29 +285,28 @@ class AccountancyCategory
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error " . $this->db->lasterror();
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
return -1; return - 1;
} }
} }
/** /**
* Function to show result of an accounting account from the general ledger with a sens and a period * Function to show result of an accounting account from the general ledger with a sens and a period
* *
* @param int $cpt Id accounting account * @param int $cpt Id accounting account
* @param string $month Specifig month - Can be empty * @param string $month Specifig month - Can be empty
* @param string $year Specific year * @param string $year Specific year
* @param int $sens Sens of the account 0: credit - debit 1: debit - credit * @param int $sens Sens of the account 0: credit - debit 1: debit - credit
* *
* @return array Result in table * @return integer Result in table
*/ */
public function getResult($cpt, $month, $year, $sens) public function getResult($cpt, $month, $year, $sens) {
{
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit"; $sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
$sql.= " WHERE t.numero_compte = " . $cpt; $sql .= " WHERE t.numero_compte = '" . $cpt."'";
$sql.= " AND YEAR(t.doc_date) = " . $year; $sql .= " AND YEAR(t.doc_date) = " . $year;
if(! empty($month)){ if (! empty($month)) {
$sql.= " AND MONTH(t.doc_date) = " . $month; $sql .= " AND MONTH(t.doc_date) = " . $month;
} }
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
@ -306,81 +314,77 @@ class AccountancyCategory
if ($resql) { if ($resql) {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$sdc = 0; $this->sdc = 0;
if ($num) { if ($num) {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
if($sens == 1){ if ($sens == 1) {
$sdc = $obj->debit - $obj->credit; $this->sdc = $obj->debit - $obj->credit;
}else{ } else {
$sdc = $obj->credit - $obj->debit; $this->sdc = $obj->credit - $obj->debit;
} }
} }
return $sdc; return $num;
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error " . $this->db->lasterror();
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
return -1; return - 1;
} }
} }
/** /**
* Function to call category from a specific country * Function to call category from a specific country
* *
* @return array Result in table * @return array Result in table
*/ */
public function getCatsCal() public function getCatsCal() {
{ global $db, $langs, $user, $mysoc;
global $db,$langs,$user,$mysoc;
if (empty($mysoc->country_id) && empty($mysoc->country_code)) if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
{ dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
dol_print_error('','Call to select_accounting_account with mysoc country not yet defined'); exit();
exit; }
}
if (! empty($mysoc->country_id)) if (! empty($mysoc->country_id)) {
{ $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position"; $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c"; $sql .= " WHERE c.active = 1 AND c.category_type = 1 ";
$sql.= " WHERE c.active = 1 AND c.category_type = 1 "; $sql .= " AND c.fk_country = " . $mysoc->country_id;
$sql.= " AND c.fk_country = ".$mysoc->country_id; $sql .= " ORDER BY c.position ASC";
$sql.= " ORDER BY c.position ASC"; } else {
} $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
else $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co";
{ $sql .= " WHERE c.active = 1 AND c.category_type = 1 AND c.fk_country = co.rowid";
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position"; $sql .= " AND co.code = '" . $mysoc->country_code . "'";
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co"; $sql .= " ORDER BY c.position ASC";
$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";
}
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$i = 0; $i = 0;
$obj = ''; $obj = '';
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$data = array(); $data = array ();
if ($num) { if ($num) {
while ( $i < $num ) { while ( $i < $num ) {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$position = $obj->position; $position = $obj->position;
$data[$position] = array( $data[$position] = array (
'code' => $obj->code, 'code' => $obj->code,
'label' => $obj->label, 'label' => $obj->label,
'formula' => $obj->formula 'formula' => $obj->formula
); );
$i ++; $i ++;
} }
} }
return $data; return $data;
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error " . $this->db->lasterror();
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); $this->errors[] = $this->error;
dol_syslog(__METHOD__ . " " . implode(',' . $this->errors), LOG_ERR);
return -1; return - 1;
} }
} }
} }

View File

@ -43,6 +43,7 @@ class AccountancyExport
public static $EXPORT_TYPE_CIEL = 5; public static $EXPORT_TYPE_CIEL = 5;
public static $EXPORT_TYPE_QUADRATUS = 6; public static $EXPORT_TYPE_QUADRATUS = 6;
public static $EXPORT_TYPE_EBP = 7; public static $EXPORT_TYPE_EBP = 7;
public static $EXPORT_TYPE_COGILOG = 8;
/** /**
* *
@ -91,6 +92,7 @@ class AccountancyExport
self::$EXPORT_TYPE_CIEL => $langs->trans('Modelcsv_ciel'), self::$EXPORT_TYPE_CIEL => $langs->trans('Modelcsv_ciel'),
self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'), self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'),
self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'), self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'),
self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'),
); );
} }
@ -137,7 +139,10 @@ class AccountancyExport
case self::$EXPORT_TYPE_EBP : case self::$EXPORT_TYPE_EBP :
$this->exportEbp($TData); $this->exportEbp($TData);
break; break;
default : case self::$EXPORT_TYPE_COGILOG :
$this->exportCogilog($TData);
break;
default:
$this->errors[] = $langs->trans('accountancy_error_modelnotfound'); $this->errors[] = $langs->trans('accountancy_error_modelnotfound');
break; break;
} }
@ -151,6 +156,8 @@ class AccountancyExport
* @return void * @return void
*/ */
public function exportNormal($objectLines) { public function exportNormal($objectLines) {
global $conf;
foreach ( $objectLines as $line ) { foreach ( $objectLines as $line ) {
// Std export // Std export
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE); $date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
@ -188,6 +195,37 @@ class AccountancyExport
} }
} }
/**
* Export format : COGILOG
*
* @param array $objectLines data
*
* @return void
*/
public function exportCogilog($objectLines) {
foreach ( $objectLines as $line ) {
$date = dol_print_date($line->doc_date, '%d%m%Y');
print $line->code_journal . $this->separator;
print $date . $this->separator;
print $line->piece_num . $this->separator;
print length_accountg($line->numero_compte) . $this->separator;
print '' . $this->separator;
print $line->label_compte . $this->separator;
print $date . $this->separator;
if ($line->sens=='D') {
print price($line->montant) . $this->separator;
print '' . $this->separator;
}elseif ($line->sens=='C') {
print '' . $this->separator;
print price($line->montant) . $this->separator;
}
print $line->doc_ref . $this->separator;
print $line->label_compte . $this->separator;
print $this->end_line;
}
}
/** /**
* Export format : COALA * Export format : COALA
* *

View File

@ -109,6 +109,8 @@ class BookKeeping extends CommonObject
public function create(User $user, $notrigger = false) { public function create(User $user, $notrigger = false) {
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
global $langs;
$error = 0; $error = 0;
// Clean parameters // Clean parameters
@ -166,11 +168,11 @@ class BookKeeping extends CommonObject
// first check if line not yet in bookkeeping // first check if line not yet in bookkeeping
$sql = "SELECT count(*) as nb"; $sql = "SELECT count(*) as nb";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE doc_type = '" . $this->doc_type . "'"; $sql .= " WHERE doc_type = '" . $this->db->escape($this->doc_type) . "'";
$sql .= " AND fk_docdet = " . $this->fk_docdet; $sql .= " AND fk_docdet = " . $this->fk_docdet;
$sql .= " AND numero_compte = '" . $this->numero_compte . "'"; $sql .= " AND numero_compte = '" . $this->db->escape($this->numero_compte) . "'";
dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this) . ":: create ", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
@ -202,11 +204,12 @@ class BookKeeping extends CommonObject
$this->piece_num = $objnum->maxpiecenum; $this->piece_num = $objnum->maxpiecenum;
} }
} }
dol_syslog(get_class($this) . ":: create this->piece_num=" . $this->piece_num, LOG_DEBUG);
if (empty($this->piece_num)) { if (empty($this->piece_num)) {
$this->piece_num = 1; $this->piece_num = 1;
} }
dol_syslog(get_class($this) . ":: create this->piece_num=" . $this->piece_num, LOG_DEBUG);
$now = dol_now(); $now = dol_now();
if (empty($this->date_create)) { if (empty($this->date_create)) {
$this->date_create = $now; $this->date_create = $now;
@ -233,26 +236,26 @@ class BookKeeping extends CommonObject
$sql .= ") VALUES ("; $sql .= ") VALUES (";
$sql .= "'" . $this->doc_date . "'"; $sql .= "'" . $this->db->idate($this->doc_date) . "'";
$sql .= ",'" . $this->doc_type . "'"; $sql .= ",'" . $this->db->escape($this->doc_type) . "'";
$sql .= ",'" . $this->doc_ref . "'"; $sql .= ",'" . $this->db->escape($this->doc_ref) . "'";
$sql .= "," . $this->fk_doc; $sql .= "," . $this->fk_doc;
$sql .= "," . $this->fk_docdet; $sql .= "," . $this->fk_docdet;
$sql .= ",'" . $this->code_tiers . "'"; $sql .= ",'" . $this->db->escape($this->code_tiers) . "'";
$sql .= ",'" . $this->numero_compte . "'"; $sql .= ",'" . $this->db->escape($this->numero_compte) . "'";
$sql .= ",'" . $this->db->escape($this->label_compte) . "'"; $sql .= ",'" . $this->db->escape($this->label_compte) . "'";
$sql .= "," . $this->debit; $sql .= "," . $this->debit;
$sql .= "," . $this->credit; $sql .= "," . $this->credit;
$sql .= "," . $this->montant; $sql .= "," . $this->montant;
$sql .= ",'" . $this->sens . "'"; $sql .= ",'" . $this->db->escape($this->sens) . "'";
$sql .= ",'" . $this->fk_user_author . "'"; $sql .= ",'" . $this->fk_user_author . "'";
$sql .= ",'" . $this->date_create . "'"; $sql .= ",'" . $this->date_create . "'";
$sql .= ",'" . $this->code_journal . "'"; $sql .= ",'" . $this->db->escape($this->code_journal) . "'";
$sql .= "," . $this->piece_num; $sql .= "," . $this->piece_num;
$sql .= ")"; $sql .= ")";
dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this) . ":: create", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); $id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
@ -264,25 +267,25 @@ class BookKeeping extends CommonObject
$result = - 2; $result = - 2;
$error ++; $error ++;
$this->errors[] = 'Error Create Error ' . $result . ' lecture ID'; $this->errors[] = 'Error Create Error ' . $result . ' lecture ID';
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); dol_syslog(__METHOD__ . ' $result='.$result.' ' . implode(',', $this->errors), LOG_ERR);
} }
} else { } else {
$result = - 1; $result = - 1;
$error ++; $error ++;
$this->errors[] = 'Error ' . $this->db->lasterror(); $this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); dol_syslog(__METHOD__ . ' $result='.$result.' ' . implode(',', $this->errors), LOG_ERR);
} }
} else { } else {
$result = - 3; $result = - 3;
$error ++; $error ++;
$this->errors[] = 'Error ' . $this->db->lasterror(); $this->errors[] = $langs->trans('BookeppingLineAlreayExists');
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); dol_syslog(__METHOD__ . ' $result='.$result.' ' . implode(',', $this->errors), LOG_ERR);
} }
} else { } else {
$result = - 5; $result = - 5;
$error ++; $error ++;
$this->errors[] = 'Error ' . $this->db->lasterror(); $this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); dol_syslog(__METHOD__ . ' $result='.$result.' '. implode(',', $this->errors), LOG_ERR);
} }
if (! $error) { if (! $error) {
@ -944,6 +947,49 @@ class BookKeeping extends CommonObject
return 1; return 1;
} }
/**
* Delete bookkepping by year
*
* @param string $delyear year to delete
* @param string $deljournal journal to delete
* @return int Result
*/
function deleteByYearAndJournal($delyear,$deljournal) {
$this->db->begin();
$sqlwhere=array();
// first check if line not yet in bookkeeping
$sql = "DELETE";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
if (!empty($delyear)) {
$sqlwhere[] .= " YEAR(doc_date) = " . $delyear;
}
if (!empty($deljournal)) {
$sqlwhere[] .= " code_journal = '" . $this->db->escape($deljournal)."'";
}
if (count($sqlwhere)>0) {
$sql.=" WHERE ".implode(' AND ', $sqlwhere);
$resql = $this->db->query($sql);
if (! $resql) {
$this->errors[] = "Error " . $this->db->lasterror();
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;
}
$this->db->commit();
}
return 1;
}
/** /**
* Delete bookkepping by piece number * Delete bookkepping by piece number
* *

View File

@ -246,7 +246,7 @@ class FormVentilation extends Form
// Auxiliary supplier account // Auxiliary supplier account
$sql = "SELECT DISTINCT code_compta_fournisseur, nom "; $sql = "SELECT DISTINCT code_compta_fournisseur, nom ";
$sql .= " FROM ".MAIN_DB_PREFIX."societe"; $sql .= " FROM ".MAIN_DB_PREFIX."societe";
$sql .= " ORDER BY code_compta"; $sql .= " ORDER BY code_compta_fournisseur";
dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG); dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
@ -284,7 +284,7 @@ class FormVentilation extends Form
$sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear"; $sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping";
$sql .= " ORDER BY doc_date"; $sql .= " ORDER BY date_format(doc_date,'%Y')";
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -304,4 +304,40 @@ class FormVentilation extends Form
return $out_array; return $out_array;
} }
} }
/**
* Return HTML combo list of years existing into book keepping
*
* @param string $selected Preselected value
* @param string $htmlname Name of HTML select object
* @param int $useempty Affiche valeur vide dans liste
* @param string $output_format (html/opton (for option html only)/array (to return options arrays
* @return string/array
*/
function selectjournal_accountancy_bookkepping($selected = '', $htmlname = 'journalid', $useempty = 0, $output_format = 'html')
{
$out_array = array();
$sql = "SELECT DISTINCT code_journal";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping";
$sql .= " ORDER BY code_journal";
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->error = "Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR);
return -1;
}
while ($obj = $this->db->fetch_object($resql)) {
$out_array[$obj->code_journal] = $obj->code_journal;
}
$this->db->free($resql);
if ($output_format == 'html') {
return Form::selectarray($htmlname, $out_array, $selected, $useempty, 0, 0, 'placeholder="aa"');
} else {
return $out_array;
}
}
} }

View File

@ -138,7 +138,7 @@ if ($result) {
//Define array for display vat tx //Define array for display vat tx
$def_tva[$obj->rowid]=price($obj->tva_tx); $def_tva[$obj->rowid]=price($obj->tva_tx);
$tabfac[$obj->rowid]["date"] = $obj->df; $tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')'; $tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')';
$tabfac[$obj->rowid]["refsologest"] = $obj->ref; $tabfac[$obj->rowid]["refsologest"] = $obj->ref;
$tabfac[$obj->rowid]["refsuppliersologest"] = $obj->ref_supplier; $tabfac[$obj->rowid]["refsuppliersologest"] = $obj->ref_supplier;
@ -166,14 +166,13 @@ if ($action == 'writebookkeeping') {
$now = dol_now(); $now = dol_now();
$error = 0; $error = 0;
foreach ( $tabfac as $key => $val ) { foreach ($tabfac as $key => $val)
{
$companystatic = new Societe($db); $companystatic = new Societe($db);
$invoicestatic = new FactureFournisseur($db); $invoicestatic = new FactureFournisseur($db);
$invoicestatic->id = $key; $invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"]; $invoicestatic->ref = (string) $val["refsologest"];
$invoicestatic->ref = $val["refsologest"];
$invoicestatic->refsupplier = $val["refsuppliersologest"]; $invoicestatic->refsupplier = $val["refsuppliersologest"];
$invoicestatic->type = $val["type"]; $invoicestatic->type = $val["type"];
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32)); $invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
@ -193,7 +192,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_facturefourndet"]; $bookkeeping->fk_docdet = $val["fk_facturefourndet"];
$bookkeeping->code_tiers = $tabcompany[$key]['code_fournisseur']; $bookkeeping->code_tiers = $tabcompany[$key]['code_fournisseur'];
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("Code_tiers"); $bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("Code_tiers");
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
@ -225,7 +224,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_facturefourndet"]; $bookkeeping->fk_docdet = $val["fk_facturefourndet"];
$bookkeeping->code_tiers = ''; $bookkeeping->code_tiers = '';
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->refsupplier . ' - ' . utf8_decode($accountingaccount->label); $bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label;
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
@ -256,7 +255,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_facturefourndet"]; $bookkeeping->fk_docdet = $val["fk_facturefourndet"];
$bookkeeping->code_tiers = ''; $bookkeeping->code_tiers = '';
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key]; $bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key];
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
@ -297,7 +296,7 @@ if ($action == 'export_csv') {
$sep = ";"; $sep = ";";
foreach ( $tabfac as $key => $val ) { foreach ( $tabfac as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y'); $date = dol_print_date($val["date"], '%d%m%Y');
// Product / Service // Product / Service
foreach ( $tabht[$key] as $k => $mt ) { foreach ( $tabht[$key] as $k => $mt ) {
@ -340,7 +339,7 @@ if ($action == 'export_csv') {
print length_accounta(html_entity_decode($k)) . $sep; print length_accounta(html_entity_decode($k)) . $sep;
print ($mt < 0 ? 'D' : 'C') . $sep; print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print utf8_decode($companystatic->name) . $sep; print $companystatic->name . $sep;
print $val["ref"]; print $val["ref"];
print "\n"; print "\n";
} }
@ -356,7 +355,7 @@ if ($action == 'export_csv') {
$invoicestatic->type = $val["type"]; $invoicestatic->type = $val["type"];
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32)); $invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
$date = dol_print_date($db->jdate($val["date"]), 'day'); $date = dol_print_date($val["date"], 'day');
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name']; $companystatic->name = $tabcompany[$key]['name'];
@ -370,7 +369,7 @@ if ($action == 'export_csv') {
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep; print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
// print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; // print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
@ -384,7 +383,7 @@ if ($action == 'export_csv') {
print '"' . $val["ref"] . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
// print '"' . $langs->trans("VAT") . '"' . $sep; // print '"' . $langs->trans("VAT") . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $sep; print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n"; print "\n";
@ -396,8 +395,7 @@ if ($action == 'export_csv') {
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
// print '"' . utf8_decode($companystatic->name) . '"' . $sep; print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"'; print '"' . ($mt >= 0 ? price($mt) : '') . '"';
} }
@ -479,7 +477,7 @@ if ($action == 'export_csv') {
$invoicestatic->type = $val["type"]; $invoicestatic->type = $val["type"];
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32)); $invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
$date = dol_print_date($db->jdate($val["date"]), 'day'); $date = dol_print_date($val["date"], 'day');
// Product / Service // Product / Service
foreach ( $tabht[$key] as $k => $mt ) { foreach ( $tabht[$key] as $k => $mt ) {

View File

@ -161,7 +161,7 @@ if ($result) {
} }
// Invoice lines // Invoice lines
$tabfac[$obj->rowid]["date"] = $obj->df; $tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
$tabfac[$obj->rowid]["ref"] = $obj->facnumber; $tabfac[$obj->rowid]["ref"] = $obj->facnumber;
$tabfac[$obj->rowid]["type"] = $obj->type; $tabfac[$obj->rowid]["type"] = $obj->type;
$tabfac[$obj->rowid]["description"] = $obj->label_compte; $tabfac[$obj->rowid]["description"] = $obj->label_compte;
@ -207,7 +207,7 @@ if ($action == 'writebookkeeping') {
$companystatic->client = $tabcompany[$key]['code_client']; $companystatic->client = $tabcompany[$key]['code_client'];
$invoicestatic->id = $key; $invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"]; $invoicestatic->ref = (string) $val["ref"];
foreach ( $tabttc[$key] as $k => $mt ) { foreach ( $tabttc[$key] as $k => $mt ) {
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
@ -220,7 +220,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->code_tiers = $tabcompany[$key]['code_client']; $bookkeeping->code_tiers = $tabcompany[$key]['code_client'];
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
// $bookkeeping->label_compte = $tabcompany[$key]['name']; // $bookkeeping->label_compte = $tabcompany[$key]['name'];
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers"); $bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers");
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0) ? $mt : 0; $bookkeeping->debit = ($mt >= 0) ? $mt : 0;
@ -250,7 +250,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_docdet = $val["fk_facturedet"]; $bookkeeping->fk_docdet = $val["fk_facturedet"];
$bookkeeping->code_tiers = ''; $bookkeeping->code_tiers = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . utf8_decode($accountingaccount->label); $bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label;
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? $mt : 0; $bookkeeping->debit = ($mt < 0) ? $mt : 0;
@ -280,7 +280,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_docdet = $val["fk_facturedet"]; $bookkeeping->fk_docdet = $val["fk_facturedet"];
$bookkeeping->code_tiers = ''; $bookkeeping->code_tiers = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.$def_tva[$key]; $bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.$def_tva[$key];
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? $mt : 0; $bookkeeping->debit = ($mt < 0) ? $mt : 0;
@ -324,7 +324,7 @@ if ($action == 'export_csv') {
$invoicestatic->id = $key; $invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"]; $invoicestatic->ref = $val["ref"];
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y'); $date = dol_print_date($val["date"], '%d%m%Y');
foreach ( $tabttc[$key] as $k => $mt ) { foreach ( $tabttc[$key] as $k => $mt ) {
print $date . $sep; print $date . $sep;
@ -333,8 +333,7 @@ if ($action == 'export_csv') {
print length_accounta(html_entity_decode($k)) . $sep; print length_accounta(html_entity_decode($k)) . $sep;
print ($mt < 0 ? 'C' : 'D') . $sep; print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . $sep; print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . $sep;
// print utf8_decode($companystatic->name) . $sep;
print $val["ref"]; print $val["ref"];
print "\n"; print "\n";
} }
@ -349,8 +348,7 @@ if ($action == 'export_csv') {
print $sep; print $sep;
print ($mt < 0 ? 'D' : 'C') . $sep; print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . utf8_decode(utf8_decode($accountingaccount_static->label)) . $sep; print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount_static->label . $sep;
// print dol_trunc($accountingaccount_static->label, 32) . $sep;
print $val["ref"]; print $val["ref"];
print "\n"; print "\n";
} }
@ -365,7 +363,7 @@ if ($action == 'export_csv') {
print $sep; print $sep;
print ($mt < 0 ? 'D' : 'C') . $sep; print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . $sep; print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . $sep;
// print $langs->trans("VAT") . $sep; // print $langs->trans("VAT") . $sep;
print $val["ref"]; print $val["ref"];
print "\n"; print "\n";
@ -382,14 +380,13 @@ if ($action == 'export_csv') {
$invoicestatic->id = $key; $invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"]; $invoicestatic->ref = $val["ref"];
$date = dol_print_date($db->jdate($val["date"]), 'day'); $date = dol_print_date($val["date"], 'day');
foreach ( $tabttc[$key] as $k => $mt ) { foreach ( $tabttc[$key] as $k => $mt ) {
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep; print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
// print '"' . utf8_decode($companystatic->name) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n"; print "\n";
@ -404,8 +401,7 @@ if ($action == 'export_csv') {
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep; print '"' . dol_trunc($companystatic->name, 16) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
// print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"'; print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print "\n"; print "\n";
@ -418,8 +414,7 @@ if ($action == 'export_csv') {
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . '"' . $sep; print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . '"' . $sep;
// print '"' . $langs->trans("VAT") . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"'; print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print "\n"; print "\n";
@ -497,7 +492,7 @@ if ($action == 'export_csv') {
$invoicestatic->ref = $val["ref"]; $invoicestatic->ref = $val["ref"];
$invoicestatic->type = $val["type"]; $invoicestatic->type = $val["type"];
$date = dol_print_date($db->jdate($val["date"]), 'day'); $date = dol_print_date($val["date"], 'day');
// Third party // Third party
foreach ( $tabttc[$key] as $k => $mt ) { foreach ( $tabttc[$key] as $k => $mt ) {
@ -527,7 +522,7 @@ if ($action == 'export_csv') {
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>"; print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>" . length_accountg($k) . "</td>"; print "<td>" . length_accountg($k) . "</td>";
// print "<td>" . $accountingaccount->label . "</td>"; // print "<td>" . $accountingaccount->label . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . utf8_decode(utf8_decode($accountingaccount->label)) . "</td>"; print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>"; print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>"; print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>"; print "</tr>";

View File

@ -123,8 +123,21 @@ if(!empty($cats))
$position = $cpt['position']; $position = $cpt['position'];
$code = $cpt['code']; $code = $cpt['code'];
$resultNP = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']); $return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
$resultN = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']); if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultNP=0;
} else {
$resultNP=$AccCat->sdc;
}
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultN=0;
} else {
$resultN=$AccCat->sdc;
}
$sommes[$code]['NP'] += $resultNP; $sommes[$code]['NP'] += $resultNP;
$sommes[$code]['N'] += $resultN; $sommes[$code]['N'] += $resultN;
print '<tr'. $bc[$var].'>'; print '<tr'. $bc[$var].'>';
@ -134,7 +147,13 @@ if(!empty($cats))
print '<td>' . price($resultN) . '</td>'; print '<td>' . price($resultN) . '</td>';
foreach($months as $k => $v){ foreach($months as $k => $v){
$resultM = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']); $return = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultM=0;
} else {
$resultM=$AccCat->sdc;
}
$sommes[$code]['M'][$k] += $resultM; $sommes[$code]['M'][$k] += $resultM;
print '<td align="right">' . price($resultM) . '</td>'; print '<td align="right">' . price($resultM) . '</td>';
} }

View File

@ -316,7 +316,7 @@ class Adherent extends CommonObject
if ($id > 0) if ($id > 0)
{ {
$this->id=$id; $this->id=$id;
$this->ref=$id; $this->ref=(string) $id;
// Update minor fields // Update minor fields
$result=$this->update($user,1,1,0,0,'add'); // nosync is 1 to avoid update data of user $result=$this->update($user,1,1,0,0,'add'); // nosync is 1 to avoid update data of user
@ -1578,6 +1578,7 @@ class Adherent extends CommonObject
$label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs); $label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs);
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$link=''; $linkend='';
if ($option == 'card') if ($option == 'card')
{ {
$link = '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id.$linkclose; $link = '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id.$linkclose;

View File

@ -190,11 +190,12 @@ class Cotisation extends CommonObject
*/ */
function delete($user) function delete($user)
{ {
$accountline=new AccountLine($this->db);
// It subscription is linked to a bank transaction, we get it // It subscription is linked to a bank transaction, we get it
if ($this->fk_bank) if ($this->fk_bank > 0)
{ {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$accountline=new AccountLine($this->db);
$result=$accountline->fetch($this->fk_bank); $result=$accountline->fetch($this->fk_bank);
} }
@ -213,7 +214,7 @@ class Cotisation extends CommonObject
$result=$member->fetch($this->fk_adherent); $result=$member->fetch($this->fk_adherent);
$result=$member->update_end_date($user); $result=$member->update_end_date($user);
if ($accountline->id > 0) // If we found bank account line (this means this->fk_bank defined) if (is_object($accountline) && $accountline->id > 0) // If we found bank account line (this means this->fk_bank defined)
{ {
$result=$accountline->delete($user); // Return false if refused because line is conciliated $result=$accountline->delete($user); // Return false if refused because line is conciliated
if ($result > 0) if ($result > 0)

View File

@ -823,7 +823,8 @@ else
if (! empty($conf->global->MAIN_INFO_SIREN)) if (! empty($conf->global->MAIN_INFO_SIREN))
{ {
print $conf->global->MAIN_INFO_SIREN; print $conf->global->MAIN_INFO_SIREN;
if ($mysoc->country_code == 'FR') print ' &nbsp; <a href="http://avis-situation-sirene.insee.fr/avisitu/jsp/avis.jsp" target="_blank">'.$langs->trans("Check").'</a>'; $s = $mysoc->id_prof_url(1,$mysoc);
if ($s) print ' - '.$s;
} else { } else {
print '&nbsp;'; print '&nbsp;';
} }
@ -838,6 +839,8 @@ else
if (! empty($conf->global->MAIN_INFO_SIRET)) if (! empty($conf->global->MAIN_INFO_SIRET))
{ {
print $conf->global->MAIN_INFO_SIRET; print $conf->global->MAIN_INFO_SIRET;
$s = $mysoc->id_prof_url(2,$mysoc);
if ($s) print ' - '.$s;
} else { } else {
print '&nbsp;'; print '&nbsp;';
} }
@ -852,6 +855,8 @@ else
if (! empty($conf->global->MAIN_INFO_APE)) if (! empty($conf->global->MAIN_INFO_APE))
{ {
print $conf->global->MAIN_INFO_APE; print $conf->global->MAIN_INFO_APE;
$s = $mysoc->id_prof_url(3,$mysoc);
if ($s) print ' - '.$s;
} else { } else {
print '&nbsp;'; print '&nbsp;';
} }
@ -866,6 +871,8 @@ else
if (! empty($conf->global->MAIN_INFO_RCS)) if (! empty($conf->global->MAIN_INFO_RCS))
{ {
print $conf->global->MAIN_INFO_RCS; print $conf->global->MAIN_INFO_RCS;
$s = $mysoc->id_prof_url(4,$mysoc);
if ($s) print ' - '.$s;
} else { } else {
print '&nbsp;'; print '&nbsp;';
} }
@ -880,6 +887,8 @@ else
if (! empty($conf->global->MAIN_INFO_PROFID5)) if (! empty($conf->global->MAIN_INFO_PROFID5))
{ {
print $conf->global->MAIN_INFO_PROFID5; print $conf->global->MAIN_INFO_PROFID5;
$s = $mysoc->id_prof_url(5,$mysoc);
if ($s) print ' - '.$s;
} else { } else {
print '&nbsp;'; print '&nbsp;';
} }
@ -894,6 +903,8 @@ else
if (! empty($conf->global->MAIN_INFO_PROFID6)) if (! empty($conf->global->MAIN_INFO_PROFID6))
{ {
print $conf->global->MAIN_INFO_PROFID6; print $conf->global->MAIN_INFO_PROFID6;
$s = $mysoc->id_prof_url(6,$mysoc);
if ($s) print ' - '.$s;
} else { } else {
print '&nbsp;'; print '&nbsp;';
} }
@ -909,9 +920,9 @@ else
$s=''; $s='';
$s.=$conf->global->MAIN_INFO_TVAINTRA; $s.=$conf->global->MAIN_INFO_TVAINTRA;
$s.='<input type="hidden" name="tva_intra" size="12" maxlength="20" value="'.$conf->global->MAIN_INFO_TVAINTRA.'">'; $s.='<input type="hidden" name="tva_intra" size="12" maxlength="20" value="'.$conf->global->MAIN_INFO_TVAINTRA.'">';
if (empty($conf->global->MAIN_DISABLEVATCHECK)) if (empty($conf->global->MAIN_DISABLEVATCHECK) && $mysoc->isInEEC())
{ {
$s.=' &nbsp; '; $s.=' - ';
if (! empty($conf->use_javascript_ajax)) if (! empty($conf->use_javascript_ajax))
{ {
print "\n"; print "\n";

View File

@ -62,6 +62,23 @@ if ($action == 'update')
{ {
if (! $_POST['cancel']) if (! $_POST['cancel'])
{ {
$leftmenu=''; $mainmenu='';
if (! empty($_POST['menuIdParent']) && ! is_numeric($_POST['menuIdParent']))
{
$tmp=explode('&',$_POST['menuIdParent']);
foreach($tmp as $s)
{
if (preg_match('/fk_mainmenu=/',$s))
{
$mainmenu=preg_replace('/fk_mainmenu=/','',$s);
}
if (preg_match('/fk_leftmenu=/',$s))
{
$leftmenu=preg_replace('/fk_leftmenu=/','',$s);
}
}
}
$menu = new Menubase($db); $menu = new Menubase($db);
$result=$menu->fetch($_POST['menuId']); $result=$menu->fetch($_POST['menuId']);
if ($result > 0) if ($result > 0)
@ -75,7 +92,18 @@ if ($action == 'update')
$menu->perms=$_POST['perms']; $menu->perms=$_POST['perms'];
$menu->target=$_POST['target']; $menu->target=$_POST['target'];
$menu->user=$_POST['user']; $menu->user=$_POST['user'];
$menu->fk_menu=$_POST['fk_menu']; if (is_numeric($_POST['menuIdParent']))
{
$menu->fk_menu=$_POST['menuIdParent'];
}
else
{
if ($_POST['type'] == 'top') $menu->fk_menu=0;
else $menu->fk_menu=-1;
$menu->fk_mainmenu=$mainmenu;
$menu->fk_leftmenu=$leftmenu;
}
$result=$menu->update($user); $result=$menu->update($user);
if ($result > 0) if ($result > 0)
{ {
@ -342,7 +370,7 @@ if ($action == 'create')
} }
else else
{ {
print '<td><input type="text" size="20" id="menuId" name="menuId" value="'.($_POST["menuId"]?$_POST["menuId"]:'').'"></td>'; print '<td><input type="text" size="40" id="menuId" name="menuId" value="'.($_POST["menuId"]?$_POST["menuId"]:'').'"></td>';
} }
print '<td>'.$langs->trans('DetailMenuIdParent'); print '<td>'.$langs->trans('DetailMenuIdParent');
print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def'; print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
@ -425,12 +453,15 @@ elseif ($action == 'edit')
print '<tr><td class="fieldrequired">'.$langs->trans('Type').'</td><td>'.$langs->trans(ucfirst($menu->type)).'</td><td>'.$langs->trans('DetailType').'</td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans('Type').'</td><td>'.$langs->trans(ucfirst($menu->type)).'</td><td>'.$langs->trans('DetailType').'</td></tr>';
// MenuId Parent // MenuId Parent
print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent').'</td>'; print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent');
print '</td>';
$valtouse=$menu->fk_menu; $valtouse=$menu->fk_menu;
if ($menu->fk_mainmenu) $valtouse='fk_mainmenu='.$menu->fk_mainmenu; if ($menu->fk_mainmenu) $valtouse='fk_mainmenu='.$menu->fk_mainmenu;
if ($menu->fk_leftmenu) $valtouse.='&fk_leftmenu='.$menu->fk_leftmenu; if ($menu->fk_leftmenu) $valtouse.='&fk_leftmenu='.$menu->fk_leftmenu;
print '<td><input type="text" name="fk_menu" value="'.$valtouse.'" size="10"></td>'; print '<td><input type="text" name="menuIdParent" value="'.$valtouse.'" size="40"></td>';
print '<td>'.$langs->trans('DetailMenuIdParent').'</td></tr>'; print '<td>'.$langs->trans('DetailMenuIdParent');
print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
print '</td></tr>';
// Niveau // Niveau
//print '<tr><td>'.$langs->trans('Level').'</td><td>'.$menu->level.'</td><td>'.$langs->trans('DetailLevel').'</td></tr>'; //print '<tr><td>'.$langs->trans('Level').'</td><td>'.$menu->level.'</td><td>'.$langs->trans('DetailLevel').'</td></tr>';

View File

@ -361,7 +361,7 @@ if ($conf->use_javascript_ajax)
if (count($remainingdata)) if (count($remainingdata))
{ {
print '<table class="border" width="100%">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("NotTopTreeMenuPersonalized").'</td>'; print '<td>'.$langs->trans("NotTopTreeMenuPersonalized").'</td>';

View File

@ -45,14 +45,6 @@ $action = GETPOST('action','alpha');
if ($action == "set") if ($action == "set")
{ {
$db->begin(); $db->begin();
for ($i = 0 ; $i < 2 ; $i++)
{
$res = dolibarr_set_const($db, GETPOST("nom$i",'alpha'), GETPOST("value$i",'alpha'),'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
}
$res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"),'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$id=GETPOST('PRELEVEMENT_ID_BANKACCOUNT','int'); $id=GETPOST('PRELEVEMENT_ID_BANKACCOUNT','int');
$account = new Account($db); $account = new Account($db);
@ -78,6 +70,15 @@ if ($action == "set")
} }
else $error++; else $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"),'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (GETPOST("PRELEVEMENT_USER") > 0)
{
$res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"),'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
}
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
@ -131,33 +132,25 @@ print '<td width="30%">'.$langs->trans("Parameter").'</td>';
print '<td width="40%">'.$langs->trans("Value").'</td>'; print '<td width="40%">'.$langs->trans("Value").'</td>';
print "</tr>"; print "</tr>";
//User
print '<tr class="impair"><td>'.$langs->trans("ResponsibleUser").'</td>';
print '<td align="left">';
print '<input type="hidden" name="nom0" value="PRELEVEMENT_USER">';
print $form->select_dolusers($conf->global->PRELEVEMENT_USER, 'value0', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print '</td>';
print '</tr>';
//Profid1 of Transmitter
print '<tr class="pair"><td>'.$langs->trans("NumeroNationalEmetter").' - '.$langs->transcountry('ProfId1',$mysoc->country_code).'</td>';
print '<td align="left">';
print '<input type="hidden" name="nom1" value="PRELEVEMENT_NUMERO_NATIONAL_EMETTEUR">';
print '<input type="text" name="value1" value="'.$conf->global->PRELEVEMENT_NUMERO_NATIONAL_EMETTEUR.'" size="9" ></td>';
print '</tr>';
// Bank account (from Banks module) // Bank account (from Banks module)
print '<tr class="impair"><td>'.$langs->trans("BankToReceiveWithdraw").'</td>'; print '<tr class="impair"><td class="fieldrequired">'.$langs->trans("BankToReceiveWithdraw").'</td>';
print '<td align="left">'; print '<td align="left">';
$form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT,'PRELEVEMENT_ID_BANKACCOUNT',0,"courant=1",1); $form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT,'PRELEVEMENT_ID_BANKACCOUNT',0,"courant=1",1);
print '</td></tr>'; print '</td></tr>';
// ICS // ICS
print '<tr class="pair"><td>'.$langs->trans("ICS").'</td>'; print '<tr class="pair"><td class="fieldrequired">'.$langs->trans("ICS").'</td>';
print '<td align="left">'; print '<td align="left">';
print '<input type="text" name="PRELEVEMENT_ICS" value="'.$conf->global->PRELEVEMENT_ICS.'" size="9" ></td>'; print '<input type="text" name="PRELEVEMENT_ICS" value="'.$conf->global->PRELEVEMENT_ICS.'" size="9" ></td>';
print '</td></tr>'; print '</td></tr>';
//User
print '<tr class="impair"><td class="fieldrequired">'.$langs->trans("ResponsibleUser").'</td>';
print '<td align="left">';
print $form->select_dolusers($conf->global->PRELEVEMENT_USER, 'PRELEVEMENT_USER', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print '</td>';
print '</tr>';
print '</table>'; print '</table>';
print '<br>'; print '<br>';

View File

@ -617,13 +617,14 @@ else if ($id || $ref)
* @param Object $object Object we want to see categories it can be classified into * @param Object $object Object we want to see categories it can be classified into
* @param int $typeid Type of category (0, 1, 2, 3) * @param int $typeid Type of category (0, 1, 2, 3)
* @param int $socid Id thirdparty * @param int $socid Id thirdparty
* @param int $showclassifyform 1=Add form to 'Classify', 0=Do not show form to 'Classify' * @param int $showclassifyform 1=Add form to 'Classify', 0=Do not show form to 'Classify'
* @return int 0 * @return int 0
*/ */
function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1) function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1)
{ {
global $user,$langs,$form,$bc; global $user,$langs,$form,$bc;
$title='NotDefined';
if ($typeid == Categorie::TYPE_PRODUCT) $title = $langs->trans("ProductsCategoriesShort"); if ($typeid == Categorie::TYPE_PRODUCT) $title = $langs->trans("ProductsCategoriesShort");
if ($typeid == Categorie::TYPE_SUPPLIER) $title = $langs->trans("SuppliersCategoriesShort"); if ($typeid == Categorie::TYPE_SUPPLIER) $title = $langs->trans("SuppliersCategoriesShort");
if ($typeid == Categorie::TYPE_CUSTOMER) $title = $langs->trans("CustomersProspectsCategoriesShort"); if ($typeid == Categorie::TYPE_CUSTOMER) $title = $langs->trans("CustomersProspectsCategoriesShort");

View File

@ -1008,13 +1008,13 @@ class Categorie extends CommonObject
} }
/** /**
* Affiche contenu de $this->cats * Display content of $this->cats
* *
* @return void * @return void
*/ */
function debug_cats() function debug_cats()
{ {
// Affiche $this->cats // Display $this->cats
foreach($this->cats as $key => $val) foreach($this->cats as $key => $val)
{ {
print 'id: '.$this->cats[$key]['id']; print 'id: '.$this->cats[$key]['id'];
@ -1029,11 +1029,11 @@ class Categorie extends CommonObject
/** /**
* Retourne toutes les categories * Returns all categories
* *
* @param int $type Type of category * @param int $type Type of category
* @param boolean $parent Just parent categories if true * @param boolean $parent Just parent categories if true
* @return array Tableau d'objet Categorie * @return array Table of Object Category
*/ */
function get_all_categories($type=null, $parent=false) function get_all_categories($type=null, $parent=false)
{ {
@ -1064,9 +1064,9 @@ class Categorie extends CommonObject
} }
/** /**
* Retourne le nombre total de categories * Returns total number of categories
* *
* @return int Nombre de categories * @return int Number of categories
* @deprecated function not used ? * @deprecated function not used ?
*/ */
function get_nb_categories() function get_nb_categories()
@ -1133,7 +1133,7 @@ class Categorie extends CommonObject
} }
/** /**
* Retourne les categories de premier niveau (qui ne sont pas filles) * Returns the top level categories (which are not girls)
* *
* @param int $type Type of category * @param int $type Type of category
* @return array * @return array
@ -1144,8 +1144,8 @@ class Categorie extends CommonObject
} }
/** /**
* Retourne les chemin de la categorie, avec les noms des categories * Returns the path of the category, with the names of the categories
* separes par $sep (" >> " par defaut) * separated by $sep (" >> " by default)
* *
* @param string $sep Separator * @param string $sep Separator
* @param string $url Url * @param string $url Url
@ -1205,7 +1205,7 @@ class Categorie extends CommonObject
/** /**
* Retourne un tableau contenant la liste des categories meres * Returns an array containing the list of parent categories
* *
* @return int|array <0 KO, array OK * @return int|array <0 KO, array OK
*/ */
@ -1239,8 +1239,8 @@ class Categorie extends CommonObject
} }
/** /**
* Retourne dans un tableau tous les chemins possibles pour arriver a la categorie * Returns in a table all possible paths to get to the category
* en partant des categories principales, representes par des tableaux de categories * starting with the major categories represented by Tables of categories
* *
* @return array * @return array
*/ */
@ -1324,8 +1324,8 @@ class Categorie extends CommonObject
/** /**
* Retourne les categories dont l'id ou le nom correspond * Returns categories whose id or name match
* ajoute des wildcards au nom sauf si $exact = true * add wildcards in the name unless $exact = true
* *
* @param int $id Id * @param int $id Id
* @param string $nom Name * @param string $nom Name

View File

@ -61,8 +61,14 @@ $originid=GETPOST('originid','int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$fulldayevent=GETPOST('fullday'); $fulldayevent=GETPOST('fullday');
$datep=dol_mktime($fulldayevent?'00':GETPOST("aphour"), $fulldayevent?'00':GETPOST("apmin"), 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear"));
$datef=dol_mktime($fulldayevent?'23':GETPOST("p2hour"), $fulldayevent?'59':GETPOST("p2min"), $fulldayevent?'59':'0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year")); $aphour = GETPOST('aphour');
$apmin = GETPOST('apmin');
$p2hour = GETPOST('p2hour');
$p2min = GETPOST('p2min');
$datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear"));
$datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year"));
// Security check // Security check
$socid = GETPOST('socid','int'); $socid = GETPOST('socid','int');
@ -92,7 +98,6 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('actioncard','globalcard')); $hookmanager->initHooks(array('actioncard','globalcard'));
/* /*
* Actions * Actions
*/ */
@ -781,7 +786,7 @@ if ($action == 'create')
print '<tr><td>'.$langs->trans("Project").'</td><td>'; print '<tr><td>'.$langs->trans("Project").'</td><td>';
$numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:0),GETPOST("projectid")?GETPOST("projectid"):'','projectid'); $numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1),GETPOST("projectid")?GETPOST("projectid"):'','projectid');
if ($numproject==0) if ($numproject==0)
{ {
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").'</a>'; print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").'</a>';

View File

@ -406,7 +406,7 @@ class ActionComm extends CommonObject
*/ */
public function add(User $user, $notrigger = 0) public function add(User $user, $notrigger = 0)
{ {
$this->create($user, $notrigger); return $this->create($user, $notrigger);
} }
/** /**

View File

@ -208,7 +208,7 @@ class ICal
//print 'type='.$type.' key='.$key.' value='.$value.'<br>'."\n"; //print 'type='.$type.' key='.$key.' value='.$value.'<br>'."\n";
if ($key == false) if (empty($key))
{ {
$key = $this->last_key; $key = $this->last_key;
switch ($type) switch ($type)

View File

@ -423,7 +423,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande
$companystatic->code_client = $obj->code_client; $companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas=$obj->canvas; $companystatic->canvas=$obj->canvas;
print $companystatic->getNomUrl(1,'customer',16); print $companystatic->getNomUrl(1,'supplier',16);
print '</td>'; print '</td>';
print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>'; print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
$i++; $i++;
@ -729,7 +729,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
$companystatic->code_client = $obj->code_client; $companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas=$obj->canvas; $companystatic->canvas=$obj->canvas;
print $companystatic->getNomUrl(1, 'company', 44); print $companystatic->getNomUrl(1, 'customer', 44);
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="right">';
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n"; print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
@ -828,7 +828,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
$companystatic->code_client = $obj->code_client; $companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas=$obj->canvas; $companystatic->canvas=$obj->canvas;
print $companystatic->getNomUrl(1, 'company', 44); print $companystatic->getNomUrl(1, 'customer', 44);
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="right">';
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n"; print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";

View File

@ -221,7 +221,7 @@ if ($action == 'add') {
if ((count($advTarget->thirdparty_lines) > 0) || (count($advTarget->contact_lines) > 0)) { if ((count($advTarget->thirdparty_lines) > 0) || (count($advTarget->contact_lines) > 0)) {
// Add targets into database // Add targets into database
$obj = new mailing_advthirdparties($db); $obj = new mailing_advthirdparties($db);
$result = $obj->add_to_target($id, $advTarget->thirdparty_lines, $array_query['type_of_target'], $advTarget->contact_lines); $result = $obj->add_to_target_spec($id, $advTarget->thirdparty_lines, $array_query['type_of_target'], $advTarget->contact_lines);
} else { } else {
$result = 0; $result = 0;
} }

View File

@ -673,9 +673,9 @@ if ($action == 'create')
dol_fiche_head(); dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("MailTitle").'</td><td><input class="flat" name="titre" size="40" value="'.$_POST['titre'].'"></td></tr>'; print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("MailTitle").'</td><td><input class="flat" name="titre" size="40" value="'.$_POST['titre'].'"></td></tr>';
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("MailFrom").'</td><td><input class="flat" name="from" size="40" value="'.$conf->global->MAILING_EMAIL_FROM.'"></td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans("MailFrom").'</td><td><input class="flat" name="from" size="40" value="'.$conf->global->MAILING_EMAIL_FROM.'"></td></tr>';
print '<tr><td width="25%">'.$langs->trans("MailErrorsTo").'</td><td><input class="flat" name="errorsto" size="40" value="'.(!empty($conf->global->MAILING_EMAIL_ERRORSTO)?$conf->global->MAILING_EMAIL_ERRORSTO:$conf->global->MAIN_MAIL_ERRORS_TO).'"></td></tr>'; print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td><input class="flat" name="errorsto" size="40" value="'.(!empty($conf->global->MAILING_EMAIL_ERRORSTO)?$conf->global->MAILING_EMAIL_ERRORSTO:$conf->global->MAIN_MAIL_ERRORS_TO).'"></td></tr>';
// Other attributes // Other attributes
$parameters=array(); $parameters=array();
@ -689,11 +689,11 @@ if ($action == 'create')
print '</br><br>'; print '</br><br>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("MailTopic").'</td><td><input class="flat" name="sujet" size="60" value="'.$_POST['sujet'].'"></td></tr>'; print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("MailTopic").'</td><td><input class="flat" name="sujet" size="60" value="'.$_POST['sujet'].'"></td></tr>';
print '<tr><td width="25%">'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
print $htmlother->selectColor($_POST['bgcolor'],'bgcolor','new_mailing',0); print $htmlother->selectColor($_POST['bgcolor'],'bgcolor','new_mailing',0);
print '</td></tr>'; print '</td></tr>';
print '<tr><td width="25%" valign="top"><span class="fieldrequired">'.$langs->trans("MailMessage").'</span><br>'; print '<tr><td valign="top"><span class="fieldrequired">'.$langs->trans("MailMessage").'</span><br>';
print '<br><i>'.$langs->trans("CommonSubstitutions").':<br>'; print '<br><i>'.$langs->trans("CommonSubstitutions").':<br>';
foreach($object->substitutionarray as $key => $val) foreach($object->substitutionarray as $key => $val)
{ {
@ -792,7 +792,7 @@ else
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print $form->showrefnav($object,'id', $linkback); print $form->showrefnav($object,'id', $linkback);
print '</td></tr>'; print '</td></tr>';
@ -995,7 +995,7 @@ else
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Subject // Subject
print '<tr><td width="25%">'.$langs->trans("MailTopic").'</td><td colspan="3">'.$object->sujet.'</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("MailTopic").'</td><td colspan="3">'.$object->sujet.'</td></tr>';
// Joined files // Joined files
print '<tr><td>'.$langs->trans("MailFile").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("MailFile").'</td><td colspan="3">';
@ -1021,7 +1021,7 @@ else
print '</td></tr>';*/ print '</td></tr>';*/
// Message // Message
print '<tr><td width="25%" valign="top">'.$langs->trans("MailMessage").'<br>'; print '<tr><td valign="top">'.$langs->trans("MailMessage").'<br>';
print '<br><i>'.$langs->trans("CommonSubstitutions").':<br>'; print '<br><i>'.$langs->trans("CommonSubstitutions").':<br>';
foreach($object->substitutionarray as $key => $val) foreach($object->substitutionarray as $key => $val)
{ {
@ -1055,7 +1055,7 @@ else
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print $form->showrefnav($object,'id', $linkback); print $form->showrefnav($object,'id', $linkback);
print '</td></tr>'; print '</td></tr>';
@ -1114,9 +1114,9 @@ else
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Subject // Subject
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("MailTopic").'</td><td colspan="3"><input class="flat" type="text" size=60 name="sujet" value="'.$object->sujet.'"></td></tr>'; print '<tr><td class="fieldrequired titlefield">'.$langs->trans("MailTopic").'</td><td colspan="3"><input class="flat" type="text" size=60 name="sujet" value="'.$object->sujet.'"></td></tr>';
$trackid=''; // TODO To avoid conflicts with 2 mass emailing, we shoul set a trackid here, even if we use another one into email header. $trackid=''; // TODO To avoid conflicts with 2 mass emailing, we should set a trackid here, even if we use another one into email header.
dol_init_file_process($upload_dir, $trackid); dol_init_file_process($upload_dir, $trackid);
// Joined files // Joined files
@ -1156,12 +1156,12 @@ else
print '</td></tr>'; print '</td></tr>';
// Background color // Background color
print '<tr><td width="25%">'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
print $htmlother->selectColor($object->bgcolor,'bgcolor','edit_mailing',0); print $htmlother->selectColor($object->bgcolor,'bgcolor','edit_mailing',0);
print '</td></tr>'; print '</td></tr>';
// Message // Message
print '<tr><td width="25%" valign="top">'.$langs->trans("MailMessage").'<br>'; print '<tr><td valign="top">'.$langs->trans("MailMessage").'<br>';
print '<br><i>'.$langs->trans("CommonSubstitutions").':<br>'; print '<br><i>'.$langs->trans("CommonSubstitutions").':<br>';
foreach($object->substitutionarray as $key => $val) foreach($object->substitutionarray as $key => $val)
{ {

View File

@ -183,30 +183,30 @@ if ($object->fetch($id) >= 0)
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print $form->showrefnav($object,'id', $linkback); print $form->showrefnav($object,'id', $linkback);
print '</td></tr>'; print '</td></tr>';
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>';
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>';
// Errors to // 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 '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td colspan="3">'.dol_print_email($object->email_errorsto,0,0,0,0,1);
print '</td></tr>'; print '</td></tr>';
// Status // Status
print '<tr><td width="25%">'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4); print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4);
if ($object->statut == 2) print ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.')'; if ($object->statut == 2) print ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.')';
print '</td></tr>'; print '</td></tr>';
// Nb of distinct emails // Nb of distinct emails
print '<tr><td width="25%">'; print '<tr><td>';
print $langs->trans("TotalNbOfDistinctRecipients"); print $langs->trans("TotalNbOfDistinctRecipients");
print '</td><td colspan="3">'; print '</td><td colspan="3">';
$nbemail = ($object->nbemail?$object->nbemail:'0'); $nbemail = ($object->nbemail?$object->nbemail:'0');
if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && ($conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || $object->statut == 2))
{ {
$text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); $text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
print $form->textwithpicto($nbemail,$text,1,'warning'); print $form->textwithpicto($nbemail,$text,1,'warning');

View File

@ -41,6 +41,8 @@ class Mailing extends CommonObject
var $bgcolor; var $bgcolor;
var $bgimage; var $bgimage;
var $statut; // Status 0=Draft, 1=Validated, 2=Sent partially, 3=Sent completely
var $email_from; var $email_from;
var $email_replyto; var $email_replyto;
var $email_errorsto; var $email_errorsto;

View File

@ -32,6 +32,8 @@ $langs->load("orders");
$langs->load("bills"); $langs->load("bills");
$langs->load("companies"); $langs->load("companies");
$id=GETPOST('id','int');
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$backtopage=GETPOST('backtopage','alpha'); $backtopage=GETPOST('backtopage','alpha');
@ -58,6 +60,9 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
//if ($user->rights->societe->creer) //if ($user->rights->societe->creer)
//if ($user->rights->facture->creer) //if ($user->rights->facture->creer)
$amount_ttc_1=GETPOST('amount_ttc_1');
$amount_ttc_2=GETPOST('amount_ttc_2');
$error=0; $error=0;
$remid=GETPOST("remid")?GETPOST("remid"):0; $remid=GETPOST("remid")?GETPOST("remid"):0;
$discount=new DiscountAbsolute($db); $discount=new DiscountAbsolute($db);
@ -67,7 +72,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
$error++; $error++;
setEventMessages($langs->trans("ErrorFailedToLoadDiscount"), null, 'errors'); setEventMessages($langs->trans("ErrorFailedToLoadDiscount"), null, 'errors');
} }
if (! $error && price2num($_POST["amount_ttc_1"]+$_POST["amount_ttc_2"]) != $discount->amount_ttc) if (! $error && price2num($amount_ttc_1+$amount_ttc_2) != $discount->amount_ttc)
{ {
$error++; $error++;
setEventMessages($langs->trans("TotalOfTwoDiscountMustEqualsOriginal"), null, 'errors'); setEventMessages($langs->trans("TotalOfTwoDiscountMustEqualsOriginal"), null, 'errors');
@ -120,7 +125,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
if ($res > 0 && $newid1 > 0 && $newid2 > 0) if ($res > 0 && $newid1 > 0 && $newid2 > 0)
{ {
$db->commit(); $db->commit();
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$_REQUEST['id']); // To avoid pb whith back header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id); // To avoid pb whith back
exit; exit;
} }
else else
@ -135,10 +140,14 @@ if ($action == 'setremise')
//if ($user->rights->societe->creer) //if ($user->rights->societe->creer)
//if ($user->rights->facture->creer) //if ($user->rights->facture->creer)
if (price2num($_POST["amount_ht"]) > 0) $amount_ht=GETPOST('amount_ht');
$desc=GETPOST('desc','alpha');
$tva_tx=GETPOST('tva_tx','alpha');
if (price2num($amount_ht) > 0)
{ {
$error=0; $error=0;
if (empty($_POST["desc"])) if (empty($desc))
{ {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("ReasonDiscount")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("ReasonDiscount")), null, 'errors');
$error++; $error++;
@ -147,8 +156,8 @@ if ($action == 'setremise')
if (! $error) if (! $error)
{ {
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($_GET["id"]); $soc->fetch($id);
$discountid=$soc->set_remise_except($_POST["amount_ht"],$user,$_POST["desc"],$_POST["tva_tx"]); $discountid=$soc->set_remise_except($amount_ht,$user,$desc,$tva_tx);
if ($discountid > 0) if ($discountid > 0)
{ {
@ -159,7 +168,7 @@ if ($action == 'setremise')
} }
else else
{ {
header("Location: remx.php?id=".$_GET["id"]); header("Location: remx.php?id=".$id);
exit; exit;
} }
} }
@ -189,7 +198,7 @@ if (GETPOST("action") == 'confirm_remove' && GETPOST("confirm")=='yes')
if ($result > 0) if ($result > 0)
{ {
$db->commit(); $db->commit();
header("Location: ".$_SERVER["PHP_SELF"].'?id='.GETPOST('id','int')); // To avoid pb whith back header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id); // To avoid pb whith back
exit; exit;
} }
else else
@ -264,15 +273,15 @@ if ($socid > 0)
print load_fiche_titre($langs->trans("NewGlobalDiscount"),'',''); print load_fiche_titre($langs->trans("NewGlobalDiscount"),'','');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="38%">'.$langs->trans("AmountHT").'</td>'; print '<tr><td width="38%" class="fieldrequired">'.$langs->trans("AmountHT").'</td>';
print '<td><input type="text" size="5" name="amount_ht" value="'.$_POST["amount_ht"].'">'; print '<td><input type="text" size="5" name="amount_ht" value="'.$_POST["amount_ht"].'">';
print '<span class="hideonsmartphone">&nbsp;'.$langs->trans("Currency".$conf->currency).'</span></td></tr>'; print '<span class="hideonsmartphone">&nbsp;'.$langs->trans("Currency".$conf->currency).'</span></td></tr>';
print '<tr><td width="38%">'.$langs->trans("VAT").'</td>'; print '<tr><td width="38%">'.$langs->trans("VAT").'</td>';
print '<td>'; print '<td>';
print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$object); print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$object);
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("NoteReason").'</td>'; print '<tr><td class="fieldrequired" >'.$langs->trans("NoteReason").'</td>';
print '<td><input type="text" size="60" name="desc" value="'.$_POST["desc"].'"></td></tr>'; print '<td><input type="text" size="60" name="desc" value="'.GETPOST('desc').'"></td></tr>';
print "</table>"; print "</table>";
@ -296,7 +305,7 @@ if ($socid > 0)
if ($_GET['action'] == 'remove') if ($_GET['action'] == 'remove')
{ {
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$_GET["remid"], $langs->trans('RemoveDiscount'), $langs->trans('ConfirmRemoveDiscount'), 'confirm_remove', '', 0, 1); print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.GETPOST('remid'), $langs->trans('RemoveDiscount'), $langs->trans('ConfirmRemoveDiscount'), 'confirm_remove', '', 0, 1);
} }
/* /*
@ -383,7 +392,7 @@ if ($socid > 0)
else print '<td>&nbsp;</td>'; else print '<td>&nbsp;</td>';
print '</tr>'; print '</tr>';
if ($_GET["action"]=='split' && $_GET['remid'] == $obj->rowid) if ($_GET["action"]=='split' && GETPOST('remid') == $obj->rowid)
{ {
$showconfirminfo['rowid']=$obj->rowid; $showconfirminfo['rowid']=$obj->rowid;
$showconfirminfo['amount_ttc']=$obj->amount_ttc; $showconfirminfo['amount_ttc']=$obj->amount_ttc;

View File

@ -1195,9 +1195,9 @@ if (empty($reshook))
$file = $upload_dir . '/' . GETPOST('file'); $file = $upload_dir . '/' . GETPOST('file');
$ret = dol_delete_file($file, 0, 0, 0, $object); $ret = dol_delete_file($file, 0, 0, 0, $object);
if ($ret) if ($ret)
setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
else else
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors');
$action = ''; $action = '';
} }
} }

View File

@ -1030,7 +1030,6 @@ if ($resql)
else print '<td></td>'; else print '<td></td>';
} }
print '</tr>'; print '</tr>';
} }
$db->free($resql); $db->free($resql);

View File

@ -70,6 +70,11 @@ $date_end = dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endda
$date_starty = dol_mktime(0,0,0,$_REQUEST["date_start_delymonth"],$_REQUEST["date_start_delyday"],$_REQUEST["date_start_delyyear"]); // Date for local PHP server $date_starty = dol_mktime(0,0,0,$_REQUEST["date_start_delymonth"],$_REQUEST["date_start_delyday"],$_REQUEST["date_start_delyyear"]); // Date for local PHP server
$date_endy = dol_mktime(23,59,59,$_REQUEST["date_end_delymonth"],$_REQUEST["date_end_delyday"],$_REQUEST["date_end_delyyear"]); $date_endy = dol_mktime(23,59,59,$_REQUEST["date_end_delymonth"],$_REQUEST["date_end_delyday"],$_REQUEST["date_end_delyyear"]);
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('facture');
if ($action == 'create') if ($action == 'create')
{ {
if (! is_array($selected)) if (! is_array($selected))
@ -174,6 +179,9 @@ if (($action == 'create' || $action == 'add') && !$error)
$object->remise_absolue = $_POST['remise_absolue']; $object->remise_absolue = $_POST['remise_absolue'];
$object->remise_percent = $_POST['remise_percent']; $object->remise_percent = $_POST['remise_percent'];
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if ($ret < 0) $error++;
if ($_POST['origin'] && $_POST['originid']) if ($_POST['origin'] && $_POST['originid'])
{ {
$object->origin = $_POST['origin']; $object->origin = $_POST['origin'];
@ -464,6 +472,12 @@ if ($action == 'create' && !$error)
$parameters=array('objectsrc' => $objectsrc, 'idsrc' => $listoforders, 'colspan' => ' colspan="3"'); $parameters=array('objectsrc' => $objectsrc, 'idsrc' => $listoforders, 'colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
$object=new Facture($db);
print $object->showOptionals($extrafields,'edit');
}
// Modele PDF // Modele PDF
print '<tr><td>'.$langs->trans('Model').'</td>'; print '<tr><td>'.$langs->trans('Model').'</td>';
print '<td>'; print '<td>';

View File

@ -36,10 +36,10 @@ $id=GETPOST('account');
$ref=GETPOST('ref'); $ref=GETPOST('ref');
// Security check // Security check
$fieldid = (! empty($ref)?$ref:$id); $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :''));
$fieldname = isset($ref)?'ref':'rowid'; $fieldtype = (! empty($ref) ? 'ref' :'rowid');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'banque',$fieldid,'bank_account','','',$fieldname); $result=restrictedArea($user,'banque',$fieldvalue,'bank_account&bank_account','','',$fieldtype);
$year_start=GETPOST('year_start'); $year_start=GETPOST('year_start');
$year_current = strftime("%Y",time()); $year_current = strftime("%Y",time());
@ -146,7 +146,7 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("B
// Ref // Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>'; print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
if ($_GET["account"]) if (!empty($id))
{ {
if (! preg_match('/,/', $id)) if (! preg_match('/,/', $id))
{ {

View File

@ -163,7 +163,7 @@ if (empty($reshook))
// Change status of invoice // Change status of invoice
else if ($action == 'reopen' && $user->rights->facture->creer) { else if ($action == 'reopen' && $user->rights->facture->creer) {
$result = $object->fetch($id); $result = $object->fetch($id);
if ($object->statut == 2 || ($object->statut == 3 && $object->close_code != 'replaced')) { if ($object->statut == 2 || ($object->statut == 3 && $object->close_code != 'replaced') || ($object->statut == 1 && $object->paye == 1)) { // ($object->statut == 1 && $object->paye == 1) should not happened but can be found when data are corrupted
$result = $object->set_unpaid($user); $result = $object->set_unpaid($user);
if ($result > 0) { if ($result > 0) {
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id); header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id);
@ -2930,16 +2930,16 @@ else if ($id > 0 || ! empty($ref))
// Ref // Ref
print '<tr><td width="20%">' . $langs->trans('Ref') . '</td>'; print '<tr><td width="20%">' . $langs->trans('Ref') . '</td>';
print '<td colspan="5">'; print '<td colspan="5">';
$morehtmlref = ''; $morehtmlright = '';
$discount = new DiscountAbsolute($db); $discount = new DiscountAbsolute($db);
$result = $discount->fetch(0, $object->id); $result = $discount->fetch(0, $object->id);
if ($result > 0) { if ($result > 0) {
$morehtmlref = ' (' . $langs->trans("CreditNoteConvertedIntoDiscount", $discount->getNomUrl(1, 'discount')) . ')'; $morehtmlright = '&nbsp; (' . $langs->trans("CreditNoteConvertedIntoDiscount", $discount->getNomUrl(1, 'discount')) . ')';
} }
if ($result < 0) { if ($result < 0) {
dol_print_error('', $discount->error); dol_print_error('', $discount->error);
} }
print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref); print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', '', '', 0, '', '', $morehtmlright);
print '</td></tr>'; print '</td></tr>';
// Ref customer // Ref customer
@ -3905,8 +3905,8 @@ else if ($id > 0 || ! empty($ref))
if ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) if ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT)
|| ($object->type == Facture::TYPE_CREDIT_NOTE && empty($discount->id)) || ($object->type == Facture::TYPE_CREDIT_NOTE && empty($discount->id))
|| ($object->type == Facture::TYPE_DEPOSIT && empty($discount->id))) || ($object->type == Facture::TYPE_DEPOSIT && empty($discount->id)))
&& ($object->statut == 2 || $object->statut == 3) && ($object->statut == 2 || $object->statut == 3 || ($object->statut == 1 && $object->paye == 1)) // Condition ($object->statut == 1 && $object->paye == 1) should not happened but can be found due to corrupted data
&& $user->rights->facture->creer) // A paid invoice (partially or completely) && $user->rights->facture->creer) // A paid invoice (partially or completely)
{ {
if (! $objectidnext && $object->close_code != 'replaced') // Not replaced by another invoice if (! $objectidnext && $object->close_code != 'replaced') // Not replaced by another invoice
{ {

View File

@ -509,7 +509,7 @@ class FactureRec extends CommonInvoice
$facid=$this->id; $facid=$this->id;
dol_syslog("FactureRec::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG); dol_syslog(get_class($this)."::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG);
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Check parameters // Check parameters
@ -604,6 +604,111 @@ class FactureRec extends CommonInvoice
} }
} }
/**
* Update a line to invoice
*
* @param int $rowid Id of line to update
* @param string $desc Description de la ligne
* @param double $pu_ht Prix unitaire HT (> 0 even for credit note)
* @param double $qty Quantite
* @param double $txtva Taux de tva force, sinon -1
* @param int $fk_product Id du produit/service predefini
* @param double $remise_percent Pourcentage de remise de la ligne
* @param string $price_base_type HT or TTC
* @param int $info_bits Bits de type de lignes
* @param int $fk_remise_except Id remise
* @param double $pu_ttc Prix unitaire TTC (> 0 even for credit note)
* @param int $type Type of line (0=product, 1=service)
* @param int $rang Position of line
* @param int $special_code Special code
* @param string $label Label of the line
* @param string $fk_unit Unit
* @return int <0 if KO, Id of line if OK
*/
function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $label='', $fk_unit=null)
{
global $mysoc;
$facid=$this->id;
dol_syslog(get_class($this)."::updateline facid=".$facid." rowid=$rowid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG);
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Check parameters
if ($type < 0) return -1;
if ($this->brouillon)
{
// Clean parameters
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
if (! $qty) $qty=1;
if (! $info_bits) $info_bits=0;
$pu_ht=price2num($pu_ht);
$pu_ttc=price2num($pu_ttc);
$txtva=price2num($txtva);
if ($price_base_type=='HT')
{
$pu=$pu_ht;
}
else
{
$pu=$pu_ttc;
}
// Calcul du total TTC et de la TVA pour la ligne a partir de
// qty, pu, remise_percent et txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, 0, $price_base_type, $info_bits, $type, $mysoc);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
$product_type=$type;
if ($fk_product)
{
$product=new Product($this->db);
$result=$product->fetch($fk_product);
$product_type=$product->type;
}
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet_rec SET ";
$sql.= "fk_facture = '".$facid."'";
$sql.= ", label=".(! empty($label)?"'".$this->db->escape($label)."'":"null");
$sql.= ", description='".$this->db->escape($desc)."'";
$sql.= ", price=".price2num($pu_ht);
$sql.= ", qty=".price2num($qty);
$sql.= ", tva_tx=".price2num($txtva);
$sql.= ", fk_product=".(! empty($fk_product)?"'".$fk_product."'":"null");
$sql.= ", product_type=".$product_type;
$sql.= ", remise_percent='".price2num($remise_percent)."'";
$sql.= ", subprice='".price2num($pu_ht)."'";
$sql.= ", total_ht='".price2num($total_ht)."'";
$sql.= ", total_tva='".price2num($total_tva)."'";
$sql.= ", total_ttc='".price2num($total_ttc)."'";
$sql.= ", rang=".$rang;
$sql.= ", special_code=".$special_code;
$sql.= ", fk_unit=".($fk_unit?"'".$this->db->escape($fk_unit)."'":"null");
$sql.= " WHERE rowid = ".$rowid;
dol_syslog(get_class($this)."::updateline", LOG_DEBUG);
if ($this->db->query($sql))
{
$this->id=$facid;
$this->update_price();
return 1;
}
else
{
$this->error=$this->db->lasterror();
return -1;
}
}
}
/** /**
* Return the next date of * Return the next date of
* *

View File

@ -3555,6 +3555,10 @@ class Facture extends CommonInvoice
$prodids[$i] = $row[0]; $prodids[$i] = $row[0];
} }
} }
//Avoid php warning Warning: mt_rand(): max(0) is smaller than min(1) when no product exists
if (empty($num_prods)) {
$num_prods=1;
}
// Initialize parameters // Initialize parameters
$this->id=0; $this->id=0;

View File

@ -552,9 +552,9 @@ if ($action == 'addline' && $user->rights->facture->creer)
if ($result > 0) if ($result > 0)
{ {
// Define output language
/*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) /*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{ {
// Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
@ -615,8 +615,168 @@ if ($action == 'addline' && $user->rights->facture->creer)
} }
} }
elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('cancel'))
{
if (! $object->fetch($id) > 0) dol_print_error($db);
$object->fetch_thirdparty();
// Clean parameters
$date_start = '';
$date_end = '';
//$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
//$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
$description = dol_htmlcleanlastbr(GETPOST('product_desc') ? GETPOST('product_desc') : GETPOST('desc'));
$pu_ht = GETPOST('price_ht');
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
$qty = GETPOST('qty');
// Define info_bits
$info_bits = 0;
if (preg_match('/\*/', $vat_rate))
$info_bits |= 0x01;
// Define vat_rate
$vat_rate = str_replace('*', '', $vat_rate);
$localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty);
$localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty);
// Add buying price
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
// Extrafields
$extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
// Unset extrafield
if (is_array($extralabelsline)) {
// Get extra fields
foreach ($extralabelsline as $key => $value) {
unset($_POST["options_" . $key]);
}
}
// Define special_code for special lines
$special_code=GETPOST('special_code');
if (! GETPOST('qty')) $special_code=3;
/*$line = new FactureLigne($db);
$line->fetch(GETPOST('lineid'));
$percent = $line->get_prev_progress($object->id);
if (GETPOST('progress') < $percent)
{
$mesg = '<div class="warning">' . $langs->trans("CantBeLessThanMinPercent") . '</div>';
setEventMessages($mesg, null, 'warnings');
$error++;
$result = -1;
}*/
// Check minimum price
$productid = GETPOST('productid', 'int');
if (! empty($productid))
{
$product = new Product($db);
$product->fetch($productid);
$type = $product->type;
$price_min = $product->price_min;
if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level))
$price_min = $product->multiprices_min [$object->thirdparty->price_level];
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
// Check price is not lower than minimum (check is done only for standard or replacement invoices)
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error ++;
}
} else {
$type = GETPOST('type');
$label = (GETPOST('product_label') ? GETPOST('product_label') : '');
// Check parameters
if (GETPOST('type') < 0) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
$error ++;
}
}
if ($qty < 0) {
$langs->load("errors");
setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors');
$error ++;
}
// Update line
if (! $error) {
$result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty,
$vat_rate, GETPOST('productid'), GETPOST('remise_percent'), 'HT', $info_bits, 0, 0, $type,
0, $special_code, $label, GETPOST('units'));
if ($result >= 0) {
/*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
// Define output language
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id'))
$newlang = GETPOST('lang_id');
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
$newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$ret = $object->fetch($id); // Reload to get new records
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}*/
$object->fetch($object->id); // Reload lines
unset($_POST['qty']);
unset($_POST['type']);
unset($_POST['productid']);
unset($_POST['remise_percent']);
unset($_POST['price_ht']);
unset($_POST['multicurrency_price_ht']);
unset($_POST['price_ttc']);
unset($_POST['tva_tx']);
unset($_POST['product_ref']);
unset($_POST['product_label']);
unset($_POST['product_desc']);
unset($_POST['fournprice']);
unset($_POST['buying_price']);
unset($_POST['np_marginRate']);
unset($_POST['np_markRate']);
unset($_POST['dp_desc']);
unset($_POST['idprod']);
unset($_POST['units']);
unset($_POST['date_starthour']);
unset($_POST['date_startmin']);
unset($_POST['date_startsec']);
unset($_POST['date_startday']);
unset($_POST['date_startmonth']);
unset($_POST['date_startyear']);
unset($_POST['date_endhour']);
unset($_POST['date_endmin']);
unset($_POST['date_endsec']);
unset($_POST['date_endday']);
unset($_POST['date_endmonth']);
unset($_POST['date_endyear']);
unset($_POST['situations']);
unset($_POST['progress']);
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
// Do we click on purge search criteria ? // 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 if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
{ {
$search_ref=''; $search_ref='';
$search_societe=''; $search_societe='';
@ -1302,7 +1462,7 @@ else
// Show object lines // Show object lines
if (! empty($object->lines)) if (! empty($object->lines))
{ {
$disableedit=1; //$disableedit=1;
//$disablemove=1; //$disablemove=1;
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 0); // No date selector for template invoice $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 0); // No date selector for template invoice
} }

View File

@ -699,7 +699,13 @@ 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_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1);
if ($search_montant_vat != '') $sql.= natural_search('f.total_vat', $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_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_status != '' && $search_status >= 0)
{
if ($search_status == '0') $sql.=" AND f.fk_statut = 0"; // draft
if ($search_status == '1') $sql.=" AND f.fk_statut = 1"; // unpayed
if ($search_status == '2') $sql.=" AND f.fk_statut = 2"; // payed Not that some correupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed)
if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned
}
if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode.""; if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode."";
if ($month > 0) if ($month > 0)
{ {

View File

@ -87,8 +87,6 @@ class BonPrelevement extends CommonObject
$this->factures = array(); $this->factures = array();
$this->numero_national_emetteur = "";
$this->methodes_trans = array(); $this->methodes_trans = array();
$this->methodes_trans[0] = "Internet"; $this->methodes_trans[0] = "Internet";
@ -919,7 +917,10 @@ class BonPrelevement extends CommonObject
$row = $this->db->fetch_row($resql); $row = $this->db->fetch_row($resql);
$ref = "T".$ref.str_pad(dol_substr("00".intval($row[0])+1,0,2),2,"0",STR_PAD_LEFT); $ref = "T".$ref.str_pad(dol_substr("00".intval($row[0])+1,0,2),2,"0",STR_PAD_LEFT);
$this->filename = $conf->prelevement->dir_output.'/receipts/'.$ref.'.xml'; $dir=$conf->prelevement->dir_output.'/receipts';
if (! is_dir($dir)) dol_mkdir($dir);
$this->filename = $dir.'/receipts/'.$ref.'.xml';
// Create withdraw receipt in database // Create withdraw receipt in database
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";
@ -935,10 +936,6 @@ class BonPrelevement extends CommonObject
{ {
$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons"); $prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
$this->id = $prev_id; $this->id = $prev_id;
$dir=$conf->prelevement->dir_output.'/receipts';
$file=$filebonprev;
if (! is_dir($dir)) dol_mkdir($dir);
} }
else else
{ {
@ -1018,7 +1015,6 @@ class BonPrelevement extends CommonObject
$this->date_echeance = $datetimeprev; $this->date_echeance = $datetimeprev;
$this->reference_remise = $ref; $this->reference_remise = $ref;
$this->numero_national_emetteur = $conf->global->PRELEVEMENT_NUMERO_NATIONAL_EMETTEUR;
$this->raison_sociale = $conf->global->PRELEVEMENT_RAISON_SOCIALE; $this->raison_sociale = $conf->global->PRELEVEMENT_RAISON_SOCIALE;
$this->emetteur_code_banque = $conf->global->PRELEVEMENT_CODE_BANQUE; $this->emetteur_code_banque = $conf->global->PRELEVEMENT_CODE_BANQUE;
@ -1027,14 +1023,14 @@ class BonPrelevement extends CommonObject
$this->emetteur_number_key = $conf->global->PRELEVEMENT_NUMBER_KEY; $this->emetteur_number_key = $conf->global->PRELEVEMENT_NUMBER_KEY;
$this->emetteur_iban = $conf->global->PRELEVEMENT_IBAN; $this->emetteur_iban = $conf->global->PRELEVEMENT_IBAN;
$this->emetteur_bic = $conf->global->PRELEVEMENT_BIC; $this->emetteur_bic = $conf->global->PRELEVEMENT_BIC;
$this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // TODO Add this into setup of admin/prelevement.php. Ex: PRELEVEMENT_ICS = "FR78ZZZ123456"; $this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
$this->factures = $factures_prev_id; $this->factures = $factures_prev_id;
// Generation of SEPA file // Generation of SEPA file
$this->generate(); $this->generate();
} }
dol_syslog(__METHOD__."::End withdraw receipt, file ".$filebonprev, LOG_DEBUG); dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG);
} }
/* /*
@ -1462,7 +1458,7 @@ class BonPrelevement extends CommonObject
fputs($this->file, " "); // Zone Reservee B2 fputs($this->file, " "); // Zone Reservee B2
fputs($this->file, $this->numero_national_emetteur); // Numero National d'emmetteur B3 fputs($this->file, $this->emetteur_ics); // ICS
// Date d'echeance C1 // Date d'echeance C1
@ -1611,7 +1607,7 @@ class BonPrelevement extends CommonObject
fputs($this->file, " "); // Zone Reservee B2 fputs($this->file, " "); // Zone Reservee B2
fputs($this->file, $this->numero_national_emetteur); // Numero National d'emmetteur B3 fputs($this->file, $this->emetteur_ics); // ICS
// Date d'echeance C1 // Date d'echeance C1
@ -1778,7 +1774,7 @@ class BonPrelevement extends CommonObject
fputs($this->file, " "); // Zone Reservee B2 fputs($this->file, " "); // Zone Reservee B2
fputs($this->file, $this->numero_national_emetteur); // Numero National d'emmetteur B3 fputs($this->file, $this->emetteur_ics); // ICS
// Reserve C1 // Reserve C1

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2015-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -62,13 +62,17 @@ if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJ
{ {
$arrayresult['searchintoprojects']=array('text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php?search_all='.urlencode($search_boxvalue)); $arrayresult['searchintoprojects']=array('text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php?search_all='.urlencode($search_boxvalue));
} }
if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLED) && $user->rights->projet->lire)
{
$arrayresult['searchintotasks']=array('text'=>img_picto('','object_task').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php?search_all='.urlencode($search_boxvalue));
}
if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire) if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire)
{ {
$arrayresult['searchintomember']=array('text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php?sall='.urlencode($search_boxvalue)); $arrayresult['searchintomember']=array('text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php?sall='.urlencode($search_boxvalue));
} }
if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->user->user->lire) if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->rights->user->user->lire)
{ {
$arrayresult['searchintouser']=array('text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/index.php?sall='.urlencode($search_boxvalue)); $arrayresult['searchintouser']=array('text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/index.php?sall='.urlencode($search_boxvalue));
} }
@ -114,11 +118,11 @@ if (! empty($conf->ficheinter->enabled) && empty($conf->global->MAIN_SEARCHFORM_
// HR // HR
if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire) if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire)
{ {
$arrayresult['searchintoexpensereport']=array('text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?sall='.urlencode($search_boxvalue)); $arrayresult['searchintoexpensereport']=array('text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue));
} }
if (! empty($conf->holiday->enabled) && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->rights->holiday->read) if (! empty($conf->holiday->enabled) && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->rights->holiday->read)
{ {
$arrayresult['searchintoleaves']=array('text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?sall='.urlencode($search_boxvalue)); $arrayresult['searchintoleaves']=array('text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue));
} }

View File

@ -167,12 +167,14 @@ class box_actions extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @return void * @param int $nooutput No print, only return string
* @return string
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
global $langs, $conf; global $langs, $conf;
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents);
$out='';
if (! empty($conf->global->SHOW_DIALOG_HOMEPAGE)) if (! empty($conf->global->SHOW_DIALOG_HOMEPAGE))
{ {
$actioncejour=false; $actioncejour=false;
@ -183,8 +185,8 @@ class box_actions extends ModeleBoxes
$bcx[1] = 'class="box_impair"'; $bcx[1] = 'class="box_impair"';
if ($contents[0][0]['text'] != $langs->trans("NoActionsToDo")) if ($contents[0][0]['text'] != $langs->trans("NoActionsToDo"))
{ {
print '<div id="dialogboxaction" title="'.$nblines." ".$langs->trans("ActionsToDo").'">'; $out.= '<div id="dialogboxaction" title="'.$nblines." ".$langs->trans("ActionsToDo").'">';
print '<table width=100%>'; $out.= '<table width=100%>';
for ($line=0, $n=$nblines; $line < $n; $line++) for ($line=0, $n=$nblines; $line < $n; $line++)
{ {
if (isset($contents[$line])) if (isset($contents[$line]))
@ -202,40 +204,45 @@ class box_actions extends ModeleBoxes
$urlsoc=$contents[$line][3]['url']; $urlsoc=$contents[$line][3]['url'];
$dateligne=$contents[$line][4]['text']; $dateligne=$contents[$line][4]['text'];
$percentage=$contents[$line][5]['text']; $percentage=$contents[$line][5]['text'];
print '<tr '.$bcx[$var].'>'; $out.= '<tr '.$bcx[$var].'>';
print '<td align=center>'; $out.= '<td align=center>';
print img_object("",$logo); $out.= img_object("",$logo);
print '</td>'; $out.= '</td>';
print '<td align=center><a href="'.$urlevent.'">'.$label.'</a></td>'; $out.= '<td align=center><a href="'.$urlevent.'">'.$label.'</a></td>';
print '<td align=center><a href="'.$urlsoc.'">'.img_object("",$logosoc)." ".$nomsoc.'</a></td>'; $out.= '<td align=center><a href="'.$urlsoc.'">'.img_object("",$logosoc)." ".$nomsoc.'</a></td>';
print '<td align=center>'.$dateligne.'</td>'; $out.= '<td align=center>'.$dateligne.'</td>';
print '<td align=center>'.$percentage.'</td>'; $out.= '<td align=center>'.$percentage.'</td>';
print '</tr>'; $out.= '</tr>';
} }
} }
print '</table>'; $out.= '</table>';
} }
print '</div>'; $out.= '</div>';
if ($actioncejour) if ($actioncejour)
{ {
print '<script>'; $out.= '<script>';
print '$("#dialogboxaction").dialog({ autoOpen: true });'; $out.= '$("#dialogboxaction").dialog({ autoOpen: true });';
if ($conf->global->SHOW_DIALOG_HOMEPAGE > 1) // autoclose after this delay if ($conf->global->SHOW_DIALOG_HOMEPAGE > 1) // autoclose after this delay
{ {
print 'setTimeout(function(){'; $out.= 'setTimeout(function(){';
print '$("#dialogboxaction").dialog("close");'; $out.= '$("#dialogboxaction").dialog("close");';
print '}, '.($conf->global->SHOW_DIALOG_HOMEPAGE*1000).');'; $out.= '}, '.($conf->global->SHOW_DIALOG_HOMEPAGE*1000).');';
} }
print '</script>'; $out.= '</script>';
} }
else else
{ {
print '<script>'; $out.= '<script>';
print '$("#dialogboxaction").dialog({ autoOpen: false });'; $out.= '$("#dialogboxaction").dialog({ autoOpen: false });';
print '</script>'; $out.= '</script>';
} }
} }
if ($nooutput) return $out;
else print $out;
return '';
} }
} }

View File

@ -455,10 +455,11 @@ class box_activity extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -135,11 +135,12 @@ class box_bookmarks extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -157,11 +157,12 @@ class box_clients extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -176,11 +176,12 @@ class box_commandes extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -169,11 +169,12 @@ class box_comptes extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -163,11 +163,12 @@ class box_contacts extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -157,11 +157,12 @@ class box_contracts extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -184,11 +184,12 @@ class box_external_rss extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -180,11 +180,12 @@ class box_factures extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @return void * @param int $nooutput No print, only return string
* @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -189,11 +189,12 @@ class box_factures_fourn extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -186,11 +186,12 @@ class box_factures_fourn_imp extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -182,11 +182,12 @@ class box_factures_imp extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -144,11 +144,12 @@ class box_ficheinter extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -139,11 +139,12 @@ class box_fournisseurs extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -158,11 +158,12 @@ class box_goodcustomers extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -263,11 +263,12 @@ class box_graph_invoices_permonth extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -262,11 +262,12 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -263,11 +263,12 @@ class box_graph_orders_permonth extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -262,11 +262,12 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -390,11 +390,12 @@ class box_graph_product_distribution extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -264,11 +264,12 @@ class box_graph_propales_permonth extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -169,11 +169,12 @@ class box_members extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -192,11 +192,12 @@ class box_produits extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -199,11 +199,12 @@ class box_produits_alerte_stock extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -173,11 +173,12 @@ class box_project extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -166,11 +166,12 @@ class box_propales extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -167,11 +167,12 @@ class box_prospect extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -175,11 +175,12 @@ class box_services_contracts extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -147,11 +147,12 @@ class box_services_expired extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -171,11 +171,12 @@ class box_supplier_orders extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @return void * @param int $nooutput No print, only return string
*/ * @return void
function showBox($head = null, $contents = null) */
function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -137,10 +137,11 @@ class box_task extends ModeleBoxes
* *
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void * @return void
*/ */
function showBox($head = null, $contents = null) function showBox($head = null, $contents = null, $nooutput=0)
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }
} }

View File

@ -885,7 +885,7 @@ abstract class CommonObject
if ($order == 'position') $order.=',code'; if ($order == 'position') $order.=',code';
$tab = array(); $tab = array();
$sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle"; $sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle, tc.position";
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc";
$sql.= " WHERE tc.element='".$this->element."'"; $sql.= " WHERE tc.element='".$this->element."'";
if ($activeonly == 1) $sql.= " AND tc.active=1"; // only the active types if ($activeonly == 1) $sql.= " AND tc.active=1"; // only the active types
@ -4489,7 +4489,7 @@ abstract class CommonObject
if (! $db->query($sql)) if (! $db->query($sql))
{ {
if ($ignoreerrors) return true; if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B.
//$this->errors = $db->lasterror(); //$this->errors = $db->lasterror();
return false; return false;
} }

View File

@ -640,7 +640,8 @@ class ExtraFields
} }
else else
{ {
print dol_print_error($this->db); $this->error=$this->db->lasterror();
dol_syslog(get_class($this)."::fetch_name_optionals_label ".$this->error, LOG_ERR);
} }
return $array_name_label; return $array_name_label;
@ -800,11 +801,7 @@ class ExtraFields
// 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value // 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value
$keyList=(empty($InfoFieldList[2])?'rowid':$InfoFieldList[2].' as rowid'); $keyList=(empty($InfoFieldList[2])?'rowid':$InfoFieldList[2].' as rowid');
if (count($InfoFieldList) > 3 && ! empty($InfoFieldList[3]))
{
list($parentName, $parentField) = explode('|', $InfoFieldList[3]);
$keyList.= ', '.$parentField;
}
if (count($InfoFieldList) > 4 && ! empty($InfoFieldList[4])) if (count($InfoFieldList) > 4 && ! empty($InfoFieldList[4]))
{ {
if (strpos($InfoFieldList[4], 'extra.') !== false) if (strpos($InfoFieldList[4], 'extra.') !== false)
@ -814,6 +811,11 @@ class ExtraFields
$keyList=$InfoFieldList[2].' as rowid'; $keyList=$InfoFieldList[2].' as rowid';
} }
} }
if (count($InfoFieldList) > 3 && ! empty($InfoFieldList[3]))
{
list($parentName, $parentField) = explode('|', $InfoFieldList[3]);
$keyList.= ', '.$parentField;
}
$fields_label = explode('|',$InfoFieldList[1]); $fields_label = explode('|',$InfoFieldList[1]);
if (is_array($fields_label)) if (is_array($fields_label))

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2010-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2014 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2010-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* *
@ -87,8 +87,7 @@ class HookManager
{ {
if (is_array($hooks)) $arrayhooks=$hooks; // New system if (is_array($hooks)) $arrayhooks=$hooks; // New system
else $arrayhooks=explode(':',$hooks); // Old system (for backward compatibility) else $arrayhooks=explode(':',$hooks); // Old system (for backward compatibility)
if (in_array($context,$arrayhooks) || in_array('all',$arrayhooks)) // We instantiate action class only if hook is required
if (in_array($context,$arrayhooks)) // We instantiate action class only if hook is required
{ {
$path = '/'.$module.'/class/'; $path = '/'.$module.'/class/';
$actionfile = 'actions_'.$module.'.class.php'; $actionfile = 'actions_'.$module.'.class.php';
@ -143,6 +142,7 @@ class HookManager
'formObjectOptions', 'formObjectOptions',
'formattachOptions', 'formattachOptions',
'formBuilddocLineOptions', 'formBuilddocLineOptions',
'getIdProfUrl',
'moveUploadedFile', 'moveUploadedFile',
'pdf_build_address', 'pdf_build_address',
'pdf_writelinedesc', 'pdf_writelinedesc',
@ -247,11 +247,7 @@ class HookManager
} }
} }
// TODO remove this. When there is something to print for an output hook, ->resPrint is filled.
//if ($hooktype == 'output') return $this->resPrint;
//if ($hooktype == 'returnvalue') return $result;
return ($error?-1:$resaction); return ($error?-1:$resaction);
} }
} }

View File

@ -5582,10 +5582,11 @@ class Form
* @param string $moreparam More param to add in nav link url. * @param string $moreparam More param to add in nav link url.
* @param int $nodbprefix Do not include DB prefix to forge table name * @param int $nodbprefix Do not include DB prefix to forge table name
* @param string $morehtmlleft More html code to show before ref * @param string $morehtmlleft More html code to show before ref
* @param string $morehtmlright More html code to show before navigation arrows * @param string $morehtmlstatus More html code to show under navigation arrows (status place)
* @param string $morehtmlright More html code to show after ref
* @return string Portion HTML avec ref + boutons nav * @return string Portion HTML avec ref + boutons nav
*/ */
function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0,$morehtmlleft='',$morehtmlright='') function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0,$morehtmlleft='',$morehtmlstatus='',$morehtmlright='')
{ {
global $langs,$conf; global $langs,$conf;
@ -5604,7 +5605,7 @@ class Form
//print "xx".$previous_ref."x".$next_ref; //print "xx".$previous_ref."x".$next_ref;
$ret.='<div style="vertical-align: middle">'; $ret.='<div style="vertical-align: middle">';
$ret.='<div class="inline-block floatleft">'.$morehtmlleft.'</div>'; if ($morehtmlleft) $ret.='<div class="inline-block floatleft">'.$morehtmlleft.'</div>';
$ret.='<div class="inline-block floatleft valignmiddle refid'.(($shownav && ($previous_ref || $next_ref))?' refidpadding':'').'">'; $ret.='<div class="inline-block floatleft valignmiddle refid'.(($shownav && ($previous_ref || $next_ref))?' refidpadding':'').'">';
@ -5624,6 +5625,8 @@ class Form
} }
$ret.='</div>'; $ret.='</div>';
if ($morehtmlright) $ret.='<div class="inline-block floatleft">'.$morehtmlright.'</div>';
if ($previous_ref || $next_ref || $morehtml) if ($previous_ref || $next_ref || $morehtml)
{ {
$ret.='<div class="pagination"><ul>'; $ret.='<div class="pagination"><ul>';
@ -5641,7 +5644,7 @@ class Form
{ {
$ret.='</ul></div>'; $ret.='</ul></div>';
} }
if ($morehtmlright) $ret.='<div class="statusref">'.$morehtmlright.'</div>'; if ($morehtmlstatus) $ret.='<div class="statusref">'.$morehtmlstatus.'</div>';
$ret.='</div>'; $ret.='</div>';
return $ret; return $ret;

View File

@ -50,7 +50,7 @@ class FormContract
* @param string $htmlname Nom de la zone html * @param string $htmlname Nom de la zone html
* @param int $maxlength Maximum length of label * @param int $maxlength Maximum length of label
* @param int $showempty Show empty line * @param int $showempty Show empty line
* @return int Nbre of project if OK, <0 if KO * @return int Nbr of project if OK, <0 if KO
*/ */
function select_contract($socid=-1, $selected='', $htmlname='contrattid', $maxlength=16, $showempty=1) function select_contract($socid=-1, $selected='', $htmlname='contrattid', $maxlength=16, $showempty=1)
{ {
@ -137,4 +137,32 @@ class FormContract
return -1; return -1;
} }
} }
/**
* Show a form to select a contract
*
* @param int $page Page
* @param int $socid Id third party (-1=all, 0=only contracts not linked to a third party, id=contracts not linked or linked to third party id)
* @param int $selected Id contract preselected
* @param string $htmlname Nom de la zone html
* @param int $maxlength Maximum length of label
* @param int $showempty Show empty line
* @return int Nbr of project if OK, <0 if KO
*/
function formSelectContract($page, $socid=-1, $selected='', $htmlname='contrattid', $maxlength=16, $showempty=1)
{
global $langs;
print "\n";
print '<form method="post" action="'.$page.'">';
print '<input type="hidden" name="action" value="setcontract">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
print '<tr><td>';
$this->select_contract($socid, $selected, $htmlname, $maxlength, $showempty);
print '</td>';
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr></table></form>';
}
} }

View File

@ -6,6 +6,7 @@
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com> * Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -687,7 +688,7 @@ class FormFile
* *
* @param string $modulepart propal, facture, facture_fourn, ... * @param string $modulepart propal, facture, facture_fourn, ...
* @param string $modulesubdir Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module. * @param string $modulesubdir Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module.
* @param string $filedir Directory to scan * @param string $filedir Full path to directory to scan
* @param string $filter Filter filenames on this regex string (Example: '\.pdf$') * @param string $filter Filter filenames on this regex string (Example: '\.pdf$')
* @return string Output string with HTML link of documents (might be empty string). This also fill the array ->infofiles * @return string Output string with HTML link of documents (might be empty string). This also fill the array ->infofiles
*/ */
@ -720,9 +721,6 @@ class FormFile
if ($modulepart == 'export') { if ($modulepart == 'export') {
$relativepath = $file["name"]; $relativepath = $file["name"];
} }
if ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_fournisseur') {
$relativepath = get_exdir($modulesubdir, 2,0,0,null,'invoice_supplier'). $modulesubdir. "/" . $file["name"];
}
// Show file name with link to download // Show file name with link to download
$out.= '<a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'"'; $out.= '<a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'"';

View File

@ -464,12 +464,14 @@ class FormProjets
$sql = "SELECT t.id as rowid, t.label as ref"; $sql = "SELECT t.id as rowid, t.label as ref";
$projectkey="fk_project"; $projectkey="fk_project";
break; break;
case "expensereport_det": case "expensereport":
return ''; return '';
case "expensereport_det":
/*$sql = "SELECT rowid, '' as ref"; // table is llx_expensereport_det /*$sql = "SELECT rowid, '' as ref"; // table is llx_expensereport_det
$projectkey="fk_projet"; $projectkey="fk_projet";
break;*/ break;*/
case "commande": return '';
case "commande":
case "contrat": case "contrat":
case "fichinter": case "fichinter":
$sql = "SELECT t.rowid, t.ref"; $sql = "SELECT t.rowid, t.ref";

View File

@ -161,6 +161,7 @@ class Translate
{ {
global $conf,$db; global $conf,$db;
// Load $this->tab_translate[] from database
if (count($this->tab_translate) == 0) $this->loadFromDatabase($db); // Nothing was loaded yet, so we load database. if (count($this->tab_translate) == 0) $this->loadFromDatabase($db); // Nothing was loaded yet, so we load database.
// Check parameters // Check parameters
@ -241,7 +242,7 @@ class Translate
$tmparray=dol_getcache($usecachekey); $tmparray=dol_getcache($usecachekey);
if (is_array($tmparray) && count($tmparray)) if (is_array($tmparray) && count($tmparray))
{ {
$this->tab_translate+=$tmparray; // Faster than array_merge($tmparray,$this->tab_translate). Note: If a valuer already exists into tab_translate, value into tmparaay is not added. $this->tab_translate+=$tmparray; // Faster than array_merge($tmparray,$this->tab_translate). Note: If a value already exists into tab_translate, value into tmparaay is not added.
//print $newdomain."\n"; //print $newdomain."\n";
//var_dump($this->tab_translate); //var_dump($this->tab_translate);
if ($alt == 2) $fileread=1; if ($alt == 2) $fileread=1;
@ -261,7 +262,8 @@ class Translate
{ {
$tab=explode('=',$line,2); $tab=explode('=',$line,2);
$key=trim($tab[0]); $key=trim($tab[0]);
//print "Domain=$domain, found a string for $tab[0] with value $tab[1]<br>"; //if ($domain == 'orders') print "Domain=$domain, found a string for $tab[0] with value $tab[1]. Currently in cache ".$this->tab_translate[$key]."<br>";
//if ($key == 'Order') print "Domain=$domain, found a string for key=$key=$tab[0] with value $tab[1]. Currently in cache ".$this->tab_translate[$key]."<br>";
if (empty($this->tab_translate[$key]) && isset($tab[1])) // If translation was already found, we must not continue, even if MAIN_FORCELANGDIR is set (MAIN_FORCELANGDIR is to replace lang dir, not to overwrite entries) if (empty($this->tab_translate[$key]) && isset($tab[1])) // If translation was already found, we must not continue, even if MAIN_FORCELANGDIR is set (MAIN_FORCELANGDIR is to replace lang dir, not to overwrite entries)
{ {
$value=trim(preg_replace('/\\n/',"\n",$tab[1])); $value=trim(preg_replace('/\\n/',"\n",$tab[1]));
@ -278,6 +280,7 @@ class Translate
else else
{ {
$this->tab_translate[$key]=$value; $this->tab_translate[$key]=$value;
//if ($domain == 'orders') print "$tab[0] value $value<br>";
if ($usecachekey) $tabtranslatedomain[$key]=$value; // To save lang content in cache if ($usecachekey) $tabtranslatedomain[$key]=$value; // To save lang content in cache
} }
} }

View File

@ -133,26 +133,26 @@ oConnector.CheckError = function( responseXml )
switch ( iErrorNumber ) switch ( iErrorNumber )
{ {
case 0 : case 0:
break ; break;
case 1 : // Custom error. Message placed in the "text" attribute. case 1: // Custom error. Message placed in the "text" attribute.
alert( oErrorNode.attributes.getNamedItem('text').value ); alert( oErrorNode.attributes.getNamedItem('text').value );
break ; break;
case 101 : case 101:
alert( 'Folder already exists' ); alert( 'Folder already exists' );
break ; break;
case 102 : case 102:
alert( 'Invalid folder name' ); alert( 'Invalid folder name' );
break ; break;
case 103 : case 103:
alert( 'You have no permissions to create the folder' ); alert( 'You have no permissions to create the folder' );
break ; break;
case 110 : case 110:
alert( 'Unknown error creating folder' ); alert( 'Unknown error creating folder' );
break ; break;
default : default:
alert( 'Error on your request. Error number: ' + iErrorNumber ); alert( 'Error on your request. Error number: ' + iErrorNumber );
break ; break;
} }
} }
return iErrorNumber ; return iErrorNumber ;

View File

@ -91,24 +91,24 @@ function CreateFolderCallBack( fckXml )
switch ( iErrorNumber ) switch ( iErrorNumber )
{ {
case 0 : case 0:
window.parent.frames['frmResourcesList'].Refresh(); window.parent.frames['frmResourcesList'].Refresh();
break ; break;
case 101 : case 101:
alert( 'Folder already exists' ); alert( 'Folder already exists' );
break ; break;
case 102 : case 102:
alert( 'Invalid folder name' ); alert( 'Invalid folder name' );
break ; break;
case 103 : case 103:
alert( 'You have no permissions to create the folder' ); alert( 'You have no permissions to create the folder' );
break ; break;
case 110 : case 110:
alert( 'Unknown error creating folder' ); alert( 'Unknown error creating folder' );
break ; break;
default : default:
alert( 'Error creating folder. Error number: ' + iErrorNumber ); alert( 'Error creating folder. Error number: ' + iErrorNumber );
break ; break;
} }
*/ */
} }

View File

@ -95,22 +95,22 @@ function OnUploadCompleted( errorNumber, data )
switch ( errorNumber ) switch ( errorNumber )
{ {
case 0 : case 0:
window.parent.frames['frmResourcesList'].Refresh(); window.parent.frames['frmResourcesList'].Refresh();
break ; break;
case 1 : // Custom error. case 1: // Custom error.
alert( data ); alert( data );
break ; break;
case 201 : case 201:
window.parent.frames['frmResourcesList'].Refresh(); window.parent.frames['frmResourcesList'].Refresh();
alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + data + '"' ); alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + data + '"' );
break ; break;
case 202 : case 202:
alert( 'Invalid file' ); alert( 'Invalid file' );
break ; break;
default : default:
alert( 'Error on file upload. Error number: ' + errorNumber ); alert( 'Error on file upload. Error number: ' + errorNumber );
break ; break;
} }
} }

View File

@ -160,14 +160,14 @@ function CreateFolder( $resourceType, $currentFolder )
switch ( $sErrorMsg ) switch ( $sErrorMsg )
{ {
case '' : case '':
$sErrorNumber = '0' ; $sErrorNumber = '0' ;
break ; break;
case 'Invalid argument' : case 'Invalid argument' :
case 'No such file or directory' : case 'No such file or directory' :
$sErrorNumber = '102' ; // Path too long. $sErrorNumber = '102' ; // Path too long.
break ; break ;
default : default:
$sErrorNumber = '110' ; $sErrorNumber = '110' ;
break ; break ;
} }

View File

@ -46,7 +46,7 @@ function emailing_prepare_head(Mailing $object)
$head[$h][2] = 'targets'; $head[$h][2] = 'targets';
$h++; $h++;
if (! empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR)) // Still need debug if (! empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR))
{ {
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id; $head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id;
$head[$h][1] = $langs->trans("MailAdvTargetRecipients"); $head[$h][1] = $langs->trans("MailAdvTargetRecipients");

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