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 (C) 2015
- Marcos García <marcosgdf@gmail.com>
Copyright (C) 2014
- Laurent Destailleur <eldy@users.sourceforge.net>
- Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>

View File

@ -2,10 +2,44 @@
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.* *****
For users:
- Fix: Can upload files on services.
- Fix: sql errors on updat fichinter.
- Fix: sql errors on update fichinter.
- Fix: debian script syntax error.
- Fix: error "menu param is not inside list" into pos module.
- 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: cents for indian ruppes are calle paisa and paise.
- 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: 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.* *****
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.
***** 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 *****
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.

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
[ Laurent Destailleur (eldy) ]
* New upstream release.
-- 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
Maintainer: Laurent Destailleur (eldy) <eldy@users.sourceforge.net>
# 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
Build-Depends: debhelper (>= 9), po-debconf
# 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,
# Required PHP libraries
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,
# libnusoap-php,
# libphp-pclzip,
@ -26,9 +27,10 @@ Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm |
# fonts-dejavu-core | ttf-dejavu-core,
xdg-utils,
mysql-server,
mysql-client,
${misc:Depends},
${perl:Depends}
Recommends: mysql-client, apache2 | lighttpd | httpd
Recommends: apache2 | lighttpd | httpd
Suggests: www-browser
Description: Web based software to manage a company or foundation
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/
Upstream-Name: Dolibarr
Upstream-Contact: Laurent Destailleur <eldy@users.sourceforge.net>
Source: http://sourceforge.net/projects/dolibarr/files/
Source: http://www.dolibarr.org/files/stable/standard/
Files: *
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]
; ----- Change this -----
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
AppVerName=DoliWamp-3.6.0
; 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
; 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=__FILENAMEEXEDOLIWAMP__
; 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=__FILENAMEEXEDOLIWAMP__
; ----- End of change
;OutputManifestFile=build\doliwampbuild.log
; Define full path from which all relative path are defined

View File

@ -2,7 +2,7 @@
#----------------------------------------------------------------------------
# \file build/makepack-dolibarr.pl
# \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:
#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/pos*`;
$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/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`;
@ -460,8 +461,8 @@ if ($nboftargetok) {
$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/PCLZip`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-2.33`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-20100919`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/utils`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/LICENSE.TXT`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/savant`;
@ -610,9 +611,6 @@ if ($nboftargetok) {
print "Version is $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n";
#print "Create directory $RPMDIR\n";
#$ret=`mkdir -p "$RPMDIR"`;
print "Remove target ".$FILENAMERPM."...\n";
unlink("$NEWDESTI/".$FILENAMERPM);
print "Remove target ".$FILENAMETGZ2."-".$RPMSUBVERSION.".src.rpm...\n";
@ -620,13 +618,13 @@ if ($nboftargetok) {
print "Create directory $BUILDROOT/$FILENAMETGZ2\n";
$ret=`rm -fr $BUILDROOT/$FILENAMETGZ2`;
print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMETGZ2\n";
$cmd="cp -pr '$BUILDROOT/$PROJECT' '$BUILDROOT/$FILENAMETGZ2'";
$ret=`$cmd`;
# Set owners
#print "Set owners on files/dir\n";
#$ret=`chown -R root.root $BUILDROOT/$FILENAMETGZ2`;
# Removed files we don't need
$ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/htdocs/includes/ckeditor/_source`;
print "Set permissions on files/dir\n";
$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/zip`;
# 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/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/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
$ret=`mv $BUILDROOT/$PROJECT.tmp/ChangeLog $BUILDROOT/$PROJECT.tmp/changelog`;
@ -905,8 +911,6 @@ if ($nboftargetok) {
close SPECFROM;
close SPECTO;
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\"";
$ret=`$cmd`;
$cmd="cp -pr \"$BUILDROOT/$PROJECT/doc/images\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/images\"";
@ -945,8 +949,12 @@ if ($nboftargetok) {
$SOURCEBACK=$SOURCE;
$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";
$ret= `$cmd`;
#print "$ret\n";
@ -956,6 +964,9 @@ if ($nboftargetok) {
rename("$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe","$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe");
print "Move $SOURCE/build/$FILENAMEEXEDOLIWAMP.exe to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n";
$ret=`mv "$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe" "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"`;
$ret=`rm "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`;
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/rpm/*.spec
- Commit all changes.
- Add a Tag (x.y.z)
- Build Dolibarr and DoliWamp packages with makepack-dolibarr.pl
- Check content of built packages.
- Move build files into www.dolibarr.org web site
(/home/dolibarr/wwwroot/files/stable).
- 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"
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
%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
- 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
%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
- 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
%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
- 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
%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
- 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,17 +6,34 @@
<exclude-pattern>*/conf.php</exclude-pattern>
<exclude-pattern>*/includes/*</exclude-pattern>
<exclude-pattern>*/documents/*</exclude-pattern>
<exclude-pattern>*/dev/vagrant/*</exclude-pattern>
<exclude-pattern>*/custom/*</exclude-pattern>
<exclude-pattern>*/nltechno*</exclude-pattern>
<!-- List of all tests -->
<!-- List of all tests -->
<rule ref="Internal.NoCodeFound">
<severity>0</severity>
</rule>
<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">
<severity>0</severity>
</rule>
@ -105,7 +122,7 @@
<rule ref="Generic.Metrics.CyclomaticComplexity">
<properties>
<property name="complexity" value="80" />
<property name="absoluteComplexity" value="200" />
<property name="absoluteComplexity" value="250" />
</properties>
</rule>
<rule ref="Generic.Metrics.NestingLevel">
@ -162,7 +179,75 @@
<rule ref="PEAR.Commenting.ClassComment.MissingTag">
<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.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.WrongStyle">
@ -219,6 +304,24 @@
<rule ref="PEAR.Functions.FunctionCallSignature.Indent">
<severity>0</severity>
</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" />
@ -236,6 +339,10 @@
</rule>
<rule ref="PEAR.NamingConventions.ValidFunctionName" />
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore">
<severity>0</severity>
</rule>
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNameInvalid">
<severity>0</severity>
</rule>

View File

@ -7,7 +7,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@ -17,6 +17,7 @@
*
* You should have received a copy of the GNU General Public License
* 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
*
* @param string &$action Type of action
* @param string $action Type of action
* @param int $id Id of object
* @return void
*/
@ -228,7 +228,7 @@ abstract class ActionsAdherentCardCommon
/**
* 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
* @return string HTML output
*/

View File

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

View File

@ -5,6 +5,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* 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
* 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 $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
*/
function getmorphylib($morphy='')
@ -348,12 +349,12 @@ class Adherent extends CommonObject
if (! $notrigger)
{
// Appel des triggers
// Call triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('MEMBER_CREATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
// End call triggers
}
if (count($this->errors))
@ -1101,7 +1102,7 @@ class Adherent extends CommonObject
$this->ref = $obj->rowid;
$this->id = $obj->rowid;
$this->ref_ext = $obj->ref_ext;
$this->civility_id = $obj->civility;
$this->civility_id = $obj->civility_id;
$this->firstname = $obj->firstname;
$this->lastname = $obj->lastname;
$this->login = $obj->login;

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -117,7 +117,7 @@ if ($action == 'edit') // Edit
print_fiche_titre($langs->trans("Language"),'','').'<br>';
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 '</tr>';
@ -159,7 +159,7 @@ if ($action == 'edit') // Edit
// Other
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 '</tr>';
@ -283,7 +283,7 @@ else // Show
// Language
print_fiche_titre($langs->trans("Language"),'','').'<br>';
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;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("DefaultLanguage").'</td><td>';
@ -327,7 +327,7 @@ else // Show
// Other
$var=true;
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;
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();
$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
$result2=$ldap->add($dn,$info,$user); // Now the test
$result3=$ldap->delete($dn); // Clean what we did

View File

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

View File

@ -77,7 +77,7 @@ if($action)
if($action == 'STOCK_USE_VIRTUAL_STOCK') {
$res = dolibarr_set_const($db, "STOCK_USE_VIRTUAL_STOCK", GETPOST('STOCK_USE_VIRTUAL_STOCK','alpha'),'chaine',0,'',$conf->entity);
}
if($action == 'STOCK_MUST_BE_ENOUGH_FOR_INVOICE') {
$res = dolibarr_set_const($db, "STOCK_MUST_BE_ENOUGH_FOR_INVOICE", GETPOST('STOCK_MUST_BE_ENOUGH_FOR_INVOICE','alpha'),'chaine',0,'',$conf->entity);
}
@ -329,7 +329,7 @@ if ($virtualdiffersfromphysical)
print '</table>';
}
$db->close();
llxFooter();
?>
$db->close();

View File

@ -81,7 +81,7 @@ else
print '<td width="300">'.$langs->trans("Parameters").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
print '</tr>'."\n";
// arraytest is an array of test to do
$arraytest=array();
if (preg_match('/mysql/i',$db->type))
@ -91,7 +91,7 @@ else
'collation_database'=>array('var'=>'dolibarr_main_db_collation','valifempty'=>'utf8_general_ci')
);
}
$listtouse=array();
if ($listname == 'listofvars') $listtouse=$listofvars;
if ($listname == 'listofstatus') $listtouse=$listofstatus;
@ -124,4 +124,5 @@ else
}
llxFooter();
?>
$db->close();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -191,5 +191,3 @@ $obj_facturation->paiementLe('RESET');
// Affichage des templates
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 '</div>';
?>

View File

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

View File

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

View File

