Merge branch 'upstream/3.5'

This commit is contained in:
aspangaro 2013-11-24 17:25:20 +01:00
commit f98ec89dec
168 changed files with 4994 additions and 3698 deletions

2
.gitignore vendored
View File

@ -15,3 +15,5 @@ doxygen_warnings.log
.DS_Store .DS_Store
.idea .idea
*.iml *.iml
Thumbs.db

View File

@ -7,7 +7,6 @@ file_filter = htdocs/langs/<lang>/admin.lang
source_file = htdocs/langs/en_US/admin.lang source_file = htdocs/langs/en_US/admin.lang
source_lang = en_US source_lang = en_US
type = MOZILLAPROPERTIES type = MOZILLAPROPERTIES
lang_map = uz_UZ: uz
[dolibarr.agenda] [dolibarr.agenda]
file_filter = htdocs/langs/<lang>/agenda.lang file_filter = htdocs/langs/<lang>/agenda.lang

View File

@ -130,8 +130,13 @@ parameter. All methods addline in this case were modified to remove this paramet
***** ChangeLog for 3.4.2 compared to 3.4.1 ***** ***** ChangeLog for 3.4.2 compared to 3.4.1 *****
Fix: field's problem into company's page (RIB)
Fix: Document cerfa doesn't contained firstname & lastname from donator
Fix: Bad rounding on margin calculations and display. Fix: Bad rounding on margin calculations and display.
Fix: Option drop table into backup was broken. Fix: Option drop table into backup was broken.
Fix: [ bug #1105 ] Searching Boxes other search option
Fix: wrong buy price update
Fix :[ bug #1142 ] Set paiement on invoice (PGSql)
***** ChangeLog for 3.4.1 compared to 3.4.0 ***** ***** ChangeLog for 3.4.1 compared to 3.4.0 *****
Fix: Display buying price on line edit when no supplier price is defined Fix: Display buying price on line edit when no supplier price is defined

View File

@ -39,7 +39,13 @@ END
# To use Alioth.debian.org # To use Alioth.debian.org
* Create a login * Create an account login
* Update your ~/.ssh/config file to add:
Host svn.debian.org git.debian.org bzr.debian.org hg.debian.org darcs.debian.org arch.debian.org
User eldy-guest
IdentityFile ~/.ssh/id_rsa
* Check login on page https://alioth.debian.org/users/login
Ex: https://alioth.debian.org/users/eldy-guest
* Setup your ssh as described into page: http://wiki.debian.org/Alioth/SSH * Setup your ssh as described into page: http://wiki.debian.org/Alioth/SSH
* Ask to be included into project collab-maint: http://alioth.debian.org/projects/collab-maint/ * Ask to be included into project collab-maint: http://alioth.debian.org/projects/collab-maint/
@ -192,8 +198,7 @@ To update dolibarr debian package
* You can git clone debian git repo * You can git clone debian git repo
> git clone git.debian.org:/git/collab-maint/dolibarr.git [dolibarr-debian] > git clone git.debian.org:/git/collab-maint/dolibarr.git [dolibarr-debian]
or better or better
> mkdir gitdebian > cd ~; mkdir git-debian; cd git-debian
> cd gitdebian
> gbp-clone git.debian.org:/git/collab-maint/dolibarr.git > gbp-clone git.debian.org:/git/collab-maint/dolibarr.git
* You can then create a PHP project from Eclipse called dolibarr-debian * You can then create a PHP project from Eclipse called dolibarr-debian

View File

@ -14,6 +14,20 @@ dolibarr (3.4.1-3) unstable; urgency=low
dolibarr (3.4.0-3) unstable; urgency=low dolibarr (3.4.0-3) unstable; urgency=low
[ Laurent Destailleur (eldy) ]
* Maintenance release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Mon, 22 Apr 2013 12:00:00 +0100
dolibarr (3.4.1) unstable; urgency=low
[ Laurent Destailleur (eldy) ]
* Maintenance release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Mon, 22 Apr 2013 12:00:00 +0100
dolibarr (3.4.0) unstable; urgency=low
[ Laurent Destailleur (eldy) ] [ Laurent Destailleur (eldy) ]
* New upstream release. * New upstream release.

View File

@ -2,7 +2,15 @@
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# \file build/makepack-dolibarr.pl # \file build/makepack-dolibarr.pl
# \brief Dolibarr package builder (tgz, zip, rpm, deb, exe, aps) # \brief Dolibarr package builder (tgz, zip, rpm, deb, exe, aps)
# \author (c)2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> # \author (c)2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
#
# This is list of constant you can set to have generated packages moved into a specific dir:
#DESTIBETARC='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/lastbuild'
#DESTISTABLE='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/stable'
#DESTIMODULES='/media/HDDATA1_LD/Mes Sites/Web/Admin1/wwwroot/files/modules'
#DESTIDOLIMEDBETARC='/media/HDDATA1_LD/Mes Sites/Web/DoliCloud/dolimed.com/htdocs/files/lastbuild'
#DESTIDOLIMEDMODULES='/media/HDDATA1_LD/Mes Sites/Web/DoliCloud/dolimed.com/htdocs/files/modules'
#DESTIDOLIMEDSTABLE='/media/HDDATA1_LD/Mes Sites/Web/DoliCloud/dolimed.com/htdocs/files/stable'
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
use Cwd; use Cwd;

View File

@ -2,13 +2,15 @@
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# \file build/makepack-dolibarrmodule.pl # \file build/makepack-dolibarrmodule.pl
# \brief Package builder (tgz, zip, rpm, deb, exe) # \brief Package builder (tgz, zip, rpm, deb, exe)
# \author (c)2005-2006 Laurent Destailleur <eldy@users.sourceforge.net> # \author (c)2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
use Cwd; use Cwd;
$OWNER="ldestailleur";
$GROUP="ldestailleur";
@LISTETARGET=("TGZ"); # Possible packages @LISTETARGET=("ZIP"); # Possible packages
%REQUIREMENTTARGET=( # Tool requirement for each package %REQUIREMENTTARGET=( # Tool requirement for each package
"TGZ"=>"tar", "TGZ"=>"tar",
"ZIP"=>"7z" "ZIP"=>"7z"
@ -272,7 +274,6 @@ foreach my $PROJECT (@PROJECTLIST) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf*sav*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf*sav*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom2`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom2`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/theme/bureau2crea`;
$ret=`rm -fr $BUILDROOT/$PROJECT/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`; $ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`;
$ret=`rm -fr $BUILDROOT/$PROJECT/CVS* $BUILDROOT/$PROJECT/*/CVS* $BUILDROOT/$PROJECT/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/*/CVS*`; $ret=`rm -fr $BUILDROOT/$PROJECT/CVS* $BUILDROOT/$PROJECT/*/CVS* $BUILDROOT/$PROJECT/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/*/CVS*`;
@ -323,6 +324,7 @@ foreach my $PROJECT (@PROJECTLIST) {
print "Move $FILENAMEZIP.zip to $NEWDESTI/$FILENAMEZIP.zip\n"; print "Move $FILENAMEZIP.zip to $NEWDESTI/$FILENAMEZIP.zip\n";
$ret=`mv "$BUILDROOT/$FILENAMEZIP.zip" "$NEWDESTI/$FILENAMEZIP.zip"`; $ret=`mv "$BUILDROOT/$FILENAMEZIP.zip" "$NEWDESTI/$FILENAMEZIP.zip"`;
$ret=`chown $OWNER.$GROUP "$NEWDESTI/$FILENAMEZIP.zip"`;
next; next;
} }

View File

@ -34,3 +34,12 @@ Enter the Remote URL that should looks like this: http://www.dolibarr.org/files/
Then add into advanded - attributes Then add into advanded - attributes
OBS:Screenshots http://www.dolibarr.org/images/dolibarr_screenshot1.png OBS:Screenshots http://www.dolibarr.org/images/dolibarr_screenshot1.png
OBS:QualityCategory Testing OBS:QualityCategory Testing
# Move project into official directory
- Enter a bug to ask to be a maintener of a category or to add a new one.
For example: https://bugzilla.novell.com/show_bug.cgi?id=848083 to be a maintener of category
https://build.opensuse.org/project/show/Application:ERP
- Once done, go into project, category, subproject and enter a subproject for your application.
Fo example: Dolibarr
- Then go onto project into your home and ask a publish to the category/you project your created.

View File

@ -117,9 +117,9 @@ do
lang2=`expr substr $lang 4 2 | tr "[:upper:]" "[:lower:]"`; lang2=`expr substr $lang 4 2 | tr "[:upper:]" "[:lower:]"`;
echo "%dir %{_datadir}/%{name}/htdocs/langs/${lang}" >> %{name}.lang echo "%dir %{_datadir}/%{name}/htdocs/langs/${lang}" >> %{name}.lang
if [ "$lang1" = "$lang2" ] ; then if [ "$lang1" = "$lang2" ] ; then
echo "%lang(${lang1}) %{_datadir}/%{name}/htdocs/langs/${lang}/*.lang" echo "%lang(${lang1}) %{_datadir}/%{name}/htdocs/langs/${lang}/*.lang"
else else
echo "%lang(${lang}) %{_datadir}/%{name}/htdocs/langs/${lang}/*.lang" echo "%lang(${lang}) %{_datadir}/%{name}/htdocs/langs/${lang}/*.lang"
fi fi
done >>%{name}.lang done >>%{name}.lang
@ -238,20 +238,20 @@ echo Create document directory $docdir
export config=%{_sysconfdir}/dolibarr/conf.php export config=%{_sysconfdir}/dolibarr/conf.php
if [ -s $config ] && grep -q "File generated by" $config if [ -s $config ] && grep -q "File generated by" $config
then then
# File already exist. We add params not found. # File already exist. We add params not found.
echo 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 || [ ! -d "/usr/share/php/adodb" ] || 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 || [ ! -d "/usr/share/php/fpdi" ] || 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 || [ ! -d "/usr/share/php/nusoap" ] || 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 || [ ! -d "/usr/share/php/libphp-pclzip" ] || 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 || [ ! -d "/usr/share/javascript/ckeditor" ] || 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 || [ ! -d "/usr/share/javascript/jquery" ] || 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 || [ ! -d "/usr/share/javascript/jquery-ui" ] || 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 || [ ! -d "/usr/share/javascript/flot" ] || 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/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/dejavu/DejaVuSans-Bold.ttf'; ?>" >> $config
fi fi
# Create config for SE Linux # Create config for SE Linux
@ -264,13 +264,13 @@ restorecon -R -v /var/lib/dolibarr
# Create a config link dolibarr.conf # Create a config link dolibarr.conf
if [ ! -L $apachelink ]; then if [ ! -L $apachelink ]; then
apachelinkdir=`dirname $apachelink` apachelinkdir=`dirname $apachelink`
if [ -d $apachelinkdir ]; then if [ -d $apachelinkdir ]; then
echo Create dolibarr web server config link from %{_sysconfdir}/dolibarr/apache.conf to $apachelink echo Create dolibarr web server config link from %{_sysconfdir}/dolibarr/apache.conf to $apachelink
ln -fs %{_sysconfdir}/dolibarr/apache.conf $apachelink ln -fs %{_sysconfdir}/dolibarr/apache.conf $apachelink
else else
echo Do not create link $apachelink - web server conf dir $apachelinkdir not found. web server package may not be installed echo Do not create link $apachelink - web server conf dir $apachelinkdir not found. web server package may not be installed
fi fi
fi fi
echo Set permission to $apacheuser:$apachegroup on /var/lib/dolibarr echo Set permission to $apacheuser:$apachegroup on /var/lib/dolibarr
@ -302,30 +302,30 @@ echo
if [ "x$1" = "x0" ] ; if [ "x$1" = "x0" ] ;
then then
# Remove # Remove
echo "Removed package" echo "Removed package"
# Define vars # Define vars
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf" export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
# Remove apache link # Remove apache link
if [ -L $apachelink ] ; if [ -L $apachelink ] ;
then then
echo "Delete apache config link for Dolibarr ($apachelink)" echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink %{__rm} -f $apachelink
status=purge status=purge
fi fi
# Restart web servers if required # Restart web servers if required
if [ "x$status" = "xpurge" ] ; if [ "x$status" = "xpurge" ] ;
then then
# Restart web server # Restart web server
echo Restart web server echo Restart web server
/sbin/service httpd restart /sbin/service httpd restart
fi fi
else else
# Upgrade # Upgrade
echo "No remove action done (this is an upgrade)" echo "No remove action done (this is an upgrade)"
fi fi
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release

View File

@ -190,9 +190,9 @@ do
lang2=`expr substr $lang 4 2 | tr "[:upper:]" "[:lower:]"`; lang2=`expr substr $lang 4 2 | tr "[:upper:]" "[:lower:]"`;
echo "%dir %{_datadir}/%{name}/htdocs/langs/${lang}" >> %{name}.lang echo "%dir %{_datadir}/%{name}/htdocs/langs/${lang}" >> %{name}.lang
if [ "$lang1" = "$lang2" ] ; then if [ "$lang1" = "$lang2" ] ; then
echo "%lang(${lang1}) %{_datadir}/%{name}/htdocs/langs/${lang}/*.lang" echo "%lang(${lang1}) %{_datadir}/%{name}/htdocs/langs/${lang}/*.lang"
else else
echo "%lang(${lang}) %{_datadir}/%{name}/htdocs/langs/${lang}/*.lang" echo "%lang(${lang}) %{_datadir}/%{name}/htdocs/langs/${lang}/*.lang"
fi fi
done >>%{name}.lang done >>%{name}.lang
@ -323,28 +323,28 @@ export installconfig="%{_sysconfdir}/dolibarr/install.forced.php"
# Detect OS # Detect OS
os='unknown'; os='unknown';
if [ -d %{_sysconfdir}/httpd/conf.d ]; then if [ -d %{_sysconfdir}/httpd/conf.d ]; then
export os='fedora-redhat'; export os='fedora-redhat';
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf" export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
export apacheuser='apache'; export apacheuser='apache';
export apachegroup='apache'; export apachegroup='apache';
fi fi
if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^wwwrun /etc/passwd | wc -l` -ge 1 ]; then if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^wwwrun /etc/passwd | wc -l` -ge 1 ]; then
export os='opensuse'; export os='opensuse';
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf" export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
export apacheuser='wwwrun'; export apacheuser='wwwrun';
export apachegroup='www'; export apachegroup='www';
fi fi
if [ -d %{_sysconfdir}/httpd/conf.d -a `grep -i "^mageia\|mandriva" /etc/issue | wc -l` -ge 1 ]; then if [ -d %{_sysconfdir}/httpd/conf.d -a `grep -i "^mageia\|mandriva" /etc/issue | wc -l` -ge 1 ]; then
export os='mageia-mandriva'; export os='mageia-mandriva';
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf" export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
export apacheuser='apache'; export apacheuser='apache';
export apachegroup='apache'; export apachegroup='apache';
fi fi
if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^www-data /etc/passwd | wc -l` -ge 1 ]; then if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^www-data /etc/passwd | wc -l` -ge 1 ]; then
export os='ubuntu-debian'; export os='ubuntu-debian';
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf" export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
export apacheuser='www-data'; export apacheuser='www-data';
export apachegroup='www-data'; export apachegroup='www-data';
fi fi
echo OS detected: $os echo OS detected: $os
%endif %endif
@ -363,16 +363,16 @@ echo Create document directory $docdir
# Create install.forced.php into Dolibarr install directory # Create install.forced.php into Dolibarr install directory
if [ "x$os" = "xubuntu-debian" ] if [ "x$os" = "xubuntu-debian" ]
then then
superuserlogin='' superuserlogin=''
superuserpassword='' superuserpassword=''
if [ -f %{_sysconfdir}/mysql/debian.cnf ] ; then if [ -f %{_sysconfdir}/mysql/debian.cnf ] ; then
# Load superuser login and pass # Load superuser login and pass
superuserlogin=$(/bin/grep --max-count=1 "user" %{_sysconfdir}/mysql/debian.cnf | /bin/sed -e 's/^user[ =]*//g') superuserlogin=$(/bin/grep --max-count=1 "user" %{_sysconfdir}/mysql/debian.cnf | /bin/sed -e 's/^user[ =]*//g')
superuserpassword=$(/bin/grep --max-count=1 "password" %{_sysconfdir}/mysql/debian.cnf | /bin/sed -e 's/^password[ =]*//g') superuserpassword=$(/bin/grep --max-count=1 "password" %{_sysconfdir}/mysql/debian.cnf | /bin/sed -e 's/^password[ =]*//g')
fi fi
echo Mysql superuser found to use is $superuserlogin echo Mysql superuser found to use is $superuserlogin
%{__cat} /usr/share/dolibarr/build/rpm/install.forced.php.generic | sed -e 's/__SUPERUSERLOGIN__/'$superuserlogin'/g' | sed -e 's/__SUPERUSERPASSWORD__/'$superuserpassword'/g' > $installconfig %{__cat} /usr/share/dolibarr/build/rpm/install.forced.php.generic | sed -e 's/__SUPERUSERLOGIN__/'$superuserlogin'/g' | sed -e 's/__SUPERUSERPASSWORD__/'$superuserpassword'/g' > $installconfig
%{__chmod} -R 660 $installconfig %{__chmod} -R 660 $installconfig
fi fi
%endif %endif
@ -383,29 +383,29 @@ fi
export config=%{_sysconfdir}/dolibarr/conf.php export config=%{_sysconfdir}/dolibarr/conf.php
if [ -s $config ] && grep -q "File generated by" $config if [ -s $config ] && grep -q "File generated by" $config
then then
# File already exist. We add params not found. # File already exist. We add params not found.
echo 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 || [ ! -d "/usr/share/php/adodb" ] || 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 || [ ! -d "/usr/share/php/fpdi" ] || 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 || [ ! -d "/usr/share/php/nusoap" ] || 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 || [ ! -d "/usr/share/php/libphp-pclzip" ] || 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 || [ ! -d "/usr/share/javascript/ckeditor" ] || 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 || [ ! -d "/usr/share/javascript/jquery" ] || 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 || [ ! -d "/usr/share/javascript/jquery-ui" ] || 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 || [ ! -d "/usr/share/javascript/flot" ] || 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
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} %if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version}
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 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
%else %else
%if 0%{?mdkversion} %if 0%{?mdkversion}
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 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
%else %else
%if 0%{?suse_version} %if 0%{?suse_version}
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 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
%else %else
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
%endif %endif
%endif %endif
%endif %endif
@ -418,12 +418,12 @@ if [ "x$os" = "xfedora-redhat" -a -s /sbin/restorecon ]; then
%endif %endif
%if 0%{?mdkversion} || 0%{?suse_version} %if 0%{?mdkversion} || 0%{?suse_version}
%else %else
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
semanage fcontext -a -t httpd_sys_script_rw_t "/etc/dolibarr(/.*?)" semanage fcontext -a -t httpd_sys_script_rw_t "/etc/dolibarr(/.*?)"
semanage fcontext -a -t httpd_sys_script_rw_t "/var/lib/dolibarr(/.*?)" semanage fcontext -a -t httpd_sys_script_rw_t "/var/lib/dolibarr(/.*?)"
restorecon -R -v /etc/dolibarr restorecon -R -v /etc/dolibarr
restorecon -R -v /var/lib/dolibarr restorecon -R -v /var/lib/dolibarr
%endif %endif
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion} || 0%{?suse_version} %if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion} || 0%{?suse_version}
%else %else
@ -432,13 +432,13 @@ fi
# Create a config link dolibarr.conf # Create a config link dolibarr.conf
if [ ! -L $apachelink ]; then if [ ! -L $apachelink ]; then
apachelinkdir=`dirname $apachelink` apachelinkdir=`dirname $apachelink`
if [ -d $apachelinkdir ]; then if [ -d $apachelinkdir ]; then
echo Create dolibarr web server config link from %{_sysconfdir}/dolibarr/apache.conf to $apachelink echo Create dolibarr web server config link from %{_sysconfdir}/dolibarr/apache.conf to $apachelink
ln -fs %{_sysconfdir}/dolibarr/apache.conf $apachelink ln -fs %{_sysconfdir}/dolibarr/apache.conf $apachelink
else else
echo Do not create link $apachelink - web server conf dir $apachelinkdir not found. web server package may not be installed echo Do not create link $apachelink - web server conf dir $apachelinkdir not found. web server package may not be installed
fi fi
fi fi
echo Set permission to $apacheuser:$apachegroup on /var/lib/dolibarr echo Set permission to $apacheuser:$apachegroup on /var/lib/dolibarr
@ -451,30 +451,30 @@ echo Restart web server
/sbin/service httpd restart /sbin/service httpd restart
%else %else
if [ -f %{_sysconfdir}/init.d/httpd ]; then if [ -f %{_sysconfdir}/init.d/httpd ]; then
%{_sysconfdir}/init.d/httpd restart %{_sysconfdir}/init.d/httpd restart
fi fi
if [ -f %{_sysconfdir}/init.d/apache2 ]; then if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart %{_sysconfdir}/init.d/apache2 restart
fi fi
%endif %endif
# Restart mysql server # Restart mysql server
echo Restart mysql server echo Restart mysql server
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion} %if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion}
/sbin/service mysqld restart /sbin/service mysqld restart
%else %else
%if 0%{?suse_version} %if 0%{?suse_version}
if [ -f /etc/init.d/mysqld ]; then if [ -f /etc/init.d/mysqld ]; then
/etc/init.d/mysqld restart /etc/init.d/mysqld restart
else else
/sbin/service mysql restart /sbin/service mysql restart
fi fi
%else %else
if [ -f /etc/init.d/mysqld ]; then if [ -f /etc/init.d/mysqld ]; then
/etc/init.d/mysqld restart /etc/init.d/mysqld restart
fi fi
if [ -f /etc/init.d/mysql ]; then if [ -f /etc/init.d/mysql ]; then
/etc/init.d/mysql restart /etc/init.d/mysql restart
fi fi
%endif %endif
%endif %endif
@ -497,63 +497,63 @@ echo
if [ "x$1" = "x0" ] ; if [ "x$1" = "x0" ] ;
then then
# Remove # Remove
echo "Removed package" echo "Removed package"
# Define vars # Define vars
os='unknown'; os='unknown';
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion} %if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion}
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf" export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
%else %else
%if 0%{?suse_version} %if 0%{?suse_version}
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf" export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
%else %else
if [ -d %{_sysconfdir}/httpd/conf.d ]; then if [ -d %{_sysconfdir}/httpd/conf.d ]; then
export os='fedora-redhat'; export os='fedora-redhat';
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf" export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
fi fi
if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^wwwrun /etc/passwd | wc -l` -ge 1 ]; then if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^wwwrun /etc/passwd | wc -l` -ge 1 ]; then
export os='opensuse'; export os='opensuse';
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf" export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
fi fi
if [ -d %{_sysconfdir}/httpd/conf.d -a `grep -i "^mageia\|mandriva" /etc/issue | wc -l` -ge 1 ]; then if [ -d %{_sysconfdir}/httpd/conf.d -a `grep -i "^mageia\|mandriva" /etc/issue | wc -l` -ge 1 ]; then
export os='mageia-mandriva'; export os='mageia-mandriva';
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf" export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
fi fi
if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^www-data /etc/passwd | wc -l` -ge 1 ]; then if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^www-data /etc/passwd | wc -l` -ge 1 ]; then
export os='ubuntu-debian'; export os='ubuntu-debian';
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf" export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
fi fi
%endif %endif
%endif %endif
# Remove apache link # Remove apache link
if [ -L $apachelink ] ; if [ -L $apachelink ] ;
then then
echo "Delete apache config link for Dolibarr ($apachelink)" echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink %{__rm} -f $apachelink
status=purge status=purge
fi fi
# Restart web servers if required # Restart web servers if required
if [ "x$status" = "xpurge" ] ; if [ "x$status" = "xpurge" ] ;
then then
# Restart web server # Restart web server
echo Restart web server echo Restart web server
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion} %if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion}
/sbin/service httpd restart /sbin/service httpd restart
%else %else
if [ -f %{_sysconfdir}/init.d/httpd ]; then if [ -f %{_sysconfdir}/init.d/httpd ]; then
%{_sysconfdir}/init.d/httpd restart %{_sysconfdir}/init.d/httpd restart
fi fi
if [ -f %{_sysconfdir}/init.d/apache2 ]; then if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart %{_sysconfdir}/init.d/apache2 restart
fi fi
%endif %endif
fi fi
else else
# Upgrade # Upgrade
echo "No remove action done (this is an upgrade)" echo "No remove action done (this is an upgrade)"
fi fi
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release

View File

@ -114,9 +114,9 @@ do
lang2=`expr substr $lang 4 2 | tr "[:upper:]" "[:lower:]"`; lang2=`expr substr $lang 4 2 | tr "[:upper:]" "[:lower:]"`;
echo "%dir %{_datadir}/%{name}/htdocs/langs/${lang}" >> %{name}.lang echo "%dir %{_datadir}/%{name}/htdocs/langs/${lang}" >> %{name}.lang
if [ "$lang1" = "$lang2" ] ; then if [ "$lang1" = "$lang2" ] ; then
echo "%lang(${lang1}) %{_datadir}/%{name}/htdocs/langs/${lang}/*.lang" echo "%lang(${lang1}) %{_datadir}/%{name}/htdocs/langs/${lang}/*.lang"
else else
echo "%lang(${lang}) %{_datadir}/%{name}/htdocs/langs/${lang}/*.lang" echo "%lang(${lang}) %{_datadir}/%{name}/htdocs/langs/${lang}/*.lang"
fi fi
done >>%{name}.lang done >>%{name}.lang
@ -235,31 +235,31 @@ echo Create document directory $docdir
export config=%{_sysconfdir}/dolibarr/conf.php export config=%{_sysconfdir}/dolibarr/conf.php
if [ -s $config ] && grep -q "File generated by" $config if [ -s $config ] && grep -q "File generated by" $config
then then
# File already exist. We add params not found. # File already exist. We add params not found.
echo 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 || [ ! -d "/usr/share/php/adodb" ] || 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 || [ ! -d "/usr/share/php/fpdi" ] || 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 || [ ! -d "/usr/share/php/nusoap" ] || 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 || [ ! -d "/usr/share/php/libphp-pclzip" ] || 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 || [ ! -d "/usr/share/javascript/ckeditor" ] || 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 || [ ! -d "/usr/share/javascript/jquery" ] || 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 || [ ! -d "/usr/share/javascript/jquery-ui" ] || 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 || [ ! -d "/usr/share/javascript/flot" ] || 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/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/TTF/dejavu/DejaVuSans-Bold.ttf'; ?>" >> $config
fi fi
# Create a config link dolibarr.conf # Create a config link dolibarr.conf
if [ ! -L $apachelink ]; then if [ ! -L $apachelink ]; then
apachelinkdir=`dirname $apachelink` apachelinkdir=`dirname $apachelink`
if [ -d $apachelinkdir ]; then if [ -d $apachelinkdir ]; then
echo Create dolibarr web server config link from %{_sysconfdir}/dolibarr/apache.conf to $apachelink echo Create dolibarr web server config link from %{_sysconfdir}/dolibarr/apache.conf to $apachelink
ln -fs %{_sysconfdir}/dolibarr/apache.conf $apachelink ln -fs %{_sysconfdir}/dolibarr/apache.conf $apachelink
else else
echo Do not create link $apachelink - web server conf dir $apachelinkdir not found. web server package may not be installed echo Do not create link $apachelink - web server conf dir $apachelinkdir not found. web server package may not be installed
fi fi
fi fi
echo Set permission to $apacheuser:$apachegroup on /var/lib/dolibarr echo Set permission to $apacheuser:$apachegroup on /var/lib/dolibarr
@ -269,19 +269,19 @@ echo Set permission to $apacheuser:$apachegroup on /var/lib/dolibarr
# Restart web server # Restart web server
echo Restart web server echo Restart web server
if [ -f %{_sysconfdir}/init.d/httpd ]; then if [ -f %{_sysconfdir}/init.d/httpd ]; then
%{_sysconfdir}/init.d/httpd restart %{_sysconfdir}/init.d/httpd restart
fi fi
if [ -f %{_sysconfdir}/init.d/apache2 ]; then if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart %{_sysconfdir}/init.d/apache2 restart
fi fi
# Restart mysql # Restart mysql
echo Restart mysql echo Restart mysql
if [ -f /etc/init.d/mysqld ]; then if [ -f /etc/init.d/mysqld ]; then
/etc/init.d/mysqld restart /etc/init.d/mysqld restart
fi fi
if [ -f /etc/init.d/mysql ]; then if [ -f /etc/init.d/mysql ]; then
/etc/init.d/mysql restart /etc/init.d/mysql restart
fi fi
# Show result # Show result
@ -301,35 +301,35 @@ echo
if [ "x$1" = "x0" ] ; if [ "x$1" = "x0" ] ;
then then
# Remove # Remove
echo "Removed package" echo "Removed package"
# Define vars # Define vars
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf" export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
# Remove apache link # Remove apache link
if [ -L $apachelink ] ; if [ -L $apachelink ] ;
then then
echo "Delete apache config link for Dolibarr ($apachelink)" echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink %{__rm} -f $apachelink
status=purge status=purge
fi fi
# Restart web servers if required # Restart web servers if required
if [ "x$status" = "xpurge" ] ; if [ "x$status" = "xpurge" ] ;
then then
# Restart web server # Restart web server
echo Restart web server echo Restart web server
if [ -f %{_sysconfdir}/init.d/httpd ]; then if [ -f %{_sysconfdir}/init.d/httpd ]; then
%{_sysconfdir}/init.d/httpd restart %{_sysconfdir}/init.d/httpd restart
fi fi
if [ -f %{_sysconfdir}/init.d/apache2 ]; then if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart %{_sysconfdir}/init.d/apache2 restart
fi fi
fi fi
else else
# Upgrade # Upgrade
echo "No remove action done (this is an upgrade)" echo "No remove action done (this is an upgrade)"
fi fi

View File

