Merge remote-tracking branch 'origin/3.6' into 3.6

This commit is contained in:
jean 2015-01-20 17:31:17 +01:00
commit b809f0aeb8
224 changed files with 6904 additions and 6470 deletions

View File

@ -52,6 +52,9 @@ http://www.fsf.org/licensing/licenses/index_html
Copyright Copyright
--------- ---------
Copyright (C) 2015
- Marcos García <marcosgdf@gmail.com>
Copyright (C) 2014 Copyright (C) 2014
- Laurent Destailleur <eldy@users.sourceforge.net> - Laurent Destailleur <eldy@users.sourceforge.net>
- Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> - Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>

View File

@ -2,10 +2,44 @@
English Dolibarr ChangeLog English Dolibarr ChangeLog
-------------------------------------------------------------- --------------------------------------------------------------
***** ChangeLog for 3.6.3 compared to 3.6.2 *****
- Fix: ref_ext was not saved when recording a customer order from web service
- Fix: amarok is a bugged theme making dolidroid failed. We swith to eldy automatically with dolidroid.
- Fix: [ bug #1788 ] Duplicated doActions hook in product/fournisseurs.php
- Fix: withdrawal create error if in the same month are deleted previus withdrawals.
- Fix: [ bug #1801 ] FAC_FORCE_DATE_VALIDATION constant alters supplier invoice date given to numeration modules
- Fix: [ bug #1802 ] SQL error when updating a task with PostgreSQL database
- Fix: [ bug #1785 ] Start date is lost in Project > Linked objects
- Fix: [ bug #1804 ] SQL error when sending email without addresee
- Fix: [ bug #1803 ] AJAX company contact input is not aligned
- Fix: [ bug #1787 ] Incorrect behaviour of doActions hook
- Fix: [ bug #1796 ] Unable to use numeration modules from an external module
- Fix: [ bug #1783 ] SQL error when enabling 3rd party module with PostgreSQL and MySQL strict mode ON
- Fix: [ bug #1717 ] Sorting unpaid invoices by amount received brings due amount
- Fix: [ bug #1784 ] MOTD doesn't show up in Amarok theme
***** ChangeLog for 3.6.2 compared to 3.6.1 *****
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
- Fix: bug 1588 : relative discount.
- Fix: label of input method not tranlated.
- Fix: box of customer and propsects were not correctly disabled.
- Fix: [ bug #1618 ] PHP Error thrown when saving a barcode
- Fix: Civility & birthdate wasn't save into adherent module.
- Fix: webservice Thirdparty parameter lastname for invidual creation is now lastname and not ref
- Fix: Chars - is no more allowed into value for code for extra fields.
- Fix: [ bug #1622 ] Requesting holiday than spans across two years cause high CPU usage by Apache
- Fix: [ bug #1595 ] Selected boolean extrafield in intervention creation page, does not save state
- Fix: Show sender Country on PDF docs when sender Country <> receiver Country
- Fix: [ bug #1624 ] Use lowest buying price for margin when selling with POS
- Fix: [ bug #1749 ] Undefined $mailchimp
- Fix: [ bug #1649 ] Cancel button of several thirdparty actions, does the same thing as modify
- Fix: [ bug #1736 ] Failing supplier Elephant numeration module with some masks
- Fix: [ bug #1731 ] Can't use quick navigation on project tasks secondary tabs
***** ChangeLog for 3.6.1 compared to 3.6.* ***** ***** ChangeLog for 3.6.1 compared to 3.6.* *****
For users: For users:
- Fix: Can upload files on services. - Fix: Can upload files on services.
- Fix: sql errors on updat fichinter. - Fix: sql errors on update fichinter.
- Fix: debian script syntax error. - Fix: debian script syntax error.
- Fix: error "menu param is not inside list" into pos module. - Fix: error "menu param is not inside list" into pos module.
- Fix: Salary payments are not reflected on the reporting sheets. - Fix: Salary payments are not reflected on the reporting sheets.
@ -20,7 +54,13 @@ For users:
- Fix: Extrafield feature select from table should try to translate multiple column when not needed - Fix: Extrafield feature select from table should try to translate multiple column when not needed
- Fix: cents for indian ruppes are calle paisa and paise. - Fix: cents for indian ruppes are calle paisa and paise.
- Fix: Invoices payments may be older than invoices. - Fix: Invoices payments may be older than invoices.
- Fix: Withdrawal total amount is double
- Fix: [ bug #1593 ] Spanish Localtax IRPF not being calculated since 3.6.0 in supplier invoices when adding a line - Fix: [ bug #1593 ] Spanish Localtax IRPF not being calculated since 3.6.0 in supplier invoices when adding a line
- Fix: Web service categorie WDSL declaration is correct
- Fix: ErrorBadValueForParamNotAString was displayed in virtual product if no base price defined
- Fix: Category creation failed and no message output
- Fix: Lanf for Payment Type
- Fix: PHPCheckstyle 1.5.5
***** ChangeLog for 3.6 compared to 3.5.* ***** ***** ChangeLog for 3.6 compared to 3.5.* *****
For users: For users:
@ -130,6 +170,25 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f
- Remove add_photo_web() that is ot used anymore by core code. - Remove add_photo_web() that is ot used anymore by core code.
***** ChangeLog for 3.5.7 compared to 3.5.6 *****
Fix: Paypal link were broken dur to SSL v3 closed.
Fix: [ bug #1769 ] Error when installing to a PostgreSQL DB that contains numbers
Fix: [ bug #1752 ] Date filter of margins module, filters since 12H instead of 00H
Fix: [ bug #1757 ] Sorting breaks product/service statistics
Fix: [ bug #1797 ] Tulip supplier invoice module takes creation date instead of invoice date
Fix: [ bug #1792 ] Users are not allowed to see margins module index page when no product view permission is enabled
***** ChangeLog for 3.5.6 compared to 3.5.5 *****
Fix: Avoid missing class error for fetch_thirdparty method #1973
Fix: Can't update phone_pro from web service
Fix: Some security holes.
Fix: copy extrafields when creating order from proposal.
Fix: report on action was not filtering by environment.
Fix: Avoid missing class error.
Fix: Add function dolEscapeXML.
Fix: Bad days and month reported by function.
Fix: Bad margin calculation.
***** ChangeLog for 3.5.5 compared to 3.5.4 ***** ***** ChangeLog for 3.5.5 compared to 3.5.4 *****
Fix: Holiday module was broken. Initializaion of amount of holidays failed. Fix: Holiday module was broken. Initializaion of amount of holidays failed.
Fix: [ bug #1523 ] suite bug #1334 : filtre et ordre de tri conjoints ne s'appliquent pas. Fix: [ bug #1523 ] suite bug #1334 : filtre et ordre de tri conjoints ne s'appliquent pas.

View File

@ -1,69 +1,20 @@
dolibarr (3.6.2-3) unstable; urgency=low
[ Laurent Destailleur (eldy) ]
* New upstream release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Sat, 27 dec 2014 12:00:00 +0100
dolibarr (3.6.1-3) unstable; urgency=low
[ Laurent Destailleur (eldy) ]
* New upstream release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 23 Sep 2014 12:00:00 +0100
dolibarr (3.6.0-3) unstable; urgency=low dolibarr (3.6.0-3) unstable; urgency=low
[ Laurent Destailleur (eldy) ] [ Laurent Destailleur (eldy) ]
* New upstream release. * New upstream release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 15 July 2014 12:00:00 +0100 -- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 15 July 2014 12:00:00 +0100
dolibarr (3.5.5-3) unstable; urgency=low
[ Laurent Destailleur (eldy) ]
* New upstream release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 8 July 2014 12:00:00 +0100
dolibarr (3.5.4-3) unstable; urgency=low
[ Laurent Destailleur (eldy) ]
* New upstream release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 1 July 2014 12:00:00 +0100
dolibarr (3.5.3-3) unstable; urgency=low
[ Laurent Destailleur (eldy) ]
* New upstream release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Fri, 2 May 2014 12:00:00 +0100
dolibarr (3.5.2-3) unstable; urgency=low
[ Laurent Destailleur (eldy) ]
* New upstream release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Fri, 14 March 2014 12:00:00 +0100
dolibarr (3.5.1-3) unstable; urgency=low
[ Laurent Destailleur (eldy) ]
* New upstream release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Fri, 7 Feb 2014 12:00:00 +0100
dolibarr (3.5.0-3) unstable; urgency=low
[ Laurent Destailleur (eldy) ]
* New upstream release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Fri, 31 Jan 2014 12:00:00 +0100
dolibarr (3.4.2-3) unstable; urgency=low
[ Laurent Destailleur (eldy) ]
* Maintenance release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Mon, 30 Dec 2013 12:00:00 +0100
dolibarr (3.4.1-3) unstable; urgency=low
[ Laurent Destailleur (eldy) ]
* Maintenance release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Mon, 27 Apr 2013 12:00:00 +0100
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

View File

@ -3,7 +3,7 @@ Section: web
Priority: optional Priority: optional
Maintainer: Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Maintainer: Laurent Destailleur (eldy) <eldy@users.sourceforge.net>
# Uploaders: Laurent Destailleur (eldy) <eldy@users.sourceforge.net> # Only if differs from Maintainer # Uploaders: Laurent Destailleur (eldy) <eldy@users.sourceforge.net> # Only if differs from Maintainer
Standards-Version: 3.9.4 Standards-Version: 3.9.6
Homepage: http://www.dolibarr.org Homepage: http://www.dolibarr.org
Build-Depends: debhelper (>= 9), po-debconf Build-Depends: debhelper (>= 9), po-debconf
# This package need at least debian 7 or ubuntu 13.04 or any distribution based on this version # This package need at least debian 7 or ubuntu 13.04 or any distribution based on this version
@ -16,7 +16,8 @@ Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm |
php5-mysql | php5-mysqli, php5-curl, php5-gd, php5-ldap, php5-geoip, php5-mysql | php5-mysqli, php5-curl, php5-gd, php5-ldap, php5-geoip,
# Required PHP libraries # Required PHP libraries
php-pear, php-mail-mime, php-pear, php-mail-mime,
# php-tcpdf, libfpdi-php, libfpdf-tpl-php, php-fpdf, # php-tcpdf, libfpdi-php,
# libfpdf-tpl-php, php-fpdf,
# libphp-adodb, # libphp-adodb,
# libnusoap-php, # libnusoap-php,
# libphp-pclzip, # libphp-pclzip,
@ -26,9 +27,10 @@ Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm |
# fonts-dejavu-core | ttf-dejavu-core, # fonts-dejavu-core | ttf-dejavu-core,
xdg-utils, xdg-utils,
mysql-server, mysql-server,
mysql-client,
${misc:Depends}, ${misc:Depends},
${perl:Depends} ${perl:Depends}
Recommends: mysql-client, apache2 | lighttpd | httpd Recommends: apache2 | lighttpd | httpd
Suggests: www-browser Suggests: www-browser
Description: Web based software to manage a company or foundation Description: Web based software to manage a company or foundation
Dolibarr ERP & CRM is an easy to use open source/free software for small Dolibarr ERP & CRM is an easy to use open source/free software for small

View File

@ -1,7 +1,7 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Dolibarr Upstream-Name: Dolibarr
Upstream-Contact: Laurent Destailleur <eldy@users.sourceforge.net> Upstream-Contact: Laurent Destailleur <eldy@users.sourceforge.net>
Source: http://sourceforge.net/projects/dolibarr/files/ Source: http://www.dolibarr.org/files/stable/standard/
Files: * Files: *
Copyright: 2002-2009, Rodolphe Quiedeville <rodolphe@quiedeville.org> Copyright: 2002-2009, Rodolphe Quiedeville <rodolphe@quiedeville.org>

1
build/exe/doliwamp/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/doliwamp.tmp.iss

View File

@ -16,10 +16,10 @@
[Setup] [Setup]
; ----- Change this ----- ; ----- Change this -----
AppName=DoliWamp AppName=DoliWamp
; DoliWamp-x.x.x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x ; Replace key with DoliWamp-x.x.x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x
AppVerName=DoliWamp-3.6.0 AppVerName=__FILENAMEEXEDOLIWAMP__
; DoliWamp-x.x x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x ; Replace key with DoliWamp-x.x x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x
OutputBaseFilename=DoliWamp-3.6.0 OutputBaseFilename=__FILENAMEEXEDOLIWAMP__
; ----- End of change ; ----- End of change
;OutputManifestFile=build\doliwampbuild.log ;OutputManifestFile=build\doliwampbuild.log
; Define full path from which all relative path are defined ; Define full path from which all relative path are defined

View File

@ -2,7 +2,7 @@
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# \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-2013 Laurent Destailleur <eldy@users.sourceforge.net> # \author (c)2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
# #
# This is list of constant you can set to have generated packages moved into a specific dir: # 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' #DESTIBETARC='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/lastbuild'
@ -442,6 +442,7 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`;
$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 -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`; $ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`;
@ -460,8 +461,8 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/license.txt`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/license.txt`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-2.33`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-20100919`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/utils`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/utils`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/LICENSE.TXT`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/LICENSE.TXT`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/savant`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/savant`;
@ -610,9 +611,6 @@ if ($nboftargetok) {
print "Version is $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n"; print "Version is $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n";
#print "Create directory $RPMDIR\n";
#$ret=`mkdir -p "$RPMDIR"`;
print "Remove target ".$FILENAMERPM."...\n"; print "Remove target ".$FILENAMERPM."...\n";
unlink("$NEWDESTI/".$FILENAMERPM); unlink("$NEWDESTI/".$FILENAMERPM);
print "Remove target ".$FILENAMETGZ2."-".$RPMSUBVERSION.".src.rpm...\n"; print "Remove target ".$FILENAMETGZ2."-".$RPMSUBVERSION.".src.rpm...\n";
@ -620,13 +618,13 @@ if ($nboftargetok) {
print "Create directory $BUILDROOT/$FILENAMETGZ2\n"; print "Create directory $BUILDROOT/$FILENAMETGZ2\n";
$ret=`rm -fr $BUILDROOT/$FILENAMETGZ2`; $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2`;
print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMETGZ2\n"; print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMETGZ2\n";
$cmd="cp -pr '$BUILDROOT/$PROJECT' '$BUILDROOT/$FILENAMETGZ2'"; $cmd="cp -pr '$BUILDROOT/$PROJECT' '$BUILDROOT/$FILENAMETGZ2'";
$ret=`$cmd`; $ret=`$cmd`;
# Set owners # Removed files we don't need
#print "Set owners on files/dir\n"; $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/htdocs/includes/ckeditor/_source`;
#$ret=`chown -R root.root $BUILDROOT/$FILENAMETGZ2`;
print "Set permissions on files/dir\n"; print "Set permissions on files/dir\n";
$ret=`chmod -R 755 $BUILDROOT/$FILENAMETGZ2`; $ret=`chmod -R 755 $BUILDROOT/$FILENAMETGZ2`;
@ -747,10 +745,18 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/rpm`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/rpm`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/zip`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/zip`;
# Removed duplicate license files # Removed duplicate license files
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/_source/LICENSE.md`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/_source/plugins/scayt/LICENSE.md`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/_source/plugins/wsc/LICENSE.md`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/LICENSE.md`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/LICENSE.md`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/plugins/scayt/LICENSE.md`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/plugins/scayt/LICENSE.md`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/plugins/wsc/LICENSE.md`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/plugins/wsc/LICENSE.md`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/jquery/plugins/flot/LICENSE.txt`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/jquery/plugins/flot/LICENSE.txt`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-2.34/LICENSE`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/tcpdf/fonts/freefont-20120503/COPYING`;
# Removed files we don't need
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/_source`;
# Rename upstream changelog to match debian rules # Rename upstream changelog to match debian rules
$ret=`mv $BUILDROOT/$PROJECT.tmp/ChangeLog $BUILDROOT/$PROJECT.tmp/changelog`; $ret=`mv $BUILDROOT/$PROJECT.tmp/ChangeLog $BUILDROOT/$PROJECT.tmp/changelog`;
@ -905,8 +911,6 @@ if ($nboftargetok) {
close SPECFROM; close SPECFROM;
close SPECTO; close SPECTO;
print "Version set to $MAJOR.$MINOR.$newbuild\n"; print "Version set to $MAJOR.$MINOR.$newbuild\n";
#$cmd="cp -pr \"$BUILDROOT/$PROJECT/build/aps/configure\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/scripts/configure\"";
#$ret=`$cmd`;
$cmd="cp -pr \"$BUILDROOT/$PROJECT/build/aps/configure.php\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/scripts/configure.php\""; $cmd="cp -pr \"$BUILDROOT/$PROJECT/build/aps/configure.php\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/scripts/configure.php\"";
$ret=`$cmd`; $ret=`$cmd`;
$cmd="cp -pr \"$BUILDROOT/$PROJECT/doc/images\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/images\""; $cmd="cp -pr \"$BUILDROOT/$PROJECT/doc/images\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/images\"";
@ -945,8 +949,12 @@ if ($nboftargetok) {
$SOURCEBACK=$SOURCE; $SOURCEBACK=$SOURCE;
$SOURCEBACK =~ s/\//\\/g; $SOURCEBACK =~ s/\//\\/g;
print "Compil exe $FILENAMEEXEDOLIWAMP.exe file from iss file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.iss\"\n";
$cmd= "ISCC.exe \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.iss\""; print "Prepare file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss from \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.iss\"\n";
$ret=`cat "$SOURCE/build/exe/doliwamp/doliwamp.iss" | sed -e 's/__FILENAMEEXEDOLIWAMP__/$FILENAMEEXEDOLIWAMP/g' > "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`;
print "Compil exe $FILENAMEEXEDOLIWAMP.exe file from iss file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\"\n";
$cmd= "ISCC.exe \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\"";
print "$cmd\n"; print "$cmd\n";
$ret= `$cmd`; $ret= `$cmd`;
#print "$ret\n"; #print "$ret\n";
@ -956,6 +964,9 @@ if ($nboftargetok) {
rename("$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe","$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"); rename("$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe","$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe");
print "Move $SOURCE/build/$FILENAMEEXEDOLIWAMP.exe to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n"; print "Move $SOURCE/build/$FILENAMEEXEDOLIWAMP.exe to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n";
$ret=`mv "$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe" "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"`; $ret=`mv "$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe" "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"`;
$ret=`rm "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`;
next; next;
} }
} }

View File

@ -36,14 +36,13 @@ complete release of Dolibarr, step by step.
- Update version number with x.y.z in build/exe/doliwamp/doliwamp.iss - Update version number with x.y.z in build/exe/doliwamp/doliwamp.iss
- Update version number with x.y.z in build/rpm/*.spec - Update version number with x.y.z in build/rpm/*.spec
- Commit all changes. - Commit all changes.
- Add a Tag (x.y.z)
- Build Dolibarr and DoliWamp packages with makepack-dolibarr.pl - Build Dolibarr and DoliWamp packages with makepack-dolibarr.pl
- Check content of built packages. - Check content of built packages.
- Move build files into www.dolibarr.org web site - Move build files into www.dolibarr.org web site
(/home/dolibarr/wwwroot/files/stable). (/home/dolibarr/wwwroot/files/stable).
- Run makepack-dolibarr.pl again with option to publish files on - Run makepack-dolibarr.pl again with option to publish files on
sourceforge. sourceforge. This will also add official tag.
- Edit symbolic links in directory "/home/dolibarr/wwwroot/files/stable/xxx" - Edit symbolic links in directory "/home/dolibarr/wwwroot/files/stable/xxx"
on server to point to new files (used by some web sites). on server to point to new files (used by some web sites).

View File

@ -333,23 +333,11 @@ 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
%changelog %changelog
* Sat Dec 27 2014 Laurent Destailleur 3.6.2-0.3
- Upstream release
* Wed Sep 24 2014 Laurent Destailleur 3.6.1-0.3
- Upstream release
* Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3 * Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3
- Upstream release - Upstream release
* Tue Jul 8 2014 Laurent Destailleur 3.5.5-0.3
- Upstream release
* Tue Jul 1 2014 Laurent Destailleur 3.5.4-0.3
- Upstream release
* Fri May 2 2014 Laurent Destailleur 3.5.3-0.3
- Upstream release
* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3
- Upstream release
* Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3
- Upstream release
* Mon Dec 30 2013 Laurent Destailleur 3.5.0-0.3
- Initial version (#723326)

View File

@ -569,23 +569,12 @@ 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
%changelog %changelog
* Sat Dec 27 2014 Laurent Destailleur 3.6.2-0.3
- Upstream release
* Wed Sep 24 2014 Laurent Destailleur 3.6.1-0.3
- Upstream release
* Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3 * Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3
- Upstream release - Upstream release
* Tue Jul 8 2014 Laurent Destailleur 3.5.5-0.3
- Upstream release
* Tue Jul 1 2014 Laurent Destailleur 3.5.4-0.3
- Upstream release
* Fri May 2 2014 Laurent Destailleur 3.5.3-0.3
- Upstream release
* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3
- Upstream release
* Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3
- Upstream release
* Mon Dec 30 2013 Laurent Destailleur 3.5.0-0.3
- Initial version (#723326)

View File

@ -338,23 +338,12 @@ 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
%changelog %changelog
* Sat Dec 27 2014 Laurent Destailleur 3.6.2-0.3
- Upstream release
* Wed Sep 24 2014 Laurent Destailleur 3.6.1-0.3
- Upstream release
* Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3 * Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3
- Upstream release - Upstream release
* Tue Jul 8 2014 Laurent Destailleur 3.5.5-0.3
- Upstream release
* Tue Jul 1 2014 Laurent Destailleur 3.5.4-0.3
- Upstream release
* Fri May 2 2014 Laurent Destailleur 3.5.3-0.3
- Upstream release
* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3
- Upstream release
* Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3
- Upstream release
* Mon Dec 30 2013 Laurent Destailleur 3.5.0-0.3
- Initial version (#723326)

View File

@ -349,23 +349,12 @@ 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
%changelog %changelog
* Sat Dec 27 2014 Laurent Destailleur 3.6.2-0.3
- Upstream release
* Wed Sep 24 2014 Laurent Destailleur 3.6.1-0.3
- Upstream release
* Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3 * Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3
- Upstream release - Upstream release
* Tue Jul 8 2014 Laurent Destailleur 3.5.5-0.3
- Upstream release
* Tue Jul 1 2014 Laurent Destailleur 3.5.4-0.3
- Upstream release
* Fri May 2 2014 Laurent Destailleur 3.5.3-0.3
- Upstream release
* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3
- Upstream release
* Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3
- Upstream release
* Mon Dec 30 2013 Laurent Destailleur 3.5.0-0.3
- Initial version (#723326)

View File

@ -6,6 +6,7 @@
<exclude-pattern>*/conf.php</exclude-pattern> <exclude-pattern>*/conf.php</exclude-pattern>
<exclude-pattern>*/includes/*</exclude-pattern> <exclude-pattern>*/includes/*</exclude-pattern>
<exclude-pattern>*/documents/*</exclude-pattern> <exclude-pattern>*/documents/*</exclude-pattern>
<exclude-pattern>*/dev/vagrant/*</exclude-pattern>
<exclude-pattern>*/custom/*</exclude-pattern> <exclude-pattern>*/custom/*</exclude-pattern>
<exclude-pattern>*/nltechno*</exclude-pattern> <exclude-pattern>*/nltechno*</exclude-pattern>
@ -17,6 +18,22 @@
<rule ref="Generic.CodeAnalysis.EmptyStatement" /> <rule ref="Generic.CodeAnalysis.EmptyStatement" />
<rule ref="Generic.CodeAnalysis.EmptyStatement.DetectedCATCH">
<severity>0</severity>
</rule>
<rule ref="Generic.CodeAnalysis.EmptyStatement.DetectedFOREACH">
<severity>0</severity>
</rule>
<rule ref="Generic.CodeAnalysis.EmptyStatement.DetectedIF">
<severity>0</severity>
</rule>
<rule ref="Generic.CodeAnalysis.EmptyStatement.DetectedELSE">
<severity>0</severity>
</rule>
<rule ref="Generic.CodeAnalysis.EmptyStatement.DetectedELSEIF">
<severity>0</severity>
</rule>
<rule ref="Generic.CodeAnalysis.EmptyStatement.NotAllowed"> <rule ref="Generic.CodeAnalysis.EmptyStatement.NotAllowed">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
@ -105,7 +122,7 @@
<rule ref="Generic.Metrics.CyclomaticComplexity"> <rule ref="Generic.Metrics.CyclomaticComplexity">
<properties> <properties>
<property name="complexity" value="80" /> <property name="complexity" value="80" />
<property name="absoluteComplexity" value="200" /> <property name="absoluteComplexity" value="250" />
</properties> </properties>
</rule> </rule>
<rule ref="Generic.Metrics.NestingLevel"> <rule ref="Generic.Metrics.NestingLevel">
@ -162,6 +179,74 @@
<rule ref="PEAR.Commenting.ClassComment.MissingTag"> <rule ref="PEAR.Commenting.ClassComment.MissingTag">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@authorTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@categoryTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@licenseTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@linkTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@packageTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamType">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamName">
<severity>0</severity>
</rule>
<!-- TODO Remove this and fix reported errors -->
<rule ref="PEAR.Commenting.ClassComment.Missing">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.MissingReturn">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.ReturnNotRequired">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.Missing">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@authorTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@categoryTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@licenseTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@linkTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@packageTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamType">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamName">
<severity>0</severity>
</rule>
<!-- TODO Remove this and fix reported errors -->
<rule ref="PEAR.Commenting.ClassComment.Missing">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.MissingReturn">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.ReturnNotRequired">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.Missing">
<severity>0</severity>
</rule>
<!-- <!--
<rule ref="PEAR.Commenting.FileComment" /> <rule ref="PEAR.Commenting.FileComment" />
@ -219,6 +304,24 @@
<rule ref="PEAR.Functions.FunctionCallSignature.Indent"> <rule ref="PEAR.Functions.FunctionCallSignature.Indent">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<rule ref="PEAR.Functions.FunctionCallSignature.SpaceBeforeOpenBracket">
<severity>0</severity>
</rule>
<rule ref="PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket">
<severity>0</severity>
</rule>
<rule ref="PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket">
<severity>0</severity>
</rule>
<rule ref="PEAR.Functions.FunctionCallSignature.SpaceAfterCloseBracket">
<severity>0</severity>
</rule>
<rule ref="PEAR.Functions.FunctionCallSignature.CloseBracketLine">
<severity>0</severity>
</rule>
<rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket">
<severity>0</severity>
</rule>
<rule ref="PEAR.Functions.ValidDefaultValue" /> <rule ref="PEAR.Functions.ValidDefaultValue" />
@ -236,6 +339,10 @@
</rule> </rule>
<rule ref="PEAR.NamingConventions.ValidFunctionName" /> <rule ref="PEAR.NamingConventions.ValidFunctionName" />
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore">
<severity>0</severity>
</rule>
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNameInvalid"> <rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNameInvalid">
<severity>0</severity> <severity>0</severity>
</rule> </rule>

View File

@ -7,7 +7,7 @@
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -17,6 +17,7 @@
* *
* 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/>.
* or see http://www.gnu.org/
*/ */
/** /**

View File

@ -94,7 +94,7 @@ abstract class ActionsAdherentCardCommon
/** /**
* Load data control * Load data control
* *
* @param string &$action Type of action * @param string $action Type of action
* @param int $id Id of object * @param int $id Id of object
* @return void * @return void
*/ */
@ -228,7 +228,7 @@ abstract class ActionsAdherentCardCommon
/** /**
* Set content of ->tpl array, to use into template * Set content of ->tpl array, to use into template
* *
* @param string &$action Type of action * @param string $action Type of action
* @param int $id Id * @param int $id Id
* @return string HTML output * @return string HTML output
*/ */

View File

@ -76,7 +76,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
/** /**
* Assign custom values for canvas * Assign custom values for canvas
* *
* @param string &$action Type of action * @param string $action Type of action
* @param int $id Id * @param int $id Id
* @return void * @return void
*/ */

View File

@ -5,6 +5,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 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
* 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
@ -124,7 +125,7 @@ class Adherent extends CommonObject
/** /**
* Fonction envoyant un email a l'adherent avec le texte fourni en parametre. * Function sending an email has the adherent with the text supplied in parameter.
* *
* @param string $text Content of message (not html entities encoded) * @param string $text Content of message (not html entities encoded)
* @param string $subject Subject of message * @param string $subject Subject of message
@ -247,9 +248,9 @@ class Adherent extends CommonObject
/** /**
* Renvoie le libelle traduit de la nature d'un adherent (physique ou morale) * Return translated label by the nature of a adherent (physical or moral)
* *
* @param string $morphy Nature physique ou morale de l'adherent * @param string $morphy Nature of the adherent (physical or moral)
* @return string Label * @return string Label
*/ */
function getmorphylib($morphy='') function getmorphylib($morphy='')
@ -348,12 +349,12 @@ class Adherent extends CommonObject
if (! $notrigger) if (! $notrigger)
{ {
// Appel des triggers // Call 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);
$result=$interface->run_triggers('MEMBER_CREATE',$this,$user,$langs,$conf); $result=$interface->run_triggers('MEMBER_CREATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers // End call triggers
} }
if (count($this->errors)) if (count($this->errors))
@ -1101,7 +1102,7 @@ class Adherent extends CommonObject
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref_ext = $obj->ref_ext; $this->ref_ext = $obj->ref_ext;
$this->civility_id = $obj->civility; $this->civility_id = $obj->civility_id;
$this->firstname = $obj->firstname; $this->firstname = $obj->firstname;
$this->lastname = $obj->lastname; $this->lastname = $obj->lastname;
$this->login = $obj->login; $this->login = $obj->login;

View File

@ -5,6 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2012-2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2014 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
* 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
@ -120,8 +121,10 @@ $hookmanager->initHooks(array('membercard'));
$parameters=array('rowid'=>$rowid, 'objcanvas'=>$objcanvas); $parameters=array('rowid'=>$rowid, 'objcanvas'=>$objcanvas);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer)) if (empty($reshook)) {
{
if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer))
{
$error=0; $error=0;
if (empty($user->rights->user->user->creer)) // If can edit only itself user, we can link to itself only if (empty($user->rights->user->user->creer)) // If can edit only itself user, we can link to itself only
{ {
@ -141,10 +144,10 @@ if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights
$action=''; $action='';
} }
} }
} }
if ($action == 'setsocid') if ($action == 'setsocid')
{ {
$error=0; $error=0;
if (! $error) if (! $error)
{ {
@ -176,11 +179,11 @@ if ($action == 'setsocid')
} }
} }
} }
} }
// Create user from a member // Create user from a member
if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user->user->creer) if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user->user->creer)
{ {
if ($result > 0) if ($result > 0)
{ {
// Creation user // Creation user
@ -197,11 +200,11 @@ if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user
{ {
$errmsg=$object->error; $errmsg=$object->error;
} }
} }
// Create third party from a member // Create third party from a member
if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer) if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer)
{ {
if ($result > 0) if ($result > 0)
{ {
// Creation user // Creation user
@ -219,10 +222,10 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
{ {
$errmsg=$object->error; $errmsg=$object->error;
} }
} }
if ($action == 'confirm_sendinfo' && $confirm == 'yes') if ($action == 'confirm_sendinfo' && $confirm == 'yes')
{ {
if ($object->email) if ($object->email)
{ {
$from=$conf->email_from; $from=$conf->email_from;
@ -233,10 +236,10 @@ if ($action == 'confirm_sendinfo' && $confirm == 'yes')
$langs->load("mails"); $langs->load("mails");
$mesg=$langs->trans("MailSuccessfulySent", $from, $object->email); $mesg=$langs->trans("MailSuccessfulySent", $from, $object->email);
} }
} }
if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer) if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$birthdate=''; $birthdate='';
@ -397,10 +400,10 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
{ {
$action='edit'; $action='edit';
} }
} }
if ($action == 'add' && $user->rights->adherent->creer) if ($action == 'add' && $user->rights->adherent->creer)
{ {
if ($canvas) $object->canvas=$canvas; if ($canvas) $object->canvas=$canvas;
$birthdate=''; $birthdate='';
if (isset($_POST["birthday"]) && $_POST["birthday"] if (isset($_POST["birthday"]) && $_POST["birthday"]
@ -546,10 +549,10 @@ if ($action == 'add' && $user->rights->adherent->creer)
else { else {
$action = 'create'; $action = 'create';
} }
} }
if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes') if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes')
{ {
$result=$object->delete($rowid); $result=$object->delete($rowid);
if ($result > 0) if ($result > 0)
{ {
@ -568,10 +571,10 @@ if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confir
{ {
$errmesg=$object->error; $errmesg=$object->error;
} }
} }
if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm == 'yes') if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm == 'yes')
{ {
$error=0; $error=0;
$db->begin(); $db->begin();
@ -610,10 +613,10 @@ if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm ==
$db->rollback(); $db->rollback();
} }
$action=''; $action='';
} }
if ($user->rights->adherent->supprimer && $action == 'confirm_resign') if ($user->rights->adherent->supprimer && $action == 'confirm_resign')
{ {
if ($confirm == 'yes') if ($confirm == 'yes')
{ {
$adht = new AdherentType($db); $adht = new AdherentType($db);
@ -644,11 +647,11 @@ if ($user->rights->adherent->supprimer && $action == 'confirm_resign')
header("Location: ".$backtopage); header("Location: ".$backtopage);
exit; exit;
} }
} }
// SPIP Management // SPIP Management
if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $confirm == 'yes') if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $confirm == 'yes')
{ {
if (! count($object->errors)) if (! count($object->errors))
{ {
if (!$mailmanspip->del_to_spip($object)) if (!$mailmanspip->del_to_spip($object))
@ -656,10 +659,10 @@ if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $conf
$errmsg.= $langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error."<BR>\n"; $errmsg.= $langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error."<BR>\n";
} }
} }
} }
if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm == 'yes') if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm == 'yes')
{ {
if (! count($object->errors)) if (! count($object->errors))
{ {
if (!$mailmanspip->add_to_spip($object)) if (!$mailmanspip->add_to_spip($object))
@ -667,10 +670,10 @@ if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm
$errmsg.= $langs->trans('AddIntoSpipError').': '.$mailmanspip->error."<BR>\n"; $errmsg.= $langs->trans('AddIntoSpipError').': '.$mailmanspip->error."<BR>\n";
} }
} }
}
} }
/* /*
* View * View
*/ */
@ -707,7 +710,7 @@ else
{ {
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* Fiche creation */ /* Creation card */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
$object->canvas=$canvas; $object->canvas=$canvas;
@ -870,7 +873,7 @@ else
// Birthday // Birthday
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n"; print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";
$form->select_date(($object->naiss ? $object->naiss : -1),'naiss','','',1,'formsoc'); $form->select_date(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc');
print "</td></tr>\n"; print "</td></tr>\n";
// Profil public // Profil public

View File

@ -534,4 +534,3 @@ print '<br>';
llxFooter(); llxFooter();
$db->close(); $db->close();
?>

View File

@ -117,7 +117,7 @@ if ($action == 'edit') // Edit
print_fiche_titre($langs->trans("Language"),'','').'<br>'; print_fiche_titre($langs->trans("Language"),'','').'<br>';
print '<table summary="edit" class="noborder" width="100%">'; print '<table summary="edit" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
@ -159,7 +159,7 @@ if ($action == 'edit') // Edit
// Other // Other
print '<table summary="edit" class="noborder" width="100%">'; print '<table summary="edit" class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="35%">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td>'; print '<tr class="liste_titre"><td width="35%">'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
@ -283,7 +283,7 @@ else // Show
// Language // Language
print_fiche_titre($langs->trans("Language"),'','').'<br>'; print_fiche_titre($langs->trans("Language"),'','').'<br>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td><td>&nbsp;</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td><td>&nbsp;</td></tr>';
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("DefaultLanguage").'</td><td>'; print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("DefaultLanguage").'</td><td>';
@ -327,7 +327,7 @@ else // Show
// Other // Other
$var=true; $var=true;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="35%">'.$langs->trans("Parameter").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td width="35%">'.$langs->trans("Parameters").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>';
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("EnableShowLogo").'</td><td>' . yn($conf->global->MAIN_SHOW_LOGO) . '</td>'; print '<tr '.$bc[$var].'><td>'.$langs->trans("EnableShowLogo").'</td><td>' . yn($conf->global->MAIN_SHOW_LOGO) . '</td>';

View File

@ -219,6 +219,10 @@ if (function_exists("ldap_connect"))
$info=$object->_load_ldap_info(); $info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info); $dn=$object->_load_ldap_dn($info);
// Get a gid number for objectclass PosixGroup
if(in_array('posixGroup',$info['objectclass']))
$info['gidNumber'] = $ldap->getNextGroupGid();
$result1=$ldap->delete($dn); // To be sure to delete existing records $result1=$ldap->delete($dn); // To be sure to delete existing records
$result2=$ldap->add($dn,$info,$user); // Now the test $result2=$ldap->add($dn,$info,$user); // Now the test
$result3=$ldap->delete($dn); // Clean what we did $result3=$ldap->delete($dn); // Clean what we did

View File

@ -143,4 +143,3 @@ print '</table>';
llxFooter(); llxFooter();
$db->close(); $db->close();
?>

View File

@ -329,7 +329,7 @@ if ($virtualdiffersfromphysical)
print '</table>'; print '</table>';
} }
$db->close();
llxFooter(); llxFooter();
?>
$db->close();

View File

@ -124,4 +124,5 @@ else
} }
llxFooter(); llxFooter();
?>
$db->close();

View File

@ -130,4 +130,3 @@ else
llxFooter(); llxFooter();
$db->close(); $db->close();
?>

View File

@ -379,4 +379,3 @@ print '</table>';
llxFooter(); llxFooter();
$db->close(); $db->close();
?>

View File

@ -118,5 +118,3 @@ print info_admin($langs->trans("SystemInfoDesc")).'<br>';
llxFooter(); llxFooter();
$db->close(); $db->close();
?>

View File

@ -350,4 +350,3 @@ print "<br><br>";
llxFooter(); llxFooter();
$db->close(); $db->close();
?>

View File

@ -166,4 +166,3 @@ if (preg_match('/^confirm/i',$choice))
llxFooter(); llxFooter();
$db->close(); $db->close();
?>

View File

@ -174,4 +174,3 @@ if (! empty($result['return']))
llxFooter(); llxFooter();
$db->close(); $db->close();
?>

View File

@ -69,4 +69,3 @@ print $langs->trans("SeeAlso").': <a href="'.$urlwikitranslatordoc.'" target="_b
llxFooter(); llxFooter();
$db->close(); $db->close();
?>

View File

@ -146,4 +146,3 @@ print '</table>';
llxFooter(); llxFooter();
$db->close(); $db->close();
?>

View File

@ -75,4 +75,3 @@ include_once 'affPied.php';
print '</div></div></div>'."\n"; print '</div></div></div>'."\n";
print '</body></html>'."\n"; print '</body></html>'."\n";
?>

View File

@ -191,5 +191,3 @@ $obj_facturation->paiementLe('RESET');
// Affichage des templates // Affichage des templates
require ('tpl/facturation1.tpl.php'); require ('tpl/facturation1.tpl.php');
?>

View File

@ -78,4 +78,3 @@ if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && ! empty($conf->stock->enabled)
} }
print '</li></ul>'; print '</li></ul>';
print '</div>'; print '</div>';
?>