@ -284,7 +284,7 @@ class ActionComm extends CommonObject
$sql.= " a.fk_user_action, a.fk_user_done,";
$sql.= " a.fk_contact, a.percent as percentage,";
$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.= " s.nom as socname,";
$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_contact, a.percent as percentage,";
$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.= " s.nom as socname,";
$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_day = $prev['prev_day'];
$first_day = $prev['first_day'];
$first_month= $prev['first_month'];
$first_year = $prev['first_year'];
$week = $prev['week'];
$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_month = $next['month'];
$next_day = $next['day'];
// Define firstdaytoshow and lastdaytoshow
$firstdaytoshow=dol_mktime(0,0,0,$prev_month,$first_day,$prev_year);
$lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year);
$firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year);
$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd');
$max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year));
@ -870,39 +871,27 @@ elseif ($action == 'show_week') // View by week
}
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";
for($iter_day = 0; $iter_day < 7; $iter_day++)
{
if(($tmpday <= $max_day_in_month))
{
// Show days of the current week
$curtime = dol_mktime(0, 0, 0, $month, $tmpday, $year);
// Show days of the current week
$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';
if ($iter_day == 6) $style.=' cal_other_month_right';
$today=0;
$todayarray=dol_getdate($now,'fast');
if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1;
if ($today) $style='cal_today';
$style='cal_current_month';
if ($iter_day == 6) $style.=' cal_other_month_right';
$today=0;
$todayarray=dol_getdate($now,'fast');
if ($todayarray['mday']==$tmpday && $todayarray['mon']==$tmpmonth && $todayarray['year']==$tmpyear) $today=1;
if ($today) $style='cal_today';
echo ' <td class="'.$style.' nowrap" width="14%" valign="top">';
show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
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 ' <td class="'.$style.'" width="14%" valign="top">';
show_day_events($db, $tmpday, $tmpmonth, $tmpyear, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
echo " </td>\n";
}
echo " </tr>\n";
@ -966,7 +955,7 @@ llxFooter();
* @param int $year Year
* @param int $monthshown Current month shown in calendar view
* @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 $maxnbofchar Nb of characters to show for event line
* @param string $newparam Parameters on current URL

View File

@ -79,70 +79,80 @@ $object = new Societe($db);
$parameters = array('socid' => $id);
$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')
{
$result=$object->fetch($id);
$object->code_compta=$_POST["customeraccountancycode"];
$result=$object->update($object->id,$user,1,1,0);
if ($result < 0)
if ($action == 'setcustomeraccountancycode')
{
$mesgs[]=join(',',$object->errors);
if (!$cancelbutton) {
$result=$object->fetch($id);
$object->code_compta=$_POST["customeraccountancycode"];
$result=$object->update($object->id,$user,1,1,0);
if ($result < 0)
{
$mesgs[]=join(',',$object->errors);
}
$action="";
}
}
$action="";
}
// conditions de reglement
if ($action == 'setconditions' && $user->rights->societe->creer)
{
$object->fetch($id);
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
if ($result < 0) dol_print_error($db,$object->error);
}
// mode de reglement
if ($action == 'setmode' && $user->rights->societe->creer)
{
$object->fetch($id);
$result=$object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
if ($result < 0) dol_print_error($db,$object->error);
}
// assujetissement a la TVA
if ($action == 'setassujtva' && $user->rights->societe->creer)
{
$object->fetch($id);
$object->tva_assuj=$_POST['assujtva_value'];
// conditions de reglement
if ($action == 'setconditions' && $user->rights->societe->creer)
{
$object->fetch($id);
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
if ($result < 0) dol_print_error($db,$object->error);
}
// mode de reglement
if ($action == 'setmode' && $user->rights->societe->creer)
{
$object->fetch($id);
$result=$object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
if ($result < 0) dol_print_error($db,$object->error);
}
// assujetissement a la TVA
if ($action == 'setassujtva' && $user->rights->societe->creer)
{
$object->fetch($id);
$object->tva_assuj=$_POST['assujtva_value'];
// TODO move to DAO class
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET tva_assuj='".$_POST['assujtva_value']."' WHERE rowid='".$id."'";
$result = $db->query($sql);
if (! $result) dol_print_error($result);
}
// TODO move to DAO class
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET tva_assuj='".$_POST['assujtva_value']."' WHERE rowid='".$id."'";
$result = $db->query($sql);
if (! $result) dol_print_error($result);
}
// set prospect level
if ($action == 'setprospectlevel' && $user->rights->societe->creer)
{
$object->fetch($id);
$object->fk_prospectlevel=GETPOST('prospect_level_id','alpha');
$result=$object->set_prospect_level($user);
if ($result < 0) setEventMessage($object->error,'errors');
}
// set prospect level
if ($action == 'setprospectlevel' && $user->rights->societe->creer)
{
$object->fetch($id);
$object->fk_prospectlevel=GETPOST('prospect_level_id','alpha');
$result=$object->set_prospect_level($user);
if ($result < 0) setEventMessage($object->error,'errors');
}
// Update communication level
if ($action == 'cstc')
{
$object->fetch($id);
$object->stcomm_id=GETPOST('stcomm','int');
$result=$object->set_commnucation_level($user);
if ($result < 0) setEventMessage($object->error,'errors');
}
// Update communication level
if ($action == 'cstc')
{
$object->fetch($id);
$object->stcomm_id=GETPOST('stcomm','int');
$result=$object->set_commnucation_level($user);
if ($result < 0) setEventMessage($object->error,'errors');
}
// Update communication level
if ($action == 'setOutstandingBill')
{
$object->fetch($id);
$object->outstanding_limit=GETPOST('OutstandingBill');
$result=$object->set_OutstandingBill($user);
if ($result < 0) setEventMessage($object->error,'errors');
// Update communication level
if ($action == 'setOutstandingBill')
{
if (!$cancelbutton) {
$object->fetch($id);
$object->outstanding_limit = GETPOST('OutstandingBill');
$result = $object->set_OutstandingBill($user);
if ($result < 0) {
setEventMessage($object->error, 'errors');
}
}
}
}
@ -821,11 +831,11 @@ if ($id > 0)
/*
* Barre d'actions
*/
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
print '<div class="tabsAction">';
if (! empty($conf->propal->enabled) && $user->rights->propal->creer)
@ -933,4 +943,3 @@ dol_htmloutput_mesg('',$mesgs);
// End of page
llxFooter();
$db->close();
?>

View File

@ -102,446 +102,390 @@ $object->substitutionarrayfortest=array(
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
// Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes')
{
if (empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"]))
if (empty($reshook)) {
// Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes')
{
$mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
}
else
{
$result=$object->createFromClone($object->id,$_REQUEST["clone_content"],$_REQUEST["clone_receivers"]);
if ($result > 0)
if (empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"]))
{
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
exit;
$mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
}
else
{
$mesg=$object->error;
}
}
$action='';
}
// Action send emailing for everybody
if ($action == 'sendallconfirmed' && $confirm == 'yes')
{
if (empty($conf->global->MAILING_LIMIT_SENDBYWEB))
{
// Pour des raisons de securite, on ne permet pas cette fonction via l'IHM,
// on affiche donc juste un message
$mesg='<div class="warning">'.$langs->trans("MailingNeedCommand").'</div>';
$mesg.='<br><textarea cols="70" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>';
$mesg.='<br><br><div class="warning">'.$langs->trans("MailingNeedCommand2").'</div>';
$action='';
}
else if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0)
{
$mesg='<div class="warning">'.$langs->trans("NotEnoughPermissions").'</div>';
$action='';
}
else
{
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
if ($object->statut == 0)
{
dol_print_error('','ErrorMailIsNotValidated');
exit;
}
$id = $object->id;
$subject = $object->sujet;
$message = $object->body;
$from = $object->email_from;
$replyto = $object->email_replyto;
$errorsto = $object->email_errorsto;
// Le message est-il en html
$msgishtml=-1; // Unknown by default
if (preg_match('/[\s\t]*<html>/i',$message)) $msgishtml=1;
// Warning, we must not use begin-commit transaction here
// because we want to save update for each mail sent.
$nbok=0; $nbko=0;
// On choisit les mails non deja envoyes pour ce mailing (statut=0)
// ou envoyes en erreur (statut=-1)
$sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.source_url, mc.source_id, mc.source_type, mc.tag";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".$object->id;
dol_syslog("fiche.php: select targets sql=".$sql, LOG_DEBUG);
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql); // nb of possible recipients
if ($num)
$result=$object->createFromClone($object->id,$_REQUEST["clone_content"],$_REQUEST["clone_receivers"]);
if ($result > 0)
{
dol_syslog("comm/mailing/fiche.php: nb of targets = ".$num, LOG_DEBUG);
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
exit;
}
else
{
$mesg=$object->error;
}
}
$action='';
}
$now=dol_now();
// Action send emailing for everybody
if ($action == 'sendallconfirmed' && $confirm == 'yes')
{
if (empty($conf->global->MAILING_LIMIT_SENDBYWEB))
{
// Pour des raisons de securite, on ne permet pas cette fonction via l'IHM,
// on affiche donc juste un message
$mesg='<div class="warning">'.$langs->trans("MailingNeedCommand").'</div>';
$mesg.='<br><textarea cols="70" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>';
$mesg.='<br><br><div class="warning">'.$langs->trans("MailingNeedCommand2").'</div>';
$action='';
}
else if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0)
{
$mesg='<div class="warning">'.$langs->trans("NotEnoughPermissions").'</div>';
$action='';
}
else
{
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
// Positionne date debut envoi
$sql="UPDATE ".MAIN_DB_PREFIX."mailing SET date_envoi=".$db->idate($now)." WHERE rowid=".$object->id;
if ($object->statut == 0)
{
dol_print_error('','ErrorMailIsNotValidated');
exit;
}
$id = $object->id;
$subject = $object->sujet;
$message = $object->body;
$from = $object->email_from;
$replyto = $object->email_replyto;
$errorsto = $object->email_errorsto;
// Le message est-il en html
$msgishtml=-1; // Unknown by default
if (preg_match('/[\s\t]*<html>/i',$message)) $msgishtml=1;
// Warning, we must not use begin-commit transaction here
// because we want to save update for each mail sent.
$nbok=0; $nbko=0;
// On choisit les mails non deja envoyes pour ce mailing (statut=0)
// ou envoyes en erreur (statut=-1)
$sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.source_url, mc.source_id, mc.source_type, mc.tag";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".$object->id;
dol_syslog("fiche.php: select targets sql=".$sql, LOG_DEBUG);
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql); // nb of possible recipients
if ($num)
{
dol_syslog("comm/mailing/fiche.php: nb of targets = ".$num, LOG_DEBUG);
$now=dol_now();
// Positionne date debut envoi
$sql="UPDATE ".MAIN_DB_PREFIX."mailing SET date_envoi=".$db->idate($now)." WHERE rowid=".$object->id;
$resql2=$db->query($sql);
if (! $resql2)
{
dol_print_error($db);
}
// Loop on each email and send it
$i = 0;
while ($i < $num && $i < $conf->global->MAILING_LIMIT_SENDBYWEB)
{
$res=1;
$obj = $db->fetch_object($resql);
// sendto en RFC2822
$sendto = str_replace(',',' ',dolGetFirstLastname($obj->firstname, $obj->lastname))." <".$obj->email.">";
// Make substitutions on topic and body. From (AA=YY;BB=CC;...) we keep YY, CC, ...
$other=explode(';',$obj->other);
$tmpfield=explode('=',$other[0],2); $other1=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
$tmpfield=explode('=',$other[1],2); $other2=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
$tmpfield=explode('=',$other[2],2); $other3=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
$tmpfield=explode('=',$other[3],2); $other4=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
$tmpfield=explode('=',$other[4],2); $other5=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
// Array of possible substitutions (See also fie mailing-send.php that should manage same substitutions)
$substitutionarray=array(
'__ID__' => $obj->source_id,
'__EMAIL__' => $obj->email,
'__LASTNAME__' => $obj->lastname,
'__FIRSTNAME__' => $obj->firstname,
'__MAILTOEMAIL__' => '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>',
'__OTHER1__' => $other1,
'__OTHER2__' => $other2,
'__OTHER3__' => $other3,
'__OTHER4__' => $other4,
'__OTHER5__' => $other5,
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
'__UNSUBSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>'
);
if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN))
{
$substitutionarray['__SECUREKEYPAYPAL__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_MEMBER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
else $substitutionarray['__SECUREKEYPAYPAL_MEMBER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'membersubscription' . $obj->source_id, 2);
}
$substitutionisok=true;
complete_substitutions_array($substitutionarray, $langs);
$newsubject=make_substitutions($subject,$substitutionarray);
$newmessage=make_substitutions($message,$substitutionarray);
$arr_file = array();
$arr_mime = array();
$arr_name = array();
$arr_css = array();
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0);
if (count($listofpaths))
{
foreach($listofpaths as $key => $val)
{
$arr_file[]=$listofpaths[$key]['fullname'];
$arr_mime[]=dol_mimetype($listofpaths[$key]['name']);
$arr_name[]=$listofpaths[$key]['name'];
}
}
// Fabrication du mail
$mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css);
if ($mail->error)
{
$res=0;
}
if (! $substitutionisok)
{
$mail->error='Some substitution failed';
$res=0;
}
// Send mail
if ($res)
{
$res=$mail->sendfile();
}
if ($res)
{
// Mail successful
$nbok++;
dol_syslog("comm/mailing/fiche.php: ok for #".$i.($mail->error?' - '.$mail->error:''), LOG_DEBUG);
$sql="UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
$sql.=" SET statut=1, date_envoi=".$db->idate($now)." WHERE rowid=".$obj->rowid;
$resql2=$db->query($sql);
if (! $resql2)
{
dol_print_error($db);
}
else
{
//if cheack read is use then update prospect contact status
if (strpos($message, '__CHECK_READ__') !== false)
{
//Update status communication of thirdparty prospect
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".$obj->rowid.")";
dol_syslog("fiche.php: set prospect thirdparty status sql=".$sql, LOG_DEBUG);
$resql2=$db->query($sql);
if (! $resql2)
{
dol_print_error($db);
}
//Update status communication of contact prospect
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.rowid=".$obj->rowid." AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
dol_syslog("fiche.php: set prospect contact status sql=".$sql, LOG_DEBUG);
$resql2=$db->query($sql);
if (! $resql2)
{
dol_print_error($db);
}
}
}
//test if CHECK READ change statut prospect contact
}
else
{
// Mail failed
$nbko++;
dol_syslog("comm/mailing/fiche.php: error for #".$i.($mail->error?' - '.$mail->error:''), LOG_WARNING);
$sql="UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
$sql.=" SET statut=-1, date_envoi=".$db->idate($now)." WHERE rowid=".$obj->rowid;
$resql2=$db->query($sql);
if (! $resql2)
{
dol_print_error($db);
}
}
$i++;
}
}
else
{
setEventMessage($langs->transnoentitiesnoconv("NoMoreRecipientToSendTo"));
}
// Loop finished, set global statut of mail
if ($nbko > 0)
{
$statut=2; // Status 'sent partially' (because at least one error)
if ($nbok > 0) setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
else setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
}
else
{
if ($nbok >= $num)
{
$statut=3; // Send to everybody
setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
}
else
{
$statut=2; // Status 'sent partially' (because not send to everybody)
setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
}
}
$sql="UPDATE ".MAIN_DB_PREFIX."mailing SET statut=".$statut." WHERE rowid=".$object->id;
dol_syslog("comm/mailing/fiche.php: update global status sql=".$sql, LOG_DEBUG);
$resql2=$db->query($sql);
if (! $resql2)
{
dol_print_error($db);
}
// Loop on each email and send it
$i = 0;
while ($i < $num && $i < $conf->global->MAILING_LIMIT_SENDBYWEB)
{
$res=1;
$obj = $db->fetch_object($resql);
// sendto en RFC2822
$sendto = str_replace(',',' ',dolGetFirstLastname($obj->firstname, $obj->lastname))." <".$obj->email.">";
// Make substitutions on topic and body. From (AA=YY;BB=CC;...) we keep YY, CC, ...
$other=explode(';',$obj->other);
$tmpfield=explode('=',$other[0],2); $other1=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
$tmpfield=explode('=',$other[1],2); $other2=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
$tmpfield=explode('=',$other[2],2); $other3=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
$tmpfield=explode('=',$other[3],2); $other4=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
$tmpfield=explode('=',$other[4],2); $other5=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
// Array of possible substitutions (See also fie mailing-send.php that should manage same substitutions)
$substitutionarray=array(
'__ID__' => $obj->source_id,
'__EMAIL__' => $obj->email,
'__LASTNAME__' => $obj->lastname,
'__FIRSTNAME__' => $obj->firstname,
'__MAILTOEMAIL__' => '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>',
'__OTHER1__' => $other1,
'__OTHER2__' => $other2,
'__OTHER3__' => $other3,
'__OTHER4__' => $other4,
'__OTHER5__' => $other5,
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
'__UNSUBSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>'
);
if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN))
{
$substitutionarray['__SECUREKEYPAYPAL__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_MEMBER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
else $substitutionarray['__SECUREKEYPAYPAL_MEMBER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'membersubscription' . $obj->source_id, 2);
}
$substitutionisok=true;
complete_substitutions_array($substitutionarray, $langs);
$newsubject=make_substitutions($subject,$substitutionarray);
$newmessage=make_substitutions($message,$substitutionarray);
$arr_file = array();
$arr_mime = array();
$arr_name = array();
$arr_css = array();
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0);
if (count($listofpaths))
{
foreach($listofpaths as $key => $val)
{
$arr_file[]=$listofpaths[$key]['fullname'];
$arr_mime[]=dol_mimetype($listofpaths[$key]['name']);
$arr_name[]=$listofpaths[$key]['name'];
}
}
// Fabrication du mail
$mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css);
if ($mail->error)
{
$res=0;
}
if (! $substitutionisok)
{
$mail->error='Some substitution failed';
$res=0;
}
// Send mail
if ($res)
{
$res=$mail->sendfile();
}
if ($res)
{
// Mail successful
$nbok++;
dol_syslog("comm/mailing/fiche.php: ok for #".$i.($mail->error?' - '.$mail->error:''), LOG_DEBUG);
$sql="UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
$sql.=" SET statut=1, date_envoi=".$db->idate($now)." WHERE rowid=".$obj->rowid;
$resql2=$db->query($sql);
if (! $resql2)
{
dol_print_error($db);
}
else
{
//if cheack read is use then update prospect contact status
if (strpos($message, '__CHECK_READ__') !== false)
{
//Update status communication of thirdparty prospect
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".$obj->rowid.")";
dol_syslog("fiche.php: set prospect thirdparty status sql=".$sql, LOG_DEBUG);
$resql2=$db->query($sql);
if (! $resql2)
{
dol_print_error($db);
}
//Update status communication of contact prospect
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.rowid=".$obj->rowid." AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
dol_syslog("fiche.php: set prospect contact status sql=".$sql, LOG_DEBUG);
$resql2=$db->query($sql);
if (! $resql2)
{
dol_print_error($db);
}
}
}
//test if CHECK READ change statut prospect contact
}
else
{
// Mail failed
$nbko++;
dol_syslog("comm/mailing/fiche.php: error for #".$i.($mail->error?' - '.$mail->error:''), LOG_WARNING);
$sql="UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
$sql.=" SET statut=-1, date_envoi=".$db->idate($now)." WHERE rowid=".$obj->rowid;
$resql2=$db->query($sql);
if (! $resql2)
{
dol_print_error($db);
}
}
$i++;
}
}
else
{
setEventMessage($langs->transnoentitiesnoconv("NoMoreRecipientToSendTo"));
}
// Loop finished, set global statut of mail
if ($nbko > 0)
{
$statut=2; // Status 'sent partially' (because at least one error)
if ($nbok > 0) setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
else setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
}
else
{
if ($nbok >= $num)
{
$statut=3; // Send to everybody
setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
}
else
{
$statut=2; // Status 'sent partially' (because not send to everybody)
setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
}
}
$sql="UPDATE ".MAIN_DB_PREFIX."mailing SET statut=".$statut." WHERE rowid=".$object->id;
dol_syslog("comm/mailing/fiche.php: update global status sql=".$sql, LOG_DEBUG);
$resql2=$db->query($sql);
if (! $resql2)
{
dol_syslog($db->error());
dol_print_error($db);
}
$action = '';
}
else
{
dol_syslog($db->error());
dol_print_error($db);
}
$action = '';
}
}
// Action send test emailing
if ($action == 'send' && empty($_POST["cancel"]))
{
$error=0;
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
$object->sendto = $_POST["sendto"];
if (! $object->sendto)
{
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("MailTo")).'</div>';
$error++;
}
if (! $error)
// Action send test emailing
if ($action == 'send' && empty($_POST["cancel"]))
{
// Le message est-il en html
$msgishtml=-1; // Inconnu par defaut
if (preg_match('/[\s\t]*<html>/i',$object->body)) $msgishtml=1;
$error=0;
// Pratique les substitutions sur le sujet et message
$tmpsujet=make_substitutions($object->sujet,$object->substitutionarrayfortest);
$tmpbody=make_substitutions($object->body,$object->substitutionarrayfortest);
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
$arr_file = array();
$arr_mime = array();
$arr_name = array();
$arr_css = array();
// Ajout CSS
if (!empty($object->bgcolor)) $arr_css['bgcolor'] = (preg_match('/^#/',$object->bgcolor)?'':'#').$object->bgcolor;
if (!empty($object->bgimage)) $arr_css['bgimage'] = $object->bgimage;
// Attached files
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0);
if (count($listofpaths))
$object->sendto = $_POST["sendto"];
if (! $object->sendto)
{
foreach($listofpaths as $key => $val)
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("MailTo")).'</div>';
$error++;
}
if (! $error)
{
// Le message est-il en html
$msgishtml=-1; // Inconnu par defaut
if (preg_match('/[\s\t]*<html>/i',$object->body)) $msgishtml=1;
// Pratique les substitutions sur le sujet et message
$tmpsujet=make_substitutions($object->sujet,$object->substitutionarrayfortest);
$tmpbody=make_substitutions($object->body,$object->substitutionarrayfortest);
$arr_file = array();
$arr_mime = array();
$arr_name = array();
$arr_css = array();
// Ajout CSS
if (!empty($object->bgcolor)) $arr_css['bgcolor'] = (preg_match('/^#/',$object->bgcolor)?'':'#').$object->bgcolor;
if (!empty($object->bgimage)) $arr_css['bgimage'] = $object->bgimage;
// Attached files
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0);
if (count($listofpaths))
{
$arr_file[]=$listofpaths[$key]['fullname'];
$arr_mime[]=dol_mimetype($listofpaths[$key]['name']);
$arr_name[]=$listofpaths[$key]['name'];
foreach($listofpaths as $key => $val)
{
$arr_file[]=$listofpaths[$key]['fullname'];
$arr_mime[]=dol_mimetype($listofpaths[$key]['name']);
$arr_name[]=$listofpaths[$key]['name'];
}
}
$mailfile = new CMailFile($tmpsujet,$object->sendto,$object->email_from,$tmpbody, $arr_file,$arr_mime,$arr_name,'', '', 0, $msgishtml,$object->email_errorsto,$arr_css);
$result=$mailfile->sendfile();
if ($result)
{
$mesg='<div class="ok">'.$langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($object->email_from,2),$mailfile->getValidAddress($object->sendto,2)).'</div>';
}
else
{
$mesg='<div class="error">'.$langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result.'</div>';
}
$action='';
}
$mailfile = new CMailFile($tmpsujet,$object->sendto,$object->email_from,$tmpbody, $arr_file,$arr_mime,$arr_name,'', '', 0, $msgishtml,$object->email_errorsto,$arr_css);
$result=$mailfile->sendfile();
if ($result)
{
$mesg='<div class="ok">'.$langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($object->email_from,2),$mailfile->getValidAddress($object->sendto,2)).'</div>';
}
else
{
$mesg='<div class="error">'.$langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result.'</div>';
}
$action='';
}
}
// Action add emailing
if ($action == 'add')
{
$object->email_from = trim($_POST["from"]);
$object->email_replyto = trim($_POST["replyto"]);
$object->email_errorsto = trim($_POST["errorsto"]);
$object->titre = trim($_POST["titre"]);
$object->sujet = trim($_POST["sujet"]);
$object->body = trim($_POST["body"]);
$object->bgcolor = trim($_POST["bgcolor"]);
$object->bgimage = trim($_POST["bgimage"]);
if (! $object->titre) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTitle"));
if (! $object->sujet) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTopic"));
if (! $object->body) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailMessage"));
if (! $mesg)
{
if ($object->create($user) >= 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
$mesg=$object->error;
}
$mesg='<div class="error">'.$mesg.'</div>';
$action="create";
}
// Action update description of emailing
if ($action == 'settitre' || $action == 'setemail_from' || $actino == 'setreplyto' || $action == 'setemail_errorsto')
{
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
if ($action == 'settitre') $object->titre = trim(GETPOST('titre','alpha'));
else if ($action == 'setemail_from') $object->email_from = trim(GETPOST('email_from','alpha'));
else if ($action == 'setemail_replyto') $object->email_replyto = trim(GETPOST('email_replyto','alpha'));
else if ($action == 'setemail_errorsto') $object->email_errorsto = trim(GETPOST('email_errorsto','alpha'));
else if ($action == 'settitre' && empty($object->titre)) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTitle"));
else if ($action == 'setfrom' && empty($object->email_from)) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailFrom"));
if (! $mesg)
{
if ($object->update($user) >= 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
$mesg=$object->error;
}
$mesg='<div class="error">'.$mesg.'</div>';
$action="";
}
/*
* Add file in email form
*/
if (! empty($_POST['addfile']))
{
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
// Set tmp user directory
dol_add_file_process($upload_dir,0,0);
$action="edit";
}
// Action remove file
if (! empty($_POST["removedfile"]))
{
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_remove_file_process($_POST['removedfile'],0);
$action="edit";
}
// Action update emailing
if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"]))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$isupload=0;
if (! $isupload)
// Action add emailing
if ($action == 'add')
{
$object->email_from = trim($_POST["from"]);
$object->email_replyto = trim($_POST["replyto"]);
$object->email_errorsto = trim($_POST["errorsto"]);
$object->titre = trim($_POST["titre"]);
$object->sujet = trim($_POST["sujet"]);
$object->body = trim($_POST["body"]);
$object->bgcolor = trim($_POST["bgcolor"]);
$object->bgimage = trim($_POST["bgimage"]);
if (! $object->titre) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTitle"));
if (! $object->sujet) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTopic"));
if (! $object->body) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailMessage"));
if (! $mesg)
{
if ($object->create($user) >= 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
$mesg=$object->error;
}
$mesg='<div class="error">'.$mesg.'</div>';
$action="create";
}
// Action update description of emailing
if ($action == 'settitre' || $action == 'setemail_from' || $actino == 'setreplyto' || $action == 'setemail_errorsto')
{
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
if ($action == 'settitre') $object->titre = trim(GETPOST('titre','alpha'));
else if ($action == 'setemail_from') $object->email_from = trim(GETPOST('email_from','alpha'));
else if ($action == 'setemail_replyto') $object->email_replyto = trim(GETPOST('email_replyto','alpha'));
else if ($action == 'setemail_errorsto') $object->email_errorsto = trim(GETPOST('email_errorsto','alpha'));
else if ($action == 'settitre' && empty($object->titre)) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTitle"));
else if ($action == 'setfrom' && empty($object->email_from)) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailFrom"));
if (! $mesg)
{
if ($object->update($user) >= 0)
@ -553,78 +497,136 @@ if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"
}
$mesg='<div class="error">'.$mesg.'</div>';
$action="";
}
/*
* Add file in email form
*/
if (! empty($_POST['addfile']))
{
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
// Set tmp user directory
dol_add_file_process($upload_dir,0,0);
$action="edit";
}
else
// Action remove file
if (! empty($_POST["removedfile"]))
{
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_remove_file_process($_POST['removedfile'],0);
$action="edit";
}
}
// Action confirmation validation
if ($action == 'confirm_valid' && $confirm == 'yes')
{
if ($object->id > 0)
// Action update emailing
if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"]))
{
$object->valid($user);
setEventMessage($langs->trans("MailingSuccessfullyValidated"));
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
else
{
dol_print_error($db);
}
}
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
// Resend
if ($action == 'confirm_reset' && $confirm == 'yes')
{
if ($object->id > 0)
{
$db->begin();
$isupload=0;
$result=$object->valid($user);
if ($result > 0)
if (! $isupload)
{
$result=$object->reset_targets_status($user);
$object->sujet = trim($_POST["sujet"]);
$object->body = trim($_POST["body"]);
$object->bgcolor = trim($_POST["bgcolor"]);
$object->bgimage = trim($_POST["bgimage"]);
if (! $object->sujet) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTopic"));
if (! $object->body) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailMessage"));
if (! $mesg)
{
if ($object->update($user) >= 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
$mesg=$object->error;
}
$mesg='<div class="error">'.$mesg.'</div>';
$action="edit";
}
if ($result > 0)
else
{
$db->commit();
$action="edit";
}
}
// Action confirmation validation
if ($action == 'confirm_valid' && $confirm == 'yes')
{
if ($object->id > 0)
{
$object->valid($user);
setEventMessage($langs->trans("MailingSuccessfullyValidated"));
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
else
{
$mesg=$object->error;
$db->rollback();
dol_print_error($db);
}
}
else
// Resend
if ($action == 'confirm_reset' && $confirm == 'yes')
{
dol_print_error($db);
if ($object->id > 0)
{
$db->begin();
$result=$object->valid($user);
if ($result > 0)
{
$result=$object->reset_targets_status($user);
}
if ($result > 0)
{
$db->commit();
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
else
{
$mesg=$object->error;
$db->rollback();
}
}
else
{
dol_print_error($db);
}
}
// Action confirmation suppression
if ($action == 'confirm_delete' && $confirm == 'yes')
{
if ($object->delete($object->id))
{
$url= (! empty($urlfrom) ? $urlfrom : 'liste.php');
header("Location: ".$url);
exit;
}
}
if (! empty($_POST["cancel"]))
{
$action = '';
}
}
// Action confirmation suppression
if ($action == 'confirm_delete' && $confirm == 'yes')
{
if ($object->delete($object->id))
{
$url= (! empty($urlfrom) ? $urlfrom : 'liste.php');
header("Location: ".$url);
exit;
}
}
if (! empty($_POST["cancel"]))
{
$action = '';
}
/*
* View

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* 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>
*
* This program is free software; you can redistribute it and/or modify
@ -413,7 +413,15 @@ class Propal extends CommonObject
// infos marge
$this->line->fk_fournprice = $fk_fournprice;
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->pa_ht = $pa_ht;
// Mise en option de la ligne
@ -565,7 +573,15 @@ class Propal extends CommonObject
$this->line->skip_update_total = $skip_update_total;
// infos marge
$this->line->fk_fournprice = $fk_fournprice;
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->pa_ht = $pa_ht;
$this->line->date_start=$date_start;
@ -797,7 +813,10 @@ class Propal extends CommonObject
$fk_parent_line,
$this->lines[$i]->fk_fournprice,
$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)
@ -932,6 +951,10 @@ class Propal extends CommonObject
$this->db->begin();
// get extrafields so they will be clone
foreach($this->lines as $line)
$line->fetch_optionals($line->rowid);
// Load source object
$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.= " WHERE p.fk_statut = c.id";
$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;
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
@ -2541,11 +2564,14 @@ class Propal extends CommonObject
$classname = $conf->global->PROPALE_ADDON;
// Include file with class
foreach ($conf->file->dol_document_root as $dirroot)
{
$dir = $dirroot."/core/modules/propale/";
// Load file with numbering class (if found)
$mybool|=@include_once $dir.$file;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$dir = dol_buildpath($reldir."core/modules/propale/");
// Load file with numbering class (if found)
$mybool|=@include_once $dir.$file;
}
if (! $mybool)

View File

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

View File

@ -5,7 +5,7 @@
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* 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>
*
* This program is free software; you can redistribute it and/or modify
@ -137,17 +137,20 @@ class Commande extends CommonOrder
$classname = $conf->global->COMMANDE_ADDON;
// Include file with class
foreach ($conf->file->dol_document_root as $dirroot)
{
$dir = $dirroot."/core/modules/commande/";
// Load file with numbering class (if found)
$mybool|=@include_once $dir.$file;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$dir = dol_buildpath($reldir."core/modules/commande/");
// Load file with numbering class (if found)
$mybool|=@include_once $dir.$file;
}
if (! $mybool)
{
dol_print_error('',"Failed to include file ".$file);
return '';
dol_print_error('',"Failed to include file ".$file);
return '';
}
$obj = new $classname();
@ -658,18 +661,19 @@ class Commande extends CommonOrder
$this->db->begin();
$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.= ", remise_absolue, remise_percent";
$sql.= ", entity";
$sql.= ")";
$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->source>=0 && $this->source != '' ?$this->source:'null');
$sql.= ", '".$this->db->escape($this->note_private)."'";
$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->modelpdf."'";
$sql.= ", ".($this->cond_reglement_id>0?"'".$this->cond_reglement_id."'":"null");
@ -725,7 +729,8 @@ class Commande extends CommonOrder
$fk_parent_line,
$this->lines[$i]->fk_fournprice,
$this->lines[$i]->pa_ht,
$this->lines[$i]->label
$this->lines[$i]->label,
$this->lines[$i]->array_options
);
if ($result < 0)
{
@ -863,6 +868,10 @@ class Commande extends CommonOrder
$this->db->begin();
// get extrafields so they will be clone
foreach($this->lines as $line)
$line->fetch_optionals($line->rowid);
// Load source object
$objFrom = dol_clone($this);
@ -893,6 +902,13 @@ class Commande extends CommonOrder
$this->date_validation = '';
$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
$result=$this->create($user);
if ($result < 0) $error++;
@ -980,7 +996,12 @@ class Commande extends CommonOrder
$line->marge_tx = $marginInfos[1];
$line->marque_tx = $marginInfos[2];
$this->lines[$i] = $line;
// 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->socid = $object->socid;
@ -999,6 +1020,11 @@ class Commande extends CommonOrder
$this->origin = $object->element;
$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
$this->linked_objects[$this->origin] = $this->origin_id;
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;
// infos marge
$this->line->fk_fournprice = $fk_fournprice;
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->pa_ht = $pa_ht;
// TODO Ne plus utiliser
@ -2399,7 +2433,15 @@ class Commande extends CommonOrder
$this->line->skip_update_total=$skip_update_total;
// infos marge
$this->line->fk_fournprice = $fk_fournprice;
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->pa_ht = $pa_ht;
// TODO deprecated

View File

@ -156,7 +156,7 @@ if ($resql)
print "<tr ".$bc[$var].">";
print '<td>';
$result='';
$lien=$lienfin='';
$lien = '<a href="'.dol_buildpath('/commande/orderstoinvoice.php',1).'?socid='.$obj->rowid.'">';
@ -164,7 +164,7 @@ if ($resql)
$name=$obj->nom;
$result.=($lien.img_object($langs->trans("ShowCompany").': '.$name,'company').$lienfin);
$result.=$lien.(dol_trunc($name,$maxlen)).$lienfin;
print $result;
print '</td>';
print '<td>'.$obj->town.'&nbsp;</td>';
@ -185,7 +185,7 @@ else
dol_print_error($db);
}
llxFooter();
$db->close();
llxFooter();
?>

File diff suppressed because it is too large Load Diff

View File

@ -164,7 +164,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$sql.= " ORDER BY dlr ASC";
// 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.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff";
$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')
{
// TODO This code is to avoid to count suppliers credit note (ff.type = 2)
// Ajouter gestion des avoirs fournisseurs, champ
if (($obj->total_ttc < 0 && $obj->type != 2)
|| ($obj->total_ttc > 0 && $obj->type == 2))
$showline=1;
// Uncomment this line to avoid to count suppliers credit note (ff.type = 2)
//$showline=(($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->type=$obj->type;
$ref = $facturefournstatic->getNomUrl(1,'');
@ -304,7 +305,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
if ($paiement) $total_ttc = $obj->total_ttc - $paiement;
$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)
{
$var=!$var;

View File

@ -111,7 +111,7 @@ if ($conf->salaries->enabled)
$total = 0 ;
print '<table class="noborder" width="100%">';
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("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);
@ -144,7 +144,7 @@ if ($conf->salaries->enabled)
$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="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>';
@ -174,7 +174,7 @@ if ($conf->tax->enabled)
print '<table class="noborder" width="100%">';
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("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);
@ -304,7 +304,7 @@ if ($conf->tax->enabled)
$total = 0 ;
print '<table class="noborder" width="100%">';
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("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);
@ -337,7 +337,7 @@ if ($conf->tax->enabled)
$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="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>';

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -8,7 +8,7 @@
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* 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) 2013 Cedric Gross <c.gross@kreiz-it.fr>
* 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]->pa_ht,
$this->lines[$i]->label,
''
$this->lines[$i]->array_options
);
if ($result < 0)
{
@ -593,6 +593,10 @@ class Facture extends CommonInvoice
$this->db->begin();
// get extrafields so they will be clone
foreach($this->lines as $line)
$line->fetch_optionals($line->rowid);
// Load source object
$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);
$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;
}
@ -740,6 +749,11 @@ class Facture extends CommonInvoice
$this->origin = $object->element;
$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
$this->linked_objects[$this->origin] = $this->origin_id;
if (! empty($object->other_linked_objects) && is_array($object->other_linked_objects))
@ -1564,11 +1578,11 @@ class Facture extends CommonInvoice
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('BILL_CANCEL',$this,$user,$langs,$conf);
if ($result < 0) {
$error++;
$error++;
$this->errors=$interface->errors;
$this->db->rollback();
return -1;
}
// Fin appel triggers
@ -2199,7 +2213,15 @@ class Facture extends CommonInvoice
$this->line->skip_update_total = $skip_update_total;
// infos marge
$this->line->fk_fournprice = $fk_fournprice;
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->pa_ht = $pa_ht;
if (is_array($array_option) && count($array_option)>0) {
@ -2482,52 +2504,64 @@ class Facture extends CommonInvoice
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';
$mybool=false;
$file = $conf->global->FACTURE_ADDON.".php";
$classname = $conf->global->FACTURE_ADDON;
// Include file with class
foreach ($conf->file->dol_document_root as $dirroot)
if (! empty($conf->global->FACTURE_ADDON))
{
$dir = $dirroot."/core/modules/facture/";
// Load file with numbering class (if found)
$mybool|=@include_once $dir.$file;
}
$mybool=false;
$file = $conf->global->FACTURE_ADDON.".php";
$classname = $conf->global->FACTURE_ADDON;
// For compatibility
if (! $mybool)
{
$file = $conf->global->FACTURE_ADDON."/".$conf->global->FACTURE_ADDON.".modules.php";
$classname = "mod_facture_".$conf->global->FACTURE_ADDON;
$classname = preg_replace('/\-.*$/','',$classname);
// Include file with class
foreach ($conf->file->dol_document_root as $dirroot)
{
$dir = $dirroot."/core/modules/facture/";
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$dir = dol_buildpath($reldir."core/modules/facture/");
// Load file with numbering class (if found)
$mybool|=@include_once $dir.$file;
}
}
//print "xx".$mybool.$dir.$file."-".$classname;
if (! $mybool)
{
dol_print_error('',"Failed to include file ".$file);
return '';
}
// For compatibility
if (! $mybool)
{
$file = $conf->global->FACTURE_ADDON."/".$conf->global->FACTURE_ADDON.".modules.php";
$classname = "mod_facture_".$conf->global->FACTURE_ADDON;
$classname = preg_replace('/\-.*$/','',$classname);
// Include file with class
foreach ($conf->file->dol_document_root as $dirroot)
{
$dir = $dirroot."/core/modules/facture/";
// Load file with numbering class (if found)
$mybool|=@include_once $dir.$file;
}
}
$obj = new $classname();
$numref = "";
$numref = $obj->getNumRef($soc,$this,$mode);
if (! $mybool)
{
dol_print_error('',"Failed to include file ".$file);
return '';
}
if ($numref != "")
{
return $numref;
$obj = new $classname();
$numref = "";
$numref = $obj->getNextValue($soc,$this,$mode);
if ($numref != "")
{
return $numref;
}
else
{
dol_print_error($db,"Facture::getNextNumRef ".$obj->error);
return "";
}
}
else
{
//dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error);
return false;
$langs->load("errors");
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
return "";
}
}
@ -3463,6 +3497,14 @@ class FactureLigne extends CommonInvoiceLine
return -1;
}
}
// 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();
@ -3574,7 +3616,7 @@ class FactureLigne extends CommonInvoiceLine
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result = $interface->run_triggers('LINEBILL_INSERT',$this,$user,$langs,$conf);
if ($result < 0)
if ($result < 0)
{
$error++;
$this->errors=$interface->errors;

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("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("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);
if (empty($mode))
{

View File

@ -71,182 +71,184 @@ $hookmanager->initHooks(array('paiementcard'));
$parameters=array('socid'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
/*
* Actions
*/
if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes'))
{
$error = 0;
if (empty($reshook)) {
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$paiement_id = 0;
$totalpayment = 0;
$atleastonepaymentnotnull = 0;
// Generate payment array and check if there is payment higher than invoice and payment date before invoice date
$tmpinvoice=new Facture($db);
foreach ($_POST as $key => $value)
/*
* Actions
*/
if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes'))
{
if (substr($key,0,7) == 'amount_')
$error = 0;
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$paiement_id = 0;
$totalpayment = 0;
$atleastonepaymentnotnull = 0;
// Generate payment array and check if there is payment higher than invoice and payment date before invoice date
$tmpinvoice=new Facture($db);
foreach ($_POST as $key => $value)
{
$cursorfacid = substr($key,7);
$amounts[$cursorfacid] = price2num(trim(GETPOST($key)));
$totalpayment = $totalpayment + $amounts[$cursorfacid];
if (! empty($amounts[$cursorfacid])) $atleastonepaymentnotnull++;
$result=$tmpinvoice->fetch($cursorfacid);
if ($result <= 0) dol_print_error($db);
$amountsresttopay[$cursorfacid]=price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement());
if ($amounts[$cursorfacid])
if (substr($key,0,7) == 'amount_')
{
// Check amount
if ($amounts[$cursorfacid] && (abs($amounts[$cursorfacid]) > abs($amountsresttopay[$cursorfacid])))
{
$addwarning=1;
$formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPay")).' '.$langs->trans("HelpPaymentHigherThanReminderToPay");
}
// Check date
if ($datepaye && ($datepaye < $tmpinvoice->date))
{
$langs->load("errors");
//$error++;
setEventMessage($langs->transnoentities("WarningPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'warnings');
}
}
$cursorfacid = substr($key,7);
$amounts[$cursorfacid] = price2num(trim(GETPOST($key)));
$totalpayment = $totalpayment + $amounts[$cursorfacid];
if (! empty($amounts[$cursorfacid])) $atleastonepaymentnotnull++;
$result=$tmpinvoice->fetch($cursorfacid);
if ($result <= 0) dol_print_error($db);
$amountsresttopay[$cursorfacid]=price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement());
if ($amounts[$cursorfacid])
{
// Check amount
if ($amounts[$cursorfacid] && (abs($amounts[$cursorfacid]) > abs($amountsresttopay[$cursorfacid])))
{
$addwarning=1;
$formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPay")).' '.$langs->trans("HelpPaymentHigherThanReminderToPay");
}
// Check date
if ($datepaye && ($datepaye < $tmpinvoice->date))
{
$langs->load("errors");
//$error++;
setEventMessage($langs->transnoentities("WarningPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'warnings');
}
}
$formquestion[$i++]=array('type' => 'hidden','name' => $key, 'value' => $_POST[$key]);
}
}
// Check parameters
if (! GETPOST('paiementcode'))
{
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('PaymentMode')), 'errors');
$error++;
}
if (! empty($conf->banque->enabled))
{
// If bank module is on, account is required to enter a payment
if (GETPOST('accountid') <= 0)
{
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')), 'errors');
$error++;
}
}
if (empty($totalpayment) && empty($atleastonepaymentnotnull))
{
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->trans('PaymentAmount')), 'errors');
$error++;
}
if (empty($datepaye))
{
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('Date')), 'errors');
$error++;
}
}
/*
* Action add_paiement
*/
if ($action == 'add_paiement')
{
if ($error)
{
$action = 'create';
}
// Le reste propre a cette action s'affiche en bas de page.
}
/*
* Action confirm_paiement
*/
if ($action == 'confirm_paiement' && $confirm == 'yes')
{
$error=0;
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$db->begin();
// Clean parameters amount if payment is for a credit note
if (GETPOST('type') == 2)
{
foreach ($amounts as $key => $value) // How payment is dispatch
{
$newvalue = price2num($value,'MT');
$amounts[$key] = -$newvalue;
}
}
if (! empty($conf->banque->enabled))
{
// Si module bank actif, un compte est obligatoire lors de la saisie d'un paiement
if (GETPOST('accountid') <= 0)
{
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')), 'errors');
$error++;
}
}
// Creation of payment line
$paiement = new Paiement($db);
$paiement->datepaye = $datepaye;
$paiement->amounts = $amounts; // Array with all payments dispatching
$paiement->paiementid = dol_getIdFromCode($db,$_POST['paiementcode'],'c_paiement');
$paiement->num_paiement = $_POST['num_paiement'];
$paiement->note = $_POST['comment'];
if (! $error)
{
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0));
if ($paiement_id < 0)
{
setEventMessage($paiement->error, 'errors');
$error++;
}
}
if (! $error)
{
$label='(CustomerInvoicePayment)';
if (GETPOST('type') == 2) $label='(CustomerInvoicePaymentBack)';
$result=$paiement->addPaymentToBank($user,'payment',$label,GETPOST('accountid'),GETPOST('chqemetteur'),GETPOST('chqbank'));
if ($result < 0)
{
setEventMessage($paiement->error, 'errors');
$error++;
}
}
if (! $error)
{
$db->commit();
// If payment dispatching on more than one invoice, we keep on summary page, otherwise go on invoice card
$invoiceid=0;
foreach ($paiement->amounts as $key => $amount)
{
$facid = $key;
if (is_numeric($amount) && $amount <> 0)
{
if ($invoiceid != 0) $invoiceid=-1; // There is more than one invoice payed by this payment
else $invoiceid=$facid;
$formquestion[$i++]=array('type' => 'hidden','name' => $key, 'value' => $_POST[$key]);
}
}
if ($invoiceid > 0) $loc = DOL_URL_ROOT.'/compta/facture.php?facid='.$invoiceid;
else $loc = DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$paiement_id;
header('Location: '.$loc);
exit;
// Check parameters
if (! GETPOST('paiementcode'))
{
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('PaymentMode')), 'errors');
$error++;
}
if (! empty($conf->banque->enabled))
{
// If bank module is on, account is required to enter a payment
if (GETPOST('accountid') <= 0)
{
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')), 'errors');
$error++;
}
}
if (empty($totalpayment) && empty($atleastonepaymentnotnull))
{
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->trans('PaymentAmount')), 'errors');
$error++;
}
if (empty($datepaye))
{
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('Date')), 'errors');
$error++;
}
}
else
/*
* Action add_paiement
*/
if ($action == 'add_paiement')
{
$db->rollback();
if ($error)
{
$action = 'create';
}
// Le reste propre a cette action s'affiche en bas de page.
}
/*
* Action confirm_paiement
*/
if ($action == 'confirm_paiement' && $confirm == 'yes')
{
$error=0;
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$db->begin();
// Clean parameters amount if payment is for a credit note
if (GETPOST('type') == 2)
{
foreach ($amounts as $key => $value) // How payment is dispatch
{
$newvalue = price2num($value,'MT');
$amounts[$key] = -$newvalue;
}
}
if (! empty($conf->banque->enabled))
{
// Si module bank actif, un compte est obligatoire lors de la saisie d'un paiement
if (GETPOST('accountid') <= 0)
{
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')), 'errors');
$error++;
}
}
// Creation of payment line
$paiement = new Paiement($db);
$paiement->datepaye = $datepaye;
$paiement->amounts = $amounts; // Array with all payments dispatching
$paiement->paiementid = dol_getIdFromCode($db,$_POST['paiementcode'],'c_paiement');
$paiement->num_paiement = $_POST['num_paiement'];
$paiement->note = $_POST['comment'];
if (! $error)
{
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0));
if ($paiement_id < 0)
{
setEventMessage($paiement->error, 'errors');
$error++;
}
}
if (! $error)
{
$label='(CustomerInvoicePayment)';
if (GETPOST('type') == 2) $label='(CustomerInvoicePaymentBack)';
$result=$paiement->addPaymentToBank($user,'payment',$label,GETPOST('accountid'),GETPOST('chqemetteur'),GETPOST('chqbank'));
if ($result < 0)
{
setEventMessage($paiement->error, 'errors');
$error++;
}
}
if (! $error)
{
$db->commit();
// If payment dispatching on more than one invoice, we keep on summary page, otherwise go on invoice card
$invoiceid=0;
foreach ($paiement->amounts as $key => $amount)
{
$facid = $key;
if (is_numeric($amount) && $amount <> 0)
{
if ($invoiceid != 0) $invoiceid=-1; // There is more than one invoice payed by this payment
else $invoiceid=$facid;
}
}
if ($invoiceid > 0) $loc = DOL_URL_ROOT.'/compta/facture.php?facid='.$invoiceid;
else $loc = DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$paiement_id;
header('Location: '.$loc);
exit;
}
else
{
$db->rollback();
}
}
}
/*
* View
*/