@ -115,9 +115,9 @@ do
lang2=`expr substr $lang 4 2 | tr "[:upper:]" "[:lower:]"`; lang2=`expr substr $lang 4 2 | tr "[:upper:]" "[:lower:]"`;
echo "%dir %{_datadir}/%{name}/htdocs/langs/${lang}" >> %{name}.lang echo "%dir %{_datadir}/%{name}/htdocs/langs/${lang}" >> %{name}.lang
if [ "$lang1" = "$lang2" ] ; then if [ "$lang1" = "$lang2" ] ; then
echo "%lang(${lang1}) %{_datadir}/%{name}/htdocs/langs/${lang}/*.lang" echo "%lang(${lang1}) %{_datadir}/%{name}/htdocs/langs/${lang}/*.lang"
else else
echo "%lang(${lang}) %{_datadir}/%{name}/htdocs/langs/${lang}/*.lang" echo "%lang(${lang}) %{_datadir}/%{name}/htdocs/langs/${lang}/*.lang"
fi fi
done >>%{name}.lang done >>%{name}.lang
@ -246,31 +246,31 @@ echo Create document directory $docdir
export config=%{_sysconfdir}/dolibarr/conf.php export config=%{_sysconfdir}/dolibarr/conf.php
if [ -s $config ] && grep -q "File generated by" $config if [ -s $config ] && grep -q "File generated by" $config
then then
# File already exist. We add params not found. # File already exist. We add params not found.
echo 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 || [ ! -d "/usr/share/php/adodb" ] || 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 || [ ! -d "/usr/share/php/fpdi" ] || 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 || [ ! -d "/usr/share/php/nusoap" ] || 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 || [ ! -d "/usr/share/php/libphp-pclzip" ] || 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 || [ ! -d "/usr/share/javascript/ckeditor" ] || 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 || [ ! -d "/usr/share/javascript/jquery" ] || 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 || [ ! -d "/usr/share/javascript/jquery-ui" ] || 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 || [ ! -d "/usr/share/javascript/flot" ] || 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/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/DejaVuSans-Bold.ttf'; ?>" >> $config
fi fi
# Create a config link dolibarr.conf # Create a config link dolibarr.conf
if [ ! -L $apachelink ]; then if [ ! -L $apachelink ]; then
apachelinkdir=`dirname $apachelink` apachelinkdir=`dirname $apachelink`
if [ -d $apachelinkdir ]; then if [ -d $apachelinkdir ]; then
echo Create dolibarr web server config link from %{_sysconfdir}/dolibarr/apache.conf to $apachelink echo Create dolibarr web server config link from %{_sysconfdir}/dolibarr/apache.conf to $apachelink
ln -fs %{_sysconfdir}/dolibarr/apache.conf $apachelink ln -fs %{_sysconfdir}/dolibarr/apache.conf $apachelink
else else
echo Do not create link $apachelink - web server conf dir $apachelinkdir not found. web server package may not be installed echo Do not create link $apachelink - web server conf dir $apachelinkdir not found. web server package may not be installed
fi fi
fi fi
echo Set permission to $apacheuser:$apachegroup on /var/lib/dolibarr echo Set permission to $apacheuser:$apachegroup on /var/lib/dolibarr
@ -280,18 +280,18 @@ echo Set permission to $apacheuser:$apachegroup on /var/lib/dolibarr
# Restart web server # Restart web server
echo Restart web server echo Restart web server
if [ -f %{_sysconfdir}/init.d/httpd ]; then if [ -f %{_sysconfdir}/init.d/httpd ]; then
%{_sysconfdir}/init.d/httpd restart %{_sysconfdir}/init.d/httpd restart
fi fi
if [ -f %{_sysconfdir}/init.d/apache2 ]; then if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart %{_sysconfdir}/init.d/apache2 restart
fi fi
# Restart mysql # Restart mysql
echo Restart mysql echo Restart mysql
if [ -f /etc/init.d/mysqld ]; then if [ -f /etc/init.d/mysqld ]; then
/etc/init.d/mysqld restart /etc/init.d/mysqld restart
else else
/sbin/service mysql restart /sbin/service mysql restart
fi fi
# Show result # Show result
@ -311,35 +311,35 @@ echo
if [ "x$1" = "x0" ] ; if [ "x$1" = "x0" ] ;
then then
# Remove # Remove
echo "Removed package" echo "Removed package"
# Define vars # Define vars
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf" export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
# Remove apache link # Remove apache link
if [ -L $apachelink ] ; if [ -L $apachelink ] ;
then then
echo "Delete apache config link for Dolibarr ($apachelink)" echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink %{__rm} -f $apachelink
status=purge status=purge
fi fi
# Restart web servers if required # Restart web servers if required
if [ "x$status" = "xpurge" ] ; if [ "x$status" = "xpurge" ] ;
then then
# Restart web server # Restart web server
echo Restart web server echo Restart web server
if [ -f %{_sysconfdir}/init.d/httpd ]; then if [ -f %{_sysconfdir}/init.d/httpd ]; then
%{_sysconfdir}/init.d/httpd restart %{_sysconfdir}/init.d/httpd restart
fi fi
if [ -f %{_sysconfdir}/init.d/apache2 ]; then if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart %{_sysconfdir}/init.d/apache2 restart
fi fi
fi fi
else else
# Upgrade # Upgrade
echo "No remove action done (this is an upgrade)" echo "No remove action done (this is an upgrade)"
fi fi

26
dev/fixnotabfiles.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/sh
#------------------------------------------------------
# Script to find files that are not Unix encoded
#
# Laurent Destailleur - eldy@users.sourceforge.net
#------------------------------------------------------
# Usage: fixnotabfiles.sh [list|fix]
#------------------------------------------------------
# Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then
echo "Usage: fixnotabfiles.sh [list|fix]"
fi
# To detec
if [ "x$1" = "xlist" ]
then
find build \( -iname "*.sh" -o -iname "*.spec" \) -exec grep -l -P '\t' {} \;
fi
# To convert
if [ "x$1" = "xfix" ]
then
echo Feature not implemented. Please fix files manually.
fi

File diff suppressed because one or more lines are too long

View File

@ -154,14 +154,14 @@ class autoTranslator
if (isset($this->_translatedFiles[$file]) && count($this->_translatedFiles[$file])>0) if (isset($this->_translatedFiles[$file]) && count($this->_translatedFiles[$file])>0)
{ {
$fp = fopen($destPath, 'a'); $fp = fopen($destPath, 'a');
fwrite($fp, "\r\n"); fwrite($fp, "\n");
fwrite($fp, "\r\n"); fwrite($fp, "\n");
fwrite($fp, "// START - Lines generated via autotranslator.php tool (".$this->_time.").\r\n"); fwrite($fp, "// START - Lines generated via autotranslator.php tool (".$this->_time.").\n");
fwrite($fp, "// Reference language: ".$this->_refLang." -> ".$my_destlang."\r\n"); fwrite($fp, "// Reference language: ".$this->_refLang." -> ".$my_destlang."\n");
foreach( $this->_translatedFiles[$file] as $line) { foreach( $this->_translatedFiles[$file] as $line) {
fwrite($fp, $line . "\r\n"); fwrite($fp, $line . "\n");
} }
fwrite($fp, "// STOP - Lines generated via autotranslator.php tool (".$this->_time_end.").\r\n"); fwrite($fp, "// STOP - Lines generated via autotranslator.php tool (".$this->_time_end.").\n");
fclose($fp); fclose($fp);
} }
return; return;
@ -177,11 +177,11 @@ class autoTranslator
private function createTranslationFile($path,$my_destlang) private function createTranslationFile($path,$my_destlang)
{ {
$fp = fopen($path, 'w+'); $fp = fopen($path, 'w+');
fwrite($fp, "/*\r\n"); fwrite($fp, "/*\n");
fwrite($fp, " * Language code: {$my_destlang}\r\n"); fwrite($fp, " * Language code: {$my_destlang}\n");
fwrite($fp, " * Automatic generated via autotranslator.php tool\r\n"); fwrite($fp, " * Automatic generated via autotranslator.php tool\n");
fwrite($fp, " * Generation date " . $this->_time. "\r\n"); fwrite($fp, " * Generation date " . $this->_time. "\n");
fwrite($fp, " */\r\n"); fwrite($fp, " */\n");
fclose($fp); fclose($fp);
return; return;
} }

View File

@ -13,7 +13,7 @@ then
echo "This push local files to transifex." echo "This push local files to transifex."
echo "Note: If you push a language file (not source), file will be skipped if transifex file is newer." echo "Note: If you push a language file (not source), file will be skipped if transifex file is newer."
echo " Using -f will overwrite translation but not memory." echo " Using -f will overwrite translation but not memory."
echo "Usage: txpush.sh (source|all|xx_XX) [-r dolibarr.file] [-f] [--skip] [--no-interactive]" echo "Usage: txpush.sh (source|all|xx_XX) [-r dolibarr.file] [-f] [--no-interactive]"
exit exit
fi fi
@ -22,8 +22,8 @@ if [ "x$1" = "xall" ]
then then
for fic in ar_SA bg_BG ca_ES da_DK de_DE el_GR es_ES et_EE fa_IR fi_FI fr_FR he_IL hu_HU is_IS it_IT ja_JP ko_KR nb_NO nl_NL pl_PL pt_PT ro_RO ru_RU ru_UA sl_SI sv_SE tr_TR vi_VN zh_CN zh_TW for fic in ar_SA bg_BG ca_ES da_DK de_DE el_GR es_ES et_EE fa_IR fi_FI fr_FR he_IL hu_HU is_IS it_IT ja_JP ko_KR nb_NO nl_NL pl_PL pt_PT ro_RO ru_RU ru_UA sl_SI sv_SE tr_TR vi_VN zh_CN zh_TW
do do
echo "tx push -t -l $fic $2 $3" echo "tx push --skip -t -l $fic $2 $3"
tx push -t -l $fic $2 $3 tx push --skip -t -l $fic $2 $3
done done
else else
if [ "x$1" = "xsource" ] if [ "x$1" = "xsource" ]
@ -31,7 +31,7 @@ then
echo "tx push -s $2 $3" echo "tx push -s $2 $3"
tx push -s $2 $3 tx push -s $2 $3
else else
echo "tx push -t -l $1 $2 $3 $4" echo "tx push --skip -t -l $1 $2 $3 $4"
tx push -t -l $1 $2 $3 $4 tx push --skip -t -l $1 $2 $3 $4
fi fi
fi fi

View File

@ -263,7 +263,7 @@ print '<br>';
/* /*
* Edition des variables globales non rattachées à un theme specifique * Editing global variables not related to a specific theme
*/ */
$constantes=array( $constantes=array(
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT', 'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT',

View File

@ -321,6 +321,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
$result=$object->update($user,0,$nosyncuser,$nosyncuserpass); $result=$object->update($user,0,$nosyncuser,$nosyncuserpass);
if ($result >= 0 && ! count($object->errors)) if ($result >= 0 && ! count($object->errors))
{ {
// Logo/Photo save
$dir= $conf->adherent->dir_output . '/' . get_exdir($object->id,2,0,1).'/photos'; $dir= $conf->adherent->dir_output . '/' . get_exdir($object->id,2,0,1).'/photos';
$file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
if ($file_OK) if ($file_OK)
@ -361,8 +362,21 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
$errmsgs[] = "ErrorBadImageFormat"; $errmsgs[] = "ErrorBadImageFormat";
} }
} }
else
{
switch($_FILES['photo']['error'])
{
case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini
case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form
$errors[] = "ErrorFileSizeTooLarge";
break;
case 3: //uploaded file was only partially uploaded
$errors[] = "ErrorFilePartiallyUploaded";
break;
}
}
$rowid=$object->id; $rowid=$object->id;
$action=''; $action='';
if (! empty($backtopage)) if (! empty($backtopage))

View File

