Merge remote-tracking branch 'upstream/develop' into develop

Conflicts:
	htdocs/public/agenda/agendaexport.php
This commit is contained in:
Raphaël Doursenaud 2012-04-26 15:10:11 +02:00
commit ce42e5e4f6
740 changed files with 35598 additions and 16886 deletions

View File

@ -18,13 +18,13 @@ GeoIP 2004 LGPL 2.1 Yes Sample code to m
NuSoap 0.9.5 LGPL 2.1 Yes Library to develop SOAP Web services (not into rpm and deb package) NuSoap 0.9.5 LGPL 2.1 Yes Library to develop SOAP Web services (not into rpm and deb package)
OdtPHP 1.0.1 GPL 2.0 Yes Library to build/edit ODT files OdtPHP 1.0.1 GPL 2.0 Yes Library to build/edit ODT files
PHPExcel 1.7.6 LGPL 2.1 Yes Read/Write XLS files, read ODS files PHPExcel 1.7.6 LGPL 2.1 Yes Read/Write XLS files, read ODS files
TCPDF 5.9.098 LGPL 3.0 Yes PDF generation TCPDF 5.9.156 LGPL 3.0 Yes PDF generation
JS libraries: JS libraries:
jQuery 1.7.1 GPL and MIT Licence Yes JS library jQuery 1.7.1 GPL and MIT Licence Yes JS library
jQuery UI 1.8.17 GPL and MIT Licence Yes JS library plugin UI jQuery UI 1.8.17 GPL and MIT Licence Yes JS library plugin UI
jQuery Colorpicker 1.1 MIT Licence Yes JS library for color picker for a defined list of colors jQuery Colorpicker 1.1 MIT Licence Yes JS library for color picker for a defined list of colors
jQuery DataTable 1.8.1 BSD Yes JS library for tables output jQuery DataTables 1.9.1 BSD Yes JS library for tables output
jQuery Flot 0.7 MIT Licence Yes JS library to build graph jQuery Flot 0.7 MIT Licence Yes JS library to build graph
jQuery FileUpload 5.0.3 GPL and MIT Licence Yes JS library to upload files jQuery FileUpload 5.0.3 GPL and MIT Licence Yes JS library to upload files
jQuery JCrop 0.9.8 GPL and MIT Licence Yes JS library plugin Crop (to crop images) jQuery JCrop 0.9.8 GPL and MIT Licence Yes JS library plugin Crop (to crop images)

View File

@ -2,13 +2,23 @@
English Dolibarr ChangeLog English Dolibarr ChangeLog
-------------------------------------------------------------- --------------------------------------------------------------
***** ChangeLog for 3.3 compared to 3.2 *****
For users:
- New: Add supplier ref on supplier orders.
- New: Can export supplier orders.
For developers:
***** ChangeLog for 3.2 compared to 3.1 ***** ***** ChangeLog for 3.2 compared to 3.1 *****
WARNING: PHP lower than 5.x are no more supported. WARNING: PHP lower than 5.x are no more supported.
WARNING: Because of a major datastructure change onto supplier prices tabkes, be aware WARNING: Because of a major datastructure change onto supplier prices tables, be aware
to make a backup of your database before making upgrade. to make a backup of your database before making upgrade.
For users: For users:
- New: Each user can remove/add its own boxes. - New: Each user can remove/add its own boxes.
- New: Add signature at end of predefined email text.
- New: Can use personalized fields of products/services. - New: Can use personalized fields of products/services.
- New: Can attach files on social contributions. - New: Can attach files on social contributions.
- New: Show payments terms and conditions onto muscadet template. - New: Show payments terms and conditions onto muscadet template.
@ -61,9 +71,12 @@ For users:
- New: Add hidden option MAIN_ADD_PDF_BACKGROUND to add a PDF as background of invoice/order generated PDF. - New: Add hidden option MAIN_ADD_PDF_BACKGROUND to add a PDF as background of invoice/order generated PDF.
- New: Can convert a product/service into service/product. - New: Can convert a product/service into service/product.
- New: Show delivery date into proposal template azur. - New: Show delivery date into proposal template azur.
- New: Support tags into header and footer into ODT templates.
- Fix: Can use POS module with several concurrent users. - Fix: Can use POS module with several concurrent users.
- Fix: Installer don't fails with Mysql version that added a ssl_cypher field. - Fix: Installer don't fails with Mysql version that added a ssl_cypher field.
- Fix: Sanitize input parameters. - Fix: Sanitize input parameters.
- Fix: [ bug #368 ] Product list
- Fix: [ bug #370 ] Filter in accountancy -> suppliers_bills
For developers: For developers:
- New: Can add a left menu into an existing top menu or left menu. - New: Can add a left menu into an existing top menu or left menu.

View File

@ -8,9 +8,7 @@ script to build a package, ready to be distributed,
with format .DEB (for Debian, Ubuntu, ...). with format .DEB (for Debian, Ubuntu, ...).
# To build a debian package, you need first # To build a debian package, you need first
# apt-get -i debhelper # apt-get -i debhelper dpkg-source gpg lintian
# apt-get -i dpkg-source
# apt-get -i gpg
# This is standard command to work on Debian packaging: # This is standard command to work on Debian packaging:
@ -35,7 +33,8 @@ with format .DEB (for Debian, Ubuntu, ...).
# dpkg --purge Remove config files and interactive saved answers # dpkg --purge Remove config files and interactive saved answers
# #
# dpkg-buildpackage -us -uc Build a source and binary package # dpkg-buildpackage -us -uc Build a source and binary package
#
# gdebi package.deb Install a package + dependencies
To submit a package to Debian: To submit a package to Debian:

View File

@ -1,4 +1,4 @@
dolibarr (3.2.0+nmu1) unstable; urgency=low dolibarr (3.3.0+nmu1) unstable; urgency=low
* Non-maintainer upload. * Non-maintainer upload.
* New upstream release. * New upstream release.

View File

@ -9,13 +9,11 @@ Build-Depends: debhelper (>= 7), po-debconf, dpatch
Package: dolibarr Package: dolibarr
Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5, Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5,
php5-mysql | php5-mysqli, php5-mysql | php5-mysqli,
php5-cli, php5-curl, php5-gd, php5-ldap, php-pear, php-mail-mime, php5-geoip, php-fpdf, php5-cli, php5-curl, php5-gd, php5-ldap, php-pear, php-mail-mime, php5-geoip,
libphp-adodb, libphp-adodb,
libfpdi-php,
libfpdf-tpl-php,
libnusoap-php, libnusoap-php,
libphp-pclzip, libphp-pclzip,
libjs-jquery, libjs-jquery-ui, libjs-flot, ckeditor, libjs-jquery, libjs-jquery-ui, ckeditor,
ttf-dejavu-core, ttf-dejavu-core,
xdg-utils, xdg-utils,
mysql-server, mysql-server,

View File

@ -6,11 +6,10 @@ Installed-Size: 61200
Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5, Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5,
php5-mysql | php5-mysqli, php5-mysql | php5-mysqli,
php5-cli, php5-curl, php5-gd, php5-ldap, php-pear, php-mail-mime, php5-geoip, php5-cli, php5-curl, php5-gd, php5-ldap, php-pear, php-mail-mime, php5-geoip,
libphp-adodb,
libnusoap-php, libnusoap-php,
libphp-pclzip, libphp-pclzip,
libfpdi-php, libjs-jquery, libjs-jquery-ui, ckeditor,
libfpdf-tpl-php,
ckeditor,
ttf-dejavu-core, ttf-dejavu-core,
xdg-utils, xdg-utils,
mysql-server mysql-server
@ -27,6 +26,7 @@ Description: Web based software to manage a small company or foundation
. .
Dolibarr was designed to be easy to use. Only features you need are Dolibarr was designed to be easy to use. Only features you need are
visible, depending on which module were activated. visible, depending on which module were activated.
Most common used modules are:
. .
Customers, Suppliers or Prospects directory, Customers, Suppliers or Prospects directory,
Contacts directory, Contacts directory,

View File

@ -83,7 +83,8 @@ case "$1" in
chown -R root:www-data $installconfig chown -R root:www-data $installconfig
chmod -R 660 $installconfig chmod -R 660 $installconfig
if [ ! -f $config ] # If a conf already exists and its content was already completed by installer
if [ ! -s $config ] || ! grep -q "File generated by" $config
then then
# Create an empty conf.php with permission to web server # Create an empty conf.php with permission to web server
echo Create empty file $config echo Create empty file $config
@ -92,18 +93,18 @@ case "$1" in
chown -R root:www-data $config chown -R root:www-data $config
else else
# File already exist. We add params not found. # File already exist. We add params not found.
// Add new params to overwrite path to use shared libraries/fonts echo Add new params to overwrite path to use shared libraries/fonts
grep -q -c "dolibarr_lib_ADODB_PATH" $config || echo "<?php \$dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; ?>" >> $config grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "<?php \$dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; ?>" >> $config
grep -q -c "dolibarr_lib_FPDI_PATH" $config || echo "<?php \$dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; ?>" >> $config grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "<?php \$dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; ?>" >> $config
grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config #grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || echo "<?php \$dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; ?>" >> $config grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ] || echo "<?php \$dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; ?>" >> $config
grep -q -c "dolibarr_lib_PHPEXCEL_PATH" $config || echo "<?php \$dolibarr_lib_PHPEXCEL_PATH=''; ?>" >> $config #grep -q -c "dolibarr_lib_PHPEXCEL_PATH" $config || echo "<?php \$dolibarr_lib_PHPEXCEL_PATH=''; ?>" >> $config
grep -q -c "dolibarr_lib_TCPDF_PATH" $config || echo "<?php \$dolibarr_lib_TCPDF_PATH=''; ?>" >> $config #grep -q -c "dolibarr_lib_TCPDF_PATH" $config || echo "<?php \$dolibarr_lib_TCPDF_PATH=''; ?>" >> $config
grep -q -c "dolibarr_js_CKEDITOR" $config || echo "<?php \$dolibarr_js_CKEDITOR='/javascript/ckeditor'; ?>" >> $config grep -q -c "dolibarr_js_CKEDITOR" $config || [ ! -d "/usr/share/javascript/ckeditor" ] || echo "<?php \$dolibarr_js_CKEDITOR='/javascript/ckeditor'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY" $config || echo "<?php \$dolibarr_js_JQUERY='/javascript/jquery'; ?>" >> $config grep -q -c "dolibarr_js_JQUERY" $config || [ ! -d "/usr/share/javascript/jquery" ] || echo "<?php \$dolibarr_js_JQUERY='/javascript/jquery'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY_UI" $config || echo "<?php \$dolibarr_js_JQUERY_UI='/javascript/jquery-ui'; ?>" >> $config grep -q -c "dolibarr_js_JQUERY_UI" $config || [ ! -d "/usr/share/javascript/jquery-ui" ] || echo "<?php \$dolibarr_js_JQUERY_UI='/javascript/jquery-ui'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY_FLOT" $config || echo "<?php \$dolibarr_js_JQUERY_FLOT='/javascript/flot'; ?>" >> $config grep -q -c "dolibarr_js_JQUERY_FLOT" $config || [ ! -d "/usr/share/javascript/flot" ] || echo "<?php \$dolibarr_js_JQUERY_FLOT='/javascript/flot'; ?>" >> $config
grep -q -c "dolibarr_font_DOL_DEFAULT_TTF_BOLD" $config || echo "<?php \$dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf'; ?>" >> $config grep -q -c "dolibarr_font_DOL_DEFAULT_TTF_BOLD" $config || echo "<?php \$dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf'; ?>" >> $config
fi fi

View File

@ -3,7 +3,8 @@
# #
# see: dh_installdeb(1) # see: dh_installdeb(1)
set -e #set -e
set +e
# summary of how this script can be called: # summary of how this script can be called:
# * <postrm> `remove' # * <postrm> `remove'

View File

@ -27,7 +27,7 @@ $force_install_lockinstall='444';
// Value to overwrite path to use shared libraries/fonts instead of embedded one // Value to overwrite path to use shared libraries/fonts instead of embedded one
$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; $force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';
$force_dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; //$force_dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi';
$force_dolibarr_lib_GEOIP_PATH=''; $force_dolibarr_lib_GEOIP_PATH='';
$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; $force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap';
$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip';
@ -36,7 +36,7 @@ $force_dolibarr_lib_TCPDF_PATH='';
$force_dolibarr_js_CKEDITOR='/javascript/ckeditor'; $force_dolibarr_js_CKEDITOR='/javascript/ckeditor';
$force_dolibarr_js_JQUERY='/javascript/jquery'; $force_dolibarr_js_JQUERY='/javascript/jquery';
$force_dolibarr_js_JQUERY_UI='/javascript/jquery-ui'; $force_dolibarr_js_JQUERY_UI='/javascript/jquery-ui';
$force_dolibarr_js_JQUERY_FLOT='/javascript/flot'; //$force_dolibarr_js_JQUERY_FLOT='/javascript/flot';
$force_dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf'; $force_dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf';
?> ?>

View File

@ -104,6 +104,7 @@ clean:
rm -fr htdocs/includes/jquery/plugins/jstree rm -fr htdocs/includes/jquery/plugins/jstree
rm -fr htdocs/includes/jquery/plugins/lightbox rm -fr htdocs/includes/jquery/plugins/lightbox
rm -fr htdocs/includes/jquery/plugins/mobile rm -fr htdocs/includes/jquery/plugins/mobile
rm -fr htdocs/includes/jquery/plugins/multiselect
rm -fr htdocs/includes/phpexcel/PHPExcel/Shared/PDF rm -fr htdocs/includes/phpexcel/PHPExcel/Shared/PDF
rm -fr htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip rm -fr htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip
rm -fr htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-2.33 rm -fr htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-2.33

View File

@ -31,7 +31,7 @@ PROJECT_NAME = dolibarr
# This could be handy for archiving the generated documentation or # This could be handy for archiving the generated documentation or
# if some version control system is used. # if some version control system is used.
PROJECT_NUMBER = 3.2.0 PROJECT_NUMBER = 3.3.0
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put. # base path where the generated documentation will be put.

View File

@ -31,7 +31,7 @@ PROJECT_NAME = dolibarr
# This could be handy for archiving the generated documentation or # This could be handy for archiving the generated documentation or
# if some version control system is used. # if some version control system is used.
PROJECT_NUMBER = 3.2.0 PROJECT_NUMBER = 3.3.0
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put. # base path where the generated documentation will be put.

View File

@ -17,12 +17,13 @@
; ----- Change this ----- ; ----- Change this -----
AppName=DoliWamp AppName=DoliWamp
; DoliWamp-x.x.x or DoliWamp-x.x.x-dev or DoliWamp-x.x.x-beta ; DoliWamp-x.x.x or DoliWamp-x.x.x-dev or DoliWamp-x.x.x-beta
AppVerName=DoliWamp-3.2.0-alpha AppVerName=DoliWamp-3.3.0-alpha
; DoliWamp-x.x x or DoliWamp-x.x.x-dev or DoliWamp-x.x.x-beta ; DoliWamp-x.x x or DoliWamp-x.x.x-dev or DoliWamp-x.x.x-beta
OutputBaseFilename=DoliWamp-3.2.0-alpha OutputBaseFilename=DoliWamp-3.3.0-alpha
; Define full path from wich all relative path are defined ; Define full path from wich all relative path are defined
; You must modify this to put here your dolibarr root directory ; You must modify this to put here your dolibarr root directory
SourceDir=c:\Documents and Settings\ldestail\git\dolibarr ;SourceDir=C:\Documents and Settings\ldestail\git\dolibarrold
SourceDir=Z:\home\ldestail\git\dolibarrold
; ----- End of change ; ----- End of change
;OutputManifestFile=build\doliwampbuild.log ;OutputManifestFile=build\doliwampbuild.log
AppId=doliwamp AppId=doliwamp

View File

@ -61,5 +61,25 @@ DEBEMAIL="<Your email address>"
sudo pbuilder build <working-dir>/<project>_<version>.dsc sudo pbuilder build <working-dir>/<project>_<version>.dsc
# To get/download package:
Add signing key of the Launchpad repository:
> gpg --keyserver keyserver.ubuntu.com --recv-key A38BF8FD
> sudo apt-key add ~/.gnupg/pubring.gpg
Add Dolibarr Launchpad repository to your system setup by adding the two lines to /etc/apt/sources.list
For the development snapshot version:
deb http://ppa.launchpad.net/eldy/dolibarr-dev/ubuntu precise main
deb-src http://ppa.launchpad.net/eldy/dolibarr-dev/ubuntu precise main
For the stable version:
deb http://ppa.launchpad.net/eldy/dolibarr-stable/ubuntu precise main
deb-src http://ppa.launchpad.net/eldy/dolibarr-stable/ubuntu precise main
Update your package cache:
> apt-get update
Install Dolibarr:
> apt-get install dolibarr

View File

@ -9,7 +9,7 @@ use Cwd;
$PROJECT="dolibarr"; $PROJECT="dolibarr";
$MAJOR="3"; $MAJOR="3";
$MINOR="2"; $MINOR="3";
$BUILD="0-alpha"; # Mettre x pour release, x-dev pour dev, x-beta pour beta, x-rc pour release candidate $BUILD="0-alpha"; # Mettre x pour release, x-dev pour dev, x-beta pour beta, x-rc pour release candidate
$RPMSUBVERSION="auto"; # auto use value found into BUILD $RPMSUBVERSION="auto"; # auto use value found into BUILD
@ -38,7 +38,7 @@ $FILENAMEZIP="$PROJECT-$MAJOR.$MINOR.$BUILD";
$FILENAMERPM="$PROJECT-$MAJOR.$MINOR.$BUILD-$RPMSUBVERSION"; $FILENAMERPM="$PROJECT-$MAJOR.$MINOR.$BUILD-$RPMSUBVERSION";
$FILENAMEDEB="${PROJECT}_${MAJOR}.${MINOR}.${BUILD}"; $FILENAMEDEB="${PROJECT}_${MAJOR}.${MINOR}.${BUILD}";
$FILENAMEAPS="$PROJECT-$MAJOR.$MINOR.$BUILD.app"; $FILENAMEAPS="$PROJECT-$MAJOR.$MINOR.$BUILD.app";
$FILENAMEEXEDOLIWAMP="$PROJECT-$MAJOR.$MINOR.$BUILD"; $FILENAMEEXEDOLIWAMP="DoliWamp-$MAJOR.$MINOR.$BUILD";
if (-d "/usr/src/redhat") { $RPMDIR="/usr/src/redhat"; } # redhat if (-d "/usr/src/redhat") { $RPMDIR="/usr/src/redhat"; } # redhat
if (-d "/usr/src/RPM") { $RPMDIR="/usr/src/RPM"; } # mandrake if (-d "/usr/src/RPM") { $RPMDIR="/usr/src/RPM"; } # mandrake
@ -763,8 +763,10 @@ if ($nboftargetok) {
print "Remove target $FILENAMEEXEDOLIWAMP.exe...\n"; print "Remove target $FILENAMEEXEDOLIWAMP.exe...\n";
unlink "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"; unlink "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe";
print "Compil exe $FILENAMEEXEDOLIWAMP.exe file from iss file \"$SOURCE\\build\\exe\\doliwamp\\doliwamp.iss\"\n"; $SOURCEBACK=$SOURCE;
$cmd= "iscc.exe \"$SOURCE\\build\\exe\\doliwamp\\doliwamp.iss\""; $SOURCEBACK =~ s/\//\\/g;
print "Compil exe $FILENAMEEXEDOLIWAMP.exe file from iss file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.iss\"\n";
$cmd= "ISCC.exe \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.iss\"";
print "$cmd\n"; print "$cmd\n";
$ret= `$cmd`; $ret= `$cmd`;
#print "$ret\n"; #print "$ret\n";
@ -772,6 +774,8 @@ if ($nboftargetok) {
# Move to final dir # Move to final dir
print "Move \"$SOURCE\\build\\$FILENAMEEXEDOLIWAMP.exe\" to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n"; print "Move \"$SOURCE\\build\\$FILENAMEEXEDOLIWAMP.exe\" to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n";
rename("$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe","$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"); rename("$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe","$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe");
print "Move $SOURCE/build/$FILENAMEEXEDOLIWAMP.exe to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n";
$ret=`mv "$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe" "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"`;
next; next;
} }
} }

View File

@ -12,7 +12,7 @@ beta version of Dolibarr, step by step.
- Update version number with x.x.x in build/doxygen/dolibarr-doxygen.doxyfile - Update version number with x.x.x in build/doxygen/dolibarr-doxygen.doxyfile
- Update version number with x.x.x in build/perl/virtualmin/dolibarr.pl - Update version number with x.x.x in build/perl/virtualmin/dolibarr.pl
- Update version number with x.x.x-y in build/makepack-dolibarr.pl - Update version number with x.x.x-y in build/makepack-dolibarr.pl
- Update version number with x.x.x-y in build/deb/changelog - Update version number with x.x.x-y in build/debian/changelog
- Update version number with x.x.x-y in build/exe/doliwamp/doliwamp.iss - Update version number with x.x.x-y in build/exe/doliwamp/doliwamp.iss
- Update version number with x.x.x-y in htdocs/filefunc.inc.php - Update version number with x.x.x-y in htdocs/filefunc.inc.php
- Update version number with x.x.x-y in htdocs/install/inc.php - Update version number with x.x.x-y in htdocs/install/inc.php

View File

@ -30,7 +30,7 @@ return "Regis Houssin";
# script_dolibarr_versions() # script_dolibarr_versions()
sub script_dolibarr_versions sub script_dolibarr_versions
{ {
return ( "3.1.0", "3.0.1", "2.9.0" ); return ( "3.3.0", "3.2.0", "3.1.0", "3.0.1", "2.9.0" );
} }
sub script_dolibarr_category sub script_dolibarr_category

View File