View File

@ -143,6 +143,8 @@ if ($action == 'add' && $user->rights->categorie->creer)
{ {
$action = 'confirmed'; $action = 'confirmed';
$_POST["addcat"] = ''; $_POST["addcat"] = '';
} else {
setEventMessage($object->error,'errors');
} }
} }
} }

View File

@ -520,4 +520,3 @@ if($object->type == 4)
llxFooter(); llxFooter();
$db->close(); $db->close();
?>

View File

@ -284,7 +284,7 @@ class ActionComm extends CommonObject
$sql.= " a.fk_user_action, a.fk_user_done,"; $sql.= " a.fk_user_action, a.fk_user_done,";
$sql.= " a.fk_contact, a.percent as percentage,"; $sql.= " a.fk_contact, a.percent as percentage,";
$sql.= " a.fk_element, a.elementtype,"; $sql.= " a.fk_element, a.elementtype,";
$sql.= " a.priority, a.fulldayevent, a.location, a.transparency,"; $sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,";
$sql.= " c.id as type_id, c.code as type_code, c.libelle,"; $sql.= " c.id as type_id, c.code as type_code, c.libelle,";
$sql.= " s.nom as socname,"; $sql.= " s.nom as socname,";
$sql.= " u.firstname, u.lastname as lastname"; $sql.= " u.firstname, u.lastname as lastname";
@ -878,7 +878,7 @@ class ActionComm extends CommonObject
$sql.= " a.fk_user_action, a.fk_user_done,"; $sql.= " a.fk_user_action, a.fk_user_done,";
$sql.= " a.fk_contact, a.percent as percentage,"; $sql.= " a.fk_contact, a.percent as percentage,";
$sql.= " a.fk_element, a.elementtype,"; $sql.= " a.fk_element, a.elementtype,";
$sql.= " a.priority, a.fulldayevent, a.location,"; $sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,";
$sql.= " u.firstname, u.lastname,"; $sql.= " u.firstname, u.lastname,";
$sql.= " s.nom as socname,"; $sql.= " s.nom as socname,";
$sql.= " c.id as type_id, c.code as type_code, c.libelle"; $sql.= " c.id as type_id, c.code as type_code, c.libelle";
@ -1071,4 +1071,3 @@ class ActionComm extends CommonObject
} }
?>

View File

@ -184,18 +184,19 @@ if ($action=='show_week')
$prev_month = $prev['prev_month']; $prev_month = $prev['prev_month'];
$prev_day = $prev['prev_day']; $prev_day = $prev['prev_day'];
$first_day = $prev['first_day']; $first_day = $prev['first_day'];
$first_month= $prev['first_month'];
$first_year = $prev['first_year'];
$week = $prev['week']; $week = $prev['week'];
$day = (int) $day; $day = (int) $day;
$next = dol_get_next_week($day, $week, $month, $year); $next = dol_get_next_week($first_day, $week, $first_month, $first_year);
$next_year = $next['year']; $next_year = $next['year'];
$next_month = $next['month']; $next_month = $next['month'];
$next_day = $next['day']; $next_day = $next['day'];
// Define firstdaytoshow and lastdaytoshow // Define firstdaytoshow and lastdaytoshow
$firstdaytoshow=dol_mktime(0,0,0,$prev_month,$first_day,$prev_year); $firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year);
$lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year); $lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd');
$max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year));
@ -870,40 +871,28 @@ elseif ($action == 'show_week') // View by week
} }
echo " </tr>\n"; echo " </tr>\n";
// In loops, tmpday contains day nb in current month (can be zero or negative for days of previous month)
//var_dump($eventarray);
//print $tmpday;
echo " <tr>\n"; echo " <tr>\n";
for($iter_day = 0; $iter_day < 7; $iter_day++) for($iter_day = 0; $iter_day < 7; $iter_day++)
{
if(($tmpday <= $max_day_in_month))
{ {
// Show days of the current week // Show days of the current week
$curtime = dol_mktime(0, 0, 0, $month, $tmpday, $year); $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd');
$tmparray = dol_getdate($curtime,'fast');
$tmpday = $tmparray['mday'];
$tmpmonth = $tmparray['mon'];
$tmpyear = $tmparray['year'];
$style='cal_current_month'; $style='cal_current_month';
if ($iter_day == 6) $style.=' cal_other_month_right'; if ($iter_day == 6) $style.=' cal_other_month_right';
$today=0; $today=0;
$todayarray=dol_getdate($now,'fast'); $todayarray=dol_getdate($now,'fast');
if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1; if ($todayarray['mday']==$tmpday && $todayarray['mon']==$tmpmonth && $todayarray['year']==$tmpyear) $today=1;
if ($today) $style='cal_today'; if ($today) $style='cal_today';
echo ' <td class="'.$style.' nowrap" width="14%" valign="top">'; echo ' <td class="'.$style.'" width="14%" valign="top">';
show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300); show_day_events($db, $tmpday, $tmpmonth, $tmpyear, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
echo " </td>\n"; echo " </td>\n";
} }
else
{
$style='cal_current_month';
if ($iter_day == 6) $style.=' cal_other_month_right';
echo ' <td class="'.$style.' nowrap" width="14%" valign="top">';
show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
echo "</td>\n";
}
$tmpday++;
}
echo " </tr>\n"; echo " </tr>\n";
echo "</table>\n"; echo "</table>\n";
@ -966,7 +955,7 @@ llxFooter();
* @param int $year Year * @param int $year Year
* @param int $monthshown Current month shown in calendar view * @param int $monthshown Current month shown in calendar view
* @param string $style Style to use for this day * @param string $style Style to use for this day
* @param array &$eventarray Array of events * @param array $eventarray Array of events
* @param int $maxprint Nb of actions to show each day on month view (0 means no limit) * @param int $maxprint Nb of actions to show each day on month view (0 means no limit)
* @param int $maxnbofchar Nb of characters to show for event line * @param int $maxnbofchar Nb of characters to show for event line
* @param string $newparam Parameters on current URL * @param string $newparam Parameters on current URL

View File