@ -561,9 +561,9 @@ if ($action == 'edit' || $action == 'updateedit')
print '<td align="right">&nbsp;</td>'; print '<td align="right">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
$var=true; $var=true;
$var=!$var; $var=!$var;
print "<tr ".$bc[$var]."><td width=\"140\"><label><input type=\"radio\" name=\"optionlocaltax1\" value=\"localtax1on\"".($conf->global->FACTURE_LOCAL_TAX1_OPTION != "localtax1off"?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code)."</label></td>"; // Note: When option is not set, it must not appears as set on on, because there is no default value for this option
print "<tr ".$bc[$var]."><td width=\"140\"><label><input type=\"radio\" name=\"optionlocaltax1\" value=\"localtax1on\"".(($conf->global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on")?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code)."</label></td>";
print '<td colspan="2">'; print '<td colspan="2">';
print "<table>"; print "<table>";
print "<tr><td>".$langs->transcountry("LocalTax1IsUsedDesc",$mysoc->country_code)."</td></tr>"; print "<tr><td>".$langs->transcountry("LocalTax1IsUsedDesc",$mysoc->country_code)."</td></tr>";
@ -595,7 +595,8 @@ if ($action == 'edit' || $action == 'updateedit')
$var=true; $var=true;
$var=!$var; $var=!$var;
print "<tr ".$bc[$var]."><td width=\"140\"><label><input type=\"radio\" name=\"optionlocaltax2\" value=\"localtax2on\"".($conf->global->FACTURE_LOCAL_TAX2_OPTION != "localtax2off"?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code)."</label></td>"; // Note: When option is not set, it must not appears as set on on, because there is no default value for this option
print "<tr ".$bc[$var]."><td width=\"140\"><label><input type=\"radio\" name=\"optionlocaltax2\" value=\"localtax2on\"".(($conf->global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on")?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code)."</label></td>";
print '<td colspan="2">'; print '<td colspan="2">';
print "<table>"; print "<table>";
print "<tr><td>".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code)."</td></tr>"; print "<tr><td>".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code)."</td></tr>";
@ -941,7 +942,7 @@ else
$var=true; $var=true;
$var=!$var; $var=!$var;
print "<tr ".$bc[$var]."><td width=\"140\"><label><input ".$bc[$var]." type=\"radio\" name=\"optionlocaltax1\" disabled value=\"localtax1on\"".($conf->global->FACTURE_LOCAL_TAX1_OPTION != "localtax1off"?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code)."</label></td>"; print "<tr ".$bc[$var]."><td width=\"140\"><label><input ".$bc[$var]." type=\"radio\" name=\"optionlocaltax1\" disabled value=\"localtax1on\"".(($conf->global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on")?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code)."</label></td>";
print '<td colspan="2">'; print '<td colspan="2">';
print "<table>"; print "<table>";
print "<tr><td>".$langs->transcountry("LocalTax1IsUsedDesc",$mysoc->country_code)."</td></tr>"; print "<tr><td>".$langs->transcountry("LocalTax1IsUsedDesc",$mysoc->country_code)."</td></tr>";
@ -974,7 +975,7 @@ else
$var=true; $var=true;
$var=!$var; $var=!$var;
print "<tr ".$bc[$var]."><td width=\"140\"><label><input ".$bc[$var]." type=\"radio\" name=\"optionlocaltax2\" disabled value=\"localtax2on\"".($conf->global->FACTURE_LOCAL_TAX2_OPTION != "localtax2off"?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code)."</label></td>"; print "<tr ".$bc[$var]."><td width=\"140\"><label><input ".$bc[$var]." type=\"radio\" name=\"optionlocaltax2\" disabled value=\"localtax2on\"".(($conf->global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on")?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code)."</label></td>";
print '<td colspan="2">'; print '<td colspan="2">';
print "<table>"; print "<table>";
print "<tr><td>".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code)."</td></tr>"; print "<tr><td>".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code)."</td></tr>";

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.org> * Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.org>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2013 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
@ -40,15 +40,6 @@ $action = GETPOST('action','alpha');
* Actions * Actions
*/ */
if ($action == 'setMAILING_EMAIL_UNSUBSCRIBE')
{
$res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE",1,'chaine',0,'',$conf->entity);
}
if ($action == 'unsetMAILING_EMAIL_UNSUBSCRIBE')
{
$res=dolibarr_del_const($db, "MAILING_EMAIL_UNSUBSCRIBE");
}
if ($action == 'setvalue') if ($action == 'setvalue')
{ {
$db->begin(); $db->begin();
@ -62,22 +53,8 @@ if ($action == 'setvalue')
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++;
if ($checkread=='on')
{
$res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE",1,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
}
else if ($checkread=='off')
{
$res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE",0,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
}
//Create temporary encryption key if nedded // Create temporary encryption key if nedded
if (($conf->global->MAILING_EMAIL_UNSUBSCRIBE==1) && (empty($checkread_key)))
{
$checkread_key=getRandomPassword(true);
}
$res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE_KEY",$checkread_key,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE_KEY",$checkread_key,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
@ -157,32 +134,13 @@ 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>';
// TODO the precedent values are deleted after turn on this switch // Constant to add salt into the unsubscribe and check read tag.
$var=!$var; // It is also used as a security key parameter.
print '<tr '.$bc[$var].'><td>';
print $langs->trans("ActivateCheckRead").'</td><td>';
if (!empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE))
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetMAILING_EMAIL_UNSUBSCRIBE">';
print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>';
$readonly='';
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setMAILING_EMAIL_UNSUBSCRIBE">';
print img_picto($langs->trans("Disabled"),'switch_off');
print '</a>';
$readonly='disabled="disabled"';
}
print '</td></tr>';
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'; print '<tr '.$bc[$var].'><td>';
print $langs->trans("ActivateCheckReadKey").'</td><td>'; print $langs->trans("ActivateCheckReadKey").'</td><td>';
print '<input size="32" type="text" name="MAILING_EMAIL_UNSUBSCRIBE_KEY" id="MAILING_EMAIL_UNSUBSCRIBE_KEY" '.$readonly.' value="'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY.'">'; print '<input size="32" type="text" name="MAILING_EMAIL_UNSUBSCRIBE_KEY" id="MAILING_EMAIL_UNSUBSCRIBE_KEY" value="'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY.'">';
if (! empty($conf->use_javascript_ajax)) if (! empty($conf->use_javascript_ajax)) print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2011-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013 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
@ -196,13 +196,14 @@ print '</tr>';
print '</table>'; print '</table>';
dol_fiche_end(); print '<br><center>';
print '<center>';
print '<input type="submit" class="button" name="button" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button" name="button" value="'.$langs->trans("Modify").'">';
print '</center>'; print '</center>';
print '</form><br>'; print '</form>';
dol_fiche_end();
$db->close(); $db->close();

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013 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
@ -327,7 +327,7 @@ dol_fiche_end();
// Form to test upload // Form to test upload
print '<br>'; print '<br>';
$formfile=new FormFile($db); $formfile=new FormFile($db);
$formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestFileUploadForm"), 0, 0, 1); $formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestFileUploadForm"), 0, 0, 1, 50, '', '', 1, '', 0);
// List of document // List of document
$filearray=dol_dir_list($upload_dir, "files", 0, '', '', 'name', SORT_ASC, 1); $filearray=dol_dir_list($upload_dir, "files", 0, '', '', 'name', SORT_ASC, 1);

View File

@ -105,6 +105,11 @@ $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';
if (preg_match('/^es_/i',$langs->getDefaultLang())) $url='http://wiki.dolibarr.org/index.php/Subscribirse'; 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 '<li><a href="'.$url.'" target="_blank">'.$langs->trans("SubscribeToFoundation").'</a></li>';
print '<li><a href="http://facebook.com/dolibarr" target="_blank">FaceBook</a></li>';
print '<li><a href="http://twitter.com/dolibarr" target="_blank">Twitter</a></li>';
print '<li><a href="http://plus.google.com/+DolibarrOrg" target="_blank">Google Plus page</a></li>';
print '</ul>'; print '</ul>';

View File

@ -27,8 +27,7 @@ include_once DOL_DOCUMENT_ROOT.'/boutique/commande/class/boutiquecommande.class.
/** /**
* \class BoutiqueCommande * Class to manage orders OSC
* \brief Classe permettant la gestion des commandes OSC
*/ */
class BoutiqueCommande class BoutiqueCommande
{ {

View File

@ -118,7 +118,8 @@ if (empty($reshook))
} }
if ($type==1 && $user->rights->societe->creer) if ($type==1 && $user->rights->societe->creer)
{ {
$object = new Societe($db); require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
$object = new Fournisseur($db);
$result = $object->fetch($objectid); $result = $object->fetch($objectid);
$elementtype = 'fournisseur'; $elementtype = 'fournisseur';
} }
@ -165,7 +166,8 @@ if (empty($reshook))
} }
if ($type==1 && $user->rights->societe->creer) if ($type==1 && $user->rights->societe->creer)
{ {
$object = new Societe($db); require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
$object = new Fournisseur($db);
$result = $object->fetch($objectid); $result = $object->fetch($objectid);
$elementtype = 'fournisseur'; $elementtype = 'fournisseur';
} }
@ -319,11 +321,11 @@ if ($socid)
dol_fiche_end(); dol_fiche_end();
if ($soc->client) formCategory($db,$soc,2,$socid); if ($soc->client) formCategory($db,$soc,2,$socid,$user->rights->societe->creer);
if ($soc->client && $soc->fournisseur) print '<br><br>'; if ($soc->client && $soc->fournisseur) print '<br><br>';
if ($soc->fournisseur) formCategory($db,$soc,1,$socid); if ($soc->fournisseur) formCategory($db,$soc,1,$socid,$user->rights->societe->creer);
} }
else if ($id || $ref) else if ($id || $ref)
{ {
@ -377,7 +379,7 @@ else if ($id || $ref)
dol_fiche_end(); dol_fiche_end();
formCategory($db,$product,0); formCategory($db,$product,0,($user->rights->produit->creer || $user->rights->service->creer));
} }
if ($type == 3) if ($type == 3)
@ -456,7 +458,7 @@ else if ($id || $ref)
dol_fiche_end(); dol_fiche_end();
formCategory($db,$member,3); formCategory($db,$member,3,0,$user->rights->adherent->creer);
} }
if ($type == 4) if ($type == 4)
{ {
@ -602,7 +604,7 @@ else if ($id || $ref)
dol_fiche_end(); dol_fiche_end();
formCategory($db,$object,4); formCategory($db,$object,4,$user->rights->societe->creer);
} }
} }
@ -610,13 +612,14 @@ else if ($id || $ref)
/** /**
* Function to output a form to add object into a category * Function to output a form to add object into a category
* *
* @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 * @param int $socid Id thirdparty
* @param string $showclassifyform 1=Add form to 'Classify', 0=Do not show form to 'Classify'
* @return int 0 * @return int 0
*/ */
function formCategory($db,$object,$typeid,$socid=0) function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1)
{ {
global $user,$langs,$form,$bc; global $user,$langs,$form,$bc;
@ -626,33 +629,37 @@ function formCategory($db,$object,$typeid,$socid=0)
if ($typeid == 3) $title = $langs->trans("MembersCategoriesShort"); if ($typeid == 3) $title = $langs->trans("MembersCategoriesShort");
if ($typeid == 4) $title = $langs->trans("ContactCategoriesShort"); if ($typeid == 4) $title = $langs->trans("ContactCategoriesShort");
// Form to add record into a category
print '<br>'; print '<br>';
print_fiche_titre($title,'',''); print_fiche_titre($title,'','');
print '<form method="post" action="'.DOL_URL_ROOT.'/categories/categorie.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; // Form to add record into a category
print '<input type="hidden" name="typeid" value="'.$typeid.'">'; if ($showclassifyform)
print '<input type="hidden" name="type" value="'.$typeid.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="40%">';
print $langs->trans("ClassifyInCategory").' &nbsp;';
print $form->select_all_categories($typeid,'auto');
print '</td><td>';
print '<input type="submit" class="button" value="'.$langs->trans("Classify").'"></td>';
if ($user->rights->categorie->creer)
{ {
print '<td align="right">'; print '<form method="post" action="'.DOL_URL_ROOT.'/categories/categorie.php">';
print '<a href="'.DOL_URL_ROOT.'/categories/fiche.php?action=create&amp;origin='.$object->id.'&type='.$typeid.'&urlfrom='.urlencode($_SERVER["PHP_SELF"].'?'.(($typeid==1||$typeid==2)?'socid':'id').'='.$object->id.'&type='.$typeid).'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print $langs->trans("CreateCat").' '; print '<input type="hidden" name="typeid" value="'.$typeid.'">';
print img_picto($langs->trans("Create"),'filenew'); print '<input type="hidden" name="type" value="'.$typeid.'">';
print "</a>"; print '<input type="hidden" name="id" value="'.$object->id.'">';
print '</td>'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="40%">';
print $langs->trans("ClassifyInCategory").' &nbsp;';
print $form->select_all_categories($typeid,'auto');
print '</td><td>';
print '<input type="submit" class="button" value="'.$langs->trans("Classify").'"></td>';
if ($user->rights->categorie->creer)
{
print '<td align="right">';
print '<a href="'.DOL_URL_ROOT.'/categories/fiche.php?action=create&amp;origin='.$object->id.'&type='.$typeid.'&urlfrom='.urlencode($_SERVER["PHP_SELF"].'?'.(($typeid==1||$typeid==2)?'socid':'id').'='.$object->id.'&type='.$typeid).'">';
print $langs->trans("CreateCat").' ';
print img_picto($langs->trans("Create"),'filenew');
print "</a>";
print '</td>';
}
print '</tr>';
print '</table>';
print '</form>';
print '<br>';
} }
print '</tr>';
print '</table>';
print '</form>';
print '<br/>';
$c = new Categorie($db); $c = new Categorie($db);

View File

@ -386,7 +386,7 @@ class Categorie
* Link an object to the category * Link an object to the category
* *
* @param Object $obj Object to link to category * @param Object $obj Object to link to category
* @param string $type Type of category (member, supplier, product, customer, contact) * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact')
* @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked * @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked
*/ */
function add_type($obj,$type) function add_type($obj,$type)
@ -397,11 +397,14 @@ class Categorie
if ($this->id == -1) return -2; if ($this->id == -1) return -2;
if ($type == 'company') $type='societe'; // For backward compatibility
if ($type == 'fournisseur') $type='societe'; if ($type == 'company') $type='societe';
if ($type == 'customer') $type='societe';
if ($type == 'supplier') $type='fournisseur';
$column_name=$type; $column_name=$type;
if ($type=='contact') $column_name='socpeople'; if ($type=='contact') $column_name='socpeople';
if ($type=='fournisseur') $column_name='societe';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_".$type." (fk_categorie, fk_".$column_name.")"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_".$type." (fk_categorie, fk_".$column_name.")";
$sql .= " VALUES (".$this->id.", ".$obj->id.")"; $sql .= " VALUES (".$this->id.", ".$obj->id.")";
@ -479,7 +482,7 @@ class Categorie
* Delete object from category * Delete object from category
* *
* @param Object $obj Object * @param Object $obj Object
* @param string $type Type * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact')
* @return int 1 if OK, -1 if KO * @return int 1 if OK, -1 if KO
*/ */
function del_type($obj,$type) function del_type($obj,$type)
@ -488,11 +491,14 @@ class Categorie
$error=0; $error=0;
if ($type == 'company') $type='societe'; // For backward compatibility
if ($type == 'fournisseur') $type='societe'; if ($type == 'company') $type='societe';
if ($type == 'customer') $type='societe';
if ($type == 'supplier') $type='fournisseur';
$column_name=$type; $column_name=$type;
if ($type=='contact') $column_name='socpeople'; if ($type=='contact') $column_name='socpeople';
if ($type=='fournisseur') $column_name='societe';
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_".$type; $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_".$type;
$sql .= " WHERE fk_categorie = ".$this->id; $sql .= " WHERE fk_categorie = ".$this->id;

View File

@ -887,7 +887,7 @@ class ActionComm extends CommonObject
$sql.= " AND a.entity = ".$conf->entity; $sql.= " AND a.entity = ".$conf->entity;
foreach ($filters as $key => $value) foreach ($filters as $key => $value)
{ {
if ($key == 'notolderthan') $sql.=" AND a.datep >= '".$this->db->idate($now-($value*24*60*60))."'"; if ($key == 'notolderthan' && $value != '') $sql.=" AND a.datep >= '".$this->db->idate($now-($value*24*60*60))."'";
if ($key == 'year') $sql.=" AND a.datep BETWEEN '".$this->db->idate(dol_get_first_day($value,1))."' AND '".$this->db->idate(dol_get_last_day($value,12))."'"; if ($key == 'year') $sql.=" AND a.datep BETWEEN '".$this->db->idate(dol_get_first_day($value,1))."' AND '".$this->db->idate(dol_get_last_day($value,12))."'";
if ($key == 'id') $sql.=" AND a.id=".(is_numeric($value)?$value:0); if ($key == 'id') $sql.=" AND a.id=".(is_numeric($value)?$value:0);
if ($key == 'idfrom') $sql.=" AND a.id >= ".(is_numeric($value)?$value:0); if ($key == 'idfrom') $sql.=" AND a.id >= ".(is_numeric($value)?$value:0);

View File

@ -1,11 +1,11 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.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
@ -202,7 +202,7 @@ if ($id > 0)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td><td width="70%" colspan="3">'; print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td><td width="70%" colspan="3">';
$object->next_prev_filter="te.client in (1,3)"; $object->next_prev_filter="te.client in (1,2,3)";
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','',''); print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
print '</td></tr>'; print '</td></tr>';
@ -389,7 +389,7 @@ if ($id > 0)
print '<td>'; print '<td>';
print $form->editfieldkey("OutstandingBill",'OutstandingBill',$object->outstanding_limit,$object,$user->rights->societe->creer); print $form->editfieldkey("OutstandingBill",'OutstandingBill',$object->outstanding_limit,$object,$user->rights->societe->creer);
print '</td><td colspan="3">'; print '</td><td colspan="3">';
print $form->editfieldval("OutstandingBill",'OutstandingBill',$object->outstanding_limit,$object,$user->rights->societe->creer); print $form->editfieldval("OutstandingBill",'OutstandingBill',$object->outstanding_limit,$object,$user->rights->societe->creer,'amount',($object->outstanding_limit != '' ? price($object->outstanding_limit) : ''));
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* *
* 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
@ -52,6 +53,8 @@ $search_zipcode=GETPOST("search_zipcode");
$search_town=GETPOST("search_town"); $search_town=GETPOST("search_town");
$search_code=GETPOST("search_code"); $search_code=GETPOST("search_code");
$search_compta=GETPOST("search_compta"); $search_compta=GETPOST("search_compta");
$search_status = GETPOST("search_status",'int');
if ($search_status=='') $search_status=1; // always display activ customer first
// Load sale and categ filters // Load sale and categ filters
$search_sale = GETPOST("search_sale"); $search_sale = GETPOST("search_sale");
@ -83,6 +86,7 @@ if (GETPOST("button_removefilter_x"))
$search_idprof2=''; $search_idprof2='';
$search_idprof3=''; $search_idprof3='';
$search_idprof4=''; $search_idprof4='';
$seach_status=1;
} }
@ -92,6 +96,7 @@ if (GETPOST("button_removefilter_x"))
*/ */
$formother=new FormOther($db); $formother=new FormOther($db);
$form = new Form($db);
$thirdpartystatic=new Societe($db); $thirdpartystatic=new Societe($db);
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
@ -125,6 +130,8 @@ if ($search_town) {
} }
if ($search_code) $sql.= " AND s.code_client LIKE '%".$db->escape($search_code)."%'"; if ($search_code) $sql.= " AND s.code_client LIKE '%".$db->escape($search_code)."%'";
if ($search_compta) $sql.= " AND s.code_compta LIKE '%".$db->escape($search_compta)."%'"; if ($search_compta) $sql.= " AND s.code_compta LIKE '%".$db->escape($search_compta)."%'";
if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status);
// Insert sale filter // Insert sale filter
if ($search_sale) if ($search_sale)
{ {
@ -152,6 +159,7 @@ if ($result)
$param = "&amp;search_nom=".$search_nom."&amp;search_code=".$search_code."&amp;search_zipcode=".$search_zipcode."&amp;search_town=".$search_town; $param = "&amp;search_nom=".$search_nom."&amp;search_code=".$search_code."&amp;search_zipcode=".$search_zipcode."&amp;search_town=".$search_town;
if ($search_categ != '') $param.='&amp;search_categ='.$search_categ; if ($search_categ != '') $param.='&amp;search_categ='.$search_categ;
if ($search_sale != '') $param.='&amp;search_sale='.$search_sale; if ($search_sale != '') $param.='&amp;search_sale='.$search_sale;
if ($search_status != '') $param.='&amp;search_status='.$search_status;
print_barre_liste($langs->trans("ListOfCustomers"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print_barre_liste($langs->trans("ListOfCustomers"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
@ -190,7 +198,7 @@ if ($result)
print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER["PHP_SELF"],"s.code_compta","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER["PHP_SELF"],"s.code_compta","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="right"',$sortfield,$sortorder);
print '<td class="liste_titre" width="1%">&nbsp;</td>';
$parameters=array(); $parameters=array();
$formconfirm=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook $formconfirm=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
@ -218,7 +226,13 @@ if ($result)
print '<input type="text" class="flat" name="search_compta" value="'.$search_compta.'" size="10">'; print '<input type="text" class="flat" name="search_compta" value="'.$search_compta.'" size="10">';
print '</td>'; print '</td>';
print '</td><td>&nbsp;</td>'; print '<td class="liste_titre" align="center">';
print '&nbsp;';
print '</td>';
print '<td class="liste_titre" align="center">';
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
print '</td>';
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '&nbsp; '; print '&nbsp; ';
@ -243,6 +257,7 @@ if ($result)
$thirdpartystatic->id=$obj->rowid; $thirdpartystatic->id=$obj->rowid;
$thirdpartystatic->name=$obj->name; $thirdpartystatic->name=$obj->name;
$thirdpartystatic->client=$obj->client; $thirdpartystatic->client=$obj->client;
$thirdpartystatic->code_client=$obj->code_client;
$thirdpartystatic->canvas=$obj->canvas; $thirdpartystatic->canvas=$obj->canvas;
$thirdpartystatic->status=$obj->status; $thirdpartystatic->status=$obj->status;
print $thirdpartystatic->getNomUrl(1); print $thirdpartystatic->getNomUrl(1);
@ -252,8 +267,9 @@ if ($result)
print '<td>'.$obj->code_client.'</td>'; print '<td>'.$obj->code_client.'</td>';
print '<td>'.$obj->code_compta.'</td>'; print '<td>'.$obj->code_compta.'</td>';
print '<td align="right">'.dol_print_date($db->jdate($obj->datec),'day').'</td>'; print '<td align="right">'.dol_print_date($db->jdate($obj->datec),'day').'</td>';
print '<td align="right">'.$thirdpartystatic->getLibStatut(3); print '<td align="center">'.$thirdpartystatic->getLibStatut(3);
print '</td>'; print '</td>';
print '<td></td>';
$parameters=array('obj' => $obj); $parameters=array('obj' => $obj);
$formconfirm=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook $formconfirm=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook

View File

@ -67,13 +67,10 @@ $object->substitutionarray=array(
'__OTHER4__' => 'Other4', '__OTHER4__' => 'Other4',
'__OTHER5__' => 'Other5', '__OTHER5__' => 'Other5',
'__SIGNATURE__' => 'TagSignature', '__SIGNATURE__' => 'TagSignature',
'__CHECK_READ__' => 'TagCheckMail' '__CHECK_READ__' => 'TagCheckMail',
'__UNSUBSCRIBE__' => 'TagUnsubscribe'
//,'__PERSONALIZED__' => 'Personalized' // Hidden because not used yet //,'__PERSONALIZED__' => 'Personalized' // Hidden because not used yet
); );
if (! empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE))
{
$object->substitutionarray=array_merge($object->substitutionarray, array('__UNSUBSCRIBE__' => 'TagUnsubscribe'));
}
$object->substitutionarrayfortest=array( $object->substitutionarrayfortest=array(
'__ID__' => 'TESTIdRecord', '__ID__' => 'TESTIdRecord',
@ -86,19 +83,12 @@ $object->substitutionarrayfortest=array(
'__OTHER3__' => 'TESTOther3', '__OTHER3__' => 'TESTOther3',
'__OTHER4__' => 'TESTOther4', '__OTHER4__' => 'TESTOther4',
'__OTHER5__' => 'TESTOther5', '__OTHER5__' => 'TESTOther5',
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$user->signature:'') '__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$user->signature:''),
//,'__PERSONALIZED__' => 'TESTPersonalized' // Not used yet '__CHECK_READ__' => 'TagCheckMail',
'__UNSUBSCRIBE__' => 'TagUnsubscribe'
//,'__PERSONALIZED__' => 'TESTPersonalized' // Not used yet
); );
if (!empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE))
{
$object->substitutionarrayfortest=array_merge(
$object->substitutionarrayfortest,
array(
'__CHECK_READ__' => 'TESTCheckMail',
'__UNSUBSCRIBE__' => 'TESTUnsubscribe'
)
);
}
/* /*
* Actions * Actions
@ -221,8 +211,8 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
$substitutionarray=array( $substitutionarray=array(
'__ID__' => $obj->source_id, '__ID__' => $obj->source_id,
'__EMAIL__' => $obj->email, '__EMAIL__' => $obj->email,
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'" width="1" height="1" style="width:1px;height:1px" border="0"/>', '__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
'__UNSUBSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>', '__UNSUBSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>',
'__MAILTOEMAIL__' => '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>', '__MAILTOEMAIL__' => '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>',
'__LASTNAME__' => $obj->lastname, '__LASTNAME__' => $obj->lastname,
'__FIRSTNAME__' => $obj->firstname, '__FIRSTNAME__' => $obj->firstname,

View File

@ -634,13 +634,33 @@ else if ($action == "setabsolutediscount" && $user->rights->propal->creer)
} }
// Add line // Add line
else if ($action == "addline" && $user->rights->propal->creer) else if (($action == 'addline' || $action == 'addline_predef') && $user->rights->propal->creer)
{ {
$idprod=GETPOST('idprod', 'int'); // Set if we used free entry or predefined product
$product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):(GETPOST('dp_desc')?GETPOST('dp_desc'):''))); if (GETPOST('addline_libre'))
$price_ht = GETPOST('price_ht'); {
$tva_tx = (GETPOST('tva_tx')?GETPOST('tva_tx'):0); $predef='';
$predef=((! empty($idprod) && $conf->global->MAIN_FEATURES_LEVEL < 2) ? '_predef' : ''); $idprod=0;
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
$price_ht = GETPOST('price_ht');
$tva_tx=(GETPOST('tva_tx')?GETPOST('tva_tx'):0);
}
if (GETPOST('addline_predefined'))
{
$predef=(($conf->global->MAIN_FEATURES_LEVEL < 2) ? '_predef' : '');
$idprod=GETPOST('idprod', 'int');
$product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):''));
$price_ht = '';
$tva_tx = '';
}
if (GETPOST('usenewaddlineform')) {
$idprod=GETPOST('idprod', 'int');
$product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):(GETPOST('dp_desc')?GETPOST('dp_desc'):'')));
$price_ht = GETPOST('price_ht');
$tva_tx=(GETPOST('tva_tx')?GETPOST('tva_tx'):0);
}
$qty = GETPOST('qty'.$predef);
$remise_percent=GETPOST('remise_percent'.$predef);
//Extrafields //Extrafields
$extrafieldsline = new ExtraFields($db); $extrafieldsline = new ExtraFields($db);
@ -673,7 +693,7 @@ else if ($action == "addline" && $user->rights->propal->creer)
$error++; $error++;
} }
if (! $error && (GETPOST('qty') >= 0) && (! empty($product_desc) || ! empty($idprod))) if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod)))
{ {
$pu_ht=0; $pu_ht=0;
$pu_ttc=0; $pu_ttc=0;
@ -791,8 +811,8 @@ else if ($action == "addline" && $user->rights->propal->creer)
} }
// Margin // Margin
$fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):''); $fournprice=(GETPOST('fournprice'.$predef)?GETPOST('fournprice'.$predef):'');
$buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):''); $buyingprice=(GETPOST('buying_price'.$predef)?GETPOST('buying_price'.$predef):'');
$date_start=dol_mktime(0, 0, 0, GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); $date_start=dol_mktime(0, 0, 0, GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
$date_end=dol_mktime(0, 0, 0, GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); $date_end=dol_mktime(0, 0, 0, GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
@ -804,7 +824,7 @@ else if ($action == "addline" && $user->rights->propal->creer)
$info_bits=0; $info_bits=0;
if ($tva_npr) $info_bits |= 0x01; if ($tva_npr) $info_bits |= 0x01;
if (! empty($price_min) && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) if (! empty($price_min) && (price2num($pu_ht)*(1-price2num($remise_percent)/100) < price2num($price_min)))
{ {
$mesg = $langs->trans("CantBeLessThanMinPrice",price(price2num($price_min,'MU'),0,$langs,0,0,-1,$conf->currency)); $mesg = $langs->trans("CantBeLessThanMinPrice",price(price2num($price_min,'MU'),0,$langs,0,0,-1,$conf->currency));
setEventMessage($mesg, 'errors'); setEventMessage($mesg, 'errors');
@ -815,12 +835,12 @@ else if ($action == "addline" && $user->rights->propal->creer)
$result=$object->addline( $result=$object->addline(
$desc, $desc,
$pu_ht, $pu_ht,
GETPOST('qty'), $qty,
$tva_tx, $tva_tx,
$localtax1_tx, $localtax1_tx,
$localtax2_tx, $localtax2_tx,
$idprod, $idprod,
GETPOST('remise_percent'), $remise_percent,
$price_base_type, $price_base_type,
$pu_ttc, $pu_ttc,
$info_bits, $info_bits,
@ -854,7 +874,6 @@ else if ($action == "addline" && $user->rights->propal->creer)
unset($_POST['qty']); unset($_POST['qty']);
unset($_POST['type']); unset($_POST['type']);
unset($_POST['idprod']);
unset($_POST['remise_percent']); unset($_POST['remise_percent']);
unset($_POST['price_ht']); unset($_POST['price_ht']);
unset($_POST['price_ttc']); unset($_POST['price_ttc']);
@ -866,10 +885,16 @@ else if ($action == "addline" && $user->rights->propal->creer)
unset($_POST['buying_price']); unset($_POST['buying_price']);
unset($_POST['np_marginRate']); unset($_POST['np_marginRate']);
unset($_POST['np_markRate']); unset($_POST['np_markRate']);
// old method
unset($_POST['np_desc']);
unset($_POST['dp_desc']); unset($_POST['dp_desc']);
unset($_POST['idprod']);
unset($_POST['qty_predef']);
unset($_POST['remise_percent_predef']);
unset($_POST['fournprice_predef']);
unset($_POST['buying_price_predef']);
unset($_POST['np_marginRate_predef']);
unset($_POST['np_markRate_predef']);
unset($_POST['np_desc']);
} }
else else
{ {
@ -2003,15 +2028,25 @@ else
* Lines * Lines
*/ */
// Show object lines
$result = $object->getLinesArray();
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline')?'#add':'#line_'.GETPOST('lineid')).'" method="POST">
<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">
<input type="hidden" name="action" value="'.(($action != 'editline')?'addline':'updateligne').'">
<input type="hidden" name="mode" value="">
<input type="hidden" name="id" value="'.$object->id.'">
';
if (! empty($conf->use_javascript_ajax) && $object->statut == 0) if (! empty($conf->use_javascript_ajax) && $object->statut == 0)
{ {
include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
} }
print '<table id="tablelines" class="noborder" width="100%">'; print '<table id="tablelines" class="noborder noshadow" width="100%">';
// Show object lines
$result = $object->getLinesArray();
if (! empty($object->lines)) if (! empty($object->lines))
$ret=$object->printObjectLines($action,$mysoc,$soc,$lineid,1); $ret=$object->printObjectLines($action,$mysoc,$soc,$lineid,1);
@ -2047,8 +2082,9 @@ else
print '</table>'; print '</table>';
print '</div>'; print "</form>\n";
print "\n";
dol_fiche_end();
if ($action == 'statut') if ($action == 'statut')
{ {

View File

@ -1710,7 +1710,7 @@ class Propal extends CommonObject
{ {
if ($statut == 2) if ($statut == 2)
{ {
// Classe la société rattachée comme client // The connected company is classified as a client
$soc=new Societe($this->db); $soc=new Societe($this->db);
$soc->id = $this->socid; $soc->id = $this->socid;
$result=$soc->set_as_client(); $result=$soc->set_as_client();

View File

@ -22,7 +22,7 @@
/** /**
* \file htdocs/comm/propal/document.php * \file htdocs/comm/propal/document.php
* \ingroup propale * \ingroup propale
* \brief Page de gestion des documents attaches a une proposition commerciale * \brief Management page of documents attached to a business proposal
*/ */
require '../../main.inc.php'; require '../../main.inc.php';

View File

@ -47,6 +47,8 @@ $search_town = GETPOST("search_town");
$search_state = GETPOST("search_state"); $search_state = GETPOST("search_state");
$search_datec = GETPOST("search_datec"); $search_datec = GETPOST("search_datec");
$search_categ = GETPOST("search_categ",'int'); $search_categ = GETPOST("search_categ",'int');
$search_status = GETPOST("search_status",'int');
if ($search_status=='') $search_status=1; // always display activ customer first
$catid = GETPOST("catid",'int'); $catid = GETPOST("catid",'int');
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
@ -173,8 +175,9 @@ if ($action == 'cstc')
*/ */
$formother=new FormOther($db); $formother=new FormOther($db);
$form=new Form($db);
$sql = "SELECT s.rowid, s.nom, s.zip, s.town, s.datec, s.datea, s.status as status,"; $sql = "SELECT s.rowid, s.nom, s.zip, s.town, s.datec, s.datea, s.status as status, s.code_client, s.client,";
$sql.= " st.libelle as stcomm, s.prefix_comm, s.fk_stcomm, s.fk_prospectlevel,"; $sql.= " st.libelle as stcomm, s.prefix_comm, s.fk_stcomm, s.fk_prospectlevel,";
$sql.= " d.nom as departement"; $sql.= " d.nom as departement";
// Updated by Matelli // Updated by Matelli
@ -205,6 +208,7 @@ if ($search_state) {
$sql .= natural_search('d.nom', $search_state); $sql .= natural_search('d.nom', $search_state);
} }
if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'"; if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'";
if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status);
// Insert levels filters // Insert levels filters
if ($search_levels) if ($search_levels)
{ {
@ -231,7 +235,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$sql.= " ORDER BY $sortfield $sortorder, s.nom ASC"; $sql.= " ORDER BY $sortfield $sortorder, s.nom ASC";
$sql.= $db->plimit($conf->liste_limit+1, $offset); $sql.= $db->plimit($conf->liste_limit+1, $offset);
dol_syslog('comm/prospect/list.php sql='.$sql,LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
@ -265,6 +269,7 @@ if ($resql)
if ($search_level_to != '') $param.='&amp;search_level_to='.$search_level_to; if ($search_level_to != '') $param.='&amp;search_level_to='.$search_level_to;
if ($search_categ != '') $param.='&amp;search_categ='.$search_categ; if ($search_categ != '') $param.='&amp;search_categ='.$search_categ;
if ($search_sale != '') $param.='&amp;search_sale='.$search_sale; if ($search_sale != '') $param.='&amp;search_sale='.$search_sale;
if ($search_status != '') $param.='&amp;search_status='.$search_status;
// $param and $urladd should have the same value // $param and $urladd should have the same value
$urladd = $param; $urladd = $param;
@ -306,7 +311,8 @@ if ($resql)
print_liste_field_titre($langs->trans("ProspectLevelShort"),$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("ProspectLevelShort"),$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("StatusProsp"),$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("StatusProsp"),$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder);
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
print '<td class="liste_titre">&nbsp;</td>';
$parameters=array(); $parameters=array();
$formconfirm=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook $formconfirm=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
@ -368,6 +374,10 @@ if ($resql)
print '&nbsp;'; print '&nbsp;';
print '</td>'; print '</td>';
print '<td class="liste_titre" align="center">';
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
print '</td>';
// Print the search button // Print the search button
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
print '<input class="liste_titre" name="button_search" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input class="liste_titre" name="button_search" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
@ -395,6 +405,8 @@ if ($resql)
$prospectstatic->id=$obj->rowid; $prospectstatic->id=$obj->rowid;
$prospectstatic->nom=$obj->nom; $prospectstatic->nom=$obj->nom;
$prospectstatic->status=$obj->status; $prospectstatic->status=$obj->status;
$prospectstatic->code_client=$obj->code_client;
$prospectstatic->client=$obj->client;
$prospectstatic->fk_prospectlevel=$obj->fk_prospectlevel; $prospectstatic->fk_prospectlevel=$obj->fk_prospectlevel;
print $prospectstatic->getNomUrl(1,'prospect'); print $prospectstatic->getNomUrl(1,'prospect');
print '</td>'; print '</td>';
@ -425,9 +437,10 @@ if ($resql)
} }
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="center">';
print $prospectstatic->LibStatut($prospectstatic->status,3); print $prospectstatic->LibStatut($prospectstatic->status,3);
print '</td>'; print '</td>';
print '<td></td>';
$parameters=array('obj' => $obj); $parameters=array('obj' => $obj);
$formconfirm=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook $formconfirm=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook

View File

@ -269,7 +269,7 @@ class Commande extends CommonOrder
if (preg_match('/^[\(]?PROV/i', $this->ref)) if (preg_match('/^[\(]?PROV/i', $this->ref))
{ {
// On renomme repertoire ($this->ref = ancienne ref, $numfa = nouvelle ref) // On renomme repertoire ($this->ref = ancienne ref, $numfa = nouvelle ref)
// afin de ne pas perdre les fichiers attaches // in order not to lose the attachments
$comref = dol_sanitizeFileName($this->ref); $comref = dol_sanitizeFileName($this->ref);
$snum = dol_sanitizeFileName($num); $snum = dol_sanitizeFileName($num);
$dirsource = $conf->commande->dir_output.'/'.$comref; $dirsource = $conf->commande->dir_output.'/'.$comref;

View File

@ -22,7 +22,7 @@
/** /**
* \file htdocs/commande/document.php * \file htdocs/commande/document.php
* \ingroup order * \ingroup order
* \brief Documents setup page attached to an order * \brief Management page of documents attached to an order
*/ */
require '../main.inc.php'; require '../main.inc.php';

View File

@ -564,18 +564,37 @@ else if ($action == 'setnote_private' && $user->rights->commande->creer)
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
} }
/* // Add a new line
* Ajout d'une ligne produit dans la commande
*/
else if ($action == 'addline' && $user->rights->commande->creer) else if ($action == 'addline' && $user->rights->commande->creer)
{ {
$langs->load('errors'); $langs->load('errors');
$error = false; $error = false;
$idprod=GETPOST('idprod', 'int'); // Set if we used free entry or predefined product
$product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):(GETPOST('dp_desc')?GETPOST('dp_desc'):''))); if (GETPOST('addline_libre'))
$price_ht = GETPOST('price_ht'); {
$tva_tx = (GETPOST('tva_tx')?GETPOST('tva_tx'):0); $predef='';
$idprod=0;
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
$price_ht = GETPOST('price_ht');
$tva_tx=(GETPOST('tva_tx')?GETPOST('tva_tx'):0);
}
if (GETPOST('addline_predefined'))
{
$predef=(($conf->global->MAIN_FEATURES_LEVEL < 2) ? '_predef' : '');
$idprod=GETPOST('idprod', 'int');
$product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):''));
$price_ht = '';
$tva_tx = '';
}
if (GETPOST('usenewaddlineform')) {
$idprod=GETPOST('idprod', 'int');
$product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):(GETPOST('dp_desc')?GETPOST('dp_desc'):'')));
$price_ht = GETPOST('price_ht');
$tva_tx=(GETPOST('tva_tx')?GETPOST('tva_tx'):0);
}
$qty = GETPOST('qty'.$predef);
$remise_percent=GETPOST('remise_percent'.$predef);
//Extrafields //Extrafields
$extrafieldsline = new ExtraFields($db); $extrafieldsline = new ExtraFields($db);
@ -591,7 +610,7 @@ else if ($action == 'addline' && $user->rights->commande->creer)
} }
} }
if ((empty($idprod) || GETPOST('usenewaddlineform')) && ($price_ht < 0) && (GETPOST('qty') < 0)) if ((empty($idprod) || GETPOST('usenewaddlineform')) && ($price_ht < 0) && ($qty < 0))
{ {
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors'); setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors');
$error = true; $error = true;
@ -606,7 +625,7 @@ else if ($action == 'addline' && $user->rights->commande->creer)
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
$error++; $error++;
} }
if (! GETPOST('qty') && GETPOST('qty') == '') if ($qty == '')
{ {
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors'); setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors');
$error = true; $error = true;
@ -617,10 +636,9 @@ else if ($action == 'addline' && $user->rights->commande->creer)
$error = true; $error = true;
} }
if (! $error && (GETPOST('qty') >= 0) && (! empty($product_desc) || ! empty($idprod))) if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod)))
{ {
// Clean parameters // Clean parameters
$predef=((! empty($idprod) && $conf->global->MAIN_FEATURES_LEVEL < 2) ? '_predef' : '');
$date_start=dol_mktime(0, 0, 0, GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); $date_start=dol_mktime(0, 0, 0, GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
$date_end=dol_mktime(0, 0, 0, GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); $date_end=dol_mktime(0, 0, 0, GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
$price_base_type = (GETPOST('price_base_type', 'alpha')?GETPOST('price_base_type', 'alpha'):'HT'); $price_base_type = (GETPOST('price_base_type', 'alpha')?GETPOST('price_base_type', 'alpha'):'HT');
@ -737,8 +755,8 @@ else if ($action == 'addline' && $user->rights->commande->creer)
} }
// Margin // Margin
$fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):''); $fournprice=(GETPOST('fournprice'.$predef)?GETPOST('fournprice'.$predef):'');
$buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):''); $buyingprice=(GETPOST('buying_price'.$predef)?GETPOST('buying_price'.$predef):'');
// Local Taxes // Local Taxes
$localtax1_tx= get_localtax($tva_tx, 1, $object->client); $localtax1_tx= get_localtax($tva_tx, 1, $object->client);
@ -749,7 +767,7 @@ else if ($action == 'addline' && $user->rights->commande->creer)
$info_bits=0; $info_bits=0;
if ($tva_npr) $info_bits |= 0x01; if ($tva_npr) $info_bits |= 0x01;
if (! empty($price_min) && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) if (! empty($price_min) && (price2num($pu_ht)*(1-price2num($remise_percent)/100) < price2num($price_min)))
{ {
$mesg = $langs->trans("CantBeLessThanMinPrice",price(price2num($price_min,'MU'),0,$langs,0,0,-1,$conf->currency)); $mesg = $langs->trans("CantBeLessThanMinPrice",price(price2num($price_min,'MU'),0,$langs,0,0,-1,$conf->currency));
setEventMessage($mesg, 'errors'); setEventMessage($mesg, 'errors');
@ -760,12 +778,12 @@ else if ($action == 'addline' && $user->rights->commande->creer)
$result = $object->addline( $result = $object->addline(
$desc, $desc,
$pu_ht, $pu_ht,
GETPOST('qty'), $qty,
$tva_tx, $tva_tx,
$localtax1_tx, $localtax1_tx,
$localtax2_tx, $localtax2_tx,
$idprod, $idprod,
GETPOST('remise_percent'), $remise_percent,
$info_bits, $info_bits,
0, 0,
$price_base_type, $price_base_type,
@ -803,7 +821,6 @@ else if ($action == 'addline' && $user->rights->commande->creer)
unset($_POST['qty']); unset($_POST['qty']);
unset($_POST['type']); unset($_POST['type']);
unset($_POST['idprod']);
unset($_POST['remise_percent']); unset($_POST['remise_percent']);
unset($_POST['price_ht']); unset($_POST['price_ht']);
unset($_POST['price_ttc']); unset($_POST['price_ttc']);
@ -815,10 +832,16 @@ else if ($action == 'addline' && $user->rights->commande->creer)
unset($_POST['buying_price']); unset($_POST['buying_price']);
unset($_POST['np_marginRate']); unset($_POST['np_marginRate']);
unset($_POST['np_markRate']); unset($_POST['np_markRate']);
// old method
unset($_POST['np_desc']);
unset($_POST['dp_desc']); unset($_POST['dp_desc']);
unset($_POST['idprod']);
unset($_POST['qty_predef']);
unset($_POST['remise_percent_predef']);
unset($_POST['fournprice_predef']);
unset($_POST['buying_price_predef']);
unset($_POST['np_marginRate_predef']);
unset($_POST['np_markRate_predef']);
unset($_POST['np_desc']);
} }
else else
{ {
@ -1449,7 +1472,7 @@ if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->righ
/* /*
* View * View
*/ */
llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'); llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes');
@ -1460,9 +1483,9 @@ $formorder = new FormOrder($db);
/********************************************************************* /*********************************************************************
* *
* Mode creation * Mode creation
* *
*********************************************************************/ *********************************************************************/
if ($action == 'create' && $user->rights->commande->creer) if ($action == 'create' && $user->rights->commande->creer)
{ {
print_fiche_titre($langs->trans('CreateOrder')); print_fiche_titre($langs->trans('CreateOrder'));
@ -2311,25 +2334,34 @@ else
/* /*
* Lines * Lines
*/ */
$result = $object->getLinesArray(); $result = $object->getLinesArray();
$numlines = count($object->lines);
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline')?'#add':'#line_'.GETPOST('lineid')).'" method="POST">
<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">
<input type="hidden" name="action" value="'.(($action != 'editline')?'addline':'updateligne').'">
<input type="hidden" name="mode" value="">
<input type="hidden" name="id" value="'.$object->id.'">
';
if (! empty($conf->use_javascript_ajax) && $object->statut == 0) if (! empty($conf->use_javascript_ajax) && $object->statut == 0)
{ {
include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
} }
print '<table id="tablelines" class="noborder" width="100%">'; print '<table id="tablelines" class="noborder noshadow" width="100%">';
// Show object lines // Show object lines
if (! empty($object->lines)) if (! empty($object->lines))
$ret=$object->printObjectLines($action,$mysoc,$soc,$lineid,1); $ret=$object->printObjectLines($action,$mysoc,$soc,$lineid,1);
$numlines = count($object->lines);
/* /*
* Form to add new line * Form to add new line
*/ */
if ($object->statut == 0 && $user->rights->commande->creer) if ($object->statut == 0 && $user->rights->commande->creer)
{ {
if ($action != 'editline') if ($action != 'editline')
@ -2359,7 +2391,10 @@ else
} }
} }
print '</table>'; print '</table>';
print '</div>';
print "</form>\n";
dol_fiche_end();
/* /*

View File

@ -65,28 +65,26 @@ llxHeader('',$langs->trans("TaxAndDividendsArea"));
$title=$langs->trans("TaxAndDividendsArea"); $title=$langs->trans("TaxAndDividendsArea");
if ($_GET["mode"] == 'sconly') $title=$langs->trans("SocialContributionsPayments"); if ($_GET["mode"] == 'sconly') $title=$langs->trans("SocialContributionsPayments");
print_fiche_titre($title,($year?"<a href='index.php?year=".($year-1)."'>".img_previous()."</a> ".$langs->trans("Year")." $year <a href='index.php?year=".($year+1)."'>".img_next()."</a>":"")); $param='';
if (GETPOST("mode") == 'sconly') $param='&mode=sconly';
if ($sortfield) $param.='&sortfield='.$sortfield;
if ($sortorder) $param.='&sortorder='.$sortorder;
if ($_GET["mode"] != 'sconly') print_fiche_titre($title, ($year?"<a href='index.php?year=".($year-1).$param."'>".img_previous()."</a> ".$langs->trans("Year")." $year <a href='index.php?year=".($year+1).$param."'>".img_next()."</a>":""));
if ($year) $param.='&year='.$year;
// Social contributions only
if (GETPOST("mode") != 'sconly')
{ {
print $langs->trans("DescTaxAndDividendsArea").'<br>'; print $langs->trans("DescTaxAndDividendsArea").'<br>';
print "<br>"; print "<br>";
}
print_fiche_titre($langs->trans("SocialContributionsPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
// Social contributions
if ($_GET["mode"] != 'sconly')
{
print_titre($langs->trans("SocialContributionsPayments"));
}
if ($_GET["mode"] == 'sconly')
{
$param='&mode=sconly';
} }
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">"; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="120"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="120"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder);
@ -110,10 +108,10 @@ if ($year > 0)
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance, // Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
$sql .= " (cs.periode IS NOT NULL AND cs.periode between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; $sql .= " (cs.periode IS NOT NULL AND cs.periode between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
$sql .= "OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; $sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
$sql .= ")"; $sql .= ")";
} }
$sql.= $db->order($sortfield,$sortorder); if (! preg_match('/^pv/',$sortfield)) $sql.= $db->order($sortfield,$sortorder);
//$sql.= $db->plimit($limit+1,$offset); //$sql.= $db->plimit($limit+1,$offset);
//print $sql; //print $sql;
@ -184,18 +182,18 @@ if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly')
$tva = new Tva($db); $tva = new Tva($db);
print_titre($langs->trans("VATPayments")); print_fiche_titre($langs->trans("VATPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
$sql = "SELECT f.rowid, f.amount, f.label, f.datev as dm"; $sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."tva as f "; $sql.= " FROM ".MAIN_DB_PREFIX."tva as pv";
$sql.= " WHERE f.entity = ".$conf->entity; $sql.= " WHERE pv.entity = ".$conf->entity;
if ($year > 0) if ($year > 0)
{ {
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance, // Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
$sql.= " AND f.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; $sql.= " AND pv.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
} }
$sql.= " ORDER BY dm DESC"; if (preg_match('/^pv/',$sortfield)) $sql.= $db->order($sortfield,$sortorder);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
@ -205,12 +203,12 @@ if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly')
$total = 0 ; $total = 0 ;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td width="120" class="nowrap">'.$langs->trans("PeriodEndDate").'</td>'; print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder);
print "<td>".$langs->trans("Label")."</td>"; print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
print '<td align="right" width="10%">'.$langs->trans("ExpectedToPay")."</td>"; print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print '<td align="right" width="10%">'.$langs->trans("RefPayment")."</td>"; print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
print '<td align="center" width="15%">'.$langs->trans("DatePayment")."</td>"; print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder);
print '<td align="right" width="10%">'.$langs->trans("PayedByThisPayment")."</td>"; print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n"; print "</tr>\n";
$var=1; $var=1;
while ($i < $num) while ($i < $num)
@ -227,12 +225,13 @@ if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly')
print '<td align="right">'.price($obj->amount)."</td>"; print '<td align="right">'.price($obj->amount)."</td>";
// Ref payment
$tva_static->id=$obj->rowid; $tva_static->id=$obj->rowid;
$tva_static->ref=$obj->rowid; $tva_static->ref=$obj->rowid;
print '<td align="right">'.$tva_static->getNomUrl(1)."</td>\n"; print '<td align="left">'.$tva_static->getNomUrl(1)."</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n"; print '<td align="center">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
print "<td align=\"right\">".price($obj->amount)."</td>"; print '<td align="right">'.price($obj->amount)."</td>";
print "</tr>\n"; print "</tr>\n";
$i++; $i++;

File diff suppressed because it is too large Load Diff

View File

@ -79,7 +79,7 @@ if ($result)
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("WithdrawalReceipt"),"bons.php","p.ref",'','','class="liste_titre"'); print_liste_field_titre($langs->trans("WithdrawalReceipts"),"bons.php","p.ref",'','','class="liste_titre"');
print_liste_field_titre($langs->trans("Date"),"bons.php","p.datec","","",'class="liste_titre" align="center"'); print_liste_field_titre($langs->trans("Date"),"bons.php","p.datec","","",'class="liste_titre" align="center"');
print '<td class="liste_titre" align="right">'.$langs->trans("Amount").'</td>'; print '<td class="liste_titre" align="right">'.$langs->trans("Amount").'</td>';
print '</tr>'; print '</tr>';

View File

@ -47,7 +47,7 @@ $page = GETPOST('page','int');
$sortorder = ((GETPOST('sortorder','alpha')=="")) ? "DESC" : GETPOST('sortorder','alpha'); $sortorder = ((GETPOST('sortorder','alpha')=="")) ? "DESC" : GETPOST('sortorder','alpha');
$sortfield = ((GETPOST('sortfield','alpha')=="")) ? "p.ref" : GETPOST('sortfield','alpha'); $sortfield = ((GETPOST('sortfield','alpha')=="")) ? "p.ref" : GETPOST('sortfield','alpha');
llxHeader('',$langs->trans("WithdrawalReceipt")); llxHeader('',$langs->trans("WithdrawalReceipts"));
if ($prev_id) if ($prev_id)
{ {
@ -56,7 +56,7 @@ if ($prev_id)
if ($bon->fetch($prev_id) == 0) if ($bon->fetch($prev_id) == 0)
{ {
$head = prelevement_prepare_head($bon); $head = prelevement_prepare_head($bon);
dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalReceipt"), '', 'payment'); dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalReceipts"), '', 'payment');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';

View File

@ -46,7 +46,7 @@ $page = GETPOST('page','int');
/* /*
* View * View
*/ */
llxHeader('',$langs->trans("WithdrawalReceipt")); llxHeader('',$langs->trans("WithdrawalReceipts"));
if ($prev_id) if ($prev_id)
{ {
@ -55,7 +55,7 @@ if ($prev_id)
if ($bon->fetch($prev_id) == 0) if ($bon->fetch($prev_id) == 0)
{ {
$head = prelevement_prepare_head($bon); $head = prelevement_prepare_head($bon);
dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalReceipt"), '', 'payment'); dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalReceipts"), '', 'payment');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';

View File

@ -44,7 +44,7 @@ $page = GETPOST('page','int');
* View * View
*/ */
llxHeader('',$langs->trans("WithdrawalReceipt")); llxHeader('',$langs->trans("WithdrawalReceipts"));
if ($prev_id) if ($prev_id)
{ {
@ -53,7 +53,7 @@ if ($prev_id)
if ($bon->fetch($prev_id) == 0) if ($bon->fetch($prev_id) == 0)
{ {
$head = prelevement_prepare_head($bon); $head = prelevement_prepare_head($bon);
dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalReceipt"), '', 'payment'); dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalReceipts"), '', 'payment');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';

View File

@ -133,7 +133,7 @@ if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
$bon = new BonPrelevement($db,""); $bon = new BonPrelevement($db,"");
$form = new Form($db); $form = new Form($db);
llxHeader('',$langs->trans("WithdrawalReceipt")); llxHeader('',$langs->trans("WithdrawalReceipts"));
if ($id > 0) if ($id > 0)
@ -141,7 +141,7 @@ if ($id > 0)
$bon->fetch($id); $bon->fetch($id);
$head = prelevement_prepare_head($bon); $head = prelevement_prepare_head($bon);
dol_fiche_head($head, 'prelevement', $langs->trans("WithdrawalReceipt"), '', 'payment'); dol_fiche_head($head, 'prelevement', $langs->trans("WithdrawalReceipts"), '', 'payment');
if (GETPOST('error','alpha')!='') if (GETPOST('error','alpha')!='')
{ {

View File

@ -130,7 +130,7 @@ if ($id)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="20%">'.$langs->trans("WithdrawalReceipt").'</td><td>'; print '<tr><td width="20%">'.$langs->trans("WithdrawalReceipts").'</td><td>';
print '<a href="fiche.php?id='.$lipre->bon_rowid.'">'.$lipre->bon_ref.'</a></td></tr>'; print '<a href="fiche.php?id='.$lipre->bon_rowid.'">'.$lipre->bon_ref.'</a></td></tr>';
print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($lipre->amount).'</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($lipre->amount).'</td></tr>';

View File

@ -54,7 +54,7 @@ $sortfield = ((GETPOST('sortfield','alpha')=="")) ? "pl.fk_soc" : GETPOST('sortf
* View * View
*/ */
llxHeader('',$langs->trans("WithdrawalReceipt")); llxHeader('',$langs->trans("WithdrawalReceipts"));
if ($prev_id) if ($prev_id)
{ {
@ -63,7 +63,7 @@ if ($prev_id)
if ($bon->fetch($prev_id) == 0) if ($bon->fetch($prev_id) == 0)
{ {
$head = prelevement_prepare_head($bon); $head = prelevement_prepare_head($bon);
dol_fiche_head($head, 'lines', $langs->trans("WithdrawalReceipt"), '', 'payment'); dol_fiche_head($head, 'lines', $langs->trans("WithdrawalReceipts"), '', 'payment');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';

View File

@ -111,7 +111,7 @@ if ($result)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">'.$langs->trans("Line").'</td>'; print '<td class="liste_titre">'.$langs->trans("Line").'</td>';
print_liste_field_titre($langs->trans("WithdrawalReceipt"),$_SERVER["PHP_SELF"],"p.ref"); print_liste_field_titre($langs->trans("WithdrawalReceipts"),$_SERVER["PHP_SELF"],"p.ref");
print_liste_field_titre($langs->trans("Bill"),$_SERVER["PHP_SELF"],"f.facnumber",'',$urladd); print_liste_field_titre($langs->trans("Bill"),$_SERVER["PHP_SELF"],"f.facnumber",'',$urladd);
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom"); print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom");
print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client",'','','align="center"'); print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client",'','','align="center"');

View File

@ -40,6 +40,7 @@ class Contact extends CommonObject
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id; var $id;
var $ref_ext;
var $civilite_id; // In fact we store civility_code var $civilite_id; // In fact we store civility_code
var $lastname; var $lastname;
var $firstname; var $firstname;
@ -64,9 +65,13 @@ class Contact extends CommonObject
var $code; var $code;
var $email; var $email;
var $skype; var $skype;
var $jabberid;
var $phone_pro; var $phone_pro;
var $phone_perso; var $phone_perso;
var $phone_mobile; var $phone_mobile;
var $fax;
var $priv;
var $birthday; var $birthday;
var $default_lang; var $default_lang;
@ -119,6 +124,7 @@ class Contact extends CommonObject
if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname=ucwords($this->firstname); if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname=ucwords($this->firstname);
if (! $this->socid) $this->socid = 0; if (! $this->socid) $this->socid = 0;
if (! $this->priv) $this->priv = 0; if (! $this->priv) $this->priv = 0;
if (empty($this->statut)) $this->statut = 0;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople (";
$sql.= " datec"; $sql.= " datec";

View File

@ -52,7 +52,8 @@ $search_email=GETPOST("search_email");
$search_skype=GETPOST("search_skype"); $search_skype=GETPOST("search_skype");
$search_priv=GETPOST("search_priv"); $search_priv=GETPOST("search_priv");
$search_categ = GETPOST("search_categ",'int'); $search_categ = GETPOST("search_categ",'int');
$search_statut=GETPOST("search_statut"); $search_status = GETPOST("search_status",'int');
if ($search_status=='') $search_status=1; // always display activ customer first
$type=GETPOST("type"); $type=GETPOST("type");
@ -104,6 +105,7 @@ if (GETPOST('button_removefilter'))
$search_skype=""; $search_skype="";
$search_priv=""; $search_priv="";
$sall=""; $sall="";
$seach_status=1;
} }
if ($search_priv < 0) $search_priv=''; if ($search_priv < 0) $search_priv='';
@ -192,6 +194,7 @@ if (strlen($search_skype)) // filtre sur skype
{ {
$sql .= " AND p.skype LIKE '%".$db->escape($search_skype)."%'"; $sql .= " AND p.skype LIKE '%".$db->escape($search_skype)."%'";
} }
if ($search_status!='') $sql .= " AND p.statut = ".$db->escape($search_status);
if ($type == "o") // filtre sur type if ($type == "o") // filtre sur type
{ {
$sql .= " AND p.fk_soc IS NULL"; $sql .= " AND p.fk_soc IS NULL";
@ -245,6 +248,7 @@ if ($result)
$param ='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall); $param ='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall);
$param.='&type='.urlencode($type).'&view='.urlencode($view).'&search_lastname='.urlencode($search_lastname).'&search_firstname='.urlencode($search_firstname).'&search_societe='.urlencode($search_societe).'&search_email='.urlencode($search_email); $param.='&type='.urlencode($type).'&view='.urlencode($view).'&search_lastname='.urlencode($search_lastname).'&search_firstname='.urlencode($search_firstname).'&search_societe='.urlencode($search_societe).'&search_email='.urlencode($search_email);
if (!empty($search_categ)) $param.='&search_categ='.$search_categ; if (!empty($search_categ)) $param.='&search_categ='.$search_categ;
if ($search_status != '') $param.='&amp;search_status='.$search_status;
if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv); if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv);
$num = $db->num_rows($result); $num = $db->num_rows($result);
@ -335,7 +339,9 @@ if ($result)
$selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate")); $selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate"));
print $form->selectarray('search_priv',$selectarray,$search_priv,1); print $form->selectarray('search_priv',$selectarray,$search_priv,1);
print '</td>'; print '</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre" align="center">';
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
print '</td>';
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
print '<input type="image" value="button_search" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input type="image" value="button_search" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '&nbsp; '; print '&nbsp; ';

View File

@ -999,6 +999,9 @@ class Contrat extends CommonObject
$pu=$pu_ttc; $pu=$pu_ttc;
} }
// Check parameters
if (empty($remise_percent)) $remise_percent=0;
// Calcul du total TTC et de la TVA pour la ligne a partir de // Calcul du total TTC et de la TVA pour la ligne a partir de
// qty, pu, remise_percent et txtva // qty, pu, remise_percent et txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker

View File

@ -158,9 +158,9 @@ if (GETPOST('remonth') && GETPOST('reday') && GETPOST('reyear'))
$datecontrat = dol_mktime(GETPOST('rehour'), GETPOST('remin'), 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $datecontrat = dol_mktime(GETPOST('rehour'), GETPOST('remin'), 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
} }
// Add contract
if ($action == 'add' && $user->rights->contrat->creer) if ($action == 'add' && $user->rights->contrat->creer)
{ {
// Check // Check
if (empty($datecontrat)) if (empty($datecontrat))
{ {
@ -339,9 +339,36 @@ else if ($action == 'classin' && $user->rights->contrat->creer)
$object->setProject(GETPOST('projectid')); $object->setProject(GETPOST('projectid'));
} }
// Add a new line
else if ($action == 'addline' && $user->rights->contrat->creer) else if ($action == 'addline' && $user->rights->contrat->creer)
{ {
if (! GETPOST('qty')) // Set if we used free entry or predefined product
if (GETPOST('addline_libre'))
{
$predef='';
$idprod=0;
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
$price_ht = GETPOST('price_ht');
$tva_tx=(GETPOST('tva_tx')?GETPOST('tva_tx'):0);
}
if (GETPOST('addline_predefined'))
{
$predef=(($conf->global->MAIN_FEATURES_LEVEL < 2) ? '_predef' : '');
$idprod=GETPOST('idprod', 'int');
$product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):''));
$price_ht = '';
$tva_tx = '';
}
if (GETPOST('usenewaddlineform')) {
$idprod=GETPOST('idprod', 'int');
$product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):(GETPOST('dp_desc')?GETPOST('dp_desc'):'')));
$price_ht = GETPOST('price_ht');
$tva_tx=(GETPOST('tva_tx')?GETPOST('tva_tx'):0);
}
$qty = GETPOST('qty'.$predef);
$remise_percent=GETPOST('remise_percent'.$predef);
if ($qty == '')
{ {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Qty")),'errors'); setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Qty")),'errors');
$error++; $error++;
@ -362,41 +389,19 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
} }
$ret=$object->fetch_thirdparty(); $ret=$object->fetch_thirdparty();
$date_start=''; // Clean parameters
$date_end=''; $date_start=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
// Si ajout champ produit libre $date_end=dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
if (GETPOST('mode') == 'libre') $price_base_type = (GETPOST('price_base_type', 'alpha')?GETPOST('price_base_type', 'alpha'):'HT');
{
if (GETPOST('date_start_slmonth') && GETPOST('date_start_slday') && GETPOST('date_start_slyear'))
{
$date_start=dol_mktime(GETPOST('date_start_slhour'), GETPOST('date_start_slmin'), 0, GETPOST('date_start_slmonth'), GETPOST('date_start_slday'), GETPOST('date_start_slyear'));
}
if (GETPOST('date_end_slmonth') && GETPOST('date_end_slday') && GETPOST('date_end_slyear'))
{
$date_end=dol_mktime(GETPOST('date_end_slhour'), GETPOST('date_end_slmin'), 0, GETPOST('date_end_slmonth'), GETPOST('date_end_slday'), GETPOST('date_end_slyear'));
}
}
// Si ajout champ produit predefini
if (GETPOST('mode') == 'predefined')
{
if (GETPOST('date_startmonth') && GETPOST('date_startday') && GETPOST('date_startyear'))
{
$date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
}
if (GETPOST('date_endmonth') && GETPOST('date_endday') && GETPOST('date_endyear'))
{
$date_end=dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
}
}
// Ecrase $pu par celui du produit // Ecrase $pu par celui du produit
// Ecrase $desc par celui du produit // Ecrase $desc par celui du produit
// Ecrase $txtva par celui du produit // Ecrase $txtva par celui du produit
// Ecrase $base_price_type par celui du produit // Ecrase $base_price_type par celui du produit
if (GETPOST('idprod')) if ($idprod > 0)
{ {
$prod = new Product($db); $prod = new Product($db);
$prod->fetch(GETPOST('idprod')); $prod->fetch($idprod);
$tva_tx = get_default_tva($mysoc,$object->thirdparty,$prod->id); $tva_tx = get_default_tva($mysoc,$object->thirdparty,$prod->id);
$tva_npr = get_default_npr($mysoc,$object->thirdparty,$prod->id); $tva_npr = get_default_npr($mysoc,$object->thirdparty,$prod->id);
@ -426,22 +431,21 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU'); $pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU');
} }
else else
{ {
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU');
} }
} }
$desc = $prod->description; $desc=$prod->description;
$desc.= $prod->description && GETPOST('np_desc') ? "\n" : ""; $desc=dol_concatdesc($desc,$product_desc);
$desc.= GETPOST('np_desc');
} }
else else
{ {
$pu_ht=GETPOST('price_ht'); $pu_ht=GETPOST('price_ht');
$price_base_type = 'HT'; $price_base_type = 'HT';
$tva_tx=GETPOST('tva_tx')?str_replace('*','',GETPOST('tva_tx')):0; // tva_tx field may be disabled, so we use vat rate 0 $tva_tx=GETPOST('tva_tx')?str_replace('*','',GETPOST('tva_tx')):0; // tva_tx field may be disabled, so we use vat rate 0
$tva_npr=preg_match('/\*/',GETPOST('tva_tx'))?1:0; $tva_npr=preg_match('/\*/',GETPOST('tva_tx'))?1:0;
$desc=GETPOST('dp_desc'); $desc=$product_desc;
} }
$localtax1_tx=get_localtax($tva_tx,1,$object->societe); $localtax1_tx=get_localtax($tva_tx,1,$object->societe);
@ -457,23 +461,23 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
$info_bits=0; $info_bits=0;
if ($tva_npr) $info_bits |= 0x01; if ($tva_npr) $info_bits |= 0x01;
if($price_min && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) if($price_min && (price2num($pu_ht)*(1-price2num($remise_percent)/100) < price2num($price_min)))
{ {
$object->error = $langs->trans("CantBeLessThanMinPrice",price(price2num($price_min,'MU'),0,$langs,0,0,-1,$conf->currency)); $object->error = $langs->trans("CantBeLessThanMinPrice",price(price2num($price_min,'MU'),0,$langs,0,0,-1,$conf->currency));
$result = -1 ; $result = -1 ;
} }
else else
{ {
// Insert line // Insert line
$result = $object->addline( $result = $object->addline(
$desc, $desc,
$pu_ht, $pu_ht,
GETPOST('qty'), $qty,
$tva_tx, $tva_tx,
$localtax1_tx, $localtax1_tx,
$localtax2_tx, $localtax2_tx,
GETPOST('idprod'), $idprod,
GETPOST('remise_percent'), $remise_percent,
$date_start, $date_start,
$date_end, $date_end,
$price_base_type, $price_base_type,
@ -506,7 +510,6 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
unset($_POST['qty']); unset($_POST['qty']);
unset($_POST['type']); unset($_POST['type']);
unset($_POST['idprod']);
unset($_POST['remise_percent']); unset($_POST['remise_percent']);
unset($_POST['price_ht']); unset($_POST['price_ht']);
unset($_POST['price_ttc']); unset($_POST['price_ttc']);
@ -516,6 +519,16 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
unset($_POST['product_desc']); unset($_POST['product_desc']);
unset($_POST['fournprice']); unset($_POST['fournprice']);
unset($_POST['buying_price']); unset($_POST['buying_price']);
unset($_POST['dp_desc']);
unset($_POST['idprod']);
unset($_POST['qty_predef']);
unset($_POST['remise_percent_predef']);
unset($_POST['fournprice_predef']);
unset($_POST['buying_price_predef']);
unset($_POST['np_marginRate_predef']);
unset($_POST['np_markRate_predef']);
unset($_POST['np_desc']);
} }
else else
{ {
@ -1306,6 +1319,7 @@ else
} }
print "</table>"; print "</table>";
print "</form>\n"; print "</form>\n";
@ -1472,6 +1486,7 @@ else
* Desactiver la ligne de contrat * Desactiver la ligne de contrat
*/ */
print '<form name="closeline" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;ligne='.$object->lines[$cursorline-1]->id.'&amp;action=closeline" method="post">'; print '<form name="closeline" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;ligne='.$object->lines[$cursorline-1]->id.'&amp;action=closeline" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
@ -1525,13 +1540,22 @@ else
} }
//print '</table>'; //print '</table>';
// Form to add new line // Form to add new line
if ($user->rights->contrat->creer && ($object->statut >= 0)) if ($user->rights->contrat->creer && ($object->statut >= 0))
{ {
$dateSelector=1; $dateSelector=1;
print '<br>'; print "\n";
print '<table id="tablelines" class="noborder" width="100%">'; // Array with (n*2)+1 lines print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline')?'#add':'#line_'.GETPOST('lineid')).'" method="POST">
<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">
<input type="hidden" name="action" value="'.(($action != 'editline')?'addline':'updateligne').'">
<input type="hidden" name="mode" value="">
<input type="hidden" name="id" value="'.$object->id.'">
';
print '<br>';
print '<table id="tablelines" class="noborder noshadow" width="100%">'; // Array with (n*2)+1 lines
// Trick to not show product entries // Trick to not show product entries
$savproductenabled=$conf->product->enabled; $savproductenabled=$conf->product->enabled;
@ -1567,13 +1591,12 @@ else
// Restore correct setup // Restore correct setup
$conf->product->enabled = $savproductenabled; $conf->product->enabled = $savproductenabled;
print '</form>';
print '</table>'; print '</table>';
print '</form>';
} }
dol_fiche_end();
print '</div>';
/* /*
@ -1642,11 +1665,13 @@ llxFooter();
$db->close(); $db->close();
?> ?>
<?php <?php
if ($conf->margin->enabled) { if ($conf->margin->enabled && $action == 'editline')
{
?> ?>
<script type="text/javascript"> <script type="text/javascript">
<?php if ($action == 'editline') { ?>
$(document).ready(function() { $(document).ready(function() {
var idprod = $("input[name='idprod']").val(); var idprod = $("input[name='idprod']").val();
var fournprice = $("input[name='fournprice']").val(); var fournprice = $("input[name='fournprice']").val();
@ -1695,6 +1720,8 @@ $(document).ready(function() {
$('#buying_price').show(); $('#buying_price').show();
} }
}); });
<?php } ?>
</script> </script>
<?php } ?>
<?php
}
?>

View File

@ -207,6 +207,7 @@ if (file_exists($fullpathselecteddir))
// Enable jquery handlers on new generated HTML objects // Enable jquery handlers on new generated HTML objects
print '<script type="text/javascript">'; print '<script type="text/javascript">';
print 'jQuery(".classfortooltip").tipTip({ maxWidth: "600px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50});'; print 'jQuery(".classfortooltip").tipTip({ maxWidth: "600px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50});';
// TODO Remove this. Is replaced with function as 3rd parameter of fileTree
print 'jQuery(".fmdirlia").click(function(e) { print 'jQuery(".fmdirlia").click(function(e) {
id=jQuery(this).attr(\'id\').substr(12); id=jQuery(this).attr(\'id\').substr(12);
jQuery("#formuserfile_section_dir").val(jQuery(this).attr(\'rel\')); jQuery("#formuserfile_section_dir").val(jQuery(this).attr(\'rel\'));
@ -221,7 +222,7 @@ if (file_exists($fullpathselecteddir))
else print "PermissionDenied"; else print "PermissionDenied";
} }
// This ajax service is called only when a directory $selecteddir is opened but not closed. // This ajax service is called only when a directory $selecteddir is opened but not when closed.
//print '<script language="javascript">'; //print '<script language="javascript">';
//print "loadandshowpreview('".dol_escape_js($selecteddir)."');"; //print "loadandshowpreview('".dol_escape_js($selecteddir)."');";
//print '</script>'; //print '</script>';

View File

@ -935,6 +935,10 @@ class ExtraFields
$sql = 'SELECT '.$keyList; $sql = 'SELECT '.$keyList;
$sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[0]; $sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[0];
if (strpos($InfoFieldList[4], 'extra')!==false)
{
$sql.= ' as main';
}
$sql.= ' WHERE '.$selectkey.'=\''.$this->db->escape($value).'\''; $sql.= ' WHERE '.$selectkey.'=\''.$this->db->escape($value).'\'';
//$sql.= ' AND entity = '.$conf->entity; //$sql.= ' AND entity = '.$conf->entity;
dol_syslog(get_class($this).':showOutputField:$type=sellist sql='.$sql); dol_syslog(get_class($this).':showOutputField:$type=sellist sql='.$sql);

View File

@ -121,8 +121,8 @@ class Form
* @param string $value Value to show/edit * @param string $value Value to show/edit
* @param object $object Object * @param object $object Object
* @param boolean $perm Permission to allow button to edit parameter * @param boolean $perm Permission to allow button to edit parameter
* @param string $typeofdata Type of data ('string' by default, 'email', 'numeric:99', 'text' or 'textarea:rows:cols', 'day' or 'datepicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select:xxx'...) * @param string $typeofdata Type of data ('string' by default, 'amount', 'email', 'numeric:99', 'text' or 'textarea:rows:cols', 'day' or 'datepicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select:xxx'...)
* @param string $editvalue When in edit mode, use this value as $value instead of value * @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of value)
* @param object $extObject External object * @param object $extObject External object
* @param string $success Success message * @param string $success Success message
* @param string $moreparam More param to add on a href URL * @param string $moreparam More param to add on a href URL
@ -134,6 +134,9 @@ class Form
$ret=''; $ret='';
// Check parameters
if (empty($typeofdata)) return 'ErrorBadParameter';
// When option to edit inline is activated // When option to edit inline is activated
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && ! preg_match('/^select;|datehourpicker/',$typeofdata)) // FIXME add jquery timepicker if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && ! preg_match('/^select;|datehourpicker/',$typeofdata)) // FIXME add jquery timepicker
{ {
@ -150,7 +153,7 @@ class Form
$ret.='<input type="hidden" name="id" value="'.$object->id.'">'; $ret.='<input type="hidden" name="id" value="'.$object->id.'">';
$ret.='<table class="nobordernopadding" cellpadding="0" cellspacing="0">'; $ret.='<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
$ret.='<tr><td>'; $ret.='<tr><td>';
if (preg_match('/^(string|email|numeric)/',$typeofdata)) if (preg_match('/^(string|email|numeric|amount)/',$typeofdata))
{ {
$tmp=explode(':',$typeofdata); $tmp=explode(':',$typeofdata);
$ret.='<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue?$editvalue:$value).'"'.($tmp[1]?' size="'.$tmp[1].'"':'').'>'; $ret.='<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue?$editvalue:$value).'"'.($tmp[1]?' size="'.$tmp[1].'"':'').'>';
@ -191,8 +194,9 @@ class Form
$ret.='</form>'."\n"; $ret.='</form>'."\n";
} }
else else
{ {
if ($typeofdata == 'email') $ret.=dol_print_email($value,0,0,0,0,1); if ($typeofdata == 'email') $ret.=dol_print_email($value,0,0,0,0,1);
elseif ($typeofdata == 'amount') $ret.=($value != '' ? price($value,'',$langs) : '');
elseif (preg_match('/^text/',$typeofdata) || preg_match('/^note/',$typeofdata)) $ret.=dol_htmlentitiesbr($value); elseif (preg_match('/^text/',$typeofdata) || preg_match('/^note/',$typeofdata)) $ret.=dol_htmlentitiesbr($value);
elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret.=dol_print_date($value,'day'); elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret.=dol_print_date($value,'day');
elseif ($typeofdata == 'datehourpicker') $ret.=dol_print_date($value,'dayhour'); elseif ($typeofdata == 'datehourpicker') $ret.=dol_print_date($value,'dayhour');

View File

@ -64,9 +64,10 @@ class FormFile
* @param boolean $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option). 2 should never be used. * @param boolean $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option). 2 should never be used.
* @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__' * @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
* @param string $linkfiles 1=Also add form to link files, 0=Do not show form to link files * @param string $linkfiles 1=Also add form to link files, 0=Do not show form to link files
* @param string $htmlname Name and id of HTML form
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=1, $savingdocmask='', $linkfiles=1) function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=1, $savingdocmask='', $linkfiles=1, $htmlname='formuserfile')
{ {
global $conf,$langs, $hookmanager; global $conf,$langs, $hookmanager;
$hookmanager->initHooks(array('formfile')); $hookmanager->initHooks(array('formfile'));
@ -90,9 +91,9 @@ class FormFile
if (empty($title)) $title=$langs->trans("AttachANewFile"); if (empty($title)) $title=$langs->trans("AttachANewFile");
if ($title != 'none') print_titre($title); if ($title != 'none') print_titre($title);
$out .= '<form name="formuserfile" action="'.$url.'" enctype="multipart/form-data" method="POST">'; $out .= '<form name="'.$htmlname.'" id="'.$htmlname.'" action="'.$url.'" enctype="multipart/form-data" method="POST">';
$out .= '<input type="hidden" id="formuserfile_section_dir" name="section_dir" value="">'; $out .= '<input type="hidden" id="'.$htmlname.'_section_dir" name="section_dir" value="">';
$out .= '<input type="hidden" id="formuserfile_section_id" name="section_id" value="'.$sectionid.'">'; $out .= '<input type="hidden" id="'.$htmlname.'_section_id" name="section_id" value="'.$sectionid.'">';
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$out .= '<table width="100%" class="nobordernopadding">'; $out .= '<table width="100%" class="nobordernopadding">';
@ -165,16 +166,16 @@ class FormFile
$langs->load('link'); $langs->load('link');
$title = $langs->trans("LinkANewFile"); $title = $langs->trans("LinkANewFile");
$out .= load_fiche_titre($title, null, null); $out .= load_fiche_titre($title, null, null);
$out .= '<form name="formuserfile" action="'.$url.'" method="POST">'; $out .= '<form name="'.$htmlname.'_link" id="'.$htmlname.'_link" action="'.$url.'" method="POST">';
$out .= '<input type="hidden" id="formuserfile_section_dir" name="section_dir" value="">'; $out .= '<input type="hidden" id="'.$htmlname.'_link_section_dir" name="link_section_dir" value="">';
$out .= '<input type="hidden" id="formuserfile_section_id" name="section_id" value="'.$sectionid.'">'; $out .= '<input type="hidden" id="'.$htmlname.'_link_section_id" name="link_section_id" value="'.$sectionid.'">';
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$out .= '<table width="100%" class="nobordernopadding">'; $out .= '<table width="100%" class="nobordernopadding">';
$out .= '<tr>'; $out .= '<tr>';
$out .= '<td valign="middle" class="nowrap">'; $out .= '<td valign="middle" class="nowrap">';
$out .= $langs->trans("Link") . ': '; $out .= $langs->trans("Link") . ': ';
$out .= '<input type="text" name="link" id="link">'; $out .= '<input type="text" name="link" size="'.$maxlength.'" id="link">';
$out .= ' &nbsp; ' . $langs->trans("Label") . ': '; $out .= ' &nbsp; ' . $langs->trans("Label") . ': ';
$out .= '<input type="text" name="label" id="label">'; $out .= '<input type="text" name="label" id="label">';
$out .= '<input type="hidden" name="objecttype" value="' . $object->element . '">'; $out .= '<input type="hidden" name="objecttype" value="' . $object->element . '">';
@ -770,14 +771,14 @@ class FormFile
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart; print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
if ($forcedownload) print '&attachment=1'; if ($forcedownload) print '&attachment=1';
if (! empty($object->entity)) print '&entity='.$object->entity; if (! empty($object->entity)) print '&entity='.$object->entity;
print '&file='.urlencode($relativepath.$file['name']); $filepath=$relativepath.$file['name'];
/* Restore old code: When file is at level 2+, full relative path must be in url, not only level1 /* Restore old code: When file is at level 2+, full relative path (and not only level1) must be into url
if ($file['level1name'] <> $object->id) if ($file['level1name'] <> $object->id)
$filepath=urlencode($object->id.'/'.$file['level1name'].'/'.$file['name']); $filepath=$object->id.'/'.$file['level1name'].'/'.$file['name'];
else else
$filepath=urlencode($object->id.'/'.$file['name']); $filepath=$object->id.'/'.$file['name'];
print '&file='.$filepath; */
*/ print '&file='.urlencode($filepath);
print '">'; print '">';
print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' '; print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' ';
@ -800,14 +801,16 @@ class FormFile
// Delete or view link // Delete or view link
// ($param must start with &) // ($param must start with &)
print '<td align="right">'; print '<td align="right">';
if ($useinecm) print '<a href="'.DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($file['name']).$param.'" class="editfilelink" rel="'.urlencode($file['name']).$param.'">'.img_view().'</a> &nbsp; '; if ($useinecm) print '<a href="'.DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($file['name']).$param.'" class="editfilelink" rel="'.urlencode($file['name']).'">'.img_view().'</a> &nbsp; ';
if ($permtodelete) if ($permtodelete)
{ {
/*
if ($file['level1name'] <> $object->id) if ($file['level1name'] <> $object->id)
$filepath=urlencode($file['level1name'].'/'.$file['name']); $filepath=$file['level1name'].'/'.$file['name'];
else else
$filepath=urlencode($file['name']); $filepath=$file['name'];
print '<a href="'.(($useinecm && ! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':$url.'?action=delete&urlfile='.$filepath.$param).'" class="deletefilelink" rel="'.$filepath.$param.'">'.img_delete().'</a>'; */
print '<a href="'.(($useinecm && ! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':$url.'?action=delete&urlfile='.urlencode($filepath).$param).'" class="deletefilelink" rel="'.$filepath.'">'.img_delete().'</a>';
} }
else print '&nbsp;'; else print '&nbsp;';
print "</td>"; print "</td>";
@ -831,7 +834,7 @@ class FormFile
/** /**
* Show list of documents in a directory * Show list of documents in a directory
* *
* @param string $upload_dir Directory that was scanned * @param string $upload_dir Directory that was scanned
* @param array $filearray Array of files loaded by dol_dir_list function before calling this function * @param array $filearray Array of files loaded by dol_dir_list function before calling this function
* @param string $modulepart Value for modulepart used by download wrapper * @param string $modulepart Value for modulepart used by download wrapper
* @param string $param Parameters on sort links * @param string $param Parameters on sort links
@ -841,7 +844,7 @@ class FormFile
* @param int $useinecm Change output for use in ecm module * @param int $useinecm Change output for use in ecm module
* @param int $textifempty Text to show if filearray is empty * @param int $textifempty Text to show if filearray is empty
* @param int $maxlength Maximum length of file name shown * @param int $maxlength Maximum length of file name shown
* @param string $url Full url to use for click links ('' = autodetect) * @param string $url Full url to use for click links ('' = autodetect)
* @return int <0 if KO, nb of files shown if OK * @return int <0 if KO, nb of files shown if OK
*/ */
function list_of_autoecmfiles($upload_dir,$filearray,$modulepart,$param,$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$url='') function list_of_autoecmfiles($upload_dir,$filearray,$modulepart,$param,$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$url='')
@ -1048,7 +1051,7 @@ class FormFile
global $bc; global $bc;
global $sortfield, $sortorder; global $sortfield, $sortorder;
require_once DOL_DOCUMENT_ROOT . '/link/class/link.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$link = new Link($this->db); $link = new Link($this->db);
$links = array(); $links = array();
if ($sortfield == "name") { if ($sortfield == "name") {
@ -1063,6 +1066,9 @@ class FormFile
// Show list of associated links // Show list of associated links
print_titre($langs->trans("LinkedFiles")); print_titre($langs->trans("LinkedFiles"));
print '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST">';
print '<table width="100%" class="liste">'; print '<table width="100%" class="liste">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre( print_liste_field_titre(
@ -1076,7 +1082,7 @@ class FormFile
$sortorder $sortorder
); );
print_liste_field_titre( print_liste_field_titre(
$langs->trans("Size"), "",
"", "",
"", "",
"", "",
@ -1104,30 +1110,30 @@ class FormFile
print_liste_field_titre('','',''); print_liste_field_titre('','','');
print '</tr>'; print '</tr>';
$nboflinks = count($links); $nboflinks = count($links);
if ($nboflinks > 0) { if ($nboflinks > 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
}
$var = true; $var = true;
foreach ($links as $link) { foreach ($links as $link)
{
$var =! $var; $var =! $var;
print '<tr ' . $bc[$var] . '>'; print '<tr ' . $bc[$var] . '>';
//edit mode //edit mode
if ($action == 'update' && $selected === $link->id) { if ($action == 'update' && $selected === $link->id)
print '<form action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '" method="post">'; {
print '<td>';
print '<input type="hidden" name="id" value="' . $object->id . '">';
print '<input type="hidden" name="linkid" value="' . $link->id . '">'; print '<input type="hidden" name="linkid" value="' . $link->id . '">';
print '<input type="hidden" name="action" value="confirm_updateline">'; print '<input type="hidden" name="action" value="confirm_updateline">';
print '<td>'; print $langs->trans('Link') . ': <input type="text" name="link" size="50" value="' . $link->url . '">';
print $langs->trans('Link') . ': <input type="text" name="link" value = "' . $link->url . '">';
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="right">';
print $langs->trans('Label') . ': <input type="text" name="label" value = "' . $link->label . '">'; print $langs->trans('Label') . ': <input type="text" name="label" value="' . $link->label . '">';
print '</td>'; print '</td>';
print '<td align="center">' . dol_print_date(dol_now(), "dayhour", "tzuser") . '</td>'; print '<td align="center">' . dol_print_date(dol_now(), "dayhour", "tzuser") . '</td>';
print '<td align="right"></td>'; print '<td align="right"></td>';
print '<td align="right" colspan="2"><input type="submit" name="save" class="button" value="' . $langs->trans('Save') . '">'; print '<td align="right" colspan="2"><input type="submit" name="save" class="button" value="' . $langs->trans('Save') . '">';
print '<input type="submit" name="cancel" class="button" value="' . $langs->trans('Cancel') . '"></td>'; print '<input type="submit" name="cancel" class="button" value="' . $langs->trans('Cancel') . '">';
print '</form>'; print '</td>';
} }
else { else {
print '<td>'; print '<td>';
@ -1142,7 +1148,7 @@ class FormFile
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=update&linkid=' . $link->id print '<a href="' . $_SERVER['PHP_SELF'] . '?action=update&linkid=' . $link->id
. '&id=' . $object->id . '" class="editfilelink" >' . img_edit().'</a>'; . '&id=' . $object->id . '" class="editfilelink" >' . img_edit().'</a>';
if ($permtodelete) { if ($permtodelete) {
print '<a href="'. $_SERVER['PHP_SELF'] .'?action=delete&linkid=' . $link->id print ' &nbsp; <a href="'. $_SERVER['PHP_SELF'] .'?action=delete&linkid=' . $link->id
. '&id=' . $object->id . '" class="deletefilelink" >' . img_delete() . '</a>'; . '&id=' . $object->id . '" class="deletefilelink" >' . img_delete() . '</a>';
} else { } else {
print '&nbsp;'; print '&nbsp;';
@ -1151,13 +1157,16 @@ class FormFile
} }
print "</tr>\n"; print "</tr>\n";
} }
if ($nboflinks == 0) { if ($nboflinks == 0)
{
print '<tr ' . $bc[$var] . '><td colspan="4">'; print '<tr ' . $bc[$var] . '><td colspan="4">';
print $langs->trans("NoLinkFound"); print $langs->trans("NoLinkFound");
print '</td></tr>'; print '</td></tr>';
} }
print "</table>"; print "</table>";
print '</form>';
return $nboflinks; return $nboflinks;
} }

View File

@ -16,7 +16,7 @@
*/ */
/** /**
* \file htdocs/link/class/link.class.php * \file htdocs/core/class/link.class.php
* \ingroup link * \ingroup link
* \brief File for link class * \brief File for link class
*/ */
@ -39,6 +39,7 @@ class Link extends CommonObject
public $objecttype; public $objecttype;
public $objectid; public $objectid;
/** /**
* Constructor * Constructor
* *
@ -154,22 +155,22 @@ class Link extends CommonObject
{ {
global $langs,$conf; global $langs,$conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$langs->load("errors"); $langs->load("errors");
$error=0; $error=0;
dol_syslog(get_class($this)."::Update id = " . $this->id . " call_trigger = " . $call_trigger); dol_syslog(get_class($this)."::Update id = " . $this->id . " call_trigger = " . $call_trigger);
// Check parameters // Check parameters
if (empty($this->url)) { if (empty($this->url))
{
$this->error = $langs->trans("NoURL"); $this->error = $langs->trans("NoURL");
return -1; return -1;
} }
// Clean parameters // Clean parameters
$this->url = clean_url($this->url,0); $this->url = clean_url($this->url,1);
if(empty($this->label)) { if (empty($this->label)) $this->label = basename($this->url);
$this->label = basename($this->url);
}
$this->label = trim($this->label); $this->label = trim($this->label);
@ -184,12 +185,12 @@ class Link extends CommonObject
$sql .= ", objectid = " . $this->objectid; $sql .= ", objectid = " . $this->objectid;
$sql .= " WHERE rowid = '" . $this->id ."'"; $sql .= " WHERE rowid = '" . $this->id ."'";
dol_syslog(get_class($this)."::update sql = " .$sql);
dol_syslog(get_class($this)."::Update sql = " .$sql);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
if ($call_trigger) { if ($call_trigger)
{
// Appel des triggers // Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface = new Interfaces($this->db); $interface = new Interfaces($this->db);
@ -201,7 +202,8 @@ class Link extends CommonObject
// Fin appel triggers // Fin appel triggers
} }
if (! $error) { if (! $error)
{
dol_syslog(get_class($this) . "::Update success"); dol_syslog(get_class($this) . "::Update success");
$this->db->commit(); $this->db->commit();
return 1; return 1;
@ -209,14 +211,19 @@ class Link extends CommonObject
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
} else { }
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { else
{
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
// Doublon // Doublon
$this->error = $langs->trans("ErrorDuplicateField"); $this->error = $langs->trans("ErrorDuplicateField");
$result = -1; $result = -1;
} else { }
else
{
$this->error = $langs->trans("Error sql = " . $sql); $this->error = $langs->trans("Error sql = " . $sql);
dol_syslog(get_class($this) . "::Update fails update sql = " . $sql, LOG_ERR); dol_syslog(get_class($this) . "::Update fails update = " . $this->error, LOG_ERR);
$result = -2; $result = -2;
} }
$this->db->rollback(); $this->db->rollback();
@ -238,22 +245,27 @@ class Link extends CommonObject
public function fetchAll(&$links, $objecttype, $objectid, $sortfield=null, $sortorder=null) public function fetchAll(&$links, $objecttype, $objectid, $sortfield=null, $sortorder=null)
{ {
global $conf; global $conf;
$sql = "SELECT rowid, entity, datea, url, label , objecttype, objectid FROM " . MAIN_DB_PREFIX . "links"; $sql = "SELECT rowid, entity, datea, url, label , objecttype, objectid FROM " . MAIN_DB_PREFIX . "links";
$sql .= " WHERE objecttype = '" . $objecttype . "' AND objectid = " . $objectid; $sql .= " WHERE objecttype = '" . $objecttype . "' AND objectid = " . $objectid;
if($conf->entity != 0) $sql .= " AND entity = " . $conf->entity; if ($conf->entity != 0) $sql .= " AND entity = " . $conf->entity;
if ($sortfield) { if ($sortfield) {
if (empty($sortorder)) { if (empty($sortorder)) {
$sortorder = "ASC"; $sortorder = "ASC";
} }
$sql .= " ORDER BY " . $sortfield . " " . $sortorder; $sql .= " ORDER BY " . $sortfield . " " . $sortorder;
} }
dol_syslog(get_class($this)."::fetchAll sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
dol_syslog(get_class($this)."::fetchAll " . $sql, LOG_DEBUG); if ($resql)
if ($resql) { {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
dol_syslog(get_class($this)."::fetchAll " . $num . "records", LOG_DEBUG); dol_syslog(get_class($this)."::fetchAll " . $num . "records", LOG_DEBUG);
if ($num > 0) { if ($num > 0)
while ($obj = $this->db->fetch_object($resql)) { {
while ($obj = $this->db->fetch_object($resql))
{
$link = new Link($db); $link = new Link($db);
$link->id = $obj->rowid; $link->id = $obj->rowid;
$link->entity = $obj->entity; $link->entity = $obj->entity;
@ -274,25 +286,31 @@ class Link extends CommonObject
} }
} }
/* /**
* Loads a link from database * Loads a link from database
* @param rowid id of link to load
* @return int 1 if ok, 0 if no record found, -1 if error
* *
* */ * @param int $rowid Id of link to load
* @return int 1 if ok, 0 if no record found, -1 if error
*
**/
public function fetch($rowid=null) public function fetch($rowid=null)
{ {
global $conf; global $conf;
if (empty($rowid)) { if (empty($rowid)) {
$rowid = $this->id; $rowid = $this->id;
} }
$sql = "SELECT rowid, entity, datea, url, label, objecttype, objectid FROM " . MAIN_DB_PREFIX . "links"; $sql = "SELECT rowid, entity, datea, url, label, objecttype, objectid FROM " . MAIN_DB_PREFIX . "links";
$sql .= " WHERE rowid = " . $rowid; $sql .= " WHERE rowid = " . $rowid;
if($conf->entity != 0) $sql .= " AND entity = " . $conf->entity; if($conf->entity != 0) $sql .= " AND entity = " . $conf->entity;
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
dol_syslog(get_class($this)."::fetch " . $sql, LOG_DEBUG); if ($resql)
if ($resql) { {
if($this->db->num_rows($resql) > 0) { if($this->db->num_rows($resql) > 0)
{
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->entity = $obj->entity; $this->entity = $obj->entity;
$this->datea = $this->db->jdate($obj->datea); $this->datea = $this->db->jdate($obj->datea);
@ -301,14 +319,14 @@ class Link extends CommonObject
$this->objecttype = $obj->objecttype; $this->objecttype = $obj->objecttype;
$this->objectid = $obj->objectid; $this->objectid = $obj->objectid;
return 1; return 1;
} else { }
$this->error = 'Fetch no link found for id = ' . $rowid; else
dol_syslog($this->error, LOG_ERR); {
return 0; return 0;
} }
} else { } else {
dol_syslog($this->db->error(), LOG_ERR); $this->error=$this->db->lasterror();
$this->error=$this->db->error(); dol_syslog($this->error, LOG_ERR);
return -1; return -1;
} }
} }
@ -328,11 +346,12 @@ class Link extends CommonObject
$this->db->begin(); $this->db->begin();
// Remove link // Remove link
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "links"; $sql = "DELETE FROM " . MAIN_DB_PREFIX . "links";
$sql.= " WHERE rowid = " . $this->id; $sql.= " WHERE rowid = " . $this->id;
dol_syslog(get_class($this)."::delete sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this)."::delete sql=" . $sql, LOG_DEBUG);
if (! $this->db->query($sql)) { if (! $this->db->query($sql))
{
$error++; $error++;
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
dol_syslog(get_class($this)."::delete error -4 " . $this->error, LOG_ERR); dol_syslog(get_class($this)."::delete error -4 " . $this->error, LOG_ERR);

View File

@ -210,6 +210,7 @@ class DoliDBPgsql extends DoliDB
// tinyint type conversion // tinyint type conversion
$line=preg_replace('/tinyint\(?[0-9]*\)?/','smallint',$line); $line=preg_replace('/tinyint\(?[0-9]*\)?/','smallint',$line);
$line=preg_replace('/tinyint/i','smallint',$line);
// nuke unsigned // nuke unsigned
$line=preg_replace('/(int\w+|smallint)\s+unsigned/i','\\1',$line); $line=preg_replace('/(int\w+|smallint)\s+unsigned/i','\\1',$line);
@ -875,7 +876,7 @@ class DoliDBPgsql extends DoliDB
42701=> 'DB_ERROR_COLUMN_ALREADY_EXISTS', 42701=> 'DB_ERROR_COLUMN_ALREADY_EXISTS',
'42710' => 'DB_ERROR_KEY_NAME_ALREADY_EXISTS', '42710' => 'DB_ERROR_KEY_NAME_ALREADY_EXISTS',
'23505' => 'DB_ERROR_RECORD_ALREADY_EXISTS', '23505' => 'DB_ERROR_RECORD_ALREADY_EXISTS',
'42704' => 'DB_ERROR_NO_INDEX_TO_DROP', '42704' => 'DB_ERROR_NO_INDEX_TO_DROP', // May also be Type xxx does not exists
'42601' => 'DB_ERROR_SYNTAX', '42601' => 'DB_ERROR_SYNTAX',
'42P16' => 'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS', '42P16' => 'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS',
1075 => 'DB_ERROR_CANT_DROP_PRIMARY_KEY', 1075 => 'DB_ERROR_CANT_DROP_PRIMARY_KEY',

View File

@ -1,4 +1,4 @@
// Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net> // Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
// Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> // Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.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
@ -290,8 +290,10 @@ function loadXMLDoc(url,readyStateFunction,async)
return req; return req;
} }
// To hide/show select Boxes with IE6 (and only IE6 because IE6 has a bug and /* To hide/show select Boxes with IE6 (and only IE6 because IE6 has a bug and
// not put popup completely on the front) * not put popup completely on the front)
* Used only bu popup calendar
*/
function hideSelectBoxes() { function hideSelectBoxes() {
var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10); var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10);
if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE 6") > -1) if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE 6") > -1)
@ -304,6 +306,10 @@ function hideSelectBoxes() {
} }
} }
} }
/* To hide/show select Boxes with IE6 (and only IE6 because IE6 has a bug and
* not put popup completely on the front)
* Used only bu popup calendar
*/
function displaySelectBoxes() { function displaySelectBoxes() {
var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10); var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10);
if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE 6") > -1) if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE 6") > -1)
@ -354,9 +360,7 @@ function formatDate(date,format)
c=format.charAt(i); // Recupere char du format c=format.charAt(i); // Recupere char du format
substr=""; substr="";
j=i; j=i;
while ((format.charAt(j)==c) && (j < format.length)) // Recupere char while ((format.charAt(j)==c) && (j < format.length)) // Recupere char successif identiques
// successif
// identiques
{ {
substr += format.charAt(j++); substr += format.charAt(j++);
} }
@ -623,8 +627,9 @@ function hideMessage(fieldId,message) {
if (textbox.value == message) textbox.value = ''; if (textbox.value == message) textbox.value = '';
} }
/* /*
* * TODO Used by admin page only ?
*/ */
function setConstant(url, code, input, entity) { function setConstant(url, code, input, entity) {
$.get( url, { $.get( url, {
@ -679,7 +684,7 @@ function setConstant(url, code, input, entity) {
} }
/* /*
* * TODO Used by admin page only ?
*/ */
function delConstant(url, code, input, entity) { function delConstant(url, code, input, entity) {
$.get( url, { $.get( url, {
@ -733,7 +738,7 @@ function delConstant(url, code, input, entity) {
} }
/* /*
* * TODO Used by admin page only ?
*/ */
function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton) { function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton) {
var boxConfirm = box; var boxConfirm = box;
@ -784,7 +789,9 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
/* /*
* ================================================================= * =================================================================
* This is to allow to transform all select box into ajax autocomplete box * This is to allow to transform all select box into ajax autocomplete box
* with just one line: $(function() { $( "#idofmylist" ).combobox(); }); * with just one line:
* $(function() { $( "#idofmylist" ).combobox(); });
* Do not use it on large combo boxes
* ================================================================= * =================================================================
*/ */
(function( $ ) { (function( $ ) {
@ -894,6 +901,8 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
/* /*
* Timer for delayed keyup function * Timer for delayed keyup function
*
* TODO Who use this ?
*/ */
(function($){ (function($){
$.widget("ui.onDelayedKeyup", { $.widget("ui.onDelayedKeyup", {

View File

@ -33,7 +33,7 @@
* @param string $urloption More parameters on URL request * @param string $urloption More parameters on URL request
* @param int $minLength Minimum number of chars to trigger that Ajax search * @param int $minLength Minimum number of chars to trigger that Ajax search
* @param int $autoselect Automatic selection if just one value * @param int $autoselect Automatic selection if just one value
* @param array $ajaxoptions Multiple options array * @param array $ajaxoptions Multiple options array (Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done
* @return string Script * @return string Script
*/ */
function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array()) function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array())

View File

@ -522,6 +522,17 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
global $user,$conf; global $user,$conf;
global $bc; global $bc;
$form= new Form($db);
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$search_status = GETPOST("search_status",'int');
if ($search_status=='') $search_status=1; // always display activ customer first
$search_name = GETPOST("search_name",'alpha');
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="p.lastname";
$i=-1; $i=-1;
$contactstatic = new Contact($db); $contactstatic = new Contact($db);
@ -547,20 +558,30 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print "\n".'<table class="noborder" width="100%">'."\n"; print "\n".'<table class="noborder" width="100%">'."\n";
$param="socid=".$object->id;
if ($search_status != '') $param.='&amp;search_status='.$search_status;
if ($search_name != '') $param.='&amp;search_name='.urlencode($search_name);
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">';
print '<input type="hidden" name="socid" value="'.$object->id.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
$colspan=8; $colspan=8;
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>'; print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder);
print '<td>'.$langs->trans("Poste").'</td>'; print_liste_field_titre($langs->trans("Poste"),$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder);
print '<td>'.$langs->trans("PhonePro").'</td>'; print_liste_field_titre($langs->trans("PhonePro"),$_SERVER["PHP_SELF"],"p.phone","",$param,'',$sortfield,$sortorder);
print '<td>'.$langs->trans("PhoneMobile").'</td>'; print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mobile","",$param,'',$sortfield,$sortorder);
print '<td>'.$langs->trans("Fax").'</td>'; print_liste_field_titre($langs->trans("Fax"),$_SERVER["PHP_SELF"],"p.fax","",$param,'',$sortfield,$sortorder);
print '<td>'.$langs->trans("EMail").'</td>'; print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email","",$param,'',$sortfield,$sortorder);
if (! empty($conf->skype->enabled)) if (! empty($conf->skype->enabled))
{ {
$colspan++; $colspan++;
print '<td>'.$langs->trans("Skype").'</td>'; print '<td>'.$langs->trans("Skype").'</td>';
} }
print '<td>'.$langs->trans("Status").'</td>'; print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'',$sortfield,$sortorder);
print "<td>&nbsp;</td>"; print "<td>&nbsp;</td>";
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
{ {
@ -575,12 +596,52 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print "</tr>"; print "</tr>";
print '<tr class="liste_titre">';
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_name" size="20" value="'.$search_name.'">';
print '</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
if (! empty($conf->skype->enabled))
{
$colspan++;
print '<td>&nbsp;</td>';
}
print '<td class="liste_titre">';
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
print '</td>';
print "<td>&nbsp;</td>";
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
{
$colspan++;
print '<td>&nbsp;</td>';
}
print '<td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>';
print "</tr>";
$sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays, p.poste, p.phone, p.phone_mobile, p.fax, p.email, p.skype, p.statut "; $sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays, p.poste, p.phone, p.phone_mobile, p.fax, p.email, p.skype, p.statut ";
$sql .= ", p.civilite, p.address, p.zip, p.town"; $sql .= ", p.civilite, p.address, p.zip, p.town";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
$sql .= " WHERE p.fk_soc = ".$object->id; $sql .= " WHERE p.fk_soc = ".$object->id;
$sql .= " ORDER by p.datec"; if ($search_status!='') $sql .= " AND p.statut = ".$db->escape($search_status);
if ($search_name) $sql .= " AND (p.lastname LIKE '%".$db->escape(strtolower($search_name))."%' OR p.firstname LIKE '%".$db->escape(strtolower($search_name))."%')";
$sql.= " ORDER BY $sortfield $sortorder";
dol_syslog('core/lib/company.lib.php :: show_contacts sql='.$sql,LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
$num = $db->num_rows($result); $num = $db->num_rows($result);
@ -592,16 +653,14 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$contactstatic->id = $obj->rowid;
$contactstatic->lastname = $obj->lastname;
$contactstatic->firstname = $obj->firstname;
$contactstatic->statut=$obj->statut;
$var = !$var; $var = !$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print '<td>'; print '<td>';
$contactstatic->id = $obj->rowid;
$contactstatic->statut = $obj->statut;
$contactstatic->lastname = $obj->lastname;
$contactstatic->firstname = $obj->firstname;
print $contactstatic->getNomUrl(1); print $contactstatic->getNomUrl(1);
print '</td>'; print '</td>';
@ -629,7 +688,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print '</td>'; print '</td>';
} }
print '<td>'.$contactstatic->getLibStatut(5).'</td>'; print '<td>'.$contactstatic->getLibStatut(5).'</td>';
// copy in clipboard // copy in clipboard
$coords = ''; $coords = '';
@ -690,7 +749,6 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
} }
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }

View File

@ -1058,7 +1058,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
} }
} elseif ($link) { } elseif ($link) {
if (dol_mkdir($upload_dir) >= 0) { if (dol_mkdir($upload_dir) >= 0) {
require_once DOL_DOCUMENT_ROOT . '/link/class/link.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$linkObject = new Link($db); $linkObject = new Link($db);
$linkObject->entity = $conf->entity; $linkObject->entity = $conf->entity;
$linkObject->url = $link; $linkObject->url = $link;

View File

@ -2358,7 +2358,7 @@ function dol_print_error_email($prefixcode)
* @param string $field Field to use for new sorting * @param string $field Field to use for new sorting
* @param string $begin ("" by defaut) * @param string $begin ("" by defaut)
* @param string $moreparam Add more parameters on sort url links ("" by default) * @param string $moreparam Add more parameters on sort url links ("" by default)
* @param string $td Options of attribute td ("" by defaut) * @param string $td Options of attribute td ("" by defaut, example: 'align="center"')
* @param string $sortfield Current field used to sort * @param string $sortfield Current field used to sort
* @param string $sortorder Current sort order * @param string $sortorder Current sort order
* @return void * @return void
@ -2395,8 +2395,8 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
// If field is used as sort criteria we use a specific class // If field is used as sort criteria we use a specific class
// Example if (sortfield,field)=("nom","xxx.nom") or (sortfield,field)=("nom","nom") // Example if (sortfield,field)=("nom","xxx.nom") or (sortfield,field)=("nom","nom")
if ($field && ($sortfield == $field || $sortfield == preg_replace("/^[^\.]+\./","",$field))) $out.= '<'.$tag.' class="liste_titre_sel" '. $moreattrib.'>'; if ($field && ($sortfield == $field || $sortfield == preg_replace("/^[^\.]+\./","",$field))) $out.= '<'.$tag.' class="liste_titre_sel'.($field?' nowrap':'').'" '. $moreattrib.'>';
else $out.= '<'.$tag.' class="liste_titre" '. $moreattrib.'>'; else $out.= '<'.$tag.' class="liste_titre'.($field?' nowrap':'').'" '. $moreattrib.'>';
if (! empty($conf->dol_optimize_smallscreen) && empty($thead) && $field) // If this is a sort field if (! empty($conf->dol_optimize_smallscreen) && empty($thead) && $field) // If this is a sort field
{ {
@ -2449,7 +2449,7 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
} }
/** /**
* Show a title (deprecated. use print_fiche_titre instrad) * Show a title (deprecated. use print_fiche_titre instead)
* *
* @param string $title Title to show * @param string $title Title to show
* @return string Title to show * @return string Title to show
@ -2462,16 +2462,16 @@ function print_titre($title)
/** /**
* Show a title with picto * Show a title with picto
* *
* @param string $titre Title to show * @param string $title Title to show
* @param string $mesg Added message to show on right * @param string $mesg Added message to show on right
* @param string $picto Icon to use before title (should be a 32x32 transparent png file) * @param string $picto Icon to use before title (should be a 32x32 transparent png file)
* @param int $pictoisfullpath 1=Icon name is a full absolute url of image * @param int $pictoisfullpath 1=Icon name is a full absolute url of image
* @param int $id To force an id on html objects * @param int $id To force an id on html objects
* @return void * @return void
*/ */
function print_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath=0, $id='') function print_fiche_titre($title, $mesg='', $picto='title.png', $pictoisfullpath=0, $id='')
{ {
print load_fiche_titre($titre, $mesg, $picto, $pictoisfullpath, $id); print load_fiche_titre($title, $mesg, $picto, $pictoisfullpath, $id);
} }
/** /**

View File

@ -442,7 +442,7 @@ function isValidUrl($url,$http=0,$pass=0,$port=0,$path=0,$query=0,$anchor=0)
* Clean an url string * Clean an url string
* *
* @param string $url Url * @param string $url Url
* @param string $http 1: keep http://, 0: remove also http:// * @param string $http 1 = keep both http:// and https://, 0: remove http:// but not https://
* @return string Cleaned url * @return string Cleaned url
*/ */
function clean_url($url,$http=1) function clean_url($url,$http=1)

View File

@ -484,7 +484,7 @@ function quotedPrintEncode($str,$forcal=0)
{ {
$newpara = ''; $newpara = '';
$strlength=dol_strlen($line); $strlength=strlen($line); // Do not use dol_strlen here, we need number of bytes
for ($j = 0; $j <= ($strlength - 1); $j++) for ($j = 0; $j <= ($strlength - 1); $j++)
{ {
$char = substr($line, $j, 1); $char = substr($line, $j, 1);
@ -493,7 +493,7 @@ function quotedPrintEncode($str,$forcal=0)
if ( $ascii < 32 || $ascii == 61 || $ascii > 126 ) if ( $ascii < 32 || $ascii == 61 || $ascii > 126 )
$char = '=' . strtoupper(sprintf("%02X", $ascii)); $char = '=' . strtoupper(sprintf("%02X", $ascii));
if ((dol_strlen($newpara) + dol_strlen($char)) >= 76 ) if ((strlen($newpara) + strlen($char)) >= 76 ) // Do not use dol_strlen here, we need number of bytes
{ {
$out .= $newpara . '=' . "\r\n"; // CRLF $out .= $newpara . '=' . "\r\n"; // CRLF
if ($forcal) $out .= " "; // + Space for cal if ($forcal) $out .= " "; // + Space for cal

View File

@ -562,7 +562,7 @@ abstract class DolibarrModules
if (! $resql) $err++; if (! $resql) $err++;
} }
if (! $err && ! preg_match('/newboxdefonly/',$options)) if (! $err && ! preg_match('/newboxdefonly/',$option))
{ {
$lastid=$this->db->last_insert_id(MAIN_DB_PREFIX."boxes_def","rowid"); $lastid=$this->db->last_insert_id(MAIN_DB_PREFIX."boxes_def","rowid");

View File

@ -155,24 +155,20 @@ class MailingTargets // This can't be abstract as it is used for some method
if (! empty($targetarray['email'])) // avoid empty email address if (! empty($targetarray['email'])) // avoid empty email address
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing_cibles"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing_cibles";
$sql .= " (fk_mailing,"; $sql.= " (fk_mailing,";
$sql .= " fk_contact,"; $sql.= " fk_contact,";
$sql .= " lastname, firstname, email, other, source_url, source_id,"; $sql.= " lastname, firstname, email, other, source_url, source_id,";
if (! empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE)) { $sql.= " tag,";
$sql .= " tag,";
}
$sql.= " source_type)"; $sql.= " source_type)";
$sql .= " VALUES (".$mailing_id.","; $sql.= " VALUES (".$mailing_id.",";
$sql .= (empty($targetarray['fk_contact']) ? '0' : "'".$targetarray['fk_contact']."'") .","; $sql.= (empty($targetarray['fk_contact']) ? '0' : "'".$targetarray['fk_contact']."'") .",";
$sql .= "'".$this->db->escape($targetarray['lastname'])."',"; $sql.= "'".$this->db->escape($targetarray['lastname'])."',";
$sql .= "'".$this->db->escape($targetarray['firstname'])."',"; $sql.= "'".$this->db->escape($targetarray['firstname'])."',";
$sql .= "'".$this->db->escape($targetarray['email'])."',"; $sql.= "'".$this->db->escape($targetarray['email'])."',";
$sql .= "'".$this->db->escape($targetarray['other'])."',"; $sql.= "'".$this->db->escape($targetarray['other'])."',";
$sql .= "'".$this->db->escape($targetarray['source_url'])."',"; $sql.= "'".$this->db->escape($targetarray['source_url'])."',";
$sql .= (empty($targetarray['source_id']) ? 'null' : "'".$this->db->escape($targetarray['source_id'])."'").","; $sql.= (empty($targetarray['source_id']) ? 'null' : "'".$this->db->escape($targetarray['source_id'])."'").",";
if (! empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE)) { $sql .= "'".$this->db->escape(dol_hash($targetarray['email'].';'.$targetarray['name'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY))."',";
$sql .= "'".$this->db->escape(md5($targetarray['email'].';'.$targetarray['name'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY))."',";
}
$sql .= "'".$this->db->escape($targetarray['source_type'])."')"; $sql .= "'".$this->db->escape($targetarray['source_type'])."')";
$result=$this->db->query($sql); $result=$this->db->query($sql);
if ($result) if ($result)

View File

@ -529,7 +529,6 @@ class doc_generic_project_odt extends ModelePDFProjects
else // Text else // Text
{ {
$odfHandler->setVars($key, $value, true, 'UTF-8'); $odfHandler->setVars($key, $value, true, 'UTF-8');
$odfHandler->setVarsHeadFooter($key, $value, true, 'UTF-8');
} }
} }
catch(OdfException $e) catch(OdfException $e)

View File

@ -21,7 +21,7 @@
*/ */
?> ?>
<!-- BEGIN PHP TEMPLATE FOR JQUERY --> <!-- BEGIN PHP TEMPLATE AJAXROW.TPL.PHP -->
<?php <?php
$id=$object->id; $id=$object->id;
$fk_element=$object->fk_element; $fk_element=$object->fk_element;
@ -84,4 +84,4 @@ $(document).ready(function(){
}); });
</script> </script>
<?php } ?> <?php } ?>
<!-- END PHP TEMPLATE --> <!-- END PHP TEMPLATE AJAXROW.TPL.PHP -->

View File

@ -20,22 +20,24 @@
/* /*
* Confirm suppression * Confirm suppression
*/ */
if ($action == 'delete') {
$ret = $form->form_confirm( if ($action == 'delete')
$_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int'), {
$langs->trans('DeleteFile'), $ret = $form->form_confirm(
$langs->trans('ConfirmDeleteFile'), $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int'),
'confirm_deletefile', $langs->trans('DeleteFile'),
'', $langs->trans('ConfirmDeleteFile'),
0, 'confirm_deletefile',
1 '',
); 0,
if ($ret == 'html') print '<br>'; 1
);
if ($ret == 'html') print '<br>';
} }
$formfile=new FormFile($db); $formfile=new FormFile($db);
// Show upload form // Show upload form (document and links)
$formfile->form_attach_new_file( $formfile->form_attach_new_file(
$_SERVER["PHP_SELF"].'?id='.$object->id, $_SERVER["PHP_SELF"].'?id='.$object->id,
'', '',

View File

@ -25,7 +25,8 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) {
} elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) { } elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) {
if ($object->id) { if ($object->id) {
$link = GETPOST('link', 'alpha'); $link = GETPOST('link', 'alpha');
if ($link) { if ($link)
{
if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://') { if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://') {
$link = 'http://' . $link; $link = 'http://' . $link;
} }
@ -36,11 +37,14 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) {
// Delete file/link // Delete file/link
if ($action == 'confirm_deletefile' && $confirm == 'yes') { if ($action == 'confirm_deletefile' && $confirm == 'yes')
if ($object->id) { {
if ($object->id)
{
$urlfile = GETPOST('urlfile', 'alpha'); $urlfile = GETPOST('urlfile', 'alpha');
$linkid = GETPOST('linkid', 'int'); $linkid = GETPOST('linkid', 'int');
if ($urlfile) { if ($urlfile)
{
$file = $upload_dir . "/" . $urlfile; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $file = $upload_dir . "/" . $urlfile; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret = dol_delete_file($file, 0, 0, 0, $object); $ret = dol_delete_file($file, 0, 0, 0, $object);
@ -49,8 +53,10 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') {
} else { } else {
setEventMessage($langs->trans("ErrorFailToDeleteFile", $urlfile), 'errors'); setEventMessage($langs->trans("ErrorFailToDeleteFile", $urlfile), 'errors');
} }
} elseif ($linkid) { }
require_once DOL_DOCUMENT_ROOT . '/link/class/link.class.php'; elseif ($linkid)
{
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$link = new Link($db); $link = new Link($db);
$link->id = $linkid; $link->id = $linkid;
$link->fetch(); $link->fetch();
@ -65,23 +71,30 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') {
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
exit; exit;
} }
} elseif ($action == 'confirm_updateline' && GETPOST('save') && GETPOST('link', 'alpha')) { }
require_once DOL_DOCUMENT_ROOT . '/link/class/link.class.php'; elseif ($action == 'confirm_updateline' && GETPOST('save') && GETPOST('link', 'alpha'))
{
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$langs->load('link'); $langs->load('link');
$link = new Link($db); $link = new Link($db);
$link->id = GETPOST('linkid', 'int'); $link->id = GETPOST('linkid', 'int');
$f = $link->fetch(); $f = $link->fetch();
if ($f) { if ($f)
{
$link->url = GETPOST('link', 'alpha'); $link->url = GETPOST('link', 'alpha');
if (substr($link->url, 0, 7) != 'http://' && substr($link->url, 0, 8) != 'https://') { if (substr($link->url, 0, 7) != 'http://' && substr($link->url, 0, 8) != 'https://')
{
$link->url = 'http://' . $link->url; $link->url = 'http://' . $link->url;
} }
$link->label = GETPOST('label', 'alpha'); $link->label = GETPOST('label', 'alpha');
$res = $link->update($user); $res = $link->update($user);
if (!$res) { if (!$res)
{
setEventMessage($langs->trans("ErrorFailedToUpdateLink", $link->label)); setEventMessage($langs->trans("ErrorFailedToUpdateLink", $link->label));
} }
} else { }
else
{
//error fetching //error fetching
} }
} }

View File

@ -32,12 +32,6 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
<!-- BEGIN PHP TEMPLATE freeproductline_create.tpl.php --> <!-- BEGIN PHP TEMPLATE freeproductline_create.tpl.php -->
<form name="addproduct" id="addproduct" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id; ?>#add" method="POST">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
<input type="hidden" name="action" value="addline">
<input type="hidden" name="mode" value="libre">
<input type="hidden" name="id" value="<?php echo $this->id; ?>">
<tr class="liste_titre nodrag nodrop"> <tr class="liste_titre nodrag nodrop">
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>> <td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
<div id="add"></div> <div id="add"></div>
@ -116,7 +110,7 @@ else {
</td> </td>
<td align="right"><?php <td align="right"><?php
if ($seller->tva_assuj == "0") echo '<input type="hidden" name="np_tva_tx" value="0">0'; if ($seller->tva_assuj == "0") echo '<input type="hidden" name="tva_tx" value="0">0';
else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?$_POST["tva_tx"]:-1), $seller, $buyer); else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?$_POST["tva_tx"]:-1), $seller, $buyer);
?> ?>
</td> </td>
@ -137,7 +131,7 @@ else {
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {
echo '<td align="right"><input type="text" size="2" name="np_marginRate" value="'.(isset($_POST["np_marginRate"])?$_POST["np_marginRate"]:'').'">%</td>'; echo '<td align="right"><input type="text" size="2" name="np_marginRate" value="'.(isset($_POST["np_marginRate"])?$_POST["np_marginRate"]:'').'">%</td>';
} }
elseif (! empty($conf->global->DISPLAY_MARK_RATES)) { if (! empty($conf->global->DISPLAY_MARK_RATES)) {
echo '<td align="right"><input type="text" size="2" name="np_markRate" value="'.(isset($_POST["np_markRate"])?$_POST["np_markRate"]:'').'">%</td>'; echo '<td align="right"><input type="text" size="2" name="np_markRate" value="'.(isset($_POST["np_markRate"])?$_POST["np_markRate"]:'').'">%</td>';
} }
} }
@ -155,7 +149,7 @@ else {
} }
?> ?>
<td align="center" valign="middle" colspan="<?php echo $colspan; ?>"> <td align="center" valign="middle" colspan="<?php echo $colspan; ?>">
<input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline_libre"> <input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline_libre" id="addline_libre">
</td> </td>
<?php <?php
//Line extrafield //Line extrafield
@ -196,9 +190,9 @@ if (! empty($conf->service->enabled) && $dateSelector)
if (! empty($object->element) && $object->element == 'contrat') if (! empty($object->element) && $object->element == 'contrat')
{ {
print $langs->trans("DateStartPlanned").' '; print $langs->trans("DateStartPlanned").' ';
$form->select_date('',"date_start_sl",$usehm,$usehm,1,"addline_sl"); $form->select_date('',"date_start",$usehm,$usehm,1,"addline_sl");
print ' &nbsp; '.$langs->trans("DateEndPlanned").' '; print ' &nbsp; '.$langs->trans("DateEndPlanned").' ';
$form->select_date('',"date_end_sl",$usehm,$usehm,1,"addline_sl"); $form->select_date('',"date_end",$usehm,$usehm,1,"addline_sl");
} }
else else
{ {
@ -214,7 +208,6 @@ if (! empty($conf->service->enabled) && $dateSelector)
} }
?> ?>
</form>
<?php <?php
if (! empty($usemargins) && $user->rights->margins->creer) if (! empty($usemargins) && $user->rights->margins->creer)
@ -223,34 +216,29 @@ if (! empty($usemargins) && $user->rights->margins->creer)
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
var npRate = null;
<?php <?php
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { ?> if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { ?>
npRate = "np_marginRate"; $('#addline_libre').click(function (e) {
<?php } return checkFreeLine(e, "np_marginRate");
elseif (! empty($conf->global->DISPLAY_MARK_RATES)) { ?>
npRate = "np_markRate";
<?php }
?>
$("form#addproduct").submit(function(e) {
if (npRate) return checkFreeLine(e, npRate);
else return true;
});
if (npRate == 'np_marginRate') {
$("input[name='np_marginRate']:first").blur(function(e) {
return checkFreeLine(e, npRate);
}); });
$("input[name='np_marginRate']:first").blur(function(e) {
return checkFreeLine(e, "np_marginRate");
});
<?php
} }
else { if (! empty($conf->global->DISPLAY_MARK_RATES)) { ?>
if (npRate == 'np_markRate') { $('#addline_libre').click(function (e) {
$("input[name='np_markRate']:first").blur(function(e) { return checkFreeLine(e, "np_markRate");
return checkFreeLine(e, npRate); });
}); $("input[name='np_markRate']:first").blur(function(e) {
} return checkFreeLine(e, "np_markRate");
});
<?php
} }
?>
}); });
// TODO This works for french numbers only
function checkFreeLine(e, npRate) function checkFreeLine(e, npRate)
{ {
var buying_price = $("input[name='buying_price']:first"); var buying_price = $("input[name='buying_price']:first");
@ -261,14 +249,14 @@ if (! empty($usemargins) && $user->rights->margins->creer)
return true; return true;
if (! $.isNumeric(rate.val().replace(',','.'))) if (! $.isNumeric(rate.val().replace(',','.')))
{ {
alert('<?php echo $langs->trans("rateMustBeNumeric"); ?>'); alert('<?php echo dol_escape_js($langs->trans("rateMustBeNumeric")); ?>');
e.stopPropagation(); e.stopPropagation();
setTimeout(function () { rate.focus() }, 50); setTimeout(function () { rate.focus() }, 50);
return false; return false;
} }
if (npRate == "np_markRate" && rate.val() >= 100) if (npRate == "np_markRate" && rate.val() >= 100)
{ {
alert('<?php echo $langs->trans("markRateShouldBeLesserThan100"); ?>'); alert('<?php echo dol_escape_js($langs->trans("markRateShouldBeLesserThan100")); ?>');
e.stopPropagation(); e.stopPropagation();
setTimeout(function () { rate.focus() }, 50); setTimeout(function () { rate.focus() }, 50);
return false; return false;
@ -284,12 +272,14 @@ if (! empty($usemargins) && $user->rights->margins->creer)
np_price = ((buying_price.val().replace(',','.') / (1 - rate.val().replace(',','.') / 100)) / (1 - remise.val().replace(',','.') / 100)); np_price = ((buying_price.val().replace(',','.') / (1 - rate.val().replace(',','.') / 100)) / (1 - remise.val().replace(',','.') / 100));
} }
} }
$("input[name='price_ht']:first").val(formatFloat(np_price)); $("input[name='price_ht']:first").val(roundFloat(np_price));
return true; return true;
} }
function roundFloat(num) { // TODO This works for french numbers only
function roundFloat(num)
{
var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>; var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>;
var main_rounding = <?php echo min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); ?>; var main_rounding = <?php echo min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); ?>;
@ -312,10 +302,6 @@ if (! empty($usemargins) && $user->rights->margins->creer)
return parseFloat(amount).toFixed(rounding); return parseFloat(amount).toFixed(rounding);
} }
function formatFloat(num) {
return roundFloat(num).replace('.', ',');
}
</script> </script>
<?php <?php
} }

View File

@ -28,14 +28,7 @@
?> ?>
<!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php --> <!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php -->
<form id="editproduct" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'#'.$line->id; ?>" method="POST">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
<input type="hidden" name="action" value="updateligne">
<input type="hidden" name="usenewupdatelineform" value="1" />
<input type="hidden" name="id" value="<?php echo $this->id; ?>">
<input type="hidden" name="lineid" value="<?php echo $line->id; ?>">
<input type="hidden" id="product_type" name="type" value="<?php echo $line->product_type; ?>">
<input type="hidden" id="product_id" name="productid" value="<?php echo (! empty($line->fk_product)?$line->fk_product:0); ?>" />
<?php <?php
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
$coldisplay=2; $coldisplay=2;
@ -45,7 +38,11 @@ if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
?> ?>
<tr <?php echo $bc[$var]; ?>> <tr <?php echo $bc[$var]; ?>>
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>> <td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
<div id="<?php echo $line->id; ?>"></div> <div id="line_<?php echo $line->id; ?>"></div>
<input type="hidden" name="lineid" value="<?php echo $line->id; ?>">
<input type="hidden" id="product_type" name="type" value="<?php echo $line->product_type; ?>">
<input type="hidden" id="product_id" name="productid" value="<?php echo (! empty($line->fk_product)?$line->fk_product:0); ?>" />
<?php <?php
if ($conf->global->MAIN_FEATURES_LEVEL > 1) if ($conf->global->MAIN_FEATURES_LEVEL > 1)
@ -187,12 +184,15 @@ if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
</tr> </tr>
<?php } ?> <?php } ?>
</form>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() {
<?php if ($conf->global->MAIN_FEATURES_LEVEL > 1) { ?> <?php
if ($conf->global->MAIN_FEATURES_LEVEL > 1) // TODO A virer
{
?>
jQuery(document).ready(function() {
if ($('#product_type').val() == 0) { if ($('#product_type').val() == 0) {
$('#service_duration_area').hide(); $('#service_duration_area').hide();
@ -290,7 +290,9 @@ $(document).ready(function() {
} }
}); });
function update_price(input, output) { // update_price
function update_price(input, output)
{
$.post('<?php echo DOL_URL_ROOT; ?>/core/ajax/price.php', { $.post('<?php echo DOL_URL_ROOT; ?>/core/ajax/price.php', {
'amount': $('#' + input).val(), 'amount': $('#' + input).val(),
'output': output, 'output': output,
@ -368,10 +370,19 @@ $(document).ready(function() {
}); });
<?php } ?> <?php } ?>
<?php } ?> });
<?php if (! empty($conf->margin->enabled)) { ?> <?php } // End MAIN_LEVEL_FEATURES > 1 ?>
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': <?php echo $line->fk_product?$line->fk_product:0; ?>}, function(data) {
<?php
if (! empty($conf->margin->enabled))
{
?>
jQuery(document).ready(function()
{
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': <?php echo $line->fk_product?$line->fk_product:0; ?>}, function(data) {
if (data && data.length > 0) { if (data && data.length > 0) {
var options = ''; var options = '';
var trouve=false; var trouve=false;
@ -405,99 +416,101 @@ $(document).ready(function() {
$("#fournprice").hide(); $("#fournprice").hide();
$('#buying_price').show(); $('#buying_price').show();
} }
}, 'json'); }, 'json');
<?php } ?>
});
var npRate = null;
<?php
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { ?>
npRate = "marginRate";
<?php }
elseif (! empty($conf->global->DISPLAY_MARK_RATES)) { ?>
npRate = "markRate";
<?php }
?>
$("form#editproduct").submit(function(e) { <?php
if (npRate) return checkEditLine(e, npRate); if (! empty($conf->global->DISPLAY_MARGIN_RATES))
else return true; {
}); ?>
if (npRate == 'marginRate') { $('#savelinebutton').click(function (e) {
$("input[name='marginRate']:first").blur(function(e) { return checkEditLine(e, "marginRate");
return checkEditLine(e, npRate); });
}); $("input[name='np_marginRate']:first").blur(function(e) {
} return checkEditLine(e, "marginRate");
else { });
if (npRate == 'markRate') { <?php
$("input[name='markRate']:first").blur(function(e) {
return checkEditLine(e, npRate);
});
}
}
function checkEditLine(e, npRate)
{
var buying_price = $("input[name='buying_price']:first");
var remise = $("input[name='remise_percent']:first");
var rate = $("input[name='"+npRate+"']:first");
if (rate.val() == '')
return true;
if (! $.isNumeric(rate.val().replace(',','.')))
{
alert('<?php echo $langs->trans("rateMustBeNumeric"); ?>');
e.stopPropagation();
setTimeout(function () { rate.focus() }, 50);
return false;
}
if (npRate == "markRate" && rate.val() >= 100)
{
alert('<?php echo $langs->trans("markRateShouldBeLesserThan100"); ?>');
e.stopPropagation();
setTimeout(function () { rate.focus() }, 50);
return false;
}
var price = 0;
if (remise.val().replace(',','.') != 100)
{
if (npRate == "marginRate")
price = ((buying_price.val().replace(',','.') * (1 + rate.val().replace(',','.') / 100)) / (1 - remise.val().replace(',','.') / 100));
else {
if (npRate == "markRate")
price = ((buying_price.val().replace(',','.') / (1 - rate.val().replace(',','.') / 100)) / (1 - remise.val().replace(',','.') / 100));
} }
if (! empty($conf->global->DISPLAY_MARK_RATES))
{
?>
$('#savelinebutton').click(function (e) {
return checkEditLine(e, "markRate");
});
$("input[name='np_markRate']:first").blur(function(e) {
return checkEditLine(e, "markRate");
});
<?php
}
?>
});
// TODO This works for french numbers only
function checkEditLine(e, npRate)
{
var buying_price = $("input[name='buying_price']:first");
var remise = $("input[name='remise_percent']:first");
var rate = $("input[name='"+npRate+"']:first");
if (rate.val() == '')
return true;
if (! $.isNumeric(rate.val().replace(',','.')))
{
alert('<?php echo $langs->trans("rateMustBeNumeric"); ?>');
e.stopPropagation();
setTimeout(function () { rate.focus() }, 50);
return false;
}
if (npRate == "markRate" && rate.val() >= 100)
{
alert('<?php echo $langs->trans("markRateShouldBeLesserThan100"); ?>');
e.stopPropagation();
setTimeout(function () { rate.focus() }, 50);
return false;
}
var price = 0;
if (remise.val().replace(',','.') != 100)
{
if (npRate == "marginRate")
price = ((buying_price.val().replace(',','.') * (1 + rate.val().replace(',','.') / 100)) / (1 - remise.val().replace(',','.') / 100));
else {
if (npRate == "markRate")
price = ((buying_price.val().replace(',','.') / (1 - rate.val().replace(',','.') / 100)) / (1 - remise.val().replace(',','.') / 100));
}
}
$("input[name='price_ht']:first").val(roundFloat(price));
return true;
} }
$("input[name='price_ht']:first").val(formatFloat(price));
return true; // TODO This works for french numbers only
} function roundFloat(num) {
function roundFloat(num) { var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>;
var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>; var main_rounding = <?php echo min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); ?>;
var main_rounding = <?php echo min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); ?>;
var amount = num.toString().replace(',','.'); // should be useless var amount = num.toString().replace(',','.'); // should be useless
var nbdec = 0; var nbdec = 0;
var rounding = main_rounding; var rounding = main_rounding;
var pos = amount.indexOf('.'); var pos = amount.indexOf('.');
var decpart = ''; var decpart = '';
if (pos >= 0) if (pos >= 0)
decpart = amount.substr(pos+1).replace('/0+$/i',''); // Supprime les 0 de fin de partie decimale decpart = amount.substr(pos+1).replace('/0+$/i',''); // Supprime les 0 de fin de partie decimale
nbdec = decpart.length; nbdec = decpart.length;
if (nbdec > rounding) if (nbdec > rounding)
rounding = nbdec; rounding = nbdec;
// Si on depasse max // Si on depasse max
if (rounding > main_max_dec_shown) if (rounding > main_max_dec_shown)
{ {
rounding = main_max_dec_shown; rounding = main_max_dec_shown;
} }
//amount = parseFloat(amount) + (1 / Math.pow(100, rounding)); // to avoid floating-point errors //amount = parseFloat(amount) + (1 / Math.pow(100, rounding)); // to avoid floating-point errors
return parseFloat(amount).toFixed(rounding); return parseFloat(amount).toFixed(rounding);
} }
function formatFloat(num) { <?php
return roundFloat(num).replace('.', ',');
} }
?>
</script> </script>
<!-- END PHP TEMPLATE objectline_edit.tpl.php --> <!-- END PHP TEMPLATE objectline_edit.tpl.php -->