View File

@ -1,8 +1,9 @@
<?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* 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) 2014 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@ -164,7 +165,7 @@ class BonPrelevement extends CommonObject
/**
* 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 string $client_nom name of cliente
* @param int $amount amount of invoice
@ -889,30 +890,31 @@ class BonPrelevement extends CommonObject
*/
if (!$error)
{
$ref = "T".substr($year,-2).$month;
$ref = substr($year,-2).$month;
$sql = "SELECT substring(ref from char_length(ref) - 1)";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons";
$sql.= " WHERE ref LIKE '%".$ref."%'";
$sql.= " AND entity = ".$conf->entity;
$sql.= " ORDER BY ref DESC LIMIT 1";
dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
$sql = "SELECT count(*)";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons";
$sql.= " WHERE ref LIKE '".$ref."%'";
$sql.= " AND entity = ".$conf->entity;
if ($resql)
{
$row = $this->db->fetch_row($resql);
}
else
{
$error++;
dol_syslog("Erreur recherche reference");
}
dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
$row = $this->db->fetch_row($resql);
}
else
{
$error++;
dol_syslog("Erreur recherche reference");
}
$ref = $ref . substr("00".($row[0]+1), -2);
$filebonprev = $ref;
$ref = "T".$ref.str_pad(dol_substr("00".intval($row[0])+1),2,"0",STR_PAD_LEFT);
$filebonprev = $ref;
// Create withdraw receipt in database
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";
$sql.= " ref, entity, datec";
@ -1411,7 +1413,7 @@ class BonPrelevement extends CommonObject
fputs($this->file, ' </CstmrDrctDbtInitn>'.$CrLf);
fputs($this->file, '</Document>'.$CrLf);
$sql = "SELECT pl.amount";
/*$sql = "SELECT pl.amount";
$sql.= " FROM";
$sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
$sql.= " ".MAIN_DB_PREFIX."facture as f,";
@ -1437,7 +1439,7 @@ class BonPrelevement extends CommonObject
else
{
$result = -2;
}
}*/
}