@ -79,9 +79,13 @@ $object = new Societe($db);
$parameters = array('socid' => $id); $parameters = array('socid' => $id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some
if (empty($reshook)) {
//Some actions show a "cancel" input submit button with name="cancel"
$cancelbutton = GETPOST('cancel');
if ($action == 'setcustomeraccountancycode') if ($action == 'setcustomeraccountancycode')
{ {
if (!$cancelbutton) {
$result=$object->fetch($id); $result=$object->fetch($id);
$object->code_compta=$_POST["customeraccountancycode"]; $object->code_compta=$_POST["customeraccountancycode"];
$result=$object->update($object->id,$user,1,1,0); $result=$object->update($object->id,$user,1,1,0);
@ -90,25 +94,26 @@ if ($action == 'setcustomeraccountancycode')
$mesgs[]=join(',',$object->errors); $mesgs[]=join(',',$object->errors);
} }
$action=""; $action="";
} }
}
// conditions de reglement // conditions de reglement
if ($action == 'setconditions' && $user->rights->societe->creer) if ($action == 'setconditions' && $user->rights->societe->creer)
{ {
$object->fetch($id); $object->fetch($id);
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int')); $result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
} }
// mode de reglement // mode de reglement
if ($action == 'setmode' && $user->rights->societe->creer) if ($action == 'setmode' && $user->rights->societe->creer)
{ {
$object->fetch($id); $object->fetch($id);
$result=$object->setPaymentMethods(GETPOST('mode_reglement_id','int')); $result=$object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
} }
// assujetissement a la TVA // assujetissement a la TVA
if ($action == 'setassujtva' && $user->rights->societe->creer) if ($action == 'setassujtva' && $user->rights->societe->creer)
{ {
$object->fetch($id); $object->fetch($id);
$object->tva_assuj=$_POST['assujtva_value']; $object->tva_assuj=$_POST['assujtva_value'];
@ -116,33 +121,38 @@ if ($action == 'setassujtva' && $user->rights->societe->creer)
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET tva_assuj='".$_POST['assujtva_value']."' WHERE rowid='".$id."'"; $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET tva_assuj='".$_POST['assujtva_value']."' WHERE rowid='".$id."'";
$result = $db->query($sql); $result = $db->query($sql);
if (! $result) dol_print_error($result); if (! $result) dol_print_error($result);
} }
// set prospect level // set prospect level
if ($action == 'setprospectlevel' && $user->rights->societe->creer) if ($action == 'setprospectlevel' && $user->rights->societe->creer)
{ {
$object->fetch($id); $object->fetch($id);
$object->fk_prospectlevel=GETPOST('prospect_level_id','alpha'); $object->fk_prospectlevel=GETPOST('prospect_level_id','alpha');
$result=$object->set_prospect_level($user); $result=$object->set_prospect_level($user);
if ($result < 0) setEventMessage($object->error,'errors'); if ($result < 0) setEventMessage($object->error,'errors');
} }
// Update communication level // Update communication level
if ($action == 'cstc') if ($action == 'cstc')
{ {
$object->fetch($id); $object->fetch($id);
$object->stcomm_id=GETPOST('stcomm','int'); $object->stcomm_id=GETPOST('stcomm','int');
$result=$object->set_commnucation_level($user); $result=$object->set_commnucation_level($user);
if ($result < 0) setEventMessage($object->error,'errors'); if ($result < 0) setEventMessage($object->error,'errors');
} }
// Update communication level // Update communication level
if ($action == 'setOutstandingBill') if ($action == 'setOutstandingBill')
{ {
if (!$cancelbutton) {
$object->fetch($id); $object->fetch($id);
$object->outstanding_limit=GETPOST('OutstandingBill'); $object->outstanding_limit = GETPOST('OutstandingBill');
$result=$object->set_OutstandingBill($user); $result = $object->set_OutstandingBill($user);
if ($result < 0) setEventMessage($object->error,'errors'); if ($result < 0) {
setEventMessage($object->error, 'errors');
}
}
}
} }
@ -933,4 +943,3 @@ dol_htmloutput_mesg('',$mesgs);
// End of page // End of page
llxFooter(); llxFooter();
$db->close(); $db->close();
?>

View File

