# WARNING: head commit changed in the meantime
Change-Id: I27dc1da6ca41955468f3661433e41c72a277f670
This commit is contained in:
commit
4b8f42949c
@ -287,10 +287,13 @@ script:
|
|||||||
php upgrade.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400.log
|
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 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 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 -
|
cd -
|
||||||
set +e
|
set +e
|
||||||
echo
|
echo
|
||||||
#cat $TRAVIS_BUILD_DIR/upgrade390400-2.log
|
#cat $TRAVIS_BUILD_DIR/upgrade400500-2.log
|
||||||
#cat /tmp/dolibarr_install.log
|
#cat /tmp/dolibarr_install.log
|
||||||
|
|
||||||
- |
|
- |
|
||||||
|
|||||||
35
ChangeLog
35
ChangeLog
@ -163,6 +163,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 *****
|
***** ChangeLog for 3.9.2 compared to 3.9.1 *****
|
||||||
FIX: #4813 Won translation for the key OppStatusWON instead OppStatusWIN
|
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, ...).
|
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.
|
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
|
> 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.
|
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/ckeditor
|
||||||
- htdocs/includes/jquery/plugins/datatables/extras/TableTools/swf
|
- htdocs/includes/phpexcel or htdocs/includes/phpoffice
|
||||||
- htdocs/includes/phpexcel
|
- htdocs/includes/tcpdf or htdocs/includes/tecnickom
|
||||||
- htdocs/includes/tcpdf
|
|
||||||
And rename file into
|
And rename file into
|
||||||
dolibarr-x.y.z+dfsgw.tgz
|
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)
|
(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,
|
Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5,
|
||||||
php5-cli,
|
php5-cli,
|
||||||
# Required PHP extensions
|
# 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
|
# Required PHP libraries
|
||||||
php-pear, php-mail-mime,
|
php-pear, php-mail-mime,
|
||||||
# php-tcpdf, libfpdi-php,
|
# php-tcpdf, libfpdi-php,
|
||||||
@ -31,10 +31,10 @@ Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm |
|
|||||||
${misc:Depends},
|
${misc:Depends},
|
||||||
${perl:Depends}
|
${perl:Depends}
|
||||||
Recommends: apache2 | lighttpd | httpd
|
Recommends: apache2 | lighttpd | httpd
|
||||||
Suggests: www-browser
|
Suggests: www-browser, php5-geoip
|
||||||
Description: Web based software to manage a company or foundation
|
Description: Web based software to manage a company or foundation
|
||||||
Dolibarr ERP & CRM is an easy to use open source/free software for small
|
Dolibarr ERP & CRM is an easy to use open source/free software package for
|
||||||
and medium companies, foundations or freelances. It includes different
|
companies, foundations or freelances. It includes different
|
||||||
features for Enterprise Resource Planning (ERP) and Customer Relationship
|
features for Enterprise Resource Planning (ERP) and Customer Relationship
|
||||||
Management (CRM) but also for different other activities.
|
Management (CRM) but also for different other activities.
|
||||||
.
|
.
|
||||||
|
|||||||
@ -1,2 +1 @@
|
|||||||
README.md
|
README.md
|
||||||
README-FR.md
|
|
||||||
|
|||||||
@ -2,4 +2,4 @@
|
|||||||
version=3
|
version=3
|
||||||
|
|
||||||
#http://sf.net/dolibarr/dolibarr-(.+)\.tgz
|
#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 -->
|
<!-- 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 || [];
|
ga('create', 'UA-9049390-16', 'auto');
|
||||||
_gaq.push(['_setAccount', 'UA-9049390-1']);
|
ga('send', 'pageview');
|
||||||
_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);
|
|
||||||
})();
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<!-- End google analytics -->
|
<!-- End google analytics -->
|
||||||
@ -41,5 +38,14 @@ google_ad_height = 60;
|
|||||||
<br>
|
<br>
|
||||||
|
|
||||||
</div>
|
</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>
|
</body>
|
||||||
</html>
|
</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">
|
<!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">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
@ -14,7 +12,23 @@ File added into doxygen generated documentation
|
|||||||
<link href="tabs.css" rel="stylesheet" type="text/css" />
|
<link href="tabs.css" rel="stylesheet" type="text/css" />
|
||||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||||
<!-- End from dolibarr.org -->
|
<!-- 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>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="top">
|
<div id="top">
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ DoYouWantToStart=Vol iniciar el proc
|
|||||||
TechnicalParameters=Paràmetres tècnics
|
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.
|
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ó) :
|
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) :
|
ApachePort=Puerto Apache (únicament primera instal.lació, normalment és el 80) :
|
||||||
MySqlPort=Puerto Mysql (únicament primera instal.lació, normalment és el 3306) :
|
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?
|
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?
|
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:
|
ChooseDefaultBrowser=Esculli el seu navegador per defecte. Si no està segur, simplement feu clic a Obrir:
|
||||||
|
|
||||||
LaunchNow=Llançar ara Dolibarr
|
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 ?
|
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 ?
|
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 :
|
ChooseDefaultBrowser=Please choose your default browser. If you are not sure, just click Open :
|
||||||
|
|
||||||
LaunchNow=Launch Dolibarr now
|
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 ?
|
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 ?
|
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 :
|
ChooseDefaultBrowser=Merci de choisir votre navigateur par défaut. Si vous n'êtes pas sûr, cliquez simplement sur Ouvrir :
|
||||||
|
|
||||||
LaunchNow=Lancer Dolibarr maintenant
|
LaunchNow=Lancer Dolibarr maintenant
|
||||||
|
|||||||
@ -20,7 +20,7 @@ DoYouWantToStart=
|
|||||||
TechnicalParameters=Parámetros técnicos
|
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.
|
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) :
|
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) :
|
ApachePort=Puerto Apache (únicamente primera instalación, normalmente es el 80) :
|
||||||
MySqlPort=Puerto Mysql (únicamente primera instalación, normalmente es el 3306) :
|
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?
|
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 ?
|
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 :
|
ChooseDefaultBrowser=Escoja su navegador por defecto. Si no está seguro, simplementa haga clic en Abrir :
|
||||||
|
|
||||||
LaunchNow=Lanzar ahora Dolibarr
|
LaunchNow=Lanzar ahora Dolibarr
|
||||||
|
|||||||
@ -540,6 +540,20 @@ begin
|
|||||||
begin
|
begin
|
||||||
//navigateur
|
//navigateur
|
||||||
browser := 'iexplore.exe';
|
browser := 'iexplore.exe';
|
||||||
|
|
||||||
|
if browser = 'iexplore.exe' then
|
||||||
|
begin
|
||||||
|
if FileExists (pfPath+'/Google/Chrome/Application/chrome.exe') then
|
||||||
|
begin
|
||||||
|
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
|
if FileExists (pfPath+'/Mozilla Firefox/firefox.exe') then
|
||||||
begin
|
begin
|
||||||
if MsgBox(CustomMessage('FirefoxDetected'),mbConfirmation,MB_YESNO) = IDYES then
|
if MsgBox(CustomMessage('FirefoxDetected'),mbConfirmation,MB_YESNO) = IDYES then
|
||||||
@ -547,6 +561,8 @@ begin
|
|||||||
browser := pfPath+'/Mozilla Firefox/firefox.exe';
|
browser := pfPath+'/Mozilla Firefox/firefox.exe';
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
if browser = 'iexplore.exe' then
|
if browser = 'iexplore.exe' then
|
||||||
begin
|
begin
|
||||||
if FileExists (pfPath+'/Internet Explorer/iexplore.exe') then
|
if FileExists (pfPath+'/Internet Explorer/iexplore.exe') then
|
||||||
@ -611,7 +627,9 @@ begin
|
|||||||
destFile := pathWithSlashes+'/alias/dolibarr.conf';
|
destFile := pathWithSlashes+'/alias/dolibarr.conf';
|
||||||
srcFile := pathWithSlashes+'/alias/dolibarr.conf.install';
|
srcFile := pathWithSlashes+'/alias/dolibarr.conf.install';
|
||||||
|
|
||||||
if not FileExists (destFile) and FileExists(srcFile) then
|
if FileExists(srcFile) then
|
||||||
|
begin
|
||||||
|
if not FileExists (destFile) then
|
||||||
begin
|
begin
|
||||||
LoadStringFromFile (srcFile, srcContents);
|
LoadStringFromFile (srcFile, srcContents);
|
||||||
|
|
||||||
@ -620,6 +638,18 @@ begin
|
|||||||
|
|
||||||
SaveStringToFile(destFile, srcContents, False);
|
SaveStringToFile(destFile, srcContents, False);
|
||||||
end
|
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);
|
DeleteFile(srcFile);
|
||||||
|
|
||||||
|
|
||||||
@ -632,14 +662,25 @@ begin
|
|||||||
destFile := pathWithSlashes+'/apps/phpmyadmin'+phpmyadminVersion+'/config.inc.php';
|
destFile := pathWithSlashes+'/apps/phpmyadmin'+phpmyadminVersion+'/config.inc.php';
|
||||||
srcFile := pathWithSlashes+'/apps/phpmyadmin'+phpmyadminVersion+'/config.inc.php.install';
|
srcFile := pathWithSlashes+'/apps/phpmyadmin'+phpmyadminVersion+'/config.inc.php.install';
|
||||||
|
|
||||||
if not FileExists (destFile) and FileExists (srcFile) then
|
if FileExists(srcFile) then
|
||||||
|
begin
|
||||||
|
if not FileExists (destFile) then
|
||||||
begin
|
begin
|
||||||
// sinon on prends le fichier par defaut
|
|
||||||
LoadStringFromFile (srcFile, srcContents);
|
LoadStringFromFile (srcFile, srcContents);
|
||||||
StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
|
StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
|
||||||
StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
|
StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
|
||||||
SaveStringToFile(destFile,srcContents, False);
|
SaveStringToFile(destFile,srcContents, False);
|
||||||
end
|
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
|
# now build is 0+nmu1 for example
|
||||||
$FILENAMEDEBNATIVE="${PROJECT}_${MAJOR}.${MINOR}.${build}";
|
$FILENAMEDEBNATIVE="${PROJECT}_${MAJOR}.${MINOR}.${build}";
|
||||||
$FILENAMEDEB="${PROJECT}_${MAJOR}.${MINOR}.${newbuild}";
|
$FILENAMEDEB="${PROJECT}_${MAJOR}.${MINOR}.${newbuild}";
|
||||||
|
$FILENAMEDEBSHORT="${PROJECT}_${MAJOR}.${MINOR}.${build}";
|
||||||
|
|
||||||
|
|
||||||
my $copyalreadydone=0;
|
my $copyalreadydone=0;
|
||||||
@ -389,10 +390,15 @@ if ($nboftargetok) {
|
|||||||
{
|
{
|
||||||
print 'Run git tag -a -f -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n";
|
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"`;
|
$ret=`git tag -a -f -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD"`;
|
||||||
|
print 'Run git push -f --tags'."\n";
|
||||||
|
$ret=`git push -f --tags`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
print 'Run git push --tags'."\n";
|
print 'Run git push --tags'."\n";
|
||||||
$ret=`git push --tags`;
|
$ret=`git push --tags`;
|
||||||
|
}
|
||||||
chdir("$olddir");
|
chdir("$olddir");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -824,7 +830,7 @@ if ($nboftargetok) {
|
|||||||
$ret=`$cmd`;
|
$ret=`$cmd`;
|
||||||
|
|
||||||
print "Remove other files\n";
|
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`;
|
||||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README-FR`;
|
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README-FR`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/aps`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/aps`;
|
||||||
@ -1127,6 +1133,7 @@ if ($nboftargetok) {
|
|||||||
%filestoscansf=(
|
%filestoscansf=(
|
||||||
"$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)',
|
"$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/${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/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)',
|
||||||
"$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM',
|
"$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM',
|
||||||
"$DESTI/standard/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM'
|
"$DESTI/standard/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM'
|
||||||
@ -1134,6 +1141,7 @@ if ($nboftargetok) {
|
|||||||
%filestoscanstableasso=(
|
%filestoscanstableasso=(
|
||||||
"$DESTI/package_rpm_generic/$FILENAMERPM"=>'package_rpm_generic',
|
"$DESTI/package_rpm_generic/$FILENAMERPM"=>'package_rpm_generic',
|
||||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'package_debian-ubuntu',
|
"$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/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'package_windows',
|
||||||
"$DESTI/standard/$FILENAMETGZ.tgz"=>'standard',
|
"$DESTI/standard/$FILENAMETGZ.tgz"=>'standard',
|
||||||
"$DESTI/standard/$FILENAMETGZ.zip"=>'standard'
|
"$DESTI/standard/$FILENAMETGZ.zip"=>'standard'
|
||||||
@ -1195,7 +1203,7 @@ if ($nboftargetok) {
|
|||||||
|
|
||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
if ($target eq 'SF') {
|
if ($target eq 'SF' && $filestoscan{$file} ne 'none') {
|
||||||
$destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD;
|
$destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD;
|
||||||
}
|
}
|
||||||
elsif ($target eq 'ASSO' and $NEWPUBLISH =~ /stable/) {
|
elsif ($target eq 'ASSO' and $NEWPUBLISH =~ /stable/) {
|
||||||
|
|||||||
@ -31,8 +31,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Recupere root dolibarr
|
// Recupere root dolibarr
|
||||||
$path=preg_replace('/generate-facture.php/i','',$_SERVER["PHP_SELF"]);
|
//$path=preg_replace('/generate-produit.php/i','',$_SERVER["PHP_SELF"]);
|
||||||
require ($path."../../htdocs/master.inc.php");
|
require (__DIR__. '/../../htdocs/master.inc.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.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
|
// Recupere root dolibarr
|
||||||
$path=preg_replace('/generate-commande.php/i','',$_SERVER["PHP_SELF"]);
|
//$path=preg_replace('/generate-commande.php/i','',$_SERVER["PHP_SELF"]);
|
||||||
require ($path."../../htdocs/master.inc.php");
|
require (__DIR__. '/../../htdocs/master.inc.php');
|
||||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.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.'/contact/class/contact.class.php';
|
||||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.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
|
// Recupere root dolibarr
|
||||||
$path=preg_replace('/generate-produit.php/i','',$_SERVER["PHP_SELF"]);
|
//$path=preg_replace('/generate-produit.php/i','',$_SERVER["PHP_SELF"]);
|
||||||
require ($path."../../htdocs/master.inc.php");
|
require (__DIR__. '/../../htdocs/master.inc.php');
|
||||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.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.'/contact/class/contact.class.php';
|
||||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.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
|
// Recupere root dolibarr
|
||||||
$path=preg_replace('/generate-propale.php/i','',$_SERVER["PHP_SELF"]);
|
//$path=preg_replace('/generate-propale.php/i','',$_SERVER["PHP_SELF"]);
|
||||||
require ($path."../../htdocs/master.inc.php");
|
require (__DIR__. '/../../htdocs/master.inc.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.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."/comm/propal/class/propal.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.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
|
// Recupere root dolibarr
|
||||||
$path=preg_replace('/generate-societe.php/i','',$_SERVER["PHP_SELF"]);
|
//$path=preg_replace('/generate-societe.php/i','',$_SERVER["PHP_SELF"]);
|
||||||
require ($path."../../htdocs/master.inc.php");
|
require (__DIR__. '/../../htdocs/master.inc.php');
|
||||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.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.'/contact/class/contact.class.php';
|
||||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env php
|
#!/usr/bin/env php
|
||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -56,7 +57,7 @@ $error=0;
|
|||||||
|
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
|
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];
|
$mode = $argv[1];
|
||||||
$filepath = $argv[2];
|
$filepath = $argv[2];
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env php
|
#!/usr/bin/env php
|
||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -56,7 +57,7 @@ $error=0;
|
|||||||
|
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
|
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];
|
$mode = $argv[1];
|
||||||
$filepath = $argv[2];
|
$filepath = $argv[2];
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env php
|
#!/usr/bin/env php
|
||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -56,7 +57,7 @@ $error=0;
|
|||||||
|
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
|
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];
|
$mode = $argv[1];
|
||||||
$filepath = $argv[2];
|
$filepath = $argv[2];
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env php
|
#!/usr/bin/env php
|
||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
@ -146,7 +146,7 @@ $sqls=array(
|
|||||||
|
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
|
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];
|
$mode = $argv[1];
|
||||||
$option = $argv[2];
|
$option = $argv[2];
|
||||||
@ -154,14 +154,14 @@ $option = $argv[2];
|
|||||||
if (empty($mode) || ! in_array($mode,array('test','confirm'))) {
|
if (empty($mode) || ! in_array($mode,array('test','confirm'))) {
|
||||||
print "Usage: $script_file (test|confirm) (all|option)\n";
|
print "Usage: $script_file (test|confirm) (all|option)\n";
|
||||||
print "\n";
|
print "\n";
|
||||||
print "option can be ".join(',',array_keys($sqls))."\n";
|
print "option can be ".implode(',',array_keys($sqls))."\n";
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($option) || ! in_array($option, array_merge(array('all'),array_keys($sqls))) ) {
|
if (empty($option) || ! in_array($option, array_merge(array('all'),array_keys($sqls))) ) {
|
||||||
print "Usage: $script_file (test|confirm) (all|option)\n";
|
print "Usage: $script_file (test|confirm) (all|option)\n";
|
||||||
print "\n";
|
print "\n";
|
||||||
print "option can be ".join(',',array_keys($sqls))."\n";
|
print "option can be ".implode(',',array_keys($sqls))."\n";
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* 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 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) ---Put here your own copyright and developer email---
|
* Copyright (C) ---Put here your own copyright and developer email---
|
||||||
@ -116,7 +116,7 @@ class Skeleton_Class extends CommonObject
|
|||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error ++;
|
$error ++;
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
@ -189,7 +189,7 @@ class Skeleton_Class extends CommonObject
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||||
|
|
||||||
return - 1;
|
return - 1;
|
||||||
}
|
}
|
||||||
@ -256,7 +256,7 @@ class Skeleton_Class extends CommonObject
|
|||||||
return $num;
|
return $num;
|
||||||
} else {
|
} else {
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||||
|
|
||||||
return - 1;
|
return - 1;
|
||||||
}
|
}
|
||||||
@ -301,7 +301,7 @@ class Skeleton_Class extends CommonObject
|
|||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error ++;
|
$error ++;
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$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) {
|
if (!$error && !$notrigger) {
|
||||||
@ -362,7 +362,7 @@ class Skeleton_Class extends CommonObject
|
|||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error ++;
|
$error ++;
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,7 +410,7 @@ class Skeleton_Class extends CommonObject
|
|||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error ++;
|
$error ++;
|
||||||
$this->errors = $object->errors;
|
$this->errors = $object->errors;
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// End
|
// End
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2007-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -292,7 +292,7 @@ if ($resql)
|
|||||||
if ($sall)
|
if ($sall)
|
||||||
{
|
{
|
||||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
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 = '';
|
$moreforfilter = '';
|
||||||
|
|||||||
@ -300,7 +300,7 @@ class autoTranslator
|
|||||||
//setting language pair
|
//setting language pair
|
||||||
$lang_pair = $src_lang.'|'.$dest_lang;
|
$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);
|
$src_text_to_translate=preg_replace('/'.preg_quote('\n\n').'/',' NNNNN ',$src_text_to_translate);
|
||||||
|
|
||||||
// Define GET URL v1
|
// Define GET URL v1
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (c) 2015 Tommaso Basilici <t.basilici@19.coop>
|
/* Copyright (c) 2015 Tommaso Basilici <t.basilici@19.coop>
|
||||||
* Copyright (c) 2015 Laurent Destailleur <eldy@destailleur.fr>
|
* 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -293,6 +294,10 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
|
|||||||
if (preg_match('/^Language_/', $value)) $qualifiedforclean=0;
|
if (preg_match('/^Language_/', $value)) $qualifiedforclean=0;
|
||||||
if (preg_match('/^DescADHERENT_/', $value)) $qualifiedforclean=0;
|
if (preg_match('/^DescADHERENT_/', $value)) $qualifiedforclean=0;
|
||||||
if (preg_match('/^SubmitTranslation/', $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;
|
||||||
// main.lang
|
// main.lang
|
||||||
if (preg_match('/^Duration/', $value)) $qualifiedforclean=0;
|
if (preg_match('/^Duration/', $value)) $qualifiedforclean=0;
|
||||||
if (preg_match('/^FormatDate/', $value)) $qualifiedforclean=0;
|
if (preg_match('/^FormatDate/', $value)) $qualifiedforclean=0;
|
||||||
@ -357,7 +362,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
|
|||||||
{
|
{
|
||||||
$filetosave='/tmp/'.($argv[2]?$argv[2]:"").'notused.lang';
|
$filetosave='/tmp/'.($argv[2]?$argv[2]:"").'notused.lang';
|
||||||
print "Strings in en_US that are never used are saved into file ".$filetosave.":\n";
|
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";
|
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; ";
|
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]:"");
|
print "diff ".($argv[2]?$argv[2]:"").".tmp ".$filetosave." | grep \< | cut -b 3- > ".($argv[2]?$argv[2]:"");
|
||||||
|
|||||||
@ -23,6 +23,7 @@
|
|||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Balance of book keeping
|
* \brief Balance of book keeping
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
// Class
|
// 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("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("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("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_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
@ -213,6 +214,9 @@ else {
|
|||||||
|
|
||||||
$total_debit = 0;
|
$total_debit = 0;
|
||||||
$total_credit = 0;
|
$total_credit = 0;
|
||||||
|
$sous_total_debit = 0;
|
||||||
|
$sous_total_credit = 0;
|
||||||
|
$displayed_account = "";
|
||||||
|
|
||||||
foreach ( $object->lines as $line ) {
|
foreach ( $object->lines as $line ) {
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
@ -220,11 +224,36 @@ else {
|
|||||||
$total_debit += $line->debit;
|
$total_debit += $line->debit;
|
||||||
$total_credit += $line->credit;
|
$total_credit += $line->credit;
|
||||||
$description = $object->get_compte_desc($line->numero_compte); // Search description of the account
|
$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)){
|
if(empty($description)){
|
||||||
$link = '<a href="../admin/card.php?action=create&compte=' . length_accountg($line->numero_compte) . '">' . img_edit_add() .'</a>';
|
$link = '<a href="../admin/card.php?action=create&compte=' . length_accountg($line->numero_compte) . '">' . img_edit_add() .'</a>';
|
||||||
}
|
}
|
||||||
print '<tr'. $bc[$var].'>';
|
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>' . length_accountg($line->numero_compte) . '</td>';
|
||||||
print '<td>' . $description . '</td>';
|
print '<td>' . $description . '</td>';
|
||||||
print '<td align="right">' . number_format($line->debit, 2, ',', ' ') . '</td>';
|
print '<td align="right">' . number_format($line->debit, 2, ',', ' ') . '</td>';
|
||||||
@ -233,21 +262,22 @@ else {
|
|||||||
print '<td align="center">' . $link;
|
print '<td align="center">' . $link;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
// Comptabilise le sous-total
|
||||||
|
$sous_total_debit += $line->debit;
|
||||||
|
$sous_total_credit += $line->credit;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="liste_total">';
|
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>';
|
print "<td> </td>\n";
|
||||||
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>';
|
||||||
|
|
||||||
|
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 "</table>";
|
||||||
print '</form>';
|
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);
|
$title_page = $langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end);
|
||||||
|
|
||||||
llxHeader('', $title_page);
|
llxHeader('', $title_page);
|
||||||
|
|
||||||
// List
|
// 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 '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||||
print '<div class="tabsAction">' . "\n";
|
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"><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"><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>';
|
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();
|
||||||
@ -109,8 +109,6 @@ class BookKeeping extends CommonObject
|
|||||||
public function create(User $user, $notrigger = false) {
|
public function create(User $user, $notrigger = false) {
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
global $langs;
|
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
@ -168,11 +166,11 @@ class BookKeeping extends CommonObject
|
|||||||
// first check if line not yet in bookkeeping
|
// first check if line not yet in bookkeeping
|
||||||
$sql = "SELECT count(*) as nb";
|
$sql = "SELECT count(*) as nb";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sql .= " WHERE doc_type = '" . $this->db->escape($this->doc_type) . "'";
|
$sql .= " WHERE doc_type = '" . $this->doc_type . "'";
|
||||||
$sql .= " AND fk_docdet = " . $this->fk_docdet;
|
$sql .= " AND fk_docdet = " . $this->fk_docdet;
|
||||||
$sql .= " AND numero_compte = '" . $this->db->escape($this->numero_compte) . "'";
|
$sql .= " AND numero_compte = '" . $this->numero_compte . "'";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . ":: create ", LOG_DEBUG);
|
dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
@ -204,12 +202,11 @@ class BookKeeping extends CommonObject
|
|||||||
$this->piece_num = $objnum->maxpiecenum;
|
$this->piece_num = $objnum->maxpiecenum;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dol_syslog(get_class($this) . ":: create this->piece_num=" . $this->piece_num, LOG_DEBUG);
|
||||||
if (empty($this->piece_num)) {
|
if (empty($this->piece_num)) {
|
||||||
$this->piece_num = 1;
|
$this->piece_num = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this) . ":: create this->piece_num=" . $this->piece_num, LOG_DEBUG);
|
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
if (empty($this->date_create)) {
|
if (empty($this->date_create)) {
|
||||||
$this->date_create = $now;
|
$this->date_create = $now;
|
||||||
@ -236,26 +233,26 @@ class BookKeeping extends CommonObject
|
|||||||
|
|
||||||
$sql .= ") VALUES (";
|
$sql .= ") VALUES (";
|
||||||
|
|
||||||
$sql .= "'" . $this->db->idate($this->doc_date) . "'";
|
$sql .= "'" . $this->doc_date . "'";
|
||||||
$sql .= ",'" . $this->db->escape($this->doc_type) . "'";
|
$sql .= ",'" . $this->doc_type . "'";
|
||||||
$sql .= ",'" . $this->db->escape($this->doc_ref) . "'";
|
$sql .= ",'" . $this->doc_ref . "'";
|
||||||
$sql .= "," . $this->fk_doc;
|
$sql .= "," . $this->fk_doc;
|
||||||
$sql .= "," . $this->fk_docdet;
|
$sql .= "," . $this->fk_docdet;
|
||||||
$sql .= ",'" . $this->db->escape($this->code_tiers) . "'";
|
$sql .= ",'" . $this->code_tiers . "'";
|
||||||
$sql .= ",'" . $this->db->escape($this->numero_compte) . "'";
|
$sql .= ",'" . $this->numero_compte . "'";
|
||||||
$sql .= ",'" . $this->db->escape($this->label_compte) . "'";
|
$sql .= ",'" . $this->db->escape($this->label_compte) . "'";
|
||||||
$sql .= "," . $this->debit;
|
$sql .= "," . $this->debit;
|
||||||
$sql .= "," . $this->credit;
|
$sql .= "," . $this->credit;
|
||||||
$sql .= "," . $this->montant;
|
$sql .= "," . $this->montant;
|
||||||
$sql .= ",'" . $this->db->escape($this->sens) . "'";
|
$sql .= ",'" . $this->sens . "'";
|
||||||
$sql .= ",'" . $this->fk_user_author . "'";
|
$sql .= ",'" . $this->fk_user_author . "'";
|
||||||
$sql .= ",'" . $this->date_create . "'";
|
$sql .= ",'" . $this->date_create . "'";
|
||||||
$sql .= ",'" . $this->db->escape($this->code_journal) . "'";
|
$sql .= ",'" . $this->code_journal . "'";
|
||||||
$sql .= "," . $this->piece_num;
|
$sql .= "," . $this->piece_num;
|
||||||
|
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . ":: create", LOG_DEBUG);
|
dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
$id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
||||||
@ -267,25 +264,25 @@ class BookKeeping extends CommonObject
|
|||||||
$result = - 2;
|
$result = - 2;
|
||||||
$error ++;
|
$error ++;
|
||||||
$this->errors[] = 'Error Create Error ' . $result . ' lecture ID';
|
$this->errors[] = 'Error Create Error ' . $result . ' lecture ID';
|
||||||
dol_syslog(__METHOD__ . ' $result='.$result.' ' . implode(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$result = - 1;
|
$result = - 1;
|
||||||
$error ++;
|
$error ++;
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' $result='.$result.' ' . implode(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$result = - 3;
|
$result = - 3;
|
||||||
$error ++;
|
$error ++;
|
||||||
$this->errors[] = $langs->trans('BookeppingLineAlreayExists');
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' $result='.$result.' ' . implode(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$result = - 5;
|
$result = - 5;
|
||||||
$error ++;
|
$error ++;
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' $result='.$result.' '. implode(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
@ -531,6 +528,118 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load object in memory from the database
|
||||||
|
*
|
||||||
|
* @param string $sortorder Sort Order
|
||||||
|
* @param string $sortfield Sort field
|
||||||
|
* @param int $limit offset limit
|
||||||
|
* @param int $offset offset limit
|
||||||
|
* @param array $filter filter array
|
||||||
|
* @param string $filtermode filter mode (AND or OR)
|
||||||
|
*
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') {
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
|
$sql = 'SELECT';
|
||||||
|
$sql .= ' t.rowid,';
|
||||||
|
|
||||||
|
$sql .= " t.doc_date,";
|
||||||
|
$sql .= " t.doc_type,";
|
||||||
|
$sql .= " t.doc_ref,";
|
||||||
|
$sql .= " t.fk_doc,";
|
||||||
|
$sql .= " t.fk_docdet,";
|
||||||
|
$sql .= " t.code_tiers,";
|
||||||
|
$sql .= " t.numero_compte,";
|
||||||
|
$sql .= " t.label_compte,";
|
||||||
|
$sql .= " t.debit,";
|
||||||
|
$sql .= " t.credit,";
|
||||||
|
$sql .= " t.montant,";
|
||||||
|
$sql .= " t.sens,";
|
||||||
|
$sql .= " t.fk_user_author,";
|
||||||
|
$sql .= " t.import_key,";
|
||||||
|
$sql .= " t.code_journal,";
|
||||||
|
$sql .= " t.piece_num";
|
||||||
|
|
||||||
|
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||||
|
|
||||||
|
// Manage filter
|
||||||
|
$sqlwhere = array ();
|
||||||
|
if (count($filter) > 0) {
|
||||||
|
foreach ( $filter as $key => $value ) {
|
||||||
|
if ($key == 't.doc_date') {
|
||||||
|
$sqlwhere[] = $key . '=\'' . $this->db->idate($value) . '\'';
|
||||||
|
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
|
||||||
|
$sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\'';
|
||||||
|
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.code_tiers>=' || $key == 't.code_tiers<=') {
|
||||||
|
$sqlwhere[] = $key . '\'' . $this->db->escape($value) . '\'';
|
||||||
|
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
|
||||||
|
$sqlwhere[] = $key . '=' . $value;
|
||||||
|
} elseif ($key == 't.code_tiers' || $key == 't.numero_compte') {
|
||||||
|
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
|
||||||
|
} elseif ($key == 't.label_compte') {
|
||||||
|
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
|
||||||
|
}else {
|
||||||
|
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($sqlwhere) > 0) {
|
||||||
|
$sql .= ' WHERE ' . implode(' ' . $filtermode . ' ', $sqlwhere);
|
||||||
|
}
|
||||||
|
// Affichage par compte comptable
|
||||||
|
$sql .= ' ORDER BY t.numero_compte ASC';
|
||||||
|
if (! empty($sortfield)) {
|
||||||
|
$sql .= ', ' . $sortfield . ' ' .$sortorder;
|
||||||
|
}
|
||||||
|
if (! empty($limit)) {
|
||||||
|
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||||
|
}
|
||||||
|
$this->lines = array ();
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
|
||||||
|
while ( $obj = $this->db->fetch_object($resql) ) {
|
||||||
|
$line = new BookKeepingLine();
|
||||||
|
|
||||||
|
$line->id = $obj->rowid;
|
||||||
|
|
||||||
|
$line->doc_date = $this->db->jdate($obj->doc_date);
|
||||||
|
$line->doc_type = $obj->doc_type;
|
||||||
|
$line->doc_ref = $obj->doc_ref;
|
||||||
|
$line->fk_doc = $obj->fk_doc;
|
||||||
|
$line->fk_docdet = $obj->fk_docdet;
|
||||||
|
$line->code_tiers = $obj->code_tiers;
|
||||||
|
$line->numero_compte = $obj->numero_compte;
|
||||||
|
$line->label_compte = $obj->label_compte;
|
||||||
|
$line->debit = $obj->debit;
|
||||||
|
$line->credit = $obj->credit;
|
||||||
|
$line->montant = $obj->montant;
|
||||||
|
$line->sens = $obj->sens;
|
||||||
|
$line->fk_user_author = $obj->fk_user_author;
|
||||||
|
$line->import_key = $obj->import_key;
|
||||||
|
$line->code_journal = $obj->code_journal;
|
||||||
|
$line->piece_num = $obj->piece_num;
|
||||||
|
|
||||||
|
$this->lines[] = $line;
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
|
||||||
|
return $num;
|
||||||
|
} else {
|
||||||
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
|
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load object in memory from the database
|
* Load object in memory from the database
|
||||||
*
|
*
|
||||||
@ -947,49 +1056,6 @@ class BookKeeping extends CommonObject
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete bookkepping by year
|
|
||||||
*
|
|
||||||
* @param string $delyear year to delete
|
|
||||||
* @param string $deljournal journal to delete
|
|
||||||
* @return int Result
|
|
||||||
*/
|
|
||||||
function deleteByYearAndJournal($delyear,$deljournal) {
|
|
||||||
$this->db->begin();
|
|
||||||
|
|
||||||
$sqlwhere=array();
|
|
||||||
|
|
||||||
// first check if line not yet in bookkeeping
|
|
||||||
$sql = "DELETE";
|
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
|
||||||
if (!empty($delyear)) {
|
|
||||||
$sqlwhere[] .= " YEAR(doc_date) = " . $delyear;
|
|
||||||
}
|
|
||||||
if (!empty($deljournal)) {
|
|
||||||
$sqlwhere[] .= " code_journal = '" . $this->db->escape($deljournal)."'";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($sqlwhere)>0) {
|
|
||||||
$sql.=" WHERE ".implode(' AND ', $sqlwhere);
|
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
|
||||||
|
|
||||||
if (! $resql) {
|
|
||||||
$this->errors[] = "Error " . $this->db->lasterror();
|
|
||||||
foreach ( $this->errors as $errmsg ) {
|
|
||||||
dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR);
|
|
||||||
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
|
|
||||||
}
|
|
||||||
$this->db->rollback();
|
|
||||||
return - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->db->commit();
|
|
||||||
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete bookkepping by piece number
|
* Delete bookkepping by piece number
|
||||||
*
|
*
|
||||||
@ -1248,6 +1314,122 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return list of accounts with label by chart of accounts
|
||||||
|
*
|
||||||
|
* @param string $selectid Preselected chart of accounts
|
||||||
|
* @param string $htmlname Name of field in html form
|
||||||
|
* @param int $showempty Add an empty field
|
||||||
|
* @param array $event Event options
|
||||||
|
* @param int $select_in $selectid value is a aa.rowid (0 default) or aa.account_number (1)
|
||||||
|
* @param int $select_out set value returned by select 0=rowid (default), 1=account_number
|
||||||
|
* @param int $aabase set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number
|
||||||
|
*
|
||||||
|
* @return string String with HTML select
|
||||||
|
*/
|
||||||
|
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') {
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
|
||||||
|
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||||
|
|
||||||
|
$sql = "SELECT DISTINCT ab.numero_compte as account_number, aa.label as label, aa.rowid as rowid, aa.fk_pcg_version";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab";
|
||||||
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = ab.numero_compte";
|
||||||
|
$sql .= " AND aa.active = 1";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||||
|
$sql .= " AND asy.rowid = " . $pcgver;
|
||||||
|
$sql .= " ORDER BY account_number ASC";
|
||||||
|
|
||||||
|
dol_syslog(get_class($this) . "::select_account", LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
|
if (!$resql) {
|
||||||
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
|
dol_syslog(get_class($this) . "::select_account " . $this->error, LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$out = ajax_combobox($htmlname, $event);
|
||||||
|
|
||||||
|
$options = array();
|
||||||
|
$selected = null;
|
||||||
|
|
||||||
|
while ($obj = $this->db->fetch_object($resql)) {
|
||||||
|
$label = length_accountg($obj->account_number) . ' - ' . $obj->label;
|
||||||
|
$label = dol_trunc($label, $trunclength);
|
||||||
|
|
||||||
|
$select_value_in = $obj->rowid;
|
||||||
|
$select_value_out = $obj->rowid;
|
||||||
|
|
||||||
|
if ($select_in == 1) {
|
||||||
|
$select_value_in = $obj->account_number;
|
||||||
|
}
|
||||||
|
if ($select_out == 1) {
|
||||||
|
$select_value_out = $obj->account_number;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number
|
||||||
|
// Because same account_number can be share between different accounting_system and do have the same meaning
|
||||||
|
if (($selectid != '') && $selectid == $select_value_in) {
|
||||||
|
$selected = $select_value_out;
|
||||||
|
}
|
||||||
|
|
||||||
|
$options[$select_value_out] = $label;
|
||||||
|
}
|
||||||
|
|
||||||
|
$out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300');
|
||||||
|
$this->db->free($resql);
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description of a root accounting account
|
||||||
|
*
|
||||||
|
* @param string $account Accounting account
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function get_compte_racine($account = null)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||||
|
|
||||||
|
|
||||||
|
$sql = "SELECT root.account_number, root.label as label";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||||
|
$sql .= " AND asy.rowid = " . $pcgver;
|
||||||
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as parent ON aa.account_parent = parent.rowid";
|
||||||
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as root ON parent.account_parent = root.rowid";
|
||||||
|
$sql .= " WHERE aa.account_number = '" . $account . "'";
|
||||||
|
$sql .= " AND parent.active = 1";
|
||||||
|
$sql .= " AND root.active = 1";
|
||||||
|
|
||||||
|
|
||||||
|
dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$obj = '';
|
||||||
|
if ($this->db->num_rows($resql)) {
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $obj->label;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
|
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description of accounting account
|
* Description of accounting account
|
||||||
*
|
*
|
||||||
@ -1258,7 +1440,6 @@ class BookKeeping extends CommonObject
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||||
|
|
||||||
$sql = "SELECT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version, cat.label as category";
|
$sql = "SELECT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version, cat.label as category";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa ";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa ";
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||||
@ -1266,7 +1447,6 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " AND asy.rowid = " . $pcgver;
|
$sql .= " AND asy.rowid = " . $pcgver;
|
||||||
$sql .= " AND aa.active = 1";
|
$sql .= " AND aa.active = 1";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
@ -1284,7 +1464,6 @@ class BookKeeping extends CommonObject
|
|||||||
} else {
|
} else {
|
||||||
$this->error = "Error " . $this->db->lasterror();
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
/* 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -16,12 +17,12 @@
|
|||||||
*/
|
*/
|
||||||
$prefix = $conf->global->ACCOUNTING_EXPORT_PREFIX_SPEC;
|
$prefix = $conf->global->ACCOUNTING_EXPORT_PREFIX_SPEC;
|
||||||
$format = $conf->global->ACCOUNTING_EXPORT_FORMAT;
|
$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');
|
$date_export = dol_print_date($now, '%Y%m%d%H%M%S');
|
||||||
|
|
||||||
header('Content-Type: text/csv');
|
header('Content-Type: text/csv');
|
||||||
if ($prefix)
|
|
||||||
$filename = $prefix . "_" . "journal_" . $journal . $date_export . "." . $format;
|
$filename = ($prefix?$prefix . "_":""). "journal_" . $journal . ($nodateexport?"":$date_export) . "." . $format;
|
||||||
else
|
|
||||||
$filename = "journal_" . $journal . $date_export . "." . $format;
|
|
||||||
header('Content-Disposition: attachment;filename=' . $filename);
|
header('Content-Disposition: attachment;filename=' . $filename);
|
||||||
@ -9,6 +9,7 @@
|
|||||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -353,7 +354,7 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
if (count($this->errors))
|
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();
|
$this->db->rollback();
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -83,7 +84,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search
|
|||||||
// List of fields to search into when doing a "search in all"
|
// List of fields to search into when doing a "search in all"
|
||||||
$fieldstosearchall = array(
|
$fieldstosearchall = array(
|
||||||
'd.rowid'=>'Ref',
|
'd.rowid'=>'Ref',
|
||||||
//'d.ref'=>'Ref',
|
'd.login'=>'Login',
|
||||||
'd.lastname'=>'Lastname',
|
'd.lastname'=>'Lastname',
|
||||||
'd.firstname'=>'Firstname',
|
'd.firstname'=>'Firstname',
|
||||||
'd.login'=>'Login',
|
'd.login'=>'Login',
|
||||||
@ -328,7 +329,7 @@ if ($resql)
|
|||||||
if ($sall)
|
if ($sall)
|
||||||
{
|
{
|
||||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
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
|
// Filter on categories
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* 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-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
||||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@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';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||||
$formmail=new FormMail($db);
|
$formmail=new FormMail($db);
|
||||||
$tmp=$formmail->getAvailableSubstitKey('form');
|
$tmp=$formmail->getAvailableSubstitKey('form');
|
||||||
print join(', ', $tmp);
|
print implode(', ', $tmp);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -372,7 +372,6 @@ else
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Name").'</td>';
|
print '<td>'.$langs->trans("Name").'</td>';
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -75,28 +76,28 @@ if ($action == 'update')
|
|||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"],'chaine',0,'',$conf->entity);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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_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);
|
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) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -437,7 +437,7 @@ if (function_exists("ldap_connect"))
|
|||||||
print "search: *<br>\n";
|
print "search: *<br>\n";
|
||||||
print "userDN: ".$conf->global->LDAP_USER_DN."<br>\n";
|
print "userDN: ".$conf->global->LDAP_USER_DN."<br>\n";
|
||||||
print "useridentifier: ".$conf->global->LDAP_KEY_USERS."<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 "=> ".count($liste)." records<br>\n";
|
||||||
print "\n<br>";
|
print "\n<br>";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -243,7 +243,7 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == 'yes')
|
|||||||
{
|
{
|
||||||
$this->db->begin();
|
$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);
|
$db->query($sql);
|
||||||
|
|
||||||
if ($result == 0)
|
if ($result == 0)
|
||||||
@ -312,7 +312,7 @@ if ($action == 'create')
|
|||||||
$parent_rowid = $_GET['menuId'];
|
$parent_rowid = $_GET['menuId'];
|
||||||
if ($_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);
|
$res = $db->query($sql);
|
||||||
if ($res)
|
if ($res)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -118,7 +118,11 @@ llxHeader('',$langs->trans("NotificationSetup"));
|
|||||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
print load_fiche_titre($langs->trans("NotificationSetup"),$linkback,'title_setup');
|
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 '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
@ -141,18 +145,19 @@ print '</td>';
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br><br>';
|
||||||
|
|
||||||
|
|
||||||
if ($conf->societe->enabled)
|
// Notification per contacts
|
||||||
{
|
$title=$langs->trans("ListOfNotificationsPerUser");
|
||||||
print load_fiche_titre($langs->trans("ListOfNotificationsPerContact"),'','');
|
if (! empty($conf->societe->enabled)) $title=$langs->trans("ListOfNotificationsPerUserOrContact");
|
||||||
|
print load_fiche_titre($title,'','');
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
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>'.$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 '<td align="right">'.$langs->trans("NbOfTargetedContacts").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
@ -160,7 +165,11 @@ if ($conf->societe->enabled)
|
|||||||
$notificationtrigger=new InterfaceNotification($db);
|
$notificationtrigger=new InterfaceNotification($db);
|
||||||
$listofnotifiedevents=$notificationtrigger->getListOfManagedEvents();
|
$listofnotifiedevents=$notificationtrigger->getListOfManagedEvents();
|
||||||
|
|
||||||
|
print '<tr '.$bc[$var].'>';
|
||||||
|
print '<td>';
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
|
$i=0;
|
||||||
foreach($listofnotifiedevents as $notifiedevent)
|
foreach($listofnotifiedevents as $notifiedevent)
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
@ -172,21 +181,17 @@ if ($conf->societe->enabled)
|
|||||||
elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order');
|
elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order');
|
||||||
elseif ($notifiedevent['elementtype'] == 'ficheinter') $elementLabel = $langs->trans('Intervention');
|
elseif ($notifiedevent['elementtype'] == 'ficheinter') $elementLabel = $langs->trans('Intervention');
|
||||||
|
|
||||||
print '<tr '.$bc[$var].'>';
|
if ($i) print ', ';
|
||||||
print '<td>'.$elementLabel.'</td>';
|
print $label;
|
||||||
print '<td>'.$notifiedevent['code'].'</td>';
|
|
||||||
print '<td>'.$label.'</td>';
|
$i++;
|
||||||
/*print '<td align="right">';
|
|
||||||
$tmparray = $notify->getNotificationsArray($notifiedevent['code'], 0);
|
|
||||||
print count($tmparray);
|
|
||||||
print '</td>';*/
|
|
||||||
print '</tr>';
|
|
||||||
}
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '* '.$langs->trans("GoOntoContactCardToAddMore").'<br>';
|
print '* '.$langs->trans("GoOntoUserCardToAddMore").'<br>';
|
||||||
print '<br>';
|
if (! empty($conf->societe->enabled)) print '** '.$langs->trans("GoOntoContactCardToAddMore").'<br>';
|
||||||
}
|
print '<br><br>';
|
||||||
|
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("ListOfFixedNotifications"),'','');
|
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);
|
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
|
* View
|
||||||
@ -215,6 +231,33 @@ foreach ($dirmodels as $reldir)
|
|||||||
|
|
||||||
print '</table>';
|
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();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -49,6 +49,10 @@ if($action)
|
|||||||
{
|
{
|
||||||
$res = dolibarr_set_const($db, "STOCK_USERSTOCK_AUTOCREATE", GETPOST('STOCK_USERSTOCK_AUTOCREATE','alpha'),'chaine',0,'',$conf->entity);
|
$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
|
// Mode of stock decrease
|
||||||
if ($action == 'STOCK_CALCULATE_ON_BILL'
|
if ($action == 'STOCK_CALCULATE_ON_BILL'
|
||||||
|| $action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER'
|
|| $action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER'
|
||||||
@ -319,9 +323,6 @@ $found++;
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
// 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 '<br>';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -329,6 +330,20 @@ if ($conf->invoice->enabled || $conf->order->enabled || $conf->expedition->enabl
|
|||||||
print " <td align=\"right\" width=\"160\"> </td>\n";
|
print " <td align=\"right\" width=\"160\"> </td>\n";
|
||||||
print '</tr>'."\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) {
|
if($conf->invoice->enabled) {
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
@ -374,7 +389,6 @@ if ($conf->invoice->enabled || $conf->order->enabled || $conf->expedition->enabl
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
|
||||||
|
|
||||||
$virtualdiffersfromphysical=0;
|
$virtualdiffersfromphysical=0;
|
||||||
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|
||||||
@ -427,6 +441,7 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<br>';
|
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.
|
/* 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) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -87,9 +88,9 @@ foreach($phparray as $key => $value)
|
|||||||
$valtoshow=$keyvalue;
|
$valtoshow=$keyvalue;
|
||||||
if ($keyparam == 'X-ChromePhp-Data') $valtoshow=dol_trunc($keyvalue,80);
|
if ($keyparam == 'X-ChromePhp-Data') $valtoshow=dol_trunc($keyvalue,80);
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
if ($keyparam == 'Path') $valtoshow=join('; ',explode(';',trim($valtoshow)));
|
if ($keyparam == 'Path') $valtoshow=implode('; ',explode(';',trim($valtoshow)));
|
||||||
if ($keyparam == 'PATH') $valtoshow=join('; ',explode(';',trim($valtoshow)));
|
if ($keyparam == 'PATH') $valtoshow=implode('; ',explode(';',trim($valtoshow)));
|
||||||
if ($keyparam == '_SERVER["PATH"]') $valtoshow=join('; ',explode(';',trim($valtoshow)));
|
if ($keyparam == '_SERVER["PATH"]') $valtoshow=implode('; ',explode(';',trim($valtoshow)));
|
||||||
print $valtoshow;
|
print $valtoshow;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -104,7 +105,7 @@ foreach($phparray as $key => $value)
|
|||||||
{
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$valtoshow=$keyvalue2;
|
$valtoshow=$keyvalue2;
|
||||||
if ($keyparam == 'disable_functions') $valtoshow=join(', ',explode(',',trim($valtoshow)));
|
if ($keyparam == 'disable_functions') $valtoshow=implode(', ',explode(',',trim($valtoshow)));
|
||||||
//print $keyparam;
|
//print $keyparam;
|
||||||
print $valtoshow;
|
print $valtoshow;
|
||||||
$i++;
|
$i++;
|
||||||
|
|||||||
@ -1096,19 +1096,34 @@ class ActionComm extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto=0)
|
function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto=0)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs, $hookmanager;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
$tooltip = '<u>' . $langs->trans('ShowAction'.$objp->code) . '</u>';
|
$tooltip = '<u>' . $langs->trans('ShowAction'.$objp->code) . '</u>';
|
||||||
if (! empty($this->ref))
|
if (! empty($this->ref))
|
||||||
$tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $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;
|
$label = $this->label;
|
||||||
if (empty($label)) $label=$this->libelle; // For backward compatibility
|
if (empty($label)) $label=$this->libelle; // For backward compatibility
|
||||||
$linkclose = '" title="'.dol_escape_htmltag($tooltip, 1).'">';
|
if (! empty($label))
|
||||||
if ($option=='birthday') $link = '<a class="'.$classname.' classfortooltip" href="'.DOL_URL_ROOT.'/contact/perso.php?id='.$this->id.$linkclose;
|
$tooltip .= '<br><b>' . $langs->trans('Title') . ':</b> ' . $label;
|
||||||
else $link = '<a class="'.$classname.' classfortooltip" href="'.DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id.$linkclose;
|
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>';
|
$linkend='</a>';
|
||||||
//print 'rrr'.$this->libelle.'-'.$withpicto;
|
//print 'rrr'.$this->libelle.'-'.$withpicto;
|
||||||
|
|
||||||
|
|||||||
@ -186,7 +186,7 @@ $week = $prev['week'];
|
|||||||
|
|
||||||
$day = (int) $day;
|
$day = (int) $day;
|
||||||
$next = dol_get_next_day($day, $month, $year);
|
$next = dol_get_next_day($day, $month, $year);
|
||||||
$next_year = year + 1;
|
$next_year = $year + 1;
|
||||||
$next_month = $month;
|
$next_month = $month;
|
||||||
$next_day = $day;
|
$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';
|
if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
|
||||||
|
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
$langs->load('banks');
|
||||||
|
|
||||||
if (! empty($conf->contrat->enabled)) $langs->load("contracts");
|
if (! empty($conf->contrat->enabled)) $langs->load("contracts");
|
||||||
if (! empty($conf->commande->enabled)) $langs->load("orders");
|
if (! empty($conf->commande->enabled)) $langs->load("orders");
|
||||||
if (! empty($conf->expedition->enabled)) $langs->load("sendings");
|
if (! empty($conf->expedition->enabled)) $langs->load("sendings");
|
||||||
@ -124,6 +126,14 @@ if (empty($reshook))
|
|||||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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
|
// customer preferred shipping method
|
||||||
if ($action == 'setshippingmethod' && $user->rights->societe->creer)
|
if ($action == 'setshippingmethod' && $user->rights->societe->creer)
|
||||||
{
|
{
|
||||||
@ -337,6 +347,26 @@ if ($id > 0)
|
|||||||
print "</td>";
|
print "</td>";
|
||||||
print '</tr>';
|
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)
|
// Relative discounts (Discounts-Drawbacks-Rebates)
|
||||||
print '<tr><td class="nowrap">';
|
print '<tr><td class="nowrap">';
|
||||||
print '<table width="100%" class="nobordernopadding"><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
|
else
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$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>";
|
print "</table><br>";
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$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>";
|
print "</table><br>";
|
||||||
|
|
||||||
@ -357,7 +357,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$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>";
|
print "</table><br>";
|
||||||
|
|
||||||
@ -438,7 +438,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$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>";
|
print "</table><br>";
|
||||||
|
|
||||||
|
|||||||
@ -2417,7 +2417,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
// Tableau des substitutions
|
// Tableau des substitutions
|
||||||
$formmail->setSubstitFromObject($object);
|
$formmail->setSubstitFromObject($object);
|
||||||
$formmail->substit['__PROPREF__'] = $object->ref;
|
$formmail->substit['__PROPREF__'] = $object->ref; // For backward compatibility
|
||||||
|
|
||||||
// Find the good contact adress
|
// Find the good contact adress
|
||||||
$custcontact = '';
|
$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->societe->creer)
|
||||||
//if ($user->rights->facture->creer)
|
//if ($user->rights->facture->creer)
|
||||||
@ -267,9 +267,15 @@ if ($socid > 0)
|
|||||||
print '<tr><td class="titlefield">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>';
|
print '<tr><td class="titlefield">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>';
|
||||||
print '<td>'.$remise_all.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
|
print '<td>'.$remise_all.' '.$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 '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>';
|
||||||
print '<td>'.$remise_user.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
|
print '<td>'.$remise_user.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
|
||||||
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
if ($user->rights->societe->creer)
|
||||||
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("NewGlobalDiscount"),'','');
|
print load_fiche_titre($langs->trans("NewGlobalDiscount"),'','');
|
||||||
@ -285,11 +291,13 @@ if ($socid > 0)
|
|||||||
print '<td><input type="text" size="60" name="desc" value="'.GETPOST('desc').'"></td></tr>';
|
print '<td><input type="text" size="60" name="desc" value="'.GETPOST('desc').'"></td></tr>';
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
if ($user->rights->societe->creer)
|
||||||
|
{
|
||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">';
|
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">';
|
||||||
if (! empty($backtopage))
|
if (! empty($backtopage))
|
||||||
@ -298,6 +306,7 @@ if ($socid > 0)
|
|||||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||||
}
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
@ -425,7 +434,7 @@ if ($socid > 0)
|
|||||||
print '<br>';
|
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
|
// Remises liees a lignes de factures
|
||||||
|
|||||||
@ -523,7 +523,7 @@ if (empty($reshook))
|
|||||||
else if ($action == 'setmode' && $user->rights->commande->creer) {
|
else if ($action == 'setmode' && $user->rights->commande->creer) {
|
||||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
dol_print_error($db, $object->error);
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Multicurrency Code
|
// Multicurrency Code
|
||||||
@ -539,13 +539,13 @@ if (empty($reshook))
|
|||||||
else if ($action == 'setavailability' && $user->rights->commande->creer) {
|
else if ($action == 'setavailability' && $user->rights->commande->creer) {
|
||||||
$result = $object->availability(GETPOST('availability_id'));
|
$result = $object->availability(GETPOST('availability_id'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
dol_print_error($db, $object->error);
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setdemandreason' && $user->rights->commande->creer) {
|
else if ($action == 'setdemandreason' && $user->rights->commande->creer) {
|
||||||
$result = $object->demand_reason(GETPOST('demand_reason_id'));
|
$result = $object->demand_reason(GETPOST('demand_reason_id'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
dol_print_error($db, $object->error);
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setconditions' && $user->rights->commande->creer) {
|
else if ($action == 'setconditions' && $user->rights->commande->creer) {
|
||||||
|
|||||||
@ -57,97 +57,99 @@ class Commande extends CommonOrder
|
|||||||
* Client ID
|
* Client ID
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
var $socid;
|
public $socid;
|
||||||
|
|
||||||
var $ref_client;
|
public $ref_client;
|
||||||
var $ref_int;
|
public $ref_int;
|
||||||
var $contactid;
|
public $contactid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Status of the order. Check the following constants:
|
* Status of the order. Check the following constants:
|
||||||
* @var int
|
* @var int
|
||||||
* @see Commande::STATUS_CANCELED, Commande::STATUS_DRAFT, Commande::STATUS_ACCEPTED, Commande::STATUS_CLOSED
|
* @see Commande::STATUS_CANCELED, Commande::STATUS_DRAFT, Commande::STATUS_ACCEPTED, Commande::STATUS_CLOSED
|
||||||
*/
|
*/
|
||||||
var $statut;
|
public $statut;
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
* @see billed
|
* @see billed
|
||||||
*/
|
*/
|
||||||
var $facturee;
|
public $facturee;
|
||||||
var $billed; // billed or not
|
public $billed; // billed or not
|
||||||
|
|
||||||
var $brouillon;
|
public $brouillon;
|
||||||
var $cond_reglement_code;
|
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.
|
* It holds the label of the payment mode. Use it in case translation cannot be found.
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $mode_reglement;
|
public $mode_reglement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Payment mode id
|
* Payment mode id
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
var $mode_reglement_id;
|
public $mode_reglement_id;
|
||||||
/**
|
/**
|
||||||
* Payment mode code
|
* Payment mode code
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $mode_reglement_code;
|
public $mode_reglement_code;
|
||||||
/**
|
/**
|
||||||
* Availability delivery time id
|
* Availability delivery time id
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
var $availability_id;
|
public $availability_id;
|
||||||
/**
|
/**
|
||||||
* Availability delivery time code
|
* Availability delivery time code
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $availability_code;
|
public $availability_code;
|
||||||
/**
|
/**
|
||||||
* Label of availability delivery time. Use it in case translation cannot be found.
|
* Label of availability delivery time. Use it in case translation cannot be found.
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $availability;
|
public $availability;
|
||||||
|
|
||||||
var $demand_reason_id;
|
public $demand_reason_id;
|
||||||
var $demand_reason_code;
|
public $demand_reason_code;
|
||||||
var $address;
|
public $address;
|
||||||
var $date; // Date commande
|
public $date; // Date commande
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
* @see date
|
* @see date
|
||||||
*/
|
*/
|
||||||
var $date_commande;
|
public $date_commande;
|
||||||
var $date_livraison; // Date livraison souhaitee
|
public $date_livraison; // Date livraison souhaitee
|
||||||
var $fk_remise_except;
|
public $fk_remise_except;
|
||||||
var $remise_percent;
|
public $remise_percent;
|
||||||
var $remise_absolue;
|
public $remise_absolue;
|
||||||
var $info_bits;
|
public $info_bits;
|
||||||
var $rang;
|
public $rang;
|
||||||
var $special_code;
|
public $special_code;
|
||||||
var $source; // Origin of order
|
public $source; // Origin of order
|
||||||
var $extraparams=array();
|
public $extraparams=array();
|
||||||
|
|
||||||
var $linked_objects=array();
|
public $linked_objects=array();
|
||||||
|
|
||||||
var $user_author_id;
|
public $user_author_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var OrderLine[]
|
* @var OrderLine[]
|
||||||
*/
|
*/
|
||||||
var $lines = array();
|
public $lines = array();
|
||||||
|
|
||||||
// Multicurrency
|
// Multicurrency
|
||||||
var $fk_multicurrency;
|
public $fk_multicurrency;
|
||||||
var $multicurrency_code;
|
public $multicurrency_code;
|
||||||
var $multicurrency_tx;
|
public $multicurrency_tx;
|
||||||
var $multicurrency_total_ht;
|
public $multicurrency_total_ht;
|
||||||
var $multicurrency_total_tva;
|
public $multicurrency_total_tva;
|
||||||
var $multicurrency_total_ttc;
|
public $multicurrency_total_ttc;
|
||||||
|
|
||||||
|
public $oldcopy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ERR Not enough stock
|
* ERR Not enough stock
|
||||||
@ -469,7 +471,7 @@ class Commande extends CommonOrder
|
|||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('ORDER_SETDRAFT',$user);
|
$result=$this->call_trigger('ORDER_UNVALIDATE',$user);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2044,30 +2046,62 @@ class Commande extends CommonOrder
|
|||||||
*
|
*
|
||||||
* @param User $user User qui positionne la remise
|
* @param User $user User qui positionne la remise
|
||||||
* @param float $remise Discount (percent)
|
* @param float $remise Discount (percent)
|
||||||
|
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @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;
|
$remise=trim($remise)?trim($remise):0;
|
||||||
|
|
||||||
if ($user->rights->commande->creer)
|
if ($user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$remise=price2num($remise);
|
$remise=price2num($remise);
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
|
||||||
$sql.= ' SET remise_percent = '.$remise;
|
$sql.= ' SET remise_percent = '.$remise;
|
||||||
$sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = '.self::STATUS_DRAFT.' ;';
|
$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->errors[]=$this->db->error();
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$this->oldcopy= clone $this;
|
||||||
$this->remise_percent = $remise;
|
$this->remise_percent = $remise;
|
||||||
$this->update_price(1);
|
$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;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
foreach($this->errors as $errmsg)
|
||||||
return -1;
|
{
|
||||||
|
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 User $user User qui positionne la remise
|
||||||
* @param float $remise Discount
|
* @param float $remise Discount
|
||||||
|
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @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;
|
$remise=trim($remise)?trim($remise):0;
|
||||||
|
|
||||||
if ($user->rights->commande->creer)
|
if ($user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$remise=price2num($remise);
|
$remise=price2num($remise);
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
|
||||||
$sql.= ' SET remise_absolue = '.$remise;
|
$sql.= ' SET remise_absolue = '.$remise;
|
||||||
$sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = '.self::STATUS_DRAFT.' ;';
|
$sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = '.self::STATUS_DRAFT.' ;';
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::set_remise_absolue", LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
if ($this->db->query($sql))
|
if (!$resql)
|
||||||
{
|
{
|
||||||
|
$this->errors[]=$this->db->error();
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$this->oldcopy= clone $this;
|
||||||
$this->remise_absolue = $remise;
|
$this->remise_absolue = $remise;
|
||||||
$this->update_price(1);
|
$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;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
foreach($this->errors as $errmsg)
|
||||||
return -1;
|
{
|
||||||
|
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1*$error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2114,27 +2178,57 @@ class Commande extends CommonOrder
|
|||||||
*
|
*
|
||||||
* @param User $user Object user making change
|
* @param User $user Object user making change
|
||||||
* @param int $date Date
|
* @param int $date Date
|
||||||
|
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @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)
|
if ($user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
||||||
$sql.= " SET date_commande = ".($date ? $this->db->idate($date) : 'null');
|
$sql.= " SET date_commande = ".($date ? $this->db->idate($date) : 'null');
|
||||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
|
$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);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if (!$resql)
|
||||||
{
|
{
|
||||||
|
$this->errors[]=$this->db->error();
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$this->oldcopy= clone $this;
|
||||||
$this->date = $date;
|
$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;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
foreach($this->errors as $errmsg)
|
||||||
return -1;
|
{
|
||||||
|
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1*$error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2148,27 +2242,57 @@ class Commande extends CommonOrder
|
|||||||
*
|
*
|
||||||
* @param User $user Objet utilisateur qui modifie
|
* @param User $user Objet utilisateur qui modifie
|
||||||
* @param int $date_livraison Date de livraison
|
* @param int $date_livraison Date de livraison
|
||||||
|
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
|
||||||
* @return int <0 si ko, >0 si ok
|
* @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)
|
if ($user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
||||||
$sql.= " SET date_livraison = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null');
|
$sql.= " SET date_livraison = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null');
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$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);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if (!$resql)
|
||||||
{
|
{
|
||||||
|
$this->errors[]=$this->db->error();
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$this->oldcopy= clone $this;
|
||||||
$this->date_livraison = $date_livraison;
|
$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;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
foreach($this->errors as $errmsg)
|
||||||
return -1;
|
{
|
||||||
|
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1*$error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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
|
* 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 $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
|
* @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.')');
|
dol_syslog('Commande::availability('.$availability_id.')');
|
||||||
if ($this->statut >= self::STATUS_DRAFT)
|
if ($this->statut >= self::STATUS_DRAFT)
|
||||||
{
|
{
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
|
||||||
$sql .= ' SET fk_availability = '.$availability_id;
|
$sql .= ' SET fk_availability = '.$availability_id;
|
||||||
$sql .= ' WHERE rowid='.$this->id;
|
$sql .= ' WHERE rowid='.$this->id;
|
||||||
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->availability_id = $availability_id;
|
$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;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog('Commande::availability Erreur '.$sql.' - '.$this->db->error(), LOG_ERR);
|
foreach($this->errors as $errmsg)
|
||||||
$this->error=$this->db->lasterror();
|
{
|
||||||
return -1;
|
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1*$error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog('Commande::availability, etat facture incompatible', LOG_ERR);
|
$error_str='Command status do not meet requirement '.$this->statut;
|
||||||
$this->error='Etat commande incompatible '.$this->statut;
|
dol_syslog(__METHOD__.$error_str, LOG_ERR);
|
||||||
|
$this->error=$error_str;
|
||||||
|
$this->errors[]= $this->error;
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change la source de la demande
|
* Update order demand_reason
|
||||||
*
|
*
|
||||||
* @param int $demand_reason_id Id of new demand
|
* @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
|
* @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.')');
|
dol_syslog('Commande::demand_reason('.$demand_reason_id.')');
|
||||||
if ($this->statut >= self::STATUS_DRAFT)
|
if ($this->statut >= self::STATUS_DRAFT)
|
||||||
{
|
{
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
|
||||||
$sql .= ' SET fk_input_reason = '.$demand_reason_id;
|
$sql .= ' SET fk_input_reason = '.$demand_reason_id;
|
||||||
$sql .= ' WHERE rowid='.$this->id;
|
$sql .= ' WHERE rowid='.$this->id;
|
||||||
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->demand_reason_id = $demand_reason_id;
|
$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;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog('Commande::demand_reason Erreur '.$sql.' - '.$this->db->error(), LOG_ERR);
|
foreach($this->errors as $errmsg)
|
||||||
$this->error=$this->db->lasterror();
|
{
|
||||||
return -1;
|
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1*$error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog('Commande::demand_reason, etat facture incompatible', LOG_ERR);
|
$error_str='order status do not meet requirement '.$this->statut;
|
||||||
$this->error='Etat commande incompatible '.$this->statut;
|
dol_syslog(__METHOD__.$error_str, LOG_ERR);
|
||||||
|
$this->error=$error_str;
|
||||||
|
$this->errors[]= $this->error;
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2381,27 +2519,57 @@ class Commande extends CommonOrder
|
|||||||
*
|
*
|
||||||
* @param User $user User that make change
|
* @param User $user User that make change
|
||||||
* @param string $ref_client 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
|
* @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)
|
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 = 'UPDATE '.MAIN_DB_PREFIX.'commande SET';
|
||||||
$sql.= ' ref_client = '.(empty($ref_client) ? 'NULL' : '\''.$this->db->escape($ref_client).'\'');
|
$sql.= ' ref_client = '.(empty($ref_client) ? 'NULL' : '\''.$this->db->escape($ref_client).'\'');
|
||||||
$sql.= ' WHERE rowid = '.$this->id;
|
$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->oldcopy= clone $this;
|
||||||
$this->ref_client = $ref_client;
|
$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;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->lasterror();
|
foreach($this->errors as $errmsg)
|
||||||
return -2;
|
{
|
||||||
|
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1*$error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2414,11 +2582,11 @@ class Commande extends CommonOrder
|
|||||||
* Classify the order as invoiced
|
* Classify the order as invoiced
|
||||||
*
|
*
|
||||||
* @param User $user Object user making the change
|
* @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
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function classifyBilled(User $user)
|
function classifyBilled(User $user, $notrigger=0)
|
||||||
{
|
{
|
||||||
global $user;
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@ -2428,17 +2596,25 @@ class Commande extends CommonOrder
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::classifyBilled", LOG_DEBUG);
|
dol_syslog(get_class($this)."::classifyBilled", LOG_DEBUG);
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
|
{
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$this->oldcopy= clone $this;
|
||||||
|
$this->facturee=1; // deprecated
|
||||||
|
$this->billed=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $notrigger && empty($error))
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('ORDER_CLASSIFY_BILLED',$user);
|
$result=$this->call_trigger('ORDER_CLASSIFY_BILLED',$user);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
// End call triggers
|
// End call triggers
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$this->facturee=1; // deprecated
|
|
||||||
$this->billed=1;
|
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -2494,6 +2670,13 @@ class Commande extends CommonOrder
|
|||||||
dol_syslog(get_class($this)."::classifyUnBilled", LOG_DEBUG);
|
dol_syslog(get_class($this)."::classifyUnBilled", LOG_DEBUG);
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$this->oldcopy= clone $this;
|
||||||
|
$this->facturee=1; // deprecated
|
||||||
|
$this->billed=1;
|
||||||
|
}
|
||||||
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('ORDER_CLASSIFY_UNBILLED',$user);
|
$result=$this->call_trigger('ORDER_CLASSIFY_UNBILLED',$user);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
|
|||||||
@ -48,6 +48,8 @@ $langs->load('companies');
|
|||||||
$langs->load('compta');
|
$langs->load('compta');
|
||||||
$langs->load('bills');
|
$langs->load('bills');
|
||||||
|
|
||||||
|
$action=GETPOST('action','alpha');
|
||||||
|
$massaction=GETPOST('massaction','alpha');
|
||||||
$orderyear=GETPOST("orderyear","int");
|
$orderyear=GETPOST("orderyear","int");
|
||||||
$ordermonth=GETPOST("ordermonth","int");
|
$ordermonth=GETPOST("ordermonth","int");
|
||||||
$orderday=GETPOST("orderday","int");
|
$orderday=GETPOST("orderday","int");
|
||||||
@ -70,6 +72,7 @@ $search_sale=GETPOST('search_sale','int');
|
|||||||
$search_total_ht=GETPOST('search_total_ht','alpha');
|
$search_total_ht=GETPOST('search_total_ht','alpha');
|
||||||
$optioncss = GETPOST('optioncss','alpha');
|
$optioncss = GETPOST('optioncss','alpha');
|
||||||
$billed = GETPOST('billed','int');
|
$billed = GETPOST('billed','int');
|
||||||
|
$toselect = GETPOST('toselect', 'array');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$id = (GETPOST('orderid')?GETPOST('orderid','int'):GETPOST('id','int'));
|
$id = (GETPOST('orderid')?GETPOST('orderid','int'):GETPOST('id','int'));
|
||||||
@ -183,6 +186,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
|||||||
$deliveryyear='';
|
$deliveryyear='';
|
||||||
$viewstatut='';
|
$viewstatut='';
|
||||||
$billed='';
|
$billed='';
|
||||||
|
$toselect='';
|
||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,6 +205,148 @@ if (empty($reshook))
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO Use a common inc.php file
|
||||||
|
if (! $error && $massaction == 'delete' && $user->rights->commande->supprimer)
|
||||||
|
{
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
$objecttmp=new Commande($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;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error && $massaction == "builddoc" && $user->rights->commande->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 Commande($db);
|
||||||
|
$listofobjectid=array();
|
||||||
|
$listofobjectthirdparties=array();
|
||||||
|
$listofobjectref=array();
|
||||||
|
foreach($toselect as $toselectid)
|
||||||
|
{
|
||||||
|
$objecttmp=new Commande($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($conf->commande->dir_output,'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[] = $conf->commande->dir_output.'/'.$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("Orders")));
|
||||||
|
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');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -380,6 +526,8 @@ if ($resql)
|
|||||||
|
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
@ -408,7 +556,13 @@ if ($resql)
|
|||||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
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
|
// Lignes des champs de filtre
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
@ -420,7 +574,7 @@ if ($resql)
|
|||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
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 ($sall)
|
if ($sall)
|
||||||
{
|
{
|
||||||
@ -657,7 +811,7 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
// Action column
|
// Action column
|
||||||
print '<td class="liste_titre" align="middle">';
|
print '<td class="liste_titre" align="middle">';
|
||||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
||||||
print $searchpitco;
|
print $searchpitco;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
@ -1001,7 +1155,14 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Action column
|
// Action column
|
||||||
print '<td></td>';
|
print '<td class="nowrap" align="center">';
|
||||||
|
if ($massactionbutton)
|
||||||
|
{
|
||||||
|
$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']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|||||||
@ -89,7 +89,8 @@ if ($_POST["action"] == 'add')
|
|||||||
$account->proprio = trim($_POST["proprio"]);
|
$account->proprio = trim($_POST["proprio"]);
|
||||||
$account->owner_address = trim($_POST["owner_address"]);
|
$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->accountancy_journal = trim($_POST["accountancy_journal"]);
|
||||||
|
|
||||||
$account->solde = $_POST["solde"];
|
$account->solde = $_POST["solde"];
|
||||||
@ -171,7 +172,8 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
|||||||
$account->proprio = trim($_POST["proprio"]);
|
$account->proprio = trim($_POST["proprio"]);
|
||||||
$account->owner_address = trim($_POST["owner_address"]);
|
$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->accountancy_journal = trim($_POST["accountancy_journal"]);
|
||||||
|
|
||||||
$account->currency_code = trim($_POST["account_currency_code"]);
|
$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')
|
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))
|
if (! $db->query($sql))
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
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))
|
if (! $db->query($sql))
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2008-2009 Laurent Destailleur (Eldy) <eldy@users.sourceforge.net>
|
* Copyright (C) 2008-2009 Laurent Destailleur (Eldy) <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com
|
* 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -166,10 +167,12 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
|
|||||||
|
|
||||||
// Social contributions
|
// 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= " 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.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||||
$sql3.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id";
|
$sql3.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id";
|
||||||
$sql3.= " WHERE cs.entity = ".$conf->entity;
|
$sql3.= " WHERE cs.entity = ".$conf->entity;
|
||||||
$sql3.= " AND cs.paye = 0"; // Not paid
|
$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";
|
$sql3.= " ORDER BY dlr ASC";
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|||||||
@ -1214,7 +1214,10 @@ if (empty($reshook))
|
|||||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
||||||
// modified by hook
|
// modified by hook
|
||||||
if ($reshook < 0)
|
if ($reshook < 0)
|
||||||
|
{
|
||||||
|
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
@ -4213,7 +4216,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
$formmail->withdeliveryreceipt = 1;
|
$formmail->withdeliveryreceipt = 1;
|
||||||
$formmail->withcancel = 1;
|
$formmail->withcancel = 1;
|
||||||
// Tableau des substitutions
|
// Tableau des substitutions
|
||||||
$formmail->setSubstitFromObject($object);
|
$formmail->setSubstitFromObject($object, $outputlangs);
|
||||||
$formmail->substit['__INVREF__'] = $object->ref;
|
$formmail->substit['__INVREF__'] = $object->ref;
|
||||||
|
|
||||||
// Find the good contact adress
|
// Find the good contact adress
|
||||||
|
|||||||
@ -59,63 +59,63 @@ class Facture extends CommonInvoice
|
|||||||
*/
|
*/
|
||||||
protected $table_ref_field = 'facnumber';
|
protected $table_ref_field = 'facnumber';
|
||||||
|
|
||||||
var $socid;
|
public $socid;
|
||||||
|
|
||||||
var $author;
|
public $author;
|
||||||
var $fk_user_author;
|
public $fk_user_author;
|
||||||
var $fk_user_valid;
|
public $fk_user_valid;
|
||||||
var $date; // Date invoice
|
public $date; // Date invoice
|
||||||
var $date_creation; // Creation date
|
public $date_creation; // Creation date
|
||||||
var $date_validation; // Validation date
|
public $date_validation; // Validation date
|
||||||
var $datem;
|
public $datem;
|
||||||
var $ref_client;
|
public $ref_client;
|
||||||
var $ref_int;
|
public $ref_int;
|
||||||
//Check constants for types
|
//Check constants for types
|
||||||
var $type = self::TYPE_STANDARD;
|
public $type = self::TYPE_STANDARD;
|
||||||
|
|
||||||
//var $amount;
|
//var $amount;
|
||||||
var $remise_absolue;
|
public $remise_absolue;
|
||||||
var $remise_percent;
|
public $remise_percent;
|
||||||
var $total_ht=0;
|
public $total_ht=0;
|
||||||
var $total_tva=0;
|
public $total_tva=0;
|
||||||
var $total_ttc=0;
|
public $total_ttc=0;
|
||||||
var $revenuestamp;
|
public $revenuestamp;
|
||||||
|
|
||||||
//! Fermeture apres paiement partiel: discount_vat, badcustomer, abandon
|
//! Fermeture apres paiement partiel: discount_vat, badcustomer, abandon
|
||||||
//! Fermeture alors que aucun paiement: replaced (si remplace), abandon
|
//! Fermeture alors que aucun paiement: replaced (si remplace), abandon
|
||||||
var $close_code;
|
public $close_code;
|
||||||
//! Commentaire si mis a paye sans paiement complet
|
//! 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)
|
//! 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
|
//! id of source invoice if replacement invoice or credit note
|
||||||
var $fk_facture_source;
|
public $fk_facture_source;
|
||||||
var $linked_objects=array();
|
public $linked_objects=array();
|
||||||
var $date_lim_reglement;
|
public $date_lim_reglement;
|
||||||
var $cond_reglement_code; // Code in llx_c_paiement
|
public $cond_reglement_code; // Code in llx_c_paiement
|
||||||
var $mode_reglement_code; // Code in llx_c_paiement
|
public $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_bank; // Field to store bank id to use when payment mode is withdraw
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
var $products=array();
|
public $products=array();
|
||||||
/**
|
/**
|
||||||
* @var FactureLigne[]
|
* @var FactureLigne[]
|
||||||
*/
|
*/
|
||||||
var $lines=array();
|
public $lines=array();
|
||||||
var $line;
|
public $line;
|
||||||
var $extraparams=array();
|
public $extraparams=array();
|
||||||
var $specimen;
|
public $specimen;
|
||||||
|
|
||||||
var $fac_rec;
|
public $fac_rec;
|
||||||
|
|
||||||
// Multicurrency
|
// Multicurrency
|
||||||
var $fk_multicurrency;
|
public $fk_multicurrency;
|
||||||
var $multicurrency_code;
|
public $multicurrency_code;
|
||||||
var $multicurrency_tx;
|
public $multicurrency_tx;
|
||||||
var $multicurrency_total_ht;
|
public $multicurrency_total_ht;
|
||||||
var $multicurrency_total_tva;
|
public $multicurrency_total_tva;
|
||||||
var $multicurrency_total_ttc;
|
public $multicurrency_total_ttc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int Situation cycle reference number
|
* @var int Situation cycle reference number
|
||||||
@ -142,6 +142,8 @@ class Facture extends CommonInvoice
|
|||||||
*/
|
*/
|
||||||
public $tab_next_situation_invoice=array();
|
public $tab_next_situation_invoice=array();
|
||||||
|
|
||||||
|
public $oldcopy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard invoice
|
* Standard invoice
|
||||||
*/
|
*/
|
||||||
@ -1486,25 +1488,60 @@ class Facture extends CommonInvoice
|
|||||||
* Set customer ref
|
* Set customer ref
|
||||||
*
|
*
|
||||||
* @param string $ref_client 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
|
* @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';
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
|
||||||
if (empty($ref_client))
|
if (empty($ref_client))
|
||||||
$sql .= ' SET ref_client = NULL';
|
$sql .= ' SET ref_client = NULL';
|
||||||
else
|
else
|
||||||
$sql .= ' SET ref_client = \''.$this->db->escape($ref_client).'\'';
|
$sql .= ' SET ref_client = \''.$this->db->escape($ref_client).'\'';
|
||||||
$sql .= ' WHERE rowid = '.$this->id;
|
$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;
|
$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;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
foreach($this->errors as $errmsg)
|
||||||
return -1;
|
{
|
||||||
|
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1*$error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2070,7 +2107,7 @@ class Facture extends CommonInvoice
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if ($final) {
|
if ($final) {
|
||||||
$this->setFinal();
|
$this->setFinal($user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2760,9 +2797,10 @@ class Facture extends CommonInvoice
|
|||||||
*
|
*
|
||||||
* @param User $user User that set discount
|
* @param User $user User that set discount
|
||||||
* @param double $remise Discount
|
* @param double $remise Discount
|
||||||
|
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
|
||||||
* @return int <0 if ko, >0 if ok
|
* @return int <0 if ko, >0 if ok
|
||||||
*/
|
*/
|
||||||
function set_remise($user, $remise)
|
function set_remise($user, $remise, $notrigger=0)
|
||||||
{
|
{
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (empty($remise)) $remise=0;
|
if (empty($remise)) $remise=0;
|
||||||
@ -2771,21 +2809,48 @@ class Facture extends CommonInvoice
|
|||||||
{
|
{
|
||||||
$remise=price2num($remise);
|
$remise=price2num($remise);
|
||||||
|
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
|
||||||
$sql.= ' SET remise_percent = '.$remise;
|
$sql.= ' SET remise_percent = '.$remise;
|
||||||
$sql.= ' WHERE rowid = '.$this->id;
|
$sql.= ' WHERE rowid = '.$this->id;
|
||||||
$sql.= ' AND fk_statut = '.self::STATUS_DRAFT;
|
$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->remise_percent = $remise;
|
||||||
$this->update_price(1);
|
$this->update_price(1);
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
foreach($this->errors as $errmsg)
|
||||||
return -1;
|
{
|
||||||
|
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 User $user User that set discount
|
||||||
* @param double $remise Discount
|
* @param double $remise Discount
|
||||||
|
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @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 (empty($remise)) $remise=0;
|
||||||
|
|
||||||
if ($user->rights->facture->creer)
|
if ($user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$remise=price2num($remise);
|
$remise=price2num($remise);
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
|
||||||
@ -2811,18 +2881,43 @@ class Facture extends CommonInvoice
|
|||||||
$sql.= ' WHERE rowid = '.$this->id;
|
$sql.= ' WHERE rowid = '.$this->id;
|
||||||
$sql.= ' AND fk_statut = '.self::STATUS_DRAFT;
|
$sql.= ' AND fk_statut = '.self::STATUS_DRAFT;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::set_remise_absolue", LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
if ($this->db->query($sql))
|
if (!$resql)
|
||||||
{
|
{
|
||||||
|
$this->errors[]=$this->db->error();
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$this->oldcopy= clone $this;
|
||||||
$this->remise_absolue = $remise;
|
$this->remise_absolue = $remise;
|
||||||
$this->update_price(1);
|
$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;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
foreach($this->errors as $errmsg)
|
||||||
return -1;
|
{
|
||||||
|
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";
|
$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";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||||
if (!$user->rights->societe->client->voir && !$user->societe_id)
|
if (!$user->rights->societe->client->voir && !$user->societe_id)
|
||||||
{
|
{
|
||||||
@ -3479,6 +3574,7 @@ class Facture extends CommonInvoice
|
|||||||
while ($obj=$this->db->fetch_object($resql))
|
while ($obj=$this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$generic_facture->date_lim_reglement = $this->db->jdate($obj->datefin);
|
$generic_facture->date_lim_reglement = $this->db->jdate($obj->datefin);
|
||||||
|
$generic_facture->statut = $obj->fk_statut;
|
||||||
|
|
||||||
$response->nbtodo++;
|
$response->nbtodo++;
|
||||||
|
|
||||||
@ -3818,25 +3914,49 @@ class Facture extends CommonInvoice
|
|||||||
/**
|
/**
|
||||||
* Sets the invoice as a final situation
|
* 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;
|
$this->situation_final = 1;
|
||||||
$sql = 'update ' . MAIN_DB_PREFIX . 'facture set situation_final = ' . $this->situation_final . ' where rowid = ' . $this->id;
|
$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);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql) {
|
if (!$resql)
|
||||||
// FIXME: call triggers MODIFY because we modify invoice
|
{
|
||||||
|
$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();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
}
|
||||||
$this->error = $this->db->lasterror();
|
else
|
||||||
dol_syslog(get_class($this) . "::update Error setFinal " . $sql, LOG_ERR);
|
{
|
||||||
|
foreach($this->errors as $errmsg)
|
||||||
|
{
|
||||||
|
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
|
}
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1*$error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4005,6 +4125,10 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
$sql.= ' fd.fk_unit,';
|
$sql.= ' fd.fk_unit,';
|
||||||
$sql.= ' fd.situation_percent, fd.fk_prev_id,';
|
$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.= ' 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.= ' FROM '.MAIN_DB_PREFIX.'facturedet as fd';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON fd.fk_product = p.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON fd.fk_product = p.rowid';
|
||||||
$sql.= ' WHERE fd.rowid = '.$rowid;
|
$sql.= ' WHERE fd.rowid = '.$rowid;
|
||||||
@ -4055,6 +4179,11 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
$this->situation_percent = $objp->situation_percent;
|
$this->situation_percent = $objp->situation_percent;
|
||||||
$this->fk_prev_id = $objp->fk_prev_id;
|
$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);
|
$this->db->free($result);
|
||||||
|
|
||||||
return 1;
|
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 (! 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->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
|
// Check parameters
|
||||||
if ($this->product_type < 0) return -1;
|
if ($this->product_type < 0) return -1;
|
||||||
|
|
||||||
|
|||||||
@ -205,12 +205,12 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOS
|
|||||||
$day='';
|
$day='';
|
||||||
$year='';
|
$year='';
|
||||||
$month='';
|
$month='';
|
||||||
$toselect='';
|
|
||||||
$option='';
|
$option='';
|
||||||
$filter='';
|
$filter='';
|
||||||
$day_lim='';
|
$day_lim='';
|
||||||
$year_lim='';
|
$year_lim='';
|
||||||
$month_lim='';
|
$month_lim='';
|
||||||
|
$toselect='';
|
||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,6 +229,7 @@ if (empty($reshook))
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO Use a common inc.php file
|
||||||
if (! $error && $massaction == 'confirm_presend')
|
if (! $error && $massaction == 'confirm_presend')
|
||||||
{
|
{
|
||||||
$resaction = '';
|
$resaction = '';
|
||||||
@ -522,17 +523,17 @@ if (empty($reshook))
|
|||||||
|
|
||||||
$arrayofinclusion=array();
|
$arrayofinclusion=array();
|
||||||
foreach($listofobjectref as $tmppdf) $arrayofinclusion[]=preg_quote($tmppdf.'.pdf','/');
|
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);
|
$listoffiles = dol_dir_list($conf->facture->dir_output,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true);
|
||||||
|
|
||||||
// liste les fichiers
|
// build list of files with full path
|
||||||
$files = array();
|
$files = array();
|
||||||
foreach($listofobjectref as $basename)
|
foreach($listofobjectref as $basename)
|
||||||
{
|
{
|
||||||
foreach($factures as $facture)
|
foreach($listoffiles as $filefound)
|
||||||
{
|
{
|
||||||
if (strstr($facture["name"],$basename))
|
if (strstr($filefound["name"],$basename))
|
||||||
{
|
{
|
||||||
$files[] = $conf->facture->dir_output.'/'.$basename.'/'.$facture["name"];
|
$files[] = $conf->facture->dir_output.'/'.$basename.'/'.$filefound["name"];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -831,7 +832,12 @@ if ($resql)
|
|||||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
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 ($massaction == 'presend') $arrayofmassactions=array();
|
||||||
|
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||||
@ -1183,7 +1189,7 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
// Action column
|
// Action column
|
||||||
print '<td class="liste_titre" align="middle">';
|
print '<td class="liste_titre" align="middle">';
|
||||||
$searchpitco=$form->showFilterAndCheckAddButtons(1, 'checkforselect', 1);
|
$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
||||||
print $searchpitco;
|
print $searchpitco;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -1423,9 +1429,12 @@ if ($resql)
|
|||||||
|
|
||||||
// Action column
|
// Action column
|
||||||
print '<td class="nowrap" align="center">';
|
print '<td class="nowrap" align="center">';
|
||||||
|
if ($massactionbutton)
|
||||||
|
{
|
||||||
$selected=0;
|
$selected=0;
|
||||||
if (in_array($obj->facid, $arrayofselected)) $selected=1;
|
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 '<input id="cb'.$obj->facid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->facid.'"'.($selected?' checked="checked"':'').'>';
|
||||||
|
}
|
||||||
print '</td>' ;
|
print '</td>' ;
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
|
|||||||
@ -199,7 +199,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
|||||||
}
|
}
|
||||||
else
|
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>";
|
print "</table><br>";
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
@ -275,7 +275,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
|||||||
}
|
}
|
||||||
else
|
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>";
|
print "</table><br>";
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
@ -387,7 +387,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
|||||||
{
|
{
|
||||||
$colspan=5;
|
$colspan=5;
|
||||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++;
|
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>';
|
print '</table><br>';
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
@ -474,7 +474,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
|||||||
{
|
{
|
||||||
$colspan=5;
|
$colspan=5;
|
||||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++;
|
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>';
|
print '</table><br>';
|
||||||
}
|
}
|
||||||
@ -842,7 +842,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
|||||||
{
|
{
|
||||||
$colspan=6;
|
$colspan=6;
|
||||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++;
|
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>';
|
print '</table><br>';
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
@ -942,7 +942,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
|||||||
{
|
{
|
||||||
$colspan=6;
|
$colspan=6;
|
||||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++;
|
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>';
|
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/paiement/class/paiement.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.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.'/compta/bank/class/account.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||||
|
|
||||||
$langs->load('companies');
|
$langs->load('companies');
|
||||||
$langs->load('bills');
|
$langs->load('bills');
|
||||||
@ -518,11 +519,21 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||||||
* List of unpaid invoices
|
* List of unpaid invoices
|
||||||
*/
|
*/
|
||||||
$sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.multicurrency_total_ttc, f.type, ';
|
$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.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
|
||||||
|
|
||||||
|
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.= ' WHERE f.entity = '.$conf->entity;
|
||||||
$sql.= ' AND f.fk_soc = '.$facture->socid;
|
$sql.= ' AND (f.fk_soc = '.$facture->socid;
|
||||||
$sql.= ' AND f.paye = 0';
|
|
||||||
|
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
|
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => not validated, Statut=2 => canceled
|
||||||
if ($facture->type != 2)
|
if ($facture->type != 2)
|
||||||
{
|
{
|
||||||
@ -583,6 +594,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
|
$soc = new Societe($db);
|
||||||
|
$soc->fetch($objp->socid);
|
||||||
|
|
||||||
$invoice=new Facture($db);
|
$invoice=new Facture($db);
|
||||||
$invoice->fetch($objp->facid);
|
$invoice->fetch($objp->facid);
|
||||||
$paiement = $invoice->getSommePaiement();
|
$paiement = $invoice->getSommePaiement();
|
||||||
@ -605,6 +619,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $invoice->getNomUrl(1,'');
|
print $invoice->getNomUrl(1,'');
|
||||||
|
if($objp->socid != $facture->thirdparty->id) print ' - '.$soc->getNomUrl(1).' ';
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -159,6 +160,8 @@ if ($_GET["action"] == 'create')
|
|||||||
|
|
||||||
$charge = new ChargeSociales($db);
|
$charge = new ChargeSociales($db);
|
||||||
$charge->fetch($chid);
|
$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;
|
$total = $charge->amount;
|
||||||
|
|
||||||
@ -178,16 +181,16 @@ if ($_GET["action"] == 'create')
|
|||||||
|
|
||||||
dol_fiche_head('', '');
|
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("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 colspan=\"2\">".$charge->type_libelle."</td></tr>\n";
|
print '<tr><td>'.$langs->trans("Type")."</td><td>".$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("Period")."</td><td>".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("Label").'</td><td>'.$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("DateDue")."</td><td>".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("Amount")."</td><td>".price($charge->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT sum(p.amount) as total";
|
$sql = "SELECT sum(p.amount) as total";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||||
@ -199,28 +202,28 @@ if ($_GET["action"] == 'create')
|
|||||||
$sumpaid = $obj->total;
|
$sumpaid = $obj->total;
|
||||||
$db->free();
|
$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>'.$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 colspan="2">'.price($total-$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 '<tr class="liste_titre">';
|
||||||
print "<td colspan=\"3\">".$langs->trans("Payment").'</td>';
|
print "<td colspan=\"2\">".$langs->trans("Payment").'</td>';
|
||||||
print '</tr>';
|
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"]);
|
$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;
|
$datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?(empty($_POST["remonth"])?-1:$datepaye):0;
|
||||||
$form->select_date($datepayment,'','','','',"add_payment",1,1);
|
$form->select_date($datepayment,'','','','',"add_payment",1,1);
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print '</tr>';
|
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");
|
$form->select_types_paiements(isset($_POST["paiementtype"])?$_POST["paiementtype"]:$charge->paiementtype, "paiementtype");
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="fieldrequired">'.$langs->trans('AccountToDebit').'</td>';
|
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
|
$form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$charge->accountid, "accountid", 0, '',1); // Show opend bank account list
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -228,11 +231,11 @@ if ($_GET["action"] == 'create')
|
|||||||
print '<tr><td>'.$langs->trans('Numero');
|
print '<tr><td>'.$langs->trans('Numero');
|
||||||
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
||||||
print '</td>';
|
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 '<tr>';
|
||||||
print '<td valign="top">'.$langs->trans("Comments").'</td>';
|
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 '</tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
* 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -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
|
// Delete social contribution
|
||||||
if ($action == 'confirm_delete' && $confirm == 'yes')
|
if ($action == 'confirm_delete' && $confirm == 'yes')
|
||||||
{
|
{
|
||||||
@ -127,6 +145,8 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
|
|||||||
$object->date_ech=$dateech;
|
$object->date_ech=$dateech;
|
||||||
$object->periode=$dateperiod;
|
$object->periode=$dateperiod;
|
||||||
$object->amount=$amount;
|
$object->amount=$amount;
|
||||||
|
$object->mode_reglement_id = GETPOST('mode_reglement_id');
|
||||||
|
$object->fk_account = GETPOST('fk_account', 'int');
|
||||||
|
|
||||||
$id=$object->create($user);
|
$id=$object->create($user);
|
||||||
if ($id <= 0)
|
if ($id <= 0)
|
||||||
@ -290,6 +310,17 @@ if ($action == 'create')
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td><input type="text" size="6" name="amount" class="flat" value="'.GETPOST('amount').'"></td>';
|
print '<td><input type="text" size="6" name="amount" class="flat" value="'.GETPOST('amount').'"></td>';
|
||||||
print '</tr>';
|
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
|
// Date due
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="fieldrequired">';
|
print '<td class="fieldrequired">';
|
||||||
@ -313,7 +344,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
/* *************************************************************************** */
|
/* *************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* Mode fiche */
|
/* Card Mode */
|
||||||
/* */
|
/* */
|
||||||
/* *************************************************************************** */
|
/* *************************************************************************** */
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
@ -382,7 +413,8 @@ if ($id > 0)
|
|||||||
// Type
|
// Type
|
||||||
print "<tr><td>".$langs->trans("Type")."</td><td>".$object->type_libelle."</td>";
|
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">';
|
print '<td rowspan="'.$rowspan.'" valign="top">';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -432,12 +464,12 @@ if ($id > 0)
|
|||||||
|
|
||||||
if ($object->paye == 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=\"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=\"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("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;
|
$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 "<td align=\"right\" bgcolor=\"#f0f0f0\"><b>".price($resteapayer)."</b></td><td bgcolor=\"#f0f0f0\"> ".$langs->trans("Currency".$conf->currency)."</td></tr>\n";
|
||||||
}
|
}
|
||||||
print "</table>";
|
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>';
|
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
|
// Status
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4, $totalpaye).'</td></tr>';
|
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 '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||||
print '</div';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'edit') print "</form>\n";
|
if ($action == 'edit') print "</form>\n";
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
* 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -49,6 +50,7 @@ class ChargeSociales extends CommonObject
|
|||||||
var $date_creation;
|
var $date_creation;
|
||||||
var $date_modification;
|
var $date_modification;
|
||||||
var $date_validation;
|
var $date_validation;
|
||||||
|
var $fk_account;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,13 +73,16 @@ class ChargeSociales extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function fetch($id, $ref='')
|
function fetch($id, $ref='')
|
||||||
{
|
{
|
||||||
$sql = "SELECT cs.rowid, cs.date_ech,";
|
$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.libelle as lib, cs.fk_type, cs.amount, cs.paye, cs.periode, cs.import_key";
|
||||||
$sql.= " c.libelle";
|
$sql.= ", cs.fk_account, cs.fk_mode_reglement";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs, ".MAIN_DB_PREFIX."c_chargesociales as c";
|
$sql.= ", c.libelle";
|
||||||
$sql.= " WHERE cs.fk_type = c.id";
|
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
|
||||||
if ($ref) $sql.= " AND cs.rowid = ".$ref;
|
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||||
else $sql.= " AND cs.rowid = ".$id;
|
$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);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
@ -93,6 +98,10 @@ class ChargeSociales extends CommonObject
|
|||||||
$this->lib = $obj->lib;
|
$this->lib = $obj->lib;
|
||||||
$this->type = $obj->fk_type;
|
$this->type = $obj->fk_type;
|
||||||
$this->type_libelle = $obj->libelle;
|
$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->amount = $obj->amount;
|
||||||
$this->paye = $obj->paye;
|
$this->paye = $obj->paye;
|
||||||
$this->periode = $this->db->jdate($obj->periode);
|
$this->periode = $this->db->jdate($obj->periode);
|
||||||
@ -155,8 +164,11 @@ class ChargeSociales extends CommonObject
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, libelle, date_ech, periode, amount, entity)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, entity)";
|
||||||
$sql.= " VALUES (".$this->type.",'".$this->db->escape($this->lib)."',";
|
$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.= " '".$this->db->idate($this->date_ech)."','".$this->db->idate($this->periode)."',";
|
||||||
$sql.= " '".price2num($newamount)."',";
|
$sql.= " '".price2num($newamount)."',";
|
||||||
$sql.= " ".$conf->entity;
|
$sql.= " ".$conf->entity;
|
||||||
@ -216,7 +228,7 @@ class ChargeSociales extends CommonObject
|
|||||||
// Delete payments
|
// Delete payments
|
||||||
if (! $error)
|
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);
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
@ -228,7 +240,7 @@ class ChargeSociales extends CommonObject
|
|||||||
|
|
||||||
if (! $error)
|
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);
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -255,7 +256,7 @@ if ($resql)
|
|||||||
// Due date
|
// Due date
|
||||||
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
|
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>';
|
print '<td></td>';
|
||||||
|
|
||||||
|
|||||||
@ -904,7 +904,7 @@ else
|
|||||||
|
|
||||||
// Statut
|
// Statut
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td>';
|
print '<tr><td>'.$langs->trans("Status").'</td>';
|
||||||
print '<td>';
|
print '<td colspan="3">';
|
||||||
print $object->getLibStatut(4);
|
print $object->getLibStatut(4);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -957,7 +957,7 @@ class Contact extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0,$option='',$maxlen=0,$moreparam='')
|
function getNomUrl($withpicto=0,$option='',$maxlen=0,$moreparam='')
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs, $hookmanager;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
$label = '<u>' . $langs->trans("ShowContact") . '</u>';
|
$label = '<u>' . $langs->trans("ShowContact") . '</u>';
|
||||||
@ -973,13 +973,27 @@ class Contact extends CommonObject
|
|||||||
$label.= '<br><b>' . $langs->trans("Address") . ':</b> '.dol_format_address($this, 1, ' ', $langs);
|
$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.'"';
|
$link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'"';
|
||||||
|
$linkclose="";
|
||||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||||
{
|
{
|
||||||
$label=$langs->trans("ShowContact");
|
$label=$langs->trans("ShowContact");
|
||||||
$link.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
}
|
}
|
||||||
$link.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
$link.= ' class="classfortooltip">';
|
$linkclose.= ' 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>';
|
$linkend='</a>';
|
||||||
|
|
||||||
if ($option == 'xxx')
|
if ($option == 'xxx')
|
||||||
|
|||||||
@ -57,6 +57,8 @@ $search_email=GETPOST("search_email");
|
|||||||
$search_skype=GETPOST("search_skype");
|
$search_skype=GETPOST("search_skype");
|
||||||
$search_priv=GETPOST("search_priv");
|
$search_priv=GETPOST("search_priv");
|
||||||
$search_categ=GETPOST("search_categ",'int');
|
$search_categ=GETPOST("search_categ",'int');
|
||||||
|
$search_categ_thirdparty=GETPOST("search_categ_thirdparty",'int');
|
||||||
|
$search_categ_supplier=GETPOST("search_categ_supplier",'int');
|
||||||
$search_status=GETPOST("search_status",'int');
|
$search_status=GETPOST("search_status",'int');
|
||||||
$search_type=GETPOST('search_type','alpha');
|
$search_type=GETPOST('search_type','alpha');
|
||||||
if ($search_status=='') $search_status=1; // always display activ customer first
|
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_skype="";
|
||||||
$search_priv="";
|
$search_priv="";
|
||||||
$search_status=-1;
|
$search_status=-1;
|
||||||
|
$search_categ='';
|
||||||
|
$search_categ_thirdparty='';
|
||||||
|
$search_categ_supplier='';
|
||||||
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
if ($search_priv < 0) $search_priv='';
|
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)";
|
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."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";
|
$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";
|
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).')';
|
$sql.= ' WHERE p.entity IN ('.getEntity('societe', 1).')';
|
||||||
if (!$user->rights->societe->client->voir && !$socid) //restriction
|
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_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 > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ);
|
||||||
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
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) {
|
if ($search_firstlast_only) {
|
||||||
$sql .= natural_search(array('p.lastname','p.firstname'), $search_firstlast_only);
|
$sql .= natural_search(array('p.lastname','p.firstname'), $search_firstlast_only);
|
||||||
@ -350,15 +362,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
$nbtotalofrecords = $db->num_rows($result);
|
$nbtotalofrecords = $db->num_rows($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add limit
|
|
||||||
if($view == "recent")
|
|
||||||
{
|
|
||||||
$sql.= $db->plimit($limit+1, $offset);
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$sql.= $db->plimit($limit+1, $offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
//print $sql;
|
//print $sql;
|
||||||
dol_syslog("contact/list.php", LOG_DEBUG);
|
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.='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall);
|
||||||
$param.='&type='.urlencode($type).'&view='.urlencode($view);
|
$param.='&type='.urlencode($type).'&view='.urlencode($view);
|
||||||
if (!empty($search_categ)) $param.='&search_categ='.urlencode($search_categ);
|
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_lastname != '') $param.='&search_lastname='.urlencode($search_lastname);
|
||||||
if ($search_firstname != '') $param.='&search_firstname='.urlencode($search_firstname);
|
if ($search_firstname != '') $param.='&search_firstname='.urlencode($search_firstname);
|
||||||
if ($search_societe != '') $param.='&search_societe='.urlencode($search_societe);
|
if ($search_societe != '') $param.='&search_societe='.urlencode($search_societe);
|
||||||
@ -423,6 +429,22 @@ if ($result)
|
|||||||
$moreforfilter.=$langs->trans('Categories'). ': ';
|
$moreforfilter.=$langs->trans('Categories'). ': ';
|
||||||
$moreforfilter.=$formother->select_categories(Categorie::TYPE_CONTACT,$search_categ,'search_categ',1);
|
$moreforfilter.=$formother->select_categories(Categorie::TYPE_CONTACT,$search_categ,'search_categ',1);
|
||||||
$moreforfilter.='</div>';
|
$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)
|
if ($moreforfilter)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1513,7 +1513,7 @@ else
|
|||||||
// Remise
|
// Remise
|
||||||
if ($objp->remise_percent > 0)
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2422,7 +2422,7 @@ class ContratLigne extends CommonObjectLine
|
|||||||
$sql.= " p.ref as product_ref,";
|
$sql.= " p.ref as product_ref,";
|
||||||
$sql.= " p.label as product_label,";
|
$sql.= " p.label as product_label,";
|
||||||
$sql.= " p.description as product_desc,";
|
$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.description,";
|
||||||
$sql.= " t.date_commande,";
|
$sql.= " t.date_commande,";
|
||||||
$sql.= " t.date_ouverture_prevue as date_ouverture_prevue,";
|
$sql.= " t.date_ouverture_prevue as date_ouverture_prevue,";
|
||||||
|
|||||||
@ -67,20 +67,18 @@ $result = restrictedArea($user, 'contrat', $id);
|
|||||||
$staticcontrat=new Contrat($db);
|
$staticcontrat=new Contrat($db);
|
||||||
$staticcontratligne=new ContratLigne($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;
|
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"
|
// List of fields to search into when doing a "search in all"
|
||||||
$fieldstosearchall = array(
|
$fieldstosearchall = array(
|
||||||
'c.ref'=>'Ref',
|
'c.ref'=>'Ref',
|
||||||
@ -93,6 +91,35 @@ $fieldstosearchall = array(
|
|||||||
if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate";
|
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
|
* View
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -52,15 +52,26 @@ $search_status=GETPOST("search_status","alpha");
|
|||||||
$statut=GETPOST('statut')?GETPOST('statut'):1;
|
$statut=GETPOST('statut')?GETPOST('statut'):1;
|
||||||
$socid=GETPOST('socid','int');
|
$socid=GETPOST('socid','int');
|
||||||
|
|
||||||
|
$opouvertureprevuemonth=GETPOST('opouvertureprevuemonth');
|
||||||
|
$opouvertureprevueday=GETPOST('opouvertureprevueday');
|
||||||
|
$opouvertureprevueyear=GETPOST('opouvertureprevueyear');
|
||||||
|
$filter_opouvertureprevue=GETPOST('filter_opouvertureprevue');
|
||||||
|
|
||||||
$op1month=GETPOST('op1month');
|
$op1month=GETPOST('op1month');
|
||||||
$op1day=GETPOST('op1day');
|
$op1day=GETPOST('op1day');
|
||||||
$op1year=GETPOST('op1year');
|
$op1year=GETPOST('op1year');
|
||||||
$filter_op1=GETPOST('filter_op1');
|
$filter_op1=GETPOST('filter_op1');
|
||||||
|
|
||||||
$op2month=GETPOST('op2month');
|
$op2month=GETPOST('op2month');
|
||||||
$op2day=GETPOST('op2day');
|
$op2day=GETPOST('op2day');
|
||||||
$op2year=GETPOST('op2year');
|
$op2year=GETPOST('op2year');
|
||||||
$filter_op2=GETPOST('filter_op2');
|
$filter_op2=GETPOST('filter_op2');
|
||||||
|
|
||||||
|
$opcloturemonth=GETPOST('opcloturemonth');
|
||||||
|
$opclotureday=GETPOST('opclotureday');
|
||||||
|
$opclotureyear=GETPOST('opclotureyear');
|
||||||
|
$filter_opcloture=GETPOST('filter_opcloture');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$contratid = GETPOST('id','int');
|
$contratid = GETPOST('id','int');
|
||||||
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
||||||
@ -88,12 +99,20 @@ $staticcontrat=new Contrat($db);
|
|||||||
$staticcontratligne=new ContratLigne($db);
|
$staticcontratligne=new ContratLigne($db);
|
||||||
$companystatic=new Societe($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_name="";
|
||||||
$search_contract="";
|
$search_contract="";
|
||||||
$search_service="";
|
$search_service="";
|
||||||
$search_status=-1;
|
$search_status=-1;
|
||||||
|
$opouvertureprevuemonth="";
|
||||||
|
$opouvertureprevueday="";
|
||||||
|
$opouvertureprevueyear="";
|
||||||
|
$filter_opouvertureprevue="";
|
||||||
$op1month="";
|
$op1month="";
|
||||||
$op1day="";
|
$op1day="";
|
||||||
$op1year="";
|
$op1year="";
|
||||||
@ -102,6 +121,10 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
|||||||
$op2day="";
|
$op2day="";
|
||||||
$op2year="";
|
$op2year="";
|
||||||
$filter_op2="";
|
$filter_op2="";
|
||||||
|
$opcloturemonth="";
|
||||||
|
$opclotureday="";
|
||||||
|
$opclotureyear="";
|
||||||
|
$filter_opcloture="";
|
||||||
$mode='';
|
$mode='';
|
||||||
$filter='';
|
$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_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 ($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;
|
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_date1=dol_mktime(0,0,0,$op1month,$op1day,$op1year);
|
||||||
$filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year);
|
$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)."'";
|
$filter_datecloture=dol_mktime(0,0,0,$opcloturemonth,$opclotureday,$opclotureyear);
|
||||||
if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " AND date_fin_validite ".$filter_op2." '".$db->idate($filter_date2)."'";
|
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;
|
$totalnboflines=0;
|
||||||
$result=$db->query($sql);
|
$result=$db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -170,10 +197,14 @@ if ($resql)
|
|||||||
if ($search_service) $param.='&search_service='.urlencode($search_service);
|
if ($search_service) $param.='&search_service='.urlencode($search_service);
|
||||||
if ($mode) $param.='&mode='.$mode;
|
if ($mode) $param.='&mode='.$mode;
|
||||||
if ($filter) $param.='&filter='.$filter;
|
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_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_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_date1 != '') $param.='&op1day='.$op1day.'&op1month='.$op1month.'&op1year='.$op1year;
|
||||||
if ($filter_date2 != '') $param.='&op2day='.$op2day.'&op2month='.$op2month.'&op2year='.$op2year;
|
if ($filter_date2 != '') $param.='&op2day='.$op2day.'&op2month='.$op2month.'&op2year='.$op2year;
|
||||||
|
if ($filter_datecloture != '') $param.='&opclotureday='.$op2day.'&opcloturemonth='.$op2month.'&opclotureyear='.$op2year;
|
||||||
|
|
||||||
$title=$langs->trans("ListOfServices");
|
$title=$langs->trans("ListOfServices");
|
||||||
if ($mode == "0") $title=$langs->trans("ListOfInactiveServices"); // Must use == "0"
|
if ($mode == "0") $title=$langs->trans("ListOfInactiveServices"); // Must use == "0"
|
||||||
@ -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("Service"),$_SERVER["PHP_SELF"], "p.description",$param,"","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"], "s.nom",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"], "s.nom",$param,"","",$sortfield,$sortorder);
|
||||||
// Date debut
|
// 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 == -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 > 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("DateStartRealShort"),$_SERVER["PHP_SELF"], "cd.date_ouverture",$param,'',' align="center"',$sortfield,$sortorder);
|
||||||
// Date fin
|
// 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);
|
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);
|
||||||
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("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($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_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -214,6 +245,18 @@ if ($resql)
|
|||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input type="text" class="flat" size="12" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
|
print '<input type="text" class="flat" size="12" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
|
||||||
print '</td>';
|
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">';
|
print '<td class="liste_titre" align="center">';
|
||||||
$arrayofoperators=array('<'=>'<','>'=>'>');
|
$arrayofoperators=array('<'=>'<','>'=>'>');
|
||||||
print $form->selectarray('filter_op1',$arrayofoperators,$filter_op1,1);
|
print $form->selectarray('filter_op1',$arrayofoperators,$filter_op1,1);
|
||||||
@ -221,6 +264,9 @@ if ($resql)
|
|||||||
$filter_date1=dol_mktime(0,0,0,$op1month,$op1day,$op1year);
|
$filter_date1=dol_mktime(0,0,0,$op1month,$op1day,$op1year);
|
||||||
print $form->select_date($filter_date1,'op1',0,0,1,'',1,0,1);
|
print $form->select_date($filter_date1,'op1',0,0,1,'',1,0,1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
}
|
||||||
|
if (($mode == "" || $mode == -1) || $mode < 5)
|
||||||
|
{
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
$arrayofoperators=array('<'=>'<','>'=>'>');
|
$arrayofoperators=array('<'=>'<','>'=>'>');
|
||||||
print $form->selectarray('filter_op2',$arrayofoperators,$filter_op2,1);
|
print $form->selectarray('filter_op2',$arrayofoperators,$filter_op2,1);
|
||||||
@ -228,6 +274,17 @@ if ($resql)
|
|||||||
$filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year);
|
$filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year);
|
||||||
print $form->select_date($filter_date2,'op2',0,0,1,'',1,0,1);
|
print $form->select_date($filter_date2,'op2',0,0,1,'',1,0,1);
|
||||||
print '</td>';
|
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">';
|
print '<td align="right">';
|
||||||
$arrayofstatus=array(
|
$arrayofstatus=array(
|
||||||
'0'=>$langs->trans("ServiceStatusInitial"),
|
'0'=>$langs->trans("ServiceStatusInitial"),
|
||||||
@ -287,7 +344,8 @@ if ($resql)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Start date
|
// Start date
|
||||||
if ($mode == "0") {
|
if (($mode == "" || $mode == -1) || $mode == "0")
|
||||||
|
{
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print ($obj->date_ouverture_prevue?dol_print_date($db->jdate($obj->date_ouverture_prevue)):' ');
|
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)))
|
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 ' ';
|
else print ' ';
|
||||||
print '</td>';
|
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
|
// Date fin
|
||||||
if ($mode == "" || $mode < 5) print '<td align="center">'.($obj->date_fin_validite?dol_print_date($db->jdate($obj->date_fin_validite)):' ');
|
if (($mode == "" || $mode == -1) || $mode < 5)
|
||||||
else print '<td align="center">'.dol_print_date($db->jdate($obj->date_cloture));
|
{
|
||||||
// Icone warning
|
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"));
|
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 ' ';
|
else print ' ';
|
||||||
|
}
|
||||||
|
if (($mode == "" || $mode == -1) || $mode >= 5) print '<td align="center">'.dol_print_date($db->jdate($obj->date_cloture));
|
||||||
|
// Icone warning
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" class="nowrap">';
|
print '<td align="right" class="nowrap">';
|
||||||
if ($obj->cstatut == 0) // If contract is draft, we say line is also draft
|
if ($obj->cstatut == 0) // If contract is draft, we say line is also draft
|
||||||
|
|||||||
@ -82,6 +82,7 @@ else // For no ajax call
|
|||||||
$relativepath=$ecmdir->getRelativePath();
|
$relativepath=$ecmdir->getRelativePath();
|
||||||
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
|
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
|
||||||
}
|
}
|
||||||
|
if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php';
|
||||||
|
|
||||||
// Load traductions files
|
// Load traductions files
|
||||||
$langs->load("ecm");
|
$langs->load("ecm");
|
||||||
@ -138,10 +139,10 @@ if (! dol_is_dir($upload_dir))
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<!-- TYPE='.$type.' -->'."\n";
|
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:'');
|
$param=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'');
|
||||||
$url=DOL_URL_ROOT.'/ecm/index.php';
|
|
||||||
|
|
||||||
// Dir scan
|
// Dir scan
|
||||||
if ($type == 'directory')
|
if ($type == 'directory')
|
||||||
|
|||||||
@ -35,6 +35,19 @@ $element = GETPOST('element','alpha',2);
|
|||||||
$table_element = GETPOST('table_element','alpha',2);
|
$table_element = GETPOST('table_element','alpha',2);
|
||||||
$fk_element = GETPOST('fk_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
|
* View
|
||||||
*/
|
*/
|
||||||
@ -81,7 +94,7 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
|
|||||||
}
|
}
|
||||||
else $newelement = $element;
|
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)))
|
|| (isset($subelement) && (! empty($user->rights->$newelement->$subelement->creer) || ! empty($user->rights->$newelement->$subelement->write)))
|
||||||
|| ($element == 'payment' && $user->rights->facture->paiement)
|
|| ($element == 'payment' && $user->rights->facture->paiement)
|
||||||
|| ($element == 'payment_supplier' && $user->rights->fournisseur->facture->creer))
|
|| ($element == 'payment_supplier' && $user->rights->fournisseur->facture->creer))
|
||||||
|
|||||||
@ -132,6 +132,8 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
|||||||
$mesg = $px1->isGraphKo();
|
$mesg = $px1->isGraphKo();
|
||||||
if (! $mesg)
|
if (! $mesg)
|
||||||
{
|
{
|
||||||
|
$langs->load("bills");
|
||||||
|
|
||||||
$px1->SetData($data1);
|
$px1->SetData($data1);
|
||||||
unset($data1);
|
unset($data1);
|
||||||
$px1->SetPrecisionY(0);
|
$px1->SetPrecisionY(0);
|
||||||
|
|||||||
@ -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),
|
'text' => $contratlignestatic->getNomUrl(1),
|
||||||
'asis' => 1
|
'asis' => 1
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][] = array('td' => '',
|
||||||
'text' => $contractstatic->getNomUrl(1),
|
'text' => $contractstatic->getNomUrl(1),
|
||||||
'asis' => 1
|
'asis' => 1
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][] = array('td' => '',
|
||||||
'text' => $thirdpartytmp->getNomUrl(1),
|
'text' => $thirdpartytmp->getNomUrl(1),
|
||||||
'asis' => 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'));
|
'text' => dol_print_date($datem,'day'));
|
||||||
|
|
||||||
$this->info_box_contents[$i][] = array('td' => 'align="right" width="18"',
|
$this->info_box_contents[$i][] = array('td' => 'align="right" width="18"',
|
||||||
|
|||||||
@ -2451,19 +2451,19 @@ abstract class CommonObject
|
|||||||
{
|
{
|
||||||
if ($justsource)
|
if ($justsource)
|
||||||
{
|
{
|
||||||
$sql.= "fk_source = '".$sourceid."' AND sourcetype = '".$sourcetype."'";
|
$sql.= "fk_source = ".$sourceid." AND sourcetype = '".$sourcetype."'";
|
||||||
if ($withtargettype) $sql.= " AND targettype = '".$targettype."'";
|
if ($withtargettype) $sql.= " AND targettype = '".$targettype."'";
|
||||||
}
|
}
|
||||||
else if ($justtarget)
|
else if ($justtarget)
|
||||||
{
|
{
|
||||||
$sql.= "fk_target = '".$targetid."' AND targettype = '".$targettype."'";
|
$sql.= "fk_target = ".$targetid." AND targettype = '".$targettype."'";
|
||||||
if ($withsourcetype) $sql.= " AND sourcetype = '".$sourcetype."'";
|
if ($withsourcetype) $sql.= " AND sourcetype = '".$sourcetype."'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql.= "(fk_source = '".$sourceid."' AND sourcetype = '".$sourcetype."')";
|
$sql.= "(fk_source = ".$sourceid." AND sourcetype = '".$sourcetype."')";
|
||||||
$sql.= " ".$clause." (fk_target = '".$targetid."' AND targettype = '".$targettype."')";
|
$sql.= " ".$clause." (fk_target = ".$targetid." AND targettype = '".$targettype."')";
|
||||||
}
|
}
|
||||||
$sql .= ' ORDER BY sourcetype';
|
$sql .= ' ORDER BY sourcetype';
|
||||||
//print $sql;
|
//print $sql;
|
||||||
@ -4128,9 +4128,16 @@ abstract class CommonObject
|
|||||||
$langs->load('admin');
|
$langs->load('admin');
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
$extrafields = new ExtraFields($this->db);
|
$extrafields = new ExtraFields($this->db);
|
||||||
$extrafields->fetch_name_optionals_label($this->table_element);
|
$target_extrafields=$extrafields->fetch_name_optionals_label($this->table_element);
|
||||||
|
|
||||||
foreach($this->array_options as $key => $value)
|
//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($new_array_options as $key => $value)
|
||||||
{
|
{
|
||||||
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
||||||
$attributeType = $extrafields->attribute_type[$attributeKey];
|
$attributeType = $extrafields->attribute_type[$attributeKey];
|
||||||
@ -4193,7 +4200,7 @@ abstract class CommonObject
|
|||||||
$this->db->query($sql_del);
|
$this->db->query($sql_del);
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object";
|
$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
|
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
||||||
// Add field of attribut
|
// Add field of attribut
|
||||||
@ -4201,7 +4208,7 @@ abstract class CommonObject
|
|||||||
$sql.=",".$attributeKey;
|
$sql.=",".$attributeKey;
|
||||||
}
|
}
|
||||||
$sql .= ") VALUES (".$this->id;
|
$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
|
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
||||||
// Add field o fattribut
|
// Add field o fattribut
|
||||||
|
|||||||
@ -99,7 +99,7 @@ class DolEditor
|
|||||||
$this->editor->Value = $content;
|
$this->editor->Value = $content;
|
||||||
$this->editor->Height = $height;
|
$this->editor->Height = $height;
|
||||||
if (! empty($width)) $this->editor->Width = $width;
|
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['AutoDetectLanguage'] = 'true';
|
||||||
$this->editor->Config['ToolbarLocation'] = $toolbarlocation ? $toolbarlocation : 'In';
|
$this->editor->Config['ToolbarLocation'] = $toolbarlocation ? $toolbarlocation : 'In';
|
||||||
$this->editor->Config['ToolbarStartExpanded'] = $toolbarstartexpanded;
|
$this->editor->Config['ToolbarStartExpanded'] = $toolbarstartexpanded;
|
||||||
|
|||||||
@ -82,6 +82,7 @@ class ExtraFields
|
|||||||
'chkbxlst' => 'ExtrafieldCheckBoxFromList',
|
'chkbxlst' => 'ExtrafieldCheckBoxFromList',
|
||||||
'link' => 'ExtrafieldLink',
|
'link' => 'ExtrafieldLink',
|
||||||
'separate' => 'ExtrafieldSeparator',
|
'separate' => 'ExtrafieldSeparator',
|
||||||
|
'password' => 'ExtrafieldPassword',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -199,6 +200,9 @@ class ExtraFields
|
|||||||
} elseif ($type=='link') {
|
} elseif ($type=='link') {
|
||||||
$typedb='int';
|
$typedb='int';
|
||||||
$lengthdb='11';
|
$lengthdb='11';
|
||||||
|
} elseif($type=='password') {
|
||||||
|
$typedb='varchar';
|
||||||
|
$lengthdb='50';
|
||||||
} else {
|
} else {
|
||||||
$typedb=$type;
|
$typedb=$type;
|
||||||
$lengthdb=$length;
|
$lengthdb=$length;
|
||||||
@ -426,6 +430,9 @@ class ExtraFields
|
|||||||
} elseif ($type=='link') {
|
} elseif ($type=='link') {
|
||||||
$typedb='int';
|
$typedb='int';
|
||||||
$lengthdb='11';
|
$lengthdb='11';
|
||||||
|
} elseif($type=='password') {
|
||||||
|
$typedb='varchar';
|
||||||
|
$lengthdb='50';
|
||||||
} else {
|
} else {
|
||||||
$typedb=$type;
|
$typedb=$type;
|
||||||
$lengthdb=$length;
|
$lengthdb=$length;
|
||||||
@ -1146,6 +1153,10 @@ class ExtraFields
|
|||||||
$out.='Error bad setup of extrafield';
|
$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)) {
|
if (!empty($hidden)) {
|
||||||
$out='<input type="hidden" value="'.$value.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'"/>';
|
$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);
|
$value=dol_htmlentitiesbr($value);
|
||||||
}
|
}
|
||||||
|
elseif ($type == 'password')
|
||||||
|
{
|
||||||
|
$value=preg_replace('/./i','*',$value);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$showsize=round($size);
|
$showsize=round($size);
|
||||||
|
|||||||
@ -24,8 +24,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class GenericObject
|
* Class of a generic business object
|
||||||
* \brief Class of a generic business object
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class GenericObject extends CommonObject
|
class GenericObject extends CommonObject
|
||||||
|
|||||||
@ -142,6 +142,7 @@ class HookManager
|
|||||||
'formObjectOptions',
|
'formObjectOptions',
|
||||||
'formattachOptions',
|
'formattachOptions',
|
||||||
'formBuilddocLineOptions',
|
'formBuilddocLineOptions',
|
||||||
|
'getFormMail',
|
||||||
'getIdProfUrl',
|
'getIdProfUrl',
|
||||||
'moveUploadedFile',
|
'moveUploadedFile',
|
||||||
'pdf_build_address',
|
'pdf_build_address',
|
||||||
|
|||||||
@ -1437,7 +1437,7 @@ class Form
|
|||||||
$nodatarole=($comboenhancement?' data-role="none"':'');
|
$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_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";
|
if ($show_every) $out.= '<option value="-2"'.(($selected==-2)?' selected':'').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
|
||||||
|
|
||||||
@ -1768,7 +1768,7 @@ class Form
|
|||||||
$optJson = array();
|
$optJson = array();
|
||||||
$objp = $this->db->fetch_object($result);
|
$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
|
{ // Price by quantity will return many prices for the same product
|
||||||
$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise";
|
$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_price_by_qty";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_price_by_qty";
|
||||||
@ -1916,8 +1916,8 @@ class Form
|
|||||||
$sql.= " WHERE fk_product='".$objp->rowid."'";
|
$sql.= " WHERE fk_product='".$objp->rowid."'";
|
||||||
$sql.= " AND entity IN (".getEntity('productprice', 1).")";
|
$sql.= " AND entity IN (".getEntity('productprice', 1).")";
|
||||||
$sql.= " AND price_level=".$price_level;
|
$sql.= " AND price_level=".$price_level;
|
||||||
$sql.= " ORDER BY date_price, rowid";
|
$sql.= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.
|
||||||
$sql.= " DESC LIMIT 1";
|
$sql.= " LIMIT 1";
|
||||||
|
|
||||||
dol_syslog(get_class($this).'::constructProductListOption search price for level '.$price_level.'', LOG_DEBUG);
|
dol_syslog(get_class($this).'::constructProductListOption search price for level '.$price_level.'', LOG_DEBUG);
|
||||||
$result2 = $this->db->query($sql);
|
$result2 = $this->db->query($sql);
|
||||||
@ -4263,7 +4263,8 @@ class Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now we get list
|
// 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)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
// Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '')
|
// Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '')
|
||||||
@ -5929,7 +5930,7 @@ class Form
|
|||||||
/**
|
/**
|
||||||
* Return HTML to show the search and clear seach button
|
* 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 string $cssclass CSS class
|
||||||
* @param int $calljsfunction 0=default. 1=call function initCheckForSelect() after changing status of checkboxes
|
* @param int $calljsfunction 0=default. 1=call function initCheckForSelect() after changing status of checkboxes
|
||||||
* @return string
|
* @return string
|
||||||
@ -5944,7 +5945,6 @@ class Form
|
|||||||
if ($addcheckuncheckall)
|
if ($addcheckuncheckall)
|
||||||
{
|
{
|
||||||
if (! empty($conf->use_javascript_ajax)) $out.='<input type="checkbox" id="checkallactions" name="checkallactions" class="checkallactions">';
|
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() {
|
$(document).ready(function() {
|
||||||
$("#checkallactions").click(function() {
|
$("#checkallactions").click(function() {
|
||||||
@ -5957,10 +5957,11 @@ class Form
|
|||||||
console.log("We uncheck all");
|
console.log("We uncheck all");
|
||||||
$(".'.$cssclass.'").prop(\'checked\', false);
|
$(".'.$cssclass.'").prop(\'checked\', false);
|
||||||
}'."\n";
|
}'."\n";
|
||||||
if ($calljsfunction) $out.='if (typeof initCheckForSelect == \'function\') { initCheckForSelect(); } else { console.log("No function initCheckForSelect found. Call won\'t done."); }';
|
if ($calljsfunction) $out.='if (typeof initCheckForSelect == \'function\') { initCheckForSelect(); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }';
|
||||||
$out.=' });
|
$out.=' });
|
||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
|
}
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -251,7 +251,8 @@ class FormMail extends Form
|
|||||||
|
|
||||||
$parameters=array(
|
$parameters=array(
|
||||||
'addfileaction' => $addfileaction,
|
'addfileaction' => $addfileaction,
|
||||||
'removefileaction'=> $removefileaction
|
'removefileaction'=> $removefileaction,
|
||||||
|
'trackid'=> $this->trackid
|
||||||
);
|
);
|
||||||
$reshook=$hookmanager->executeHooks('getFormMail', $parameters, $this);
|
$reshook=$hookmanager->executeHooks('getFormMail', $parameters, $this);
|
||||||
|
|
||||||
@ -928,17 +929,29 @@ class FormMail extends Form
|
|||||||
* Set substit array from object
|
* Set substit array from object
|
||||||
*
|
*
|
||||||
* @param Object $object Object to use
|
* @param Object $object Object to use
|
||||||
|
* @param Translate $outputlangs Object lang
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function setSubstitFromObject($object)
|
function setSubstitFromObject($object, $outputlangs=null)
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
$this->substit['__REF__'] = $object->ref;
|
$this->substit['__REF__'] = $object->ref;
|
||||||
$this->substit['__SIGNATURE__'] = $user->signature;
|
|
||||||
$this->substit['__REFCLIENT__'] = $object->ref_client;
|
$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_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
|
||||||
$this->substit['__PROJECT_NAME__'] = (is_object($object->projet)?$object->projet->title:'');
|
$this->substit['__PROJECT_NAME__'] = (is_object($object->projet)?$object->projet->title:'');
|
||||||
|
|
||||||
|
$this->substit['__SIGNATURE__'] = $user->signature;
|
||||||
$this->substit['__PERSONALIZED__'] = '';
|
$this->substit['__PERSONALIZED__'] = '';
|
||||||
$this->substit['__CONTACTCIVNAME__'] = ''; // Will be replace just before sending
|
$this->substit['__CONTACTCIVNAME__'] = ''; // Will be replace just before sending
|
||||||
}
|
}
|
||||||
|
|||||||
@ -579,7 +579,7 @@ class FormOther
|
|||||||
{
|
{
|
||||||
print " ";
|
print " ";
|
||||||
}
|
}
|
||||||
print $lines[$i]->label."</option>\n";
|
print $lines[$i]->ref.' '.$lines[$i]->label."</option>\n";
|
||||||
$inc++;
|
$inc++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -569,7 +569,7 @@ class FormProjets
|
|||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$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"';
|
if ($obj->rowid == $preselected) $sellist .= ' selected="selected"';
|
||||||
$sellist .= '>';
|
$sellist .= '>';
|
||||||
if ($useshortlabel)
|
if ($useshortlabel)
|
||||||
|
|||||||
@ -69,12 +69,17 @@ class Notify
|
|||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("mails");
|
$langs->load("mails");
|
||||||
|
|
||||||
$listofnotiftodo=$this->getNotificationsArray($action,$socid,$object);
|
$listofnotiftodo=$this->getNotificationsArray($action,$socid,$object,0);
|
||||||
$nb=count($listofnotiftodo);
|
|
||||||
if ($nb <= 0) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("NoNotificationsWillBeSent");
|
$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 == 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 ($nb >= 2) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("SomeNotificationsWillBeSent",$nb);
|
||||||
|
|
||||||
|
if (is_array($listofnotiftodo))
|
||||||
|
{
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach ($listofnotiftodo as $key => $val)
|
foreach ($listofnotiftodo as $key => $val)
|
||||||
{
|
{
|
||||||
@ -85,6 +90,7 @@ class Notify
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if ($i) $texte.=')';
|
if ($i) $texte.=')';
|
||||||
|
}
|
||||||
|
|
||||||
return $texte;
|
return $texte;
|
||||||
}
|
}
|
||||||
@ -93,11 +99,12 @@ class Notify
|
|||||||
* Return number of notifications activated for action code (and third party)
|
* 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 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 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
|
* @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;
|
global $conf, $user;
|
||||||
|
|
||||||
@ -108,6 +115,8 @@ class Notify
|
|||||||
if (is_object($object)) $valueforthreshold = $object->total_ht;
|
if (is_object($object)) $valueforthreshold = $object->total_ht;
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
|
{
|
||||||
|
if ($socid >= 0)
|
||||||
{
|
{
|
||||||
$sql = "SELECT a.code, c.email, c.rowid";
|
$sql = "SELECT a.code, c.email, c.rowid";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n,";
|
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n,";
|
||||||
@ -137,8 +146,9 @@ class Notify
|
|||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
if ($obj)
|
if ($obj)
|
||||||
{
|
{
|
||||||
|
$newval2=trim($obj->email);
|
||||||
$isvalid=isValidEmail($newval2);
|
$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);
|
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++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -148,6 +158,52 @@ class Notify
|
|||||||
$error++;
|
$error++;
|
||||||
$this->error=$this->db->lasterror();
|
$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)
|
if (! $error)
|
||||||
@ -177,7 +233,7 @@ class Notify
|
|||||||
{
|
{
|
||||||
$tmpuser=new User($this->db);
|
$tmpuser=new User($this->db);
|
||||||
$tmpuser->fetch($user->fk_user);
|
$tmpuser->fetch($user->fk_user);
|
||||||
if ($tmpuser->email) $newval2=$tmpuser->email;
|
if ($tmpuser->email) $newval2=trim($tmpuser->email);
|
||||||
else $newval2='';
|
else $newval2='';
|
||||||
}
|
}
|
||||||
else $newval2='';
|
else $newval2='';
|
||||||
@ -185,7 +241,7 @@ class Notify
|
|||||||
if ($newval2)
|
if ($newval2)
|
||||||
{
|
{
|
||||||
$isvalid=isValidEmail($newval2, 0);
|
$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);
|
$newref=(empty($object->newref)?$object->ref:$object->newref);
|
||||||
|
|
||||||
// Check notification per third party
|
// 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.= " a.rowid as adid, a.label, a.code, n.rowid, n.type";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,";
|
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
||||||
@ -266,6 +322,29 @@ class Notify
|
|||||||
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
|
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
|
||||||
$sql .= " AND s.rowid = ".$object->socid;
|
$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);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
@ -394,8 +473,16 @@ class Notify
|
|||||||
|
|
||||||
if ($mailfile->sendfile())
|
if ($mailfile->sendfile())
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, objet_id, email)";
|
if ($obj->type_target == 'touserid') {
|
||||||
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".$object->socid.", ".$obj->cid.", '".$obj->type."', '".$object_type."', ".$object->id.", '".$this->db->escape($obj->email)."')";
|
$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))
|
if (! $this->db->query($sql))
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
@ -423,6 +510,7 @@ class Notify
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors[]=$this->db->lasterror();
|
$this->errors[]=$this->db->lasterror();
|
||||||
|
dol_syslog("Failed to get list of notification to send ".$this->db->lasterror(), LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -579,8 +667,8 @@ class Notify
|
|||||||
|
|
||||||
if ($mailfile->sendfile())
|
if ($mailfile->sendfile())
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, objet_id, email)";
|
$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.", null, 'email', '".$object_type."', ".$object->id.", '".$this->db->escape($conf->global->$param)."')";
|
$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))
|
if (! $this->db->query($sql))
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
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;
|
if($i>0 && $row->total) $result[$i-1]['total_diff'] = ($result[$i-1]['total'] - $row->total) / $row->total * 100;
|
||||||
$result[$i]['avg'] = $row->avg;
|
$result[$i]['avg'] = $row->avg;
|
||||||
if($i>0 && $row->avg) $result[$i-1]['avg_diff'] = ($result[$i-1]['avg'] - $row->avg) / $row->avg * 100;
|
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++;
|
$i++;
|
||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|||||||
@ -606,10 +606,13 @@ class DoliDBMysql extends DoliDB
|
|||||||
$sql="SHOW TABLES FROM ".$database." ".$like.";";
|
$sql="SHOW TABLES FROM ".$database." ".$like.";";
|
||||||
//print $sql;
|
//print $sql;
|
||||||
$result = $this->query($sql);
|
$result = $this->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
while($row = $this->fetch_row($result))
|
while($row = $this->fetch_row($result))
|
||||||
{
|
{
|
||||||
$listtables[] = $row[0];
|
$listtables[] = $row[0];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $listtables;
|
return $listtables;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -627,10 +630,13 @@ class DoliDBMysql extends DoliDB
|
|||||||
|
|
||||||
dol_syslog($sql,LOG_DEBUG);
|
dol_syslog($sql,LOG_DEBUG);
|
||||||
$result = $this->query($sql);
|
$result = $this->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
while($row = $this->fetch_row($result))
|
while($row = $this->fetch_row($result))
|
||||||
{
|
{
|
||||||
$infotables[] = $row;
|
$infotables[] = $row;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $infotables;
|
return $infotables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -589,10 +589,13 @@ class DoliDBMysqli extends DoliDB
|
|||||||
$sql="SHOW TABLES FROM ".$database." ".$like.";";
|
$sql="SHOW TABLES FROM ".$database." ".$like.";";
|
||||||
//print $sql;
|
//print $sql;
|
||||||
$result = $this->query($sql);
|
$result = $this->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
while($row = $this->fetch_row($result))
|
while($row = $this->fetch_row($result))
|
||||||
{
|
{
|
||||||
$listtables[] = $row[0];
|
$listtables[] = $row[0];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $listtables;
|
return $listtables;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -610,10 +613,13 @@ class DoliDBMysqli extends DoliDB
|
|||||||
|
|
||||||
dol_syslog($sql,LOG_DEBUG);
|
dol_syslog($sql,LOG_DEBUG);
|
||||||
$result = $this->query($sql);
|
$result = $this->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
while($row = $this->fetch_row($result))
|
while($row = $this->fetch_row($result))
|
||||||
{
|
{
|
||||||
$infotables[] = $row;
|
$infotables[] = $row;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $infotables;
|
return $infotables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -861,10 +861,13 @@ class DoliDBPgsql extends DoliDB
|
|||||||
$like = '';
|
$like = '';
|
||||||
if ($table) $like = " AND table_name LIKE '".$table."'";
|
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");
|
$result = pg_query($this->db, "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'".$like." ORDER BY table_name");
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
while($row = $this->fetch_row($result))
|
while($row = $this->fetch_row($result))
|
||||||
{
|
{
|
||||||
$listtables[] = $row[0];
|
$listtables[] = $row[0];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $listtables;
|
return $listtables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -747,10 +747,13 @@ class DoliDBSqlite extends DoliDB
|
|||||||
$sql="SHOW TABLES FROM ".$database." ".$like.";";
|
$sql="SHOW TABLES FROM ".$database." ".$like.";";
|
||||||
//print $sql;
|
//print $sql;
|
||||||
$result = $this->query($sql);
|
$result = $this->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
while($row = $this->fetch_row($result))
|
while($row = $this->fetch_row($result))
|
||||||
{
|
{
|
||||||
$listtables[] = $row[0];
|
$listtables[] = $row[0];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $listtables;
|
return $listtables;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -769,10 +772,13 @@ class DoliDBSqlite extends DoliDB
|
|||||||
|
|
||||||
dol_syslog($sql,LOG_DEBUG);
|
dol_syslog($sql,LOG_DEBUG);
|
||||||
$result = $this->query($sql);
|
$result = $this->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
while($row = $this->fetch_row($result))
|
while($row = $this->fetch_row($result))
|
||||||
{
|
{
|
||||||
$infotables[] = $row;
|
$infotables[] = $row;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $infotables;
|
return $infotables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -831,10 +831,13 @@ class DoliDBSqlite3 extends DoliDB
|
|||||||
$sql="SHOW TABLES FROM ".$database." ".$like.";";
|
$sql="SHOW TABLES FROM ".$database." ".$like.";";
|
||||||
//print $sql;
|
//print $sql;
|
||||||
$result = $this->query($sql);
|
$result = $this->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
while($row = $this->fetch_row($result))
|
while($row = $this->fetch_row($result))
|
||||||
{
|
{
|
||||||
$listtables[] = $row[0];
|
$listtables[] = $row[0];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $listtables;
|
return $listtables;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -853,10 +856,13 @@ class DoliDBSqlite3 extends DoliDB
|
|||||||
|
|
||||||
dol_syslog($sql,LOG_DEBUG);
|
dol_syslog($sql,LOG_DEBUG);
|
||||||
$result = $this->query($sql);
|
$result = $this->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
while($row = $this->fetch_row($result))
|
while($row = $this->fetch_row($result))
|
||||||
{
|
{
|
||||||
$infotables[] = $row;
|
$infotables[] = $row;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $infotables;
|
return $infotables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -44,9 +44,10 @@ function versiontostring($versionarray)
|
|||||||
/**
|
/**
|
||||||
* Compare 2 versions (stored into 2 arrays).
|
* Compare 2 versions (stored into 2 arrays).
|
||||||
* To check if Dolibarr version is lower than (x,y,z), do "if versioncompare(versiondolibarrarray(), array(x.y.z)) <= 0"
|
* To check if Dolibarr version is lower than (x,y,z), do "if versioncompare(versiondolibarrarray(), array(x.y.z)) <= 0"
|
||||||
* For example: if (versioncompare(versiondolibarrarray(),array(4,0,-4)) >= 0) is true if version is 4.0 beta or higher.
|
* For example: if (versioncompare(versiondolibarrarray(),array(4,0,-4)) >= 0) is true if version is 4.0 alpha or higher.
|
||||||
* For example: if (versioncompare(versiondolibarrarray(),array(4,0,0)) >= 0) is true if version is 4.0 final or higher.
|
* For example: if (versioncompare(versiondolibarrarray(),array(4,0,0)) >= 0) is true if version is 4.0 final or higher.
|
||||||
* For example: if (versioncompare(versiondolibarrarray(),array(4,0,1)) >= 0) is true if version is 4.0.1 or higher.
|
* For example: if (versioncompare(versiondolibarrarray(),array(4,0,1)) >= 0) is true if version is 4.0.1 or higher.
|
||||||
|
* Alternative way to compare: if ((float) DOL_VERSION >= 4.0) is true if version is 4.0 alpha or higher (works only to compare first and second level)
|
||||||
*
|
*
|
||||||
* @param array $versionarray1 Array of version (vermajor,verminor,patch)
|
* @param array $versionarray1 Array of version (vermajor,verminor,patch)
|
||||||
* @param array $versionarray2 Array of version (vermajor,verminor,patch)
|
* @param array $versionarray2 Array of version (vermajor,verminor,patch)
|
||||||
|
|||||||
@ -79,7 +79,9 @@ function societe_prepare_head(Societe $object)
|
|||||||
if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES))
|
if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES))
|
||||||
{
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/societe/societecontact.php?socid='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/societe/societecontact.php?socid='.$object->id;
|
||||||
|
$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
|
||||||
$head[$h][1] = $langs->trans("ContactsAddresses");
|
$head[$h][1] = $langs->trans("ContactsAddresses");
|
||||||
|
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
|
||||||
$head[$h][2] = 'contact';
|
$head[$h][2] = 'contact';
|
||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
@ -88,6 +90,26 @@ function societe_prepare_head(Societe $object)
|
|||||||
{
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/societe/project.php?socid='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/societe/project.php?socid='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("Projects");
|
$head[$h][1] = $langs->trans("Projects");
|
||||||
|
$nbNote = 0;
|
||||||
|
$sql = "SELECT COUNT(n.rowid) as nb";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."projet as n";
|
||||||
|
$sql.= " WHERE fk_soc = ".$object->id;
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$nbNote=$obj->nb;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||||
$head[$h][2] = 'project';
|
$head[$h][2] = 'project';
|
||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -117,12 +117,24 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit)
|
|||||||
if ($duration_value == 0) return $time;
|
if ($duration_value == 0) return $time;
|
||||||
if ($duration_unit == 'h') return $time + (3600*$duration_value);
|
if ($duration_unit == 'h') return $time + (3600*$duration_value);
|
||||||
if ($duration_unit == 'w') return $time + (3600*24*7*$duration_value);
|
if ($duration_unit == 'w') return $time + (3600*24*7*$duration_value);
|
||||||
if ($duration_value > 0) $deltastring="+".abs($duration_value);
|
|
||||||
if ($duration_value < 0) $deltastring="-".abs($duration_value);
|
$deltastring='P';
|
||||||
if ($duration_unit == 'd') { $deltastring.=" day"; }
|
|
||||||
if ($duration_unit == 'm') { $deltastring.=" month"; }
|
if ($duration_value > 0){ $deltastring.=abs($duration_value); $sub= false; }
|
||||||
if ($duration_unit == 'y') { $deltastring.=" year"; }
|
if ($duration_value < 0){ $deltastring.=abs($duration_value); $sub= true; }
|
||||||
return strtotime($deltastring,$time);
|
if ($duration_unit == 'd') { $deltastring.="D"; }
|
||||||
|
if ($duration_unit == 'm') { $deltastring.="M"; }
|
||||||
|
if ($duration_unit == 'y') { $deltastring.="Y"; }
|
||||||
|
|
||||||
|
$date = new DateTime();
|
||||||
|
$date->setTimezone(new DateTimeZone('UTC'));
|
||||||
|
$date->setTimestamp($time);
|
||||||
|
$interval = new DateInterval($deltastring);
|
||||||
|
|
||||||
|
if($sub) $date->sub($interval);
|
||||||
|
else $date->add( $interval );
|
||||||
|
|
||||||
|
return $date->getTimestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -619,11 +619,9 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
|
|||||||
// If syslog module enabled
|
// If syslog module enabled
|
||||||
if (empty($conf->syslog->enabled)) return;
|
if (empty($conf->syslog->enabled)) return;
|
||||||
|
|
||||||
if (! empty($level))
|
|
||||||
{
|
|
||||||
// Test log level
|
// Test log level
|
||||||
$logLevels = array(LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG);
|
$logLevels = array(LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG);
|
||||||
if (!in_array($level, $logLevels))
|
if (!in_array($level, $logLevels, true))
|
||||||
{
|
{
|
||||||
throw new Exception('Incorrect log level');
|
throw new Exception('Incorrect log level');
|
||||||
}
|
}
|
||||||
@ -666,7 +664,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
|
|||||||
$loghandlerinstance->export($data,$suffixinfilename);
|
$loghandlerinstance->export($data,$suffixinfilename);
|
||||||
}
|
}
|
||||||
unset($data);
|
unset($data);
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($ident))
|
if (! empty($ident))
|
||||||
{
|
{
|
||||||
@ -1129,6 +1127,7 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
|||||||
if ($formatwithoutreduce != $format) { $format = $formatwithoutreduce; $reduceformat=1; } // so format 'dayreduceformat' is processed like day
|
if ($formatwithoutreduce != $format) { $format = $formatwithoutreduce; $reduceformat=1; } // so format 'dayreduceformat' is processed like day
|
||||||
|
|
||||||
// Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default.
|
// Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default.
|
||||||
|
// TODO Add format daysmallyear and dayhoursmallyear
|
||||||
if ($format == 'day') $format=($outputlangs->trans("FormatDateShort")!="FormatDateShort"?$outputlangs->trans("FormatDateShort"):$conf->format_date_short);
|
if ($format == 'day') $format=($outputlangs->trans("FormatDateShort")!="FormatDateShort"?$outputlangs->trans("FormatDateShort"):$conf->format_date_short);
|
||||||
else if ($format == 'hour') $format=($outputlangs->trans("FormatHourShort")!="FormatHourShort"?$outputlangs->trans("FormatHourShort"):$conf->format_hour_short);
|
else if ($format == 'hour') $format=($outputlangs->trans("FormatHourShort")!="FormatHourShort"?$outputlangs->trans("FormatHourShort"):$conf->format_hour_short);
|
||||||
else if ($format == 'hourduration') $format=($outputlangs->trans("FormatHourShortDuration")!="FormatHourShortDuration"?$outputlangs->trans("FormatHourShortDuration"):$conf->format_hour_short_duration);
|
else if ($format == 'hourduration') $format=($outputlangs->trans("FormatHourShortDuration")!="FormatHourShortDuration"?$outputlangs->trans("FormatHourShortDuration"):$conf->format_hour_short_duration);
|
||||||
@ -4267,7 +4266,7 @@ function picto_required()
|
|||||||
* Clean a string from all HTML tags and entities
|
* Clean a string from all HTML tags and entities
|
||||||
*
|
*
|
||||||
* @param string $StringHtml String to clean
|
* @param string $StringHtml String to clean
|
||||||
* @param integer $removelinefeed Replace also all lines feeds by a space, otherwise only last one are removed
|
* @param integer $removelinefeed 1=Replace also all lines feeds by a space, 0=Only last one are removed
|
||||||
* @param string $pagecodeto Encoding of input/output string
|
* @param string $pagecodeto Encoding of input/output string
|
||||||
* @return string String cleaned
|
* @return string String cleaned
|
||||||
*
|
*
|
||||||
@ -5257,7 +5256,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode=
|
|||||||
if (preg_match('/SUBSTITUTION_([^_]+)/i',$values[2],$reg))
|
if (preg_match('/SUBSTITUTION_([^_]+)/i',$values[2],$reg))
|
||||||
{
|
{
|
||||||
$substitutionarray=array();
|
$substitutionarray=array();
|
||||||
complete_substitutions_array($substitutionarray,$langs,$object);
|
complete_substitutions_array($substitutionarray,$langs,$object,array('needforkey'=>$values[2]));
|
||||||
$label=make_substitutions($reg[1], $substitutionarray);
|
$label=make_substitutions($reg[1], $substitutionarray);
|
||||||
}
|
}
|
||||||
else $label=$langs->trans($values[2]);
|
else $label=$langs->trans($values[2]);
|
||||||
@ -5277,7 +5276,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode=
|
|||||||
if (preg_match('/SUBSTITUTION_([^_]+)/i',$values[2],$reg))
|
if (preg_match('/SUBSTITUTION_([^_]+)/i',$values[2],$reg))
|
||||||
{
|
{
|
||||||
$substitutionarray=array();
|
$substitutionarray=array();
|
||||||
complete_substitutions_array($substitutionarray,$langs,$object);
|
complete_substitutions_array($substitutionarray,$langs,$object,array('needforkey'=>$values[2]));
|
||||||
$label=make_substitutions($reg[1], $substitutionarray);
|
$label=make_substitutions($reg[1], $substitutionarray);
|
||||||
}
|
}
|
||||||
else $label=$langs->trans($values[2]);
|
else $label=$langs->trans($values[2]);
|
||||||
|
|||||||
@ -1971,6 +1971,11 @@ function getElementProperties($element_type)
|
|||||||
$module='resource';
|
$module='resource';
|
||||||
$subelement='dolresource';
|
$subelement='dolresource';
|
||||||
}
|
}
|
||||||
|
if ($element_type == 'propaldet') {
|
||||||
|
$classpath = 'comm/propal/class';
|
||||||
|
$module='propal';
|
||||||
|
$subelement='propaleligne';
|
||||||
|
}
|
||||||
$classfile = strtolower($subelement);
|
$classfile = strtolower($subelement);
|
||||||
$classname = ucfirst($subelement);
|
$classname = ucfirst($subelement);
|
||||||
|
|
||||||
|
|||||||
@ -110,6 +110,11 @@ function project_prepare_head($object)
|
|||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/projet/info.php?id='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans("Info");
|
||||||
|
$head[$h][2] = 'info';
|
||||||
|
$h++;
|
||||||
|
|
||||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'project','remove');
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'project','remove');
|
||||||
|
|
||||||
return $head;
|
return $head;
|
||||||
@ -526,7 +531,8 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
|||||||
* Output a task line into a pertime intput mode
|
* Output a task line into a pertime intput mode
|
||||||
*
|
*
|
||||||
* @param string $inc Line number (start to 0, then increased by recursive call)
|
* @param string $inc Line number (start to 0, then increased by recursive call)
|
||||||
* @param string $parent Id of parent project to show (0 to show all)
|
* @param string $parent Id of parent task to show (0 to show all)
|
||||||
|
* @param User|null $fuser Restrict list to user if defined
|
||||||
* @param Task[] $lines Array of lines
|
* @param Task[] $lines Array of lines
|
||||||
* @param int $level Level (start to 0, then increased/decrease by recursive call)
|
* @param int $level Level (start to 0, then increased/decrease by recursive call)
|
||||||
* @param string $projectsrole Array of roles user has on project
|
* @param string $projectsrole Array of roles user has on project
|
||||||
@ -534,40 +540,61 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
|||||||
* @param string $mine Show only task lines I am assigned to
|
* @param string $mine Show only task lines I am assigned to
|
||||||
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
|
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
|
||||||
* @param int $preselectedday Preselected day
|
* @param int $preselectedday Preselected day
|
||||||
|
* @param boolean $var Var for css of lines
|
||||||
* @return $inc
|
* @return $inc
|
||||||
*/
|
*/
|
||||||
function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=1, $preselectedday='')
|
function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=1, $preselectedday='', $var=false)
|
||||||
{
|
{
|
||||||
global $db, $user, $bc, $langs;
|
global $db, $user, $bc, $langs;
|
||||||
global $form, $formother, $projectstatic, $taskstatic;
|
global $form, $formother, $projectstatic, $taskstatic;
|
||||||
|
|
||||||
$lastprojectid=0;
|
$lastprojectid=0;
|
||||||
|
$workloadforid=array();
|
||||||
$var=true;
|
$lineswithoutlevel0=array();
|
||||||
|
|
||||||
$numlines=count($lines);
|
$numlines=count($lines);
|
||||||
|
|
||||||
|
// Create a smaller array with sublevels only to be used later. This increase dramatically performances.
|
||||||
|
if ($parent == 0) // Always and only if at first level
|
||||||
|
{
|
||||||
|
for ($i = 0 ; $i < $numlines ; $i++)
|
||||||
|
{
|
||||||
|
if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
|
||||||
|
|
||||||
for ($i = 0 ; $i < $numlines ; $i++)
|
for ($i = 0 ; $i < $numlines ; $i++)
|
||||||
{
|
{
|
||||||
if ($parent == 0) $level = 0;
|
if ($parent == 0) $level = 0;
|
||||||
|
|
||||||
if ($lines[$i]->fk_parent == $parent)
|
if ($lines[$i]->fk_task_parent == $parent)
|
||||||
{
|
{
|
||||||
// Break on a new project
|
|
||||||
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
|
|
||||||
{
|
|
||||||
$var = !$var;
|
|
||||||
$lastprojectid=$lines[$i]->fk_project;
|
|
||||||
|
|
||||||
if ($preselectedday)
|
|
||||||
{
|
|
||||||
$projectstatic->id = $lines[$i]->fk_project;
|
|
||||||
$projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent into this->weekWorkLoad and this->weekWorkLoadPerTaks for all day of a week
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we want all or we have a role on task, we show it
|
// If we want all or we have a role on task, we show it
|
||||||
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
|
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
|
||||||
{
|
{
|
||||||
|
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
|
||||||
|
|
||||||
|
// Break on a new project
|
||||||
|
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
|
||||||
|
{
|
||||||
|
$lastprojectid=$lines[$i]->fk_project;
|
||||||
|
if ($preselectedday)
|
||||||
|
{
|
||||||
|
$projectstatic->id = $lines[$i]->fk_project;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($workloadforid[$projectstatic->id]))
|
||||||
|
{
|
||||||
|
if ($preselectedday)
|
||||||
|
{
|
||||||
|
$projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
|
||||||
|
$workloadforid[$projectstatic->id]=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$projectstatic->id=$lines[$i]->fk_project;
|
$projectstatic->id=$lines[$i]->fk_project;
|
||||||
$projectstatic->ref=$lines[$i]->projectref;
|
$projectstatic->ref=$lines[$i]->projectref;
|
||||||
$projectstatic->title=$lines[$i]->projectlabel;
|
$projectstatic->title=$lines[$i]->projectlabel;
|
||||||
@ -626,7 +653,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t
|
|||||||
|
|
||||||
// Time spent by user
|
// Time spent by user
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
$tmptimespent=$taskstatic->getSummaryOfTimeSpent();
|
$tmptimespent=$taskstatic->getSummaryOfTimeSpent($fuser->id);
|
||||||
if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'],'allhourmin');
|
if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'],'allhourmin');
|
||||||
else print '--:--';
|
else print '--:--';
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
@ -681,7 +708,11 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t
|
|||||||
|
|
||||||
$inc++;
|
$inc++;
|
||||||
$level++;
|
$level++;
|
||||||
if ($lines[$i]->id) projectLinesPerDay($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday);
|
if ($lines[$i]->id > 0)
|
||||||
|
{
|
||||||
|
if ($parent == 0) projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lineswithoutlevel0, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $var);
|
||||||
|
else projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $var);
|
||||||
|
}
|
||||||
$level--;
|
$level--;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -698,55 +729,85 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t
|
|||||||
/**
|
/**
|
||||||
* Output a task line into a perday intput mode
|
* Output a task line into a perday intput mode
|
||||||
*
|
*
|
||||||
* @param string $inc Line number (start to 0, then increased by recursive call)
|
* @param string $inc Line output identificator (start to 0, then increased by recursive call)
|
||||||
* @param int $firstdaytoshow First day to show
|
* @param int $firstdaytoshow First day to show
|
||||||
* @param User|null $fuser Restrict list to user if defined
|
* @param User|null $fuser Restrict list to user if defined
|
||||||
* @param string $parent Id of parent project to show (0 to show all)
|
* @param string $parent Id of parent task to show (0 to show all)
|
||||||
* @param Task[] $lines Array of lines
|
* @param Task[] $lines Array of lines (list of tasks but we will show only if we have a specific role on task)
|
||||||
* @param int $level Level (start to 0, then increased/decrease by recursive call)
|
* @param int $level Level (start to 0, then increased/decrease by recursive call)
|
||||||
* @param string $projectsrole Array of roles user has on project
|
* @param string $projectsrole Array of roles user has on project
|
||||||
* @param string $tasksrole Array of roles user has on task
|
* @param string $tasksrole Array of roles user has on task
|
||||||
* @param string $mine Show only task lines I am assigned to
|
* @param string $mine Show only task lines I am assigned to
|
||||||
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
|
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
|
||||||
|
* @param boolean $var Var for css of lines
|
||||||
* @return $inc
|
* @return $inc
|
||||||
*/
|
*/
|
||||||
function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=1)
|
function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=1, $var=false)
|
||||||
{
|
{
|
||||||
global $db, $user, $bc, $langs;
|
global $conf, $db, $user, $bc, $langs;
|
||||||
global $form, $formother, $projectstatic, $taskstatic;
|
global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
|
||||||
|
|
||||||
$lastprojectid=0;
|
|
||||||
|
|
||||||
$var=true;
|
|
||||||
|
|
||||||
$numlines=count($lines);
|
$numlines=count($lines);
|
||||||
|
|
||||||
|
$lastprojectid=0;
|
||||||
|
$workloadforid=array();
|
||||||
|
$lineswithoutlevel0=array();
|
||||||
|
|
||||||
|
// Create a smaller array with sublevels only to be used later. This increase dramatically performances.
|
||||||
|
if ($parent == 0) // Always and only if at first level
|
||||||
|
{
|
||||||
|
for ($i = 0 ; $i < $numlines ; $i++)
|
||||||
|
{
|
||||||
|
if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//dol_syslog('projectLinesPerWeek inc='.$inc.' firstdaytoshow='.$firstdaytoshow.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
|
||||||
|
|
||||||
for ($i = 0 ; $i < $numlines ; $i++)
|
for ($i = 0 ; $i < $numlines ; $i++)
|
||||||
{
|
{
|
||||||
if ($parent == 0) $level = 0;
|
if ($parent == 0) $level = 0;
|
||||||
|
|
||||||
if ($lines[$i]->fk_parent == $parent)
|
if ($lines[$i]->fk_task_parent == $parent)
|
||||||
{
|
{
|
||||||
// Break on a new project
|
|
||||||
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
|
|
||||||
{
|
|
||||||
$var = !$var;
|
|
||||||
$lastprojectid=$lines[$i]->fk_project;
|
|
||||||
|
|
||||||
$projectstatic->id = $lines[$i]->fk_project;
|
|
||||||
$projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id); // Load time spent into this->weekWorkLoad and this->weekWorkLoadPerTaks for all day of a week
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we want all or we have a role on task, we show it
|
// If we want all or we have a role on task, we show it
|
||||||
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
|
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
|
||||||
{
|
{
|
||||||
|
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
|
||||||
|
|
||||||
|
// Break on a new project
|
||||||
|
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
|
||||||
|
{
|
||||||
|
//$var = ! $var;
|
||||||
|
$lastprojectid=$lines[$i]->fk_project;
|
||||||
|
$projectstatic->id = $lines[$i]->fk_project;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($workloadforid[$projectstatic->id]))
|
||||||
|
{
|
||||||
|
$projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
|
||||||
|
$workloadforid[$projectstatic->id]=1;
|
||||||
|
}
|
||||||
|
|
||||||
print "<tr ".$bc[$var].">\n";
|
print "<tr ".$bc[$var].">\n";
|
||||||
|
|
||||||
// Project
|
if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY))
|
||||||
|
{
|
||||||
|
// Thirdparty
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
|
$thirdpartystatic->id=$lines[$i]->socid;
|
||||||
|
$thirdpartystatic->name=$lines[$i]->thirdparty_name;
|
||||||
|
print $thirdpartystatic->getNomUrl(1, 'project', 10);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Project
|
||||||
|
print '<td class="nowrap">'.$var;
|
||||||
$projectstatic->id=$lines[$i]->fk_project;
|
$projectstatic->id=$lines[$i]->fk_project;
|
||||||
$projectstatic->ref=$lines[$i]->projectref;
|
$projectstatic->ref=$lines[$i]->projectref;
|
||||||
$projectstatic->title=$lines[$i]->projectlabel;
|
$projectstatic->title=$lines[$i]->projectlabel;
|
||||||
$projectstatic->public=$lines[$i]->public;
|
$projectstatic->public=$lines[$i]->public;
|
||||||
|
$projectstatic->thirdparty_name=$lines[$i]->thirdparty_name;
|
||||||
print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
|
print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
|
||||||
print "</td>";
|
print "</td>";
|
||||||
|
|
||||||
@ -796,7 +857,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
|
|
||||||
// Time spent by user
|
// Time spent by user
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
$tmptimespent=$taskstatic->getSummaryOfTimeSpent();
|
$tmptimespent=$taskstatic->getSummaryOfTimeSpent($fuser->id);
|
||||||
if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'],'allhourmin');
|
if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'],'allhourmin');
|
||||||
else print '--:--';
|
else print '--:--';
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
@ -844,6 +905,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
$tableCell.='</td>';
|
$tableCell.='</td>';
|
||||||
print $tableCell;
|
print $tableCell;
|
||||||
}
|
}
|
||||||
|
dol_syslog("yyy");
|
||||||
|
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject"));
|
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject"));
|
||||||
@ -853,9 +915,14 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Call to show task with a lower level (task under the current task)
|
||||||
$inc++;
|
$inc++;
|
||||||
$level++;
|
$level++;
|
||||||
if ($lines[$i]->id) projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask);
|
if ($lines[$i]->id > 0)
|
||||||
|
{
|
||||||
|
if ($parent == 0) projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lineswithoutlevel0, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $var);
|
||||||
|
else projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $var);
|
||||||
|
}
|
||||||
$level--;
|
$level--;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
*/
|
*/
|
||||||
function user_prepare_head($object)
|
function user_prepare_head($object)
|
||||||
{
|
{
|
||||||
global $db, $langs, $conf, $user;
|
global $langs, $conf, $user, $db;
|
||||||
|
|
||||||
$langs->load("users");
|
$langs->load("users");
|
||||||
|
|
||||||
@ -88,6 +88,36 @@ function user_prepare_head($object)
|
|||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notifications
|
||||||
|
if ($user->societe_id == 0 && ! empty($conf->notification->enabled))
|
||||||
|
{
|
||||||
|
$nbNote = 0;
|
||||||
|
$sql = "SELECT COUNT(n.rowid) as nb";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n";
|
||||||
|
$sql.= " WHERE fk_user = ".$object->id;
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$nbNote=$obj->nb;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/user/notify/card.php?id='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans("Notifications");
|
||||||
|
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||||
|
$head[$h][2] = 'notify';
|
||||||
|
$h++;
|
||||||
|
}
|
||||||
|
|
||||||
// Show more tabs from modules
|
// Show more tabs from modules
|
||||||
// Entries must be declared in modules descriptor with line
|
// Entries must be declared in modules descriptor with line
|
||||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user