View File

@ -300,7 +300,7 @@ if ($id > 0)
* Payments
*/
$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.= ", ".MAIN_DB_PREFIX."c_paiement as c ";
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
@ -333,8 +333,9 @@ if ($id > 0)
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 '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
print "<td>".$objp->paiement_type.' '.$objp->num_paiement."</td>\n";
print '<td align="right">'.price($objp->amount)."</td><td>&nbsp;".$langs->trans("Currency".$conf->currency)."</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 "</tr>";
$totalpaye += $objp->amount;
$i++;

View File

@ -94,7 +94,7 @@ abstract class ActionsContactCardCommon
/**
* Load data control
*
* @param string &$action Type of action
* @param string $action Type of action
* @param int $id Id of object
* @return void
*/
@ -228,7 +228,7 @@ abstract class ActionsContactCardCommon
/**
* 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
* @return string HTML output
*/

View File

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

View File

@ -1,12 +1,12 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* 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) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* 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
@ -41,6 +41,7 @@ class Contrat extends CommonObject
public $table_element='contrat';
public $table_element_line='contratdet';
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 $ref;
@ -91,23 +92,31 @@ class Contrat extends CommonObject
global $db, $langs, $conf;
$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";
$classname = $conf->global->CONTRACT_ADDON;
// Chargement de la classe de numerotation
$classname = $conf->global->CONTRACT_ADDON;
// Include file with class
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
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 '';
}
$result=include_once $dir.'/'.$file;
if ($result)
{
$obj = new $classname();
$numref = "";
$numref = $obj->getNextValue($soc,$this);
@ -117,15 +126,17 @@ class Contrat extends CommonObject
}
else
{
$this->error = $obj->error;
dol_print_error($db,get_class($this)."::getNextValue ".$obj->error);
return "";
}
}
else
{
print $langs->trans("Error")." ".$langs->trans("Error_CONTRACT_ADDON_NotDefined");
$langs->load("errors");
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
return "";
}
}
}
/**

View File

@ -28,7 +28,7 @@ $extrasize=GETPOST('size');
if (GETPOST('type')=='double' && strpos($extrasize,',')===false) $extrasize='24,8';
if (GETPOST('type')=='date') $extrasize='';
if (GETPOST('type')=='datetime') $extrasize='';
if (GETPOST('type')=='select') $extrasize='';
if (GETPOST('type')=='select') $extrasize='';
// Add attribute
@ -87,7 +87,7 @@ if ($action == 'add')
$mesg[]=$langs->trans("ErrorNoValueForRadioType");
$action = 'create';
}
if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox')) && GETPOST('param'))
if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox')) && GETPOST('param'))
{
// Construct array for parameter (value of select list)
$parameters = GETPOST('param');
@ -95,7 +95,7 @@ if ($action == 'add')
foreach($parameters_array as $param_ligne)
{
if (!empty($param_ligne)) {
if (preg_match_all('/,/',$param_ligne,$matches))
if (preg_match_all('/,/',$param_ligne,$matches))
{
if (count($matches[0])>1) {
$error++;
@ -104,7 +104,7 @@ if ($action == 'add')
$action = 'create';
}
}
else
else
{
$error++;
$langs->load("errors");
@ -112,12 +112,12 @@ if ($action == 'add')
$action = 'create';
}
}
}
}
}
if (! $error)
{
// attrname must be alphabetical and lower case only
// attrname must be alphabetical and lower case only
if (isset($_POST["attrname"]) && preg_match("/^[a-z0-9-_]+$/",$_POST['attrname']))
{
// Construct array for parameter (value of select list)
@ -139,8 +139,8 @@ if ($action == 'add')
list($key,$value) = explode(',',$param_ligne);
$params['options'][$key] = $value;
}
}
}
$result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$default_value,$params);
if ($result > 0)
{
@ -164,7 +164,7 @@ if ($action == 'add')
$action = 'create';
}
}
else
else
{
setEventMessage($mesg,'errors');
}

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');
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;
$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"',

View File

@ -37,12 +37,28 @@ class box_clients extends ModeleBoxes
var $depends = array("societe");
var $db;
var $param;
var $enabled = 1;
var $info_box_head = 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
*

View File

@ -39,11 +39,28 @@ class box_prospect extends ModeleBoxes
var $depends = array("societe");
var $db;
var $enabled = 1;
var $info_box_head = 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.
*

View File

@ -125,7 +125,7 @@ class Canvas
/**
* 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 string $ref Object ref (if id not provided)
* @return void
@ -181,7 +181,7 @@ class Canvas
/**
* Shared method for canvas to execute actions
*
* @param string &$action Action string
* @param string $action Action string
* @param int $id Object id
* @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

View File

@ -3,7 +3,7 @@
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* 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) 2011-2014 Philippe Grand <philippe.grand@atoo-net.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;
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
$thirdparty = new Societe($this->db);
$result=$thirdparty->fetch(isset($this->socid)?$this->socid:$this->fk_soc);
$this->client = $thirdparty; // deprecated
@ -2120,11 +2122,11 @@ abstract class CommonObject
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)
if ($key != 'rowid' && $key != 'tms' && $key != 'fk_member' && ! is_int($key))
// 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' && ! is_int($key))
{
// we can add this attribute to adherent object
$this->array_options["options_$key"]=$value;
// we can add this attribute to object properties
$this->array_options["options_".$key]=$value;
}
}
}
@ -2218,10 +2220,10 @@ abstract class CommonObject
$this->array_options[$key] = price2num($this->array_options[$key]);
break;
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;
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;
}
}
@ -2235,7 +2237,7 @@ abstract class CommonObject
{
$attributeKey = substr($key,8); // Remove 'options_' prefix
// 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 .= ") VALUES (".$this->id;
@ -2243,7 +2245,7 @@ abstract class CommonObject
{
$attributeKey = substr($key,8); // Remove 'options_' prefix
// 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] != '')
{

View File

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

View File

@ -154,7 +154,7 @@ class 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') {
$typedb='int';
@ -226,8 +226,7 @@ class ExtraFields
// Clean parameters
if (empty($pos)) $pos=0;
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(is_array($param) and count($param) > 0)
{
@ -744,15 +743,17 @@ class ExtraFields
if (strpos($InfoFieldList[4], 'extra')!==false)
{
$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
{
$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.
$sql.=preg_replace('/^ AND /','',$sqlwhere);
//$sql.=preg_replace('/^ AND /','',$sqlwhere);
//print $sql;
dol_syslog(get_class($this).'::showInputField type=sellist sql='.$sql);
@ -980,7 +981,10 @@ class ExtraFields
{
foreach ($fields_label as $field_toshow)
{
$translabel=$langs->trans($obj->$field_toshow);
$translabel='';
if (!empty($obj->$field_toshow)) {
$translabel=$langs->trans($obj->$field_toshow);
}
if ($translabel!=$field_toshow) {
$value.=dol_trunc($translabel,18).' ';
}else {
@ -990,7 +994,10 @@ class ExtraFields
}
else
{
$translabel=$langs->trans($obj->$InfoFieldList[1]);
$translabel='';
if (!empty($obj->$InfoFieldList[1])) {
$translabel=$langs->trans($obj->$InfoFieldList[1]);
}
if ($translabel!=$obj->$InfoFieldList[1]) {
$value=dol_trunc($translabel,18);
}else {
@ -1041,7 +1048,7 @@ class ExtraFields
* Fill array_options property of object by extrafields value (using for data sent by forms)
*
* @param array $extralabels $array of extrafields
* @param object &$object Object
* @param object $object Object
* @param string $onlykey Only following key is filled
* @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 array $parameters Array of parameters
* @param Object &$object Object to use hooks on
* @param string &$action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...)
* @param Object $object Object to use hooks on
* @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.
* 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.
@ -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.
$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 ($method =='insertExtraFields') $hooktype='returnvalue';
if (in_array(
$method,
array(

View File

@ -1492,9 +1492,9 @@ class Form
/**
* constructProductListOption
*
* @param resultset &$objp Resultset of fetch
* @param string &$opt Option
* @param string &$optJson Option
* @param resultset $objp Resultset of fetch
* @param string $opt Option
* @param string $optJson Option
* @param int $price_level Price level
* @param string $selected Preselected value
* @return void
@ -4080,7 +4080,7 @@ class Form
/**
* 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
* @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 '<table class="nobordernopadding"><tr class="nobordernopadding">';
print '<td class="nobordernopadding">';
if ($obj->rowid == 0)
{
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 ajax_autocompleter(($socid?$socid:-1),$htmlname,DOL_URL_ROOT.'/societe/ajaxcompanies.php','',$minLength);
print '</td>';
print '</tr>';
print '</table>';
print "\n";
return $socid;
}

View File

@ -4,7 +4,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@ -14,6 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* 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)
*
* @param int &$inc Cursor counter
* @param int $inc Cursor counter
* @param int $parent Id of parent task we want to see
* @param array $lines Array of task lines
* @param int $level Level
@ -1033,6 +1033,7 @@ class FormOther
if ($nbboxactivated)
{
$langs->load("boxes");
$langs->load("projects");
$emptybox=new ModeleBoxes($db);

View File

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

View File

@ -234,7 +234,7 @@ class Link extends CommonObject
/**
* 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 int $objectid id of the associated object in dolibarr
* @param string $sortfield field used to sort

View File

@ -152,7 +152,7 @@ class Menubase
$sql.= " '".$this->fk_menu."',";
$sql.= " ".($this->fk_mainmenu?"'".$this->fk_mainmenu."'":"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->target)."',";
$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 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 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
*/
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 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 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
*/
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 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 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
*/
function menuLoad($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)