@ -102,9 +102,11 @@ $object->substitutionarrayfortest=array(
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
// Action clone object if (empty($reshook)) {
if ($action == 'confirm_clone' && $confirm == 'yes')
{ // Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes')
{
if (empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) if (empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"]))
{ {
$mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>'; $mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
@ -123,11 +125,11 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
} }
} }
$action=''; $action='';
} }
// Action send emailing for everybody // Action send emailing for everybody
if ($action == 'sendallconfirmed' && $confirm == 'yes') if ($action == 'sendallconfirmed' && $confirm == 'yes')
{ {
if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) if (empty($conf->global->MAILING_LIMIT_SENDBYWEB))
{ {
// Pour des raisons de securite, on ne permet pas cette fonction via l'IHM, // Pour des raisons de securite, on ne permet pas cette fonction via l'IHM,
@ -378,11 +380,11 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
$action = ''; $action = '';
} }
} }
// Action send test emailing // Action send test emailing
if ($action == 'send' && empty($_POST["cancel"])) if ($action == 'send' && empty($_POST["cancel"]))
{ {
$error=0; $error=0;
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1); $upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
@ -439,11 +441,11 @@ if ($action == 'send' && empty($_POST["cancel"]))
$action=''; $action='';
} }
} }
// Action add emailing // Action add emailing
if ($action == 'add') if ($action == 'add')
{ {
$object->email_from = trim($_POST["from"]); $object->email_from = trim($_POST["from"]);
$object->email_replyto = trim($_POST["replyto"]); $object->email_replyto = trim($_POST["replyto"]);
$object->email_errorsto = trim($_POST["errorsto"]); $object->email_errorsto = trim($_POST["errorsto"]);
@ -469,11 +471,11 @@ if ($action == 'add')
$mesg='<div class="error">'.$mesg.'</div>'; $mesg='<div class="error">'.$mesg.'</div>';
$action="create"; $action="create";
} }
// Action update description of emailing // Action update description of emailing
if ($action == 'settitre' || $action == 'setemail_from' || $actino == 'setreplyto' || $action == 'setemail_errorsto') if ($action == 'settitre' || $action == 'setemail_from' || $actino == 'setreplyto' || $action == 'setemail_errorsto')
{ {
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1); $upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
if ($action == 'settitre') $object->titre = trim(GETPOST('titre','alpha')); if ($action == 'settitre') $object->titre = trim(GETPOST('titre','alpha'));
@ -496,13 +498,13 @@ if ($action == 'settitre' || $action == 'setemail_from' || $actino == 'setreplyt
$mesg='<div class="error">'.$mesg.'</div>'; $mesg='<div class="error">'.$mesg.'</div>';
$action=""; $action="";
} }
/* /*
* Add file in email form * Add file in email form
*/ */
if (! empty($_POST['addfile'])) if (! empty($_POST['addfile']))
{ {
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1); $upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -511,11 +513,11 @@ if (! empty($_POST['addfile']))
dol_add_file_process($upload_dir,0,0); dol_add_file_process($upload_dir,0,0);
$action="edit"; $action="edit";
} }
// Action remove file // Action remove file
if (! empty($_POST["removedfile"])) if (! empty($_POST["removedfile"]))
{ {
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1); $upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -523,11 +525,11 @@ if (! empty($_POST["removedfile"]))
dol_remove_file_process($_POST['removedfile'],0); dol_remove_file_process($_POST['removedfile'],0);
$action="edit"; $action="edit";
} }
// Action update emailing // Action update emailing
if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"])) if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"]))
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$isupload=0; $isupload=0;
@ -559,11 +561,11 @@ if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"
{ {
$action="edit"; $action="edit";
} }
} }
// Action confirmation validation // Action confirmation validation
if ($action == 'confirm_valid' && $confirm == 'yes') if ($action == 'confirm_valid' && $confirm == 'yes')
{ {
if ($object->id > 0) if ($object->id > 0)
{ {
$object->valid($user); $object->valid($user);
@ -575,11 +577,11 @@ if ($action == 'confirm_valid' && $confirm == 'yes')
{ {
dol_print_error($db); dol_print_error($db);
} }
} }
// Resend // Resend
if ($action == 'confirm_reset' && $confirm == 'yes') if ($action == 'confirm_reset' && $confirm == 'yes')
{ {
if ($object->id > 0) if ($object->id > 0)
{ {
$db->begin(); $db->begin();
@ -606,26 +608,26 @@ if ($action == 'confirm_reset' && $confirm == 'yes')
{ {
dol_print_error($db); dol_print_error($db);
} }
} }
// Action confirmation suppression // Action confirmation suppression
if ($action == 'confirm_delete' && $confirm == 'yes') if ($action == 'confirm_delete' && $confirm == 'yes')
{ {
if ($object->delete($object->id)) if ($object->delete($object->id))
{ {
$url= (! empty($urlfrom) ? $urlfrom : 'liste.php'); $url= (! empty($urlfrom) ? $urlfrom : 'liste.php');
header("Location: ".$url); header("Location: ".$url);
exit; exit;
} }
} }
if (! empty($_POST["cancel"])) if (! empty($_POST["cancel"]))
{ {
$action = ''; $action = '';
}
} }
/* /*
* View * View
*/ */

View File

@ -9,6 +9,7 @@
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Marcos García <marcosgdf@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
* 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
@ -106,10 +107,11 @@ $parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some
// hooks // hooks
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once if (empty($reshook)) {
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
// Action clone object // Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes') { if ($action == 'confirm_clone' && $confirm == 'yes') {
if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) { if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) {
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors'); setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
} else { } else {
@ -124,10 +126,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes') {
} }
} }
} }
} }
// Delete proposal // Delete proposal
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->propal->supprimer) { else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->propal->supprimer) {
$result = $object->delete($user); $result = $object->delete($user);
if ($result > 0) { if ($result > 0) {
header('Location: ' . DOL_URL_ROOT . '/comm/propal/list.php'); header('Location: ' . DOL_URL_ROOT . '/comm/propal/list.php');
@ -136,10 +138,10 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->prop
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans($object->error), 'errors'); setEventMessage($langs->trans($object->error), 'errors');
} }
} }
// Remove line // Remove line
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->propal->creer) { else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->propal->creer) {
$result = $object->deleteline($lineid); $result = $object->deleteline($lineid);
// reorder lines // reorder lines
if ($result) if ($result)
@ -159,10 +161,10 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
exit(); exit();
} }
// Validation // Validation
else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->propal->valider) { else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->propal->valider) {
$result = $object->valid($user); $result = $object->valid($user);
if ($result >= 0) { if ($result >= 0) {
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
@ -181,9 +183,9 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->pr
if (count($object->errors) > 0) setEventMessage($object->errors, 'errors'); if (count($object->errors) > 0) setEventMessage($object->errors, 'errors');
else setEventMessage($langs->trans($object->error), 'errors'); else setEventMessage($langs->trans($object->error), 'errors');
} }
} }
else if ($action == 'setdate' && $user->rights->propal->creer) { else if ($action == 'setdate' && $user->rights->propal->creer) {
$datep = dol_mktime(12, 0, 0, $_POST ['remonth'], $_POST ['reday'], $_POST ['reyear']); $datep = dol_mktime(12, 0, 0, $_POST ['remonth'], $_POST ['reday'], $_POST ['reyear']);
if (empty($datep)) { if (empty($datep)) {
@ -196,23 +198,23 @@ else if ($action == 'setdate' && $user->rights->propal->creer) {
if ($result < 0) if ($result < 0)
dol_print_error($db, $object->error); dol_print_error($db, $object->error);
} }
} else if ($action == 'setecheance' && $user->rights->propal->creer) { } else if ($action == 'setecheance' && $user->rights->propal->creer) {
$result = $object->set_echeance($user, dol_mktime(12, 0, 0, $_POST ['echmonth'], $_POST ['echday'], $_POST ['echyear'])); $result = $object->set_echeance($user, dol_mktime(12, 0, 0, $_POST ['echmonth'], $_POST ['echday'], $_POST ['echyear']));
if ($result < 0) if ($result < 0)
dol_print_error($db, $object->error); dol_print_error($db, $object->error);
} else if ($action == 'setdate_livraison' && $user->rights->propal->creer) { } else if ($action == 'setdate_livraison' && $user->rights->propal->creer) {
$result = $object->set_date_livraison($user, dol_mktime(12, 0, 0, $_POST ['liv_month'], $_POST ['liv_day'], $_POST ['liv_year'])); $result = $object->set_date_livraison($user, dol_mktime(12, 0, 0, $_POST ['liv_month'], $_POST ['liv_day'], $_POST ['liv_year']));
if ($result < 0) if ($result < 0)
dol_print_error($db, $object->error); dol_print_error($db, $object->error);
} }
// Positionne ref client // Positionne ref client
else if ($action == 'set_ref_client' && $user->rights->propal->creer) { else if ($action == 'set_ref_client' && $user->rights->propal->creer) {
$object->set_ref_client($user, $_POST ['ref_client']); $object->set_ref_client($user, $_POST ['ref_client']);
} }
// Create proposal // Create proposal
else if ($action == 'add' && $user->rights->propal->creer) { else if ($action == 'add' && $user->rights->propal->creer) {
$object->socid = $socid; $object->socid = $socid;
$object->fetch_thirdparty(); $object->fetch_thirdparty();
@ -344,23 +346,23 @@ else if ($action == 'add' && $user->rights->propal->creer) {
} }
} }
} }
} }
// Classify billed // Classify billed
else if ($action == 'classifybilled' && $user->rights->propal->cloturer) { else if ($action == 'classifybilled' && $user->rights->propal->cloturer) {
$object->cloture($user, 4, ''); $object->cloture($user, 4, '');
} }
// Reopen proposal // Reopen proposal
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) { else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
// prevent browser refresh from reopening proposal several times // prevent browser refresh from reopening proposal several times
if ($object->statut == 2 || $object->statut == 3) { if ($object->statut == 2 || $object->statut == 3) {
$object->reopen($user, 1); $object->reopen($user, 1);
} }
} }
// Close proposal // Close proposal
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel')) { else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
if (! GETPOST('statut')) { if (! GETPOST('statut')) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("CloseAs")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("CloseAs")), 'errors');
$action = 'statut'; $action = 'statut';
@ -370,10 +372,10 @@ else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST(
$object->cloture($user, GETPOST('statut'), GETPOST('note')); $object->cloture($user, GETPOST('statut'), GETPOST('note'));
} }
} }
} }
// Add file in email form // Add file in email form
if (GETPOST('addfile')) { if (GETPOST('addfile')) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
// Set tmp user directory TODO Use a dedicated directory for temp mails files // Set tmp user directory TODO Use a dedicated directory for temp mails files
@ -382,10 +384,10 @@ if (GETPOST('addfile')) {
dol_add_file_process($upload_dir_tmp, 0, 0); dol_add_file_process($upload_dir_tmp, 0, 0);
$action = 'presend'; $action = 'presend';
} }
// Remove file in email form // Remove file in email form
if (GETPOST('removedfile')) { if (GETPOST('removedfile')) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
// Set tmp user directory // Set tmp user directory
@ -395,33 +397,38 @@ if (GETPOST('removedfile')) {
// TODO Delete only files that was uploaded from email form // TODO Delete only files that was uploaded from email form
dol_remove_file_process($_POST ['removedfile'], 0); dol_remove_file_process($_POST ['removedfile'], 0);
$action = 'presend'; $action = 'presend';
} }
/* /*
* Send mail * Send mail
*/ */
if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) { if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel'))
{
$langs->load('mails'); $langs->load('mails');
if ($object->id > 0) { if ($object->id > 0)
{
$receiver = GETPOST('receiver');
if ($_POST ['sendto']) { if ($_POST ['sendto']) {
// Le destinataire a ete fourni via le champ libre // Le destinataire a ete fourni via le champ libre
$sendto = $_POST ['sendto']; $sendto = $_POST ['sendto'];
$sendtoid = 0; $sendtoid = 0;
} elseif ($_POST ['receiver'] != '-1') { } elseif ($receiver !== "") {
// Recipient was provided from combo list // Recipient was provided from combo list
if ($_POST ['receiver'] == 'thirdparty') // Id of third party if ($receiver == 'thirdparty') // Id of third party
{ {
$sendto = $object->client->email; $sendto = $object->client->email;
$sendtoid = 0; $sendtoid = 0;
} else // Id du contact } elseif ($receiver != '-1') // Id du contact
{ {
$sendto = $object->client->contact_get_property($_POST ['receiver'], 'email'); $sendto = $object->client->contact_get_property($receiver, 'email');
$sendtoid = $_POST ['receiver']; $sendtoid = $receiver;
} }
} }
if (dol_strlen($sendto)) { if (dol_strlen($sendto))
{
$langs->load("commercial"); $langs->load("commercial");
$from = $_POST ['fromname'] . ' <' . $_POST ['frommail'] . '>'; $from = $_POST ['fromname'] . ' <' . $_POST ['frommail'] . '>';
@ -509,10 +516,10 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
setEventMessage($langs->trans('ErrorFailedToReadEntity', $langs->trans("Proposal")), 'errors'); setEventMessage($langs->trans('ErrorFailedToReadEntity', $langs->trans("Proposal")), 'errors');
dol_syslog($langs->trans('ErrorFailedToReadEntity', $langs->trans("Proposal"))); dol_syslog($langs->trans('ErrorFailedToReadEntity', $langs->trans("Proposal")));
} }
} }
// Go back to draft // Go back to draft
if ($action == 'modif' && $user->rights->propal->creer) { if ($action == 'modif' && $user->rights->propal->creer) {
$object->set_draft($user); $object->set_draft($user);
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
@ -526,9 +533,9 @@ if ($action == 'modif' && $user->rights->propal->creer) {
$ret = $object->fetch($id); // Reload to get new records $ret = $object->fetch($id); // Reload to get new records
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }
} }
else if ($action == "setabsolutediscount" && $user->rights->propal->creer) { else if ($action == "setabsolutediscount" && $user->rights->propal->creer) {
if ($_POST ["remise_id"]) { if ($_POST ["remise_id"]) {
if ($object->id > 0) { if ($object->id > 0) {
$result = $object->insert_discount($_POST ["remise_id"]); $result = $object->insert_discount($_POST ["remise_id"]);
@ -537,24 +544,23 @@ else if ($action == "setabsolutediscount" && $user->rights->propal->creer) {
} }
} }
} }
} }
// Add line // Add line
else if ($action == 'addline' && $user->rights->propal->creer) { else if ($action == 'addline' && $user->rights->propal->creer) {
// Set if we used free entry or predefined product // Set if we used free entry or predefined product
$predef=''; $predef='';
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):''); $product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
$price_ht = GETPOST('price_ht');
if (GETPOST('prod_entry_mode') == 'free') if (GETPOST('prod_entry_mode') == 'free')
{ {
$idprod=0; $idprod=0;
$price_ht = GETPOST('price_ht');
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
} }
else else
{ {
$idprod=GETPOST('idprod', 'int'); $idprod=GETPOST('idprod', 'int');
$price_ht = '';
$tva_tx = ''; $tva_tx = '';
} }
@ -612,12 +618,12 @@ else if ($action == 'addline' && $user->rights->propal->creer) {
// On defini prix unitaire // On defini prix unitaire
if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->client->price_level) if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->client->price_level)
{ {
$pu_ht = $prod->multiprices [$object->client->price_level]; $pu_ht = $prod->multiprices[$object->client->price_level];
$pu_ttc = $prod->multiprices_ttc [$object->client->price_level]; $pu_ttc = $prod->multiprices_ttc[$object->client->price_level];
$price_min = $prod->multiprices_min [$object->client->price_level]; $price_min = $prod->multiprices_min[$object->client->price_level];
$price_base_type = $prod->multiprices_base_type [$object->client->price_level]; $price_base_type = $prod->multiprices_base_type[$object->client->price_level];
$tva_tx=$prod->multiprices_tva_tx[$object->client->price_level]; if (isset($prod->multiprices_tva_tx[$object->client->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level];
$tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level]; if (isset($prod->multiprices_recuperableonly[$object->client->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level];
} }
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{ {
@ -789,10 +795,10 @@ else if ($action == 'addline' && $user->rights->propal->creer) {
} }
} }
} }
} }
// Mise a jour d'une ligne dans la propale // Mise a jour d'une ligne dans la propale
else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('save') == $langs->trans("Save")) { else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('save') == $langs->trans("Save")) {
// Define info_bits // Define info_bits
$info_bits = 0; $info_bits = 0;
if (preg_match('/\*/', GETPOST('tva_tx'))) if (preg_match('/\*/', GETPOST('tva_tx')))
@ -898,15 +904,15 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa
setEventMessage($object->error, 'errors'); setEventMessage($object->error, 'errors');
} }
} }
} }
else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('cancel') == $langs->trans('Cancel')) { else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('cancel') == $langs->trans('Cancel')) {
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
exit(); exit();
} }
// Generation doc (depuis lien ou depuis cartouche doc) // Generation doc (depuis lien ou depuis cartouche doc)
else if ($action == 'builddoc' && $user->rights->propal->creer) { else if ($action == 'builddoc' && $user->rights->propal->creer) {
if (GETPOST('model')) { if (GETPOST('model')) {
$object->setDocModel($user, GETPOST('model')); $object->setDocModel($user, GETPOST('model'));
} }
@ -928,10 +934,10 @@ else if ($action == 'builddoc' && $user->rights->propal->creer) {
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc')); header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc'));
exit(); exit();
} }
} }
// Remove file in doc form // Remove file in doc form
else if ($action == 'remove_file' && $user->rights->propal->creer) { else if ($action == 'remove_file' && $user->rights->propal->creer) {
if ($object->id > 0) { if ($object->id > 0) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
@ -944,46 +950,46 @@ else if ($action == 'remove_file' && $user->rights->propal->creer) {
else else
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors'); setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors');
} }
} }
// Set project // Set project
else if ($action == 'classin' && $user->rights->propal->creer) { else if ($action == 'classin' && $user->rights->propal->creer) {
$object->setProject($_POST ['projectid']); $object->setProject($_POST ['projectid']);
} }
// Delai de livraison // Delai de livraison
else if ($action == 'setavailability' && $user->rights->propal->creer) { else if ($action == 'setavailability' && $user->rights->propal->creer) {
$result = $object->availability($_POST ['availability_id']); $result = $object->availability($_POST ['availability_id']);
} }
// Origine de la propale // Origine de la propale
else if ($action == 'setdemandreason' && $user->rights->propal->creer) { else if ($action == 'setdemandreason' && $user->rights->propal->creer) {
$result = $object->demand_reason($_POST ['demand_reason_id']); $result = $object->demand_reason($_POST ['demand_reason_id']);
} }
// Conditions de reglement // Conditions de reglement
else if ($action == 'setconditions' && $user->rights->propal->creer) { else if ($action == 'setconditions' && $user->rights->propal->creer) {
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
} }
else if ($action == 'setremisepercent' && $user->rights->propal->creer) { else if ($action == 'setremisepercent' && $user->rights->propal->creer) {
$result = $object->set_remise_percent($user, $_POST ['remise_percent']); $result = $object->set_remise_percent($user, $_POST ['remise_percent']);
} }
else if ($action == 'setremiseabsolue' && $user->rights->propal->creer) { else if ($action == 'setremiseabsolue' && $user->rights->propal->creer) {
$result = $object->set_remise_absolue($user, $_POST ['remise_absolue']); $result = $object->set_remise_absolue($user, $_POST ['remise_absolue']);
} }
// Mode de reglement // Mode de reglement
else if ($action == 'setmode' && $user->rights->propal->creer) { else if ($action == 'setmode' && $user->rights->propal->creer) {
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
} }
/* /*
* Ordonnancement des lignes * Ordonnancement des lignes
*/ */
else if ($action == 'up' && $user->rights->propal->creer) { else if ($action == 'up' && $user->rights->propal->creer) {
$object->line_up(GETPOST('rowid')); $object->line_up(GETPOST('rowid'));
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
@ -1000,9 +1006,9 @@ else if ($action == 'up' && $user->rights->propal->creer) {
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id . '#' . GETPOST('rowid')); header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id . '#' . GETPOST('rowid'));
exit(); exit();
} }
else if ($action == 'down' && $user->rights->propal->creer) { else if ($action == 'down' && $user->rights->propal->creer) {
$object->line_down(GETPOST('rowid')); $object->line_down(GETPOST('rowid'));
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
@ -1019,7 +1025,7 @@ else if ($action == 'down' && $user->rights->propal->creer) {
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id . '#' . GETPOST('rowid')); header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id . '#' . GETPOST('rowid'));
exit(); exit();
} else if ($action == 'update_extras') { } else if ($action == 'update_extras') {
// Fill array 'array_options' with data from update form // Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
@ -1045,9 +1051,9 @@ else if ($action == 'down' && $user->rights->propal->creer) {
if ($error) if ($error)
$action = 'edit_extras'; $action = 'edit_extras';
} }
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer) { if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer) {
if ($action == 'addcontact') { if ($action == 'addcontact') {
if ($object->id > 0) { if ($object->id > 0) {
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
@ -1088,6 +1094,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->
dol_print_error($db); dol_print_error($db);
} }
} }
}
} }
/* /*

View File

@ -8,7 +8,7 @@
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-214 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * 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
@ -413,7 +413,15 @@ class Propal extends CommonObject
// infos marge // infos marge
if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
// by external module, take lowest buying price
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productFournisseur = new ProductFournisseur($this->db);
$productFournisseur->find_min_price_product_fournisseur($fk_product);
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
} else {
$this->line->fk_fournprice = $fk_fournprice; $this->line->fk_fournprice = $fk_fournprice;
}
$this->line->pa_ht = $pa_ht; $this->line->pa_ht = $pa_ht;
// Mise en option de la ligne // Mise en option de la ligne
@ -565,7 +573,15 @@ class Propal extends CommonObject
$this->line->skip_update_total = $skip_update_total; $this->line->skip_update_total = $skip_update_total;
// infos marge // infos marge
if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
// by external module, take lowest buying price
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productFournisseur = new ProductFournisseur($this->db);
$productFournisseur->find_min_price_product_fournisseur($fk_product);
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
} else {
$this->line->fk_fournprice = $fk_fournprice; $this->line->fk_fournprice = $fk_fournprice;
}
$this->line->pa_ht = $pa_ht; $this->line->pa_ht = $pa_ht;
$this->line->date_start=$date_start; $this->line->date_start=$date_start;
@ -797,7 +813,10 @@ class Propal extends CommonObject
$fk_parent_line, $fk_parent_line,
$this->lines[$i]->fk_fournprice, $this->lines[$i]->fk_fournprice,
$this->lines[$i]->pa_ht, $this->lines[$i]->pa_ht,
$this->lines[$i]->label $this->lines[$i]->label,
$this->lines[$i]->date_start,
$this->lines[$i]->date_end,
$this->lines[$i]->array_options
); );
if ($result < 0) if ($result < 0)
@ -932,6 +951,10 @@ class Propal extends CommonObject
$this->db->begin(); $this->db->begin();
// get extrafields so they will be clone
foreach($this->lines as $line)
$line->fetch_optionals($line->rowid);
// Load source object // Load source object
$objFrom = dol_clone($this); $objFrom = dol_clone($this);
@ -1072,7 +1095,7 @@ class Propal extends CommonObject
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid';
$sql.= " WHERE p.fk_statut = c.id"; $sql.= " WHERE p.fk_statut = c.id";
$sql.= " AND p.entity = ".$conf->entity; $sql.= " AND p.entity = ".$conf->entity;
if ($ref) $sql.= " AND p.ref='".$this->db->escape($ref)."'"; if ($ref) $sql.= " AND p.ref='".$ref."'";
else $sql.= " AND p.rowid=".$rowid; else $sql.= " AND p.rowid=".$rowid;
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
@ -2541,9 +2564,12 @@ class Propal extends CommonObject
$classname = $conf->global->PROPALE_ADDON; $classname = $conf->global->PROPALE_ADDON;
// Include file with class // Include file with class
foreach ($conf->file->dol_document_root as $dirroot) $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
{
$dir = $dirroot."/core/modules/propale/"; foreach ($dirmodels as $reldir) {
$dir = dol_buildpath($reldir."core/modules/propale/");
// Load file with numbering class (if found) // Load file with numbering class (if found)
$mybool|=@include_once $dir.$file; $mybool|=@include_once $dir.$file;
} }

View File

@ -162,11 +162,13 @@ $hookmanager->initHooks(array('prospectlist'));
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
if ($action == 'cstc') if (empty($reshook)) {
{ if ($action == 'cstc')
{
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm = ".$_GET["pstcomm"]; $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm = ".$_GET["pstcomm"];
$sql .= " WHERE rowid = ".$_GET["socid"]; $sql .= " WHERE rowid = ".$_GET["socid"];
$result=$db->query($sql); $result=$db->query($sql);
}
} }

View File

@ -5,7 +5,7 @@
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Jean Heimburger <jean@tiaris.info> * Copyright (C) 2011 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * 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
@ -137,9 +137,12 @@ class Commande extends CommonOrder
$classname = $conf->global->COMMANDE_ADDON; $classname = $conf->global->COMMANDE_ADDON;
// Include file with class // Include file with class
foreach ($conf->file->dol_document_root as $dirroot) $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
{
$dir = $dirroot."/core/modules/commande/"; foreach ($dirmodels as $reldir) {
$dir = dol_buildpath($reldir."core/modules/commande/");
// Load file with numbering class (if found) // Load file with numbering class (if found)
$mybool|=@include_once $dir.$file; $mybool|=@include_once $dir.$file;
} }
@ -658,18 +661,19 @@ class Commande extends CommonOrder
$this->db->begin(); $this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande (";
$sql.= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note_private, note_public, ref_client, ref_int"; $sql.= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note_private, note_public, ref_ext, ref_client, ref_int";
$sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_availability, fk_input_reason, date_livraison, fk_delivery_address"; $sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_availability, fk_input_reason, date_livraison, fk_delivery_address";
$sql.= ", remise_absolue, remise_percent"; $sql.= ", remise_absolue, remise_percent";
$sql.= ", entity"; $sql.= ", entity";
$sql.= ")"; $sql.= ")";
$sql.= " VALUES ('(PROV)',".$this->socid.", '".$this->db->idate($now)."', ".$user->id; $sql.= " VALUES ('(PROV)',".$this->socid.", '".$this->db->idate($now)."', ".$user->id;
$sql.= ", ".($this->fk_project?$this->fk_project:"null"); $sql.= ", ".($this->fk_project>0?$this->fk_project:"null");
$sql.= ", '".$this->db->idate($date)."'"; $sql.= ", '".$this->db->idate($date)."'";
$sql.= ", ".($this->source>=0 && $this->source != '' ?$this->source:'null'); $sql.= ", ".($this->source>=0 && $this->source != '' ?$this->source:'null');
$sql.= ", '".$this->db->escape($this->note_private)."'"; $sql.= ", '".$this->db->escape($this->note_private)."'";
$sql.= ", '".$this->db->escape($this->note_public)."'"; $sql.= ", '".$this->db->escape($this->note_public)."'";
$sql.= ", '".$this->db->escape($this->ref_client)."'"; $sql.= ", ".($this->ref_ext?"'".$this->db->escape($this->ref_ext)."'":"null");
$sql.= ", ".($this->ref_client?"'".$this->db->escape($this->ref_client)."'":"null");
$sql.= ", ".($this->ref_int?"'".$this->db->escape($this->ref_int)."'":"null"); $sql.= ", ".($this->ref_int?"'".$this->db->escape($this->ref_int)."'":"null");
$sql.= ", '".$this->modelpdf."'"; $sql.= ", '".$this->modelpdf."'";
$sql.= ", ".($this->cond_reglement_id>0?"'".$this->cond_reglement_id."'":"null"); $sql.= ", ".($this->cond_reglement_id>0?"'".$this->cond_reglement_id."'":"null");
@ -725,7 +729,8 @@ class Commande extends CommonOrder
$fk_parent_line, $fk_parent_line,
$this->lines[$i]->fk_fournprice, $this->lines[$i]->fk_fournprice,
$this->lines[$i]->pa_ht, $this->lines[$i]->pa_ht,
$this->lines[$i]->label $this->lines[$i]->label,
$this->lines[$i]->array_options
); );
if ($result < 0) if ($result < 0)
{ {
@ -863,6 +868,10 @@ class Commande extends CommonOrder
$this->db->begin(); $this->db->begin();
// get extrafields so they will be clone
foreach($this->lines as $line)
$line->fetch_optionals($line->rowid);
// Load source object // Load source object
$objFrom = dol_clone($this); $objFrom = dol_clone($this);
@ -893,6 +902,13 @@ class Commande extends CommonOrder
$this->date_validation = ''; $this->date_validation = '';
$this->ref_client = ''; $this->ref_client = '';
// Set ref
require_once DOL_DOCUMENT_ROOT ."/core/modules/commande/".$conf->global->COMMANDE_ADDON.'.php';
$obj = $conf->global->COMMANDE_ADDON;
$modCommande = new $obj;
$this->ref = $modCommande->getNextValue($objsoc,$this);
// Create clone // Create clone
$result=$this->create($user); $result=$this->create($user);
if ($result < 0) $error++; if ($result < 0) $error++;
@ -980,6 +996,11 @@ class Commande extends CommonOrder
$line->marge_tx = $marginInfos[1]; $line->marge_tx = $marginInfos[1];
$line->marque_tx = $marginInfos[2]; $line->marque_tx = $marginInfos[2];
// get extrafields from original line
$object->lines[$i]->fetch_optionals($object->lines[$i]->rowid);
foreach($object->lines[$i]->array_options as $options_key => $value)
$line->array_options[$options_key] = $value;
$this->lines[$i] = $line; $this->lines[$i] = $line;
} }
@ -999,6 +1020,11 @@ class Commande extends CommonOrder
$this->origin = $object->element; $this->origin = $object->element;
$this->origin_id = $object->id; $this->origin_id = $object->id;
// get extrafields from original line
$object->fetch_optionals($object->id);
foreach($object->array_options as $options_key => $value)
$this->array_options[$options_key] = $value;
// Possibility to add external linked objects with hooks // Possibility to add external linked objects with hooks
$this->linked_objects[$this->origin] = $this->origin_id; $this->linked_objects[$this->origin] = $this->origin_id;
if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects)) if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects))
@ -1192,7 +1218,15 @@ class Commande extends CommonOrder
$this->line->date_end=$date_end; $this->line->date_end=$date_end;
// infos marge // infos marge
if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
// by external module, take lowest buying price
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productFournisseur = new ProductFournisseur($this->db);
$productFournisseur->find_min_price_product_fournisseur($fk_product);
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
} else {
$this->line->fk_fournprice = $fk_fournprice; $this->line->fk_fournprice = $fk_fournprice;
}
$this->line->pa_ht = $pa_ht; $this->line->pa_ht = $pa_ht;
// TODO Ne plus utiliser // TODO Ne plus utiliser
@ -2399,7 +2433,15 @@ class Commande extends CommonOrder
$this->line->skip_update_total=$skip_update_total; $this->line->skip_update_total=$skip_update_total;
// infos marge // infos marge
if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
//by external module, take lowest buying price
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productFournisseur = new ProductFournisseur($this->db);
$productFournisseur->find_min_price_product_fournisseur($fk_product);
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
} else {
$this->line->fk_fournprice = $fk_fournprice; $this->line->fk_fournprice = $fk_fournprice;
}
$this->line->pa_ht = $pa_ht; $this->line->pa_ht = $pa_ht;
// TODO deprecated // TODO deprecated

View File

@ -185,7 +185,7 @@ else
dol_print_error($db); dol_print_error($db);
} }
llxFooter();
$db->close(); $db->close();
llxFooter();
?>

View File

@ -101,11 +101,13 @@ $permissionnote = $user->rights->commande->creer; // Used by the include of acti
$parameters = array('socid' => $socid); $parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once if (empty($reshook)) {
// Action clone object include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->creer)
{ // Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->creer)
{
if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
{ {
$mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>'; $mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
@ -131,10 +133,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->
} }
} }
} }
} }
// Reopen a closed order // Reopen a closed order
else if ($action == 'reopen' && $user->rights->commande->creer) { else if ($action == 'reopen' && $user->rights->commande->creer) {
if ($object->statut == 3) { if ($object->statut == 3) {
$result = $object->set_reopen($user); $result = $object->set_reopen($user);
if ($result > 0) if ($result > 0)
@ -147,10 +149,10 @@ else if ($action == 'reopen' && $user->rights->commande->creer) {
setEventMessage($object->error, 'errors'); setEventMessage($object->error, 'errors');
} }
} }
} }
// Suppression de la commande // Suppression de la commande
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->commande->supprimer) { else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->commande->supprimer) {
$result = $object->delete($user); $result = $object->delete($user);
if ($result > 0) { if ($result > 0) {
header('Location: index.php'); header('Location: index.php');
@ -159,10 +161,10 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->comm
else { else {
setEventMessage($object->error, 'errors'); setEventMessage($object->error, 'errors');
} }
} }
// Remove a product line // Remove a product line
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->commande->creer) { else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->commande->creer) {
$result = $object->deleteline($lineid); $result = $object->deleteline($lineid);
if ($result > 0) { if ($result > 0) {
// Define output language // Define output language
@ -188,15 +190,15 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
{ {
setEventMessage($object->error, 'errors'); setEventMessage($object->error, 'errors');
} }
} }
// Categorisation dans projet // Categorisation dans projet
else if ($action == 'classin' && $user->rights->commande->creer) { else if ($action == 'classin' && $user->rights->commande->creer) {
$object->setProject(GETPOST('projectid')); $object->setProject(GETPOST('projectid'));
} }
// Add order // Add order
else if ($action == 'add' && $user->rights->commande->creer) { else if ($action == 'add' && $user->rights->commande->creer) {
$datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); $datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
@ -405,27 +407,27 @@ else if ($action == 'add' && $user->rights->commande->creer) {
$mesg = '<div class="error">' . $object->error . '</div>'; $mesg = '<div class="error">' . $object->error . '</div>';
} }
} }
} }
else if ($action == 'classifybilled' && $user->rights->commande->creer) else if ($action == 'classifybilled' && $user->rights->commande->creer)
{ {
$ret=$object->classifyBilled(); $ret=$object->classifyBilled();
if ($ret < 0) { if ($ret < 0) {
setEventMessage($object->error, 'errors'); setEventMessage($object->error, 'errors');
} }
} }
// Positionne ref commande client // Positionne ref commande client
else if ($action == 'set_ref_client' && $user->rights->commande->creer) { else if ($action == 'set_ref_client' && $user->rights->commande->creer) {
$object->set_ref_client($user, GETPOST('ref_client')); $object->set_ref_client($user, GETPOST('ref_client'));
} }
else if ($action == 'setremise' && $user->rights->commande->creer) { else if ($action == 'setremise' && $user->rights->commande->creer) {
$object->set_remise($user, GETPOST('remise')); $object->set_remise($user, GETPOST('remise'));
} }
else if ($action == 'setabsolutediscount' && $user->rights->commande->creer) { else if ($action == 'setabsolutediscount' && $user->rights->commande->creer) {
if (GETPOST('remise_id')) { if (GETPOST('remise_id')) {
if ($object->id > 0) { if ($object->id > 0) {
$object->insert_discount(GETPOST('remise_id')); $object->insert_discount(GETPOST('remise_id'));
@ -433,9 +435,9 @@ else if ($action == 'setabsolutediscount' && $user->rights->commande->creer) {
dol_print_error($db, $object->error); dol_print_error($db, $object->error);
} }
} }
} }
else if ($action == 'setdate' && $user->rights->commande->creer) { else if ($action == 'setdate' && $user->rights->commande->creer) {
// print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; // print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
$date = dol_mktime(0, 0, 0, GETPOST('order_month'), GETPOST('order_day'), GETPOST('order_year')); $date = dol_mktime(0, 0, 0, GETPOST('order_month'), GETPOST('order_day'), GETPOST('order_year'));
@ -443,9 +445,9 @@ else if ($action == 'setdate' && $user->rights->commande->creer) {
if ($result < 0) { if ($result < 0) {
$mesg = '<div class="error">' . $object->error . '</div>'; $mesg = '<div class="error">' . $object->error . '</div>';
} }
} }
else if ($action == 'setdate_livraison' && $user->rights->commande->creer) { else if ($action == 'setdate_livraison' && $user->rights->commande->creer) {
// print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; // print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
$datelivraison = dol_mktime(0, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); $datelivraison = dol_mktime(0, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
@ -453,27 +455,27 @@ else if ($action == 'setdate_livraison' && $user->rights->commande->creer) {
if ($result < 0) { if ($result < 0) {
$mesg = '<div class="error">' . $object->error . '</div>'; $mesg = '<div class="error">' . $object->error . '</div>';
} }
} }
else if ($action == 'setmode' && $user->rights->commande->creer) { else if ($action == 'setmode' && $user->rights->commande->creer) {
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
if ($result < 0) if ($result < 0)
dol_print_error($db, $object->error); dol_print_error($db, $object->error);
} }
else if ($action == 'setavailability' && $user->rights->commande->creer) { else if ($action == 'setavailability' && $user->rights->commande->creer) {
$result = $object->availability(GETPOST('availability_id')); $result = $object->availability(GETPOST('availability_id'));
if ($result < 0) if ($result < 0)
dol_print_error($db, $object->error); dol_print_error($db, $object->error);
} }
else if ($action == 'setdemandreason' && $user->rights->commande->creer) { else if ($action == 'setdemandreason' && $user->rights->commande->creer) {
$result = $object->demand_reason(GETPOST('demand_reason_id')); $result = $object->demand_reason(GETPOST('demand_reason_id'));
if ($result < 0) if ($result < 0)
dol_print_error($db, $object->error); dol_print_error($db, $object->error);
} }
else if ($action == 'setconditions' && $user->rights->commande->creer) { else if ($action == 'setconditions' && $user->rights->commande->creer) {
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
if ($result < 0) { if ($result < 0) {
dol_print_error($db, $object->error); dol_print_error($db, $object->error);
@ -493,34 +495,33 @@ else if ($action == 'setconditions' && $user->rights->commande->creer) {
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }
} }
} }
else if ($action == 'setremisepercent' && $user->rights->commande->creer) { else if ($action == 'setremisepercent' && $user->rights->commande->creer) {
$result = $object->set_remise($user, GETPOST('remise_percent')); $result = $object->set_remise($user, GETPOST('remise_percent'));
} }
else if ($action == 'setremiseabsolue' && $user->rights->commande->creer) { else if ($action == 'setremiseabsolue' && $user->rights->commande->creer) {
$result = $object->set_remise_absolue($user, GETPOST('remise_absolue')); $result = $object->set_remise_absolue($user, GETPOST('remise_absolue'));
} }
// Add a new line // Add a new line
else if ($action == 'addline' && $user->rights->commande->creer) { else if ($action == 'addline' && $user->rights->commande->creer) {
$langs->load('errors'); $langs->load('errors');
$error = 0; $error = 0;
// Set if we used free entry or predefined product // Set if we used free entry or predefined product
$predef=''; $predef='';
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):''); $product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
$price_ht = GETPOST('price_ht');
if (GETPOST('prod_entry_mode') == 'free') if (GETPOST('prod_entry_mode') == 'free')
{ {
$idprod=0; $idprod=0;
$price_ht = GETPOST('price_ht');
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
} }
else else
{ {
$idprod=GETPOST('idprod', 'int'); $idprod=GETPOST('idprod', 'int');
$price_ht = '';
$tva_tx = ''; $tva_tx = '';
} }
@ -588,8 +589,8 @@ else if ($action == 'addline' && $user->rights->commande->creer) {
$pu_ttc = $prod->multiprices_ttc [$object->client->price_level]; $pu_ttc = $prod->multiprices_ttc [$object->client->price_level];
$price_min = $prod->multiprices_min [$object->client->price_level]; $price_min = $prod->multiprices_min [$object->client->price_level];
$price_base_type = $prod->multiprices_base_type [$object->client->price_level]; $price_base_type = $prod->multiprices_base_type [$object->client->price_level];
$tva_tx=$prod->multiprices_tva_tx[$object->client->price_level]; if (isset($prod->multiprices_tva_tx[$object->client->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level];
$tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level]; if (isset($prod->multiprices_recuperableonly[$object->client->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level];
} }
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{ {
@ -760,12 +761,12 @@ else if ($action == 'addline' && $user->rights->commande->creer) {
} }
} }
} }
} }
/* /*
* Mise a jour d'une ligne dans la commande * Mise a jour d'une ligne dans la commande
*/ */
else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('save') == $langs->trans('Save')) { else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('save') == $langs->trans('Save')) {
// Clean parameters // Clean parameters
$date_start=''; $date_start='';
$date_end=''; $date_end='';
@ -866,14 +867,14 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('
setEventMessage($object->error, 'errors'); setEventMessage($object->error, 'errors');
} }
} }
} }
else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('cancel') == $langs->trans('Cancel')) { else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('cancel') == $langs->trans('Cancel')) {
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
exit(); exit();
} }
else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->commande->valider) { else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->commande->valider) {
$idwarehouse = GETPOST('idwarehouse'); $idwarehouse = GETPOST('idwarehouse');
$qualified_for_stock_change=0; $qualified_for_stock_change=0;
@ -915,10 +916,10 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->co
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }
} }
} }
// Go back to draft status // Go back to draft status
else if ($action == 'confirm_modif' && $user->rights->commande->creer) { else if ($action == 'confirm_modif' && $user->rights->commande->creer) {
$idwarehouse = GETPOST('idwarehouse'); $idwarehouse = GETPOST('idwarehouse');
$qualified_for_stock_change=0; $qualified_for_stock_change=0;
@ -962,16 +963,16 @@ else if ($action == 'confirm_modif' && $user->rights->commande->creer) {
} }
} }
} }
} }
else if ($action == 'confirm_shipped' && $confirm == 'yes' && $user->rights->commande->cloturer) { else if ($action == 'confirm_shipped' && $confirm == 'yes' && $user->rights->commande->cloturer) {
$result = $object->cloture($user); $result = $object->cloture($user);
if ($result < 0) { if ($result < 0) {
setEventMessage($object->error, 'errors'); setEventMessage($object->error, 'errors');
} }
} }
else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->commande->valider) { else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->commande->valider) {
$idwarehouse = GETPOST('idwarehouse'); $idwarehouse = GETPOST('idwarehouse');
$qualified_for_stock_change=0; $qualified_for_stock_change=0;
@ -1002,13 +1003,13 @@ else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->comm
setEventMessage($object->error, 'errors'); setEventMessage($object->error, 'errors');
} }
} }
} }
/* /*
* Ordonnancement des lignes * Ordonnancement des lignes
*/ */
else if ($action == 'up' && $user->rights->commande->creer) { else if ($action == 'up' && $user->rights->commande->creer) {
$object->line_up(GETPOST('rowid')); $object->line_up(GETPOST('rowid'));
// Define output language // Define output language
@ -1028,9 +1029,9 @@ else if ($action == 'up' && $user->rights->commande->creer) {
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '#' . GETPOST('rowid')); header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '#' . GETPOST('rowid'));
exit(); exit();
} }
else if ($action == 'down' && $user->rights->commande->creer) { else if ($action == 'down' && $user->rights->commande->creer) {
$object->line_down(GETPOST('rowid')); $object->line_down(GETPOST('rowid'));
// Define output language // Define output language
@ -1049,10 +1050,10 @@ else if ($action == 'down' && $user->rights->commande->creer) {
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '#' . GETPOST('rowid')); header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '#' . GETPOST('rowid'));
exit(); exit();
} }
else if ($action == 'builddoc') // In get or post else if ($action == 'builddoc') // In get or post
{ {
/* /*
* Generate order document * Generate order document
* define into /core/modules/commande/modules_commande.php * define into /core/modules/commande/modules_commande.php
@ -1079,10 +1080,10 @@ else if ($action == 'builddoc') // In get or post
dol_print_error($db, $result); dol_print_error($db, $result);
exit(); exit();
} }
} }
// Remove file in doc form // Remove file in doc form
else if ($action == 'remove_file') { else if ($action == 'remove_file') {
if ($object->id > 0) { if ($object->id > 0) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
@ -1096,18 +1097,18 @@ else if ($action == 'remove_file') {
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
$action = ''; $action = '';
} }
} }
// Print file // Print file
else if ($action == 'print_file' and $user->rights->printipp->read) { else if ($action == 'print_file' and $user->rights->printipp->read) {
require_once DOL_DOCUMENT_ROOT . '/core/class/dolprintipp.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/dolprintipp.class.php';
$printer = new dolPrintIPP($db, $conf->global->PRINTIPP_HOST, $conf->global->PRINTIPP_PORT, $user->login, $conf->global->PRINTIPP_USER, $conf->global->PRINTIPP_PASSWORD); $printer = new dolPrintIPP($db, $conf->global->PRINTIPP_HOST, $conf->global->PRINTIPP_PORT, $user->login, $conf->global->PRINTIPP_USER, $conf->global->PRINTIPP_PASSWORD);
$printer->print_file(GETPOST('file', 'alpha'), GETPOST('printer', 'alpha')); $printer->print_file(GETPOST('file', 'alpha'), GETPOST('printer', 'alpha'));
setEventMessage($langs->trans("FileWasSentToPrinter", GETPOST('file'))); setEventMessage($langs->trans("FileWasSentToPrinter", GETPOST('file')));
$action = ''; $action = '';
} }
else if ($action == 'update_extras') { else if ($action == 'update_extras') {
// Fill array 'array_options' with data from update form // Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
@ -1132,12 +1133,12 @@ else if ($action == 'update_extras') {
if ($error) if ($error)
$action = 'edit_extras'; $action = 'edit_extras';
} }
/* /*
* Add file in email form * Add file in email form
*/ */
if (GETPOST('addfile')) { if (GETPOST('addfile')) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
// Set tmp user directory TODO Use a dedicated directory for temp mails files // Set tmp user directory TODO Use a dedicated directory for temp mails files
@ -1146,12 +1147,12 @@ if (GETPOST('addfile')) {
dol_add_file_process($upload_dir_tmp, 0, 0); dol_add_file_process($upload_dir_tmp, 0, 0);
$action = 'presend'; $action = 'presend';
} }
/* /*
* Remove file in email form * Remove file in email form
*/ */
if (GETPOST('removedfile')) { if (GETPOST('removedfile')) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
// Set tmp user directory // Set tmp user directory
@ -1161,12 +1162,12 @@ if (GETPOST('removedfile')) {
// TODO Delete only files that was uploaded from email form // TODO Delete only files that was uploaded from email form
dol_remove_file_process(GETPOST('removedfile'), 0); dol_remove_file_process(GETPOST('removedfile'), 0);
$action = 'presend'; $action = 'presend';
} }
/* /*
* Send mail * Send mail
*/ */
if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) { if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) {
$langs->load('mails'); $langs->load('mails');
if ($object->id > 0) { if ($object->id > 0) {
@ -1294,9 +1295,9 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
$mesg = '<div class="error">' . $langs->trans('ErrorFailedToReadEntity', $langs->trans("Order")) . '</div>'; $mesg = '<div class="error">' . $langs->trans('ErrorFailedToReadEntity', $langs->trans("Order")) . '</div>';
dol_syslog($langs->trans('ErrorFailedToReadEntity', $langs->trans("Order"))); dol_syslog($langs->trans('ErrorFailedToReadEntity', $langs->trans("Order")));
} }
} }
if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer) { if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer) {
if ($action == 'addcontact') { if ($action == 'addcontact') {
if ($object->id > 0) { if ($object->id > 0) {
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
@ -1336,6 +1337,7 @@ if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->righ
dol_print_error($db); dol_print_error($db);
} }
} }
}
} }
/* /*

View File

@ -164,7 +164,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$sql.= " ORDER BY dlr ASC"; $sql.= " ORDER BY dlr ASC";
// Supplier invoices // Supplier invoices
$sql2= " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.ref_supplier as ref, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,"; $sql2= " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.ref as ref, ff.ref_supplier as ref_supplier, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,";
$sql2.= " s.rowid as socid, s.nom, s.fournisseur"; $sql2.= " s.rowid as socid, s.nom, s.fournisseur";
$sql2.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff"; $sql2.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff";
$sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid"; $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid";
@ -260,12 +260,13 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
if ($obj->family == 'invoice_supplier') if ($obj->family == 'invoice_supplier')
{ {
// TODO This code is to avoid to count suppliers credit note (ff.type = 2) $showline=1;
// Ajouter gestion des avoirs fournisseurs, champ // Uncomment this line to avoid to count suppliers credit note (ff.type = 2)
if (($obj->total_ttc < 0 && $obj->type != 2) //$showline=(($obj->total_ttc < 0 && $obj->type != 2) || ($obj->total_ttc > 0 && $obj->type == 2))
|| ($obj->total_ttc > 0 && $obj->type == 2)) if ($showline)
{ {
$facturefournstatic->ref=$obj->ref; $ref=$obj->ref;
$facturefournstatic->ref=$ref;
$facturefournstatic->id=$obj->objid; $facturefournstatic->id=$obj->objid;
$facturefournstatic->type=$obj->type; $facturefournstatic->type=$obj->type;
$ref = $facturefournstatic->getNomUrl(1,''); $ref = $facturefournstatic->getNomUrl(1,'');
@ -304,7 +305,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
if ($paiement) $total_ttc = $obj->total_ttc - $paiement; if ($paiement) $total_ttc = $obj->total_ttc - $paiement;
$solde += $total_ttc; $solde += $total_ttc;
// We discard with a remain to pay to 0 // We discard lines with a remainder to pay to 0
if (price2num($total_ttc) != 0) if (price2num($total_ttc) != 0)
{ {
$var=!$var; $var=!$var;

View File

@ -111,7 +111,7 @@ if ($conf->salaries->enabled)
$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_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.datev","",$param,'width="120"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.datev","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder);
@ -144,7 +144,7 @@ if ($conf->salaries->enabled)
$i++; $i++;
} }
print '<tr class="liste_total"><td align="right" colspan="2">'.$langs->trans("Total").'</td>'; print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").'</td>';
print '<td align="right">'.price($total)."</td>"; print '<td align="right">'.price($total)."</td>";
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
@ -174,7 +174,7 @@ if ($conf->tax->enabled)
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="140px"',$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);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder);
@ -304,7 +304,7 @@ if ($conf->tax->enabled)
$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_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
@ -337,7 +337,7 @@ if ($conf->tax->enabled)
$i++; $i++;
} }
print '<tr class="liste_total"><td align="right" colspan="2">'.$langs->trans("Total").'</td>'; print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").'</td>';
print '<td align="right">'.price($total)."</td>"; print '<td align="right">'.price($total)."</td>";
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';

View File

@ -111,10 +111,12 @@ $permissionnote = $user->rights->facture->creer; // Used by the include of actio
$parameters = array('socid' => $socid); $parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once if (empty($reshook)) {
// Action clone object include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->creer) {
// Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->creer) {
if (1 == 0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) { if (1 == 0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) {
$mesgs [] = '<div class="error">' . $langs->trans("NoCloneOptionsSpecified") . '</div>'; $mesgs [] = '<div class="error">' . $langs->trans("NoCloneOptionsSpecified") . '</div>';
} else { } else {
@ -129,10 +131,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->c
} }
} }
} }
} }
// Change status of invoice // Change status of invoice
else if ($action == 'reopen' && $user->rights->facture->creer) { else if ($action == 'reopen' && $user->rights->facture->creer) {
$result = $object->fetch($id); $result = $object->fetch($id);
if ($object->statut == 2 || ($object->statut == 3 && $object->close_code != 'replaced')) { if ($object->statut == 2 || ($object->statut == 3 && $object->close_code != 'replaced')) {
$result = $object->set_unpaid($user); $result = $object->set_unpaid($user);
@ -143,10 +145,10 @@ else if ($action == 'reopen' && $user->rights->facture->creer) {
setEventMessage($object->error, 'errors'); setEventMessage($object->error, 'errors');
} }
} }
} }
// Delete invoice // Delete invoice
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture->supprimer) { else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture->supprimer) {
$result = $object->fetch($id); $result = $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
@ -167,10 +169,10 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fact
setEventMessage($object->error, 'errors'); setEventMessage($object->error, 'errors');
$action=''; $action='';
} }
} }
// Delete line // Delete line
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->facture->creer) { else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->facture->creer) {
$object->fetch($id); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
@ -199,17 +201,17 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
setEventMessage($object->error, 'errors'); setEventMessage($object->error, 'errors');
$action = ''; $action = '';
} }
} }
// Delete link of credit note to invoice // Delete link of credit note to invoice
else if ($action == 'unlinkdiscount' && $user->rights->facture->creer) { else if ($action == 'unlinkdiscount' && $user->rights->facture->creer) {
$discount = new DiscountAbsolute($db); $discount = new DiscountAbsolute($db);
$result = $discount->fetch($_GET ["discountid"]); $result = $discount->fetch($_GET ["discountid"]);
$discount->unlink_invoice(); $discount->unlink_invoice();
} }
// Validation // Validation
else if ($action == 'valid' && $user->rights->facture->creer) { else if ($action == 'valid' && $user->rights->facture->creer) {
$object->fetch($id); $object->fetch($id);
// On verifie signe facture // On verifie signe facture
@ -226,30 +228,30 @@ else if ($action == 'valid' && $user->rights->facture->creer) {
$action = ''; $action = '';
} }
} }
} }
else if ($action == 'set_thirdparty' && $user->rights->facture->creer) { else if ($action == 'set_thirdparty' && $user->rights->facture->creer) {
$object->fetch($id); $object->fetch($id);
$object->setValueFrom('fk_soc', $socid); $object->setValueFrom('fk_soc', $socid);
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id); header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id);
exit(); exit();
} }
else if ($action == 'classin' && $user->rights->facture->creer) { else if ($action == 'classin' && $user->rights->facture->creer) {
$object->fetch($id); $object->fetch($id);
$object->setProject($_POST['projectid']); $object->setProject($_POST['projectid']);
} }
else if ($action == 'setmode' && $user->rights->facture->creer) { else if ($action == 'setmode' && $user->rights->facture->creer) {
$object->fetch($id); $object->fetch($id);
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
if ($result < 0) if ($result < 0)
dol_print_error($db, $object->error); dol_print_error($db, $object->error);
} }
else if ($action == 'setinvoicedate' && $user->rights->facture->creer) else if ($action == 'setinvoicedate' && $user->rights->facture->creer)
{ {
$object->fetch($id); $object->fetch($id);
$old_date_lim_reglement = $object->date_lim_reglement; $old_date_lim_reglement = $object->date_lim_reglement;
$date = dol_mktime(12, 0, 0, $_POST['invoicedatemonth'], $_POST['invoicedateday'], $_POST['invoicedateyear']); $date = dol_mktime(12, 0, 0, $_POST['invoicedatemonth'], $_POST['invoicedateday'], $_POST['invoicedateyear']);
@ -265,9 +267,9 @@ else if ($action == 'setinvoicedate' && $user->rights->facture->creer)
if ($object->date_lim_reglement < $object->date) $object->date_lim_reglement = $object->date; if ($object->date_lim_reglement < $object->date) $object->date_lim_reglement = $object->date;
$result = $object->update($user); $result = $object->update($user);
if ($result < 0) dol_print_error($db, $object->error); if ($result < 0) dol_print_error($db, $object->error);
} }
else if ($action == 'setconditions' && $user->rights->facture->creer) { else if ($action == 'setconditions' && $user->rights->facture->creer) {
$object->fetch($id); $object->fetch($id);
$object->cond_reglement_code = 0; // To clean property $object->cond_reglement_code = 0; // To clean property
$object->cond_reglement_id = 0; // To clean property $object->cond_reglement_id = 0; // To clean property
@ -280,9 +282,9 @@ else if ($action == 'setconditions' && $user->rights->facture->creer) {
if ($object->date_lim_reglement < $object->date) $object->date_lim_reglement = $object->date; if ($object->date_lim_reglement < $object->date) $object->date_lim_reglement = $object->date;
$result = $object->update($user); $result = $object->update($user);
if ($result < 0) dol_print_error($db, $object->error); if ($result < 0) dol_print_error($db, $object->error);
} }
else if ($action == 'setpaymentterm' && $user->rights->facture->creer) { else if ($action == 'setpaymentterm' && $user->rights->facture->creer) {
$object->fetch($id); $object->fetch($id);
$object->date_lim_reglement = dol_mktime(12, 0, 0, $_POST['paymenttermmonth'], $_POST['paymenttermday'], $_POST['paymenttermyear']); $object->date_lim_reglement = dol_mktime(12, 0, 0, $_POST['paymenttermmonth'], $_POST['paymenttermday'], $_POST['paymenttermyear']);
if ($object->date_lim_reglement < $object->date) { if ($object->date_lim_reglement < $object->date) {
@ -292,23 +294,23 @@ else if ($action == 'setpaymentterm' && $user->rights->facture->creer) {
$result = $object->update($user); $result = $object->update($user);
if ($result < 0) if ($result < 0)
dol_print_error($db, $object->error); dol_print_error($db, $object->error);
} }
else if ($action == 'setrevenuestamp' && $user->rights->facture->creer) { else if ($action == 'setrevenuestamp' && $user->rights->facture->creer) {
$object->fetch($id); $object->fetch($id);
$object->revenuestamp = GETPOST('revenuestamp'); $object->revenuestamp = GETPOST('revenuestamp');
$result = $object->update($user); $result = $object->update($user);
$object->update_price(1); $object->update_price(1);
if ($result < 0) if ($result < 0)
dol_print_error($db, $object->error); dol_print_error($db, $object->error);
} }
else if ($action == 'setremisepercent' && $user->rights->facture->creer) { else if ($action == 'setremisepercent' && $user->rights->facture->creer) {
$object->fetch($id); $object->fetch($id);
$result = $object->set_remise($user, $_POST['remise_percent']); $result = $object->set_remise($user, $_POST['remise_percent']);
} }
else if ($action == "setabsolutediscount" && $user->rights->facture->creer) { else if ($action == "setabsolutediscount" && $user->rights->facture->creer) {
// POST[remise_id] ou POST[remise_id_for_payment] // POST[remise_id] ou POST[remise_id_for_payment]
if (! empty($_POST["remise_id"])) { if (! empty($_POST["remise_id"])) {
$ret = $object->fetch($id); $ret = $object->fetch($id);
@ -331,16 +333,16 @@ else if ($action == "setabsolutediscount" && $user->rights->facture->creer) {
$mesgs [] = '<div class="error">' . $discount->error . '</div>'; $mesgs [] = '<div class="error">' . $discount->error . '</div>';
} }
} }
} }
else if ($action == 'set_ref_client' && $user->rights->facture->creer) { else if ($action == 'set_ref_client' && $user->rights->facture->creer) {
$object->fetch($id); $object->fetch($id);
$object->set_ref_client($_POST['ref_client']); $object->set_ref_client($_POST['ref_client']);
} }
// Classify to validated // Classify to validated
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->facture->valider) else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->facture->valider)
{ {
$idwarehouse = GETPOST('idwarehouse'); $idwarehouse = GETPOST('idwarehouse');
$object->fetch($id); $object->fetch($id);
@ -403,10 +405,10 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
else setEventMessage($object->error, 'errors'); else setEventMessage($object->error, 'errors');
} }
} }
} }
// Go back to draft status (unvalidate) // Go back to draft status (unvalidate)
else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate)) { else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate)) {
$idwarehouse = GETPOST('idwarehouse'); $idwarehouse = GETPOST('idwarehouse');
$object->fetch($id); $object->fetch($id);
@ -475,15 +477,15 @@ else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_
} }
} }
} }
} }
// Classify "paid" // Classify "paid"
else if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->facture->paiement) { else if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->facture->paiement) {
$object->fetch($id); $object->fetch($id);
$result = $object->set_paid($user); $result = $object->set_paid($user);
if ($result<0) setEventMessage($object->error,'errors'); if ($result<0) setEventMessage($object->error,'errors');
} // Classif "paid partialy" } // Classif "paid partialy"
else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->rights->facture->paiement) { else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->rights->facture->paiement) {
$object->fetch($id); $object->fetch($id);
$close_code = $_POST["close_code"]; $close_code = $_POST["close_code"];
$close_note = $_POST["close_note"]; $close_note = $_POST["close_note"];
@ -493,8 +495,8 @@ else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->righ
} else { } else {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), 'errors');
} }
} // Classify "abandoned" } // Classify "abandoned"
else if ($action == 'confirm_canceled' && $confirm == 'yes') { else if ($action == 'confirm_canceled' && $confirm == 'yes') {
$object->fetch($id); $object->fetch($id);
$close_code = $_POST["close_code"]; $close_code = $_POST["close_code"];
$close_note = $_POST["close_note"]; $close_note = $_POST["close_note"];
@ -504,11 +506,11 @@ else if ($action == 'confirm_canceled' && $confirm == 'yes') {
} else { } else {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), 'errors');
} }
} }
// Convertir en reduc // Convertir en reduc
else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->rights->facture->creer) else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->rights->facture->creer)
{ {
$object->fetch($id); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
//$object->fetch_lines(); // Already done into fetch //$object->fetch_lines(); // Already done into fetch
@ -582,13 +584,13 @@ else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->righ
$db->rollback(); $db->rollback();
} }
} }
} }
/* /*
* Insert new invoice in database * Insert new invoice in database
*/ */
else if ($action == 'add' && $user->rights->facture->creer) else if ($action == 'add' && $user->rights->facture->creer)
{ {
if ($socid > 0) $object->socid = GETPOST('socid', 'int'); if ($socid > 0) $object->socid = GETPOST('socid', 'int');
$db->begin(); $db->begin();
@ -1053,27 +1055,26 @@ else if ($action == 'add' && $user->rights->facture->creer)
$_GET ["originid"] = $_POST["originid"]; $_GET ["originid"] = $_POST["originid"];
$mesgs [] = '<div class="error">' . $object->error . '</div>'; $mesgs [] = '<div class="error">' . $object->error . '</div>';
} }
} }
// Add a new line // Add a new line
else if ($action == 'addline' && $user->rights->facture->creer) else if ($action == 'addline' && $user->rights->facture->creer)
{ {
$langs->load('errors'); $langs->load('errors');
$error = 0; $error = 0;
// Set if we used free entry or predefined product // Set if we used free entry or predefined product
$predef=''; $predef='';
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):''); $product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
$price_ht = GETPOST('price_ht');
if (GETPOST('prod_entry_mode') == 'free') if (GETPOST('prod_entry_mode') == 'free')
{ {
$idprod=0; $idprod=0;
$price_ht = GETPOST('price_ht');
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
} }
else else
{ {
$idprod=GETPOST('idprod', 'int'); $idprod=GETPOST('idprod', 'int');
$price_ht = '';
$tva_tx = ''; $tva_tx = '';
} }
@ -1152,8 +1153,8 @@ else if ($action == 'addline' && $user->rights->facture->creer)
$pu_ttc = $prod->multiprices_ttc[$object->client->price_level]; $pu_ttc = $prod->multiprices_ttc[$object->client->price_level];
$price_min = $prod->multiprices_min[$object->client->price_level]; $price_min = $prod->multiprices_min[$object->client->price_level];
$price_base_type = $prod->multiprices_base_type[$object->client->price_level]; $price_base_type = $prod->multiprices_base_type[$object->client->price_level];
//$tva_tx=$prod->multiprices_tva_tx[$object->client->price_level]; if (isset($prod->multiprices_tva_tx[$object->client->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level];
//$tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level]; if (isset($prod->multiprices_recuperableonly[$object->client->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level];
} }
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{ {
@ -1323,9 +1324,9 @@ else if ($action == 'addline' && $user->rights->facture->creer)
$action = ''; $action = '';
} }
} }
} }
elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('cancel')) { elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('cancel')) {
if (! $object->fetch($id) > 0) if (! $object->fetch($id) > 0)
dol_print_error($db); dol_print_error($db);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
@ -1433,15 +1434,15 @@ elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('
setEventMessage($object->error, 'errors'); setEventMessage($object->error, 'errors');
} }
} }
} }
else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['cancel'] == $langs->trans('Cancel')) { else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['cancel'] == $langs->trans('Cancel')) {
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id); // Pour reaffichage de la fiche en cours d'edition header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id); // Pour reaffichage de la fiche en cours d'edition
exit(); exit();
} }
// Modify line position (up) // Modify line position (up)
else if ($action == 'up' && $user->rights->facture->creer) { else if ($action == 'up' && $user->rights->facture->creer) {
$object->fetch($id); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$object->line_up($_GET ['rowid']); $object->line_up($_GET ['rowid']);
@ -1462,8 +1463,8 @@ else if ($action == 'up' && $user->rights->facture->creer) {
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '#' . $_GET ['rowid']); header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '#' . $_GET ['rowid']);
exit(); exit();
} // Modify line position (down) } // Modify line position (down)
else if ($action == 'down' && $user->rights->facture->creer) { else if ($action == 'down' && $user->rights->facture->creer) {
$object->fetch($id); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$object->line_down($_GET ['rowid']); $object->line_down($_GET ['rowid']);
@ -1484,19 +1485,19 @@ else if ($action == 'down' && $user->rights->facture->creer) {
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '#' . $_GET ['rowid']); header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '#' . $_GET ['rowid']);
exit(); exit();
} }
// Link invoice to order // Link invoice to order
if (GETPOST('linkedOrder')) { if (GETPOST('linkedOrder')) {
$object->fetch($id); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$result = $object->add_object_linked('commande', GETPOST('linkedOrder')); $result = $object->add_object_linked('commande', GETPOST('linkedOrder'));
} }
/* /*
* Add file in email form * Add file in email form
*/ */
if (GETPOST('addfile')) { if (GETPOST('addfile')) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
// Set tmp user directory // Set tmp user directory
@ -1505,12 +1506,12 @@ if (GETPOST('addfile')) {
dol_add_file_process($upload_dir_tmp, 0, 0); dol_add_file_process($upload_dir_tmp, 0, 0);
$action = 'presend'; $action = 'presend';
} }
/* /*
* Remove file in email form * Remove file in email form
*/ */
if (! empty($_POST['removedfile'])) { if (! empty($_POST['removedfile'])) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
// Set tmp user directory // Set tmp user directory
@ -1520,12 +1521,12 @@ if (! empty($_POST['removedfile'])) {
// TODO Delete only files that was uploaded from email form // TODO Delete only files that was uploaded from email form
dol_remove_file_process($_POST['removedfile'], 0); dol_remove_file_process($_POST['removedfile'], 0);
$action = 'presend'; $action = 'presend';
} }
/* /*
* Send mail * Send mail
*/ */
if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel']) { if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel']) {
$langs->load('mails'); $langs->load('mails');
$actiontypecode = ''; $actiontypecode = '';
@ -1676,13 +1677,13 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
} }
$action = 'presend'; $action = 'presend';
} }
/* /*
* Generate document * Generate document
*/ */
else if ($action == 'builddoc') // En get ou en post else if ($action == 'builddoc') // En get ou en post
{ {
$object->fetch($id); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
@ -1708,10 +1709,10 @@ else if ($action == 'builddoc') // En get ou en post
dol_print_error($db, $result); dol_print_error($db, $result);
exit(); exit();
} }
} }
// Remove file in doc form // Remove file in doc form
else if ($action == 'remove_file') { else if ($action == 'remove_file') {
if ($object->fetch($id)) { if ($object->fetch($id)) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
@ -1727,18 +1728,18 @@ else if ($action == 'remove_file') {
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
$action = ''; $action = '';
} }
} }
// Print file // Print file
else if ($action == 'print_file' and $user->rights->printipp->read) { else if ($action == 'print_file' and $user->rights->printipp->read) {
require_once DOL_DOCUMENT_ROOT . '/core/class/dolprintipp.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/dolprintipp.class.php';
$printer = new dolPrintIPP($db, $conf->global->PRINTIPP_HOST, $conf->global->PRINTIPP_PORT, $user->login, $conf->global->PRINTIPP_USER, $conf->global->PRINTIPP_PASSWORD); $printer = new dolPrintIPP($db, $conf->global->PRINTIPP_HOST, $conf->global->PRINTIPP_PORT, $user->login, $conf->global->PRINTIPP_USER, $conf->global->PRINTIPP_PASSWORD);
$printer->print_file(GETPOST('file', 'alpha'), GETPOST('printer', 'alpha')); $printer->print_file(GETPOST('file', 'alpha'), GETPOST('printer', 'alpha'));
setEventMessage($langs->trans("FileWasSentToPrinter", GETPOST('file'))); setEventMessage($langs->trans("FileWasSentToPrinter", GETPOST('file')));
$action = ''; $action = '';
} }
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture->creer) { if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture->creer) {
if ($action == 'addcontact') { if ($action == 'addcontact') {
$result = $object->fetch($id); $result = $object->fetch($id);
@ -1781,9 +1782,9 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture-
dol_print_error($db); dol_print_error($db);
} }
} }
} }
if ($action == 'update_extras') { if ($action == 'update_extras') {
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
@ -1808,6 +1809,7 @@ if ($action == 'update_extras') {
if ($error) if ($error)
$action = 'edit_extras'; $action = 'edit_extras';
}
} }
@ -1885,6 +1887,8 @@ if ($action == 'create')
$ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : ''); $ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : '');
$ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : ''); $ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : '');
// only if socid not filled else it's allready done upper
if (empty($socid))
$soc = $objectsrc->thirdparty; $soc = $objectsrc->thirdparty;
$cond_reglement_id = (! empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(! empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1)); $cond_reglement_id = (! empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(! empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));