View File

@ -32,12 +32,6 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
<!-- BEGIN PHP TEMPLATE predefinedproductline_create.tpl.php --> <!-- BEGIN PHP TEMPLATE predefinedproductline_create.tpl.php -->
<form name="addpredefinedproduct" id="addpredefinedproduct" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id; ?>#add" method="POST">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
<input type="hidden" name="action" value="addline">
<input type="hidden" name="mode" value="predefined">
<input type="hidden" name="id" value="<?php echo $this->id; ?>">
<tr class="liste_titre nodrag nodrop"> <tr class="liste_titre nodrag nodrop">
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="4"' : ' colspan="3"'); ?>> <td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="4"' : ' colspan="3"'); ?>>
<?php <?php
@ -128,25 +122,25 @@ else {
?> ?>
</td> </td>
<td align="right"><input type="hidden" name="price_ht"><input type="text" size="2" name="qty" class="flat" value="1"></td> <td align="right"><input type="hidden" name="price_ht_predef"><input type="text" size="2" name="qty_predef" class="flat" value="1"></td>
<td align="right" class="nowrap"><input type="text" size="1" class="flat" name="remise_percent" value="<?php echo $buyer->remise_percent; ?>"><span class="hideonsmartphone">%</span></td> <td align="right" class="nowrap"><input type="text" size="1" class="flat" name="remise_percent_predef" value="<?php echo $buyer->remise_percent; ?>"><span class="hideonsmartphone">%</span></td>
<?php <?php
$colspan = 4; $colspan = 4;
if (! empty($usemargins)) if (! empty($usemargins))
{ {
?> ?>
<td align="right"> <td align="right">
<select id="fournprice" name="fournprice" class="flat" style="display: none;"></select> <select id="fournprice_predef" name="fournprice_predef" class="flat" style="display: none;"></select>
<input type="text" size="5" id="buying_price" name="buying_price" class="flat" value="<?php echo (isset($_POST["buying_price"])?$_POST["buying_price"]:''); ?>"> <input type="text" size="5" id="buying_price_predef" name="buying_price_predef" class="flat" value="<?php echo (isset($_POST["buying_price_predef"])?$_POST["buying_price_predef"]:''); ?>">
</td> </td>
<?php <?php
if ($user->rights->margins->creer) if ($user->rights->margins->creer)
{ {
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {
echo '<td align="right"><input type="text" size="2" name="np_marginRate" value="'.(isset($_POST["np_marginRate"])?$_POST["np_marginRate"]:'').'">%</td>'; echo '<td align="right"><input type="text" size="2" name="np_marginRate_predef" value="'.(isset($_POST["np_marginRate_predef"])?$_POST["np_marginRate_predef"]:'').'">%</td>';
} }
elseif (! empty($conf->global->DISPLAY_MARK_RATES)) { if (! empty($conf->global->DISPLAY_MARK_RATES)) {
echo '<td align="right"><input type="text" size="2" name="np_markRate" value="'.(isset($_POST["np_markRate"])?$_POST["np_markRate"]:'').'">%</td>'; echo '<td align="right"><input type="text" size="2" name="np_markRate_predef" value="'.(isset($_POST["np_markRate_predef"])?$_POST["np_markRate_predef"]:'').'">%</td>';
} }
} }
else else
@ -163,7 +157,7 @@ else {
} }
?> ?>
<td align="center" valign="middle" colspan="<?php echo $colspan; ?>"> <td align="center" valign="middle" colspan="<?php echo $colspan; ?>">
<input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline_predefined"> <input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline_predefined" id="addline_predefined">
</td> </td>
<?php <?php
//Line extrafield //Line extrafield
@ -203,9 +197,9 @@ if (! empty($conf->service->enabled) && $dateSelector)
if (! empty($object->element) && $object->element == 'contrat') if (! empty($object->element) && $object->element == 'contrat')
{ {
print $langs->trans("DateStartPlanned").' '; print $langs->trans("DateStartPlanned").' ';
$form->select_date('',"date_start",$usehm,$usehm,1,"addline"); $form->select_date('',"date_start_predef",$usehm,$usehm,1,"addline");
print ' &nbsp; '.$langs->trans("DateEndPlanned").' '; print ' &nbsp; '.$langs->trans("DateEndPlanned").' ';
$form->select_date('',"date_end",$usehm,$usehm,1,"addline"); $form->select_date('',"date_end_predef",$usehm,$usehm,1,"addline");
} }
else else
{ {
@ -221,7 +215,6 @@ if (! empty($conf->service->enabled) && $dateSelector)
} }
?> ?>
</form>
<?php <?php
if (! empty($usemargins) && $user->rights->margins->creer) if (! empty($usemargins) && $user->rights->margins->creer)
@ -230,52 +223,48 @@ if (! empty($usemargins) && $user->rights->margins->creer)
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
var npRate = null;
<?php <?php
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { ?> if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { ?>
npRate = "np_marginRate"; $('#addline_predefined').click(function (e) {
<?php } return checkLine(e, "np_marginRate_predef");
elseif (! empty($conf->global->DISPLAY_MARK_RATES)) { ?>
npRate = "np_markRate";
<?php }
?>
$("form#addpredefinedproduct").submit(function(e) {
if (npRate) return checkLine(e, npRate);
else return true;
});
if (npRate == 'np_marginRate') {
$("input[name='np_marginRate']:last").blur(function(e) {
return checkLine(e, npRate);
}); });
$("input[name='np_marginRate_predef']:last").blur(function(e) {
return checkLine(e, "np_marginRate_predef");
});
<?php
} }
else { if (! empty($conf->global->DISPLAY_MARK_RATES)) {
if (npRate == 'np_markRate') { ?>
$("input[name='np_markRate']:last").blur(function(e) { $('#addline_predefined').click(function (e) {
return checkLine(e, npRate); return checkLine(e, "np_markRate_predef");
}); });
} $("input[name='np_marginRate_predef']:last").blur(function(e) {
return checkLine(e, "np_markRate_predef");
});
<?php
} }
?>
}); });
// TODO This works for french numbers only
function checkLine(e, npRate) function checkLine(e, npRate)
{ {
var buying_price = $("input[name='buying_price']:last"); var buying_price = $("input[name='buying_price_predef']:last");
var remise = $("input[name='remise_percent']:last"); var remise = $("input[name='remise_percent_predef']:last");
var rate = $("input[name='"+npRate+"']:last"); var rate = $("input[name='"+npRate+"']:last");
if (rate.val() == '') if (rate.val() == '')
return true; return true;
if (! $.isNumeric(rate.val().replace(',','.'))) if (! $.isNumeric(rate.val().replace(',','.')))
{ {
alert('<?php echo $langs->trans("rateMustBeNumeric"); ?>'); alert('<?php echo dol_escape_js($langs->trans("rateMustBeNumeric")); ?>');
e.stopPropagation(); e.stopPropagation();
setTimeout(function () { rate.focus() }, 50); setTimeout(function () { rate.focus() }, 50);
return false; return false;
} }
if (npRate == "np_markRate" && rate.val() >= 100) if (npRate == "np_markRate_predef" && rate.val() >= 100)
{ {
alert('<?php echo $langs->trans("markRateShouldBeLesserThan100"); ?>'); alert('<?php echo dol_escape_js($langs->trans("markRateShouldBeLesserThan100")); ?>');
e.stopPropagation(); e.stopPropagation();
setTimeout(function () { rate.focus() }, 50); setTimeout(function () { rate.focus() }, 50);
return false; return false;
@ -284,18 +273,19 @@ if (! empty($usemargins) && $user->rights->margins->creer)
var np_price = 0; var np_price = 0;
if (remise.val().replace(',','.') != 100) if (remise.val().replace(',','.') != 100)
{ {
if (npRate == "np_marginRate") if (npRate == "np_marginRate_predef")
np_price = ((buying_price.val().replace(',','.') * (1 + rate.val().replace(',','.') / 100)) / (1 - remise.val().replace(',','.') / 100)); np_price = ((buying_price.val().replace(',','.') * (1 + rate.val().replace(',','.') / 100)) / (1 - remise.val().replace(',','.') / 100));
else { else {
if (npRate == "np_markRate") if (npRate == "np_markRate_predef")
np_price = ((buying_price.val().replace(',','.') / (1 - rate.val().replace(',','.') / 100)) / (1 - remise.val().replace(',','.') / 100)); np_price = ((buying_price.val().replace(',','.') / (1 - rate.val().replace(',','.') / 100)) / (1 - remise.val().replace(',','.') / 100));
} }
} }
$("input[name='price_ht']:last").val(formatFloat(np_price)); $("input[name='price_ht_predef']:last").val(roundFloat(np_price));
return true; return true;
} }
// TODO This works for french numbers only
function roundFloat(num) { function roundFloat(num) {
var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>; var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>;
var main_rounding = <?php echo min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); ?>; var main_rounding = <?php echo min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); ?>;
@ -319,16 +309,12 @@ if (! empty($usemargins) && $user->rights->margins->creer)
return parseFloat(amount).toFixed(rounding); return parseFloat(amount).toFixed(rounding);
} }
function formatFloat(num) {
return roundFloat(num).replace('.', ',');
}
jQuery(document).ready(function() { jQuery(document).ready(function() {
$("#idprod").change(function() $("#idprod").change(function()
{ {
$("#fournprice options").remove(); $("#fournprice_predef options").remove();
$("#fournprice").hide(); $("#fournprice_predef").hide();
$("#buying_price").val("").show(); $("#buying_price_predef").val("").show();
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', { 'idprod': $(this).val() }, function(data) { $.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', { 'idprod': $(this).val() }, function(data) {
if (data && data.length > 0) if (data && data.length > 0)
{ {
@ -339,19 +325,19 @@ if (! empty($usemargins) && $user->rights->margins->creer)
options += '<option value="'+this.id+'" price="'+this.price+'"'; options += '<option value="'+this.id+'" price="'+this.price+'"';
if (i == 1) { if (i == 1) {
options += ' selected'; options += ' selected';
$("#buying_price").val(this.price); $("#buying_price_predef").val(this.price);
} }
options += '>'+this.label+'</option>'; options += '>'+this.label+'</option>';
}); });
options += '<option value=""><?php echo $langs->trans("InputPrice"); ?></option>'; options += '<option value=""><?php echo $langs->trans("InputPrice"); ?></option>';
$("#buying_price").hide(); $("#buying_price_predef").hide();
$("#fournprice").html(options).show(); $("#fournprice_predef").html(options).show();
$("#fournprice").change(function() { $("#fournprice_predef").change(function() {
var selval = $(this).find('option:selected').attr("price"); var selval = $(this).find('option:selected').attr("price");
if (selval) if (selval)
$("#buying_price").val(selval).hide(); $("#buying_price_predef").val(selval).hide();
else else
$('#buying_price').show(); $('#buying_price_predef').show();
}); });
} }
}, },

View File

@ -120,7 +120,7 @@ if ($action=='add')
$object->unitfrequency=GETPOST('unitfrequency','int'); $object->unitfrequency=GETPOST('unitfrequency','int');
$object->frequency=$object->unitfrequency * GETPOST('nbfrequency','int'); $object->frequency=$object->unitfrequency * GETPOST('nbfrequency','int');
//Add cron task // Add cron task
$result = $object->create($user); $result = $object->create($user);
// test du Resultat de la requete // test du Resultat de la requete
@ -154,7 +154,7 @@ if ($action=='update')
$object->unitfrequency=GETPOST('unitfrequency','int'); $object->unitfrequency=GETPOST('unitfrequency','int');
$object->frequency=$object->unitfrequency * GETPOST('nbfrequency','int'); $object->frequency=$object->unitfrequency * GETPOST('nbfrequency','int');
//Add cron task // Add cron task
$result = $object->update($user); $result = $object->update($user);
// test du Resultat de la requete // test du Resultat de la requete
@ -172,7 +172,7 @@ if ($action=='activate')
{ {
$object->status=1; $object->status=1;
//Add cron task // Add cron task
$result = $object->update($user); $result = $object->update($user);
// test du Resultat de la requete // test du Resultat de la requete
@ -189,7 +189,8 @@ if ($action=='activate')
if ($action=='inactive') if ($action=='inactive')
{ {
$object->status=0; $object->status=0;
//Add cron task
// Add cron task
$result = $object->update($user); $result = $object->update($user);
// test du Resultat de la requete // test du Resultat de la requete

View File

@ -53,6 +53,7 @@ $action=GETPOST("action");
$section=GETPOST("section")?GETPOST("section","int"):GETPOST("section_id","int"); $section=GETPOST("section")?GETPOST("section","int"):GETPOST("section_id","int");
$module=GETPOST("module"); $module=GETPOST("module");
if (! $section) $section=0; if (! $section) $section=0;
$section_dir=GETPOST('section_dir');
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
@ -93,7 +94,7 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Define relativepath and upload_dir // Define relativepath and upload_dir
$relativepath=''; $relativepath='';
if ($ecmdir->id) $relativepath=$ecmdir->getRelativePath(); if ($ecmdir->id) $relativepath=$ecmdir->getRelativePath();
else $relativepath=GETPOST('section_dir'); else $relativepath=$section_dir;
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath; $upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
if (empty($_FILES['userfile']['tmp_name'])) if (empty($_FILES['userfile']['tmp_name']))
@ -167,16 +168,20 @@ if ($action == 'confirm_deletefile')
{ {
if (GETPOST('confirm') == 'yes') if (GETPOST('confirm') == 'yes')
{ {
$langs->load("other"); $langs->load("other");
$result=$ecmdir->fetch($section); if ($section)
if (! ($result > 0))
{ {
dol_print_error($db,$ecmdir->error); $result=$ecmdir->fetch($section);
exit; if (! ($result > 0))
{
dol_print_error($db,$ecmdir->error);
exit;
}
$relativepath=$ecmdir->getRelativePath();
} }
$relativepath=$ecmdir->getRelativePath(); else $relativepath='';
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath; $upload_dir = $conf->ecm->dir_output.($relativepath?'/'.$relativepath:'');
$file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_POST are already decoded by PHP).
$ret=dol_delete_file($file); $ret=dol_delete_file($file);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
@ -391,7 +396,7 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) {
if (! empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } if (! empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); }
if (! empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } if (! empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); }
if (! empty($conf->tax->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBySocialContributions")); } if (! empty($conf->tax->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBySocialContributions")); }
if (! empty($conf->projet->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsByProjects")); } if (! empty($conf->projet->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsByProjects")); }
} }
print_fiche_titre($langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager")); print_fiche_titre($langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager"));
@ -461,7 +466,6 @@ if ($action == 'delete_section')
// End confirm // End confirm
if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$action) || $action == 'delete') if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$action) || $action == 'delete')
{ {
print '<table width="100%" class="nobordernopadding">'; print '<table width="100%" class="nobordernopadding">';
@ -774,8 +778,19 @@ include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php';
// To attach new file // To attach new file
if ((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) || ! empty($section)) if ((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) || ! empty($section))
{ {
if (empty($section) || $section == -1)
{
?>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#formuserfile').hide();
});
</script>
<?php
}
$formfile=new FormFile($db); $formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/ecm/index.php', 'none', 0, ($section?$section:-1), $user->rights->ecm->upload, 48, null, '', 0, '', 0); $formfile->form_attach_new_file(DOL_URL_ROOT.'/ecm/index.php', 'none', 0, ($section?$section:-1), $user->rights->ecm->upload, 48, null, '', 0, '', 0, 'formuserfile');
} }
else print '&nbsp;'; else print '&nbsp;';
@ -789,6 +804,8 @@ else print '&nbsp;';
<?php <?php
// End of page // End of page
if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) {
include 'tpl/builddatabase.tpl.php'; include 'tpl/builddatabase.tpl.php';
} }