View File

@ -258,7 +258,7 @@ class RssParser
if (!is_resource($xmlparser)) {
$this->error="ErrorFailedToCreateParser"; return -1;
}
xml_set_object($xmlparser, $this);
xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element');
xml_set_character_data_handler($xmlparser, 'feed_cdata');
@ -268,7 +268,7 @@ class RssParser
//var_dump($rss->_format);exit;
}
}
// If $rss loaded
if ($rss)
{
@ -452,7 +452,7 @@ class RssParser
*
* @param string $p Start
* @param string $element Tag
* @param array &$attrs Attributes of tags
* @param array $attrs Attributes of tags
* @return void
*/
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
*
* @param string &$str1 Str1
* @param string $str1 Str1
* @param string $str2 Str2
* @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
$langs->load("main");
$langs->load("agenda");
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
@ -57,7 +58,7 @@ if (GETPOST('mode') && GETPOST('mode') == 'test')
}
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)

View File

@ -17,8 +17,8 @@
*/
/**
* \file htdocs/core/db/dolidb.class.php
* \brief Class file to manage Dolibarr database access
* \file htdocs/core/db/DoliDB.class.php
* \brief Class file to manage Dolibarr database access
*/
require_once DOL_DOCUMENT_ROOT .'/core/db/Database.interface.php';