View File

@ -420,4 +420,3 @@ elseif (file_exists($fileimagebis))
$db->close(); $db->close();
llxFooter(); llxFooter();
?>

View File

@ -8,7 +8,7 @@
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr> * Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
@ -391,7 +391,7 @@ class Facture extends CommonInvoice
$this->lines[$i]->fk_fournprice, $this->lines[$i]->fk_fournprice,
$this->lines[$i]->pa_ht, $this->lines[$i]->pa_ht,
$this->lines[$i]->label, $this->lines[$i]->label,
'' $this->lines[$i]->array_options
); );
if ($result < 0) if ($result < 0)
{ {
@ -593,6 +593,10 @@ class Facture extends CommonInvoice
$this->db->begin(); $this->db->begin();
// get extrafields so they will be clone
foreach($this->lines as $line)
$line->fetch_optionals($line->rowid);
// Load source object // Load source object
$objFrom = dol_clone($this); $objFrom = dol_clone($this);
@ -721,6 +725,11 @@ class Facture extends CommonInvoice
$marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht); $marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht);
$line->pa_ht = $marginInfos[0]; $line->pa_ht = $marginInfos[0];
// get extrafields from original line
$object->lines[$i]->fetch_optionals($object->lines[$i]->rowid);
foreach($object->lines[$i]->array_options as $options_key => $value)
$line->array_options[$options_key] = $value;
$this->lines[$i] = $line; $this->lines[$i] = $line;
} }
@ -740,6 +749,11 @@ class Facture extends CommonInvoice
$this->origin = $object->element; $this->origin = $object->element;
$this->origin_id = $object->id; $this->origin_id = $object->id;
// get extrafields from original line
$object->fetch_optionals($object->id);
foreach($object->array_options as $options_key => $value)
$this->array_options[$options_key] = $value;
// Possibility to add external linked objects with hooks // Possibility to add external linked objects with hooks
$this->linked_objects[$this->origin] = $this->origin_id; $this->linked_objects[$this->origin] = $this->origin_id;
if (! empty($object->other_linked_objects) && is_array($object->other_linked_objects)) if (! empty($object->other_linked_objects) && is_array($object->other_linked_objects))
@ -2199,7 +2213,15 @@ class Facture extends CommonInvoice
$this->line->skip_update_total = $skip_update_total; $this->line->skip_update_total = $skip_update_total;
// infos marge // infos marge
if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
// POS or external module, take lowest buying price
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productFournisseur = new ProductFournisseur($this->db);
$productFournisseur->find_min_price_product_fournisseur($fk_product);
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
} else {
$this->line->fk_fournprice = $fk_fournprice; $this->line->fk_fournprice = $fk_fournprice;
}
$this->line->pa_ht = $pa_ht; $this->line->pa_ht = $pa_ht;
if (is_array($array_option) && count($array_option)>0) { if (is_array($array_option) && count($array_option)>0) {
@ -2482,14 +2504,20 @@ class Facture extends CommonInvoice
else if ($conf->global->FACTURE_ADDON=='terre') $conf->global->FACTURE_ADDON='mod_facture_terre'; else if ($conf->global->FACTURE_ADDON=='terre') $conf->global->FACTURE_ADDON='mod_facture_terre';
else if ($conf->global->FACTURE_ADDON=='mercure') $conf->global->FACTURE_ADDON='mod_facture_mercure'; else if ($conf->global->FACTURE_ADDON=='mercure') $conf->global->FACTURE_ADDON='mod_facture_mercure';
if (! empty($conf->global->FACTURE_ADDON))
{
$mybool=false; $mybool=false;
$file = $conf->global->FACTURE_ADDON.".php"; $file = $conf->global->FACTURE_ADDON.".php";
$classname = $conf->global->FACTURE_ADDON; $classname = $conf->global->FACTURE_ADDON;
// Include file with class // Include file with class
foreach ($conf->file->dol_document_root as $dirroot) $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
{
$dir = $dirroot."/core/modules/facture/"; foreach ($dirmodels as $reldir) {
$dir = dol_buildpath($reldir."core/modules/facture/");
// Load file with numbering class (if found) // Load file with numbering class (if found)
$mybool|=@include_once $dir.$file; $mybool|=@include_once $dir.$file;
} }
@ -2508,7 +2536,6 @@ class Facture extends CommonInvoice
$mybool|=@include_once $dir.$file; $mybool|=@include_once $dir.$file;
} }
} }
//print "xx".$mybool.$dir.$file."-".$classname;
if (! $mybool) if (! $mybool)
{ {
@ -2518,7 +2545,7 @@ class Facture extends CommonInvoice
$obj = new $classname(); $obj = new $classname();
$numref = ""; $numref = "";
$numref = $obj->getNumRef($soc,$this,$mode); $numref = $obj->getNextValue($soc,$this,$mode);
if ($numref != "") if ($numref != "")
{ {
@ -2526,8 +2553,15 @@ class Facture extends CommonInvoice
} }
else else
{ {
//dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error); dol_print_error($db,"Facture::getNextNumRef ".$obj->error);
return false; return "";
}
}
else
{
$langs->load("errors");
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
return "";
} }
} }
@ -3464,6 +3498,14 @@ class FactureLigne extends CommonInvoiceLine
} }
} }
// POS or by external module, take lowest buying price
if (!empty($this->fk_product) && empty($this->fk_fournprice) && empty($this->pa_ht)) {
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productFournisseur = new ProductFournisseur($this->db);
$productFournisseur->find_min_price_product_fournisseur($this->fk_product);
$this->fk_fournprice = $productFournisseur->product_fourn_price_id;
}
$this->db->begin(); $this->db->begin();
// Insertion dans base de la ligne // Insertion dans base de la ligne