@ -217,6 +217,26 @@ echo Create document directory $docdir
# Set correct owner on config files # Set correct owner on config files
%{__chown} -R root:$apachegroup /etc/dolibarr/* %{__chown} -R root:$apachegroup /etc/dolibarr/*
# If a conf already exists and its content was already completed by installer
export config=%{_sysconfdir}/dolibarr/conf.php
if [ -s $config ] && grep -q "File generated by" $config
then
# File already exist. We add params not found.
echo Add new params to overwrite path to use shared libraries/fonts
grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "<?php \$dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; ?>" >> $config
grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "<?php \$dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; ?>" >> $config
#grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ] || echo "<?php \$dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; ?>" >> $config
#grep -q -c "dolibarr_lib_PHPEXCEL_PATH" $config || echo "<?php \$dolibarr_lib_PHPEXCEL_PATH=''; ?>" >> $config
#grep -q -c "dolibarr_lib_TCPDF_PATH" $config || echo "<?php \$dolibarr_lib_TCPDF_PATH=''; ?>" >> $config
grep -q -c "dolibarr_js_CKEDITOR" $config || [ ! -d "/usr/share/javascript/ckeditor" ] || echo "<?php \$dolibarr_js_CKEDITOR='/javascript/ckeditor'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY" $config || [ ! -d "/usr/share/javascript/jquery" ] || echo "<?php \$dolibarr_js_JQUERY='/javascript/jquery'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY_UI" $config || [ ! -d "/usr/share/javascript/jquery-ui" ] || echo "<?php \$dolibarr_js_JQUERY_UI='/javascript/jquery-ui'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY_FLOT" $config || [ ! -d "/usr/share/javascript/flot" ] || echo "<?php \$dolibarr_js_JQUERY_FLOT='/javascript/flot'; ?>" >> $config
grep -q -c "dolibarr_font_DOL_DEFAULT_TTF_BOLD" $config || echo "<?php \$dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf'; ?>" >> $config
fi
# Create config for se $seconfig # Create config for se $seconfig
echo Add SE Linux permissions for dolibarr echo Add SE Linux permissions for dolibarr
# semanage add records into /etc/selinux/targeted/contexts/files/file_contexts.local # semanage add records into /etc/selinux/targeted/contexts/files/file_contexts.local
@ -292,5 +312,5 @@ fi
%changelog %changelog
* Wed Jul 31 2011 Laurent Destailleur 3.2.0-0.1.a * Wed Mar 4 2012 Laurent Destailleur 3.3.0-0.1.a
- Initial version (#723326) - Initial version (#723326)

View File

@ -254,6 +254,26 @@ fi
# Set correct owner on config files # Set correct owner on config files
%{__chown} -R root:$apachegroup /etc/dolibarr/* %{__chown} -R root:$apachegroup /etc/dolibarr/*
# If a conf already exists and its content was already completed by installer
export config=%{_sysconfdir}/dolibarr/conf.php
if [ -s $config ] && grep -q "File generated by" $config
then
# File already exist. We add params not found.
echo Add new params to overwrite path to use shared libraries/fonts
grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "<?php \$dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; ?>" >> $config
grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "<?php \$dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; ?>" >> $config
#grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ] || echo "<?php \$dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; ?>" >> $config
#grep -q -c "dolibarr_lib_PHPEXCEL_PATH" $config || echo "<?php \$dolibarr_lib_PHPEXCEL_PATH=''; ?>" >> $config
#grep -q -c "dolibarr_lib_TCPDF_PATH" $config || echo "<?php \$dolibarr_lib_TCPDF_PATH=''; ?>" >> $config
grep -q -c "dolibarr_js_CKEDITOR" $config || [ ! -d "/usr/share/javascript/ckeditor" ] || echo "<?php \$dolibarr_js_CKEDITOR='/javascript/ckeditor'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY" $config || [ ! -d "/usr/share/javascript/jquery" ] || echo "<?php \$dolibarr_js_JQUERY='/javascript/jquery'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY_UI" $config || [ ! -d "/usr/share/javascript/jquery-ui" ] || echo "<?php \$dolibarr_js_JQUERY_UI='/javascript/jquery-ui'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY_FLOT" $config || [ ! -d "/usr/share/javascript/flot" ] || echo "<?php \$dolibarr_js_JQUERY_FLOT='/javascript/flot'; ?>" >> $config
grep -q -c "dolibarr_font_DOL_DEFAULT_TTF_BOLD" $config || echo "<?php \$dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf'; ?>" >> $config
fi
# Create config for se $seconfig # Create config for se $seconfig
if [ "x$os" = "xfedora-redhat" -a -s /sbin/restorecon ]; then if [ "x$os" = "xfedora-redhat" -a -s /sbin/restorecon ]; then
echo Add SE Linux permissions for dolibarr echo Add SE Linux permissions for dolibarr
@ -348,5 +368,5 @@ fi
%changelog %changelog
* Wed Jul 31 2011 Laurent Destailleur 3.2.0-0.1.a * Wed Mar 4 2012 Laurent Destailleur 3.3.0-0.1.a
- Initial version (#723326) - Initial version (#723326)

View File

@ -214,6 +214,26 @@ echo Create document directory $docdir
# Set correct owner on config files # Set correct owner on config files
%{__chown} -R root:$apachegroup /etc/dolibarr/* %{__chown} -R root:$apachegroup /etc/dolibarr/*
# If a conf already exists and its content was already completed by installer
export confcomplete=`grep -c "File generated by" %{_sysconfdir}/dolibarr/conf.php 2>/dev/null`
if [ -s %{_sysconfdir}/dolibarr/conf.php -a "x$confcomplete" != "x0" ]
then
# File already exist. We add params not found.
echo Add new params to overwrite path to use shared libraries/fonts
grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "<?php \$dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; ?>" >> $config
grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "<?php \$dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; ?>" >> $config
#grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ] || echo "<?php \$dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; ?>" >> $config
#grep -q -c "dolibarr_lib_PHPEXCEL_PATH" $config || echo "<?php \$dolibarr_lib_PHPEXCEL_PATH=''; ?>" >> $config
#grep -q -c "dolibarr_lib_TCPDF_PATH" $config || echo "<?php \$dolibarr_lib_TCPDF_PATH=''; ?>" >> $config
grep -q -c "dolibarr_js_CKEDITOR" $config || [ ! -d "/usr/share/javascript/ckeditor" ] || echo "<?php \$dolibarr_js_CKEDITOR='/javascript/ckeditor'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY" $config || [ ! -d "/usr/share/javascript/jquery" ] || echo "<?php \$dolibarr_js_JQUERY='/javascript/jquery'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY_UI" $config || [ ! -d "/usr/share/javascript/jquery-ui" ] || echo "<?php \$dolibarr_js_JQUERY_UI='/javascript/jquery-ui'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY_FLOT" $config || [ ! -d "/usr/share/javascript/flot" ] || echo "<?php \$dolibarr_js_JQUERY_FLOT='/javascript/flot'; ?>" >> $config
grep -q -c "dolibarr_font_DOL_DEFAULT_TTF_BOLD" $config || echo "<?php \$dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/TTF/dejavu/DejaVuSans-Bold.ttf'; ?>" >> $config
fi
# Create a config link dolibarr.conf # Create a config link dolibarr.conf
if [ ! -L $apachelink ]; then if [ ! -L $apachelink ]; then
echo Create dolibarr web server config link $apachelink echo Create dolibarr web server config link $apachelink
@ -281,5 +301,5 @@ fi
%changelog %changelog
* Wed Jul 31 2011 Laurent Destailleur 3.2.0-0.1.a * Wed Mar 4 2012 Laurent Destailleur 3.3.0-0.1.a
- Initial version (#723326) - Initial version (#723326)

View File

@ -219,6 +219,26 @@ echo Create document directory $docdir
# Set correct owner on config files # Set correct owner on config files
%{__chown} -R root:$apachegroup /etc/dolibarr/* %{__chown} -R root:$apachegroup /etc/dolibarr/*
# If a conf already exists and its content was already completed by installer
export config=%{_sysconfdir}/dolibarr/conf.php
if [ -s $config ] && grep -q "File generated by" $config
then
# File already exist. We add params not found.
echo Add new params to overwrite path to use shared libraries/fonts
grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "<?php \$dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; ?>" >> $config
grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "<?php \$dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; ?>" >> $config
#grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ] || echo "<?php \$dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; ?>" >> $config
#grep -q -c "dolibarr_lib_PHPEXCEL_PATH" $config || echo "<?php \$dolibarr_lib_PHPEXCEL_PATH=''; ?>" >> $config
#grep -q -c "dolibarr_lib_TCPDF_PATH" $config || echo "<?php \$dolibarr_lib_TCPDF_PATH=''; ?>" >> $config
grep -q -c "dolibarr_js_CKEDITOR" $config || [ ! -d "/usr/share/javascript/ckeditor" ] || echo "<?php \$dolibarr_js_CKEDITOR='/javascript/ckeditor'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY" $config || [ ! -d "/usr/share/javascript/jquery" ] || echo "<?php \$dolibarr_js_JQUERY='/javascript/jquery'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY_UI" $config || [ ! -d "/usr/share/javascript/jquery-ui" ] || echo "<?php \$dolibarr_js_JQUERY_UI='/javascript/jquery-ui'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY_FLOT" $config || [ ! -d "/usr/share/javascript/flot" ] || echo "<?php \$dolibarr_js_JQUERY_FLOT='/javascript/flot'; ?>" >> $config
grep -q -c "dolibarr_font_DOL_DEFAULT_TTF_BOLD" $config || echo "<?php \$dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/truetype/DejaVuSans-Bold.ttf'; ?>" >> $config
fi
# Create a config link dolibarr.conf # Create a config link dolibarr.conf
if [ ! -L $apachelink ]; then if [ ! -L $apachelink ]; then
echo Create dolibarr web server config link $apachelink echo Create dolibarr web server config link $apachelink
@ -286,5 +306,5 @@ fi
%changelog %changelog
* Wed Jul 31 2011 Laurent Destailleur 3.2.0-0.1.a * Wed Mar 4 2012 Laurent Destailleur 3.3.0-0.1.a
- Initial version (#723326) - Initial version (#723326)

View File

@ -30,6 +30,6 @@ $force_dolibarr_lib_TCPDF_PATH='';
//$force_dolibarr_js_JQUERY='/javascript/jquery'; //$force_dolibarr_js_JQUERY='/javascript/jquery';
//$force_dolibarr_js_JQUERY_UI='/javascript/jquery-ui'; //$force_dolibarr_js_JQUERY_UI='/javascript/jquery-ui';
//$force_dolibarr_js_JQUERY_FLOT='/javascript/flot'; //$force_dolibarr_js_JQUERY_FLOT='/javascript/flot';
$force_dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/truetype'; $force_dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/truetype/DejaVuSans-Bold.ttf';
?> ?>

View File

@ -88,5 +88,3 @@ cvschangelogbuilder_dolibarr*
*/pdf_huitre.modules.php */pdf_huitre.modules.php
doxygen_warnings.log doxygen_warnings.log
dolibarr_install.log dolibarr_install.log
*/doc_generic_invoice_odt.modules.php
*/htdocs/theme/bureau2crea/*

View File

@ -30,7 +30,7 @@ public function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false, $ln=
by by
public function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=false, $maxh=0, $valign='T', $fitcell=false) { public function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=false, $maxh=0, $valign='T', $fitcell=false) {
* Removed all fonts except dejavu* (greek, arab, persan, romanian, turkish), freemono* (russian), stsongstdlight* (chinese), helvetica* (all other) and useless directories (fonts/utils, docs, cache, images) * Removed all fonts except dejavu* (used by greek, arab, persan, romanian, turkish), freemono* (russian), stsongstdlight* (chinese), helvetica* (all other) and useless directories (fonts/utils, docs, cache, images)
* Replace in tcpdf_config.php * Replace in tcpdf_config.php
define ('K_PATH_CACHE', K_PATH_MAIN.'cache/'); define ('K_PATH_CACHE', K_PATH_MAIN.'cache/');

View File

@ -11,7 +11,7 @@
#------------------------------------------------------ #------------------------------------------------------
export dumpfile="mysqldump_dolibarr_3.1.0.sql" export dumpfile=`ls mysqldump_dolibarr_*.sql | sort | tail -n 1`
export mydir=`echo "$0" | sed -e 's/initdemo.sh//'`; export mydir=`echo "$0" | sed -e 's/initdemo.sh//'`;
if [ "x$mydir" = "x" ] if [ "x$mydir" = "x" ]
then then

File diff suppressed because one or more lines are too long

View File

@ -81,6 +81,7 @@ class modMyModule extends DolibarrModules
// 'models' => 0, // Set this to 1 if module has its own models directory // 'models' => 0, // Set this to 1 if module has its own models directory
// 'css' => '/mymodule/css/mymodule.css.php', // Set this to relative path of css if module has its own css file // 'css' => '/mymodule/css/mymodule.css.php', // Set this to relative path of css if module has its own css file
// 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module // 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module
// 'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) // Set here all workflow context managed by module
// ); // );
$this->module_parts = array(); $this->module_parts = array();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -59,9 +59,11 @@ class AccountancyAccount
*/ */
function create($user) function create($user)
{ {
$now=dol_now();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."accountingaccount"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."accountingaccount";
$sql.= " (date_creation, fk_user_author, numero,intitule)"; $sql.= " (date_creation, fk_user_author, numero,intitule)";
$sql.= " VALUES (".$this->db->idate(gmmktime()).",".$user->id.",'".$this->numero."','".$this->intitule."')"; $sql.= " VALUES (".$this->db->idate($now).",".$user->id.",'".$this->numero."','".$this->intitule."')";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)

View File

@ -4,8 +4,8 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -39,7 +39,7 @@ if (! $user->admin) accessforbidden();
$type=array('yesno','texte','chaine'); $type=array('yesno','texte','chaine');
$action = GETPOST("action"); $action = GETPOST('action','alpha');
/* /*
@ -49,8 +49,8 @@ $action = GETPOST("action");
// Action mise a jour ou ajout d'une constante // Action mise a jour ou ajout d'une constante
if ($action == 'update' || $action == 'add') if ($action == 'update' || $action == 'add')
{ {
$constname=GETPOST("constname"); $constname=GETPOST('constname','alpha');
$constvalue=GETPOST("constvalue"); $constvalue=(GETPOST('constvalue_'.$constname,'alpha') ? GETPOST('constvalue_'.$constname,'alpha') : GETPOST('constvalue','alpha'));
if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE') && $constvalue == -1) $constvalue=''; if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE') && $constvalue == -1) $constvalue='';
if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
@ -59,9 +59,8 @@ if ($action == 'update' || $action == 'add')
else $constvalue=1; else $constvalue=1;
} }
if (in_array($constname,array('ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL'))) $constvalue=$_POST["constvalue".$constname]; $consttype=GETPOST('consttype','alpha');
$consttype=$_POST["consttype"]; $constnote=GETPOST('constnote','alpha');
$constnote=GETPOST("constnote");
$res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity); $res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
@ -79,7 +78,7 @@ if ($action == 'update' || $action == 'add')
// Action activation d'un sous module du module adherent // Action activation d'un sous module du module adherent
if ($action == 'set') if ($action == 'set')
{ {
$result=dolibarr_set_const($db, $_GET["name"],$_GET["value"],'',0,'',$conf->entity); $result=dolibarr_set_const($db, GETPOST('name','alpha'),GETPOST('value','alpha'),'',0,'',$conf->entity);
if ($result < 0) if ($result < 0)
{ {
print $db->error(); print $db->error();
@ -89,7 +88,7 @@ if ($action == 'set')
// Action desactivation d'un sous module du module adherent // Action desactivation d'un sous module du module adherent
if ($action == 'unset') if ($action == 'unset')
{ {
$result=dolibarr_del_const($db,$_GET["name"],$conf->entity); $result=dolibarr_del_const($db,GETPOST('name','alpha'),$conf->entity);
if ($result < 0) if ($result < 0)
{ {
print $db->error(); print $db->error();

View File

@ -125,7 +125,6 @@ print $langs->trans("EnablePublicSubscriptionForm");
print '</td><td width="60" align="right">'; print '</td><td width="60" align="right">';
print $form->selectyesno("MEMBER_ENABLE_PUBLIC",$conf->global->MEMBER_ENABLE_PUBLIC,1); print $form->selectyesno("MEMBER_ENABLE_PUBLIC",$conf->global->MEMBER_ENABLE_PUBLIC,1);
print "</td></tr>\n"; print "</td></tr>\n";
print '</form>';
// Type // Type
/*$var=! $var; /*$var=! $var;

View File

@ -39,8 +39,12 @@ $langs->load("users");
$langs->load("mails"); $langs->load("mails");
$action=GETPOST('action','alpha');
$rowid=GETPOST('rowid','int');
$typeid=GETPOST('typeid','int');
// Security check // Security check
if (! $user->rights->adherent->cotisation->lire) accessforbidden(); $result=restrictedArea($user,'adherent',$rowid);
$object = new Adherent($db); $object = new Adherent($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
@ -50,10 +54,6 @@ $errmsg='';
$defaultdelay=1; $defaultdelay=1;
$defaultdelayunit='y'; $defaultdelayunit='y';
$action=GETPOST('action');
$rowid=GETPOST('rowid');
$typeid=GETPOST('typeid');
if ($rowid) if ($rowid)
{ {
// Load member // Load member

View File

@ -193,6 +193,7 @@ class Adherent extends CommonObject
$infos=''; $infos='';
if ($this->civilite_id) $infos.= $langs->transnoentities("UserTitle").": ".$this->getCivilityLabel(1)."\n"; if ($this->civilite_id) $infos.= $langs->transnoentities("UserTitle").": ".$this->getCivilityLabel(1)."\n";
$infos.= $langs->transnoentities("id").": ".$this->id."\n";
$infos.= $langs->transnoentities("Lastname").": ".$this->lastname."\n"; $infos.= $langs->transnoentities("Lastname").": ".$this->lastname."\n";
$infos.= $langs->transnoentities("Firstname").": ".$this->firstname."\n"; $infos.= $langs->transnoentities("Firstname").": ".$this->firstname."\n";
$infos.= $langs->transnoentities("Company").": ".$this->societe."\n"; $infos.= $langs->transnoentities("Company").": ".$this->societe."\n";
@ -210,6 +211,7 @@ class Adherent extends CommonObject
// Substitutions // Substitutions
$substitutionarray=array( $substitutionarray=array(
'%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT, '%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT,
'%ID%'=>$msgishtml?dol_htmlentitiesbr($this->id):$this->id,
'%INFOS%'=>$msgishtml?dol_htmlentitiesbr($infos):$infos, '%INFOS%'=>$msgishtml?dol_htmlentitiesbr($infos):$infos,
'%CIVILITE%'=>$this->getCivilityLabel($msgishtml?0:1), '%CIVILITE%'=>$this->getCivilityLabel($msgishtml?0:1),
'%PRENOM%'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname, '%PRENOM%'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname,
@ -966,7 +968,7 @@ class Adherent extends CommonObject
*/ */
function fetch($rowid,$ref='',$fk_soc='') function fetch($rowid,$ref='',$fk_soc='')
{ {
global $conf, $langs; global $langs;
$sql = "SELECT d.rowid, d.civilite, d.prenom as firstname, d.nom as lastname, d.societe, d.fk_soc, d.statut, d.public, d.adresse as address, d.cp as zip, d.ville as town, d.note,"; $sql = "SELECT d.rowid, d.civilite, d.prenom as firstname, d.nom as lastname, d.societe, d.fk_soc, d.statut, d.public, d.adresse as address, d.cp as zip, d.ville as town, d.note,";
$sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,"; $sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,";
@ -987,10 +989,12 @@ class Adherent extends CommonObject
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as dep ON d.fk_departement = dep.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as dep ON d.fk_departement = dep.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON d.rowid = u.fk_member"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON d.rowid = u.fk_member";
$sql.= " WHERE d.fk_adherent_type = t.rowid"; $sql.= " WHERE d.fk_adherent_type = t.rowid";
$sql.= " AND d.entity = ".$conf->entity; if ($rowid) $sql.= " AND d.rowid=".$rowid;
elseif ($ref || $fk_soc) {
$sql.= " AND d.entity IN (".getEntity().")";
if ($ref) $sql.= " AND d.rowid='".$ref."'"; if ($ref) $sql.= " AND d.rowid='".$ref."'";
elseif ($fk_soc) $sql.= " AND d.fk_soc='".$fk_soc."'"; elseif ($fk_soc) $sql.= " AND d.fk_soc='".$fk_soc."'";
else $sql.= " AND d.rowid=".$rowid; }
dol_syslog(get_class($this)."::fetch sql=".$sql); dol_syslog(get_class($this)."::fetch sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -31,18 +31,21 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php"); require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php"); require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php");
$langs->load("members");
$langs->load("companies"); $langs->load("companies");
$langs->load('other'); $langs->load('other');
$id=GETPOST('id','int');
$action=GETPOST('action','alpha');
$confirm=GETPOST('confirm','alpha');
$mesg = ""; $mesg = "";
// Security check // Security check
$id = GETPOST('id','int');
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$id = $user->societe_id; $id = $user->societe_id;
} }
//$result = restrictedArea($user, 'societe', $id); $result=restrictedArea($user,'adherent',$id);
// Get parameters // Get parameters
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
@ -65,7 +68,7 @@ $upload_dir = $conf->adherent->dir_output . "/" . get_exdir($id,2,0,1) . '/' . $
*/ */
// Envoie fichier // Envoie fichier
if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{ {
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
@ -96,7 +99,7 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
} }
// Suppression fichier // Suppression fichier
if ($_REQUEST['action'] == 'confirm_deletefile' && $_REQUEST['confirm'] == 'yes') if ($action == 'confirm_deletefile' && $confirm == 'yes')
{ {
$file = $upload_dir . "/" . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $file = $upload_dir . "/" . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file); dol_delete_file($file);
@ -197,21 +200,21 @@ if ($id > 0)
/* /*
* Confirmation suppression fichier * Confirmation suppression fichier
*/ */
if ($_GET['action'] == 'delete') if ($action == 'delete')
{ {
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$member->id.'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
// Affiche formulaire upload // Affiche formulaire upload
$formfile=new FormFile($db); $formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/adherents/document.php?id='.$id,'',0,0,$user->rights->adherent->creer); $formfile->form_attach_new_file(DOL_URL_ROOT.'/adherents/document.php?id='.$member->id,'',0,0,$user->rights->adherent->creer);
// List of document // List of document
$param='&socid='.$societe->id; $param='&socid='.$societe->id;
$formfile->list_of_documents($filearray,$member,'member',$param, 0, get_exdir($id,2,0,1).'/'.$id.'/'); $formfile->list_of_documents($filearray,$member,'member',$param, 0, get_exdir($member->id,2,0,1).'/'.$member->id.'/');
print "<br><br>"; print "<br><br>";
} }
@ -226,9 +229,7 @@ else
print $langs->trans("ErrorRecordNotFound"); print $langs->trans("ErrorRecordNotFound");
} }
$db->close();
llxFooter(); llxFooter();
$db->close();
?> ?>

View File