View File

@ -351,7 +351,6 @@ class DoliDBMysqli extends DoliDB
* @return int Nombre de lignes
* @see num_rows
*/
function affected_rows($resultset)
{
// 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'))
{
$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
@ -397,7 +397,7 @@ class DoliDBPgsql extends DoliDB
if (! $port) $port = 5432;
$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
@ -832,7 +832,7 @@ class DoliDBPgsql extends DoliDB
// Test charset match LC_TYPE (pgsql error otherwise)
//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);
$ret=$this->query($sql);
return $ret;

View File

@ -853,17 +853,17 @@ function unActivateModule($value, $requiredby=1)
/**
* Add external modules to list of dictionaries
*
* @param array &$taborder Taborder
* @param array &$tabname Tabname
* @param array &$tablib Tablib
* @param array &$tabsql Tabsql
* @param array &$tabsqlsort Tabsqlsort
* @param array &$tabfield Tabfield
* @param array &$tabfieldvalue Tabfieldvalue
* @param array &$tabfieldinsert Tabfieldinsert
* @param array &$tabrowid Tabrowid
* @param array &$tabcond Tabcond
* @param array &$tabhelp Tabhelp
* @param array $taborder Taborder
* @param array $tabname Tabname
* @param array $tablib Tablib
* @param array $tabsql Tabsql
* @param array $tabsqlsort Tabsqlsort
* @param array $tabfield Tabfield
* @param array $tabfieldvalue Tabfieldvalue
* @param array $tabfieldinsert Tabfieldinsert
* @param array $tabrowid Tabrowid
* @param array $tabcond Tabcond
* @param array $tabhelp Tabhelp
* @return int 1
*/
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 $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.
* @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)
{
@ -524,7 +524,7 @@ function dol_get_first_day_week($day,$month,$year,$gm=false)
}
$tmpmonth = $prev_month;
$tmpyear = $prev_year;
//Get first day of next week
$tmptime=dol_mktime(12,0,0,$month,$tmpday,$year,1,0);
$tmptime-=24*60*60*7;
@ -532,7 +532,7 @@ function dol_get_first_day_week($day,$month,$year,$gm=false)
$prev_day = $tmparray['mday'];
//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_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);
}
@ -563,9 +563,10 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
$nbFerie = 0;
// 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;
$countryfound=0;
@ -573,7 +574,6 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
$jour = date("d", $timestampStart);
$mois = date("m", $timestampStart);
$annee = date("Y", $timestampStart);
if ($countrycode == 'FR')
{
$countryfound=1;
@ -676,8 +676,10 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
if ($ferie) $nbFerie++;
// Increase number of days (on go up into loop)
$jour++;
$timestampStart=dol_mktime(0,0,0,$mois,$jour,$annee,1); // Generate GMT date for next day
$timestampStart=dol_time_plus_duree($timestampStart, 1, 'd');
//var_dump($jour.' '.$mois.' '.$annee.' '.$timestampStart);
$i++;
}
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 $lastday We include last day, 0: no, 1:yes
* @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
*/
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
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;
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");
if ($inhour == 1 && $nbOpenDay <= 3) $nbOpenDay = $nbOpenDay*24 . $langs->trans("HourShort");
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 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[] $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 $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
@ -1289,7 +1289,7 @@ function dol_uncompress($inputfile,$outputdir)
*
* @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[] $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
* @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 int $withcountry 1=Add country into address 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
*/
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='';
$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;
}
}
if ($withcountry) $ret.=($object->country?$sep.$object->country:'');
if (! is_object($outputlangs)) $outputlangs=$langs;
if ($withcountry) $ret.=($object->country_code?$sep.$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)):'');
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();
}
}
else $localtz = new DateTimeZone('UTC');
if (empty($localtz)) {
$localtz = new DateTimeZone('UTC');
}
$dt = new DateTime(null,$localtz);
$dt->setDate($year,$month,$day);
$dt->setTime((int) $hour, (int) $minute, (int) $second);
@ -3770,7 +3775,7 @@ function make_substitutions($chaine,$substitutionarray)
/**
* 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 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)
@ -4109,7 +4114,7 @@ function dol_htmloutput_errors($mesgstring='', $mesgarray='', $keepembedded=0)
* or descending output and uses optionally natural case insensitive sorting (which
* 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 int $order Sort order
* @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 Translate $langs Object langs
* @param Object $object Object object
* @param array &$head Object head
* @param int &$h New position to fill
* @param array $head Object head
* @param int $h New position to fill
* @param string $type Value for object where objectvalue can be
* 'thirdparty' to add a tab in third party 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.= " FROM ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE ".$field." LIKE '".$maskLike."'";
$sql.= " AND ".$field." NOT LIKE '%PROV%'";
$sql.= " AND ".$field." NOT LIKE '(PROV%)'";
$sql.= " AND entity IN (".getEntity($table, 1).")";
if ($where) $sql.=$where;
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
@ -1107,7 +1107,7 @@ function numero_semaine($time)
* Convertit une masse d'une unite vers une autre unite
*
* @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
* @return float Masse convertie
*/
@ -1142,7 +1142,7 @@ function weight_convert($weight,&$from_unit,$to_unit)
*
* @param DoliDB $db Handler database
* @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
* @return int <0 if KO, >0 if OK
*