View File

@ -535,7 +535,7 @@ if ($resql)
print_liste_field_titre($langs->trans("Taxes"),$_SERVER["PHP_SELF"],"f.tva","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Taxes"),$_SERVER["PHP_SELF"],"f.tva","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Rest"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Rest"),$_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","",$param,'align="right"',$sortfield,$sortorder);
if (empty($mode)) if (empty($mode))
{ {

View File

@ -71,11 +71,13 @@ $hookmanager->initHooks(array('paiementcard'));
$parameters=array('socid'=>$socid); $parameters=array('socid'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
/* if (empty($reshook)) {
/*
* Actions * Actions
*/ */
if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes')) if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes'))
{ {
$error = 0; $error = 0;
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
@ -145,25 +147,25 @@ if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='ye
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('Date')), 'errors'); setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('Date')), 'errors');
$error++; $error++;
} }
} }
/* /*
* Action add_paiement * Action add_paiement
*/ */
if ($action == 'add_paiement') if ($action == 'add_paiement')
{ {
if ($error) if ($error)
{ {
$action = 'create'; $action = 'create';
} }
// Le reste propre a cette action s'affiche en bas de page. // Le reste propre a cette action s'affiche en bas de page.
} }
/* /*
* Action confirm_paiement * Action confirm_paiement
*/ */
if ($action == 'confirm_paiement' && $confirm == 'yes') if ($action == 'confirm_paiement' && $confirm == 'yes')
{ {
$error=0; $error=0;
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
@ -244,9 +246,9 @@ if ($action == 'confirm_paiement' && $confirm == 'yes')
{ {
$db->rollback(); $db->rollback();
} }
}
} }
/* /*
* View * View
*/ */

View File

@ -1,8 +1,9 @@
<?php <?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -164,7 +165,7 @@ class BonPrelevement extends CommonObject
/** /**
* Add line to withdrawal * Add line to withdrawal
* *
* @param int &$line_id id line to add * @param int $line_id id line to add
* @param int $client_id id invoice customer * @param int $client_id id invoice customer
* @param string $client_nom name of cliente * @param string $client_nom name of cliente
* @param int $amount amount of invoice * @param int $amount amount of invoice
@ -889,12 +890,13 @@ class BonPrelevement extends CommonObject
*/ */
if (!$error) if (!$error)
{ {
$ref = "T".substr($year,-2).$month; $ref = substr($year,-2).$month;
$sql = "SELECT count(*)"; $sql = "SELECT substring(ref from char_length(ref) - 1)";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons";
$sql.= " WHERE ref LIKE '".$ref."%'"; $sql.= " WHERE ref LIKE '%".$ref."%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$sql.= " ORDER BY ref DESC LIMIT 1";
dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG); dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -909,7 +911,7 @@ class BonPrelevement extends CommonObject
dol_syslog("Erreur recherche reference"); dol_syslog("Erreur recherche reference");
} }
$ref = $ref . substr("00".($row[0]+1), -2); $ref = "T".$ref.str_pad(dol_substr("00".intval($row[0])+1),2,"0",STR_PAD_LEFT);
$filebonprev = $ref; $filebonprev = $ref;
@ -1411,7 +1413,7 @@ class BonPrelevement extends CommonObject
fputs($this->file, ' </CstmrDrctDbtInitn>'.$CrLf); fputs($this->file, ' </CstmrDrctDbtInitn>'.$CrLf);
fputs($this->file, '</Document>'.$CrLf); fputs($this->file, '</Document>'.$CrLf);
$sql = "SELECT pl.amount"; /*$sql = "SELECT pl.amount";
$sql.= " FROM"; $sql.= " FROM";
$sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; $sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
$sql.= " ".MAIN_DB_PREFIX."facture as f,"; $sql.= " ".MAIN_DB_PREFIX."facture as f,";
@ -1437,7 +1439,7 @@ class BonPrelevement extends CommonObject
else else
{ {
$result = -2; $result = -2;
} }*/
} }

View File

@ -300,7 +300,7 @@ if ($id > 0)
* Payments * Payments
*/ */
$sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,"; $sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,";
$sql.= "c.libelle as paiement_type"; $sql.= "c.code as type_code,c.libelle as paiement_type";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p"; $sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
$sql.= ", ".MAIN_DB_PREFIX."c_paiement as c "; $sql.= ", ".MAIN_DB_PREFIX."c_paiement as c ";
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
@ -333,7 +333,8 @@ if ($id > 0)
print "<tr ".$bc[$var]."><td>"; print "<tr ".$bc[$var]."><td>";
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.'</a></td>'; print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.'</a></td>';
print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n"; print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
print "<td>".$objp->paiement_type.' '.$objp->num_paiement."</td>\n"; $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type;
print "<td>".$labeltype.' '.$objp->num_paiement."</td>\n";
print '<td align="right">'.price($objp->amount)."</td><td>&nbsp;".$langs->trans("Currency".$conf->currency)."</td>\n"; print '<td align="right">'.price($objp->amount)."</td><td>&nbsp;".$langs->trans("Currency".$conf->currency)."</td>\n";
print "</tr>"; print "</tr>";
$totalpaye += $objp->amount; $totalpaye += $objp->amount;

View File

@ -94,7 +94,7 @@ abstract class ActionsContactCardCommon
/** /**
* Load data control * Load data control
* *
* @param string &$action Type of action * @param string $action Type of action
* @param int $id Id of object * @param int $id Id of object
* @return void * @return void
*/ */
@ -228,7 +228,7 @@ abstract class ActionsContactCardCommon
/** /**
* Set content of ->tpl array, to use into template * Set content of ->tpl array, to use into template
* *
* @param string &$action Type of action * @param string $action Type of action
* @param int $id Id * @param int $id Id
* @return string HTML output * @return string HTML output
*/ */

View File

@ -75,7 +75,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
/** /**
* Assign custom values for canvas * Assign custom values for canvas
* *
* @param string &$action Type of action * @param string $action Type of action
* @param int $id Id * @param int $id Id
* @return void * @return void
*/ */

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Destailleur Laurent <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Destailleur Laurent <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
@ -41,6 +41,7 @@ class Contrat extends CommonObject
public $table_element='contrat'; public $table_element='contrat';
public $table_element_line='contratdet'; public $table_element_line='contratdet';
public $fk_element='fk_contrat'; public $fk_element='fk_contrat';
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; var $ref;
@ -91,23 +92,31 @@ class Contrat extends CommonObject
global $db, $langs, $conf; global $db, $langs, $conf;
$langs->load("contracts"); $langs->load("contracts");
$dir = DOL_DOCUMENT_ROOT . "/core/modules/contract"; if (!empty($conf->global->CONTRACT_ADDON))
if (empty($conf->global->CONTRACT_ADDON))
{ {
$conf->global->CONTRACT_ADDON='mod_contract_serpis'; $mybool = false;
}
$file = $conf->global->CONTRACT_ADDON.".php"; $file = $conf->global->CONTRACT_ADDON.".php";
// Chargement de la classe de numerotation
$classname = $conf->global->CONTRACT_ADDON; $classname = $conf->global->CONTRACT_ADDON;
$result=include_once $dir.'/'.$file; // Include file with class
if ($result) $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
{
$obj = new $classname();
foreach ($dirmodels as $reldir) {
$dir = dol_buildpath($reldir."core/modules/contract/");
// Load file with numbering class (if found)
$mybool|=@include_once $dir.$file;
}
if (! $mybool)
{
dol_print_error('',"Failed to include file ".$file);
return '';
}
$obj = new $classname();
$numref = ""; $numref = "";
$numref = $obj->getNextValue($soc,$this); $numref = $obj->getNextValue($soc,$this);
@ -117,13 +126,15 @@ class Contrat extends CommonObject
} }
else else
{ {
$this->error = $obj->error;
dol_print_error($db,get_class($this)."::getNextValue ".$obj->error); dol_print_error($db,get_class($this)."::getNextValue ".$obj->error);
return ""; return "";
} }
} }
else else
{ {
print $langs->trans("Error")." ".$langs->trans("Error_CONTRACT_ADDON_NotDefined"); $langs->load("errors");
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
return ""; return "";
} }
} }

View File

@ -229,5 +229,3 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
} }
} }
?>

View File

@ -43,5 +43,3 @@ else if ($action == 'setnote_private' && ! empty($permissionnote) && ! GETPOST('
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private'); $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private');
if ($result < 0) setEventMessage($object->error,'errors'); if ($result < 0) setEventMessage($object->error,'errors');
} }
?>

View File

