diff --git a/.tx/config b/.tx/config index c4ec45cd3b2..010227f6e61 100644 --- a/.tx/config +++ b/.tx/config @@ -170,7 +170,7 @@ source_file = htdocs/langs/en_US/interventions.lang source_lang = en_US type = MOZILLAPROPERTIES -[dolibarr.languages] +[dolibarr.languages-not-res] file_filter = htdocs/langs//languages.lang source_file = htdocs/langs/en_US/languages.lang source_lang = en_US diff --git a/COPYRIGHT b/COPYRIGHT index b8cf93e595a..4e43541fa60 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -40,7 +40,7 @@ jQuery blockUI 2.70.0 GPL and MIT License Yes jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors jQuery DataTables 1.9.4 BSD Yes JS library for tables output jQuery FileUpload 5.0.3 GPL and MIT License Yes JS library to upload files -jQuery Flot 0.7 MIT License Yes JS library to build graph +jQuery Flot 0.8.3 MIT License Yes JS library to build graph jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images) jQuery Jeditable 1.7.1 GPL and MIT License Yes JS library plugin jeditable (to edit in place) jQuery jNotify 1.1.00 Apache Software License 2.0 Yes JS library plugin jNotify (to use ajax popups) diff --git a/ChangeLog b/ChangeLog index e3d40f3a04c..2510764c349 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,7 +12,7 @@ Upgrading to any other version or any other database system is abolutely require make a Dolibarr upgrade. -***** ChangeLog for 4.0 compared to 3.9.* ***** +***** ChangeLog for 4.0.0 compared to 3.9.* ***** For users: NEW: Add reccuring invoice feature and automatic generation of invoices. diff --git a/build/exe/doliwamp/Languages/MyFrench.isl b/build/exe/doliwamp/Languages/MyFrench.isl index 0fd71f96bfb..6c1b859a318 100644 --- a/build/exe/doliwamp/Languages/MyFrench.isl +++ b/build/exe/doliwamp/Languages/MyFrench.isl @@ -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. -; WARNING !!! STRINGS FOR THIS 4 STRINGS MUST BE LOWER THAN 60 CHARACTERS -SMTPServer=Serveur SMTP (le votre ou celui de votre FAI, première installation uniquement) : -ApachePort=Port Apache (première installation uniquement, le choix standard est 80) : -MySqlPort=Port Mysql (première installation uniquement, le choix standard est 3306) : +; WARNING !!! STRINGS FOR THIS 4 STRINGS MUST BE LOWER THAN 70 CHARACTERS +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): +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): 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... diff --git a/build/exe/doliwamp/dolibarr.conf.install b/build/exe/doliwamp/dolibarr.conf.install index 40b8dea7784..4dbb8c62317 100644 --- a/build/exe/doliwamp/dolibarr.conf.install +++ b/build/exe/doliwamp/dolibarr.conf.install @@ -1,6 +1,6 @@ Alias /dolibarr "WAMPROOT/www/dolibarr/htdocs/" -# NOTE: +# NOTE FOR APACHE 2.2: # To restrict access to dolibarr from outside set lines # # Order Deny,Allow @@ -12,10 +12,21 @@ Alias /dolibarr "WAMPROOT/www/dolibarr/htdocs/" # Order Allow,Deny # Allow from all # +# NOTE FOR APACHE 2.3: +# To restrict access to dolibarr from outside set lines +# +# +# Require ip 127.0.0.1 +# Require host localhost +# +# +# instead of +# +# Require all granted +# Options Indexes FollowSymLinks MultiViews AllowOverride all - Order Allow,Deny - Allow from all + Require all granted \ No newline at end of file diff --git a/build/exe/doliwamp/doliwamp.bmp b/build/exe/doliwamp/doliwamp.bmp index 52b1320d111..3414e100306 100644 Binary files a/build/exe/doliwamp/doliwamp.bmp and b/build/exe/doliwamp/doliwamp.bmp differ diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index 8c6130437ac..dfe7febf2db 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -99,17 +99,18 @@ Source: "build\exe\doliwamp\builddemosslfiles.bat.install"; DestDir: "{app}\"; F Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversion; ; PhpMyAdmin, Apache, Php, Mysql ; Put here path of Wampserver applications -; Value OK: apache 2.2.6, php 5.2.5 (5.2.11, 5.3.0 and 5.3.1 fails if php_exif, php_pgsql, php_zip is on), mysql 5.0.45 or 5.1.36 -; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45 or 5.1.36 +; Value OK: apache 2.2.6, php 5.2.5 (5.2.11, 5.3.0 and 5.3.1 fails if php_exif, php_pgsql, php_zip is on), mysql 5.0.45 +; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45 +; Value ???: 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\bin\apache\apache2.4.9\*.*"; DestDir: "{app}\bin\apache\apache2.4.9"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log" Source: "C:\Program Files\Wamp\bin\php\php5.5.12\*.*"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log" -Source: "C:\Program Files\Wamp\bin\mysql\mysql5.6.17\*.*"; DestDir: "{app}\bin\mysql\mysql5.6.17"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe" +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) Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db" ; Dolibarr Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,documents\*,includes\ckeditor\_source\*,includes\savant\*,includes\phpmailer\*,jquery\plugins\template\*,nltechno*\*,PHPExcel\Shared\PDF\*,PHPExcel\Shared\PCLZip\*,tcpdf\fonts\dejavu-fonts-ttf-2.33\*,tcpdf\fonts\freefont-20100919\*,tcpdf\fonts\utils\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\conf.php.sav,*\install.forced.php" -Source: "dev\*.*"; DestDir: "{app}\www\dolibarr\dev"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,dbmodel\*,fpdf\*,initdata\*,iso-normes\*,licence\*,phpcheckstyle\*,phpunit\*,samples\*,test\*,uml\*,vagrant\*,xdebug\*" +Source: "dev\*.*"; DestDir: "{app}\www\dolibarr\dev"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,dbmodel\*,fpdf\*,initdata\*,initdemo\*,iso-normes\*,licence\*,phpcheckstyle\*,phpunit\*,samples\*,test\*,uml\*,vagrant\*,xdebug\*" Source: "doc\*.*"; DestDir: "{app}\www\dolibarr\doc"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,wiki\*,plaquette\*,dev\*,images\dolibarr_screenshot2.png,images\dolibarr_screenshot3.png,images\dolibarr_screenshot4.png,images\dolibarr_screenshot5.png,images\dolibarr_screenshot6.png,images\dolibarr_screenshot7.png,images\dolibarr_screenshot8.png,images\dolibarr_screenshot9.png,images\dolibarr_screenshot10.png,images\dolibarr_screenshot11.png,images\dolibarr_screenshot12.png" Source: "scripts\*.*"; DestDir: "{app}\www\dolibarr\scripts"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,product\materiel.net.php,product\import-product.php" Source: "*.*"; DestDir: "{app}\www\dolibarr"; Flags: ignoreversion; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,default.properties,install.lock" @@ -118,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\config.inc.php.install"; DestDir: "{app}\apps\phpmyadmin4.1.14"; Flags: ignoreversion; Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.9\conf"; Flags: ignoreversion; -Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.5.12"; Flags: ignoreversion; -Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php5.6.17"; Flags: ignoreversion; +Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.0.45"; 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\install.forced.php.install"; DestDir: "{app}\www\dolibarr\htdocs\install"; Flags: ignoreversion; Source: "build\exe\doliwamp\openssl.conf"; DestDir: "{app}"; Flags: ignoreversion; @@ -145,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 +[Registry] +; Add "run as admin" flag. Same than command line: reg add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "" /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] //variables globales @@ -197,7 +204,7 @@ begin //version des applis, a modifier pour chaque version de WampServer 2 apacheVersion := '2.4.9'; phpVersion := '5.5.12' ; - mysqlVersion := '5.6.17'; + mysqlVersion := '5.0.45'; phpmyadminVersion := '4.1.14'; smtpServer := 'localhost'; @@ -255,14 +262,13 @@ begin // Prepare an object calle "Page" of type wpInstalling. // Object will be show later in NextButtonClick function. - Page := CreateInputQueryPage(wpInstalling, - CustomMessage('TechnicalParameters'), '', - CustomMessage('IfFirstInstall')); + Page := CreateInputQueryPage(wpInstalling, CustomMessage('TechnicalParameters'), '', CustomMessage('IfFirstInstall')); // TODO Add control differently if first install or update if firstinstall then begin + // False means it's not a password edit Page.Add(CustomMessage('SMTPServer'), False); Page.Add(CustomMessage('ApachePort'), False); Page.Add(CustomMessage('MySqlPort'), False); @@ -270,6 +276,7 @@ begin end else begin + // False means it's not a password edit Page.Add(CustomMessage('SMTPServer'), False); Page.Add(CustomMessage('ApachePort'), False); Page.Add(CustomMessage('MySqlPort'), False); @@ -309,8 +316,7 @@ function NextButtonClick(CurPageID: Integer): Boolean; var myResult: Integer; var res: Boolean; var paramok: Boolean; -var datadirold: String; -var datadirnew: String; +var datadir: String; var exedirold: String; var exedirnew: String; var themessage: String; @@ -329,10 +335,22 @@ begin winPath := ExpandConstant('{win}'); pathWithSlashes := path; StringChange (pathWithSlashes, '\','/'); - datadirold := pathWithSlashes+'/bin/mysql/mysql5.6.17/data'; - datadirnew := pathWithSlashes+'/bin/mysql/data'; - exedirold := pathWithSlashes+'/bin/mysql/mysql5.6.17'; - exedirnew := pathWithSlashes+'/bin/mysql/mysql5.6.17'; + datadir := pathWithSlashes+'/bin/mysql/data'; + exedirold := pathWithSlashes+'/bin/mysql/mysql5.0.45'; + exedirnew := pathWithSlashes+'/bin/mysql/mysql5.0.45'; + + + //---------------------------------------------- + // 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 http://www.microsoft.com/en-us/download/details.aspx?id=30679 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 // and change only all basedir= strings to use new version. Like this, data dir is still correct. @@ -663,7 +681,7 @@ begin //installDir et version de php StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True); StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True); - StringChangeEx (srcContents, 'WAMPMYSQLVERSION', myport, True); + StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True); SaveStringToFile(destFile,srcContents, False); end @@ -737,6 +755,7 @@ begin LoadStringFromFile (srcFile, srcContents); //version de apache et mysql + StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True); StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True); StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True); @@ -745,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) //---------------------------------------------- @@ -778,6 +776,7 @@ begin LoadStringFromFile (srcFile, srcContents); //version de apache et mysql + StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True); StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True); StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True); @@ -966,7 +965,6 @@ end; procedure DeinitializeSetup(); begin // DeleteFile(path+'\install_services.bat'); -// DeleteFile(path+'\install_services_auto.bat'); end; @@ -1003,7 +1001,7 @@ Filename: "{app}\rundoliwamp.bat"; Description: {cm:LaunchNow}; Flags: shellexec [UninstallDelete] 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}\apps" Type: filesandordirs; Name: "{app}\bin\apache" diff --git a/build/exe/doliwamp/doliwampsmall.bmp b/build/exe/doliwamp/doliwampsmall.bmp index f19e98fd19a..f4d51aa0229 100644 Binary files a/build/exe/doliwamp/doliwampsmall.bmp and b/build/exe/doliwamp/doliwampsmall.bmp differ diff --git a/build/exe/doliwamp/httpd.conf.install b/build/exe/doliwamp/httpd.conf.install index bfe17b07d42..96bf688b1d5 100644 --- a/build/exe/doliwamp/httpd.conf.install +++ b/build/exe/doliwamp/httpd.conf.install @@ -66,19 +66,23 @@ Listen WAMPAPACHEPORT # LoadModule actions_module modules/mod_actions.so LoadModule alias_module modules/mod_alias.so +LoadModule allowmethods_module modules/mod_allowmethods.so LoadModule asis_module modules/mod_asis.so LoadModule auth_basic_module modules/mod_auth_basic.so #LoadModule auth_digest_module modules/mod_auth_digest.so #LoadModule authn_anon_module modules/mod_authn_anon.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 authz_core_module modules/mod_authz_core.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_host_module modules/mod_authz_host.so LoadModule authz_user_module modules/mod_authz_user.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 cgi_module modules/mod_cgi.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 mime_module modules/mod_mime.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_ajp_module modules/mod_proxy_ajp.so #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so #LoadModule proxy_connect_module modules/mod_proxy_connect.so #LoadModule proxy_http_module modules/mod_proxy_http.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 setenvif_module modules/mod_setenvif.so #LoadModule speling_module modules/mod_speling.so +#LoadModule ssl_module modules/mod_ssl.so LoadModule status_module modules/mod_status.so #LoadModule unique_id_module modules/mod_unique_id.so LoadModule userdir_module modules/mod_userdir.so #LoadModule usertrack_module modules/mod_usertrack.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_2.dll" +LoadModule php5_module "WAMPROOT/bin/php/phpWAMPPHPVERSION/php5apache2_4.dll" # # ExtendedStatus controls whether Apache will generate "full" status @@ -123,9 +127,9 @@ ExtendedStatus On SetHandler server-status -Order Deny,Allow -Deny from all -Allow from localhost, 127.0.0.1 +Require local +#Require ip 1.2.3.4 +#Require host 1.2.3.4 @@ -211,9 +215,7 @@ KeepAliveTimeout 30 Options FollowSymLinks AllowOverride None - Order deny,allow - Deny from all - Satisfy all + Require all denied # @@ -253,9 +255,10 @@ KeepAliveTimeout 30 # Controls who can get stuff from this server. # # onlineoffline tag - don't remove - Order Deny,Allow - Deny from all - Allow from 127.0.0.1 + + Require ip 127.0.0.1 + Require host localhost + @@ -272,8 +275,7 @@ KeepAliveTimeout 30 # viewed by Web clients. # - Order allow,deny - Deny from all + Require all denied # @@ -359,8 +361,7 @@ LogLevel warn AllowOverride None Options None - Order allow,deny - Allow from all + Require all granted # @@ -410,7 +411,7 @@ LogLevel warn # keep browsers from trying to display binary files as though they are # text. # -DefaultType text/plain +#DefaultType text/plain # diff --git a/build/exe/doliwamp/install_services.bat.install b/build/exe/doliwamp/install_services.bat.install index 991e6f040aa..5ad43827f86 100644 --- a/build/exe/doliwamp/install_services.bat.install +++ b/build/exe/doliwamp/install_services.bat.install @@ -8,6 +8,8 @@ echo ---- Execute install_services.bat >> doliwamp.log 2>>&1 REM NET STOP doliwampapache REM NET STOP doliwampmysqld +cd "WAMPROOT" + REM Apache x.x .\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 @@ -19,3 +21,5 @@ REM Mysql 5.1+ REM .\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld.exe --install doliwampmysqld echo ---- End script >> doliwamp.log 2>>&1 + +REM pause diff --git a/build/exe/doliwamp/my.ini.install b/build/exe/doliwamp/my.ini.install index c855cc27a66..e1a9495e20b 100644 --- a/build/exe/doliwamp/my.ini.install +++ b/build/exe/doliwamp/my.ini.install @@ -77,10 +77,6 @@ log-error=WAMPROOT/logs/mysql.log #Path to the database root 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 default-storage-engine=INNODB @@ -101,13 +97,6 @@ max_connections=255 # slowdown instead of a performance improvement. 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 # grows larger than this value, it is automatically converted to disk # based table This limitation is for a single table. There can be many @@ -125,18 +114,6 @@ thread_cache_size=12 #*** 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 # 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 @@ -170,13 +147,6 @@ sort_buffer_size=203K # and speed up some things. #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 # disk at each commit, which offers full ACID behavior. If you are # 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. -basedir=WAMPROOT/bin/mysql/mysql5.6.17 +basedir=WAMPROOT/bin/mysql/mysqlWAMPMYSQLVERSION #log file log-error=WAMPROOT/logs/mysql.log @@ -234,10 +204,6 @@ log-error=WAMPROOT/logs/mysql.log #Path to the database root 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 default-storage-engine=INNODB @@ -258,13 +224,6 @@ max_connections=255 # slowdown instead of a performance improvement. 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 # grows larger than this value, it is automatically converted to disk # based table This limitation is for a single table. There can be many @@ -282,18 +241,6 @@ thread_cache_size=12 #*** 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 # 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 @@ -327,13 +274,6 @@ sort_buffer_size=203K # and speed up some things. #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 # disk at each commit, which offers full ACID behavior. If you are # willing to compromise this safety, and you are running small diff --git a/build/exe/doliwamp/phpmyadmin.conf.install b/build/exe/doliwamp/phpmyadmin.conf.install index ff7045835fa..7c0c2f8141c 100644 --- a/build/exe/doliwamp/phpmyadmin.conf.install +++ b/build/exe/doliwamp/phpmyadmin.conf.install @@ -1,22 +1,35 @@ Alias /phpmyadmin "WAMPROOT/apps/phpmyadminWAMPPHPMYADMINVERSION/" -# to give access to phpmyadmin from outside -# replace the lines +# NOTE FOR APACHE 2.2: +# 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 # Allow from 127.0.0.1 # -# by +# NOTE FOR APACHE 2.3: +# To grant access to dolibarr from outside set lines # -# Order Allow,Deny -# Allow from all +# Require all granted +# +# instead of +# +# +# Require ip 127.0.0.1 +# Require host localhost +# # Options Indexes FollowSymLinks MultiViews AllowOverride all - Order Deny,Allow - Deny from all - Allow from 127.0.0.1 + + Require ip 127.0.0.1 + Require host localhost + \ No newline at end of file diff --git a/build/exe/doliwamp/startdoliwamp.bat b/build/exe/doliwamp/startdoliwamp.bat index d6842c56010..6e1d6f2641d 100644 --- a/build/exe/doliwamp/startdoliwamp.bat +++ b/build/exe/doliwamp/startdoliwamp.bat @@ -10,9 +10,11 @@ NET START doliwampapache >> doliwamp.log 2>>&1 echo 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 ---- End script >> doliwamp.log 2>>&1 REM sleep is not a Windows commande -REM sleep 1 -ping 1.1.1.1 -n 1 -w 1000 > nul \ No newline at end of file +REM sleep 2 +ping 127.0.0.1 -n 2 -w 1000 > nul diff --git a/build/exe/doliwamp/startdoliwamp_manual_donotuse.bat.install b/build/exe/doliwamp/startdoliwamp_manual_donotuse.bat.install index 751302c0633..c8e33e4620b 100644 --- a/build/exe/doliwamp/startdoliwamp_manual_donotuse.bat.install +++ b/build/exe/doliwamp/startdoliwamp_manual_donotuse.bat.install @@ -13,5 +13,6 @@ echo 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 +REM start WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld.exe --defaults-file=WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\my.ini --console pause \ No newline at end of file diff --git a/build/exe/doliwamp/stopdoliwamp.bat b/build/exe/doliwamp/stopdoliwamp.bat index e4d2ce07c29..e7f8caefb77 100644 --- a/build/exe/doliwamp/stopdoliwamp.bat +++ b/build/exe/doliwamp/stopdoliwamp.bat @@ -15,4 +15,6 @@ echo ---- End script >> doliwamp.log 2>>&1 REM sleep is not a Windows command REM sleep 1 -ping 1.1.1.1 -n 1 -w 1000 > nul \ No newline at end of file +ping 1.1.1.1 -n 1 -w 1000 > nul + +REM pause diff --git a/build/exe/doliwamp/uninstall_services.bat.install b/build/exe/doliwamp/uninstall_services.bat.install index 52b166c19d4..0f12a29b6e2 100644 --- a/build/exe/doliwamp/uninstall_services.bat.install +++ b/build/exe/doliwamp/uninstall_services.bat.install @@ -3,10 +3,19 @@ REM -------------------------------------------------------- REM This script install Apache and Mysql DoliWamp services REM -------------------------------------------------------- +cd "WAMPROOT" + echo ---- Execute uninstall_services.bat >> doliwamp.log 2>>&1 NET STOP doliwampapache .\bin\apache\apacheWAMPAPACHEVERSION\bin\httpd.exe -k uninstall -n doliwampapache + NET STOP doliwampmysqld +REM Mysql 5.0- .\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} echo ---- End script >> doliwamp.log 2>>&1 + +REM pause diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 45c8e0a6f42..b6c86a7a119 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -53,7 +53,7 @@ if (-d "/usr/src/RPM") { $RPMDIR="/usr/src/RPM"; } # mandrake use vars qw/ $REVISION $VERSION /; -$VERSION="3.3"; +$VERSION="4.0"; @@ -356,6 +356,7 @@ if ($nboftargetok) { # Test that the ChangeLog is ok $TMPBUILDTOCHECKCHANGELOG=$BUILD; $TMPBUILDTOCHECKCHANGELOG =~ s/\-rc\d*//; + $TMPBUILDTOCHECKCHANGELOG =~ s/\-beta\d*//; print "Check if ChangeLog is ok for version $MAJOR.$MINOR\.$TMPBUILDTOCHECKCHANGELOG\n"; $ret=`grep "ChangeLog for $MAJOR.$MINOR\.$TMPBUILDTOCHECKCHANGELOG" "$SOURCE/ChangeLog" 2>&1`; if (! $ret) @@ -458,6 +459,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/dev/codetemplates`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/dbmodel`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/initdata`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/initdemo`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/iso-normes`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/ldap`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/licence`; @@ -1121,7 +1123,7 @@ if ($nboftargetok) { { if ($CHOOSEDPUBLISH{$target} < 0) { next; } - print "\nList of files to publish\n"; + print "\nList of files to publish (BUILD=$BUILD)\n"; %filestoscansf=( "$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)', "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)', @@ -1136,6 +1138,22 @@ if ($nboftargetok) { "$DESTI/standard/$FILENAMETGZ.tgz"=>'standard', "$DESTI/standard/$FILENAMETGZ.zip"=>'standard' ); + if ($target eq 'ASSO' && $BUILD =~ /[a-z]/i) { # Not stable + %filestoscansf=( + "$DESTI/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)', + "$DESTI/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)', + "$DESTI/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)', + "$DESTI/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM', + "$DESTI/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM' + ); + %filestoscanstableasso=( + "$DESTI/$FILENAMERPM"=>'', + "$DESTI/${FILENAMEDEB}_all.deb"=>'', + "$DESTI/$FILENAMEEXEDOLIWAMP.exe"=>'', + "$DESTI/$FILENAMETGZ.tgz"=>'', + "$DESTI/$FILENAMETGZ.zip"=>'' + ); + } use POSIX qw/strftime/; foreach my $file (sort keys %filestoscansf) diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index 0cd72f99cdd..4ad1441104d 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -192,6 +192,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/loan %_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/margin +%_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paypal @@ -206,6 +207,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/theme %_datadir/dolibarr/htdocs/user %_datadir/dolibarr/htdocs/webservices +%_datadir/dolibarr/htdocs/websites %_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.php diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index 043088bf5d6..f20b2047225 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -272,6 +272,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/loan %_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/margin +%_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paypal @@ -286,6 +287,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/theme %_datadir/dolibarr/htdocs/user %_datadir/dolibarr/htdocs/webservices +%_datadir/dolibarr/htdocs/websites %_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.php diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index 3f439bb4a9a..ca836bc47d6 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -189,6 +189,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/loan %_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/margin +%_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paypal @@ -203,6 +204,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/theme %_datadir/dolibarr/htdocs/user %_datadir/dolibarr/htdocs/webservices +%_datadir/dolibarr/htdocs/websites %_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.php diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index cc21d7083b3..fcff3363213 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -200,6 +200,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/loan %_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/margin +%_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paypal @@ -214,6 +215,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/theme %_datadir/dolibarr/htdocs/user %_datadir/dolibarr/htdocs/webservices +%_datadir/dolibarr/htdocs/websites %_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.php diff --git a/dev/security/htaccess.txt b/dev/security/htaccess.txt index 7d3aaf1a903..a8364c85a0f 100644 --- a/dev/security/htaccess.txt +++ b/dev/security/htaccess.txt @@ -1,2 +1 @@ -Order allow,deny -Deny from all \ No newline at end of file +Require all granted diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index 7fa7aae9756..22432433334 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -90,7 +90,7 @@ class modMyModule extends DolibarrModules // '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 // '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 // '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 // ); @@ -180,8 +180,8 @@ class modMyModule extends DolibarrModules // Cronjobs $this->cronjobs = array(); // List of cron jobs entries to add - // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600), - // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24) + // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'test'=>true), + // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'test'=>true) // ); // Permissions @@ -241,7 +241,7 @@ class modMyModule extends DolibarrModules // $this->export_code[$r]=$this->rights_class.'_'.$r; // $this->export_label[$r]='MyModule'; // Translation key (used only if key ExportDataset_xxx_z not found) // $this->export_enabled[$r]='1'; // Condition to show export in list (ie: '$user->id==3'). Set to 1 to always show when module is enabled. - // $this->export_icon[$r]='generic:MyModule'; + // $this->export_icon[$r]='generic:MyModule'; // Put here code of icon then string for translation key of module name // $this->export_permission[$r]=array(array("mymodule","level1","level2")); // $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef'); // $this->export_TypeFields_array[$r]=array('t.date'=>'Date', 't.qte'=>'Numeric', 't.poids'=>'Numeric', 't.fad'=>'Numeric', 't.paq'=>'Numeric', 't.stockage'=>'Numeric', 't.fadparliv'=>'Numeric', 't.livau100'=>'Numeric', 't.forfait'=>'Numeric', 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.subprice'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text'); diff --git a/dev/translation/sanity_check_en_langfiles.php b/dev/translation/sanity_check_en_langfiles.php index eb5ca99ea48..6d63c415981 100755 --- a/dev/translation/sanity_check_en_langfiles.php +++ b/dev/translation/sanity_check_en_langfiles.php @@ -299,6 +299,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a if (preg_match('/^DateFormat/', $value)) $qualifiedforclean=0; if (preg_match('/^.b$/', $value)) $qualifiedforclean=0; if (preg_match('/^.*Bytes$/', $value)) $qualifiedforclean=0; + if (preg_match('/^NoteSomeFeaturesAreDisabled/', $value)) $qualifiedforclean=0; if (preg_match('/^(DoTest|Under|Limits|Cards|CurrentValue|DateLimit|DateAndHour|NbOfLines|NbOfObjects|NbOfReferes|TotalTTCShort|VATs)/', $value)) $qualifiedforclean=0; // orders if (preg_match('/^OrderSource/', $value)) $qualifiedforclean=0; @@ -315,12 +316,16 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a if (preg_match('/^EMailText/', $value)) $qualifiedforclean=0; if (preg_match('/ById$/', $value)) $qualifiedforclean=0; if (preg_match('/ByLogin$/', $value)) $qualifiedforclean=0; + // printing + if (preg_match('/PrintingDriverDesc$/', $value)) $qualifiedforclean=0; + if (preg_match('/PrintTestDesc$/', $value)) $qualifiedforclean=0; // products if (preg_match('/GlobalVariableUpdaterType$/', $value)) $qualifiedforclean=0; if (preg_match('/GlobalVariableUpdaterHelp$/', $value)) $qualifiedforclean=0; if (preg_match('/OppStatus/', $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('/TF_/i', $value)) $qualifiedforclean=0; if (preg_match('/WithBankUsing/i', $value)) $qualifiedforclean=0; diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index b1836836e84..e1a0e3fe052 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -16,9 +16,9 @@ */ /** - * \file htdocs/accountancy/admin/categories.php - * \ingroup Advanced accountancy - * \brief Page to assign mass categories to accounts + * \file htdocs/accountancy/admin/categories.php + * \ingroup Advanced accountancy + * \brief Page to assign mass categories to accounts */ require '../../main.inc.php'; @@ -36,11 +36,11 @@ $langs->load("accountancy"); $mesg = ''; $action = GETPOST('action'); $cat_id = GETPOST('account_category'); -$selectcpt = GETPOST('cpt_bk'); +$selectcpt = GETPOST('cpt_bk', 'array'); $cpt_id = GETPOST('cptid'); -if($cat_id == 0){ - $cat_id = null; +if ($cat_id == 0) { + $cat_id = null; } $id = GETPOST('id', 'int'); @@ -54,31 +54,30 @@ if (! $user->admin) $AccCat = new AccountancyCategory($db); // si ajout de comptes -if(!empty($selectcpt)){ - $cpts = array(); - $i = 0; - foreach ($selectcpt as $selectedOption){ - $cpts[$i] = "'".$selectedOption."'"; - $i++; +if (! empty($selectcpt)) { + $cpts = array (); + foreach ( $selectcpt as $selectedOption ) { + if (! array_key_exists($selectedOption, $cpts)) + $cpts[$selectedOption] = "'" . $selectedOption . "'"; } - - 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'); - }else{ - setEventMessages($langs->trans('errors'), null, 'errors'); } - - } if ($action == 'delete') { - if($cpt_id){ - if($AccCat->deleteCptCat($cpt_id)){ + if ($cpt_id) { + if ($AccCat->deleteCptCat($cpt_id)) { setEventMessages($langs->trans('Deleted'), null, 'mesgs'); - }else{ + } else { setEventMessages($langs->trans('errors'), null, 'errors'); } } -} +} /* * View @@ -88,65 +87,69 @@ llxheader('', $langs->trans('AccountAccounting')); $formaccounting = new FormAccounting($db); $form = new Form($db); - print load_fiche_titre($langs->trans('Categories')); +print load_fiche_titre($langs->trans('Categories')); - print '
' . "\n"; - print ''; - print ''; +print '' . "\n"; +print ''; +print ''; - dol_fiche_head(); +dol_fiche_head(); - print ''; - // Category - print ''; - print ''; +print '
' . $langs->trans("AccountingCategory") . ''; - $formaccounting->select_accounting_category($cat_id, 'account_category', 1); - print ''; - print '
'; +// Category +print ''; +print ''; - - if(!empty($cat_id)){ - $obj = $AccCat->getCptBK($cat_id); - print ''; - print ''; +if (! empty($cat_id)) { + $return = $AccCat->getCptBK($cat_id); + if ($return < 0) { + setEventMessages(null, $AccCat->errors, 'errors'); } - - print '
' . $langs->trans("AccountingCategory") . ''; +$formaccounting->select_accounting_category($cat_id, 'account_category', 1); +print ''; +print '
' . $langs->trans("AddCompteFromBK") . ''; - if(!empty($obj)){ - print ' - '; - } - print '
'; + print '' . $langs->trans("AddCompteFromBK") . ''; + print ''; + if (is_array($AccCat->lines_cptbk) && count($AccCat->lines_cptbk) > 0) { + print ' - '; + } + print ''; +} - dol_fiche_end(); +print ''; - print '
'; +dol_fiche_end(); + +print ''; if ($action == 'display' || $action == 'delete') { print ''; - print ''; + print ''; - if(!empty($cat_id)){ - $obj = $AccCat->display($cat_id); - $j=1; - if(!empty($obj)){ - foreach ( $obj as $cpt ) { + if (! empty($cat_id)) { + $return = $AccCat->display($cat_id); + if ($return < 0) { + setEventMessages(null, $AccCat->errors, 'errors'); + } + $j = 1; + if (is_array($AccCat->lines_display) && count($AccCat->lines_display) > 0) { + foreach ( $AccCat->lines_display as $cpt ) { $var = ! $var; - print ''; + print ''; print ''; print ''; - 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 ''; + 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 ''; print "\n"; - $j++; + $j ++; } - } + } } print "
'.$langs->trans("Numerocompte").''.$langs->trans("Description").'Action
' . $langs->trans("Numerocompte") . '' . $langs->trans("Description") . 'Action
' . length_accountg($cpt->account_number) . '' . $cpt->label . '
"; diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 7293797ecc6..ba3c37f1997 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -18,9 +18,9 @@ */ /** - * \file htdocs/accountancy/bookkeeping/card.php - * \ingroup Advanced accountancy - * \brief Page to show book-entry + * \file htdocs/accountancy/bookkeeping/card.php + * \ingroup Advanced accountancy + * \brief Page to show book-entry */ require '../../main.inc.php'; @@ -62,17 +62,17 @@ if (! empty($update)) { } if ($action == "confirm_update") { - + $error = 0; - + if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) { setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); $error ++; } - + if (empty($error)) { $book = new BookKeeping($db); - + $result = $book->fetch($id); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); @@ -82,7 +82,7 @@ if ($action == "confirm_update") { $book->label_compte = $label_compte; $book->debit = $debit; $book->credit = $credit; - + if (floatval($debit) != 0.0) { $book->montant = $debit; $book->sens = 'D'; @@ -91,7 +91,7 @@ if ($action == "confirm_update") { $book->montant = $credit; $book->sens = 'C'; } - + $result = $book->update($user); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); @@ -101,19 +101,19 @@ if ($action == "confirm_update") { } } } -} +} else if ($action == "add") { $error = 0; - + if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) { setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); $error ++; } - + if (empty($error)) { $book = new BookKeeping($db); - + $book->numero_compte = $account_number; $book->code_tiers = $code_tiers; $book->label_compte = $label_compte; @@ -126,17 +126,17 @@ else if ($action == "add") { $book->code_journal = GETPOST('code_journal'); $book->fk_doc = GETPOST('fk_doc'); $book->fk_docdet = GETPOST('fk_docdet'); - + if (floatval($debit) != 0.0) { $book->montant = $debit; $book->sens = 'D'; } - + if (floatval($credit) != 0.0) { $book->montant = $credit; $book->sens = 'C'; } - + $result = $book->createStd($user); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); @@ -145,15 +145,15 @@ else if ($action == "add") { $action = ''; } } -} +} else if ($action == "confirm_delete") { $book = new BookKeeping($db); - + $result = $book->fetch($id); - + $piece_num = $book->piece_num; - + if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); } else { @@ -163,11 +163,11 @@ else if ($action == "confirm_delete") { } } $action = ''; -} +} else if ($action == "confirm_create") { $book = new BookKeeping($db); - + $book->label_compte = ''; $book->debit = 0; $book->credit = 0; @@ -178,9 +178,9 @@ else if ($action == "confirm_create") { $book->code_journal = GETPOST('code_journal'); $book->fk_doc = 0; $book->fk_docdet = 0; - + $book->montant = 0; - + $result = $book->createStd($user); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); @@ -209,15 +209,15 @@ if ($action == 'delete') { if ($action == 'create') { print load_fiche_titre($langs->trans("CreateMvts")); - + $code_journal_array = array ( $conf->global->ACCOUNTING_SELL_JOURNAL => $conf->global->ACCOUNTING_SELL_JOURNAL, $conf->global->ACCOUNTING_PURCHASE_JOURNAL => $conf->global->ACCOUNTING_PURCHASE_JOURNAL, $conf->global->ACCOUNTING_SOCIAL_JOURNAL => $conf->global->ACCOUNTING_SOCIAL_JOURNAL, $conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL => $conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL, - $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL => $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL + $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL => $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL ); - + $sql = 'SELECT DISTINCT accountancy_journal FROM ' . MAIN_DB_PREFIX . 'bank_account WHERE clos=0'; $resql = $db->query($sql); if (! $resql) { @@ -229,52 +229,52 @@ if ($action == 'create') { } } } - + $book = new BookKeeping($db); $next_num_mvt = $book->getNextNumMvt(); - + print '
'; print '' . "\n"; print '' . "\n"; - + dol_fiche_head(); - + print ''; print ''; print ''; print ''; print ''; - + print ''; print ''; print ''; print ''; - + print ''; print ''; print ''; print ''; - + print ''; print ''; print ''; print ''; - + print ''; print ''; print ''; print ''; - + print '
' . $langs->trans("NumMvts") . '' . $next_num_mvt . '
' . $langs->trans("Docdate") . ''; print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1); print '
' . $langs->trans("Codejournal") . '' . $html->selectarray('code_journal', $code_journal_array) . '
' . $langs->trans("Docref") . '
' . $langs->trans("Doctype") . '
'; - + dol_fiche_end(); - + print '
'; print '     '; print '
'; - + print '
'; } else { $book = new BookKeeping($db); @@ -283,9 +283,9 @@ if ($action == 'create') { setEventMessages($book->error, $book->errors, 'errors'); } if (! empty($book->piece_num)) { - + print load_fiche_titre($langs->trans("UpdateMvts"), '' . $langs->trans('BackToList') . ''); - + print ''; print ''; print ''; @@ -309,14 +309,14 @@ if ($action == 'create') { print ''; print '
' . $langs->trans("NumMvts") . '
'; print '
'; - + $result = $book->fetch_all_per_mvt($piece_num); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); } else { - + print load_fiche_titre($langs->trans("ListeMvts")); - + print '
'; print '' . "\n"; print '' . "\n"; @@ -324,15 +324,15 @@ if ($action == 'create') { print '' . "\n"; print '' . "\n"; print '' . "\n"; - + print ""; if (count($book->linesmvt) > 0) { - + $total_debit = 0; $total_credit = 0; - + print ''; - + print_liste_field_titre($langs->trans("AccountAccountingShort")); print_liste_field_titre($langs->trans("Code_tiers")); print_liste_field_titre($langs->trans("Labelcompte")); @@ -341,18 +341,18 @@ if ($action == 'create') { print_liste_field_titre($langs->trans("Amount"), "", "", "", "", 'align="center"'); print_liste_field_titre($langs->trans("Sens"), "", "", "", "", 'align="center"'); print_liste_field_titre($langs->trans("Action"), "", "", "", "", 'width="60" align="center"'); - + print "\n"; - + foreach ( $book->linesmvt as $line ) { $var = ! $var; - print ''; - + print ''; + $total_debit += $line->debit; $total_credit += $line->credit; - + if ($action == 'update' && $line->id == $id) { - + print ''; @@ -376,7 +376,7 @@ if ($action == 'create') { print ''; print ''; print ''; - + print ''; } print "\n"; } - + if ($total_debit != $total_credit) { setEventMessages(null, array ( - 'MvtNotCorrectlyBalanced', - $total_credit, - $total_debit + $langs->trans('MvtNotCorrectlyBalanced', $total_credit, $total_debit) ), 'errors'); } - + if ($action == "" || $action == 'add') { $var = ! $var; - print ''; + print ''; print ''; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index cb5d7caf006..23148213aa0 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -202,14 +202,22 @@ if ($action == 'delbookkeeping') { if ($action == 'delbookkeepingyearconfirm') { $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) { setEventMessages($object->error, $object->errors, 'errors'); } Header("Location: list.php"); - exit(); + exit; } } if ($action == 'delmouvconfirm') { @@ -222,7 +230,7 @@ if ($action == 'delmouvconfirm') { setEventMessages($object->error, $object->errors, 'errors'); } Header("Location: list.php"); - exit(); + exit; } } if ($action == 'export_csv') { @@ -276,11 +284,13 @@ if ($action == 'delbookkeepingyear') { $form_question = array (); $delyear = GETPOST('delyear'); + $deljournal = GETPOST('deljournal'); if (empty($delyear)) { $delyear = dol_print_date(dol_now(), '%Y'); } $year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array'); + $journal_array = $formventilation->selectjournal_accountancy_bookkepping($deljournal, 'deljournal', 0, 'array'); $form_question['delyear'] = array ( 'name' => 'delyear', @@ -289,6 +299,13 @@ if ($action == 'delbookkeepingyear') { 'values' => $year_array, '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); print $formconfirm; diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index ef880aa8113..6211f5752b1 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -17,9 +17,9 @@ */ /** - * \file htdocs/accountancy/class/accountancycategory.class.php - * \ingroup Advanced accountancy - * \brief File of class to manage categories of an accounting category_type + * \file htdocs/accountancy/class/accountancycategory.class.php + * \ingroup Advanced accountancy + * \brief File of class to manage categories of an accounting category_type */ // Class @@ -32,18 +32,20 @@ class AccountancyCategory { private $db; public $error; - public $errors = array(); - //public $element='accounting_category'; - //public $table_element='c_accounting_category'; + public $errors = array (); + public $element = 'accounting_category'; + public $table_element = 'c_accounting_category'; 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; return 1; @@ -52,122 +54,136 @@ class AccountancyCategory /** * 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 - */ - public function display($id) - { + */ + public function display($id) { $sql = "SELECT t.rowid, t.account_number, t.label"; - $sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; - $sql.= " WHERE t.fk_accounting_category = " . $id; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; + $sql .= " WHERE t.fk_accounting_category = " . $id; + + $this->lines_display = array (); dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - $i = 0; - $obj = ''; $num = $this->db->num_rows($resql); if ($num) { - while ( $i < $num ) { - $obj[$i] = $this->db->fetch_object($resql); - $i ++; + while ( $obj = $this->db->fetch_object($resql) ) { + $this->lines_display[] = $obj; } } - return $obj; + return $num; } else { $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 * - * @param int $id Id category + * @param int $id Id category * * @return int <0 if KO, 0 if not found, >0 if OK */ - public function getCptBK($id) - { + public function getCptBK($id) { global $conf; $sql = "SELECT t.numero_compte, t.label_compte, t.doc_ref"; - $sql.= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; - $sql.= " WHERE t.numero_compte NOT IN ("; - $sql.= " SELECT t.account_number"; - $sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; - $sql.= " WHERE t.fk_accounting_category = " . $id .")"; - $sql.= " AND t.numero_compte IN ("; - $sql.= " SELECT DISTINCT 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)"; - $sql.= " GROUP BY t.numero_compte"; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; + $sql .= " WHERE t.numero_compte NOT IN ("; + $sql .= " SELECT t.account_number"; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; + $sql .= " WHERE t.fk_accounting_category = " . $id . ")"; + $sql .= " AND t.numero_compte IN ("; + $sql .= " SELECT DISTINCT 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)"; + $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); if ($resql) { - $i = 0; - $obj = ''; $num = $this->db->num_rows($resql); if ($num) { - while ( $i < $num ) { - $obj[$i] = $this->db->fetch_object($resql); - $i ++; + while ( $obj = $this->db->fetch_object($resql) ) { + $this->lines_cptbk[] = $obj; } } - return $obj; + return $num; } else { $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 * - * @param int $id_cat Id category - * @param array $cpts list of accounts array + * @param int $id_cat Id category + * @param array $cpts list of accounts array * * @return int <0 if KO, >0 if OK */ - public function updateAccAcc($id_cat, $cpts = array()) - { + public function updateAccAcc($id_cat, $cpts = array()) { global $conf; $error = 0; - $sql = "UPDATE " . 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"; - $sql.= " SET fk_accounting_category=" . $id_cat; - $sql.= " WHERE aa.account_number IN (" . join(',',$cpts) .")"; - $this->db->begin(); + require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; - 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); if (! $resql) { $error ++; $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 if ($error) { - foreach ($this->errors as $errmsg) { + foreach ( $this->errors as $errmsg ) { dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR); - $this->error.=($this->error ? ', ' . $errmsg : $errmsg); + $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); } $this->db->rollback(); - return -1 * $error; + return - 1 * $error; } else { $this->db->commit(); @@ -178,17 +194,16 @@ class AccountancyCategory /** * 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 */ - public function deleteCptCat($cpt_id) - { + public function deleteCptCat($cpt_id) { $error = 0; $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account as aa"; - $sql.= " SET fk_accounting_category= 0"; - $sql.= " WHERE aa.rowid= " . $cpt_id; + $sql .= " SET fk_accounting_category= 0"; + $sql .= " WHERE aa.rowid= " . $cpt_id; $this->db->begin(); dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); @@ -200,13 +215,13 @@ class AccountancyCategory // Commit or rollback if ($error) { - foreach ($this->errors as $errmsg) { + foreach ( $this->errors as $errmsg ) { dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR); - $this->error.=($this->error ? ', ' . $errmsg : $errmsg); + $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); } $this->db->rollback(); - return -1 * $error; + return - 1 * $error; } else { $this->db->commit(); @@ -217,57 +232,51 @@ class AccountancyCategory /** * 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; $sql = ""; - if (empty($mysoc->country_id) && empty($mysoc->country_code)) - { - dol_print_error('','Call to select_accounting_account with mysoc country not yet defined'); - exit; - } + if (empty($mysoc->country_id) && empty($mysoc->country_code)) { + dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined'); + exit(); + } - 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.= " 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.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c"; - $sql.= " WHERE c.active = 1"; - $sql.= " AND c.fk_country = ".$mysoc->country_id.")"; - $sql.= " AND cat.rowid = t.fk_accounting_category"; - $sql.= " ORDER BY cat.position ASC"; - } - 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.= " WHERE c.active = 1 AND c.fk_country = co.rowid"; - $sql.= " AND co.code = '".$mysoc->country_code."'"; - $sql.= " ORDER BY c.position ASC"; - } - - $resql = $this->db->query($sql); + 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 .= " 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 .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c"; + $sql .= " WHERE c.active = 1"; + $sql .= " AND c.fk_country = " . $mysoc->country_id . ")"; + $sql .= " AND cat.rowid = t.fk_accounting_category"; + $sql .= " ORDER BY cat.position ASC"; + } 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 .= " WHERE c.active = 1 AND c.fk_country = co.rowid"; + $sql .= " AND co.code = '" . $mysoc->country_code . "'"; + $sql .= " ORDER BY c.position ASC"; + } + + $resql = $this->db->query($sql); if ($resql) { $i = 0; $obj = ''; $num = $this->db->num_rows($resql); - $data = array(); + $data = array (); if ($num) { - while ( $i < $num ) { - $obj = $this->db->fetch_object($resql); + while ( $obj = $this->db->fetch_object($resql) ) { $name_cat = $obj->name_cat; - $data[$name_cat][$i] = array( - 'id' => $obj->rowid, - 'code' => $obj->code, - 'position' => $obj->position, - 'account_number' => $obj->account_number, - 'name_cpt' => $obj->name_cpt, - 'sens' => $obj->sens, - ); + $data[$name_cat][$i] = array ( + 'id' => $obj->rowid, + 'code' => $obj->code, + 'position' => $obj->position, + 'account_number' => $obj->account_number, + 'name_cpt' => $obj->name_cpt, + 'sens' => $obj->sens + ); $i ++; } } @@ -276,29 +285,28 @@ class AccountancyCategory $this->error = "Error " . $this->db->lasterror(); 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 - * - * @param int $cpt Id accounting account - * @param string $month Specifig month - Can be empty - * @param string $year Specific year - * @param int $sens Sens of the account 0: credit - debit 1: debit - credit * - * @return array Result in table + * @param int $cpt Id accounting account + * @param string $month Specifig month - Can be empty + * @param string $year Specific year + * @param int $sens Sens of the account 0: credit - debit 1: debit - credit + * + * @return integer Result in table */ - public function getResult($cpt, $month, $year, $sens) - { - $sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit"; - $sql.= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; - $sql.= " WHERE t.numero_compte = " . $cpt; - $sql.= " AND YEAR(t.doc_date) = " . $year; + public function getResult($cpt, $month, $year, $sens) { + $sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit"; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; + $sql .= " WHERE t.numero_compte = '" . $cpt."'"; + $sql .= " AND YEAR(t.doc_date) = " . $year; - if(! empty($month)){ - $sql.= " AND MONTH(t.doc_date) = " . $month; + if (! empty($month)) { + $sql .= " AND MONTH(t.doc_date) = " . $month; } dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); @@ -306,81 +314,77 @@ class AccountancyCategory if ($resql) { $num = $this->db->num_rows($resql); - $sdc = 0; + $this->sdc = 0; if ($num) { $obj = $this->db->fetch_object($resql); - if($sens == 1){ - $sdc = $obj->debit - $obj->credit; - }else{ - $sdc = $obj->credit - $obj->debit; + if ($sens == 1) { + $this->sdc = $obj->debit - $obj->credit; + } else { + $this->sdc = $obj->credit - $obj->debit; } } - return $sdc; + return $num; } else { $this->error = "Error " . $this->db->lasterror(); dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); - return -1; + return - 1; } } /** * Function to call category from a specific country * - * @return array Result in table + * @return array Result in table */ - public function getCatsCal() - { - global $db,$langs,$user,$mysoc; + public function getCatsCal() { + global $db, $langs, $user, $mysoc; - if (empty($mysoc->country_id) && empty($mysoc->country_code)) - { - dol_print_error('','Call to select_accounting_account with mysoc country not yet defined'); - exit; - } + if (empty($mysoc->country_id) && empty($mysoc->country_code)) { + dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined'); + exit(); + } - if (! empty($mysoc->country_id)) - { - $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c"; - $sql.= " WHERE c.active = 1 AND c.category_type = 1 "; - $sql.= " AND c.fk_country = ".$mysoc->country_id; - $sql.= " ORDER BY c.position ASC"; - } - else - { - $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co"; - $sql.= " WHERE c.active = 1 AND c.category_type = 1 AND c.fk_country = co.rowid"; - $sql.= " AND co.code = '".$mysoc->country_code."'"; - $sql.= " ORDER BY c.position ASC"; - } + if (! empty($mysoc->country_id)) { + $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position"; + $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c"; + $sql .= " WHERE c.active = 1 AND c.category_type = 1 "; + $sql .= " AND c.fk_country = " . $mysoc->country_id; + $sql .= " ORDER BY c.position ASC"; + } else { + $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position"; + $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co"; + $sql .= " WHERE c.active = 1 AND c.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); if ($resql) { $i = 0; $obj = ''; $num = $this->db->num_rows($resql); - $data = array(); + $data = array (); if ($num) { while ( $i < $num ) { $obj = $this->db->fetch_object($resql); $position = $obj->position; - $data[$position] = array( - 'code' => $obj->code, - 'label' => $obj->label, - 'formula' => $obj->formula - ); + $data[$position] = array ( + 'code' => $obj->code, + 'label' => $obj->label, + 'formula' => $obj->formula + ); $i ++; } } return $data; } else { $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; } } } diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index c7920577adc..ddc80e00571 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -43,6 +43,7 @@ class AccountancyExport public static $EXPORT_TYPE_CIEL = 5; public static $EXPORT_TYPE_QUADRATUS = 6; 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_QUADRATUS => $langs->trans('Modelcsv_quadratus'), 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 : $this->exportEbp($TData); break; - default : + case self::$EXPORT_TYPE_COGILOG : + $this->exportCogilog($TData); + break; + default: $this->errors[] = $langs->trans('accountancy_error_modelnotfound'); break; } @@ -151,6 +156,8 @@ class AccountancyExport * @return void */ public function exportNormal($objectLines) { + global $conf; + foreach ( $objectLines as $line ) { // Std export $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 * diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 6f4698413dc..79e66ab7cce 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -54,13 +54,13 @@ class BookKeeping extends CommonObject * @var string Name of table without prefix where object is stored */ public $table_element = 'accounting_bookkeeping'; - + /** * * @var BookKeepingLine[] Lines */ public $lines = array (); - + /** * * @var int ID @@ -84,10 +84,10 @@ class BookKeeping extends CommonObject public $import_key; public $code_journal; public $piece_num; - + /** */ - + /** * Constructor * @@ -97,22 +97,24 @@ class BookKeeping extends CommonObject $this->db = $db; return 1; } - + /** * Create object into database * * @param User $user User that creates * @param bool $notrigger false=launch triggers after, true=disable triggers - * + * * @return int <0 if KO, Id of created object if OK */ public function create(User $user, $notrigger = false) { dol_syslog(__METHOD__, LOG_DEBUG); - + + global $langs; + $error = 0; - + // Clean parameters - + if (isset($this->doc_type)) { $this->doc_type = trim($this->doc_type); } @@ -158,32 +160,32 @@ class BookKeeping extends CommonObject if (isset($this->piece_num)) { $this->piece_num = trim($this->piece_num); } - + $this->db->begin(); - + $this->piece_num = 0; - + // first check if line not yet in bookkeeping $sql = "SELECT count(*) as nb"; $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 numero_compte = '" . $this->numero_compte . "'"; - - dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG); + $sql .= " AND numero_compte = '" . $this->db->escape($this->numero_compte) . "'"; + + dol_syslog(get_class($this) . ":: create ", LOG_DEBUG); $resql = $this->db->query($sql); - + if ($resql) { $row = $this->db->fetch_object($resql); if ($row->nb == 0) { - + // Determine piece_num $sqlnum = "SELECT piece_num"; $sqlnum .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sqlnum .= " WHERE doc_type = '" . $this->doc_type . "'"; $sqlnum .= " AND fk_docdet = '" . $this->fk_docdet . "'"; $sqlnum .= " AND doc_ref = '" . $this->doc_ref . "'"; - + dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG); $resqlnum = $this->db->query($sqlnum); if ($resqlnum) { @@ -194,7 +196,7 @@ class BookKeeping extends CommonObject if (empty($this->piece_num)) { $sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum"; $sqlnum .= " FROM " . MAIN_DB_PREFIX . $this->table_element; - + dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG); $resqlnum = $this->db->query($sqlnum); if ($resqlnum) { @@ -202,18 +204,19 @@ class BookKeeping extends CommonObject $this->piece_num = $objnum->maxpiecenum; } } - dol_syslog(get_class($this) . ":: create this->piece_num=" . $this->piece_num, LOG_DEBUG); if (empty($this->piece_num)) { $this->piece_num = 1; } - + + dol_syslog(get_class($this) . ":: create this->piece_num=" . $this->piece_num, LOG_DEBUG); + $now = dol_now(); if (empty($this->date_create)) { $this->date_create = $now; } - + $sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . " ("; - + $sql .= "doc_date"; $sql .= ", doc_type"; $sql .= ", doc_ref"; @@ -230,33 +233,33 @@ class BookKeeping extends CommonObject $sql .= ", import_key"; $sql .= ", code_journal"; $sql .= ", piece_num"; - + $sql .= ") VALUES ("; - - $sql .= "'" . $this->doc_date . "'"; - $sql .= ",'" . $this->doc_type . "'"; - $sql .= ",'" . $this->doc_ref . "'"; + + $sql .= "'" . $this->db->idate($this->doc_date) . "'"; + $sql .= ",'" . $this->db->escape($this->doc_type) . "'"; + $sql .= ",'" . $this->db->escape($this->doc_ref) . "'"; $sql .= "," . $this->fk_doc; $sql .= "," . $this->fk_docdet; - $sql .= ",'" . $this->code_tiers . "'"; - $sql .= ",'" . $this->numero_compte . "'"; + $sql .= ",'" . $this->db->escape($this->code_tiers) . "'"; + $sql .= ",'" . $this->db->escape($this->numero_compte) . "'"; $sql .= ",'" . $this->db->escape($this->label_compte) . "'"; $sql .= "," . $this->debit; $sql .= "," . $this->credit; $sql .= "," . $this->montant; - $sql .= ",'" . $this->sens . "'"; + $sql .= ",'" . $this->db->escape($this->sens) . "'"; $sql .= ",'" . $this->fk_user_author . "'"; $sql .= ",'" . $this->date_create . "'"; - $sql .= ",'" . $this->code_journal . "'"; + $sql .= ",'" . $this->db->escape($this->code_journal) . "'"; $sql .= "," . $this->piece_num; - + $sql .= ")"; - - dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG); + + dol_syslog(get_class($this) . ":: create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); - + if ($id > 0) { $this->id = $id; $result = 0; @@ -264,67 +267,67 @@ class BookKeeping extends CommonObject $result = - 2; $error ++; $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 { $result = - 1; $error ++; $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 { $result = - 3; $error ++; - $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + $this->errors[] = $langs->trans('BookeppingLineAlreayExists'); + dol_syslog(__METHOD__ . ' $result='.$result.' ' . implode(',', $this->errors), LOG_ERR); } } else { $result = - 5; $error ++; $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 (! $notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action to call a trigger. - + // // Call triggers // $result=$this->call_trigger('MYOBJECT_CREATE',$user); // if ($result < 0) $error++; // // End call triggers } } - + // Commit or rollback if ($error) { $this->db->rollback(); - + return - 1 * $error; } else { $this->db->commit(); - + return $result; } } - + /** * Create object into database * * @param User $user User that creates * @param bool $notrigger false=launch triggers after, true=disable triggers - * + * * @return int <0 if KO, Id of created object if OK */ public function createStd(User $user, $notrigger = false) { dol_syslog(__METHOD__, LOG_DEBUG); - + $error = 0; - + // Clean parameters - + if (isset($this->doc_type)) { $this->doc_type = trim($this->doc_type); } @@ -370,13 +373,13 @@ class BookKeeping extends CommonObject if (isset($this->piece_num)) { $this->piece_num = trim($this->piece_num); } - + // Check parameters // Put here code to add control on parameters values - + // Insert request $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '('; - + $sql .= 'doc_date,'; $sql .= 'doc_type,'; $sql .= 'doc_ref,'; @@ -393,9 +396,9 @@ class BookKeeping extends CommonObject $sql .= 'import_key,'; $sql .= 'code_journal,'; $sql .= 'piece_num'; - + $sql .= ') VALUES ('; - + $sql .= ' ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) == 0 ? 'NULL' : "'" . $this->db->idate($this->doc_date) . "'") . ','; $sql .= ' ' . (! isset($this->doc_type) ? 'NULL' : "'" . $this->db->escape($this->doc_type) . "'") . ','; $sql .= ' ' . (! isset($this->doc_ref) ? 'NULL' : "'" . $this->db->escape($this->doc_ref) . "'") . ','; @@ -412,58 +415,58 @@ class BookKeeping extends CommonObject $sql .= ' ' . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . ','; $sql .= ' ' . (! isset($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ','; $sql .= ' ' . (! isset($this->piece_num) ? 'NULL' : $this->piece_num); - + $sql .= ')'; - + $this->db->begin(); - + $resql = $this->db->query($sql); if (! $resql) { $error ++; $this->errors[] = 'Error ' . $this->db->lasterror(); dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); } - + if (! $error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); - + if (! $notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action to call a trigger. - + // // Call triggers // $result=$this->call_trigger('MYOBJECT_CREATE',$user); // if ($result < 0) $error++; // // End call triggers } } - + // Commit or rollback if ($error) { $this->db->rollback(); - + return - 1 * $error; } else { $this->db->commit(); - + return $this->id; } } - + /** * Load object in memory from the database * * @param int $id Id object * @param string $ref Ref - * + * * @return int <0 if KO, 0 if not found, >0 if OK */ public function fetch($id, $ref = null) { dol_syslog(__METHOD__, LOG_DEBUG); - + $sql = 'SELECT'; $sql .= ' t.rowid,'; - + $sql .= " t.doc_date,"; $sql .= " t.doc_type,"; $sql .= " t.doc_ref,"; @@ -480,22 +483,22 @@ class BookKeeping extends CommonObject $sql .= " t.import_key,"; $sql .= " t.code_journal,"; $sql .= " t.piece_num"; - + $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; if (null !== $ref) { $sql .= ' WHERE t.ref = ' . '\'' . $ref . '\''; } else { $sql .= ' WHERE t.rowid = ' . $id; } - + $resql = $this->db->query($sql); if ($resql) { $numrows = $this->db->num_rows($resql); if ($numrows) { $obj = $this->db->fetch_object($resql); - + $this->id = $obj->rowid; - + $this->doc_date = $this->db->jdate($obj->doc_date); $this->doc_type = $obj->doc_type; $this->doc_ref = $obj->doc_ref; @@ -514,7 +517,7 @@ class BookKeeping extends CommonObject $this->piece_num = $obj->piece_num; } $this->db->free($resql); - + if ($numrows) { return 1; } else { @@ -523,11 +526,11 @@ class BookKeeping extends CommonObject } else { $this->errors[] = 'Error ' . $this->db->lasterror(); dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); - + return - 1; } } - + /** * Load object in memory from the database * @@ -537,15 +540,15 @@ class BookKeeping extends CommonObject * @param int $offset offset limit * @param array $filter filter array * @param string $filtermode filter mode (AND or OR) - * + * * @return int <0 if KO, >0 if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { dol_syslog(__METHOD__, LOG_DEBUG); - + $sql = 'SELECT'; $sql .= ' t.rowid,'; - + $sql .= " t.doc_date,"; $sql .= " t.doc_type,"; $sql .= " t.doc_ref,"; @@ -562,9 +565,9 @@ class BookKeeping extends CommonObject $sql .= " t.import_key,"; $sql .= " t.code_journal,"; $sql .= " t.piece_num"; - + $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; - + // Manage filter $sqlwhere = array (); if (count($filter) > 0) { @@ -584,11 +587,11 @@ class BookKeeping extends CommonObject } } } - + if (count($sqlwhere) > 0) { $sql .= ' WHERE ' . implode(' ' . $filtermode . ' ', $sqlwhere); } - + if (! empty($sortfield)) { $sql .= $this->db->order($sortfield, $sortorder); } @@ -596,16 +599,16 @@ class BookKeeping extends CommonObject $sql .= ' ' . $this->db->plimit($limit + 1, $offset); } $this->lines = array (); - + $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - + while ( $obj = $this->db->fetch_object($resql) ) { $line = new BookKeepingLine(); - + $line->id = $obj->rowid; - + $line->doc_date = $this->db->jdate($obj->doc_date); $line->doc_type = $obj->doc_type; $line->doc_ref = $obj->doc_ref; @@ -622,20 +625,20 @@ class BookKeeping extends CommonObject $line->import_key = $obj->import_key; $line->code_journal = $obj->code_journal; $line->piece_num = $obj->piece_num; - + $this->lines[] = $line; } $this->db->free($resql); - + return $num; } else { $this->errors[] = 'Error ' . $this->db->lasterror(); dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); - + return - 1; } } - + /** * Load object in memory from the database * @@ -650,15 +653,15 @@ class BookKeeping extends CommonObject */ public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { dol_syslog(__METHOD__, LOG_DEBUG); - + $sql = 'SELECT'; $sql .= " t.numero_compte,"; $sql .= " SUM(t.debit) as debit,"; $sql .= " SUM(t.credit) as credit"; - - + + $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; - + // Manage filter $sqlwhere = array (); if (count($filter) > 0) { @@ -678,13 +681,13 @@ class BookKeeping extends CommonObject } } } - + if (count($sqlwhere) > 0) { $sql .= ' WHERE ' . implode(' ' . $filtermode . ' ', $sqlwhere); } - + $sql .= ' GROUP BY t.numero_compte'; - + if (! empty($sortfield)) { $sql .= $this->db->order($sortfield, $sortorder); } @@ -692,45 +695,45 @@ class BookKeeping extends CommonObject $sql .= ' ' . $this->db->plimit($limit + 1, $offset); } $this->lines = array (); - + $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - + while ( $obj = $this->db->fetch_object($resql) ) { $line = new BookKeepingLine(); - + $line->numero_compte = $obj->numero_compte; $line->debit = $obj->debit; $line->credit = $obj->credit; $this->lines[] = $line; } $this->db->free($resql); - + return $num; } else { $this->errors[] = 'Error ' . $this->db->lasterror(); dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); - + return - 1; } } - + /** * Update object into database * * @param User $user User that modifies * @param bool $notrigger false=launch triggers after, true=disable triggers - * + * * @return int <0 if KO, >0 if OK */ public function update(User $user, $notrigger = false) { $error = 0; - + dol_syslog(__METHOD__, LOG_DEBUG); - + // Clean parameters - + if (isset($this->doc_type)) { $this->doc_type = trim($this->doc_type); } @@ -776,13 +779,13 @@ class BookKeeping extends CommonObject if (isset($this->piece_num)) { $this->piece_num = trim($this->piece_num); } - + // Check parameters // Put here code to add a control on parameters values - + // Update request $sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET'; - + $sql .= ' doc_date = ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) != 0 ? "'" . $this->db->idate($this->doc_date) . "'" : 'null') . ','; $sql .= ' doc_type = ' . (isset($this->doc_type) ? "'" . $this->db->escape($this->doc_type) . "'" : "null") . ','; $sql .= ' doc_ref = ' . (isset($this->doc_ref) ? "'" . $this->db->escape($this->doc_ref) . "'" : "null") . ','; @@ -799,71 +802,71 @@ class BookKeeping extends CommonObject $sql .= ' import_key = ' . (isset($this->import_key) ? "'" . $this->db->escape($this->import_key) . "'" : "null") . ','; $sql .= ' code_journal = ' . (isset($this->code_journal) ? "'" . $this->db->escape($this->code_journal) . "'" : "null") . ','; $sql .= ' piece_num = ' . (isset($this->piece_num) ? $this->piece_num : "null"); - + $sql .= ' WHERE rowid=' . $this->id; - + $this->db->begin(); - + $resql = $this->db->query($sql); if (! $resql) { $error ++; $this->errors[] = 'Error ' . $this->db->lasterror(); dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); } - + if (! $error && ! $notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. - + // // Call triggers // $result=$this->call_trigger('MYOBJECT_MODIFY',$user); // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} // // End call triggers } - + // Commit or rollback if ($error) { $this->db->rollback(); - + return - 1 * $error; } else { $this->db->commit(); - + return 1; } } - + /** * Delete object in database * * @param User $user User that deletes * @param bool $notrigger false=launch triggers after, true=disable triggers - * + * * @return int <0 if KO, >0 if OK */ public function delete(User $user, $notrigger = false) { dol_syslog(__METHOD__, LOG_DEBUG); - + $error = 0; - + $this->db->begin(); - + if (! $error) { if (! $notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. - + // // Call triggers // $result=$this->call_trigger('MYOBJECT_DELETE',$user); // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} // // End call triggers } } - + if (! $error) { $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element; $sql .= ' WHERE rowid=' . $this->id; - + $resql = $this->db->query($sql); if (! $resql) { $error ++; @@ -871,19 +874,19 @@ class BookKeeping extends CommonObject dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); } } - + // Commit or rollback if ($error) { $this->db->rollback(); - + return - 1 * $error; } else { $this->db->commit(); - + return 1; } } - + /** * Delete bookkepping by importkey * @@ -892,14 +895,14 @@ class BookKeeping extends CommonObject */ function deleteByImportkey($importkey) { $this->db->begin(); - + // first check if line not yet in bookkeeping $sql = "DELETE"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " WHERE import_key = '" . $importkey . "'"; - + $resql = $this->db->query($sql); - + if (! $resql) { $this->errors[] = "Error " . $this->db->lasterror(); foreach ( $this->errors as $errmsg ) { @@ -909,11 +912,11 @@ class BookKeeping extends CommonObject $this->db->rollback(); return - 1; } - + $this->db->commit(); return 1; } - + /** * Delete bookkepping by year * @@ -922,14 +925,14 @@ class BookKeeping extends CommonObject */ function deleteByYear($delyear) { $this->db->begin(); - + // first check if line not yet in bookkeeping $sql = "DELETE"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " WHERE YEAR(doc_date) = " . $delyear; - + $resql = $this->db->query($sql); - + if (! $resql) { $this->errors[] = "Error " . $this->db->lasterror(); foreach ( $this->errors as $errmsg ) { @@ -939,11 +942,54 @@ class BookKeeping extends CommonObject $this->db->rollback(); return - 1; } - + $this->db->commit(); 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 * @@ -952,14 +998,14 @@ class BookKeeping extends CommonObject */ function deleteMvtNum($piecenum) { $this->db->begin(); - + // first check if line not yet in bookkeeping $sql = "DELETE"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " WHERE piece_num = " . $piecenum; - + $resql = $this->db->query($sql); - + if (! $resql) { $this->errors[] = "Error " . $this->db->lasterror(); foreach ( $this->errors as $errmsg ) { @@ -969,57 +1015,57 @@ class BookKeeping extends CommonObject $this->db->rollback(); return - 1; } - + $this->db->commit(); return 1; } - + /** * Load an object from its id and create a new one in database * * @param int $fromid Id of object to clone - * + * * @return int New id of clone */ public function createFromClone($fromid) { dol_syslog(__METHOD__, LOG_DEBUG); - + global $user; $error = 0; $object = new Accountingbookkeeping($this->db); - + $this->db->begin(); - + // Load source object $object->fetch($fromid); // Reset object $object->id = 0; - + // Clear fields // ... - + // Create clone $result = $object->create($user); - + // Other options if ($result < 0) { $error ++; $this->errors = $object->errors; dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); } - + // End if (! $error) { $this->db->commit(); - + return $object->id; } else { $this->db->rollback(); - + return - 1; } } - + /** * Initialise object with example values * Id must be 0 if object instance is a specimen @@ -1028,7 +1074,7 @@ class BookKeeping extends CommonObject */ public function initAsSpecimen() { $this->id = 0; - + $this->doc_date = ''; $this->doc_type = ''; $this->doc_ref = ''; @@ -1046,7 +1092,7 @@ class BookKeeping extends CommonObject $this->code_journal = ''; $this->piece_num = ''; } - + /** * Load an accounting document into memory from database * @@ -1057,12 +1103,12 @@ class BookKeeping extends CommonObject $sql = "SELECT piece_num,doc_date,code_journal,doc_ref,doc_type"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " WHERE piece_num = " . $piecenum; - + dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); - + $this->piece_num = $obj->piece_num; $this->code_journal = $obj->code_journal; $this->doc_date = $this->db->jdate($obj->doc_date); @@ -1073,10 +1119,10 @@ class BookKeeping extends CommonObject dol_syslog(get_class($this) . "::" . __METHOD__ . $this->error, LOG_ERR); return - 1; } - + return 1; } - + /** * Return next number movement * @@ -1084,13 +1130,13 @@ class BookKeeping extends CommonObject */ public function getNextNumMvt() { $sql = "SELECT MAX(piece_num)+1 as max FROM " . MAIN_DB_PREFIX . $this->table_element; - + dol_syslog(get_class($this) . "getNextNumMvt sql=" . $sql, LOG_DEBUG); $result = $this->db->query($sql); - + if ($result) { $obj = $this->db->fetch_object($result); - + return $obj->max; } else { $this->error = "Error " . $this->db->lasterror(); @@ -1098,7 +1144,7 @@ class BookKeeping extends CommonObject return - 1; } } - + /** * Load all informations of accountancy document * @@ -1112,17 +1158,17 @@ class BookKeeping extends CommonObject $sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " WHERE piece_num = " . $piecenum; - + dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { - + while ( $obj = $this->db->fetch_object($result) ) { - + $line = new BookKeepingLine(); - + $line->id = $obj->rowid; - + $line->doc_date = $this->db->jdate($obj->doc_date); $line->doc_type = $obj->doc_type; $line->doc_ref = $obj->doc_ref; @@ -1137,7 +1183,7 @@ class BookKeeping extends CommonObject $line->sens = $obj->sens; $line->code_journal = $obj->code_journal; $line->piece_num = $obj->piece_num; - + $this->linesmvt[] = $line; } } else { @@ -1145,10 +1191,10 @@ class BookKeeping extends CommonObject dol_syslog(get_class($this) . "::" . __METHOD__ . $this->error, LOG_ERR); return - 1; } - + return 1; } - + /** * Export bookkeping * @@ -1161,20 +1207,20 @@ class BookKeeping extends CommonObject $sql .= " numero_compte, label_compte, debit, credit,"; $sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; - + dol_syslog(get_class($this) . "::export_bookkeping", LOG_DEBUG); - + $resql = $this->db->query($sql); - + if ($resql) { $this->linesexport = array (); - + $num = $this->db->num_rows($resql); while ( $obj = $this->db->fetch_object($resql) ) { $line = new BookKeepingLine(); - + $line->id = $obj->rowid; - + $line->doc_date = $this->db->jdate($obj->doc_date); $line->doc_type = $obj->doc_type; $line->doc_ref = $obj->doc_ref; @@ -1189,11 +1235,11 @@ class BookKeeping extends CommonObject $line->sens = $obj->sens; $line->code_journal = $obj->code_journal; $line->piece_num = $obj->piece_num; - + $this->linesexport[] = $line; } $this->db->free($resql); - + return $num; } else { $this->error = "Error " . $this->db->lasterror(); @@ -1201,15 +1247,15 @@ class BookKeeping extends CommonObject return - 1; } } - + /** * Description of accounting account * * @param string $account Accounting account - * @return string + * @return string */ function get_compte_desc($account = null) - { + { global $conf; $pcgver = $conf->global->CHARTOFACCOUNTS; @@ -1226,14 +1272,14 @@ class BookKeeping extends CommonObject if ($resql) { $obj = ''; if ($this->db->num_rows($resql)) { - $obj = $this->db->fetch_object($resql); + $obj = $this->db->fetch_object($resql); } - - if(empty($obj->category)){ + + if(empty($obj->category)){ return $obj->label; }else{ return $obj->label.' ('.$obj->category.')'; - + } } else { $this->error = "Error " . $this->db->lasterror(); @@ -1242,7 +1288,7 @@ class BookKeeping extends CommonObject return -1; } } - + } /** diff --git a/htdocs/accountancy/class/html.formventilation.class.php b/htdocs/accountancy/class/html.formventilation.class.php index e3ae592a47f..9294cf7f6a8 100644 --- a/htdocs/accountancy/class/html.formventilation.class.php +++ b/htdocs/accountancy/class/html.formventilation.class.php @@ -58,7 +58,7 @@ class FormVentilation extends Form return Form::selectarray($htmlname, $options, $selectedkey); } - + /** * Return list of accounts with label by chart of accounts * @@ -69,23 +69,23 @@ class FormVentilation extends Form * @param int $select_in $selectid value is a aa.rowid (0 default) or aa.account_number (1) * @param int $select_out set value returned by select 0=rowid (default), 1=account_number * @param int $aabase set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number - * + * * @return string String with HTML select */ function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') { global $conf; - + require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50; - + $sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version"; $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"; $sql .= " ORDER BY aa.account_number"; - + dol_syslog(get_class($this) . "::select_account", LOG_DEBUG); $resql = $this->db->query($sql); @@ -127,7 +127,7 @@ class FormVentilation extends Form $this->db->free($resql); return $out; } - + /** * Return list of accounts with label by class of accounts * @@ -135,18 +135,18 @@ class FormVentilation extends Form * @param string $htmlname Name of field in html form * @param int $showempty Add an empty field * @param array $event Event options - * + * * @return string String with HTML select */ function select_pcgtype($selectid, $htmlname = 'pcg_type', $showempty = 0, $event = array()) { global $conf; - + $sql = "SELECT DISTINCT pcg_type "; $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 .= " ORDER BY pcg_type"; - + dol_syslog(get_class($this) . "::select_pcgtype", LOG_DEBUG); $resql = $this->db->query($sql); @@ -168,7 +168,7 @@ class FormVentilation extends Form $this->db->free($resql); return $out; } - + /** * Return list of accounts with label by sub_class of accounts * @@ -176,18 +176,18 @@ class FormVentilation extends Form * @param string $htmlname Name of field in html form * @param int $showempty Add an empty field * @param array $event Event options - * + * * @return string String with HTML select */ function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array()) { global $conf; - + $sql = "SELECT DISTINCT pcg_subtype "; $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 .= " ORDER BY pcg_subtype"; - + dol_syslog(get_class($this) . "::select_pcgsubtype", LOG_DEBUG); $resql = $this->db->query($sql); @@ -209,7 +209,7 @@ class FormVentilation extends Form $this->db->free($resql); return $out; } - + /** * Return list of auxilary thirdparty accounts * @@ -217,7 +217,7 @@ class FormVentilation extends Form * @param string $htmlname Name of field in html form * @param int $showempty Add an empty field * @param array $event Event options - * + * * @return string String with HTML select */ function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $event = array()) { @@ -246,7 +246,7 @@ class FormVentilation extends Form // Auxiliary supplier account $sql = "SELECT DISTINCT code_compta_fournisseur, nom "; $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); $resql = $this->db->query($sql); if ($resql) { @@ -268,7 +268,7 @@ class FormVentilation extends Form return $out; } - + /** * Return HTML combo list of years existing into book keepping * @@ -284,7 +284,7 @@ class FormVentilation extends Form $sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear"; $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); $resql = $this->db->query($sql); @@ -304,4 +304,40 @@ class FormVentilation extends Form 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; + } + } } diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 5ca1197b3e2..47bc9576a91 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -138,7 +138,7 @@ if ($result) { //Define array for display vat 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]["refsologest"] = $obj->ref; $tabfac[$obj->rowid]["refsuppliersologest"] = $obj->ref_supplier; @@ -166,14 +166,13 @@ if ($action == 'writebookkeeping') { $now = dol_now(); $error = 0; - foreach ( $tabfac as $key => $val ) { - + foreach ($tabfac as $key => $val) + { $companystatic = new Societe($db); $invoicestatic = new FactureFournisseur($db); $invoicestatic->id = $key; - $invoicestatic->ref = $val["ref"]; - $invoicestatic->ref = $val["refsologest"]; + $invoicestatic->ref = (string) $val["refsologest"]; $invoicestatic->refsupplier = $val["refsuppliersologest"]; $invoicestatic->type = $val["type"]; $invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32)); @@ -193,7 +192,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_facturefourndet"]; $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->montant = $mt; $bookkeeping->sens = ($mt >= 0) ? 'C' : 'D'; @@ -225,7 +224,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_facturefourndet"]; $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->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; @@ -256,7 +255,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_facturefourndet"]; $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->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; @@ -297,7 +296,7 @@ if ($action == 'export_csv') { $sep = ";"; 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 foreach ( $tabht[$key] as $k => $mt ) { @@ -340,7 +339,7 @@ if ($action == 'export_csv') { print length_accounta(html_entity_decode($k)) . $sep; print ($mt < 0 ? 'D' : 'C') . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep; - print utf8_decode($companystatic->name) . $sep; + print $companystatic->name . $sep; print $val["ref"]; print "\n"; } @@ -356,7 +355,7 @@ if ($action == 'export_csv') { $invoicestatic->type = $val["type"]; $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->name = $tabcompany[$key]['name']; @@ -370,7 +369,7 @@ if ($action == 'export_csv') { print '"' . $date . '"' . $sep; print '"' . $val["ref"] . '"' . $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 '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; @@ -384,7 +383,7 @@ if ($action == 'export_csv') { print '"' . $val["ref"] . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $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) : '') . '"'; print "\n"; @@ -396,8 +395,7 @@ if ($action == 'export_csv') { print '"' . $date . '"' . $sep; print '"' . $val["ref"] . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; - // print '"' . utf8_decode($companystatic->name) . '"' . $sep; - print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep; + print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"'; } @@ -479,7 +477,7 @@ if ($action == 'export_csv') { $invoicestatic->type = $val["type"]; $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 foreach ( $tabht[$key] as $k => $mt ) { diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 5da210ca09a..7a92d6649d3 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -161,7 +161,7 @@ if ($result) { } // 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]["type"] = $obj->type; $tabfac[$obj->rowid]["description"] = $obj->label_compte; @@ -207,7 +207,7 @@ if ($action == 'writebookkeeping') { $companystatic->client = $tabcompany[$key]['code_client']; $invoicestatic->id = $key; - $invoicestatic->ref = $val["ref"]; + $invoicestatic->ref = (string) $val["ref"]; foreach ( $tabttc[$key] as $k => $mt ) { $bookkeeping = new BookKeeping($db); @@ -220,7 +220,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->code_tiers = $tabcompany[$key]['code_client']; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; // $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->sens = ($mt >= 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt >= 0) ? $mt : 0; @@ -250,7 +250,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = $val["fk_facturedet"]; $bookkeeping->code_tiers = ''; $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->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt < 0) ? $mt : 0; @@ -280,7 +280,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = $val["fk_facturedet"]; $bookkeeping->code_tiers = ''; $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->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt < 0) ? $mt : 0; @@ -324,7 +324,7 @@ if ($action == 'export_csv') { $invoicestatic->id = $key; $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 ) { print $date . $sep; @@ -333,8 +333,7 @@ if ($action == 'export_csv') { print length_accounta(html_entity_decode($k)) . $sep; print ($mt < 0 ? 'C' : 'D') . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep; - print utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . $sep; - // print utf8_decode($companystatic->name) . $sep; + print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . $sep; print $val["ref"]; print "\n"; } @@ -349,8 +348,7 @@ if ($action == 'export_csv') { print $sep; print ($mt < 0 ? 'D' : 'C') . $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($accountingaccount_static->label, 32) . $sep; + print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount_static->label . $sep; print $val["ref"]; print "\n"; } @@ -365,7 +363,7 @@ if ($action == 'export_csv') { print $sep; print ($mt < 0 ? 'D' : 'C') . $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 $val["ref"]; print "\n"; @@ -382,14 +380,13 @@ if ($action == 'export_csv') { $invoicestatic->id = $key; $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 ) { print '"' . $date . '"' . $sep; print '"' . $val["ref"] . '"' . $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 '"' . utf8_decode($companystatic->name) . '"' . $sep; + print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; print "\n"; @@ -404,8 +401,7 @@ if ($action == 'export_csv') { print '"' . $date . '"' . $sep; print '"' . $val["ref"] . '"' . $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($accountingaccount->label, 32) . '"' . $sep; + print '"' . dol_trunc($companystatic->name, 16) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"'; print "\n"; @@ -418,8 +414,7 @@ if ($action == 'export_csv') { print '"' . $date . '"' . $sep; print '"' . $val["ref"] . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; - print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . '"' . $sep; - // print '"' . $langs->trans("VAT") . '"' . $sep; + print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"'; print "\n"; @@ -497,7 +492,7 @@ if ($action == 'export_csv') { $invoicestatic->ref = $val["ref"]; $invoicestatic->type = $val["type"]; - $date = dol_print_date($db->jdate($val["date"]), 'day'); + $date = dol_print_date($val["date"], 'day'); // Third party foreach ( $tabttc[$key] as $k => $mt ) { @@ -527,7 +522,7 @@ if ($action == 'export_csv') { print ""; print ""; // print ""; - print ""; + print ""; print ""; print ""; print ""; diff --git a/htdocs/accountancy/report/result.php b/htdocs/accountancy/report/result.php index 72a4d6e96b2..c9c1a13fd14 100644 --- a/htdocs/accountancy/report/result.php +++ b/htdocs/accountancy/report/result.php @@ -53,7 +53,7 @@ if ($year == 0) { } if($cat_id == 0){ - $cat_id = null; + $cat_id = null; } // Security check @@ -76,31 +76,31 @@ $textprevyear = '' . img_next() . ''; print load_fiche_titre($langs->trans('ReportInOut') . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear); - + print '
'; print $formventilation->select_account($line->numero_compte, 'account_number', 0, array (), 1, 1, ''); print '' . price($line->credit) . '' . price($line->montant) . '' . $line->sens . ''; print ''; print img_edit(); @@ -384,23 +384,21 @@ if ($action == 'create') { print ''; print img_delete(); print ''; - + print '
'; print $formventilation->select_account($account_number, 'account_number', 0, array (), 1, 1, ''); print '" . $invoicestatic->getNomUrl(1) . "" . length_accountg($k) . "" . $accountingaccount->label . "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . utf8_decode(utf8_decode($accountingaccount->label)) . "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . "" . ($mt < 0 ? price(- $mt) : '') . "" . ($mt >= 0 ? price($mt) : '') . "
'; - -$months = array( $langs->trans("JanuaryMin"), - $langs->trans("FebruaryMin"), - $langs->trans("MarchMin"), - $langs->trans("AprilMin"), - $langs->trans("MayMin"), - $langs->trans("JuneMin"), - $langs->trans("JulyMin"), - $langs->trans("AugustMin"), - $langs->trans("SeptemberMin"), - $langs->trans("OctoberMin"), - $langs->trans("NovemberMin"), + +$months = array( $langs->trans("JanuaryMin"), + $langs->trans("FebruaryMin"), + $langs->trans("MarchMin"), + $langs->trans("AprilMin"), + $langs->trans("MayMin"), + $langs->trans("JuneMin"), + $langs->trans("JulyMin"), + $langs->trans("AugustMin"), + $langs->trans("SeptemberMin"), + $langs->trans("OctoberMin"), + $langs->trans("NovemberMin"), $langs->trans("DecemberMin"), ); print ''; print ''; -print ''; +print ''; print ''; foreach($months as $k => $v){ print ''; } -print ''; +print ''; $cats = $AccCat->getCatsCpts(); $catsCalcule = $AccCat->getCatsCal(); @@ -123,22 +123,41 @@ if(!empty($cats)) $position = $cpt['position']; $code = $cpt['code']; - $resultNP = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']); - $resultN = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']); + $return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $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]['N'] += $resultN; + $sommes[$code]['N'] += $resultN; print ''; print ''; print ''; print ''; print ''; - + 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; print ''; } - + print "\n"; } @@ -168,9 +187,9 @@ if(!empty($cats)) } $result = strtr($formula, $vars); eval( '$result = (' . $result . ');' ); - print ''; + print ''; $sommes[$code]['N'] += $result; - + // Detail by month foreach($months as $k => $v){ foreach($sommes as $code => $det){ @@ -181,14 +200,14 @@ if(!empty($cats)) print ''; $sommes[$code]['M'][$k] += $result; } - + //print ''; print "\n"; unset($catsCalcule[$p]); // j'élimine la catégorie calculée après affichage } $j++; } - + // Others calculed category foreach($catsCalcule as $p => $catc) { @@ -215,7 +234,7 @@ if(!empty($cats)) } $result = strtr($formula, $vars); eval( '$result = (' . $result . ');' ); - print ''; + print ''; $sommes[$code]['N'] += $result; // Detail by month diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 49048cfaf1f..ac09e1864b6 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -404,11 +404,7 @@ if (empty($reshook)) } else { - if ($object->error) { - setEventMessages($object->error, $object->errors, 'errors'); - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } + setEventMessages($object->error, $object->errors, 'errors'); $action=''; } } @@ -1443,6 +1439,12 @@ else if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { print ''; } - + print '
'.$langs->trans("Account").''.$langs->trans("Description").'N-1N-1'.$langs->trans("NReal").''.$langs->trans($v).'
' . $cpt['account_number'] . '' . $cpt['name_cpt'] . '' . price($resultNP) . '' . price($resultN) . '' . price($resultM) . '
' . price($result) . '' . price($result) . '' . price($result) . '' . $catsCalcule[$p]['formula'] . '
' . price($result) . '' . price($result) . '
'.$langs->trans("Password").''.preg_replace('/./i','*',$object->pass); + if ($object->pass) print preg_replace('/./i','*',$object->pass); + else + { + if ($user->admin) print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted; + else print $langs->trans("Hidden"); + } if ((! empty($object->pass) || ! empty($object->pass_crypted)) && empty($object->user_id)) { $langs->load("errors"); @@ -1451,7 +1453,7 @@ else } print '
'; print ''; @@ -1483,6 +1485,30 @@ else print $object->showOptionals($extrafields, 'view', $parameters); } + // Date end subscription + print ''.$langs->trans("SubscriptionEndDate").''; + if ($object->datefin) + { + print dol_print_date($object->datefin,'day'); + if ($object->hasDelay()) { + print " ".img_warning($langs->trans("Late")); + } + } + else + { + if (! $adht->cotisation) + { + print $langs->trans("SubscriptionNotRecorded"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated + } + else + { + print $langs->trans("SubscriptionNotReceived"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated + } + } + print ''; + // Third party Dolibarr if (! empty($conf->societe->enabled)) { @@ -1553,30 +1579,6 @@ else } print ''; - // Date end subscription - print ''.$langs->trans("SubscriptionEndDate").''; - if ($object->datefin) - { - print dol_print_date($object->datefin,'day'); - if ($object->hasDelay()) { - print " ".img_warning($langs->trans("Late")); - } - } - else - { - if (! $adht->cotisation) - { - print $langs->trans("SubscriptionNotRecorded"); - if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated - } - else - { - print $langs->trans("SubscriptionNotReceived"); - if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated - } - } - print ''; - print "\n"; print "\n"; diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 784f6d4dea7..1299f2400dc 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -53,6 +53,10 @@ $result=restrictedArea($user,'adherent',$rowid,'','cotisation'); $object = new Adherent($db); $extrafields = new ExtraFields($db); $adht = new AdherentType($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + $errmsg=''; $errmsgs=array(); @@ -379,6 +383,13 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ $invoice->socid=$object->fk_soc; $invoice->date=$datecotisation; + // Possibility to add external linked objects with hooks + $invoice->linked_objects['subscription'] = $crowid; + if (! empty($_POST['other_linked_objects']) && is_array($_POST['other_linked_objects'])) + { + $invoice->linked_objects = array_merge($invoice->linked_objects, $_POST['other_linked_objects']); + } + $result=$invoice->create($user); if ($result <= 0) { @@ -641,6 +652,30 @@ if ($rowid > 0) print $object->showOptionals($extrafields, 'view', $parameters); } + // Date end subscription + print ''.$langs->trans("SubscriptionEndDate").''; + if ($object->datefin) + { + print dol_print_date($object->datefin,'day'); + if ($object->hasDelay()) { + print " ".img_warning($langs->trans("Late")); + } + } + else + { + if (! $adht->cotisation) + { + print $langs->trans("SubscriptionNotRecorded"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + } + else + { + print $langs->trans("SubscriptionNotReceived"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + } + } + print ''; + // Third party Dolibarr if (! empty($conf->societe->enabled)) { @@ -711,30 +746,6 @@ if ($rowid > 0) } print ''; - // Date end subscription - print ''.$langs->trans("SubscriptionEndDate").''; - if ($object->datefin) - { - print dol_print_date($object->datefin,'day'); - if ($object->hasDelay()) { - print " ".img_warning($langs->trans("Late")); - } - } - else - { - if (! $adht->cotisation) - { - print $langs->trans("SubscriptionNotRecorded"); - if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie - } - else - { - print $langs->trans("SubscriptionNotReceived"); - if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie - } - } - print ''; - print "\n"; print "\n"; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 87ceb66f9d1..e12c49732dd 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -47,8 +47,15 @@ class Adherent extends CommonObject var $mesgs; var $login; - var $pass; - var $societe; + + //! Clear password in memory + var $pass; + //! Clear password in database (defined if DATABASE_PWD_ENCRYPTED=0) + var $pass_indatabase; + //! Encrypted password in database (always defined) + var $pass_indatabase_crypted; + + var $societe; var $company; var $address; var $zip; @@ -309,7 +316,7 @@ class Adherent extends CommonObject if ($id > 0) { $this->id=$id; - $this->ref=$id; + $this->ref=(string) $id; // Update minor fields $result=$this->update($user,1,1,0,0,'add'); // nosync is 1 to avoid update data of user @@ -482,8 +489,10 @@ class Adherent extends CommonObject dol_syslog(get_class($this)."::update update password"); if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted) { - // Si mot de passe saisi et different de celui en base - $result=$this->setPassword($user,$this->pass,0,$notrigger,$nosyncuserpass); + $isencrypted = empty($conf->global->DATABASE_PWD_ENCRYPTED)?0:1; + + // If password to set differs from the one found into database + $result=$this->setPassword($user,$this->pass,$isencrypted,$notrigger,$nosyncuserpass); if (! $nbrowsaffected) $nbrowsaffected++; } } @@ -509,7 +518,7 @@ class Adherent extends CommonObject if (! $error && $nbrowsaffected) // If something has change in main data { // Update information on linked user if it is an update - if ($this->user_id > 0 && ! $nosyncuser) + if (! $error && $this->user_id > 0 && ! $nosyncuser) { require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; @@ -552,7 +561,7 @@ class Adherent extends CommonObject } // Update information on linked thirdparty if it is an update - if ($this->fk_soc > 0 && ! $nosyncthirdparty) + if (! $error && $this->fk_soc > 0 && ! $nosyncthirdparty) { require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; @@ -810,13 +819,11 @@ class Adherent extends CommonObject $password=getRandomPassword(false); } - // Cryptage mot de passe - if ($isencrypted) - { - // Encryption - $password_indatabase = dol_hash($password); - } - else + // Crypt password + $password_crypted = dol_hash($password); + + $password_indatabase = ''; + if (! $isencrypted) { $password_indatabase = $password; } @@ -824,7 +831,17 @@ class Adherent extends CommonObject $this->db->begin(); // Mise a jour - $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET pass = '".$this->db->escape($password_indatabase)."'"; + $sql = "UPDATE ".MAIN_DB_PREFIX."adherent"; + $sql.= " SET pass_crypted = '".$this->db->escape($password_crypted)."'"; + //if (! empty($conf->global->DATABASE_PWD_ENCRYPTED)) + if ($isencrypted) + { + $sql.= ", pass = null"; + } + else + { + $sql.= ", pass = '".$this->db->escape($password_indatabase)."'"; + } $sql.= " WHERE rowid = ".$this->id; //dol_syslog("Adherent::Password sql=hidden"); @@ -838,7 +855,8 @@ class Adherent extends CommonObject { $this->pass=$password; $this->pass_indatabase=$password_indatabase; - + $this->pass_indatabase_crypted=$password_crypted; + if ($this->user_id && ! $nosyncuser) { require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; @@ -1042,7 +1060,7 @@ class Adherent extends CommonObject $sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,"; $sql.= " d.note_public,"; - $sql.= " d.email, d.skype, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,"; + $sql.= " d.email, d.skype, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,"; $sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,"; $sql.= " d.datec as datec,"; $sql.= " d.tms as datem,"; @@ -1087,7 +1105,6 @@ class Adherent extends CommonObject $this->firstname = $obj->firstname; $this->lastname = $obj->lastname; $this->login = $obj->login; - $this->pass = $obj->pass; $this->societe = $obj->company; $this->company = $obj->company; $this->fk_soc = $obj->fk_soc; @@ -1095,6 +1112,10 @@ class Adherent extends CommonObject $this->zip = $obj->zip; $this->town = $obj->town; + $this->pass = $obj->pass; + $this->pass_indatabase = $obj->pass; + $this->pass_indatabase_crypted = $obj->pass_crypted; + $this->state_id = $obj->state_id; $this->state_code = $obj->state_id?$obj->state_code:''; $this->state = $obj->state_id?$obj->state:''; @@ -1423,9 +1444,10 @@ class Adherent extends CommonObject $err=0; // mailman - if (! empty($conf->global->ADHERENT_USE_MAILMAN)) + if (! empty($conf->global->ADHERENT_USE_MAILMAN) && ! empty($conf->mailmanspip->enabled)) { $result=$mailmanspip->add_to_mailman($this); + if ($result < 0) { if (! empty($mailmanspip->error)) $this->errors[]=$mailmanspip->error; @@ -1444,7 +1466,7 @@ class Adherent extends CommonObject } // spip - if ($conf->global->ADHERENT_USE_SPIP && ! empty($conf->mailmanspip->enabled)) + if (! empty($conf->global->ADHERENT_USE_SPIP) && ! empty($conf->mailmanspip->enabled)) { $result=$mailmanspip->add_to_spip($this); if ($result < 0) @@ -1458,7 +1480,7 @@ class Adherent extends CommonObject return -$err; } else - { + { return 1; } } @@ -1556,6 +1578,7 @@ class Adherent extends CommonObject $label.= '
' . $langs->trans('Name') . ': ' . $this->getFullName($langs); $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; + $link=''; $linkend=''; if ($option == 'card') { $link = 'load("users"); $adh = new Adherent($db); -$subscription = new Cotisation($db); +$object = new Cotisation($db); $errmsg=''; -$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; -$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"]; -$typeid=isset($_GET["typeid"])?$_GET["typeid"]:$_POST["typeid"]; +$action=GETPOST("action",'alpha'); +$rowid=GETPOST("rowid","int")?GETPOST("rowid","int"):GETPOST("id","int"); +$typeid=GETPOST("typeid","int"); +$cancel=GETPOST('cancel'); if (! $user->rights->adherent->cotisation->lire) accessforbidden(); +$permissionnote = $user->rights->adherent->cotisation->creer; // Used by the include of actions_setnotes.inc.php +$permissiondellink=$user->rights->adherent->cotisation->creer; // Used by the include of actions_dellink.inc.php +$permissiontoedit = $user->rights->adherent->cotisation->creer; // Used by the include of actions_lineupdonw.inc.php + /* * Actions */ +if ($cancel) $action=''; + +//include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once + +include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once + +//include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once + + if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'update' && ! $_POST["cancel"]) { // Charge objet actuel - $result=$subscription->fetch($_POST["rowid"]); + $result=$object->fetch($_POST["rowid"]); if ($result > 0) { $db->begin(); $errmsg=''; - if ($subscription->fk_bank) + if ($object->fk_bank) { $accountline=new AccountLine($db); - $result=$accountline->fetch($subscription->fk_bank); + $result=$accountline->fetch($object->fk_bank); // If transaction consolidated if ($accountline->rappro) @@ -84,31 +98,31 @@ if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'update if (! $errmsg) { // Modifie valeures - $subscription->dateh=dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']); - $subscription->datef=dol_mktime($_POST['datesubendhour'], $_POST['datesubendmin'], 0, $_POST['datesubendmonth'], $_POST['datesubendday'], $_POST['datesubendyear']); - $subscription->note=$_POST["note"]; - $subscription->amount=$_POST["amount"]; - //print 'datef='.$subscription->datef.' '.$_POST['datesubendday']; + $object->dateh=dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']); + $object->datef=dol_mktime($_POST['datesubendhour'], $_POST['datesubendmin'], 0, $_POST['datesubendmonth'], $_POST['datesubendday'], $_POST['datesubendyear']); + $object->note=$_POST["note"]; + $object->amount=$_POST["amount"]; + //print 'datef='.$object->datef.' '.$_POST['datesubendday']; - $result=$subscription->update($user); - if ($result >= 0 && ! count($subscription->errors)) + $result=$object->update($user); + if ($result >= 0 && ! count($object->errors)) { $db->commit(); - header("Location: fiche_subscription.php?rowid=".$subscription->id); + header("Location: fiche_subscription.php?rowid=".$object->id); exit; } else { $db->rollback(); - if ($subscription->error) + if ($object->error) { - $errmsg=$subscription->error; + $errmsg=$object->error; } else { - foreach($subscription->errors as $error) + foreach($object->errors as $error) { if ($errmsg) $errmsg.='
'; $errmsg.=$error; @@ -126,11 +140,11 @@ if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'update if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->adherent->cotisation->creer) { - $result=$subscription->fetch($rowid); - $result=$subscription->delete($user); + $result=$object->fetch($rowid); + $result=$object->delete($user); if ($result > 0) { - header("Location: card_subscriptions.php?rowid=".$subscription->fk_adherent); + header("Location: card_subscriptions.php?rowid=".$object->fk_adherent); exit; } else @@ -145,11 +159,12 @@ if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && * View */ -llxHeader('',$langs->trans("SubscriptionCard"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); - $form = new Form($db); +llxHeader('',$langs->trans("SubscriptionCard"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); + + dol_htmloutput_errors($errmsg); @@ -161,8 +176,8 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') * ********************************************/ - $subscription->fetch($rowid); - $result=$adh->fetch($subscription->fk_adherent); + $object->fetch($rowid); + $result=$adh->fetch($object->fk_adherent); /* * Affichage onglets @@ -170,12 +185,12 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$subscription->id; + $head[$h][0] = DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$object->id; $head[$h][1] = $langs->trans("SubscriptionCard"); $head[$h][2] = 'general'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/adherents/info_subscription.php?rowid='.$subscription->id; + $head[$h][0] = DOL_URL_ROOT.'/adherents/info_subscription.php?rowid='.$object->id; $head[$h][1] = $langs->trans("Info"); $head[$h][2] = 'info'; $h++; @@ -184,7 +199,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') print ''; print ""; print ""; - print "fk_bank."\">"; + print "fk_bank."\">"; dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment'); @@ -196,7 +211,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') // Ref print ''.$langs->trans("Ref").''; print ''; - print $form->showrefnav($subscription, 'rowid', $linkback, 1); + print $form->showrefnav($object, 'rowid', $linkback, 1); print ''; // Member @@ -207,34 +222,34 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') // Date start subscription print ''.$langs->trans("DateSubscription").''; - $form->select_date($subscription->dateh,'datesub',1,1,0,'update',1); + $form->select_date($object->dateh,'datesub',1,1,0,'update',1); print ''; print ''; // Date end subscription print ''.$langs->trans("DateEndSubscription").''; - $form->select_date($subscription->datef,'datesubend',0,0,0,'update',1); + $form->select_date($object->datef,'datesubend',0,0,0,'update',1); print ''; print ''; // Amount print ''.$langs->trans("Amount").''; - print ''; + print ''; // Label print ''.$langs->trans("Label").''; - print ''; + print ''; // Bank line if (! empty($conf->banque->enabled)) { - if ($conf->global->ADHERENT_BANK_USE || $subscription->fk_bank) + if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank) { print ''.$langs->trans("BankTransactionLine").''; - if ($subscription->fk_bank) + if ($object->fk_bank) { $bankline=new AccountLine($db); - $result=$bankline->fetch($subscription->fk_bank); + $result=$bankline->fetch($object->fk_bank); print $bankline->getNomUrl(1,0,'showall'); } else @@ -267,8 +282,8 @@ if ($rowid && $action != 'edit') /* */ /* ************************************************************************** */ - $result=$subscription->fetch($rowid); - $result=$adh->fetch($subscription->fk_adherent); + $result=$object->fetch($rowid); + $result=$adh->fetch($object->fk_adherent); /* * Affichage onglets @@ -276,12 +291,12 @@ if ($rowid && $action != 'edit') $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$subscription->id; + $head[$h][0] = DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$object->id; $head[$h][1] = $langs->trans("SubscriptionCard"); $head[$h][2] = 'general'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/adherents/info_subscription.php?rowid='.$subscription->id; + $head[$h][0] = DOL_URL_ROOT.'/adherents/info_subscription.php?rowid='.$object->id; $head[$h][1] = $langs->trans("Info"); $head[$h][2] = 'info'; $h++; @@ -295,7 +310,7 @@ if ($rowid && $action != 'edit') //$formquestion['text']=''.$langs->trans("ThisWillAlsoDeleteBankRecord").''; $text=$langs->trans("ConfirmDeleteSubscription"); if (! empty($conf->banque->enabled) && ! empty($conf->global->ADHERENT_BANK_USE)) $text.='
'.img_warning().' '.$langs->trans("ThisWillAlsoDeleteBankRecord"); - print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$subscription->id,$langs->trans("DeleteSubscription"),$text,"confirm_delete",$formquestion,0,1); + print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("DeleteSubscription"),$text,"confirm_delete",$formquestion,0,1); } print ''; @@ -307,7 +322,7 @@ if ($rowid && $action != 'edit') // Ref print ''.$langs->trans("Ref").''; print ''; - print $form->showrefnav($subscription, 'rowid', $linkback, 1); + print $form->showrefnav($object, 'rowid', $linkback, 1); print ''; // Member @@ -318,35 +333,35 @@ if ($rowid && $action != 'edit') // Date record /*print ''; - print ''.$langs->trans("DateSubscription").''.dol_print_date($subscription->datec,'dayhour').''; + print ''.$langs->trans("DateSubscription").''.dol_print_date($object->datec,'dayhour').''; print '';*/ // Date subscription print ''; - print ''.$langs->trans("DateSubscription").''.dol_print_date($subscription->dateh,'day').''; + print ''.$langs->trans("DateSubscription").''.dol_print_date($object->dateh,'day').''; print ''; // Date end subscription print ''; - print ''.$langs->trans("DateEndSubscription").''.dol_print_date($subscription->datef,'day').''; + print ''.$langs->trans("DateEndSubscription").''.dol_print_date($object->datef,'day').''; print ''; // Amount - print ''.$langs->trans("Amount").''.price($subscription->amount).''; + print ''.$langs->trans("Amount").''.price($object->amount).''; // Amount - print ''.$langs->trans("Label").''.$subscription->note.''; + print ''.$langs->trans("Label").''.$object->note.''; // Bank line if (! empty($conf->banque->enabled)) { - if ($conf->global->ADHERENT_BANK_USE || $subscription->fk_bank) + if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank) { print ''.$langs->trans("BankTransactionLine").''; - if ($subscription->fk_bank) + if ($object->fk_bank) { $bankline=new AccountLine($db); - $result=$bankline->fetch($subscription->fk_bank); + $result=$bankline->fetch($object->fk_bank); print $bankline->getNomUrl(1,0,'showall'); } else @@ -373,7 +388,7 @@ if ($rowid && $action != 'edit') { if (! $bankline->rappro) { - print '
"; + print '"; } else { @@ -384,12 +399,49 @@ if ($rowid && $action != 'edit') // Supprimer if ($user->rights->adherent->cotisation->creer) { - print '\n"; + print '\n"; } print ''; - print "
\n"; - + + + print '
'; + print ''; // ancre + + // Documents generes + /* + $filename = dol_sanitizeFileName($object->ref); + $filedir = $conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref); + $urlsource = $_SERVER['PHP_SELF'] . '?facid=' . $object->id; + $genallowed = $user->rights->facture->creer; + $delallowed = $user->rights->facture->supprimer; + + print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); + $somethingshown = $formfile->numoffiles; + */ + // Linked object block + $somethingshown = $form->showLinkedObjectBlock($object); + + // Show links to link elements + /*$linktoelem = $form->showLinkToObjectBlock($object,array('order')); + if ($linktoelem) print '
'.$linktoelem; + + // Link for paypal payment + if (! empty($conf->paypal->enabled) && $object->statut != 0) { + include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php'; + print showPaypalPaymentUrl('invoice', $object->ref); + } + */ + print '
'; + + // List of actions on element + /* + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + $somethingshown = $formactions->showactions($object, 'invoice', $socid); + */ + + print '
'; } diff --git a/htdocs/adherents/tpl/index.html b/htdocs/adherents/tpl/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/adherents/tpl/linkedobjectblock.tpl.php b/htdocs/adherents/tpl/linkedobjectblock.tpl.php new file mode 100644 index 00000000000..f593e72faa9 --- /dev/null +++ b/htdocs/adherents/tpl/linkedobjectblock.tpl.php @@ -0,0 +1,55 @@ + + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2014 Marcos García + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +?> + + + +load("members"); + +$var=true; +$total=0; +foreach($linkedObjectBlock as $key => $objectlink) +{ + $var=!$var; +?> + > + trans("Subscription"); ?> + getNomUrl(1); ?> + + dateh,'day'); ?> + rights->adherent->lire) { + $total = $total + $objectlink->amount; + echo price($objectlink->amount); + } ?> + + ">transnoentitiesnoconv("RemoveLink")); ?> + + + + \ No newline at end of file diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 54150556791..4ebbd2096f9 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -308,10 +308,12 @@ if ($action == 'edit' || $action == 'updateedit') print ''; print ''."\n"; + // Name $var=!$var; print ''."\n"; + // Addresse $var=!$var; print ''."\n"; @@ -392,7 +394,7 @@ if ($action == 'edit' || $action == 'updateedit') // Note $var=!$var; print ''; + print ''; print ''; print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'; print '
'; print '
'; - print '
'; @@ -531,7 +533,7 @@ if ($action == 'edit' || $action == 'updateedit') // Object of the company $var=!$var; print ''; - print ''; + print ''; print ''; print ''; @@ -821,7 +823,8 @@ else if (! empty($conf->global->MAIN_INFO_SIREN)) { print $conf->global->MAIN_INFO_SIREN; - if ($mysoc->country_code == 'FR') print '   '.$langs->trans("Check").''; + $s = $mysoc->id_prof_url(1,$mysoc); + if ($s) print ' - '.$s; } else { print ' '; } @@ -836,6 +839,8 @@ else if (! empty($conf->global->MAIN_INFO_SIRET)) { print $conf->global->MAIN_INFO_SIRET; + $s = $mysoc->id_prof_url(2,$mysoc); + if ($s) print ' - '.$s; } else { print ' '; } @@ -850,6 +855,8 @@ else if (! empty($conf->global->MAIN_INFO_APE)) { print $conf->global->MAIN_INFO_APE; + $s = $mysoc->id_prof_url(3,$mysoc); + if ($s) print ' - '.$s; } else { print ' '; } @@ -864,6 +871,8 @@ else if (! empty($conf->global->MAIN_INFO_RCS)) { print $conf->global->MAIN_INFO_RCS; + $s = $mysoc->id_prof_url(4,$mysoc); + if ($s) print ' - '.$s; } else { print ' '; } @@ -878,6 +887,8 @@ else if (! empty($conf->global->MAIN_INFO_PROFID5)) { print $conf->global->MAIN_INFO_PROFID5; + $s = $mysoc->id_prof_url(5,$mysoc); + if ($s) print ' - '.$s; } else { print ' '; } @@ -892,6 +903,8 @@ else if (! empty($conf->global->MAIN_INFO_PROFID6)) { print $conf->global->MAIN_INFO_PROFID6; + $s = $mysoc->id_prof_url(6,$mysoc); + if ($s) print ' - '.$s; } else { print ' '; } @@ -907,9 +920,9 @@ else $s=''; $s.=$conf->global->MAIN_INFO_TVAINTRA; $s.=''; - if (empty($conf->global->MAIN_DISABLEVATCHECK)) + if (empty($conf->global->MAIN_DISABLEVATCHECK) && $mysoc->isInEEC()) { - $s.='   '; + $s.=' - '; if (! empty($conf->use_javascript_ajax)) { print "\n"; diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 9209542a9c0..b299a1f18fe 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -62,6 +62,23 @@ if ($action == 'update') { 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); $result=$menu->fetch($_POST['menuId']); if ($result > 0) @@ -75,7 +92,18 @@ if ($action == 'update') $menu->perms=$_POST['perms']; $menu->target=$_POST['target']; $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); if ($result > 0) { @@ -342,7 +370,7 @@ if ($action == 'create') } else { - print ''; + print ''; } print ''.$langs->trans('DetailMenuIdParent'); print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def'; @@ -425,12 +453,15 @@ elseif ($action == 'edit') print ''.$langs->trans('Type').''.$langs->trans(ucfirst($menu->type)).''.$langs->trans('DetailType').''; // MenuId Parent - print ''.$langs->trans('MenuIdParent').''; + print ''.$langs->trans('MenuIdParent'); + print ''; $valtouse=$menu->fk_menu; if ($menu->fk_mainmenu) $valtouse='fk_mainmenu='.$menu->fk_mainmenu; if ($menu->fk_leftmenu) $valtouse.='&fk_leftmenu='.$menu->fk_leftmenu; - print ''; - print ''.$langs->trans('DetailMenuIdParent').''; + print ''; + print ''.$langs->trans('DetailMenuIdParent'); + print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def'; + print ''; // Niveau //print ''.$langs->trans('Level').''.$menu->level.''.$langs->trans('DetailLevel').''; diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index cba8d45c8f3..c8b7b469bd2 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -361,7 +361,7 @@ if ($conf->use_javascript_ajax) if (count($remainingdata)) { - print ''; + print '
'; print ''; print ''; diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 410851b640b..b131009ab88 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -45,14 +45,6 @@ $action = GETPOST('action','alpha'); if ($action == "set") { $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'); $account = new Account($db); @@ -78,6 +70,15 @@ if ($action == "set") } 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) { $db->commit(); @@ -131,33 +132,25 @@ print ''; print ''; print ""; -//User -print ''; -print ''; -print ''; - -//Profid1 of Transmitter -print ''; -print ''; -print ''; - // Bank account (from Banks module) -print ''; +print ''; print ''; // ICS -print ''; +print ''; print ''; print ''; +//User +print ''; +print ''; +print ''; + print '
'.$langs->trans("NotTopTreeMenuPersonalized").''.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("ResponsibleUser").''; -print ''; -print $form->select_dolusers($conf->global->PRELEVEMENT_USER, 'value0', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); -print '
'.$langs->trans("NumeroNationalEmetter").' - '.$langs->transcountry('ProfId1',$mysoc->country_code).''; -print ''; -print '
'.$langs->trans("BankToReceiveWithdraw").'
'.$langs->trans("BankToReceiveWithdraw").''; $form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT,'PRELEVEMENT_ID_BANKACCOUNT',0,"courant=1",1); print '
'.$langs->trans("ICS").'
'.$langs->trans("ICS").''; print '
'.$langs->trans("ResponsibleUser").''; +print $form->select_dolusers($conf->global->PRELEVEMENT_USER, 'PRELEVEMENT_USER', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); +print '
'; print '
'; diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 175aaa65665..5ace954045a 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -53,6 +53,8 @@ if ($file && ! $what) exit; } +$errormsg=''; + /* * Actions @@ -120,16 +122,37 @@ if ($what == 'mysql') { $cmddump=GETPOST("mysqldump"); // Do not sanitize here with 'alpha', will be sanitize later by escapeshellarg - if ($cmddump) + if (! empty($dolibarr_main_restrict_os_commands)) + { + $arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands); + $ok=0; + dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that on of this command is inside ".$cmddump); + foreach($arrayofallowedcommand as $allowedcommand) + { + if (preg_match('/'.preg_quote($allowedcommand,'/').'/', $cmddump)) + { + $ok=1; + break; + } + } + if (! $ok) + { + $errormsg=$langs->trans('CommandIsNotInsideAllowedCommands'); + } + } + + if (! $errormsg && $cmddump) { dolibarr_set_const($db, 'SYSTEMTOOLS_MYSQLDUMP', $cmddump,'chaine',0,'',$conf->entity); } - $utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file); - - $errormsg=$utils->error; - $_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone']; - $_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun']; + if (! $errormsg) + { + $utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file); + $errormsg=$utils->error; + $_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone']; + $_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun']; + } } // MYSQL NO BIN @@ -146,16 +169,19 @@ if ($what == 'mysqlnobin') if ($what == 'postgresql') { $cmddump=GETPOST("postgresqldump"); // Do not sanitize here with 'alpha', will be sanitize later by escapeshellarg - if ($cmddump) + + if (! $errormsg && $cmddump) { dolibarr_set_const($db, 'SYSTEMTOOLS_POSTGRESQLDUMP', $cmddump,'chaine',0,'',$conf->entity); } - $utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file); - - $errormsg=$utils->error; - $_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone']; - $_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun']; + if (! $errormsg) + { + $utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file); + $errormsg=$utils->error; + $_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone']; + $_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun']; + } $what=''; // Clear to show message to run command } diff --git a/htdocs/cashdesk/include/environnement.php b/htdocs/cashdesk/include/environnement.php index 3e6a88f252a..4490d4cf405 100644 --- a/htdocs/cashdesk/include/environnement.php +++ b/htdocs/cashdesk/include/environnement.php @@ -44,7 +44,7 @@ $conf_fkaccount_cb = (! empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]))?$_SESSIO // View parameters -$conf_taille_listes = (empty($conf->global->PRODUIT_LIMIT_SIZE)?500:$conf->global->PRODUIT_LIMIT_SIZE); // Nombre max de lignes a afficher dans les listes +$conf_taille_listes = (empty($conf->global->PRODUIT_LIMIT_SIZE)?1000:$conf->global->PRODUIT_LIMIT_SIZE); // Nombre max de lignes a afficher dans les listes $conf_nbr_car_listes = 60; // Nombre max de caracteres par ligne dans les listes // Add hidden option to force decrease of stock whatever is user setup diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index 1775c14767d..c347b4863c7 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -617,13 +617,14 @@ else if ($id || $ref) * @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 $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 */ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1) { global $user,$langs,$form,$bc; + $title='NotDefined'; if ($typeid == Categorie::TYPE_PRODUCT) $title = $langs->trans("ProductsCategoriesShort"); if ($typeid == Categorie::TYPE_SUPPLIER) $title = $langs->trans("SuppliersCategoriesShort"); if ($typeid == Categorie::TYPE_CUSTOMER) $title = $langs->trans("CustomersProspectsCategoriesShort"); diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 8e98e0014e8..60e132f3051 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2006-2012 Laurent Destailleur * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2013 Juanjo Menent - * Copyright (C) 2013 Philippe Grand + * Copyright (C) 2013-2016 Philippe Grand * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Charlie Benke @@ -43,13 +43,13 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; class Categorie extends CommonObject { // Categories types - const TYPE_PRODUCT = 0; - const TYPE_SUPPLIER = 1; - const TYPE_CUSTOMER = 2; - const TYPE_MEMBER = 3; - const TYPE_CONTACT = 4; - const TYPE_USER = 4; // categorie contact and user are same ! - const TYPE_ACCOUNT = 5; // bank account + const TYPE_PRODUCT = 0; // TODO Replace with value 'product' + const TYPE_SUPPLIER = 1; // TODO Replace this value with 'supplier' + const TYPE_CUSTOMER = 2; // TODO Replace this value with 'customer' + const TYPE_MEMBER = 3; // TODO Replace this value with 'member' + const TYPE_CONTACT = 4; // TODO Replace this value with 'contact' + const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user' + const TYPE_ACCOUNT = 5; // for bank account TODO Replace this value with 'account' /** * @var array ID mapping from type string @@ -63,7 +63,7 @@ class Categorie extends CommonObject 'member' => 3, 'contact' => 4, 'user' => 4, - 'account' => 5, + 'account' => 5, ); /** * @var array Foreign keys mapping from type string @@ -149,7 +149,7 @@ class Categorie extends CommonObject */ var $type; - var $cats=array(); // Tableau en memoire des categories + var $cats=array(); // Categories table in memory var $motherof=array(); /** @@ -232,9 +232,9 @@ class Categorie extends CommonObject * Add category into database * * @param User $user Object user - * @return int -1 : erreur SQL - * -2 : nouvel ID inconnu - * -3 : categorie invalide + * @return int -1 : SQL error + * -2 : new ID unknown + * -3 : Invalid category * -4 : category already exists */ function create($user) @@ -304,7 +304,7 @@ class Categorie extends CommonObject $action='create'; // Actions on extra fields (by external module or standard code) - // TODO le hook fait double emploi avec le trigger !! + // TODO the hook duplicates the trigger !! $hookmanager->initHooks(array('HookModuleNamedao')); $parameters=array('socid'=>$this->id); $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks @@ -398,7 +398,7 @@ class Categorie extends CommonObject $action='update'; // Actions on extra fields (by external module or standard code) - // TODO le hook fait double emploi avec le trigger !! + // TODO the hook duplicates the trigger !! $hookmanager->initHooks(array('HookCategorydao')); $parameters=array(); $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks @@ -867,8 +867,8 @@ class Categorie extends CommonObject } /** - * Reconstruit l'arborescence des categories sous la forme d'un tableau - * Renvoi un tableau de tableau('id','id_mere',...) trie selon arbre et avec: + * Rebuilding the category tree as an array + * Return an array of table('id','id_mere',...) trie selon arbre et avec: * id = id de la categorie * id_mere = id de la categorie mere * id_children = tableau des id enfant @@ -1008,13 +1008,13 @@ class Categorie extends CommonObject } /** - * Affiche contenu de $this->cats + * Display content of $this->cats * * @return void */ function debug_cats() { - // Affiche $this->cats + // Display $this->cats foreach($this->cats as $key => $val) { 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 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) { @@ -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 ? */ 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 * @return array @@ -1144,8 +1144,8 @@ class Categorie extends CommonObject } /** - * Retourne les chemin de la categorie, avec les noms des categories - * separes par $sep (" >> " par defaut) + * Returns the path of the category, with the names of the categories + * separated by $sep (" >> " by default) * * @param string $sep Separator * @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 */ @@ -1239,8 +1239,8 @@ class Categorie extends CommonObject } /** - * Retourne dans un tableau tous les chemins possibles pour arriver a la categorie - * en partant des categories principales, representes par des tableaux de categories + * Returns in a table all possible paths to get to the category + * starting with the major categories represented by Tables of categories * * @return array */ @@ -1324,8 +1324,8 @@ class Categorie extends CommonObject /** - * Retourne les categories dont l'id ou le nom correspond - * ajoute des wildcards au nom sauf si $exact = true + * Returns categories whose id or name match + * add wildcards in the name unless $exact = true * * @param int $id Id * @param string $nom Name diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 4df296d19da..cd1c9ecfd1b 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -61,8 +61,14 @@ $originid=GETPOST('originid','int'); $confirm = GETPOST('confirm', 'alpha'); $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 $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 $hookmanager->initHooks(array('actioncard','globalcard')); - /* * Actions */ @@ -781,7 +786,7 @@ if ($action == 'create') print ''.$langs->trans("Project").''; - $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) { print '   '.$langs->trans("AddProject").''; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 6b77e2414da..e759e93a635 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -406,7 +406,7 @@ class ActionComm extends CommonObject */ public function add(User $user, $notrigger = 0) { - $this->create($user, $notrigger); + return $this->create($user, $notrigger); } /** diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index 54f97fa2117..8254a5de1ba 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -208,7 +208,7 @@ class ICal //print 'type='.$type.' key='.$key.' value='.$value.'
'."\n"; - if ($key == false) + if (empty($key)) { $key = $this->last_key; switch ($type) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 6a06aad080f..4711aac7222 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -423,7 +423,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas=$obj->canvas; - print $companystatic->getNomUrl(1,'customer',16); + print $companystatic->getNomUrl(1,'supplier',16); print ''; print ''.price($obj->total_ttc).''; $i++; @@ -729,7 +729,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas=$obj->canvas; - print $companystatic->getNomUrl(1, 'company', 44); + print $companystatic->getNomUrl(1, 'customer', 44); print ''; print ''; print dol_print_date($db->jdate($obj->dp),'day').''."\n"; @@ -828,7 +828,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas=$obj->canvas; - print $companystatic->getNomUrl(1, 'company', 44); + print $companystatic->getNomUrl(1, 'customer', 44); print ''; print ''; print dol_print_date($db->jdate($obj->dp),'day').''."\n"; diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php index be8a63225fe..9cd40a55b8b 100644 --- a/htdocs/comm/mailing/advtargetemailing.php +++ b/htdocs/comm/mailing/advtargetemailing.php @@ -221,7 +221,7 @@ if ($action == 'add') { if ((count($advTarget->thirdparty_lines) > 0) || (count($advTarget->contact_lines) > 0)) { // Add targets into database $obj = new mailing_advthirdparties($db); - $result = $obj->add_to_target($id, $advTarget->thirdparty_lines, $array_query['type_of_target'], $advTarget->contact_lines); + $result = $obj->add_to_target_spec($id, $advTarget->thirdparty_lines, $array_query['type_of_target'], $advTarget->contact_lines); } else { $result = 0; } @@ -967,11 +967,11 @@ if ($object->fetch($id) >= 0) { print ''; print '
'; } - - if (empty($conf->mailchimp->enabled) || (! empty($conf->mailchimp->enabled) && $object->statut != 3)) + + if (empty($conf->mailchimp->enabled) || (! empty($conf->mailchimp->enabled) && $object->statut != 3)) { - // List of recipients (TODO Move code of page cibles.php into a .tpl.php file and make an include here to avoid duplicate content) + // List of recipients (TODO Move code of page cibles.php into a .tpl.php file and make an include here to avoid duplicate content) } } diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 1a54340e7ce..73717696dc7 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -259,7 +259,8 @@ if (empty($reshook)) } // Fabrication du mail - $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css); + $trackid=''; // TODO Define a trackid for mass emailing too. We can use source type for this. + $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid); if ($mail->error) { @@ -672,9 +673,9 @@ if ($action == 'create') dol_fiche_head(); print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; // Other attributes $parameters=array(); @@ -688,11 +689,11 @@ if ($action == 'create') print '

'; print '
'.$langs->trans("MailTitle").'
'.$langs->trans("MailFrom").'
'.$langs->trans("MailErrorsTo").'
'.$langs->trans("MailTitle").'
'.$langs->trans("MailFrom").'
'.$langs->trans("MailErrorsTo").'
'; - print ''; - print ''; + print ''; - print ''; + print ''; print ''; @@ -994,7 +995,7 @@ else print '
'.$langs->trans("MailTopic").'
'.$langs->trans("BackgroundColorByDefault").''; + print '
'.$langs->trans("MailTopic").'
'.$langs->trans("BackgroundColorByDefault").''; print $htmlother->selectColor($_POST['bgcolor'],'bgcolor','new_mailing',0); print '
'.$langs->trans("MailMessage").'
'; + print '
'.$langs->trans("MailMessage").'
'; print '
'.$langs->trans("CommonSubstitutions").':
'; foreach($object->substitutionarray as $key => $val) { @@ -791,7 +792,7 @@ else $linkback = ''.$langs->trans("BackToList").''; - print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id', $linkback); print '
'; // Subject - print ''; + print ''; // Joined files print '';*/ // Message - print ''; + print ''; print ''; @@ -1113,9 +1114,10 @@ else print '
'.$langs->trans("MailTopic").''.$object->sujet.'
'.$langs->trans("MailTopic").''.$object->sujet.'
'.$langs->trans("MailFile").''; @@ -1020,7 +1021,7 @@ else print '
'.$langs->trans("MailMessage").'
'; + print '
'.$langs->trans("MailMessage").'
'; print '
'.$langs->trans("CommonSubstitutions").':
'; foreach($object->substitutionarray as $key => $val) { @@ -1054,7 +1055,7 @@ else $linkback = ''.$langs->trans("BackToList").''; - print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id', $linkback); print '
'; // Subject - print ''; + print ''; - dol_init_file_process($upload_dir); + $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); // Joined files $addfileaction='addfile'; @@ -1154,12 +1156,12 @@ else print ''; // Background color - print ''; // Message - print ''; + print ''; print ''; - print ''; + print ''; - print ''; + print ''; // Errors to - print ''; // Status - print ''; // Nb of distinct emails - print ''; print ''; - if ($_GET["action"]=='split' && $_GET['remid'] == $obj->rowid) + if ($_GET["action"]=='split' && GETPOST('remid') == $obj->rowid) { $showconfirminfo['rowid']=$obj->rowid; $showconfirminfo['amount_ttc']=$obj->amount_ttc; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index e67b18a5989..f3240443a6e 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1195,9 +1195,9 @@ if (empty($reshook)) $file = $upload_dir . '/' . GETPOST('file'); $ret = dol_delete_file($file, 0, 0, 0, $object); if ($ret) - setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); + setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs'); else - setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); + setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors'); $action = ''; } } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 3ecbe763d0b..6f14d407a5d 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -449,6 +449,8 @@ class Commande extends CommonOrder // If stock is decremented on validate order, we must reincrement it if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) { + $result = 0; + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; $langs->load("agenda"); @@ -460,22 +462,9 @@ class Commande extends CommonOrder $mouvP = new MouvementStock($this->db); // We increment stock of product (and sub-products) $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderBackToDraftInDolibarr",$this->ref)); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; $this->error=$mouvP->error; break; } } } - - if (!$error) - { - $this->statut=self::STATUS_DRAFT; - $this->db->commit(); - return $result; - } - else - { - $this->error=$mouvP->error; - $this->db->rollback(); - return $result; - } } if (!$error) { @@ -1278,7 +1267,8 @@ class Commande extends CommonOrder if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref); dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR); $this->db->rollback(); return self::STOCK_NOT_ENOUGH_FOR_ORDER; @@ -2642,7 +2632,8 @@ class Commande extends CommonOrder if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref); dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR); $this->db->rollback(); unset($_POST['productid']); @@ -3256,7 +3247,8 @@ class Commande extends CommonOrder dol_syslog(get_class($this)."::initAsSpecimen"); - // Charge tableau des produits prodids + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index f19a431ec10..47cee9903ef 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1030,7 +1030,6 @@ if ($resql) else print ''; } print ''; - } $db->free($resql); diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index bcbe3ea408e..4bbb3def843 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -70,9 +70,14 @@ $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_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 (is_array($selected) == false) + if (! is_array($selected)) { $error++; setEventMessages($langs->trans('Error_OrderNotChecked'), null, 'errors'); @@ -174,6 +179,9 @@ if (($action == 'create' || $action == 'add') && !$error) $object->remise_absolue = $_POST['remise_absolue']; $object->remise_percent = $_POST['remise_percent']; + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if ($ret < 0) $error++; + if ($_POST['origin'] && $_POST['originid']) { $object->origin = $_POST['origin']; @@ -464,6 +472,12 @@ if ($action == 'create' && !$error) $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 + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + $object=new Facture($db); + print $object->showOptionals($extrafields,'edit'); + } + // Modele PDF print ''; print ''; print ''; - print ''; + print ''; // Label print ''; @@ -393,10 +391,10 @@ if ($action == 'create') print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print '
'.$langs->trans("MailTopic").'
'.$langs->trans("MailTopic").'
'.$langs->trans("BackgroundColorByDefault").''; + print '
'.$langs->trans("BackgroundColorByDefault").''; print $htmlother->selectColor($object->bgcolor,'bgcolor','edit_mailing',0); print '
'.$langs->trans("MailMessage").'
'; + print '
'.$langs->trans("MailMessage").'
'; print '
'.$langs->trans("CommonSubstitutions").':
'; foreach($object->substitutionarray as $key => $val) { diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index d09be0897c3..cc5b16f1935 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -183,30 +183,30 @@ if ($object->fetch($id) >= 0) $linkback = ''.$langs->trans("BackToList").''; - print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id', $linkback); print '
'.$langs->trans("MailTitle").''.$object->titre.'
'.$langs->trans("MailTitle").''.$object->titre.'
'.$langs->trans("MailFrom").''.dol_print_email($object->email_from,0,0,0,0,1).'
'.$langs->trans("MailFrom").''.dol_print_email($object->email_from,0,0,0,0,1).'
'.$langs->trans("MailErrorsTo").''.dol_print_email($object->email_errorsto,0,0,0,0,1); + print '
'.$langs->trans("MailErrorsTo").''.dol_print_email($object->email_errorsto,0,0,0,0,1); print '
'.$langs->trans("Status").''.$object->getLibStatut(4); + print '
'.$langs->trans("Status").''.$object->getLibStatut(4); if ($object->statut == 2) print ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.')'; print '
'; + print '
'; print $langs->trans("TotalNbOfDistinctRecipients"); print ''; $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); print $form->textwithpicto($nbemail,$text,1,'warning'); diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index d9cc6f31d23..298ceb886b9 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -41,6 +41,8 @@ class Mailing extends CommonObject var $bgcolor; var $bgimage; + var $statut; // Status 0=Draft, 1=Validated, 2=Sent partially, 3=Sent completely + var $email_from; var $email_replyto; var $email_errorsto; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 1ff75f2b661..ffc412fba70 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -438,7 +438,8 @@ class Propal extends CommonObject $product_type=$product->type; if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_PROPOSAL) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnProposal', $product->ref); $this->db->rollback(); return -3; } @@ -2610,7 +2611,8 @@ class Propal extends CommonObject { global $langs; - // Charge tableau des produits prodids + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index a4aff6d71c1..b682b214da8 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -32,6 +32,8 @@ $langs->load("orders"); $langs->load("bills"); $langs->load("companies"); +$id=GETPOST('id','int'); + $action=GETPOST('action','alpha'); $backtopage=GETPOST('backtopage','alpha'); @@ -58,6 +60,9 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') //if ($user->rights->societe->creer) //if ($user->rights->facture->creer) + $amount_ttc_1=GETPOST('amount_ttc_1'); + $amount_ttc_2=GETPOST('amount_ttc_2'); + $error=0; $remid=GETPOST("remid")?GETPOST("remid"):0; $discount=new DiscountAbsolute($db); @@ -67,7 +72,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') $error++; 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++; setEventMessages($langs->trans("TotalOfTwoDiscountMustEqualsOriginal"), null, 'errors'); @@ -120,7 +125,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') if ($res > 0 && $newid1 > 0 && $newid2 > 0) { $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; } else @@ -135,10 +140,14 @@ if ($action == 'setremise') //if ($user->rights->societe->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; - if (empty($_POST["desc"])) + if (empty($desc)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("ReasonDiscount")), null, 'errors'); $error++; @@ -147,8 +156,8 @@ if ($action == 'setremise') if (! $error) { $soc = new Societe($db); - $soc->fetch($_GET["id"]); - $discountid=$soc->set_remise_except($_POST["amount_ht"],$user,$_POST["desc"],$_POST["tva_tx"]); + $soc->fetch($id); + $discountid=$soc->set_remise_except($amount_ht,$user,$desc,$tva_tx); if ($discountid > 0) { @@ -159,7 +168,7 @@ if ($action == 'setremise') } else { - header("Location: remx.php?id=".$_GET["id"]); + header("Location: remx.php?id=".$id); exit; } } @@ -189,7 +198,7 @@ if (GETPOST("action") == 'confirm_remove' && GETPOST("confirm")=='yes') if ($result > 0) { $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; } else @@ -227,11 +236,11 @@ if ($socid > 0) print ''; dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"),0,'company'); - + dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); - + print '
'; - + print '
'; print ''; @@ -264,22 +273,22 @@ if ($socid > 0) print load_fiche_titre($langs->trans("NewGlobalDiscount"),'',''); print '
'; - print ''; + print ''; print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print "
'.$langs->trans("AmountHT").'
'.$langs->trans("AmountHT").''; print ' '.$langs->trans("Currency".$conf->currency).'
'.$langs->trans("VAT").''; print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$object); print '
'.$langs->trans("NoteReason").'
'.$langs->trans("NoteReason").'
"; print '
'; - + dol_fiche_end(); - + print '
'; print ''; if (! empty($backtopage)) @@ -296,7 +305,7 @@ if ($socid > 0) 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 '
 
'.$langs->trans('Model').''; diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 7b53d775cb6..f756d50ad2a 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -36,10 +36,10 @@ $id=GETPOST('account'); $ref=GETPOST('ref'); // Security check -$fieldid = (! empty($ref)?$ref:$id); -$fieldname = isset($ref)?'ref':'rowid'; +$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :'')); +$fieldtype = (! empty($ref) ? 'ref' :'rowid'); 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_current = strftime("%Y",time()); @@ -146,7 +146,7 @@ $linkback = ''.$langs->trans("B // Ref print '
'.$langs->trans("Ref").''; -if ($_GET["account"]) +if (!empty($id)) { if (! preg_match('/,/', $id)) { diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index e6043167b22..5ba06842c30 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -89,8 +89,7 @@ if ($_POST["action"] == 'add') $account->proprio = trim($_POST["proprio"]); $account->owner_address = trim($_POST["owner_address"]); - if (GETPOST('account_number') <= 0) { $accountancy_code_number = ''; } else { $accountancy_code_number = GETPOST('account_number'); } - $account->account_number = $accountancy_code_number; + $account->account_number = GETPOST('account_number'); $account->accountancy_journal = trim($_POST["accountancy_journal"]); $account->solde = $_POST["solde"]; @@ -172,8 +171,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"]) $account->proprio = trim($_POST["proprio"]); $account->owner_address = trim($_POST["owner_address"]); - if (GETPOST('account_number') <= 0) { $accountancy_code_number = ''; } else { $accountancy_code_number = GETPOST('account_number'); } - $account->account_number = $accountancy_code_number; + $account->account_number = GETPOST('account_number'); $account->accountancy_journal = trim($_POST["accountancy_journal"]); $account->currency_code = trim($_POST["account_currency_code"]); @@ -287,7 +285,7 @@ if ($action == 'create') // Ref print '
'.$langs->trans("Ref").'ref).'" maxlength="12">
ref).'" maxlength="12">
'.$langs->trans("LabelBankCashAccount").'
'.$langs->trans("BalanceMinimalAllowed").'min_allowed).'">
min_allowed).'">
'.$langs->trans("BalanceMinimalDesired").'min_desired).'">
min_desired).'">
'; print '
'; @@ -407,7 +405,7 @@ if ($action == 'create') // If bank account print ''.$langs->trans("BankName").''; - print ''; + print ''; print ''; // Show fields of bank account @@ -431,7 +429,7 @@ if ($action == 'create') } print ''.$langs->trans($val).''; - print ''; + print ''; print ''; } $ibankey = FormBank::getIBANLabel($account); @@ -440,23 +438,23 @@ if ($action == 'create') // IBAN print ''.$langs->trans($ibankey).''; - print ''; + print ''; print ''.$langs->trans($bickey).''; - print ''; + print ''; print ''.$langs->trans("BankAccountDomiciliation").''; print ""; print ''.$langs->trans("BankAccountOwner").''; - print ''; + print ''; print ''; print ''.$langs->trans("BankAccountOwnerAddress").''; print ""; print ''; diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 34cec22fb54..a5038fc2e78 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -45,16 +45,9 @@ $statut=GETPOST('statut'); * View */ -$help_url='EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas'; -llxHeader('',$langs->trans('AccountsArea'),$help_url); +$title=$langs->trans('BankAccounts'); -$link=''; -if ($statut == '') $link=''.$langs->trans("IncludeClosedAccount").''; -if ($statut == 'all') $link=''.$langs->trans("OnlyOpenedAccount").''; -print load_fiche_titre($langs->trans("AccountsArea"),$link, 'title_bank.png'); - - -// On charge tableau des comptes financiers (ouverts par defaut) +// Load array of financial accounts (opened by default) $accounts = array(); $sql = "SELECT rowid, courant, rappro"; @@ -66,17 +59,30 @@ $sql.= $db->order('label', 'ASC'); $resql = $db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - while ($i < $num) - { - $objp = $db->fetch_object($resql); - $accounts[$objp->rowid] = $objp->courant; - $i++; - } - $db->free($resql); + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $accounts[$objp->rowid] = $objp->courant; + $i++; + } + $db->free($resql); } +$nbtotalofrecords = $num; + + +$help_url='EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas'; +llxHeader('',$title,$help_url); + +$link=''; +if ($statut == '') $link=''.$langs->trans("IncludeClosedAccount").''; +if ($statut == 'all') $link=''.$langs->trans("OnlyOpenedAccount").''; + +print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$link,$num,$nbtotalofrecords,'title_bank.png',0,'','',$limit, 1); + + /* * Comptes courants (courant = 1) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 375288ce754..6535cee7c98 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -163,7 +163,7 @@ if (empty($reshook)) // Change status of invoice else if ($action == 'reopen' && $user->rights->facture->creer) { $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); if ($result > 0) { header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id); @@ -1790,57 +1790,13 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; - /* - * Generate document - */ - if ($action == 'builddoc') // En get ou en post - { - $object->fetch($id); - $object->fetch_thirdparty(); + // Actions to build doc + $upload_dir = $conf->facture->dir_output; + $permissioncreate=$user->rights->facture->creer; + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + - // Save last template used to generate document - if (GETPOST('model')) - $object->setDocModel($user, GETPOST('model', 'alpha')); - if (GETPOST('fk_bank')) { // this field may come from an external module - $object->fk_bank = GETPOST('fk_bank'); - } else { - $object->fk_bank = $object->fk_account; - } - - // 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); - } - $result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result <= 0) - { - setEventMessages($object->error, $object->errors, 'errors'); - $action=''; - } - } - - // Remove file in doc form - else if ($action == 'remove_file') { - if ($object->fetch($id)) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - - $object->fetch_thirdparty(); - - $langs->load("other"); - $upload_dir = $conf->facture->dir_output; - $file = $upload_dir . '/' . GETPOST('file'); - $ret = dol_delete_file($file, 0, 0, 0, $object); - if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); - else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); - $action = ''; - } - } elseif ($action == 'update_extras') { + if ($action == 'update_extras') { // Fill array 'array_options' with data from add form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); @@ -2974,16 +2930,16 @@ else if ($id > 0 || ! empty($ref)) // Ref print '' . $langs->trans('Ref') . ''; print ''; - $morehtmlref = ''; + $morehtmlright = ''; $discount = new DiscountAbsolute($db); $result = $discount->fetch(0, $object->id); if ($result > 0) { - $morehtmlref = ' (' . $langs->trans("CreditNoteConvertedIntoDiscount", $discount->getNomUrl(1, 'discount')) . ')'; + $morehtmlright = '  (' . $langs->trans("CreditNoteConvertedIntoDiscount", $discount->getNomUrl(1, 'discount')) . ')'; } if ($result < 0) { 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 ''; // Ref customer @@ -3949,8 +3905,8 @@ else if ($id > 0 || ! empty($ref)) if ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) || ($object->type == Facture::TYPE_CREDIT_NOTE && empty($discount->id)) || ($object->type == Facture::TYPE_DEPOSIT && empty($discount->id))) - && ($object->statut == 2 || $object->statut == 3) - && $user->rights->facture->creer) // A paid invoice (partially or completely) + && ($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) { if (! $objectidnext && $object->close_code != 'replaced') // Not replaced by another invoice { diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 2bcd227827e..1d75be61f6c 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -509,7 +509,7 @@ class FactureRec extends CommonInvoice $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'; // 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 * @@ -760,8 +865,9 @@ class FactureRec extends CommonInvoice $arraynow=dol_getdate($now); $nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']); - $prodids = array(); + // Load array of products prodids $num_prods = 0; + $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b0e0c431502..73127f9a1f2 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -108,7 +108,7 @@ class Facture extends CommonInvoice var $specimen; var $fac_rec; - + // Multicurrency var $fk_multicurrency; var $multicurrency_code; @@ -136,7 +136,7 @@ class Facture extends CommonInvoice * @var array Table of previous situations */ public $tab_previous_situation_invoice=array(); - + /** * @var array Table of next situations */ @@ -249,7 +249,7 @@ class Facture extends CommonInvoice $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } - + dol_syslog(get_class($this)."::create user=".$user->id); // Check parameters @@ -280,7 +280,7 @@ class Facture extends CommonInvoice $result=$_facrec->fetch($this->fac_rec); $this->socid = $_facrec->socid; - + // Fields coming from GUI (priority on template). TODO Value of template should be used as default value on GUI so we can use here always value from GUI $this->fk_project = GETPOST('projectid','int') > 0 ? GETPOST('projectid','int') : $_facrec->fk_project; $this->note_public = GETPOST('note_public') ? GETPOST('note_public') : $_facrec->note_public; @@ -289,7 +289,7 @@ class Facture extends CommonInvoice $this->cond_reglement_id = GETPOST('cond_reglement_id') > 0 ? GETPOST('cond_reglement_id') : $_facrec->cond_reglement_id; $this->mode_reglement_id = GETPOST('mode_reglement_id') > 0 ? GETPOST('mode_reglement_id') : $_facrec->mode_reglement_id; $this->fk_account = GETPOST('fk_account') > 0 ? GETPOST('fk_account') : $_facrec->fk_account; - + // Fields always coming from template $this->remise_absolue = $_facrec->remise_absolue; $this->remise_percent = $_facrec->remise_percent; @@ -302,13 +302,13 @@ class Facture extends CommonInvoice $this->note_public=trim($this->note_public); $this->note_private=trim($this->note_private); $this->note_private=dol_concatdesc($this->note_private, $langs->trans("GeneratedFromRecurringInvoice", $_facrec->ref)); - + //if (! $this->remise) $this->remise = 0; if (! $this->mode_reglement_id) $this->mode_reglement_id = 0; $this->brouillon = 1; - + $forceduedate = $this->calculate_date_lim_reglement(); - + // For recurrn invoices, update date and number of last generation of recurring template invoice, before inserting new invoice if ($_facrec->frequency > 0) { @@ -658,7 +658,7 @@ class Facture extends CommonInvoice function createFromCurrent($user,$invertdetail=0) { global $conf; - + // Charge facture source $facture=new Facture($this->db); @@ -712,15 +712,15 @@ class Facture extends CommonInvoice elseif ($this->type == self::TYPE_SITUATION && !empty($conf->global->INVOICE_USE_SITUATION)) { $this->fetchObjectLinked('', '', $object->id, 'facture'); - - foreach ($this->linkedObjectsIds as $typeObject => $Tfk_object) + + foreach ($this->linkedObjectsIds as $typeObject => $Tfk_object) { - foreach ($Tfk_object as $fk_object) + foreach ($Tfk_object as $fk_object) { $facture->add_object_linked($typeObject, $fk_object); } } - + $facture->add_object_linked('facture', $this->fk_facture_source); } @@ -1107,7 +1107,7 @@ class Facture extends CommonInvoice $this->multicurrency_total_ht = $obj->multicurrency_total_ht; $this->multicurrency_total_tva = $obj->multicurrency_total_tva; $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; - + if ($this->type == self::TYPE_SITUATION && $fetch_situation) { $this->fetchPreviousNextSituationInvoice(); @@ -1229,7 +1229,7 @@ class Facture extends CommonInvoice $line->situation_percent= $objp->situation_percent; $line->fk_prev_id = $objp->fk_prev_id; $line->fk_unit = $objp->fk_unit; - + // Multicurrency $line->fk_multicurrency = $objp->fk_multicurrency; $line->multicurrency_code = $objp->multicurrency_code; @@ -1237,7 +1237,7 @@ class Facture extends CommonInvoice $line->multicurrency_total_ht = $objp->multicurrency_total_ht; $line->multicurrency_total_tva = $objp->multicurrency_total_tva; $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; - + $this->lines[$i] = $line; $i++; @@ -1255,17 +1255,17 @@ class Facture extends CommonInvoice /** * Fetch previous and next situations invoices * - * @return void + * @return void */ function fetchPreviousNextSituationInvoice() { global $conf; - + $this->tab_previous_situation_invoice = array(); $this->tab_next_situation_invoice = array(); - + $sql = 'SELECT rowid, situation_counter FROM '.MAIN_DB_PREFIX.'facture WHERE rowid <> '.$this->id.' AND entity = '.$conf->entity.' AND situation_cycle_ref = '.(int) $this->situation_cycle_ref.' ORDER BY situation_counter ASC'; - + dol_syslog(get_class($this).'::fetchPreviousNextSituationInvoice ', LOG_DEBUG); $result = $this->db->query($sql); if ($result && $this->db->num_rows($result) > 0) @@ -1274,13 +1274,13 @@ class Facture extends CommonInvoice { $invoice = new Facture($this->db); if ($invoice->fetch($objp->rowid) > 0) - { + { if ($objp->situation_counter < $this->situation_counter) $this->tab_previous_situation_invoice[] = $invoice; else $this->tab_next_situation_invoice[] = $invoice; } } } - + } /** @@ -2061,7 +2061,7 @@ class Facture extends CommonInvoice $this->brouillon=0; $this->date_validation=$now; $i = 0; - + if (!empty($conf->global->INVOICE_USE_SITUATION)) { $final = True; @@ -2094,7 +2094,7 @@ class Facture extends CommonInvoice /** * Update price of next invoice - * + * * @param Translate $langs Translate object * @return bool false if KO, true if OK */ @@ -2103,13 +2103,13 @@ class Facture extends CommonInvoice foreach ($this->tab_next_situation_invoice as $next_invoice) { $is_last = $next_invoice->is_last_in_cycle(); - - if ($next_invoice->brouillon && $is_last != 1) + + if ($next_invoice->brouillon && $is_last != 1) { $this->error = $langs->trans('updatePriceNextInvoiceErrorUpdateline', $next_invoice->ref); return false; } - + $next_invoice->brouillon = 1; foreach ($next_invoice->lines as $line) { @@ -2117,17 +2117,17 @@ class Facture extends CommonInvoice $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); - - if ($result < 0) + + if ($result < 0) { $this->error = $langs->trans('updatePriceNextInvoiceErrorUpdateline', $next_invoice->ref); return false; } } - + break; // Only the next invoice and not each next invoice } - + return true; } @@ -2280,7 +2280,7 @@ class Facture extends CommonInvoice if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0; if (empty($fk_prev_id)) $fk_prev_id = 'null'; if (! isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100; - + $remise_percent=price2num($remise_percent); $qty=price2num($qty); $pu_ht=price2num($pu_ht); @@ -2314,7 +2314,8 @@ class Facture extends CommonInvoice $product_type=$product->type; if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', $product->ref); $this->db->rollback(); return -3; } @@ -2341,7 +2342,7 @@ class Facture extends CommonInvoice $multicurrency_total_ht = $tabprice[16]; $multicurrency_total_tva = $tabprice[17]; $multicurrency_total_ttc = $tabprice[18]; - + // Rank to use $rangtouse = $rang; if ($rangtouse == -1) @@ -2354,31 +2355,36 @@ class Facture extends CommonInvoice $this->line=new FactureLigne($this->db); $this->line->context = $this->context; - + $this->line->fk_facture=$this->id; $this->line->label=$label; // deprecated $this->line->desc=$desc; - $this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative + + $this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative + $this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise + $this->line->tva_tx=$txtva; $this->line->localtax1_tx=$txlocaltax1; $this->line->localtax2_tx=$txlocaltax2; + $this->line->localtax1_type = $localtaxes_type[0]; + $this->line->localtax2_type = $localtaxes_type[2]; + + $this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative + $this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); // For credit note and if qty is negative, total is negative + $this->line->total_tva= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva); // For credit note and if qty is negative, total is negative + $this->line->total_localtax1=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax1):$total_localtax1); // For credit note and if qty is negative, total is negative + $this->line->total_localtax2=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax2):$total_localtax2); // For credit note and if qty is negative, total is negative + $this->line->fk_product=$fk_product; $this->line->product_type=$product_type; $this->line->remise_percent=$remise_percent; - $this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise $this->line->date_start=$date_start; $this->line->date_end=$date_end; $this->line->ventil=$ventil; $this->line->rang=$rangtouse; $this->line->info_bits=$info_bits; $this->line->fk_remise_except=$fk_remise_except; - $this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative - $this->line->total_tva= $total_tva; - $this->line->total_localtax1=$total_localtax1; - $this->line->total_localtax2=$total_localtax2; - $this->line->localtax1_type = $localtaxes_type[0]; - $this->line->localtax2_type = $localtaxes_type[2]; - $this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); + $this->line->special_code=$special_code; $this->line->fk_parent_line=$fk_parent_line; $this->line->origin=$origin; @@ -2390,7 +2396,7 @@ class Facture extends CommonInvoice // infos marge $this->line->fk_fournprice = $fk_fournprice; $this->line->pa_ht = $pa_ht; - + // Multicurrency $this->line->fk_multicurrency = $this->fk_multicurrency; $this->line->multicurrency_code = $this->multicurrency_code; @@ -2398,7 +2404,7 @@ class Facture extends CommonInvoice $this->line->multicurrency_total_ht = $multicurrency_total_ht; $this->line->multicurrency_total_tva = $multicurrency_total_tva; $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; - + if (is_array($array_options) && count($array_options)>0) { $this->line->array_options=$array_options; } @@ -2483,7 +2489,7 @@ class Facture extends CommonInvoice return -3; } } - + $this->db->begin(); // Clean parameters @@ -2509,7 +2515,7 @@ class Facture extends CommonInvoice $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc); $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. - + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, $situation_percent, $this->multicurrency_tx); $total_ht = $tabprice[0]; @@ -2525,7 +2531,7 @@ class Facture extends CommonInvoice $multicurrency_total_ht = $tabprice[16]; $multicurrency_total_tva = $tabprice[17]; $multicurrency_total_ttc = $tabprice[18]; - + // Old properties: $price, $remise (deprecated) $price = $pu; $remise = 0; @@ -2547,7 +2553,8 @@ class Facture extends CommonInvoice $product_type=$product->type; if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', $product->ref); $this->db->rollback(); return -3; } @@ -2600,7 +2607,7 @@ class Facture extends CommonInvoice $this->line->multicurrency_total_ht = $multicurrency_total_ht; $this->line->multicurrency_total_tva = $multicurrency_total_tva; $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; - + if (is_array($array_options) && count($array_options)>0) { $this->line->array_options=$array_options; } @@ -2631,28 +2638,28 @@ class Facture extends CommonInvoice } /** - * Check if the percent edited is lower of next invoice line - * + * Check if the percent edited is lower of next invoice line + * * @param int $idline id of line to check * @param float $situation_percent progress percentage need to be test * @return false if KO, true if OK */ function checkProgressLine($idline, $situation_percent) { - $sql = 'SELECT fd.situation_percent FROM '.MAIN_DB_PREFIX.'facturedet fd - INNER JOIN '.MAIN_DB_PREFIX.'facture f ON (fd.fk_facture = f.rowid) - WHERE fd.fk_prev_id = '.$idline.' + $sql = 'SELECT fd.situation_percent FROM '.MAIN_DB_PREFIX.'facturedet fd + INNER JOIN '.MAIN_DB_PREFIX.'facture f ON (fd.fk_facture = f.rowid) + WHERE fd.fk_prev_id = '.$idline.' AND f.fk_statut <> 0'; - + $result = $this->db->query($sql); if (! $result) { $this->error=$this->db->error(); return false; } - + $obj = $this->db->fetch_object($result); - + if ($obj === null) return true; else return $situation_percent < $obj->situation_percent; } @@ -2667,7 +2674,7 @@ class Facture extends CommonInvoice function update_percent($line, $percent) { global $mysoc,$user; - + include_once(DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php'); // Cap percentages to 100 @@ -3530,6 +3537,8 @@ class Facture extends CommonInvoice $arraynow=dol_getdate($now); $nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']); + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; @@ -3546,6 +3555,10 @@ class Facture extends CommonInvoice $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 $this->id=0; @@ -3779,7 +3792,7 @@ class Facture extends CommonInvoice function get_prev_sits() { global $conf; - + $sql = 'SELECT rowid FROM ' . MAIN_DB_PREFIX . 'facture'; $sql .= ' where situation_cycle_ref = ' . $this->situation_cycle_ref; $sql .= ' and situation_counter < ' . $this->situation_counter; @@ -3809,9 +3822,9 @@ class Facture extends CommonInvoice */ function setFinal() { - + $this->db->begin(); - + $this->situation_final = 1; $sql = 'update ' . MAIN_DB_PREFIX . 'facture set situation_final = ' . $this->situation_final . ' where rowid = ' . $this->id; $resql = $this->db->query($sql); @@ -3836,12 +3849,12 @@ class Facture extends CommonInvoice function is_last_in_cycle() { global $conf; - + if (!empty($this->situation_cycle_ref)) { // No point in testing anything if we're not inside a cycle $sql = 'SELECT max(situation_counter) FROM ' . MAIN_DB_PREFIX . 'facture WHERE situation_cycle_ref = ' . $this->situation_cycle_ref . ' AND entity = ' . ($this->entity > 0 ? $this->entity : $conf->entity); $resql = $this->db->query($sql); - + if ($resql && $resql->num_rows > 0) { $res = $this->db->fetch_array($resql); $last = $res['max(situation_counter)']; @@ -3886,7 +3899,7 @@ class Facture extends CommonInvoice // Paid invoices have status STATUS_CLOSED if ($this->statut != Facture::STATUS_VALIDATED) return false; - + return $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay); } } @@ -3975,7 +3988,7 @@ class FactureLigne extends CommonInvoiceLine var $multicurrency_total_ht; var $multicurrency_total_tva; var $multicurrency_total_ttc; - + /** * Load invoice line from database * @@ -4065,7 +4078,7 @@ class FactureLigne extends CommonInvoiceLine $error=0; $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. - + dol_syslog(get_class($this)."::insert rang=".$this->rang, LOG_DEBUG); // Clean parameters @@ -4091,9 +4104,9 @@ class FactureLigne extends CommonInvoiceLine if (empty($this->multicurrency_total_ht)) $this->multicurrency_total_ht=0; if (empty($this->multicurrency_total_tva)) $this->multicurrency_total_tva=0; if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc=0; - + // if buy price not defined, define buyprice as configured in margin admin - if ($this->pa_ht == 0 && $pa_ht_isemptystring) + if ($this->pa_ht == 0 && $pa_ht_isemptystring) { if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { @@ -4277,7 +4290,7 @@ class FactureLigne extends CommonInvoiceLine $error=0; $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. - + // Clean parameters $this->desc=trim($this->desc); if (empty($this->tva_tx)) $this->tva_tx=0; @@ -4299,7 +4312,7 @@ class FactureLigne extends CommonInvoiceLine if ($this->product_type < 0) return -1; // if buy price not defined, define buyprice as configured in margin admin - if ($this->pa_ht == 0 && $pa_ht_isemptystring) + if ($this->pa_ht == 0 && $pa_ht_isemptystring) { if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { @@ -4346,13 +4359,13 @@ class FactureLigne extends CommonInvoiceLine if (! empty($this->rang)) $sql.= ", rang=".$this->rang; $sql .= ", situation_percent=" . $this->situation_percent; $sql .= ", fk_unit=".(!$this->fk_unit ? 'NULL' : $this->fk_unit); - + // Multicurrency $sql.= " , multicurrency_subprice=".price2num($this->multicurrency_subprice).""; $sql.= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht).""; $sql.= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; $sql.= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; - + $sql.= " WHERE rowid = ".$this->rowid; dol_syslog(get_class($this)."::update", LOG_DEBUG); @@ -4468,7 +4481,7 @@ class FactureLigne extends CommonInvoiceLine /** * Returns situation_percent of the previous line. - * Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line. + * Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line. * * @param int $invoiceid Invoice id * @return int >= 0 diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 7b2d7076aca..198b08cb451 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -552,9 +552,9 @@ if ($action == 'addline' && $user->rights->facture->creer) if ($result > 0) { - // Define output language /*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','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 = '
' . $langs->trans("CantBeLessThanMinPercent") . '
'; + 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 ? -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_societe=''; @@ -1302,7 +1462,7 @@ else // Show object lines if (! empty($object->lines)) { - $disableedit=1; + //$disableedit=1; //$disablemove=1; $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 0); // No date selector for template invoice } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 989aa6a6692..0e9c6874103 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -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_vat != '') $sql.= natural_search('f.total_vat', $search_montant_vat, 1); if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); -if ($search_status != '' && $search_status >= 0) $sql.= " AND f.fk_statut = ".$db->escape($search_status); +if ($search_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 ($month > 0) { diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 00254b7440f..0fa260bbe34 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -1,7 +1,7 @@ * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2014 Juanjo Menent * @@ -483,20 +483,27 @@ if ($object->id > 0) // Add a withdraw request if ($object->statut > Facture::STATUS_DRAFT && $object->paye == 0 && $num == 0) { - if ($user->rights->prelevement->bons->creer) - { - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - } - else - { - print ''.$langs->trans("MakeWithdrawRequest").''; - } + if ($resteapayer > 0) + { + if ($user->rights->prelevement->bons->creer) + { + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + } + else + { + print ''.$langs->trans("MakeWithdrawRequest").''; + } + } + else + { + print ''.$langs->trans("MakeWithdrawRequest").''; + } } else { diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index ffb3b3631f1..1c167e04e95 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -824,7 +824,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) print ''; $total_ttc += $obj->total_ttc; - $total += $obj->total; + $total += $obj->total_ht; $totalam += $obj->am; $var=!$var; $i++; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 31d9e4d67c1..e130f1b726f 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -87,8 +87,6 @@ class BonPrelevement extends CommonObject $this->factures = array(); - $this->numero_national_emetteur = ""; - $this->methodes_trans = array(); $this->methodes_trans[0] = "Internet"; @@ -919,7 +917,10 @@ class BonPrelevement extends CommonObject $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); - $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 $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"); $this->id = $prev_id; - - $dir=$conf->prelevement->dir_output.'/receipts'; - $file=$filebonprev; - if (! is_dir($dir)) dol_mkdir($dir); } else { @@ -1018,7 +1015,6 @@ class BonPrelevement extends CommonObject $this->date_echeance = $datetimeprev; $this->reference_remise = $ref; - $this->numero_national_emetteur = $conf->global->PRELEVEMENT_NUMERO_NATIONAL_EMETTEUR; $this->raison_sociale = $conf->global->PRELEVEMENT_RAISON_SOCIALE; $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_iban = $conf->global->PRELEVEMENT_IBAN; $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; // Generation of SEPA file $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, $this->numero_national_emetteur); // Numero National d'emmetteur B3 + fputs($this->file, $this->emetteur_ics); // ICS // Date d'echeance C1 @@ -1611,7 +1607,7 @@ class BonPrelevement extends CommonObject 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 @@ -1778,7 +1774,7 @@ class BonPrelevement extends CommonObject 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 diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 3d6db94d801..6ca98728312 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -220,6 +220,25 @@ $dolibarr_main_authentication='dolibarr'; // $dolibarr_main_force_https='0'; +// dolibarr_main_prod +// When this parameter is defined, all errors messages are not reported. +// This feature exists for production usage to avoid to give any information to hackers. +// Default value: 0 +// Possible values: 0 or 1 +// Examples: +// $dolibarr_main_prod='0'; +// +$dolibarr_main_prod='0'; + +// $dolibarr_main_restrict_os_commands +// To restrict commands you can execute by the backup feature, enter allowed command here. +// Note: If you can, defining permission on OS linux (using SELinux for example) may be a better choice. +// Default value: 'mysqldump, mysql, pg_dump, pgrestore' +// Examples: +// $dolibarr_main_restrict_os_commands='mysqldump, /usr/local/bin/otherdumptool'; +// +$dolibarr_main_restrict_os_commands='mysqldump, mysql, pg_dump, pgrestore'; + // dolibarr_nocsrfcheck // This parameter can be used to disable CSRF protection. // This might be required if you access Dolibarr behind a proxy that make @@ -231,15 +250,11 @@ $dolibarr_main_force_https='0'; // $dolibarr_nocsrfcheck='0'; -// dolibarr_main_prod -// When this parameter is defined, all errors messages are not reported. -// This feature exists for production usage to avoid to give any information to hackers. -// Default value: 0 -// Possible values: 0 or 1 +// dolibarr_mailing_limit_sendbyweb +// Can set a limit for mailing send by web. Can be used for a restricted mode. +// Default value: 0 (use database value if exist) // Examples: -// $dolibarr_main_prod='0'; -// -$dolibarr_main_prod='0'; +// $dolibarr_mailing_limit_sendbyweb='0'; @@ -251,8 +266,6 @@ $dolibarr_main_prod='0'; // This parameter contains prefix of Dolibarr database. 'llx_' if not defined. // Examples: // $dolibarr_main_db_prefix='llx_'; -// -$dolibarr_main_db_prefix=''; // dolibarr_main_limit_users // Can set a limit on the number of users it will be possible to create @@ -261,12 +274,6 @@ $dolibarr_main_db_prefix=''; // Examples: // $dolibarr_main_limit_users='0'; -// dolibarr_mailing_limit_sendbyweb -// Can set a limit for mailing send by web. Can be used for a restricted mode. -// Default value: 0 (use database value if exist) -// Examples: -// $dolibarr_mailing_limit_sendbyweb='0'; - // dolibarr_strict_mode // Set this to 1 to enable the PHP strict mode. For dev environment only. // Default value: 0 (use database value if exist) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 47cde8e3f40..fd92db95dfc 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2098,6 +2098,8 @@ class Contrat extends CommonObject { global $user,$langs,$conf; + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; @@ -2116,8 +2118,6 @@ class Contrat extends CommonObject } } - - // Initialise parametres $this->id=0; $this->specimen=1; diff --git a/htdocs/core/actions_builddoc.inc.php b/htdocs/core/actions_builddoc.inc.php index 9502d723013..2e5d7d71252 100644 --- a/htdocs/core/actions_builddoc.inc.php +++ b/htdocs/core/actions_builddoc.inc.php @@ -51,15 +51,15 @@ if ($action == 'builddoc' && $permissioncreate) // Save last template used to generate document if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); - // Special case for invoices - if (property_exists($object, 'fk_bank')) - { + // Special case to force bank account + //if (property_exists($object, 'fk_bank')) + //{ if (GETPOST('fk_bank')) { // this field may come from an external module $object->fk_bank = GETPOST('fk_bank'); - } else { + } else if (! empty($object->fk_account)) { $object->fk_bank = $object->fk_account; } - } + //} $outputlangs = $langs; $newlang=''; diff --git a/htdocs/core/actions_printing.inc.php b/htdocs/core/actions_printing.inc.php index 5f04e42cc9b..061b98d1e9c 100644 --- a/htdocs/core/actions_printing.inc.php +++ b/htdocs/core/actions_printing.inc.php @@ -1,6 +1,6 @@ - * Copyright (C) 2014 Frederic France +/* Copyright (C) 2014-2016 Laurent Destailleur + * Copyright (C) 2014 Frederic France * * 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 @@ -44,7 +44,8 @@ if ($action == 'print_file' and $user->rights->printing->read) $printer = new $classname($db); //print '
'.print_r($printer, true).'
'; - if (! empty($conf->global->{$printer->active})) { + if (! empty($conf->global->{$printer->active})) + { $subdir=(GETPOST('printer', 'alpha')=='expedition'?'sending':''); $module = GETPOST('printer', 'alpha'); if ($module =='commande_fournisseur') { @@ -56,10 +57,11 @@ if ($action == 'print_file' and $user->rights->printing->read) //print '
'.print_r($printer->errors, true).'
'; setEventMessages($printer->error, $printer->errors, 'errors'); } - if ($ret==0) { + if ($ret==0) + { //print '
'.print_r($printer->errors, true).'
'; setEventMessages($printer->error, $printer->errors); - setEventMessages($langs->trans("FileWasSentToPrinter", basename(GETPOST('file'))).' '.$langs->trans("ViaModule").' '.$printer->name, null); + setEventMessages($langs->trans("FileWasSentToPrinter", basename(GETPOST('file'))).' '.$langs->transnoentitiesnoconv("ViaModule").' '.$printer->name, null); $printed++; } } diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 58c48d5b254..a5e6a29b50a 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -22,8 +22,6 @@ */ -// TODO Include this include file into all element pages allowing email sending - // $id must be defined // $actiontypecode must be defined // $paramname must be defined @@ -34,13 +32,15 @@ */ if (GETPOST('addfile')) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $trackid = GETPOST('trackid','aZ09'); + + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; // Set tmp user directory $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; + $upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path - dol_add_file_process($upload_dir_tmp,0,0); + dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, $trackid); $action='presend'; } @@ -49,33 +49,39 @@ if (GETPOST('addfile')) */ if (! empty($_POST['removedfile']) && empty($_POST['removAll'])) { + $trackid = GETPOST('trackid','aZ09'); + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; // Set tmp user directory $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; + $upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path - // TODO Delete only files that was uploaded from email form - dol_remove_file_process(GETPOST('removedfile','alpha'),0); + // TODO Delete only files that was uploaded from email form. This can be addressed by adding the trackid into the temp path then changing donotdeletefile to 2 instead of 1 to say "delete only if into temp dir" + // GETPOST('removedfile','alpha') is position of file into $_SESSION["listofpaths"...] array. + dol_remove_file_process(GETPOST('removedfile','alpha'), 0, 1, $trackid); // We do not delete because if file is the official PDF of doc, we don't want to remove it physically $action='presend'; } /* * Remove all files in email form */ - -if(! empty($_POST['removAll'])) +if (GETPOST('removAll')) { - $listofpaths=array(); + $trackid = GETPOST('trackid','aZ09'); + + $listofpaths=array(); $listofnames=array(); $listofmimes=array(); - if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]); - if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]); - if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); + $keytoavoidconflict = empty($trackid)?'':'-'.$trackid; + if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]); + if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]); + if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]); include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); - + $formmail->trackid = $trackid; + foreach($listofpaths as $key => $value) { $pathtodelete = $value; @@ -94,7 +100,9 @@ if(! empty($_POST['removAll'])) */ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removAll'] && ! $_POST['removedfile'] && ! $_POST['cancel'] && !$_POST['modelselected']) { - if($conf->dolimail->enabled) $langs->load("dolimail@dolimail"); + $trackid = GETPOST('trackid','aZ09'); + + if (! empty($conf->dolimail->enabled)) $langs->load("dolimail@dolimail"); $langs->load('mails'); $subject='';$actionmsg='';$actionmsg2=''; @@ -195,7 +203,10 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO if ($mode == 'emailfromproposal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)); if ($mode == 'emailfromorder') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO)); if ($mode == 'emailfrominvoice') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)); - + if ($mode == 'emailfromsupplierproposal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO)); + if ($mode == 'emailfromsupplierorder') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO)); + if ($mode == 'emailfromsupplierinvoice') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO)); + $deliveryreceipt = $_POST['deliveryreceipt']; if ($action == 'send' || $action == 'relance') @@ -215,13 +226,13 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO // Create form object include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); - + $formmail->trackid = $trackid; // $trackid must be defined + $attachedfiles=$formmail->get_attached_files(); $filepath = $attachedfiles['paths']; $filename = $attachedfiles['names']; $mimetype = $attachedfiles['mimes']; - $trackid = GETPOST('trackid','aZ09'); // Feature to push mail sent into Sent folder if (! empty($conf->dolimail->enabled)) @@ -270,7 +281,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid); if ($mailfile->error) { - $mesgs[]='
'.$mailfile->error.'
'; + setEventMessage($mailfile->error, 'errors'); + $action='presend'; } else { @@ -351,13 +363,6 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $action = 'presend'; } } - /* } - else - { - $langs->load("other"); - $mesgs[]='
'.$langs->trans('ErrorMailRecipientIsEmpty').'
'; - dol_syslog('Recipient email is empty'); - }*/ } else { diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 416975acfdb..f9200810bdd 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2015-2016 Laurent Destailleur * * 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 @@ -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)); } +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) { $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)); } @@ -114,11 +118,11 @@ if (! empty($conf->ficheinter->enabled) && empty($conf->global->MAIN_SEARCHFORM_ // HR 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) { - $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)); } diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index 1f5e8493d7b..973738fec11 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -167,13 +167,15 @@ class box_actions extends ModeleBoxes * * @param array $head Array with properties of box title * @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; parent::showBox($this->info_box_head, $this->info_box_contents); - if (! empty($conf->global->SHOW_DIALOG_HOMEPAGE)) + $out=''; + if (! empty($conf->global->SHOW_DIALOG_HOMEPAGE)) { $actioncejour=false; $contents=$this->info_box_contents; @@ -183,8 +185,8 @@ class box_actions extends ModeleBoxes $bcx[1] = 'class="box_impair"'; if ($contents[0][0]['text'] != $langs->trans("NoActionsToDo")) { - print '
trans("ActionsToDo").'">'; - print ''; + $out.= '
trans("ActionsToDo").'">'; + $out.= '
'; for ($line=0, $n=$nblines; $line < $n; $line++) { if (isset($contents[$line])) @@ -202,40 +204,45 @@ class box_actions extends ModeleBoxes $urlsoc=$contents[$line][3]['url']; $dateligne=$contents[$line][4]['text']; $percentage=$contents[$line][5]['text']; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + $out.= ''; + $out.= ''; + $out.= ''; + $out.= ''; + $out.= ''; + $out.= ''; + $out.= ''; } } - print '
'; - print img_object("",$logo); - print ''.$label.''.img_object("",$logosoc)." ".$nomsoc.''.$dateligne.''.$percentage.'
'; + $out.= img_object("",$logo); + $out.= ''.$label.''.img_object("",$logosoc)." ".$nomsoc.''.$dateligne.''.$percentage.'
'; + $out.= ''; } - print '
'; + $out.= ''; if ($actioncejour) { - print ''; + $out.= ''; } else { - print ''; + $out.= ''; } } + + if ($nooutput) return $out; + else print $out; + + return ''; } } diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index f7e09d33583..34666507488 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -455,10 +455,11 @@ class box_activity extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php index 88adb744ceb..e99a0b30387 100644 --- a/htdocs/core/boxes/box_bookmarks.php +++ b/htdocs/core/boxes/box_bookmarks.php @@ -135,11 +135,12 @@ class box_bookmarks extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index 24c940fb9ea..307dcc7cbfd 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -157,11 +157,12 @@ class box_clients extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index 6eb5006182c..7653206333d 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -176,11 +176,12 @@ class box_commandes extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @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); } } diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 178851466be..a6b8e2744a6 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -169,11 +169,12 @@ class box_comptes extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index a1fc2768ba1..45963af9bb1 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -83,7 +83,7 @@ class box_contacts extends ModeleBoxes $societestatic=new Societe($db); $line = 0; - while ($line < $num) + while ($line < $num) { $objp = $db->fetch_object($result); $datec=$db->jdate($objp->datec); @@ -100,7 +100,7 @@ class box_contacts extends ModeleBoxes $contactstatic->address = $objp->address; $contactstatic->zip = $objp->zip; $contactstatic->town = $objp->town; - + $societestatic->id = $objp->fk_soc; $societestatic->name = $objp->socname; $societestatic->name_alias = $objp->name_alias; @@ -108,7 +108,7 @@ class box_contacts extends ModeleBoxes $societestatic->code_fournisseur = $objp->code_fournisseur; $societestatic->client = $objp->client; $societestatic->fournisseur = $objp->fournisseur; - + $this->info_box_contents[$line][] = array( 'td' => 'align="left"', 'text' => $contactstatic->getNomUrl(1), @@ -131,7 +131,7 @@ class box_contacts extends ModeleBoxes 'text' => $contactstatic->getLibStatut(3), 'asis'=>1, ); - + $line++; } @@ -163,11 +163,12 @@ class box_contacts extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index 665bff4c6da..40cc8885f90 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -55,14 +55,14 @@ class box_contracts extends ModeleBoxes $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; - + $this->info_box_head = array('text' => $langs->trans("BoxTitleLastContracts",$max)); if ($user->rights->contrat->lire) { $contractstatic=new Contrat($db); $thirdpartytmp=new Societe($db); - + $sql = "SELECT s.nom as name, s.rowid as socid,"; $sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.fin_validite, c.date_cloture"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c"; @@ -83,8 +83,8 @@ class box_contracts extends ModeleBoxes $line = 0; $langs->load("contracts"); - - while ($line < $num) + + while ($line < $num) { $objp = $db->fetch_object($resql); $datec=$db->jdate($objp->datec); @@ -99,7 +99,7 @@ class box_contracts extends ModeleBoxes $thirdpartytmp->name = $objp->name; $thirdpartytmp->id = $objp->socid; - + // fin_validite is no more on contract but on services // if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->contrat->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); } @@ -157,11 +157,12 @@ class box_contracts extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @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); } } diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php index f1db35e1614..dbe71a6ca41 100644 --- a/htdocs/core/boxes/box_external_rss.php +++ b/htdocs/core/boxes/box_external_rss.php @@ -184,11 +184,12 @@ class box_external_rss extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @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); } } diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 7b5a01d6bca..22a90929a0b 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -180,11 +180,12 @@ class box_factures extends ModeleBoxes * * @param array $head Array with properties of box title * @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) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index 88b64947f05..b43d9cfc47b 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -189,11 +189,12 @@ class box_factures_fourn extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index 27441f22ea5..b3ca0fec031 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -186,11 +186,12 @@ class box_factures_fourn_imp extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index bcc26f60e4c..67c4d4dbfcc 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -182,11 +182,12 @@ class box_factures_imp extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index decf5e564f0..d57a2a991df 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -144,11 +144,12 @@ class box_ficheinter extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index e3e6061d803..ed3680af455 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -139,11 +139,12 @@ class box_fournisseurs extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @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); } } diff --git a/htdocs/core/boxes/box_goodcustomers.php b/htdocs/core/boxes/box_goodcustomers.php index 579df4762a0..56aa9097ac2 100644 --- a/htdocs/core/boxes/box_goodcustomers.php +++ b/htdocs/core/boxes/box_goodcustomers.php @@ -81,7 +81,7 @@ class box_goodcustomers extends ModeleBoxes if ($user->rights->societe->lire) { - + $sql = "SELECT s.rowid, s.nom as name, s.logo, s.code_client, s.code_fournisseur, s.client, s.fournisseur, s.tms as datem, s.status as status,"; $sql.= " count(*) as nbfact, sum(". $db->ifsql('f.paye=1','1','0').") as nbfactpaye"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f"; @@ -127,7 +127,7 @@ class box_goodcustomers extends ModeleBoxes 'td' => 'align="right"', 'text' => $nbfact.( $nbimpaye != 0 ? ' ('.$nbimpaye.')':'') ); - + $this->info_box_contents[$line][] = array( 'td' => 'align="right" width="18"', 'text' => $thirdpartystatic->LibStatut($objp->status,3) @@ -158,11 +158,12 @@ class box_goodcustomers extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 3848960e5e9..1b54d917d05 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -171,7 +171,7 @@ class box_graph_invoices_permonth extends ModeleBoxes if (! $mesg) { $langs->load("bills"); - + $px2->SetData($data2); unset($data2); $px2->SetPrecisionY(0); @@ -263,11 +263,12 @@ class box_graph_invoices_permonth extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 0931d2d05df..c7856d619f6 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -170,7 +170,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes if (! $mesg) { $langs->load("bills"); - + $px2->SetData($data2); unset($data2); $px2->SetPrecisionY(0); @@ -262,11 +262,12 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index 4f86dcd0b8b..4a0f0a7d5b1 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -90,7 +90,7 @@ class box_graph_orders_permonth extends ModeleBoxes if ($user->rights->commande->lire) { $langs->load("orders"); - + $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; $param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb'; $param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot'; @@ -263,11 +263,12 @@ class box_graph_orders_permonth extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 6df7d81766c..2ab14bb4502 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -89,7 +89,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes if ($user->rights->fournisseur->commande->lire) { $langs->load("orders"); - + $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; $param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb'; $param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot'; @@ -262,11 +262,12 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 46ddccc2a1d..48168eadb53 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -390,11 +390,12 @@ class box_graph_product_distribution extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index 8ef7b25969f..0ae61938ce7 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -264,11 +264,12 @@ class box_graph_propales_permonth extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index 9c166aac866..d5d8f1243f5 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -169,11 +169,12 @@ class box_members extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index c8ef1b5f558..5cce3254bfb 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -192,11 +192,12 @@ class box_produits extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 5a718b79696..4d79abd156b 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -199,11 +199,12 @@ class box_produits_alerte_stock extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 7d819ec0d2b..8733f3ed8ce 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -173,11 +173,12 @@ class box_project extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index c14cf07a51c..b0a1e4a3798 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -166,11 +166,12 @@ class box_propales extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @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); } } diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index 3895a27a9f1..40adb98b405 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -167,11 +167,12 @@ class box_prospect extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index 802dee8474f..b45bde124a3 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -64,7 +64,7 @@ class box_services_contracts extends ModeleBoxes $contractstatic=new Contrat($db); $contratlignestatic=new ContratLigne($db); $thirdpartytmp = new Societe($db); - + $sql = "SELECT s.nom as name, s.rowid as socid,"; $sql.= " c.rowid, c.ref, c.statut as contract_status,"; $sql.= " cd.rowid as cdid, cd.tms as datem, cd.statut, cd.label, cd.description, cd.product_type as type,"; @@ -103,14 +103,14 @@ class box_services_contracts extends ModeleBoxes $contratlignestatic->type=$objp->type; $contratlignestatic->product_id=$objp->product_id; $contratlignestatic->product_ref=$objp->product_ref; - + $contractstatic->statut=$objp->contract_status; $contractstatic->id=$objp->rowid; $contractstatic->ref=$objp->ref; - + $thirdpartytmp->name = $objp->name; $thirdpartytmp->id = $objp->socid; - + // Multilangs if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active { @@ -132,7 +132,7 @@ class box_services_contracts extends ModeleBoxes 'text' => $contratlignestatic->getNomUrl(1), 'asis' => 1 ); - + $this->info_box_contents[$i][] = array('td' => 'align="left"', 'text' => $contractstatic->getNomUrl(1), 'asis' => 1 @@ -175,11 +175,12 @@ class box_services_contracts extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index 296ef56af8a..29db63054e5 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -118,7 +118,7 @@ class box_services_expired extends ModeleBoxes $i++; } - if ($num==0) + if ($num==0) { $langs->load("contracts"); $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoExpiredServices")); @@ -147,11 +147,12 @@ class box_services_expired extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @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); } } diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 84521bf4ee0..1f0e1ece2ef 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -171,11 +171,12 @@ class box_supplier_orders extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines - * @return void - */ - function showBox($head = null, $contents = null) + * @param int $nooutput No print, only return string + * @return void + */ + 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); } } diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index d314af73cd1..29dd9390597 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -91,11 +91,11 @@ class box_task extends ModeleBoxes $sql.= $db->plimit($max, 0); $result = $db->query($sql); - if ($result) + if ($result) { $num = $db->num_rows($result); $i = 0; - while ($i < $num) + while ($i < $num) { $objp = $db->fetch_object($result); $this->info_box_contents[$i][] = array( @@ -137,10 +137,11 @@ class box_task extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @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); } } diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 7bc8672ddab..238aa8ab438 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -197,7 +197,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines * @param int $nooutput No print, only return string - * @return void + * @return string */ function showBox($head = null, $contents = null, $nooutput=0) { diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 1db31697bb8..563ec168d29 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -134,6 +134,13 @@ class CMailFile dol_syslog("CMailFile::CMailfile: MAIN_MAIL_SENDMODE=".$conf->global->MAIN_MAIL_SENDMODE." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, trackid=$trackid", LOG_DEBUG); dol_syslog("CMailFile::CMailfile: subject=$subject, deliveryreceipt=$deliveryreceipt, msgishtml=$msgishtml", LOG_DEBUG); + if (empty($subject)) + { + dol_syslog("CMailFile::CMailfile: Try to send an email with empty subject"); + $this->error='ErrorSubjectIsRequired'; + return; + } + // Detect if message is HTML (use fast method) if ($msgishtml == -1) { @@ -436,8 +443,7 @@ class CMailFile { // Send mail method not correctly defined // -------------------------------------- - - return 'Bad value for MAIN_MAIL_SENDMODE constant'; + $this->error = 'Bad value for MAIN_MAIL_SENDMODE constant'; } } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 15272a19d6c..71540cf16d7 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -444,7 +444,7 @@ abstract class CommonObject global $conf, $langs; $countriesusingstate=array('AU','US','IN','GB','ES','UK','TR'); // See also option MAIN_FORCE_STATE_INTO_ADDRESS - + $contactid=0; $thirdpartyid=0; if ($this->element == 'societe') @@ -461,12 +461,12 @@ abstract class CommonObject $contactid=$this->contact_id; $thirdpartyid=$object->fk_soc; } - + $out=''; - + $outdone=0; $coords = $this->getFullAddress(1,', '); - if ($coords) + if ($coords) { if (! empty($conf->use_javascript_ajax)) { @@ -481,7 +481,7 @@ abstract class CommonObject } if (! in_array($this->country_code,$countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS) // If MAIN_FORCE_STATE_INTO_ADDRESS is on, state is already returned previously with getFullAddress - && empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state) + && empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state) { $out.=($outdone?' - ':'').$this->state; $outdone++; @@ -512,15 +512,15 @@ abstract class CommonObject if (! empty($this->office_fax)) { $out.=dol_print_phone($this->fax,$this->country_code,$contactid,$thirdpartyid,'AC_FAX',' ','fax',$langs->trans("Fax")); $outdone++; } - + $out.='
'; $outdone=0; - if (! empty($this->email)) + if (! empty($this->email)) { $out.=dol_print_email($this->email,$this->id,$object->id,'AC_EMAIL',0,0,1); $outdone++; } - if (! empty($this->url)) + if (! empty($this->url)) { $out.=dol_print_url($this->url,'',0,1); $outdone++; @@ -531,12 +531,12 @@ abstract class CommonObject if ($this->skype) $out.=dol_print_skype($this->skype,$this->id,$object->id,'AC_SKYPE'); $outdone++; } - + $out.=''; - + return $out; } - + /** * Add a link between element $this->element and a contact * @@ -592,7 +592,7 @@ abstract class CommonObject } $datecreate = dol_now(); - + $this->db->begin(); // Insertion dans la base @@ -610,9 +610,9 @@ abstract class CommonObject if (! $notrigger) { $result=$this->call_trigger(strtoupper($this->element).'_ADD_CONTACT', $user); - if ($result < 0) - { - $this->db->rollback(); + if ($result < 0) + { + $this->db->rollback(); return -1; } } @@ -883,9 +883,9 @@ abstract class CommonObject if (empty($order)) $order='position'; if ($order == 'position') $order.=',code'; - + $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.= " WHERE tc.element='".$this->element."'"; if ($activeonly == 1) $sql.= " AND tc.active=1"; // only the active types @@ -1196,7 +1196,7 @@ abstract class CommonObject if (!empty($id) && !empty($field) && !empty($table)) { $sql = "SELECT ".$field." FROM ".MAIN_DB_PREFIX.$table; $sql.= " WHERE rowid = ".$id; - + dol_syslog(get_class($this).'::getValueFrom', LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -1428,7 +1428,7 @@ abstract class CommonObject if ($this->statut >= 0 || $this->element == 'societe') { $fieldname = 'multicurrency_code'; - + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql .= ' SET '.$fieldname.' = "'.$this->db->escape($code).'"'; $sql .= ' WHERE rowid='.$this->id; @@ -1436,10 +1436,10 @@ abstract class CommonObject if ($this->db->query($sql)) { $this->multicurrency_code = $code; - + list($fk_multicurrency, $rate) = MultiCurrency::getIdAndTxFromCode($this->db, $code); if ($rate) $this->setMulticurrencyRate($rate); - + return 1; } else @@ -1456,7 +1456,7 @@ abstract class CommonObject return -2; } } - + /** * Change the multicurrency rate * @@ -1469,7 +1469,7 @@ abstract class CommonObject if ($this->statut >= 0 || $this->element == 'societe') { $fieldname = 'multicurrency_tx'; - + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql .= ' SET '.$fieldname.' = '.$rate; $sql .= ' WHERE rowid='.$this->id; @@ -1477,11 +1477,11 @@ abstract class CommonObject if ($this->db->query($sql)) { $this->multicurrency_tx = $rate; - + // Update line price if (!empty($this->lines)) { - foreach ($this->lines as &$line) + foreach ($this->lines as &$line) { switch ($this->element) { case 'propal': @@ -1503,10 +1503,10 @@ abstract class CommonObject dol_syslog(get_class($this).'::setMulticurrencyRate no updateline defined', LOG_DEBUG); break; } - + } } - + return 1; } else @@ -2244,7 +2244,7 @@ abstract class CommonObject $this->total_localtax1 += $obj->total_localtax1; $this->total_localtax2 += $obj->total_localtax2; $this->total_ttc += $obj->total_ttc; - + if (! isset($total_ht_by_vats[$obj->vatrate])) $total_ht_by_vats[$obj->vatrate]=0; if (! isset($total_tva_by_vats[$obj->vatrate])) $total_tva_by_vats[$obj->vatrate]=0; if (! isset($total_ttc_by_vats[$obj->vatrate])) $total_ttc_by_vats[$obj->vatrate]=0; @@ -2290,12 +2290,12 @@ abstract class CommonObject $this->total_ttc -= $sit->total_ttc; } } - + // Multicurrency $this->multicurrency_total_ht += $this->total_ht * $multicurrency_tx; $this->multicurrency_total_tva += $this->total_tva * $multicurrency_tx; $this->multicurrency_total_ttc += $this->total_ttc * $multicurrency_tx; - + $this->db->free($resql); // Now update global field total_ht, total_ttc and tva @@ -2398,8 +2398,8 @@ abstract class CommonObject * - all parameters empty -> we look all link to current object (current object can be source or target) * - one couple id+type is provided -> this will set $justsource or $justtarget * - one couple id+type is provided and other type is provided -> this will set $justsource or $justtarget + criteria on other type - * - * + * + * * @param int $sourceid Object source id (if not defined, id of object) * @param string $sourcetype Object source type (if not defined, element name of object) * @param int $targetid Object target id (if not defined, id of object) @@ -2508,7 +2508,7 @@ abstract class CommonObject { // Parse element/subelement (ex: project_task) $module = $element = $subelement = $objecttype; - if ($objecttype != 'supplier_proposal' && $objecttype != 'order_supplier' && $objecttype != 'invoice_supplier' + if ($objecttype != 'supplier_proposal' && $objecttype != 'order_supplier' && $objecttype != 'invoice_supplier' && preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs)) { $module = $element = $regs[1]; @@ -2541,15 +2541,13 @@ abstract class CommonObject else if ($objecttype == 'fichinter') { $classpath = 'fichinter/class'; $subelement = 'fichinter'; $module = 'ficheinter'; } - - // TODO ajout temporaire - MAXIME MANGIN - else if ($objecttype == 'contratabonnement') { - $classpath = 'contrat/class'; $subelement = 'contrat'; $module = 'contratabonnement'; + else if ($objecttype == 'subscription') { + $classpath = 'adherents/class'; $module = 'adherent'; } // Set classfile $classfile = strtolower($subelement); $classname = ucfirst($subelement); - + if ($objecttype == 'invoice_supplier') { $classfile = 'fournisseur.facture'; $classname = 'FactureFournisseur'; } @@ -2562,7 +2560,10 @@ abstract class CommonObject else if ($objecttype == 'facturerec') { $classfile = 'facture-rec'; $classname = 'FactureRec'; } - + else if ($objecttype == 'subscription') { + $classfile = 'cotisation'; $classname = 'Cotisation'; + } + // Here $module, $classfile and $classname are set if ($conf->$module->enabled && (($element != $this->element) || $alsosametype)) { @@ -2935,7 +2936,7 @@ abstract class CommonObject return price2num($total_discount); } - + /** * Return into unit=0, the calculated total of weight and volume of all lines * qty * Calculate by adding weight and volume of each product line, so properties ->volume/volume_units/weight/weight_units must be loaded on line. @@ -2950,13 +2951,13 @@ abstract class CommonObject $totalVolume = ''; $totalOrdered = ''; // defined for shipment only $totalToShip = ''; // defined for shipment only - + foreach ($this->lines as $line) { - + $totalOrdered+=$line->qty_asked; // defined for shipment only $totalToShip+=$line->qty_shipped; // defined for shipment only - + // Define qty, weight, volume, weight_units, volume_units if ($this->element == 'shipping') $qty=$line->qty_shipped; // for shipments else $qty=$line->qty; @@ -2964,12 +2965,12 @@ abstract class CommonObject $volume=$line->volume; $weight_units=$line->weight_units; $volume_units=$line->volume_units; - + $weightUnit=0; $volumeUnit=0; if (! empty($weight_units)) $weightUnit = $weight_units; if (! empty($volume_units)) $volumeUnit = $volume_units; - + //var_dump($line->volume_units); if ($weight_units < 50) // >50 means a standard unit (power of 10 of official unit) > 50 means an exotic unit (like inch) { @@ -2992,11 +2993,11 @@ abstract class CommonObject $totalVolume += $volume * $qty; // This may be wrong if we mix different units } } - + return array('weight'=>$totalWeight, 'volume'=>$totalVolume, 'ordered'=>$totalOrdered, 'toship'=>$totalToShip); - } - - + } + + /** * Set extra parameters * @@ -3266,7 +3267,7 @@ abstract class CommonObject // Multicurrency if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('PriceUHTCurrency').''; - + if ($inputalsopricewithtax) print ''.$langs->trans('PriceUTTC').''; // Qty @@ -3429,7 +3430,7 @@ abstract class CommonObject $text.= ' - '.(! empty($line->label)?$line->label:$label); $description.=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($line->description)); // Description is what to show on popup. We shown nothing if already into desc. } - + $line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU'); // Output template part (modules that overwrite templates must declare this into descriptor) @@ -3870,7 +3871,7 @@ abstract class CommonObject return -1; } } - + // We save charset_output to restore it because write_file can change it if needed for // output format that does not support UTF8. $sav_charset_output=$outputlangs->charset_output; @@ -3934,13 +3935,13 @@ abstract class CommonObject /* For default values */ /** - * Return the default value to use for a field when showing the create form of object. + * Return the default value to use for a field when showing the create form of object. * Return values in this order: * 1) If parameter is available into POST, we return it first. * 2) If not but an alternate value was provided as parameter of function, we return it. - * 3) If not but a constant $conf->global->OBJECTELEMENT_FIELDNAME is set, we return it (It is better to use the dedicated table). + * 3) If not but a constant $conf->global->OBJECTELEMENT_FIELDNAME is set, we return it (It is better to use the dedicated table). * 4) Return value found into database (TODO No yet implemented) - * + * * @param string $fieldname Name of field * @param string $alternatevalue Alternate value to use * @return string|string[] Default value (can be an array if the GETPOST return an array) @@ -3951,27 +3952,27 @@ abstract class CommonObject // If param here has been posted, we use this value first. if (isset($_POST[$fieldname])) return GETPOST($fieldname, 2); - + if (isset($alternatevalue)) return $alternatevalue; - + $newelement=$this->element; if ($newelement == 'facture') $newelement='invoice'; if ($newelement == 'commande') $newelement='order'; - if (empty($newelement)) + if (empty($newelement)) { dol_syslog("Ask a default value using common method getDefaultCreateValueForField on an object with no property ->element defined. Return empty string.", LOG_WARNING); return ''; } - + $keyforfieldname=strtoupper($newelement.'_DEFAULT_'.$fieldname); //var_dump($keyforfieldname); if (isset($conf->global->$keyforfieldname)) return $conf->global->$keyforfieldname; - - // TODO Ad here a scan into table llx_overwrite_default with a filter on $this->element and $fieldname - + + // TODO Ad here a scan into table llx_overwrite_default with a filter on $this->element and $fieldname + } - - + + /* For triggers */ @@ -3988,7 +3989,7 @@ abstract class CommonObject function call_trigger($trigger_name, $user) { global $langs,$conf; - + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); $result=$interface->run_triggers($trigger_name,$this,$user,$langs,$conf); @@ -3997,14 +3998,13 @@ abstract class CommonObject { if (!empty($this->errors)) { - $this->errors=array_merge($this->errors,$interface->errors); + $this->errors=array_unique(array_merge($this->errors,$interface->errors)); // We use array_unique because when a trigger call another trigger on same object, this->errors is added twice. } else { $this->errors=$interface->errors; } } - return $result; } @@ -4171,7 +4171,7 @@ abstract class CommonObject { $res=$object->fetch(0,$value); if ($res > 0) $this->array_options[$key]=$object->id; - else + else { $this->error="Ref '".$value."' for object '".$object->element."' not found"; $this->db->rollback(); @@ -4235,7 +4235,7 @@ abstract class CommonObject } else return 0; } - + /** * Update an exta field value for the current object. * Data to describe values to insert/update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...) @@ -4300,7 +4300,7 @@ abstract class CommonObject } break; } - + $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET ".$key."='".$this->db->escape($this->array_options["options_".$key])."'"; $sql .= " WHERE fk_object = ".$this->id; @@ -4478,7 +4478,7 @@ abstract class CommonObject * @param int $origin_id Old thirdparty id (the thirdparty to delete) * @param int $dest_id New thirdparty id (the thirdparty that will received element of the other) * @param string[] $tables Tables that need to be changed - * @param int $ignoreerrors Ignore errors. Return true even if errors. We need this when replacement can fails like for categories (categorie of old thirdparty may already exists on new one) + * @param int $ignoreerrors Ignore errors. Return true even if errors. We need this when replacement can fails like for categories (categorie of old thirdparty may already exists on new one) * @return bool */ public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables, $ignoreerrors=0) @@ -4487,9 +4487,9 @@ abstract class CommonObject { $sql = 'UPDATE '.MAIN_DB_PREFIX.$table.' SET fk_soc = '.$dest_id.' WHERE fk_soc = '.$origin_id; - 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(); return false; } @@ -4497,26 +4497,26 @@ abstract class CommonObject return true; } - + /** * Get buy price to use for margin calculation. This function is called when buy price is unknown. * set buy price = sell price if ForceBuyingPriceIfNull configured, * else if calculation MARGIN_TYPE = 'costprice' and costprice is defined, use costprice as buyprice * else if calculation MARGIN_TYPE = 'pmp' and pmp is calculated, use pmp as buyprice * else set min buy price as buy price - * + * * @param float $unitPrice product unit price * @param float $discountPercent line discount percent * @param int $fk_product product id * * @return float <0 if ko, buyprice if ok */ - public function defineBuyPrice($unitPrice = 0, $discountPercent = 0, $fk_product = 0) + public function defineBuyPrice($unitPrice = 0, $discountPercent = 0, $fk_product = 0) { global $conf; - + $buyPrice = 0; - + if (($unitPrice > 0) && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) // In most cases, test here is false { $buyPrice = $unitPrice * (1 - $discountPercent / 100); @@ -4560,7 +4560,7 @@ abstract class CommonObject $buyPrice = $product->pmp; } } - + if (empty($buyPrice) && isset($conf->global->MARGIN_TYPE) && in_array($conf->global->MARGIN_TYPE, array('1','pmp','costprice'))) { require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 35b0d4024ec..4002f437ede 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -429,7 +429,7 @@ class Conf $this->liste_limit=$this->global->MAIN_SIZE_LISTE_LIMIT; // conf->product->limit_size = constante de taille maximale des select de produit - if (! isset($this->global->PRODUIT_LIMIT_SIZE)) $this->global->PRODUIT_LIMIT_SIZE=100; + if (! isset($this->global->PRODUIT_LIMIT_SIZE)) $this->global->PRODUIT_LIMIT_SIZE=1000; $this->product->limit_size=$this->global->PRODUIT_LIMIT_SIZE; // conf->theme et $this->css diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 283d189377c..1a362d143dc 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -633,7 +633,8 @@ class ExtraFields } 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; @@ -793,11 +794,7 @@ class ExtraFields // 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'); - if (count($InfoFieldList) > 3 && ! empty($InfoFieldList[3])) - { - list($parentName, $parentField) = explode('|', $InfoFieldList[3]); - $keyList.= ', '.$parentField; - } + if (count($InfoFieldList) > 4 && ! empty($InfoFieldList[4])) { if (strpos($InfoFieldList[4], 'extra.') !== false) @@ -807,6 +804,11 @@ class ExtraFields $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]); if (is_array($fields_label)) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 484b6518f77..1a7425b0a55 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2010-2016 Laurent Destailleur * Copyright (C) 2010-2014 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent * @@ -87,8 +87,7 @@ class HookManager { if (is_array($hooks)) $arrayhooks=$hooks; // New system else $arrayhooks=explode(':',$hooks); // Old system (for backward compatibility) - - if (in_array($context,$arrayhooks)) // We instantiate action class only if hook is required + if (in_array($context,$arrayhooks) || in_array('all',$arrayhooks)) // We instantiate action class only if hook is required { $path = '/'.$module.'/class/'; $actionfile = 'actions_'.$module.'.class.php'; @@ -143,6 +142,7 @@ class HookManager 'formObjectOptions', 'formattachOptions', 'formBuilddocLineOptions', + 'getIdProfUrl', 'moveUploadedFile', 'pdf_build_address', '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); } } - diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 19c779dc2d2..507f45a12f8 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2737,12 +2737,12 @@ class Form /** - * Retourne la liste des types de paiements possibles + * Return list of payment modes * * @param string $selected Id du type de paiement pre-selectionne * @param string $htmlname Nom de la zone select - * @param string $filtertype Pour filtre - * @param int $addempty Ajoute entree vide + * @param int $filtertype Not used + * @param int $addempty Add an empty entry * @return void */ function select_conditions_paiements($selected='',$htmlname='condid',$filtertype=-1,$addempty=0) @@ -5109,7 +5109,7 @@ class Form * @param int $id Id of object * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact'). Old mode (0, 1, 2, ...) is deprecated. * @param int $rendermode 0=Default, use multiselect. 1=Emulate multiselect (recommended) - * @return mixed Array of category objects or < 0 if KO + * @return string String with categories */ function showCategories($id, $type, $rendermode=0) { @@ -5170,7 +5170,7 @@ class Form { $num = count($object->linkedObjects); $numoutput=0; - + foreach($object->linkedObjects as $objecttype => $objects) { $tplpath = $element = $subelement = $objecttype; @@ -5217,7 +5217,10 @@ class Form else if ($objecttype == 'expensereport') { $tplpath = 'expensereport'; } - + else if ($objecttype == 'subscription') { + $tplpath = 'adherents'; + } + global $linkedObjectBlock; $linkedObjectBlock = $objects; @@ -5225,7 +5228,7 @@ class Form { $numoutput++; - echo '
'; + print '
'; print load_fiche_titre($langs->trans('RelatedObjects'), '', ''); print ''; @@ -5579,10 +5582,11 @@ class Form * @param string $moreparam More param to add in nav link url. * @param int $nodbprefix Do not include DB prefix to forge table name * @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 */ - 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; @@ -5601,7 +5605,7 @@ class Form //print "xx".$previous_ref."x".$next_ref; $ret.='
'; - $ret.='
'.$morehtmlleft.'
'; + if ($morehtmlleft) $ret.='
'.$morehtmlleft.'
'; $ret.='
'; @@ -5621,6 +5625,8 @@ class Form } $ret.='
'; + if ($morehtmlright) $ret.='
'.$morehtmlright.'
'; + if ($previous_ref || $next_ref || $morehtml) { $ret.=''; } - if ($morehtmlright) $ret.='
'.$morehtmlright.'
'; + if ($morehtmlstatus) $ret.='
'.$morehtmlstatus.'
'; $ret.='
'; return $ret; diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 17b7eeb192f..33393f1ef46 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -124,7 +124,7 @@ class FormAdmin * @param string $htmlname Name of html select * @param array $dirmenuarray Array of directories to scan * @param string $moreattrib More attributes on html select tag - * @return void + * @return integer|null */ function select_menu($selected, $htmlname, $dirmenuarray, $moreattrib='') { diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 0f6edbcfd15..05bbbd941d9 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -204,7 +204,7 @@ class FormCompany * Ainsi les liens avec les departements se font sur un departement independemment de son nom. * * @param string $selected Code state preselected (mus be state id) - * @param string $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show + * @param integer $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show * @param string $htmlname Id of department * @return string String with HTML select * @see select_country diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index 0169f5ae811..80b618b8804 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -50,7 +50,7 @@ class FormContract * @param string $htmlname Nom de la zone html * @param int $maxlength Maximum length of label * @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) { @@ -137,4 +137,32 @@ class FormContract 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 ''; + print ''; + print ''; + print '
'; + print ''; + print ''; + print '
'; + $this->select_contract($socid, $selected, $htmlname, $maxlength, $showempty); + print '
'; + } + } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 8a259ce2e57..f4163a889f0 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2014 Marcos García * Copyright (C) 2015 Bahfir Abbes + * Copyright (C) 2016 Ferran Marcet * 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 @@ -577,7 +578,7 @@ class FormFile $file_list=dol_dir_list($filedir,'files',0,'','(\.meta|_preview\.png)$','date',SORT_DESC); // Show title of array if not already shown - if ((! empty($file_list) || preg_match('/^massfilesarea', $modulepart)) && ! $headershown) + if ((! empty($file_list) || preg_match('/^massfilesarea/', $modulepart)) && ! $headershown) { $headershown=1; $out.= '
'.$titletoshow.'
'; @@ -687,7 +688,7 @@ class FormFile * * @param string $modulepart propal, facture, facture_fourn, ... * @param string $modulesubdir Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module. - * @param string $filedir Directory to scan + * @param string $filedir Full path to directory to scan * @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 */ @@ -720,9 +721,6 @@ class FormFile if ($modulepart == 'export') { $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 $out.= 'user->dir_output."/".$user->id; - $upload_dir = $vardir.'/temp/'; + $upload_dir = $vardir.'/temp/'; // TODO Add $keytoavoidconflict in upload_dir path if (is_dir($upload_dir)) dol_delete_dir_recursive($upload_dir); - unset($_SESSION["listofpaths"]); - unset($_SESSION["listofnames"]); - unset($_SESSION["listofmimes"]); + $keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined + unset($_SESSION["listofpaths".$keytoavoidconflict]); + unset($_SESSION["listofnames".$keytoavoidconflict]); + unset($_SESSION["listofmimes".$keytoavoidconflict]); } /** @@ -153,17 +154,19 @@ class FormMail extends Form $listofpaths=array(); $listofnames=array(); $listofmimes=array(); - if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]); - if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]); - if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); + + $keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined + if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]); + if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]); + if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]); if (! in_array($file,$listofnames)) { $listofpaths[]=$path; $listofnames[]=$file; $listofmimes[]=$type; - $_SESSION["listofpaths"]=join(';',$listofpaths); - $_SESSION["listofnames"]=join(';',$listofnames); - $_SESSION["listofmimes"]=join(';',$listofmimes); + $_SESSION["listofpaths".$keytoavoidconflict]=join(';',$listofpaths); + $_SESSION["listofnames".$keytoavoidconflict]=join(';',$listofnames); + $_SESSION["listofmimes".$keytoavoidconflict]=join(';',$listofmimes); } } @@ -178,17 +181,19 @@ class FormMail extends Form $listofpaths=array(); $listofnames=array(); $listofmimes=array(); - if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]); - if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]); - if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); + + $keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined + if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]); + if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]); + if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]); if ($keytodelete >= 0) { unset ($listofpaths[$keytodelete]); unset ($listofnames[$keytodelete]); unset ($listofmimes[$keytodelete]); - $_SESSION["listofpaths"]=join(';',$listofpaths); - $_SESSION["listofnames"]=join(';',$listofnames); - $_SESSION["listofmimes"]=join(';',$listofmimes); + $_SESSION["listofpaths".$keytoavoidconflict]=join(';',$listofpaths); + $_SESSION["listofnames".$keytoavoidconflict]=join(';',$listofnames); + $_SESSION["listofmimes".$keytoavoidconflict]=join(';',$listofmimes); //var_dump($_SESSION['listofpaths']); } } @@ -203,9 +208,11 @@ class FormMail extends Form $listofpaths=array(); $listofnames=array(); $listofmimes=array(); - if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]); - if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]); - if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); + + $keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined + if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]); + if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]); + if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]); return array('paths'=>$listofpaths, 'names'=>$listofnames, 'mimes'=>$listofmimes); } @@ -260,9 +267,10 @@ class FormMail extends Form $listofpaths=array(); $listofnames=array(); $listofmimes=array(); - if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]); - if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]); - if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); + $keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined + if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]); + if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]); + if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]); // Define output language $outputlangs = $langs; @@ -327,7 +335,7 @@ class FormMail extends Form ))) { $out.= '
'."\n"; - $out.= $langs->trans('SelectMailModel').': '; + $out.= $langs->trans('SelectMailModel').': '; // Do not put disabled on option, it is already on select and it makes chrome crazy. if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); $out.= '   '; $out.= ''; @@ -770,9 +778,10 @@ class FormMail extends Form * @param string $user Use template public or limited to this user * @param Translate $outputlangs Output lang object * @param int $id Id template to find + * @param int $active 1=Only active template, 0=Only disabled, -1=All * @return array array('topic'=>,'content'=>,..) */ - private function getEMailTemplate($db, $type_template, $user, $outputlangs,$id=0) + private function getEMailTemplate($db, $type_template, $user, $outputlangs, $id=0, $active=1) { $ret=array(); @@ -781,6 +790,7 @@ class FormMail extends Form $sql.= " WHERE type_template='".$db->escape($type_template)."'"; $sql.= " AND entity IN (".getEntity("c_email_templates").")"; $sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")"; + if ($active >= 0) $sql.=" AND active = ".$active; if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')"; if (!empty($id)) $sql.= " AND rowid=".$id; $sql.= $db->order("lang,label","ASC"); @@ -870,9 +880,10 @@ class FormMail extends Form * @param string $type_template Get message for key module * @param string $user Use template public or limited to this user * @param Translate $outputlangs Output lang object - * @return int <0 if KO, + * @param int $active 1=Only active template, 0=Only disabled, -1=All + * @return int <0 if KO, nb of records found if OK */ - public function fetchAllEMailTemplate($type_template, $user, $outputlangs) + public function fetchAllEMailTemplate($type_template, $user, $outputlangs, $active=1) { $ret=array(); @@ -881,6 +892,7 @@ class FormMail extends Form $sql.= " WHERE type_template='".$this->db->escape($type_template)."'"; $sql.= " AND entity IN (".getEntity("c_email_templates").")"; $sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")"; + if ($active >= 0) $sql.=" AND active = ".$active; if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')"; $sql.= $this->db->order("position,lang,label","ASC"); //print $sql; @@ -961,7 +973,7 @@ class FormMail extends Form // For mass emailing, we have different keys $vars=array( '__ID__' => 'IdRecord', - '__EMAIL__' => 'EMail', + '__EMAIL__' => 'EMailRecipient', '__LASTNAME__' => 'Lastname', '__FIRSTNAME__' => 'Firstname', '__MAILTOEMAIL__' => 'TagMailtoEmail', diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index f160e4cd500..d2ad0a6f1ab 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -464,12 +464,14 @@ class FormProjets $sql = "SELECT t.id as rowid, t.label as ref"; $projectkey="fk_project"; break; - case "expensereport_det": + case "expensereport": return ''; + case "expensereport_det": /*$sql = "SELECT rowid, '' as ref"; // table is llx_expensereport_det $projectkey="fk_projet"; break;*/ - case "commande": + return ''; + case "commande": case "contrat": case "fichinter": $sql = "SELECT t.rowid, t.ref"; diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php index 1ac219029fd..029aaef1116 100644 --- a/htdocs/core/class/interfaces.class.php +++ b/htdocs/core/class/interfaces.class.php @@ -191,10 +191,12 @@ class Interfaces if ($result < 0) { // Action KO + //dol_syslog("Error in trigger ".$action." - Nb of error string returned = ".count($objMod->errors), LOG_ERR); $nbtotal++; $nbko++; if (! empty($objMod->errors)) $this->errors=array_merge($this->errors,$objMod->errors); else if (! empty($objMod->error)) $this->errors[]=$objMod->error; + //dol_syslog("Error in trigger ".$action." - Nb of error string returned = ".count($this->errors), LOG_ERR); } } else @@ -205,7 +207,7 @@ class Interfaces if ($nbko) { - dol_syslog(get_class($this)."::run_triggers action=".$action." Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko, LOG_ERR); + dol_syslog(get_class($this)."::run_triggers action=".$action." Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko." - Nb of error string returned in this->errors = ".count($this->errors), LOG_ERR); return -$nbko; } else diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index c0757de2d6b..9ca6196b018 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -161,13 +161,14 @@ class Translate { 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. // Check parameters if (empty($domain)) { dol_print_error('',get_class($this)."::Load ErrorWrongParameters"); - exit; + return -1; } if ($this->defaultlang == 'none_NONE') return 0; // Special language code to not translate keys @@ -241,7 +242,7 @@ class Translate $tmparray=dol_getcache($usecachekey); 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"; //var_dump($this->tab_translate); if ($alt == 2) $fileread=1; @@ -261,7 +262,8 @@ class Translate { $tab=explode('=',$line,2); $key=trim($tab[0]); - //print "Domain=$domain, found a string for $tab[0] with value $tab[1]
"; + //if ($domain == 'orders') print "Domain=$domain, found a string for $tab[0] with value $tab[1]. Currently in cache ".$this->tab_translate[$key]."
"; + //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]."
"; 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])); @@ -278,6 +280,7 @@ class Translate else { $this->tab_translate[$key]=$value; + //if ($domain == 'orders') print "$tab[0] value $value
"; if ($usecachekey) $tabtranslatedomain[$key]=$value; // To save lang content in cache } } diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index c8b72ebcdd9..5a9a446596f 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -44,7 +44,7 @@ class DoliDBPgsql extends DoliDB //! Collate used to force collate when creating database var $forcecollate=''; // Can't be static as it may be forced with a dynamic value //! Version min database - const VERSIONMIN='8.4.0'; // Version min database + const VERSIONMIN='9.0.0'; // Version min database /** @var resource Resultset of last query */ private $_results; @@ -163,10 +163,13 @@ class DoliDBPgsql extends DoliDB } if ($line != "") { - // group_concat support (PgSQL >= 9.1) - $line = preg_replace('/GROUP_CONCAT/i', 'STRING_AGG', $line); + // group_concat support (PgSQL >= 9.0) + // Replace group_concat(x) or group_concat(x SEPARATOR ',') with string_agg(x, ',') + $line = preg_replace('/GROUP_CONCAT/i', 'STRING_AGG', $line); $line = preg_replace('/ SEPARATOR/i', ',', $line); - + $line = preg_replace('/STRING_AGG\(([^,\)]+)\)/i', 'STRING_AGG(\\1, \',\')', $line); + //print $line."\n"; + if ($type == 'auto') { if (preg_match('/ALTER TABLE/i',$line)) $type='dml'; diff --git a/htdocs/core/filemanagerdol/browser/default/browser.php b/htdocs/core/filemanagerdol/browser/default/browser.php index 15e44621bcf..f8262998049 100644 --- a/htdocs/core/filemanagerdol/browser/default/browser.php +++ b/htdocs/core/filemanagerdol/browser/default/browser.php @@ -133,26 +133,26 @@ oConnector.CheckError = function( responseXml ) switch ( iErrorNumber ) { - case 0 : - break ; - case 1 : // Custom error. Message placed in the "text" attribute. + case 0: + break; + case 1: // Custom error. Message placed in the "text" attribute. alert( oErrorNode.attributes.getNamedItem('text').value ); - break ; - case 101 : + break; + case 101: alert( 'Folder already exists' ); - break ; - case 102 : + break; + case 102: alert( 'Invalid folder name' ); - break ; - case 103 : + break; + case 103: alert( 'You have no permissions to create the folder' ); - break ; - case 110 : + break; + case 110: alert( 'Unknown error creating folder' ); - break ; - default : + break; + default: alert( 'Error on your request. Error number: ' + iErrorNumber ); - break ; + break; } } return iErrorNumber ; diff --git a/htdocs/core/filemanagerdol/browser/default/frmcreatefolder.php b/htdocs/core/filemanagerdol/browser/default/frmcreatefolder.php index 44b00b2154c..6f90c0c36ad 100644 --- a/htdocs/core/filemanagerdol/browser/default/frmcreatefolder.php +++ b/htdocs/core/filemanagerdol/browser/default/frmcreatefolder.php @@ -91,24 +91,24 @@ function CreateFolderCallBack( fckXml ) switch ( iErrorNumber ) { - case 0 : + case 0: window.parent.frames['frmResourcesList'].Refresh(); - break ; - case 101 : + break; + case 101: alert( 'Folder already exists' ); - break ; - case 102 : + break; + case 102: alert( 'Invalid folder name' ); - break ; - case 103 : + break; + case 103: alert( 'You have no permissions to create the folder' ); - break ; - case 110 : + break; + case 110: alert( 'Unknown error creating folder' ); - break ; - default : + break; + default: alert( 'Error creating folder. Error number: ' + iErrorNumber ); - break ; + break; } */ } diff --git a/htdocs/core/filemanagerdol/browser/default/frmupload.php b/htdocs/core/filemanagerdol/browser/default/frmupload.php index dd58eded713..10575586cec 100644 --- a/htdocs/core/filemanagerdol/browser/default/frmupload.php +++ b/htdocs/core/filemanagerdol/browser/default/frmupload.php @@ -95,22 +95,22 @@ function OnUploadCompleted( errorNumber, data ) switch ( errorNumber ) { - case 0 : + case 0: window.parent.frames['frmResourcesList'].Refresh(); - break ; - case 1 : // Custom error. + break; + case 1: // Custom error. alert( data ); - break ; - case 201 : + break; + case 201: window.parent.frames['frmResourcesList'].Refresh(); alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + data + '"' ); - break ; - case 202 : + break; + case 202: alert( 'Invalid file' ); - break ; - default : + break; + default: alert( 'Error on file upload. Error number: ' + errorNumber ); - break ; + break; } } diff --git a/htdocs/core/filemanagerdol/connectors/php/commands.php b/htdocs/core/filemanagerdol/connectors/php/commands.php index 3f02b9f39fb..5c8e76a9522 100644 --- a/htdocs/core/filemanagerdol/connectors/php/commands.php +++ b/htdocs/core/filemanagerdol/connectors/php/commands.php @@ -160,14 +160,14 @@ function CreateFolder( $resourceType, $currentFolder ) switch ( $sErrorMsg ) { - case '' : + case '': $sErrorNumber = '0' ; - break ; + break; case 'Invalid argument' : case 'No such file or directory' : $sErrorNumber = '102' ; // Path too long. break ; - default : + default: $sErrorNumber = '110' ; break ; } diff --git a/htdocs/core/lib/emailing.lib.php b/htdocs/core/lib/emailing.lib.php index 443b9b6156a..9ddd05f7faa 100644 --- a/htdocs/core/lib/emailing.lib.php +++ b/htdocs/core/lib/emailing.lib.php @@ -39,14 +39,14 @@ function emailing_prepare_head(Mailing $object) $head[$h][2] = 'card'; $h++; - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->mailing->mailing_advance->recipient)) + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->mailing->mailing_advance->recipient)) { $head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$object->id; $head[$h][1] = $langs->trans("MailRecipients"); $head[$h][2] = 'targets'; $h++; - - if (! empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR)) // Still need debug + + if (! empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR)) { $head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id; $head[$h][1] = $langs->trans("MailAdvTargetRecipients"); @@ -54,7 +54,7 @@ function emailing_prepare_head(Mailing $object) $h++; } } - + $head[$h][0] = DOL_URL_ROOT."/comm/mailing/info.php?id=".$object->id; $head[$h][1] = $langs->trans("Info"); $head[$h][2] = 'info'; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 5db75628b1e..7ce5b18456b 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1392,12 +1392,14 @@ function dol_meta_create($object) /** - * Init $_SESSION with uploaded files + * Scan a directory and init $_SESSION to manage uploaded files with list of all found files. + * Note: Only email module seems to use this. Other feature initialize the $_SESSION doing $formmail->clear_attached_files(); $formmail->add_attached_files() * * @param string $pathtoscan Path to scan + * @param string $trackid Track id (used to prefix name of session vars to avoid conflict) * @return void */ -function dol_init_file_process($pathtoscan='') +function dol_init_file_process($pathtoscan='', $trackid='') { $listofpaths=array(); $listofnames=array(); @@ -1413,9 +1415,10 @@ function dol_init_file_process($pathtoscan='') $listofmimes[]=dol_mimetype($val['name']); } } - $_SESSION["listofpaths"]=join(';',$listofpaths); - $_SESSION["listofnames"]=join(';',$listofnames); - $_SESSION["listofmimes"]=join(';',$listofmimes); + $keytoavoidconflict = empty($trackid)?'':'-'.$trackid; + $_SESSION["listofpaths".$keytoavoidconflict]=join(';',$listofpaths); + $_SESSION["listofnames".$keytoavoidconflict]=join(';',$listofnames); + $_SESSION["listofmimes".$keytoavoidconflict]=join(';',$listofmimes); } @@ -1430,9 +1433,10 @@ function dol_init_file_process($pathtoscan='') * @param string $varfiles _FILES var name * @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__' * @param string $link Link to add + * @param string $trackid Track id (used to prefix name of session vars to avoid conflict) * @return void */ -function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesession=0, $varfiles='addedfile', $savingdocmask='', $link=null) +function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesession=0, $varfiles='addedfile', $savingdocmask='', $link=null, $trackid='') { global $db,$user,$conf,$langs; @@ -1482,6 +1486,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); + $formmail->trackid = $trackid; $formmail->add_attached_files($destpath, $destfile, $TFile['type'][$i]); } if (image_format_supported($destpath) == 1) @@ -1550,9 +1555,10 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio * @param int $filenb File nb to delete * @param int $donotupdatesession 1=Do not edit _SESSION variable * @param int $donotdeletefile 1=Do not delete physically file + * @param string $trackid Track id (used to prefix name of session vars to avoid conflict) * @return void */ -function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=1) +function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=1,$trackid='') { global $db,$user,$conf,$langs,$_FILES; @@ -1562,9 +1568,10 @@ function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile= $listofpaths=array(); $listofnames=array(); $listofmimes=array(); - if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]); - if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]); - if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); + $keytoavoidconflict = empty($trackid)?'':'-'.$trackid; + if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]); + if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]); + if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]); if ($keytodelete >= 0) { @@ -1583,6 +1590,7 @@ function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile= { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); + $formmail->trackid = $trackid; $formmail->remove_attached_files($keytodelete); } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 495d7ce1c3c..136e31bd23a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4548,9 +4548,9 @@ function dol_textishtml($msg,$option=0) if (preg_match('//i',$msg)) return true; - elseif (preg_match('/<(br|div|font|li|span|strong|table)>/i',$msg)) return true; - elseif (preg_match('/<(br|div|font|li|span|strong|table)\s+[^<>\/]*>/i',$msg)) return true; - elseif (preg_match('/<(br|div|font|li|span|strong|table)\s+[^<>\/]*\/>/i',$msg)) return true; + elseif (preg_match('/<(br|div|font|li|p|span|strong|table)>/i',$msg)) return true; + elseif (preg_match('/<(br|div|font|li|p|span|strong|table)\s+[^<>\/]*>/i',$msg)) return true; + elseif (preg_match('/<(br|div|font|li|p|span|strong|table)\s+[^<>\/]*\/>/i',$msg)) return true; elseif (preg_match('/]*src[^<>]*>/i',$msg)) return true; // must accept elseif (preg_match('/]*href[^<>]*>/i',$msg)) return true; // must accept
elseif (preg_match('//i',$msg)) return true; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 15c1fb498ee..7ab1a53d230 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -484,7 +484,7 @@ function dol_print_object_info($object, $usetable=0) * * @param string $email Email address (Ex: "toto@example.com", "John Do ") * @param string $trackingid Tracking id (Ex: thi123 for thirdparty with id 123) - * @return boolean True if domain email is OK, False if KO + * @return string Return email tracker string */ function dolAddEmailTrackId($email, $trackingid) { @@ -606,8 +606,8 @@ function clean_url($url,$http=1) * Returns an email value with obfuscated parts. * * @param string $mail Email - * @param string $replace Replacement character (defaul : *) - * @param int $nbreplace Number of replacement character (default : 8) + * @param string $replace Replacement character (defaul: *) + * @param int $nbreplace Number of replacement character (default: 8) * @param int $nbdisplaymail Number of character unchanged (default: 4) * @param int $nbdisplaydomain Number of character unchanged of domain (default: 3) * @param bool $displaytld Display tld (default: true) @@ -1239,7 +1239,7 @@ function hexbin($hexa) * Retourne le numero de la semaine par rapport a une date * * @param string $time Date au format 'timestamp' - * @return int Number of week + * @return string Number of week */ function numero_semaine($time) { diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 2a8074f6276..1d238ed231d 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -318,15 +318,15 @@ function pdfGetHeightForHtmlContent(&$pdf, $htmlcontent) else { for ($page=$start_page; $page <= $end_page; ++$page) { - $this->setPage($page); + $pdf->setPage($page); if ($page == $start_page) { // first page - $height = $this->h - $start_y - $this->bMargin; + $height = $pdf->h - $start_y - $pdf->bMargin; } elseif ($page == $end_page) { // last page - $height = $end_y - $this->tMargin; + $height = $end_y - $pdf->tMargin; } else { - $height = $this->h - $this->tMargin - $this->bMargin; + $height = $pdf->h - $pdf->tMargin - $pdf->bMargin; } } } @@ -1476,7 +1476,10 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0) */ function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0) { - global $hookmanager; + global $hookmanager,$conf; + + $sign=1; + if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; $result=''; $reshook=0; @@ -1493,7 +1496,7 @@ function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0) } if (empty($reshook)) { - if (empty($hidedetails) || $hidedetails > 1) $result.=price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs); + if (empty($hidedetails) || $hidedetails > 1) $result.=price($sign * (($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100), 0, $outputlangs); } return $result; } @@ -1801,7 +1804,10 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0) */ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0) { - global $hookmanager; + global $hookmanager,$conf; + + $sign=1; + if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; $reshook=0; $result=''; @@ -1822,7 +1828,7 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0) { $result.=$outputlangs->transnoentities("Option"); } - elseif (empty($hidedetails) || $hidedetails > 1) $result.=price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs); + elseif (empty($hidedetails) || $hidedetails > 1) $result.=price($sign * ($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs); } return $result; } diff --git a/htdocs/core/lib/prelevement.lib.php b/htdocs/core/lib/prelevement.lib.php index a575ae51bcc..47bc2cb1974 100644 --- a/htdocs/core/lib/prelevement.lib.php +++ b/htdocs/core/lib/prelevement.lib.php @@ -78,9 +78,9 @@ function prelevement_prepare_head(BonPrelevement $object) function prelevement_check_config() { global $conf; - if(empty($conf->global->PRELEVEMENT_USER)) return -1; if(empty($conf->global->PRELEVEMENT_ID_BANKACCOUNT)) return -1; - if(empty($conf->global->PRELEVEMENT_NUMERO_NATIONAL_EMETTEUR)) return -1; + if(empty($conf->global->PRELEVEMENT_ICS)) return -1; + if(empty($conf->global->PRELEVEMENT_USER)) return -1; return 0; } diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 2c362a42c2c..a6091f8ebb0 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -310,6 +310,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='') $expedition->id=$objp->sendingid; $expedition->fetchObjectLinked($expedition->id,$expedition->element); //var_dump($expedition->linkedObjects); + $receiving=''; if (count($expedition->linkedObjects['delivery']) > 0) $receiving=reset($expedition->linkedObjects['delivery']); // Take first link diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 05b3bbf054d..17079bc96ac 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -78,11 +78,19 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url'])) { - $tmp=explode('?',$newTabMenu[$i]['url'],2); + $tmp=explode('?',$newTabMenu[$i]['url'],2); $url = $shorturl = $tmp[0]; $param = (isset($tmp[1])?$tmp[1]:''); - if (! preg_match('/mainmenu/i',$param) || ! preg_match('/leftmenu/i',$param)) $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu='; + // Complete param to force leftmenu to '' to closed opend menu when we click on a link with no leftmenu defined. + if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($newTabMenu[$i]['url'])) + { + $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['url'].'&leftmenu='; + } + if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && empty($newTabMenu[$i]['url'])) + { + $param.=($param?'&':'').'leftmenu='; + } //$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad $url = dol_buildpath($url,1).($param?'?'.$param:''); $shorturl = $shorturl.($param?'?'.$param:''); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 3e02aa67131..8b6e43d0de8 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -857,8 +857,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("donations"); $newmenu->add("/don/index.php?leftmenu=donations&mainmenu=accountancy",$langs->trans("Donations"), 0, $user->rights->don->lire, '', $mainmenu, 'donations'); - if (empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/don/card.php?action=create",$langs->trans("NewDonation"), 1, $user->rights->don->creer); - if (empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/don/list.php",$langs->trans("List"), 1, $user->rights->don->lire); + if (empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/don/card.php?leftmenu=donations&action=create",$langs->trans("NewDonation"), 1, $user->rights->don->creer); + if (empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/don/list.php?leftmenu=donations",$langs->trans("List"), 1, $user->rights->don->lire); // if ($leftmenu=="donations") $newmenu->add("/don/stats/index.php",$langs->trans("Statistics"), 1, $user->rights->don->lire); } @@ -1058,6 +1058,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/compta/bank/index.php?leftmenu=bank&mainmenu=bank",$langs->trans("MenuBankCash"),0,$user->rights->banque->lire, '', $mainmenu, 'bank'); $newmenu->add("/compta/bank/card.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer); + $newmenu->add("/compta/bank/index.php?leftmenu=bank&mainmenu=bank",$langs->trans("List"),1,$user->rights->banque->lire, '', $mainmenu, 'bank'); $newmenu->add("/compta/bank/search.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire); $newmenu->add("/compta/bank/budget.php",$langs->trans("ListTransactionsByCategory"),1,$user->rights->banque->lire); @@ -1184,9 +1185,9 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $langs->load("projects"); // Project affected to user - $newmenu->add("/projet/index.php?leftmenu=projects&mode=mine", $langs->trans("MyProjects"), 0, $user->rights->projet->lire, '', $mainmenu, 'myprojects'); - $newmenu->add("/projet/card.php?leftmenu=projects&action=create&mode=mine", $langs->trans("NewProject"), 1, $user->rights->projet->creer); - $newmenu->add("/projet/list.php?leftmenu=projects&mode=mine&search_status=1", $langs->trans("List"), 1, $user->rights->projet->lire); + $newmenu->add("/projet/index.php?leftmenu=myprojects&mode=mine", $langs->trans("MyProjects"), 0, $user->rights->projet->lire, '', $mainmenu, 'myprojects'); + $newmenu->add("/projet/card.php?leftmenu=myprojects&action=create&mode=mine", $langs->trans("NewProject"), 1, $user->rights->projet->creer); + $newmenu->add("/projet/list.php?leftmenu=myprojects&mode=mine&search_status=1", $langs->trans("List"), 1, $user->rights->projet->lire); // All project i have permission on $newmenu->add("/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire && $user->rights->projet->lire, '', $mainmenu, 'projects'); @@ -1197,10 +1198,10 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (empty($conf->global->PROJECT_HIDE_TASKS)) { // Project affected to user - $newmenu->add("/projet/activity/index.php?mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire); - $newmenu->add("/projet/tasks.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer); - $newmenu->add("/projet/tasks/list.php?mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire); - $newmenu->add("/projet/activity/perweek.php?mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer); + $newmenu->add("/projet/activity/index.php?leftmenu=mytasks&mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire); + $newmenu->add("/projet/tasks.php?leftmenu=mytasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer); + $newmenu->add("/projet/tasks/list.php?leftmenu=mytasks&mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire); + $newmenu->add("/projet/activity/perweek.php?leftmenu=mytasks&mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer); // All project i have permission on $newmenu->add("/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire && $user->rights->projet->lire); @@ -1452,15 +1453,33 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu } } - // For external modules - $tmp=explode('?',$menu_array[$i]['url'],2); - $url = $tmp[0]; - $param = (isset($tmp[1])?$tmp[1]:''); - $url = dol_buildpath($url,1).($param?'?'.$param:''); + $url = $shorturl = $menu_array[$i]['url']; + + if (! preg_match("/^(http:\/\/|https:\/\/)/i",$menu_array[$i]['url'])) + { + $tmp=explode('?',$menu_array[$i]['url'],2); + $url = $shorturl = $tmp[0]; + $param = (isset($tmp[1])?$tmp[1]:''); // params in url of the menu link + // Complete param to force leftmenu to '' to closed opend menu when we click on a link with no leftmenu defined. + if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($menu_array[$i]['mainmenu'])) + { + $param.=($param?'&':'').'mainmenu='.$menu_array[$i]['mainmenu'].'&leftmenu='; + } + if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && empty($menu_array[$i]['mainmenu'])) + { + $param.=($param?'&':'').'leftmenu='; + } + //$url.="idmenu=".$menu_array[$i]['rowid']; // Already done by menuLoad + $url = dol_buildpath($url,1).($param?'?'.$param:''); + $shorturl = $shorturl.($param?'?'.$param:''); + } + $url=preg_replace('/__LOGIN__/',$user->login,$url); + $shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl); $url=preg_replace('/__USERID__/',$user->id,$url); - + $shorturl=preg_replace('/__USERID__/',$user->id,$shorturl); + print ''."\n"; // Menu niveau 0 diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index aff994a5209..98091a8b727 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -239,7 +239,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetSubject($outputlangs->transnoentities("Order")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 1aabe54cbd8..a2828fb466a 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -198,7 +198,7 @@ class pdf_strato extends ModelePDFContract $pdf->SetSubject($outputlangs->transnoentities("ContractCard")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("ContractCard")); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("ContractCard")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index c6ba0b45ff2..b3dce6ee7c9 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -305,10 +305,12 @@ class pdf_standard extends ModeleExpenseReport $showpricebeforepagebreak=1; + $pdf->SetFont('','', $default_font_size - 1); + // Accountancy piece $pdf->SetXY($this->posxpiece, $curY); - $pdf->MultiCell($this->posxcomment-$this->posxpiece-0.8, 4, $piece_comptable, 0, 'C'); - + $pdf->writeHTMLCell($this->posxcomment-$this->posxpiece-0.8, 4, $this->posxpiece-1, $curY, $piece_comptable, 0, 1); + // Comments $pdf->SetXY($this->posxcomment, $curY); $pdf->writeHTMLCell($this->posxdate-$this->posxcomment-0.8, 4, $this->posxcomment-1, $curY, $object->lines[$i]->comments, 0, 1); @@ -547,7 +549,7 @@ class pdf_standard extends ModeleExpenseReport $pdf->SetFont('','B', $default_font_size + 4); $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx,6,$langs->trans("ExpenseReport"), 0, 'L'); + $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx,6,$langs->trans("ExpenseReport"), 0, 'R'); $pdf->SetFont('','', $default_font_size -1); @@ -555,19 +557,19 @@ class pdf_standard extends ModeleExpenseReport $posy+=8; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("Ref")." : " . $object->ref, '', 'L'); + $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("Ref")." : " . $object->ref, '', 'R'); // Date start period $posy+=5; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("DateStart")." : " . ($object->date_debut>0?dol_print_date($object->date_debut,"day",false,$outputlangs):''), '', 'L'); + $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("DateStart")." : " . ($object->date_debut>0?dol_print_date($object->date_debut,"day",false,$outputlangs):''), '', 'R'); // Date end period $posy+=5; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("DateEnd")." : " . ($object->date_fin>0?dol_print_date($object->date_fin,"day",false,$outputlangs):''), '', 'L'); + $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("DateEnd")." : " . ($object->date_fin>0?dol_print_date($object->date_fin,"day",false,$outputlangs):''), '', 'R'); // Status Expense Report $posy+=6; diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 4615c783dfe..1b36ef6c92f 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -282,7 +282,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetSubject($outputlangs->transnoentities("Invoice")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Invoice")); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Invoice")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right @@ -538,15 +538,18 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY($this->postotalht, $curY); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0); + + $sign=1; + if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva $prev_progress = $object->lines[$i]->get_prev_progress($object->id); if ($prev_progress > 0) // Compute progress from previous situation { - if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; - else $tvaligne = $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; + if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $sign * $object->lines[$i]->multicurrency_total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; + else $tvaligne = $sign * $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; } else { - if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; - else $tvaligne=$object->lines[$i]->total_tva; + if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne= $sign * $object->lines[$i]->multicurrency_total_tva; + else $tvaligne= $sign * $object->lines[$i]->total_tva; } $localtax1ligne=$object->lines[$i]->total_localtax1; diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php index cba8af72295..24ad5ee4a0b 100644 --- a/htdocs/core/modules/mailings/advthirdparties.modules.php +++ b/htdocs/core/modules/mailings/advthirdparties.modules.php @@ -56,7 +56,7 @@ class mailing_advthirdparties extends MailingTargets * @param array $contactid Array of contact id to add * @return int <0 if error, number of emails added if ok */ - function add_to_target($mailing_id,$socid,$type_of_target, $contactid) + function add_to_target_spec($mailing_id,$socid,$type_of_target, $contactid) { global $conf, $langs; @@ -80,14 +80,14 @@ class mailing_advthirdparties extends MailingTargets { $num = $this->db->num_rows($result); $i = 0; - + dol_syslog(get_class($this)."::add_to_target mailing ".$num." targets found", LOG_DEBUG); - + $old = ''; while ($i < $num) { $obj = $this->db->fetch_object($result); - + if (!empty($obj->email) && filter_var($obj->email, FILTER_VALIDATE_EMAIL)) { if (!array_key_exists($obj->email, $cibles)) { $cibles[$obj->email] = array( @@ -102,7 +102,7 @@ class mailing_advthirdparties extends MailingTargets ); } } - + $i++; } } @@ -129,21 +129,21 @@ class mailing_advthirdparties extends MailingTargets $sql.= " AND socp.fk_soc IN (".implode(',',$socid).")"; } $sql.= " ORDER BY email"; - + // Stock recipients emails into targets table $result=$this->db->query($sql); if ($result) { $num = $this->db->num_rows($result); $i = 0; - + dol_syslog(get_class($this)."::add_to_target mailing ".$num." targets found"); - + $old = ''; while ($i < $num) { $obj = $this->db->fetch_object($result); - + if (!empty($obj->email) && filter_var($obj->email, FILTER_VALIDATE_EMAIL)) { if (!array_key_exists($obj->email, $cibles)) { $cibles[$obj->email] = array( @@ -158,7 +158,7 @@ class mailing_advthirdparties extends MailingTargets ); } } - + $i++; } } @@ -200,9 +200,10 @@ class mailing_advthirdparties extends MailingTargets * For example if this selector is used to extract 500 different * emails from a text file, this function must return 500. * - * @return int Nb of recipients + * @param string $sql Sql request to use + * @return int Nb of recipients */ - function getNbOfRecipients() + function getNbOfRecipients($sql='') { global $conf; diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 03b450aa275..af51e01c576 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -71,7 +71,7 @@ class modAccounting extends DolibarrModules $this->requiredby = array(); // List of modules id to disable if this one is disabled $this->conflictwith = array("modComptabilite"); // List of modules are in conflict with this module $this->phpmin = array(5, 3); // Minimum version of PHP required by module - $this->need_dolibarr_version = array(3, 7); // Minimum version of Dolibarr required by module + $this->need_dolibarr_version = array(3, 9); // Minimum version of Dolibarr required by module $this->langfiles = array("accountancy"); // Constants @@ -179,7 +179,7 @@ class modAccounting extends DolibarrModules $this->const[18] = array ( "ACCOUNTING_EXPORT_GLOBAL_ACCOUNT", "yesno", - "1" + "1" ); $this->const[19] = array ( "ACCOUNTING_EXPORT_LABEL", @@ -189,12 +189,12 @@ class modAccounting extends DolibarrModules $this->const[20] = array ( "ACCOUNTING_EXPORT_AMOUNT", "yesno", - "1" + "1" ); $this->const[21] = array ( "ACCOUNTING_EXPORT_DEVISE", "yesno", - "1" + "1" ); */ $this->const[22] = array( @@ -270,7 +270,7 @@ class modAccounting extends DolibarrModules $this->rights[$r][4] = 'fiscalyear'; $this->rights[$r][5] = ''; $r++; - + $this->rights[$r][0] = 50440; $this->rights[$r][1] = 'Manage chart of accounts'; $this->rights[$r][2] = 'r'; diff --git a/htdocs/core/modules/modCron.class.php b/htdocs/core/modules/modCron.class.php index 89a90dfc8bd..22e66431e4e 100644 --- a/htdocs/core/modules/modCron.class.php +++ b/htdocs/core/modules/modCron.class.php @@ -101,7 +101,7 @@ class modCron extends DolibarrModules // Cronjobs $this->cronjobs = array( - 0=>array('label'=>'PurgeDeleteTemporaryFilesShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'purgeFiles', 'parameters'=>'', 'comment'=>'PurgeDeleteTemporaryFiles', 'frequency'=>1, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>10, 'status'=>1, 'test'=>true), + 0=>array('label'=>'PurgeDeleteTemporaryFilesShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'purgeFiles', 'parameters'=>'', 'comment'=>'PurgeDeleteTemporaryFiles', 'frequency'=>2, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>10, 'status'=>1, 'test'=>true), 1=>array('label'=>'MakeLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'dumpDatabase', 'parameters'=>'none', 'comment'=>'MakeLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>20, 'status'=>0, 'test'=>in_array($db->type, array('mysql','mysqli'))), // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24) ); diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index a36abbf0b0f..154639f848d 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -153,27 +153,32 @@ class modProduct extends DolibarrModules if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode')); if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.unitprice'=>'SuppliersPrices')); if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.cost_price'=>'CostPrice')); + if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('group_concat(cat.label)'=>'Categories')); if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote')); $this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date'); - if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric','p.pmp'=>'Numeric')); + if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric')); if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text')); if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric')); if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text')); + if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array("group_concat(cat.label)"=>'Text')); $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",'p.label'=>"product",'p.description'=>"product",'p.url'=>"product",'p.accountancy_code_sell'=>'product','p.accountancy_code_sell'=>'product','p.note'=>"product",'p.length'=>"product",'p.surface'=>"product",'p.volume'=>"product",'p.weight'=>"product",'p.customcode'=>'product','p.price_base_type'=>"product",'p.price'=>"product",'p.price_ttc'=>"product",'p.tva_tx'=>"product",'p.tosell'=>"product",'p.tobuy'=>"product",'p.datec'=>"product",'p.tms'=>"product"); + if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array("group_concat(cat.label)"=>'category')); if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'product','p.pmp'=>'product')); if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product')); if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'product','pf.ref_fourn'=>'product','pf.unitprice'=>'product')); if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation')); - if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('group_concat(cat.label)'=>'Categories')); $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid'); $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p'; + if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid'; if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_lang as l ON l.fk_product = p.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object'; if (! empty($conf->fournisseur->enabled)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc'; $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity("product", 1).')'; - + if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_order[$r] =' GROUP BY p.rowid'; // FIXME The group by used a generic value to say "all fields in select except function fields" + if (! empty($conf->global->PRODUIT_MULTIPRICES)) { // Exports product multiprice diff --git a/htdocs/core/modules/modSupplierProposal.class.php b/htdocs/core/modules/modSupplierProposal.class.php index 9c249da4dc6..842146597a3 100644 --- a/htdocs/core/modules/modSupplierProposal.class.php +++ b/htdocs/core/modules/modSupplierProposal.class.php @@ -141,7 +141,7 @@ class modSupplierProposal extends DolibarrModules $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=commercial', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'type'=>'left', // This is a Left menu entry - 'titre'=>'SupplierProposalShort', + 'titre'=>'SupplierProposalsShort', 'leftmenu'=>'supplier_proposalsubmenu', 'url'=>'/supplier_proposal/index.php', 'langs'=>'supplier_proposal', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. @@ -156,7 +156,7 @@ class modSupplierProposal extends DolibarrModules 'fk_menu'=>'fk_mainmenu=commercial,fk_leftmenu=supplier_proposalsubmenu', 'type'=>'left', 'titre'=>'SupplierProposalNew', - 'url'=>'/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals', + 'url'=>'/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals', 'langs'=>'supplier_proposal', 'enabled'=>'$conf->supplier_proposal->enabled', 'perms'=>'$user->rights->supplier_proposal->creer', @@ -182,7 +182,7 @@ class modSupplierProposal extends DolibarrModules 'fk_menu'=>'fk_mainmenu=commercial,fk_leftmenu=supplier_proposalsubmenu', 'type'=>'left', 'titre'=>'Statistics', - 'url'=>'/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier', + 'url'=>'/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier', 'langs'=>'supplier_proposal', 'enabled'=>'$conf->supplier_proposal->enabled', 'perms'=>'$user->rights->supplier_proposal->lire', diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index 37c228607e1..2b58cd59c09 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -294,7 +294,7 @@ class pdf_beluga extends ModelePDFProjects 'lang'=>'interventions'), 'trip'=>array( 'name'=>"TripsAndExpenses", - 'title'=>"ListTripAssociatedProject", + 'title'=>"ListExpenseReportsAssociatedProject", 'class'=>'Deplacement', 'table'=>'deplacement', 'datefieldname'=>'dated', @@ -304,7 +304,7 @@ class pdf_beluga extends ModelePDFProjects 'lang'=>'trip'), 'expensereport'=>array( 'name'=>"ExpensesReports", - 'title'=>"ListTripAssociatedProject", + 'title'=>"ListExpenseReportsAssociatedProject", 'class'=>'ExpenseReport', 'table'=>'expensereport', 'datefieldname'=>'dated', diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index a00658a9837..fb0d229f6b6 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -434,6 +434,7 @@ class doc_generic_task_odt extends ModelePDFTask } $project= new Project($this->db); $project->fetch($object->fk_project); + $project->fetch_thirdparty(); $dir = $conf->projet->dir_output. "/" . $project->ref. "/"; $objectref = dol_sanitizeFileName($object->ref); @@ -468,7 +469,7 @@ class doc_generic_task_odt extends ModelePDFTask dol_mkdir($conf->projet->dir_temp); - $socobject=$object->thirdparty; + $socobject=$project->thirdparty; // Make substitution $substitutionarray=array( diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 81f73b98f29..801d6dc16e4 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -296,7 +296,7 @@ class pdf_azur extends ModelePDFPropales $pdf->SetSubject($outputlangs->transnoentities("CommercialProposal")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("CommercialProposal")); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("CommercialProposal")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 2787f446e4e..ceed17350d0 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -232,7 +232,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetSubject($outputlangs->transnoentities("Invoice")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 783a0b2d0b6..d8912fa1a42 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -243,7 +243,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetSubject($outputlangs->transnoentities("Order")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 797aa81ce4b..2a6a442582c 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -252,7 +252,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->SetSubject($outputlangs->transnoentities("CommercialAsk")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("CommercialAsk")); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("CommercialAsk")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 64c78c43c2e..9f894095807 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -85,7 +85,9 @@ $alwayseditable=$extrafields->attribute_alwayseditable[$attrname]; $param=$extrafields->attribute_param[$attrname]; $perms=$extrafields->attribute_perms[$attrname]; $list=$extrafields->attribute_list[$attrname]; -//$ishidden=$extrafields->attribute_hidden[$attrname]; +if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) { + $ishidden=$extrafields->attribute_hidden[$attrname]; +} if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param)) { diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 8dc599441e2..c8bae6140c1 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -694,17 +694,17 @@ function setforpredef() { jQuery("#prod_entry_mode_free").prop('checked',false); jQuery("#prod_entry_mode_predef").prop('checked',true); jQuery("#price_ht").hide(); - jQuery("#title_up_ht").hide(); jQuery("#price_ttc").hide(); // May no exists jQuery("#tva_tx").hide(); jQuery("#buying_price").show(); + //jQuery("#fournprice_predef").show(); // management somewhere else jQuery("#title_vat").hide(); + jQuery("#title_up_ht").hide(); jQuery("#title_up_ttc").hide(); jQuery("#np_marginRate").hide(); // May no exists jQuery("#np_markRate").hide(); // May no exists jQuery(".np_marginRate").hide(); // May no exists jQuery(".np_markRate").hide(); // May no exists - jQuery(".np_markRate").hide(); // May no exists jQuery("#units, #title_units").hide(); } diff --git a/htdocs/don/card.php b/htdocs/don/card.php index e770e2a146c..8614220e8c0 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -743,9 +743,9 @@ if (! empty($id) && $action != 'edit') // Delete if ($user->rights->don->supprimer) { - if ($don->statut == -1 || $don->statut == 0) + if ($object->statut == -1 || $object->statut == 0) { - print '"; + print '"; } else { @@ -783,4 +783,4 @@ if (! empty($id) && $action != 'edit') } llxFooter(); -$db->close(); \ No newline at end of file +$db->close(); diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 6b849a1518b..1293eee7ab1 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1927,7 +1927,6 @@ else if ($id || $ref) $formmail->substit['__SHIPPINGTRACKNUM__']=$object->tracking_number; $formmail->substit['__SHIPPINGTRACKNUMURL__']=$object->tracking_url; - //Find the good contact adress //Find the good contact adress if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled)) { $objectsrc=new Commande($db); @@ -1939,8 +1938,11 @@ else if ($id || $ref) } $custcontact=''; $contactarr=array(); - $contactarr=$objectsrc->liste_contact(-1,'external'); - + if (is_object($objectsrc)) // For the case the shipment was created without orders + { + $contactarr=$objectsrc->liste_contact(-1,'external'); + } + if (is_array($contactarr) && count($contactarr)>0) { foreach($contactarr as $contact) { diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index a7375c451a8..bb8cb9bcdda 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -896,7 +896,8 @@ class Expedition extends CommonObject $product_type=$product->type; if ($product_type == 0 && $product_stock < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $product->ref); $this->db->rollback(); return -3; } @@ -952,7 +953,8 @@ class Expedition extends CommonObject if ($prod_batch->qty < $linebatch->dluo_qty) { - $this->errors[] = $langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->errors[]=$langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $prod_batch->fk_product); dol_syslog(get_class($this)."::addline_batch error=Product ".$prod_batch->batch.": ".$this->errorsToString(), LOG_ERR); $this->db->rollback(); return -1; @@ -1302,7 +1304,7 @@ class Expedition extends CommonObject $sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked, cd.product_type"; $sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva"; - $sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice, cd.remise_percent"; + $sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht"; $sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot"; $sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type"; $sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch"; @@ -1373,6 +1375,8 @@ class Expedition extends CommonObject $line->volume = $obj->volume; $line->volume_units = $obj->volume_units; + $line->pa_ht = $obj->pa_ht; + // For invoicing $tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type, $mysoc); // We force type to 0 $line->desc = $obj->description; // We need ->desc because some code into CommonObject use desc (property defined for other elements) @@ -1547,7 +1551,8 @@ class Expedition extends CommonObject dol_syslog(get_class($this)."::initAsSpecimen"); - // Charge tableau des produits prodids + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index f046b4ea61f..e177312a7d6 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1432,7 +1432,7 @@ else { $num = $db->num_rows($resql); $i = 0; $total = 0; - print ''; + print '
'; print ''; print ''; print ''; diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index d269757af7e..e09a74e20f3 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015 Alexandre Spangaro @@ -51,22 +51,21 @@ $month_end = GETPOST("month_end","int"); $year_end = GETPOST("year_end","int"); $optioncss = GETPOST('optioncss','alpha'); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers -{ - $search_ref=""; - $search_user=""; - $search_amount_ht=""; - $search_amount_ttc=""; - $search_status=""; - $month_start=""; - $year_start=""; - $month_end=""; - $year_end=""; -} - if ($search_status == '') $search_status=-1; if ($search_user == '') $search_user=-1; +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$contextpage='expensereportlist'; + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('expensereportlist')); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('expensereport'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); + + // List of fields to search into when doing a "search in all" $fieldstosearchall = array( 'd.ref'=>'Ref', @@ -75,6 +74,33 @@ $fieldstosearchall = array( ); + +/* + * Actions + */ + +$parameters=array('socid'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers +{ + $search_ref=""; + $search_user=""; + $search_amount_ht=""; + $search_amount_ttc=""; + $search_status=""; + $month_start=""; + $year_start=""; + $month_end=""; + $year_end=""; + $search_array_options=array(); +} + + + /* * View */ @@ -108,7 +134,6 @@ $sql.= " u.rowid as id_user, u.firstname, u.lastname"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON d.fk_user_author = u.rowid"; $sql.= " WHERE d.entity = ".$conf->entity; - // Search all if (!empty($sall)) { @@ -192,13 +217,22 @@ if ($resql) $i = 0; $param=""; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($search_ref) $param.="&search_ref=".$search_ref; if ($search_user) $param.="&search_user=".$search_user; if ($search_amount_ht) $param.="&search_amount_ht=".$search_amount_ht; if ($search_amount_ttc) $param.="&search_amount_ttc=".$search_amount_ttc; if ($search_status >= 0) $param.="&search_status=".$search_status; - if ($optioncss != '') $param.='&optioncss='.$optioncss; - + if ($optioncss != '') $param.='&optioncss='.$optioncss; + // Add $param from extra fields + foreach ($search_array_options as $key => $val) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); + } + print_barre_liste($langs->trans("ListTripsAndExpenses"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print '
'."\n"; if ($optioncss != '') print ''; @@ -210,8 +244,9 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); } - + print '
'.$langs->trans("RefPayment").''.$langs->trans("Date").'
'; print ""; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","",$param,'',$sortfield,$sortorder); diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 6632f050550..496092b7f73 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -234,19 +234,32 @@ class Export } $sql.=$this->array_export_sql_end[$indice]; - // Add the filtering into sql if a filtering array is provided + // Add the WHERE part. Filtering into sql if a filtering array is provided if (is_array($array_filterValue) && !empty($array_filterValue)) { $sqlWhere=''; // Loop on each condition to add foreach ($array_filterValue as $key => $value) { + if (preg_match('/GROUP_CONCAT/i', $key)) continue; if ($value != '') $sqlWhere.=" and ".$this->build_filterQuery($this->array_export_TypeFields[$indice][$key], $key, $array_filterValue[$key]); } $sql.=$sqlWhere; } + + // Add the order $sql.=$this->array_export_sql_order[$indice]; + // Add the HAVING part. + if (is_array($array_filterValue) && !empty($array_filterValue)) + { + // Loop on each condition to add + foreach ($array_filterValue as $key => $value) + { + if (preg_match('/GROUP_CONCAT/i', $key) and $value != '') $sql.=" HAVING ".$this->build_filterQuery($this->array_export_TypeFields[$indice][$key], $key, $array_filterValue[$key]); + } + } + return $sql; } diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 50ca1e09a91..11ae0fc9218 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -561,6 +561,8 @@ if ($step == 2 && $datatoexport) print ''; print ''; } - $perm_libelle=($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id)!=("PermissionAdvanced".$obj->id))?$langs->trans("PermissionAdvanced".$obj->id):(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$obj->libelle)); + $perm_libelle=($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id)!=("PermissionAdvanced".$obj->id))?$langs->trans("PermissionAdvanced".$obj->id):(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$langs->trans($obj->libelle))); print ''; print ''; diff --git a/htdocs/user/index.php b/htdocs/user/index.php index f7927cee665..5d8f02e1c32 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -229,6 +229,15 @@ $sql.=$hookmanager->resPrint; $sql.=$db->order($sortfield,$sortorder); //$sql.= $db->plimit($conf->liste_limit+1, $offset); +/*$totalnboflines=0; +$result=$db->query($sql); +if ($result) +{ + $totalnboflines = $db->num_rows($result); +} + +$sql.= $db->plimit($limit+1, $offset); +*/ $result = $db->query($sql); if ($result) { @@ -236,6 +245,8 @@ if ($result) $i = 0; $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($sall != '') $param.='&sall='.urlencode($sall); if ($search_user != '') $param.="&search_user=".$search_user; if ($search_login != '') $param.="&search_login=".$search_login; diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index 585db4c343e..b6d33de99ae 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -34,8 +34,9 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIREHOOK')) define('NOREQUIREHOOK','1'); // Disable "main.inc.php" hooks -// Pour autre que companylogo, on charge environnement + info issus de logon comme le user +// Some value of modulepart can be used to get resources that are public so no login are required. if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'companylogo') && ! defined("NOLOGIN")) define("NOLOGIN",'1'); +if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias') && ! defined("NOLOGIN")) define("NOLOGIN",'1'); /** * Header empty diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php index ae29dab196b..19f72486c3f 100644 --- a/htdocs/websites/index.php +++ b/htdocs/websites/index.php @@ -137,6 +137,8 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain * Actions */ +if (GETPOST('refreshsite')) $pageid=0; // If we change the site, we reset the pageid. + // Add page if ($action == 'add') { @@ -321,7 +323,7 @@ if ($action == 'updatemeta') $res = $objectpage->fetch($pageid, $object->fk_website); if ($res > 0) { - $objectpage->pageurl = GETPOST('WEBSITE_PAGENAME'); + $objectpage->pageurl = GETPOST('WEBSITE_PAGENAME'); $objectpage->title = GETPOST('WEBSITE_TITLE'); $objectpage->description = GETPOST('WEBSITE_DESCRIPTION'); $objectpage->keywords = GETPOST('WEBSITE_KEYWORDS'); @@ -476,7 +478,7 @@ if (count($object->records) > 0) } $out.=''; print $out; - print ''; + print ''; if ($website) { @@ -529,22 +531,31 @@ if (count($object->records) > 0) $out.=''; print $out; - print ''; + print ''; print ''; //print $form->selectarray('page', $array); diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index df755a50b64..38054c48c69 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -80,6 +80,23 @@ if ($key != $conf->global->CRON_KEY) exit(-1); } +// If param userlogin is reserved word 'firstadmin' +if ($userlogin == 'firstadmin') +{ + $sql='SELECT login from '.MAIN_DB_PREFIX.'user WHERE admin = 1 ORDER BY entity LIMIT 1'; + $resql=$db->query($sql); + if ($resql) + { + $obj=$db->fetch_object($resql); + if ($obj) + { + $userlogin = $obj->login; + echo "First admin user found is login '".$userlogin."'\n
"; + } + } + else dol_print_error($db); +} + // Check user login $user=new User($db); $result=$user->fetch('',$userlogin); @@ -93,8 +110,8 @@ else { if (empty($user->id)) { - echo " User user login: ".$userlogin." do not exists"; - dol_syslog(" User user login:".$userlogin." do not exists", LOG_ERR); + echo "User user login: ".$userlogin." does not exists"; + dol_syslog("User user login:".$userlogin." does not exists", LOG_ERR); exit(-1); } } @@ -178,7 +195,7 @@ function usage($path,$script_file) { global $conf; - print "Usage: ".$script_file." securitykey userlogin [cronjobid]\n"; + print "Usage: ".$script_file." securitykey userlogin|'firstadmin' [cronjobid]\n"; print "The script return 0 when everything worked successfully.\n"; print "\n"; print "On Linux system, you can have cron jobs ran automatically by adding an entry into cron.\n"; diff --git a/scripts/product/migrate_picture_path.php b/scripts/product/migrate_picture_path.php index 9d3cba8452f..f8624ebc040 100755 --- a/scripts/product/migrate_picture_path.php +++ b/scripts/product/migrate_picture_path.php @@ -1,6 +1,6 @@ #!/usr/bin/env php +/* Copyright (C) 2007-2016 Laurent Destailleur * Copyright (C) 2015 Jean Heimburger * * This program is free software; you can redistribute it and/or modify @@ -21,7 +21,6 @@ * \file scripts/product/migrate_picture_path.php * \ingroup scripts * \brief Migrate pictures from old system prior to 3.7 to new path for 3.7+ - * */ $sapi_type = php_sapi_name(); @@ -119,7 +118,7 @@ function migrate_product_photospath($product) $handle=opendir($origin_osencoded); if (is_resource($handle)) { - while (($file = readdir($handle)) != false) + while (($file = readdir($handle)) !== false) { if ($file != '.' && $file != '..' && is_dir($origin_osencoded.'/'.$file)) { @@ -127,7 +126,7 @@ function migrate_product_photospath($product) if (is_resource($thumbs)) { dol_mkdir($destin.'/'.$file); - while (($thumb = readdir($thumbs)) != false) + while (($thumb = readdir($thumbs)) !== false) { dol_move($origin.'/'.$file.'/'.$thumb, $destin.'/'.$file.'/'.$thumb); } diff --git a/test/phpunit/CategorieTest.php b/test/phpunit/CategorieTest.php index d9e030ef9ef..574a8d793f9 100644 --- a/test/phpunit/CategorieTest.php +++ b/test/phpunit/CategorieTest.php @@ -200,7 +200,7 @@ class CategorieTest extends PHPUnit_Framework_TestCase // Get list of categories for product $localcateg=new Categorie($this->savdb); - $listofcateg=$localcateg->containing($localobject2->id, 'product', 'label'); + $listofcateg=$localcateg->containing($localobject2->id, Categorie::TYPE_PRODUCT, 'label'); $this->assertTrue(in_array('Specimen Category for product',$listofcateg), 'Categ not found linked to product when it should'); return $id; diff --git a/test/phpunit/PgsqlTest.php b/test/phpunit/PgsqlTest.php index 04693c017ed..05efcaeb30b 100644 --- a/test/phpunit/PgsqlTest.php +++ b/test/phpunit/PgsqlTest.php @@ -162,6 +162,18 @@ class PgsqlTest extends PHPUnit_Framework_TestCase print __METHOD__." result=".$result."\n"; $this->assertEquals($result, $sql.' DEFERRABLE INITIALLY IMMEDIATE;'); + // Test GROUP_CONCAT (without SEPARATOR) + $sql="SELECT a.b, GROUP_CONCAT(a.c) FROM table GROUP BY a.b"; + $result=DoliDBPgsql::convertSQLFromMysql($sql); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c, ',') FROM table GROUP BY a.b", 'Test GROUP_CONCAT (without SEPARATOR)'); + + // Test GROUP_CONCAT (with SEPARATOR) + $sql="SELECT a.b, GROUP_CONCAT(a.c SEPARATOR ',') FROM table GROUP BY a.b"; + $result=DoliDBPgsql::convertSQLFromMysql($sql); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c, ',') FROM table GROUP BY a.b", 'Test GROUP_CONCAT (with SEPARATOR)'); + return $result; } }
'; // If value of entityicon=entitylang='icon:Label' + //print $code.'-'.$label.'-'.$entity; + $tmparray=explode(':',$entityicon); if (count($tmparray) >=2) { @@ -1187,15 +1189,16 @@ exit; // don't know why but apache hangs with php 5.3.10-1ubuntu3.12 and apache */ function getablenamefromfield($code,$sqlmaxforexport) { + $alias=preg_replace('/\.(.*)$/i','',$code); // Keep only 'Alias' and remove '.Fieldname' + $regexstring='/([a-zA-Z_]+) as '.preg_quote($alias).'[, \)]/i'; + $newsql=$sqlmaxforexport; - $newsql=preg_replace('/^(.*) FROM /i','',$newsql); - $newsql=preg_replace('/WHERE (.*)$/i','',$newsql); // We must keep the ' ' before WHERE - $alias=preg_replace('/\.(.*)$/i','',$code); - //print $newsql.' '.$alias; - $regexstring='/([a-zA-Z_]+) as '.$alias.'[, \)]/i'; + $newsql=preg_replace('/^(.*) FROM /i','',$newsql); // Remove part before the FROM + $newsql=preg_replace('/WHERE (.*)$/i','',$newsql); // Remove part after the WHERE so we have now only list of table aliases in a string. We must keep the ' ' before WHERE + if (preg_match($regexstring,$newsql,$reg)) { - return $reg[1]; + return $reg[1]; // The tablename } else return ''; } diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index a54a983f514..2a4ec4337f2 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -111,6 +111,36 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once + // Action clone object + if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->ficheinter->creer) + { + if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) + { + setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); + } + else + { + if ($object->id > 0) + { + // Because createFromClone modifies the object, we must clone it so that we can restore it later + $orig = clone $object; + + $result=$object->createFromClone($socid); + if ($result > 0) + { + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); + exit; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + $object = $orig; + $action=''; + } + } + } + } + if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->ficheinter->creer) { $result = $object->setValid($user); @@ -447,7 +477,7 @@ if (empty($reshook)) } // Set into a contract - else if ($action == 'setcontrat' && $user->rights->contrat->creer) + else if ($action == 'setcontract' && $user->rights->contrat->creer) { $result=$object->set_contrat($user,GETPOST('contratid','int')); if ($result < 0) dol_print_error($db,$object->error); @@ -700,174 +730,19 @@ if (empty($reshook)) exit; } - - /* - * Add file in email form - */ - if (GETPOST('addfile','alpha')) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory TODO Use a dedicated directory for temp mails files - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - dol_add_file_process($upload_dir_tmp,0,0); - $action='presend'; - } - - /* - * Remove file in email form - */ - if (GETPOST('removedfile','alpha')) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - // TODO Delete only files that was uploaded from email form - dol_remove_file_process(GETPOST('removedfile','alpha'),0); - $action='presend'; - } - /* * Send mail - */ - if ($action == 'send' && ! GETPOST('cancel','alpha') && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send)) - { - $langs->load('mails'); + */ + + // Actions to send emails + $actiontypecode='AC_OTH_AUTO'; + $trigger_name='FICHINTER_SENTBYMAIL'; + $paramname='id'; + $mode='emailfromintervention'; + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; + - if (GETPOST('sendto','alpha')) - { - // Le destinataire a ete fourni via le champ libre - $sendto = GETPOST('sendto','alpha'); - $sendtoid = 0; - } - elseif (GETPOST('receiver','alpha') != '-1') - { - // Recipient was provided from combo list - if (GETPOST('receiver','alpha') == 'thirdparty') // Id of third party - { - $sendto = $object->thirdparty->email; - $sendtoid = 0; - } - else // Id du contact - { - $sendto = $object->thirdparty->contact_get_property(GETPOST('receiver'),'email'); - $sendtoid = GETPOST('receiver','alpha'); - } - } - - if (dol_strlen($sendto)) - { - $langs->load("commercial"); - - $from = GETPOST('fromname','alpha') . ' <' . GETPOST('frommail','alpha') .'>'; - $replyto = GETPOST('replytoname','alpha'). ' <' . GETPOST('replytomail','alpha').'>'; - $message = GETPOST('message'); - $sendtocc = GETPOST('sendtocc','alpha'); - $deliveryreceipt = GETPOST('deliveryreceipt','alpha'); - - if ($action == 'send') - { - if (strlen(GETPOST('subject','alphs'))) $subject = GETPOST('subject','alpha'); - else $subject = $langs->transnoentities('Intervention').' '.$object->ref; - $actiontypecode='AC_OTH_AUTO'; - $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; - if ($message) - { - if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); - $actionmsg = dol_concatdesc($actionmsg, $message); - } - $actionmsg2=$langs->transnoentities("InterventionSentByEMail",$object->ref); - } - - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - - $attachedfiles=$formmail->get_attached_files(); - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; - - // Send by email - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1); - if ($mailfile->error) - { - $mesg='
'.$mailfile->error.'
'; - } - else - { - $result=$mailfile->sendfile(); - if ($result) - { - $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); - setEventMessages($mesg, null, 'mesgs'); - $error=0; - - // Initialisation donnees - $object->sendtoid = $sendtoid; - $object->actiontypecode = $actiontypecode; - $object->actionmsg = $actionmsg; - $object->actionmsg2 = $actionmsg2; - $object->fk_element = $object->id; - $object->elementtype = $object->element; - - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('FICHINTER_SENTBYMAIL',$object,$user,$langs,$conf); - if ($result < 0) { - $error++; $object->errors=$interface->errors; - } - // Fin appel triggers - - if ($error) - { - dol_print_error($db); - } - else - { - // Redirect here - // This avoid sending mail twice if going out and then back to page - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; - } - } - else - { - $langs->load("other"); - $mesg='
'; - if ($mailfile->error) - { - $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); - $mesg.='
'.$mailfile->error; - } - else - { - $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; - } - $mesg.='
'; - } - } - } - else - { - $langs->load("other"); - $mesg='
'.$langs->trans('ErrorMailRecipientIsEmpty').' !
'; - dol_syslog('Recipient email is empty'); - } - - $action='presend'; - } - - else if ($action == 'update_extras') + if ($action == 'update_extras') { // Fill array 'array_options' with data from update form $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); @@ -1249,6 +1124,20 @@ else if ($id > 0 || ! empty($ref)) $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&line_id='.$lineid, $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1); } + // Clone confirmation + if ($action == 'clone') { + // Create an array for form + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => + // 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' + // => 1), + array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '', '', 0, 0, null, 0, 'minwidth200'))); + // Paiement incomplet. On demande si motif = escompte ou autre + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneIntervention'), $langs->trans('ConfirmCloneIntervention', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + } + if (!$formconfirm) { $parameters=array('lineid'=>$lineid); @@ -1362,15 +1251,8 @@ else if ($id > 0 || ! empty($ref)) print '
'; if ($action == 'contrat') { - print ''; - print ''; - print ''; - print '
'; - $htmlcontract= new Formcontract($db); - //print "$socid,$selected,$htmlname"; - $htmlcontract->select_contract($object->socid,$object->fk_contrat,'contratid'); - - print '
'; + $formcontract= new Formcontract($db); + $formcontract->formSelectContract($_SERVER["PHP_SELF"].'?id='.$object->id, $object->socid, $object->fk_contrat, 'contratid', 0, 1); } else { @@ -1743,6 +1625,11 @@ else if ($id > 0 || ! empty($ref)) } } + // Clone + if ($user->rights->ficheinter->creer) { + print ''; + } + // Delete if (($object->statut == 0 && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) { @@ -1755,7 +1642,6 @@ else if ($id > 0 || ! empty($ref)) } print ''; - print '
'; if ($action != 'presend') { diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 66fb1031d6e..54d5dc05c33 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -220,7 +220,6 @@ class Fichinter extends CommonObject if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { - $result=$this->insertExtraFields(); if ($result < 0) { @@ -926,6 +925,102 @@ class Fichinter extends CommonObject return -2; } + + + /** + * Load an object from its id and create a new one in database + * + * @param int $socid Id of thirdparty + * @return int New id of clone + */ + function createFromClone($socid=0) + { + global $user,$hookmanager; + + $error=0; + + $this->context['createfromclone'] = 'createfromclone'; + + $this->db->begin(); + + // get extrafields so they will be clone + foreach($this->lines as $line) + $line->fetch_optionals($line->rowid); + + // Load source object + $objFrom = clone $this; + + // Change socid if needed + if (! empty($socid) && $socid != $this->socid) + { + $objsoc = new Societe($this->db); + + if ($objsoc->fetch($socid)>0) + { + $this->socid = $objsoc->id; + //$this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); + //$this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); + $this->fk_project = ''; + $this->fk_delivery_address = ''; + } + + // TODO Change product price if multi-prices + } + + $this->id=0; + $this->ref = ''; + $this->statut=0; + + // Clear fields + $this->user_author_id = $user->id; + $this->user_valid = ''; + $this->date_creation = ''; + $this->date_validation = ''; + $this->ref_client = ''; + + // Create clone + $result=$this->create($user); + if ($result < 0) $error++; + + if (! $error) + { + // Add lines because it is not included into create function + foreach ($this->lines as $line) + { + $this->addline($user, $this->id, $line->desc, $line->datei, $line->duration); + } + + // Hook of thirdparty module + if (is_object($hookmanager)) + { + $parameters=array('objFrom'=>$objFrom); + $action=''; + $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) $error++; + } + + // Call trigger + $result=$this->call_trigger('INTERVENTION_CLONE',$user); + if ($result < 0) $error++; + // End call triggers + } + + unset($this->context['createfromclone']); + + // End + if (! $error) + { + $this->db->commit(); + return $this->id; + } + else + { + $this->db->rollback(); + return -1; + } + } + + /** * Adding a line of intervention into data base * @@ -1036,9 +1131,11 @@ class Fichinter extends CommonObject $line = new FichinterLigne($this->db); $line->id = $objp->rowid; $line->desc = $objp->description; + $line->duration = $objp->duree; //For invoicing we calculing hours $line->qty = round($objp->duree/3600,2); $line->date = $this->db->jdate($objp->date); + $line->datei = $this->db->jdate($objp->date); $line->rang = $objp->rang; $line->product_type = 1; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 81121f3b4bf..5d88dd78977 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Jean-François Ferry * * 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 @@ -64,13 +64,13 @@ $search_status=GETPOST('search_status'); $sall=GETPOST('sall'); $optioncss = GETPOST('optioncss','alpha'); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers -{ - $search_ref=""; - $search_company=""; - $search_desc=""; - $search_status=""; -} +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('interventionlist')); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('fichinter'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); // List of fields to search into when doing a "search in all" $fieldstosearchall = array( @@ -82,6 +82,52 @@ $fieldstosearchall = array( if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate"; if (! empty($conf->global->FICHINTER_DISABLE_DETAILS)) unset($fieldstosearchall['f.description']); +// Definition of fields for list +$arrayfields=array( + 'f.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), + 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), + 'f.fk_project'=>array('label'=>$langs->trans("Project"), 'checked'=>1), + 'f.fk_contrat'=>array('label'=>$langs->trans("Contract"), 'checked'=>1), + 'f.description'=>array('label'=>$langs->trans("Description"), 'checked'=>1), + 'fd.description'=>array('label'=>"xx", 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0), + 'fd.date'=>array('label'=>$langs->trans("Date"), 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0), + 'fd.duree'=>array('label'=>$langs->trans("Duration"), 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0), + 'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), + 'f.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), +); +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) + { + $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); + } +} + + +/* + * Acions + */ + +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_ref=""; + $search_company=""; + $search_project=""; + $search_contract=""; + $search_desc=""; + $search_status=""; + $search_array_options=array(); +} + + /* * View @@ -94,13 +140,20 @@ llxHeader('', $langs->trans("Intervention")); $sql = "SELECT"; -$sql.= " f.ref, f.rowid as fichid, f.fk_statut, f.description,"; +$sql.= " f.ref, f.rowid as fichid, f.fk_statut, f.description, f.datec as date_creation, f.tms as date_update,"; if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sql.= " fd.description as descriptiondetail, fd.date as dp, fd.duree,"; $sql.= " s.nom as name, s.rowid as socid, s.client"; -$sql.= " FROM (".MAIN_DB_PREFIX."societe as s"; -if (! $user->rights->societe->client->voir && empty($socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql.= ", ".MAIN_DB_PREFIX."fichinter as f)"; +// Add fields from extrafields +foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f"; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinter_extrafields as ef on (f.rowid = ef.fk_object)"; if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid"; +if (! $user->rights->societe->client->voir && empty($socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +$sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE f.fk_soc = s.rowid "; $sql.= " AND f.entity = ".$conf->entity; if ($search_ref) { @@ -123,6 +176,23 @@ if ($socid) if ($sall) { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } +// Add where from extra fields +foreach ($search_array_options as $key => $val) +{ + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $typ=$extrafields->attribute_type[$tmpkey]; + $mode=0; + if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric + if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) + { + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + } +} +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); $totalnboflines=0; @@ -149,7 +219,14 @@ if ($result) if ($search_desc) $param.="&search_desc=".urlencode($search_desc); if ($search_status != '' && $search_status > -1) $param.="&search_status=".urlencode($search_status); if ($optioncss != '') $param.='&optioncss='.$optioncss; - + // Add $param from extra fields + foreach ($search_array_options as $key => $val) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); + } + print ''."\n"; if ($optioncss != '') print ''; print ''; @@ -165,42 +242,120 @@ if ($result) foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); } - - print ''; + $moreforfilter=''; + + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + + print '
'; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$param,'width="15%"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$param,'',$sortfield,$sortorder); - if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$param,'width="15%"',$sortfield,$sortorder); + if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['f.description']['checked'])) print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['fd.description']['checked'])) print_liste_field_titre('',$_SERVER["PHP_SELF"],''); + if (! empty($arrayfields['fd.date']['checked'])) print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fd.date","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['fd.duree']['checked'])) print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],"fd.duree","",$param,'align="right"',$sortfield,$sortorder); + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - print_liste_field_titre('',$_SERVER["PHP_SELF"],''); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fd.date","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],"fd.duree","",$param,'align="right"',$sortfield,$sortorder); + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + } + } } - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.fk_statut","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); + // Hook fields + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"f.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"f.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.fk_statut","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; print ''; - print ''; - if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) - { - // Desc of line - print ''; - print ''; + if (! empty($arrayfields['f.ref']['checked'])) + { + print ''; + } + if (! empty($arrayfields['s.nom']['checked'])) + { + print ''; + } + if (! empty($arrayfields['f.description']['checked'])) + { + print ''; + } + if (! empty($arrayfields['fd.description']['checked'])) + { + // Desc of line print ''; + } + if (! empty($arrayfields['fd.date']['checked'])) + { + print ''; + } + if (! empty($arrayfields['fd.duree']['checked'])) + { + print ''; } - print ''; + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + $typeofextrafield=$extrafields->attribute_type[$key]; + print ''; + } + } + } + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (! empty($arrayfields['f.datec']['checked'])) + { + // Date creation + print ''; + } + if (! empty($arrayfields['f.tms']['checked'])) + { + // Date modification + print ''; + } + if (! empty($arrayfields['f.fk_statut']['checked'])) + { + print ''; + } print '"; - print "\n"; - print ''; - print ''; - if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + if (! empty($arrayfields['f.ref']['checked'])) { - //print ''; - print ''; - print '\n"; - print ''; + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['s.nom']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['f.description']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['fd.description']['checked'])) + { + //print ''; + print ''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['fd.date']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['fd.duree']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totaldurationfield']=$totalarray['nbfield']; + $totalarray['totalduration']+=$obj->duree; } - print ''; - print ''; + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + print 'getAlignFlag($key); + if ($align) print ' align="'.$align.'"'; + print '>'; + $tmpkey='options_'.$key; + print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); + print ''; + if (! $i) $totalarray['nbfield']++; + } + } + } + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (! empty($arrayfields['f.datec']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Date modification + if (! empty($arrayfields['f.tms']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Status + if (! empty($arrayfields['f.fk_statut']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Action column + print ''; + if (! $i) $totalarray['nbfield']++; + print "\n"; - $total += $objp->duree; + $total += $obj->duree; $i++; } - $rowspan=3; - if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + + // Show total line + if (isset($totalarray['totalduration'])) { - print ''; - print ''; - print ''; + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if ($i == 1) + { + if ($num < $limit) print ''; + else print ''; + } + elseif ($totalarray['totaldurationfield'] == $i) print ''; + else print ''; + } + print ''; } print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print '  '; + print ''; + print ''; + print ''; + print ''; + print ''; + print '   '; - $liststatus=$interventionstatic->statuts_short; - print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1); - print ''; + if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select'))) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $searchclass=''; + if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; + if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; + print ''; + } + print ''; + print ''; + print ''; + $liststatus=$interventionstatic->statuts_short; + print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1); + print ''; $searchpitco=$form->showFilterAndCheckAddButtons(0); print $searchpitco; @@ -212,44 +367,129 @@ if ($result) $var=True; $total = 0; $i = 0; + $totalarray=array(); while ($i < min($num, $limit)) { - $objp = $db->fetch_object($result); + $obj = $db->fetch_object($result); + + $interventionstatic->id=$obj->fichid; + $interventionstatic->ref=$obj->ref; + $interventionstatic->statut=$obj->fk_statut; + $var=!$var; print "
"; - $interventionstatic->id=$objp->fichid; - $interventionstatic->ref=$objp->ref; - print $interventionstatic->getNomUrl(1); - print "'; - $companystatic->name=$objp->name; - $companystatic->id=$objp->socid; - $companystatic->client=$objp->client; - print $companystatic->getNomUrl(1,'',44); - print ''.dol_trunc(dolGetFirstLineOfText($objp->description),48).''.dol_trunc(dol_escape_htmltag(dolGetFirstLineOfText($objp->descriptiondetail)),48).''.dolGetFirstLineOfText($objp->descriptiondetail).''.dol_print_date($db->jdate($objp->dp),'dayhour')."'.convertSecondToTime($objp->duree).'"; + print $interventionstatic->getNomUrl(1); + print "'; + $companystatic->name=$obj->name; + $companystatic->id=$obj->socid; + $companystatic->client=$obj->client; + print $companystatic->getNomUrl(1,'',44); + print ''.dol_trunc(dolGetFirstLineOfText($obj->description),48).''.dol_trunc(dol_escape_htmltag(dolGetFirstLineOfText($obj->descriptiondetail)),48).''.dolGetFirstLineOfText($obj->descriptiondetail).''.dol_print_date($db->jdate($obj->dp),'dayhour')."'.convertSecondToTime($obj->duree, 'allhourmin').''.$interventionstatic->LibStatut($objp->fk_statut,5).' '; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour'); + print ''.$interventionstatic->LibStatut($obj->fk_statut,5).'
'.$langs->trans("Total").''.convertSecondToTime($total).'  
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.convertSecondToTime($totalarray['totalduration'], 'allhourmin').'
'; @@ -264,4 +504,4 @@ else llxFooter(); -$db->close(); \ No newline at end of file +$db->close(); diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 92a41209ba4..54053c26606 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.0-beta'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.0-rc'); if (! defined('EURO')) define('EURO',chr(128)); diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 8729834ec3e..d8bb890c0dd 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -448,6 +448,18 @@ if ($object->id > 0) } // TODO move to DAO class + $sql = "SELECT count(p.rowid) as total"; + $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p "; + $sql.= " WHERE p.fk_soc =".$object->id; + $sql.= " AND p.entity =".$conf->entity; + $sql.= " ORDER BY p.date_commande DESC"; + $resql=$db->query($sql); + if ($resql) + { + $object_count = $db->fetch_object($resql); + $num = $object_count->total; + } + $sql = "SELECT p.rowid,p.ref, p.date_commande as dc, p.fk_statut, p.total_ht, p.tva as total_tva, p.total_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p "; $sql.= " WHERE p.fk_soc =".$object->id; @@ -458,7 +470,6 @@ if ($object->id > 0) if ($resql) { $i = 0 ; - $num = $db->num_rows($resql); if ($num > 0) { @@ -474,7 +485,7 @@ if ($object->id > 0) } $var = True; - while ($i < $num && $i <= $MAXLIST) + while ($i < $num && $i < $MAXLIST) { $obj = $db->fetch_object($resql); $var=!$var; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 69932f0c232..8c1a86b03a5 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1647,7 +1647,8 @@ class FactureFournisseur extends CommonInvoice $now = dol_now(); - // Charge tableau des produits prodids + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index e9a67a0e98e..34a11663e2a 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -6,8 +6,6 @@ * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2015 Marcos García * Copyright (C) 2016 Charlie Benke - - status * * 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 diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index c940486d73b..fa93be5020d 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -870,10 +870,10 @@ if (empty($reshook)) if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) // En get ou en post { // Build document - - // Save last template used to generate document - if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); - + + // Save last template used to generate document + if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); + $outputlangs = $langs; if (GETPOST('lang_id')) { @@ -883,7 +883,7 @@ if (empty($reshook)) $result= $object->generateDocument($object->modelpdf,$outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { - setEventMessages($object->error, $object->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $action=''; } } @@ -899,7 +899,7 @@ if (empty($reshook)) if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); } - + if ($action == 'update_extras') { // Fill array 'array_options' with data from add form @@ -1145,190 +1145,17 @@ if (empty($reshook)) } } - /* - * Add file in email form - */ - if (GETPOST('addfile')) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory TODO Use a dedicated directory for temp mails files - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - dol_add_file_process($upload_dir_tmp,0,0); - $action='presend'; - } - - /* - * Remove file in email form - */ - if (GETPOST('removedfile')) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - // TODO Delete only files that was uploaded from email form - dol_remove_file_process(GETPOST('removedfile','alpha'),0); - $action='presend'; - } - /* * Send mail */ - if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) - { - $langs->load('mails'); - - if ($object->id > 0) - { - // $ref = dol_sanitizeFileName($object->ref); - // $file = $conf->fournisseur->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf'; - - // if (is_readable($file)) - // { - if (GETPOST('sendto','alpha')) - { - // Le destinataire a ete fourni via le champ libre - $sendto = GETPOST('sendto','alpha'); - $sendtoid = 0; - } - elseif (GETPOST('receiver','alpha') != '-1') - { - // Recipient was provided from combo list - if (GETPOST('receiver','alpha') == 'thirdparty') // Id of third party - { - $sendto = $object->thirdparty->email; - $sendtoid = 0; - } - else // Id du contact - { - $sendto = $object->thirdparty->contact_get_property(GETPOST('receiver','alpha'),'email'); - $sendtoid = GETPOST('receiver','alpha'); - } - } - - if (dol_strlen($sendto)) - { - $langs->load("commercial"); - - $from = GETPOST('fromname','alpha') . ' <' . GETPOST('frommail','alpha') .'>'; - $replyto = GETPOST('replytoname','alpha'). ' <' . GETPOST('replytomail','alpha').'>'; - $message = GETPOST('message'); - $sendtocc = GETPOST('sendtocc','alpha'); - $deliveryreceipt = GETPOST('deliveryreceipt','alpha'); - - if ($action == 'send') - { - if (dol_strlen(GETPOST('subject'))) $subject=GETPOST('subject'); - else $subject = $langs->transnoentities('CustomerOrder').' '.$object->ref; - $actiontypecode='AC_SUP_ORD'; - $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; - if ($message) - { - if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); - $actionmsg = dol_concatdesc($actionmsg, $message); - } - $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); - } - - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - - $attachedfiles=$formmail->get_attached_files(); - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; - - // Send mail - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1); - if ($mailfile->error) - { - setEventMessages($mailfile->error, $mailfile->errors, 'errors'); - } - else - { - $result=$mailfile->sendfile(); - if ($result) - { - $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain " - setEventMessages($mesg, null, 'mesgs'); - - $error=0; - - // Initialisation donnees - $object->sendtoid = $sendtoid; - $object->actiontypecode = $actiontypecode; - $object->actionmsg = $actionmsg; - $object->actionmsg2 = $actionmsg2; - $object->fk_element = $object->id; - $object->elementtype = $object->element; - - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('ORDER_SUPPLIER_SENTBYMAIL',$object,$user,$langs,$conf); - if ($result < 0) { $error++; $errors=$interface->errors; } - // Fin appel triggers - - if ($error) - { - setEventMessages($object->error, $object->errors, 'errors'); - } - else - { - // Redirect here - // This avoid sending mail twice if going out and then back to page - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; - } - } - else - { - $langs->load("other"); - if ($mailfile->error) - { - $mesg = $langs->trans('ErrorFailedToSendMail',$from,$sendto); - $mesg.= '
'.$mailfile->error; - } - else - { - $mesg = 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; - } - - setEventMessages($mesg, null, 'errors'); - } - } - /* } - else - { - $langs->load("other"); - $mesg='
'.$langs->trans('ErrorMailRecipientIsEmpty').' !
'; - $action='presend'; - dol_syslog('Recipient email is empty'); - }*/ - } - else - { - $langs->load("errors"); - setEventMessages($langs->trans('ErrorCantReadFile',$file), null, 'errors'); - dol_syslog('Failed to read file: '.$file); - } - } - else - { - $langs->load("other"); - setEventMessages($langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")), null, 'errors'); - dol_syslog('Impossible de lire les donnees de la facture. Le fichier facture n\'a peut-etre pas ete genere.'); - } - } + + // Actions to send emails + $actiontypecode='AC_SUP_ORD'; + $trigger_name='ORDER_SUPPLIER_SENTBYMAIL'; + $paramname='id'; + $mode='emailfromsupplierorder'; + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; + if ($action == 'webservice' && GETPOST('mode', 'alpha') == "send" && ! GETPOST('cancel')) { diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index 64f6aa4dff0..89f0a942172 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -71,11 +71,17 @@ $date_end = dol_mktime(23, 59, 59, $_REQUEST["date_endmonth"], $_REQUEST["date_e $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"]); -if ($action == 'create') { - if (is_array($selected) == false) { - $mesgs = array ( - '
' . $langs->trans('Error_OrderNotChecked') . '
' - ); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label('facture_fourn'); + +if ($action == 'create') +{ + if (! is_array($selected)) + { + $error++; + setEventMessages($langs->trans('Error_OrderNotChecked'), null, 'errors'); } else { $origin = GETPOST('origin'); $originid = GETPOST('originid'); @@ -87,11 +93,12 @@ include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); $hookmanager->initHooks(array('orderstoinvoicesupplier')); + /* * Actions */ -if (($action == 'create' || $action == 'add') && empty($mesgs)) { +if (($action == 'create' || $action == 'add') && ! $error) { require_once DOL_DOCUMENT_ROOT . '/core/lib/fourn.lib.php'; if (! empty($conf->projet->enabled)) @@ -160,6 +167,9 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) { if (empty($object->date_echeance)) $object->date_echeance = $object->calculate_date_lim_reglement(); + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if ($ret < 0) $error++; + if ($_POST['origin'] && $_POST['originid']) { $object->linked_objects = $orders_id; $id = $object->create($user); @@ -360,6 +370,12 @@ if ($action == 'create' && !$error) { ); $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 FactureFournisseur($db); + print $object->showOptionals($extrafields,'edit'); + } + // Modele PDF print '
' . $langs->trans('Model') . ''; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index f078c714416..a8c2ff747ad 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -311,14 +311,17 @@ if (empty($reshook)) } // Delete payment - elseif ($action == 'deletepaiement' && $user->rights->fournisseur->facture->creer) + elseif ($action == 'confirm_delete_paiement' && $confirm == 'yes' && $user->rights->fournisseur->facture->creer) { - $object->fetch($id); + $object->fetch($id); if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0) { $paiementfourn = new PaiementFourn($db); $result=$paiementfourn->fetch(GETPOST('paiement_id')); - if ($result > 0) $result=$paiementfourn->delete(); // If fetch ok and found + if ($result > 0) { + $result=$paiementfourn->delete(); // If fetch ok and found + header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); + } if ($result < 0) { setEventMessages($paiementfourn->error, $paiementfourn->errors, 'errors'); } @@ -932,184 +935,17 @@ if (empty($reshook)) } } - // Add file in email form - if (GETPOST('addfile')) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory TODO Use a dedicated directory for temp mails files - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - dol_add_file_process($upload_dir_tmp,0,0); - $action='presend'; - } - - // Remove file in email form - if (! empty($_POST['removedfile'])) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - // TODO Delete only files that was uploaded from email form - dol_remove_file_process(GETPOST('removedfile','alpha'),0); - $action='presend'; - } - - // Send mail - if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel']) - { - $langs->load('mails'); - - $object->fetch($id); - $result=$object->fetch_thirdparty(); - if ($result > 0) - { - if ($_POST['sendto']) - { - // Le destinataire a ete fourni via le champ libre - $sendto = $_POST['sendto']; - $sendtoid = 0; - } - elseif ($_POST['receiver'] != '-1') - { - // Recipient was provided from combo list - if ($_POST['receiver'] == 'thirdparty') // Id of third party - { - $sendto = $object->thirdparty->email; - $sendtoid = 0; - } - else // Id du contact - { - $sendto = $object->thirdparty->contact_get_property($_POST['receiver'],'email'); - $sendtoid = $_POST['receiver']; - } - } - - if (dol_strlen($sendto)) - { - $langs->load("commercial"); - - $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; - $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; - $message = $_POST['message']; - $sendtocc = $_POST['sendtocc']; - $deliveryreceipt = $_POST['deliveryreceipt']; - - if ($action == 'send') - { - if (dol_strlen($_POST['subject'])) $subject=$_POST['subject']; - else $subject = $langs->transnoentities('CustomerOrder').' '.$object->ref; - $actiontypecode='AC_SUP_INV'; - $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; - if ($message) - { - if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); - $actionmsg = dol_concatdesc($actionmsg, $message); - } - $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); - } - - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - - $attachedfiles=$formmail->get_attached_files(); - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; - - // Send mail - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1); - if ($mailfile->error) - { - setEventMessages($mailfile->error, $mailfile->errors, 'errors'); - } - else - { - $result=$mailfile->sendfile(); - if ($result) - { - $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain " - setEventMessages($mesg, null, 'mesgs'); - - $error=0; - - // Init data for trigger - $object->sendtoid = $sendtoid; - $object->actiontypecode = $actiontypecode; - $object->actionmsg = $actionmsg; - $object->actionmsg2 = $actionmsg2; - $object->fk_element = $object->id; - $object->elementtype = $object->element; - - $object->email_subject = $subject; - $object->email_to = $sendto; - $object->email_tocc = $sendtocc; - $object->email_tobcc = $sendtobcc; - $object->email_from = $from; - $object->email_content = $_POST['message']; - - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('BILL_SUPPLIER_SENTBYMAIL',$object,$user,$langs,$conf); - if ($result < 0) { - $error++; $object->errors=$interface->errors; - } - // End call triggers - - if ($error) - { - dol_print_error($db); - } - else - { - // Redirect here - // This avoid sending mail twice if going out and then back to page - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; - } - } - else - { - $langs->load("other"); - if ($mailfile->error) - { - $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); - $mesg.='
'.$mailfile->error; - } - else - { - $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; - } - setEventMessages($mesg, null, 'errors'); - } - } - } - - else - { - $langs->load("other"); - setEventMessages($langs->trans('ErrorMailRecipientIsEmpty'), null, 'errors'); - dol_syslog('Recipient email is empty'); - } - } - else - { - $langs->load("other"); - setEventMessages($langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")), null, 'errors'); - dol_syslog('Unable to read data from the invoice. The invoice file has perhaps not been generated.'); - } - - //$action = 'presend'; - } + /* + * Send mail + */ + + // Actions to send emails + $actiontypecode='AC_SUP_INV'; + $trigger_name='BILL_SUPPLIER_SENTBYMAIL'; + $paramname='id'; + $mode='emailfromsupplierinvoice'; + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; + // Build document if ($action == 'builddoc') @@ -1787,6 +1623,12 @@ else { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete', '', 0, 1); + } + if ($action == 'deletepaiement') + { + $payment_id = GETPOST('paiement_id'); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&paiement_id='.$payment_id, $langs->trans('DeletePayment'), $langs->trans('ConfirmDeletePayment'), 'confirm_delete_paiement', '', 0, 1); + } // Confirmation to delete line @@ -1903,7 +1745,7 @@ else { $num = $db->num_rows($result); $i = 0; $totalpaye = 0; - print ''; + print '
'; print ''; print ''; print ''; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 88f01c1e837..9412c5eb015 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -743,17 +743,20 @@ if ($resql) $facturestatic->ref_supplier=$obj->ref_supplier; $facturestatic->date_echeance = $db->jdate($obj->datelimite); $facturestatic->statut = $obj->fk_statut; - + print ''; if (! empty($arrayfields['f.ref']['checked'])) { print '\n"; + $subdir = get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref); + print $formfile->getDocumentsLink('facture_fournisseur', $subdir, $filedir); + + print "\n"; if (! $i) $totalarray['nbfield']++; } diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index a9fe469c0cf..e4b5070f097 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -50,6 +50,8 @@ $langs->load('users'); $cp = new Holiday($db); +$alltypeleaves=$cp->getTypes(1,-1); // To have labels + llxHeader('', $langs->trans('CPTitreMenu').' ('.$langs->trans("Year").' '.$year.')'); // Recent changes are more important than old changes @@ -94,7 +96,10 @@ foreach($cp->logs as $logs_CP) print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''."\n"; diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/cs/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/cs/config index 42cdf326704..500460e8ab5 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/cs/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/cs/config @@ -1,47 +1,47 @@ +## +## PHPExcel ## -## PHPExcel -## -## Copyright (c) 2006 - 2013 PHPExcel -## -## This library is free software; you can redistribute it and/or -## modify it under the terms of the GNU Lesser General Public -## License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## -## This library is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Lesser General Public License for more details. -## -## You should have received a copy of the GNU Lesser General Public -## License along with this library; if not, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -## -## @category PHPExcel -## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) -## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version ##VERSION##, ##DATE## -## -## - - -ArgumentSeparator = ; - - -## -## (For future use) -## -currencySymbol = KÄ - - -## -## Excel Error Codes (For future use) -## -NULL = #NULL! -DIV0 = #DIV/0! -VALUE = #HODNOTA! -REF = #REF! -NAME = #NÃZEV? -NUM = #NUM! -NA = #N/A +## Copyright (c) 2006 - 2013 PHPExcel +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## @category PHPExcel +## @package PHPExcel_Settings +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) +## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL +## @version ##VERSION##, ##DATE## +## +## + + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = KÄ + + +## +## Excel Error Codes (For future use) +## +NULL = #NULL! +DIV0 = #DIV/0! +VALUE = #HODNOTA! +REF = #REF! +NAME = #NÃZEV? +NUM = #NUM! +NA = #N/A diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/cs/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/cs/functions index f9d69784ae2..b648e20c2b0 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/cs/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/cs/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/da/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/da/config index ae5900311e8..b959379b133 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/da/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/da/config @@ -1,48 +1,48 @@ +## +## PHPExcel ## -## PHPExcel -## -## Copyright (c) 2006 - 2013 PHPExcel -## -## This library is free software; you can redistribute it and/or -## modify it under the terms of the GNU Lesser General Public -## License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## -## This library is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Lesser General Public License for more details. -## -## You should have received a copy of the GNU Lesser General Public -## License along with this library; if not, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -## -## @category PHPExcel -## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) -## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version ##VERSION##, ##DATE## -## -## - - -ArgumentSeparator = ; - - -## -## (For future use) -## +## Copyright (c) 2006 - 2013 PHPExcel +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## @category PHPExcel +## @package PHPExcel_Settings +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) +## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL +## @version ##VERSION##, ##DATE## +## +## + + +ArgumentSeparator = ; + + +## +## (For future use) +## currencySymbol = kr - - - -## -## Excel Error Codes (For future use) -## -NULL = #NUL! -DIV0 = #DIVISION/0! -VALUE = #VÆRDI! -REF = #REFERENCE! -NAME = #NAVN? -NUM = #NUM! -NA = #I/T + + + +## +## Excel Error Codes (For future use) +## +NULL = #NUL! +DIV0 = #DIVISION/0! +VALUE = #VÆRDI! +REF = #REFERENCE! +NAME = #NAVN? +NUM = #NUM! +NA = #I/T diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/da/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/da/functions index 1db4d30bb1c..1599ccd1815 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/da/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/da/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/de/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/de/config index aa0228e7f97..7e2ba9d2891 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/de/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/de/config @@ -1,47 +1,47 @@ +## +## PHPExcel ## -## PHPExcel -## -## Copyright (c) 2006 - 2013 PHPExcel -## -## This library is free software; you can redistribute it and/or -## modify it under the terms of the GNU Lesser General Public -## License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## -## This library is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Lesser General Public License for more details. -## -## You should have received a copy of the GNU Lesser General Public -## License along with this library; if not, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -## -## @category PHPExcel -## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) -## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version ##VERSION##, ##DATE## -## -## - - -ArgumentSeparator = ; - - -## -## (For future use) -## -currencySymbol = € - - -## -## Excel Error Codes (For future use) -## -NULL = #NULL! -DIV0 = #DIV/0! -VALUE = #WERT! -REF = #BEZUG! -NAME = #NAME? -NUM = #ZAHL! -NA = #NV +## Copyright (c) 2006 - 2013 PHPExcel +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## @category PHPExcel +## @package PHPExcel_Settings +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) +## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL +## @version ##VERSION##, ##DATE## +## +## + + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = € + + +## +## Excel Error Codes (For future use) +## +NULL = #NULL! +DIV0 = #DIV/0! +VALUE = #WERT! +REF = #BEZUG! +NAME = #NAME? +NUM = #ZAHL! +NA = #NV diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/de/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/de/functions index ce85641a3c9..8214f384878 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/de/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/de/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/en/uk/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/en/uk/config index 532080b57b0..00acff8bc34 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/en/uk/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/en/uk/config @@ -1,32 +1,32 @@ +## +## PHPExcel ## -## PHPExcel -## -## Copyright (c) 2006 - 2013 PHPExcel -## -## This library is free software; you can redistribute it and/or -## modify it under the terms of the GNU Lesser General Public -## License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## -## This library is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Lesser General Public License for more details. -## -## You should have received a copy of the GNU Lesser General Public -## License along with this library; if not, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -## -## @category PHPExcel -## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) -## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version ##VERSION##, ##DATE## -## -## - - -## -## (For future use) -## -currencySymbol = £ +## Copyright (c) 2006 - 2013 PHPExcel +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## @category PHPExcel +## @package PHPExcel_Settings +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) +## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL +## @version ##VERSION##, ##DATE## +## +## + + +## +## (For future use) +## +currencySymbol = £ diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/es/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/es/config index 96cfa69db17..8f7d9e084ec 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/es/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/es/config @@ -1,47 +1,47 @@ +## +## PHPExcel ## -## PHPExcel -## -## Copyright (c) 2006 - 2013 PHPExcel -## -## This library is free software; you can redistribute it and/or -## modify it under the terms of the GNU Lesser General Public -## License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## -## This library is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Lesser General Public License for more details. -## -## You should have received a copy of the GNU Lesser General Public -## License along with this library; if not, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -## -## @category PHPExcel -## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) -## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version ##VERSION##, ##DATE## -## -## - - -ArgumentSeparator = ; - - -## -## (For future use) -## -currencySymbol = $ ## I'm surprised that the Excel Documentation suggests $ rather than € - - -## -## Excel Error Codes (For future use) -## -NULL = #¡NULO! -DIV0 = #¡DIV/0! -VALUE = #¡VALOR! -REF = #¡REF! -NAME = #¿NOMBRE? -NUM = #¡NÚM! -NA = #N/A +## Copyright (c) 2006 - 2013 PHPExcel +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## @category PHPExcel +## @package PHPExcel_Settings +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) +## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL +## @version ##VERSION##, ##DATE## +## +## + + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = $ ## I'm surprised that the Excel Documentation suggests $ rather than € + + +## +## Excel Error Codes (For future use) +## +NULL = #¡NULO! +DIV0 = #¡DIV/0! +VALUE = #¡VALOR! +REF = #¡REF! +NAME = #¿NOMBRE? +NUM = #¡NÚM! +NA = #N/A diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/es/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/es/functions index 51ce48b3153..aa065969f3d 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/es/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/es/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fi/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fi/config index 498cf4ceb8e..36bc3fc70b8 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fi/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fi/config @@ -1,47 +1,47 @@ +## +## PHPExcel ## -## PHPExcel -## -## Copyright (c) 2006 - 2013 PHPExcel -## -## This library is free software; you can redistribute it and/or -## modify it under the terms of the GNU Lesser General Public -## License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## -## This library is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Lesser General Public License for more details. -## -## You should have received a copy of the GNU Lesser General Public -## License along with this library; if not, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -## -## @category PHPExcel -## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) -## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version ##VERSION##, ##DATE## -## -## - - -ArgumentSeparator = ; - - -## -## (For future use) -## -currencySymbol = $ # Symbol not known, should it be a € (Euro)? - - -## -## Excel Error Codes (For future use) -## -NULL = #TYHJÄ! -DIV0 = #JAKO/0! -VALUE = #ARVO! -REF = #VIITTAUS! -NAME = #NIMI? -NUM = #LUKU! -NA = #PUUTTUU +## Copyright (c) 2006 - 2013 PHPExcel +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## @category PHPExcel +## @package PHPExcel_Settings +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) +## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL +## @version ##VERSION##, ##DATE## +## +## + + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = $ # Symbol not known, should it be a € (Euro)? + + +## +## Excel Error Codes (For future use) +## +NULL = #TYHJÄ! +DIV0 = #JAKO/0! +VALUE = #ARVO! +REF = #VIITTAUS! +NAME = #NIMI? +NUM = #LUKU! +NA = #PUUTTUU diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fi/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fi/functions index 7bed722a641..c10b3b9f381 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fi/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fi/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fr/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fr/config index 1f5db88c43b..80f7d5411a6 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fr/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fr/config @@ -1,47 +1,47 @@ +## +## PHPExcel ## -## PHPExcel -## -## Copyright (c) 2006 - 2013 PHPExcel -## -## This library is free software; you can redistribute it and/or -## modify it under the terms of the GNU Lesser General Public -## License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## -## This library is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Lesser General Public License for more details. -## -## You should have received a copy of the GNU Lesser General Public -## License along with this library; if not, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -## -## @category PHPExcel -## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) -## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version ##VERSION##, ##DATE## -## -## - - -ArgumentSeparator = ; - - -## -## (For future use) -## -currencySymbol = € - - -## -## Excel Error Codes (For future use) -## -NULL = #NUL! -DIV0 = #DIV/0! -VALUE = #VALEUR! -REF = #REF! -NAME = #NOM? -NUM = #NOMBRE! -NA = #N/A +## Copyright (c) 2006 - 2013 PHPExcel +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## @category PHPExcel +## @package PHPExcel_Settings +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) +## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL +## @version ##VERSION##, ##DATE## +## +## + + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = € + + +## +## Excel Error Codes (For future use) +## +NULL = #NUL! +DIV0 = #DIV/0! +VALUE = #VALEUR! +REF = #REF! +NAME = #NOM? +NUM = #NOMBRE! +NA = #N/A diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fr/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fr/functions index 8d25f6ac193..cce977b15bc 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fr/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/fr/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/hu/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/hu/config index 080b2018faa..c6c315814c4 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/hu/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/hu/config @@ -1,47 +1,47 @@ +## +## PHPExcel ## -## PHPExcel -## -## Copyright (c) 2006 - 2013 PHPExcel -## -## This library is free software; you can redistribute it and/or -## modify it under the terms of the GNU Lesser General Public -## License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## -## This library is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Lesser General Public License for more details. -## -## You should have received a copy of the GNU Lesser General Public -## License along with this library; if not, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -## -## @category PHPExcel -## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) -## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version ##VERSION##, ##DATE## -## -## - - -ArgumentSeparator = ; - - -## -## (For future use) -## -currencySymbol = Ft - - -## -## Excel Error Codes (For future use) -## -NULL = #NULLA! -DIV0 = #ZÉRÓOSZTÓ! -VALUE = #ÉRTÉK! -REF = #HIV! -NAME = #NÉV? -NUM = #SZÃM! -NA = #HIÃNYZIK +## Copyright (c) 2006 - 2013 PHPExcel +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## @category PHPExcel +## @package PHPExcel_Settings +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) +## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL +## @version ##VERSION##, ##DATE## +## +## + + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = Ft + + +## +## Excel Error Codes (For future use) +## +NULL = #NULLA! +DIV0 = #ZÉRÓOSZTÓ! +VALUE = #ÉRTÉK! +REF = #HIV! +NAME = #NÉV? +NUM = #SZÃM! +NA = #HIÃNYZIK diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/hu/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/hu/functions index 4abce13b91b..941c1b740d0 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/hu/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/hu/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/it/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/it/config index c3afa754b90..97af8b9a570 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/it/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/it/config @@ -1,47 +1,47 @@ +## +## PHPExcel ## -## PHPExcel -## -## Copyright (c) 2006 - 2013 PHPExcel -## -## This library is free software; you can redistribute it and/or -## modify it under the terms of the GNU Lesser General Public -## License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## -## This library is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Lesser General Public License for more details. -## -## You should have received a copy of the GNU Lesser General Public -## License along with this library; if not, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -## -## @category PHPExcel -## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) -## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version ##VERSION##, ##DATE## -## -## - - -ArgumentSeparator = ; - - -## -## (For future use) -## -currencySymbol = € - - -## -## Excel Error Codes (For future use) -## -NULL = #NULLO! -DIV0 = #DIV/0! -VALUE = #VALORE! -REF = #RIF! -NAME = #NOME? -NUM = #NUM! -NA = #N/D +## Copyright (c) 2006 - 2013 PHPExcel +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## @category PHPExcel +## @package PHPExcel_Settings +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) +## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL +## @version ##VERSION##, ##DATE## +## +## + + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = € + + +## +## Excel Error Codes (For future use) +## +NULL = #NULLO! +DIV0 = #DIV/0! +VALUE = #VALORE! +REF = #RIF! +NAME = #NOME? +NUM = #NUM! +NA = #N/D diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/it/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/it/functions index b9219a6a4ce..862cf8302c8 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/it/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/it/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/nl/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/nl/config index 48dcc15b507..a14b476c945 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/nl/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/nl/config @@ -1,47 +1,47 @@ +## +## PHPExcel ## -## PHPExcel -## -## Copyright (c) 2006 - 2013 PHPExcel -## -## This library is free software; you can redistribute it and/or -## modify it under the terms of the GNU Lesser General Public -## License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## -## This library is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Lesser General Public License for more details. -## -## You should have received a copy of the GNU Lesser General Public -## License along with this library; if not, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -## -## @category PHPExcel -## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) -## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version ##VERSION##, ##DATE## -## -## - - -ArgumentSeparator = ; - - -## -## (For future use) -## -currencySymbol = € - - -## -## Excel Error Codes (For future use) -## -NULL = #LEEG! -DIV0 = #DEEL/0! -VALUE = #WAARDE! -REF = #VERW! -NAME = #NAAM? -NUM = #GETAL! -NA = #N/B +## Copyright (c) 2006 - 2013 PHPExcel +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## @category PHPExcel +## @package PHPExcel_Settings +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) +## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL +## @version ##VERSION##, ##DATE## +## +## + + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = € + + +## +## Excel Error Codes (For future use) +## +NULL = #LEEG! +DIV0 = #DEEL/0! +VALUE = #WAARDE! +REF = #VERW! +NAME = #NAAM? +NUM = #GETAL! +NA = #N/B diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/nl/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/nl/functions index b6b8296ef04..79b7acd1ef9 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/nl/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/nl/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/no/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/no/config index bf2d34a7f2c..e3e3cc4f786 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/no/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/no/config @@ -1,47 +1,47 @@ +## +## PHPExcel ## -## PHPExcel -## -## Copyright (c) 2006 - 2013 PHPExcel -## -## This library is free software; you can redistribute it and/or -## modify it under the terms of the GNU Lesser General Public -## License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## -## This library is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Lesser General Public License for more details. -## -## You should have received a copy of the GNU Lesser General Public -## License along with this library; if not, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -## -## @category PHPExcel -## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) -## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version ##VERSION##, ##DATE## -## -## - - -ArgumentSeparator = ; - - -## -## (For future use) -## -currencySymbol = kr - - -## -## Excel Error Codes (For future use) -## -NULL = #NULL! -DIV0 = #DIV/0! -VALUE = #VERDI! -REF = #REF! -NAME = #NAVN? -NUM = #NUM! -NA = #I/T +## Copyright (c) 2006 - 2013 PHPExcel +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## @category PHPExcel +## @package PHPExcel_Settings +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) +## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL +## @version ##VERSION##, ##DATE## +## +## + + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = kr + + +## +## Excel Error Codes (For future use) +## +NULL = #NULL! +DIV0 = #DIV/0! +VALUE = #VERDI! +REF = #REF! +NAME = #NAVN? +NUM = #NUM! +NA = #I/T diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/no/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/no/functions index 57a80a7a406..3cccce42a1d 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/no/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/no/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pl/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pl/config index 4dd75bee69c..ea111797270 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pl/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pl/config @@ -1,47 +1,47 @@ +## +## PHPExcel ## -## PHPExcel -## -## Copyright (c) 2006 - 2013 PHPExcel -## -## This library is free software; you can redistribute it and/or -## modify it under the terms of the GNU Lesser General Public -## License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## -## This library is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Lesser General Public License for more details. -## -## You should have received a copy of the GNU Lesser General Public -## License along with this library; if not, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -## -## @category PHPExcel -## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) -## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version ##VERSION##, ##DATE## -## -## - - -ArgumentSeparator = ; - - -## -## (For future use) -## -currencySymbol = zÅ‚ - - -## -## Excel Error Codes (For future use) -## -NULL = #ZERO! -DIV0 = #DZIEL/0! -VALUE = #ARG! -REF = #ADR! -NAME = #NAZWA? -NUM = #LICZBA! -NA = #N/D! +## Copyright (c) 2006 - 2013 PHPExcel +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## @category PHPExcel +## @package PHPExcel_Settings +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) +## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL +## @version ##VERSION##, ##DATE## +## +## + + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = zÅ‚ + + +## +## Excel Error Codes (For future use) +## +NULL = #ZERO! +DIV0 = #DZIEL/0! +VALUE = #ARG! +REF = #ADR! +NAME = #NAZWA? +NUM = #LICZBA! +NA = #N/D! diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pl/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pl/functions index 2e5697973c1..5607f8f672c 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pl/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pl/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pt/br/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pt/br/config index 45b6fbd92d1..d39c5c63438 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pt/br/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pt/br/config @@ -1,47 +1,47 @@ +## +## PHPExcel ## -## PHPExcel -## -## Copyright (c) 2006 - 2013 PHPExcel -## -## This library is free software; you can redistribute it and/or -## modify it under the terms of the GNU Lesser General Public -## License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## -## This library is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Lesser General Public License for more details. -## -## You should have received a copy of the GNU Lesser General Public -## License along with this library; if not, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -## -## @category PHPExcel -## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) -## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version ##VERSION##, ##DATE## -## -## - - -ArgumentSeparator = ; - - -## -## (For future use) -## -currencySymbol = R$ - - -## -## Excel Error Codes (For future use) -## -NULL = #NULO! -DIV0 = #DIV/0! -VALUE = #VALOR! -REF = #REF! -NAME = #NOME? -NUM = #NÚM! -NA = #N/D +## Copyright (c) 2006 - 2013 PHPExcel +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## @category PHPExcel +## @package PHPExcel_Settings +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) +## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL +## @version ##VERSION##, ##DATE## +## +## + + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = R$ + + +## +## Excel Error Codes (For future use) +## +NULL = #NULO! +DIV0 = #DIV/0! +VALUE = #VALOR! +REF = #REF! +NAME = #NOME? +NUM = #NÚM! +NA = #N/D diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pt/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pt/config index 8bb8d8b8ea0..5e486bb29ff 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pt/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/pt/config @@ -1,47 +1,47 @@ +## +## PHPExcel ## -## PHPExcel -## -## Copyright (c) 2006 - 2013 PHPExcel -## -## This library is free software; you can redistribute it and/or -## modify it under the terms of the GNU Lesser General Public -## License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## -## This library is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Lesser General Public License for more details. -## -## You should have received a copy of the GNU Lesser General Public -## License along with this library; if not, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -## -## @category PHPExcel -## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) -## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version ##VERSION##, ##DATE## -## -## - - -ArgumentSeparator = ; - - -## -## (For future use) -## -currencySymbol = € - - -## -## Excel Error Codes (For future use) -## -NULL = #NULO! -DIV0 = #DIV/0! -VALUE = #VALOR! -REF = #REF! -NAME = #NOME? -NUM = #NÚM! -NA = #N/D +## Copyright (c) 2006 - 2013 PHPExcel +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## @category PHPExcel +## @package PHPExcel_Settings +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) +## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL +## @version ##VERSION##, ##DATE## +## +## + + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = € + + +## +## Excel Error Codes (For future use) +## +NULL = #NULO! +DIV0 = #DIV/0! +VALUE = #VALOR! +REF = #REF! +NAME = #NOME? +NUM = #NÚM! +NA = #N/D diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/ru/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/ru/config index 56e45bfda8f..098c8075d29 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/ru/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/ru/config @@ -1,47 +1,47 @@ +## +## PHPExcel ## -## PHPExcel -## -## Copyright (c) 2006 - 2013 PHPExcel -## -## This library is free software; you can redistribute it and/or -## modify it under the terms of the GNU Lesser General Public -## License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## -## This library is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Lesser General Public License for more details. -## -## You should have received a copy of the GNU Lesser General Public -## License along with this library; if not, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -## -## @category PHPExcel -## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) -## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version ##VERSION##, ##DATE## -## -## - - -ArgumentSeparator = ; - - -## -## (For future use) -## -currencySymbol = Ñ€ - - -## -## Excel Error Codes (For future use) -## -NULL = #ПУСТО! -DIV0 = #ДЕЛ/0! -VALUE = #ЗÐÐЧ! -REF = #ССЫЛ! -NAME = #ИМЯ? -NUM = #ЧИСЛО! -NA = #Ð/Д +## Copyright (c) 2006 - 2013 PHPExcel +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## @category PHPExcel +## @package PHPExcel_Settings +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) +## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL +## @version ##VERSION##, ##DATE## +## +## + + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = Ñ€ + + +## +## Excel Error Codes (For future use) +## +NULL = #ПУСТО! +DIV0 = #ДЕЛ/0! +VALUE = #ЗÐÐЧ! +REF = #ССЫЛ! +NAME = #ИМЯ? +NUM = #ЧИСЛО! +NA = #Ð/Д diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/ru/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/ru/functions index 324c3df2a81..86bcd4f63a7 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/ru/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/ru/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/sv/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/sv/config index 726f77164e4..c2094c06249 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/sv/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/sv/config @@ -1,47 +1,47 @@ +## +## PHPExcel ## -## PHPExcel -## -## Copyright (c) 2006 - 2013 PHPExcel -## -## This library is free software; you can redistribute it and/or -## modify it under the terms of the GNU Lesser General Public -## License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## -## This library is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Lesser General Public License for more details. -## -## You should have received a copy of the GNU Lesser General Public -## License along with this library; if not, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -## -## @category PHPExcel -## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) -## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version ##VERSION##, ##DATE## -## -## - - -ArgumentSeparator = ; - - -## -## (For future use) -## -currencySymbol = kr - - -## -## Excel Error Codes (For future use) -## -NULL = #Skärning! -DIV0 = #Division/0! -VALUE = #Värdefel! -REF = #Referens! -NAME = #Namn? -NUM = #Ogiltigt! -NA = #Saknas! +## Copyright (c) 2006 - 2013 PHPExcel +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## @category PHPExcel +## @package PHPExcel_Settings +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) +## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL +## @version ##VERSION##, ##DATE## +## +## + + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = kr + + +## +## Excel Error Codes (For future use) +## +NULL = #Skärning! +DIV0 = #Division/0! +VALUE = #Värdefel! +REF = #Referens! +NAME = #Namn? +NUM = #Ogiltigt! +NA = #Saknas! diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/tr/config b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/tr/config index b69d4257a50..cca084b2ba5 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/tr/config +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/tr/config @@ -1,47 +1,47 @@ +## +## PHPExcel ## -## PHPExcel -## -## Copyright (c) 2006 - 2013 PHPExcel -## -## This library is free software; you can redistribute it and/or -## modify it under the terms of the GNU Lesser General Public -## License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## -## This library is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Lesser General Public License for more details. -## -## You should have received a copy of the GNU Lesser General Public -## License along with this library; if not, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -## -## @category PHPExcel -## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) -## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version ##VERSION##, ##DATE## -## -## - - -ArgumentSeparator = ; - - -## -## (For future use) -## -currencySymbol = YTL - - -## -## Excel Error Codes (For future use) -## -NULL = #BOÅž! -DIV0 = #SAYI/0! -VALUE = #DEÄžER! -REF = #BAÅžV! -NAME = #AD? -NUM = #SAYI! -NA = #YOK +## Copyright (c) 2006 - 2013 PHPExcel +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## @category PHPExcel +## @package PHPExcel_Settings +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) +## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL +## @version ##VERSION##, ##DATE## +## +## + + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = YTL + + +## +## Excel Error Codes (For future use) +## +NULL = #BOÅž! +DIV0 = #SAYI/0! +VALUE = #DEÄžER! +REF = #BAÅžV! +NAME = #AD? +NUM = #SAYI! +NA = #YOK diff --git a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/tr/functions b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/tr/functions index 79645214714..3e7c225f402 100644 --- a/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/tr/functions +++ b/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/locale/tr/functions @@ -1,6 +1,6 @@ ## ## PHPExcel -## +## ## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or diff --git a/htdocs/install/mysql/data/llx_accounting_category.sql b/htdocs/install/mysql/data/llx_accounting_category.sql index 5769d291563..8e69ca6331e 100644 --- a/htdocs/install/mysql/data/llx_accounting_category.sql +++ b/htdocs/install/mysql/data/llx_accounting_category.sql @@ -25,5 +25,5 @@ -- INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1,'VTE','Ventes de marchandises', '707xxx', 0, 0, '', '10', 1, 1); -INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2,'MAR','Coût d\'achats marchandises vendues', '603xxx | 607xxx | 609xxx', 0, 0, '', '20', 1, 1); +INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2,'MAR','Coût d achats marchandises vendues', '603xxx | 607xxx | 609xxx', 0, 0, '', '20', 1, 1); INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3,'MARGE','Marge commerciale', '', 0, 1, '1 + 2', '30', 1, 1); \ No newline at end of file diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql index e939563cf9b..0ddeaf8f3ad 100644 --- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql +++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql @@ -136,6 +136,7 @@ CREATE TABLE llx_website tms timestamp ) ENGINE=innodb; ALTER TABLE llx_website ADD COLUMN fk_default_home integer; +ALTER TABLE llx_website CHANGE COLUMN shortname ref varchar(24) NOT NULL; ALTER TABLE llx_website ADD UNIQUE INDEX uk_website_ref (ref, entity); CREATE TABLE llx_website_page diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index 307c88c3007..cbacf7454c7 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -56,16 +56,12 @@ CREATE OR REPLACE FUNCTION dol_util_triggerall(DoEnable boolean) RETURNS integer CREATE OR REPLACE FUNCTION update_modified_column_tms() RETURNS TRIGGER AS $$ BEGIN NEW.tms = now(); RETURN NEW; END; $$ LANGUAGE plpgsql; CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_accounting_account FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_accounting_fiscalyear FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_accountingtransaction FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_actioncomm FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_actioncomm_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_type FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_type_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_askpricesupplier FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_askpricesupplier_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_askpricesupplierdet_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); @@ -152,6 +148,9 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe_rib FOR EACH CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_socpeople FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_socpeople_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_stock_mouvement FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_supplier_proposal FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_supplier_proposal_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_supplier_proposaldet_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_tva FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 70f1f3422ea..a07dbc48168 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -853,24 +853,30 @@ function write_conf_file($conffile) fputs($fp,"\n"); /* Authentication */ + fputs($fp, '// Authentication settings'); + fputs($fp,"\n"); + fputs($fp, '$dolibarr_main_authentication=\'dolibarr\';'); fputs($fp,"\n\n"); - fputs($fp, '// Specific settings'); + fputs($fp, '//$dolibarr_main_demo=\'autologin,autopass\';'); fputs($fp,"\n"); - fputs($fp, '//$dolibarr_main_demo=\'autologin,autopass\';'); + fputs($fp, '// Security settings'); fputs($fp,"\n"); fputs($fp, '$dolibarr_main_prod=\'0\';'); fputs($fp,"\n"); - fputs($fp, '$dolibarr_nocsrfcheck=\'0\';'); - fputs($fp,"\n"); - fputs($fp, '$dolibarr_main_force_https=\''.$main_force_https.'\';'); fputs($fp,"\n"); + fputs($fp, '$dolibarr_main_restrict_os_commands=\'mysqldump, mysql, pg_dump, pgrestore\';'); + fputs($fp,"\n"); + + fputs($fp, '$dolibarr_nocsrfcheck=\'0\';'); + fputs($fp,"\n"); + fputs($fp, '$dolibarr_main_cookie_cryptkey=\''.$key.'\';'); fputs($fp,"\n"); diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index f880da8b854..9182c7cd9c2 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -178,9 +178,12 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) if ($numrows == 0) dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1",'chaine',0,'',$conf->entity); } + // Create user used to create the admin user $createuser=new User($db); $createuser->id=0; - + $createuser->admin=1; + + // Set admin user $newuser = new User($db); $newuser->lastname='SuperAdmin'; $newuser->firstname=''; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 18742ba0ed7..9a12afd3953 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -84,6 +84,11 @@ AccountingCategory=Accounting category NotMatch=Not Set +DeleteMvt=Delete general ledger lines +DelYear=Year to delete +DelJournal=Journal to delete +ConfirmDeleteMvt=This will delete all line of of the general ledger for year and/or from a specifics journal + DelBookKeeping=Delete the records of the general ledger DescSellsJournal=Sales journal @@ -142,6 +147,7 @@ Modelcsv_bob50=Export towards Sage BOB 50 Modelcsv_ciel=Export towards Sage Ciel Compta or Compta Evolution Modelcsv_quadratus=Export towards Quadratus QuadraCompta Modelcsv_ebp=Export towards EBP +Modelcsv_cogilog=Export towards Cogilog ## Tools - Init accounting account on product / service InitAccountancy=Init accountancy @@ -160,3 +166,4 @@ Formula=Formula ## Error ErrorNoAccountingCategoryForThisCountry=No accounting category are available for this country ExportNotSupported=The export format setuped is not supported into this page +BookeppingLineAlreayExists=Lines already existing into bookeeping diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index d7936f43c32..3eb13b3e602 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -512,6 +512,8 @@ Module5000Name=Multi-company Module5000Desc=Allows you to manage multiple companies Module6000Name=Workflow Module6000Desc=Workflow management +Module10000Name=Websites +Module10000Desc=Create public websites with a WYSIWG editor. Just setup your web server to point to the dedicated directory to have it online on the Internet. Module20000Name=Leave Requests management Module20000Desc=Declare and follow employees leaves requests Module39000Name=Product lot @@ -532,6 +534,8 @@ Module59000Name=Margins Module59000Desc=Module to manage margins Module60000Name=Commissions Module60000Desc=Module to manage commissions +Module63000Name=Resources +Module63000Desc=Manage resources (printers, cars, room, ...) you can then share into events Permission11=Read customer invoices Permission12=Create/modify customer invoices Permission13=Unvalidate customer invoices @@ -1589,3 +1593,4 @@ DetectionNotPossible=Detection not possible UrlToGetKeyToUseAPIs=Url to get token to use API (once token has been received it is saved on database user table and will be checked on each future access) ListOfAvailableAPIs=List of available APIs activateModuleDependNotSatisfied=Module "%s" depends on module "%s" that is missing, so module "%1$s" may not work correclty. Please install module "%2$s" or disable module "%1$s" if you want to be safe from any surprise +CommandIsNotInsideAllowedCommands=The command you try to run is not inside list of allowed commands defined into parameter $dolibarr_main_restrict_os_commands into conf.php file. diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 01e57a756b9..af2f6174315 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -323,6 +323,7 @@ NextDateToExecution=Date for next invoice generation DateLastGeneration=Date of latest generation MaxPeriodNumber=Max nb of invoice generation NbOfGenerationDone=Nb of invoice generation already done +MaxGenerationReached=Maximum nb of generations reached InvoiceAutoValidate=Validate invoices automatically GeneratedFromRecurringInvoice=Generated from template recurring invoice %s DateIsNotEnough=Date not reached yet diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 5d4ea34ded4..3c5d0e1cf12 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -170,6 +170,10 @@ ErrorWarehouseRequiredIntoShipmentLine=Warehouse is required on the line to ship ErrorFileMustHaveFormat=File must have format %s ErrorSupplierCountryIsNotDefined=Country for this supplier is not defined. Correct this first. ErrorsThirdpartyMerge=Failed to merge the two records. Request canceled. +ErrorStockIsNotEnoughToAddProductOnOrder=Stock is not enougth for product %s to add it into a new order. +ErrorStockIsNotEnoughToAddProductOnInvoice=Stock is not enougth for product %s to add it into a new invoice. +ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enougth for product %s to add it into a new shipment. +ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enougth for product %s to add it into a new proposal. # Warnings WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index 26959e39ab9..b0adb985dff 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -14,10 +14,12 @@ DeleteIntervention=Delete intervention ValidateIntervention=Validate intervention ModifyIntervention=Modify intervention DeleteInterventionLine=Delete intervention line +CloneIntervention=Clone intervention ConfirmDeleteIntervention=Are you sure you want to delete this intervention ? ConfirmValidateIntervention=Are you sure you want to validate this intervention under name %s ? ConfirmModifyIntervention=Are you sure you want to modify this intervention ? ConfirmDeleteInterventionLine=Are you sure you want to delete this intervention line ? +ConfirmCloneIntervention=Are you sure you want to clone this intervention ? NameAndSignatureOfInternalContact=Name and signature of intervening : NameAndSignatureOfExternalContact=Name and signature of customer : DocumentModelStandard=Standard document model for interventions diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index bda34ce2299..884f9048666 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -1,5 +1,4 @@ # Dolibarr language file - Source file is en_US - languages - Language_ar_AR=Arabic Language_ar_SA=Arabic Language_bn_BD=Bengali diff --git a/htdocs/langs/en_US/link.lang b/htdocs/langs/en_US/link.lang index 6880d4d86a0..77a1814f1ca 100644 --- a/htdocs/langs/en_US/link.lang +++ b/htdocs/langs/en_US/link.lang @@ -1,3 +1,4 @@ +# Dolibarr language file - Source file is en_US - languages LinkANewFile=Link a new file/document LinkedFiles=Linked files and documents NoLinkFound=No registered links diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 79c7aff2029..b57b1e4bdae 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -102,7 +102,8 @@ YouCanUseCommaSeparatorForSeveralRecipients=You can use the comma separat TagCheckMail=Track mail opening TagUnsubscribe=Unsubscribe link TagSignature=Signature sending user -TagMailtoEmail=Recipient EMail +EMailRecipient=Recipient EMail +TagMailtoEmail=Recipient EMail (including html "mailto:" link) NoEmailSentBadSenderOrRecipientEmail=No email sent. Bad sender or recipient email. Verify user profile. # Module Notifications Notifications=Notifications diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index fb59e1dd8fd..b90d02f8f77 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -177,6 +177,7 @@ Groups=Groups NoUserGroupDefined=No user group defined Password=Password PasswordRetype=Retype your password +NoteSomeFeaturesAreDisabled=Note that a lot of features/modules are disabled in this demonstration. Name=Name Person=Person Parameter=Parameter @@ -743,6 +744,7 @@ SearchIntoMembers=Members SearchIntoUsers=Users SearchIntoProductsOrServices=Products or services SearchIntoProjects=Projects +SearchIntoTasks=Tasks SearchIntoCustomerInvoices=Customer invoices SearchIntoSupplierInvoices=Supplier invoices SearchIntoCustomerOrders=Customer orders diff --git a/htdocs/langs/en_US/printing.lang b/htdocs/langs/en_US/printing.lang index 14577a126e4..2da614e96f9 100644 --- a/htdocs/langs/en_US/printing.lang +++ b/htdocs/langs/en_US/printing.lang @@ -51,3 +51,5 @@ IPP_Supported=Type of media DirectPrintingJobsDesc=This page lists printing jobs found for available printers. GoogleAuthNotConfigured=Google OAuth setup not done. Enable module OAuth and set a Google ID/Secret. GoogleAuthConfigured=Google OAuth credentials found into setup of module OAuth. +PrintingDriverDescprintgcp=Configuration variables for printing driver Google Cloud Print. +PrintTestDescprintgcp=List of Printers for Google Cloud Print. diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index a6f2ba51f23..e9142d463ff 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -32,6 +32,8 @@ ServicesOnSellAndOnBuy=Services for sale and for purchase LastModifiedProductsAndServices=Latest %s modified products/services LastRecordedProducts=Latest %s recorded products LastRecordedServices=Latest %s recorded services +CardProduct0=Product card +CardProduct1=Service card Stock=Stock Stocks=Stocks Movements=Movements @@ -83,7 +85,7 @@ SetDefaultBarcodeType=Set barcode type BarcodeValue=Barcode value NoteNotVisibleOnBill=Note (not visible on invoices, proposals...) ServiceLimitedDuration=If product is a service with limited duration: -MultiPricesAbility=Several level of prices per product/service +MultiPricesAbility=Several segment of prices per product/service (each customer is in one segment) MultiPricesNumPrices=Number of prices AssociatedProductsAbility=Activate the package feature AssociatedProducts=Package product @@ -174,13 +176,13 @@ AlwaysUseNewPrice=Always use current price of product/service AlwaysUseFixedPrice=Use the fixed price PriceByQuantity=Different prices by quantity PriceByQuantityRange=Quantity range -MultipriceRules=Price level rules -UseMultipriceRules=Use price level rules (defined into product module setup) to autocalculate prices of all other level according to first level +MultipriceRules=Price segment rules +UseMultipriceRules=Use price segment rules (defined into product module setup) to autocalculate prices of all other segment according to first segment PercentVariationOver=%% variation over %s PercentDiscountOver=%% discount over %s ### composition fabrication Build=Produce -ProductsMultiPrice=Products and prices for each price level +ProductsMultiPrice=Products and prices for each price segment ProductsOrServiceMultiPrice=Customer prices (of products or services, multi-prices) ProductSellByQuarterHT=Products turnover quarterly before tax ServiceSellByQuarterHT=Services turnover quarterly before tax @@ -201,9 +203,9 @@ DefinitionOfBarCodeForThirdpartyNotComplete=Definition of type or value of bar c BarCodeDataForProduct=Barcode information of product %s : BarCodeDataForThirdparty=Barcode information of thirdparty %s : ResetBarcodeForAllRecords=Define barcode value for all records (this will also reset barcode value already defined with new values) -PriceByCustomer=Different price for each customer -PriceCatalogue=Unique price per product/service -PricingRule=Rules for customer prices +PriceByCustomer=Different prices for each customer +PriceCatalogue=A single sell price per product/service +PricingRule=Rules for sell prices AddCustomerPrice=Add price by customer ForceUpdateChildPriceSoc=Set same price on customer subsidiaries PriceByCustomerLog=Log of previous customer prices diff --git a/htdocs/langs/en_US/supplier_proposal.lang b/htdocs/langs/en_US/supplier_proposal.lang index 86127b11a96..909a4d713c1 100644 --- a/htdocs/langs/en_US/supplier_proposal.lang +++ b/htdocs/langs/en_US/supplier_proposal.lang @@ -12,6 +12,7 @@ RequestsOpened=Open price requests SupplierProposalArea=Supplier proposals area SupplierProposalShort=Supplier proposal SupplierProposals=Supplier proposals +SupplierProposalsShort=Supplier proposals NewAskPrice=New price request ShowSupplierProposal=Show price request AddSupplierProposal=Create a price request diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 205c1e0eccb..767b138eb54 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -383,7 +383,7 @@ ShowDetailsInPDFPageFoot=Ajout de plus d'informations dans le pied de page de vo NoDetails=Pas plus de détails dans le pied-de-page DisplayCompanyInfo=Afficher l'adresse de la société DisplayCompanyInfoAndManagers=Afficher les noms des sociétés et des supérieurs hiérarchiques -EnableAndSetupModuleCron=If you want to have this recurring invoice beeing generated automatically, module *%s* must be enabled and correctly setup. Otherwise, generation of invoices must be done manually from this template with button *Create*. Note that even if you enabled automatic generation, you can still safely launch manual generation. Duplicates generation for same period are not possible. +EnableAndSetupModuleCron=Si vous voulez avoir cette facture récurrente générée automatiquement, le module *%s* doit être activé et correctement configuré. Dans le cas contraire, la génération des factures doit être effectuée manuellement à partir de ce modèle avec le bouton *Créer*. Notez que même si vous avez activé la génération automatique, vous pouvez toujours lancer en toute sécurité la génération manuelle. La génération en double sur une même période n'est pas possibles. # Modules Module0Name=Utilisateurs & groupes @@ -550,7 +550,7 @@ Permission32=Créer/modifier les produits Permission34=Supprimer les produits Permission36=Voir/gérer les produits cachés Permission38=Exporter les produits -Permission41=Lire les projets et les tâches (projets publiques et projets dont je suis contact). Peut également entrer le temps consommé sur les tâches assignées (feuille de temps) +Permission41=Consulter les projets et les tâches (projets publiques et projets dont je suis contact). Peut également entrer le temps consommé sur les tâches assignées (feuille de temps) Permission42=Créer/modifier les projets et tâches (partagés ou dont je suis contact) Permission44=Supprimer les projets et tâches (partagés ou dont je suis contact) Permission45=Exporter les projets @@ -593,7 +593,7 @@ Permission121=Consulter les tiers (sociétés) liés à l'utilisateur Permission122=Créer/modifier les tiers (sociétés) liés à l'utilisateur Permission125=Supprimer les tiers (sociétés) liés à l'utilisateur Permission126=Exporter les tiers (sociétés) -Permission141=Consulter les projets et tâches (y compris privés dont je ne suis pas contact) +Permission141=Consulter tous les projets et tâches (y compris privés dont je ne suis pas contact) Permission142=Créer/modifier tous les projets et tâches (y compris privés dont je ne suis pas contact) Permission144=Supprimer les projets et tâches (y compris privés dont je ne suis pas contact) Permission146=Consulter les fournisseurs @@ -1585,6 +1585,6 @@ AddOtherPagesOrServices=Ajout d'autres pages ou services AddModels=Ajout de modèles de document ou de numérotation AddSubstitutions=Ajout de valeurs de substitution DetectionNotPossible=Détection impossible -UrlToGetKeyToUseAPIs=Url to get token to use API (once token has been received it is saved on database user table and will be checked on each future access) +UrlToGetKeyToUseAPIs=Url pour obtenir le jeton pour utiliser l'API (une fois le jeton reçu, il est enregistré dans la table des utilisateurs de la base de données et sera vérifié à chaque accès) ListOfAvailableAPIs=Liste des APIs disponibles -activateModuleDependNotSatisfied=Module "%s" depends on module "%s" that is missing, so module "%1$s" may not work correclty. Please install module "%2$s" or disable module "%1$s" if you want to be safe from any surprise +activateModuleDependNotSatisfied=Le module "%s" dépend du module "%s" qui est manquant, aussi le module "%1$s" peut ne pas fonctionner correctement. Merci d'installer le module "%2$s" ou désactiver le module "%1$s" si vous ne souhaitez pas avoir de mauvaise surprise diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 4aa648459d1..6ca57901e9e 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -467,7 +467,7 @@ InvoiceSituationLast=Dernière facture PDFCrevetteSituationNumber=Situation N°%s PDFCrevetteSituationInvoiceLineDecompte=Facture de situation - Déompte PDFCrevetteSituationInvoiceTitle=Facture de situation -PDFCrevetteSituationInvoiceLine=Situation N°%s : Inv. N°%s on %s +PDFCrevetteSituationInvoiceLine=Situation N°%s : Fact. N°%s sur %s TotalSituationInvoice=Total situation invoiceLineProgressError=L'avancement d'une ligne de facture ne peut pas être supérieure ou égale à la ligne de facture suivante. updatePriceNextInvoiceErrorUpdateline=Erreur: mise à jour du prix sur la ligne de facture : %s diff --git a/htdocs/langs/fr_FR/interventions.lang b/htdocs/langs/fr_FR/interventions.lang index a2803463899..d9c51beab73 100644 --- a/htdocs/langs/fr_FR/interventions.lang +++ b/htdocs/langs/fr_FR/interventions.lang @@ -14,10 +14,12 @@ DeleteIntervention=Supprimer intervention ValidateIntervention=Valider intervention ModifyIntervention=Modifier intervention DeleteInterventionLine=Supprimer ligne d'intervention +CloneIntervention=Clone intervention ConfirmDeleteIntervention=Êtes-vous sûr de vouloir effacer cette intervention ? ConfirmValidateIntervention=Êtes-vous sûr de vouloir valider cette intervention sous la référence %s ? ConfirmModifyIntervention=Êtes-vous sûr de vouloir modifier cette intervention ? ConfirmDeleteInterventionLine=Êtes-vous sûr de vouloir effacer cette ligne ? +ConfirmCloneIntervention=Are you sure you want to clone this intervention ? NameAndSignatureOfInternalContact=Nom et signature de l'intervenant : NameAndSignatureOfExternalContact=Nom et signature du client : DocumentModelStandard=Modèle de fiche d'intervention standard diff --git a/htdocs/langs/fr_FR/languages.lang b/htdocs/langs/fr_FR/languages.lang index dd730bd73a2..6c3f24877c7 100644 --- a/htdocs/langs/fr_FR/languages.lang +++ b/htdocs/langs/fr_FR/languages.lang @@ -1,5 +1,4 @@ # Dolibarr language file - Source file is en_US - languages - Language_ar_AR=Arabe Language_ar_SA=Arabe Language_bn_BD=Bengalais diff --git a/htdocs/langs/fr_FR/loan.lang b/htdocs/langs/fr_FR/loan.lang index 481c9ba7b18..6fb63229485 100644 --- a/htdocs/langs/fr_FR/loan.lang +++ b/htdocs/langs/fr_FR/loan.lang @@ -31,9 +31,9 @@ DownPaymentDesc=L'acompte = Le prix de la maison multiplié par le pource InterestRateDesc=Le taux d'intérêt = Le pourcentage annuel d'intérêt divisé par 100. MonthlyFactorDesc=The monthly factor = The result of the following formula MonthlyInterestRateDesc=Le taux d'intérêt mensuel = Le taux annuel d'intérêt divisé par 12 (pour les 12 mois de l'année) -MonthTermDesc=The month term of the loan in months = The number of years you've taken the loan out for times 12 +MonthTermDesc=Le terme en mois du prêt en mois = Le nombre d'années que vous avez pris pour le prêt multiplié par 12 MonthlyPaymentDesc=Le paiement mensuel est déterminé en utilisant la formule suivante -AmortizationPaymentDesc=The amortization breaks down how much of your monthly payment goes towards the bank's interest, and how much goes into paying off the principal of your loan. +AmortizationPaymentDesc=L' amortissement décompose votre paiement mensuel entre l'intérêt de la banque et le remboursement du principal de votre prêt. AmountFinanced=Montant financé AmortizationMonthlyPaymentOverYears=Amortissement pour paiement mensuel : %s sur %s ans Totalsforyear=Total pour l'année diff --git a/htdocs/langs/fr_FR/oauth.lang b/htdocs/langs/fr_FR/oauth.lang index c0cbb9a370c..24a654f21ac 100644 --- a/htdocs/langs/fr_FR/oauth.lang +++ b/htdocs/langs/fr_FR/oauth.lang @@ -12,3 +12,4 @@ ListOfSupportedOauthProviders=Saisissez ici le crédit fourni par votre fourniss OAUTH_GOOGLE_NAME=API Google OAUTH_GOOGLE_ID=ID API Google OAUTH_GOOGLE_SECRET=API Google Secrète +OAUTH_GOOGLE_DESC=Allez sur cette page puis Identitifaction pour créer des informations d'identification OAuth diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index f77239535a6..45e86b50686 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -833,7 +833,8 @@ class Livraison extends CommonObject $now=dol_now(); - // Charge tableau des produits prodids + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 5e919498a9b..3f790907fc1 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1480,7 +1480,12 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && empty($conf->browser->phone)) { $qs=$_SERVER["QUERY_STRING"]; - $qs.=(($qs && $morequerystring)?'&':'').$morequerystring; + + foreach($_POST as $key=>$value) { + if($key!=='action')$qs.='&'.$key.'='.urlencode($value); + } + + $qs.=(($qs && $morequerystring)?'&':'').$morequerystring; $text =''; $text.= img_picto(":".$langs->trans("PrintContentArea"), 'printer_top.png', 'class="printer"'); $text.=''; diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index 9b203ea0424..c2c6ba1bc99 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -140,6 +140,7 @@ class MultiCurrency extends CommonObject $this->db->begin(); + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { $error ++; @@ -184,9 +185,10 @@ class MultiCurrency extends CommonObject $sql = 'SELECT'; $sql .= ' c.rowid, c.name, c.code, c.entity, c.date_create, c.fk_user'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' AS c'; - if (!empty($code)) $sql .= ' WHERE c.code = "'.$this->db->escape($code).'"'; + if (!empty($code)) $sql .= ' WHERE c.code = \''.$this->db->escape($code).'\''; else $sql .= ' WHERE c.rowid = ' . $id; + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -226,8 +228,6 @@ class MultiCurrency extends CommonObject */ public function fetchAllCurrencyRate() { - dol_syslog('Currency::fetchAllCurrencyRate', LOG_DEBUG); - $sql = 'SELECT cr.rowid'; $sql.= ' FROM ' . MAIN_DB_PREFIX . $this->table_element_line. ' as cr'; $sql.= ' WHERE cr.fk_multicurrency = '.$this->id; @@ -235,6 +235,7 @@ class MultiCurrency extends CommonObject $this->rates = array(); + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); @@ -284,10 +285,11 @@ class MultiCurrency extends CommonObject // Update request $sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET'; - $sql .= ' name="'.$this->db->escape($this->name).'"'; - $sql .= ' code="'.$this->db->escape($this->code).'"'; + $sql .= ' name=\''.$this->db->escape($this->name).'\''; + $sql .= ' code=\''.$this->db->escape($this->code).'\''; $sql .= ' WHERE rowid=' . $this->id; + dol_syslog(__METHOD__,LOG_DEBUG); $this->db->begin(); $resql = $this->db->query($sql); @@ -347,6 +349,7 @@ class MultiCurrency extends CommonObject $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element; $sql .= ' WHERE rowid=' . $this->id; + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { $error ++; @@ -425,7 +428,9 @@ class MultiCurrency extends CommonObject $currency->code = $code; $currency->name = $code; - $sql = 'SELECT label FROM '.MAIN_DB_PREFIX.'c_currencies WHERE code_iso = "'.$db->escape($code).'"'; + $sql = 'SELECT label FROM '.MAIN_DB_PREFIX.'c_currencies WHERE code_iso = \''.$db->escape($code).'\''; + + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $db->query($sql); if ($resql && ($line = $db->fetch_object($resql))) { @@ -475,6 +480,7 @@ class MultiCurrency extends CommonObject $sql.= ' WHERE cr.fk_multicurrency = '.$this->id; $sql.= ' AND cr.date_sync >= ALL (SELECT cr2.date_sync FROM '.MAIN_DB_PREFIX.$this->table_element_line.' AS cr2 WHERE cr.rowid = cr2.rowid)'; + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $this->db->query($sql); if ($resql && ($obj = $this->db->fetch_object($resql))) { $this->rate = new CurrencyRate($this->db); @@ -493,7 +499,9 @@ class MultiCurrency extends CommonObject */ public static function getIdFromCode(&$db, $code) { - $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE code = "'.$db->escape($code).'"'; + $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE code = \''.$db->escape($code).'\''; + + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $db->query($sql); if ($resql && $obj = $db->fetch_object($resql)) return $obj->rowid; else return 0; @@ -512,10 +520,11 @@ class MultiCurrency extends CommonObject { $sql = 'SELECT m.rowid, mc.rate FROM '.MAIN_DB_PREFIX.'multicurrency m'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'multicurrency_rate mc ON (m.rowid = mc.fk_multicurrency)'; - $sql.= ' WHERE m.code = "'.$db->escape($code).'"'; + $sql.= ' WHERE m.code = \''.$db->escape($code).'\''; $sql.= " AND m.entity IN (".getEntity('multicurrency', 1).")"; $sql.= ' ORDER BY mc.date_sync DESC LIMIT 1'; + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $db->query($sql); if ($resql && $obj = $db->fetch_object($resql)) return array($obj->rowid, $obj->rate); else return array(0, 1); @@ -556,6 +565,8 @@ class MultiCurrency extends CommonObject global $db; $sql = 'SELECT multicurrency_tx FROM '.MAIN_DB_PREFIX.$table.' WHERE rowid = '.$fk_facture; + + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $db->query($sql); if ($resql && ($line = $db->fetch_object($resql))) { @@ -721,6 +732,7 @@ class CurrencyRate extends CommonObjectLine $this->db->begin(); + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { $error ++; @@ -765,6 +777,7 @@ class CurrencyRate extends CommonObjectLine $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' AS cr'; $sql .= ' WHERE cr.rowid = ' . $id; + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $numrows = $this->db->num_rows($resql); @@ -816,6 +829,7 @@ class CurrencyRate extends CommonObjectLine $this->db->begin(); + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { $error ++; @@ -866,6 +880,7 @@ class CurrencyRate extends CommonObjectLine $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element; $sql .= ' WHERE rowid='.$this->id; + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { $error ++; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 330e712cf1b..e524b8f8303 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1314,7 +1314,7 @@ else } // Custom code - if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) + if (! $object->isService() && empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) { print ''; // Origin country diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 138cfe45a2b..f9f2fe51b5f 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -208,28 +208,39 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') } } - $graphfiles=array( - 'propal' =>array('modulepart'=>'productstats_proposals', - 'file' => $object->id.'/propal12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', - 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsProposals"):$langs->transnoentitiesnoconv("NumberOfProposals"))), - 'proposalssuppliers'=>array('modulepart'=>'productstats_proposalssuppliers', - 'file' => $object->id.'/proposalssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', - 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierProposals"):$langs->transnoentitiesnoconv("NumberOfSupplierProposals"))), - - 'orders' =>array('modulepart'=>'productstats_orders', - 'file' => $object->id.'/orders12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', - 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsCustomerOrders"):$langs->transnoentitiesnoconv("NumberOfCustomerOrders"))), - 'orderssuppliers'=>array('modulepart'=>'productstats_orderssuppliers', - 'file' => $object->id.'/orderssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', - 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierOrders"):$langs->transnoentitiesnoconv("NumberOfSupplierOrders"))), - - 'invoices' =>array('modulepart'=>'productstats_invoices', - 'file' => $object->id.'/invoices12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', - 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsCustomerInvoices"):$langs->transnoentitiesnoconv("NumberOfCustomerInvoices"))), - 'invoicessuppliers'=>array('modulepart'=>'productstats_invoicessuppliers', - 'file' => $object->id.'/invoicessuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', - 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierInvoices"):$langs->transnoentitiesnoconv("NumberOfSupplierInvoices"))), - ); + if($conf->propal->enabled) { + $graphfiles['propal']=array('modulepart'=>'productstats_proposals', + 'file' => $object->id.'/propal12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsProposals"):$langs->transnoentitiesnoconv("NumberOfProposals"))); + } + + if($conf->supplier_proposal->enabled) { + $graphfiles['proposalssuppliers']=array('modulepart'=>'productstats_proposalssuppliers', + 'file' => $object->id.'/proposalssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierProposals"):$langs->transnoentitiesnoconv("NumberOfSupplierProposals"))); + } + + if($conf->order->enabled) { + $graphfiles['orders']=array('modulepart'=>'productstats_orders', + 'file' => $object->id.'/orders12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsCustomerOrders"):$langs->transnoentitiesnoconv("NumberOfCustomerOrders"))); + } + + if($conf->fournisseur->enabled) { + $graphfiles['orderssuppliers']=array('modulepart'=>'productstats_orderssuppliers', + 'file' => $object->id.'/orderssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierOrders"):$langs->transnoentitiesnoconv("NumberOfSupplierOrders"))); + } + + if($conf->facture->enabled) { + $graphfiles['invoices']=array('modulepart'=>'productstats_invoices', + 'file' => $object->id.'/invoices12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsCustomerInvoices"):$langs->transnoentitiesnoconv("NumberOfCustomerInvoices"))); + + $graphfiles['invoicessuppliers']=array('modulepart'=>'productstats_invoicessuppliers', + 'file' => $object->id.'/invoicessuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierInvoices"):$langs->transnoentitiesnoconv("NumberOfSupplierInvoices"))); + } $px = new DolGraph(); diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index d8051465626..9bc37ad5a7a 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -50,7 +50,7 @@ $cancel=GETPOST('cancel'); $id=GETPOST('id', 'int'); $ref=GETPOST('ref', 'alpha'); -$stocklimit = GETPOST('stocklimit'); +$stocklimit = GETPOST('seuil_stock_alerte'); $desiredstock = GETPOST('desiredstock'); $cancel = GETPOST('cancel'); $fieldid = isset($_GET["ref"])?'ref':'rowid'; @@ -70,7 +70,7 @@ $result=restrictedArea($user,'produit&stock',$id,'product&product','','',$fieldi if ($cancel) $action=''; // Set stock limit -if ($action == 'setstocklimit') +if ($action == 'setseuil_stock_alerte') { $object = new Product($db); $result=$object->fetch($id); @@ -78,6 +78,8 @@ if ($action == 'setstocklimit') $result=$object->update($object->id,$user,0,'update'); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); + //else + // setEventMessage($lans->trans("SavedRecordSuccessfully")); $action=''; } diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index e7ce1625aad..d3895b0000e 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -307,17 +307,19 @@ if (empty($reshook)) // Delete file in doc form if ($action == 'remove_file' && $user->rights->projet->creer) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - if ($object->id > 0) { - $langs->load("other"); - $upload_dir = $conf->projet->dir_output . "/"; - $urlfile=GETPOST('urlfile','alpha'); - $file = $upload_dir . '/' . $filetodelete; - $ret=dol_delete_file($file); - if ($ret) setEventMessages($langs->trans("FileWasRemoved", $urlfile), null, 'mesgs'); - else setEventMessages($langs->trans("ErrorFailToDeleteFile", $urlfile), null, 'errors'); + require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; + + $langs->load("other"); + $upload_dir = $conf->projet->dir_output; + $file = $upload_dir . '/' . GETPOST('file'); + $ret = dol_delete_file($file, 0, 0, 0, $object); + if ($ret) + setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs'); + else + setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors'); + $action = ''; } } @@ -666,9 +668,13 @@ else $filteronlist=''; if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST; $text=$form->select_thirdparty_list($object->thirdparty->id, 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), '', 0, 0, 'minwidth300'); - $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty"); - print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1, 0, '', '', 2); - print ''; + if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) + { + $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty"); + print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1, 0, '', '', 2); + } + else print $text; + print ''; } // Visibility diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 236a8154578..f29122f1c24 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1145,6 +1145,7 @@ class Project extends CommonObject // Load source object $clone_project->fetch($fromid); + $clone_project->fetch_optionals(); $clone_project->fetch_thirdparty(); $orign_dt_start=$clone_project->date_start; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index faac1a20e10..a5addbc705a 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -416,7 +416,7 @@ if ($resql) if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'],$_SERVER["PHP_SELF"],'p.opp_amount',"",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['p.fk_opp_status']['checked'])) print_liste_field_titre($arrayfields['p.fk_opp_status']['label'],$_SERVER["PHP_SELF"],'p.fk_opp_status',"",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'],$_SERVER["PHP_SELF"],'p.opp_percent',"",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'],$_SERVER["PHP_SELF"],'p.budget_amount',"",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'],$_SERVER["PHP_SELF"],'p.budget_amount',"",$param,'align="right"',$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 52e01d445a8..cbef511bae7 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -38,7 +38,11 @@ $id=GETPOST('id','int'); $search_all=GETPOST('search_all'); $search_project=GETPOST('search_project'); -if (! isset($_GET['search_projectstatus']) && ! isset($_POST['search_projectstatus'])) $search_projectstatus=1; +if (! isset($_GET['search_projectstatus']) && ! isset($_POST['search_projectstatus'])) +{ + if ($search_all != '') $search_projectstatus=-1; + else $search_projectstatus=1; +} else $search_projectstatus=GETPOST('search_projectstatus'); $search_project_ref=GETPOST('search_project_ref'); $search_project_title=GETPOST('search_project_title'); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index b69c731a1d7..c4dd53315a3 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -53,7 +53,7 @@ $projectstatic = new Project($db); * Actions */ -if ($action == 'addtimespent' && $user->rights->projet->creer) +if ($action == 'addtimespent' && $user->rights->projet->lire) { $error=0; diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 02f87a89395..4abf2754f77 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -361,7 +361,7 @@ foreach ($demoprofiles as $profilearray) print '
'.$langs->trans('Payments').''.$langs->trans('Date').'
'; - + print $facturestatic->getNomUrl(1); $filename=dol_sanitizeFileName($obj->ref); + $filedir=$conf->fournisseur->facture->dir_output.'/'.get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref); - print $formfile->getDocumentsLink('facture_fournisseur', $filename, $filedir); - print "'.$user_action->getNomUrl(1).''.$user_update->getNomUrl(1).''.$logs_CP['type_action'].''.$logs_CP['fk_type'].''; + $label=$alltypeleaves[$logs_CP['fk_type']]['label']; + print $label?$label:$logs_CP['fk_type']; + print ''.price2num($logs_CP['prev_solde'],5).' '.$langs->trans('days').''.price2num($logs_CP['new_solde'],5).' '.$langs->trans('days').'
'.$langs->trans("CustomCode").'
'."\n"; // Title print ''; - print ''; + print ''; print ''; print ''."\n"; // Modules @@ -478,7 +478,7 @@ function llxHeaderVierge($title, $head = "") top_htmlhead($head,$title); - print ''."\n"; + print ''."\n"; } /** diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 69262715b31..21bfed210fb 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2608,7 +2608,7 @@ class Societe extends CommonObject * @param int $idprof 1,2,3,4 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm) * @param Societe $soc Objet societe * @return int <=0 if KO, >0 if OK - * TODO not in business class + * TODO better to have this in a lib than into a business class */ function id_prof_check($idprof,$soc) { @@ -2720,27 +2720,39 @@ class Societe extends CommonObject } /** - * Renvoi url de verification d'un identifiant professionnal + * Return an url to check online a professional id or empty string * - * @param int $idprof 1,2,3,4 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm) - * @param Societe $soc Objet societe - * @return string url ou chaine vide si aucune url connue - * TODO not in business class + * @param int $idprof 1,2,3,4 (Example: 1=siren,2=siret,3=naf,4=rcs/rm) + * @param Societe $thirdparty Object thirdparty + * @return string Url or empty string if no URL known + * TODO better in a lib than into business class */ - function id_prof_url($idprof,$soc) + function id_prof_url($idprof,$thirdparty) { - global $conf,$langs; - - if (! empty($conf->global->MAIN_DISABLEPROFIDRULES)) return ''; + global $conf,$langs,$hookmanager; $url=''; + $action = ''; + + $hookmanager->initHooks(array('idprofurl')); + $parameters=array('idprof'=>$idprof, 'company'=>$thirdparty); + $reshook=$hookmanager->executeHooks('getIdProfUrl',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) + { + if (! empty($conf->global->MAIN_DISABLEPROFIDRULES)) return ''; - if ($idprof == 1 && $soc->country_code == 'FR') $url='http://www.societe.com/cgi-bin/recherche?rncs='.$soc->idprof1; - if ($idprof == 1 && ($soc->country_code == 'GB' || $soc->country_code == 'UK')) $url='http://www.companieshouse.gov.uk/WebCHeck/findinfolink/'; - if ($idprof == 1 && $soc->country_code == 'ES') $url='http://www.e-informa.es/servlet/app/portal/ENTP/screen/SProducto/prod/ETIQUETA_EMPRESA/nif/'.$soc->idprof1; - if ($idprof == 1 && $soc->country_code == 'IN') $url='http://www.tinxsys.com/TinxsysInternetWeb/dealerControllerServlet?tinNumber='.$soc->idprof1.';&searchBy=TIN&backPage=searchByTin_Inter.jsp'; - - if ($url) return '['.$langs->trans("Check").']'; + if ($idprof == 1 && $thirdparty->country_code == 'FR') $url='http://www.societe.com/cgi-bin/search?champs='.$thirdparty->idprof1; // See also http://avis-situation-sirene.insee.fr/ + if ($idprof == 1 && ($thirdparty->country_code == 'GB' || $thirdparty->country_code == 'UK')) $url='http://www.companieshouse.gov.uk/WebCHeck/findinfolink/'; + if ($idprof == 1 && $thirdparty->country_code == 'ES') $url='http://www.e-informa.es/servlet/app/portal/ENTP/screen/SProducto/prod/ETIQUETA_EMPRESA/nif/'.$thirdparty->idprof1; + if ($idprof == 1 && $thirdparty->country_code == 'IN') $url='http://www.tinxsys.com/TinxsysInternetWeb/dealerControllerServlet?tinNumber='.$thirdparty->idprof1.';&searchBy=TIN&backPage=searchByTin_Inter.jsp'; + + if ($url) return ''.$langs->trans("Check").''; + } + else + { + return $hookmanager->resPrint; + } + return ''; } @@ -3467,17 +3479,17 @@ class Societe extends CommonObject * Because this function is meant to be executed within a transaction, we won't take care of it. */ $sql = 'SELECT rowid -FROM llx_societe_commerciaux +FROM '.MAIN_DB_PREFIX.'societe_commerciaux WHERE fk_soc = '.(int) $dest_id.' AND fk_user IN ( SELECT fk_user - FROM llx_societe_commerciaux + FROM '.MAIN_DB_PREFIX.'societe_commerciaux WHERE fk_soc = '.(int) $origin_id.' );'; $query = $db->query($sql); while ($result = $db->fetch_object($query)) { - $db->query('DELETE FROM llx_societe_commerciaux WHERE rowid = '.$result->rowid); + $db->query('DELETE FROM '.MAIN_DB_PREFIX.'societe_commerciaux WHERE rowid = '.$result->rowid); } /** diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 70dee1ab8eb..a5fae415a6a 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -276,7 +276,7 @@ if ($type_element == 'contract') $thirdTypeSelect='customer'; } -if ($sql_select) +if (!empty($sql_select)) { $sql = $sql_select; $sql.= ' d.description as description,'; @@ -302,7 +302,7 @@ if ($sql_select) $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; } if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'"; - if ($sprod_fulldescr) + if ($sprod_fulldescr) { $sql.= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%'"; if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'"; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 8e8c69b0ce9..3e7871b2c4a 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -476,7 +476,7 @@ if (empty($reshook)) $actiontypecode='AC_ASKPRICE'; $trigger_name='SUPPLIER_PROPOSAL_SENTBYMAIL'; $paramname='id'; - $mode='emailfromsupplier_proposal'; + $mode='emailfromsupplierproposal'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index fd7f266e159..00efb287dcc 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2186,7 +2186,8 @@ class SupplierProposal extends CommonObject { global $user,$langs,$conf; - // Charge tableau des produits prodids + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; diff --git a/htdocs/theme/eldy/img/object_trip.png b/htdocs/theme/eldy/img/object_trip.png index 95cc4412111..d911bd621de 100644 Binary files a/htdocs/theme/eldy/img/object_trip.png and b/htdocs/theme/eldy/img/object_trip.png differ diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 9bdbd3bb4b7..ef75f3032cb 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -653,7 +653,7 @@ td.showDragHandle { table-layout: fixed; } #id-right, #id-left { - padding-top: 12px; + padding-top: 16px; padding-bottom: 8px; display: table-cell; /* DOL_XXX Empeche fonctionnement correct du scroll horizontal sur tableau, avec datatable ou CSS */ @@ -1058,6 +1058,8 @@ div.tmenucenter div.menu_titre { padding-top: 4px; padding-bottom: 4px; + overflow: hidden; + text-overflow: ellipsis; } .mainmenuaspan { @@ -1421,7 +1423,7 @@ div.vmenu, td.vmenu { .companylogo { } .searchform { padding-top: 4px; } -a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active { font-size:px; font-family: ; text-align: ; font-weight: bold; } +a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active { white-space: nowrap; font-size:px; font-family: ; text-align: ; font-weight: bold; } font.vmenudisabled { font-size:px; font-family: ; text-align: ; font-weight: bold; color: #aaa; margin-left: 4px; } a.vmenu:link, a.vmenu:visited { color: #; } @@ -2731,7 +2733,10 @@ form.liste_total div { border-top-color: rgb() !important; border-top-style: solid !important; } - +.paymenttable tr td:first-child, .margintable tr td:first-child +{ + padding-left: 2px; +} .margintable td { border: 0px !important; } @@ -4090,7 +4095,7 @@ select { /* display: inline-block; */ /* We can't set this. This disable ability to make */ /* TODO modified by jmobile, replace jmobile with pure css*/ overflow:hidden; - white-space: nowrap; + white-space: nowrap; /* Enabling this make behaviour strange when selecting the empty value if this empty value is '' instead of ' ' */ text-overflow: ellipsis; } .fiche .ui-controlgroup { @@ -4289,7 +4294,9 @@ border-top-right-radius: 6px; /* For demo pages */ img.demothumb { - box-shadow: 2px 2px 8px #888; + box-shadow: 2px 2px 8px #BBB; + margin-right: 20px; + margin-left: 10px; } @@ -4326,6 +4333,12 @@ img.demothumb { width: px; } + img.demothumb { + box-shadow: 1px 1px 4px #BBB; + margin-right: 6px; + margin-left: 4px; + width: 80px; + } } /* nboftopmenuentries = , fontsize= */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index ed60bf1e876..9e217efb30c 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1087,6 +1087,8 @@ div.tmenucenter } div.menu_titre { padding-bottom: 2px; + overflow: hidden; + text-overflow: ellipsis; } .mainmenuaspan { @@ -1458,7 +1460,7 @@ div.vmenu, td.vmenu { .companylogo { padding-top: 4px; } .searchform { padding-top: 8px; } -a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active { font-size:px; font-family: ; text-align: ; font-weight: bold; } +a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active { white-space: nowrap; font-size:px; font-family: ; text-align: ; font-weight: bold; } font.vmenudisabled { font-size:px; font-family: ; text-align: ; font-weight: bold; color: #aaa; margin-left: 4px; } a.vmenu:link, a.vmenu:visited { color: #; } @@ -2599,7 +2601,10 @@ input.liste_titre { border-top-color: rgb() !important; border-top-style: solid !important; } - +.paymenttable tr td:first-child, .margintable tr td:first-child +{ + padding-left: 2px; +} .margintable td { border: 0px !important; } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 28b1040f579..032628e4e67 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -54,6 +54,7 @@ $mode = GETPOST('mode','alpha'); $confirm = GETPOST('confirm','alpha'); $subaction = GETPOST('subaction','alpha'); $group = GETPOST("group","int",3); +$cancel = GETPOST('cancel'); // Define value to know what current user can do on users $canadduser=(! empty($user->admin) || $user->rights->user->user->creer); @@ -299,7 +300,8 @@ if (empty($reshook)) { } } - if ($action == 'update' && !$_POST["cancel"]) { + if ($action == 'update' && ! $cancel) + { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; if ($caneditfield) // Case we can edit all field @@ -395,7 +397,7 @@ if (empty($reshook)) { if (!$error) { $ret = $object->update($user); if ($ret < 0) { - $error ++; + $error++; if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); setEventMessages($langs->trans("ErrorLoginAlreadyExists", $object->login), null, 'errors'); @@ -1440,6 +1442,49 @@ else print ''; } + // Multicompany + // TODO This should be done with hook formObjectOption + if (is_object($mc)) + { + if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) + { + print '\n"; + } + } + + if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) + { + print ''; + print ''; + print "\n"; + } + + print ''; + print ''; + print "\n"; + + print ''; + print ''; + print "\n"; + + // Other attributes + $parameters=array(); + $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)) + { + print $object->showOptionals($extrafields); + } + // Company / Contact if (! empty($conf->societe->enabled)) { @@ -1488,49 +1533,6 @@ else print ''."\n"; } - // Multicompany - // TODO This should be done with hook formObjectOption - if (is_object($mc)) - { - if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) - { - print '\n"; - } - } - - if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) - { - print ''; - print ''; - print "\n"; - } - - print ''; - print ''; - print "\n"; - - print ''; - print ''; - print "\n"; - - // Other attributes - $parameters=array(); - $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)) - { - print $object->showOptionals($extrafields); - } - print "
Demo '.$profilearray['label'].'Demo '.$profilearray['label'].''.$langs->trans($profilearray['label']).'
'.$langs->trans("Entity").''; + if (empty($object->entity)) + { + print $langs->trans("AllEntities"); + } + else + { + $mc->getInfo($object->entity); + print $mc->label; + } + print "
'.$langs->trans("OpenIDURL").''.$object->openid.'
'.$langs->trans("LastConnexion").''.dol_print_date($object->datelastlogin,"dayhour").'
'.$langs->trans("PreviousConnexion").''.dol_print_date($object->datepreviouslogin,"dayhour").'
'.$langs->trans("Entity").''; - if (empty($object->entity)) - { - print $langs->trans("AllEntities"); - } - else - { - $mc->getInfo($object->entity); - print $mc->label; - } - print "
'.$langs->trans("OpenIDURL").''.$object->openid.'
'.$langs->trans("LastConnexion").''.dol_print_date($object->datelastlogin,"dayhour").'
'.$langs->trans("PreviousConnexion").''.dol_print_date($object->datepreviouslogin,"dayhour").'
\n"; print ''; @@ -2222,7 +2224,7 @@ else print '
'; $cate_arbo = $form->select_all_categories( Categorie::TYPE_CONTACT, null, null, null, null, 1 ); $c = new Categorie( $db ); - $cats = $c->containing( $object->id, 'user' ); + $cats = $c->containing($object->id, Categorie::TYPE_USER); foreach ($cats as $cat) { $arrayselected[] = $cat->id; } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 6a19be4da1e..5b79447736e 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1332,14 +1332,14 @@ class User extends CommonObject // If user is linked to a member, remove old link to this member if ($this->fk_member > 0) { - $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL where fk_member = ".$this->fk_member; - dol_syslog(get_class($this)."::update", LOG_DEBUG); + dol_syslog(get_class($this)."::update remove link with member. We will recreate it later", LOG_DEBUG); + $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL where fk_member = ".$this->fk_member; $resql = $this->db->query($sql); if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -5; } } // Set link to user + dol_syslog(get_class($this)."::update set link with member", LOG_DEBUG); $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member =".($this->fk_member>0?$this->fk_member:'null')." where rowid = ".$this->id; - dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -5; } @@ -1347,6 +1347,8 @@ class User extends CommonObject { if ($this->fk_member > 0 && ! $nosyncmember) { + dol_syslog(get_class($this)."::update user is linked with a member. We try to update member too.", LOG_DEBUG); + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; // This user is linked with a member, so we also update members informations @@ -1360,7 +1362,9 @@ class User extends CommonObject $adh->lastname=$this->lastname; $adh->login=$this->login; $adh->gender=$this->gender; + $adh->pass=$this->pass; + $adh->societe=(empty($adh->societe) && $this->societe_id ? $this->societe_id : $adh->societe); $adh->email=$this->email; @@ -1373,17 +1377,19 @@ class User extends CommonObject $adh->user_id=$this->id; $adh->user_login=$this->login; - $result=$adh->update($user,0,1); - if ($result < 0) + $result=$adh->update($user,0,1,0); + if ($result < 0) { - $this->error=$luser->error; - dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR); + $this->error=$adh->error; + $this->errors=$adh->errors; + dol_syslog(get_class($this)."::update error after calling adh->update to sync it with user: ".$this->error, LOG_ERR); $error++; } } else { $this->error=$adh->error; + $this->errors=$adh->errors; $error++; } } @@ -1495,7 +1501,7 @@ class User extends CommonObject $password=getRandomPassword(false); } - // Crypte avec md5 + // Crypt password $password_crypted = dol_hash($password); // Mise a jour @@ -1539,7 +1545,7 @@ class User extends CommonObject if ($result >= 0) { - $result=$adh->setPassword($user,$this->pass,0,1); // Cryptage non gere dans module adherent + $result=$adh->setPassword($user,$this->pass,(empty($conf->global->DATABASE_PWD_ENCRYPTED)?0:1),1); // Cryptage non gere dans module adherent if ($result < 0) { $this->error=$adh->error; diff --git a/htdocs/user/class/userbankaccount.class.php b/htdocs/user/class/userbankaccount.class.php index 4e88233fe35..514e8d0b28c 100644 --- a/htdocs/user/class/userbankaccount.class.php +++ b/htdocs/user/class/userbankaccount.class.php @@ -141,8 +141,7 @@ class UserBankAccount extends Account $sql = "SELECT rowid, fk_user, entity, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,"; $sql.= " owner_address, label, datec, tms as datem"; $sql.= " FROM ".MAIN_DB_PREFIX."user_rib"; - if ($id) $sql.= " WHERE rowid = ".$id; - if ($socid) $sql.= " WHERE fk_user = ".$userid; + $sql.= " WHERE rowid = ".$id; $resql = $this->db->query($sql); if ($resql) diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index 9ffda5e96c8..fa8e31e71a1 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -315,7 +315,7 @@ if ($id) print ' '.$perm_libelle. '