View File

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

View File

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

View File

@ -309,7 +309,10 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
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))
{
@ -420,7 +423,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
/**
* 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 int $page_height Height of page
* @return void
@ -441,7 +444,7 @@ function pdf_pagehead(&$pdf,$outputlangs,$page_height)
/**
* Add a draft watermark on PDF files
*
* @param PDF &$pdf Object PDF
* @param PDF $pdf Object PDF
* @param Translate $outputlangs Object lang
* @param int $h Height 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
*
* @param PDF &$pdf Object PDF
* @param PDF $pdf Object PDF
* @param Translate $outputlangs Object lang
* @param int $curx X
* @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
*
* @param PDF &$pdf The PDF factory
* @param PDF $pdf The PDF factory
* @param Translate $outputlangs Object lang for output
* @param string $paramfreetext Constant name of free text
* @param Societe $fromcompany Object company
@ -852,7 +855,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
/**
* Show linked objects for PDF generation
*
* @param PDF &$pdf Object PDF
* @param PDF $pdf Object PDF
* @param object $object Object
* @param Translate $outputlangs Object lang
* @param int $posx X
@ -890,7 +893,7 @@ function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$w,$h,$al
/**
* Output line description into PDF
*
* @param PDF &$pdf PDF object
* @param PDF $pdf PDF object
* @param Object $object Object
* @param int $i Current line number
* @param Translate $outputlangs Object lang for output
@ -1587,13 +1590,13 @@ function pdf_getLinkedObjects($object,$outputlangs)
{
$outputlangs->load('orders');
$outputlangs->load('sendings');
$num=count($objects);
for ($i=0;$i<$num;$i++)
{
$objects[$i]->fetchObjectLinked();
$order = $objects[$i]->linkedObjects['commande'][0];
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending");
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : '');
$linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($objects[$i]->ref);

View File

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

View File

@ -206,13 +206,13 @@ function project_admin_prepare_head()
/**
* 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 array &$lines Array of all tasks
* @param int &$level Level of task
* @param array $lines Array of all tasks
* @param int $level Level of task
* @param string $var Color
* @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 $addordertick Add a tick to move task
* @return void
@ -443,12 +443,12 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
/**
* Output a task line
*
* @param string &$inc ?
* @param string $inc ?
* @param string $parent ?
* @param Object $lines ?
* @param int &$level ?
* @param string &$projectsrole ?
* @param string &$tasksrole ?
* @param int $level ?
* @param string $projectsrole ?
* @param string $tasksrole ?
* @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
* @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)
*
* @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 array &$lines Array of all tasks
* @param string &$taskrole Array of task filtered on a particular user
* @param array $lines Array of all tasks
* @param string $taskrole Array of task filtered on a particular user
* @return int 1 if there is
*/
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
{
$tmpreadok=1;
foreach($feature2 as $subfeature)
{
if (! empty($subfeature) && empty($user->rights->$feature->$subfeature->lire) && empty($user->rights->$feature->$subfeature->read)) { $readok=0; $nbko++; }
else if (empty($subfeature) && empty($user->rights->$feature->lire) && empty($user->rights->$feature->read)) { $readok=0; $nbko++; }
else { $readok=1; break; } // Break is to bypass second test if the first is ok
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)) { $tmpreadok=0; }
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

View File

@ -28,7 +28,7 @@
/**
* 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 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)

View File

@ -54,10 +54,8 @@ function trip_prepare_head($object)
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'trip','remove');
return $head;
}
?>

View File

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

View File

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

View File

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

View File

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

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