@ -114,7 +114,7 @@ class box_activity extends ModeleBoxes
$billurl="viewstatut=2&paye=1&year=".$objp->annee; $billurl="viewstatut=2&paye=1&year=".$objp->annee;
$this->info_box_contents[$i][2] = array('td' => 'align="right"', $this->info_box_contents[$i][2] = array('td' => 'align="right"',
'text' => $objp->nb, 'url' => DOL_URL_ROOT."/compta/facture/liste.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills" 'text' => $objp->nb, 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills"
); );
$this->info_box_contents[$i][3] = array('td' => 'align="right"', $this->info_box_contents[$i][3] = array('td' => 'align="right"',

View File

@ -37,12 +37,28 @@ class box_clients extends ModeleBoxes
var $depends = array("societe"); var $depends = array("societe");
var $db; var $db;
var $param; var $enabled = 1;
var $info_box_head = array(); var $info_box_head = array();
var $info_box_contents = array(); var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param='')
{
global $conf, $user;
$this->db = $db;
// disable box for such cases
if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled=0; // disabled by this option
}
/** /**
* Load data for box to show them later * Load data for box to show them later
* *

View File

@ -39,11 +39,28 @@ class box_prospect extends ModeleBoxes
var $depends = array("societe"); var $depends = array("societe");
var $db; var $db;
var $enabled = 1;
var $info_box_head = array(); var $info_box_head = array();
var $info_box_contents = array(); var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param='')
{
global $conf, $user;
$this->db = $db;
// disable box for such cases
if (! empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $this->enabled=0; // disabled by this option
}
/** /**
* Load data into info_box_contents array to show array later. * Load data into info_box_contents array to show array later.
* *

View File

@ -125,7 +125,7 @@ class Canvas
/** /**
* Shared method for canvas to assign values for templates * Shared method for canvas to assign values for templates
* *
* @param string &$action Action string * @param string $action Action string
* @param int $id Object id (if ref not provided) * @param int $id Object id (if ref not provided)
* @param string $ref Object ref (if id not provided) * @param string $ref Object ref (if id not provided)
* @return void * @return void
@ -181,7 +181,7 @@ class Canvas
/** /**
* Shared method for canvas to execute actions * Shared method for canvas to execute actions
* *
* @param string &$action Action string * @param string $action Action string
* @param int $id Object id * @param int $id Object id
* @return mixed Return return code of doActions of canvas * @return mixed Return return code of doActions of canvas
* @deprecated This function is called if you add a doActions class inside your canvas. Try to not * @deprecated This function is called if you add a doActions class inside your canvas. Try to not

View File

@ -3,7 +3,7 @@
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2011-2014 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2014 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
@ -609,6 +609,8 @@ abstract class CommonObject
if (empty($this->socid) && empty($this->fk_soc)) return 0; if (empty($this->socid) && empty($this->fk_soc)) return 0;
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
$thirdparty = new Societe($this->db); $thirdparty = new Societe($this->db);
$result=$thirdparty->fetch(isset($this->socid)?$this->socid:$this->fk_soc); $result=$thirdparty->fetch(isset($this->socid)?$this->socid:$this->fk_soc);
$this->client = $thirdparty; // deprecated $this->client = $thirdparty; // deprecated
@ -2120,11 +2122,11 @@ abstract class CommonObject
foreach ($tab as $key => $value) foreach ($tab as $key => $value)
{ {
// Test fetch_array ! is_int($key) because fetch_array seult is a mix table with Key as alpha and Key as int (depend db engine) // Test fetch_array ! is_int($key) because fetch_array result is a mix table with some key as alpha and some key as int (depend db engine)
if ($key != 'rowid' && $key != 'tms' && $key != 'fk_member' && ! is_int($key)) if ($key != 'rowid' && $key != 'tms' && ! is_int($key))
{ {
// we can add this attribute to adherent object // we can add this attribute to object properties
$this->array_options["options_$key"]=$value; $this->array_options["options_".$key]=$value;
} }
} }
} }
@ -2218,10 +2220,10 @@ abstract class CommonObject
$this->array_options[$key] = price2num($this->array_options[$key]); $this->array_options[$key] = price2num($this->array_options[$key]);
break; break;
case 'date': case 'date':
$this->array_options[$key]=$this->db->idate($this->array_options[$key]); if (is_numeric($this->array_options[$key])) $this->array_options[$key]=$this->db->idate($this->array_options[$key]);
break; break;
case 'datetime': case 'datetime':
$this->array_options[$key]=$this->db->idate($this->array_options[$key]); if (is_numeric($this->array_options[$key])) $this->array_options[$key]=$this->db->idate($this->array_options[$key]);
break; break;
} }
} }
@ -2235,7 +2237,7 @@ abstract class CommonObject
{ {
$attributeKey = substr($key,8); // Remove 'options_' prefix $attributeKey = substr($key,8); // Remove 'options_' prefix
// Add field of attribut // Add field of attribut
if ($extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate if (isset($extrafields->attribute_type[$attributeKey]) && $extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate
$sql.=",".$attributeKey; $sql.=",".$attributeKey;
} }
$sql .= ") VALUES (".$this->id; $sql .= ") VALUES (".$this->id;
@ -2243,7 +2245,7 @@ abstract class CommonObject
{ {
$attributeKey = substr($key,8); // Remove 'options_' prefix $attributeKey = substr($key,8); // Remove 'options_' prefix
// Add field o fattribut // Add field o fattribut
if($extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate) if(isset($extrafields->attribute_type[$attributeKey]) && $extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate)
{ {
if ($this->array_options[$key] != '') if ($this->array_options[$key] != '')
{ {

View File

@ -201,4 +201,3 @@ class dolprintIPP
return $ipp->printer_attributes; return $ipp->printer_attributes;
} }
} }
?>

View File

@ -154,7 +154,7 @@ class ExtraFields
{ {
$table=$elementtype.'_extrafields'; $table=$elementtype.'_extrafields';
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9_]*$/",$attrname) && ! is_numeric($attrname))
{ {
if ($type=='boolean') { if ($type=='boolean') {
$typedb='int'; $typedb='int';
@ -226,8 +226,7 @@ class ExtraFields
// Clean parameters // Clean parameters
if (empty($pos)) $pos=0; if (empty($pos)) $pos=0;
if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname) && ! is_numeric($attrname))
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
{ {
if(is_array($param) and count($param) > 0) if(is_array($param) and count($param) > 0)
{ {
@ -744,15 +743,17 @@ class ExtraFields
if (strpos($InfoFieldList[4], 'extra')!==false) if (strpos($InfoFieldList[4], 'extra')!==false)
{ {
$sql.= ' as main, '.MAIN_DB_PREFIX .$InfoFieldList[0].'_extrafields as extra'; $sql.= ' as main, '.MAIN_DB_PREFIX .$InfoFieldList[0].'_extrafields as extra';
$sqlwhere.= ' AND extra.fk_object=main.'.$InfoFieldList[2]. ' AND '.$InfoFieldList[4]; $sqlwhere.= ' WHERE extra.fk_object=main.'.$InfoFieldList[2]. ' AND '.$InfoFieldList[4];
} }
else else
{ {
$sqlwhere.= ' AND '.$InfoFieldList[4]; $sqlwhere.= ' WHERE '.$InfoFieldList[4];
} }
}else {
$sqlwhere.= ' WHERE 1';
} }
if (in_array($InfoFieldList[0],array('tablewithentity'))) $sqlwhere.= ' AND entity = '.$conf->entity; // Some tables may have field, some other not. For the moment we disable it. if (in_array($InfoFieldList[0],array('tablewithentity'))) $sqlwhere.= ' AND entity = '.$conf->entity; // Some tables may have field, some other not. For the moment we disable it.
$sql.=preg_replace('/^ AND /','',$sqlwhere); //$sql.=preg_replace('/^ AND /','',$sqlwhere);
//print $sql; //print $sql;
dol_syslog(get_class($this).'::showInputField type=sellist sql='.$sql); dol_syslog(get_class($this).'::showInputField type=sellist sql='.$sql);
@ -980,7 +981,10 @@ class ExtraFields
{ {
foreach ($fields_label as $field_toshow) foreach ($fields_label as $field_toshow)
{ {
$translabel='';
if (!empty($obj->$field_toshow)) {
$translabel=$langs->trans($obj->$field_toshow); $translabel=$langs->trans($obj->$field_toshow);
}
if ($translabel!=$field_toshow) { if ($translabel!=$field_toshow) {
$value.=dol_trunc($translabel,18).' '; $value.=dol_trunc($translabel,18).' ';
}else { }else {
@ -990,7 +994,10 @@ class ExtraFields
} }
else else
{ {
$translabel='';
if (!empty($obj->$InfoFieldList[1])) {
$translabel=$langs->trans($obj->$InfoFieldList[1]); $translabel=$langs->trans($obj->$InfoFieldList[1]);
}
if ($translabel!=$obj->$InfoFieldList[1]) { if ($translabel!=$obj->$InfoFieldList[1]) {
$value=dol_trunc($translabel,18); $value=dol_trunc($translabel,18);
}else { }else {
@ -1041,7 +1048,7 @@ class ExtraFields
* Fill array_options property of object by extrafields value (using for data sent by forms) * Fill array_options property of object by extrafields value (using for data sent by forms)
* *
* @param array $extralabels $array of extrafields * @param array $extralabels $array of extrafields
* @param object &$object Object * @param object $object Object
* @param string $onlykey Only following key is filled * @param string $onlykey Only following key is filled
* @return int 1 if array_options set / 0 if no value * @return int 1 if array_options set / 0 if no value
*/ */

View File

@ -114,8 +114,8 @@ class HookManager
* *
* @param string $method Name of method hooked ('doActions', 'printSearchForm', 'showInputField', ...) * @param string $method Name of method hooked ('doActions', 'printSearchForm', 'showInputField', ...)
* @param array $parameters Array of parameters * @param array $parameters Array of parameters
* @param Object &$object Object to use hooks on * @param Object $object Object to use hooks on
* @param string &$action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...) * @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...)
* @return mixed For doActions,formObjectOptions,pdf_xxx: Return 0 if we want to keep standard actions, >0 if if want to stop standard actions, <0 means KO. * @return mixed For doActions,formObjectOptions,pdf_xxx: Return 0 if we want to keep standard actions, >0 if if want to stop standard actions, <0 means KO.
* For printSearchForm,printLeftBlock,printTopRightMenu,formAddObjectLine,...: Return HTML string. TODO Deprecated. Must always return an int and things to print into ->resprints. * For printSearchForm,printLeftBlock,printTopRightMenu,formAddObjectLine,...: Return HTML string. TODO Deprecated. Must always return an int and things to print into ->resprints.
* Can also return some values into an array ->results. * Can also return some values into an array ->results.
@ -131,6 +131,7 @@ class HookManager
// Define type of hook ('output', 'returnvalue' or 'addreplace'). 'addreplace' should be type for all hooks. 'output' and 'returnvalue' are deprecated. // Define type of hook ('output', 'returnvalue' or 'addreplace'). 'addreplace' should be type for all hooks. 'output' and 'returnvalue' are deprecated.
$hooktype='output'; $hooktype='output';
if (preg_match('/^pdf_/',$method)) $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are returnvalue hooks. When there is 2 hooks of this type, only last one win. if (preg_match('/^pdf_/',$method)) $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are returnvalue hooks. When there is 2 hooks of this type, only last one win.
if ($method =='insertExtraFields') $hooktype='returnvalue';
if (in_array( if (in_array(
$method, $method,
array( array(

View File

@ -1492,9 +1492,9 @@ class Form
/** /**
* constructProductListOption * constructProductListOption
* *
* @param resultset &$objp Resultset of fetch * @param resultset $objp Resultset of fetch
* @param string &$opt Option * @param string $opt Option
* @param string &$optJson Option * @param string $optJson Option
* @param int $price_level Price level * @param int $price_level Price level
* @param string $selected Preselected value * @param string $selected Preselected value
* @return void * @return void
@ -4080,7 +4080,7 @@ class Form
/** /**
* Return HTML code to output a barcode * Return HTML code to output a barcode
* *
* @param Object &$object Object containing data to retrieve file name * @param Object $object Object containing data to retrieve file name
* @param int $width Width of photo * @param int $width Width of photo
* @return string HTML code to output barcode * @return string HTML code to output barcode
*/ */

View File

@ -610,8 +610,6 @@ class FormCompany
} }
print "\n".'<!-- Input text for third party with Ajax.Autocompleter (selectCompaniesForNewContact) -->'."\n"; print "\n".'<!-- Input text for third party with Ajax.Autocompleter (selectCompaniesForNewContact) -->'."\n";
print '<table class="nobordernopadding"><tr class="nobordernopadding">';
print '<td class="nobordernopadding">';
if ($obj->rowid == 0) if ($obj->rowid == 0)
{ {
print '<input type="text" size="30" id="search_'.$htmlname.'" name="search_'.$htmlname.'" value="" '.$htmloption.' />'; print '<input type="text" size="30" id="search_'.$htmlname.'" name="search_'.$htmlname.'" value="" '.$htmloption.' />';
@ -621,9 +619,6 @@ class FormCompany
print '<input type="text" size="30" id="search_'.$htmlname.'" name="search_'.$htmlname.'" value="'.$obj->nom.'" '.$htmloption.' />'; print '<input type="text" size="30" id="search_'.$htmlname.'" name="search_'.$htmlname.'" value="'.$obj->nom.'" '.$htmloption.' />';
} }
print ajax_autocompleter(($socid?$socid:-1),$htmlname,DOL_URL_ROOT.'/societe/ajaxcompanies.php','',$minLength); print ajax_autocompleter(($socid?$socid:-1),$htmlname,DOL_URL_ROOT.'/societe/ajaxcompanies.php','',$minLength);
print '</td>';
print '</tr>';
print '</table>';
print "\n"; print "\n";
return $socid; return $socid;
} }

View File

@ -4,7 +4,7 @@
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -14,6 +14,7 @@
* *
* 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/>.
* or see http://www.gnu.org/
*/ */
/** /**

View File

@ -462,7 +462,7 @@ class FormOther
/** /**
* Write lines of a project (all lines of a project if parent = 0) * Write lines of a project (all lines of a project if parent = 0)
* *
* @param int &$inc Cursor counter * @param int $inc Cursor counter
* @param int $parent Id of parent task we want to see * @param int $parent Id of parent task we want to see
* @param array $lines Array of task lines * @param array $lines Array of task lines
* @param int $level Level * @param int $level Level
@ -1033,6 +1033,7 @@ class FormOther
if ($nbboxactivated) if ($nbboxactivated)
{ {
$langs->load("boxes"); $langs->load("boxes");
$langs->load("projects");
$emptybox=new ModeleBoxes($db); $emptybox=new ModeleBoxes($db);

View File

@ -370,7 +370,7 @@ class Ldap
* Ldap object connect and bind must have been done * Ldap object connect and bind must have been done
* *
* @param string $dn DN entry key * @param string $dn DN entry key
* @param string[] $info Attributes array * @param array $info Attributes array
* @param User $user Objet user that create * @param User $user Objet user that create
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
@ -423,7 +423,7 @@ class Ldap
* Ldap object connect and bind must have been done * Ldap object connect and bind must have been done
* *
* @param string $dn DN entry key * @param string $dn DN entry key
* @param string[] $info Attributes array * @param array $info Attributes array
* @param string $user Objet user that modify * @param string $user Objet user that modify
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
@ -475,7 +475,7 @@ class Ldap
* Ldap object connect and bind must have been done * Ldap object connect and bind must have been done
* *
* @param string $dn DN entry key * @param string $dn DN entry key
* @param string[] $info Attributes array * @param array $info Attributes array
* @param User $user Objet user that update * @param User $user Objet user that update
* @param string $olddn Old DN entry key (before update) * @param string $olddn Old DN entry key (before update)
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
@ -563,7 +563,7 @@ class Ldap
* Build a LDAP message * Build a LDAP message
* *
* @param string $dn DN entry key * @param string $dn DN entry key
* @param string[] $info Attributes array * @param array $info Attributes array
* @return string Content of file * @return string Content of file
*/ */
function dump_content($dn, $info) function dump_content($dn, $info)
@ -605,7 +605,7 @@ class Ldap
* Dump a LDAP message to ldapinput.in file * Dump a LDAP message to ldapinput.in file
* *
* @param string $dn DN entry key * @param string $dn DN entry key
* @param string[] $info Attributes array * @param array $info Attributes array
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function dump($dn, $info) function dump($dn, $info)
@ -642,7 +642,7 @@ class Ldap
* Ldap object connect and bind must have been done * Ldap object connect and bind must have been done
* *
* @param string $dn DN entry key * @param string $dn DN entry key
* @param string[] $info Attributes array * @param array $info Attributes array
* @param User $user Objet user that create * @param User $user Objet user that create
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
@ -694,7 +694,7 @@ class Ldap
* Ldap object connect and bind must have been done * Ldap object connect and bind must have been done
* *
* @param string $dn DN entry key * @param string $dn DN entry key
* @param string[] $info Attributes array * @param array $info Attributes array
* @param User $user Objet user that create * @param User $user Objet user that create
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
@ -746,7 +746,7 @@ class Ldap
* Ldap object connect and bind must have been done * Ldap object connect and bind must have been done
* *
* @param string $dn DN entry key * @param string $dn DN entry key
* @param string[] $info Attributes array * @param array $info Attributes array
* @param User $user Objet user that create * @param User $user Objet user that create
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */

View File

@ -234,7 +234,7 @@ class Link extends CommonObject
/** /**
* Loads all links from database * Loads all links from database
* *
* @param array &$links array of Link objects to fill * @param array $links array of Link objects to fill
* @param string $objecttype type of the associated object in dolibarr * @param string $objecttype type of the associated object in dolibarr
* @param int $objectid id of the associated object in dolibarr * @param int $objectid id of the associated object in dolibarr
* @param string $sortfield field used to sort * @param string $sortfield field used to sort

View File

@ -152,7 +152,7 @@ class Menubase
$sql.= " '".$this->fk_menu."',"; $sql.= " '".$this->fk_menu."',";
$sql.= " ".($this->fk_mainmenu?"'".$this->fk_mainmenu."'":"null").","; $sql.= " ".($this->fk_mainmenu?"'".$this->fk_mainmenu."'":"null").",";
$sql.= " ".($this->fk_leftmenu?"'".$this->fk_leftmenu."'":"null").","; $sql.= " ".($this->fk_leftmenu?"'".$this->fk_leftmenu."'":"null").",";
$sql.= " '".$this->position."',"; $sql.= " '".(int) $this->position."',";
$sql.= " '".$this->db->escape($this->url)."',"; $sql.= " '".$this->db->escape($this->url)."',";
$sql.= " '".$this->db->escape($this->target)."',"; $sql.= " '".$this->db->escape($this->target)."',";
$sql.= " '".$this->db->escape($this->titre)."',"; $sql.= " '".$this->db->escape($this->titre)."',";
@ -380,7 +380,7 @@ class Menubase
* @param string $myleftmenu Value for leftmenu to filter menu to load (always '') * @param string $myleftmenu Value for leftmenu to filter menu to load (always '')
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office * @param int $type_user 0=Menu for backoffice, 1=Menu for front office
* @param string $menu_handler Filter on name of menu_handler used (auguria, eldy...) * @param string $menu_handler Filter on name of menu_handler used (auguria, eldy...)
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @return array Return array with menu entries for top menu * @return array Return array with menu entries for top menu
*/ */
function menuTopCharger($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu) function menuTopCharger($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
@ -408,7 +408,7 @@ class Menubase
* @param string $myleftmenu Value for leftmenu to filter menu to load (always '') * @param string $myleftmenu Value for leftmenu to filter menu to load (always '')
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office * @param int $type_user 0=Menu for backoffice, 1=Menu for front office
* @param string $menu_handler Filter on name of menu_handler used (auguria, eldy...) * @param string $menu_handler Filter on name of menu_handler used (auguria, eldy...)
* @param array &$tabMenu Array with menu entries already loaded * @param array $tabMenu Array with menu entries already loaded
* @return Menu Menu array for particular mainmenu value or full tabArray * @return Menu Menu array for particular mainmenu value or full tabArray
*/ */
function menuLeftCharger($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu) function menuLeftCharger($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
@ -493,7 +493,7 @@ class Menubase
* @param string $myleftmenu Value for left that defined leftmenu * @param string $myleftmenu Value for left that defined leftmenu
* @param int $type_user Looks for menu entry for 0=Internal users, 1=External users * @param int $type_user Looks for menu entry for 0=Internal users, 1=External users
* @param string $menu_handler Name of menu_handler used ('auguria', 'eldy'...) * @param string $menu_handler Name of menu_handler used ('auguria', 'eldy'...)
* @param array &$tabMenu Array to store new entries found (in most cases, it's empty, but may be alreay filled) * @param array $tabMenu Array to store new entries found (in most cases, it's empty, but may be alreay filled)
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function menuLoad($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu) function menuLoad($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)

View File

@ -452,7 +452,7 @@ class RssParser
* *
* @param string $p Start * @param string $p Start
* @param string $element Tag * @param string $element Tag
* @param array &$attrs Attributes of tags * @param array $attrs Attributes of tags
* @return void * @return void
*/ */
function feed_start_element($p, $element, &$attrs) function feed_start_element($p, $element, &$attrs)
@ -644,7 +644,7 @@ class RssParser
/** /**
* To concat 2 string with no warning if an operand is not defined * To concat 2 string with no warning if an operand is not defined
* *
* @param string &$str1 Str1 * @param string $str1 Str1
* @param string $str2 Str2 * @param string $str2 Str2
* @return string String cancatenated * @return string String cancatenated
*/ */

View File

@ -39,6 +39,7 @@ require_once '../main.inc.php';
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); // If language was forced on URL by the main.inc.php if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); // If language was forced on URL by the main.inc.php
$langs->load("main"); $langs->load("main");
$langs->load("agenda");
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); $right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); $left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
@ -57,7 +58,7 @@ if (GETPOST('mode') && GETPOST('mode') == 'test')
} }
else else
{ {
print '<title>Calendar</title>'; print '<title>'.$langs->trans("Calendar").'</title>';
} }
// Define tradMonths javascript array (we define this in datapicker AND in parent page to avoid errors with IE8) // Define tradMonths javascript array (we define this in datapicker AND in parent page to avoid errors with IE8)

View File

@ -17,7 +17,7 @@
*/ */
/** /**
* \file htdocs/core/db/dolidb.class.php * \file htdocs/core/db/DoliDB.class.php
* \brief Class file to manage Dolibarr database access * \brief Class file to manage Dolibarr database access
*/ */

View File

@ -351,7 +351,6 @@ class DoliDBMysqli extends DoliDB
* @return int Nombre de lignes * @return int Nombre de lignes
* @see num_rows * @see num_rows
*/ */
function affected_rows($resultset) function affected_rows($resultset)
{ {
// If resultset not provided, we take the last used by connexion // If resultset not provided, we take the last used by connexion

View File

@ -387,7 +387,7 @@ class DoliDBPgsql extends DoliDB
if ((! empty($host) && $host == "socket") && ! defined('NOLOCALSOCKETPGCONNECT')) if ((! empty($host) && $host == "socket") && ! defined('NOLOCALSOCKETPGCONNECT'))
{ {
$con_string = "dbname='".$name."' user='".$login."' password='".$passwd."'"; // $name may be empty $con_string = "dbname='".$name."' user='".$login."' password='".$passwd."'"; // $name may be empty
$this->db = pg_connect($con_string); $this->db = @pg_connect($con_string);
} }
// if local connection failed or not requested, use TCP/IP // if local connection failed or not requested, use TCP/IP
@ -397,7 +397,7 @@ class DoliDBPgsql extends DoliDB
if (! $port) $port = 5432; if (! $port) $port = 5432;
$con_string = "host='".$host."' port='".$port."' dbname='".$name."' user='".$login."' password='".$passwd."'"; $con_string = "host='".$host."' port='".$port."' dbname='".$name."' user='".$login."' password='".$passwd."'";
$this->db = pg_connect($con_string); $this->db = @pg_connect($con_string);
} }
// now we test if at least one connect method was a success // now we test if at least one connect method was a success
@ -832,7 +832,7 @@ class DoliDBPgsql extends DoliDB
// Test charset match LC_TYPE (pgsql error otherwise) // Test charset match LC_TYPE (pgsql error otherwise)
//print $charset.' '.setlocale(LC_CTYPE,'0'); exit; //print $charset.' '.setlocale(LC_CTYPE,'0'); exit;
$sql='CREATE DATABASE '.$database.' OWNER '.$owner.' ENCODING \''.$charset.'\''; $sql='CREATE DATABASE "'.$database.'" OWNER "'.$owner.'" ENCODING \''.$charset.'\'';
dol_syslog($sql,LOG_DEBUG); dol_syslog($sql,LOG_DEBUG);
$ret=$this->query($sql); $ret=$this->query($sql);
return $ret; return $ret;

View File

