mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into
dev_fix5353 Conflicts: htdocs/societe/class/societe.class.php
This commit is contained in:
commit
419dd3095b
|
|
@ -287,10 +287,13 @@ script:
|
|||
php upgrade.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400.log
|
||||
php upgrade2.php 3.9.0 4.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade390400-2.log
|
||||
php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log
|
||||
php upgrade.php 4.0.0 5.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade400500.log
|
||||
php upgrade2.php 4.0.0 5.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade400500-2.log
|
||||
php step5.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-3.log
|
||||
cd -
|
||||
set +e
|
||||
echo
|
||||
#cat $TRAVIS_BUILD_DIR/upgrade390400-2.log
|
||||
#cat $TRAVIS_BUILD_DIR/upgrade400500-2.log
|
||||
#cat /tmp/dolibarr_install.log
|
||||
|
||||
- |
|
||||
|
|
|
|||
35
ChangeLog
35
ChangeLog
|
|
@ -162,6 +162,41 @@ So if you included it into your module, change your code like this to be compati
|
|||
|
||||
|
||||
|
||||
***** ChangeLog for 3.9.3 compared to 3.9.2 *****
|
||||
FIX: #4383 $userid not defined
|
||||
FIX: #4448 $filebonprev is not used, $this->filename now
|
||||
FIX: #4455
|
||||
FIX: #4749
|
||||
FIX: #4756
|
||||
FIX: #4828
|
||||
FIX: #4926
|
||||
FIX: #4964 buyprice in customer from shipping buyprice wasn't load in expedition::fetch_lines
|
||||
FIX: #5004
|
||||
FIX: #5068
|
||||
FIX: #5170 tva sign with INVOICE_POSITIVE_CREDIT_NOTE option
|
||||
FIX: #5338 use of not initialized var $aphour, $apmin, etc
|
||||
FIX: #5343
|
||||
FIX: #5380
|
||||
FIX: #5383 bad object id on don delete
|
||||
FIX: #5414
|
||||
FIX: #5470 User of expense report in bank transactions page is not correct
|
||||
FIX: a case of corrupted ODT by Word that insert <text:s> when it should not.
|
||||
FIX: Can't create thirdparty or validate invoice if profid is mandatory and profid does not exists for other countries
|
||||
FIX: dasboard wrong for late invoice
|
||||
FIX: duplicate jquery.js files
|
||||
FIX: extrafield cloned on project clone
|
||||
FIX: Failed to open file
|
||||
FIX: Filter on opportunity amount and budget
|
||||
FIX: form_confirm to delete payment on supplier invoice
|
||||
FIX: javascript error with german-switzerland language
|
||||
FIX: large expense note
|
||||
FIX: Missing original .js file (license violation if sources are not provided)
|
||||
FIX: Option strict mode compatibility
|
||||
FIX: product stats all bloc module without enbaled test
|
||||
FIX: receiving link never works
|
||||
FIX: task ODT company object not correctly retrieved
|
||||
FIX: Translate group perms as it is done into user perms
|
||||
FIX: We must take the last recent defined price when using price level
|
||||
|
||||
***** ChangeLog for 3.9.2 compared to 3.9.1 *****
|
||||
FIX: #4813 Won translation for the key OppStatusWON instead OppStatusWIN
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
Dolibarr ERP & CRM is a modern software to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda, ...).
|
||||
|
||||
It's an Open Source software (wrote in PHP language) designed for small and medium companies, foundation and freelances.
|
||||
It's an Open Source software (wrote in PHP language) designed for small, medium or large companies, foundations and freelances.
|
||||
|
||||
You can freely use, study, modify or distribute it according to its Free Software licence.
|
||||
|
||||
|
|
|
|||
|
|
@ -288,11 +288,11 @@ from origin/upstream and origin/pristine.
|
|||
> debian/get-orig-source.sh
|
||||
If script fails with error Bad certificate, you can set "export PERL_LWP_SSL_VERIFY_HOSTNAME=0" to solve this.
|
||||
|
||||
* Edit tgz file to remove
|
||||
* Edit orig.tar.gz file to remove
|
||||
- debian
|
||||
- htdocs/includes/ckeditor
|
||||
- htdocs/includes/jquery/plugins/datatables/extras/TableTools/swf
|
||||
- htdocs/includes/phpexcel
|
||||
- htdocs/includes/tcpdf
|
||||
- htdocs/includes/phpexcel or htdocs/includes/phpoffice
|
||||
- htdocs/includes/tcpdf or htdocs/includes/tecnickom
|
||||
And rename file into
|
||||
dolibarr-x.y.z+dfsgw.tgz
|
||||
(x.y.z = version, w start from 1 and is increased for each new git-import-orig already done)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ Architecture: all
|
|||
Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5,
|
||||
php5-cli,
|
||||
# Required PHP extensions
|
||||
php5-mysql | php5-mysqli, php5-curl, php5-gd, php5-ldap, php5-geoip,
|
||||
php5-mysql | php5-mysqli, php5-curl, php5-gd, php5-ldap,
|
||||
# Required PHP libraries
|
||||
php-pear, php-mail-mime,
|
||||
# php-tcpdf, libfpdi-php,
|
||||
|
|
@ -31,10 +31,10 @@ Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm |
|
|||
${misc:Depends},
|
||||
${perl:Depends}
|
||||
Recommends: apache2 | lighttpd | httpd
|
||||
Suggests: www-browser
|
||||
Suggests: www-browser, php5-geoip
|
||||
Description: Web based software to manage a company or foundation
|
||||
Dolibarr ERP & CRM is an easy to use open source/free software for small
|
||||
and medium companies, foundations or freelances. It includes different
|
||||
Dolibarr ERP & CRM is an easy to use open source/free software package for
|
||||
companies, foundations or freelances. It includes different
|
||||
features for Enterprise Resource Planning (ERP) and Customer Relationship
|
||||
Management (CRM) but also for different other activities.
|
||||
.
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
README.md
|
||||
README-FR.md
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# Remove warning, we want to keep both standard and minified sources.
|
||||
dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jsgantt/*
|
||||
dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jquery/*
|
||||
dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jquery/*
|
||||
# This is a textual data file
|
||||
source-is-missing htdocs/includes/mobiledetect/mobiledetectlib/Mobile_Detect.json
|
||||
|
|
@ -2,4 +2,4 @@
|
|||
version=3
|
||||
|
||||
#http://sf.net/dolibarr/dolibarr-(.+)\.tgz
|
||||
http://www.dolibarr.org/files/stable/standard/dolibarr-(.+)\.tgz
|
||||
http://www.dolibarr.org/files/stable/package_debian-ubuntu/dolibarr_(.+)\.orig\.tar\.gz
|
||||
|
|
|
|||
|
|
@ -4,17 +4,14 @@ File added into doxygen generated documentation
|
|||
|
||||
|
||||
<!-- Google analytics -->
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-9049390-1']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
ga('create', 'UA-9049390-16', 'auto');
|
||||
ga('send', 'pageview');
|
||||
|
||||
</script>
|
||||
<!-- End google analytics -->
|
||||
|
|
@ -41,5 +38,14 @@ google_ad_height = 60;
|
|||
<br>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Twitter ad collector -->
|
||||
<script src="//platform.twitter.com/oct.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">twttr.conversion.trackPid('ntm4n', { tw_sale_amount: 0, tw_order_quantity: 0 });</script>
|
||||
<noscript>
|
||||
<img height="1" width="1" style="display:none;" alt="" src="https://analytics.twitter.com/i/adsct?txn_id=ntm4n&p_id=Twitter&tw_sale_amount=0&tw_order_quantity=0" />
|
||||
<img height="1" width="1" style="display:none;" alt="" src="//t.co/i/adsct?txn_id=ntm4n&p_id=Twitter&tw_sale_amount=0&tw_order_quantity=0" />
|
||||
</noscript>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,6 +1,4 @@
|
|||
<!--
|
||||
File added into doxygen generated documentation
|
||||
-->
|
||||
<!-- File added into doxygen generated documentation -->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
|
|
@ -14,7 +12,23 @@ File added into doxygen generated documentation
|
|||
<link href="tabs.css" rel="stylesheet" type="text/css" />
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
<!-- End from dolibarr.org -->
|
||||
|
||||
<!-- Facebook Pixel Code -->
|
||||
<script>
|
||||
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
|
||||
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
|
||||
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
|
||||
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
|
||||
document,'script','//connect.facebook.net/en_US/fbevents.js');
|
||||
|
||||
fbq('init', '1998533953704960');
|
||||
fbq('track', "PageView");</script>
|
||||
<noscript><img height="1" width="1" style="display:none"
|
||||
src="https://www.facebook.com/tr?id=1998533953704960&ev=PageView&noscript=1"
|
||||
/></noscript>
|
||||
<!-- End Facebook Pixel Code -->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="top">
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ DoYouWantToStart=Vol iniciar el proc
|
|||
TechnicalParameters=Paràmetres tècnics
|
||||
IfFirstInstall=Si es tracta de la primera instal lació, haurà d'especificar alguns paràmetres tècnics. Si no els entén, no sabeu o va a procedir a una actualització, deixi els camps amb els valors proposats per defecte.
|
||||
|
||||
; WARNING !!! STRINGS HERE MUST BE LOWER THAN 60 CHARACTERS
|
||||
; WARNING !!! STRINGS HERE MUST BE LOWER THAN 70 CHARACTERS
|
||||
SMTPServer=Servidor SMTP (El seu o el del seu ISP, únicament primera instal.lació) :
|
||||
ApachePort=Puerto Apache (únicament primera instal.lació, normalment és el 80) :
|
||||
MySqlPort=Puerto Mysql (únicament primera instal.lació, normalment és el 3306) :
|
||||
|
|
@ -31,6 +31,7 @@ FailedToDeleteLock=FailedToDeleteLock=Error en l'eliminaci
|
|||
PortAlreadyInUse=Sembla que el port %1 ja està sent utilitzat. Es recomana cancel·lar, tornar enrere i especificar un altre valor per al port% 2. Cancel·lar i escollir un altre valor?
|
||||
|
||||
FirefoxDetected=S'ha detectat Firefox al seu ordinador. Voleu activar per defecte com a navegador per Dolibarr?
|
||||
ChromeDetected=S'ha detectat Chrome al seu ordinador. Voleu activar per defecte com a navegador per Dolibarr?
|
||||
ChooseDefaultBrowser=Esculli el seu navegador per defecte. Si no està segur, simplement feu clic a Obrir:
|
||||
|
||||
LaunchNow=Llançar ara Dolibarr
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ FailedToDeleteLock=Failed to delete the file %1/www/dolibarr/install.lock. You c
|
|||
PortAlreadyInUse=Port %1 seems to be already in use. You should cancel to go back and choose another value for %2 port. Cancel choice and choose another value ?
|
||||
|
||||
FirefoxDetected=Firefox has been detected on your computer. Would you like to use it as the default browser for Dolibarr ?
|
||||
ChromeDetected=Chrome has been detected on your computer. Would you like to use it as the default browser for Dolibarr ?
|
||||
ChooseDefaultBrowser=Please choose your default browser. If you are not sure, just click Open :
|
||||
|
||||
LaunchNow=Launch Dolibarr now
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ FailedToDeleteLock=Echec de la suppression du fichier %1/www/dolibarr/install.lo
|
|||
PortAlreadyInUse=Le port %1 semble déjà utilisé. Il est recommandé d'annuler pour revenir en arrière et spécifier une autre valeur pour le port %2. Annuler le choix et choisir une autre valeur ?
|
||||
|
||||
FirefoxDetected=Firefox a été détecté sur votre ordinateur. Voulez-vous en faire votre navigateur par défaut pour Dolibarr ?
|
||||
ChromeDetected=Chrome a été détecté sur votre ordinateur. Voulez-vous en faire votre navigateur par défaut pour Dolibarr ?
|
||||
ChooseDefaultBrowser=Merci de choisir votre navigateur par défaut. Si vous n'êtes pas sûr, cliquez simplement sur Ouvrir :
|
||||
|
||||
LaunchNow=Lancer Dolibarr maintenant
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ DoYouWantToStart=
|
|||
TechnicalParameters=Parámetros técnicos
|
||||
IfFirstInstall=Si se trata de la primera instalación, deberá especificar algunos parámetros técnicos. Si no los entiende, no está seguro o va a proceder a una actualización, deje los campos con los valores propuestos por defecto.
|
||||
|
||||
; WARNING !!! STRINGS HERE MUST BE LOWER THAN 60 CHARACTERS
|
||||
; WARNING !!! STRINGS HERE MUST BE LOWER THAN 70 CHARACTERS
|
||||
SMTPServer=Servidor SMTP (El suyo o el de su ISP, únicamente primera instalación) :
|
||||
ApachePort=Puerto Apache (únicamente primera instalación, normalmente es el 80) :
|
||||
MySqlPort=Puerto Mysql (únicamente primera instalación, normalmente es el 3306) :
|
||||
|
|
@ -31,6 +31,7 @@ FailedToDeleteLock=Error en la eliminaci
|
|||
PortAlreadyInUse=Parece que el puerto %1 ya esta siendo usado. Se recomienda cancelar, volver atras y especificar otro valor para el puerto %2. ¿Cancelar y escojer otro valor?
|
||||
|
||||
FirefoxDetected=Se ha detectado Firefox en su ordenador. Desea activarlo por defecto como navegador para Dolibarr ?
|
||||
ChromeDetected=Se ha detectado Chrome en su ordenador. Desea activarlo por defecto como navegador para Dolibarr ?
|
||||
ChooseDefaultBrowser=Escoja su navegador por defecto. Si no está seguro, simplementa haga clic en Abrir :
|
||||
|
||||
LaunchNow=Lanzar ahora Dolibarr
|
||||
|
|
|
|||
|
|
@ -540,13 +540,29 @@ begin
|
|||
begin
|
||||
//navigateur
|
||||
browser := 'iexplore.exe';
|
||||
if FileExists (pfPath+'/Mozilla Firefox/firefox.exe') then
|
||||
|
||||
if browser = 'iexplore.exe' then
|
||||
begin
|
||||
if MsgBox(CustomMessage('FirefoxDetected'),mbConfirmation,MB_YESNO) = IDYES then
|
||||
if FileExists (pfPath+'/Google/Chrome/Application/chrome.exe') then
|
||||
begin
|
||||
browser := pfPath+'/Mozilla Firefox/firefox.exe';
|
||||
if MsgBox(CustomMessage('ChromeDetected'),mbConfirmation,MB_YESNO) = IDYES then
|
||||
begin
|
||||
browser := pfPath+'/Google/Chrome/Application/chrome.exe';
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
if browser = 'iexplore.exe' then
|
||||
begin
|
||||
if FileExists (pfPath+'/Mozilla Firefox/firefox.exe') then
|
||||
begin
|
||||
if MsgBox(CustomMessage('FirefoxDetected'),mbConfirmation,MB_YESNO) = IDYES then
|
||||
begin
|
||||
browser := pfPath+'/Mozilla Firefox/firefox.exe';
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
if browser = 'iexplore.exe' then
|
||||
begin
|
||||
if FileExists (pfPath+'/Internet Explorer/iexplore.exe') then
|
||||
|
|
@ -611,14 +627,28 @@ begin
|
|||
destFile := pathWithSlashes+'/alias/dolibarr.conf';
|
||||
srcFile := pathWithSlashes+'/alias/dolibarr.conf.install';
|
||||
|
||||
if not FileExists (destFile) and FileExists(srcFile) then
|
||||
if FileExists(srcFile) then
|
||||
begin
|
||||
LoadStringFromFile (srcFile, srcContents);
|
||||
if not FileExists (destFile) then
|
||||
begin
|
||||
LoadStringFromFile (srcFile, srcContents);
|
||||
|
||||
StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
|
||||
StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
|
||||
StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
|
||||
StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
|
||||
|
||||
SaveStringToFile(destFile, srcContents, False);
|
||||
SaveStringToFile(destFile, srcContents, False);
|
||||
end
|
||||
else
|
||||
begin
|
||||
// We must replace to use format 2.4 of apache
|
||||
DeleteFile(destFile);
|
||||
LoadStringFromFile (srcFile, srcContents);
|
||||
|
||||
StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
|
||||
StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
|
||||
|
||||
SaveStringToFile(destFile, srcContents, False);
|
||||
end
|
||||
end
|
||||
DeleteFile(srcFile);
|
||||
|
||||
|
|
@ -632,13 +662,24 @@ begin
|
|||
destFile := pathWithSlashes+'/apps/phpmyadmin'+phpmyadminVersion+'/config.inc.php';
|
||||
srcFile := pathWithSlashes+'/apps/phpmyadmin'+phpmyadminVersion+'/config.inc.php.install';
|
||||
|
||||
if not FileExists (destFile) and FileExists (srcFile) then
|
||||
if FileExists(srcFile) then
|
||||
begin
|
||||
// sinon on prends le fichier par defaut
|
||||
LoadStringFromFile (srcFile, srcContents);
|
||||
StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
|
||||
StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
|
||||
SaveStringToFile(destFile,srcContents, False);
|
||||
if not FileExists (destFile) then
|
||||
begin
|
||||
LoadStringFromFile (srcFile, srcContents);
|
||||
StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
|
||||
StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
|
||||
SaveStringToFile(destFile,srcContents, False);
|
||||
end
|
||||
else
|
||||
begin
|
||||
// We must replace to use format 2.4 of apache
|
||||
DeleteFile(destFile);
|
||||
LoadStringFromFile (srcFile, srcContents);
|
||||
StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
|
||||
StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
|
||||
SaveStringToFile(destFile,srcContents, False);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@ $build =~ s/-.*$//g;
|
|||
# now build is 0+nmu1 for example
|
||||
$FILENAMEDEBNATIVE="${PROJECT}_${MAJOR}.${MINOR}.${build}";
|
||||
$FILENAMEDEB="${PROJECT}_${MAJOR}.${MINOR}.${newbuild}";
|
||||
$FILENAMEDEBSHORT="${PROJECT}_${MAJOR}.${MINOR}.${build}";
|
||||
|
||||
|
||||
my $copyalreadydone=0;
|
||||
|
|
@ -389,10 +390,15 @@ if ($nboftargetok) {
|
|||
{
|
||||
print 'Run git tag -a -f -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n";
|
||||
$ret=`git tag -a -f -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD"`;
|
||||
print 'Run git push -f --tags'."\n";
|
||||
$ret=`git push -f --tags`;
|
||||
}
|
||||
}
|
||||
print 'Run git push --tags'."\n";
|
||||
$ret=`git push --tags`;
|
||||
else
|
||||
{
|
||||
print 'Run git push --tags'."\n";
|
||||
$ret=`git push --tags`;
|
||||
}
|
||||
chdir("$olddir");
|
||||
}
|
||||
|
||||
|
|
@ -824,7 +830,7 @@ if ($nboftargetok) {
|
|||
$ret=`$cmd`;
|
||||
|
||||
print "Remove other files\n";
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/README-FR`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/README-FR.md`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README-FR`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/aps`;
|
||||
|
|
@ -1127,6 +1133,7 @@ if ($nboftargetok) {
|
|||
%filestoscansf=(
|
||||
"$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'none',
|
||||
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)',
|
||||
"$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM',
|
||||
"$DESTI/standard/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM'
|
||||
|
|
@ -1134,6 +1141,7 @@ if ($nboftargetok) {
|
|||
%filestoscanstableasso=(
|
||||
"$DESTI/package_rpm_generic/$FILENAMERPM"=>'package_rpm_generic',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'package_windows',
|
||||
"$DESTI/standard/$FILENAMETGZ.tgz"=>'standard',
|
||||
"$DESTI/standard/$FILENAMETGZ.zip"=>'standard'
|
||||
|
|
@ -1195,7 +1203,7 @@ if ($nboftargetok) {
|
|||
|
||||
print "\n";
|
||||
|
||||
if ($target eq 'SF') {
|
||||
if ($target eq 'SF' && $filestoscan{$file} ne 'none') {
|
||||
$destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD;
|
||||
}
|
||||
elsif ($target eq 'ASSO' and $NEWPUBLISH =~ /stable/) {
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
|||
}
|
||||
|
||||
// Recupere root dolibarr
|
||||
$path=preg_replace('/generate-facture.php/i','',$_SERVER["PHP_SELF"]);
|
||||
require ($path."../../htdocs/master.inc.php");
|
||||
//$path=preg_replace('/generate-produit.php/i','',$_SERVER["PHP_SELF"]);
|
||||
require (__DIR__. '/../../htdocs/master.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
|
||||
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
|||
}
|
||||
|
||||
// Recupere root dolibarr
|
||||
$path=preg_replace('/generate-commande.php/i','',$_SERVER["PHP_SELF"]);
|
||||
require ($path."../../htdocs/master.inc.php");
|
||||
//$path=preg_replace('/generate-commande.php/i','',$_SERVER["PHP_SELF"]);
|
||||
require (__DIR__. '/../../htdocs/master.inc.php');
|
||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
|||
}
|
||||
|
||||
// Recupere root dolibarr
|
||||
$path=preg_replace('/generate-produit.php/i','',$_SERVER["PHP_SELF"]);
|
||||
require ($path."../../htdocs/master.inc.php");
|
||||
//$path=preg_replace('/generate-produit.php/i','',$_SERVER["PHP_SELF"]);
|
||||
require (__DIR__. '/../../htdocs/master.inc.php');
|
||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
|||
}
|
||||
|
||||
// Recupere root dolibarr
|
||||
$path=preg_replace('/generate-propale.php/i','',$_SERVER["PHP_SELF"]);
|
||||
require ($path."../../htdocs/master.inc.php");
|
||||
//$path=preg_replace('/generate-propale.php/i','',$_SERVER["PHP_SELF"]);
|
||||
require (__DIR__. '/../../htdocs/master.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
|||
}
|
||||
|
||||
// Recupere root dolibarr
|
||||
$path=preg_replace('/generate-societe.php/i','',$_SERVER["PHP_SELF"]);
|
||||
require ($path."../../htdocs/master.inc.php");
|
||||
//$path=preg_replace('/generate-societe.php/i','',$_SERVER["PHP_SELF"]);
|
||||
require (__DIR__. '/../../htdocs/master.inc.php');
|
||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@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
|
||||
|
|
@ -56,7 +57,7 @@ $error=0;
|
|||
|
||||
@set_time_limit(0);
|
||||
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
|
||||
dol_syslog($script_file." launched with arg ".join(',',$argv));
|
||||
dol_syslog($script_file." launched with arg ".implode(',',$argv));
|
||||
|
||||
$mode = $argv[1];
|
||||
$filepath = $argv[2];
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@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
|
||||
|
|
@ -56,7 +57,7 @@ $error=0;
|
|||
|
||||
@set_time_limit(0);
|
||||
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
|
||||
dol_syslog($script_file." launched with arg ".join(',',$argv));
|
||||
dol_syslog($script_file." launched with arg ".implode(',',$argv));
|
||||
|
||||
$mode = $argv[1];
|
||||
$filepath = $argv[2];
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@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
|
||||
|
|
@ -56,7 +57,7 @@ $error=0;
|
|||
|
||||
@set_time_limit(0);
|
||||
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
|
||||
dol_syslog($script_file." launched with arg ".join(',',$argv));
|
||||
dol_syslog($script_file." launched with arg ".implode(',',$argv));
|
||||
|
||||
$mode = $argv[1];
|
||||
$filepath = $argv[2];
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
|
|
@ -146,7 +146,7 @@ $sqls=array(
|
|||
|
||||
@set_time_limit(0);
|
||||
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
|
||||
dol_syslog($script_file." launched with arg ".join(',',$argv));
|
||||
dol_syslog($script_file." launched with arg ".implode(',',$argv));
|
||||
|
||||
$mode = $argv[1];
|
||||
$option = $argv[2];
|
||||
|
|
@ -154,14 +154,14 @@ $option = $argv[2];
|
|||
if (empty($mode) || ! in_array($mode,array('test','confirm'))) {
|
||||
print "Usage: $script_file (test|confirm) (all|option)\n";
|
||||
print "\n";
|
||||
print "option can be ".join(',',array_keys($sqls))."\n";
|
||||
print "option can be ".implode(',',array_keys($sqls))."\n";
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (empty($option) || ! in_array($option, array_merge(array('all'),array_keys($sqls))) ) {
|
||||
print "Usage: $script_file (test|confirm) (all|option)\n";
|
||||
print "\n";
|
||||
print "option can be ".join(',',array_keys($sqls))."\n";
|
||||
print "option can be ".implode(',',array_keys($sqls))."\n";
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
|
|
@ -117,7 +117,7 @@ class Skeleton_Class extends CommonObject
|
|||
if (!$resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
|
|
@ -190,7 +190,7 @@ class Skeleton_Class extends CommonObject
|
|||
}
|
||||
} else {
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||
|
||||
return - 1;
|
||||
}
|
||||
|
|
@ -257,7 +257,7 @@ class Skeleton_Class extends CommonObject
|
|||
return $num;
|
||||
} else {
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||
|
||||
return - 1;
|
||||
}
|
||||
|
|
@ -302,7 +302,7 @@ class Skeleton_Class extends CommonObject
|
|||
if (!$resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
|
|
@ -363,7 +363,7 @@ class Skeleton_Class extends CommonObject
|
|||
if (!$resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -411,7 +411,7 @@ class Skeleton_Class extends CommonObject
|
|||
if ($result < 0) {
|
||||
$error ++;
|
||||
$this->errors = $object->errors;
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
// End
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2007-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@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
|
||||
|
|
@ -292,7 +292,7 @@ if ($resql)
|
|||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $all) . join(', ',$fieldstosearchall);
|
||||
print $langs->trans("FilterOnInto", $all) . implode(', ',$fieldstosearchall);
|
||||
}
|
||||
|
||||
$moreforfilter = '';
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ class autoTranslator
|
|||
//setting language pair
|
||||
$lang_pair = $src_lang.'|'.$dest_lang;
|
||||
|
||||
$src_text_to_translate=preg_replace('/%s/','SSSSS',join('',$src_texts));
|
||||
$src_text_to_translate=preg_replace('/%s/','SSSSS',implode('',$src_texts));
|
||||
$src_text_to_translate=preg_replace('/'.preg_quote('\n\n').'/',' NNNNN ',$src_text_to_translate);
|
||||
|
||||
// Define GET URL v1
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
/* Copyright (c) 2015 Tommaso Basilici <t.basilici@19.coop>
|
||||
* Copyright (c) 2015 Laurent Destailleur <eldy@destailleur.fr>
|
||||
/* Copyright (c) 2015 Tommaso Basilici <t.basilici@19.coop>
|
||||
* Copyright (c) 2015 Laurent Destailleur <eldy@destailleur.fr>
|
||||
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@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
|
||||
|
|
@ -293,6 +294,12 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
|
|||
if (preg_match('/^Language_/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^DescADHERENT_/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^SubmitTranslation/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^ModuleCompanyCode/', $value)) $qualifiedforclean=0;
|
||||
// boxes.lang
|
||||
if (preg_match('/^BoxTitleLast/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^BoxTitleLatest/', $value)) $qualifiedforclean=0;
|
||||
// install.lang
|
||||
if (preg_match('/^KeepDefaultValues/', $value)) $qualifiedforclean=0;
|
||||
// main.lang
|
||||
if (preg_match('/^Duration/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^FormatDate/', $value)) $qualifiedforclean=0;
|
||||
|
|
@ -357,7 +364,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
|
|||
{
|
||||
$filetosave='/tmp/'.($argv[2]?$argv[2]:"").'notused.lang';
|
||||
print "Strings in en_US that are never used are saved into file ".$filetosave.":\n";
|
||||
file_put_contents($filetosave, join("",$unused));
|
||||
file_put_contents($filetosave, implode("",$unused));
|
||||
print "To remove from original file, run command :\n";
|
||||
if (($argv[2]?$argv[2]:"")) print 'cd htdocs/langs/en_US; mv '.($argv[2]?$argv[2]:"")." ".($argv[2]?$argv[2]:"").".tmp; ";
|
||||
print "diff ".($argv[2]?$argv[2]:"").".tmp ".$filetosave." | grep \< | cut -b 3- > ".($argv[2]?$argv[2]:"");
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
* \ingroup Advanced accountancy
|
||||
* \brief Balance of book keeping
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
|
|
@ -184,7 +185,7 @@ else {
|
|||
print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
|
|
@ -213,6 +214,9 @@ else {
|
|||
|
||||
$total_debit = 0;
|
||||
$total_credit = 0;
|
||||
$sous_total_debit = 0;
|
||||
$sous_total_credit = 0;
|
||||
$displayed_account = "";
|
||||
|
||||
foreach ( $object->lines as $line ) {
|
||||
$var = ! $var;
|
||||
|
|
@ -220,33 +224,59 @@ else {
|
|||
$total_debit += $line->debit;
|
||||
$total_credit += $line->credit;
|
||||
$description = $object->get_compte_desc($line->numero_compte); // Search description of the account
|
||||
$root_account_description = $object->get_compte_racine($line->numero_compte);
|
||||
if(empty($description)){
|
||||
$link = '<a href="../admin/card.php?action=create&compte=' . length_accountg($line->numero_compte) . '">' . img_edit_add() .'</a>';
|
||||
}
|
||||
print '<tr'. $bc[$var].'>';
|
||||
|
||||
|
||||
// Permet d'afficher le compte comptable
|
||||
if ($root_account_description != $displayed_account) {
|
||||
|
||||
// Affiche un Sous-Total par compte comptable
|
||||
if ($displayed_account != "") {
|
||||
print '<tr class="liste_total"><td align="right" colspan="2">'.$langs->trans("SubTotal") . ':</td><td class="nowrap" align="right">'.price($sous_total_debit).'</td><td class="nowrap" align="right">'.price($sous_total_credit).'</td><td class="nowrap" align="right">'.price($sous_total_credit-$sous_total_debit).'</td>';
|
||||
print "<td> </td>\n";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Affiche le compte comptable en début de ligne
|
||||
print "<tr>";
|
||||
print '<td colspan="6" style="font-weight:bold; border-bottom: 1pt solid black;">'. $root_account_description .'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$displayed_account = $root_account_description;
|
||||
$sous_total_debit = 0;
|
||||
$sous_total_credit = 0;
|
||||
}
|
||||
|
||||
// $object->get_compte_racine($line->numero_compte);
|
||||
|
||||
|
||||
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
||||
print '<td>' . $description . '</td>';
|
||||
print '<td align="right">' . number_format($line->debit, 2, ',', ' ') . '</td>';
|
||||
print '<td align="right">' . number_format($line->credit, 2, ',', ' ') . '</td>';
|
||||
print '<td align="right">' . number_format($line->credit - $line->debit, 2, ',', ' ') . '</td>';
|
||||
print '<td align="right">' . number_format($line->credit, 2, ',', ' ') . '</td>';
|
||||
print '<td align="right">' . number_format($line->credit - $line->debit, 2, ',', ' ') . '</td>';
|
||||
print '<td align="center">' . $link;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Comptabilise le sous-total
|
||||
$sous_total_debit += $line->debit;
|
||||
$sous_total_credit += $line->credit;
|
||||
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td align="right">';
|
||||
print price($total_debit);
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print price($total_credit);
|
||||
print '</td>';
|
||||
print '<td align="right">' . price($total_credit - $total_debit) . '</td>';
|
||||
print '<td align="right"></td>';
|
||||
print '</tr>';
|
||||
print '<tr class="liste_total"><td align="right" colspan="2">'.$langs->trans("SubTotal") . ':</td><td class="nowrap" align="right">'.price($sous_total_debit).'</td><td class="nowrap" align="right">'.price($sous_total_credit).'</td><td class="nowrap" align="right">'.price($sous_total_credit-$sous_total_debit).'</td>';
|
||||
print "<td> </td>\n";
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_total"><td align="right" colspan="2">'.$langs->trans("AccountBalance") . ':</td><td class="nowrap" align="right">'.price($total_debit).'</td><td class="nowrap" align="right">'.price($total_credit).'</td><td class="nowrap" align="right">'.price($total_credit-$total_debit).'</td>';
|
||||
print "<td> </td>\n";
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print "</table>";
|
||||
print '</form>';
|
||||
|
|
|
|||
|
|
@ -258,7 +258,6 @@ if ($action == 'export_csv') {
|
|||
*/
|
||||
|
||||
$title_page = $langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end);
|
||||
|
||||
llxHeader('', $title_page);
|
||||
|
||||
// List
|
||||
|
|
@ -315,6 +314,7 @@ print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield
|
|||
|
||||
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||
print '<div class="tabsAction">' . "\n";
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="./listbyaccount.php">' . $langs->trans("Bookkeeping") . ' ' . strtolower($langs->trans("By")) . ' ' . strtolower($langs->trans("AccountAccounting")) . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><input type="submit" name="button_delmvt" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" /></div>';
|
||||
|
|
|
|||
348
htdocs/accountancy/bookkeeping/listbyaccount.php
Normal file
348
htdocs/accountancy/bookkeeping/listbyaccount.php
Normal file
|
|
@ -0,0 +1,348 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright (C) 2016 Neil Orley <neil.orley@oeris.fr>
|
||||
* largely based on the great work of :
|
||||
* - Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* - Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* - Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@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
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/bookkeeping/listbyaccount.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief List operation of book keeping ordered by account number
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("accountancy");
|
||||
|
||||
$page = GETPOST("page");
|
||||
$sortorder = GETPOST("sortorder");
|
||||
$sortfield = GETPOST("sortfield");
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
|
||||
|
||||
|
||||
|
||||
$search_accountancy_code = GETPOST("search_accountancy_code");
|
||||
|
||||
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
|
||||
if ($search_accountancy_code_start == - 1) {
|
||||
$search_accountancy_code_start = '';
|
||||
}
|
||||
$search_label_account = GETPOST('search_label_account', 'alpha');
|
||||
|
||||
$search_mvt_label = GETPOST('search_mvt_label', 'alpha');
|
||||
$search_direction = GETPOST('search_direction', 'alpha');
|
||||
$search_ledger_code = GETPOST('search_ledger_code', 'alpha');
|
||||
|
||||
$limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$offset = $limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$object = new BookKeeping($db);
|
||||
|
||||
$formventilation = new FormVentilation($db);
|
||||
$formother = new FormOther($db);
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
|
||||
|
||||
if (empty($search_date_start)) {
|
||||
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
||||
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
||||
}
|
||||
if ($sortorder == "")
|
||||
$sortorder = "ASC";
|
||||
if ($sortfield == "")
|
||||
$sortfield = "t.rowid";
|
||||
|
||||
|
||||
$options = '';
|
||||
$filter = array ();
|
||||
|
||||
if (! empty($search_date_start)) {
|
||||
$filter['t.doc_date>='] = $search_date_start;
|
||||
$options .= '&date_startmonth=' . GETPOST('date_startmonth', 'int') . '&date_startday=' . GETPOST('date_startday', 'int') . '&date_startyear=' . GETPOST('date_startyear', 'int');
|
||||
}
|
||||
if (! empty($search_date_end)) {
|
||||
$filter['t.doc_date<='] = $search_date_end;
|
||||
$options .= '&date_endmonth=' . GETPOST('date_endmonth', 'int') . '&date_endday=' . GETPOST('date_endday', 'int') . '&date_endyear=' . GETPOST('date_endyear', 'int');
|
||||
}
|
||||
if (! empty($search_doc_date)) {
|
||||
$filter['t.doc_date'] = $search_doc_date;
|
||||
$options .= '&doc_datemonth=' . GETPOST('doc_datemonth', 'int') . '&doc_dateday=' . GETPOST('doc_dateday', 'int') . '&doc_dateyear=' . GETPOST('doc_dateyear', 'int');
|
||||
}
|
||||
|
||||
|
||||
if (!GETPOST("button_removefilter_x") && !GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
if (! empty($search_accountancy_code_start)) {
|
||||
$filter['t.numero_compte'] = $search_accountancy_code_start;
|
||||
$options .= '&search_accountancy_code_start=' . $search_accountancy_code_start;
|
||||
}
|
||||
if (! empty($search_label_account)) {
|
||||
$filter['t.label_compte'] = $search_label_account;
|
||||
$options .= '&search_label_account=' . $search_label_account;
|
||||
}
|
||||
if (! empty($search_mvt_label)) {
|
||||
$filter['t.label_compte'] = $search_mvt_label;
|
||||
$options .= '&search_mvt_label=' . $search_mvt_label;
|
||||
}
|
||||
if (! empty($search_direction)) {
|
||||
$filter['t.sens'] = $search_direction;
|
||||
$options .= '&search_direction=' . $search_direction;
|
||||
}
|
||||
if (! empty($search_ledger_code)) {
|
||||
$filter['t.code_journal'] = $search_ledger_code;
|
||||
$options .= '&search_ledger_code=' . $search_ledger_code;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_doc_date = '';
|
||||
$search_accountancy_code = '';
|
||||
$search_accountancy_code_start = '';
|
||||
$search_label_account = '';
|
||||
$search_mvt_label = '';
|
||||
$search_direction = '';
|
||||
$search_ledger_code = '';
|
||||
}
|
||||
|
||||
if ($action == 'delmouvconfirm') {
|
||||
|
||||
$mvt_num = GETPOST('mvt_num', 'int');
|
||||
|
||||
if (! empty($mvt_num)) {
|
||||
$result = $object->deleteMvtNum($mvt_num);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
Header("Location: listbyaccount.php");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$title_page = $langs->trans("Bookkeeping") . ' ' . strtolower($langs->trans("By")) . ' ' . $langs->trans("AccountAccounting") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end);
|
||||
|
||||
llxHeader('', $title_page);
|
||||
|
||||
// List
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter);
|
||||
if ($nbtotalofrecords < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
$result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
$nbtotalofrecords = $result;
|
||||
|
||||
if ($action == 'delmouv') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1);
|
||||
print $formconfirm;
|
||||
}
|
||||
if ($action == 'delbookkeepingyear') {
|
||||
|
||||
$form_question = array ();
|
||||
$delyear = GETPOST('delyear');
|
||||
|
||||
if (empty($delyear)) {
|
||||
$delyear = dol_print_date(dol_now(), '%Y');
|
||||
}
|
||||
$year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
|
||||
|
||||
$form_question['delyear'] = array (
|
||||
'name' => 'delyear',
|
||||
'type' => 'select',
|
||||
'label' => $langs->trans('DelYear'),
|
||||
'values' => $year_array,
|
||||
'default' => $delyear
|
||||
);
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1);
|
||||
print $formconfirm;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords,'',0,'','',$limit);
|
||||
|
||||
// Reverse sort order
|
||||
if ( preg_match('/^asc/i', $sortorder) )
|
||||
$sortorder = "asc";
|
||||
else
|
||||
$sortorder = "desc";
|
||||
|
||||
print '<div class="tabsAction">' . "\n";
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
|
||||
print '</div>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>' . $langs->trans("AccountAccounting") . '</td>';
|
||||
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
|
||||
print '<td>' . $langs->trans("SuppliersInvoices") . ' / ' . $langs->trans("CustomersInvoices") . '</td>';
|
||||
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="GET">';
|
||||
print '<td width >' . $object->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '') . '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print $langs->trans('From') . ': ';
|
||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
||||
print '<br>';
|
||||
print $langs->trans('to') . ': ';
|
||||
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/></td>';
|
||||
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_account" value="' . $search_label_account . '"/></td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="right"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
||||
print '<td align="right" colspan="2" class="liste_titre">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
$var = True;
|
||||
|
||||
$total_debit = 0;
|
||||
$total_credit = 0;
|
||||
$sous_total_debit = 0;
|
||||
$sous_total_credit = 0;
|
||||
$displayed_account_number = "";
|
||||
|
||||
foreach ( $object->lines as $line ) {
|
||||
$var = ! $var;
|
||||
|
||||
$total_debit += $line->debit;
|
||||
$total_credit += $line->credit;
|
||||
|
||||
// Permet d'afficher le compte comptable
|
||||
if (length_accountg($line->numero_compte) != $displayed_account_number) {
|
||||
|
||||
// Affiche un Sous-Total par compte comptable
|
||||
if ($displayed_account_number != "") {
|
||||
print '<tr class="liste_total"><td align="right" colspan="4">'.$langs->trans("SubTotal").':</td><td class="nowrap" align="right">'.price($sous_total_debit).'</td><td class="nowrap" align="right">'.price($sous_total_credit).'</td>';
|
||||
print "<td> </td>\n";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Affiche le compte comptable en début de ligne
|
||||
print "<tr>";
|
||||
print '<td colspan="7" style="font-weight:bold; border-bottom: 1pt solid black;">'.length_accountg($line->numero_compte) . ' : ' . $object->get_compte_desc($line->numero_compte).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$displayed_account_number = length_accountg($line->numero_compte);
|
||||
$sous_total_debit = 0;
|
||||
$sous_total_credit = 0;
|
||||
}
|
||||
|
||||
print '<tr'. $bc[$var].'>';
|
||||
print '<td> </td>';
|
||||
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
|
||||
print '<td><a href="./card.php?piece_num=' . $line->piece_num . '">' . $line->doc_ref . '</a></td>';
|
||||
|
||||
// Affiche un lien vers la facture client/fournisseur
|
||||
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
|
||||
if ($line->doc_type == 'supplier_invoice')
|
||||
print strlen(length_accounta($line->code_tiers)) == 0 ? '<td><a href="/fourn/facture/list.php?search_ref_supplier=' . $doc_ref . '">' . $line->label_compte . '</a></td>' : '<td><a href="/fourn/facture/list.php?search_ref_supplier=' . $doc_ref . '">' . $line->label_compte . '</a><br /><span style="font-size:0.8em">(' . length_accounta($line->code_tiers) . ')</span></td>';
|
||||
elseif ($line->doc_type == 'customer_invoice')
|
||||
print strlen(length_accounta($line->code_tiers)) == 0 ? '<td><a href="/compta/facture/list.php?search_ref=' . $doc_ref . '">' . $line->label_compte . '</a></td>' : '<td><a href="/compta/facture/list.php?search_ref=' . $doc_ref . '">' . $line->label_compte . '</a><br /><span style="font-size:0.8em">(' . length_accounta($line->code_tiers) . ')</span></td>';
|
||||
else
|
||||
print strlen(length_accounta($line->code_tiers)) == 0 ? '<td>' . $line->label_compte . '</td>' : '<td>' . $line->label_compte . '<br /><span style="font-size:0.8em">(' . length_accounta($line->code_tiers) . ')</span></td>';
|
||||
|
||||
|
||||
print '<td align="right">' . price($line->debit) . '</td>';
|
||||
print '<td align="right">' . price($line->credit) . '</td>';
|
||||
print '<td align="center">' . $line->code_journal . '</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a> ';
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $options . '&page=' . $page . '">' . img_delete() . '</a>';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Comptabilise le sous-total
|
||||
$sous_total_debit += $line->debit;
|
||||
$sous_total_credit += $line->credit;
|
||||
|
||||
}
|
||||
|
||||
// Affiche un Sous-Total du dernier compte comptable affiché
|
||||
print '<tr class="liste_total"><td align="right" colspan="4">'.$langs->trans("SubTotal").':</td><td class="nowrap" align="right">'.price($sous_total_debit).'</td><td class="nowrap" align="right">'.price($sous_total_credit).'</td>';
|
||||
print "<td> </td>\n";
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Affiche le Total
|
||||
print '<tr class="liste_total">';
|
||||
print '<td align="right" colspan="4">'.$langs->trans("Total").':</td>';
|
||||
print '<td align="right">';
|
||||
print price($total_debit);
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print price($total_credit);
|
||||
print '</td>';
|
||||
print '<td colspan="2"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>";
|
||||
print '</form>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
|
||||
$db->close();
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.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
|
||||
|
|
@ -16,12 +17,12 @@
|
|||
*/
|
||||
$prefix = $conf->global->ACCOUNTING_EXPORT_PREFIX_SPEC;
|
||||
$format = $conf->global->ACCOUNTING_EXPORT_FORMAT;
|
||||
$nodateexport = $conf->global->ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME;
|
||||
|
||||
$date_export = dol_print_date($now, '%Y%m%d%H%M%S');
|
||||
|
||||
header('Content-Type: text/csv');
|
||||
if ($prefix)
|
||||
$filename = $prefix . "_" . "journal_" . $journal . $date_export . "." . $format;
|
||||
else
|
||||
$filename = "journal_" . $journal . $date_export . "." . $format;
|
||||
header('Content-Disposition: attachment;filename=' . $filename);
|
||||
|
||||
$filename = ($prefix?$prefix . "_":""). "journal_" . $journal . ($nodateexport?"":$date_export) . "." . $format;
|
||||
|
||||
header('Content-Disposition: attachment;filename=' . $filename);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@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
|
||||
|
|
@ -353,7 +354,7 @@ class Adherent extends CommonObject
|
|||
|
||||
if (count($this->errors))
|
||||
{
|
||||
dol_syslog(get_class($this)."::create ".join(',',$this->errors), LOG_ERR);
|
||||
dol_syslog(get_class($this)."::create ".implode(',',$this->errors), LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@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
|
||||
|
|
@ -83,7 +84,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search
|
|||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'd.rowid'=>'Ref',
|
||||
//'d.ref'=>'Ref',
|
||||
'd.login'=>'Login',
|
||||
'd.lastname'=>'Lastname',
|
||||
'd.firstname'=>'Firstname',
|
||||
'd.login'=>'Login',
|
||||
|
|
@ -328,7 +329,7 @@ if ($resql)
|
|||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
|
||||
print $langs->trans("FilterOnInto", $sall) . implode(', ',$fieldstosearchall);
|
||||
}
|
||||
|
||||
// Filter on categories
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
||||
|
|
@ -1085,7 +1085,7 @@ if ($id)
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail=new FormMail($db);
|
||||
$tmp=$formmail->getAvailableSubstitKey('form');
|
||||
print join(', ', $tmp);
|
||||
print implode(', ', $tmp);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -372,7 +372,6 @@ else
|
|||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@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
|
||||
|
|
@ -75,28 +76,28 @@ if ($action == 'update')
|
|||
|
||||
dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"],'chaine',0,'',$conf->entity);
|
||||
|
||||
$val=(join(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'),array()))));
|
||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'),array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_BACKBODY', join(',',colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'),array())),'chaine',0,'',$conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_BACKBODY', implode(',',colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'),array())),'chaine',0,'',$conf->entity);
|
||||
|
||||
$val=(join(',',(colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'),array()))));
|
||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'),array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', join(',',colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'),array())),'chaine',0,'',$conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', implode(',',colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'),array())),'chaine',0,'',$conf->entity);
|
||||
|
||||
$val=(join(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array()))));
|
||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', join(',',colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array())),'chaine',0,'',$conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', implode(',',colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array())),'chaine',0,'',$conf->entity);
|
||||
|
||||
$val=(join(',',(colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'),array()))));
|
||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'),array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', join(',',colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'),array())),'chaine',0,'',$conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', implode(',',colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'),array())),'chaine',0,'',$conf->entity);
|
||||
|
||||
if (GETPOST('THEME_ELDY_USE_HOVER') == '') dolibarr_del_const($db, "THEME_ELDY_USE_HOVER", $conf->entity);
|
||||
else dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $_POST["THEME_ELDY_USE_HOVER"], 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=(join(',',(colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'),array()))));
|
||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'),array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', join(',',colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'),array())),'chaine',0,'',$conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', implode(',',colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'),array())),'chaine',0,'',$conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_SIZE_SHORTLISTE_LIMIT", $_POST["main_size_shortliste_limit"],'chaine',0,'',$conf->entity);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2016 Juanjo Menent <jmenent@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
|
||||
|
|
@ -437,7 +437,7 @@ if (function_exists("ldap_connect"))
|
|||
print "search: *<br>\n";
|
||||
print "userDN: ".$conf->global->LDAP_USER_DN."<br>\n";
|
||||
print "useridentifier: ".$conf->global->LDAP_KEY_USERS."<br>\n";
|
||||
print "required_fields: ".join(',',$required_fields)."<br>\n";
|
||||
print "required_fields: ".implode(',',$required_fields)."<br>\n";
|
||||
print "=> ".count($liste)." records<br>\n";
|
||||
print "\n<br>";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == 'yes')
|
|||
{
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."menu WHERE rowid = ".$_GET['menuId'];
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."menu WHERE rowid = ".GETPOST('menuId', 'int');
|
||||
$db->query($sql);
|
||||
|
||||
if ($result == 0)
|
||||
|
|
@ -312,7 +312,7 @@ if ($action == 'create')
|
|||
$parent_rowid = $_GET['menuId'];
|
||||
if ($_GET['menuId'])
|
||||
{
|
||||
$sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".$_GET['menuId'];
|
||||
$sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".GETPOST('menuId', 'int');
|
||||
$res = $db->query($sql);
|
||||
if ($res)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ $h++;
|
|||
print "<br>\n";
|
||||
|
||||
|
||||
dol_fiche_head($head, $mode, $langs->trans("Modules"));
|
||||
dol_fiche_head($head, $mode, '');
|
||||
|
||||
$var=true;
|
||||
|
||||
|
|
@ -443,11 +443,11 @@ if ($mode != 'marketplace')
|
|||
if ($familykey!=$oldfamily)
|
||||
{
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print '<td colspan="6">';
|
||||
print '<td colspan="5">';
|
||||
$familytext=empty($familyinfo[$familykey]['label'])?$familykey:$familyinfo[$familykey]['label'];
|
||||
print $familytext;
|
||||
print "</td>\n";
|
||||
print '<td align="right">'.$langs->trans("SetupShort").'</td>'."\n";
|
||||
print '<td colspan="2" align="right">'.$langs->trans("SetupShort").'</td>'."\n";
|
||||
print "</tr>\n";
|
||||
$atleastoneforfamily=0;
|
||||
//print "<tr><td>yy".$oldfamily."-".$familykey."-".$atleastoneforfamily."<br></td><tr>";
|
||||
|
|
|
|||
|
|
@ -118,7 +118,11 @@ llxHeader('',$langs->trans("NotificationSetup"));
|
|||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("NotificationSetup"),$linkback,'title_setup');
|
||||
|
||||
print $langs->trans("NotificationsDesc").'<br><br>';
|
||||
print $langs->trans("NotificationsDesc").'<br>';
|
||||
print $langs->trans("NotificationsDescUser").'<br>';
|
||||
if (! empty($conf->societe->enabled)) print $langs->trans("NotificationsDescContact").'<br>';
|
||||
print $langs->trans("NotificationsDescGlobal").'<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
|
@ -141,52 +145,53 @@ print '</td>';
|
|||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
print '<br><br>';
|
||||
|
||||
|
||||
if ($conf->societe->enabled)
|
||||
// Notification per contacts
|
||||
$title=$langs->trans("ListOfNotificationsPerUser");
|
||||
if (! empty($conf->societe->enabled)) $title=$langs->trans("ListOfNotificationsPerUserOrContact");
|
||||
print load_fiche_titre($title,'','');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
/*print '<td>'.$langs->trans("Code").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';*/
|
||||
//print '<td align="right">'.$langs->trans("NbOfTargetedContacts").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Load array of available notifications
|
||||
$notificationtrigger=new InterfaceNotification($db);
|
||||
$listofnotifiedevents=$notificationtrigger->getListOfManagedEvents();
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>';
|
||||
|
||||
$var=true;
|
||||
$i=0;
|
||||
foreach($listofnotifiedevents as $notifiedevent)
|
||||
{
|
||||
print load_fiche_titre($langs->trans("ListOfNotificationsPerContact"),'','');
|
||||
$var=!$var;
|
||||
$label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Module").'</td>';
|
||||
print '<td>'.$langs->trans("Code").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
//print '<td align="right">'.$langs->trans("NbOfTargetedContacts").'</td>';
|
||||
print "</tr>\n";
|
||||
if ($notifiedevent['elementtype'] == 'order_supplier') $elementLabel = $langs->trans('SupplierOrder');
|
||||
elseif ($notifiedevent['elementtype'] == 'propal') $elementLabel = $langs->trans('Proposal');
|
||||
elseif ($notifiedevent['elementtype'] == 'facture') $elementLabel = $langs->trans('Bill');
|
||||
elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order');
|
||||
elseif ($notifiedevent['elementtype'] == 'ficheinter') $elementLabel = $langs->trans('Intervention');
|
||||
|
||||
// Load array of available notifications
|
||||
$notificationtrigger=new InterfaceNotification($db);
|
||||
$listofnotifiedevents=$notificationtrigger->getListOfManagedEvents();
|
||||
|
||||
$var=true;
|
||||
foreach($listofnotifiedevents as $notifiedevent)
|
||||
{
|
||||
$var=!$var;
|
||||
$label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
|
||||
|
||||
if ($notifiedevent['elementtype'] == 'order_supplier') $elementLabel = $langs->trans('SupplierOrder');
|
||||
elseif ($notifiedevent['elementtype'] == 'propal') $elementLabel = $langs->trans('Proposal');
|
||||
elseif ($notifiedevent['elementtype'] == 'facture') $elementLabel = $langs->trans('Bill');
|
||||
elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order');
|
||||
elseif ($notifiedevent['elementtype'] == 'ficheinter') $elementLabel = $langs->trans('Intervention');
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$elementLabel.'</td>';
|
||||
print '<td>'.$notifiedevent['code'].'</td>';
|
||||
print '<td>'.$label.'</td>';
|
||||
/*print '<td align="right">';
|
||||
$tmparray = $notify->getNotificationsArray($notifiedevent['code'], 0);
|
||||
print count($tmparray);
|
||||
print '</td>';*/
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '* '.$langs->trans("GoOntoContactCardToAddMore").'<br>';
|
||||
print '<br>';
|
||||
if ($i) print ', ';
|
||||
print $label;
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '* '.$langs->trans("GoOntoUserCardToAddMore").'<br>';
|
||||
if (! empty($conf->societe->enabled)) print '** '.$langs->trans("GoOntoContactCardToAddMore").'<br>';
|
||||
print '<br><br>';
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("ListOfFixedNotifications"),'','');
|
||||
|
|
|
|||
|
|
@ -69,7 +69,23 @@ if ($action == 'setmod')
|
|||
dolibarr_set_const($db, "PAYMENT_ADDON",$value,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
if ($action == 'set_FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS')
|
||||
{
|
||||
$freetext = GETPOST('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS'); // No alpha here, we want exact string
|
||||
|
||||
$res = dolibarr_set_const($db, "FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS",$freetext,'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
|
|
@ -215,6 +231,33 @@ foreach ($dirmodels as $reldir)
|
|||
|
||||
print '</table>';
|
||||
|
||||
print "<br />";
|
||||
|
||||
print load_fiche_titre($langs->trans("OtherOptions"),'','');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Allow payments on different thirdparties bills but same parent company
|
||||
$var=! $var;
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||
print '<input type="hidden" name="action" value="set_FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS" />';
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("PaymentOnDifferentThirdBills");
|
||||
print '</td><td width="60" align="center">';
|
||||
print $form->selectyesno("FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS",$conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS,1);
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" />';
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -200,13 +200,13 @@ if ($result)
|
|||
{
|
||||
print img_picto($langs->trans("Active"),'tick');
|
||||
print '</td><td>';
|
||||
print '<a href="perms.php?pid='.$obj->id.'&action=remove#'.$objMod->getName().'">'.img_edit_remove().'</a>';
|
||||
print '<a class="reposition" href="perms.php?pid='.$obj->id.'&action=remove">'.img_edit_remove().'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
print '</td><td>';
|
||||
print '<a href="perms.php?pid='.$obj->id.'&action=add#'.$objMod->getName().'">'.img_edit_add().'</a>';
|
||||
print '<a class="reposition" href="perms.php?pid='.$obj->id.'&action=add">'.img_edit_add().'</a>';
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
|
|
|
|||
|
|
@ -49,6 +49,10 @@ if($action)
|
|||
{
|
||||
$res = dolibarr_set_const($db, "STOCK_USERSTOCK_AUTOCREATE", GETPOST('STOCK_USERSTOCK_AUTOCREATE','alpha'),'chaine',0,'',$conf->entity);
|
||||
}
|
||||
if ($action == 'STOCK_ALLOW_NEGATIVE_TRANSFER')
|
||||
{
|
||||
$res = dolibarr_set_const($db, "STOCK_ALLOW_NEGATIVE_TRANSFER", GETPOST('STOCK_ALLOW_NEGATIVE_TRANSFER','alpha'),'chaine',0,'',$conf->entity);
|
||||
}
|
||||
// Mode of stock decrease
|
||||
if ($action == 'STOCK_CALCULATE_ON_BILL'
|
||||
|| $action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER'
|
||||
|
|
@ -319,63 +323,73 @@ $found++;
|
|||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print " <td>".$langs->trans("RuleForStockAvailability")."</td>\n";
|
||||
print " <td align=\"right\" width=\"160\"> </td>\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="60%">'.$langs->trans("WarehouseAllowNegativeTransfer").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_ALLOW_NEGATIVE_TRANSFER\">";
|
||||
print $form->selectyesno("STOCK_ALLOW_NEGATIVE_TRANSFER",$conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER,1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
// Option to force stock to be enough before adding a line into document
|
||||
if ($conf->invoice->enabled || $conf->order->enabled || $conf->expedition->enabled)
|
||||
{
|
||||
print '<br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print " <td>".$langs->trans("RuleForStockAvailability")."</td>\n";
|
||||
print " <td align=\"right\" width=\"160\"> </td>\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
if($conf->invoice->enabled) {
|
||||
$var = !$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="60%">'.$langs->trans("StockMustBeEnoughForInvoice").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_INVOICE\">";
|
||||
print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_INVOICE",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE,1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
if($conf->order->enabled) {
|
||||
$var = !$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="60%">'.$langs->trans("StockMustBeEnoughForOrder").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_ORDER\">";
|
||||
print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_ORDER",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER,1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
if($conf->expedition->enabled) {
|
||||
$var = !$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="60%">'.$langs->trans("StockMustBeEnoughForShipment").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT\">";
|
||||
print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT,1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
print '</table>';
|
||||
if($conf->invoice->enabled) {
|
||||
$var = !$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="60%">'.$langs->trans("StockMustBeEnoughForInvoice").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_INVOICE\">";
|
||||
print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_INVOICE",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE,1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
if($conf->order->enabled) {
|
||||
$var = !$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="60%">'.$langs->trans("StockMustBeEnoughForOrder").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_ORDER\">";
|
||||
print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_ORDER",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER,1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
if($conf->expedition->enabled) {
|
||||
$var = !$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="60%">'.$langs->trans("StockMustBeEnoughForShipment").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT\">";
|
||||
print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT,1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
$virtualdiffersfromphysical=0;
|
||||
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|
||||
|| ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
|
||||
|
|
@ -427,6 +441,7 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
|
|||
print '</form>';
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
print '<br>';
|
||||
|
||||
/* I keep the option/feature, but hidden to end users for the moment. If feature is used by module, no need to have users see it.
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@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
|
||||
|
|
@ -87,9 +88,9 @@ foreach($phparray as $key => $value)
|
|||
$valtoshow=$keyvalue;
|
||||
if ($keyparam == 'X-ChromePhp-Data') $valtoshow=dol_trunc($keyvalue,80);
|
||||
print '<td colspan="2">';
|
||||
if ($keyparam == 'Path') $valtoshow=join('; ',explode(';',trim($valtoshow)));
|
||||
if ($keyparam == 'PATH') $valtoshow=join('; ',explode(';',trim($valtoshow)));
|
||||
if ($keyparam == '_SERVER["PATH"]') $valtoshow=join('; ',explode(';',trim($valtoshow)));
|
||||
if ($keyparam == 'Path') $valtoshow=implode('; ',explode(';',trim($valtoshow)));
|
||||
if ($keyparam == 'PATH') $valtoshow=implode('; ',explode(';',trim($valtoshow)));
|
||||
if ($keyparam == '_SERVER["PATH"]') $valtoshow=implode('; ',explode(';',trim($valtoshow)));
|
||||
print $valtoshow;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
|
@ -104,7 +105,7 @@ foreach($phparray as $key => $value)
|
|||
{
|
||||
print '<td>';
|
||||
$valtoshow=$keyvalue2;
|
||||
if ($keyparam == 'disable_functions') $valtoshow=join(', ',explode(',',trim($valtoshow)));
|
||||
if ($keyparam == 'disable_functions') $valtoshow=implode(', ',explode(',',trim($valtoshow)));
|
||||
//print $keyparam;
|
||||
print $valtoshow;
|
||||
$i++;
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/api/class/api_access.class.php';
|
||||
|
||||
$langs->load("admin");
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
|
|
@ -36,7 +38,6 @@ require_once DOL_DOCUMENT_ROOT.'/api/class/api_access.class.php';
|
|||
// Enable and test if module Api is enabled
|
||||
if (empty($conf->global->MAIN_MODULE_API))
|
||||
{
|
||||
$langs->load("admin");
|
||||
dol_syslog("Call Dolibarr API interfaces with module REST disabled");
|
||||
print $langs->trans("WarningModuleNotActive",'Api').'.<br><br>';
|
||||
print $langs->trans("ToActivateModule");
|
||||
|
|
|
|||
|
|
@ -1096,21 +1096,36 @@ class ActionComm extends CommonObject
|
|||
*/
|
||||
function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
global $conf,$langs, $hookmanager;
|
||||
|
||||
$result='';
|
||||
$tooltip = '<u>' . $langs->trans('ShowAction'.$objp->code) . '</u>';
|
||||
if (! empty($this->ref))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
if (! empty($this->label))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Title') . ':</b> ' . $this->label;
|
||||
$label = $this->label;
|
||||
if (empty($label)) $label=$this->libelle; // For backward compatibility
|
||||
$linkclose = '" title="'.dol_escape_htmltag($tooltip, 1).'">';
|
||||
if ($option=='birthday') $link = '<a class="'.$classname.' classfortooltip" href="'.DOL_URL_ROOT.'/contact/perso.php?id='.$this->id.$linkclose;
|
||||
else $link = '<a class="'.$classname.' classfortooltip" href="'.DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id.$linkclose;
|
||||
$linkend='</a>';
|
||||
//print 'rrr'.$this->libelle.'-'.$withpicto;
|
||||
$result='';
|
||||
$tooltip = '<u>' . $langs->trans('ShowAction'.$objp->code) . '</u>';
|
||||
if (! empty($this->ref))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
$label = $this->label;
|
||||
if (empty($label)) $label=$this->libelle; // For backward compatibility
|
||||
if (! empty($label))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Title') . ':</b> ' . $label;
|
||||
if (! empty($this->location))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Location') . ':</b> ' . $this->location;
|
||||
|
||||
$linkclose = ' class="'.$classname.' classfortooltip" title="'.dol_escape_htmltag($tooltip, 1).'">';
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('actiondao'));
|
||||
$parameters=array('id'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
$linkclose = ($hookmanager->resPrint ? $hookmanager->resPrint : $linkclose);
|
||||
|
||||
if ($option=='birthday')
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/contact/perso.php?id='.$this->id.'"'.$linkclose;
|
||||
else
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id.'"'.$linkclose;
|
||||
$linkend='</a>';
|
||||
//print 'rrr'.$this->libelle.'-'.$withpicto;
|
||||
|
||||
if ($withpicto == 2)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -86,12 +86,12 @@ $status=GETPOST("status");
|
|||
$type=GETPOST("type");
|
||||
$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
|
||||
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
|
||||
if (GETPOST('actioncode','array'))
|
||||
if (GETPOST('actioncode','array'))
|
||||
{
|
||||
$actioncode=GETPOST('actioncode','array',3);
|
||||
if (! count($actioncode)) $actioncode='0';
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||
}
|
||||
|
|
@ -186,7 +186,7 @@ $week = $prev['week'];
|
|||
|
||||
$day = (int) $day;
|
||||
$next = dol_get_next_day($day, $month, $year);
|
||||
$next_year = year + 1;
|
||||
$next_year = $year + 1;
|
||||
$next_month = $month;
|
||||
$next_day = $day;
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherent
|
|||
if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load('banks');
|
||||
|
||||
if (! empty($conf->contrat->enabled)) $langs->load("contracts");
|
||||
if (! empty($conf->commande->enabled)) $langs->load("orders");
|
||||
if (! empty($conf->expedition->enabled)) $langs->load("sendings");
|
||||
|
|
@ -124,7 +126,15 @@ if (empty($reshook))
|
|||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// customer preferred shipping method
|
||||
// Bank account
|
||||
if ($action == 'setbankaccount' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->setBankAccount(GETPOST('fk_account','int'));
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// customer preferred shipping method
|
||||
if ($action == 'setshippingmethod' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
|
|
@ -337,6 +347,26 @@ if ($id > 0)
|
|||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// Compte bancaire par défaut
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('BankAccount');
|
||||
print '<td>';
|
||||
if (($action != 'editbankaccount') && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&socid='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editbankaccount')
|
||||
{
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_account,'fk_account',1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_account,'none');
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Relative discounts (Discounts-Drawbacks-Rebates)
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
|||
else
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td colspan="3">'.$langs->trans("NoProposal").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="3" class="opacitymedium">'.$langs->trans("NoProposal").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
|
||||
|
|
@ -277,7 +277,7 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos
|
|||
else
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td colspan="3">'.$langs->trans("NoProposal").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="3" class="opacitymedium">'.$langs->trans("NoProposal").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
|
||||
|
|
@ -357,7 +357,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
|||
else
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td colspan="3">'.$langs->trans("NoOrder").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="3" class="opacitymedium">'.$langs->trans("NoOrder").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
|
||||
|
|
@ -438,7 +438,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande
|
|||
else
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td colspan="3">'.$langs->trans("NoSupplierOrder").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="3" class="opacitymedium">'.$langs->trans("NoSupplierOrder").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
|
||||
|
|
|
|||
|
|
@ -1403,7 +1403,7 @@ if ($action == 'create')
|
|||
print '<tr>';
|
||||
print '<td>' . $langs->trans("Project") . '</td><td colspan="2">';
|
||||
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
|
||||
print ' <a href="../projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
|
@ -2417,7 +2417,7 @@ if ($action == 'create')
|
|||
|
||||
// Tableau des substitutions
|
||||
$formmail->setSubstitFromObject($object);
|
||||
$formmail->substit['__PROPREF__'] = $object->ref;
|
||||
$formmail->substit['__PROPREF__'] = $object->ref; // For backward compatibility
|
||||
|
||||
// Find the good contact adress
|
||||
$custcontact = '';
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -135,7 +135,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'setremise')
|
||||
if ($action == 'setremise' && $user->rights->societe->creer)
|
||||
{
|
||||
//if ($user->rights->societe->creer)
|
||||
//if ($user->rights->facture->creer)
|
||||
|
|
@ -266,39 +266,48 @@ if ($socid > 0)
|
|||
print '<tr><td class="titlefield">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>';
|
||||
print '<td>'.$remise_all.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>';
|
||||
print '<td>'.$remise_user.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
|
||||
if (! empty($user->fk_soc)) // No need to show this for external users
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>';
|
||||
print '<td>'.$remise_user.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
print load_fiche_titre($langs->trans("NewGlobalDiscount"),'','');
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="38%" class="fieldrequired">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td><input type="text" size="5" name="amount_ht" value="'.$_POST["amount_ht"].'">';
|
||||
print '<span class="hideonsmartphone"> '.$langs->trans("Currency".$conf->currency).'</span></td></tr>';
|
||||
print '<tr><td width="38%">'.$langs->trans("VAT").'</td>';
|
||||
print '<td>';
|
||||
print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$object);
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="fieldrequired" >'.$langs->trans("NoteReason").'</td>';
|
||||
print '<td><input type="text" size="60" name="desc" value="'.GETPOST('desc').'"></td></tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
print load_fiche_titre($langs->trans("NewGlobalDiscount"),'','');
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="38%" class="fieldrequired">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td><input type="text" size="5" name="amount_ht" value="'.$_POST["amount_ht"].'">';
|
||||
print '<span class="hideonsmartphone"> '.$langs->trans("Currency".$conf->currency).'</span></td></tr>';
|
||||
print '<tr><td width="38%">'.$langs->trans("VAT").'</td>';
|
||||
print '<td>';
|
||||
print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$object);
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="fieldrequired" >'.$langs->trans("NoteReason").'</td>';
|
||||
print '<td><input type="text" size="60" name="desc" value="'.GETPOST('desc').'"></td></tr>';
|
||||
|
||||
print "</table>";
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">';
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">';
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
}
|
||||
print '</div>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
print '</form>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
|
@ -423,7 +432,7 @@ if ($socid > 0)
|
|||
print '<br>';
|
||||
|
||||
/*
|
||||
* Liste ristournes appliquees (=liees a une ligne de facture ou facture)
|
||||
* List discount consumed (=liees a une ligne de facture ou facture)
|
||||
*/
|
||||
|
||||
// Remises liees a lignes de factures
|
||||
|
|
|
|||
|
|
@ -523,7 +523,7 @@ if (empty($reshook))
|
|||
else if ($action == 'setmode' && $user->rights->commande->creer) {
|
||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||
if ($result < 0)
|
||||
dol_print_error($db, $object->error);
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// Multicurrency Code
|
||||
|
|
@ -539,13 +539,13 @@ if (empty($reshook))
|
|||
else if ($action == 'setavailability' && $user->rights->commande->creer) {
|
||||
$result = $object->availability(GETPOST('availability_id'));
|
||||
if ($result < 0)
|
||||
dol_print_error($db, $object->error);
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
else if ($action == 'setdemandreason' && $user->rights->commande->creer) {
|
||||
$result = $object->demand_reason(GETPOST('demand_reason_id'));
|
||||
if ($result < 0)
|
||||
dol_print_error($db, $object->error);
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
else if ($action == 'setconditions' && $user->rights->commande->creer) {
|
||||
|
|
|
|||
|
|
@ -57,98 +57,100 @@ class Commande extends CommonOrder
|
|||
* Client ID
|
||||
* @var int
|
||||
*/
|
||||
var $socid;
|
||||
public $socid;
|
||||
|
||||
var $ref_client;
|
||||
var $ref_int;
|
||||
var $contactid;
|
||||
public $ref_client;
|
||||
public $ref_int;
|
||||
public $contactid;
|
||||
|
||||
/**
|
||||
* Status of the order. Check the following constants:
|
||||
* @var int
|
||||
* @see Commande::STATUS_CANCELED, Commande::STATUS_DRAFT, Commande::STATUS_ACCEPTED, Commande::STATUS_CLOSED
|
||||
*/
|
||||
var $statut;
|
||||
public $statut;
|
||||
/**
|
||||
* @deprecated
|
||||
* @see billed
|
||||
*/
|
||||
var $facturee;
|
||||
var $billed; // billed or not
|
||||
public $facturee;
|
||||
public $billed; // billed or not
|
||||
|
||||
var $brouillon;
|
||||
var $cond_reglement_code;
|
||||
public $brouillon;
|
||||
public $cond_reglement_code;
|
||||
|
||||
var $fk_account;
|
||||
public $fk_account;
|
||||
|
||||
/**
|
||||
* It holds the label of the payment mode. Use it in case translation cannot be found.
|
||||
* @var string
|
||||
*/
|
||||
var $mode_reglement;
|
||||
public $mode_reglement;
|
||||
|
||||
/**
|
||||
* Payment mode id
|
||||
* @var int
|
||||
*/
|
||||
var $mode_reglement_id;
|
||||
public $mode_reglement_id;
|
||||
/**
|
||||
* Payment mode code
|
||||
* @var string
|
||||
*/
|
||||
var $mode_reglement_code;
|
||||
public $mode_reglement_code;
|
||||
/**
|
||||
* Availability delivery time id
|
||||
* @var int
|
||||
*/
|
||||
var $availability_id;
|
||||
public $availability_id;
|
||||
/**
|
||||
* Availability delivery time code
|
||||
* @var string
|
||||
*/
|
||||
var $availability_code;
|
||||
public $availability_code;
|
||||
/**
|
||||
* Label of availability delivery time. Use it in case translation cannot be found.
|
||||
* @var string
|
||||
*/
|
||||
var $availability;
|
||||
public $availability;
|
||||
|
||||
var $demand_reason_id;
|
||||
var $demand_reason_code;
|
||||
var $address;
|
||||
var $date; // Date commande
|
||||
public $demand_reason_id;
|
||||
public $demand_reason_code;
|
||||
public $address;
|
||||
public $date; // Date commande
|
||||
/**
|
||||
* @deprecated
|
||||
* @see date
|
||||
*/
|
||||
var $date_commande;
|
||||
var $date_livraison; // Date livraison souhaitee
|
||||
var $fk_remise_except;
|
||||
var $remise_percent;
|
||||
var $remise_absolue;
|
||||
var $info_bits;
|
||||
var $rang;
|
||||
var $special_code;
|
||||
var $source; // Origin of order
|
||||
var $extraparams=array();
|
||||
public $date_commande;
|
||||
public $date_livraison; // Date livraison souhaitee
|
||||
public $fk_remise_except;
|
||||
public $remise_percent;
|
||||
public $remise_absolue;
|
||||
public $info_bits;
|
||||
public $rang;
|
||||
public $special_code;
|
||||
public $source; // Origin of order
|
||||
public $extraparams=array();
|
||||
|
||||
var $linked_objects=array();
|
||||
public $linked_objects=array();
|
||||
|
||||
var $user_author_id;
|
||||
public $user_author_id;
|
||||
|
||||
/**
|
||||
* @var OrderLine[]
|
||||
*/
|
||||
var $lines = array();
|
||||
public $lines = array();
|
||||
|
||||
// Multicurrency
|
||||
var $fk_multicurrency;
|
||||
var $multicurrency_code;
|
||||
var $multicurrency_tx;
|
||||
var $multicurrency_total_ht;
|
||||
var $multicurrency_total_tva;
|
||||
var $multicurrency_total_ttc;
|
||||
|
||||
public $fk_multicurrency;
|
||||
public $multicurrency_code;
|
||||
public $multicurrency_tx;
|
||||
public $multicurrency_total_ht;
|
||||
public $multicurrency_total_tva;
|
||||
public $multicurrency_total_ttc;
|
||||
|
||||
public $oldcopy;
|
||||
|
||||
/**
|
||||
* ERR Not enough stock
|
||||
*/
|
||||
|
|
@ -450,7 +452,7 @@ class Commande extends CommonOrder
|
|||
if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1)
|
||||
{
|
||||
$result = 0;
|
||||
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
||||
$langs->load("agenda");
|
||||
|
||||
|
|
@ -469,10 +471,10 @@ class Commande extends CommonOrder
|
|||
|
||||
if (!$error) {
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ORDER_SETDRAFT',$user);
|
||||
$result=$this->call_trigger('ORDER_UNVALIDATE',$user);
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
|
||||
|
||||
if (!$error) {
|
||||
$this->statut=self::STATUS_DRAFT;
|
||||
$this->db->commit();
|
||||
|
|
@ -701,7 +703,7 @@ class Commande extends CommonOrder
|
|||
|
||||
// Clean parameters
|
||||
$this->brouillon = 1; // set command as draft
|
||||
|
||||
|
||||
// Multicurrency (test on $this->multicurrency_tx because we sould take the default rate only if not using origin rate)
|
||||
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code);
|
||||
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
||||
|
|
@ -711,7 +713,7 @@ class Commande extends CommonOrder
|
|||
$this->fk_multicurrency = 0;
|
||||
$this->multicurrency_tx = 1;
|
||||
}
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::create user=".$user->id);
|
||||
|
||||
// Check parameters
|
||||
|
|
@ -1231,7 +1233,7 @@ class Commande extends CommonOrder
|
|||
if (empty($txlocaltax2)) $txlocaltax2=0;
|
||||
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
|
||||
if (empty($this->fk_multicurrency)) $this->fk_multicurrency=0;
|
||||
|
||||
|
||||
$remise_percent=price2num($remise_percent);
|
||||
$qty=price2num($qty);
|
||||
$pu_ht=price2num($pu_ht);
|
||||
|
|
@ -1281,7 +1283,7 @@ class Commande extends CommonOrder
|
|||
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc);
|
||||
$txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate.
|
||||
|
||||
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx);
|
||||
|
||||
$total_ht = $tabprice[0];
|
||||
|
|
@ -1294,7 +1296,7 @@ class Commande extends CommonOrder
|
|||
$multicurrency_total_ht = $tabprice[16];
|
||||
$multicurrency_total_tva = $tabprice[17];
|
||||
$multicurrency_total_ttc = $tabprice[18];
|
||||
|
||||
|
||||
// Rang to use
|
||||
$rangtouse = $rang;
|
||||
if ($rangtouse == -1)
|
||||
|
|
@ -1596,7 +1598,7 @@ class Commande extends CommonOrder
|
|||
$this->multicurrency_total_ht = $obj->multicurrency_total_ht;
|
||||
$this->multicurrency_total_tva = $obj->multicurrency_total_tva;
|
||||
$this->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
|
||||
|
||||
|
||||
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
||||
|
||||
$this->lines = array();
|
||||
|
|
@ -1787,7 +1789,7 @@ class Commande extends CommonOrder
|
|||
$line->product_desc = $objp->product_desc;
|
||||
$line->fk_product_type = $objp->fk_product_type; // Produit ou service
|
||||
$line->fk_unit = $objp->fk_unit;
|
||||
|
||||
|
||||
$line->weight = $objp->weight;
|
||||
$line->weight_units = $objp->weight_units;
|
||||
$line->volume = $objp->volume;
|
||||
|
|
@ -1803,7 +1805,7 @@ class Commande extends CommonOrder
|
|||
$line->multicurrency_total_ht = $objp->multicurrency_total_ht;
|
||||
$line->multicurrency_total_tva = $objp->multicurrency_total_tva;
|
||||
$line->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
|
||||
|
||||
|
||||
$this->lines[$i] = $line;
|
||||
|
||||
$i++;
|
||||
|
|
@ -1854,7 +1856,7 @@ class Commande extends CommonOrder
|
|||
/**
|
||||
* Load array this->expeditions of lines of shipments with nb of products sent for each order line
|
||||
* Note: For a dedicated shipment, the fetch_lines can be used to load the qty_asked and qty_shipped. This function is use to return qty_shipped cumulated for the order
|
||||
*
|
||||
*
|
||||
* @param int $filtre_statut Filter on shipment status
|
||||
* @return int <0 if KO, Nb of lines found if OK
|
||||
*/
|
||||
|
|
@ -2044,30 +2046,62 @@ class Commande extends CommonOrder
|
|||
*
|
||||
* @param User $user User qui positionne la remise
|
||||
* @param float $remise Discount (percent)
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_remise($user, $remise)
|
||||
function set_remise($user, $remise, $notrigger=0)
|
||||
{
|
||||
$remise=trim($remise)?trim($remise):0;
|
||||
|
||||
if ($user->rights->commande->creer)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$remise=price2num($remise);
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
|
||||
$sql.= ' SET remise_percent = '.$remise;
|
||||
$sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = '.self::STATUS_DRAFT.' ;';
|
||||
|
||||
if ($this->db->query($sql))
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->remise_percent = $remise;
|
||||
$this->update_price(1);
|
||||
return 1;
|
||||
$this->errors[]=$this->db->error();
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->oldcopy= clone $this;
|
||||
$this->remise_percent = $remise;
|
||||
$this->update_price(1);
|
||||
}
|
||||
|
||||
if (! $notrigger && empty($error))
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ORDER_MODIFY',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2078,32 +2112,62 @@ class Commande extends CommonOrder
|
|||
*
|
||||
* @param User $user User qui positionne la remise
|
||||
* @param float $remise Discount
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_remise_absolue($user, $remise)
|
||||
function set_remise_absolue($user, $remise, $notrigger=0)
|
||||
{
|
||||
$remise=trim($remise)?trim($remise):0;
|
||||
|
||||
if ($user->rights->commande->creer)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$remise=price2num($remise);
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
|
||||
$sql.= ' SET remise_absolue = '.$remise;
|
||||
$sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = '.self::STATUS_DRAFT.' ;';
|
||||
|
||||
dol_syslog(get_class($this)."::set_remise_absolue", LOG_DEBUG);
|
||||
|
||||
if ($this->db->query($sql))
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->remise_absolue = $remise;
|
||||
$this->update_price(1);
|
||||
return 1;
|
||||
$this->errors[]=$this->db->error();
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->oldcopy= clone $this;
|
||||
$this->remise_absolue = $remise;
|
||||
$this->update_price(1);
|
||||
}
|
||||
|
||||
if (! $notrigger && empty($error))
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ORDER_MODIFY',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2112,29 +2176,59 @@ class Commande extends CommonOrder
|
|||
/**
|
||||
* Set the order date
|
||||
*
|
||||
* @param User $user Object user making change
|
||||
* @param int $date Date
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param User $user Object user making change
|
||||
* @param int $date Date
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_date($user, $date)
|
||||
function set_date($user, $date, $notrigger=0)
|
||||
{
|
||||
if ($user->rights->commande->creer)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
||||
$sql.= " SET date_commande = ".($date ? $this->db->idate($date) : 'null');
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
|
||||
|
||||
dol_syslog(get_class($this)."::set_date",LOG_DEBUG);
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
if (!$resql)
|
||||
{
|
||||
$this->date = $date;
|
||||
return 1;
|
||||
$this->errors[]=$this->db->error();
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->oldcopy= clone $this;
|
||||
$this->date = $date;
|
||||
}
|
||||
|
||||
if (! $notrigger && empty($error))
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ORDER_MODIFY',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -2146,29 +2240,59 @@ class Commande extends CommonOrder
|
|||
/**
|
||||
* Set the planned delivery date
|
||||
*
|
||||
* @param User $user Objet utilisateur qui modifie
|
||||
* @param User $user Objet utilisateur qui modifie
|
||||
* @param int $date_livraison Date de livraison
|
||||
* @return int <0 si ko, >0 si ok
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
|
||||
* @return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function set_date_livraison($user, $date_livraison)
|
||||
function set_date_livraison($user, $date_livraison, $notrigger=0)
|
||||
{
|
||||
if ($user->rights->commande->creer)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
||||
$sql.= " SET date_livraison = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null');
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::set_date_livraison", LOG_DEBUG);
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
if (!$resql)
|
||||
{
|
||||
$this->date_livraison = $date_livraison;
|
||||
return 1;
|
||||
$this->errors[]=$this->db->error();
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->oldcopy= clone $this;
|
||||
$this->date_livraison = $date_livraison;
|
||||
}
|
||||
|
||||
if (! $notrigger && empty($error))
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ORDER_MODIFY',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -2177,64 +2301,6 @@ class Commande extends CommonOrder
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set availability
|
||||
*
|
||||
* @param User $user Object user making change
|
||||
* @param int $id If of availability delay
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_availability($user, $id)
|
||||
{
|
||||
if ($user->rights->commande->creer)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande ";
|
||||
$sql.= " SET fk_availability = '".$id."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->fk_availability = $id;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::set_availability Erreur SQL");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set source of demand
|
||||
*
|
||||
* @param User $user Object user making change
|
||||
* @param int $id Id of source
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_demand_reason($user, $id)
|
||||
{
|
||||
if ($user->rights->commande->creer)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande ";
|
||||
$sql.= " SET fk_input_reason = '".$id."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->fk_input_reason = $id;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::set_demand_reason Erreur SQL");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of orders (eventuelly filtered on a user) into an array
|
||||
*
|
||||
|
|
@ -2309,69 +2375,141 @@ class Commande extends CommonOrder
|
|||
}
|
||||
|
||||
/**
|
||||
* Change le delai de livraison
|
||||
* Update delivery delay
|
||||
*
|
||||
* @param int $availability_id Id du nouveau mode
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function availability($availability_id)
|
||||
function availability($availability_id, $notrigger=0)
|
||||
{
|
||||
global $user;
|
||||
|
||||
dol_syslog('Commande::availability('.$availability_id.')');
|
||||
if ($this->statut >= self::STATUS_DRAFT)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
|
||||
$sql .= ' SET fk_availability = '.$availability_id;
|
||||
$sql .= ' WHERE rowid='.$this->id;
|
||||
if ( $this->db->query($sql) )
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->availability_id = $availability_id;
|
||||
return 1;
|
||||
$this->errors[]=$this->db->error();
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->oldcopy= clone $this;
|
||||
$this->availability_id = $availability_id;
|
||||
}
|
||||
|
||||
if (! $notrigger && empty($error))
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ORDER_MODIFY',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog('Commande::availability Erreur '.$sql.' - '.$this->db->error(), LOG_ERR);
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog('Commande::availability, etat facture incompatible', LOG_ERR);
|
||||
$this->error='Etat commande incompatible '.$this->statut;
|
||||
$error_str='Command status do not meet requirement '.$this->statut;
|
||||
dol_syslog(__METHOD__.$error_str, LOG_ERR);
|
||||
$this->error=$error_str;
|
||||
$this->errors[]= $this->error;
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change la source de la demande
|
||||
* Update order demand_reason
|
||||
*
|
||||
* @param int $demand_reason_id Id of new demand
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
|
||||
* @return int >0 if ok, <0 if ko
|
||||
*/
|
||||
function demand_reason($demand_reason_id)
|
||||
function demand_reason($demand_reason_id, $notrigger=0)
|
||||
{
|
||||
global $user;
|
||||
|
||||
dol_syslog('Commande::demand_reason('.$demand_reason_id.')');
|
||||
if ($this->statut >= self::STATUS_DRAFT)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
|
||||
$sql .= ' SET fk_input_reason = '.$demand_reason_id;
|
||||
$sql .= ' WHERE rowid='.$this->id;
|
||||
if ( $this->db->query($sql) )
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->demand_reason_id = $demand_reason_id;
|
||||
return 1;
|
||||
$this->errors[]=$this->db->error();
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->oldcopy= clone $this;
|
||||
$this->demand_reason_id = $demand_reason_id;
|
||||
}
|
||||
|
||||
if (! $notrigger && empty($error))
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ORDER_MODIFY',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog('Commande::demand_reason Erreur '.$sql.' - '.$this->db->error(), LOG_ERR);
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog('Commande::demand_reason, etat facture incompatible', LOG_ERR);
|
||||
$this->error='Etat commande incompatible '.$this->statut;
|
||||
$error_str='order status do not meet requirement '.$this->statut;
|
||||
dol_syslog(__METHOD__.$error_str, LOG_ERR);
|
||||
$this->error=$error_str;
|
||||
$this->errors[]= $this->error;
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
|
@ -2381,27 +2519,57 @@ class Commande extends CommonOrder
|
|||
*
|
||||
* @param User $user User that make change
|
||||
* @param string $ref_client Customer ref
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_ref_client($user, $ref_client)
|
||||
function set_ref_client($user, $ref_client, $notrigger=0)
|
||||
{
|
||||
if ($user->rights->commande->creer)
|
||||
{
|
||||
dol_syslog(get_class($this).'::set_ref_client this->id='.$this->id.', ref_client='.$ref_client);
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET';
|
||||
$sql.= ' ref_client = '.(empty($ref_client) ? 'NULL' : '\''.$this->db->escape($ref_client).'\'');
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
dol_syslog(__METHOD__.' this->id='.$this->id.', ref_client='.$ref_client, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->ref_client = $ref_client;
|
||||
return 1;
|
||||
$this->errors[]=$this->db->error();
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->oldcopy= clone $this;
|
||||
$this->ref_client = $ref_client;
|
||||
}
|
||||
|
||||
if (! $notrigger && empty($error))
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ORDER_MODIFY',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
return -2;
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -2413,12 +2581,12 @@ class Commande extends CommonOrder
|
|||
/**
|
||||
* Classify the order as invoiced
|
||||
*
|
||||
* @param User $user Object user making the change
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param User $user Object user making the change
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function classifyBilled(User $user)
|
||||
function classifyBilled(User $user, $notrigger=0)
|
||||
{
|
||||
global $user;
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
|
|
@ -2429,16 +2597,24 @@ class Commande extends CommonOrder
|
|||
dol_syslog(get_class($this)."::classifyBilled", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ORDER_CLASSIFY_BILLED',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->oldcopy= clone $this;
|
||||
$this->facturee=1; // deprecated
|
||||
$this->billed=1;
|
||||
}
|
||||
|
||||
if (! $notrigger && empty($error))
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ORDER_CLASSIFY_BILLED',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -2485,25 +2661,32 @@ class Commande extends CommonOrder
|
|||
{
|
||||
global $conf, $user, $langs;
|
||||
$error = 0;
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 0';
|
||||
$sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT;
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::classifyUnBilled", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if (! $error)
|
||||
{
|
||||
$this->oldcopy= clone $this;
|
||||
$this->facturee=1; // deprecated
|
||||
$this->billed=1;
|
||||
}
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ORDER_CLASSIFY_UNBILLED',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->facturee=0; // deprecated
|
||||
$this->billed=0;
|
||||
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -2525,8 +2708,8 @@ class Commande extends CommonOrder
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Update a line in database
|
||||
*
|
||||
|
|
@ -2589,7 +2772,7 @@ class Commande extends CommonOrder
|
|||
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc);
|
||||
$txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate.
|
||||
|
||||
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx);
|
||||
|
||||
$total_ht = $tabprice[0];
|
||||
|
|
@ -2602,14 +2785,14 @@ class Commande extends CommonOrder
|
|||
$multicurrency_total_ht = $tabprice[16];
|
||||
$multicurrency_total_tva = $tabprice[17];
|
||||
$multicurrency_total_ttc = $tabprice[18];
|
||||
|
||||
|
||||
// Anciens indicateurs: $price, $subprice, $remise (a ne plus utiliser)
|
||||
$price = $pu;
|
||||
if ($price_base_type == 'TTC')
|
||||
if ($price_base_type == 'TTC')
|
||||
{
|
||||
$subprice = $tabprice[5];
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
$subprice = $pu;
|
||||
}
|
||||
|
|
@ -2691,7 +2874,7 @@ class Commande extends CommonOrder
|
|||
$this->line->multicurrency_total_ht = $multicurrency_total_ht;
|
||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
||||
|
||||
|
||||
// TODO deprecated
|
||||
$this->line->price=$price;
|
||||
$this->line->remise=$remise;
|
||||
|
|
@ -3310,7 +3493,7 @@ class Commande extends CommonOrder
|
|||
$prodid = mt_rand(1, $num_prods);
|
||||
$line->fk_product=$prodids[$prodid];
|
||||
}
|
||||
|
||||
|
||||
$this->lines[$xnbp]=$line;
|
||||
|
||||
$this->total_ht += $line->total_ht;
|
||||
|
|
@ -3442,7 +3625,7 @@ class Commande extends CommonOrder
|
|||
|
||||
return max($this->date_commande, $this->date_livraison) < ($now - $conf->commande->client->warning_delay);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show the customer delayed info
|
||||
*
|
||||
|
|
@ -3451,11 +3634,11 @@ class Commande extends CommonOrder
|
|||
public function showDelay()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
|
||||
if (empty($this->date_livraison)) $text=$langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day');
|
||||
else $text=$text=$langs->trans("DeliveryDate").' '.dol_print_date($this->date_livraison, 'day');
|
||||
$text.=' '.($conf->commande->client->warning_delay>0?'+':'-').' '.round(abs($conf->commande->client->warning_delay)/3600/24,1).' '.$langs->trans("days").' < '.$langs->trans("Today");
|
||||
|
||||
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
|
|
@ -3884,13 +4067,13 @@ class OrderLine extends CommonOrderLine
|
|||
$sql.= " , fk_parent_line=".(! empty($this->fk_parent_line)?$this->fk_parent_line:"null");
|
||||
if (! empty($this->rang)) $sql.= ", rang=".$this->rang;
|
||||
$sql.= " , fk_unit=".(!$this->fk_unit ? 'NULL' : $this->fk_unit);
|
||||
|
||||
|
||||
// Multicurrency
|
||||
$sql.= " , multicurrency_subprice=".price2num($this->multicurrency_subprice)."";
|
||||
$sql.= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht)."";
|
||||
$sql.= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva)."";
|
||||
$sql.= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc)."";
|
||||
|
||||
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
|
|
|
|||
|
|
@ -48,6 +48,12 @@ $langs->load('companies');
|
|||
$langs->load('compta');
|
||||
$langs->load('bills');
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$massaction=GETPOST('massaction','alpha');
|
||||
$show_files=GETPOST('show_files','int');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
|
||||
$orderyear=GETPOST("orderyear","int");
|
||||
$ordermonth=GETPOST("ordermonth","int");
|
||||
$orderday=GETPOST("orderday","int");
|
||||
|
|
@ -148,7 +154,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction')) { $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
$parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
|
@ -183,24 +189,17 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
|||
$deliveryyear='';
|
||||
$viewstatut='';
|
||||
$billed='';
|
||||
$toselect='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Mass actions. Controls on number of lines checked
|
||||
$maxformassaction=1000;
|
||||
if (! empty($massaction) && count($toselect) < 1)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("NoLineChecked"), null, "warnings");
|
||||
}
|
||||
if (! $error && count($toselect) > $maxformassaction)
|
||||
{
|
||||
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
$objectclass='Commande';
|
||||
$permtoread = $user->rights->commande->lire;
|
||||
$permtodelete = $user->rights->commande->supprimer;
|
||||
$uploaddir = $conf->commande->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -380,6 +379,8 @@ if ($resql)
|
|||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
|
|
@ -399,7 +400,8 @@ if ($resql)
|
|||
if ($search_total_ht != '') $param.='&search_total_ht='.$search_total_ht;
|
||||
if ($search_total_vat != '') $param.='&search_total_vat='.$search_total_vat;
|
||||
if ($search_total_ttc != '') $param.='&search_total_ttc='.$search_total_ttc;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if ($show_files) $param.='&show_files=' .$show_files;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
// Add $param from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
|
|
@ -408,8 +410,14 @@ if ($resql)
|
|||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||
}
|
||||
|
||||
//$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
|
||||
|
||||
$arrayofmassactions = array(
|
||||
'presend'=>$langs->trans("SendByMail"),
|
||||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->commande->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
|
|
@ -420,7 +428,103 @@ if ($resql)
|
|||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
|
||||
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
$langs->load("mails");
|
||||
|
||||
if (! GETPOST('cancel'))
|
||||
{
|
||||
$objecttmp=new Commande($db);
|
||||
$listofselectedid=array();
|
||||
$listofselectedthirdparties=array();
|
||||
$listofselectedref=array();
|
||||
foreach($arrayofselected as $toselectid)
|
||||
{
|
||||
$result=$objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$listofselectedid[$toselectid]=$toselectid;
|
||||
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
|
||||
$listofselectedthirdparties[$thirdpartyid]=$thirdpartyid;
|
||||
$listofselectedref[$thirdpartyid][$toselectid]=$objecttmp->ref;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '<input type="hidden" name="massaction" value="confirm_presend">';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
|
||||
dol_fiche_head(null, '', '');
|
||||
|
||||
$topicmail="SendOrderRef";
|
||||
$modelmail="order_send";
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->withform=-1;
|
||||
$formmail->fromtype = 'user';
|
||||
$formmail->fromid = $user->id;
|
||||
$formmail->fromname = $user->getFullName($langs);
|
||||
$formmail->frommail = $user->email;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
|
||||
{
|
||||
$formmail->trackid='ord'.$object->id;
|
||||
}
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'ord'.$object->id);
|
||||
}
|
||||
$formmail->withfrom=1;
|
||||
$liste=$langs->trans("AllRecipientSelected");
|
||||
if (count($listofselectedthirdparties) == 1)
|
||||
{
|
||||
$liste=array();
|
||||
$thirdpartyid=array_shift($listofselectedthirdparties);
|
||||
$soc=new Societe($db);
|
||||
$soc->fetch($thirdpartyid);
|
||||
foreach ($soc->thirdparty_and_contact_email_array(1) as $key=>$value)
|
||||
{
|
||||
$liste[$key]=$value;
|
||||
}
|
||||
$formmail->withtoreadonly=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$formmail->withtoreadonly=1;
|
||||
}
|
||||
$formmail->withto=$liste;
|
||||
$formmail->withtofree=0;
|
||||
$formmail->withtocc=1;
|
||||
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withtopic=$langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
|
||||
$formmail->withfile=$langs->trans("OnlyPDFattachmentSupported");
|
||||
$formmail->withbody=1;
|
||||
$formmail->withdeliveryreceipt=1;
|
||||
$formmail->withcancel=1;
|
||||
// Tableau des substitutions
|
||||
$formmail->substit['__REF__']='__REF__'; // We want to keep the tag
|
||||
$formmail->substit['__SIGNATURE__']=$user->signature;
|
||||
$formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag
|
||||
$formmail->substit['__PERSONALIZED__']='';
|
||||
$formmail->substit['__CONTACTCIVNAME__']='';
|
||||
|
||||
// Tableau des parametres complementaires du post
|
||||
$formmail->param['action']=$action;
|
||||
$formmail->param['models']=$modelmail;
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['id']=join(',',$arrayofselected);
|
||||
//$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||
|
||||
print $formmail->get_form();
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
|
|
@ -657,7 +761,7 @@ if ($resql)
|
|||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
|
||||
|
|
@ -1001,7 +1105,14 @@ if ($resql)
|
|||
}
|
||||
|
||||
// Action column
|
||||
print '<td></td>';
|
||||
print '<td class="nowrap" align="center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
$selected=0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
print '</tr>';
|
||||
|
|
@ -1043,6 +1154,30 @@ if ($resql)
|
|||
print '</form>'."\n";
|
||||
|
||||
print '<br>'.img_help(1,'').' '.$langs->trans("ToBillSeveralOrderSelectCustomer", $langs->transnoentitiesnoconv("CreateInvoiceForThisCustomer")).'<br>';
|
||||
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
|
||||
{
|
||||
/*
|
||||
* Show list of available documents
|
||||
*/
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||
$urlsource.=str_replace('&','&',$param);
|
||||
|
||||
$filedir=$diroutputmassaction;
|
||||
$genallowed=$user->rights->facture->lire;
|
||||
$delallowed=$user->rights->facture->lire;
|
||||
|
||||
print '<br><a name="show_files"></a>';
|
||||
$paramwithoutshowfiles=preg_replace('/show_files=1&?/','',$param);
|
||||
$title=$langs->trans("MassFilesArea").' <a href="'.$_SERVER["PHP_SELF"].'?'.$paramwithoutshowfiles.'">('.$langs->trans("Hide").')</a>';
|
||||
|
||||
print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -89,7 +89,8 @@ if ($_POST["action"] == 'add')
|
|||
$account->proprio = trim($_POST["proprio"]);
|
||||
$account->owner_address = trim($_POST["owner_address"]);
|
||||
|
||||
$account->account_number = GETPOST('account_number');
|
||||
$account_number = GETPOST('account_number','alpha');
|
||||
if ($account_number <= 0) { $account->account_number = ''; } else { $account->account_number = $account_number; }
|
||||
$account->accountancy_journal = trim($_POST["accountancy_journal"]);
|
||||
|
||||
$account->solde = $_POST["solde"];
|
||||
|
|
@ -171,7 +172,8 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
|||
$account->proprio = trim($_POST["proprio"]);
|
||||
$account->owner_address = trim($_POST["owner_address"]);
|
||||
|
||||
$account->account_number = GETPOST('account_number');
|
||||
$account_number = GETPOST('account_number', 'int');
|
||||
if ($account_number <= 0) { $account->account_number = ''; } else { $account->account_number = $account_number; }
|
||||
$account->accountancy_journal = trim($_POST["accountancy_journal"]);
|
||||
|
||||
$account->currency_code = trim($_POST["account_currency_code"]);
|
||||
|
|
|
|||
|
|
@ -83,13 +83,13 @@ if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->rights->ban
|
|||
|
||||
if ($user->rights->banque->modifier && $action == 'class')
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".$rowid." AND fk_categ = ".$_POST["cat1"];
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".$rowid." AND fk_categ = ".GETPOST('cat1', 'int');
|
||||
if (! $db->query($sql))
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES (".$rowid.", ".$_POST["cat1"].")";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES (".$rowid.", ".GETPOST('cat1', 'int').")";
|
||||
if (! $db->query($sql))
|
||||
{
|
||||
dol_print_error($db);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
* Copyright (C) 2008-2009 Laurent Destailleur (Eldy) <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com
|
||||
* Copyright (C) 2016 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -166,10 +167,12 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
|
|||
|
||||
// Social contributions
|
||||
$sql3= " SELECT 'social_contribution' as family, cs.rowid as objid, cs.libelle as ref, (-1*cs.amount) as total_ttc, ccs.libelle as type, cs.date_ech as dlr";
|
||||
$sql3.= ", cs.fk_account";
|
||||
$sql3.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||
$sql3.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id";
|
||||
$sql3.= " WHERE cs.entity = ".$conf->entity;
|
||||
$sql3.= " AND cs.paye = 0"; // Not paid
|
||||
$sql3.= " AND (cs.fk_account IN (0, ".$acct->id.") OR cs.fk_account IS NULL)"; // Id bank account of social contribution
|
||||
$sql3.= " ORDER BY dlr ASC";
|
||||
|
||||
$error=0;
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ if (empty($reshook))
|
|||
$qualified_for_stock_change = $object->hasProductsOrServices(1);
|
||||
}
|
||||
|
||||
$result = $object->delete(0, 0, $idwarehouse);
|
||||
$result = $object->delete($user, 0, $idwarehouse);
|
||||
if ($result > 0) {
|
||||
header('Location: ' . DOL_URL_ROOT . '/compta/facture/list.php');
|
||||
exit();
|
||||
|
|
@ -438,7 +438,7 @@ if (empty($reshook))
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$qualified_for_stock_change = 0;
|
||||
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
|
||||
$qualified_for_stock_change = $object->hasProductsOrServices(2);
|
||||
|
|
@ -1022,7 +1022,7 @@ if (empty($reshook))
|
|||
|
||||
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines or deposit lines");
|
||||
$result = $srcobject->fetch($object->origin_id);
|
||||
|
||||
|
||||
// If deposit invoice
|
||||
if ($_POST['type'] == Facture::TYPE_DEPOSIT)
|
||||
{
|
||||
|
|
@ -1183,7 +1183,7 @@ if (empty($reshook))
|
|||
$error ++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Now we create same links to contact than the ones found on origin object
|
||||
if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
|
||||
{
|
||||
|
|
@ -1196,13 +1196,13 @@ if (empty($reshook))
|
|||
}
|
||||
$sqlcontact = "SELECT code, fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
||||
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
|
||||
|
||||
|
||||
$resqlcontact = $db->query($sqlcontact);
|
||||
if ($resqlcontact)
|
||||
{
|
||||
while($objcontact = $db->fetch_object($resqlcontact))
|
||||
{
|
||||
//print $objcontact->code.'-'.$objcontact->fk_socpeople."\n";
|
||||
//print $objcontact->code.'-'.$objcontact->fk_socpeople."\n";
|
||||
$object->add_contact($objcontact->fk_socpeople, $objcontact->code);
|
||||
}
|
||||
}
|
||||
|
|
@ -1214,14 +1214,17 @@ if (empty($reshook))
|
|||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
// modified by hook
|
||||
if ($reshook < 0)
|
||||
{
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{ // If some invoice's lines coming from page
|
||||
$id = $object->create($user);
|
||||
|
||||
|
|
@ -1393,7 +1396,7 @@ if (empty($reshook))
|
|||
// Ecrase $txtva par celui du produit
|
||||
// Ecrase $base_price_type par celui du produit
|
||||
// Replaces $fk_unit with the product's
|
||||
if (! empty($idprod))
|
||||
if (! empty($idprod))
|
||||
{
|
||||
$prod = new Product($db);
|
||||
$prod->fetch($idprod);
|
||||
|
|
@ -1404,7 +1407,7 @@ if (empty($reshook))
|
|||
$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
|
||||
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
|
||||
|
||||
$pu_ht = $prod->price;
|
||||
$pu_ttc = $prod->price_ttc;
|
||||
$price_min = $prod->price_min;
|
||||
|
|
@ -1451,13 +1454,13 @@ if (empty($reshook))
|
|||
}
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
elseif ($tva_tx != $prod->tva_tx)
|
||||
elseif ($tva_tx != $prod->tva_tx)
|
||||
{
|
||||
if ($price_base_type != 'HT')
|
||||
if ($price_base_type != 'HT')
|
||||
{
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU');
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU');
|
||||
}
|
||||
|
|
@ -1519,7 +1522,7 @@ if (empty($reshook))
|
|||
// Local Taxes
|
||||
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr);
|
||||
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr);
|
||||
|
||||
|
||||
$info_bits = 0;
|
||||
if ($tva_npr)
|
||||
$info_bits |= 0x01;
|
||||
|
|
@ -1623,7 +1626,7 @@ if (empty($reshook))
|
|||
// Add buying price
|
||||
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
||||
|
||||
|
||||
// Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||
|
|
@ -2082,7 +2085,7 @@ if ($action == 'create')
|
|||
$invoice_predefined->fetch(GETPOST('fac_rec','int'));
|
||||
|
||||
$dateinvoice = $invoice_predefined->date_when; // To use next gen date by default later
|
||||
|
||||
|
||||
$sql = 'SELECT r.rowid, r.titre, r.total_ttc';
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as r';
|
||||
$sql .= ' WHERE r.fk_soc = ' . $invoice_predefined->socid;
|
||||
|
|
@ -3087,7 +3090,7 @@ else if ($id > 0 || ! empty($ref))
|
|||
// Remise dispo de type avoir
|
||||
if (! $absolute_discount)
|
||||
print '<br>';
|
||||
// $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer
|
||||
// $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer
|
||||
$more=' ('.$addcreditnote.')';
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0, $more); // We allow credit note even if amount is higher
|
||||
}
|
||||
|
|
@ -4038,7 +4041,7 @@ else if ($id > 0 || ! empty($ref))
|
|||
print '<div class="inline-block divButAction"><a class="butAction" href="facture/fiche-rec.php?facid=' . $object->id . '&action=create">' . $langs->trans("ChangeIntoRepeatableInvoice") . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Create a credit note
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $user->rights->facture->creer)
|
||||
{
|
||||
|
|
@ -4193,7 +4196,7 @@ else if ($id > 0 || ! empty($ref))
|
|||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'inv'.$object->id);
|
||||
}
|
||||
}
|
||||
$formmail->withfrom = 1;
|
||||
$liste = array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) {
|
||||
|
|
@ -4213,7 +4216,7 @@ else if ($id > 0 || ! empty($ref))
|
|||
$formmail->withdeliveryreceipt = 1;
|
||||
$formmail->withcancel = 1;
|
||||
// Tableau des substitutions
|
||||
$formmail->setSubstitFromObject($object);
|
||||
$formmail->setSubstitFromObject($object, $outputlangs);
|
||||
$formmail->substit['__INVREF__'] = $object->ref;
|
||||
|
||||
// Find the good contact adress
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ class InvoiceApi extends DolibarrApi
|
|||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if( !$this->invoice->delete($id))
|
||||
if( !$this->invoice->delete(DolibarrApiAccess::$user))
|
||||
{
|
||||
throw new RestException(500);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,63 +59,63 @@ class Facture extends CommonInvoice
|
|||
*/
|
||||
protected $table_ref_field = 'facnumber';
|
||||
|
||||
var $socid;
|
||||
public $socid;
|
||||
|
||||
var $author;
|
||||
var $fk_user_author;
|
||||
var $fk_user_valid;
|
||||
var $date; // Date invoice
|
||||
var $date_creation; // Creation date
|
||||
var $date_validation; // Validation date
|
||||
var $datem;
|
||||
var $ref_client;
|
||||
var $ref_int;
|
||||
public $author;
|
||||
public $fk_user_author;
|
||||
public $fk_user_valid;
|
||||
public $date; // Date invoice
|
||||
public $date_creation; // Creation date
|
||||
public $date_validation; // Validation date
|
||||
public $datem;
|
||||
public $ref_client;
|
||||
public $ref_int;
|
||||
//Check constants for types
|
||||
var $type = self::TYPE_STANDARD;
|
||||
public $type = self::TYPE_STANDARD;
|
||||
|
||||
//var $amount;
|
||||
var $remise_absolue;
|
||||
var $remise_percent;
|
||||
var $total_ht=0;
|
||||
var $total_tva=0;
|
||||
var $total_ttc=0;
|
||||
var $revenuestamp;
|
||||
public $remise_absolue;
|
||||
public $remise_percent;
|
||||
public $total_ht=0;
|
||||
public $total_tva=0;
|
||||
public $total_ttc=0;
|
||||
public $revenuestamp;
|
||||
|
||||
//! Fermeture apres paiement partiel: discount_vat, badcustomer, abandon
|
||||
//! Fermeture alors que aucun paiement: replaced (si remplace), abandon
|
||||
var $close_code;
|
||||
public $close_code;
|
||||
//! Commentaire si mis a paye sans paiement complet
|
||||
var $close_note;
|
||||
public $close_note;
|
||||
//! 1 if invoice paid COMPLETELY, 0 otherwise (do not use it anymore, use statut and close_code)
|
||||
var $paye;
|
||||
public $paye;
|
||||
//! id of source invoice if replacement invoice or credit note
|
||||
var $fk_facture_source;
|
||||
var $linked_objects=array();
|
||||
var $date_lim_reglement;
|
||||
var $cond_reglement_code; // Code in llx_c_paiement
|
||||
var $mode_reglement_code; // Code in llx_c_paiement
|
||||
var $fk_bank; // Field to store bank id to use when payment mode is withdraw
|
||||
public $fk_facture_source;
|
||||
public $linked_objects=array();
|
||||
public $date_lim_reglement;
|
||||
public $cond_reglement_code; // Code in llx_c_paiement
|
||||
public $mode_reglement_code; // Code in llx_c_paiement
|
||||
public $fk_bank; // Field to store bank id to use when payment mode is withdraw
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
var $products=array();
|
||||
public $products=array();
|
||||
/**
|
||||
* @var FactureLigne[]
|
||||
*/
|
||||
var $lines=array();
|
||||
var $line;
|
||||
var $extraparams=array();
|
||||
var $specimen;
|
||||
public $lines=array();
|
||||
public $line;
|
||||
public $extraparams=array();
|
||||
public $specimen;
|
||||
|
||||
var $fac_rec;
|
||||
public $fac_rec;
|
||||
|
||||
// Multicurrency
|
||||
var $fk_multicurrency;
|
||||
var $multicurrency_code;
|
||||
var $multicurrency_tx;
|
||||
var $multicurrency_total_ht;
|
||||
var $multicurrency_total_tva;
|
||||
var $multicurrency_total_ttc;
|
||||
public $fk_multicurrency;
|
||||
public $multicurrency_code;
|
||||
public $multicurrency_tx;
|
||||
public $multicurrency_total_ht;
|
||||
public $multicurrency_total_tva;
|
||||
public $multicurrency_total_ttc;
|
||||
|
||||
/**
|
||||
* @var int Situation cycle reference number
|
||||
|
|
@ -142,6 +142,8 @@ class Facture extends CommonInvoice
|
|||
*/
|
||||
public $tab_next_situation_invoice=array();
|
||||
|
||||
public $oldcopy;
|
||||
|
||||
/**
|
||||
* Standard invoice
|
||||
*/
|
||||
|
|
@ -1486,39 +1488,74 @@ class Facture extends CommonInvoice
|
|||
* Set customer ref
|
||||
*
|
||||
* @param string $ref_client Customer ref
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_ref_client($ref_client)
|
||||
function set_ref_client($ref_client, $notrigger=0)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
|
||||
if (empty($ref_client))
|
||||
$sql .= ' SET ref_client = NULL';
|
||||
else
|
||||
$sql .= ' SET ref_client = \''.$this->db->escape($ref_client).'\'';
|
||||
$sql .= ' WHERE rowid = '.$this->id;
|
||||
if ($this->db->query($sql))
|
||||
|
||||
dol_syslog(__METHOD__.' this->id='.$this->id.', ref_client='.$ref_client, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->errors[]=$this->db->error();
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->ref_client = $ref_client;
|
||||
}
|
||||
|
||||
if (! $notrigger && empty($error))
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BILL_MODIFY',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
$this->ref_client = $ref_client;
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete invoice
|
||||
*
|
||||
* @param int $rowid Id of invoice to delete. If empty, we delete current instance of invoice
|
||||
* @param User $user User to delete.
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @param int $idwarehouse Id warehouse to use for stock change.
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($rowid=0, $notrigger=0, $idwarehouse=-1)
|
||||
function delete($user, $notrigger=0, $idwarehouse=-1)
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
global $langs,$conf;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
if (empty($rowid)) $rowid=$this->id;
|
||||
|
|
@ -2070,7 +2107,7 @@ class Facture extends CommonInvoice
|
|||
$i++;
|
||||
}
|
||||
if ($final) {
|
||||
$this->setFinal();
|
||||
$this->setFinal($user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2760,9 +2797,10 @@ class Facture extends CommonInvoice
|
|||
*
|
||||
* @param User $user User that set discount
|
||||
* @param double $remise Discount
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
|
||||
* @return int <0 if ko, >0 if ok
|
||||
*/
|
||||
function set_remise($user, $remise)
|
||||
function set_remise($user, $remise, $notrigger=0)
|
||||
{
|
||||
// Clean parameters
|
||||
if (empty($remise)) $remise=0;
|
||||
|
|
@ -2771,21 +2809,48 @@ class Facture extends CommonInvoice
|
|||
{
|
||||
$remise=price2num($remise);
|
||||
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
|
||||
$sql.= ' SET remise_percent = '.$remise;
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
$sql.= ' AND fk_statut = '.self::STATUS_DRAFT;
|
||||
|
||||
if ($this->db->query($sql))
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->errors[]=$this->db->error();
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $notrigger && empty($error))
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BILL_MODIFY',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->remise_percent = $remise;
|
||||
$this->update_price(1);
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2796,14 +2861,19 @@ class Facture extends CommonInvoice
|
|||
*
|
||||
* @param User $user User that set discount
|
||||
* @param double $remise Discount
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_remise_absolue($user, $remise)
|
||||
function set_remise_absolue($user, $remise, $notrigger=0)
|
||||
{
|
||||
if (empty($remise)) $remise=0;
|
||||
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$remise=price2num($remise);
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
|
||||
|
|
@ -2811,18 +2881,43 @@ class Facture extends CommonInvoice
|
|||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
$sql.= ' AND fk_statut = '.self::STATUS_DRAFT;
|
||||
|
||||
dol_syslog(get_class($this)."::set_remise_absolue", LOG_DEBUG);
|
||||
|
||||
if ($this->db->query($sql))
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->errors[]=$this->db->error();
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->oldcopy= clone $this;
|
||||
$this->remise_absolue = $remise;
|
||||
$this->update_price(1);
|
||||
}
|
||||
|
||||
if (! $notrigger && empty($error))
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BILL_MODIFY',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3449,7 +3544,7 @@ class Facture extends CommonInvoice
|
|||
|
||||
$clause = " WHERE";
|
||||
|
||||
$sql = "SELECT f.rowid, f.date_lim_reglement as datefin";
|
||||
$sql = "SELECT f.rowid, f.date_lim_reglement as datefin,f.fk_statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id)
|
||||
{
|
||||
|
|
@ -3479,6 +3574,7 @@ class Facture extends CommonInvoice
|
|||
while ($obj=$this->db->fetch_object($resql))
|
||||
{
|
||||
$generic_facture->date_lim_reglement = $this->db->jdate($obj->datefin);
|
||||
$generic_facture->statut = $obj->fk_statut;
|
||||
|
||||
$response->nbtodo++;
|
||||
|
||||
|
|
@ -3818,25 +3914,49 @@ class Facture extends CommonInvoice
|
|||
/**
|
||||
* Sets the invoice as a final situation
|
||||
*
|
||||
* @return int 1 if ok, -1 if error
|
||||
* @param User $user Object user
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function setFinal()
|
||||
function setFinal(User $user, $notrigger=0)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
$this->db->begin();
|
||||
|
||||
$this->situation_final = 1;
|
||||
$sql = 'update ' . MAIN_DB_PREFIX . 'facture set situation_final = ' . $this->situation_final . ' where rowid = ' . $this->id;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
// FIXME: call triggers MODIFY because we modify invoice
|
||||
$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture SET situation_final = ' . $this->situation_final . ' where rowid = ' . $this->id;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->errors[]=$this->db->error();
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $notrigger && empty($error))
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BILL_MODIFY',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::update Error setFinal " . $sql, LOG_ERR);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
return -1*$error;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4005,6 +4125,10 @@ class FactureLigne extends CommonInvoiceLine
|
|||
$sql.= ' fd.fk_unit,';
|
||||
$sql.= ' fd.situation_percent, fd.fk_prev_id,';
|
||||
$sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc';
|
||||
$sql.= ' , fd.multicurrency_subprice';
|
||||
$sql.= ' , fd.multicurrency_total_ht';
|
||||
$sql.= ' , fd.multicurrency_total_tva';
|
||||
$sql.= ' , fd.multicurrency_total_ttc';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as fd';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON fd.fk_product = p.rowid';
|
||||
$sql.= ' WHERE fd.rowid = '.$rowid;
|
||||
|
|
@ -4055,6 +4179,11 @@ class FactureLigne extends CommonInvoiceLine
|
|||
$this->situation_percent = $objp->situation_percent;
|
||||
$this->fk_prev_id = $objp->fk_prev_id;
|
||||
|
||||
$this->multicurrency_subprice = $objp->multicurrency_subprice;
|
||||
$this->multicurrency_total_ht = $objp->multicurrency_total_ht;
|
||||
$this->multicurrency_total_tva= $objp->multicurrency_total_tva;
|
||||
$this->multicurrency_total_ttc= $objp->multicurrency_total_ttc;
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
return 1;
|
||||
|
|
@ -4308,6 +4437,11 @@ class FactureLigne extends CommonInvoiceLine
|
|||
if (! isset($this->situation_percent) || $this->situation_percent > 100 || (string) $this->situation_percent == '') $this->situation_percent = 100;
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
|
||||
if (empty($this->multicurrency_subprice)) $this->multicurrency_subprice=0;
|
||||
if (empty($this->multicurrency_total_ht)) $this->multicurrency_total_ht=0;
|
||||
if (empty($this->multicurrency_total_tva)) $this->multicurrency_total_tva=0;
|
||||
if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc=0;
|
||||
|
||||
// Check parameters
|
||||
if ($this->product_type < 0) return -1;
|
||||
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ if ($action == 'add')
|
|||
$result = $object->create($user, $oldinvoice->id);
|
||||
if ($result > 0)
|
||||
{
|
||||
$result=$oldinvoice->delete(0, 1);
|
||||
$result=$oldinvoice->delete($user, 1);
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
|
|
@ -242,7 +242,7 @@ if ($action == 'add')
|
|||
// Delete
|
||||
if ($action == 'delete' && $user->rights->facture->supprimer)
|
||||
{
|
||||
$object->delete();
|
||||
$object->delete($user);
|
||||
header("Location: " . $_SERVER['PHP_SELF'] );
|
||||
exit;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,10 +58,13 @@ $projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0);
|
|||
$id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility
|
||||
$ref=GETPOST('ref','alpha');
|
||||
$socid=GETPOST('socid','int');
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$massaction=GETPOST('massaction','alpha');
|
||||
$show_files=GETPOST('show_files','int');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
|
||||
$lineid=GETPOST('lineid','int');
|
||||
$userid=GETPOST('userid','int');
|
||||
$search_product_category=GETPOST('search_product_category','int');
|
||||
|
|
@ -86,7 +89,6 @@ $year = GETPOST('year','int');
|
|||
$day_lim = GETPOST('day_lim','int');
|
||||
$month_lim = GETPOST('month_lim','int');
|
||||
$year_lim = GETPOST('year_lim','int');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
|
||||
$option = GETPOST('option');
|
||||
if ($option == 'late') $filter = 'paye:0';
|
||||
|
|
@ -173,7 +175,8 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction')) { $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
|
||||
$parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
|
@ -205,418 +208,22 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOS
|
|||
$day='';
|
||||
$year='';
|
||||
$month='';
|
||||
$toselect='';
|
||||
$option='';
|
||||
$filter='';
|
||||
$day_lim='';
|
||||
$year_lim='';
|
||||
$month_lim='';
|
||||
$toselect='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Mass actions. Controls on number of lines checked
|
||||
$maxformassaction=1000;
|
||||
if (! empty($massaction) && count($toselect) < 1)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("NoLineChecked"), null, "warnings");
|
||||
}
|
||||
if (! $error && count($toselect) > $maxformassaction)
|
||||
{
|
||||
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error && $massaction == 'confirm_presend')
|
||||
{
|
||||
$resaction = '';
|
||||
$nbsent = 0;
|
||||
$nbignored = 0;
|
||||
$langs->load("mails");
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
if (!$error && !isset($user->email))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$thirdparty=new Societe($db);
|
||||
$objecttmp=new Facture($db);
|
||||
$listofobjectid=array();
|
||||
$listofobjectthirdparties=array();
|
||||
$listofobjectref=array();
|
||||
foreach($toselect as $toselectid)
|
||||
{
|
||||
$objecttmp=new Facture($db); // must create new instance because instance is saved into $listofobjectref array for future use
|
||||
$result=$objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$listoinvoicesid[$toselectid]=$toselectid;
|
||||
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
|
||||
$listofobjectthirdparties[$thirdpartyid]=$thirdpartyid;
|
||||
$listofobjectref[$thirdpartyid][$toselectid]=$objecttmp;
|
||||
}
|
||||
}
|
||||
//var_dump($listofobjectthirdparties);exit;
|
||||
|
||||
foreach ($listofobjectthirdparties as $thirdpartyid)
|
||||
{
|
||||
$result = $thirdparty->fetch($thirdpartyid);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Define recipient $sendto and $sendtocc
|
||||
if (trim($_POST['sendto']))
|
||||
{
|
||||
// Recipient is provided into free text
|
||||
$sendto = trim($_POST['sendto']);
|
||||
$sendtoid = 0;
|
||||
}
|
||||
elseif ($_POST['receiver'] != '-1')
|
||||
{
|
||||
// Recipient was provided from combo list
|
||||
if ($_POST['receiver'] == 'thirdparty') // Id of third party
|
||||
{
|
||||
$sendto = $thirdparty->email;
|
||||
$sendtoid = 0;
|
||||
}
|
||||
else // Id du contact
|
||||
{
|
||||
$sendto = $thirdparty->contact_get_property((int) $_POST['receiver'],'email');
|
||||
$sendtoid = $_POST['receiver'];
|
||||
}
|
||||
}
|
||||
if (trim($_POST['sendtocc']))
|
||||
{
|
||||
$sendtocc = trim($_POST['sendtocc']);
|
||||
}
|
||||
elseif ($_POST['receivercc'] != '-1')
|
||||
{
|
||||
// Recipient was provided from combo list
|
||||
if ($_POST['receivercc'] == 'thirdparty') // Id of third party
|
||||
{
|
||||
$sendtocc = $thirdparty->email;
|
||||
}
|
||||
else // Id du contact
|
||||
{
|
||||
$sendtocc = $thirdparty->contact_get_property((int) $_POST['receivercc'],'email');
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($listofobjectref[$thirdpartyid]); // Array of invoice for this thirdparty
|
||||
|
||||
$attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array());
|
||||
$listofqualifiedinvoice=array();
|
||||
$listofqualifiedref=array();
|
||||
foreach($listofobjectref[$thirdpartyid] as $objectid => $object)
|
||||
{
|
||||
//var_dump($object);
|
||||
//var_dump($thirdpartyid.' - '.$objectid.' - '.$object->statut);
|
||||
|
||||
if ($object->statut != Facture::STATUS_VALIDATED)
|
||||
{
|
||||
$nbignored++;
|
||||
continue; // Payment done or started or canceled
|
||||
}
|
||||
|
||||
// Read document
|
||||
// TODO Use future field $object->fullpathdoc to know where is stored default file
|
||||
// TODO If not defined, use $object->modelpdf (or defaut invoice config) to know what is template to use to regenerate doc.
|
||||
$filename=dol_sanitizeFileName($object->ref).'.pdf';
|
||||
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref);
|
||||
$file = $filedir . '/' . $filename;
|
||||
$mime = dol_mimetype($file);
|
||||
|
||||
if (dol_is_file($file))
|
||||
{
|
||||
if (empty($sendto)) // For the case, no recipient were set (multi thirdparties send)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
$sendto = $object->thirdparty->email;
|
||||
}
|
||||
|
||||
if (empty($sendto))
|
||||
{
|
||||
//print "No recipient for thirdparty ".$object->thirdparty->name;
|
||||
$nbignored++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dol_strlen($sendto))
|
||||
{
|
||||
// Create form object
|
||||
$attachedfiles=array(
|
||||
'paths'=>array_merge($attachedfiles['paths'],array($file)),
|
||||
'names'=>array_merge($attachedfiles['names'],array($filename)),
|
||||
'mimes'=>array_merge($attachedfiles['mimes'],array($mime))
|
||||
);
|
||||
}
|
||||
|
||||
$listofqualifiedinvoice[$objectid]=$object;
|
||||
$listofqualifiedref[$objectid]=$object->ref;
|
||||
}
|
||||
else
|
||||
{
|
||||
$nbignored++;
|
||||
$langs->load("other");
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
|
||||
dol_syslog('Failed to read file: '.$file, LOG_WARNING);
|
||||
continue;
|
||||
}
|
||||
|
||||
//var_dump($listofqualifiedref);
|
||||
}
|
||||
|
||||
if (count($listofqualifiedinvoice) > 0)
|
||||
{
|
||||
$langs->load("commercial");
|
||||
$from = $user->getFullName($langs) . ' <' . $user->email .'>';
|
||||
$replyto = $from;
|
||||
$subject = GETPOST('subject');
|
||||
$message = GETPOST('message');
|
||||
$sendtocc = GETPOST('sentocc');
|
||||
$sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO);
|
||||
|
||||
$substitutionarray=array(
|
||||
'__ID__' => join(', ',array_keys($listofqualifiedinvoice)),
|
||||
'__EMAIL__' => $thirdparty->email,
|
||||
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
||||
//'__LASTNAME__' => $obj2->lastname,
|
||||
//'__FIRSTNAME__' => $obj2->firstname,
|
||||
'__FACREF__' => join(', ',$listofqualifiedref), // For backward compatibility
|
||||
'__REF__' => join(', ',$listofqualifiedref),
|
||||
'__REFCLIENT__' => $thirdparty->name
|
||||
);
|
||||
|
||||
$subject=make_substitutions($subject, $substitutionarray);
|
||||
$message=make_substitutions($message, $substitutionarray);
|
||||
|
||||
$filepath = $attachedfiles['paths'];
|
||||
$filename = $attachedfiles['names'];
|
||||
$mimetype = $attachedfiles['mimes'];
|
||||
|
||||
//var_dump($filepath);
|
||||
|
||||
// Send mail
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php');
|
||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1);
|
||||
if ($mailfile->error)
|
||||
{
|
||||
$resaction.='<div class="error">'.$mailfile->error.'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$mailfile->sendfile();
|
||||
if ($result)
|
||||
{
|
||||
$resaction.=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)).'<br>'; // Must not contain "
|
||||
|
||||
$error=0;
|
||||
|
||||
// Insert logs into agenda
|
||||
foreach($listofqualifiedinvoice as $invid => $object)
|
||||
{
|
||||
$actiontypecode='AC_FAC';
|
||||
$actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto;
|
||||
if ($message)
|
||||
{
|
||||
if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
|
||||
$actionmsg = dol_concatdesc($actionmsg, $message);
|
||||
}
|
||||
|
||||
// Initialisation donnees
|
||||
$object->sendtoid = 0;
|
||||
$object->actiontypecode = $actiontypecode;
|
||||
$object->actionmsg = $actionmsg; // Long text
|
||||
$object->actionmsg2 = $actionmsg2; // Short text
|
||||
$object->fk_element = $invid;
|
||||
$object->elementtype = $object->element;
|
||||
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
$interface=new Interfaces($db);
|
||||
$result=$interface->run_triggers('BILL_SENTBYMAIL',$object,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
if ($error)
|
||||
{
|
||||
setEventMessages($db->lasterror(), $errors, 'errors');
|
||||
dol_syslog("Error in trigger BILL_SENTBYMAIL ".$db->lasterror(), LOG_ERR);
|
||||
}
|
||||
$nbsent++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("other");
|
||||
if ($mailfile->error)
|
||||
{
|
||||
$resaction.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
|
||||
$resaction.='<br><div class="error">'.$mailfile->error.'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$resaction.='<div class="warning">No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$resaction.=($resaction?'<br>':$resaction);
|
||||
$resaction.='<strong>'.$langs->trans("ResultOfMailSending").':</strong><br>'."\n";
|
||||
$resaction.=$langs->trans("NbSelected").': '.count($toselect)."\n<br>";
|
||||
$resaction.=$langs->trans("NbIgnored").': '.($nbignored?$nbignored:0)."\n<br>";
|
||||
$resaction.=$langs->trans("NbSent").': '.($nbsent?$nbsent:0)."\n<br>";
|
||||
|
||||
if ($nbsent)
|
||||
{
|
||||
$action=''; // Do not show form post if there was at least one successfull sent
|
||||
setEventMessages($langs->trans("EMailSentToNRecipients", $nbsent.'/'.count($toselect)), null, 'mesgs');
|
||||
setEventMessages($resaction, null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
//setEventMessages($langs->trans("EMailSentToNRecipients", 0), null, 'warnings'); // May be object has no generated PDF file
|
||||
setEventMessages($resaction, null, 'warnings');
|
||||
}
|
||||
}
|
||||
|
||||
$action='list';
|
||||
$massaction='';
|
||||
}
|
||||
|
||||
if (! $error && $massaction == "builddoc" && $user->rights->facture->lire && ! GETPOST('button_search'))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
$objecttmp=new Facture($db);
|
||||
$listofobjectid=array();
|
||||
$listofobjectthirdparties=array();
|
||||
$listofobjectref=array();
|
||||
foreach($toselect as $toselectid)
|
||||
{
|
||||
$objecttmp=new Facture($db); // must create new instance because instance is saved into $listofobjectref array for future use
|
||||
$result=$objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$listoinvoicesid[$toselectid]=$toselectid;
|
||||
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
|
||||
$listofobjectthirdparties[$thirdpartyid]=$thirdpartyid;
|
||||
$listofobjectref[$toselectid]=$objecttmp->ref;
|
||||
}
|
||||
}
|
||||
|
||||
$arrayofinclusion=array();
|
||||
foreach($listofobjectref as $tmppdf) $arrayofinclusion[]=preg_quote($tmppdf.'.pdf','/');
|
||||
$factures = dol_dir_list($conf->facture->dir_output,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true);
|
||||
|
||||
// liste les fichiers
|
||||
$files = array();
|
||||
foreach($listofobjectref as $basename)
|
||||
{
|
||||
foreach($factures as $facture)
|
||||
{
|
||||
if (strstr($facture["name"],$basename))
|
||||
{
|
||||
$files[] = $conf->facture->dir_output.'/'.$basename.'/'.$facture["name"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Define output language (Here it is not used because we do only merging existing PDF)
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
|
||||
// Create empty PDF
|
||||
$pdf=pdf_getInstance();
|
||||
if (class_exists('TCPDF'))
|
||||
{
|
||||
$pdf->setPrintHeader(false);
|
||||
$pdf->setPrintFooter(false);
|
||||
}
|
||||
$pdf->SetFont(pdf_getPDFFont($outputlangs));
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
|
||||
|
||||
// Add all others
|
||||
foreach($files as $file)
|
||||
{
|
||||
// Charge un document PDF depuis un fichier.
|
||||
$pagecount = $pdf->setSourceFile($file);
|
||||
for ($i = 1; $i <= $pagecount; $i++)
|
||||
{
|
||||
$tplidx = $pdf->importPage($i);
|
||||
$s = $pdf->getTemplatesize($tplidx);
|
||||
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
}
|
||||
|
||||
// Create output dir if not exists
|
||||
dol_mkdir($diroutputmassaction);
|
||||
|
||||
// Save merged file
|
||||
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities("Invoices")));
|
||||
if ($filter=='paye:0')
|
||||
{
|
||||
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
|
||||
else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
|
||||
}
|
||||
if ($year) $filename.='_'.$year;
|
||||
if ($month) $filename.='_'.$month;
|
||||
if ($pagecount)
|
||||
{
|
||||
$now=dol_now();
|
||||
$file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf';
|
||||
$pdf->Output($file,'F');
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$langs->load("exports");
|
||||
setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Remove file
|
||||
if ($action == 'remove_file')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$langs->load("other");
|
||||
$upload_dir = $diroutputmassaction;
|
||||
$file = $upload_dir . '/' . GETPOST('file');
|
||||
$ret=dol_delete_file($file);
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors');
|
||||
$action='';
|
||||
}
|
||||
|
||||
$objectclass='Facture';
|
||||
$permtoread = $user->rights->facture->lire;
|
||||
$permtodelete = $user->rights->facture->supprimer;
|
||||
$uploaddir = $conf->facture->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -831,7 +438,24 @@ if ($resql)
|
|||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||
}
|
||||
|
||||
$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
|
||||
$arrayofmassactions=array(
|
||||
'presend'=>$langs->trans("SendByMail"),
|
||||
'builddoc'=>$langs->trans("PDFMerge")
|
||||
);
|
||||
if ($user->rights->facture->supprimer)
|
||||
{
|
||||
//if (! empty($conf->global->STOCK_CALCULATE_ON_BILL) || empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED))
|
||||
if (empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED))
|
||||
{
|
||||
// mass deletion never possible on invoices on such situation
|
||||
}
|
||||
else
|
||||
{
|
||||
$arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
}
|
||||
}
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$i = 0;
|
||||
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
|
|
@ -843,7 +467,7 @@ if ($resql)
|
|||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
|
||||
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$massactionbutton,$num,$nbtotalofrecords,'title_accountancy.png',0,'','',$limit);
|
||||
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit);
|
||||
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
|
|
@ -934,6 +558,7 @@ if ($resql)
|
|||
$formmail->param['models']=$modelmail;
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['facid']=join(',',$arrayofselected);
|
||||
// TODO We should use $formmail->param['id']=join(',',$arrayofselected);
|
||||
//$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||
|
||||
print $formmail->get_form();
|
||||
|
|
@ -1183,7 +808,7 @@ if ($resql)
|
|||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(1, 'checkforselect', 1);
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
|
@ -1423,9 +1048,12 @@ if ($resql)
|
|||
|
||||
// Action column
|
||||
print '<td class="nowrap" align="center">';
|
||||
$selected=0;
|
||||
if (in_array($obj->facid, $arrayofselected)) $selected=1;
|
||||
print '<input id="cb'.$obj->facid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->facid.'"'.($selected?' checked="checked"':'').'>';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
$selected=0;
|
||||
if (in_array($obj->facid, $arrayofselected)) $selected=1;
|
||||
print '<input id="cb'.$obj->facid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->facid.'"'.($selected?' checked="checked"':'').'>';
|
||||
}
|
||||
print '</td>' ;
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
|
|
@ -1485,7 +1113,7 @@ if ($resql)
|
|||
$paramwithoutshowfiles=preg_replace('/show_files=1&?/','',$param);
|
||||
$title=$langs->trans("MassFilesArea").' <a href="'.$_SERVER["PHP_SELF"].'?'.$paramwithoutshowfiles.'">('.$langs->trans("Hide").')</a>';
|
||||
|
||||
print $formfile->showdocuments('massfilesarea_facture','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
||||
print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
|||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[$var].'><td colspan="3">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="3" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
$db->free($resql);
|
||||
|
|
@ -275,7 +275,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
|||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[$var].'><td colspan="3">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="3" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
$db->free($resql);
|
||||
|
|
@ -387,7 +387,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
|||
{
|
||||
$colspan=5;
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++;
|
||||
print '<tr '.$bc[$var].'><td colspan="'.$colspan.'">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
}
|
||||
print '</table><br>';
|
||||
$db->free($resql);
|
||||
|
|
@ -474,7 +474,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
|||
{
|
||||
$colspan=5;
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++;
|
||||
print '<tr '.$bc[$var].'><td colspan="'.$colspan.'">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
}
|
||||
print '</table><br>';
|
||||
}
|
||||
|
|
@ -842,7 +842,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
|||
{
|
||||
$colspan=6;
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++;
|
||||
print '<tr '.$bc[$var].'><td colspan="'.$colspan.'">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
}
|
||||
print '</table><br>';
|
||||
$db->free($resql);
|
||||
|
|
@ -942,7 +942,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
|||
{
|
||||
$colspan=6;
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++;
|
||||
print '<tr '.$bc[$var].'><td colspan="'.$colspan.'">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
}
|
||||
print '</table><br>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ require '../main.inc.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
|
||||
$langs->load('companies');
|
||||
$langs->load('bills');
|
||||
|
|
@ -518,11 +519,21 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||
* List of unpaid invoices
|
||||
*/
|
||||
$sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.multicurrency_total_ttc, f.type, ';
|
||||
$sql.= ' f.datef as df';
|
||||
$sql.= ' f.datef as df, f.fk_soc as socid';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
|
||||
$sql.= ' WHERE f.entity = '.$conf->entity;
|
||||
$sql.= ' AND f.fk_soc = '.$facture->socid;
|
||||
$sql.= ' AND f.paye = 0';
|
||||
|
||||
if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS)) {
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON (f.fk_soc = s.rowid)';
|
||||
}
|
||||
|
||||
$sql.= ' WHERE f.entity = '.$conf->entity;
|
||||
$sql.= ' AND (f.fk_soc = '.$facture->socid;
|
||||
|
||||
if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS)) {
|
||||
$sql.= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.$facture->thirdparty->parent.')';
|
||||
}
|
||||
|
||||
$sql.= ') AND f.paye = 0';
|
||||
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => not validated, Statut=2 => canceled
|
||||
if ($facture->type != 2)
|
||||
{
|
||||
|
|
@ -583,6 +594,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($objp->socid);
|
||||
|
||||
$invoice=new Facture($db);
|
||||
$invoice->fetch($objp->facid);
|
||||
$paiement = $invoice->getSommePaiement();
|
||||
|
|
@ -605,6 +619,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||
|
||||
print '<td>';
|
||||
print $invoice->getNomUrl(1,'');
|
||||
if($objp->socid != $facture->thirdparty->id) print ' - '.$soc->getNomUrl(1).' ';
|
||||
print "</td>\n";
|
||||
|
||||
// Date
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2016 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -159,6 +160,8 @@ if ($_GET["action"] == 'create')
|
|||
|
||||
$charge = new ChargeSociales($db);
|
||||
$charge->fetch($chid);
|
||||
$charge->accountid=$charge->fk_account?$charge->fk_account:$charge->accountid;
|
||||
$charge->paiementtype=$charge->mode_reglement_id?$charge->mode_reglement_id:$charge->paiementtype;
|
||||
|
||||
$total = $charge->amount;
|
||||
|
||||
|
|
@ -178,16 +181,16 @@ if ($_GET["action"] == 'create')
|
|||
|
||||
dol_fiche_head('', '');
|
||||
|
||||
print '<table cellspacing="0" class="border" width="100%" cellpadding="2">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print "<tr class=\"liste_titre\"><td colspan=\"3\">".$langs->trans("SocialContribution")."</td>";
|
||||
print "<tr class=\"liste_titre\"><td colspan=\"2\">".$langs->trans("SocialContribution")."</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="2"><a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$chid.'">'.$chid.'</a></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Type")."</td><td colspan=\"2\">".$charge->type_libelle."</td></tr>\n";
|
||||
print '<tr><td>'.$langs->trans("Period")."</td><td colspan=\"2\">".dol_print_date($charge->periode,'day')."</td></tr>\n";
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$charge->lib."</td></tr>\n";
|
||||
print '<tr><td>'.$langs->trans("DateDue")."</td><td colspan=\"2\">".dol_print_date($charge->date_ech,'day')."</td></tr>\n";
|
||||
print '<tr><td>'.$langs->trans("Amount")."</td><td colspan=\"2\">".price($charge->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td><td><a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$chid.'">'.$chid.'</a></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Type")."</td><td>".$charge->type_libelle."</td></tr>\n";
|
||||
print '<tr><td>'.$langs->trans("Period")."</td><td>".dol_print_date($charge->periode,'day')."</td></tr>\n";
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$charge->lib."</td></tr>\n";
|
||||
print '<tr><td>'.$langs->trans("DateDue")."</td><td>".dol_print_date($charge->date_ech,'day')."</td></tr>\n";
|
||||
print '<tr><td>'.$langs->trans("Amount")."</td><td>".price($charge->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||
|
||||
$sql = "SELECT sum(p.amount) as total";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||
|
|
@ -199,28 +202,28 @@ if ($_GET["action"] == 'create')
|
|||
$sumpaid = $obj->total;
|
||||
$db->free();
|
||||
}
|
||||
print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td colspan="2">'.price($sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||
print '<tr><td valign="top">'.$langs->trans("RemainderToPay").'</td><td colspan="2">'.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td>'.price($sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||
print '<tr><td valign="top">'.$langs->trans("RemainderToPay").'</td><td>'.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print "<td colspan=\"3\">".$langs->trans("Payment").'</td>';
|
||||
print "<td colspan=\"2\">".$langs->trans("Payment").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td colspan="2">';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
||||
$datepaye = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||
$datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?(empty($_POST["remonth"])?-1:$datepaye):0;
|
||||
$form->select_date($datepayment,'','','','',"add_payment",1,1);
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td colspan="2">';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
|
||||
$form->select_types_paiements(isset($_POST["paiementtype"])?$_POST["paiementtype"]:$charge->paiementtype, "paiementtype");
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">'.$langs->trans('AccountToDebit').'</td>';
|
||||
print '<td colspan="2">';
|
||||
print '<td>';
|
||||
$form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$charge->accountid, "accountid", 0, '',1); // Show opend bank account list
|
||||
print '</td></tr>';
|
||||
|
||||
|
|
@ -228,11 +231,11 @@ if ($_GET["action"] == 'create')
|
|||
print '<tr><td>'.$langs->trans('Numero');
|
||||
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
||||
print '</td>';
|
||||
print '<td colspan="2"><input name="num_paiement" type="text" value="'.GETPOST('num_paiement').'"></td></tr>'."\n";
|
||||
print '<td><input name="num_paiement" type="text" value="'.GETPOST('num_paiement').'"></td></tr>'."\n";
|
||||
|
||||
print '<tr>';
|
||||
print '<td valign="top">'.$langs->trans("Comments").'</td>';
|
||||
print '<td valign="top" colspan="2"><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_3.'"></textarea></td>';
|
||||
print '<td valign="top"><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_3.'"></textarea></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2016 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -71,6 +72,23 @@ if ($action == 'reopen' && $user->rights->tax->charges->creer) {
|
|||
}
|
||||
}
|
||||
|
||||
// payment mode
|
||||
if ($action == 'setmode' && $user->rights->tax->charges->creer) {
|
||||
$object->fetch($id);
|
||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||
if ($result < 0)
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// bank account
|
||||
if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) {
|
||||
$object->fetch($id);
|
||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Delete social contribution
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes')
|
||||
{
|
||||
|
|
@ -127,6 +145,8 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
|
|||
$object->date_ech=$dateech;
|
||||
$object->periode=$dateperiod;
|
||||
$object->amount=$amount;
|
||||
$object->mode_reglement_id = GETPOST('mode_reglement_id');
|
||||
$object->fk_account = GETPOST('fk_account', 'int');
|
||||
|
||||
$id=$object->create($user);
|
||||
if ($id <= 0)
|
||||
|
|
@ -290,6 +310,17 @@ if ($action == 'create')
|
|||
print '</td>';
|
||||
print '<td><input type="text" size="6" name="amount" class="flat" value="'.GETPOST('amount').'"></td>';
|
||||
print '</tr>';
|
||||
// Payment Mode
|
||||
print '<tr><td>' . $langs->trans('PaymentMode') . '</td><td colspan="2">';
|
||||
$form->select_types_paiements($mode_reglement_id, 'mode_reglement_id');
|
||||
print '</td></tr>';
|
||||
// Bank Account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td colspan="2">';
|
||||
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
// Date due
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">';
|
||||
|
|
@ -313,7 +344,7 @@ if ($action == 'create')
|
|||
|
||||
/* *************************************************************************** */
|
||||
/* */
|
||||
/* Mode fiche */
|
||||
/* Card Mode */
|
||||
/* */
|
||||
/* *************************************************************************** */
|
||||
if ($id > 0)
|
||||
|
|
@ -382,7 +413,8 @@ if ($id > 0)
|
|||
// Type
|
||||
print "<tr><td>".$langs->trans("Type")."</td><td>".$object->type_libelle."</td>";
|
||||
|
||||
$rowspan=5;
|
||||
$rowspan=6;
|
||||
if (! empty($conf->banque->enabled)) $rowspan++;
|
||||
print '<td rowspan="'.$rowspan.'" valign="top">';
|
||||
|
||||
/*
|
||||
|
|
@ -422,8 +454,8 @@ if ($id > 0)
|
|||
print "<tr ".$bc[$var]."><td>";
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.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";
|
||||
$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";
|
||||
$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> ".$langs->trans("Currency".$conf->currency)."</td>\n";
|
||||
print "</tr>";
|
||||
$totalpaye += $objp->amount;
|
||||
|
|
@ -432,12 +464,12 @@ if ($id > 0)
|
|||
|
||||
if ($object->paye == 0)
|
||||
{
|
||||
print "<tr><td colspan=\"2\" align=\"right\">".$langs->trans("AlreadyPaid")." :</td><td align=\"right\"><b>".price($totalpaye)."</b></td><td> ".$langs->trans("Currency".$conf->currency)."</td></tr>\n";
|
||||
print "<tr><td colspan=\"2\" align=\"right\">".$langs->trans("AmountExpected")." :</td><td align=\"right\" bgcolor=\"#d0d0d0\">".price($object->amount)."</td><td bgcolor=\"#d0d0d0\"> ".$langs->trans("Currency".$conf->currency)."</td></tr>\n";
|
||||
print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AlreadyPaid")." :</td><td align=\"right\"><b>".price($totalpaye)."</b></td><td> ".$langs->trans("Currency".$conf->currency)."</td></tr>\n";
|
||||
print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AmountExpected")." :</td><td align=\"right\" bgcolor=\"#d0d0d0\">".price($object->amount)."</td><td bgcolor=\"#d0d0d0\"> ".$langs->trans("Currency".$conf->currency)."</td></tr>\n";
|
||||
|
||||
$resteapayer = $object->amount - $totalpaye;
|
||||
|
||||
print "<tr><td colspan=\"2\" align=\"right\">".$langs->trans("RemainderToPay")." :</td>";
|
||||
print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("RemainderToPay")." :</td>";
|
||||
print "<td align=\"right\" bgcolor=\"#f0f0f0\"><b>".price($resteapayer)."</b></td><td bgcolor=\"#f0f0f0\"> ".$langs->trans("Currency".$conf->currency)."</td></tr>\n";
|
||||
}
|
||||
print "</table>";
|
||||
|
|
@ -486,6 +518,42 @@ if ($id > 0)
|
|||
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||
}
|
||||
|
||||
// Mode of payment
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentMode');
|
||||
print '</td>';
|
||||
if ($action != 'editmode')
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&id=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editmode') {
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id');
|
||||
} else {
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Bank Account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('BankAccount');
|
||||
print '<td>';
|
||||
if ($action != 'editbankaccount' && $user->rights->tax->charges->creer)
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editbankaccount') {
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
|
||||
} else {
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4, $totalpaye).'</td></tr>';
|
||||
|
||||
|
|
@ -500,7 +568,7 @@ if ($id > 0)
|
|||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
if ($action == 'edit') print "</form>\n";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2016 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -49,6 +50,7 @@ class ChargeSociales extends CommonObject
|
|||
var $date_creation;
|
||||
var $date_modification;
|
||||
var $date_validation;
|
||||
var $fk_account;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -71,13 +73,16 @@ class ChargeSociales extends CommonObject
|
|||
*/
|
||||
function fetch($id, $ref='')
|
||||
{
|
||||
$sql = "SELECT cs.rowid, cs.date_ech,";
|
||||
$sql.= " cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, cs.periode, cs.import_key,";
|
||||
$sql.= " c.libelle";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs, ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql.= " WHERE cs.fk_type = c.id";
|
||||
if ($ref) $sql.= " AND cs.rowid = ".$ref;
|
||||
else $sql.= " AND cs.rowid = ".$id;
|
||||
$sql = "SELECT cs.rowid, cs.date_ech";
|
||||
$sql.= ", cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, cs.periode, cs.import_key";
|
||||
$sql.= ", cs.fk_account, cs.fk_mode_reglement";
|
||||
$sql.= ", c.libelle";
|
||||
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id";
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id';
|
||||
if ($ref) $sql.= " WHERE cs.rowid = ".$ref;
|
||||
else $sql.= " WHERE cs.rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
|
|
@ -93,6 +98,10 @@ class ChargeSociales extends CommonObject
|
|||
$this->lib = $obj->lib;
|
||||
$this->type = $obj->fk_type;
|
||||
$this->type_libelle = $obj->libelle;
|
||||
$this->fk_account = $obj->fk_account;
|
||||
$this->mode_reglement_id = $obj->fk_mode_reglement;
|
||||
$this->mode_reglement_code = $obj->mode_reglement_code;
|
||||
$this->mode_reglement = $obj->mode_reglement_libelle;
|
||||
$this->amount = $obj->amount;
|
||||
$this->paye = $obj->paye;
|
||||
$this->periode = $this->db->jdate($obj->periode);
|
||||
|
|
@ -155,8 +164,11 @@ class ChargeSociales extends CommonObject
|
|||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, libelle, date_ech, periode, amount, entity)";
|
||||
$sql.= " VALUES (".$this->type.",'".$this->db->escape($this->lib)."',";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, entity)";
|
||||
$sql.= " VALUES (".$this->type;
|
||||
$sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL');
|
||||
$sql.= ", ".($this->mode_reglement_id>0?"'".$this->mode_reglement_id."'":"NULL");
|
||||
$sql.= ", '".$this->db->escape($this->lib)."',";
|
||||
$sql.= " '".$this->db->idate($this->date_ech)."','".$this->db->idate($this->periode)."',";
|
||||
$sql.= " '".price2num($newamount)."',";
|
||||
$sql.= " ".$conf->entity;
|
||||
|
|
@ -216,7 +228,7 @@ class ChargeSociales extends CommonObject
|
|||
// Delete payments
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge where fk_charge='".$this->id."'";
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge WHERE fk_charge='".$this->id."'";
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
|
|
@ -228,7 +240,7 @@ class ChargeSociales extends CommonObject
|
|||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales where rowid='".$this->id."'";
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales WHERE rowid='".$this->id."'";
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2016 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -255,7 +256,7 @@ if ($resql)
|
|||
// Due date
|
||||
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
|
||||
|
||||
print '<td align="right" class="nowrap">'.$chargesociale_static->LibStatut($obj->paye,5,$obj->alreadypayed).'</a></td>';
|
||||
print '<td align="right" class="nowrap">'.$chargesociale_static->LibStatut($obj->paye,5,$obj->alreadypayed).'</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
|
|
|
|||
|
|
@ -904,7 +904,7 @@ else
|
|||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td>';
|
||||
print '<td>';
|
||||
print '<td colspan="3">';
|
||||
print $object->getLibStatut(4);
|
||||
print '</td></tr>';
|
||||
|
||||
|
|
|
|||
|
|
@ -957,39 +957,53 @@ class Contact extends CommonObject
|
|||
*/
|
||||
function getNomUrl($withpicto=0,$option='',$maxlen=0,$moreparam='')
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $conf, $langs, $hookmanager;
|
||||
|
||||
$result='';
|
||||
$label = '<u>' . $langs->trans("ShowContact") . '</u>';
|
||||
$label.= '<br><b>' . $langs->trans("Name") . ':</b> '.$this->getFullName($langs);
|
||||
//if ($this->civility_id) $label.= '<br><b>' . $langs->trans("Civility") . ':</b> '.$this->civility_id; // TODO Translate cibilty_id code
|
||||
if (! empty($this->poste)) $label.= '<br><b>' . $langs->trans("Poste") . ':</b> '.$this->poste;
|
||||
$label.= '<br><b>' . $langs->trans("EMail") . ':</b> '.$this->email;
|
||||
$phonelist=array();
|
||||
if ($this->phone_pro) $phonelist[]=$this->phone_pro;
|
||||
if ($this->phone_mobile) $phonelist[]=$this->phone_mobile;
|
||||
if ($this->phone_perso) $phonelist[]=$this->phone_perso;
|
||||
$label.= '<br><b>' . $langs->trans("Phone") . ':</b> '.join(', ',$phonelist);
|
||||
$label.= '<br><b>' . $langs->trans("Address") . ':</b> '.dol_format_address($this, 1, ' ', $langs);
|
||||
$label = '<u>' . $langs->trans("ShowContact") . '</u>';
|
||||
$label.= '<br><b>' . $langs->trans("Name") . ':</b> '.$this->getFullName($langs);
|
||||
//if ($this->civility_id) $label.= '<br><b>' . $langs->trans("Civility") . ':</b> '.$this->civility_id; // TODO Translate cibilty_id code
|
||||
if (! empty($this->poste)) $label.= '<br><b>' . $langs->trans("Poste") . ':</b> '.$this->poste;
|
||||
$label.= '<br><b>' . $langs->trans("EMail") . ':</b> '.$this->email;
|
||||
$phonelist=array();
|
||||
if ($this->phone_pro) $phonelist[]=$this->phone_pro;
|
||||
if ($this->phone_mobile) $phonelist[]=$this->phone_mobile;
|
||||
if ($this->phone_perso) $phonelist[]=$this->phone_perso;
|
||||
$label.= '<br><b>' . $langs->trans("Phone") . ':</b> '.join(', ',$phonelist);
|
||||
$label.= '<br><b>' . $langs->trans("Address") . ':</b> '.dol_format_address($this, 1, ' ', $langs);
|
||||
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'"';
|
||||
$linkclose="";
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$label=$langs->trans("ShowContact");
|
||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose.= ' class="classfortooltip">';
|
||||
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'"';
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$label=$langs->trans("ShowContact");
|
||||
$link.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$link.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$link.= ' class="classfortooltip">';
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('contactdao'));
|
||||
$parameters=array('id'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook > 0) $linkclose = $hookmanager->resPrint;
|
||||
|
||||
$link.=$linkclose;
|
||||
|
||||
$linkend='</a>';
|
||||
|
||||
|
||||
if ($option == 'xxx')
|
||||
{
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
}
|
||||
|
||||
if ($withpicto) $result.=($link.img_object($label, 'contact', 'class="classfortooltip"').$linkend.' ');
|
||||
$result.=$link.($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs)).$linkend;
|
||||
|
||||
if ($withpicto) $result.=($link.img_object($label, 'contact', 'class="classfortooltip"').$linkend.' ');
|
||||
$result.=$link.($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs)).$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,8 @@ $search_email=GETPOST("search_email");
|
|||
$search_skype=GETPOST("search_skype");
|
||||
$search_priv=GETPOST("search_priv");
|
||||
$search_categ=GETPOST("search_categ",'int');
|
||||
$search_categ_thirdparty=GETPOST("search_categ_thirdparty",'int');
|
||||
$search_categ_supplier=GETPOST("search_categ_supplier",'int');
|
||||
$search_status=GETPOST("search_status",'int');
|
||||
$search_type=GETPOST('search_type','alpha');
|
||||
if ($search_status=='') $search_status=1; // always display activ customer first
|
||||
|
|
@ -191,6 +193,10 @@ if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter.x') || GETP
|
|||
$search_skype="";
|
||||
$search_priv="";
|
||||
$search_status=-1;
|
||||
$search_categ='';
|
||||
$search_categ_thirdparty='';
|
||||
$search_categ_supplier='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
if ($search_priv < 0) $search_priv='';
|
||||
|
||||
|
|
@ -220,7 +226,9 @@ $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as p";
|
|||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (p.rowid = ef.fk_object)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = p.fk_pays";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
|
||||
if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_contact as cs ON p.rowid = cs.fk_socpeople"; // We need this table joined to the select in order to filter by categ
|
||||
if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_contact as cc ON p.rowid = cc.fk_socpeople"; // We need this table joined to the select in order to filter by categ
|
||||
if (! empty($search_categ_thirdparty)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
|
||||
if (! empty($search_categ_supplier)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs2 ON s.rowid = cs2.fk_soc"; // We need this table joined to the select in order to filter by categ
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||
$sql.= ' WHERE p.entity IN ('.getEntity('societe', 1).')';
|
||||
if (!$user->rights->societe->client->voir && !$socid) //restriction
|
||||
|
|
@ -243,8 +251,12 @@ else
|
|||
if ($search_priv == '1') $sql .= " AND (p.priv='1' AND p.fk_user_creat=".$user->id.")";
|
||||
}
|
||||
|
||||
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ);
|
||||
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
||||
if ($search_categ > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ);
|
||||
if ($search_categ == -2) $sql.= " AND cc.fk_categorie IS NULL";
|
||||
if ($search_categ_thirdparty > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ_thirdparty);
|
||||
if ($search_categ_thirdparty == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
||||
if ($search_categ_supplier > 0) $sql.= " AND cs2.fk_categorie = ".$db->escape($search_categ_supplier);
|
||||
if ($search_categ_supplier == -2) $sql.= " AND cs2.fk_categorie IS NULL";
|
||||
|
||||
if ($search_firstlast_only) {
|
||||
$sql .= natural_search(array('p.lastname','p.firstname'), $search_firstlast_only);
|
||||
|
|
@ -333,7 +345,7 @@ $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // No
|
|||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
// Add order
|
||||
if($view == "recent")
|
||||
if ($view == "recent")
|
||||
{
|
||||
$sql.= $db->order("p.datec","DESC");
|
||||
}
|
||||
|
|
@ -350,15 +362,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
// Add limit
|
||||
if($view == "recent")
|
||||
{
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
}
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
//print $sql;
|
||||
dol_syslog("contact/list.php", LOG_DEBUG);
|
||||
|
|
@ -374,6 +378,8 @@ if ($result)
|
|||
$param.='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall);
|
||||
$param.='&type='.urlencode($type).'&view='.urlencode($view);
|
||||
if (!empty($search_categ)) $param.='&search_categ='.urlencode($search_categ);
|
||||
if (!empty($search_categ_thirdparty)) $param.='&search_categ_thirdparty='.urlencode($search_categ_thirdparty);
|
||||
if (!empty($search_categ_supplier)) $param.='&search_categ_supplier='.urlencode($search_categ_supplier);
|
||||
if ($search_lastname != '') $param.='&search_lastname='.urlencode($search_lastname);
|
||||
if ($search_firstname != '') $param.='&search_firstname='.urlencode($search_firstname);
|
||||
if ($search_societe != '') $param.='&search_societe='.urlencode($search_societe);
|
||||
|
|
@ -423,6 +429,22 @@ if ($result)
|
|||
$moreforfilter.=$langs->trans('Categories'). ': ';
|
||||
$moreforfilter.=$formother->select_categories(Categorie::TYPE_CONTACT,$search_categ,'search_categ',1);
|
||||
$moreforfilter.='</div>';
|
||||
if (empty($type) || $type == 'c' || $type == 'p')
|
||||
{
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
if ($type == 'c') $moreforfilter.=$langs->trans('CustomersCategoriesShort'). ': ';
|
||||
else if ($type == 'p') $moreforfilter.=$langs->trans('ProspectsCategoriesShort'). ': ';
|
||||
else $moreforfilter.=$langs->trans('CustomersProspectsCategoriesShort'). ': ';
|
||||
$moreforfilter.=$formother->select_categories(Categorie::TYPE_CUSTOMER,$search_categ_thirdparty,'search_categ_thirdparty',1);
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
if (empty($type) || $type == 'f')
|
||||
{
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('SuppliersCategoriesShort'). ': ';
|
||||
$moreforfilter.=$formother->select_categories(Categorie::TYPE_SUPPLIER,$search_categ_supplier,'search_categ_supplier',1);
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
}
|
||||
if ($moreforfilter)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1513,7 +1513,7 @@ else
|
|||
// Remise
|
||||
if ($objp->remise_percent > 0)
|
||||
{
|
||||
print '<td align="right" '.$bc[$var].'>'.$objp->remise_percent."%</td>\n";
|
||||
print '<td align="right">'.$objp->remise_percent."%</td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2422,7 +2422,7 @@ class ContratLigne extends CommonObjectLine
|
|||
$sql.= " p.ref as product_ref,";
|
||||
$sql.= " p.label as product_label,";
|
||||
$sql.= " p.description as product_desc,";
|
||||
$sql.= " p.type as product_type,";
|
||||
$sql.= " p.fk_product_type as product_type,";
|
||||
$sql.= " t.description,";
|
||||
$sql.= " t.date_commande,";
|
||||
$sql.= " t.date_ouverture_prevue as date_ouverture_prevue,";
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
|
|||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[$var].'><td colspan="3">'.$langs->trans("NoContracts").'</td></tr>';
|
||||
print '<tr '.$bc[$var].' class><td colspan="3" class="opacitymedium">'.$langs->trans("NoContracts").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
$db->free($resql);
|
||||
|
|
|
|||
|
|
@ -67,20 +67,18 @@ $result = restrictedArea($user, 'contrat', $id);
|
|||
$staticcontrat=new Contrat($db);
|
||||
$staticcontratligne=new ContratLigne($db);
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_name="";
|
||||
$search_contract="";
|
||||
$search_ref_supplier="";
|
||||
$search_user='';
|
||||
$search_sale='';
|
||||
$search_product_category='';
|
||||
$sall="";
|
||||
$search_status="";
|
||||
}
|
||||
|
||||
if ($search_status == '') $search_status=1;
|
||||
|
||||
$contextpage='contractlist';
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array($contextpage));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('contract');
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'c.ref'=>'Ref',
|
||||
|
|
@ -93,6 +91,35 @@ $fieldstosearchall = array(
|
|||
if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate";
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_name="";
|
||||
$search_contract="";
|
||||
$search_ref_supplier="";
|
||||
$search_user='';
|
||||
$search_sale='';
|
||||
$search_product_category='';
|
||||
$sall="";
|
||||
$search_status="";
|
||||
$search_array_options=array();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -52,15 +52,26 @@ $search_status=GETPOST("search_status","alpha");
|
|||
$statut=GETPOST('statut')?GETPOST('statut'):1;
|
||||
$socid=GETPOST('socid','int');
|
||||
|
||||
$opouvertureprevuemonth=GETPOST('opouvertureprevuemonth');
|
||||
$opouvertureprevueday=GETPOST('opouvertureprevueday');
|
||||
$opouvertureprevueyear=GETPOST('opouvertureprevueyear');
|
||||
$filter_opouvertureprevue=GETPOST('filter_opouvertureprevue');
|
||||
|
||||
$op1month=GETPOST('op1month');
|
||||
$op1day=GETPOST('op1day');
|
||||
$op1year=GETPOST('op1year');
|
||||
$filter_op1=GETPOST('filter_op1');
|
||||
|
||||
$op2month=GETPOST('op2month');
|
||||
$op2day=GETPOST('op2day');
|
||||
$op2year=GETPOST('op2year');
|
||||
$filter_op2=GETPOST('filter_op2');
|
||||
|
||||
$opcloturemonth=GETPOST('opcloturemonth');
|
||||
$opclotureday=GETPOST('opclotureday');
|
||||
$opclotureyear=GETPOST('opclotureyear');
|
||||
$filter_opcloture=GETPOST('filter_opcloture');
|
||||
|
||||
// Security check
|
||||
$contratid = GETPOST('id','int');
|
||||
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
||||
|
|
@ -88,12 +99,20 @@ $staticcontrat=new Contrat($db);
|
|||
$staticcontratligne=new ContratLigne($db);
|
||||
$companystatic=new Societe($db);
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_name="";
|
||||
$search_contract="";
|
||||
$search_service="";
|
||||
$search_status=-1;
|
||||
$opouvertureprevuemonth="";
|
||||
$opouvertureprevueday="";
|
||||
$opouvertureprevueyear="";
|
||||
$filter_opouvertureprevue="";
|
||||
$op1month="";
|
||||
$op1day="";
|
||||
$op1year="";
|
||||
|
|
@ -102,6 +121,10 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
|||
$op2day="";
|
||||
$op2year="";
|
||||
$filter_op2="";
|
||||
$opcloturemonth="";
|
||||
$opclotureday="";
|
||||
$opclotureyear="";
|
||||
$filter_opcloture="";
|
||||
$mode='';
|
||||
$filter='';
|
||||
}
|
||||
|
|
@ -143,10 +166,14 @@ if ($search_name) $sql.= " AND s.nom LIKE '%".$db->escape($search_name)."%'"
|
|||
if ($search_contract) $sql.= " AND c.rowid = '".$db->escape($search_contract)."'";
|
||||
if ($search_service) $sql.= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')";
|
||||
if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
|
||||
$filter_dateouvertureprevue=dol_mktime(0,0,0,$opouvertureprevuemonth,$opouvertureprevueday,$opouvertureprevueyear);
|
||||
$filter_date1=dol_mktime(0,0,0,$op1month,$op1day,$op1year);
|
||||
$filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year);
|
||||
if (! empty($filter_op1) && $filter_op1 != -1 && $filter_date1 != '') $sql.= " AND date_ouverture_prevue ".$filter_op1." '".$db->idate($filter_date1)."'";
|
||||
if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " AND date_fin_validite ".$filter_op2." '".$db->idate($filter_date2)."'";
|
||||
$filter_datecloture=dol_mktime(0,0,0,$opcloturemonth,$opclotureday,$opclotureyear);
|
||||
if (! empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1 && $filter_dateouvertureprevue != '') $sql.= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue)."'";
|
||||
if (! empty($filter_op1) && $filter_op1 != -1 && $filter_date1 != '') $sql.= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1)."'";
|
||||
if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2)."'";
|
||||
if (! empty($filter_opcloture) && $filter_opcloture != -1 && $filter_datecloture != '') $sql.= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture)."'";
|
||||
$totalnboflines=0;
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
|
|
@ -170,11 +197,15 @@ if ($resql)
|
|||
if ($search_service) $param.='&search_service='.urlencode($search_service);
|
||||
if ($mode) $param.='&mode='.$mode;
|
||||
if ($filter) $param.='&filter='.$filter;
|
||||
if (! empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1) $param.='&filter_opouvertureprevue='.urlencode($filter_opouvertureprevue);
|
||||
if (! empty($filter_op1) && $filter_op1 != -1) $param.='&filter_op1='.urlencode($filter_op1);
|
||||
if (! empty($filter_op2) && $filter_op2 != -1) $param.='&filter_op2='.urlencode($filter_op2);
|
||||
if (! empty($filter_opcloture) && $filter_opcloture != -1) $param.='&filter_opcloture='.urlencode($filter_opcloture);
|
||||
if ($filter_dateouvertureprevue != '') $param.='&opouvertureprevueday='.$opouvertureprevueday.'&opouvertureprevuemonth='.$opouvertureprevuemonth.'&opouvertureprevueyear='.$opouvertureprevueyear;
|
||||
if ($filter_date1 != '') $param.='&op1day='.$op1day.'&op1month='.$op1month.'&op1year='.$op1year;
|
||||
if ($filter_date2 != '') $param.='&op2day='.$op2day.'&op2month='.$op2month.'&op2year='.$op2year;
|
||||
|
||||
if ($filter_datecloture != '') $param.='&opclotureday='.$op2day.'&opcloturemonth='.$op2month.'&opclotureyear='.$op2year;
|
||||
|
||||
$title=$langs->trans("ListOfServices");
|
||||
if ($mode == "0") $title=$langs->trans("ListOfInactiveServices"); // Must use == "0"
|
||||
if ($mode == "4" && $filter != "expired") $title=$langs->trans("ListOfRunningServices");
|
||||
|
|
@ -191,11 +222,11 @@ if ($resql)
|
|||
print_liste_field_titre($langs->trans("Service"),$_SERVER["PHP_SELF"], "p.description",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"], "s.nom",$param,"","",$sortfield,$sortorder);
|
||||
// Date debut
|
||||
if ($mode == "0") print_liste_field_titre($langs->trans("DateStartPlannedShort"),$_SERVER["PHP_SELF"], "cd.date_ouverture_prevue",$param,'',' align="center"',$sortfield,$sortorder);
|
||||
if ($mode == "" || $mode > 0) print_liste_field_titre($langs->trans("DateStartRealShort"),$_SERVER["PHP_SELF"], "cd.date_ouverture",$param,'',' align="center"',$sortfield,$sortorder);
|
||||
if (($mode == "" || $mode == -1) || $mode == "0") print_liste_field_titre($langs->trans("DateStartPlannedShort"),$_SERVER["PHP_SELF"], "cd.date_ouverture_prevue",$param,'',' align="center"',$sortfield,$sortorder);
|
||||
if (($mode == "" || $mode == -1) || $mode > 0) print_liste_field_titre($langs->trans("DateStartRealShort"),$_SERVER["PHP_SELF"], "cd.date_ouverture",$param,'',' align="center"',$sortfield,$sortorder);
|
||||
// Date fin
|
||||
if ($mode == "" || $mode < 5) print_liste_field_titre($langs->trans("DateEndPlannedShort"),$_SERVER["PHP_SELF"], "cd.date_fin_validite",$param,'',' align="center"',$sortfield,$sortorder);
|
||||
else print_liste_field_titre($langs->trans("DateEndRealShort"),$_SERVER["PHP_SELF"], "cd.date_cloture",$param,'',' align="center"',$sortfield,$sortorder);
|
||||
if (($mode == "" || $mode == -1) || $mode < 5) print_liste_field_titre($langs->trans("DateEndPlannedShort"),$_SERVER["PHP_SELF"], "cd.date_fin_validite",$param,'',' align="center"',$sortfield,$sortorder);
|
||||
if (($mode == "" || $mode == -1) || $mode >= 5) print_liste_field_titre($langs->trans("DateEndRealShort"),$_SERVER["PHP_SELF"], "cd.date_cloture",$param,'',' align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"], "cd.statut,c.statut",$param,"","align=\"right\"",$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
|
@ -214,20 +245,46 @@ if ($resql)
|
|||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="12" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$arrayofoperators=array('<'=>'<','>'=>'>');
|
||||
print $form->selectarray('filter_op1',$arrayofoperators,$filter_op1,1);
|
||||
print ' ';
|
||||
$filter_date1=dol_mktime(0,0,0,$op1month,$op1day,$op1year);
|
||||
print $form->select_date($filter_date1,'op1',0,0,1,'',1,0,1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$arrayofoperators=array('<'=>'<','>'=>'>');
|
||||
print $form->selectarray('filter_op2',$arrayofoperators,$filter_op2,1);
|
||||
print ' ';
|
||||
$filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year);
|
||||
print $form->select_date($filter_date2,'op2',0,0,1,'',1,0,1);
|
||||
print '</td>';
|
||||
if (($mode == "" || $mode == -1) || $mode == "0")
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$arrayofoperators=array('<'=>'<','>'=>'>');
|
||||
print $form->selectarray('filter_opouvertureprevue',$arrayofoperators,$filter_opouvertureprevue,1);
|
||||
print ' ';
|
||||
$filter_dateouvertureprevue=dol_mktime(0,0,0,$opouvertureprevuemonth,$opouvertureprevueday,$opouvertureprevueyear);
|
||||
print $form->select_date($filter_dateouvertureprevue,'opouvertureprevue',0,0,1,'',1,0,1);
|
||||
print '</td>';
|
||||
}
|
||||
if (($mode == "" || $mode == -1) || $mode > 0)
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$arrayofoperators=array('<'=>'<','>'=>'>');
|
||||
print $form->selectarray('filter_op1',$arrayofoperators,$filter_op1,1);
|
||||
print ' ';
|
||||
$filter_date1=dol_mktime(0,0,0,$op1month,$op1day,$op1year);
|
||||
print $form->select_date($filter_date1,'op1',0,0,1,'',1,0,1);
|
||||
print '</td>';
|
||||
}
|
||||
if (($mode == "" || $mode == -1) || $mode < 5)
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$arrayofoperators=array('<'=>'<','>'=>'>');
|
||||
print $form->selectarray('filter_op2',$arrayofoperators,$filter_op2,1);
|
||||
print ' ';
|
||||
$filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year);
|
||||
print $form->select_date($filter_date2,'op2',0,0,1,'',1,0,1);
|
||||
print '</td>';
|
||||
}
|
||||
if (($mode == "" || $mode == -1) || $mode >= 5)
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$arrayofoperators=array('<'=>'<','>'=>'>');
|
||||
print $form->selectarray('filter_opcloture',$arrayofoperators,$filter_opcloture,1);
|
||||
print ' ';
|
||||
$filter_date_cloture=dol_mktime(0,0,0,$opcloturemonth,$opclotureday,$opclotureyear);
|
||||
print $form->select_date($filter_date_cloture,'opcloture',0,0,1,'',1,0,1);
|
||||
print '</td>';
|
||||
}
|
||||
print '<td align="right">';
|
||||
$arrayofstatus=array(
|
||||
'0'=>$langs->trans("ServiceStatusInitial"),
|
||||
|
|
@ -287,7 +344,8 @@ if ($resql)
|
|||
print '</td>';
|
||||
|
||||
// Start date
|
||||
if ($mode == "0") {
|
||||
if (($mode == "" || $mode == -1) || $mode == "0")
|
||||
{
|
||||
print '<td align="center">';
|
||||
print ($obj->date_ouverture_prevue?dol_print_date($db->jdate($obj->date_ouverture_prevue)):' ');
|
||||
if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay)))
|
||||
|
|
@ -295,13 +353,19 @@ if ($resql)
|
|||
else print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
if ($mode == "" || $mode > 0) print '<td align="center">'.($obj->date_ouverture?dol_print_date($db->jdate($obj->date_ouverture)):' ').'</td>';
|
||||
if (($mode == "" || $mode == -1) || $mode > 0)
|
||||
{
|
||||
print '<td align="center">'.($obj->date_ouverture?dol_print_date($db->jdate($obj->date_ouverture)):' ').'</td>';
|
||||
}
|
||||
// Date fin
|
||||
if ($mode == "" || $mode < 5) print '<td align="center">'.($obj->date_fin_validite?dol_print_date($db->jdate($obj->date_fin_validite)):' ');
|
||||
else print '<td align="center">'.dol_print_date($db->jdate($obj->date_cloture));
|
||||
if (($mode == "" || $mode == -1) || $mode < 5)
|
||||
{
|
||||
print '<td align="center">'.($obj->date_fin_validite?dol_print_date($db->jdate($obj->date_fin_validite)):' ');
|
||||
if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) print img_warning($langs->trans("Late"));
|
||||
else print ' ';
|
||||
}
|
||||
if (($mode == "" || $mode == -1) || $mode >= 5) print '<td align="center">'.dol_print_date($db->jdate($obj->date_cloture));
|
||||
// Icone warning
|
||||
if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) print img_warning($langs->trans("Late"));
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
print '<td align="right" class="nowrap">';
|
||||
if ($obj->cstatut == 0) // If contract is draft, we say line is also draft
|
||||
|
|
|
|||
499
htdocs/core/actions_massactions.inc.php
Normal file
499
htdocs/core/actions_massactions.inc.php
Normal file
|
|
@ -0,0 +1,499 @@
|
|||
<?php
|
||||
/* Copyright (C) 2015 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 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/actions_massactions.inc.php
|
||||
* \brief Code for actions done with massaction button (send by email, merge pdf, delete, ...)
|
||||
*/
|
||||
|
||||
|
||||
// $massaction must be defined
|
||||
// $objectclass must be defined
|
||||
// $uploaddir (example $conf->projet->dir_output . "/";)
|
||||
// $toselect may be defined
|
||||
|
||||
|
||||
// Protection
|
||||
if (empty($objectclass) || empty($uploaddir))
|
||||
{
|
||||
dol_print_error(null, 'include of actions_massactions.inc.php is done but var $massaction or $objectclass or $uploaddir was not defined');
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// Mass actions. Controls on number of lines checked
|
||||
$maxformassaction=1000;
|
||||
if (! empty($massaction) && count($toselect) < 1)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("NoLineChecked"), null, "warnings");
|
||||
}
|
||||
if (! $error && count($toselect) > $maxformassaction)
|
||||
{
|
||||
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
if (! $error && $massaction == 'confirm_presend')
|
||||
{
|
||||
$resaction = '';
|
||||
$nbsent = 0;
|
||||
$nbignored = 0;
|
||||
$langs->load("mails");
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
if (!$error && !isset($user->email))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$thirdparty=new Societe($db);
|
||||
$objecttmp=new $objectclass($db);
|
||||
$listofobjectid=array();
|
||||
$listofobjectthirdparties=array();
|
||||
$listofobjectref=array();
|
||||
foreach($toselect as $toselectid)
|
||||
{
|
||||
$objecttmp=new $objectclass($db); // must create new instance because instance is saved into $listofobjectref array for future use
|
||||
$result=$objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$listoinvoicesid[$toselectid]=$toselectid;
|
||||
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
|
||||
$listofobjectthirdparties[$thirdpartyid]=$thirdpartyid;
|
||||
$listofobjectref[$thirdpartyid][$toselectid]=$objecttmp;
|
||||
}
|
||||
}
|
||||
//var_dump($listofobjectthirdparties);exit;
|
||||
|
||||
foreach ($listofobjectthirdparties as $thirdpartyid)
|
||||
{
|
||||
$result = $thirdparty->fetch($thirdpartyid);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Define recipient $sendto and $sendtocc
|
||||
if (trim($_POST['sendto']))
|
||||
{
|
||||
// Recipient is provided into free text
|
||||
$sendto = trim($_POST['sendto']);
|
||||
$sendtoid = 0;
|
||||
}
|
||||
elseif ($_POST['receiver'] != '-1')
|
||||
{
|
||||
// Recipient was provided from combo list
|
||||
if ($_POST['receiver'] == 'thirdparty') // Id of third party
|
||||
{
|
||||
$sendto = $thirdparty->email;
|
||||
$sendtoid = 0;
|
||||
}
|
||||
else // Id du contact
|
||||
{
|
||||
$sendto = $thirdparty->contact_get_property((int) $_POST['receiver'],'email');
|
||||
$sendtoid = $_POST['receiver'];
|
||||
}
|
||||
}
|
||||
if (trim($_POST['sendtocc']))
|
||||
{
|
||||
$sendtocc = trim($_POST['sendtocc']);
|
||||
}
|
||||
elseif ($_POST['receivercc'] != '-1')
|
||||
{
|
||||
// Recipient was provided from combo list
|
||||
if ($_POST['receivercc'] == 'thirdparty') // Id of third party
|
||||
{
|
||||
$sendtocc = $thirdparty->email;
|
||||
}
|
||||
else // Id du contact
|
||||
{
|
||||
$sendtocc = $thirdparty->contact_get_property((int) $_POST['receivercc'],'email');
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($listofobjectref[$thirdpartyid]); // Array of invoice for this thirdparty
|
||||
|
||||
$attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array());
|
||||
$listofqualifiedinvoice=array();
|
||||
$listofqualifiedref=array();
|
||||
foreach($listofobjectref[$thirdpartyid] as $objectid => $object)
|
||||
{
|
||||
//var_dump($object);
|
||||
//var_dump($thirdpartyid.' - '.$objectid.' - '.$object->statut);
|
||||
|
||||
if ($objectclass == 'Facture' && $object->statut != Facture::STATUS_VALIDATED)
|
||||
{
|
||||
$nbignored++;
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction',$object->ref).'</div><br>';
|
||||
continue; // Payment done or started or canceled
|
||||
}
|
||||
if ($objectclass == 'Commande' && $object->statut == Commande::STATUS_DRAFT)
|
||||
{
|
||||
$nbignored++;
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyOrderNotDraftCanBeSentInMassAction',$object->ref).'</div><br>';
|
||||
continue;
|
||||
}
|
||||
|
||||
// Read document
|
||||
// TODO Use future field $object->fullpathdoc to know where is stored default file
|
||||
// TODO If not defined, use $object->modelpdf (or defaut invoice config) to know what is template to use to regenerate doc.
|
||||
$filename=dol_sanitizeFileName($object->ref).'.pdf';
|
||||
$filedir=$uploaddir . '/' . dol_sanitizeFileName($object->ref);
|
||||
$file = $filedir . '/' . $filename;
|
||||
$mime = dol_mimetype($file);
|
||||
|
||||
if (dol_is_file($file))
|
||||
{
|
||||
if (empty($sendto)) // For the case, no recipient were set (multi thirdparties send)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
$sendto = $object->thirdparty->email;
|
||||
}
|
||||
|
||||
if (empty($sendto))
|
||||
{
|
||||
//print "No recipient for thirdparty ".$object->thirdparty->name;
|
||||
$nbignored++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dol_strlen($sendto))
|
||||
{
|
||||
// Create form object
|
||||
$attachedfiles=array(
|
||||
'paths'=>array_merge($attachedfiles['paths'],array($file)),
|
||||
'names'=>array_merge($attachedfiles['names'],array($filename)),
|
||||
'mimes'=>array_merge($attachedfiles['mimes'],array($mime))
|
||||
);
|
||||
}
|
||||
|
||||
$listofqualifiedinvoice[$objectid]=$object;
|
||||
$listofqualifiedref[$objectid]=$object->ref;
|
||||
}
|
||||
else
|
||||
{
|
||||
$nbignored++;
|
||||
$langs->load("errors");
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div><br>';
|
||||
dol_syslog('Failed to read file: '.$file, LOG_WARNING);
|
||||
continue;
|
||||
}
|
||||
|
||||
//var_dump($listofqualifiedref);
|
||||
}
|
||||
|
||||
if (count($listofqualifiedinvoice) > 0)
|
||||
{
|
||||
$langs->load("commercial");
|
||||
$from = $user->getFullName($langs) . ' <' . $user->email .'>';
|
||||
$replyto = $from;
|
||||
$subject = GETPOST('subject');
|
||||
$message = GETPOST('message');
|
||||
$sendtocc = GETPOST('sentocc');
|
||||
$sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO);
|
||||
|
||||
$substitutionarray=array(
|
||||
'__ID__' => join(', ',array_keys($listofqualifiedinvoice)),
|
||||
'__EMAIL__' => $thirdparty->email,
|
||||
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
||||
'__FACREF__' => join(', ',$listofqualifiedref), // For backward compatibility
|
||||
'__ORDERREF__' => join(', ',$listofqualifiedref), // For backward compatibility
|
||||
'__PROPREF__' => join(', ',$listofqualifiedref), // For backward compatibility
|
||||
'__REF__' => join(', ',$listofqualifiedref),
|
||||
'__REFCLIENT__' => $thirdparty->name
|
||||
);
|
||||
|
||||
$subject=make_substitutions($subject, $substitutionarray);
|
||||
$message=make_substitutions($message, $substitutionarray);
|
||||
|
||||
$filepath = $attachedfiles['paths'];
|
||||
$filename = $attachedfiles['names'];
|
||||
$mimetype = $attachedfiles['mimes'];
|
||||
|
||||
//var_dump($filepath);
|
||||
|
||||
// Send mail
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php');
|
||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1);
|
||||
if ($mailfile->error)
|
||||
{
|
||||
$resaction.='<div class="error">'.$mailfile->error.'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$mailfile->sendfile();
|
||||
if ($result)
|
||||
{
|
||||
$resaction.=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)).'<br>'; // Must not contain "
|
||||
|
||||
$error=0;
|
||||
|
||||
// Insert logs into agenda
|
||||
foreach($listofqualifiedinvoice as $invid => $object)
|
||||
{
|
||||
if ($objectclass == 'Propale') $actiontypecode='AC_PROP';
|
||||
if ($objectclass == 'Commande') $actiontypecode='AC_COM';
|
||||
if ($objectclass == 'Facture') $actiontypecode='AC_FAC';
|
||||
if ($objectclass == 'Supplier_Proposal') $actiontypecode='AC_SUP_PRO';
|
||||
if ($objectclass == 'CommandeFournisseur') $actiontypecode='AC_SUP_ORD';
|
||||
if ($objectclass == 'FactureFournisseur') $actiontypecode='AC_SUP_INV';
|
||||
|
||||
$actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto;
|
||||
if ($message)
|
||||
{
|
||||
if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
|
||||
$actionmsg = dol_concatdesc($actionmsg, $message);
|
||||
}
|
||||
|
||||
// Initialisation donnees
|
||||
$object->sendtoid = 0;
|
||||
$object->actiontypecode = $actiontypecode;
|
||||
$object->actionmsg = $actionmsg; // Long text
|
||||
$object->actionmsg2 = $actionmsg2; // Short text
|
||||
$object->fk_element = $invid;
|
||||
$object->elementtype = $object->element;
|
||||
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
$interface=new Interfaces($db);
|
||||
$result=$interface->run_triggers('BILL_SENTBYMAIL',$object,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
if ($error)
|
||||
{
|
||||
setEventMessages($db->lasterror(), $errors, 'errors');
|
||||
dol_syslog("Error in trigger BILL_SENTBYMAIL ".$db->lasterror(), LOG_ERR);
|
||||
}
|
||||
$nbsent++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("other");
|
||||
if ($mailfile->error)
|
||||
{
|
||||
$resaction.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
|
||||
$resaction.='<br><div class="error">'.$mailfile->error.'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$resaction.='<div class="warning">No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$resaction.=($resaction?'<br>':$resaction);
|
||||
$resaction.='<strong>'.$langs->trans("ResultOfMailSending").':</strong><br>'."\n";
|
||||
$resaction.=$langs->trans("NbSelected").': '.count($toselect)."\n<br>";
|
||||
$resaction.=$langs->trans("NbIgnored").': '.($nbignored?$nbignored:0)."\n<br>";
|
||||
$resaction.=$langs->trans("NbSent").': '.($nbsent?$nbsent:0)."\n<br>";
|
||||
|
||||
if ($nbsent)
|
||||
{
|
||||
$action=''; // Do not show form post if there was at least one successfull sent
|
||||
//setEventMessages($langs->trans("EMailSentToNRecipients", $nbsent.'/'.count($toselect)), null, 'mesgs');
|
||||
setEventMessages($langs->trans("EMailSentForNElements", $nbsent.'/'.count($toselect)), null, 'mesgs');
|
||||
setEventMessages($resaction, null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
//setEventMessages($langs->trans("EMailSentToNRecipients", 0), null, 'warnings'); // May be object has no generated PDF file
|
||||
setEventMessages($resaction, null, 'warnings');
|
||||
}
|
||||
}
|
||||
|
||||
$action='list';
|
||||
$massaction='';
|
||||
}
|
||||
|
||||
if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_search'))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
$objecttmp=new $objectclass($db);
|
||||
$listofobjectid=array();
|
||||
$listofobjectthirdparties=array();
|
||||
$listofobjectref=array();
|
||||
foreach($toselect as $toselectid)
|
||||
{
|
||||
$objecttmp=new $objectclass($db); // must create new instance because instance is saved into $listofobjectref array for future use
|
||||
$result=$objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$listoinvoicesid[$toselectid]=$toselectid;
|
||||
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
|
||||
$listofobjectthirdparties[$thirdpartyid]=$thirdpartyid;
|
||||
$listofobjectref[$toselectid]=$objecttmp->ref;
|
||||
}
|
||||
}
|
||||
|
||||
$arrayofinclusion=array();
|
||||
foreach($listofobjectref as $tmppdf) $arrayofinclusion[]=preg_quote($tmppdf.'.pdf','/');
|
||||
$listoffiles = dol_dir_list($uploaddir,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true);
|
||||
|
||||
// build list of files with full path
|
||||
$files = array();
|
||||
foreach($listofobjectref as $basename)
|
||||
{
|
||||
foreach($listoffiles as $filefound)
|
||||
{
|
||||
if (strstr($filefound["name"],$basename))
|
||||
{
|
||||
$files[] = $uploaddir.'/'.$basename.'/'.$filefound["name"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Define output language (Here it is not used because we do only merging existing PDF)
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
|
||||
// Create empty PDF
|
||||
$pdf=pdf_getInstance();
|
||||
if (class_exists('TCPDF'))
|
||||
{
|
||||
$pdf->setPrintHeader(false);
|
||||
$pdf->setPrintFooter(false);
|
||||
}
|
||||
$pdf->SetFont(pdf_getPDFFont($outputlangs));
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
|
||||
|
||||
// Add all others
|
||||
foreach($files as $file)
|
||||
{
|
||||
// Charge un document PDF depuis un fichier.
|
||||
$pagecount = $pdf->setSourceFile($file);
|
||||
for ($i = 1; $i <= $pagecount; $i++)
|
||||
{
|
||||
$tplidx = $pdf->importPage($i);
|
||||
$s = $pdf->getTemplatesize($tplidx);
|
||||
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
}
|
||||
|
||||
// Create output dir if not exists
|
||||
dol_mkdir($diroutputmassaction);
|
||||
|
||||
// Save merged file
|
||||
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities("Invoices")));
|
||||
if ($filter=='paye:0')
|
||||
{
|
||||
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
|
||||
else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
|
||||
}
|
||||
if ($year) $filename.='_'.$year;
|
||||
if ($month) $filename.='_'.$month;
|
||||
if ($pagecount)
|
||||
{
|
||||
$now=dol_now();
|
||||
$file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf';
|
||||
$pdf->Output($file,'F');
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$langs->load("exports");
|
||||
setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Remove a file from massaction area
|
||||
if ($action == 'remove_file')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$langs->load("other");
|
||||
$upload_dir = $diroutputmassaction;
|
||||
$file = $upload_dir . '/' . GETPOST('file');
|
||||
$ret=dol_delete_file($file);
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors');
|
||||
$action='';
|
||||
}
|
||||
|
||||
// Delete records
|
||||
if (! $error && $massaction == 'delete' && $permtodelete)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$objecttmp=new $objectclass($db);
|
||||
$nbok = 0;
|
||||
foreach($toselect as $toselectid)
|
||||
{
|
||||
$result=$objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$result = $objecttmp->delete($user);
|
||||
if ($result <= 0)
|
||||
{
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
else $nbok++;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if ($nbok > 1) setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs');
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
//var_dump($listofobjectthirdparties);exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -82,6 +82,7 @@ else // For no ajax call
|
|||
$relativepath=$ecmdir->getRelativePath();
|
||||
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
|
||||
}
|
||||
if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php';
|
||||
|
||||
// Load traductions files
|
||||
$langs->load("ecm");
|
||||
|
|
@ -138,10 +139,10 @@ if (! dol_is_dir($upload_dir))
|
|||
}
|
||||
|
||||
print '<!-- TYPE='.$type.' -->'."\n";
|
||||
print '<!-- Page called with mode='.(isset($mode)?$mode:'').' type='.$type.' module='.$module.' url='.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
|
||||
print '<!-- Page called with mode='.(isset($mode)?$mode:'').' type='.$type.' module='.$module.' url='.$url.' '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
|
||||
|
||||
$param=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'');
|
||||
$url=DOL_URL_ROOT.'/ecm/index.php';
|
||||
|
||||
|
||||
// Dir scan
|
||||
if ($type == 'directory')
|
||||
|
|
|
|||
|
|
@ -35,6 +35,19 @@ $element = GETPOST('element','alpha',2);
|
|||
$table_element = GETPOST('table_element','alpha',2);
|
||||
$fk_element = GETPOST('fk_element','alpha',2);
|
||||
|
||||
/* Example:
|
||||
field:editval_ref_customer (8 first chars will removed to know name of property)
|
||||
element:contrat
|
||||
table_element:contrat
|
||||
fk_element:4
|
||||
type:string
|
||||
value:aaa
|
||||
loadmethod:
|
||||
savemethod:
|
||||
savemethodname:
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
|
@ -81,7 +94,7 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
|
|||
}
|
||||
else $newelement = $element;
|
||||
|
||||
if (! empty($user->rights->$newelement->creer) || ! empty($user->rights->$newelement->write)
|
||||
if (! empty($user->rights->$newelement->creer) || ! empty($user->rights->$newelement->create) || ! empty($user->rights->$newelement->write)
|
||||
|| (isset($subelement) && (! empty($user->rights->$newelement->$subelement->creer) || ! empty($user->rights->$newelement->$subelement->write)))
|
||||
|| ($element == 'payment' && $user->rights->facture->paiement)
|
||||
|| ($element == 'payment_supplier' && $user->rights->fournisseur->facture->creer))
|
||||
|
|
|
|||
|
|
@ -132,7 +132,9 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
|||
$mesg = $px1->isGraphKo();
|
||||
if (! $mesg)
|
||||
{
|
||||
$px1->SetData($data1);
|
||||
$langs->load("bills");
|
||||
|
||||
$px1->SetData($data1);
|
||||
unset($data1);
|
||||
$px1->SetPrecisionY(0);
|
||||
$i=$startyear;$legend=array();
|
||||
|
|
|
|||
|
|
@ -128,22 +128,22 @@ class box_services_contracts extends ModeleBoxes
|
|||
}
|
||||
}
|
||||
|
||||
$this->info_box_contents[$i][] = array('td' => 'class="tdoverflow maxwidth100onsmartphone" align="left"',
|
||||
$this->info_box_contents[$i][] = array('td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"',
|
||||
'text' => $contratlignestatic->getNomUrl(1),
|
||||
'asis' => 1
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][] = array('td' => 'align="left"',
|
||||
$this->info_box_contents[$i][] = array('td' => '',
|
||||
'text' => $contractstatic->getNomUrl(1),
|
||||
'asis' => 1
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][] = array('td' => 'align="left"',
|
||||
$this->info_box_contents[$i][] = array('td' => '',
|
||||
'text' => $thirdpartytmp->getNomUrl(1),
|
||||
'asis' => 1
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][] = array('td' => 'align="right"',
|
||||
$this->info_box_contents[$i][] = array('td' => '',
|
||||
'text' => dol_print_date($datem,'day'));
|
||||
|
||||
$this->info_box_contents[$i][] = array('td' => 'align="right" width="18"',
|
||||
|
|
|
|||
|
|
@ -2451,19 +2451,19 @@ abstract class CommonObject
|
|||
{
|
||||
if ($justsource)
|
||||
{
|
||||
$sql.= "fk_source = '".$sourceid."' AND sourcetype = '".$sourcetype."'";
|
||||
$sql.= "fk_source = ".$sourceid." AND sourcetype = '".$sourcetype."'";
|
||||
if ($withtargettype) $sql.= " AND targettype = '".$targettype."'";
|
||||
}
|
||||
else if ($justtarget)
|
||||
{
|
||||
$sql.= "fk_target = '".$targetid."' AND targettype = '".$targettype."'";
|
||||
$sql.= "fk_target = ".$targetid." AND targettype = '".$targettype."'";
|
||||
if ($withsourcetype) $sql.= " AND sourcetype = '".$sourcetype."'";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= "(fk_source = '".$sourceid."' AND sourcetype = '".$sourcetype."')";
|
||||
$sql.= " ".$clause." (fk_target = '".$targetid."' AND targettype = '".$targettype."')";
|
||||
$sql.= "(fk_source = ".$sourceid." AND sourcetype = '".$sourcetype."')";
|
||||
$sql.= " ".$clause." (fk_target = ".$targetid." AND targettype = '".$targettype."')";
|
||||
}
|
||||
$sql .= ' ORDER BY sourcetype';
|
||||
//print $sql;
|
||||
|
|
@ -4128,9 +4128,16 @@ abstract class CommonObject
|
|||
$langs->load('admin');
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
$extrafields->fetch_name_optionals_label($this->table_element);
|
||||
$target_extrafields=$extrafields->fetch_name_optionals_label($this->table_element);
|
||||
|
||||
//Eliminate copied source object extra_fields that do not exist in target object
|
||||
$new_array_options=array();
|
||||
foreach ($this->array_options as $key => $value) {
|
||||
if (in_array(substr($key,8), array_keys($target_extrafields)))
|
||||
$new_array_options[$key] = $value;
|
||||
}
|
||||
|
||||
foreach($this->array_options as $key => $value)
|
||||
foreach($new_array_options as $key => $value)
|
||||
{
|
||||
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
||||
$attributeType = $extrafields->attribute_type[$attributeKey];
|
||||
|
|
@ -4193,7 +4200,7 @@ abstract class CommonObject
|
|||
$this->db->query($sql_del);
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object";
|
||||
foreach($this->array_options as $key => $value)
|
||||
foreach($new_array_options as $key => $value)
|
||||
{
|
||||
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
||||
// Add field of attribut
|
||||
|
|
@ -4201,7 +4208,7 @@ abstract class CommonObject
|
|||
$sql.=",".$attributeKey;
|
||||
}
|
||||
$sql .= ") VALUES (".$this->id;
|
||||
foreach($this->array_options as $key => $value)
|
||||
foreach($new_array_options as $key => $value)
|
||||
{
|
||||
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
||||
// Add field o fattribut
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class DolEditor
|
|||
$this->editor->Value = $content;
|
||||
$this->editor->Height = $height;
|
||||
if (! empty($width)) $this->editor->Width = $width;
|
||||
$this->editor->ToolbarSet = $shorttoolbarname;
|
||||
$this->editor->ToolbarSet = $shorttoolbarname; // Profile of this toolbar set is deinfed into theme/mytheme/ckeditor/config.js
|
||||
$this->editor->Config['AutoDetectLanguage'] = 'true';
|
||||
$this->editor->Config['ToolbarLocation'] = $toolbarlocation ? $toolbarlocation : 'In';
|
||||
$this->editor->Config['ToolbarStartExpanded'] = $toolbarstartexpanded;
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ class ExtraFields
|
|||
'chkbxlst' => 'ExtrafieldCheckBoxFromList',
|
||||
'link' => 'ExtrafieldLink',
|
||||
'separate' => 'ExtrafieldSeparator',
|
||||
'password' => 'ExtrafieldPassword',
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
@ -190,7 +191,7 @@ class ExtraFields
|
|||
} elseif($type=='phone') {
|
||||
$typedb='varchar';
|
||||
$lengthdb='20';
|
||||
}elseif($type=='mail') {
|
||||
} elseif($type=='mail') {
|
||||
$typedb='varchar';
|
||||
$lengthdb='128';
|
||||
} elseif (($type=='select') || ($type=='sellist') || ($type=='radio') ||($type=='checkbox') ||($type=='chkbxlst')){
|
||||
|
|
@ -199,6 +200,9 @@ class ExtraFields
|
|||
} elseif ($type=='link') {
|
||||
$typedb='int';
|
||||
$lengthdb='11';
|
||||
} elseif($type=='password') {
|
||||
$typedb='varchar';
|
||||
$lengthdb='50';
|
||||
} else {
|
||||
$typedb=$type;
|
||||
$lengthdb=$length;
|
||||
|
|
@ -417,7 +421,7 @@ class ExtraFields
|
|||
} elseif($type=='phone') {
|
||||
$typedb='varchar';
|
||||
$lengthdb='20';
|
||||
}elseif($type=='mail') {
|
||||
} elseif($type=='mail') {
|
||||
$typedb='varchar';
|
||||
$lengthdb='128';
|
||||
} elseif (($type=='select') || ($type=='sellist') || ($type=='radio') || ($type=='checkbox') || ($type=='chkbxlst')) {
|
||||
|
|
@ -426,6 +430,9 @@ class ExtraFields
|
|||
} elseif ($type=='link') {
|
||||
$typedb='int';
|
||||
$lengthdb='11';
|
||||
} elseif($type=='password') {
|
||||
$typedb='varchar';
|
||||
$lengthdb='50';
|
||||
} else {
|
||||
$typedb=$type;
|
||||
$lengthdb=$length;
|
||||
|
|
@ -1146,6 +1153,10 @@ class ExtraFields
|
|||
$out.='Error bad setup of extrafield';
|
||||
}
|
||||
}
|
||||
elseif ($type == 'password')
|
||||
{
|
||||
$out='<input type="password" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="'.$showsize.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
if (!empty($hidden)) {
|
||||
$out='<input type="hidden" value="'.$value.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'"/>';
|
||||
}
|
||||
|
|
@ -1404,6 +1415,10 @@ class ExtraFields
|
|||
{
|
||||
$value=dol_htmlentitiesbr($value);
|
||||
}
|
||||
elseif ($type == 'password')
|
||||
{
|
||||
$value=preg_replace('/./i','*',$value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$showsize=round($size);
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
|||
|
||||
|
||||
/**
|
||||
* \class GenericObject
|
||||
* \brief Class of a generic business object
|
||||
* Class of a generic business object
|
||||
*/
|
||||
|
||||
class GenericObject extends CommonObject
|
||||
|
|
|
|||
|
|
@ -142,7 +142,8 @@ class HookManager
|
|||
'formObjectOptions',
|
||||
'formattachOptions',
|
||||
'formBuilddocLineOptions',
|
||||
'getIdProfUrl',
|
||||
'getFormMail',
|
||||
'getIdProfUrl',
|
||||
'moveUploadedFile',
|
||||
'pdf_build_address',
|
||||
'pdf_writelinedesc',
|
||||
|
|
|
|||
|
|
@ -1436,7 +1436,7 @@ class Form
|
|||
$nodatarole=($comboenhancement?' data-role="none"':'');
|
||||
}
|
||||
|
||||
$out.= '<select class="flat minwidth200'.($morecss?' '.$morecss:'').'" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled':'').$nodatarole.'>';
|
||||
$out.= '<select class="flat'.($morecss?' minwidth100 '.$morecss:' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled':'').$nodatarole.'>';
|
||||
if ($show_empty) $out.= '<option value="-1"'.((empty($selected) || $selected==-1)?' selected':'').'> </option>'."\n";
|
||||
if ($show_every) $out.= '<option value="-2"'.(($selected==-2)?' selected':'').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
|
||||
|
||||
|
|
@ -1767,7 +1767,7 @@ class Form
|
|||
$optJson = array();
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
if (!empty($objp->price_by_qty) && $objp->price_by_qty == 1 && !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))
|
||||
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) && !empty($objp->price_by_qty) && $objp->price_by_qty == 1)
|
||||
{ // Price by quantity will return many prices for the same product
|
||||
$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_price_by_qty";
|
||||
|
|
@ -1915,8 +1915,8 @@ class Form
|
|||
$sql.= " WHERE fk_product='".$objp->rowid."'";
|
||||
$sql.= " AND entity IN (".getEntity('productprice', 1).")";
|
||||
$sql.= " AND price_level=".$price_level;
|
||||
$sql.= " ORDER BY date_price, rowid";
|
||||
$sql.= " DESC LIMIT 1";
|
||||
$sql.= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.
|
||||
$sql.= " LIMIT 1";
|
||||
|
||||
dol_syslog(get_class($this).'::constructProductListOption search price for level '.$price_level.'', LOG_DEBUG);
|
||||
$result2 = $this->db->query($sql);
|
||||
|
|
@ -4262,7 +4262,8 @@ class Form
|
|||
}
|
||||
|
||||
// Now we get list
|
||||
$num = $this->load_cache_vatrates($code_country);
|
||||
$num = $this->load_cache_vatrates($code_country); // If no vat defined, return -1 with message into this->error
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
// Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '')
|
||||
|
|
@ -5928,7 +5929,7 @@ class Form
|
|||
/**
|
||||
* Return HTML to show the search and clear seach button
|
||||
*
|
||||
* @param int $addcheckuncheckall Add the check all uncheck all button
|
||||
* @param int $addcheckuncheckall Add the check all/uncheck all checkbox (use javascript) and code to manage this
|
||||
* @param string $cssclass CSS class
|
||||
* @param int $calljsfunction 0=default. 1=call function initCheckForSelect() after changing status of checkboxes
|
||||
* @return string
|
||||
|
|
@ -5943,8 +5944,7 @@ class Form
|
|||
if ($addcheckuncheckall)
|
||||
{
|
||||
if (! empty($conf->use_javascript_ajax)) $out.='<input type="checkbox" id="checkallactions" name="checkallactions" class="checkallactions">';
|
||||
}
|
||||
$out.='<script type="text/javascript">
|
||||
$out.='<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#checkallactions").click(function() {
|
||||
if($(this).is(\':checked\')){
|
||||
|
|
@ -5956,10 +5956,11 @@ class Form
|
|||
console.log("We uncheck all");
|
||||
$(".'.$cssclass.'").prop(\'checked\', false);
|
||||
}'."\n";
|
||||
if ($calljsfunction) $out.='if (typeof initCheckForSelect == \'function\') { initCheckForSelect(); } else { console.log("No function initCheckForSelect found. Call won\'t done."); }';
|
||||
$out.=' });
|
||||
});
|
||||
</script>';
|
||||
if ($calljsfunction) $out.='if (typeof initCheckForSelect == \'function\') { initCheckForSelect(); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }';
|
||||
$out.=' });
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -250,8 +250,9 @@ class FormMail extends Form
|
|||
$hookmanager->initHooks(array('formmail'));
|
||||
|
||||
$parameters=array(
|
||||
'addfileaction' => $addfileaction,
|
||||
'removefileaction'=> $removefileaction
|
||||
'addfileaction' => $addfileaction,
|
||||
'removefileaction'=> $removefileaction,
|
||||
'trackid'=> $this->trackid
|
||||
);
|
||||
$reshook=$hookmanager->executeHooks('getFormMail', $parameters, $this);
|
||||
|
||||
|
|
@ -927,18 +928,30 @@ class FormMail extends Form
|
|||
/**
|
||||
* Set substit array from object
|
||||
*
|
||||
* @param Object $object Object to use
|
||||
* @param Object $object Object to use
|
||||
* @param Translate $outputlangs Object lang
|
||||
* @return void
|
||||
*/
|
||||
function setSubstitFromObject($object)
|
||||
function setSubstitFromObject($object, $outputlangs=null)
|
||||
{
|
||||
global $user;
|
||||
$this->substit['__REF__'] = $object->ref;
|
||||
$this->substit['__SIGNATURE__'] = $user->signature;
|
||||
$this->substit['__REFCLIENT__'] = $object->ref_client;
|
||||
$this->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name;
|
||||
$this->substit['__REFSUPPLIER__'] = $object->ref_supplier;
|
||||
|
||||
$this->substit['__DATE_YMD__'] = dol_print_date($object->date, 'day', 0, $outputlangs);
|
||||
$this->substit['__DATE_DUE_YMD__'] = dol_print_date($object->date_lim_reglement, 'day', 0, $outputlangs);
|
||||
$this->substit['__AMOUNT__'] = price($object->total_ttc);
|
||||
$this->substit['__AMOUNT_WO_TAX__'] = price($object->total_ht);
|
||||
|
||||
$this->substit['__THIRDPARTY_ID__'] = (is_object($object->thirdparty)?$object->thirdparty->id:'');
|
||||
$this->substit['__THIRDPARTY_NAME__'] = (is_object($object->thirdparty)?$object->thirdparty->name:'');
|
||||
|
||||
$this->substit['__PROJECT_ID__'] = (is_object($object->projet)?$object->projet->id:'');
|
||||
$this->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
|
||||
$this->substit['__PROJECT_NAME__'] = (is_object($object->projet)?$object->projet->title:'');
|
||||
|
||||
$this->substit['__SIGNATURE__'] = $user->signature;
|
||||
$this->substit['__PERSONALIZED__'] = '';
|
||||
$this->substit['__CONTACTCIVNAME__'] = ''; // Will be replace just before sending
|
||||
}
|
||||
|
|
|
|||
|
|
@ -579,7 +579,7 @@ class FormOther
|
|||
{
|
||||
print " ";
|
||||
}
|
||||
print $lines[$i]->label."</option>\n";
|
||||
print $lines[$i]->ref.' '.$lines[$i]->label."</option>\n";
|
||||
$inc++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -569,7 +569,7 @@ class FormProjets
|
|||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$sellist .='<option value="'.$obj->rowid.'" defaultpercent="'.$obj->percent.'"';
|
||||
$sellist .='<option value="'.$obj->rowid.'" defaultpercent="'.$obj->percent.'" elemcode="'.$obj->code.'"';
|
||||
if ($obj->rowid == $preselected) $sellist .= ' selected="selected"';
|
||||
$sellist .= '>';
|
||||
if ($useshortlabel)
|
||||
|
|
|
|||
|
|
@ -69,23 +69,29 @@ class Notify
|
|||
global $langs;
|
||||
$langs->load("mails");
|
||||
|
||||
$listofnotiftodo=$this->getNotificationsArray($action,$socid,$object);
|
||||
$nb=count($listofnotiftodo);
|
||||
if ($nb <= 0) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("NoNotificationsWillBeSent");
|
||||
if ($nb == 1) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("ANotificationsWillBeSent");
|
||||
if ($nb >= 2) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("SomeNotificationsWillBeSent",$nb);
|
||||
|
||||
$i=0;
|
||||
foreach ($listofnotiftodo as $key => $val)
|
||||
{
|
||||
if ($i) $texte.=', ';
|
||||
else $texte.=' (';
|
||||
if ($val['isemailvalid']) $texte.=$val['email'];
|
||||
else $texte.=$val['emaildesc'];
|
||||
$i++;
|
||||
}
|
||||
if ($i) $texte.=')';
|
||||
|
||||
$listofnotiftodo=$this->getNotificationsArray($action,$socid,$object,0);
|
||||
|
||||
$nb=-1;
|
||||
if (is_array($listofnotiftodo)) $nb=count($listofnotiftodo);
|
||||
if ($nb < 0) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("ErrorFailedToGetListOfNotificationsToSend");
|
||||
if ($nb == 0) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("NoNotificationsWillBeSent");
|
||||
if ($nb == 1) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("ANotificationsWillBeSent");
|
||||
if ($nb >= 2) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("SomeNotificationsWillBeSent",$nb);
|
||||
|
||||
if (is_array($listofnotiftodo))
|
||||
{
|
||||
$i=0;
|
||||
foreach ($listofnotiftodo as $key => $val)
|
||||
{
|
||||
if ($i) $texte.=', ';
|
||||
else $texte.=' (';
|
||||
if ($val['isemailvalid']) $texte.=$val['email'];
|
||||
else $texte.=$val['emaildesc'];
|
||||
$i++;
|
||||
}
|
||||
if ($i) $texte.=')';
|
||||
}
|
||||
|
||||
return $texte;
|
||||
}
|
||||
|
||||
|
|
@ -93,11 +99,12 @@ class Notify
|
|||
* Return number of notifications activated for action code (and third party)
|
||||
*
|
||||
* @param string $notifcode Code of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage)
|
||||
* @param int $socid Id of third party or 0 for all thirdparties
|
||||
* @param int $socid Id of third party or 0 for all thirdparties or -1 for no thirdparties
|
||||
* @param Object $object Object the notification is about (need it to check threshold value of some notifications)
|
||||
* @param int $userid Id of user or 0 for all users or -1 for no users
|
||||
* @return array|int <0 if KO, array of notifications to send if OK
|
||||
*/
|
||||
function getNotificationsArray($notifcode,$socid,$object=null)
|
||||
function getNotificationsArray($notifcode,$socid=0,$object=null,$userid=0)
|
||||
{
|
||||
global $conf, $user;
|
||||
|
||||
|
|
@ -109,45 +116,94 @@ class Notify
|
|||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "SELECT a.code, c.email, c.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."socpeople as c,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " WHERE n.fk_contact = c.rowid";
|
||||
$sql.= " AND a.rowid = n.fk_action";
|
||||
$sql.= " AND n.fk_soc = s.rowid";
|
||||
if ($notifcode)
|
||||
{
|
||||
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
|
||||
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
|
||||
}
|
||||
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
|
||||
if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
|
||||
|
||||
dol_syslog(__METHOD__." ".$notifcode.", ".$socid."", LOG_DEBUG);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$isvalid=isValidEmail($newval2);
|
||||
$resarray[] = array('type'=> 'tocontact', 'code'=>trim($obj->code), 'emaildesc'=>'Contact id '.$obj->rowid, 'email'=>trim($obj->email), 'contactid'=>$obj->rowid, 'isemailvalid'=>$isvalid);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->lasterror();
|
||||
}
|
||||
if ($socid >= 0)
|
||||
{
|
||||
$sql = "SELECT a.code, c.email, c.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."socpeople as c,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " WHERE n.fk_contact = c.rowid";
|
||||
$sql.= " AND a.rowid = n.fk_action";
|
||||
$sql.= " AND n.fk_soc = s.rowid";
|
||||
if ($notifcode)
|
||||
{
|
||||
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
|
||||
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
|
||||
}
|
||||
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
|
||||
if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
|
||||
|
||||
dol_syslog(__METHOD__." ".$notifcode.", ".$socid."", LOG_DEBUG);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$newval2=trim($obj->email);
|
||||
$isvalid=isValidEmail($newval2);
|
||||
if (empty($resarray[$newval2])) $resarray[$newval2] = array('type'=> 'tocontact', 'code'=>trim($obj->code), 'emaildesc'=>'Contact id '.$obj->rowid, 'email'=>$newval2, 'contactid'=>$obj->rowid, 'isemailvalid'=>$isvalid);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if ($userid >= 0)
|
||||
{
|
||||
$sql = "SELECT a.code, c.email, c.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."user as c,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a";
|
||||
$sql.= " WHERE n.fk_user = c.rowid";
|
||||
$sql.= " AND a.rowid = n.fk_action";
|
||||
if ($notifcode)
|
||||
{
|
||||
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
|
||||
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
|
||||
}
|
||||
$sql.= " AND c.entity IN (".getEntity('user', 1).")";
|
||||
if ($userid > 0) $sql.= " AND c.rowid = ".$userid;
|
||||
|
||||
dol_syslog(__METHOD__." ".$notifcode.", ".$socid."", LOG_DEBUG);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$newval2=trim($obj->email);
|
||||
$isvalid=isValidEmail($newval2);
|
||||
if (empty($resarray[$newval2])) $resarray[$newval2] = array('type'=> 'touser', 'code'=>trim($obj->code), 'emaildesc'=>'User id '.$obj->rowid, 'email'=>$newval2, 'userid'=>$obj->rowid, 'isemailvalid'=>$isvalid);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
|
|
@ -177,7 +233,7 @@ class Notify
|
|||
{
|
||||
$tmpuser=new User($this->db);
|
||||
$tmpuser->fetch($user->fk_user);
|
||||
if ($tmpuser->email) $newval2=$tmpuser->email;
|
||||
if ($tmpuser->email) $newval2=trim($tmpuser->email);
|
||||
else $newval2='';
|
||||
}
|
||||
else $newval2='';
|
||||
|
|
@ -185,7 +241,7 @@ class Notify
|
|||
if ($newval2)
|
||||
{
|
||||
$isvalid=isValidEmail($newval2, 0);
|
||||
$resarray[]=array('type'=> 'tofixedemail', 'code'=>trim($key), 'emaildesc'=>trim($val2), 'email'=>trim($newval2), 'isemailvalid'=>$isvalid);
|
||||
if (empty($resarray[$newval2])) $resarray[$newval2]=array('type'=> 'tofixedemail', 'code'=>trim($key), 'emaildesc'=>trim($val2), 'email'=>$newval2, 'isemailvalid'=>$isvalid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -254,7 +310,7 @@ class Notify
|
|||
$newref=(empty($object->newref)?$object->ref:$object->newref);
|
||||
|
||||
// Check notification per third party
|
||||
$sql = "SELECT s.nom, c.email, c.rowid as cid, c.lastname, c.firstname, c.default_lang,";
|
||||
$sql = "SELECT 'tocontactid' as type_target, c.email, c.rowid as cid, c.lastname, c.firstname, c.default_lang,";
|
||||
$sql.= " a.rowid as adid, a.label, a.code, n.rowid, n.type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
||||
|
|
@ -266,6 +322,29 @@ class Notify
|
|||
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
|
||||
$sql .= " AND s.rowid = ".$object->socid;
|
||||
|
||||
// Check notification per user
|
||||
$sql.= "\nUNION\n";
|
||||
/*
|
||||
$sql.= "SELECT 1 as user, c.email, c.rowid as cid, c.lastname, c.firstname, '$langs->defaultlang' as default_lang,";
|
||||
$sql.= " a.rowid as adid, a.label, a.code, n.rowid, n.type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as c,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."notify_def as n,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."element_contact as ec";
|
||||
$sql.= " WHERE n.fk_user = c.rowid AND a.rowid = n.fk_action";
|
||||
$sql.= " AND n.fk_user = ec.fk_socpeople";
|
||||
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
|
||||
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
|
||||
$sql .= " AND ec.element_id = ".$object->id;*/
|
||||
$sql.= "SELECT 'touserid' as type_target, c.email, c.rowid as cid, c.lastname, c.firstname, c.lang as default_lang,";
|
||||
$sql.= " a.rowid as adid, a.label, a.code, n.rowid, n.type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as c,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."notify_def as n";
|
||||
$sql.= " WHERE n.fk_user = c.rowid AND a.rowid = n.fk_action";
|
||||
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
|
||||
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
|
@ -393,9 +472,17 @@ class Notify
|
|||
);
|
||||
|
||||
if ($mailfile->sendfile())
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, objet_id, email)";
|
||||
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".$object->socid.", ".$obj->cid.", '".$obj->type."', '".$object_type."', ".$object->id.", '".$this->db->escape($obj->email)."')";
|
||||
{
|
||||
if ($obj->type_target == 'touserid') {
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_user, type, objet_type, type_target, objet_id, email)";
|
||||
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid?$object->socid:'null').", ".$obj->cid.", '".$obj->type."', '".$object_type."', '".$obj->type_target."', ".$object->id.", '".$this->db->escape($obj->email)."')";
|
||||
|
||||
}
|
||||
else {
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, type_target, objet_id, email)";
|
||||
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid?$object->socid:'null').", ".$obj->cid.", '".$obj->type."', '".$object_type."', '".$obj->type_target."', ".$object->id.", '".$this->db->escape($obj->email)."')";
|
||||
|
||||
}
|
||||
if (! $this->db->query($sql))
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
|
|
@ -420,10 +507,11 @@ class Notify
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$error++;
|
||||
$this->errors[]=$this->db->lasterror();
|
||||
return -1;
|
||||
dol_syslog("Failed to get list of notification to send ".$this->db->lasterror(), LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Check notification using fixed email
|
||||
|
|
@ -579,8 +667,8 @@ class Notify
|
|||
|
||||
if ($mailfile->sendfile())
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, objet_id, email)";
|
||||
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".$object->socid.", null, 'email', '".$object_type."', ".$object->id.", '".$this->db->escape($conf->global->$param)."')";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, type_target, objet_type, objet_id, email)";
|
||||
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid?$object->socid:'null').", null, 'email', 'tofixedemail', '".$object_type."', ".$object->id.", '".$this->db->escape($conf->global->$param)."')";
|
||||
if (! $this->db->query($sql))
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
|
|
|
|||
|
|
@ -388,6 +388,12 @@ abstract class Stats
|
|||
if($i>0 && $row->total) $result[$i-1]['total_diff'] = ($result[$i-1]['total'] - $row->total) / $row->total * 100;
|
||||
$result[$i]['avg'] = $row->avg;
|
||||
if($i>0 && $row->avg) $result[$i-1]['avg_diff'] = ($result[$i-1]['avg'] - $row->avg) / $row->avg * 100;
|
||||
// For some $sql only
|
||||
if (isset($row->weighted))
|
||||
{
|
||||
$result[$i]['weighted'] = $row->weighted;
|
||||
if($i>0 && $row->weighted) $result[$i-1]['avg_weighted'] = ($result[$i-1]['weighted'] - $row->weighted) / $row->weighted * 100;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
|
|
|||
|
|
@ -606,10 +606,13 @@ class DoliDBMysql extends DoliDB
|
|||
$sql="SHOW TABLES FROM ".$database." ".$like.";";
|
||||
//print $sql;
|
||||
$result = $this->query($sql);
|
||||
while($row = $this->fetch_row($result))
|
||||
{
|
||||
$listtables[] = $row[0];
|
||||
}
|
||||
if ($result)
|
||||
{
|
||||
while($row = $this->fetch_row($result))
|
||||
{
|
||||
$listtables[] = $row[0];
|
||||
}
|
||||
}
|
||||
return $listtables;
|
||||
}
|
||||
|
||||
|
|
@ -627,10 +630,13 @@ class DoliDBMysql extends DoliDB
|
|||
|
||||
dol_syslog($sql,LOG_DEBUG);
|
||||
$result = $this->query($sql);
|
||||
while($row = $this->fetch_row($result))
|
||||
{
|
||||
$infotables[] = $row;
|
||||
}
|
||||
if ($result)
|
||||
{
|
||||
while($row = $this->fetch_row($result))
|
||||
{
|
||||
$infotables[] = $row;
|
||||
}
|
||||
}
|
||||
return $infotables;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -589,9 +589,12 @@ class DoliDBMysqli extends DoliDB
|
|||
$sql="SHOW TABLES FROM ".$database." ".$like.";";
|
||||
//print $sql;
|
||||
$result = $this->query($sql);
|
||||
while($row = $this->fetch_row($result))
|
||||
if ($result)
|
||||
{
|
||||
$listtables[] = $row[0];
|
||||
while($row = $this->fetch_row($result))
|
||||
{
|
||||
$listtables[] = $row[0];
|
||||
}
|
||||
}
|
||||
return $listtables;
|
||||
}
|
||||
|
|
@ -610,9 +613,12 @@ class DoliDBMysqli extends DoliDB
|
|||
|
||||
dol_syslog($sql,LOG_DEBUG);
|
||||
$result = $this->query($sql);
|
||||
while($row = $this->fetch_row($result))
|
||||
if ($result)
|
||||
{
|
||||
$infotables[] = $row;
|
||||
while($row = $this->fetch_row($result))
|
||||
{
|
||||
$infotables[] = $row;
|
||||
}
|
||||
}
|
||||
return $infotables;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -861,10 +861,13 @@ class DoliDBPgsql extends DoliDB
|
|||
$like = '';
|
||||
if ($table) $like = " AND table_name LIKE '".$table."'";
|
||||
$result = pg_query($this->db, "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'".$like." ORDER BY table_name");
|
||||
while($row = $this->fetch_row($result))
|
||||
{
|
||||
$listtables[] = $row[0];
|
||||
}
|
||||
if ($result)
|
||||
{
|
||||
while($row = $this->fetch_row($result))
|
||||
{
|
||||
$listtables[] = $row[0];
|
||||
}
|
||||
}
|
||||
return $listtables;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -747,9 +747,12 @@ class DoliDBSqlite extends DoliDB
|
|||
$sql="SHOW TABLES FROM ".$database." ".$like.";";
|
||||
//print $sql;
|
||||
$result = $this->query($sql);
|
||||
while($row = $this->fetch_row($result))
|
||||
if ($result)
|
||||
{
|
||||
$listtables[] = $row[0];
|
||||
while($row = $this->fetch_row($result))
|
||||
{
|
||||
$listtables[] = $row[0];
|
||||
}
|
||||
}
|
||||
return $listtables;
|
||||
}
|
||||
|
|
@ -769,9 +772,12 @@ class DoliDBSqlite extends DoliDB
|
|||
|
||||
dol_syslog($sql,LOG_DEBUG);
|
||||
$result = $this->query($sql);
|
||||
while($row = $this->fetch_row($result))
|
||||
if ($result)
|
||||
{
|
||||
$infotables[] = $row;
|
||||
while($row = $this->fetch_row($result))
|
||||
{
|
||||
$infotables[] = $row;
|
||||
}
|
||||
}
|
||||
return $infotables;
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user