View File

@ -14,27 +14,38 @@
* 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/>.
* *
* Output javascript for interactions code of ecm module
*/ */
$openeddir='/';
// TODO: just use ajaxdirtree.php for load database after ajax refresh and not scan directories
// too slow every page loaded !
?> ?>
<!-- BEGIN PHP TEMPLATE FOR JQUERY --> <!-- BEGIN PHP TEMPLATE ecm/tpl/builddatabase.tpl.php -->
<!-- Doc of fileTree plugin at http://www.abeautifulsite.net/blog/2008/03/jquery-file-tree/ -->
<script type="text/javascript"> <script type="text/javascript">
$(document).ready( function() {
$('#filetree').fileTree({ root: '<?php print dol_escape_js($openeddir); ?>', <?php
// Called if we click on a file (not a dir) $openeddir='/';
script: '<?php echo DOL_URL_ROOT.'/core/ajax/ajaxdirtree.php?modulepart=ecm&openeddir='.urlencode($openeddir); ?>', ?>
folderEvent: 'click',
multiFolder: false }, $(document).ready(function() {
// Called if we click on a file (not a dir)
$('#filetree').fileTree({
root: '<?php print dol_escape_js($openeddir); ?>',
// Ajax called if we click to expand a dir (not a file). Parameter of dir is provided as a POST parameter.
script: '<?php echo DOL_URL_ROOT.'/core/ajax/ajaxdirtree.php?modulepart=ecm&openeddir='.urlencode($openeddir); ?>',
folderEvent: 'click', // 'dblclick'
multiFolder: false },
// Called if we click on a file (not a dir)
function(file) { function(file) {
$("#mesg").hide(); $("#mesg").hide();
loadandshowpreview(file,0); loadandshowpreview(file,0);
},
// Called if we click on a dir (not a file)
function(elem) {
id=elem.attr('id').substr(12);
jQuery("#formuserfile_section_dir").val(elem.attr('rel'));
jQuery("#formuserfile_section_id").val(id);
jQuery('#formuserfile').show();
} }
); );
@ -78,5 +89,6 @@ ecmBuildDatabase = function() {
location.href="<?php echo $_SERVER['PHP_SELF']; ?>"; location.href="<?php echo $_SERVER['PHP_SELF']; ?>";
}); });
}; };
</script> </script>
<!-- END PHP TEMPLATE FOR JQUERY --> <!-- END PHP TEMPLATE ecm/tpl/builddatabase.tpl.php -->