@ -853,17 +853,17 @@ function unActivateModule($value, $requiredby=1)
/** /**
* Add external modules to list of dictionaries * Add external modules to list of dictionaries
* *
* @param array &$taborder Taborder * @param array $taborder Taborder
* @param array &$tabname Tabname * @param array $tabname Tabname
* @param array &$tablib Tablib * @param array $tablib Tablib
* @param array &$tabsql Tabsql * @param array $tabsql Tabsql
* @param array &$tabsqlsort Tabsqlsort * @param array $tabsqlsort Tabsqlsort
* @param array &$tabfield Tabfield * @param array $tabfield Tabfield
* @param array &$tabfieldvalue Tabfieldvalue * @param array $tabfieldvalue Tabfieldvalue
* @param array &$tabfieldinsert Tabfieldinsert * @param array $tabfieldinsert Tabfieldinsert
* @param array &$tabrowid Tabrowid * @param array $tabrowid Tabrowid
* @param array &$tabcond Tabcond * @param array $tabcond Tabcond
* @param array &$tabhelp Tabhelp * @param array $tabhelp Tabhelp
* @return int 1 * @return int 1
*/ */
function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql,&$tabsqlsort,&$tabfield,&$tabfieldvalue,&$tabfieldinsert,&$tabrowid,&$tabcond,&$tabhelp) function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql,&$tabsqlsort,&$tabfield,&$tabfieldvalue,&$tabfieldinsert,&$tabrowid,&$tabcond,&$tabhelp)

View File

@ -482,7 +482,7 @@ function dol_get_last_day($year,$month=12,$gm=false)
* @param int $month Month * @param int $month Month
* @param int $year Year * @param int $year Year
* @param int $gm False or 0 or 'server' = Return date to compare with server TZ, True or 1 to compare with GM date. * @param int $gm False or 0 or 'server' = Return date to compare with server TZ, True or 1 to compare with GM date.
* @return array year,month, week,first_day,prev_year,prev_month,prev_day * @return array year,month,week,first_day,prev_year,prev_month,prev_day
*/ */
function dol_get_first_day_week($day,$month,$year,$gm=false) function dol_get_first_day_week($day,$month,$year,$gm=false)
{ {
@ -532,7 +532,7 @@ function dol_get_first_day_week($day,$month,$year,$gm=false)
$prev_day = $tmparray['mday']; $prev_day = $tmparray['mday'];
//Check prev day of week is in same month than first day or not //Check prev day of week is in same month than first day or not
if ($prev_day>$tmpday) if ($prev_day > $tmpday)
{ {
$prev_month = $month-1; $prev_month = $month-1;
$prev_year = $year; $prev_year = $year;
@ -544,7 +544,7 @@ function dol_get_first_day_week($day,$month,$year,$gm=false)
} }
} }
$week = date("W",dol_mktime(0,0,0,$month,$tmpday,$year,$gm)); $week = date("W",dol_mktime(0,0,0,$tmpmonth,$tmpday,$tmpyear,$gm));
return array('year' => $year, 'month' => $month, 'week' => $week, 'first_day' => $tmpday, 'first_month' => $tmpmonth, 'first_year' => $tmpyear, 'prev_year' => $prev_year, 'prev_month' => $prev_month, 'prev_day' => $prev_day); return array('year' => $year, 'month' => $month, 'week' => $week, 'first_day' => $tmpday, 'first_month' => $tmpmonth, 'first_year' => $tmpyear, 'prev_year' => $prev_year, 'prev_month' => $prev_month, 'prev_day' => $prev_day);
} }
@ -563,9 +563,10 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
$nbFerie = 0; $nbFerie = 0;
// Check to ensure we use correct parameters // Check to ensure we use correct parameters
if ((($timestampEnd - $timestampStart) % 86400) != 0) return 'ErrorDates must use same hour and be GMT dates'; if ((($timestampEnd - $timestampStart) % 86400) != 0) return 'ErrorDates must use same hours and must be GMT dates';
while ($timestampStart < $timestampEnd) // Loop end when equals $i=0;
while ($timestampStart < $timestampEnd && ($i < 50000)) // Loop end when equals (Test on i is a security loop to avoid infinite loop)
{ {
$ferie=false; $ferie=false;
$countryfound=0; $countryfound=0;
@ -573,7 +574,6 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
$jour = date("d", $timestampStart); $jour = date("d", $timestampStart);
$mois = date("m", $timestampStart); $mois = date("m", $timestampStart);
$annee = date("Y", $timestampStart); $annee = date("Y", $timestampStart);
if ($countrycode == 'FR') if ($countrycode == 'FR')
{ {
$countryfound=1; $countryfound=1;
@ -676,8 +676,10 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
if ($ferie) $nbFerie++; if ($ferie) $nbFerie++;
// Increase number of days (on go up into loop) // Increase number of days (on go up into loop)
$jour++; $timestampStart=dol_time_plus_duree($timestampStart, 1, 'd');
$timestampStart=dol_mktime(0,0,0,$mois,$jour,$annee,1); // Generate GMT date for next day //var_dump($jour.' '.$mois.' '.$annee.' '.$timestampStart);
$i++;
} }
return $nbFerie; return $nbFerie;
@ -718,13 +720,16 @@ function num_between_day($timestampStart, $timestampEnd, $lastday=0)
* @param int $inhour 0: return number of days, 1: return number of hours * @param int $inhour 0: return number of days, 1: return number of hours
* @param int $lastday We include last day, 0: no, 1:yes * @param int $lastday We include last day, 0: no, 1:yes
* @param int $halfday Tag to define half day when holiday start and end * @param int $halfday Tag to define half day when holiday start and end
* @param string $country_code Country code (company country code if not defined)
* @return int Number of days or hours * @return int Number of days or hours
*/ */
function num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $halfday=0) function num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $halfday=0, $country_code='')
{ {
global $langs; global $langs,$mysoc;
dol_syslog('num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday); if (empty($country_code)) $country_code=$mysoc->country_code;
dol_syslog('num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday.' country_code='.$country_code);
// Check parameters // Check parameters
if (! is_int($timestampStart) && ! is_float($timestampStart)) return 'ErrorBadParameter_num_open_day'; if (! is_int($timestampStart) && ! is_float($timestampStart)) return 'ErrorBadParameter_num_open_day';
@ -733,7 +738,9 @@ function num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $ha
//print 'num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday; //print 'num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday;
if ($timestampStart < $timestampEnd) if ($timestampStart < $timestampEnd)
{ {
$nbOpenDay = num_between_day($timestampStart, $timestampEnd, $lastday) - num_public_holiday($timestampStart, $timestampEnd, $lastday); $numdays = num_between_day($timestampStart, $timestampEnd, $lastday);
$numholidays = num_public_holiday($timestampStart, $timestampEnd, $country_code);
$nbOpenDay = $numdays - $numholidays;
$nbOpenDay.= " " . $langs->trans("Days"); $nbOpenDay.= " " . $langs->trans("Days");
if ($inhour == 1 && $nbOpenDay <= 3) $nbOpenDay = $nbOpenDay*24 . $langs->trans("HourShort"); if ($inhour == 1 && $nbOpenDay <= 3) $nbOpenDay = $nbOpenDay*24 . $langs->trans("HourShort");
return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday)); return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday));

View File

@ -43,7 +43,7 @@ function dol_basename($pathfile)
* @param string $types Can be "directories", "files", or "all" * @param string $types Can be "directories", "files", or "all"
* @param int $recursive Determines whether subdirectories are searched * @param int $recursive Determines whether subdirectories are searched
* @param string $filter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function * @param string $filter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
* @param string[] $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview\.png)$','^\.')) * @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview\.png)$','^\.'))
* @param string $sortcriteria Sort criteria ("","fullname","name","date","size") * @param string $sortcriteria Sort criteria ("","fullname","name","date","size")
* @param string $sortorder Sort order (SORT_ASC, SORT_DESC) * @param string $sortorder Sort order (SORT_ASC, SORT_DESC)
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only * @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
@ -1289,7 +1289,7 @@ function dol_uncompress($inputfile,$outputdir)
* *
* @param string $dir Directory to scan * @param string $dir Directory to scan
* @param string $regexfilter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function * @param string $regexfilter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
* @param string[] $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview\.png)$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function * @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview\.png)$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function
* @param int $nohook Disable all hooks * @param int $nohook Disable all hooks
* @return string Full path to most recent file * @return string Full path to most recent file
*/ */

View File

@ -719,11 +719,12 @@ function dol_bc($var,$moreclass='')
* @param Object $object A company or contact object * @param Object $object A company or contact object
* @param int $withcountry 1=Add country into address string * @param int $withcountry 1=Add country into address string
* @param string $sep Separator to use to build string * @param string $sep Separator to use to build string
* @param Tranlsate $outputlangs Object lang that contains language for text translation.
* @return string Formated string * @return string Formated string
*/ */
function dol_format_address($object,$withcountry=0,$sep="\n") function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='')
{ {
global $conf; global $conf,$langs;
$ret=''; $ret='';
$countriesusingstate=array('AU','US','IN','GB','ES','UK','TR'); $countriesusingstate=array('AU','US','IN','GB','ES','UK','TR');
@ -768,8 +769,8 @@ function dol_format_address($object,$withcountry=0,$sep="\n")
$ret.=", ".$object->state; $ret.=", ".$object->state;
} }
} }
if (! is_object($outputlangs)) $outputlangs=$langs;
if ($withcountry) $ret.=($object->country?$sep.$object->country:''); if ($withcountry) $ret.=($object->country_code?$sep.$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)):'');
return $ret; return $ret;
} }
@ -1053,7 +1054,11 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
$default_timezone=@date_default_timezone_get(); $default_timezone=@date_default_timezone_get();
} }
} }
else $localtz = new DateTimeZone('UTC');
if (empty($localtz)) {
$localtz = new DateTimeZone('UTC');
}
$dt = new DateTime(null,$localtz); $dt = new DateTime(null,$localtz);
$dt->setDate($year,$month,$day); $dt->setDate($year,$month,$day);
$dt->setTime((int) $hour, (int) $minute, (int) $second); $dt->setTime((int) $hour, (int) $minute, (int) $second);
@ -3770,7 +3775,7 @@ function make_substitutions($chaine,$substitutionarray)
/** /**
* Complete the $substitutionarray with more entries * Complete the $substitutionarray with more entries
* *
* @param array &$substitutionarray Array substitution old value => new value value * @param array $substitutionarray Array substitution old value => new value value
* @param Translate $outputlangs If we want substitution from special constants, we provide a language * @param Translate $outputlangs If we want substitution from special constants, we provide a language
* @param Object $object If we want substitution from special constants, we provide data in a source object * @param Object $object If we want substitution from special constants, we provide data in a source object
* @param Mixed $parameters Add more parameters (useful to pass product lines) * @param Mixed $parameters Add more parameters (useful to pass product lines)
@ -4109,7 +4114,7 @@ function dol_htmloutput_errors($mesgstring='', $mesgarray='', $keepembedded=0)
* or descending output and uses optionally natural case insensitive sorting (which * or descending output and uses optionally natural case insensitive sorting (which
* can be optionally case sensitive as well). * can be optionally case sensitive as well).
* *
* @param array &$array Array to sort (array of array('key','otherkey1','otherkey2'...)) * @param array $array Array to sort (array of array('key','otherkey1','otherkey2'...))
* @param string $index Key in array to use for sorting criteria * @param string $index Key in array to use for sorting criteria
* @param int $order Sort order * @param int $order Sort order
* @param int $natsort 1=use "natural" sort (natsort), 0=use "standard" sort (asort) * @param int $natsort 1=use "natural" sort (natsort), 0=use "standard" sort (asort)
@ -4330,8 +4335,8 @@ function picto_from_langcode($codelang)
* @param Conf $conf Object conf * @param Conf $conf Object conf
* @param Translate $langs Object langs * @param Translate $langs Object langs
* @param Object $object Object object * @param Object $object Object object
* @param array &$head Object head * @param array $head Object head
* @param int &$h New position to fill * @param int $h New position to fill
* @param string $type Value for object where objectvalue can be * @param string $type Value for object where objectvalue can be
* 'thirdparty' to add a tab in third party view * 'thirdparty' to add a tab in third party view
* 'intervention' to add a tab in intervention view * 'intervention' to add a tab in intervention view

View File

@ -738,7 +738,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
$sql = "SELECT MAX(".$sqlstring.") as val"; $sql = "SELECT MAX(".$sqlstring.") as val";
$sql.= " FROM ".MAIN_DB_PREFIX.$table; $sql.= " FROM ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE ".$field." LIKE '".$maskLike."'"; $sql.= " WHERE ".$field." LIKE '".$maskLike."'";
$sql.= " AND ".$field." NOT LIKE '%PROV%'"; $sql.= " AND ".$field." NOT LIKE '(PROV%)'";
$sql.= " AND entity IN (".getEntity($table, 1).")"; $sql.= " AND entity IN (".getEntity($table, 1).")";
if ($where) $sql.=$where; if ($where) $sql.=$where;
if ($sqlwhere) $sql.=' AND '.$sqlwhere; if ($sqlwhere) $sql.=' AND '.$sqlwhere;
@ -1107,7 +1107,7 @@ function numero_semaine($time)
* Convertit une masse d'une unite vers une autre unite * Convertit une masse d'une unite vers une autre unite
* *
* @param float $weight Masse a convertir * @param float $weight Masse a convertir
* @param int &$from_unit Unite originale en puissance de 10 * @param int $from_unit Unite originale en puissance de 10
* @param int $to_unit Nouvelle unite en puissance de 10 * @param int $to_unit Nouvelle unite en puissance de 10
* @return float Masse convertie * @return float Masse convertie
*/ */
@ -1142,7 +1142,7 @@ function weight_convert($weight,&$from_unit,$to_unit)
* *
* @param DoliDB $db Handler database * @param DoliDB $db Handler database
* @param Conf $conf Object conf * @param Conf $conf Object conf
* @param User &$user Object user * @param User $user Object user
* @param array $tab Tableau (cle=>valeur) des parametres a sauvegarder * @param array $tab Tableau (cle=>valeur) des parametres a sauvegarder
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
* *

View File

@ -50,4 +50,3 @@ function holiday_prepare_head($object)
return $head; return $head;
} }
?>

View File

@ -2,19 +2,20 @@
/* /*
* Copyright (C) 2009-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2009-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ * or see http://www.gnu.org/
*/
/** /**
* \file htdocs/core/lib/invoice2.lib.php * \file htdocs/core/lib/invoice2.lib.php

View File

@ -309,7 +309,10 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if ($mode == 'source') if ($mode == 'source')
{ {
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($sourcecompany))."\n"; $withCountry = 0;
if (!empty($sourcecompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) $withCountry = 1;
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($sourcecompany, $withCountry, "\n", $outputlangs))."\n";
if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS)) if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS))
{ {
@ -420,7 +423,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
/** /**
* Show header of page for PDF generation * Show header of page for PDF generation
* *
* @param PDF &$pdf Object PDF * @param PDF $pdf Object PDF
* @param Translate $outputlangs Object lang for output * @param Translate $outputlangs Object lang for output
* @param int $page_height Height of page * @param int $page_height Height of page
* @return void * @return void
@ -441,7 +444,7 @@ function pdf_pagehead(&$pdf,$outputlangs,$page_height)
/** /**
* Add a draft watermark on PDF files * Add a draft watermark on PDF files
* *
* @param PDF &$pdf Object PDF * @param PDF $pdf Object PDF
* @param Translate $outputlangs Object lang * @param Translate $outputlangs Object lang
* @param int $h Height of PDF * @param int $h Height of PDF
* @param int $w Width of PDF * @param int $w Width of PDF
@ -481,7 +484,7 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
/** /**
* Show bank informations for PDF generation * Show bank informations for PDF generation
* *
* @param PDF &$pdf Object PDF * @param PDF $pdf Object PDF
* @param Translate $outputlangs Object lang * @param Translate $outputlangs Object lang
* @param int $curx X * @param int $curx X
* @param int $cury Y * @param int $cury Y
@ -643,7 +646,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
/** /**
* Show footer of page for PDF generation * Show footer of page for PDF generation
* *
* @param PDF &$pdf The PDF factory * @param PDF $pdf The PDF factory
* @param Translate $outputlangs Object lang for output * @param Translate $outputlangs Object lang for output
* @param string $paramfreetext Constant name of free text * @param string $paramfreetext Constant name of free text
* @param Societe $fromcompany Object company * @param Societe $fromcompany Object company
@ -852,7 +855,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
/** /**
* Show linked objects for PDF generation * Show linked objects for PDF generation
* *
* @param PDF &$pdf Object PDF * @param PDF $pdf Object PDF
* @param object $object Object * @param object $object Object
* @param Translate $outputlangs Object lang * @param Translate $outputlangs Object lang
* @param int $posx X * @param int $posx X
@ -890,7 +893,7 @@ function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$w,$h,$al
/** /**
* Output line description into PDF * Output line description into PDF
* *
* @param PDF &$pdf PDF object * @param PDF $pdf PDF object
* @param Object $object Object * @param Object $object Object
* @param int $i Current line number * @param int $i Current line number
* @param Translate $outputlangs Object lang for output * @param Translate $outputlangs Object lang for output

View File

@ -357,5 +357,3 @@ function measuring_units_string($unit,$measuring_style='')
return $measuring_units[$unit]; return $measuring_units[$unit];
} }
?>

View File

@ -206,13 +206,13 @@ function project_admin_prepare_head()
/** /**
* Show task lines with a particular parent * Show task lines with a particular parent
* *
* @param string &$inc Counter that count number of lines legitimate to show (for return) * @param string $inc Counter that count number of lines legitimate to show (for return)
* @param int $parent Id of parent task to start * @param int $parent Id of parent task to start
* @param array &$lines Array of all tasks * @param array $lines Array of all tasks
* @param int &$level Level of task * @param int $level Level of task
* @param string $var Color * @param string $var Color
* @param int $showproject Show project columns * @param int $showproject Show project columns
* @param int &$taskrole Array of roles of user for each tasks * @param int $taskrole Array of roles of user for each tasks
* @param int $projectsListId List of id of project allowed to user (string separated with comma) * @param int $projectsListId List of id of project allowed to user (string separated with comma)
* @param int $addordertick Add a tick to move task * @param int $addordertick Add a tick to move task
* @return void * @return void
@ -443,12 +443,12 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
/** /**
* Output a task line * Output a task line
* *
* @param string &$inc ? * @param string $inc ?
* @param string $parent ? * @param string $parent ?
* @param Object $lines ? * @param Object $lines ?
* @param int &$level ? * @param int $level ?
* @param string &$projectsrole ? * @param string $projectsrole ?
* @param string &$tasksrole ? * @param string $tasksrole ?
* @param string $mine Show only task lines I am assigned to * @param string $mine Show only task lines I am assigned to
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to * @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
* @return $inc * @return $inc
@ -589,10 +589,10 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
/** /**
* Search in task lines with a particular parent if there is a task for a particular user (in taskrole) * Search in task lines with a particular parent if there is a task for a particular user (in taskrole)
* *
* @param string &$inc Counter that count number of lines legitimate to show (for return) * @param string $inc Counter that count number of lines legitimate to show (for return)
* @param int $parent Id of parent task to start * @param int $parent Id of parent task to start
* @param array &$lines Array of all tasks * @param array $lines Array of all tasks
* @param string &$taskrole Array of task filtered on a particular user * @param string $taskrole Array of task filtered on a particular user
* @return int 1 if there is * @return int 1 if there is
*/ */
function searchTaskInChild(&$inc, $parent, &$lines, &$taskrole) function searchTaskInChild(&$inc, $parent, &$lines, &$taskrole)

View File

@ -174,11 +174,17 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
} }
else if (! empty($feature2)) // This should be used for future changes else if (! empty($feature2)) // This should be used for future changes
{ {
$tmpreadok=1;
foreach($feature2 as $subfeature) foreach($feature2 as $subfeature)
{ {
if (! empty($subfeature) && empty($user->rights->$feature->$subfeature->lire) && empty($user->rights->$feature->$subfeature->read)) { $readok=0; $nbko++; } if (! empty($subfeature) && empty($user->rights->$feature->$subfeature->lire) && empty($user->rights->$feature->$subfeature->read)) { $tmpreadok=0; }
else if (empty($subfeature) && empty($user->rights->$feature->lire) && empty($user->rights->$feature->read)) { $readok=0; $nbko++; } else if (empty($subfeature) && empty($user->rights->$feature->lire) && empty($user->rights->$feature->read)) { $tmpreadok=0; }
else { $readok=1; break; } // Break is to bypass second test if the first is ok else { $tmpreadok=1; break; } // Break is to bypass second test if the first is ok
}
if (! $tmpreadok) // We found a test on feature that is ko
{
$readok=0; // All tests are ko (we manage here the and, the or will be managed later using $nbko).
$nbko++;
} }
} }
else if (! empty($feature) && ($feature!='user' && $feature!='usergroup')) // This is for old permissions else if (! empty($feature) && ($feature!='user' && $feature!='usergroup')) // This is for old permissions

View File

@ -28,7 +28,7 @@
/** /**
* Show indent and picto of a tree line. Return array with information of line. * Show indent and picto of a tree line. Return array with information of line.
* *
* @param array &$fulltree Array of entries in correct order * @param array $fulltree Array of entries in correct order
* @param string $key Key of entry into fulltree to show picto * @param string $key Key of entry into fulltree to show picto
* @param int $silent Do not output indent and picto, returns only value * @param int $silent Do not output indent and picto, returns only value
* @return array array(0 or 1 if at least one of this level after, 0 or 1 if at least one of higher level after, nbofdirinsub, nbofdocinsub) * @return array array(0 or 1 if at least one of this level after, 0 or 1 if at least one of higher level after, nbofdirinsub, nbofdocinsub)

View File

@ -59,5 +59,3 @@ function trip_prepare_head($object)
return $head; return $head;
} }
?>

View File

@ -342,4 +342,3 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
print '</table>'; print '</table>';
} }
?>

View File

@ -27,9 +27,9 @@
* Check authentication array and set error, errorcode, errorlabel * Check authentication array and set error, errorcode, errorlabel
* *
* @param array $authentication Array with authentication informations ('login'=>,'password'=>,'entity'=>,'dolibarrkey'=>) * @param array $authentication Array with authentication informations ('login'=>,'password'=>,'entity'=>,'dolibarrkey'=>)
* @param int &$error Number of errors * @param int $error Number of errors
* @param string &$errorcode Error string code * @param string $errorcode Error string code
* @param string &$errorlabel Error string label * @param string $errorlabel Error string label
* @return User Return user object identified by login/pass/entity into authentication array * @return User Return user object identified by login/pass/entity into authentication array
*/ */
function check_authentication($authentication,&$error,&$errorcode,&$errorlabel) function check_authentication($authentication,&$error,&$errorcode,&$errorlabel)

View File

@ -39,5 +39,3 @@ function check_user_password_empty($usertotest,$passwordtotest,$entitytotest)
return $login; return $login;
} }
?>

View File

@ -46,6 +46,3 @@ function check_user_password_forceuser($usertotest,$passwordtotest,$entitytotest
return $login; return $login;
} }
?>

View File

@ -43,6 +43,3 @@ function check_user_password_http($usertotest,$passwordtotest,$entitytotest)
return $login; return $login;
} }
?>

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