@ -41,13 +41,6 @@ $langs->load("bills");
$langs->load("members"); $langs->load("members");
$langs->load("users"); $langs->load("users");
// Security check
if (! $user->rights->adherent->lire) accessforbidden();
$object = new Adherent($db);
$extrafields = new ExtraFields($db);
$errmsg=''; $errmsgs=array();
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$confirm=GETPOST('confirm','alpha'); $confirm=GETPOST('confirm','alpha');
@ -56,6 +49,14 @@ $typeid=GETPOST('typeid','int');
$userid=GETPOST('userid','int'); $userid=GETPOST('userid','int');
$socid=GETPOST('socid','int'); $socid=GETPOST('socid','int');
// Security check
$result=restrictedArea($user,'adherent',$rowid);
$object = new Adherent($db);
$extrafields = new ExtraFields($db);
$errmsg=''; $errmsgs=array();
if ($rowid > 0) if ($rowid > 0)
{ {
// Load member // Load member
@ -67,16 +68,12 @@ if ($rowid > 0)
if ($object->user_id) if ($object->user_id)
{ {
// $user est le user qui edite, $object->user_id est l'id de l'utilisateur lies au membre edite // $user est le user qui edite, $object->user_id est l'id de l'utilisateur lies au membre edite
$caneditfielduser=( (($user->id == $object->user_id) && $user->rights->user->self->creer) $caneditfielduser=((($user->id == $object->user_id) && $user->rights->user->self->creer)
|| (($user->id != $object->user_id) && $user->rights->user->user->creer) ); || (($user->id != $object->user_id) && $user->rights->user->user->creer));
$caneditpassworduser=( (($user->id == $object->user_id) && $user->rights->user->self->password) $caneditpassworduser=((($user->id == $object->user_id) && $user->rights->user->self->password)
|| (($user->id != $adh->user_id) && $user->rights->user->user->password) ); || (($user->id != $object->user_id) && $user->rights->user->user->password));
} }
} }
else
{
accessforbidden();
}
// Define variables to know what current user can do on members // Define variables to know what current user can do on members
$canaddmember=$user->rights->adherent->creer; $canaddmember=$user->rights->adherent->creer;

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -150,12 +150,7 @@ llxHeader('',$langs->trans("SubscriptionCard"),'EN:Module_Foundations|FR:Module_
$form = new Form($db); $form = new Form($db);
dol_htmloutput_errors($errmsg);
if ($errmsg)
{
print '<div class="error">'.$errmsg.'</div>';
print "\n";
}
if ($user->rights->adherent->cotisation->creer && $action == 'edit') if ($user->rights->adherent->cotisation->creer && $action == 'edit')
@ -316,9 +311,14 @@ if ($rowid && $action != 'edit')
print '<td>'.$langs->trans("Member").'</td><td class="valeur" colspan="3">'.$adh->getNomUrl(1,0,'subscription').'</td>'; print '<td>'.$langs->trans("Member").'</td><td class="valeur" colspan="3">'.$adh->getNomUrl(1,0,'subscription').'</td>';
print '</tr>'; print '</tr>';
// Date record
/*print '<tr>';
print '<td>'.$langs->trans("DateSubscription").'</td><td class="valeur" colspan="3">'.dol_print_date($subscription->datec,'dayhour').'</td>';
print '</tr>';*/
// Date subscription // Date subscription
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("DateSubscription").'</td><td class="valeur" colspan="3">'.dol_print_date($subscription->dateh,'dayhour').'</td>'; print '<td>'.$langs->trans("DateSubscription").'</td><td class="valeur" colspan="3">'.dol_print_date($subscription->dateh,'day').'</td>';
print '</tr>'; print '</tr>';
// Date end subscription // Date end subscription

View File

@ -1,7 +1,8 @@
<?php <?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -59,7 +60,10 @@ $AdherentType=array();
$sql = "SELECT t.rowid, t.libelle, t.cotisation,"; $sql = "SELECT t.rowid, t.libelle, t.cotisation,";
$sql.= " d.statut, count(d.rowid) as somme"; $sql.= " d.statut, count(d.rowid) as somme";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d ON t.rowid = d.fk_adherent_type"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d";
$sql.= " ON t.rowid = d.fk_adherent_type";
$sql.= " AND d.entity IN (".getEntity().")";
$sql.= " WHERE t.entity IN (".getEntity().")";
$sql.= " GROUP BY t.rowid, t.libelle, t.cotisation, d.statut"; $sql.= " GROUP BY t.rowid, t.libelle, t.cotisation, d.statut";
dol_syslog("index.php::select nb of members by type sql=".$sql, LOG_DEBUG); dol_syslog("index.php::select nb of members by type sql=".$sql, LOG_DEBUG);
@ -87,14 +91,16 @@ if ($result)
$db->free($result); $db->free($result);
} }
$now=dol_now();
// List members up to date // List members up to date
// current rule: uptodate = the end date is in future whatever is type // current rule: uptodate = the end date is in future whatever is type
// old rule: uptodate = if type does not need payment, that end date is null, if type need payment that end date is in future) // old rule: uptodate = if type does not need payment, that end date is null, if type need payment that end date is in future)
$sql = "SELECT count(*) as somme , d.fk_adherent_type"; $sql = "SELECT count(*) as somme , d.fk_adherent_type";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
//$sql.= " WHERE d.statut = 1 AND ((t.cotisation = 0 AND d.datefin IS NULL) OR d.datefin >= ".$db->idate(gmmktime()).')'; $sql.= " WHERE d.entity IN (".getEntity().")";
$sql.= " WHERE d.statut = 1 AND d.datefin >= ".$db->idate(gmmktime()); //$sql.= " AND d.statut = 1 AND ((t.cotisation = 0 AND d.datefin IS NULL) OR d.datefin >= ".$db->idate($now).')';
$sql.= " AND d.statut = 1 AND d.datefin >= ".$db->idate($now);
$sql.= " AND t.rowid = d.fk_adherent_type"; $sql.= " AND t.rowid = d.fk_adherent_type";
$sql.= " GROUP BY d.fk_adherent_type"; $sql.= " GROUP BY d.fk_adherent_type";
@ -128,8 +134,12 @@ print "</tr>\n";
$var=false; $var=false;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td>'; print '<td>';
print $langs->trans("Name").':</td><td><input type="text" name="search" class="flat" size="16">'; print $langs->trans("Ref").':</td><td><input type="text" name="search_ref" class="flat" size="16">';
print '</td><td rowspan="2"><input class="button" type="submit" value="'.$langs->trans("Search").'"></td></tr>'; print '</td><td rowspan="3"><input class="button" type="submit" value="'.$langs->trans("Search").'"></td></tr>';
print "<tr $bc[$var]>";
print '<td>';
print $langs->trans("Name").':</td><td><input type="text" name="search_nom" class="flat" size="16">';
print '</td></tr>';
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td>'; print '<td>';
print $langs->trans("Other").':</td><td><input type="text" name="sall" class="flat" size="16">'; print $langs->trans("Other").':</td><td><input type="text" name="sall" class="flat" size="16">';
@ -207,7 +217,8 @@ $sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname,";
$sql.= " a.tms as datem, datefin as date_end_subscription,"; $sql.= " a.tms as datem, datefin as date_end_subscription,";
$sql.= " ta.rowid as typeid, ta.libelle, ta.cotisation"; $sql.= " ta.rowid as typeid, ta.libelle, ta.cotisation";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta";
$sql.= " WHERE a.fk_adherent_type = ta.rowid"; $sql.= " WHERE a.entity IN (".getEntity().")";
$sql.= " AND a.fk_adherent_type = ta.rowid";
$sql.= $db->order("a.tms","DESC"); $sql.= $db->order("a.tms","DESC");
$sql.= $db->plimit($max, 0); $sql.= $db->plimit($max, 0);
@ -259,7 +270,8 @@ $sql = "SELECT a.rowid, a.statut, a.nom, a.prenom,";
$sql.= " datefin as date_end_subscription,"; $sql.= " datefin as date_end_subscription,";
$sql.= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.cotisation"; $sql.= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.cotisation";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."cotisation as c"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."cotisation as c";
$sql.= " WHERE c.fk_adherent = a.rowid"; $sql.= " WHERE a.entity IN (".getEntity().")";
$sql.= " AND c.fk_adherent = a.rowid";
$sql.= $db->order("c.tms","DESC"); $sql.= $db->order("c.tms","DESC");
$sql.= $db->plimit($max, 0); $sql.= $db->plimit($max, 0);
@ -321,7 +333,7 @@ foreach ($AdherentType as $key => $adhtype)
print '<td><a href="type.php?rowid='.$adhtype->id.'">'.img_object($langs->trans("ShowType"),"group").' '.$adhtype->getNomUrl(0,dol_size(16)).'</a></td>'; print '<td><a href="type.php?rowid='.$adhtype->id.'">'.img_object($langs->trans("ShowType"),"group").' '.$adhtype->getNomUrl(0,dol_size(16)).'</a></td>';
print '<td align="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' '.$staticmember->LibStatut(-1,$adhtype->cotisation,0,3).'</td>'; print '<td align="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' '.$staticmember->LibStatut(-1,$adhtype->cotisation,0,3).'</td>';
print '<td align="right">'.(isset($MembersValidated[$key]) && ($MembersValidated[$key]-$MemberUpToDate[$key] > 0) ? $MembersValidated[$key]-$MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,0,3).'</td>'; print '<td align="right">'.(isset($MembersValidated[$key]) && ($MembersValidated[$key]-$MemberUpToDate[$key] > 0) ? $MembersValidated[$key]-$MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,0,3).'</td>';
print '<td align="right">'.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,gmmktime(),3).'</td>'; print '<td align="right">'.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,$now,3).'</td>';
print '<td align="right">'.(isset($MembersResiliated[$key]) && $MembersResiliated[$key]> 0 ?$MembersResiliated[$key]:'').' '.$staticmember->LibStatut(0,$adhtype->cotisation,0,3).'</td>'; print '<td align="right">'.(isset($MembersResiliated[$key]) && $MembersResiliated[$key]> 0 ?$MembersResiliated[$key]:'').' '.$staticmember->LibStatut(0,$adhtype->cotisation,0,3).'</td>';
print "</tr>\n"; print "</tr>\n";
} }
@ -329,7 +341,7 @@ print '<tr class="liste_total">';
print '<td class="liste_total">'.$langs->trans("Total").'</td>'; print '<td class="liste_total">'.$langs->trans("Total").'</td>';
print '<td class="liste_total" align="right">'.$SommeA.' '.$staticmember->LibStatut(-1,$adhtype->cotisation,0,3).'</td>'; print '<td class="liste_total" align="right">'.$SommeA.' '.$staticmember->LibStatut(-1,$adhtype->cotisation,0,3).'</td>';
print '<td class="liste_total" align="right">'.$SommeB.' '.$staticmember->LibStatut(1,$adhtype->cotisation,0,3).'</td>'; print '<td class="liste_total" align="right">'.$SommeB.' '.$staticmember->LibStatut(1,$adhtype->cotisation,0,3).'</td>';
print '<td class="liste_total" align="right">'.$SommeC.' '.$staticmember->LibStatut(1,$adhtype->cotisation,gmmktime(),3).'</td>'; print '<td class="liste_total" align="right">'.$SommeC.' '.$staticmember->LibStatut(1,$adhtype->cotisation,$now,3).'</td>';
print '<td class="liste_total" align="right">'.$SommeD.' '.$staticmember->LibStatut(0,$adhtype->cotisation,0,3).'</td>'; print '<td class="liste_total" align="right">'.$SommeD.' '.$staticmember->LibStatut(0,$adhtype->cotisation,0,3).'</td>';
print '</tr>'; print '</tr>';
@ -345,7 +357,8 @@ $numb=0;
$sql = "SELECT c.cotisation, c.dateadh"; $sql = "SELECT c.cotisation, c.dateadh";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c";
$sql.= " WHERE d.rowid = c.fk_adherent"; $sql.= " WHERE d.entity IN (".getEntity().")";
$sql.= " AND d.rowid = c.fk_adherent";
if(isset($date_select) && $date_select != '') if(isset($date_select) && $date_select != '')
{ {
$sql .= " AND dateadh LIKE '$date_select%'"; $sql .= " AND dateadh LIKE '$date_select%'";
@ -401,7 +414,6 @@ print '</td></tr>';
print '</table>'; print '</table>';
$db->close();
llxFooter(); llxFooter();
$db->close();
?> ?>

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -32,8 +32,10 @@ $langs->load("bills");
$langs->load("members"); $langs->load("members");
$langs->load("users"); $langs->load("users");
if (!$user->rights->adherent->lire) $id=(GETPOST('id','int') ? GETPOST('id','int') : GETPOST('rowid','int'));
accessforbidden();
// Security check
$result=restrictedArea($user,'adherent',$id);
/* /*
@ -43,9 +45,8 @@ if (!$user->rights->adherent->lire)
llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros'); llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
$adh = new Adherent($db); $adh = new Adherent($db);
$adh->id=$_GET["id"]; $adh->fetch($id);
$adh->fetch($_GET["id"]); $adh->info($id);
$adh->info($_GET["id"]);
$head = member_prepare_head($adh); $head = member_prepare_head($adh);
@ -59,7 +60,6 @@ print '</td></tr></table>';
print '</div>'; print '</div>';
$db->close();
llxFooter(); llxFooter();
$db->close();
?> ?>

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -31,8 +31,6 @@ require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php");
$langs->load("members"); $langs->load("members");
$langs->load("companies"); $langs->load("companies");
$sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"];
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
@ -43,27 +41,32 @@ $pagenext = $page + 1;
if (! $sortorder) { $sortorder="ASC"; } if (! $sortorder) { $sortorder="ASC"; }
if (! $sortfield) { $sortfield="d.nom"; } if (! $sortfield) { $sortfield="d.nom"; }
$filter=$_GET["filter"]; $action=GETPOST("action");
$statut=isset($_GET["statut"])?$_GET["statut"]:''; $filter=GETPOST("filter");
$statut=GETPOST("statut");
$search=GETPOST("search");
$search_ref=GETPOST("search_ref");
$search_nom=GETPOST("search_nom");
$search_prenom=GETPOST("search_prenom");
$search_login=GETPOST("search_login");
$type=GETPOST("type");
$search_email=GETPOST("search_email");
$search_categ=GETPOST("search_categ");
$sall=GETPOST("sall",'int');
if (GETPOST("button_removefilter"))
if ($_REQUEST["button_removefilter"])
{ {
$_GET["search_nom"]=""; $search="";
$_REQUEST["search_nom"]=""; $search_ref="";
$_GET["search_prenom"]=""; $search_nom="";
$_REQUEST["search_prenom"]=""; $search_prenom="";
$_GET["type"]=""; $search_login="";
$_REQUEST["type"]=""; $type="";
$_GET["search_email"]=""; $search_email="";
$_REQUEST["search_email"]=""; $search_categ="";
$_GET["search_categ"]="";
$_REQUEST["search_categ"]="";
$sall=""; $sall="";
} }
// Load categ filters
$search_categ = isset($_GET["search_categ"])?$_GET["search_categ"]:$_POST["search_categ"];
/* /*
@ -90,44 +93,44 @@ if ($search_categ) $sql.= " AND d.rowid = cf.fk_member"; // Join for the needed
$sql.= " AND d.entity = ".$conf->entity; $sql.= " AND d.entity = ".$conf->entity;
if ($sall) if ($sall)
{ {
$sql.=" AND (d.prenom like '%".$sall."%' OR d.nom like '%".$sall."%' OR d.societe like '%".$sall."%'"; $sql.=" AND (";
$sql.=" OR d.email like '%".$sall."%' OR d.login like '%".$sall."%' OR d.adresse like '%".$sall."%'"; if (is_numeric($sall)) $sql.= "d.rowid = ".$sall." OR ";
$sql.=" OR d.ville like '%".$sall."%' OR d.note like '%".$sall."%')"; $sql.=" d.prenom LIKE '%".$sall."%' OR d.nom LIKE '%".$sall."%' OR d.societe LIKE '%".$sall."%'";
$sql.=" OR d.email LIKE '%".$sall."%' OR d.login LIKE '%".$sall."%' OR d.adresse LIKE '%".$sall."%'";
$sql.=" OR d.ville LIKE '%".$sall."%' OR d.note LIKE '%".$sall."%')";
} }
if ($_REQUEST["type"] > 0) if ($type > 0)
{ {
$sql.=" AND t.rowid=".$_REQUEST["type"]; $sql.=" AND t.rowid=".$type;
} }
if (isset($_GET["statut"])) if (isset($_GET["statut"]) || isset($_POST["statut"]))
{ {
$sql.=" AND d.statut in ($statut)"; // Peut valoir un nombre ou liste de nombre separes par virgules $sql.=" AND d.statut in (".$statut.")"; // Peut valoir un nombre ou liste de nombre separes par virgules
} }
if ( $_POST["action"] == 'search') if ($search_ref)
{ {
if (isset($_POST['search']) && $_POST['search'] != '') if (is_numeric($search_ref)) $sql.= " AND (d.rowid = ".$search_ref.")";
{ else $sql.=" AND 1 = 2"; // Always wrong
$sql.= " AND (d.prenom LIKE '%".$_POST['search']."%' OR d.nom LIKE '%".$_POST['search']."%')";
}
} }
if ($_GET["search_nom"]) if ($search_nom)
{ {
$sql.= " AND (d.prenom LIKE '%".$_GET["search_nom"]."%' OR d.nom LIKE '%".$_GET["search_nom"]."%')"; $sql.= " AND (d.prenom LIKE '%".$search_nom."%' OR d.nom LIKE '%".$search_nom."%')";
} }
if ($_GET["search_login"]) if ($search_login)
{ {
$sql.= " AND d.login LIKE '%".$_GET["search_login"]."%'"; $sql.= " AND d.login LIKE '%".$search_login."%'";
} }
if ($_GET["search_email"]) if ($search_email)
{ {
$sql.= " AND (d.email LIKE '%".$_GET["search_email"]."%')"; $sql.= " AND (d.email LIKE '%".$search_email."%')";
} }
if ($filter == 'uptodate') if ($filter == 'uptodate')
{ {
$sql.=" AND datefin >= ".$db->idate($now); $sql.=" AND datefin >= '".$db->idate($now)."'";
} }
if ($filter == 'outofdate') if ($filter == 'outofdate')
{ {
$sql.=" AND datefin < ".$db->idate($now); $sql.=" AND datefin < '".$db->idate($now)."'";
} }
// Insert categ filter // Insert categ filter
if ($search_categ) if ($search_categ)
@ -147,6 +150,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($conf->liste_limit+1, $offset); $sql.= $db->plimit($conf->liste_limit+1, $offset);
dol_syslog("get list sql=".$sql);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
@ -163,12 +167,12 @@ if ($resql)
if ($statut == '1' && $filter=='outofdate') { $titre=$langs->trans("MembersListNotUpToDate"); } if ($statut == '1' && $filter=='outofdate') { $titre=$langs->trans("MembersListNotUpToDate"); }
if ($statut == '0') { $titre=$langs->trans("MembersListResiliated"); } if ($statut == '0') { $titre=$langs->trans("MembersListResiliated"); }
} }
elseif ($_POST["action"] == 'search') elseif ($action == 'search')
{ {
$titre=$langs->trans("MembersListQualified"); $titre=$langs->trans("MembersListQualified");
} }
if ($_REQUEST["type"] > 0) if ($type > 0)
{ {
$membertype=new AdherentType($db); $membertype=new AdherentType($db);
$result=$membertype->fetch($_REQUEST["type"]); $result=$membertype->fetch($_REQUEST["type"]);
@ -176,16 +180,16 @@ if ($resql)
} }
$param=""; $param="";
if (isset($_GET["statut"])) $param.="&statut=".$_GET["statut"]; if (isset($_GET["statut"])) $param.="&statut=".$statut;
if (isset($_GET["search_nom"])) $param.="&search_nom=".$_GET["search_nom"]; if ($search_nom) $param.="&search_nom=".$search_nom;
if (isset($_GET["search_login"])) $param.="&search_login=".$_GET["search_login"]; if ($search_login) $param.="&search_login=".$search_login;
if (isset($_GET["search_email"])) $param.="&search_email=".$_GET["search_email"]; if ($search_email) $param.="&search_email=".$search_email;
if (isset($_GET["filter"])) $param.="&filter=".$_GET["filter"]; if ($filter) $param.="&filter=".$filter;
print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
if ($sall) if ($sall)
{ {
print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall; print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
} }
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
@ -202,40 +206,44 @@ if ($resql)
if ($moreforfilter) if ($moreforfilter)
{ {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre" colspan="8">'; print '<td class="liste_titre" colspan="9">';
print $moreforfilter; print $moreforfilter;
print '</td></tr>'; print '</td></tr>';
} }
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),"liste.php","d.nom",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Login"),"liste.php","d.login",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.nom",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),"liste.php","t.libelle",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Person"),"liste.php","d.morphy",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"t.libelle",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EMail"),"liste.php","d.email",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),"liste.php","d.statut,d.datefin",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EndSubscription"),"liste.php","d.datefin",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Action"),"liste.php","",$param,"",'width="60" align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("EndSubscription"),$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
print "</tr>\n"; print "</tr>\n";
// Lignes des champs de filtre // Lignes des champs de filtre
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_nom" value="'.$_REQUEST["search_nom"].'" size="12"></td>'; print '<input class="flat" type="text" name="search_ref" value="'.$search_ref.'" size="4"></td>';
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_login" value="'.$_REQUEST["search_login"].'" size="7"></td>'; print '<input class="flat" type="text" name="search_nom" value="'.$search_nom.'" size="12"></td>';
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_login" value="'.$search_login.'" size="7"></td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
$listetype=$membertypestatic->liste_array(); $listetype=$membertypestatic->liste_array();
print $form->selectarray("type", $listetype, $_REQUEST["type"], 1, 0, 0, '', 0, 12); print $form->selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 12);
print '</td>'; print '</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_email" value="'.$_REQUEST["search_email"].'" size="12"></td>'; print '<input class="flat" type="text" name="search_email" value="'.$search_email.'" size="12"></td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
@ -254,19 +262,27 @@ if ($resql)
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$datefin=$db->jdate($objp->datefin); $datefin=$db->jdate($objp->datefin);
$memberstatic->id=$objp->rowid;
// Nom $memberstatic->ref=$objp->rowid;
$var=!$var;
print "<tr ".$bc[$var].">";
$memberstatic->lastname=$objp->lastname; $memberstatic->lastname=$objp->lastname;
$memberstatic->firstname=$objp->firstname; $memberstatic->firstname=$objp->firstname;
$var=!$var;
print "<tr ".$bc[$var].">";
// Ref
print "<td>";
print $memberstatic->getNomUrl(1);
print "</td>\n";
// Lastname
if ($objp->societe != '') if ($objp->societe != '')
{ {
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".img_object($langs->trans("ShowMember"),"user").' '.dol_trunc($memberstatic->getFullName($langs))." / ".dol_trunc($objp->societe,12)."</a></td>\n"; print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".dol_trunc($memberstatic->getFullName($langs))." / ".dol_trunc($objp->societe,12)."</a></td>\n";
} }
else else
{ {
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".img_object($langs->trans("ShowMember"),"user").' '.dol_trunc($memberstatic->getFullName($langs))."</a></td>\n"; print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".dol_trunc($memberstatic->getFullName($langs))."</a></td>\n";
} }
// Login // Login
@ -343,7 +359,7 @@ else
} }
$db->close();
llxFooter(); llxFooter();
$db->close();
?> ?>

View File

@ -27,14 +27,15 @@ require_once(DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'); require_once(DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php');
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php"); require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php");
$action=GETPOST('action');
$id=GETPOST('id','int');
$langs->load("companies"); $langs->load("companies");
$langs->load("members"); $langs->load("members");
$langs->load("bills"); $langs->load("bills");
if (!$user->rights->adherent->lire) accessforbidden(); $action=GETPOST('action','alpha');
$id=GETPOST('id','int');
// Security check
$result=restrictedArea($user,'adherent',$id);
$object = new Adherent($db); $object = new Adherent($db);
$result=$object->fetch($id); $result=$object->fetch($id);
@ -49,7 +50,7 @@ if ($result > 0)
* Actions * Actions
*/ */
if ($_POST["action"] == 'update' && $user->rights->adherent->creer && ! $_POST["cancel"]) if ($action == 'update' && $user->rights->adherent->creer && ! $_POST["cancel"])
{ {
$db->begin(); $db->begin();
@ -174,7 +175,7 @@ if ($id)
} }
$db->close();
llxFooter(); llxFooter();
$db->close();
?> ?>

View File

@ -73,7 +73,8 @@ if ($mode)
$data = array(); $data = array();
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, c.code, c.libelle as label"; $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, c.code, c.libelle as label";
$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_pays as c on d.pays = c.rowid"; $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_pays as c on d.pays = c.rowid";
$sql.=" WHERE d.statut = 1"; $sql.=" WHERE d.entity IN (".getEntity().")";
$sql.=" AND d.statut = 1";
$sql.=" GROUP BY c.libelle, c.code"; $sql.=" GROUP BY c.libelle, c.code";
//print $sql; //print $sql;
} }
@ -88,7 +89,8 @@ if ($mode)
$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.fk_departement = c.rowid"; $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.fk_departement = c.rowid";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region"; $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p on d.pays = p.rowid"; $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p on d.pays = p.rowid";
$sql.=" WHERE d.statut = 1"; $sql.=" WHERE d.entity IN (".getEntity().")";
$sql.=" AND d.statut = 1";
$sql.=" GROUP BY p.libelle, p.code, c.nom"; $sql.=" GROUP BY p.libelle, p.code, c.nom";
//print $sql; //print $sql;
} }
@ -102,7 +104,8 @@ if ($mode)
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, p.code, p.libelle as label, d.ville as label2"; $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, p.code, p.libelle as label, d.ville as label2";
$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d"; $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p on d.pays = p.rowid"; $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p on d.pays = p.rowid";
$sql.=" WHERE d.statut = 1"; $sql.=" WHERE d.entity IN (".getEntity().")";
$sql.=" AND d.statut = 1";
$sql.=" GROUP BY p.libelle, p.code, d.ville"; $sql.=" GROUP BY p.libelle, p.code, d.ville";
//print $sql; //print $sql;
} }
@ -194,7 +197,11 @@ else
// Show graphics // Show graphics
if ($mode == 'memberbycountry') if ($mode == 'memberbycountry')
{ {
$color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/graph-color.php';
if (is_readable($color_file)) include_once($color_file);
// Assume we've already included the proper headers so just call our script inline // Assume we've already included the proper headers so just call our script inline
// More doc: https://developers.google.com/chart/interactive/docs/gallery/geomap?hl=fr-FR
print "\n<script type='text/javascript'>\n"; print "\n<script type='text/javascript'>\n";
print "google.load('visualization', '1', {'packages': ['geomap']});\n"; print "google.load('visualization', '1', {'packages': ['geomap']});\n";
print "google.setOnLoadCallback(drawMap);\n"; print "google.setOnLoadCallback(drawMap);\n";
@ -209,10 +216,9 @@ if ($mode == 'memberbycountry')
$i=0; $i=0;
foreach($data as $val) foreach($data as $val)
{ {
//$valcountry=ucfirst($val['code']); $valcountry=strtoupper($val['code']); // Should be ISO-3166 code (faster)
$valcountry=ucfirst($val['label_en']); //$valcountry=ucfirst($val['label_en']);
// fix case of uk if ($valcountry == 'Great Britain') { $valcountry = 'United Kingdom'; } // fix case of uk (when we use labels)
if ($valcountry == 'Great Britain') { $valcountry = 'United Kingdom'; }
print "\tdata.setValue(".$i.", 0, \"".$valcountry."\");\n"; print "\tdata.setValue(".$i.", 0, \"".$valcountry."\");\n";
print "\tdata.setValue(".$i.", 1, ".$val['nb'].");\n"; print "\tdata.setValue(".$i.", 1, ".$val['nb'].");\n";
// Google's Geomap only supports up to 400 entries // Google's Geomap only supports up to 400 entries
@ -226,6 +232,7 @@ if ($mode == 'memberbycountry')
//print "\toptions['zoomOutLabel'] = '".dol_escape_js($langs->transnoentitiesnoconv("Numbers"))."';\n"; //print "\toptions['zoomOutLabel'] = '".dol_escape_js($langs->transnoentitiesnoconv("Numbers"))."';\n";
print "\toptions['width'] = ".$graphwidth.";\n"; print "\toptions['width'] = ".$graphwidth.";\n";
print "\toptions['height'] = ".$graphheight.";\n"; print "\toptions['height'] = ".$graphheight.";\n";
print "\toptions['colors'] = [0x".colorArrayToHex($theme_datacolor[1],'BBBBBB').", 0x".colorArrayToHex($theme_datacolor[0],'444444')."];\n";
print "\tvar container = document.getElementById('".$mode."');\n"; print "\tvar container = document.getElementById('".$mode."');\n";
print "\tvar geomap = new google.visualization.GeoMap(container);\n"; print "\tvar geomap = new google.visualization.GeoMap(container);\n";
print "\tgeomap.draw(data, options);\n"; print "\tgeomap.draw(data, options);\n";

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -50,7 +50,7 @@ if (! $sortorder) { $sortorder="DESC"; }
if (! $sortfield) { $sortfield="d.nom"; } if (! $sortfield) { $sortfield="d.nom"; }
// Security check // Security check
if (! $user->rights->adherent->lire) accessforbidden(); $result=restrictedArea($user,'adherent',$rowid,'adherent_type');
if (GETPOST('button_removefilter')) if (GETPOST('button_removefilter'))
{ {
@ -153,7 +153,8 @@ if (! $rowid && $action != 'create' && $action != 'edit')
$sql = "SELECT d.rowid, d.libelle, d.cotisation, d.vote"; $sql = "SELECT d.rowid, d.libelle, d.cotisation, d.vote";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
$sql.= " WHERE d.entity IN (".getEntity().")";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
@ -267,10 +268,8 @@ if ($rowid > 0)
if ($action != 'edit') if ($action != 'edit')
{ {
$adht = new AdherentType($db); $adht = new AdherentType($db);
$adht->id = $rowid;
$adht->fetch($rowid); $adht->fetch($rowid);
$h=0; $h=0;
$head[$h][0] = $_SERVER["PHP_SELF"].'?rowid='.$adht->id; $head[$h][0] = $_SERVER["PHP_SELF"].'?rowid='.$adht->id;
@ -344,7 +343,7 @@ if ($rowid > 0)
$sql.= " t.libelle as type, t.cotisation"; $sql.= " t.libelle as type, t.cotisation";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " WHERE d.fk_adherent_type = t.rowid "; $sql.= " WHERE d.fk_adherent_type = t.rowid ";
$sql.= " AND d.entity = ".$conf->entity; $sql.= " AND d.entity IN (".getEntity().")";
$sql.= " AND t.rowid = ".$adht->id; $sql.= " AND t.rowid = ".$adht->id;
if ($sall) if ($sall)
{ {

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -33,7 +33,8 @@ if (!$user->admin)
$langs->load("admin"); $langs->load("admin");
$langs->load("other"); $langs->load("other");
$action=$_POST["action"]; $action = GETPOST('action','alpha');
$cancel = GETPOST('cancel','alpha');
// Get list of triggers available // Get list of triggers available
$sql = "SELECT a.rowid, a.code, a.label, a.elementtype"; $sql = "SELECT a.rowid, a.code, a.label, a.elementtype";
@ -66,7 +67,7 @@ else
/* /*
* Actions * Actions
*/ */
if ($action == "save" && empty($_POST["cancel"])) if ($action == "save" && empty($cancel))
{ {
$i=0; $i=0;
@ -76,7 +77,7 @@ if ($action == "save" && empty($_POST["cancel"]))
{ {
$param='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code']; $param='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
//print "param=".$param." - ".$_POST[$param]; //print "param=".$param." - ".$_POST[$param];
if (! empty($_POST[$param])) $res = dolibarr_set_const($db,$param,$_POST[$param],'chaine',0,'',$conf->entity); if (GETPOST($param,'alpha')) $res = dolibarr_set_const($db,$param,GETPOST($param,'alpha'),'chaine',0,'',$conf->entity);
else $res = dolibarr_del_const($db,$param,$conf->entity); else $res = dolibarr_del_const($db,$param,$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
} }
@ -141,7 +142,7 @@ if (! empty($triggers))
print '<td align="right" width="40">'; print '<td align="right" width="40">';
$key='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code']; $key='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
$value=$conf->global->$key; $value=$conf->global->$key;
print '<input '.$bc[$var].' type="checkbox" name="'.$key.'" value="1"'.((($_GET["action"]=='selectall'||$value) && $_GET["action"]!="selectnone")?' checked="checked"':'').'>'; print '<input '.$bc[$var].' type="checkbox" name="'.$key.'" value="1"'.((($action=='selectall'||$value) && $action!="selectnone")?' checked="checked"':'').'>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -37,8 +37,8 @@ $langs->load("admin");
$langs->load("other"); $langs->load("other");
$def = array(); $def = array();
$actiontest=GETPOST("test"); $actiontest=GETPOST('test','alpha');
$actionsave=GETPOST("save"); $actionsave=GETPOST('save','alpha');
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5; if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
$MAXAGENDA=empty($conf->global->AGENDA_EXT_NB)?5:$conf->global->AGENDA_EXT_NB; $MAXAGENDA=empty($conf->global->AGENDA_EXT_NB)?5:$conf->global->AGENDA_EXT_NB;
@ -53,7 +53,7 @@ if ($actionsave)
{ {
$db->begin(); $db->begin();
$disableext=GETPOST("AGENDA_DISABLE_EXT"); $disableext=GETPOST('AGENDA_DISABLE_EXT','alpha');
if ($disableext) $disableext=0; else $disableext=1; if ($disableext) $disableext=0; else $disableext=1;
$res=dolibarr_set_const($db,'AGENDA_DISABLE_EXT',$disableext,'chaine',0); $res=dolibarr_set_const($db,'AGENDA_DISABLE_EXT',$disableext,'chaine',0);
@ -63,20 +63,20 @@ if ($actionsave)
// Save agendas // Save agendas
while ($i <= $MAXAGENDA) while ($i <= $MAXAGENDA)
{ {
$color=trim(GETPOST("agenda_ext_color".$i)); $color=trim(GETPOST('agenda_ext_color'.$i,'alpha'));
if ($color=='-1') $color=''; if ($color=='-1') $color='';
//print 'color='.$color; //print 'color='.$color;
$res=dolibarr_set_const($db,'AGENDA_EXT_NAME'.$i,trim(GETPOST("agenda_ext_name".$i)),'chaine',0); $res=dolibarr_set_const($db,'AGENDA_EXT_NAME'.$i,trim(GETPOST('agenda_ext_name'.$i),'alpha'),'chaine',0);
if (! $res > 0) $error++; if (! $res > 0) $error++;
$res=dolibarr_set_const($db,'AGENDA_EXT_SRC'.$i,trim(GETPOST("agenda_ext_src".$i)),'chaine',0); $res=dolibarr_set_const($db,'AGENDA_EXT_SRC'.$i,trim(GETPOST('agenda_ext_src'.$i,'alpha')),'chaine',0);
if (! $res > 0) $error++; if (! $res > 0) $error++;
$res=dolibarr_set_const($db,'AGENDA_EXT_COLOR'.$i,$color,'chaine',0); $res=dolibarr_set_const($db,'AGENDA_EXT_COLOR'.$i,$color,'chaine',0);
if (! $res > 0) $error++; if (! $res > 0) $error++;
$i++; $i++;
} }
// Save nb of agenda // Save nb of agenda
$res=dolibarr_set_const($db,'AGENDA_EXT_NB',trim(GETPOST("AGENDA_EXT_NB")),'chaine',0); $res=dolibarr_set_const($db,'AGENDA_EXT_NB',trim(GETPOST('AGENDA_EXT_NB','alpha')),'chaine',0);
if (! $res > 0) $error++; if (! $res > 0) $error++;
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5; if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
$MAXAGENDA=empty($conf->global->AGENDA_EXT_NB)?5:$conf->global->AGENDA_EXT_NB; $MAXAGENDA=empty($conf->global->AGENDA_EXT_NB)?5:$conf->global->AGENDA_EXT_NB;
@ -119,7 +119,7 @@ dol_fiche_head($head, 'extsites', $langs->trans("Agenda"));
print '<form name="extsitesconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form name="extsitesconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">';
$selectedvalue=(GETPOST("AGENDA_DISABLE_AGENDA"))?GETPOST("AGENDA_DISABLE_EXT"):$conf->global->AGENDA_DISABLE_EXT; $selectedvalue=(GETPOST('AGENDA_DISABLE_AGENDA','alpha'))?GETPOST('AGENDA_DISABLE_EXT','alpha'):$conf->global->AGENDA_DISABLE_EXT;
if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1; if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1;
print $langs->trans("ExtSitesEnableThisTool").' '.$form->selectyesno("AGENDA_DISABLE_EXT",$selectedvalue,1).'<br><br>'; print $langs->trans("ExtSitesEnableThisTool").' '.$form->selectyesno("AGENDA_DISABLE_EXT",$selectedvalue,1).'<br><br>';

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -34,7 +35,7 @@ $langs->load("other");
$langs->load("agenda"); $langs->load("agenda");
$def = array(); $def = array();
$actionsave=$_POST["save"]; $actionsave=GETPOST('save','alpha');
// Sauvegardes parametres // Sauvegardes parametres
if ($actionsave) if ($actionsave)
@ -43,9 +44,9 @@ if ($actionsave)
$db->begin(); $db->begin();
$i+=dolibarr_set_const($db,'MAIN_AGENDA_XCAL_EXPORTKEY',trim($_POST["MAIN_AGENDA_XCAL_EXPORTKEY"]),'chaine',0,'',$conf->entity); $i+=dolibarr_set_const($db,'MAIN_AGENDA_XCAL_EXPORTKEY',trim(GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY','alpha')),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'MAIN_AGENDA_EXPORT_PAST_DELAY',trim($_POST["MAIN_AGENDA_EXPORT_PAST_DELAY"]),'chaine',0,'',$conf->entity); $i+=dolibarr_set_const($db,'MAIN_AGENDA_EXPORT_PAST_DELAY',trim(GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY','alpha')),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'MAIN_AGENDA_EXPORT_CACHE',trim($_POST["MAIN_AGENDA_EXPORT_CACHE"]),'chaine',0,'',$conf->entity); $i+=dolibarr_set_const($db,'MAIN_AGENDA_EXPORT_CACHE',trim(GETPOST('MAIN_AGENDA_EXPORT_CACHE','alpha')),'chaine',0,'',$conf->entity);
if ($i >= 3) if ($i >= 3)
{ {
@ -94,19 +95,19 @@ print "</tr>";
print "<tr class=\"impair\">"; print "<tr class=\"impair\">";
print '<td class="fieldrequired">'.$langs->trans("PasswordTogetVCalExport")."</td>"; print '<td class="fieldrequired">'.$langs->trans("PasswordTogetVCalExport")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_XCAL_EXPORTKEY\" value=\"". ($_POST["MAIN_AGENDA_XCAL_EXPORTKEY"]?$_POST["MAIN_AGENDA_XCAL_EXPORTKEY"]:$conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) . "\" size=\"40\"></td>"; print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_XCAL_EXPORTKEY\" value=\"". (GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY','alpha')?GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY','alpha'):$conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) . "\" size=\"40\"></td>";
print "<td>&nbsp;</td>"; print "<td>&nbsp;</td>";
print "</tr>"; print "</tr>";
print "<tr class=\"pair\">"; print "<tr class=\"pair\">";
print "<td>".$langs->trans("PastDelayVCalExport")."</td>"; print "<td>".$langs->trans("PastDelayVCalExport")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_EXPORT_PAST_DELAY\" value=\"". ($_POST["MAIN_AGENDA_EXPORT_PAST_DELAY"]?$_POST["MAIN_AGENDA_EXPORT_PAST_DELAY"]:$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY) . "\" size=\"10\"> ".$langs->trans("days")."</td>"; print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_EXPORT_PAST_DELAY\" value=\"". (GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY','alpha')?GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY','alpha'):$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY) . "\" size=\"10\"> ".$langs->trans("days")."</td>";
print "<td>&nbsp;</td>"; print "<td>&nbsp;</td>";
print "</tr>"; print "</tr>";
print "<tr class=\"impair\">"; print "<tr class=\"impair\">";
print "<td>".$langs->trans("UseACacheDelay")."</td>"; print "<td>".$langs->trans("UseACacheDelay")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_EXPORT_CACHE\" value=\"". ($_POST["MAIN_AGENDA_EXPORT_CACHE"]?$_POST["MAIN_AGENDA_EXPORT_CACHE"]:$conf->global->MAIN_AGENDA_EXPORT_CACHE) . "\" size=\"10\"></td>"; print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_EXPORT_CACHE\" value=\"". (GETPOST('MAIN_AGENDA_EXPORT_CACHE','alpha')?GETPOST('MAIN_AGENDA_EXPORT_CACHE','alpha'):$conf->global->MAIN_AGENDA_EXPORT_CACHE) . "\" size=\"10\"></td>";
print "<td>&nbsp;</td>"; print "<td>&nbsp;</td>";
print "</tr>"; print "</tr>";

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -31,7 +32,7 @@ $langs->load("admin");
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
$action = GETPOST("action"); $action = GETPOST('action','alpha');
/* /*
@ -40,8 +41,8 @@ $action = GETPOST("action");
if ($action == 'setcoder') if ($action == 'setcoder')
{ {
$coder = GETPOST("coder"); $coder = GETPOST('coder','alpha');
$code_id = GETPOST("code_id"); $code_id = GETPOST('code_id','alpha');
$sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type"; $sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type";
$sqlp.= " SET coder = '" . $coder."'"; $sqlp.= " SET coder = '" . $coder."'";
$sqlp.= " WHERE rowid = ". $code_id; $sqlp.= " WHERE rowid = ". $code_id;
@ -52,17 +53,17 @@ if ($action == 'setcoder')
} }
else if ($action == 'setgenbarcodelocation') else if ($action == 'setgenbarcodelocation')
{ {
$location = GETPOST("genbarcodelocation"); $location = GETPOST('genbarcodelocation','alpha');
$res = dolibarr_set_const($db, "GENBARCODE_LOCATION",$location,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "GENBARCODE_LOCATION",$location,'chaine',0,'',$conf->entity);
} }
else if ($action == 'setdefaultbarcodetype') else if ($action == 'setdefaultbarcodetype')
{ {
$coder_id = GETPOST("coder_id"); $coder_id = GETPOST('coder_id','alpha');
$res = dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $coder_id,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $coder_id,'chaine',0,'',$conf->entity);
} }
else if ($action == 'GENBARCODE_BARCODETYPE_THIRDPARTY') else if ($action == 'GENBARCODE_BARCODETYPE_THIRDPARTY')
{ {
$coder_id = GETPOST("coder_id"); $coder_id = GETPOST('coder_id','alpha');
$res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id,'chaine',0,'',$conf->entity);
} }
/* /*

View File

@ -169,14 +169,25 @@ if ($action == 'switch')
$objto=new ModeleBoxes($db); $objto=new ModeleBoxes($db);
$objto->fetch($_GET["switchto"]); $objto->fetch($_GET["switchto"]);
$resultupdatefrom=0;
$resultupdateto=0;
if (is_object($objfrom) && is_object($objto)) if (is_object($objfrom) && is_object($objto))
{ {
$sql="UPDATE ".MAIN_DB_PREFIX."boxes set box_order='".$objto->box_order."' WHERE rowid=".$objfrom->rowid; $newfirst=$objto->box_order;
//print "xx".$sql; $newsecond=$objfrom->box_order;
if ($newfirst == $newsecond)
{
$newsecondchar=preg_replace('/[0-9]+/','',$newsecond);
$newsecondnum=preg_replace('/[a-zA-Z]+/','',$newsecond);
$newsecond=sprintf("%s%02d",$newsecondchar?$newsecondchar:'A',$newsecondnum+1);
}
$sql="UPDATE ".MAIN_DB_PREFIX."boxes set box_order='".$newfirst."' WHERE rowid=".$objfrom->rowid;
dol_syslog($sql);
$resultupdatefrom = $db->query($sql); $resultupdatefrom = $db->query($sql);
if (! $resultupdatefrom) { dol_print_error($db); } if (! $resultupdatefrom) { dol_print_error($db); }
$sql="UPDATE ".MAIN_DB_PREFIX."boxes set box_order='".$objfrom->box_order."' WHERE rowid=".$objto->rowid;
//print "xx".$sql; $sql="UPDATE ".MAIN_DB_PREFIX."boxes set box_order='".$newsecond."' WHERE rowid=".$objto->rowid;
dol_syslog($sql);
$resultupdateto = $db->query($sql); $resultupdateto = $db->query($sql);
if (! $resultupdateto) { dol_print_error($db); } if (! $resultupdateto) { dol_print_error($db); }
} }

View File

@ -35,6 +35,7 @@ require_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php');
$langs->load("admin"); $langs->load("admin");
$langs->load("errors"); $langs->load("errors");
$langs->load("orders");
if (! $user->admin) accessforbidden(); if (! $user->admin) accessforbidden();
@ -47,8 +48,8 @@ $value = GETPOST('value','alpha');
if ($action == 'updateMask') if ($action == 'updateMask')
{ {
$maskconstorder=GETPOST("maskconstorder"); $maskconstorder=GETPOST('maskconstorder','alpha');
$maskorder=GETPOST("maskorder"); $maskorder=GETPOST('maskorder','alpha');
if ($maskconstorder) $res = dolibarr_set_const($db,$maskconstorder,$maskorder,'chaine',0,'',$conf->entity); if ($maskconstorder) $res = dolibarr_set_const($db,$maskconstorder,$maskorder,'chaine',0,'',$conf->entity);
@ -66,7 +67,7 @@ if ($action == 'updateMask')
if ($action == 'specimen') if ($action == 'specimen')
{ {
$modele=GETPOST("module"); $modele=GETPOST('module','alpha');
$commande = new Commande($db); $commande = new Commande($db);
$commande->initAsSpecimen(); $commande->initAsSpecimen();
@ -111,8 +112,8 @@ if ($action == 'specimen')
if ($action == 'set') if ($action == 'set')
{ {
$label = GETPOST("label"); $label = GETPOST('label','alpha');
$scandir = GETPOST("scandir"); $scandir = GETPOST('scandir','alpha');
$type='order'; $type='order';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
@ -142,8 +143,8 @@ if ($action == 'del')
if ($action == 'setdoc') if ($action == 'setdoc')
{ {
$label = GETPOST("label"); $label = GETPOST('label','alpha');
$scandir = GETPOST("scandir"); $scandir = GETPOST('scandir','alpha');
$db->begin(); $db->begin();
@ -312,7 +313,7 @@ foreach ($dirmodels as $reldir)
// Info // Info
$htmltooltip=''; $htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$facture->type=0; $commande->type=0;
$nextval=$module->getNextValue($mysoc,$commande); $nextval=$module->getNextValue($mysoc,$commande);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
{ {

View File

@ -34,6 +34,8 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formcompany.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formcompany.class.php");
$action=GETPOST('action');
$langs->load("admin"); $langs->load("admin");
$langs->load("companies"); $langs->load("companies");
@ -44,8 +46,8 @@ if (!$user->admin) accessforbidden();
* Actions * Actions
*/ */
if ( (isset($_POST["action"]) && $_POST["action"] == 'update' && empty($_POST["cancel"])) if ( ($action == 'update' && empty($_POST["cancel"]))
|| (isset($_POST["action"]) && $_POST["action"] == 'updateedit') ) || ($action == 'updateedit') )
{ {
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
@ -136,6 +138,7 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update' && empty($_POST["c
dolibarr_set_const($db, "MAIN_INFO_APE",$_POST["ape"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_APE",$_POST["ape"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_RCS",$_POST["rcs"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_RCS",$_POST["rcs"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_TRAINER",$_POST["trainer"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_TRAINER",$_POST["trainer"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_PROFID6",$_POST["MAIN_INFO_PROFID6"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",$_POST["tva"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",$_POST["tva"],'chaine',0,'',$conf->entity);
@ -147,16 +150,16 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update' && empty($_POST["c
dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION",$_POST["optionlocaltax1"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION",$_POST["optionlocaltax1"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION",$_POST["optionlocaltax2"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION",$_POST["optionlocaltax2"],'chaine',0,'',$conf->entity);
if ($_POST['action'] != 'updateedit' && ! $message) if ($action != 'updateedit' && ! $message)
{ {
Header("Location: ".$_SERVER["PHP_SELF"]); Header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} }
} }
if ($_GET["action"] == 'addthumb') if ($action == 'addthumb')
{ {
if (file_exists($conf->societe->dir_output.'/logos/'.$_GET["file"])) if (file_exists($conf->mycompany->dir_output.'/logos/'.$_GET["file"]))
{ {
$isimage=image_format_supported($_GET["file"]); $isimage=image_format_supported($_GET["file"]);
@ -199,7 +202,7 @@ if ($_GET["action"] == 'addthumb')
} }
} }
if ($_GET["action"] == 'removelogo') if ($action == 'removelogo')
{ {
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
@ -263,8 +266,7 @@ print_fiche_titre($langs->trans("CompanyFoundation"),'','setup');
print $langs->trans("CompanyFundationDesc")."<br>\n"; print $langs->trans("CompanyFundationDesc")."<br>\n";
print "<br>\n"; print "<br>\n";
if ((isset($_GET["action"]) && $_GET["action"] == 'edit') if ($action == 'edit' || $action == 'updateedit')
|| (isset($_POST["action"]) && $_POST["action"] == 'updateedit') )
{ {
/** /**
* Edition des parametres * Edition des parametres
@ -488,6 +490,22 @@ if ((isset($_GET["action"]) && $_GET["action"] == 'edit')
print '</td></tr>'; print '</td></tr>';
} }
// ProfId6
if ($langs->transcountry("ProfId6",$country_code) != '-')
{
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->transcountry("ProfId6",$country_code).'</td><td>';
if ($country_code)
{
print '<input name="MAIN_INFO_PROFID6" size="20" value="' . $conf->global->MAIN_INFO_PROFID6 . '">';
}
else
{
print $countrynotdefined;
}
print '</td></tr>';
}
// TVA Intra // TVA Intra
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("VATIntra").'</td><td>'; print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("VATIntra").'</td><td>';
@ -805,6 +823,18 @@ else
print '</td></tr>'; print '</td></tr>';
} }
// ProfId6
if ($langs->transcountry("ProfId6",$country_code) != '-')
{
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->transcountry("ProfId6",$country_code).'</td><td>';
if ($langs->transcountry("ProfId6",$country_code) != '-')
{
print $conf->global->MAIN_INFO_PROFID6;
}
print '</td></tr>';
}
// TVA // TVA
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("VATIntra").'</td>'; print '<tr '.$bc[$var].'><td>'.$langs->trans("VATIntra").'</td>';
@ -969,6 +999,7 @@ else
} }
$db->close();
llxFooter(); llxFooter();
$db->close();
?> ?>

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -33,13 +33,13 @@ $langs->load('compta');
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
$action = GETPOST("action"); $action = GETPOST('action','alpha');
$compta_mode = defined('COMPTA_MODE')?COMPTA_MODE:'RECETTES-DEPENSES'; $compta_mode = defined('COMPTA_MODE')?COMPTA_MODE:'RECETTES-DEPENSES';
if ($action == 'setcomptamode') if ($action == 'setcomptamode')
{ {
$compta_mode = GETPOST("compta_mode"); $compta_mode = GETPOST('compta_mode','alpha');
$res = dolibarr_set_const($db, 'COMPTA_MODE', $compta_mode,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, 'COMPTA_MODE', $compta_mode,'chaine',0,'',$conf->entity);
@ -58,10 +58,10 @@ if ($action == 'setcomptamode')
if ($action == 'update' || $action == 'add') if ($action == 'update' || $action == 'add')
{ {
$constname = GETPOST("constname"); $constname = GETPOST('constname','alpha');
$constvalue = GETPOST("constvalue"); $constvalue = GETPOST('constvalue','alpha');
$consttype = GETPOST("consttype"); $consttype = GETPOST('consttype','alpha');
$constnote = GETPOST("constnote"); $constnote = GETPOST('constnote','alpha');
$res = dolibarr_set_const($db, $constname, $constvalue, $consttype, 0, $constnote, $conf->entity); $res = dolibarr_set_const($db, $constname, $constvalue, $consttype, 0, $constnote, $conf->entity);

View File

@ -34,7 +34,7 @@ $langs->load("deliveries");
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
$action=GETPOST("action"); $action=GETPOST('action','alpha');
// Shipment note // Shipment note
if ($action == 'activate_sending') if ($action == 'activate_sending')

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> /* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -30,8 +30,8 @@ $langs->load("errors");
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
$action = GETPOST("action"); $action = GETPOST('action','alpha');
$value = GETPOST("value"); $value = GETPOST('value','alpha');
if (empty($conf->global->CONTRACT_ADDON)) if (empty($conf->global->CONTRACT_ADDON))
{ {
@ -45,8 +45,8 @@ if (empty($conf->global->CONTRACT_ADDON))
if ($action == 'updateMask') if ($action == 'updateMask')
{ {
$maskconst=$_POST['maskconstcontract']; $maskconst = GETPOST('maskconstcontract','alpha');
$maskvalue=$_POST['maskcontract']; $maskvalue = GETPOST('maskcontract','alpha');
if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity); if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
@ -156,7 +156,6 @@ if (is_resource($handle))
// Info // Info
$htmltooltip=''; $htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$facture->type=0;
$nextval=$module->getNextValue($mysoc,$contract); $nextval=$module->getNextValue($mysoc,$contract);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
{ {

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -31,14 +32,16 @@ if (!$user->admin) accessforbidden();
$typeconst=array('yesno','texte','chaine'); $typeconst=array('yesno','texte','chaine');
$action = GETPOST('action','alpha');
/* /*
* Action * Action
*/ */
if ($_GET["action"] == 'specimen') if ($action == 'specimen')
{ {
$modele=$_GET["module"]; $modele=GETPOST('module','alpha');
$don = new Don($db); $don = new Don($db);
$don->initAsSpecimen(); $don->initAsSpecimen();
@ -71,25 +74,29 @@ if ($_GET["action"] == 'specimen')
} }
} }
if ($_GET["action"] == 'setdoc') if ($action == 'setdoc')
{ {
$value = GETPOST('value','alpha');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$db->begin(); $db->begin();
if (dolibarr_set_const($db, "DON_ADDON_MODEL",$_GET["value"],'chaine',0,'',$conf->entity)) if (dolibarr_set_const($db, "DON_ADDON_MODEL",$value,'chaine',0,'',$conf->entity))
{ {
$conf->global->DON_ADDON_MODEL = $_GET["value"]; $conf->global->DON_ADDON_MODEL = $value;
} }
// On active le modele // On active le modele
$type='donation'; $type='donation';
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql_del.= " WHERE nom = '".$db->escape($_GET["value"])."' AND type = '".$type."'"; $sql_del.= " WHERE nom = '".$db->escape($value)."' AND type = '".$type."'";
$result1=$db->query($sql_del); $result1=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($_GET["value"])."', '".$type."', ".$conf->entity.", "; $sql.= " VALUES ('".$db->escape($value)."', '".$type."', ".$conf->entity.", ";
$sql.= ($_GET["label"]?"'".$db->escape($_GET["label"])."'":'null').", "; $sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($_GET["scandir"])?"'".$db->escape($_GET["scandir"])."'":"null"); $sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")"; $sql.= ")";
$result2=$db->query($sql); $result2=$db->query($sql);
if ($result1 && $result2) if ($result1 && $result2)
@ -102,22 +109,28 @@ if ($_GET["action"] == 'setdoc')
} }
} }
if ($_GET["action"] == 'set') if ($action == 'set')
{ {
$value = GETPOST('value','alpha');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$type='donation'; $type='donation';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($_GET["value"])."','".$type."',".$conf->entity.", "; $sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
$sql.= ($_GET["label"]?"'".$db->escape($_GET["label"])."'":'null').", "; $sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($_GET["scandir"])?"'".$db->escape($_GET["scandir"])."'":"null"); $sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")"; $sql.= ")";
$resql=$db->query($sql); $resql=$db->query($sql);
} }
if ($_GET["action"] == 'del') if ($action == 'del')
{ {
$value = GETPOST('value','alpha');
$type='donation'; $type='donation';
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'"; $sql .= " WHERE nom = '".$value."' AND type = '".$type."'";
$resql=$db->query($sql); $resql=$db->query($sql);
} }

View File

@ -5,7 +5,8 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -37,8 +38,11 @@ $langs->load("deliveries");
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
$action=GETPOST("action"); $action=GETPOST('action','alpha');
$value=GETPOST("value"); $value=GETPOST('value','alpha');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$type='shipping';
if (empty($conf->global->EXPEDITION_ADDON_NUMBER)) if (empty($conf->global->EXPEDITION_ADDON_NUMBER))
{ {
@ -49,34 +53,95 @@ if (empty($conf->global->EXPEDITION_ADDON_NUMBER))
/* /*
* Actions * Actions
*/ */
if ($action == 'updateMask')
{
$maskconst=GETPOST('maskconstexpedition','alpha');
$maskvalue=GETPOST('maskexpedition','alpha');
if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
if ($action == 'set_SHIPPING_FREE_TEXT')
{
$freetext=GETPOST('SHIPPING_FREE_TEXT','alpha');
$res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
if ($action == 'set_SHIPPING_DRAFT_WATERMARK')
{
$draft=GETPOST('SHIPPING_DRAFT_WATERMARK','alpha');
$res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
if ($action == 'specimen') if ($action == 'specimen')
{ {
$modele=GETPOST("module"); $modele=GETPOST('module','alpha');
$exp = new Expedition($db); $exp = new Expedition($db);
$exp->initAsSpecimen(); $exp->initAsSpecimen();
//$exp->fetch_commande();
// Charge le modele // Search template files
$dir = "/core/modules/expedition/doc/"; $file=''; $classname=''; $filefound=0;
$file = "pdf_expedition_".$modele.".modules.php"; $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
$file = dol_buildpath($dir.$file); foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/expedition/doc/pdf_expedition_".$modele.".modules.php",0);
if (file_exists($file)) if (file_exists($file))
{ {
$filefound=1;
$classname = "pdf_expedition_".$modele; $classname = "pdf_expedition_".$modele;
break;
}
}
if ($filefound)
{
require_once($file); require_once($file);
$obj = new $classname($db); $module = new $classname($db);
if ($obj->write_file($exp,$langs) > 0) if ($module->write_file($exp,$langs) > 0)
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=expedition&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=expedition&file=SPECIMEN.pdf");
return; return;
} }
else else
{ {
$mesg='<font class="error">'.$obj->error.'</font>'; $mesg='<font class="error">'.$module->error.'</font>';
dol_syslog($obj->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} }
else else
@ -89,30 +154,13 @@ if ($action == 'specimen')
// Activate a model // Activate a model
if ($action == 'set') if ($action == 'set')
{ {
$label = GETPOST("label"); $ret = addDocumentModel($value, $type, $label, $scandir);
$scandir = GETPOST("scandir");
$type='shipping';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")";
if ($db->query($sql))
{
}
} }
if ($action == 'del') if ($action == 'del')
{ {
$type='shipping'; $ret = delDocumentModel($value, $type);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; if ($ret > 0)
$sql.= " WHERE nom = '".$db->escape($value)."'";
$sql.= " AND type = '".$type."'";
$sql.= " AND entity = ".$conf->entity;
if ($db->query($sql))
{ {
if ($conf->global->EXPEDITION_ADDON_PDF == "$value") dolibarr_del_const($db, 'EXPEDITION_ADDON_PDF',$conf->entity); if ($conf->global->EXPEDITION_ADDON_PDF == "$value") dolibarr_del_const($db, 'EXPEDITION_ADDON_PDF',$conf->entity);
} }
@ -121,46 +169,27 @@ if ($action == 'del')
// Set default model // Set default model
if ($action == 'setdoc') if ($action == 'setdoc')
{ {
$label = GETPOST("label");
$scandir = GETPOST("scandir");
$db->begin();
if (dolibarr_set_const($db, "EXPEDITION_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) if (dolibarr_set_const($db, "EXPEDITION_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{ {
// La constante qui a ete lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coherent
$conf->global->EXPEDITION_ADDON_PDF = $value; $conf->global->EXPEDITION_ADDON_PDF = $value;
} }
// On active le modele // On active le modele
$type='shipping'; $ret = delDocumentModel($value, $type);
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; if ($ret > 0)
$sql_del.= " WHERE nom = '".$db->escape($value)."'";
$sql_del.= " AND type = '".$type."'";
$sql_del.= " AND entity = ".$conf->entity;
$result1=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($value)."', '".$type."', ".$conf->entity.", ";
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")";
$result2=$db->query($sql);
if ($result1 && $result2)
{ {
$db->commit(); $ret = addDocumentModel($value, $type, $label, $scandir);
}
else
{
$db->rollback();
} }
} }
// TODO A quoi servent les methode d'expedition ? // TODO A quoi servent les methode d'expedition ?
if ($action == 'setmethod' || $action== 'setmod') if ($action == 'setmethod' || $action== 'setmod')
{ {
$module=GETPOST("module"); $module=GETPOST('module','alpha');
$moduleid=GETPOST("moduleid"); $moduleid=GETPOST('moduleid','alpha');
$statut=GETPOST("statut"); $statut=GETPOST('statut','alpha');
require_once(DOL_DOCUMENT_ROOT."/core/modules/expedition/methode_expedition_$module.modules.php"); require_once(DOL_DOCUMENT_ROOT."/core/modules/expedition/methode_expedition_$module.modules.php");
@ -231,28 +260,8 @@ if ($action == 'setmod')
// TODO Verifier si module numerotation choisi peut etre active // TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated // par appel methode canBeActivated
$module=GETPOST("module"); dolibarr_set_const($db, "EXPEDITION_ADDON",$value,'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "EXPEDITION_ADDON",$module,'chaine',0,'',$conf->entity);
}
if ($action == 'updateMask')
{
$maskconst=GETPOST("maskconstexpedition");
$maskvalue=GETPOST("maskexpedition");
if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
} }
if ($action == 'setmodel') if ($action == 'setmodel')
@ -260,46 +269,14 @@ if ($action == 'setmodel')
dolibarr_set_const($db, "EXPEDITION_ADDON_NUMBER",$value,'chaine',0,'',$conf->entity); dolibarr_set_const($db, "EXPEDITION_ADDON_NUMBER",$value,'chaine',0,'',$conf->entity);
} }
if ($action == 'set_SHIPPING_DRAFT_WATERMARK')
{
$draft=GETPOST("SHIPPING_DRAFT_WATERMARK");
$res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
if ($action == 'set_SHIPPING_FREE_TEXT')
{
$free=GETPOST("SHIPPING_FREE_TEXT");
$res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT",$free,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
/* /*
* View * View
*/ */
$form=new Form($db); $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
$form=new Form($db);
llxHeader("",""); llxHeader("","");
@ -349,9 +326,9 @@ print "</tr>\n";
clearstatcache(); clearstatcache();
foreach ($conf->file->dol_document_root as $dirroot) foreach ($dirmodels as $reldir)
{ {
$dir = $dirroot . "/core/modules/expedition/"; $dir = dol_buildpath($reldir."core/modules/expedition/");
if (is_dir($dir)) if (is_dir($dir))
{ {
@ -409,7 +386,6 @@ foreach ($conf->file->dol_document_root as $dirroot)
// Info // Info
$htmltooltip=''; $htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$facture->type=0;
$nextval=$module->getNextValue($mysoc,$expedition); $nextval=$module->getNextValue($mysoc,$expedition);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
{ {
@ -482,15 +458,14 @@ print "</tr>\n";
clearstatcache(); clearstatcache();
foreach ($conf->file->dol_document_root as $dirroot) $var=true;
foreach ($dirmodels as $reldir)
{ {
$dir = $dirroot . "/core/modules/expedition/doc/"; $dir = dol_buildpath($reldir."core/modules/expedition/doc/");
if (is_dir($dir)) if (is_dir($dir))
{ {
$handle=opendir($dir); $handle=opendir($dir);
$var=true;
if (is_resource($handle)) if (is_resource($handle))
{ {
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
@ -501,7 +476,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
$classname = substr($file, 0, dol_strlen($file) - 12); $classname = substr($file, 0, dol_strlen($file) - 12);
$var=!$var; $var=!$var;
print "<tr $bc[$var]><td>"; print '<tr '.$bc[$var].'><td>';
print $name; print $name;
print "</td><td>\n"; print "</td><td>\n";
require_once($dir.$file); require_once($dir.$file);
@ -514,16 +489,9 @@ foreach ($conf->file->dol_document_root as $dirroot)
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
//if ($conf->global->EXPEDITION_ADDON_PDF != $name)
//{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
print img_picto($langs->trans("Activated"),'switch_on'); print img_picto($langs->trans("Activated"),'switch_on');
print '</a>'; print '</a>';
//}
//else
//{
// print img_picto($langs->trans("Activated"),'switch_on');
//}
print "</td>"; print "</td>";
} }
else else

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -44,10 +45,10 @@ $value = GETPOST('value','alpha');
if ($action == 'updateMask') if ($action == 'updateMask')
{ {
$maskconstinvoice=GETPOST("maskconstinvoice"); $maskconstinvoice=GETPOST('maskconstinvoice','alpha');
$maskconstcredit=GETPOST("maskconstcredit"); $maskconstcredit=GETPOST('maskconstcredit','alpha');
$maskinvoice=GETPOST("maskinvoice"); $maskinvoice=GETPOST('maskinvoice','alpha');
$maskcredit=GETPOST("maskcredit"); $maskcredit=GETPOST('maskcredit','alpha');
if ($maskconstinvoice) $res = dolibarr_set_const($db,$maskconstinvoice,$maskinvoice,'chaine',0,'',$conf->entity); if ($maskconstinvoice) $res = dolibarr_set_const($db,$maskconstinvoice,$maskinvoice,'chaine',0,'',$conf->entity);
if ($maskconstcredit) $res = dolibarr_set_const($db,$maskconstcredit,$maskcredit,'chaine',0,'',$conf->entity); if ($maskconstcredit) $res = dolibarr_set_const($db,$maskconstcredit,$maskcredit,'chaine',0,'',$conf->entity);
@ -65,7 +66,7 @@ if ($action == 'updateMask')
if ($action == 'specimen') if ($action == 'specimen')
{ {
$modele=GETPOST("module"); $modele=GETPOST('module','alpha');
$facture = new Facture($db); $facture = new Facture($db);
$facture->initAsSpecimen(); $facture->initAsSpecimen();
@ -116,8 +117,8 @@ if ($action == 'setModuleOptions')
{ {
if (array_key_exists('param'.$i,$_POST)) if (array_key_exists('param'.$i,$_POST))
{ {
$param=$_POST["param".$i]; $param=GETPOST("param".$i,'alpha');
$value=$_POST["value".$i]; $value=GETPOST("value".$i,'alpha');
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
} }
} }
@ -135,8 +136,8 @@ if ($action == 'setModuleOptions')
if ($action == 'set') if ($action == 'set')
{ {
$label = GETPOST("label"); $label = GETPOST('label','alpha');
$scandir = GETPOST("scandir"); $scandir = GETPOST('scandir','alpha');
$type='invoice'; $type='invoice';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
@ -166,8 +167,8 @@ if ($action == 'del')
if ($action == 'setdoc') if ($action == 'setdoc')
{ {
$label = GETPOST("label"); $label = GETPOST('label','alpha');
$scandir = GETPOST("scandir"); $scandir = GETPOST('scandir','alpha');
$db->begin(); $db->begin();
@ -214,8 +215,8 @@ if ($action == 'setmod')
if ($action == 'setribchq') if ($action == 'setribchq')
{ {
$rib = GETPOST("rib"); $rib = GETPOST('rib','alpha');
$chq = GETPOST("chq"); $chq = GETPOST('chq','alpha');
$res = dolibarr_set_const($db, "FACTURE_RIB_NUMBER",$rib,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "FACTURE_RIB_NUMBER",$rib,'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER",$chq,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER",$chq,'chaine',0,'',$conf->entity);
@ -234,7 +235,7 @@ if ($action == 'setribchq')
if ($action == 'set_FACTURE_DRAFT_WATERMARK') if ($action == 'set_FACTURE_DRAFT_WATERMARK')
{ {
$draft = GETPOST("FACTURE_DRAFT_WATERMARK"); $draft = GETPOST('FACTURE_DRAFT_WATERMARK','alpha');
$res = dolibarr_set_const($db, "FACTURE_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "FACTURE_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
@ -252,7 +253,7 @@ if ($action == 'set_FACTURE_DRAFT_WATERMARK')
if ($action == 'set_FACTURE_FREE_TEXT') if ($action == 'set_FACTURE_FREE_TEXT')
{ {
$free = GETPOST("FACTURE_FREE_TEXT"); $free = GETPOST('FACTURE_FREE_TEXT','alpha');
$res = dolibarr_set_const($db, "FACTURE_FREE_TEXT",$free,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "FACTURE_FREE_TEXT",$free,'chaine',0,'',$conf->entity);
@ -270,7 +271,7 @@ if ($action == 'set_FACTURE_FREE_TEXT')
if ($action == 'setforcedate') if ($action == 'setforcedate')
{ {
$forcedate = GETPOST("forcedate"); $forcedate = GETPOST('forcedate','alpha');
$res = dolibarr_set_const($db, "FAC_FORCE_DATE_VALIDATION",$forcedate,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "FAC_FORCE_DATE_VALIDATION",$forcedate,'chaine',0,'',$conf->entity);

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -30,6 +31,8 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$langs->load("admin"); $langs->load("admin");
$langs->load("fckeditor"); $langs->load("fckeditor");
$action = GETPOST('action','alpha');
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
// Constante et traduction de la description du module // Constante et traduction de la description du module
@ -62,7 +65,7 @@ $picto = array(
foreach($modules as $const => $desc) foreach($modules as $const => $desc)
{ {
if ($_GET["action"] == 'activate_'.strtolower($const)) if ($action == 'activate_'.strtolower($const))
{ {
dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1",'chaine',0,'',$conf->entity); dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1",'chaine',0,'',$conf->entity);
// Si fckeditor est active dans la description produit/service, on l'active dans les formulaires // Si fckeditor est active dans la description produit/service, on l'active dans les formulaires
@ -73,7 +76,7 @@ foreach($modules as $const => $desc)
Header("Location: ".$_SERVER["PHP_SELF"]); Header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} }
if ($_GET["action"] == 'disable_'.strtolower($const)) if ($action == 'disable_'.strtolower($const))
{ {
dolibarr_del_const($db, "FCKEDITOR_ENABLE_".$const,$conf->entity); dolibarr_del_const($db, "FCKEDITOR_ENABLE_".$const,$conf->entity);
Header("Location: ".$_SERVER["PHP_SELF"]); Header("Location: ".$_SERVER["PHP_SELF"]);
@ -81,9 +84,9 @@ foreach($modules as $const => $desc)
} }
} }
if ($_POST["save"]) if (GETPOST('save','alpha'))
{ {
dolibarr_set_const($db, "FCKEDITOR_TEST", $_POST["formtestfield"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "FCKEDITOR_TEST", GETPOST('formtestfield','alpha'),'chaine',0,'',$conf->entity);
} }

View File

@ -5,8 +5,8 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -36,11 +36,13 @@ $langs->load("admin");
$langs->load("errors"); $langs->load("errors");
$langs->load("interventions"); $langs->load("interventions");
if (!$user->admin) if (! $user->admin) accessforbidden();
accessforbidden();
$action = GETPOST("action"); $action = GETPOST('action','alpha');
$value = GETPOST("value"); $value = GETPOST('value','alpha');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$type='ficheinter';
/* /*
@ -48,8 +50,8 @@ $value = GETPOST("value");
*/ */
if ($action == 'updateMask') if ($action == 'updateMask')
{ {
$maskconst=GETPOST("maskconst"); $maskconst=GETPOST('maskconst','alpha');
$maskvalue=GETPOST("maskvalue"); $maskvalue=GETPOST('maskvalue','alpha');
if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity); if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
@ -66,7 +68,7 @@ if ($action == 'updateMask')
if ($action == 'set_FICHINTER_FREE_TEXT') if ($action == 'set_FICHINTER_FREE_TEXT')
{ {
$freetext= GETPOST("FICHINTER_FREE_TEXT"); $freetext= GETPOST('FICHINTER_FREE_TEXT','alpha');
$res = dolibarr_set_const($db, "FICHINTER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "FICHINTER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
@ -83,7 +85,7 @@ if ($action == 'set_FICHINTER_FREE_TEXT')
if ($action == 'set_FICHINTER_DRAFT_WATERMARK') if ($action == 'set_FICHINTER_DRAFT_WATERMARK')
{ {
$draft= GETPOST("FICHINTER_DRAFT_WATERMARK"); $draft= GETPOST('FICHINTER_DRAFT_WATERMARK','alpha');
$res = dolibarr_set_const($db, "FICHINTER_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "FICHINTER_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
@ -101,23 +103,32 @@ if ($action == 'set_FICHINTER_DRAFT_WATERMARK')
if ($action == 'specimen') if ($action == 'specimen')
{ {
$modele=$_GET["module"]; $modele= GETPOST('module','alpha');
$inter = new Fichinter($db); $inter = new Fichinter($db);
$inter->initAsSpecimen(); $inter->initAsSpecimen();
// Charge le modele // Search template files
$dir = "/core/modules/fichinter/doc/"; $file=''; $classname=''; $filefound=0;
$file = "pdf_".$modele.".modules.php"; $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
$file = dol_buildpath($dir.$file); foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/fichinter/doc/pdf_".$modele.".modules.php",0);
if (file_exists($file)) if (file_exists($file))
{ {
$filefound=1;
$classname = "pdf_".$modele; $classname = "pdf_".$modele;
break;
}
}
if ($filefound)
{
require_once($file); require_once($file);
$obj = new $classname($db); $module = new $classname($db);
if ($obj->write_file($inter,$langs) > 0) if ($module->write_file($inter,$langs) > 0)
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=ficheinter&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=ficheinter&file=SPECIMEN.pdf");
return; return;
@ -137,30 +148,13 @@ if ($action == 'specimen')
if ($action == 'set') if ($action == 'set')
{ {
$label = GETPOST("label"); $ret = addDocumentModel($value, $type, $label, $scandir);
$scandir = GETPOST("scandir");
$type='ficheinter';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")";
if ($db->query($sql))
{
}
} }
if ($action == 'del') if ($action == 'del')
{ {
$type='ficheinter'; $ret = delDocumentModel($value, $type);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; if ($ret > 0)
$sql.= " WHERE nom = '".$db->escape($value)."'";
$sql.= " AND type = '".$type."'";
$sql.= " AND entity = ".$conf->entity;
if ($db->query($sql))
{ {
if ($conf->global->FICHEINTER_ADDON_PDF == "$value") dolibarr_del_const($db, 'FICHEINTER_ADDON_PDF',$conf->entity); if ($conf->global->FICHEINTER_ADDON_PDF == "$value") dolibarr_del_const($db, 'FICHEINTER_ADDON_PDF',$conf->entity);
} }
@ -168,11 +162,6 @@ if ($action == 'del')
if ($action == 'setdoc') if ($action == 'setdoc')
{ {
$label = GETPOST("label");
$scandir = GETPOST("scandir");
$db->begin();
if (dolibarr_set_const($db, "FICHEINTER_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) if (dolibarr_set_const($db, "FICHEINTER_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{ {
// La constante qui a ete lue en avant du nouveau set // La constante qui a ete lue en avant du nouveau set
@ -181,28 +170,10 @@ if ($action == 'setdoc')
} }
// On active le modele // On active le modele
$type='ficheinter'; $ret = delDocumentModel($value, $type);
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; if ($ret > 0)
$sql_del.= " WHERE nom = '".$db->escape($value)."'";
$sql_del.= " AND type = '".$type."'";
$sql_del.= " AND entity = ".$conf->entity;
dol_syslog("fichinter: sql_del=".$sql_del);
$result1=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($value)."', '".$type."', ".$conf->entity.", ";
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")";
dol_syslog("fichinter: sql_del=".$sql_del);
$result2=$db->query($sql);
if ($result1 && $result2)
{ {
$db->commit(); $ret = addDocumentModel($value, $type, $label, $scandir);
}
else
{
$db->rollback();
} }
} }
@ -219,6 +190,8 @@ if ($action == 'setmod')
* View * View
*/ */
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
llxHeader(); llxHeader();
$form=new Form($db); $form=new Form($db);
@ -242,9 +215,9 @@ print "</tr>\n";
clearstatcache(); clearstatcache();
foreach ($conf->file->dol_document_root as $dirroot) foreach ($dirmodels as $reldir)
{ {
$dir = $dirroot . "/core/modules/fichinter/"; $dir = dol_buildpath($reldir."core/modules/fichinter/");
if (is_dir($dir)) if (is_dir($dir))
{ {
@ -260,7 +233,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
$file = $reg[1]; $file = $reg[1];
$classname = substr($file,4); $classname = substr($file,4);
require_once($dir.$file.".php"); require_once(DOL_DOCUMENT_ROOT ."/core/modules/fichinter/".$file.".php");
$module = new $file; $module = new $file;
@ -361,9 +334,9 @@ print "</tr>\n";
clearstatcache(); clearstatcache();
$var=true; $var=true;
foreach ($conf->file->dol_document_root as $dirroot) foreach ($dirmodels as $reldir)
{ {
$dir = $dirroot . "/core/modules/fichinter/doc/"; $dir = dol_buildpath($reldir."core/modules/fichinter/doc/");
if (is_dir($dir)) if (is_dir($dir))
{ {

View File

@ -4,7 +4,7 @@
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -38,9 +38,9 @@ $langs->load("admin");
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
$type=GETPOST('type'); $type=GETPOST('type', 'alpha');
$value=GETPOST('value'); $value=GETPOST('value', 'alpha');
$action=GETPOST('action'); $action=GETPOST('action', 'alpha');
$specimenthirdparty=new Societe($db); $specimenthirdparty=new Societe($db);
$specimenthirdparty->initAsSpecimen(); $specimenthirdparty->initAsSpecimen();
@ -52,8 +52,9 @@ $specimenthirdparty->initAsSpecimen();
if ($action == 'updateMask') if ($action == 'updateMask')
{ {
$maskconstorder=$_POST['maskconstorder']; $maskconstorder=GETPOST('maskconstorder','alpha');
$maskorder=$_POST['maskorder']; $maskorder=GETPOST('maskorder','alpha');
if ($maskconstorder) $res = dolibarr_set_const($db,$maskconstorder,$maskorder,'chaine',0,'',$conf->entity); if ($maskconstorder) $res = dolibarr_set_const($db,$maskconstorder,$maskorder,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
@ -70,7 +71,7 @@ if ($action == 'updateMask')
if ($action == 'specimen') // For orders if ($action == 'specimen') // For orders
{ {
$modele=GETPOST("module"); $modele=GETPOST('module','alpha');
$commande = new CommandeFournisseur($db); $commande = new CommandeFournisseur($db);
$commande->initAsSpecimen(); $commande->initAsSpecimen();
@ -116,7 +117,7 @@ if ($action == 'specimen') // For orders
if ($action == 'specimenfacture') // For invoices if ($action == 'specimenfacture') // For invoices
{ {
$modele=GETPOST("module"); $modele=GETPOST('module','alpha');
$facture = new FactureFournisseur($db); $facture = new FactureFournisseur($db);
$facture->initAsSpecimen(); $facture->initAsSpecimen();
@ -162,10 +163,13 @@ if ($action == 'specimenfacture') // For invoices
if ($action == 'set') if ($action == 'set')
{ {
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", "; $sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
$sql.= ($_GET["label"]?"'".$db->escape($_GET["label"])."'":'null').", "; $sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($_GET["scandir"])?"'".$db->escape($_GET["scandir"])."'":"null"); $sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")"; $sql.= ")";
$res=$db->query($sql); $res=$db->query($sql);
if ($res) if ($res)
@ -191,14 +195,17 @@ if ($action == 'del')
if ($action == 'setdoc') if ($action == 'setdoc')
{ {
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$db->begin(); $db->begin();
if ($_GET["type"] == 'order_supplier' && dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) if ($type == 'order_supplier' && dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{ {
$conf->global->COMMANDE_SUPPLIER_ADDON_PDF = $value; $conf->global->COMMANDE_SUPPLIER_ADDON_PDF = $value;
} }
if ($_GET["type"] == 'invoice_supplier' && dolibarr_set_const($db, "INVOICE_SUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) if ($type == 'invoice_supplier' && dolibarr_set_const($db, "INVOICE_SUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{ {
$conf->global->INVOICE_SUPPLIER_ADDON_PDF = $value; $conf->global->INVOICE_SUPPLIER_ADDON_PDF = $value;
} }
@ -212,8 +219,8 @@ if ($action == 'setdoc')
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($value)."', '".$type."', ".$conf->entity.", "; $sql.= " VALUES ('".$db->escape($value)."', '".$type."', ".$conf->entity.", ";
$sql.= ($_GET["label"]?"'".$db->escape($_GET["label"])."'":'null').", "; $sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($_GET["scandir"])?"'".$db->escape($_GET["scandir"])."'":"null"); $sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")"; $sql.= ")";
$result2=$db->query($sql); $result2=$db->query($sql);
if ($result1 && $result2) if ($result1 && $result2)
@ -242,7 +249,7 @@ if ($action == 'addcat')
if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT') if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT')
{ {
$free = GETPOST("SUPPLIER_INVOICE_FREE_TEXT"); $free = GETPOST('SUPPLIER_INVOICE_FREE_TEXT','alpha');
$res = dolibarr_set_const($db, "SUPPLIER_INVOICE_FREE_TEXT",$free,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "SUPPLIER_INVOICE_FREE_TEXT",$free,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;

View File

@ -218,7 +218,7 @@ if ($action == 'edit') // Edit
// Hide wiki link on login page // Hide wiki link on login page
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("DisableLinkToHelp",img_picto('',DOL_URL_ROOT.'/theme/common/helpdoc.png','',1)).'</td><td>'; print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("DisableLinkToHelp",img_picto('',DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/helpdoc.png','',1)).'</td><td>';
print $form->selectyesno('MAIN_HELP_DISABLELINK',isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0,1); print $form->selectyesno('MAIN_HELP_DISABLELINK',isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0,1);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
@ -366,7 +366,7 @@ else // Show
// Link to wiki help // Link to wiki help
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("DisableLinkToHelp",img_picto('',DOL_URL_ROOT.'/theme/common/helpdoc.png','',1)).'</td><td colspan="2">'; print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("DisableLinkToHelp",img_picto('',DOL_URL_ROOT.'/theme/'.$conf->theme.'/img//helpdoc.png','',1)).'</td><td colspan="2">';
print yn($conf->global->MAIN_HELP_DISABLELINK,1); print yn($conf->global->MAIN_HELP_DISABLELINK,1);
print '</td></tr>'; print '</td></tr>';

View File

@ -4,8 +4,9 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -36,8 +37,11 @@ $langs->load("deliveries");
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
$action = GETPOST("action"); $action = GETPOST('action','alpha');
$value = GETPOST("value"); $value = GETPOST('value','alpha');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$type='delivery';
/* /*
* Actions * Actions
@ -45,8 +49,8 @@ $value = GETPOST("value");
if ($action == 'updateMask') if ($action == 'updateMask')
{ {
$maskconstdelivery=GETPOST("maskconstdelivery"); $maskconstdelivery=GETPOST('maskconstdelivery','alpha');
$maskdelivery=GETPOST("maskdelivery"); $maskdelivery=GETPOST('maskdelivery','alpha');
if ($maskconstdelivery) $res = dolibarr_set_const($db,$maskconstdelivery,$maskdelivery,'chaine',0,'',$conf->entity); if ($maskconstdelivery) $res = dolibarr_set_const($db,$maskconstdelivery,$maskdelivery,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
@ -61,33 +65,59 @@ if ($action == 'updateMask')
} }
} }
if ($action == 'set_DELIVERY_FREE_TEXT')
{
$free=GETPOST('DELIVERY_FREE_TEXT','alpha');
$res=dolibarr_set_const($db, "DELIVERY_FREE_TEXT",$free,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
if ($action == 'specimen') if ($action == 'specimen')
{ {
$modele=GETPOST("module"); $modele=GETPOST('module','alpha');
$sending = new Livraison($db); $sending = new Livraison($db);
$sending->initAsSpecimen(); $sending->initAsSpecimen();
//$sending->fetch_commande();
// Charge le modele // Search template files
$dir = DOL_DOCUMENT_ROOT . "/core/modules/livraison/pdf/"; $file=''; $classname=''; $filefound=0;
$file = "pdf_".$modele.".modules.php"; $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
if (file_exists($dir.$file)) foreach($dirmodels as $reldir)
{ {
$file=dol_buildpath($reldir."core/modules/livraison/pdf/pdf_".$modele.".modules.php",0);
if (file_exists($file))
{
$filefound=1;
$classname = "pdf_".$modele; $classname = "pdf_".$modele;
require_once($dir.$file); break;
}
}
$obj = new $classname($db); if ($filefound)
{
require_once($file);
if ($obj->write_file($sending,$langs) > 0) $module = new $classname($db);
if ($module->write_file($sending,$langs) > 0)
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=livraison&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=livraison&file=SPECIMEN.pdf");
return; return;
} }
else else
{ {
$mesg='<font class="error">'.$obj->error.'</font>'; $mesg='<font class="error">'.$module->error.'</font>';
dol_syslog($obj->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} }
else else
@ -99,27 +129,13 @@ if ($action == 'specimen')
if ($action == 'set') if ($action == 'set')
{ {
$label = GETPOST("label"); $ret = addDocumentModel($value, $type, $label, $scandir);
$scandir = GETPOST("scandir");
$type='delivery';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")";
$resql=$db->query($sql);
} }
if ($action == 'del') if ($action == 'del')
{ {
$type='delivery'; $ret = delDocumentModel($value, $type);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; if ($ret > 0)
$sql.= " WHERE nom = '".$db->escape($value)."'";
$sql.= " AND type = '".$type."'";
$sql.= " AND entity = ".$conf->entity;
if ($db->query($sql))
{ {
if ($conf->global->LIVRAISON_ADDON_PDF == "$value") dolibarr_del_const($db, 'LIVRAISON_ADDON_PDF',$conf->entity); if ($conf->global->LIVRAISON_ADDON_PDF == "$value") dolibarr_del_const($db, 'LIVRAISON_ADDON_PDF',$conf->entity);
} }
@ -127,53 +143,18 @@ if ($action == 'del')
if ($action == 'setdoc') if ($action == 'setdoc')
{ {
$label = GETPOST("label");
$scandir = GETPOST("scandir");
$db->begin();
if (dolibarr_set_const($db, "LIVRAISON_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) if (dolibarr_set_const($db, "LIVRAISON_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{ {
// La constante qui a ete lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coherent
$conf->global->LIVRAISON_ADDON_PDF = $value; $conf->global->LIVRAISON_ADDON_PDF = $value;
} }
// On active le modele // On active le modele
$type='delivery'; $ret = delDocumentModel($value, $type);
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; if ($ret > 0)
$sql_del.= " WHERE nom = '".$db->escape($value)."'";
$sql_del.= " AND type = '".$type."'";
$sql_del.= " AND entity = ".$conf->entity;
$result1=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($value)."', '".$type."', ".$conf->entity.", ";
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")";
$result2=$db->query($sql);
if ($result1 && $result2)
{ {
$db->commit(); $ret = addDocumentModel($value, $type, $label, $scandir);
}
else
{
$db->rollback();
}
}
if ($action == 'set_DELIVERY_FREE_TEXT')
{
$free=GETPOST("DELIVERY_FREE_TEXT");
$res=dolibarr_set_const($db, "DELIVERY_FREE_TEXT",$free,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
} }
} }
@ -190,10 +171,12 @@ if ($action == 'setmod')
* View * View
*/ */
$form=new Form($db); $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
llxHeader("",""); llxHeader("","");
$form=new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("SendingsSetup"),$linkback,'setup'); print_fiche_titre($langs->trans("SendingsSetup"),$linkback,'setup');
print '<br>'; print '<br>';
@ -236,9 +219,9 @@ print '</tr>'."\n";
clearstatcache(); clearstatcache();
foreach ($conf->file->dol_document_root as $dirroot) foreach ($dirmodels as $reldir)
{ {
$dir = $dirroot . "/core/modules/livraison/"; $dir = dol_buildpath($reldir."core/modules/livraison/");
if (is_dir($dir)) if (is_dir($dir))
{ {
@ -292,7 +275,6 @@ foreach ($conf->file->dol_document_root as $dirroot)
// Info // Info
$htmltooltip=''; $htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$facture->type=0;
$nextval=$module->getNextValue($mysoc,$livraison); $nextval=$module->getNextValue($mysoc,$livraison);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
{ {
@ -366,9 +348,10 @@ print "</tr>\n";
clearstatcache(); clearstatcache();
foreach ($conf->file->dol_document_root as $dirroot) $var=true;
foreach ($dirmodels as $reldir)
{ {
$dir = $dirroot . "/core/modules/livraison/pdf/"; $dir = dol_buildpath($reldir."core/modules/livraison/pdf/");
if (is_dir($dir)) if (is_dir($dir))
{ {
@ -383,7 +366,8 @@ foreach ($conf->file->dol_document_root as $dirroot)
$classname = substr($file, 0, dol_strlen($file) - 12); $classname = substr($file, 0, dol_strlen($file) - 12);
$var=!$var; $var=!$var;
print "<tr $bc[$var]><td>";
print '<tr '.$bc[$var].'><td>';
print $name; print $name;
print "</td><td>\n"; print "</td><td>\n";
require_once($dir.$file); require_once($dir.$file);
@ -396,16 +380,9 @@ foreach ($conf->file->dol_document_root as $dirroot)
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
//if ($conf->global->LIVRAISON_ADDON_PDF != "$name")
//{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'switch_on'); print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>'; print '</a>';
//}
//else
//{
// print img_picto($langs->trans("Enabled"),'switch_on');
//}
print "</td>"; print "</td>";
} }
else else
@ -448,11 +425,9 @@ foreach ($conf->file->dol_document_root as $dirroot)
} }
print '</table>'; print '</table>';
/* /*
* * Autres Options
* */
*/
print "<br>"; print "<br>";
print_titre($langs->trans("OtherOptions")); print_titre($langs->trans("OtherOptions"));

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.org> * Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.org>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -32,7 +32,7 @@ $langs->load("mails");
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
$action = GETPOST("action"); $action = GETPOST('action','alpha');
/* /*
* Actions * Actions
@ -42,13 +42,16 @@ if ($action == 'setvalue' && $user->admin)
{ {
$db->begin(); $db->begin();
$mailfrom = GETPOST("MAILING_EMAIL_FROM"); $mailfrom = GETPOST('MAILING_EMAIL_FROM','alpha');
$mailerror = GETPOST("MAILING_EMAIL_ERRORSTO"); $mailerror = GETPOST('MAILING_EMAIL_ERRORSTO','alpha');
$checkread = GETPOST('value','alpha');
$res=dolibarr_set_const($db, "MAILING_EMAIL_FROM",$mailfrom,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MAILING_EMAIL_FROM",$mailfrom,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
$res=dolibarr_set_const($db, "MAILING_EMAIL_ERRORSTO",$mailerror,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MAILING_EMAIL_ERRORSTO",$mailerror,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
$res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE",$checkread,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error) if (! $error)
{ {
@ -101,6 +104,25 @@ print '<input size="32" type="text" name="MAILING_EMAIL_ERRORSTO" value="'.$conf
if (!empty($conf->global->MAILING_EMAIL_ERRORSTO) && ! isValidEmail($conf->global->MAILING_EMAIL_ERRORSTO)) print ' '.img_warning($langs->trans("BadEMail")); if (!empty($conf->global->MAILING_EMAIL_ERRORSTO) && ! isValidEmail($conf->global->MAILING_EMAIL_ERRORSTO)) print ' '.img_warning($langs->trans("BadEMail"));
print '</td></tr>'; print '</td></tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("ActivateCheckRead").'</td><td>';
if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE==1)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setvalue&value=0">';
print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>';
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setvalue&value=1">';
print img_picto($langs->trans("Disabled"),'switch_off');
print '</a>';
}
print '</td></tr>';
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>'; print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';
print '</table></form>'; print '</table></form>';

View File

@ -162,8 +162,7 @@ if (! empty($_POST['removedfile']) || ! empty($_POST['removedfilehtml']))
/* /*
* Send mail * Send mail
*/ */
if (($action == 'send' || $action == 'sendhtml') if (($action == 'send' || $action == 'sendhtml') && ! $_POST['addfile'] && ! $_POST['addfilehtml'] && ! $_POST["removedfile"] && ! $_POST['cancel'])
&& ! $_POST['addfile'] && ! $_POST['addfilehtml'] && ! $_POST["removedfile"] && ! $_POST['cancel'])
{ {
$error=0; $error=0;
@ -212,9 +211,18 @@ if (($action == 'send' || $action == 'sendhtml')
require_once(DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php");
$mailfile = new CMailFile( $mailfile = new CMailFile(
$subject, $sendto, $email_from, $body, $subject,
$filepath, $mimetype, $filename, $sendto,
$sendtocc, $sendtoccc, $deliveryreceipt, $msgishtml, $errors_to $email_from,
$body,
$filepath,
$mimetype,
$filename,
$sendtocc,
$sendtoccc,
$deliveryreceipt,
$msgishtml,
$errors_to
); );
$result=$mailfile->sendfile(); $result=$mailfile->sendfile();

View File

@ -35,7 +35,7 @@ $langs->load("withdrawals");
// Security check // Security check
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
$action = GETPOST("action"); $action = GETPOST('action','alpha');
/* /*

View File

@ -1,7 +1,8 @@
<?php <?php
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr> /* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,14 +30,17 @@ require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
require_once(DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'); require_once(DOL_DOCUMENT_ROOT.'/projet/class/task.class.php');
$langs->load("admin"); $langs->load("admin");
$langs->load("errors");
$langs->load("other"); $langs->load("other");
$langs->load("projects"); $langs->load("projects");
if (!$user->admin) if (!$user->admin) accessforbidden();
accessforbidden();
$value=GETPOST('value'); $value = GETPOST('value','alpha');
$action=GETPOST('action'); $action = GETPOST('action','alpha');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$type='project';
/* /*
@ -45,8 +49,9 @@ $action=GETPOST('action');
if ($action == 'updateMask') if ($action == 'updateMask')
{ {
$maskconstproject=GETPOST("maskconstproject"); $maskconstproject=GETPOST('maskconstproject','alpha');
$maskproject=GETPOST("maskproject"); $maskproject=GETPOST('maskproject','alpha');
if ($maskconstproject) $res = dolibarr_set_const($db,$maskconstproject,$maskproject,'chaine',0,'',$conf->entity); if ($maskconstproject) $res = dolibarr_set_const($db,$maskconstproject,$maskproject,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
@ -63,22 +68,32 @@ if ($action == 'updateMask')
if ($action == 'specimen') if ($action == 'specimen')
{ {
$modele=GETPOST("module"); $modele=GETPOST('module','alpha');
$project = new Project($db); $project = new Project($db);
$project->initAsSpecimen(); $project->initAsSpecimen();
// Charge le modele // Search template files
$dir = DOL_DOCUMENT_ROOT . "/core/modules/project/pdf/"; $file=''; $classname=''; $filefound=0;
$file = "pdf_".$modele.".modules.php"; $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
if (file_exists($dir.$file)) foreach($dirmodels as $reldir)
{ {
$file=dol_buildpath($reldir."core/modules/project/pdf/pdf_".$modele.".modules.php",0);
if (file_exists($file))
{
$filefound=1;
$classname = "pdf_".$modele; $classname = "pdf_".$modele;
require_once($dir.$file); break;
}
}
$obj = new $classname($db); if ($filefound)
{
require_once($file);
if ($obj->write_file($project,$langs) > 0) $module = new $classname($db);
if ($module->write_file($project,$langs) > 0)
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=project&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=project&file=SPECIMEN.pdf");
return; return;
@ -98,26 +113,13 @@ if ($action == 'specimen')
if ($action == 'set') if ($action == 'set')
{ {
$label = GETPOST("label"); $ret = addDocumentModel($value, $type, $label, $scandir);
$scandir = GETPOST("scandir");
$type='project';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")";
$resql=$db->query($sql);
} }
if ($action == 'del') if ($action == 'del')
{ {
$type='project'; $ret = delDocumentModel($value, $type);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; if ($ret > 0)
$sql.= " WHERE nom = '".$db->escape($value)."'";
$sql.= " AND type = '".$type."'";
$sql.= " AND entity = ".$conf->entity;
if ($db->query($sql))
{ {
if ($conf->global->PROJECT_ADDON_PDF == "$value") dolibarr_del_const($db, 'PROJECT_ADDON_PDF',$conf->entity); if ($conf->global->PROJECT_ADDON_PDF == "$value") dolibarr_del_const($db, 'PROJECT_ADDON_PDF',$conf->entity);
} }
@ -125,37 +127,18 @@ if ($action == 'del')
if ($action == 'setdoc') if ($action == 'setdoc')
{ {
$label = GETPOST("label");
$scandir = GETPOST("scandir");
$db->begin();
if (dolibarr_set_const($db, "PROJECT_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) if (dolibarr_set_const($db, "PROJECT_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{ {
// La constante qui a ete lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coherent
$conf->global->PROJECT_ADDON_PDF = $value; $conf->global->PROJECT_ADDON_PDF = $value;
} }
// On active le modele // On active le modele
$type='project'; $ret = delDocumentModel($value, $type);
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; if ($ret > 0)
$sql_del.= " WHERE nom = '".$db->escape($value)."'";
$sql_del.= " AND type = '".$type."'";
$sql_del.= " AND entity = ".$conf->entity;
$result1=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($value)."', '".$type."', ".$conf->entity.", ";
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")";
$result2=$db->query($sql);
if ($result1 && $result2)
{ {
$db->commit(); $ret = addDocumentModel($value, $type, $label, $scandir);
}
else
{
$db->rollback();
} }
} }
@ -164,17 +147,19 @@ if ($action == 'setmod')
// TODO Verifier si module numerotation choisi peut etre active // TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated // par appel methode canBeActivated
dolibarr_set_const($db, "PROJECT_ADDON",$_GET["value"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "PROJECT_ADDON",$value,'chaine',0,'',$conf->entity);
} }
/* /*
* View * View
*/ */
$form=new Form($db); $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
llxHeader(); llxHeader();
$form=new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("ProjectsSetup"),$linkback,'setup'); print_fiche_titre($langs->trans("ProjectsSetup"),$linkback,'setup');
@ -182,9 +167,6 @@ print "<br>";
// Project numbering module // Project numbering module
$dir = DOL_DOCUMENT_ROOT."/core/modules/project/";
print_titre($langs->trans("ProjectsNumberingModules")); print_titre($langs->trans("ProjectsNumberingModules"));
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
@ -198,27 +180,34 @@ print "</tr>\n";
clearstatcache(); clearstatcache();
$handle = opendir($dir); foreach ($dirmodels as $reldir)
if (is_resource($handle))
{ {
$dir = dol_buildpath($reldir."core/modules/project/");
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
$var=true; $var=true;
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (substr($file, 0, 12) == 'mod_project_' && substr($file, dol_strlen($file)-3, 3) == 'php') if (preg_match('/^(mod_.*)\.php$/i',$file,$reg))
{ {
$file = substr($file, 0, dol_strlen($file)-4); $file = $reg[1];
$classname = substr($file,4);
require_once(DOL_DOCUMENT_ROOT ."/core/modules/project/".$file.".php"); require_once(DOL_DOCUMENT_ROOT ."/core/modules/project/".$file.".php");
$module = new $file; $module = new $file;
if ($module->isEnabled())
{
// Show modules according to features level // Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
{
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n"; print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
print $module->info(); print $module->info();
@ -233,13 +222,13 @@ if (is_resource($handle))
print '</td>'."\n"; print '</td>'."\n";
print '<td align="center">'; print '<td align="center">';
if ($conf->global->PROJECT_ADDON == "$file") if ($conf->global->PROJECT_ADDON == 'mod_'.$classname)
{ {
print img_picto($langs->trans("Activated"),'switch_on'); print img_picto($langs->trans("Activated"),'switch_on');
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value=mod_'.$classname.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
} }
print '</td>'; print '</td>';
@ -272,6 +261,8 @@ if (is_resource($handle))
} }
} }
closedir($handle); closedir($handle);
}
}
} }
print '</table><br>'; print '</table><br>';
@ -281,8 +272,6 @@ print '</table><br>';
* Modeles documents for projects * Modeles documents for projects
*/ */
$dir = DOL_DOCUMENT_ROOT.'/core/modules/project/pdf/';
print_titre($langs->trans("ProjectsModelModule")); print_titre($langs->trans("ProjectsModelModule"));
// Defini tableau def de modele // Defini tableau def de modele
@ -322,14 +311,19 @@ print "</tr>\n";
clearstatcache(); clearstatcache();
$handle=opendir($dir);
$var=true; $var=true;
if (is_resource($handle)) foreach ($dirmodels as $reldir)
{ {
$dir = dol_buildpath($reldir."core/modules/project/pdf/");
if (is_dir($dir))
{
$handle=opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_') if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_')
{ {
$name = substr($file, 4, dol_strlen($file) -16); $name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12); $classname = substr($file, 0, dol_strlen($file) -12);
@ -346,16 +340,9 @@ if (is_resource($handle))
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
//if ($conf->global->PROJECT_ADDON_PDF != "$name")
//{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'switch_on'); print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>'; print '</a>';
//}
//else
//{
// print img_picto($langs->trans("Enabled"),'on');
//}
print "</td>"; print "</td>";
} }
else else
@ -392,6 +379,8 @@ if (is_resource($handle))
} }
} }
closedir($handle); closedir($handle);
}
}
} }
print '</table><br/>'; print '</table><br/>';

View File

@ -23,9 +23,9 @@
*/ */
/** /**
* \file htdocs/admin/propale.php * \file htdocs/admin/propal.php
* \ingroup propale * \ingroup propale
* \brief Page d'administration/configuration du module Propale * \brief Setup page for commercial proposal module
*/ */
require("../main.inc.php"); require("../main.inc.php");
@ -37,8 +37,11 @@ $langs->load("errors");
if (! $user->admin) accessforbidden(); if (! $user->admin) accessforbidden();
$action =GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$value = GETPOST('value','alpha'); $value = GETPOST('value','alpha');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$type='propal';
/* /*
* Actions * Actions
@ -46,8 +49,8 @@ $value = GETPOST('value','alpha');
if ($action == 'updateMask') if ($action == 'updateMask')
{ {
$maskconstpropal=GETPOST("maskconstpropal"); $maskconstpropal=GETPOST('maskconstpropal','alpha');
$maskpropal=GETPOST("maskpropal"); $maskpropal=GETPOST('maskpropal','alpha');
if ($maskconstpropal) $res = dolibarr_set_const($db,$maskconstpropal,$maskpropal,'chaine',0,'',$conf->entity); if ($maskconstpropal) $res = dolibarr_set_const($db,$maskconstpropal,$maskpropal,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
@ -64,7 +67,7 @@ if ($action == 'updateMask')
if ($action == 'specimen') if ($action == 'specimen')
{ {
$modele=GETPOST("module"); $modele=GETPOST('module','alpha');
$propal = new Propal($db); $propal = new Propal($db);
$propal->initAsSpecimen(); $propal->initAsSpecimen();
@ -109,7 +112,7 @@ if ($action == 'specimen')
if ($action == 'set_PROPALE_DRAFT_WATERMARK') if ($action == 'set_PROPALE_DRAFT_WATERMARK')
{ {
$draft = GETPOST("PROPALE_DRAFT_WATERMARK"); $draft = GETPOST('PROPALE_DRAFT_WATERMARK','alpha');
$res = dolibarr_set_const($db, "PROPALE_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "PROPALE_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
@ -126,7 +129,7 @@ if ($action == 'set_PROPALE_DRAFT_WATERMARK')
if ($action == 'set_PROPALE_FREE_TEXT') if ($action == 'set_PROPALE_FREE_TEXT')
{ {
$freetext = GETPOST("PROPALE_FREE_TEXT"); $freetext = GETPOST('PROPALE_FREE_TEXT','alpha');
$res = dolibarr_set_const($db, "PROPALE_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "PROPALE_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
@ -183,26 +186,13 @@ if ($action == 'setclassifiedinvoiced')
if ($action == 'set') if ($action == 'set')
{ {
$label = GETPOST("label"); $ret = addDocumentModel($value, $type, $label, $scandir);
$scandir = GETPOST("scandir");
$type='propal';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")";
$resql=$db->query($sql);
} }
else if ($action == 'del') else if ($action == 'del')
{ {
$type='propal'; $ret = delDocumentModel($value, $type);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; if ($ret > 0)
$sql.= " WHERE nom = '".$db->escape($value)."'";
$sql.= " AND type = '".$type."'";
$sql.= " AND entity = ".$conf->entity;
if ($db->query($sql))
{ {
if ($conf->global->PROPALE_ADDON_PDF == "$value") dolibarr_del_const($db, 'PROPALE_ADDON_PDF',$conf->entity); if ($conf->global->PROPALE_ADDON_PDF == "$value") dolibarr_del_const($db, 'PROPALE_ADDON_PDF',$conf->entity);
} }
@ -210,37 +200,16 @@ else if ($action == 'del')
else if ($action == 'setdoc') else if ($action == 'setdoc')
{ {
$label = GETPOST("label");
$scandir = GETPOST("scandir");
$db->begin();
if (dolibarr_set_const($db, "PROPALE_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) if (dolibarr_set_const($db, "PROPALE_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{ {
$conf->global->PROPALE_ADDON_PDF = $value; $conf->global->PROPALE_ADDON_PDF = $value;
} }
// On active le modele // On active le modele
$type='propal'; $ret = delDocumentModel($value, $type);
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; if ($ret > 0)
$sql_del.= " WHERE nom = '".$db->escape($value)."'";
$sql_del.= " AND type = '".$type."'";
$sql_del.= " AND entity = ".$conf->entity;
$result1=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($value)."', '".$type."', ".$conf->entity.", ";
$sql.= ($value?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($value)?"'".$db->escape($scandir)."'":"null");
$sql.= ")";
$result2=$db->query($sql);
if ($result1 && $result2)
{ {
$db->commit(); $ret = addDocumentModel($value, $type, $label, $scandir);
}
else
{
$db->rollback();
} }
} }
@ -344,7 +313,7 @@ foreach ($dirmodels as $reldir)
// Info // Info
$htmltooltip=''; $htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$facture->type=0; $propal->type=0;
$nextval=$module->getNextValue($mysoc,$propal); $nextval=$module->getNextValue($mysoc,$propal);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
{ {

View File

@ -161,7 +161,7 @@ if ($action == 'edit')
{ {
$form=new Form($db); $form=new Form($db);
if (! count($listofmethods)) print '<div class="error">'.$langs->trans("NoSmsEngine").'</div>'; if (! count($listofmethods)) print '<div class="warning">'.$langs->trans("NoSmsEngine",'<a href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=sms_manager">DoliStore</a>').'</div>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -217,6 +217,8 @@ else
{ {
$var=true; $var=true;
if (! count($listofmethods)) print '<div class="warning">'.$langs->trans("NoSmsEngine",'<a href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=sms_manager">DoliStore</a>').'</div>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
@ -272,7 +274,7 @@ else
print '<a class="butActionRefused" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>'; print '<a class="butActionRefused" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>';
}*/ }*/
if (! empty($conf->global->MAIN_SMS_SENDMODE)) if (count($listofmethods) && ! empty($conf->global->MAIN_SMS_SENDMODE))
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&amp;mode=init">'.$langs->trans("DoTestSend").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&amp;mode=init">'.$langs->trans("DoTestSend").'</a>';
} }

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -31,7 +32,7 @@ $langs->load("stocks");
// Securit check // Securit check
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
$action = GETPOST("action"); $action = GETPOST('action','alpha');
/* /*
@ -41,7 +42,7 @@ $action = GETPOST("action");
if ($action == 'STOCK_USERSTOCK_AUTOCREATE') if ($action == 'STOCK_USERSTOCK_AUTOCREATE')
{ {
$db->begin(); $db->begin();
$res = dolibarr_set_const($db, "STOCK_USERSTOCK_AUTOCREATE", GETPOST("STOCK_USERSTOCK_AUTOCREATE"),'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "STOCK_USERSTOCK_AUTOCREATE", GETPOST('STOCK_USERSTOCK_AUTOCREATE','alpha'),'chaine',0,'',$conf->entity);
} }
// Mode of stock decrease // Mode of stock decrease
if ($action == 'STOCK_CALCULATE_ON_BILL' if ($action == 'STOCK_CALCULATE_ON_BILL'
@ -52,9 +53,9 @@ if ($action == 'STOCK_CALCULATE_ON_BILL'
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", '','chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", '','chaine',0,'',$conf->entity);
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", '','chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", '','chaine',0,'',$conf->entity);
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", '','chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", '','chaine',0,'',$conf->entity);
if ($action == 'STOCK_CALCULATE_ON_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", GETPOST("STOCK_CALCULATE_ON_BILL"),'chaine',0,'',$conf->entity); if ($action == 'STOCK_CALCULATE_ON_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", GETPOST('STOCK_CALCULATE_ON_BILL','alpha'),'chaine',0,'',$conf->entity);
if ($action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", GETPOST("STOCK_CALCULATE_ON_VALIDATE_ORDER"),'chaine',0,'',$conf->entity); if ($action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity);
if ($action == 'STOCK_CALCULATE_ON_SHIPMENT') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", GETPOST("STOCK_CALCULATE_ON_SHIPMENT"),'chaine',0,'',$conf->entity); if ($action == 'STOCK_CALCULATE_ON_SHIPMENT') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", GETPOST('STOCK_CALCULATE_ON_SHIPMENT','alpha'),'chaine',0,'',$conf->entity);
} }
// Mode of stock increase // Mode of stock increase
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL' if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL'
@ -65,9 +66,9 @@ if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL'
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", '','chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", '','chaine',0,'',$conf->entity);
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", '','chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", '','chaine',0,'',$conf->entity);
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", '','chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", '','chaine',0,'',$conf->entity);
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", GETPOST("STOCK_CALCULATE_ON_SUPPLIER_BILL"),'chaine',0,'',$conf->entity); if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_BILL','alpha'),'chaine',0,'',$conf->entity);
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", GETPOST("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER"),'chaine',0,'',$conf->entity); if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity);
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", GETPOST("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER"),'chaine',0,'',$conf->entity); if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER','alpha'),'chaine',0,'',$conf->entity);
} }
if($action) if($action)

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* *
@ -47,7 +47,7 @@ print '<ul>';
print '<li>'.DOL_VERSION.' / <a href="http://www.gnu.org/copyleft/gpl.html">GNU-GPL</a></li>'; print '<li>'.DOL_VERSION.' / <a href="http://www.gnu.org/copyleft/gpl.html">GNU-GPL</a></li>';
print '</ul>'; print '</ul>';
print "<br>\n"; //print "<br>\n";
print $langs->trans("Developpers").':'; print $langs->trans("Developpers").':';
print '<ul>'; print '<ul>';
@ -55,37 +55,37 @@ print '<li>'.$langs->trans("SeeWikiForAllTeam").': <a href="http://wiki.dolibarr
print '<li>'.$langs->trans("DoliForge").': <a href="http://www.doliforge.org" target="_blank">http://wwww.doliforge.org</a></li>'; print '<li>'.$langs->trans("DoliForge").': <a href="http://www.doliforge.org" target="_blank">http://wwww.doliforge.org</a></li>';
print '</ul>'; print '</ul>';
print "<br>\n"; //print "<br>\n";
print $langs->trans("OtherInformations").':'; print $langs->trans("OtherInformations").':';
print '<ul>'; print '<ul>';
print '<li>'; print '<li>';
print '<a target="blank" href="http://www.dolibarr.org/">'.$langs->trans("OfficialWebSite").'</a>'; print '<a target="_blank" href="http://www.dolibarr.org/">'.$langs->trans("OfficialWebSite").'</a>';
print '</li>'; print '</li>';
// If the French language, it displays French website // If the French language, it displays French website
if (preg_match('/^fr_/i',$langs->getDefaultLang())) if (preg_match('/^fr_/i',$langs->getDefaultLang()))
{ {
print '<li>'; print '<li>';
print '<a target="blank" href="http://www.dolibarr.fr/">'.$langs->trans("OfficialWebSiteFr").'</a>'; print '<a target="_blank" href="http://www.dolibarr.fr/">'.$langs->trans("OfficialWebSiteFr").'</a>';
print '</li>'; print '</li>';
} }
print '<li>'; print '<li>';
print '<a target="blank" href="http://wiki.dolibarr.org/">'.$langs->trans("OfficialWiki").'</a>'; print '<a target="_blank" href="http://wiki.dolibarr.org/">'.$langs->trans("OfficialWiki").'</a>';
print '</li>'; print '</li>';
print '</ul>'; print '</ul>';
print $langs->trans("Demo").':'; print $langs->trans("Demo").':';
print '<ul>'; print '<ul>';
print '<li>'; print '<li>';
print '<a target="blank" href="http://www.dolibarr.org/onlinedemo/">'.$langs->trans("OfficialDemo").'</a>'; print '<a target="_blank" href="http://www.dolibarr.org/onlinedemo/">'.$langs->trans("OfficialDemo").'</a>';
print '</li>'; print '</li>';
print '</ul>'; print '</ul>';
print $langs->trans("ModulesMarketPlaces").':'; print $langs->trans("ModulesMarketPlaces").':';
print '<ul>'; print '<ul>';
print '<li>'; print '<li>';
print '<a target="blank" href="http://www.dolistore.com">'.$langs->trans("OfficialMarketPlace").'</a>'; print '<a target="_blank" href="http://www.dolistore.com">'.$langs->trans("OfficialMarketPlace").'</a>';
print '</li>'; print '</li>';
print '</ul>'; print '</ul>';
@ -103,7 +103,24 @@ print $langs->trans("Foundation").':<br>';
print '<ul>'; print '<ul>';
$url='http://wiki.dolibarr.org/index.php/Subscribe'; $url='http://wiki.dolibarr.org/index.php/Subscribe';
if (preg_match('/^fr_/i',$langs->getDefaultLang())) $url='http://wiki.dolibarr.org/index.php/Adh%C3%A9rer'; if (preg_match('/^fr_/i',$langs->getDefaultLang())) $url='http://wiki.dolibarr.org/index.php/Adh%C3%A9rer';
print '<li><a href="'.$url.'">'.$langs->trans("SubscribeToFoundation").'</a></li>'; if (preg_match('/^es_/i',$langs->getDefaultLang())) $url='http://wiki.dolibarr.org/index.php/Subscribirse';
print '<li><a href="'.$url.'" target="_blank">'.$langs->trans("SubscribeToFoundation").'</a></li>';
print '</ul>';
print $langs->trans("OfficialWebHostingService");
$url='http://www.dolicloud.com'; $title='DoliCloud';
print '<ul>';
print '<li>';
print '<a target="_blank" href="'.$url.'">'.$title.'</a>';
print '</li>';
if (preg_match('/^fr_/i',$langs->getDefaultLang()))
{
$url='http://www.dolibox.fr'; $title='DoliBox';
print '<li>';
print '<a target="_blank" href="'.$url.'">'.$title.'</a>';
print '</li>';
}
print '</ul>'; print '</ul>';

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2009-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -24,8 +24,7 @@ require("../../main.inc.php");
$langs->load("admin"); $langs->load("admin");
if (!$user->admin) if (!$user->admin) accessforbidden();
accessforbidden();
$action=GETPOST('action'); $action=GETPOST('action');
@ -49,8 +48,17 @@ if (!function_exists('xcache_info'))
} }
print 'Opcode cache XCache is on<br>'."\n"; print 'Opcode cache XCache is on<br><br>'."\n\n";
print $langs->trans("Split").': '.ini_get('xcache.count').' &nbsp; &nbsp; &nbsp; '.$langs->trans("Recommanded").': (cat /proc/cpuinfo | grep -c processor) + 1<br>'."\n";
print $langs->trans("Size").': '.ini_get('xcache.size').' &nbsp; &nbsp; &nbsp; '.$langs->trans("Recommanded").': 16*Split<br>'."\n";
print $langs->trans("xcache.cacher").': '.yn(ini_get('xcache.cacher')).'<br>'."\n";
print $langs->trans("xcache.optimizer").': '.yn(ini_get('xcache.optimizer')).' (will be usefull only with xcache v2)<br>'."\n";
print $langs->trans("xcache.stat").': '.yn(ini_get('xcache.stat')).'<br>'."\n";
print $langs->trans("xcache.coverager").': '.yn(ini_get('xcache.coverager')).'<br>'."\n";
//print xcache_get();
/* /*
$cacheinfos = array(); $cacheinfos = array();
for ($i = 0; $i < 10; $i ++) for ($i = 0; $i < 10; $i ++)
@ -69,4 +77,6 @@ if ($action == 'clear')
*/ */
llxFooter(); llxFooter();
$db->close();
?> ?>

View File

@ -1,19 +1,19 @@
<?php <?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2009-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** /**
* \file htdocs/admin/system/xdebug.php * \file htdocs/admin/system/xdebug.php
@ -25,11 +25,11 @@ require("../../main.inc.php");
$langs->load("admin"); $langs->load("admin");
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
/* /*
* View * View
*/ */
llxHeader(); llxHeader();
@ -72,10 +72,16 @@ if (function_exists('socket_create'))
xdebug.remote_handle=dbgp<br> xdebug.remote_handle=dbgp<br>
xdebug.remote_host=localhost<br> xdebug.remote_host=localhost<br>
xdebug.remote_port=9000<br> xdebug.remote_port=9000<br>
xdebug.profiler_enable=1<br> xdebug.profiler_enable=0<br>
xdebug.profiler_enable_trigger=1<br>
xdebug.show_local_vars=off<br> xdebug.show_local_vars=off<br>
xdebug.profiler_output_dir=/tmp/xdebug<br> xdebug.profiler_output_dir=/tmp/xdebug<br>
xdebug.profiler_append=0<br> xdebug.profiler_append=0<br>
<br>
xdebug.trace_enable_trigger=1<br>
xdebug.show_mem_delta=1<br>
xdebug.trace_output_dir=/tmp/trace<br>
xdebug.auto_trace=0<br>
'."\n"; '."\n";
print "<br>\n"; print "<br>\n";
echo 'Then check in your debug server (Eclipse), you have setup:<br> echo 'Then check in your debug server (Eclipse), you have setup:<br>
@ -90,7 +96,6 @@ if (function_exists('socket_create'))
echo "Failed to connect to address=".$address." port=".$port."<br>\n"; echo "Failed to connect to address=".$address." port=".$port."<br>\n";
echo "There is no Remote debug server at this address.\n"; echo "There is no Remote debug server at this address.\n";
} }
socket_close($client);
socket_close($socket); socket_close($socket);
} }
else else
@ -100,4 +105,6 @@ else
llxFooter(); llxFooter();
$db->close();
?> ?>

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -31,7 +31,7 @@ $langs->load('admin');
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
$action = GETPOST("action"); $action = GETPOST('action','alpha');
/* /*
* Actions * Actions
@ -53,7 +53,7 @@ $tax_mode = empty($conf->global->TAX_MODE)?0:$conf->global->TAX_MODE;
if ($action == 'settaxmode') if ($action == 'settaxmode')
{ {
$tax_mode = GETPOST("tax_mode"); $tax_mode = GETPOST('tax_mode','alpha');
$db->begin(); $db->begin();

View File

@ -28,13 +28,13 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
$langs->load("admin"); $langs->load("admin");
$action=GETPOST('action'); $action=GETPOST('action','alpha');
$what=GETPOST("what"); $what=GETPOST('what','alpha');
$export_type=GETPOST("export_type"); $export_type=GETPOST('export_type','alpha');
$file=GETPOST('filename_template'); $file=GETPOST('filename_template','alpha');
$sortfield = GETPOST("sortfield"); $sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST("sortorder"); $sortorder = GETPOST('sortorder','alpha');
$page = GETPOST("page"); $page = GETPOST("page");
if (! $sortorder) $sortorder="DESC"; if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="date"; if (! $sortfield) $sortfield="date";
@ -102,7 +102,7 @@ $time_start = time();
// MYSQL // MYSQL
if ($what == 'mysql') if ($what == 'mysql')
{ {
$cmddump=$_POST["mysqldump"]; $cmddump=GETPOST("mysqldump"); // Do not sanitize here with 'alpha', will be sanitize later by escapeshellarg
if ($cmddump) if ($cmddump)
{ {
dolibarr_set_const($db, 'SYSTEMTOOLS_MYSQLDUMP', $cmddump,'chaine',0,'',$conf->entity); dolibarr_set_const($db, 'SYSTEMTOOLS_MYSQLDUMP', $cmddump,'chaine',0,'',$conf->entity);
@ -111,7 +111,7 @@ if ($what == 'mysql')
$outputdir = $conf->admin->dir_output.'/backup'; $outputdir = $conf->admin->dir_output.'/backup';
$outputfile = $outputdir.'/'.$file; $outputfile = $outputdir.'/'.$file;
// for compression format, we add extension // for compression format, we add extension
$compression=isset($_POST['compression']) ? $_POST['compression'] : 'none'; $compression=GETPOST('compression') ? GETPOST('compression','alpha') : 'none';
if ($compression == 'gz') $outputfile.='.gz'; if ($compression == 'gz') $outputfile.='.gz';
if ($compression == 'bz') $outputfile.='.bz2'; if ($compression == 'bz') $outputfile.='.bz2';
$outputerror = $outputfile.'.err'; $outputerror = $outputfile.'.err';
@ -125,28 +125,28 @@ if ($what == 'mysql')
$param=$dolibarr_main_db_name." -h ".$dolibarr_main_db_host; $param=$dolibarr_main_db_name." -h ".$dolibarr_main_db_host;
$param.=" -u ".$dolibarr_main_db_user; $param.=" -u ".$dolibarr_main_db_user;
if (! empty($dolibarr_main_db_port)) $param.=" -P ".$dolibarr_main_db_port; if (! empty($dolibarr_main_db_port)) $param.=" -P ".$dolibarr_main_db_port;
if (! $_POST["use_transaction"]) $param.=" -l --single-transaction"; if (! GETPOST("use_transaction")) $param.=" -l --single-transaction";
if ($_POST["disable_fk"]) $param.=" -K"; if (GETPOST("disable_fk")) $param.=" -K";
if ($_POST["sql_compat"] && $_POST["sql_compat"] != 'NONE') $param.=" --compatible=".$_POST["sql_compat"]; if (GETPOST("sql_compat") && GETPOST("sql_compat") != 'NONE') $param.=" --compatible=".escapeshellarg(GETPOST("sql_compat","alpha"));
if ($_POST["drop_database"]) $param.=" --add-drop-database"; if (GETPOST("drop_database")) $param.=" --add-drop-database";
if ($_POST["sql_structure"]) if (GETPOST("sql_structure"))
{ {
if ($_POST["drop"]) $param.=" --add-drop-table"; if (GETPOST("drop")) $param.=" --add-drop-table";
} }
else else
{ {
$param.=" -t"; $param.=" -t";
} }
if ($_POST["disable-add-locks"]) $param.=" --add-locks=FALSE"; if (GETPOST("disable-add-locks")) $param.=" --add-locks=FALSE";
if ($_POST["sql_data"]) if (GETPOST("sql_data"))
{ {
$param.=" --tables"; $param.=" --tables";
if ($_POST["showcolumns"]) $param.=" -c"; if (GETPOST("showcolumns")) $param.=" -c";
if ($_POST["extended_ins"]) $param.=" -e"; if (GETPOST("extended_ins")) $param.=" -e";
else $param.=" --skip-extended-insert"; else $param.=" --skip-extended-insert";
if ($_POST["delayed"]) $param.=" --delayed-insert"; if (GETPOST("delayed")) $param.=" --delayed-insert";
if ($_POST["sql_ignore"]) $param.=" --insert-ignore"; if (GETPOST("sql_ignore")) $param.=" --insert-ignore";
if ($_POST["hexforbinary"]) $param.=" --hex-blob"; if (GETPOST("hexforbinary")) $param.=" --hex-blob";
} }
else else
{ {
@ -244,7 +244,7 @@ if ($what == 'mysqlnobin')
$outputfile = $outputdir.'/'.$file; $outputfile = $outputdir.'/'.$file;
$outputfiletemp = $outputfile.'-TMP.sql'; $outputfiletemp = $outputfile.'-TMP.sql';
// for compression format, we add extension // for compression format, we add extension
$compression=isset($_POST['compression']) ? $_POST['compression'] : 'none'; $compression=GETPOST('compression') ? GETPOST('compression','alpha') : 'none';
if ($compression == 'gz') $outputfile.='.gz'; if ($compression == 'gz') $outputfile.='.gz';
if ($compression == 'bz') $outputfile.='.bz2'; if ($compression == 'bz') $outputfile.='.bz2';
$outputerror = $outputfile.'.err'; $outputerror = $outputfile.'.err';
@ -265,7 +265,7 @@ if ($what == 'mysqlnobin')
// POSTGRESQL // POSTGRESQL
if ($what == 'postgresql') if ($what == 'postgresql')
{ {
$cmddump=$_POST["postgresqldump"]; $cmddump=GETPOST("postgresqldump"); // Do not sanitize here with 'alpha', will be sanitize later by escapeshellarg
if ($cmddump) if ($cmddump)
{ {
dolibarr_set_const($db, 'SYSTEMTOOLS_POSTGRESQLDUMP', $cmddump,'chaine',0,'',$conf->entity); dolibarr_set_const($db, 'SYSTEMTOOLS_POSTGRESQLDUMP', $cmddump,'chaine',0,'',$conf->entity);
@ -274,7 +274,7 @@ if ($what == 'postgresql')
$outputdir = $conf->admin->dir_output.'/backup'; $outputdir = $conf->admin->dir_output.'/backup';
$outputfile = $outputdir.'/'.$file; $outputfile = $outputdir.'/'.$file;
// for compression format, we add extension // for compression format, we add extension
$compression=isset($_POST['compression']) ? $_POST['compression'] : 'none'; $compression=GETPOST('compression') ? GETPOST('compression','alpha') : 'none';
if ($compression == 'gz') $outputfile.='.gz'; if ($compression == 'gz') $outputfile.='.gz';
if ($compression == 'bz') $outputfile.='.bz2'; if ($compression == 'bz') $outputfile.='.bz2';
$outputerror = $outputfile.'.err'; $outputerror = $outputfile.'.err';
@ -288,17 +288,17 @@ if ($what == 'postgresql')
$param=" --no-tablespaces --inserts -h ".$dolibarr_main_db_host; $param=" --no-tablespaces --inserts -h ".$dolibarr_main_db_host;
$param.=" -U ".$dolibarr_main_db_user; $param.=" -U ".$dolibarr_main_db_user;
if (! empty($dolibarr_main_db_port)) $param.=" -p ".$dolibarr_main_db_port; if (! empty($dolibarr_main_db_port)) $param.=" -p ".$dolibarr_main_db_port;
if ($_POST["sql_compat"] && $_POST["sql_compat"] == 'ANSI') $param.=" --disable-dollar-quoting"; if (GETPOST("sql_compat") && GETPOST("sql_compat") == 'ANSI') $param.=" --disable-dollar-quoting";
if ($_POST["drop_database"]) $param.=" -c -C"; if (GETPOST("drop_database")) $param.=" -c -C";
if ($_POST["sql_structure"]) if (GETPOST("sql_structure"))
{ {
if ($_POST["drop"]) $param.=" --add-drop-table"; if (GETPOST("drop")) $param.=" --add-drop-table";
if (empty($_POST["sql_data"])) $param.=" -s"; if (! GETPOST("sql_data")) $param.=" -s";
} }
if ($_POST["sql_data"]) if (GETPOST("sql_data"))
{ {
if (empty($_POST["sql_structure"])) $param.=" -a"; if (! GETPOST("sql_structure")) $param.=" -a";
if ($_POST["showcolumns"]) $param.=" -c"; if (GETPOST("showcolumns")) $param.=" -c";
} }
$param.=' -f "'.$outputfile.'"'; $param.=' -f "'.$outputfile.'"';
//if ($compression == 'none') //if ($compression == 'none')

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -167,10 +167,11 @@ if (preg_match('/^confirm/i',$choice))
{ {
print '<br>'; print '<br>';
$formquestion=array(); $formquestion=array();
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?choice=allfiles',$langs->trans('Purge'),$langs->trans('ConfirmPurge').' '.img_warning(),'purge',$formquestion,'no',2); print $form->formconfirm($_SERVER["PHP_SELF"].'?choice=allfiles', $langs->trans('Purge'), $langs->trans('ConfirmPurge').' '.img_warning(), 'purge', $formquestion, 'no', 2);
if ($ret == 'html') print '<br>';
} }
llxFooter(); llxFooter();
$db->close();
?> ?>

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,7 +30,7 @@ $langs->load("other");
if (! $user->admin) accessforbidden(); if (! $user->admin) accessforbidden();
if ($_GET["msg"]) $message='<div class="error">'.$_GET["msg"].'</div>'; if (GETPOST('msg','alpha')) $message='<div class="error">'.GETPOST('msg','alpha').'</div>';
$urldolibarr='http://www.dolibarr.org/downloads/'; $urldolibarr='http://www.dolibarr.org/downloads/';
@ -39,13 +40,13 @@ $urldolibarrmodules='http://www.dolistore.com/';
$urldolibarrthemes='http://www.dolistore.com/'; $urldolibarrthemes='http://www.dolistore.com/';
$dolibarrroot=preg_replace('/([\\/]+)$/i','',DOL_DOCUMENT_ROOT); $dolibarrroot=preg_replace('/([\\/]+)$/i','',DOL_DOCUMENT_ROOT);
$dolibarrroot=preg_replace('/([^\\/]+)$/i','',$dolibarrroot); $dolibarrroot=preg_replace('/([^\\/]+)$/i','',$dolibarrroot);
$dolibarrdataroot=preg_replace('/([\\/]+)$/i','',DOL_DATA_ROOT);
/* /*
* Actions * Actions
*/ */
if ($_POST["action"]=='install') if (GETPOST('action','alpha')=='install')
{ {
$error=0; $error=0;
@ -59,7 +60,7 @@ if ($_POST["action"]=='install')
} }
else else
{ {
if (! preg_match('/\.tgz/i',$original_file)) if (! preg_match('/\.tgz/i',$original_file) && ! preg_match('/\.zip/i',$original_file))
{ {
$mesg=$langs->trans("ErrorFileMustBeADolibarrPackage"); $mesg=$langs->trans("ErrorFileMustBeADolibarrPackage");
$error++; $error++;
@ -71,19 +72,50 @@ if ($_POST["action"]=='install')
@dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file); @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file);
dol_mkdir($conf->admin->dir_temp.'/'.$original_file); dol_mkdir($conf->admin->dir_temp.'/'.$original_file);
$result=dol_move_uploaded_file($_FILES["fileinstall"]["tmp_name"],$newfile,1,0,$_FILES['fileinstall']['error']); $result=dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'],$newfile,1,0,$_FILES['fileinstall']['error']);
if ($result > 0) if ($result > 0)
{ {
//dol_uncompress($newfile); $documentrootalt=DOL_DOCUMENT_ROOT_ALT;
$result=dol_uncompress($newfile,$_FILES['fileinstall']['type'],$documentrootalt);
if (! empty($result['error']))
{
if ($result['error'] == -1)
{
$langs->load("errors");
$mesg = '<div class="error">'.$langs->trans("ErrorBadFileFormat").'</div>';
}
elseif ($result['error'] == -2)
{
$langs->load("errors");
$mesg = '<div class="error">'.$langs->trans("ErrorOSSystem").'</div>';
}
elseif ($result['error'] == -3)
{
$langs->load("errors");
$mesg = '<div class="warning">'.$langs->trans("ErrorUncompFile",$_FILES['fileinstall']['name']).'</div>';
}
elseif ($result['error'] == -4)
{
$langs->load("errors");
$mesg = '<div class="error">'.$langs->trans("ErrorUncompFile",$_FILES['fileinstall']['name']).'</div>';
}
}
else
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupIsReadyForUse")."</font>";
}
} }
} }
} }
/* /*
* View * View
*/ */
$dirins=DOL_DOCUMENT_ROOT_ALT;
$vale=(is_dir($dirins));
$system=PHP_OS;
$wikihelp='EN:Installation_-_Upgrade|FR:Installation_-_Mise_à_jour|ES:Instalaci&omodulon_-_Actualizaci&omodulon'; $wikihelp='EN:Installation_-_Upgrade|FR:Installation_-_Mise_à_jour|ES:Instalaci&omodulon_-_Actualizaci&omodulon';
llxHeader('',$langs->trans("Upgrade"),$wikihelp); llxHeader('',$langs->trans("Upgrade"),$wikihelp);
@ -93,10 +125,8 @@ print $langs->trans("CurrentVersion").' : <b>'.DOL_VERSION.'</b><br>';
print $langs->trans("LastStableVersion").' : <b>'.$langs->trans("FeatureNotYetAvailable").'</b><br>'; print $langs->trans("LastStableVersion").' : <b>'.$langs->trans("FeatureNotYetAvailable").'</b><br>';
print '<br>'; print '<br>';
if ($mesg) //dol_htmloutput_errors($mesg);
{ dol_htmloutput_mesg($mesg);
print '<div class="error">'.$mesg.'</div><br>';
}
print $langs->trans("Upgrade").'<br>'; print $langs->trans("Upgrade").'<br>';
print '<hr>'; print '<hr>';
@ -107,12 +137,12 @@ print $langs->trans("DownloadPackageFromWebSite",$fullurl).'<br>';
print '<b>'.$langs->trans("StepNb",2).'</b>: '; print '<b>'.$langs->trans("StepNb",2).'</b>: ';
print $langs->trans("UnpackPackageInDolibarrRoot",$dolibarrroot).'<br>'; print $langs->trans("UnpackPackageInDolibarrRoot",$dolibarrroot).'<br>';
print '<b>'.$langs->trans("StepNb",3).'</b>: '; print '<b>'.$langs->trans("StepNb",3).'</b>: ';
print $langs->trans("RemoveLock",$dolibarrroot.'install.lock').'<br>'; print $langs->trans("RemoveLock",$dolibarrdataroot.'/install.lock').'<br>';
print '<b>'.$langs->trans("StepNb",4).'</b>: '; print '<b>'.$langs->trans("StepNb",4).'</b>: ';
$fullurl='<a href="'.DOL_URL_ROOT.'/install/" target="_blank">'.DOL_URL_ROOT.'/install/</a>'; $fullurl='<a href="'.DOL_URL_ROOT.'/install/" target="_blank">'.DOL_URL_ROOT.'/install/</a>';
print $langs->trans("CallUpdatePage",$fullurl).'<br>'; print $langs->trans("CallUpdatePage",$fullurl).'<br>';
print '<b>'.$langs->trans("StepNb",5).'</b>: '; print '<b>'.$langs->trans("StepNb",5).'</b>: ';
print $langs->trans("RestoreLock",$dolibarrroot.'install.lock').'<br>'; print $langs->trans("RestoreLock",$dolibarrdataroot.'/install.lock').'<br>';
print '<br>'; print '<br>';
print '<br>'; print '<br>';
@ -129,16 +159,43 @@ print '<b>'.$langs->trans("StepNb",3).'</b>: ';
print $langs->trans("UnpackPackageInDolibarrRoot",$dolibarrroot).'<br>'; print $langs->trans("UnpackPackageInDolibarrRoot",$dolibarrroot).'<br>';
if (! empty($conf->global->MAIN_ONLINE_INSTALL_MODULE)) if (! empty($conf->global->MAIN_ONLINE_INSTALL_MODULE))
{ {
if ($vale == 1 && $dirins != 'DOL_DOCUMENT_ROOT_ALT' && ($system=="Linux" || $system=="Darwin"))
{
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">'; print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
print '<input type="hidden" name="action" value="install">'; print '<input type="hidden" name="action" value="install">';
print $langs->trans("YouCanSubmitFile").' <input type="file" name="fileinstall"> '; print $langs->trans("YouCanSubmitFile").' <input type="file" name="fileinstall"> ';
print '<input type="submit" name="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">'; print '<input type="submit" name="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">';
print '</form>'; print '</form>';
}
elseif ($system!='Linux')
{
$langs->load('errors');
$message=info_admin($langs->transnoentities("ErrorOSSystem"));
print $message;
}
else
{
$message=info_admin($langs->trans("NotExistsDirect").$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
print $message;
}
}
else
{
print '<b>'.$langs->trans("StepNb",4).'</b>: ';
print $langs->trans("SetupIsReadyForUse").'<br>';
} }
print '<b>'.$langs->trans("StepNb",4).'</b>: ';
print $langs->trans("SetupIsReadyForUse").'<br>';
print '</form>'; print '</form>';
if (! empty($result['return']))
{
print '<br>';
foreach($result['return'] as $value)
{
echo $value.'<br>';
}
}
llxFooter(); llxFooter();
$db->close();
?> ?>

View File

@ -77,10 +77,37 @@ print "</tr>\n";
clearstatcache(); clearstatcache();
$workflowcodes=array(); $workflowcodes=array();
if ($conf->propal->enabled && $conf->commande->enabled) $workflowcodes['WORKFLOW_PROPAL_AUTOCREATE_ORDER']='WORKFLOW_PROPAL_AUTOCREATE_ORDER'; $workflow=array(
//if ($conf->propal->enabled && $conf->facture->enabled) $workflowcodes['WORKFLOW_PROPAL_AUTOCREATE_INVOICE']='WORKFLOW_PROPAL_AUTOCREATE_INVOICE'; 'order' => array(
//if ($conf->contrat->enabled && $conf->facture->enabled) $workflowcodes['WORKFLOW_CONTRACT_AUTOCREATE_INVOICE']='WORKFLOW_CONTRACT_AUTOCREATE_INVOICE'; 'propal' => array('WORKFLOW_PROPAL_AUTOCREATE_ORDER')
if ($conf->commande->enabled && $conf->facture->enabled) $workflowcodes['WORKFLOW_ORDER_AUTOCREATE_INVOICE']='WORKFLOW_ORDER_AUTOCREATE_INVOICE'; ),
'invoice' => array (
'order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')
//,'contract' => array('WORKFLOW_CONTRACT_AUTOCREATE_INVOICE')
//, 'propal' => array('WORKFLOW_PROPAL_AUTOCREATE_INVOICE')
)
);
if (! empty($conf->modules_parts['workflow'])) $workflow = array_merge($workflow, $conf->modules_parts['workflow']);
foreach($workflow as $child => $parents)
{
if ($conf->$child->enabled)
{
$langs->Load($child.'@'.$child);
foreach($parents as $parent => $actions)
{
if ($conf->$parent->enabled)
{
foreach($actions as $action)
{
$workflowcodes[$action] = $action;
}
}
}
}
}
if (count($workflowcodes) > 0) if (count($workflowcodes) > 0)
{ {

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.org> * Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.org>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -30,11 +30,11 @@ $langs->load("admin");
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
$action=GETPOST("action"); $action=GETPOST('action','alpha');
if ($action == 'setvalue') if ($action == 'setvalue')
{ {
$showmenu = GETPOST("BOOKMARKS_SHOW_IN_MENU"); $showmenu = GETPOST('BOOKMARKS_SHOW_IN_MENU','alpha');
$res = dolibarr_set_const($db, "BOOKMARKS_SHOW_IN_MENU",$showmenu,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "BOOKMARKS_SHOW_IN_MENU",$showmenu,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
@ -53,8 +53,7 @@ if ($action == 'setvalue')
/* /*
* * View
*
*/ */
llxHeader(); llxHeader();

View File

@ -102,6 +102,8 @@ class Bookmark
$this->title=trim($this->title); $this->title=trim($this->title);
if (empty($this->position)) $this->position=0; if (empty($this->position)) $this->position=0;
$now=dol_now();
$this->db->begin(); $this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_user,dateb,url,target"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_user,dateb,url,target";
@ -109,7 +111,7 @@ class Bookmark
if ($this->fk_soc) $sql.=",fk_soc"; if ($this->fk_soc) $sql.=",fk_soc";
$sql.= ") VALUES ("; $sql.= ") VALUES (";
$sql.= ($this->fk_user > 0?"'".$this->fk_user."'":"0").","; $sql.= ($this->fk_user > 0?"'".$this->fk_user."'":"0").",";
$sql.= " ".$this->db->idate(gmmktime()).","; $sql.= " ".$this->db->idate($now).",";
$sql.= " '".$this->url."', '".$this->target."',"; $sql.= " '".$this->url."', '".$this->target."',";
$sql.= " '".$this->db->escape($this->title)."', '".$this->favicon."', '".$this->position."'"; $sql.= " '".$this->db->escape($this->title)."', '".$this->favicon."', '".$this->position."'";
if ($this->fk_soc) $sql.=",".$this->fk_soc; if ($this->fk_soc) $sql.=",".$this->fk_soc;

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -39,17 +40,17 @@ if (!$user->admin) accessforbidden();
* Actions * Actions
*/ */
if ($_POST["save"]) if (GETPOST('save','alpha'))
{ {
$db->begin(); $db->begin();
$i=0; $i=0;
$i+=dolibarr_set_const($db,'OSC_DB_HOST',trim($_POST["oscommerce_dbhost"]),'chaine',0,'',$conf->entity); $i+=dolibarr_set_const($db,'OSC_DB_HOST',trim(GETPOST('oscommerce_dbhost','alpha')),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'OSC_DB_NAME',trim($_POST["oscommerce_dbname"]),'chaine',0,'',$conf->entity); $i+=dolibarr_set_const($db,'OSC_DB_NAME',trim(GETPOST('oscommerce_dbname','alpha')),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'OSC_DB_USER',trim($_POST["oscommerce_dbuser"]),'chaine',0,'',$conf->entity); $i+=dolibarr_set_const($db,'OSC_DB_USER',trim(GETPOST('oscommerce_dbuser','alpha')),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'OSC_DB_PASS',trim($_POST["oscommerce_dbpass"]),'chaine',0,'',$conf->entity); $i+=dolibarr_set_const($db,'OSC_DB_PASS',trim(GETPOST('oscommerce_dbpass','alpha')),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'OSC_DB_TABLE_PREFIX',trim($_POST["oscommerce_db_table_prefix"]),'chaine',0,'',$conf->entity); $i+=dolibarr_set_const($db,'OSC_DB_TABLE_PREFIX',trim(GETPOST('oscommerce_db_table_prefix','alpha')),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'OSC_LANGUAGE_ID',1,'chaine',0,'',$conf->entity); $i+=dolibarr_set_const($db,'OSC_LANGUAGE_ID',1,'chaine',0,'',$conf->entity);
if ($i >= 4) if ($i >= 4)
@ -64,18 +65,18 @@ if ($_POST["save"])
exit; exit;
} }
} }
elseif ($_POST["test"]) elseif (GETPOST('test','alpha'))
{ {
//$resql=$db->query("select count(*) from ".MAIN_DB_PREFIX."const"); //$resql=$db->query("select count(*) from ".MAIN_DB_PREFIX."const");
//print "< ".$db." - ".$db->db." - ".$resql." - ".$db->error()."><br>\n"; //print "< ".$db." - ".$db->db." - ".$resql." - ".$db->error()."><br>\n";
// Test de la connexion a la database webcalendar // Test de la connexion a la database webcalendar
$conf->oscommerce->db->type=$dolibarr_main_db_type; $conf->oscommerce->db->type=$dolibarr_main_db_type;
$conf->oscommerce->db->host=$_POST["oscommerce_dbhost"]; $conf->oscommerce->db->host=GETPOST('oscommerce_dbhost','alpha');
$conf->oscommerce->db->port=$_POST["oscommerce_dbport"]; $conf->oscommerce->db->port=GETPOST('oscommerce_dbport','alpha');
$conf->oscommerce->db->name=$_POST["oscommerce_dbname"]; $conf->oscommerce->db->name=GETPOST('oscommerce_dbname','alpha');
$conf->oscommerce->db->user=$_POST["oscommerce_dbuser"]; $conf->oscommerce->db->user=GETPOST('oscommerce_dbuser','alpha');
$conf->oscommerce->db->pass=$_POST["oscommerce_dbpass"]; $conf->oscommerce->db->pass=GETPOST('oscommerce_dbpass','alpha');
$oscommercedb=getDoliDBInstance($conf->oscommerce->db->type,$conf->oscommerce->db->host,$conf->oscommerce->db->user,$conf->oscommerce->db->pass,$conf->oscommerce->db->name,$conf->oscommerce->db->port); $oscommercedb=getDoliDBInstance($conf->oscommerce->db->type,$conf->oscommerce->db->host,$conf->oscommerce->db->user,$conf->oscommerce->db->pass,$conf->oscommerce->db->name,$conf->oscommerce->db->port);
@ -87,11 +88,11 @@ elseif ($_POST["test"])
$sql.=" WHERE configuration_key='STORE_NAME'"; $sql.=" WHERE configuration_key='STORE_NAME'";
$resql=$oscommercedb->query($sql); $resql=$oscommercedb->query($sql);
if ($resql) { if ($resql) {
$mesg ="<div class=\"ok\">".$langs->trans("OSCommerceTestOk",$_POST["oscommerce_dbhost"],$_POST["oscommerce_dbname"],$_POST["oscommerce_dbuser"]); $mesg ="<div class=\"ok\">".$langs->trans("OSCommerceTestOk",GETPOST('oscommerce_dbhost','alpha'),GETPOST('oscommerce_dbname','alpha'),GETPOST('oscommerce_dbuser','alpha'));
$mesg.="</div>"; $mesg.="</div>";
} }
else { else {
$mesg ="<div class=\"error\">".$langs->trans("OSCommerceErrorConnectOkButWrongDatabase",'STORE_NAME',$_POST["oscommerce_db_table_prefix"]."configuration"); $mesg ="<div class=\"error\">".$langs->trans("OSCommerceErrorConnectOkButWrongDatabase",'STORE_NAME',GETPOST('oscommerce_db_table_prefix','alpha')."configuration");
$mesg.="</div>"; $mesg.="</div>";
} }
@ -99,14 +100,14 @@ elseif ($_POST["test"])
} }
elseif ($oscommercedb->connected == 1 && $oscommercedb->database_selected != 1) elseif ($oscommercedb->connected == 1 && $oscommercedb->database_selected != 1)
{ {
$mesg ="<div class=\"error\">".$langs->trans("OSCommerceTestKo1",$_POST["oscommerce_dbhost"],$_POST["oscommerce_dbname"]); $mesg ="<div class=\"error\">".$langs->trans("OSCommerceTestKo1",GETPOST('oscommerce_dbhost','alpha'),GETPOST('oscommerce_dbname','alpha'));
$mesg.="<br>".$oscommercedb->error(); $mesg.="<br>".$oscommercedb->error();
$mesg.="</div>"; $mesg.="</div>";
//$oscommercedb->close(); Ne pas fermer car la conn de webcal est la meme que dolibarr si parametre host/user/pass identique //$oscommercedb->close(); Ne pas fermer car la conn de webcal est la meme que dolibarr si parametre host/user/pass identique
} }
else else
{ {
$mesg ="<div class=\"error\">".$langs->trans("OSCommerceTestKo2",$_POST["oscommerce_dbhost"],$_POST["oscommerce_dbuser"]); $mesg ="<div class=\"error\">".$langs->trans("OSCommerceTestKo2",GETPOST('oscommerce_dbhost','alpha'),GETPOST('oscommerce_dbuser','alpha'));
$mesg.="<br>".$oscommercedb->error(); $mesg.="<br>".$oscommercedb->error();
$mesg.="</div>"; $mesg.="</div>";
} }
@ -142,7 +143,7 @@ print "</tr>";
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("OSCommerceServer")."</td>"; print "<td>".$langs->trans("OSCommerceServer")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_dbhost\" value=\"". ($_POST["oscommerce_dbhost"]?$_POST["oscommerce_dbhost"]:$conf->global->OSC_DB_HOST) . "\" size=\"30\"></td>"; print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_dbhost\" value=\"". (GETPOST('oscommerce_dbhost','alpha')?GETPOST('oscommerce_dbhost','alpha'):$conf->global->OSC_DB_HOST) . "\" size=\"30\"></td>";
print "<td>localhost"; print "<td>localhost";
//print "<br>__dolibarr_main_db_host__ <i>(".$dolibarr_main_db_host.")</i>" //print "<br>__dolibarr_main_db_host__ <i>(".$dolibarr_main_db_host.")</i>"
print "</td>"; print "</td>";
@ -150,7 +151,7 @@ print "</tr>";
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("OSCommerceDatabaseName")."</td>"; print "<td>".$langs->trans("OSCommerceDatabaseName")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_dbname\" value=\"". ($_POST["oscommerce_dbname"]?$_POST["oscommerce_dbname"]:$conf->global->OSC_DB_NAME) . "\" size=\"30\"></td>"; print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_dbname\" value=\"". (GETPOST('oscommerce_dbname','alpha')?GETPOST('oscommerce_dbname','alpha'):$conf->global->OSC_DB_NAME) . "\" size=\"30\"></td>";
print "<td>oscommerce"; print "<td>oscommerce";
//print "<br>__dolibarr_main_db_name__ <i>(".$dolibarr_main_db_name.")</i>"; //print "<br>__dolibarr_main_db_name__ <i>(".$dolibarr_main_db_name.")</i>";
print "</td>"; print "</td>";
@ -158,14 +159,14 @@ print "</tr>";
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("OSCommercePrefix")."</td>"; print "<td>".$langs->trans("OSCommercePrefix")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_db_table_prefix\" value=\"". ($_POST["oscommerce_db_table_prefix"]?$_POST["oscommerce_db_table_prefix"]:$conf->global->DB_TABLE_PREFIX) . "\" size=\"30\"></td>"; print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_db_table_prefix\" value=\"". (GETPOST('oscommerce_db_table_prefix','alpha')?GETPOST('oscommerce_db_table_prefix','alpha'):$conf->global->DB_TABLE_PREFIX) . "\" size=\"30\"></td>";
print "<td>osc_"; print "<td>osc_";
print "</td>"; print "</td>";
print "</tr>"; print "</tr>";
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("OSCommerceUser")."</td>"; print "<td>".$langs->trans("OSCommerceUser")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_dbuser\" value=\"". ($_POST["oscommerce_dbuser"]?$_POST["oscommerce_dbuser"]:$conf->global->OSC_DB_USER) . "\" size=\"30\"></td>"; print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_dbuser\" value=\"". (GETPOST('oscommerce_dbuser','alpha')?GETPOST('oscommerce_dbuser','alpha'):$conf->global->OSC_DB_USER) . "\" size=\"30\"></td>";
print "<td>oscommerceuser"; print "<td>oscommerceuser";
//print "<br>__dolibarr_main_db_user__ <i>(".$dolibarr_main_db_user.")</i>"; //print "<br>__dolibarr_main_db_user__ <i>(".$dolibarr_main_db_user.")</i>";
print "</td>"; print "</td>";
@ -173,7 +174,7 @@ print "</tr>";
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("Password")."</td>"; print "<td>".$langs->trans("Password")."</td>";
print "<td><input type=\"password\" class=\"flat\" name=\"oscommerce_dbpass\" value=\"" . ($_POST["oscommerce_dbpass"]?$_POST["oscommerce_dbpass"]:$conf->global->OSC_DB_PASS) . "\" size=\"30\"></td>"; print "<td><input type=\"password\" class=\"flat\" name=\"oscommerce_dbpass\" value=\"" . (GETPOST('oscommerce_dbpass','alpha')?GETPOST('oscommerce_dbpass','alpha'):$conf->global->OSC_DB_PASS) . "\" size=\"30\"></td>";
print '<td>'; print '<td>';
//if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ <i>('.preg_replace('/./i','*',$dolibarr_main_db_pass).')</i>'; //if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ <i>('.preg_replace('/./i','*',$dolibarr_main_db_pass).')</i>';
print '&nbsp;</td>'; print '&nbsp;</td>';
@ -181,7 +182,7 @@ print "</tr>";
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("PasswordRetype")."</td>"; print "<td>".$langs->trans("PasswordRetype")."</td>";
print "<td><input type=\"password\" class=\"flat\" name=\"oscommerce_dbpass2\" value=\"" . ($_POST["oscommerce_dbpass2"]?$_POST["oscommerce_dbpass2"]:$conf->global->OSC_DB_PASS) ."\" size=\"30\"></td>"; print "<td><input type=\"password\" class=\"flat\" name=\"oscommerce_dbpass2\" value=\"" . (GETPOST('oscommerce_dbpass2','alpha')?GETPOST('oscommerce_dbpass2','alpha'):$conf->global->OSC_DB_PASS) ."\" size=\"30\"></td>";
print '<td>'; print '<td>';
//if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ <i>('.preg_replace('/./i','*',$dolibarr_main_db_pass).')</i>'; //if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ <i>('.preg_replace('/./i','*',$dolibarr_main_db_pass).')</i>';
print '&nbsp;</td>'; print '&nbsp;</td>';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,9 +29,9 @@ require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php");
// If socid provided by ajax company selector // If socid provided by ajax company selector
if (! empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id'])) if (! empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id']))
{ {
$_GET['CASHDESK_ID_THIRDPARTY'] = $_GET['CASHDESK_ID_THIRDPARTY_id']; $_GET['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id','alpha');
$_POST['CASHDESK_ID_THIRDPARTY'] = $_POST['CASHDESK_ID_THIRDPARTY_id']; $_POST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id','alpha');
$_REQUEST['CASHDESK_ID_THIRDPARTY'] = $_REQUEST['CASHDESK_ID_THIRDPARTY_id']; $_REQUEST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id','alpha');
} }
// Security check // Security check
@ -45,7 +45,7 @@ $langs->load("cashdesk");
/* /*
* Actions * Actions
*/ */
if (GETPOST("action") == 'set') if (GETPOST('action','alpha') == 'set')
{ {
$db->begin(); $db->begin();
@ -54,13 +54,13 @@ if (GETPOST("action") == 'set')
if (GETPOST("CASHDESK_ID_WAREHOUSE") < 0) $_POST["CASHDESK_ID_WAREHOUSE"]='';*/ if (GETPOST("CASHDESK_ID_WAREHOUSE") < 0) $_POST["CASHDESK_ID_WAREHOUSE"]='';*/
$res = dolibarr_set_const($db,"CASHDESK_ID_THIRDPARTY",GETPOST('socid','int'),'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db,"CASHDESK_ID_THIRDPARTY",GETPOST('socid','int'),'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CASH",GETPOST("CASHDESK_ID_BANKACCOUNT_CASH"),'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CASH",GETPOST('CASHDESK_ID_BANKACCOUNT_CASH','alpha'),'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CHEQUE",GETPOST("CASHDESK_ID_BANKACCOUNT_CHEQUE"),'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CHEQUE",GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE','alpha'),'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CB",GETPOST("CASHDESK_ID_BANKACCOUNT_CB"),'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CB",GETPOST('CASHDESK_ID_BANKACCOUNT_CB','alpha'),'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db,"CASHDESK_ID_WAREHOUSE",GETPOST("CASHDESK_ID_WAREHOUSE"),'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db,"CASHDESK_ID_WAREHOUSE",GETPOST('CASHDESK_ID_WAREHOUSE','alpha'),'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db,"CASHDESK_SERVICES", GETPOST("CASHDESK_SERVICES"),'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db,"CASHDESK_SERVICES", GETPOST('CASHDESK_SERVICES','alpha'),'chaine',0,'',$conf->entity);
dol_syslog("admin/cashdesk: level ".GETPOST("level")); dol_syslog("admin/cashdesk: level ".GETPOST('level','alpha'));
if (! $res > 0) $error++; if (! $res > 0) $error++;

View File

@ -47,8 +47,8 @@ print '<div class="liste_articles">';
require ('tpl/liste_articles.tpl.php'); require ('tpl/liste_articles.tpl.php');
$obj_facturation->prix_total_ht($lst_total_ht); $obj_facturation->prixTotalHt($lst_total_ht);
$obj_facturation->prix_total_ttc($lst_total_ttc); $obj_facturation->prixTotalTtc($lst_total_ttc);
print '</div>'; print '</div>';

View File

@ -253,9 +253,9 @@ class Facturation
$this->montantRendu('RESET'); $this->montantRendu('RESET');
$this->paiementLe('RESET'); $this->paiementLe('RESET');
$this->prix_total_ht('RESET'); $this->prixTotalHt('RESET');
$this->montant_tva('RESET'); $this->montantTva('RESET');
$this->prix_total_ttc('RESET'); $this->prixTotalTtc('RESET');
} }
@ -588,7 +588,7 @@ class Facturation
* @param int $aTotalHt Total amount * @param int $aTotalHt Total amount
* @return int Total amount * @return int Total amount
*/ */
public function prix_total_ht( $aTotalHt=null ) public function prixTotalHt( $aTotalHt=null )
{ {
if ( !$aTotalHt ) { if ( !$aTotalHt ) {
@ -611,7 +611,7 @@ class Facturation
* @param int $aMontantTva Amount vat * @param int $aMontantTva Amount vat
* @return int Amount vat * @return int Amount vat
*/ */
public function montant_tva( $aMontantTva=null ) public function montantTva( $aMontantTva=null )
{ {
if ( !$aMontantTva ) { if ( !$aMontantTva ) {
@ -635,7 +635,7 @@ class Facturation
* @param int $aTotalTtc Amount ttc * @param int $aTotalTtc Amount ttc
* @return int Amount ttc * @return int Amount ttc
*/ */
public function prix_total_ttc( $aTotalTtc=null ) public function prixTotalTtc( $aTotalTtc=null )
{ {
if ( !$aTotalTtc ) if ( !$aTotalTtc )
{ {

View File

@ -169,7 +169,7 @@ $langs->load("cashdesk");
<tr><th class="label1"><?php echo $langs->trans("TotalTicket"); ?></th><th class="label1"><?php echo $langs->trans("Received"); ?></th><th class="label1"><?php echo $langs->trans("Change"); ?></th></tr> <tr><th class="label1"><?php echo $langs->trans("TotalTicket"); ?></th><th class="label1"><?php echo $langs->trans("Received"); ?></th><th class="label1"><?php echo $langs->trans("Change"); ?></th></tr>
<tr> <tr>
<!-- Affichage du montant du --> <!-- Affichage du montant du -->
<td><input class="texte2_off" type="text" name="txtDu" value="<?php echo price2num($obj_facturation->prix_total_ttc(), 'MT'); ?>" disabled="disabled" /></td> <td><input class="texte2_off" type="text" name="txtDu" value="<?php echo price2num($obj_facturation->prixTotalTtc(), 'MT'); ?>" disabled="disabled" /></td>
<!-- Choix du montant encaisse --> <!-- Choix du montant encaisse -->
<td><input class="texte2" type="text" name="txtEncaisse" value="" onkeyup="javascript: verifDifference();" onfocus="javascript: this.select();" /></td> <td><input class="texte2" type="text" name="txtEncaisse" value="" onkeyup="javascript: verifDifference();" onfocus="javascript: this.select();" /></td>
<!-- Affichage du montant rendu --> <!-- Affichage du montant rendu -->

View File

@ -68,7 +68,7 @@ else
} }
$obj_facturation->calculTotaux(); $obj_facturation->calculTotaux();
$total_ttc = $obj_facturation->prix_total_ttc(); $total_ttc = $obj_facturation->prixTotalTtc();
echo ('<p class="cadre_prix_total">'.$langs->trans("Total").' : '.price2num($total_ttc, 'MT').' '.$conf->currency.'<br></p>'."\n"); echo ('<p class="cadre_prix_total">'.$langs->trans("Total").' : '.price2num($total_ttc, 'MT').' '.$conf->currency.'<br></p>'."\n");
?></div> ?></div>

View File

@ -138,9 +138,9 @@ print $object->ref;
<table class="totaux"> <table class="totaux">
<?php <?php
echo '<tr><th nowrap="nowrap">'.$langs->trans("TotalHT").'</th><td nowrap="nowrap">'.price2num($obj_facturation->prix_total_ht(),'MT')." ".$conf->currency."</td></tr>\n"; echo '<tr><th nowrap="nowrap">'.$langs->trans("TotalHT").'</th><td nowrap="nowrap">'.price2num($obj_facturation->prixTotalHt(),'MT')." ".$conf->currency."</td></tr>\n";
echo '<tr><th nowrap="nowrap">'.$langs->trans("TotalVAT").'</th><td nowrap="nowrap">'.price2num($obj_facturation->montant_tva(),'MT')." ".$conf->currency."</td></tr>\n"; echo '<tr><th nowrap="nowrap">'.$langs->trans("TotalVAT").'</th><td nowrap="nowrap">'.price2num($obj_facturation->montantTva(),'MT')." ".$conf->currency."</td></tr>\n";
echo '<tr><th nowrap="nowrap">'.$langs->trans("TotalTTC").'</th><td nowrap="nowrap">'.price2num($obj_facturation->prix_total_ttc(),'MT')." ".$conf->currency."</td></tr>\n"; echo '<tr><th nowrap="nowrap">'.$langs->trans("TotalTTC").'</th><td nowrap="nowrap">'.price2num($obj_facturation->prixTotalTtc(),'MT')." ".$conf->currency."</td></tr>\n";
?> ?>
</table> </table>

View File

@ -26,12 +26,12 @@ $langs->load("main");
<table class="table_resume"> <table class="table_resume">
<tr><td class="resume_label"><?php echo $langs->trans("Invoice"); ?></td><td><?php echo $obj_facturation->numInvoice(); ?></td></tr> <tr><td class="resume_label"><?php echo $langs->trans("Invoice"); ?></td><td><?php echo $obj_facturation->numInvoice(); ?></td></tr>
<tr><td class="resume_label"><?php echo $langs->trans("TotalHT"); ?></td><td><?php echo price2num($obj_facturation->prix_total_ht(),'MT').' '.$conf->currency; ?></td></tr> <tr><td class="resume_label"><?php echo $langs->trans("TotalHT"); ?></td><td><?php echo price2num($obj_facturation->prixTotalHt(),'MT').' '.$conf->currency; ?></td></tr>
<?php <?php
// Affichage de la tva par taux // Affichage de la tva par taux
if ( $obj_facturation->montant_tva() ) { if ( $obj_facturation->montantTva() ) {
echo ('<tr><td class="resume_label">'.$langs->trans("VAT").'</td><td>'.price2num($obj_facturation->montant_tva(),'MT').' '.$conf->currency.'</td></tr>'); echo ('<tr><td class="resume_label">'.$langs->trans("VAT").'</td><td>'.price2num($obj_facturation->montantTva(),'MT').' '.$conf->currency.'</td></tr>');
} }
else else
@ -41,7 +41,7 @@ $langs->load("main");
} }
?> ?>
<tr><td class="resume_label"><?php echo $langs->trans("TotalTTC"); ?> </td><td><?php echo price2num($obj_facturation->prix_total_ttc(),'MT').' '.$conf->currency; ?></td></tr> <tr><td class="resume_label"><?php echo $langs->trans("TotalTTC"); ?> </td><td><?php echo price2num($obj_facturation->prixTotalTtc(),'MT').' '.$conf->currency; ?></td></tr>
<tr><td class="resume_label"><?php echo $langs->trans("PaymentMode"); ?> </td><td> <tr><td class="resume_label"><?php echo $langs->trans("PaymentMode"); ?> </td><td>
<?php <?php
switch ($obj_facturation->getSetPaymentMode()) switch ($obj_facturation->getSetPaymentMode())

View File

@ -57,7 +57,7 @@ switch ($action)
// Si paiement autre qu'en especes, montant encaisse = prix total // Si paiement autre qu'en especes, montant encaisse = prix total
$mode_reglement = $obj_facturation->getSetPaymentMode(); $mode_reglement = $obj_facturation->getSetPaymentMode();
if ( $mode_reglement != 'ESP' ) { if ( $mode_reglement != 'ESP' ) {
$montant = $obj_facturation->prix_total_ttc(); $montant = $obj_facturation->prixTotalTtc();
} else { } else {
$montant = $_POST['txtEncaisse']; $montant = $_POST['txtEncaisse'];
} }
@ -66,7 +66,7 @@ switch ($action)
$obj_facturation->montantEncaisse($montant); $obj_facturation->montantEncaisse($montant);
//Determination de la somme rendue //Determination de la somme rendue
$total = $obj_facturation->prix_total_ttc(); $total = $obj_facturation->prixTotalTtc();
$encaisse = $obj_facturation->montantEncaisse(); $encaisse = $obj_facturation->montantEncaisse();
$obj_facturation->montantRendu($encaisse - $total); $obj_facturation->montantRendu($encaisse - $total);
@ -198,9 +198,9 @@ switch ($action)
$invoice->date_creation=$now; $invoice->date_creation=$now;
$invoice->date=$now; $invoice->date=$now;
$invoice->date_lim_reglement=0; $invoice->date_lim_reglement=0;
$invoice->total_ht=$obj_facturation->prix_total_ht(); $invoice->total_ht=$obj_facturation->prixTotalHt();
$invoice->total_tva=$obj_facturation->montant_tva(); $invoice->total_tva=$obj_facturation->montantTva();
$invoice->total_ttc=$obj_facturation->prix_total_ttc(); $invoice->total_ttc=$obj_facturation->prixTotalTtc();
$invoice->note=$note; $invoice->note=$note;
$invoice->cond_reglement_id=$cond_reglement_id; $invoice->cond_reglement_id=$cond_reglement_id;
$invoice->mode_reglement_id=$mode_reglement_id; $invoice->mode_reglement_id=$mode_reglement_id;
@ -234,7 +234,7 @@ switch ($action)
$payment=new Paiement($db); $payment=new Paiement($db);
$payment->datepaye=$now; $payment->datepaye=$now;
$payment->bank_account=$conf_fkaccount; $payment->bank_account=$conf_fkaccount;
$payment->amounts[$invoice->id]=$obj_facturation->prix_total_ttc(); $payment->amounts[$invoice->id]=$obj_facturation->prixTotalTtc();
$payment->note=$langs->trans("Payment").' '.$langs->trans("Invoice").' '.$obj_facturation->numInvoice(); $payment->note=$langs->trans("Payment").' '.$langs->trans("Invoice").' '.$obj_facturation->numInvoice();
$payment->paiementid=$invoice->mode_reglement_id; $payment->paiementid=$invoice->mode_reglement_id;
$payment->num_paiement=''; $payment->num_paiement='';
@ -254,7 +254,7 @@ switch ($action)
if (! $error) if (! $error)
{ {
if ($invoice->total_ttc == $obj_facturation->prix_total_ttc() if ($invoice->total_ttc == $obj_facturation->prixTotalTtc()
&& $obj_facturation->getSetPaymentMode() != 'DIFF') && $obj_facturation->getSetPaymentMode() != 'DIFF')
{ {
// We set status to payed // We set status to payed

View File

@ -75,7 +75,7 @@ if ($id || $ref)
$objecttype = 'adherent&categorie'; $objecttype = 'adherent&categorie';
$objectid = isset($id)?$id:(isset($ref)?$ref:''); $objectid = isset($id)?$id:(isset($ref)?$ref:'');
$dbtablename = 'adherent'; $dbtablename = 'adherent';
$fieldid = isset($ref)?'ref':'rowid'; $fieldid = ! empty($ref)?'ref':'rowid';
} }
} }
@ -424,6 +424,7 @@ else if ($id || $ref)
* @param DoliDb $db Database handler * @param DoliDb $db Database handler
* @param Object $object Object we want to see categories it can be classified into * @param Object $object Object we want to see categories it can be classified into
* @param int $typeid Type of category (0, 1, 2, 3) * @param int $typeid Type of category (0, 1, 2, 3)
* @param int $socid Id thirdparty
* @return int 0 * @return int 0
*/ */
function formCategory($db,$object,$typeid,$socid=0) function formCategory($db,$object,$typeid,$socid=0)

View File

@ -55,14 +55,10 @@ class Categorie
* Constructor * Constructor
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param int $id Id of category to fetch during init
*/ */
function Categorie($db, $id=-1) function __construct($db)
{ {
$this->db = $db; $this->db = $db;
$this->id = $id;
if ($id != -1) $this->fetch($this->id);
} }
/** /**
@ -73,7 +69,7 @@ class Categorie
*/ */
function fetch($id) function fetch($id)
{ {
$sql = "SELECT rowid, label, description, fk_soc, visible, type"; $sql = "SELECT rowid, entity, label, description, fk_soc, visible, type";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie";
$sql.= " WHERE rowid = ".$id; $sql.= " WHERE rowid = ".$id;
@ -89,6 +85,7 @@ class Categorie
$this->socid = $res['fk_soc']; $this->socid = $res['fk_soc'];
$this->visible = $res['visible']; $this->visible = $res['visible'];
$this->type = $res['type']; $this->type = $res['type'];
$this->entity = $res['entity'];
$this->db->free($resql); $this->db->free($resql);
} }
@ -525,20 +522,26 @@ class Categorie
* *
* @param string $field Field name for select in table. Full field name will be fk_field. * @param string $field Field name for select in table. Full field name will be fk_field.
* @param string $classname PHP Class of object to store entity * @param string $classname PHP Class of object to store entity
* @param string $table Table name for select in table. Full table name will be PREFIX_categorie_table. * @param string $category_table Table name for select in table. Full table name will be PREFIX_categorie_table.
* @param string $object_table Table name for select in table. Full table name will be PREFIX_table.
* @return void * @return void
*/ */
function get_type($field,$classname,$table='') function get_type($field,$classname,$category_table='',$object_table='')
{ {
$objs = array(); $objs = array();
// Clean parameters // Clean parameters
if (empty($table)) $table=$field; if (empty($category_table)) $category_table=$field;
if (empty($object_table)) $object_table=$field;
$sql = "SELECT fk_".$field." FROM ".MAIN_DB_PREFIX."categorie_".$table; $sql = "SELECT c.fk_".$field;
$sql.= " WHERE fk_categorie = ".$this->id; $sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$category_table." as c";
$sql.= ", ".MAIN_DB_PREFIX.$object_table." as o";
$sql.= " WHERE c.fk_categorie = ".$this->id;
$sql.= " AND c.fk_".$field." = o.rowid";
$sql.= " AND o.entity IN (".getEntity($field, 1).")";
dol_syslog("Categorie::get_type sql=".$sql); dol_syslog(get_class($this)."::get_type sql=".$sql);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -553,7 +556,7 @@ class Categorie
else else
{ {
$this->error=$this->db->error().' sql='.$sql; $this->error=$this->db->error().' sql='.$sql;
dol_syslog("Categorie::get_type ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::get_type ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@ -1278,6 +1281,8 @@ class Categorie
*/ */
function liste_photos($dir,$nbmax=0) function liste_photos($dir,$nbmax=0)
{ {
include_once(DOL_DOCUMENT_ROOT ."/core/lib/files.lib.php");
$nbphoto=0; $nbphoto=0;
$tabobj=array(); $tabobj=array();
@ -1290,7 +1295,7 @@ class Categorie
{ {
while (($file = readdir($handle)) != false) while (($file = readdir($handle)) != false)
{ {
if (is_file($dir.$file)) if (dol_is_file($dir.$file) && preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$dir.$file))
{ {
$nbphoto++; $nbphoto++;
$photo = $file; $photo = $file;

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