View File

@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcontract.class.php';
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {

View File

@ -222,7 +222,7 @@ class ProductFournisseur extends Product
{ {
// Add price for this quantity to supplier // Add price for this quantity to supplier
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price(";
$sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, entity, info_bits)"; $sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, info_bits, entity)";
$sql.= " values('".$this->db->idate($now)."',"; $sql.= " values('".$this->db->idate($now)."',";
$sql.= " ".$this->id.","; $sql.= " ".$this->id.",";
$sql.= " ".$fourn->id.","; $sql.= " ".$fourn->id.",";

View File

@ -23,7 +23,7 @@
/** /**
* \file htdocs/fourn/commande/document.php * \file htdocs/fourn/commande/document.php
* \ingroup supplier * \ingroup supplier
* \brief Page de gestion des documents attaches a une commande fournisseur * \brief Management page of attached documents to a supplier order
*/ */
require '../../main.inc.php'; require '../../main.inc.php';

View File

@ -181,160 +181,195 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
$langs->load('errors'); $langs->load('errors');
$error = 0; $error = 0;
if (GETPOST('pu') < 0 && GETPOST('qty') < 0) // Set if we used free entry or predefined product
if (GETPOST('addline_libre'))
{
$predef='';
$idprod=0;
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
$price_ht = GETPOST('price_ht');
$tva_tx=(GETPOST('tva_tx')?GETPOST('tva_tx'):0);
}
if (GETPOST('addline_predefined'))
{
$predef=(($conf->global->MAIN_FEATURES_LEVEL < 2) ? '_predef' : '');
$idprod=GETPOST('idprod', 'int');
$product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):''));
$price_ht = '';
$tva_tx = '';
}
$qty = GETPOST('qty'.$predef);
$remise_percent=GETPOST('remise_percent'.$predef);
if (GETPOST('addline_libre') && GETPOST('pu') < 0 && $qty < 0)
{ {
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPrice'), $langs->transnoentitiesnoconv('Qty')), 'errors'); setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPrice'), $langs->transnoentitiesnoconv('Qty')), 'errors');
$error++; $error++;
} }
if (! GETPOST('idprodfournprice') && GETPOST('type') < 0) if (GETPOST('addline_libre') && ! GETPOST('idprodfournprice') && GETPOST('type') < 0)
{ {
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors'); setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors');
$error++; $error++;
} }
if (! GETPOST('idprodfournprice') && (! GETPOST('pu') || GETPOST('pu')=='')) // Unit price can be 0 but not '' if (! GETPOST('addline_predefined') && (! GETPOST('pu') || GETPOST('pu')=='')) // Unit price can be 0 but not ''
{ {
setEventMessage($langs->trans($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPrice'))), 'errors'); setEventMessage($langs->trans($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPrice'))), 'errors');
$error++; $error++;
} }
if (! GETPOST('idprodfournprice') && ! GETPOST('np_desc') && ! GETPOST('dp_desc')) if (! GETPOST('addline_predefined') && ! GETPOST('np_desc') && ! GETPOST('dp_desc'))
{ {
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors'); setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors');
$error++; $error++;
} }
if (! GETPOST('idprodfournprice') && (! GETPOST('qty') || GETPOST('qty') == '') if ((! GETPOST('addline_predefined') && (! GETPOST('qty') || GETPOST('qty') == ''))
|| GETPOST('idprodfournprice') && (! GETPOST('pqty') || GETPOST('pqty') == '')) || (GETPOST('addline_predefined') && (! GETPOST('qty_predef') || GETPOST('qty_predef') == '')))
{ {
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors'); setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors');
$error++; $error++;
} }
if (! $error && ((GETPOST('qty') || GETPOST('pqty')) && ((GETPOST('pu') && (GETPOST('np_desc') || GETPOST('dp_desc'))) || GETPOST('idprodfournprice')))) // Ecrase $pu par celui du produit
// Ecrase $desc par celui du produit
// Ecrase $txtva par celui du produit
if (GETPOST('addline_predefined') || GETPOST('idprodfournprice')) // With combolist idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or ''
{ {
// Ecrase $pu par celui du produit $idprod=0;
// Ecrase $desc par celui du produit $productsupplier = new ProductFournisseur($db);
// Ecrase $txtva par celui du produit
if (GETPOST('idprodfournprice')) // >0 or -1
{
$qty = GETPOST('qty') ? GETPOST('qty') : GETPOST('pqty');
$productsupplier = new ProductFournisseur($db); if (GETPOST('idprodfournprice') == '')
$idprod=$productsupplier->get_buyprice($_POST['idprodfournprice'], $qty); // Just to see if a price exists for the quantity. Not used to found vat {
$idprod=-1;
}
if (GETPOST('idprodfournprice') > 0)
{
$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qty); // Just to see if a price exists for the quantity. Not used to found vat
}
if ($idprod > 0) if ($idprod > 0)
{ {
$res=$productsupplier->fetch($idprod); $res=$productsupplier->fetch($idprod);
// cas special pour lequel on a les meme reference que le fournisseur $label = $productsupplier->libelle;
// $label = '['.$nv_prod->ref.'] - '. $nv_prod->libelle;
$label = $productsupplier->libelle;
$desc = $productsupplier->description; $desc = $productsupplier->description;
$desc.= $productsupplier->description && $_POST['np_desc'] ? "\n" : ""; if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc);
$desc.= $_POST['np_desc'];
$remise_percent = GETPOST('remise_percent') ? GETPOST('remise_percent') : GETPOST('p_remise_percent'); $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice'));
$type = $productsupplier->type;
$tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); // Local Taxes
$type = $productsupplier->type; $localtax1_tx= get_localtax($tva_tx, 1,$mysoc,$object->thirdparty);
$localtax2_tx= get_localtax($tva_tx, 2,$mysoc,$object->thirdparty);
// Local Taxes $result=$object->addline(
$localtax1_tx= get_localtax($tva_tx, 1,$mysoc,$object->thirdparty); $desc,
$localtax2_tx= get_localtax($tva_tx, 2,$mysoc,$object->thirdparty); $productsupplier->fourn_pu,
$qty,
$tva_tx,
$localtax1_tx,
$localtax2_tx,
$productsupplier->id,
GETPOST('idprodfournprice'),
$productsupplier->fourn_ref,
$remise_percent,
'HT',
$type
);
}
if ($idprod == 0)
{
// Product not selected
$error++;
$langs->load("errors");
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ProductOrService")), 'errors');
}
if ($idprod == -1)
{
// Quantity too low
$error++;
$langs->load("errors");
setEventMessage($langs->trans("ErrorQtyTooLowForThisSupplier"), 'errors');
}
}
else
{
$type=$_POST["type"];
$desc=$_POST['dp_desc'];
$tva_tx = price2num($_POST['tva_tx']);
$result=$object->addline( // Local Taxes
$desc, $localtax1_tx= get_localtax($tva_tx, 1,$mysoc,$object->thirdparty);
$pu, // FIXME $pu is not defined $localtax2_tx= get_localtax($tva_tx, 2,$mysoc,$object->thirdparty);
$qty,
$tva_tx,
$localtax1_tx,
$localtax2_tx,
$productsupplier->id,
GETPOST('idprodfournprice'),
$productsupplier->fourn_ref,
$remise_percent,
'HT',
$type
);
}
if ($idprod == -1)
{
// Quantity too low
setEventMessage($langs->trans("ErrorQtyTooLowForThisSupplier"), 'errors');
}
}
else
{
$type=$_POST["type"];
$desc=$_POST['dp_desc'];
$tva_tx = price2num($_POST['tva_tx']);
// Local Taxes if (! $product_desc)
$localtax1_tx= get_localtax($tva_tx, 1,$mysoc,$object->thirdparty); {
$localtax2_tx= get_localtax($tva_tx, 2,$mysoc,$object->thirdparty); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")), 'errors');
}
else
{
if (!empty($_POST['pu']))
{
$price_base_type = 'HT';
$ht = price2num($_POST['pu']);
$result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, 0, $type);
}
else
{
$ttc = price2num($_POST['amountttc']);
$ht = $ttc / (1 + ($tauxtva / 100));
$price_base_type = 'HT';
$result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type);
}
}
}
if (! $_POST['dp_desc']) //print "xx".$tva_tx; exit;
{ if (! $error && $result > 0)
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")), 'errors'); {
} $ret=$object->fetch($object->id); // Reload to get new records
else
{
if (!empty($_POST['pu']))
{
$price_base_type = 'HT';
$ht = price2num($_POST['pu']);
$result=$object->addline($desc, $ht, $_POST['qty'], $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $_POST['remise_percent'], $price_base_type, 0, $type);
}
else
{
$ttc = price2num($_POST['amountttc']);
$ht = $ttc / (1 + ($tauxtva / 100));
$price_base_type = 'HT';
$result=$object->addline($desc, $ht, $_POST['qty'], $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $_POST['remise_percent'], $price_base_type, $ttc, $type);
}
}
}
//print "xx".$tva_tx; exit; if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
if ($result > 0) {
{ // Define output language
$ret=$object->fetch($object->id); // Reload to get new records $outputlangs = $langs;
$newlang=GETPOST('lang_id','alpha');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
{ }
// Define output language
$outputlangs = $langs;
$newlang=GETPOST('lang_id','alpha');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); unset($_POST['qty']);
} unset($_POST['type']);
unset($_POST['qty']); unset($_POST['remise_percent']);
unset($_POST['type']); unset($_POST['dp_desc']);
unset($_POST['idprodfournprice']); unset($_POST['pu']);
unset($_POST['remmise_percent']); unset($_POST['tva_tx']);
unset($_POST['dp_desc']); unset($_POST['label']);
unset($_POST['np_desc']); unset($localtax1_tx);
unset($_POST['pu']); unset($localtax2_tx);
unset($_POST['tva_tx']);
unset($localtax1_tx); unset($_POST['idprodfournprice']);
unset($localtax2_tx); unset($_POST['qty_predef']);
} unset($_POST['remise_percent_predef']);
else unset($_POST['fournprice_predef']);
{ unset($_POST['buying_price_predef']);
setEventMessage($object->error, 'errors'); unset($_POST['np_desc']);
} }
else
{
setEventMessage($object->error, 'errors');
} }
} }
/* /*
* Mise a jour d'une ligne dans la commande * Mise a jour d'une ligne dans la commande
*/ */
else if ($action == 'updateligne' && $user->rights->fournisseur->commande->creer && $_POST['save'] == $langs->trans('Save')) else if ($action == 'update_line' && $user->rights->fournisseur->commande->creer && $_POST['save'] == $langs->trans('Save'))
{ {
if ($_POST["elrowid"]) if ($_POST["elrowid"])
{ {
@ -1381,8 +1416,20 @@ elseif (! empty($object->id))
/* /*
* Lines * Lines
*/ */
print '<table class="noborder" width="100%">';
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?etat=1&id='.$object->id.(($action != 'edit_line')?'#add':'#line_'.GETPOST('lineid')).'" method="POST">
<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">
<input type="hidden" name="action" value="'.(($action != 'edit_line')?'addline':'update_line').'">
<input type="hidden" name="mode" value="">
<input type="hidden" name="id" value="'.$object->id.'">
<input type="hidden" name="facid" value="'.$object->id.'">
<input type="hidden" name="socid" value="'.$societe->id.'">
';
print '<table id="tablelines" class="noborder noshadow" width="100%">';
$num = count($object->lines); $num = count($object->lines);
$i = 0; $total = 0; $i = 0; $total = 0;
@ -1422,8 +1469,8 @@ elseif (! empty($object->id))
$type=1; $type=1;
} }
// Ligne en mode visu // Edit line
if ($action != 'editline' || $_GET['rowid'] != $line->id) if ($action != 'edit_line' || $_GET['rowid'] != $line->id)
{ {
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
@ -1478,7 +1525,7 @@ elseif (! empty($object->id))
print '<td align="right" class="nowrap">'.price($line->total_ht).'</td>'; print '<td align="right" class="nowrap">'.price($line->total_ht).'</td>';
if ($object->statut == 0 && $user->rights->fournisseur->commande->creer) if ($object->statut == 0 && $user->rights->fournisseur->commande->creer)
{ {
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=editline&amp;rowid='.$line->id.'#'.$line->id.'">'; print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=edit_line&amp;rowid='.$line->id.'#'.$line->id.'">';
print img_edit(); print img_edit();
print '</a></td>'; print '</a></td>';
@ -1495,16 +1542,14 @@ elseif (! empty($object->id))
} }
// Ligne en mode update // Ligne en mode update
if ($action == 'editline' && $user->rights->fournisseur->commande->creer && ($_GET["rowid"] == $line->id)) if ($action == 'edit_line' && $user->rights->fournisseur->commande->creer && ($_GET["rowid"] == $line->id))
{ {
print "\n"; print "\n";
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;etat=1&amp;ligne_id='.$line->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="updateligne">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="elrowid" value="'.$_GET['rowid'].'">';
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td>'; print '<td>';
print '<input type="hidden" name="elrowid" value="'.$_GET['rowid'].'">';
print '<a name="'.$line->id.'"></a>'; // ancre pour retourner sur la ligne print '<a name="'.$line->id.'"></a>'; // ancre pour retourner sur la ligne
if ((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && $line->fk_product > 0) if ((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && $line->fk_product > 0)
{ {
@ -1546,7 +1591,6 @@ elseif (! empty($object->id))
print '<td align="center" colspan="4"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">'; print '<td align="center" colspan="4"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'"></td>'; print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'"></td>';
print '</tr>' . "\n"; print '</tr>' . "\n";
print "</form>\n";
} }
$i++; $i++;
} }
@ -1554,7 +1598,7 @@ elseif (! empty($object->id))
/* /*
* Form to add new line * Form to add new line
*/ */
if ($object->statut == 0 && $user->rights->fournisseur->commande->creer && $action <> 'editline') if ($object->statut == 0 && $user->rights->fournisseur->commande->creer && $action <> 'edit_line')
{ {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -1571,19 +1615,6 @@ elseif (! empty($object->id))
// TODO Use the predefinedproductline_create.tpl.php file // TODO Use the predefinedproductline_create.tpl.php file
// Add free products/services form // Add free products/services form
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'#add" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="addline">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(\'#idprodfournprice\').change(function() {
if (jQuery(\'#idprodfournprice\').val() > 0) jQuery(\'#np_desc\').focus();
});
});
</script>';
$var=true; $var=true;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td>'; print '<td>';
@ -1611,14 +1642,20 @@ elseif (! empty($object->id))
print '<td align="right"><input type="text" name="pu" size="5" value="'.GETPOST('pu').'"></td>'; print '<td align="right"><input type="text" name="pu" size="5" value="'.GETPOST('pu').'"></td>';
print '<td align="right"><input type="text" name="qty" value="'.(GETPOST('qty')?GETPOST('qty'):'1').'" size="2"></td>'; print '<td align="right"><input type="text" name="qty" value="'.(GETPOST('qty')?GETPOST('qty'):'1').'" size="2"></td>';
print '<td align="right" class="nowrap"><input type="text" name="remise_percent" size="1" value="'.(GETPOST('remise_percent')?GETPOST('remise_percent'):$object->thirdparty->remise_percent).'"><span class="hideonsmartphone">%</span></td>'; print '<td align="right" class="nowrap"><input type="text" name="remise_percent" size="1" value="'.(GETPOST('remise_percent')?GETPOST('remise_percent'):$object->thirdparty->remise_percent).'"><span class="hideonsmartphone">%</span></td>';
print '<td align="center" colspan="4"><input type="submit" class="button" value="'.$langs->trans('Add').'"></td>'; print '<td align="center" colspan="4"><input type="submit" class="button" value="'.$langs->trans('Add').'" name="addline_libre"></td>';
print '</tr>'; print '</tr>';
print '</form>';
// Ajout de produits/services predefinis // Ajout de produits/services predefinis
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
{ {
print '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(\'#idprodfournprice\').change(function() {
if (jQuery(\'#idprodfournprice\').val() > 0) jQuery(\'#np_desc\').focus();
});
});
</script>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="3">'; print '<td colspan="3">';
print $langs->trans("AddNewLine").' - '; print $langs->trans("AddNewLine").' - ';
@ -1636,21 +1673,16 @@ elseif (! empty($object->id))
print '<td colspan="4">&nbsp;</td>'; print '<td colspan="4">&nbsp;</td>';
print '</tr>'; print '</tr>';
print '<form id="addpredefinedproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'#add" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="addline">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td colspan="3">'; print '<td colspan="3">';
$ajaxoptions=array( $ajaxoptions=array(
'update' => array('pqty' => 'qty', 'p_remise_percent' => 'discount'), 'update' => array('qty_predef' => 'qty_predef', 'remise_percent_predef' => 'remise_percent_predef'),
'option_disabled' => 'addPredefinedProductButton', 'option_disabled' => 'addPredefinedProductButton',
'error' => $langs->trans("NoPriceDefinedForThisSupplier") 'error' => $langs->trans("NoPriceDefinedForThisSupplier")
); );
$form->select_produits_fournisseurs($object->fourn_id, '', 'idprodfournprice', '', '', $ajaxoptions); $form->select_produits_fournisseurs($object->fourn_id, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions);
if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) print '<br>'; if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) print '<br>';
@ -1666,16 +1698,17 @@ elseif (! empty($object->id))
$doleditor->Create(); $doleditor->Create();
print '</td>'; print '</td>';
print '<td align="right"><input type="text" size="2" id="pqty" name="pqty" value="'.(GETPOST('pqty')?GETPOST('pqty'):'1').'"></td>'; print '<td align="right"><input type="text" size="2" id="qty_predef" name="qty_predef" value="'.(GETPOST('qty_predef')?GETPOST('qty_predef'):'1').'"></td>';
print '<td align="right" class="nowrap"><input type="text" size="1" id="p_remise_percent" name="p_remise_percent" value="'.(GETPOST('p_remise_percent')?GETPOST('p_remise_percent'):$object->thirdparty->remise_percent).'"><span class="hideonsmartphone">%</span></td>'; print '<td align="right" class="nowrap"><input type="text" size="1" id="remise_percent_predef" name="remise_percent_predef" value="'.(GETPOST('remise_percent_predef')?GETPOST('remise_percent_predef'):$object->thirdparty->remise_percent).'"><span class="hideonsmartphone">%</span></td>';
print '<td align="center" colspan="4"><input type="submit" id="addPredefinedProductButton" class="button" value="'.$langs->trans('Add').'"></td>'; print '<td align="center" colspan="4"><input type="submit" id="addPredefinedProductButton" class="button" value="'.$langs->trans('Add').'" name="addline_predefined"></td>';
print '</tr>'; print '</tr>';
print '</form>';
} }
} }
print '</table>'; print '</table>';
print '</div>';
print '</form>';
dol_fiche_end();
if ($action != 'presend') if ($action != 'presend')
@ -1683,7 +1716,7 @@ elseif (! empty($object->id))
/** /**
* Boutons actions * Boutons actions
*/ */
if ($user->societe_id == 0 && $action != 'editline' && $action != 'delete') if ($user->societe_id == 0 && $action != 'edit_line' && $action != 'delete')
{ {
print '<div class="tabsAction">'; print '<div class="tabsAction">';

View File

@ -477,7 +477,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
} }
// Modification d'une ligne // Modification d'une ligne
elseif ($action == 'update_line') elseif ($action == 'update_line' && $user->rights->fournisseur->facture->creer)
{ {
if (GETPOST('etat') == '1' && ! GETPOST('cancel')) // si on valide la modification if (GETPOST('etat') == '1' && ! GETPOST('cancel')) // si on valide la modification
{ {
@ -524,8 +524,32 @@ elseif ($action == 'update_line')
} }
} }
elseif ($action == 'addline') elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer)
{ {
$langs->load('errors');
$error=0;
// Set if we used free entry or predefined product
if (GETPOST('addline_libre'))
{
$predef='';
$idprod=0;
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
$price_ht = GETPOST('price_ht');
$tva_tx=(GETPOST('tva_tx')?GETPOST('tva_tx'):0);
}
if (GETPOST('addline_predefined'))
{
$predef=(($conf->global->MAIN_FEATURES_LEVEL < 2) ? '_predef' : '');
$idprod=GETPOST('idprod', 'int');
$product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):''));
$price_ht = '';
$tva_tx = '';
}
$qty = GETPOST('qty'.$predef);
$remise_percent=GETPOST('remise_percent'.$predef);
$ret=$object->fetch($id); $ret=$object->fetch($id);
if ($ret < 0) if ($ret < 0)
{ {
@ -534,10 +558,10 @@ elseif ($action == 'addline')
} }
$ret=$object->fetch_thirdparty(); $ret=$object->fetch_thirdparty();
if (GETPOST('search_idprodfournprice') || GETPOST('idprodfournprice')) // With combolist idprodfournprice is > 0 or -1, with autocomplete, idprodfournprice is > 0 or '' if (GETPOST('addline_predefined') || GETPOST('search_idprodfournprice') || GETPOST('idprodfournprice')) // With combolist idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or ''
{ {
$idprod=0; $idprod=0;
$product=new Product($db); $productsupplier=new ProductFournisseur($db);
if (GETPOST('idprodfournprice') == '') if (GETPOST('idprodfournprice') == '')
{ {
@ -545,33 +569,39 @@ elseif ($action == 'addline')
} }
if (GETPOST('idprodfournprice') > 0) if (GETPOST('idprodfournprice') > 0)
{ {
$idprod=$product->get_buyprice(GETPOST('idprodfournprice'), $_POST['qty']); // Just to see if a price exists for the quantity. Not used to found vat $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qty); // Just to see if a price exists for the quantity. Not used to found vat
} }
if ($idprod > 0) if ($idprod > 0)
{ {
$result=$product->fetch($idprod); $result=$productsupplier->fetch($idprod);
// cas special pour lequel on a les meme reference que le fournisseur $label = $productsupplier->libelle;
// $label = '['.$product->ref.'] - '. $product->libelle;
$label = $product->description;
$label.= $product->description && $_POST['np_desc'] ? "\n" : "";
$label.= $_POST['np_desc'];
$tvatx=get_default_tva($object->thirdparty, $mysoc, $product->id, $_POST['idprodfournprice']); $desc = $productsupplier->description;
$npr = get_default_npr($object->thirdparty, $mysoc, $product->id, $_POST['idprodfournprice']); if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc);
$tvatx=get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, $_POST['idprodfournprice']);
$npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, $_POST['idprodfournprice']);
$localtax1tx= get_localtax($tvatx, 1, $mysoc,$object->thirdparty); $localtax1tx= get_localtax($tvatx, 1, $mysoc,$object->thirdparty);
$localtax2tx= get_localtax($tvatx, 2, $mysoc,$object->thirdparty); $localtax2tx= get_localtax($tvatx, 2, $mysoc,$object->thirdparty);
$remise_percent=GETPOST('remise_percent');
$type = $product->type;
$result=$object->addline($label, $product->fourn_pu, $tvatx, $localtax1tx, $localtax2tx, $_POST['qty'], $idprod, $remise_percent, '', '', 0, $npr); $type = $productsupplier->type;
$result=$object->addline($desc, $productsupplier->fourn_pu, $tvatx, $localtax1tx, $localtax2tx, $qty, $idprod, $remise_percent, '', '', 0, $npr);
}
if ($idprod == 0)
{
// Product not selected
$error++;
$langs->load("errors");
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ProductOrService")).'</div>';
} }
if ($idprod == -1) if ($idprod == -1)
{ {
// Quantity too low // Quantity too low
$error++;
$langs->load("errors"); $langs->load("errors");
$mesg='<div class="error">'.$langs->trans("ErrorQtyTooLowForThisSupplier").'</div>'; $mesg='<div class="error">'.$langs->trans("ErrorQtyTooLowForThisSupplier").'</div>';
} }
@ -583,35 +613,37 @@ elseif ($action == 'addline')
$tauxtva = price2num($tauxtva); $tauxtva = price2num($tauxtva);
$localtax1tx= get_localtax($tauxtva, 1, $mysoc,$object->thirdparty); $localtax1tx= get_localtax($tauxtva, 1, $mysoc,$object->thirdparty);
$localtax2tx= get_localtax($tauxtva, 2, $mysoc,$object->thirdparty); $localtax2tx= get_localtax($tauxtva, 2, $mysoc,$object->thirdparty);
$remise_percent=GETPOST('remise_percent');
if (! $_POST['dp_desc']) if (! $product_desc)
{ {
$error++;
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Description")).'</div>'; $mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Description")).'</div>';
} }
else else
{ {
$type = $_POST["type"]; $type = $_POST["type"];
if (! empty($_POST['amount']))
if (! empty($_POST['amount']))
{ {
$ht = price2num($_POST['amount']); $ht = price2num($_POST['amount']);
$price_base_type = 'HT'; $price_base_type = 'HT';
//$desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0) //print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0
$result=$object->addline($_POST['dp_desc'], $ht, $tauxtva, $localtax1tx, $localtax2tx, $_POST['qty'], 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); $result=$object->addline($product_desc, $ht, $tauxtva, $localtax1tx, $localtax2tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type);
} }
else else
{ {
$ttc = price2num($_POST['amountttc']); $ttc = price2num($_POST['amountttc']);
$ht = $ttc / (1 + ($tauxtva / 100)); $ht = $ttc / (1 + ($tauxtva / 100));
$price_base_type = 'HT'; $price_base_type = 'HT';
$result=$object->addline($_POST['dp_desc'], $ht, $tauxtva,$localtax1tx, $localtax2tx, $_POST['qty'], 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); //print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0
$result=$object->addline($product_desc, $ht, $tauxtva,$localtax1tx, $localtax2tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type);
} }
} }
} }
//print "xx".$tva_tx; exit; //print "xx".$tva_tx; exit;
if ($result > 0) if (! $error && $result > 0)
{ {
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
@ -622,7 +654,8 @@ elseif ($action == 'addline')
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$result=supplier_invoice_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); $result=supplier_invoice_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) if ($result <= 0)
{ {
@ -633,15 +666,20 @@ elseif ($action == 'addline')
unset($_POST['qty']); unset($_POST['qty']);
unset($_POST['type']); unset($_POST['type']);
unset($_POST['idprodfournprice']);
unset($_POST['remise_percent']); unset($_POST['remise_percent']);
unset($_POST['dp_desc']); unset($_POST['dp_desc']);
unset($_POST['np_desc']);
unset($_POST['pu']); unset($_POST['pu']);
unset($_POST['tva_tx']); unset($_POST['tva_tx']);
unset($_POST['label']); unset($_POST['label']);
unset($localtax1_tx); unset($localtax1_tx);
unset($localtax2_tx); unset($localtax2_tx);
unset($_POST['idprodfournprice']);
unset($_POST['qty_predef']);
unset($_POST['remise_percent_predef']);
unset($_POST['fournprice_predef']);
unset($_POST['buying_price_predef']);
unset($_POST['np_desc']);
} }
else if (empty($mesg)) else if (empty($mesg))
{ {
@ -1103,6 +1141,7 @@ if ($action == 'create')
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="origin" value="'.GETPOST('origin').'">'; print '<input type="hidden" name="origin" value="'.GETPOST('origin').'">';
print '<input type="hidden" name="originid" value="'.GETPOST('originid').'">'; print '<input type="hidden" name="originid" value="'.GETPOST('originid').'">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
@ -1374,6 +1413,7 @@ else
*/ */
$head = facturefourn_prepare_head($object); $head = facturefourn_prepare_head($object);
$titre=$langs->trans('SupplierInvoice'); $titre=$langs->trans('SupplierInvoice');
dol_fiche_head($head, 'card', $titre, 0, 'bill'); dol_fiche_head($head, 'card', $titre, 0, 'bill');
dol_htmloutput_mesg($mesg); dol_htmloutput_mesg($mesg);
@ -1542,7 +1582,7 @@ else
{ {
if ($societe->localtax1_assuj=="1") $nbrows++; if ($societe->localtax1_assuj=="1") $nbrows++;
if ($societe->localtax2_assuj=="1") $nbrows++; if ($societe->localtax2_assuj=="1") $nbrows++;
} }
print '<td rowspan="'.$nbrows.'" valign="top">'; print '<td rowspan="'.$nbrows.'" valign="top">';
$sql = 'SELECT p.datep as dp, p.num_paiement, p.rowid, p.fk_bank,'; $sql = 'SELECT p.datep as dp, p.num_paiement, p.rowid, p.fk_bank,';
@ -1790,8 +1830,21 @@ else
/* /*
* Lines * Lines
*/ */
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?etat=1&id='.$object->id.(($action != 'edit_line')?'#add':'#line_'.GETPOST('lineid')).'" method="POST">
<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">
<input type="hidden" name="action" value="'.(($action != 'edit_line')?'addline':'update_line').'">
<input type="hidden" name="mode" value="">
<input type="hidden" name="id" value="'.$object->id.'">
<input type="hidden" name="facid" value="'.$object->id.'">
<input type="hidden" name="socid" value="'.$societe->id.'">
';
print '<br>'; print '<br>';
print '<table class="noborder" width="100%">'; print '<table id="tablelines" class="noborder noshadow" width="100%">';
$var=1; $var=1;
$num=count($object->lines); $num=count($object->lines);
for ($i = 0; $i < $num; $i++) for ($i = 0; $i < $num; $i++)
@ -1833,13 +1886,13 @@ else
// Edit line // Edit line
if ($object->statut == 0 && $action == 'edit_line' && $_GET['etat'] == '0' && $_GET['lineid'] == $object->lines[$i]->rowid) if ($object->statut == 0 && $action == 'edit_line' && $_GET['etat'] == '0' && $_GET['lineid'] == $object->lines[$i]->rowid)
{ {
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;etat=1&amp;lineid='.$object->lines[$i]->rowid.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update_line">';
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
// Show product and description // Show product and description
print '<td>'; print '<td>';
print '<input type="hidden" name="lineid" value="'.$object->lines[$i]->rowid.'">';
if ((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && $object->lines[$i]->fk_product) if ((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && $object->lines[$i]->fk_product)
{ {
print '<input type="hidden" name="idprod" value="'.$object->lines[$i]->fk_product.'">'; print '<input type="hidden" name="idprod" value="'.$object->lines[$i]->fk_product.'">';
@ -1888,11 +1941,10 @@ else
print '<td align="right" class="nowrap">&nbsp;</td>'; print '<td align="right" class="nowrap">&nbsp;</td>';
print '<td align="center" colspan="2"><input type="submit" class="button" value="'.$langs->trans('Save').'">'; print '<td align="center" colspan="2"><input type="submit" class="button" name="save" value="'.$langs->trans('Save').'">';
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'"></td>'; print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'"></td>';
print '</tr>'; print '</tr>';
print '</form>';
} }
else // Affichage simple de la ligne else // Affichage simple de la ligne
{ {
@ -1972,7 +2024,7 @@ else
/* /*
* Form to add new line * Form to add new line
*/ */
if ($object->statut == 0 && $action != 'edit_line') if ($object->statut == 0 && $action != 'edit_line')
{ {
@ -1992,11 +2044,6 @@ else
print '</tr>'; print '</tr>';
// Add free products/services form // Add free products/services form
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addline" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="facid" value="'.$object->id.'">';
print '<input type="hidden" name="socid" value="'.$societe->id.'">';
$var=true; $var=true;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td>'; print '<td>';
@ -2022,23 +2069,30 @@ else
print $form->load_tva('tauxtva',(GETPOST('tauxtva')?GETPOST('tauxtva'):-1),$societe,$mysoc); print $form->load_tva('tauxtva',(GETPOST('tauxtva')?GETPOST('tauxtva'):-1),$societe,$mysoc);
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="right">';
print '<input size="4" name="amount" type="text">'; print '<input size="4" name="amount" type="text" value="'.GETPOST("amount").'">';
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="right">';
print '<input size="4" name="amountttc" type="text">'; print '<input size="4" name="amountttc" type="text" value="'.GETPOST("amountttc").'">';
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="right">';
print '<input size="1" name="qty" type="text" value="1">'; print '<input size="1" name="qty" type="text" value="1" value="'.GETPOST("qty").'">';
print '</td>'; print '</td>';
print '<td align="right" class="nowrap"><input size="1" name="remise_percent" type="text" value="'.(GETPOST('remise_percent')?GETPOST('remise_percent'):'0').'"><span class="hideonsmartphone">%</span></td>'; print '<td align="right" class="nowrap"><input size="1" name="remise_percent" type="text" value="'.(GETPOST('remise_percent')?GETPOST('remise_percent'):'0').'"><span class="hideonsmartphone">%</span></td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td align="center" valign="middle" colspan="2"><input type="submit" class="button" value="'.$langs->trans('Add').'"></td></tr>'; print '<td align="center" valign="middle" colspan="2"><input type="submit" class="button" value="'.$langs->trans('Add').'" name="addline_libre"></td></tr>';
print '</form>';
// Ajout de produits/services predefinis // Ajout de produits/services predefinis
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
{ {
print '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(\'#idprodfournprice\').change(function() {
if (jQuery(\'#idprodfournprice\').val() > 0) jQuery(\'#np_desc\').focus();
});
});
</script>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="4">'; print '<td colspan="4">';
print $langs->trans("AddNewLine").' - '; print $langs->trans("AddNewLine").' - ';
@ -2057,30 +2111,16 @@ else
print '<td colspan="4">&nbsp;</td>'; print '<td colspan="4">&nbsp;</td>';
print '</tr>'; print '</tr>';
// TODO Use the predefinedproductline_create.tpl.php file
print '<form name="addline_predef" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addline" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="socid" value="'. $object->socid .'">';
print '<input type="hidden" name="facid" value="'.$object->id.'">';
print '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(\'#idprodfournprice\').change(function() {
if (jQuery(\'#idprodfournprice\').val() > 0) jQuery(\'#np_desc\').focus();
});
});
</script>';
$var=! $var; $var=! $var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td colspan="4">'; print '<td colspan="4">';
$ajaxoptions=array( $ajaxoptions=array(
'update' => array('pqty' => 'qty', 'p_remise_percent' => 'discount'), 'update' => array('qty_predef' => 'qty_predef', 'remise_percent_predef' => 'remise_percent_predef'),
'disabled' => 'addPredefinedProductButton', 'disabled' => 'addPredefinedProductButton',
'error' => $langs->trans("NoPriceDefinedForThisSupplier") 'error' => $langs->trans("NoPriceDefinedForThisSupplier")
); );
$form->select_produits_fournisseurs($object->socid, '', 'idprodfournprice', '', '', $ajaxoptions); $form->select_produits_fournisseurs($object->socid, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions);
if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) print '<br>'; if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) print '<br>';
@ -2096,19 +2136,21 @@ else
$doleditor->Create(); $doleditor->Create();
print '</td>'; print '</td>';
print '<td align="right"><input type="text" id="pqty" name="qty" value="1" size="1"></td>'; print '<td align="right"><input type="text" id="qty_predef" name="qty_predef" value="1" size="1"></td>';
print '<td align="right" class="nowrap"><input size="1" id="p_remise_percent" name="remise_percent" type="text" value="'.(GETPOST('remise_percent')?GETPOST('remise_percent'):'0').'"><span class="hideonsmartphone">%</span></td>'; print '<td align="right" class="nowrap"><input size="1" id="remise_percent_predef" name="remise_percent_predef" type="text" value="'.(GETPOST('remise_percent_predef')?GETPOST('remise_percent_predef'):'0').'"><span class="hideonsmartphone">%</span></td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td align="center" valign="middle" colspan="2"><input type="submit" id="addPredefinedProductButton" class="button" value="'.$langs->trans("Add").'"></td>'; print '<td align="center" valign="middle" colspan="2"><input type="submit" id="addPredefinedProductButton" class="button" value="'.$langs->trans("Add").'" name="addline_predefined"></td>';
print '</tr>'; print '</tr>';
print '</form>';
} }
} }
print '</table>'; print '</table>';
print '</div>'; print '</form>';
dol_fiche_end();
if ($action != 'presend') if ($action != 'presend')
{ {

View File

@ -59,6 +59,8 @@ if ($user->societe_id > 0)
} }
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('paymentsupplier'));
/* /*
@ -265,7 +267,7 @@ if ($action == 'create' || $action == 'add_paiement')
$sql.= ' AND f.fk_soc = '.$object->socid; $sql.= ' AND f.fk_soc = '.$object->socid;
$sql.= ' AND f.paye = 0'; $sql.= ' AND f.paye = 0';
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => non validee, Statut=2 => annulee $sql.= ' AND f.fk_statut = 1'; // Statut=0 => non validee, Statut=2 => annulee
$sql.= ' GROUP BY f.rowid, f.ref_supplier, f.total_ht, f.total_ttc, f.datef'; $sql.= ' GROUP BY f.rowid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc, f.datef';
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {

View File

@ -467,7 +467,7 @@ if ($object->fetch($id))
{ {
print '<br>'; print '<br>';
// List of contacts // List of contacts
show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?id='.$object->id); show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
} }
// Addresses list // Addresses list

View File

@ -33,7 +33,7 @@
if(jQuery) (function($){ if(jQuery) (function($){
$.extend($.fn, { $.extend($.fn, {
fileTree: function(o, h) { fileTree: function(o, h, hd) { // CHANGE DOL_LDR add hd param
// Defaults // Defaults
if( !o ) var o = {}; if( !o ) var o = {};
if( o.root == undefined ) o.root = '/'; if( o.root == undefined ) o.root = '/';
@ -77,6 +77,8 @@ if(jQuery) (function($){
$(this).parent().find('UL').slideUp({ duration: o.collapseSpeed, easing: o.collapseEasing }); $(this).parent().find('UL').slideUp({ duration: o.collapseSpeed, easing: o.collapseEasing });
$(this).parent().removeClass('expanded').addClass('collapsed'); $(this).parent().removeClass('expanded').addClass('collapsed');
} }
// CHANGE DOL_LDR use hd function provided in param
if (hd != null) hd($(this));
} else { } else {
h($(this).attr('rel')); h($(this).attr('rel'));
} }

View File

@ -128,33 +128,6 @@ class Odf
return $this; return $this;
} }
/**
* Assing a template variable
*
* @param string $key name of the variable within the template
* @param string $value replacement value
* @param bool $encode if true, special XML characters are encoded
* @throws OdfException
* @return odf
*/
public function setVarsHeadFooter($key, $value, $encode = true, $charset = 'ISO-8859')
{
$tag = $this->config['DELIMITER_LEFT'] . $key . $this->config['DELIMITER_RIGHT'];
// TODO Warning string may be:
// <text:span text:style-name="T13">{</text:span><text:span text:style-name="T12">aaa</text:span><text:span text:style-name="T13">}</text:span>
// instead of {aaa} so we should enhance this function.
//print $key.'-'.$value.'-'.strpos($this->contentXml, $this->config['DELIMITER_LEFT'] . $key . $this->config['DELIMITER_RIGHT']).'<br>';
if (strpos($this->stylesXml, $tag) === false && strpos($this->stylesXml , $tag) === false) {
//if (strpos($this->contentXml, '">'. $key . '</text;span>') === false) {
throw new OdfException("var $key not found in the document");
//}
}
$value = $encode ? htmlspecialchars($value) : $value;
$value = ($charset == 'ISO-8859') ? utf8_encode($value) : $value;
$this->vars[$tag] = str_replace("\n", "<text:line-break/>", $value);
return $this;
}
/** /**
* Evaluating php codes inside the ODT and output the buffer (print, echo) inplace of the code * Evaluating php codes inside the ODT and output the buffer (print, echo) inplace of the code
* *

View File

@ -88,13 +88,13 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (80
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (802,80, '0','0','VAT Rate 0',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (802,80, '0','0','VAT Rate 0',1);
-- FRANCE (id country=1) -- FRANCE (id country=1)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 11, 1,'19.6','0','VAT standard rate (France hors DOM-TOM)',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 11, 1, '20','0','VAT standard rate (France hors DOM-TOM)',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 12, 1, '8.5','0','VAT standard rate (DOM sauf Guyane et Saint-Martin)',0); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 12, 1, '8.5','0','VAT standard rate (DOM sauf Guyane et Saint-Martin)',0);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 13, 1, '8.5','1','VAT standard rate (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par acheteur',0); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 13, 1, '8.5','1','VAT standard rate (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par acheteur',0);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 14, 1, '5.5','0','VAT reduced rate (France hors DOM-TOM)',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 14, 1, '5.5','0','VAT reduced rate (France hors DOM-TOM)',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 15, 1, '0','0','VAT Rate 0 ou non applicable',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 15, 1, '0','0','VAT Rate 0 ou non applicable',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 16, 1, '2.1','0','VAT super-reduced rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 16, 1, '2.1','0','VAT super-reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 17, 1, '7','0','VAT reduced rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 17, 1, '10','0','VAT reduced rate',1);
-- GERMANY (id country=5) -- GERMANY (id country=5)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 51, 5, '19.0','0','allgemeine Ust.',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 51, 5, '19.0','0','allgemeine Ust.',1);

View File

@ -71,12 +71,13 @@ update llx_bank set dateo = datec where datev = '1970-01-01 00:00:00' and rappro
alter table llx_c_chargesociales add column actioncompta varchar(12) NOT NULL; alter table llx_c_chargesociales add column actioncompta varchar(12) NOT NULL;
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values ( 1, 'Allocations familiales', 1,1,'TAXFAM'); insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values ( 1, 'Allocations familiales', 1,1,'TAXFAM');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values ( 2, 'GSG Deductible', 1,1,'TAXCSGD'); insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values ( 2, 'GSG Déductible', 1,1,'TAXCSGD');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values ( 3, 'GSG/CRDS NON Deductible',0,1,'TAXCSGND'); insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values ( 3, 'GSG/CRDS NON Déductible',0,1,'TAXCSGND');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (10, 'Taxe apprenttissage', 0,1,'TAXAPP'); insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (10, 'Taxe apprentissage', 0,1,'TAXAPP');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (11, 'Taxe professionnelle', 0,1,'TAXPRO'); insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (11, 'Taxe professionnelle', 0,1,'TAXPRO');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (12, 'Contribution à la formation professionnelle', 1,1,'TAXOPCA');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (20, 'Impots locaux/fonciers', 0,1,'TAXFON'); insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (20, 'Impots locaux/fonciers', 0,1,'TAXFON');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (30, 'Assurance Sante (SECU-URSSAF)', 0,1,'TAXSECU'); insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (30, 'Assurance Santé (SECU-URSSAF)', 0,1,'TAXSECU');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (40, 'Mutuelle', 0,1,'TAXMUT'); insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (40, 'Mutuelle', 0,1,'TAXMUT');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (50, 'Assurance vieillesse (CNAV)', 0,1,'TAXRET'); insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (50, 'Assurance vieillesse (CNAV)', 0,1,'TAXRET');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (60, 'Assurance Chomage (ASSEDIC)', 0,1,'TAXCHOM'); insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (60, 'Assurance Chomage (ASSEDIC)', 0,1,'TAXCHOM');

View File

@ -58,7 +58,7 @@ ALTER TABLE llx_facture_fourn DROP INDEX uk_facture_fourn;
ALTER TABLE llx_facture_fourn DROP INDEX uk_facture_fourn_ref; ALTER TABLE llx_facture_fourn DROP INDEX uk_facture_fourn_ref;
UPDATE llx_facture_fourn set ref = NULL where ref = ''; UPDATE llx_facture_fourn set ref = NULL where ref = '';
ALTER TABLE llx_facture_fourn ADD UNIQUE INDEX uk_facture_fourn_ref (ref, entity); ALTER TABLE llx_facture_fourn ADD UNIQUE INDEX uk_facture_fourn_ref (ref, entity);
ALTER TABLE llx_facture_fourn CHANGE COLUMN facnumber ref_supplier varchar(30); ALTER TABLE llx_facture_fourn CHANGE COLUMN facnumber ref_supplier varchar(50);
ALTER TABLE llx_facture_fourn ADD UNIQUE INDEX uk_facture_fourn_ref_supplier (ref_supplier, fk_soc, entity); ALTER TABLE llx_facture_fourn ADD UNIQUE INDEX uk_facture_fourn_ref_supplier (ref_supplier, fk_soc, entity);
@ -161,22 +161,22 @@ CREATE TABLE llx_c_revenuestamp
insert into llx_c_revenuestamp(rowid,fk_pays,taux,note,active) values (101, 10, '0.4', 'Timbre fiscal', 1); insert into llx_c_revenuestamp(rowid,fk_pays,taux,note,active) values (101, 10, '0.4', 'Timbre fiscal', 1);
ALTER TABLE llx_c_tva MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_c_tva MODIFY COLUMN localtax1_type varchar(10) DEFAULT NULL;
ALTER TABLE llx_c_tva MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_c_tva MODIFY COLUMN localtax2_type varchar(10) DEFAULT NULL;
ALTER TABLE llx_commande_fournisseurdet MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_commande_fournisseurdet MODIFY COLUMN localtax1_type varchar(10) DEFAULT NULL;
ALTER TABLE llx_commande_fournisseurdet MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_commande_fournisseurdet MODIFY COLUMN localtax2_type varchar(10) DEFAULT NULL;
ALTER TABLE llx_commandedet MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_commandedet MODIFY COLUMN localtax1_type varchar(10) DEFAULT NULL;
ALTER TABLE llx_commandedet MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_commandedet MODIFY COLUMN localtax2_type varchar(10) DEFAULT NULL;
ALTER TABLE llx_contratdet MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_contratdet MODIFY COLUMN localtax1_type varchar(10) DEFAULT NULL;
ALTER TABLE llx_contratdet MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_contratdet MODIFY COLUMN localtax2_type varchar(10) DEFAULT NULL;
ALTER TABLE llx_facture_fourn_det MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_facture_fourn_det MODIFY COLUMN localtax1_type varchar(10) DEFAULT NULL;
ALTER TABLE llx_facture_fourn_det MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_facture_fourn_det MODIFY COLUMN localtax2_type varchar(10) DEFAULT NULL;
ALTER TABLE llx_facturedet_rec MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_facturedet_rec MODIFY COLUMN localtax1_type varchar(10) DEFAULT NULL;
ALTER TABLE llx_facturedet_rec MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_facturedet_rec MODIFY COLUMN localtax2_type varchar(10) DEFAULT NULL;
ALTER TABLE llx_facturedet MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_facturedet MODIFY COLUMN localtax1_type varchar(10) DEFAULT NULL;
ALTER TABLE llx_facturedet MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_facturedet MODIFY COLUMN localtax2_type varchar(10) DEFAULT NULL;
ALTER TABLE llx_propaldet MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_propaldet MODIFY COLUMN localtax1_type varchar(10) DEFAULT NULL;
ALTER TABLE llx_propaldet MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0'; ALTER TABLE llx_propaldet MODIFY COLUMN localtax2_type varchar(10) DEFAULT NULL;
-- No more use type 7, use revenuse stamp instead -- No more use type 7, use revenuse stamp instead
UPDATE llx_c_tva set localtax1=0, localtax1_type='0' where localtax1_type = '7'; UPDATE llx_c_tva set localtax1=0, localtax1_type='0' where localtax1_type = '7';
UPDATE llx_c_tva set localtax2=0, localtax2_type='0' where localtax2_type = '7'; UPDATE llx_c_tva set localtax2=0, localtax2_type='0' where localtax2_type = '7';

View File

@ -20,6 +20,7 @@
DELETE FROM llx_menu where module='holiday'; DELETE FROM llx_menu where module='holiday';
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (143, 14,'5','0','9.975','1','TPS and TVQ rate',1);
-- Fix bad migration of 3.4 that make this text instead of varchar(50) -- Fix bad migration of 3.4 that make this text instead of varchar(50)
alter table llx_don MODIFY COLUMN town varchar(50); alter table llx_don MODIFY COLUMN town varchar(50);
@ -83,7 +84,9 @@ ALTER TABLE llx_propaldet_extrafields ADD INDEX idx_propaldet_extrafields (fk_ob
DROP table llx_adherent_options; DROP table llx_adherent_options;
DROP table llx_adherent_options_label; DROP table llx_adherent_options_label;
ALTER TABLE llx_user ADD accountancy_code VARCHAR( 24 ) NULL; ALTER TABLE llx_user ADD accountancy_code VARCHAR(24) NULL;
ALTER TABLE llx_c_chargesociales ADD accountancy_code varchar(24) DEFAULT NULL;
DELETE FROM llx_boxes where box_id IN (SELECT rowid FROM llx_boxes_def where file='box_activity.php' AND note IS NULL); DELETE FROM llx_boxes where box_id IN (SELECT rowid FROM llx_boxes_def where file='box_activity.php' AND note IS NULL);
DELETE FROM llx_boxes_def where file='box_activity.php' AND note IS NULL; DELETE FROM llx_boxes_def where file='box_activity.php' AND note IS NULL;
@ -357,3 +360,7 @@ ALTER TABLE llx_user ADD skype VARCHAR(255) AFTER job;
ALTER TABLE llx_socpeople ADD skype VARCHAR(255) AFTER jabberid; ALTER TABLE llx_socpeople ADD skype VARCHAR(255) AFTER jabberid;
ALTER TABLE llx_societe ADD skype VARCHAR(255) AFTER email; ALTER TABLE llx_societe ADD skype VARCHAR(255) AFTER email;
ALTER TABLE llx_adherent ADD skype VARCHAR(255) AFTER email; ALTER TABLE llx_adherent ADD skype VARCHAR(255) AFTER email;
-- multi-rib
ALTER TABLE llx_societe_rib ADD default_rib smallint NOT NULL DEFAULT 0 AFTER owner_address;
UPDATE llx_societe_rib SET default_rib = 1;

View File

@ -24,7 +24,7 @@ create table llx_c_chargesociales
deductible smallint DEFAULT 0 NOT NULL, deductible smallint DEFAULT 0 NOT NULL,
active tinyint DEFAULT 1 NOT NULL, active tinyint DEFAULT 1 NOT NULL,
code varchar(12) NOT NULL, code varchar(12) NOT NULL,
accountancy_code varchar(15) DEFAULT NULL, accountancy_code varchar(24) DEFAULT NULL,
fk_pays integer DEFAULT 1 NOT NULL, fk_pays integer DEFAULT 1 NOT NULL,
module varchar(32) NULL module varchar(32) NULL
)ENGINE=innodb; )ENGINE=innodb;

View File

@ -2,6 +2,7 @@
-- Copyright (C) 2000-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> -- Copyright (C) 2000-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> -- Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
-- Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> -- Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
-- Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.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
@ -35,6 +36,7 @@ create table llx_societe_rib
domiciliation varchar(255), domiciliation varchar(255),
proprio varchar(60), proprio varchar(60),
owner_address varchar(255), owner_address varchar(255),
default_rib smallint NOT NULL DEFAULT 0,
import_key varchar(14) -- import key import_key varchar(14) -- import key

View File

@ -1,5 +1,5 @@
# Dolibarr language file - Source file is en_US - agenda # Dolibarr language file - Source file is en_US - agenda
# IdAgenda=ID event IdAgenda=Αναγνωριστικού συμβάντος
Actions=Ενέργειες Actions=Ενέργειες
ActionsArea=Περιοχή Ενεργειών (γεγονότα και εργασίες) ActionsArea=Περιοχή Ενεργειών (γεγονότα και εργασίες)
Agenda= Ημερολόγιο Agenda= Ημερολόγιο
@ -68,7 +68,7 @@ AgendaUrlOptions5=<b>logind=%s</b> για να περιορίσετε τα απ
AgendaShowBirthdayEvents=Εμφάνιση γενεθλίων των προσώπων επικοινωνίας AgendaShowBirthdayEvents=Εμφάνιση γενεθλίων των προσώπων επικοινωνίας
AgendaHideBirthdayEvents=Απόκρυψη γενεθλίων των προσώπων επικοινωνίας AgendaHideBirthdayEvents=Απόκρυψη γενεθλίων των προσώπων επικοινωνίας
Busy=Απασχολ. Busy=Απασχολ.
# ExportDataset_event1=List of agenda events ExportDataset_event1=Κατάλογος των εκδηλώσεων
# External Sites ical # External Sites ical
ExportCal=Εξαγωγή ημερολογίου ExportCal=Εξαγωγή ημερολογίου

View File

@ -74,7 +74,7 @@ NoRecordedProducts=Δεν υπάρχουν καταχωρημένα προϊόν
NoRecordedProspects=Δεν υπάρχουν προσφορές NoRecordedProspects=Δεν υπάρχουν προσφορές
NoContractedProducts=Δεν υπάρχουν καταχωρημένα συμβόλαια με προϊόντα/υπηρεσίες NoContractedProducts=Δεν υπάρχουν καταχωρημένα συμβόλαια με προϊόντα/υπηρεσίες
NoRecordedContracts=Δεν υπάρχουν καταχωρημένα συμβόλαια NoRecordedContracts=Δεν υπάρχουν καταχωρημένα συμβόλαια
# NoRecordedInterventions=No recorded interventions NoRecordedInterventions=Δεν καταγράφονται παρεμβάσεις
BoxLatestSupplierOrders=Τελευταίες παραγγελίες προμηθευτών BoxLatestSupplierOrders=Τελευταίες παραγγελίες προμηθευτών
BoxTitleLatestSupplierOrders=Οι %s τελευταίες παραγγελίες προμηθευτών BoxTitleLatestSupplierOrders=Οι %s τελευταίες παραγγελίες προμηθευτών
NoSupplierOrder=Δεν υπάρχουν καταχωρημένες παραγγελίες προμηθευτών NoSupplierOrder=Δεν υπάρχουν καταχωρημένες παραγγελίες προμηθευτών
@ -84,8 +84,8 @@ BoxCustomersOrdersPerMonth=Παραγγελίες πελατών ανά μήνα
BoxSuppliersOrdersPerMonth=Παραγγελίες προμηθευτών ανά μήνα BoxSuppliersOrdersPerMonth=Παραγγελίες προμηθευτών ανά μήνα
BoxProposalsPerMonth=Προσφορές ανά μήνα BoxProposalsPerMonth=Προσφορές ανά μήνα
NoTooLowStockProducts=Κανένα προϊόν κάτω από το χαμηλό όριο του αποθέματος NoTooLowStockProducts=Κανένα προϊόν κάτω από το χαμηλό όριο του αποθέματος
# BoxProductDistribution=Products/Services distribution BoxProductDistribution=Κατανομή Προϊόντα/Υπηρεσίες
# BoxProductDistributionFor=Distribution of %s for %s BoxProductDistributionFor=Κατανομή των %s για %s
ForCustomersInvoices=Τιμολόγια Πελάτη ForCustomersInvoices=Τιμολόγια Πελάτη
# ForCustomersOrders=Customers orders ForCustomersOrders=Παραγγελίες πελατών
ForProposals=Προτάσεις ForProposals=Προτάσεις

View File

@ -66,8 +66,8 @@ Country=Χώρα
CountryCode=Country code CountryCode=Country code
CountryId=Κωδικός Χώρα CountryId=Κωδικός Χώρα
Phone=Τηλέφωνο Phone=Τηλέφωνο
# Skype=Skype Skype=Skype
# Call=Call Call=Κλήση
PhonePro=Επαγγ. τηλέφωνο PhonePro=Επαγγ. τηλέφωνο
PhonePerso=Προσωπ. τηλέφωνο PhonePerso=Προσωπ. τηλέφωνο
PhoneMobile=Κιν. τηλέφωνο PhoneMobile=Κιν. τηλέφωνο
@ -398,7 +398,7 @@ InActivity=Ανοιχτό
ActivityCeased=Κλειστό ActivityCeased=Κλειστό
ActivityStateFilter=Το καθεστώς της δραστηριότητας ActivityStateFilter=Το καθεστώς της δραστηριότητας
ProductsIntoElements=Κατάλογος των προϊόντων σε ProductsIntoElements=Κατάλογος των προϊόντων σε
# OutstandingBill=Max. for outstanding bill OutstandingBill=Μέγιστο. για εκκρεμείς λογαριασμό
# Monkey # Monkey
MonkeyNumRefModelDesc=Return numero with format %syymm-nnnn for customer code and %syymm-nnnn for supplier code where yy is year, mm is month and nnnn is a sequence with no break and no return to 0. MonkeyNumRefModelDesc=Return numero with format %syymm-nnnn for customer code and %syymm-nnnn for supplier code where yy is year, mm is month and nnnn is a sequence with no break and no return to 0.
# Leopard # Leopard

View File

@ -124,8 +124,8 @@ ErrorToConnectToMysqlCheckInstance=Connect to database fails. Check Mysql server
ErrorFailedToAddContact=Failed to add contact ErrorFailedToAddContact=Failed to add contact
ErrorDateMustBeBeforeToday=The date can not be greater than today ErrorDateMustBeBeforeToday=The date can not be greater than today
ErrorPaymentModeDefinedToWithoutSetup=A payment mode was set to type %s but setup of module Invoice was not completed to define information to show for this payment mode. ErrorPaymentModeDefinedToWithoutSetup=A payment mode was set to type %s but setup of module Invoice was not completed to define information to show for this payment mode.
# ErrorPHPNeedModule=Error, your PHP must have module <b>%s</b> installed to use this feature. ErrorPHPNeedModule=Σφάλμα, η PHP σας πρέπει να έχει το module <b>%s</ b> εγκατεστημένο για να χρησιμοποιήσετε αυτήν τη δυνατότητα.
# ErrorOpenIDSetupNotComplete=You setup Dolibarr config file to allow OpenID authentication, but URL of OpenID service is not defined into constant %s ErrorOpenIDSetupNotComplete=Μπορείτε να ρυθμίσετε το Dolibarr αρχείο config να επιτρέψει OpenID ταυτότητα, αλλά το URL OpenID υπηρεσίας δεν ορίζεται σε συνεχή %s
# ErrorWarehouseMustDiffers=Source and target warehouses must differs # ErrorWarehouseMustDiffers=Source and target warehouses must differs
# Warnings # Warnings

View File

@ -87,7 +87,7 @@ FirstDayOfHoliday=Πρώτη μέρα άδειας
LastDayOfHoliday=Τελευταία μέρα άδειας LastDayOfHoliday=Τελευταία μέρα άδειας
HolidaysMonthlyUpdate=Μηνιαία ενημέρωση HolidaysMonthlyUpdate=Μηνιαία ενημέρωση
ManualUpdate=Χειροκίνητη ενημέρωση ManualUpdate=Χειροκίνητη ενημέρωση
# HolidaysCancelation=Holidays cancelation HolidaysCancelation=Ακύρωση αδειών
## Configuration du Module ## ## Configuration du Module ##
ConfCP=Διαμόρφωση τις ενότητας αδειών ConfCP=Διαμόρφωση τις ενότητας αδειών

View File

@ -155,7 +155,7 @@ Valid=Έγκυρο
Approve=Έγκριση Approve=Έγκριση
ReOpen=Εκ νέου άνοιγμα ReOpen=Εκ νέου άνοιγμα
Upload=Αποστολή Αρχείου Upload=Αποστολή Αρχείου
# ToLink=Link ToLink=Σύνδεσμος
Select=Επιλογή Select=Επιλογή
Choose=Επιλογή Choose=Επιλογή
ChooseLangage=Παρακαλούμε επιλέξτε την γλώσσα σας ChooseLangage=Παρακαλούμε επιλέξτε την γλώσσα σας
@ -659,8 +659,8 @@ from=από
toward=προς toward=προς
Access=Πρόσβαση Access=Πρόσβαση
HelpCopyToClipboard=Χρησιμοποιήστε το Ctrl + C για να αντιγράψετε στο πρόχειρο HelpCopyToClipboard=Χρησιμοποιήστε το Ctrl + C για να αντιγράψετε στο πρόχειρο
# SaveUploadedFileWithMask=Save file on server with name "<strong>%s</strong>" (otherwise "%s") SaveUploadedFileWithMask=Αποθηκεύστε το αρχείο στον server με το όνομα "<strong>%s</strong>" (αλλιώς "%s")
# OriginFileName=Nom d'origine OriginFileName=Αρχική Ονομασία
# Week day # Week day
Monday=Δευτέρα Monday=Δευτέρα

View File

@ -8,7 +8,7 @@ Members=Μέλη
MemberAccount=Είσοδος μέλους MemberAccount=Είσοδος μέλους
ShowMember=Εμφάνιση καρτέλα μέλους ShowMember=Εμφάνιση καρτέλα μέλους
UserNotLinkedToMember=Ο χρήστης δεν συνδέετε με κάποιο μέλος UserNotLinkedToMember=Ο χρήστης δεν συνδέετε με κάποιο μέλος
# ThirdpartyNotLinkedToMember=Third-party not linked to a member ThirdpartyNotLinkedToMember=Πελ./Προμ. δεν συνδέεται με ένα μέλος
MembersTickets=Tickets Μελών MembersTickets=Tickets Μελών
FundationMembers=Μέλη οργανισμού FundationMembers=Μέλη οργανισμού
Attributs=Ιδιότητες Attributs=Ιδιότητες

View File

@ -147,7 +147,7 @@ AddDeliveryCostLine=Add a delivery cost line indicating the weight of the order
# Documents models # Documents models
PDFEinsteinDescription=Ολοκληρωμένο πρότυπο παραγγελίας (λογότυπο...) PDFEinsteinDescription=Ολοκληρωμένο πρότυπο παραγγελίας (λογότυπο...)
PDFEdisonDescription=Απλό πρότυπο παραγγελίας PDFEdisonDescription=Απλό πρότυπο παραγγελίας
# PDFProformaDescription=A complete proforma invoice (logo…) PDFProformaDescription=Ένα πλήρες προτιμολόγιο (λογότυπο ...)
# Orders modes # Orders modes
OrderByMail=Ταχυδρομείο OrderByMail=Ταχυδρομείο
OrderByFax=Φαξ OrderByFax=Φαξ

View File

@ -173,12 +173,12 @@ StartUpload=Έναρξη μεταφόρτωσης
CancelUpload=Ακύρωση ανεβάσετε CancelUpload=Ακύρωση ανεβάσετε
FileIsTooBig=Τα αρχεία είναι πολύ μεγάλο FileIsTooBig=Τα αρχεία είναι πολύ μεγάλο
PleaseBePatient=Please be patient... PleaseBePatient=Please be patient...
# RequestToResetPasswordReceived=A request to change your Dolibarr password has been received RequestToResetPasswordReceived=Η αίτηση για την αλλαγή του κωδικού σας στο Dolibarr έχει παραληφθεί
# NewKeyIs=This is your new keys to login NewKeyIs=Αυτό είναι το νέο σας κλειδί για να συνδεθείτε
# NewKeyWillBe=Your new key to login to software will be NewKeyWillBe=Το νέο σας κλειδί για να συνδεθείτε με το λογισμικό είναι
# ClickHereToGoTo=Click here to go to %s ClickHereToGoTo=Κάντε κλικ εδώ για να μεταβείτε στο %s
# YouMustClickToChange=You must however first click on the following link to validate this password change YouMustClickToChange=Θα πρέπει πρώτα να κάνετε κλικ στον παρακάτω σύνδεσμο για να επικυρώσει την αλλαγή του κωδικού πρόσβασης
# ForgetIfNothing=If you didn't request this change, just forget this email. Your credentials are kept safe. ForgetIfNothing=Αν δεν ζητήσατε αυτή την αλλαγή, απλά ξεχάστε αυτό το email. Τα διαπιστευτήριά σας παραμένουν ασφαλή.
##### Calendar common ##### ##### Calendar common #####
AddCalendarEntry=Προσθήκη εγγραφής στο ημερολόγιο %s AddCalendarEntry=Προσθήκη εγγραφής στο ημερολόγιο %s

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