Merge branch 'develop' of github.com:Dolibarr/dolibarr into develop

This commit is contained in:
Maxime Kohlhaas 2015-04-14 13:01:41 +02:00
commit 4d119065a8
2361 changed files with 78686 additions and 17188 deletions

View File

@ -104,16 +104,15 @@ before_script:
script:
- cd htdocs/install
- date
# - php upgrade.php 3.4.0 3.5.0 > upgrade.log
# - php upgrade2.php 3.4.0 3.5.0 > upgrade2.log
- php upgrade.php 3.5.0 3.6.0 >> upgrade.log
- php upgrade2.php 3.5.0 3.6.0 >> upgrade2.log
- php upgrade.php 3.6.0 3.7.0 >> upgrade.log
# - cat upgrade360370.log
- php upgrade2.php 3.6.0 3.7.0 >> upgrade2.log
- php upgrade.php 3.7.0 3.8.0 >> upgrade.log
- php upgrade2.php 3.7.0 3.8.0 >> upgrade2.log
# - cat upgrade2.log
# - php upgrade.php 3.4.0 3.5.0 ignoredbversion > upgrade340350.log
# - php upgrade2.php 3.4.0 3.5.0 ignoredbversion > upgrade340350-2.log
- php upgrade.php 3.5.0 3.6.0 ignoredbversion > upgrade350360.log
- php upgrade2.php 3.5.0 3.6.0 ignoredbversion > upgrade350360-2.log
- php upgrade.php 3.6.0 3.7.0 ignoredbversion > upgrade360370.log
- php upgrade2.php 3.6.0 3.7.0 ignoredbversion > upgrade360370-2.log
- php upgrade.php 3.7.0 3.8.0 ignoredbversion > upgrade370380.log
- php upgrade2.php 3.7.0 3.8.0 ignoredbversion > upgrade370380-2.log
# - cat upgrade370380-2.log
- cd ../..
- date
- phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php

View File

@ -1,6 +1,6 @@
[main]
host = https://www.transifex.com
lang_map = uz: uz_UZ
lang_map = uz: uz_UZ, sw: sw_SW
[dolibarr.accountancy]
file_filter = htdocs/langs/<lang>/accountancy.lang
@ -146,6 +146,12 @@ source_file = htdocs/langs/en_US/holiday.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.incoterm]
file_filter = htdocs/langs/<lang>/incoterm.lang
source_file = htdocs/langs/en_US/incoterm.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.install]
file_filter = htdocs/langs/<lang>/install.lang
source_file = htdocs/langs/en_US/install.lang
@ -176,6 +182,12 @@ source_file = htdocs/langs/en_US/link.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.loan]
file_filter = htdocs/langs/<lang>/loan.lang
source_file = htdocs/langs/en_US/loan.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.mailmanspip]
file_filter = htdocs/langs/<lang>/mailmanspip.lang
source_file = htdocs/langs/en_US/mailmanspip.lang

View File

@ -3,28 +3,33 @@ How to contribute to Dolibarr
Bug reports and feature requests
--------------------------------
Issues are tracked at [Doliforge](https://doliforge.org/projects/dolibarr)
*You need to create an account before being able to use the "Bugs & Tasks" feature.*
*Note*: Issues are not a support forum. If you need help using the software, please use [the forums](http://www.dolibarr.org/forum).
1. Use the search engine to check if nobody's already reported your problem.
2. Choose the right section. (Bugs or Task and Feature Request).
3. Report with as much detail as possible (Use screenshots or even screencasts whenever possible).
**NEW**
Code
----
Issues are now managed on [GitHub](https://github.com/Dolibarr/dolibarr/Issues).
1. Please [use the search engine](https://help.github.com/articles/searching-issues) to check if nobody's already reported your problem.
2. [Create an issue](https://help.github.com/articles/creating-an-issue). Choose an appropriate title. Prepend appropriately with Bug or Feature Request.
3. Report with as much detail as possible ([Use screenshots or even screencasts whenever possible](https://help.github.com/articles/issue-attachments)).
We're still figuring out how to migrate old issues to GitHub. In the meantime, they are still available at [Doliforge](https://doliforge.org/projects/dolibarr).
<a name=code></a>Code
---------------------
### Basic workflow
1. Fork the [GitHub repository](https://github.com/Dolibarr/dolibarr).
1. [Fork](https://help.github.com/articles/fork-a-repo) the [GitHub repository](https://github.com/Dolibarr/dolibarr).
2. Clone your fork.
3. Choose a branch(See the Branches section below).
3. Choose a branch(See the [Branches](#branches) section below).
4. Commit and push your changes.
5. Make a pull request.
5. [Make a pull request](https://help.github.com/articles/creating-a-pull-request).
### Branches
### <a name=branches></a>Branches
Unless you're fixing a bug, all pull request should be made against the *develop* branch.
Unless you're fixing a bug, all pull requests should be made against the *develop* branch.
If you're fixing a bug, it is preferred that you cook your fix and pull request it
against the oldest version affected that's still supported.
@ -40,23 +45,27 @@ Please don't edit the ChangeLog file. A project manager will update it from your
Use clear commit messages with the following structure:
<pre>
KEYWORD Short description
FIX|Fix #456 Short description (where #456 is number of bug fix, if it exists. In upper case to appear into ChangeLog)
or
CLOSE|Close #456 Short description (where #456 is number of feature request, if it exists. In upper case to appear into ChangeLog)
or
NEW|New Short description (In upper case to appear into ChangeLog, use this if you add a feature not tracked, otherwise use CLOSE #456)
or
Short description (when the commit is not introducing feature nor closing a bug)
Long description (Can span accross multiple lines).
</pre>
Where KEYWORD is one of:
### Pull Requests
When submitting a pull request, use same rule than Commits. With upper case keyword to appear into ChangeLog.
- "FIXED:" for bug fixes. In upper case to appear into ChangeLog. (May be followed by the bug number i.e: #456)
- "NEW:" for new features. In upper case to appear into ChangeLog. (May be followed by the task number i.e: #123)
- void, don't put a keyword if the commit is not introducing feature or closing a bug.
### Resources
[Developer documentation](http://wiki.dolibarr.org/index.php/Developer_documentation)
Translations
------------
en_US and delta languages (i.e: fr_XX) are maintained in the repository. See Code section above.
The source language (en_US) is maintained in the repository. See the [Code](#code) section above.
All other translations are managed online at [Transifex](https://www.transifex.com/projects/p/dolibarr).

View File

@ -2,6 +2,13 @@
English Dolibarr ChangeLog
--------------------------------------------------------------
WARNING: Do not try to make any Dolibarr upgrade if you are running Mysql version 5.5.40.
Mysql version 5.5.40 has a very critical bug making your data beeing definitely lost.
You may also experience troubles with Mysql 5.5.41 with error "Lost connection" during migration.
Upgrading to any other version or database system is abolutely required BEFORE trying to
make a migration.
***** ChangeLog for 3.8 compared to 3.7.* *****
For users:
- New: Add Option to not change date on cloning project
@ -31,7 +38,8 @@ WARNING: Following changes may create regression for some external modules, but
Dolibarr better:
- Removed hoo supplierorderdao into supplier order creation. This is a business event, so we must use the
trigger ORDER_SUPPLIER_CREATE instead.
- Hooks 'printLeftBlock' and 'formConfirm' are now compliant with hook development rules. They are
"addreplace" hooks, so you must return content with "->resprints='mycontent'" and not with "return 'mycontent'"
***** ChangeLog for 3.7 compared to 3.6.* *****
@ -162,6 +170,7 @@ For translators:
- New: When a translation is not available we always jump to en_US and only en_US.
For developers:
- New: Syslog module can be set to use ChromePHP plugin to output log server into browser console.
- New: Add a css style "cursorpointer".
- New: Select list of users can return user into hierarchy.
- New: getBrowserInfo can return type of layout of browser (classic/phone/tablet)
@ -233,6 +242,13 @@ Dolibarr better:
- Fix: [ bug #1790 ] Email form behaves in an unexpected way when pressing Enter key
- Fix: Bad SEPA xml file creation
- Fix: [ bug #1892 ] PHP Fatal error when using USER_UPDATE_SESSION trigger and adding a supplier invoice payment
- Fix: Showing system error if not enough stock of product into orders creation with lines
- Fix: [ bug #2543 ] Untranslated "Contract" origin string when creating an invoice from a contract
- Fix: [ bug #2534 ] SQL error when editing a supplier invoice line
- Fix: [ bug #2535 ] Untranslated string in "Linked objects" page of a project
- Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme
- Fix: [ bug #2542 ] Contracts store localtax preferences
- Fix: Bad permission assignments for stock movements actions
***** ChangeLog for 3.6.2 compared to 3.6.1 *****
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.

View File

@ -28,9 +28,6 @@ Note: Prerequisites to build autoexe DoliWamp package:
recommanded), open file build/exe/doliwamp.iss and click on button "Compile".
The .exe file will be build into directory build.
- To build a translaction package, launch the script
> perl makepack-dolibarrlang.pl
- To build a theme package, launch the script
> perl makepack-dolibarrtheme.pl

View File

@ -3,4 +3,4 @@ dolibarr (3.8.0-3) UNRELEASED; urgency=low
[ Laurent Destailleur (eldy) ]
* New upstream release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 3 Mar 2015 12:00:00 +0100
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Sun, 21 March 2015 12:00:00 +0100

View File

@ -2,7 +2,7 @@
#----------------------------------------------------------------------------
# \file build/makepack-dolibarr.pl
# \brief Dolibarr package builder (tgz, zip, rpm, deb, exe, aps)
# \author (c)2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
# \author (c)2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
#
# This is list of constant you can set to have generated packages moved into a specific dir:
#DESTIBETARC='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/lastbuild'
@ -15,8 +15,12 @@
use Cwd;
# Change this to defined target for option 98 and 99
$PROJECT="dolibarr";
$RPMSUBVERSION="auto"; # auto use value found into BUILD
$PUBLISHSTABLE="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr";
$PUBLISHBETARC="ldestailleur\@asso.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files";
@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages
%REQUIREMENTPUBLISH=(
@ -41,6 +45,7 @@ $RPMSUBVERSION="auto"; # auto use value found into BUILD
"makensis.exe"=>"NSIS"
);
$RPMSUBVERSION="auto"; # auto use value found into BUILD
if (-d "/usr/src/redhat") { $RPMDIR="/usr/src/redhat"; } # redhat
if (-d "/usr/src/packages") { $RPMDIR="/usr/src/packages"; } # opensuse
if (-d "/usr/src/RPM") { $RPMDIR="/usr/src/RPM"; } # mandrake
@ -59,8 +64,6 @@ $DIR||='.'; $DIR =~ s/([^\/\\])[\\\/]+$/$1/;
$SOURCE="$DIR/..";
$DESTI="$SOURCE/build";
$PUBLISHSTABLE="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr";
$PUBLISHBETARC="ldestailleur\@asso.dolibarr.org:/home/dolibarr/dolibarr.org/files";
if (! $ENV{"DESTIBETARC"} || ! $ENV{"DESTISTABLE"})
{
print "Error: Missing environment variables.\n";
@ -213,9 +216,9 @@ else {
printf(" %2d - %-14s (%s)\n",$cpt,$target,"Need ".$REQUIREMENTTARGET{$target});
}
$cpt=98;
printf(" %2d - %-14s (%s)\n",$cpt,"ASSO (publish)","Need ".join(",",values %REQUIREMENTPUBLISH));
printf(" %2d - %-14s (%s)\n",$cpt,"ASSO (publish)","Need ".$REQUIREMENTPUBLISH{"ASSO"});
$cpt=99;
printf(" %2d - %-14s (%s)\n",$cpt,"SF (publish)","Need ".join(",",values %REQUIREMENTPUBLISH));
printf(" %2d - %-14s (%s)\n",$cpt,"SF (publish)","Need ".$REQUIREMENTPUBLISH{"SF"});
# Ask which target to build
print "Choose one target number or several separated with space (0 - ".$cpt."): ";
@ -1049,9 +1052,16 @@ if ($nboftargetok) {
if (! $filesize) { next; }
print "\n";
print "Publish file ".$file." to ".$filestoscan{$file}."\n";
$destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD;
if ($target eq 'SF') {
$destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD;
print "Publish file ".$file." to $NEWPUBLISH/".$filestoscan{$file}."\n";
}
else
{
$destFolder="$NEWPUBLISH";
print "Publish file ".$file." to $NEWPUBLISH\n";
}
# mkdir
#my $ssh = Net::SSH::Perl->new("frs.sourceforge.net");

View File

@ -8,7 +8,7 @@ This files describe steps made by Dolibarr packaging team to make a
beta version of Dolibarr, step by step.
- Check all files are commited.
- Update version/info in /ChangeLog
- Update version/info in ChangeLog. To generate a changelog, you can do "git log x.y.z..HEAD --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIXED\|NEW'"
- Update version number with x.y.z-w in htdocs/filefunc.inc.php
- Update version number with x.y.z-w in build/debian/changelog
- Update version number with x.y.z-w in build/rpm/*.spec
@ -17,10 +17,11 @@ beta version of Dolibarr, step by step.
- Create a branch (x.y).
- Run makepack-dolibarr.pl to generate all packages.
- Move build files into www.dolibarr.org web site
(/home/dolibarr/wwwroot/files/lastbuild).
- Post a news on dolibarr.org/dolibarr.fr
- Post a news on dolibarr.org/dolibarr.fr + social networks
- Send mail on mailings-list
@ -35,14 +36,16 @@ complete release of Dolibarr, step by step.
- Update version number with x.y.z in build/rpm/*.spec
- Commit all changes.
- Build Dolibarr and DoliWamp packages with makepack-dolibarr.pl
- Run makepack-dolibarr.pl to generate all packages.
- Check content of built packages.
- Move build files into www.dolibarr.org web site
(/home/dolibarr/wwwroot/files/stable).
- Run makepack-dolibarr.pl again with option to publish files on
sourceforge. This will also add official tag.
- Edit symbolic links in directory "/home/dolibarr/wwwroot/files/stable/xxx"
on server to point to new files (used by some web sites).
- Post a news on dolibarr.org/dolibarr.fr + social networks
- Send mail on mailings-list
- Send news on OpenSource web sites (if major beta or release)

View File

@ -172,6 +172,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/contrat
%_datadir/dolibarr/htdocs/core
%_datadir/dolibarr/htdocs/cron
%_datadir/dolibarr/htdocs/don
%_datadir/dolibarr/htdocs/ecm
%_datadir/dolibarr/htdocs/expedition
%_datadir/dolibarr/htdocs/expensereport
@ -186,6 +187,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/install
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
%_datadir/dolibarr/htdocs/livraison
%_datadir/dolibarr/htdocs/loan
%_datadir/dolibarr/htdocs/mailmanspip
%_datadir/dolibarr/htdocs/margin
%_datadir/dolibarr/htdocs/opensurvey

View File

@ -252,6 +252,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/contrat
%_datadir/dolibarr/htdocs/core
%_datadir/dolibarr/htdocs/cron
%_datadir/dolibarr/htdocs/don
%_datadir/dolibarr/htdocs/ecm
%_datadir/dolibarr/htdocs/expedition
%_datadir/dolibarr/htdocs/expensereport
@ -266,6 +267,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/install
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
%_datadir/dolibarr/htdocs/livraison
%_datadir/dolibarr/htdocs/loan
%_datadir/dolibarr/htdocs/mailmanspip
%_datadir/dolibarr/htdocs/margin
%_datadir/dolibarr/htdocs/opensurvey

View File

@ -169,6 +169,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/contrat
%_datadir/dolibarr/htdocs/core
%_datadir/dolibarr/htdocs/cron
%_datadir/dolibarr/htdocs/don
%_datadir/dolibarr/htdocs/ecm
%_datadir/dolibarr/htdocs/expedition
%_datadir/dolibarr/htdocs/expensereport
@ -183,6 +184,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/install
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
%_datadir/dolibarr/htdocs/livraison
%_datadir/dolibarr/htdocs/loan
%_datadir/dolibarr/htdocs/mailmanspip
%_datadir/dolibarr/htdocs/margin
%_datadir/dolibarr/htdocs/opensurvey

View File

@ -180,6 +180,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/contrat
%_datadir/dolibarr/htdocs/core
%_datadir/dolibarr/htdocs/cron
%_datadir/dolibarr/htdocs/don
%_datadir/dolibarr/htdocs/ecm
%_datadir/dolibarr/htdocs/expedition
%_datadir/dolibarr/htdocs/expensereport
@ -194,6 +195,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/install
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
%_datadir/dolibarr/htdocs/livraison
%_datadir/dolibarr/htdocs/loan
%_datadir/dolibarr/htdocs/mailmanspip
%_datadir/dolibarr/htdocs/margin
%_datadir/dolibarr/htdocs/opensurvey

View File

@ -164,8 +164,6 @@
<severity>0</severity>
</rule>
<rule ref="Generic.VersionControl.SubversionProperties" />
<!-- Disallow usage of tab -->
<!-- <rule ref="Generic.WhiteSpace.DisallowTabIndent" /> -->

View File

@ -70,7 +70,7 @@ $myproduct->libelle = 'libelle';
$myproduct->price = '10';
$myproduct->price_base_type = 'HT';
$myproduct->tva_tx = '19.6';
$myproduct->type = 0;
$myproduct->type = Product::TYPE_PRODUCT;
$myproduct->status = 1;
$myproduct->description = 'Description';
$myproduct->note = 'Note';

68
dev/fixaltlanguages.sh Executable file
View File

@ -0,0 +1,68 @@
#!/bin/sh
# Recursively deduplicate file lines on a per file basis
# Useful to deduplicate language files
#
# Needs awk 4.0 for the inplace fixing command
#
# Raphaël Doursenaud - rdoursenaud@gpcsolutions.fr
# Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then
echo "Scan alternate language files and remove entries found into parent file"
echo "Usage: fixaltlanguages.sh (list|fix) (all|file.lang) [xx_XX]"
exit
fi
if [ "x$2" = "x" ]
then
echo "Scan alternate language files and remove entries found into parent file"
echo "Usage: fixaltlanguages.sh (list|fix) (all|file.lang) [xx_XX]"
exit
fi
# To detect
if [ "x$1" = "xlist" ]
then
echo Feature not available
fi
# To fix
if [ "x$1" = "xfix" ]
then
for dir in `find htdocs/langs/$3* -type d`
do
dirshort=`basename $dir`
#echo $dirshort
export aa=`echo $dirshort | nawk -F"_" '{ print $1 }'`
export bb=`echo $dirshort | nawk -F"_" '{ print $2 }'`
aaupper=`echo $dirshort | nawk -F"_" '{ print toupper($1) }'`
if [ $aaupper = "EN" ]
then
aaupper="US"
fi
bblower=`echo $dirshort | nawk -F"_" '{ print tolower($2) }'`
if [ "$aa" != "$bblower" -a "$dirshort" != "en_US" ]
then
reflang="htdocs/langs/"$aa"_"$aaupper
if [ -d $reflang ]
then
echo "***** Process language "$aa"_"$bb" - Search original into "$reflang
echo $dirshort est une langue alternative de $reflang
echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
for fic in `ls htdocs/langs/${aa}_${bb}/*.delta`; do f=`echo $fic | sed -e 's/\.delta//'`; echo $f; mv $f.delta $f; done
for fic in `ls htdocs/langs/${aa}_${bb}/*.lang`;
do f=`cat $fic | wc -l`;
#echo $f lines into file $fic;
if [ $f = 1 ]
then
echo Only one line remainging into file $fic, we delete it;
rm $fic
fi;
done
fi
fi
done;
fi

View File

@ -10,7 +10,7 @@
# Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then
echo "This script clean files with CR+LF into files with LF only. All source files are included, also files into includes."
echo "This script detect or clean files with CR+LF into files with LF only. All source files are included, also files into includes."
echo "Usage: fixdosfiles.sh [list|fix]"
fi

View File

@ -7,6 +7,7 @@
# Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then
echo "Detect duplicate translation keys inside a file (there is no cross file check)."
echo "Usage: detectduplicatelangkey.sh (list|fix)"
fi

View File

@ -9,17 +9,19 @@
# Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then
echo "Find exact duplicated lines into file (not cross file checking)"
echo "Usage: deduplicatefilelinesrecursively.sh [list|fix]"
fi
# To detect
if [ "x$1" = "xlist" ]
then
for file in `find . -type f -name *.lang`
for file in `find htdocs/langs/en_US -type f -name *.lang`
do
if [ `sort "$file" | uniq -d | wc -l` -gt 0 ]
if [ `sort "$file" | grep -v '^$' | uniq -d | wc -l` -gt 0 ]
then
echo "$file"
echo "***** $file"
sort "$file" | grep -v '^$' | uniq -d
fi
done
fi
@ -27,7 +29,7 @@ fi
# To fix
if [ "x$1" = "xfix" ]
then
for file in `find . -type f -name *.lang`
for file in `find htdocs/langs/en_US -type f -name *.lang`
do
awk -i inplace ' !x[$0]++' "$file"
done;

View File

@ -10,6 +10,7 @@
# Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then
echo "Fix permissions of files"
echo "Usage: fixperms.sh (list|fix)"
fi

View File

@ -12,6 +12,7 @@
# Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then
echo "Detect and fix bad UTF8 encoded files (UTF8 must not use BOM char)"
echo "Usage: fixutf8bomfiles.sh (list|fix) [addincludes]"
fi

View File

@ -20,7 +20,7 @@
*/
/**
* \file htdocs/dev/generate-commande.php
* \file dev/initdata/generate-commande.php
* \brief Script de generation de donnees aleatoires pour les commandes
*/

View File

@ -19,7 +19,7 @@
*/
/**
* \file htdocs/dev/generate-facture.php
* \file dev/intdata/generate-facture.php
* \brief Script de generation de donnees aleatoires pour les factures
*/

View File

@ -20,7 +20,7 @@
*/
/**
* \file htdocs/dev/generate-produit.php
* \file dev/initdata/generate-produit.php
* \brief Script de generation de donnees aleatoires pour les produits
*/

View File

@ -20,7 +20,7 @@
*/
/**
* \file htdocs/dev/generate-propale.php
* \file dev/initdata/generate-propale.php
* \brief Script de generation de donnees aleatoires pour les propales
*/

View File

@ -20,8 +20,8 @@
*/
/**
* \file htdocs/dev/generate-societe.php
* \brief Script de generation de donnees aleatoires pour les societes
* \file dev/initdata/generate-societe.php
* \brief Script de generation de donnees aleatoires pour les societes
*/
// Test si mode batch
@ -89,7 +89,7 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++)
{
print "Company $s\n";
$soc = new Societe($db);
$soc->nom = "Company num ".time()."$s";
$soc->name = "Company num ".time()."$s";
$soc->town = $listoftown[rand(0, count($listoftown)-1)];
$soc->client = rand(1,2); // Une societe sur 2 est prospect, l'autre client
$soc->fournisseur = rand(0,1); // Une societe sur 2 est fournisseur
@ -101,7 +101,7 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++)
// Un client sur 3 a une remise de 5%
$user_remise=rand(1,3); if ($user_remise==3) $soc->remise_percent=5;
print "> client=".$soc->client.", fournisseur=".$soc->fournisseur.", remise=".$soc->remise_percent."\n";
$soc->note='Company created by the script generate-societe.php';
$soc->note_private = 'Company created by the script generate-societe.php';
$socid = $soc->create();
if ($socid >= 0)
@ -120,7 +120,7 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++)
}
}
print "Company ".$s." created nom=".$soc->nom."\n";
print "Company ".$s." created nom=".$soc->name."\n";
}
else
{

View File

@ -7427,7 +7427,7 @@ CREATE TABLE `llx_user` (
LOCK TABLES `llx_user` WRITE;
/*!40000 ALTER TABLE `llx_user` DISABLE KEYS */;
INSERT INTO `llx_user` VALUES (1,'2010-07-08 13:20:11','2012-12-12 16:54:10',NULL,NULL,'admin',0,NULL,NULL,NULL,'admin','21232f297a57a5a743894a0e4a801fc3',NULL,'SuperAdminName','Firstname','',NULL,'','','','bidon@destailleur.fr','',1,'','','',1,1,NULL,NULL,NULL,'','2014-12-21 20:52:09','2014-12-21 13:51:38',NULL,'',1,'01.jpg',NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(2,'2010-07-08 13:54:48','2010-07-08 09:54:48',NULL,NULL,'demo',1,NULL,NULL,NULL,'demo','fe01ce2a7fbac8fafaed7c982a04e229',NULL,'John','Doe',NULL,NULL,'09123123','','','johndoe@mycompany.com',NULL,0,'','','',1,1,NULL,NULL,NULL,'','2013-03-24 16:30:29','2010-07-08 14:12:02',NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(3,'2010-07-11 16:18:59','2013-02-20 18:07:21',NULL,NULL,'adupont',1,NULL,NULL,NULL,'adupont','00856ab2bbb748aa29aa335a6e3a2407',NULL,'Dupont','Alain','',NULL,'','','','toto@aa.com','',0,'','','',1,1,NULL,NULL,2,'','2012-12-21 17:38:55',NULL,NULL,'',1,NULL,NULL,NULL,2,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(4,'2013-01-23 17:52:27','2013-02-20 18:48:01',NULL,NULL,'aaa',1,NULL,NULL,NULL,'aaa','47bce5c74f589f4867dbd57e9ca9f808',NULL,'aaa','','',NULL,'','','','','',0,'','','',1,1,17,6,NULL,'','2013-02-25 10:18:41','2013-01-23 17:53:20',NULL,'',1,NULL,NULL,NULL,5,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(5,'2013-01-23 17:52:37','2013-01-23 15:52:37',NULL,NULL,'bbb',0,NULL,NULL,NULL,'bbb','08f8e0260c64418510cefb2b06eee5cd',NULL,'bbb','','',NULL,'','','','','',1,'','','',1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(6,'2013-02-16 20:22:40','2013-02-16 18:22:40',NULL,NULL,'aaab',2,NULL,NULL,NULL,'aaab','4c189b020ceb022e0ecc42482802e2b8',NULL,'aaab','','',NULL,'','','','','',0,'','','',1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(7,'2013-02-16 20:48:15','2013-02-16 18:48:15',NULL,NULL,'zzz',2,NULL,NULL,NULL,'zzz','f3abb86bd34cf4d52698f14c0da1dc60',NULL,'zzz','','',NULL,'','','','','',0,'','','',1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(9,'2013-02-16 20:50:07','2013-03-24 15:10:14',NULL,NULL,'zzzg',2,NULL,NULL,NULL,'jc28fg4h','93d789524fd223cf05eecea3f59cbe86',NULL,'zzzg','','',NULL,'','','','','fsdkkfsdf<br />\r\nfsdfsd<br />\r\n<strong>fsdfs</strong>',0,'','','',1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,5,NULL,'','','',NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `llx_user` VALUES (1,'2010-07-08 13:20:11','2012-12-12 16:54:10',NULL,NULL,'admin',0,NULL,NULL,NULL,'admin','21232f297a57a5a743894a0e4a801fc3',NULL,'SuperAdminName','Firstname','',NULL,'','','','bidon@destailleur.fr','',1,'','','',1,1,NULL,NULL,NULL,'','2014-12-21 20:52:09','2014-12-21 13:51:38',NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(2,'2010-07-08 13:54:48','2010-07-08 09:54:48',NULL,NULL,'demo',1,NULL,NULL,NULL,'demo','fe01ce2a7fbac8fafaed7c982a04e229',NULL,'John','Doe',NULL,NULL,'09123123','','','johndoe@mycompany.com',NULL,0,'','','',1,1,NULL,NULL,NULL,'','2013-03-24 16:30:29','2010-07-08 14:12:02',NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(3,'2010-07-11 16:18:59','2013-02-20 18:07:21',NULL,NULL,'adupont',1,NULL,NULL,NULL,'adupont','00856ab2bbb748aa29aa335a6e3a2407',NULL,'Dupont','Alain','',NULL,'','','','toto@aa.com','',0,'','','',1,1,NULL,NULL,2,'','2012-12-21 17:38:55',NULL,NULL,'',1,NULL,NULL,NULL,2,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(4,'2013-01-23 17:52:27','2013-02-20 18:48:01',NULL,NULL,'aaa',1,NULL,NULL,NULL,'aaa','47bce5c74f589f4867dbd57e9ca9f808',NULL,'aaa','','',NULL,'','','','','',0,'','','',1,1,17,6,NULL,'','2013-02-25 10:18:41','2013-01-23 17:53:20',NULL,'',1,NULL,NULL,NULL,5,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(5,'2013-01-23 17:52:37','2013-01-23 15:52:37',NULL,NULL,'bbb',0,NULL,NULL,NULL,'bbb','08f8e0260c64418510cefb2b06eee5cd',NULL,'bbb','','',NULL,'','','','','',1,'','','',1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(6,'2013-02-16 20:22:40','2013-02-16 18:22:40',NULL,NULL,'aaab',2,NULL,NULL,NULL,'aaab','4c189b020ceb022e0ecc42482802e2b8',NULL,'aaab','','',NULL,'','','','','',0,'','','',1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(7,'2013-02-16 20:48:15','2013-02-16 18:48:15',NULL,NULL,'zzz',2,NULL,NULL,NULL,'zzz','f3abb86bd34cf4d52698f14c0da1dc60',NULL,'zzz','','',NULL,'','','','','',0,'','','',1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(9,'2013-02-16 20:50:07','2013-03-24 15:10:14',NULL,NULL,'zzzg',2,NULL,NULL,NULL,'jc28fg4h','93d789524fd223cf05eecea3f59cbe86',NULL,'zzzg','','',NULL,'','','','','fsdkkfsdf<br />\r\nfsdfsd<br />\r\n<strong>fsdfs</strong>',0,'','','',1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,5,NULL,'','','',NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL);
/*!40000 ALTER TABLE `llx_user` ENABLE KEYS */;
UNLOCK TABLES;

View File

@ -174,7 +174,7 @@ $targetcontent=$sourcecontent;
// Substitute class name
$targetcontent=preg_replace('/skeleton_class\.class\.php/', $classmin.'.class.php', $targetcontent);
$targetcontent=preg_replace('/\$element=\'skeleton\'/', '\$element=\''.$classmin.'\'', $targetcontent);
$targetcontent=preg_replace('/\$table_element=\'skeleton\'/', '\$table_element=\''.$classmin.'\'', $targetcontent);
$targetcontent=preg_replace('/\$table_element=\'skeleton\'/', '\$table_element=\''.$tablenoprefix.'\'', $targetcontent);
$targetcontent=preg_replace('/Skeleton_Class/', $classname, $targetcontent);
// Substitute comments
@ -252,7 +252,13 @@ foreach($property as $key => $prop)
if ($addfield)
{
$varprop.="\t\t\$sql.= \" ";
if ($prop['istime'])
if ($prop['field']=='datec')
{
$varprop.='"."\'".$this->db->idate(dol_now())."\'"."';
if ($i < count($property)) $varprop.=",";
$varprop.='";';
}
elseif ($prop['istime'])
{
$varprop.='".(! isset($this->'.$prop['field'].') || dol_strlen($this->'.$prop['field'].')==0?\'NULL\':"\'".$this->db->idate(';
$varprop.="\$this->".$prop['field']."";
@ -268,6 +274,12 @@ foreach($property as $key => $prop)
if ($i < count($property)) $varprop.=",";
$varprop.='";';
}
elseif ($prop['field']=='fk_user_mod' || $prop['field']=='fk_user_author')
{
$varprop.='".$user->id."';
if ($i < count($property)) $varprop.=",";
$varprop.='";';
}
else
{
$varprop.='".(! isset($this->'.$prop['field'].')?\'NULL\':"\'".';
@ -289,11 +301,17 @@ $i=0;
foreach($property as $key => $prop)
{
$i++;
if ($prop['field'] != 'rowid' && $prop['field'] != 'id')
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && $prop['field'] != 'datec' && $prop['field'] != 'fk_user_author')
{
$varprop.="\t\t\$sql.= \" ";
$varprop.=$prop['field'].'=';
if ($prop['istime'])
if ($prop['field']=='tms') {
$varprop.='".(dol_strlen($this->'.$prop['field'].')!=0 ? "\'".$this->db->idate(';
$varprop.='$this->'.$prop['field'];
$varprop.=')."\'" : "\'".$this->db->idate(dol_now())."\'").';
$varprop.='"';
}
elseif ($prop['istime'])
{
// (dol_strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null')
$varprop.='".(dol_strlen($this->'.$prop['field'].')!=0 ? "\'".$this->db->idate(';
@ -301,6 +319,9 @@ foreach($property as $key => $prop)
$varprop.=')."\'" : \'null\').';
$varprop.='"';
}
elseif ($prop['field']=='fk_user_mod') {
$varprop.='".$user->id."';
}
else
{
$varprop.="\".";
@ -325,6 +346,7 @@ $targetcontent=preg_replace('/\$sql\.= " t\.field2";/', '', $targetcontent);
// Substitute select set parameters
$varprop="\n";
$varpropline="\n";
$cleanparam='';
$i=0;
foreach($property as $key => $prop)
@ -338,11 +360,22 @@ foreach($property as $key => $prop)
if ($prop['istime']) $varprop.=')';
$varprop.=";";
$varprop.="\n";
$varpropline.="\t\t\t\t\$line->".$prop['field']." = ";
if ($prop['istime']) $varpropline.='$this->db->jdate(';
$varpropline.='$obj->'.$prop['field'];
if ($prop['istime']) $varpropline.=')';
$varpropline.=";";
$varpropline.="\n";
}
}
$targetcontent=preg_replace('/\$this->prop1 = \$obj->field1;/', $varprop, $targetcontent);
$targetcontent=preg_replace('/\$this->prop2 = \$obj->field2;/', '', $targetcontent);
//Substirute fetchAll
$targetcontent=preg_replace('/\$line->prop1 = \$obj->field1;/', $varpropline, $targetcontent);
$targetcontent=preg_replace('/\$line->prop2 = \$obj->field2;/', '', $targetcontent);
// Substitute initasspecimen parameters
$varprop="\n";

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) ---Put here your own copyright and developer email---
*
* This program is free software; you can redistribute it and/or modify
@ -41,6 +42,8 @@ class Skeleton_Class extends CommonObject
var $element='skeleton'; //!< Id that identify managed objects
var $table_element='skeleton'; //!< Name of table without prefix where object is stored
var $lines=array();
var $id;
var $prop1;
var $prop2;
@ -103,11 +106,11 @@ class Skeleton_Class extends CommonObject
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
// want this action to call a trigger.
//// Call triggers
//$result=$this->call_trigger('MYOBJECT_CREATE',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//if ($result < 0) $error++;
//// End call triggers
}
}
@ -115,11 +118,6 @@ class Skeleton_Class extends CommonObject
// Commit or rollback
if ($error)
{
foreach($this->errors as $errmsg)
{
dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
}
@ -175,6 +173,69 @@ class Skeleton_Class 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
* @return int <0 if KO, >0 if OK
*/
function fetchAll($sortorder, $sortfield, $limit, $offset, $filter = array())
{
global $langs;
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.field1,";
$sql.= " t.field2";
//...
$sql.= " FROM ".MAIN_DB_PREFIX."mytable as t";
// Manage filter
$sqlwhere=array();
if (count($filter)>0) {
foreach ( $filter as $key => $value ) {
//$sqlwhere []= ' AND '. $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
}
}
if (count($sqlwhere)>0) {
$sql.= ' WHERE '.implode(' AND ', $sqlwhere);
}
$sql .= " ORDER BY " . $sortfield . " " . $sortorder . " " . $this->db->plimit($limit + 1, $offset);
$this->lines = array ();
dol_syslog(get_class($this)."::fetchAll", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
while ($obj = $this->db->fetch_object($resql))
{
$line=new Skeleton_ClassLine();
$line->id = $obj->rowid;
$line->prop1 = $obj->field1;
$line->prop2 = $obj->field2;
$this->lines[]=$line;
//...
}
$this->db->free($resql);
return $num;
}
else
{
$this->error="Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::fetchAll ".$this->error, LOG_ERR);
return -1;
}
}
/**
* Update object into database
@ -209,28 +270,20 @@ class Skeleton_Class extends CommonObject
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $error)
if (! $error && ! $notrigger)
{
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
//// Call triggers
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers
}
//// Call triggers
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers
}
// Commit or rollback
if ($error)
{
foreach($this->errors as $errmsg)
{
dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
}
@ -283,11 +336,6 @@ class Skeleton_Class extends CommonObject
// Commit or rollback
if ($error)
{
foreach($this->errors as $errmsg)
{
dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
}
@ -368,3 +416,10 @@ class Skeleton_Class extends CommonObject
}
}
class Skeleton_ClassLine
{
var $id;
var $prop1;
var $prop2;
}

View File

@ -25,7 +25,7 @@
*
* Usage:
* cd htdocs/langs
* ../../dev/translation/strip_language_file.php <primary_lang_dir> <secondary_lang_dir> [file.lang|all]
* ./dev/translation/strip_language_file.php <primary_lang_dir> <secondary_lang_dir> [file.lang|all]
*
* To rename all .delta files, you can do
* for fic in `ls *.delta`; do f=`echo $fic | sed -e 's/\.delta//'`; echo $f; mv $f.delta $f; done
@ -60,24 +60,26 @@ $rc = 0;
$lPrimary = isset($argv[1])?$argv[1]:'';
$lSecondary = isset($argv[2])?$argv[2]:'';
$lEnglish = 'en_US';
$filesToProcess = isset($argv[3])?$argv[3]:'';
if (empty($lPrimary) || empty($lSecondary) || empty($filesToProcess))
{
$rc = 1;
$msg = '***** Script to clean language files *****'."\n";
$msg.= 'Usage: ../../dev/translation/strip_language_file.php xx_XX xx_YY [file.lang|all]'."\n";
$msg.= 'Usage: ./dev/translation/strip_language_file.php xx_XX xx_YY [file.lang|all]'."\n";
print $msg . "(rc=$rc).\n";
exit($rc);
}
$aPrimary = array();
$aSecondary = array();
$aEnglish = array();
// Define array $filesToProcess
if ($filesToProcess == 'all')
{
$dir = new DirectoryIterator($lPrimary);
$dir = new DirectoryIterator('htdocs/langs/'.$lPrimary);
while($dir->valid()) {
if(!$dir->isDot() && $dir->isFile() && ! preg_match('/^\./',$dir->getFilename())) {
$files[] = $dir->getFilename();
@ -94,8 +96,9 @@ else $filesToProcess=explode(',',$filesToProcess);
// Loop on each file
foreach($filesToProcess as $fileToProcess)
{
$lPrimaryFile = $lPrimary.'/'.$fileToProcess;
$lSecondaryFile = $lSecondary.'/'.$fileToProcess;
$lPrimaryFile = 'htdocs/langs/'.$lPrimary.'/'.$fileToProcess;
$lSecondaryFile = 'htdocs/langs/'.$lSecondary.'/'.$fileToProcess;
$lEnglishFile = 'htdocs/langs/'.$lEnglish.'/'.$fileToProcess;
$output = $lSecondaryFile . '.delta';
print "---- Process language file ".$lSecondaryFile."\n";
@ -114,6 +117,13 @@ foreach($filesToProcess as $fileToProcess)
continue;
}
if ( ! is_readable($lEnglishFile) ) {
$rc = 3;
$msg = "Cannot read english language file $lEnglishFile. We discard this file.";
print $msg . "\n";
continue;
}
// Start reading and parsing Secondary
if ( $handle = fopen($lSecondaryFile, 'r') )
@ -172,6 +182,65 @@ foreach($filesToProcess as $fileToProcess)
}
// Start reading and parsing English
if ( $handle = fopen($lEnglishFile, 'r') )
{
print "Read English File $lEnglishFile:\n";
$cnt = 0;
while (($line = fgets($handle)) !== false)
{
$cnt++;
// strip comments
if ( preg_match("/^\w*#/", $line) ) {
continue;
}
// strip empty lines
if ( preg_match("/^\w*$/", $line) ) {
continue;
}
$a = mb_split('=', trim($line), 2);
if ( count($a) != 2 ) {
print "ERROR in file $lEnglishFile, line $cnt: " . trim($line) . "\n";
continue;
}
list($key, $value) = $a;
// key is redundant
if ( array_key_exists($key, $aEnglish) ) {
print "Key $key is redundant in file $lEnglishFile (line: $cnt).\n";
continue;
}
// String has no value
if ( $value == '' ) {
print "Key $key has no value in file $lEnglishFile (line: $cnt).\n";
continue;
}
$aEnglish[$key] = trim($value);
}
if ( ! feof($handle) )
{
$rc = 5;
$msg = "Unexpected fgets() fail";
print $msg . " (rc=$rc).\n";
exit($rc);
}
fclose($handle);
}
else {
$rc = 6;
$msg = "Cannot open file $lEnglishFile";
print $msg . " (rc=$rc).\n";
exit($rc);
}
// Start reading and parsing Primary. See rules in header!
$arrayofkeytoalwayskeep=array('DIRECTION','FONTFORPDF','FONTSIZEFORPDF','SeparatorDecimal','SeparatorThousand');
@ -246,7 +315,11 @@ foreach($filesToProcess as $fileToProcess)
}
// String exists in both files and does not match
if ((! empty($aSecondary[$key]) && $aSecondary[$key] != $aPrimary[$key]) || in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/',$key) || preg_match('/^FormatHour/',$key))
if (
(! empty($aSecondary[$key]) && $aSecondary[$key] != $aPrimary[$key]
&& ! empty($aEnglish[$key]) && $aSecondary[$key] != $aEnglish[$key])
|| in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/',$key) || preg_match('/^FormatHour/',$key)
)
{
//print "Key $key differs so we add it into new secondary language (line: $cnt).\n";
fwrite($oh, $key."=".(empty($aSecondary[$key])?$aPrimary[$key]:$aSecondary[$key])."\n");
@ -270,8 +343,8 @@ foreach($filesToProcess as $fileToProcess)
print "Output can be found at $output.\n";
print "To rename all .delta files, you can do\n";
print 'for fic in `ls *.delta`; do f=`echo $fic | sed -e \'s/\.delta//\'`; echo $f; mv $f.delta $f; done'."\n";
print "To rename all .delta files, you can do:\n";
print '> for fic in `ls htdocs/langs/'.$lSecondary.'/*.delta`; do f=`echo $fic | sed -e \'s/\.delta//\'`; echo $f; mv $f.delta $f; done'."\n";
}

View File

@ -13,7 +13,7 @@ then
echo "This pull remote transifex files to local dir."
echo "Note: If you pull a language file (not source), file will be skipped if local file is newer."
echo " Using -f will overwrite local file (does not work with 'all')."
echo "Usage: ./dev/translation/txpull.sh (all|xx_XX) [-r dolibarr.file] [-f]"
echo "Usage: ./dev/translation/txpull.sh (all|xx_XX) [-r dolibarr.file] [-f] [-s]"
exit
fi
@ -26,13 +26,20 @@ fi
if [ "x$1" = "xall" ]
then
for fic in ar_SA bg_BG bs_BA ca_ES cs_CZ da_DK de_DE el_GR es_ES et_EE eu_ES fa_IR fi_FI fr_FR he_IL hr_HR hu_HU id_ID is_IS it_IT ja_JP ka_GE ko_KR lt_LT lv_LV mk_MK nb_NO nl_NL pl_PL pt_PT ro_RO ru_RU ru_UA sk_SK sl_SI sq_AL sv_SE th_TH tr_TR uk_UA uz_UZ vi_VN zh_CN zh_TW
for dir in `find htdocs/langs/* -type d`
do
echo "tx pull -l $fic $2 $3"
tx pull -l $fic $2 $3
fic=`basename $dir`
if [ $fic != "en_US" ]
then
echo "tx pull -l $fic $2 $3"
tx pull -l $fic $2 $3
fi
done
cd -
else
echo "tx pull -l $1 $2 $3 $4"
tx pull -l $1 $2 $3 $4
echo "tx pull -l $1 $2 $3 $4 $5"
tx pull -l $1 $2 $3 $4 $5
fi
echo Think to launch also:
echo "> dev/fixaltlanguages.sh fix all"

View File

@ -249,7 +249,11 @@ if ($action == 'export_csv')
$purchase_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
header('Content-Type: text/csv');
header('Content-Disposition: attachment;filename=journal_achats.csv');
if ($conf->global->EXPORT_PREFIX_SPEC)
$filename=$conf->global->EXPORT_PREFIX_SPEC."_"."journal_achats.csv";
else
$filename="journal_achats.csv";
header('Content-Disposition: attachment;filename='.$filename);
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export
{

View File

@ -178,7 +178,7 @@ if ($result) {
/*
* Action
* FIXME Action must be set before any view part
* FIXME Action must be set before any view part to respect MVC
*/
// Bookkeeping Write
@ -271,7 +271,11 @@ if ($action == 'export_csv')
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
header('Content-Type: text/csv');
header('Content-Disposition: attachment;filename=journal_ventes.csv');
if ($conf->global->EXPORT_PREFIX_SPEC)
$filename=$conf->global->EXPORT_PREFIX_SPEC."_"."journal_ventes.csv";
else
$filename="journal_ventes.csv";
header('Content-Disposition: attachment;filename='.$filename);
$companystatic = new Client($db);

View File

@ -5,8 +5,9 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -77,7 +78,8 @@ class Adherent extends CommonObject
var $morphy;
var $public;
var $note; // Private note
var $note_private; // Private note
var $note_public; // Public note
var $statut; // -1:brouillon, 0:resilie, >=1:valide,paye
var $photo;
@ -310,7 +312,7 @@ class Adherent extends CommonObject
$sql.= " VALUES (";
$sql.= " '".$this->db->idate($this->datec)."'";
$sql.= ", ".($this->login?"'".$this->db->escape($this->login)."'":"null");
$sql.= ", ".($user->id>0?$user->id:"null"); // Can be null because member can be createb by a guest or a script
$sql.= ", ".($user->id>0?$user->id:"null"); // Can be null because member can be created by a guest or a script
$sql.= ", null, null, '".$this->morphy."'";
$sql.= ", '".$this->typeid."'";
$sql.= ", ".$conf->entity;
@ -445,9 +447,10 @@ class Adherent extends CommonObject
$sql.= ", email='".$this->email."'";
$sql.= ", skype='".$this->skype."'";
$sql.= ", phone=" .($this->phone?"'".$this->db->escape($this->phone)."'":"null");
$sql.= ", phone_perso=" .($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null");
$sql.= ", phone_perso=" .($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null");
$sql.= ", phone_mobile=" .($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null");
$sql.= ", note=" .($this->note?"'".$this->db->escape($this->note)."'":"null");
$sql.= ", note_private=" .($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
$sql.= ", note_public=" .($this->note_private?"'".$this->db->escape($this->note_public)."'":"null");
$sql.= ", photo=" .($this->photo?"'".$this->photo."'":"null");
$sql.= ", public='".$this->public."'";
$sql.= ", statut=" .$this->statut;
@ -473,7 +476,7 @@ class Adherent extends CommonObject
$action='update';
// Actions on extra fields (by external module)
// FIXME le hook fait double emploi avec le trigger !!
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('memberdao'));
$parameters=array('id'=>$this->id);
$action='';
@ -1053,7 +1056,8 @@ class Adherent extends CommonObject
{
global $langs;
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note,";
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,";
$sql.= " d.note_public,";
$sql.= " d.email, d.skype, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,";
$sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,";
$sql.= " d.datec as datec,";
@ -1134,7 +1138,8 @@ class Adherent extends CommonObject
$this->datevalid = $this->db->jdate($obj->datev);
$this->birth = $this->db->jdate($obj->birthday);
$this->note = $obj->note;
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
$this->morphy = $obj->morphy;
$this->typeid = $obj->fk_adherent_type;
@ -1548,9 +1553,9 @@ class Adherent extends CommonObject
}
/**
* Renvoie nom clicable (avec eventuellement le picto)
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlen length max libelle
* @param string $option Page lien
* @return string Chaine avec URL
@ -1561,32 +1566,33 @@ class Adherent extends CommonObject
$result='';
$label = '<u>' . $langs->trans("ShowMember") . '</u>';
$label.= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
if (! empty($this->ref))
$label.= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
if (! empty($this->firstname) || ! empty($this->lastname))
$label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs);
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
if ($option == 'card')
{
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id.$linkclose;
$lienfin='</a>';
$link = '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id.$linkclose;
$linkend='</a>';
}
if ($option == 'subscription')
{
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$this->id.$linkclose;
$lienfin='</a>';
$link = '<a href="'.DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$this->id.$linkclose;
$linkend='</a>';
}
if ($option == 'category')
{
$lien = '<a href="'.DOL_URL_ROOT.'/categories/categorie.php?id='.$this->id.'&type=3'.$linkclose;
$lienfin='</a>';
$link = '<a href="'.DOL_URL_ROOT.'/categories/categorie.php?id='.$this->id.'&type=3'.$linkclose;
$linkend='</a>';
}
$picto='user';
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
$result.=$lien.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$lienfin;
$result.=$link.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$linkend;
return $result;
}
@ -1801,7 +1807,7 @@ class Adherent extends CommonObject
$this->phone = '0999999999';
$this->phone_perso = '0999999998';
$this->phone_mobile = '0999999997';
$this->note='No comment';
$this->note_private='No comment';
$this->birth=time();
$this->photo='';
$this->public=1;
@ -1874,7 +1880,8 @@ class Adherent extends CommonObject
if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile;
if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax;
if ($this->note && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note;
if ($this->note_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private;
if ($this->note_public && ! empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = $this->note_public;
if ($this->birth && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth,'dayhourldap');
if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut;
if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap');

View File

@ -73,7 +73,7 @@ class AdherentType extends CommonObject
{
global $conf;
$this->statut=trim($this->statut);
$this->statut=(int) $this->statut;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type (";
$sql.= "libelle";
@ -266,9 +266,9 @@ class AdherentType extends CommonObject
/**
* Renvoie nom clicable (avec eventuellement le picto)
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlen length max libelle
* @return string String with URL
*/
@ -279,14 +279,14 @@ class AdherentType extends CommonObject
$result='';
$label=$langs->trans("ShowTypeCard",$this->libelle);
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>';
$link = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>';
$picto='group';
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
$result.=$lien.($maxlen?dol_trunc($this->libelle,$maxlen):$this->libelle).$lienfin;
$result.=$link.($maxlen?dol_trunc($this->libelle,$maxlen):$this->libelle).$linkend;
return $result;
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -90,7 +90,7 @@ class Cotisation extends CommonObject
}
else
{
$this->error=$this->db->error();
$this->error=$this->db->lasterror();
return -1;
}
}
@ -140,7 +140,7 @@ class Cotisation extends CommonObject
}
else
{
$this->error=$this->db->error();
$this->error=$this->db->lasterror();
return -1;
}
}
@ -181,7 +181,7 @@ class Cotisation extends CommonObject
else
{
$this->db->rollback();
$this->error=$this->db->error();
$this->error=$this->db->lasterror();
return -1;
}
}
@ -217,7 +217,7 @@ class Cotisation extends CommonObject
$result=$member->fetch($this->fk_adherent);
$result=$member->update_end_date($user);
if ($accountline->rowid > 0) // If we found bank account line (this means this->fk_bank defined)
if ($accountline->id > 0) // If we found bank account line (this means this->fk_bank defined)
{
$result=$accountline->delete($user); // Return false if refused because line is conciliated
if ($result > 0)
@ -254,9 +254,9 @@ class Cotisation extends CommonObject
/**
* Renvoie nom clicable (avec eventuellement le picto)
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @return string Chaine avec URL
*/
function getNomUrl($withpicto=0)
@ -266,14 +266,14 @@ class Cotisation extends CommonObject
$result='';
$label=$langs->trans("ShowSubscription").': '.$this->ref;
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>';
$link = '<a href="'.DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>';
$picto='payment';
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
$result.=$lien.$this->ref.$lienfin;
$result.=$link.$this->ref.$linkend;
return $result;
}

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,7 +20,7 @@
/**
* \file htdocs/adherents/note.php
* \ingroup member
* \brief Tabe for note of a member
* \brief Tab for note of a member
*/
require '../main.inc.php';
@ -45,26 +46,13 @@ if ($result > 0)
$result=$adht->fetch($object->typeid);
}
$permissionnote=$user->rights->adherent->creer; // Used by the include of actions_setnotes.inc.php
/*
* Actions
*/
if ($action == 'update' && $user->rights->adherent->creer && ! $_POST["cancel"])
{
$db->begin();
$res=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
if ($res < 0)
{
setEventMessage($object->error, 'errors');
$db->rollback();
}
else
{
$db->commit();
}
}
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
@ -82,7 +70,7 @@ if ($id)
dol_fiche_head($head, 'note', $langs->trans("Member"), 0, 'user');
print "<form method=\"post\" action=\"note.php\">";
print "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="border" width="100%">';
@ -129,49 +117,16 @@ if ($id)
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$object->getLibStatut(4).'</td></tr>';
// Note
print '<tr><td valign="top">'.$langs->trans("Note").'</td>';
print '<td valign="top" colspan="3">';
if ($action == 'edit' && $user->rights->adherent->creer)
{
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
print "<input type=\"hidden\" name=\"id\" value=\"".$object->id."\">";
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('note',$object->note,'',280,'dolibarr_notes','',true,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,80);
$doleditor->Create();
}
else
{
print nl2br($object->note);
}
print "</td></tr>";
if ($action == 'edit')
{
print '<tr><td colspan="4" align="center">';
print '<input type="submit" class="button" name="update" value="'.$langs->trans("Save").'">';
print '&nbsp; &nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</td></tr>';
}
print "</table>";
print "</form>\n";
print '<br>';
/*
* Actions
*/
print '</div>';
print '<div class="tabsAction">';
$colwidth='20';
$permission = $user->rights->adherent->creer; // Used by the include of notes.tpl.php
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
if ($user->rights->adherent->creer && $action != 'edit')
{
print '<div class="inline-block divButAction"><a class="butAction" href="note.php?id='.$object->id.'&amp;action=edit">'.$langs->trans('Modify')."</a></div>";
}
print "</div>";
dol_fiche_end();
}

View File

@ -319,7 +319,6 @@ foreach ($dirmodels as $reldir)
// Info
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$askpricesupplier->type=0;
$nextval=$module->getNextValue($mysoc,$askpricesupplier);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip.=''.$langs->trans("NextValue").': ';

View File

@ -622,9 +622,29 @@ else
}
print '</table>';
print '<br>';
/*
* Notifications
*/
print_titre($langs->trans("Notifications"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60"></td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
print '</td><td align="right">';
print "</td></tr>\n";
print '</table>';
llxFooter();
$db->close();

View File

@ -605,8 +605,9 @@ if ($action == 'edit' || $action == 'updateedit')
}
print '</td></tr>';
$opcions=array($langs->trans("CalcLocaltax1").' '.$langs->trans("CalcLocaltax1Desc"),$langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"),$langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc"));
print '<tr><td align="left"></label for="clt1">'.$langs->trans("CalcLocaltax").'</label>: ';
$opcions=array($langs->transcountry("CalcLocaltax1",$mysoc->country_code),$langs->transcountry("CalcLocaltax2",$mysoc->country_code),$langs->transcountry("CalcLocaltax3",$mysoc->country_code));
print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1);
print '</td></tr>';
print "</table>";
@ -649,7 +650,6 @@ if ($action == 'edit' || $action == 'updateedit')
print '</td></tr>';
}
print '<tr><td align="left"><label for="clt2">'.$langs->trans("CalcLocaltax").'</label>: ';
$opcions=array($langs->transcountry("CalcLocaltax1",$mysoc->country_code),$langs->transcountry("CalcLocaltax2",$mysoc->country_code),$langs->transcountry("CalcLocaltax3",$mysoc->country_code));
print $form->selectarray("clt2", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC2);
print '</td></tr>';
print "</table>";
@ -1061,15 +1061,15 @@ else
print '<tr><td align="left">'.$langs->trans("CalcLocaltax").': ';
if($conf->global->MAIN_INFO_LOCALTAX_CALC2==0)
{
print $langs->transcountry("CalcLocaltax1",$mysoc->country_code);
print $langs->trans("CalcLocaltax1").' - '.$langs->trans("CalcLocaltax1Desc");
}
else if($conf->global->MAIN_INFO_LOCALTAX_CALC2==1)
{
print $langs->transcountry("CalcLocaltax2",$mysoc->country_code);
print $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc");
}
else if($conf->global->MAIN_INFO_LOCALTAX_CALC2==2)
{
print $langs->transcountry("CalcLocaltax3",$mysoc->country_code);
print $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc");
}
print '</td></tr>';

View File

@ -229,7 +229,7 @@ $sql.= ", note";
$sql.= ", entity";
$sql.= " FROM ".MAIN_DB_PREFIX."const";
$sql.= " WHERE entity IN (".$user->entity.",".$conf->entity.")";
if (empty($user->entity) && $debug) {} // to force for superadmin
if ((empty($user->entity) || $user->admin) && $debug) {} // to force for superadmin
else $sql.= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits
$sql.= " ORDER BY entity, name ASC";

View File

@ -171,7 +171,7 @@ else if ($action == 'setdoc')
// on passe donc par une variable pour avoir un affichage coherent
$conf->global->FACTURE_ADDON_PDF = $value;
}
// On active le modele
$ret = delDocumentModel($value, $type);
if ($ret > 0)
@ -341,7 +341,7 @@ foreach ($dirmodels as $reldir)
// Check if there is a filter on country
preg_match('/\-(.*)_(.*)$/',$classname,$reg);
if (! empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue;
$classname = preg_replace('/\-.*$/','',$classname);
if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php')
{
@ -416,7 +416,7 @@ foreach ($dirmodels as $reldir)
$htmltooltip.=$langs->trans($module->error).'<br>';
}
}
// Example for credit invoice
$facture->type=2;
$nextval=$module->getNextValue($mysoc,$facture);
@ -630,7 +630,6 @@ print '</table>';
/*
* Modes de reglement
*
*/
print '<br>';
print_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInInvoice"));
@ -811,7 +810,27 @@ print '</tr>'."\n";
print "</table>\n";
//dol_fiche_end();
/*
* Notifications
*/
print '<br>';
print_titre($langs->trans("Notifications"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60"></td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
print '</td><td align="right">';
print "</td></tr>\n";
print '</table>';
dol_fiche_end();
llxFooter();

View File

@ -323,8 +323,6 @@ else // Show
$var=true;
// Language
print_fiche_titre($langs->trans("Language"),'','');
print '<br>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td><td>&nbsp;</td></tr>';

View File

@ -100,6 +100,7 @@ print '<br>';
print '<br>';
// Add hook to add information
$parameters=array();
$reshook=$hookmanager->executeHooks('addHomeSetup',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
print $hookmanager->resPrint;
if (empty($reshook))

View File

@ -65,13 +65,14 @@ if ($action == 'setvalue' && $user->admin)
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PHONE',GETPOST("fieldphone"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PHONE_PERSO',GETPOST("fieldphoneperso"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_MOBILE',GETPOST("fieldmobile"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FAX',GETPOST("fieldfax"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ADDRESS',GETPOST("fieldaddress"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ZIP',GETPOST("fieldzip"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_TOWN',GETPOST("fieldtown"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_COUNTRY',GETPOST("fieldcountry"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_DESCRIPTION',GETPOST("fielddescription"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_NOTE_PUBLIC',GETPOST("fieldnotepublic"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_BIRTHDATE',GETPOST("fieldbirthdate"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_STATUS',GETPOST("fieldstatus"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION', GETPOST("fieldendlastsubscription"),'chaine',0,'',$conf->entity)) $error++;
@ -312,6 +313,14 @@ print '</td><td>'.$langs->trans("LDAPFieldDescriptionExample").'</td>';
print '<td align="right">&nbsp;</td>';
print '</tr>';
// Public Note
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldNotePublic").'</td><td>';
print '<input size="25" type="text" name="fieldnotepublic" value="'.$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC.'">';
print '</td><td>'.$langs->trans("LDAPFieldNotePublicExample").'</td>';
print '<td align="right">&nbsp;</td>';
print '</tr>';
// Birthday
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldBirthdate").'</td><td>';

119
htdocs/admin/loan.php Normal file
View File

@ -0,0 +1,119 @@
<?php
/* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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/admin/loan.php
* \ingroup loan
* \brief Setup page to configure loan module
*/
require '../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$langs->load("admin");
$langs->load("loan");
// Security check
if (!$user->admin)
accessforbidden();
$action = GETPOST('action', 'alpha');
// Other parameters LOAN_*
$list = array (
'LOAN_ACCOUNTING_ACCOUNT_CAPITAL',
'LOAN_ACCOUNTING_ACCOUNT_INTEREST',
'LOAN_ACCOUNTING_ACCOUNT_INSURANCE'
);
/*
* Actions
*/
if ($action == 'update')
{
$error = 0;
foreach ($list as $constname) {
$constvalue = GETPOST($constname, 'alpha');
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
}
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
}
else
{
setEventMessage($langs->trans("Error"),'errors');
}
}
/*
* View
*/
llxHeader();
$form = new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans('ConfigLoan'),$linkback,'setup');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
/*
* Params
*/
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">' . $langs->trans('Options') . '</td>';
print "</tr>\n";
foreach ($list as $key)
{
$var=!$var;
print '<tr '.$bc[$var].' class="value">';
// Param
$label = $langs->trans($key);
print '<td><label for="'.$key.'">'.$label.'</label></td>';
// Value
print '<td>';
print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
print '</td></tr>';
}
print '</tr>';
print '</form>';
print "</table>\n";
print '<br /><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
llxFooter();
$db->close();

View File

@ -162,11 +162,11 @@ $var=true;
if (! empty($conf->global->ADHERENT_USE_MAILMAN))
{
//$lien=img_picto($langs->trans("Active"),'tick').' ';
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_MAILMAN">';
//$lien.=$langs->trans("Disable");
$lien.=img_picto($langs->trans("Activated"),'switch_on');
$lien.='</a>';
//$link=img_picto($langs->trans("Active"),'tick').' ';
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_MAILMAN">';
//$link.=$langs->trans("Disable");
$link.=img_picto($langs->trans("Activated"),'switch_on');
$link.='</a>';
// Edition des varibales globales
$constantes=array(
'ADHERENT_MAILMAN_ADMINPW',
@ -175,7 +175,7 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN))
'ADHERENT_MAILMAN_LISTS'
);
print_fiche_titre($langs->trans('MailmanTitle'), $lien,'');
print_fiche_titre($langs->trans('MailmanTitle'), $link,'');
print '<br>';
@ -207,11 +207,11 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN))
}
else
{
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_MAILMAN">';
//$lien.=img_$langs->trans("Activate")
$lien.=img_picto($langs->trans("Disabled"),'switch_off');
$lien.='</a>';
print_fiche_titre($langs->trans('MailmanTitle'), $lien,'');
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_MAILMAN">';
//$link.=img_$langs->trans("Activate")
$link.=img_picto($langs->trans("Disabled"),'switch_off');
$link.='</a>';
print_fiche_titre($langs->trans('MailmanTitle'), $link,'');
}
dol_fiche_end();

View File

@ -120,7 +120,7 @@ print "</td>";
print '</tr>';
// Use a flip-hide menu
if (isset($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL > 0)
if (isset($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL > 1)
{
$var=!$var;
print "<tr ".$bc[$var].">";

View File

@ -24,6 +24,7 @@
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/triggers/interface_50_modNotification_Notification.class.php';
@ -48,25 +49,56 @@ $action = GETPOST("action");
if ($action == 'setvalue' && $user->admin)
{
$db->begin();
$result=dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM", $_POST["email_from"], 'chaine', 0, '', $conf->entity);
if ($result < 0) $error++;
if (! $error)
{
//var_dump($_POST);
foreach($_POST as $key => $val)
{
if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_/',$key)) continue;
//print $key.' - '.$val.'<br>';
$result=dolibarr_set_const($db, $key, $val, 'chaine', 0, '', $conf->entity);
if (! preg_match('/^NOTIF_(.*)_key$/', $key, $reg)) continue;
$newval='';
$newkey='';
$shortkey=preg_replace('/_key$/','',$key);
//print $shortkey.'<br>';
if (preg_match('/^NOTIF_(.*)_old_(.*)_key/',$key,$reg))
{
dolibarr_del_const($db, 'NOTIFICATION_FIXEDEMAIL_'.$reg[1].'_THRESHOLD_HIGHER_'.$reg[2], $conf->entity);
$newkey='NOTIFICATION_FIXEDEMAIL_'.$reg[1].'_THRESHOLD_HIGHER_'.((int) GETPOST($shortkey.'_amount'));
$newval=GETPOST($shortkey.'_key');
//print $newkey.' - '.$newval.'<br>';
}
else if (preg_match('/^NOTIF_(.*)_new_key/',$key,$reg))
{
// Add a new entry
$newkey='NOTIFICATION_FIXEDEMAIL_'.$reg[1].'_THRESHOLD_HIGHER_'.((int) GETPOST($shortkey.'_amount'));
$newval=GETPOST($shortkey.'_key');
}
if ($newkey && $newval)
{
$result=dolibarr_set_const($db, $newkey, $newval, 'chaine', 0, '', $conf->entity);
}
}
}
if (! $error)
{
$db->commit();
setEventMessage($langs->trans("SetupSaved"));
}
else
{
$db->rollback();
setEventMessage($langs->trans("Error"),'errors');
}
}
@ -78,6 +110,7 @@ if ($action == 'setvalue' && $user->admin)
*/
$form=new Form($db);
$notify = new Notify($db);
llxHeader('',$langs->trans("NotificationSetup"));
@ -107,7 +140,53 @@ print '</table>';
print '<br>';
print_fiche_titre($langs->trans("ListOfAvailableNotifications"),'','');
if ($conf->societe->enabled)
{
print_fiche_titre($langs->trans("ListOfNotificationsPerContact"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Module").'</td>';
print '<td>'.$langs->trans("Code").'</td>';
print '<td>'.$langs->trans("Label").'</td>';
print '<td align="right">'.$langs->trans("NbOfTargetedContacts").'</td>';
print '<td>'.'</td>';
print "</tr>\n";
// Load array of available notifications
$notificationtrigger=new InterfaceNotification($db);
$listofnotifiedevents=$notificationtrigger->getListOfManagedEvents();
$var=true;
foreach($listofnotifiedevents as $notifiedevent)
{
$var=!$var;
$label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
if ($notifiedevent['elementtype'] == 'order_supplier') $elementLabel = $langs->trans('SupplierOrder');
elseif ($notifiedevent['elementtype'] == 'propal') $elementLabel = $langs->trans('Proposal');
elseif ($notifiedevent['elementtype'] == 'facture') $elementLabel = $langs->trans('Bill');
elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order');
print '<tr '.$bc[$var].'>';
print '<td>'.$elementLabel.'</td>';
print '<td>'.$notifiedevent['code'].'</td>';
print '<td>'.$label.'</td>';
print '<td align="right">';
$tmparray = $notify->getNotificationsArray($notifiedevent['code'], 0);
print count($tmparray);
print '</td>';
print '</tr>';
}
print '</table>';
print '* '.$langs->trans("GoOntoContactCardToAddMore").'<br>';
print '<br>';
}
print_fiche_titre($langs->trans("ListOfFixedNotifications"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -115,12 +194,15 @@ print '<td>'.$langs->trans("Module").'</td>';
print '<td>'.$langs->trans("Code").'</td>';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("FixedEmailTarget").'</td>';
print '<td>'.$langs->trans("Threshold").'</td>';
print '<td>'.'</td>';
print "</tr>\n";
// Load array of available notifications
$notificationtrigger=new InterfaceNotification($db);
$listofnotifiedevents=$notificationtrigger->getListOfManagedEvents();
$var=true;
foreach($listofnotifiedevents as $notifiedevent)
{
$var=!$var;
@ -136,18 +218,47 @@ foreach($listofnotifiedevents as $notifiedevent)
print '<td>'.$notifiedevent['code'].'</td>';
print '<td>'.$label.'</td>';
print '<td>';
$param='NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'];
$value=GETPOST($param)?GETPOST($param,'alpha'):$conf->global->$param;
$s='<input type="text" size="32" name="'.$param.'" value="'.dol_escape_htmltag($value).'">'; // Do not use type="email" here, we must be able to enter a list of email with , separator.
$arrayemail=explode(',',$value);
$showwarning=0;
foreach($arrayemail as $key=>$valuedet)
{
$valuedet=trim($valuedet);
if (! empty($valuedet) && ! isValidEmail($valuedet)) $showwarning++;
}
if ((! empty($conf->global->$param)) && $showwarning) $s.=' '.img_warning($langs->trans("ErrorBadEMail"));
print $form->textwithpicto($s,$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
// Notification with threshold
foreach($conf->global as $key => $val)
{
if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_(.*)/', $key, $reg)) continue;
$param='NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_'.$reg[1];
$value=GETPOST('NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key')?GETPOST('NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key','alpha'):$conf->global->$param;
$s='<input type="text" size="32" name="NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key" value="'.dol_escape_htmltag($value).'">'; // Do not use type="email" here, we must be able to enter a list of email with , separator.
$arrayemail=explode(',',$value);
$showwarning=0;
foreach($arrayemail as $key=>$valuedet)
{
$valuedet=trim($valuedet);
if (! empty($valuedet) && ! isValidEmail($valuedet,1)) $showwarning++;
}
if ((! empty($conf->global->$param)) && $showwarning) $s.=' '.img_warning($langs->trans("ErrorBadEMail"));
print $form->textwithpicto($s,$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'<br>'.$langs->trans("YouCanAlsoUseSupervisorKeyword"),1,'help','',0,2);
print '<br>';
}
// New entry input fields
$s='<input type="text" size="32" name="NOTIF_'.$notifiedevent['code'].'_new_key" value="">'; // Do not use type="email" here, we must be able to enter a list of email with , separator.
print $form->textwithpicto($s,$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'<br>'.$langs->trans("YouCanAlsoUseSupervisorKeyword"),1,'help','',0,2);
print '</td>';
print '<td>';
// Notification with threshold
foreach($conf->global as $key => $val)
{
if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_(.*)/', $key, $reg)) continue;
print $langs->trans("AmountHT").' >= <input type="text" size="4" name="NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_amount" value="'.dol_escape_htmltag($reg[1]).'">';
print '<br>';
}
// New entry input fields
print $langs->trans("AmountHT").' >= <input type="text" size="4" name="NOTIF_'.$notifiedevent['code'].'_new_amount" value="">';
print '</td>';
print '<td>';
// TODO Add link to show message content
print '</td>';
print '</tr>';
}

View File

@ -643,6 +643,27 @@ print "</tr>\n";
print "<tr ".$bc[false].">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->propal->dir_output."</td>\n</tr>\n";
print "</table>\n<br>";
$db->close();
/*
* Notifications
*/
print_titre($langs->trans("Notifications"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60"></td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
print '</td><td align="right">';
print "</td></tr>\n";
print '</table>';
llxFooter();
$db->close();

View File

@ -124,11 +124,11 @@ $var=true;
*/
if (! empty($conf->global->ADHERENT_USE_SPIP))
{
//$lien=img_picto($langs->trans("Active"),'tick').' ';
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">';
//$lien.=$langs->trans("Disable");
$lien.=img_picto($langs->trans("Activated"),'switch_on');
$lien.='</a>';
//$link=img_picto($langs->trans("Active"),'tick').' ';
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">';
//$link.=$langs->trans("Disable");
$link.=img_picto($langs->trans("Activated"),'switch_on');
$link.='</a>';
// Edition des varibales globales
$constantes=array(
'ADHERENT_SPIP_SERVEUR',
@ -137,18 +137,18 @@ if (! empty($conf->global->ADHERENT_USE_SPIP))
'ADHERENT_SPIP_PASS'
);
print_fiche_titre($langs->trans('SPIPTitle'), $lien, '');
print_fiche_titre($langs->trans('SPIPTitle'), $link, '');
print '<br>';
form_constantes($constantes);
print '<br>';
}
else
{
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">';
//$lien.=$langs->trans("Activate");
$lien.=img_picto($langs->trans("Disabled"),'switch_off');
$lien.='</a>';
print_fiche_titre($langs->trans('SPIPTitle'), $lien, '');
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">';
//$link.=$langs->trans("Activate");
$link.=img_picto($langs->trans("Disabled"),'switch_off');
$link.='</a>';
print_fiche_titre($langs->trans('SPIPTitle'), $link, '');
}

View File

@ -443,14 +443,16 @@ foreach ($dirmodels as $reldir)
}
}
print '</table><br/>';
print '<br>';
print '</table><br>';
/*
* Other options
*
*/
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_SUPPLIER_INVOICE_FREE_TEXT">';
print_titre($langs->trans("OtherOptions"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -459,16 +461,38 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
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_SUPPLIER_INVOICE_FREE_TEXT">';
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnInvoices").' ('.$langs->trans("AddCRIfTooLong").')<br>';
print '<textarea name="SUPPLIER_INVOICE_FREE_TEXT" class="flat" cols="120">'.$conf->global->SUPPLIER_INVOICE_FREE_TEXT.'</textarea>';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</table><br>';
print '</form>';
$db->close();
/*
* Notifications
*/
print_titre($langs->trans("Notifications"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60"></td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
print '</td><td align="right">';
print "</td></tr>\n";
print '</table>';
llxFooter();
$db->close();

View File

@ -165,22 +165,45 @@ else if ($action == 'addcat')
$fourn->CreateCategory($user,$_POST["cat"]);
}
else if ($action == 'set_SUPPLIER_ORDER_FREE_TEXT')
else if ($action == 'set_SUPPLIER_ORDER_OTHER')
{
$freetext = GETPOST('SUPPLIER_ORDER_FREE_TEXT'); // No alpha here, we want exact string
$doubleapproval = GETPOST('SUPPLIER_ORDER_DOUBLE_APPROVAL');
//$doubleapprovalgroup = GETPOST('SUPPLIER_ORDER_DOUBLE_APPROVAL_GROUP') > 0 ? GETPOST('SUPPLIER_ORDER_DOUBLE_APPROVAL_GROUP') : '';
$res = dolibarr_set_const($db, "SUPPLIER_ORDER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
$res1 = dolibarr_set_const($db, "SUPPLIER_ORDER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
$res2 = dolibarr_set_const($db, "SUPPLIER_ORDER_DOUBLE_APPROVAL",$doubleapproval,'chaine',0,'',$conf->entity);
/*if (isset($_POST["SUPPLIER_ORDER_DOUBLE_APPROVAL_GROUP"]))
{
$res3 = dolibarr_set_const($db, "SUPPLIER_ORDER_DOUBLE_APPROVAL_GROUP",$doubleapprovalgroup,'chaine',0,'',$conf->entity);
}
else
{
$res3=1;
}*/
if (! $res > 0) $error++;
// TODO We add/delete permission here until permission can have a condition on a global var
include_once DOL_DOCUMENT_ROOT.'/core/modules/modFournisseur.class.php';
$newmodule=new modFournisseur($db);
// clear default rights array
$newmodule->rights=array();
// add new right
$r=0;
$newmodule->rights[$r][0] = 1190;
$newmodule->rights[$r][1] = $langs->trans("Permission1190");
$newmodule->rights[$r][2] = 'w';
$newmodule->rights[$r][3] = 0;
$newmodule->rights[$r][4] = 'commande';
$newmodule->rights[$r][5] = 'approve2';
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
}
else
{
setEventMessage($langs->trans("Error"),'errors');
}
if ($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL)
{
$newmodule->insert_permissions(1);
}
else
{
$newmodule->delete_permissions();
}
}
@ -188,12 +211,12 @@ else if ($action == 'set_SUPPLIER_ORDER_FREE_TEXT')
* View
*/
$form=new Form($db);
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
llxHeader("","");
$form=new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("SuppliersSetup"),$linkback,'setup');
@ -439,14 +462,16 @@ foreach ($dirmodels as $reldir)
}
}
print '</table><br/>';
print '<br>';
print '</table><br>';
/*
* Other options
*
*/
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_SUPPLIER_ORDER_OTHER">';
print_titre($langs->trans("OtherOptions"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -454,17 +479,60 @@ print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=false;
if ($conf->global->MAIN_FEATURES_LEVEL > 0)
{
print '<tr '.$bc[$var].'><td>';
print $langs->trans("UseDoubleApproval").'<br>';
print $langs->trans("IfSetToYesDontForgetPermission");
print '</td><td>';
print $form->selectyesno('SUPPLIER_ORDER_DOUBLE_APPROVAL', $conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL, 1);
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
$var=!$var;
/*print '<tr '.$bc[$var].'><td>';
print $langs->trans("GroupOfUserForSecondApproval").'</td><td>';
print $form->select_dolgroups($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL_GROUP,'SUPPLIER_ORDER_DOUBLE_APPROVAL_GROUP', 1);
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
$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_SUPPLIER_ORDER_FREE_TEXT">';
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnOrders").' ('.$langs->trans("AddCRIfTooLong").')<br>';
print '<textarea name="SUPPLIER_ORDER_FREE_TEXT" class="flat" cols="120">'.$conf->global->SUPPLIER_ORDER_FREE_TEXT.'</textarea>';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</table><br>';
print '</form>';
$db->close();
/*
* Notifications
*/
print_titre($langs->trans("Notifications"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60"></td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
print '</td><td align="right">';
print "</td></tr>\n";
print '</table>';
llxFooter();
$db->close();

View File

@ -179,7 +179,7 @@ $c=getServerTimeZoneInt('summer');
$daylight=(is_numeric($c) && is_numeric($b))?round($c-$b):'unknown';
//print $a." ".$b." ".$c." ".$daylight;
$val=($a>=0?'+':'').$a;
$val.=' ('.($a==='unknown'?'unknown':($a>=0?'+':'').($a*3600)).')';
$val.=' ('.($a=='unknown'?'unknown':($a>=0?'+':'').($a*3600)).')';
$val.=' &nbsp; &nbsp; &nbsp; '.getServerTimeZoneString();
$val.=' &nbsp; &nbsp; &nbsp; '.$langs->trans("DaylingSavingTime").': '.($daylight==='unknown'?'unknown':($a==$c?yn($daylight):yn(0).($daylight?' &nbsp; &nbsp; ('.$langs->trans('YesInSummer').')':'')));
print $form->textwithtooltip($val,$txt,2,1,img_info(''));

View File

@ -111,11 +111,6 @@ jQuery(document).ready(function() {
print_fiche_titre($langs->trans("Backup"),'','setup');
print $langs->trans("BackupDesc",DOL_DATA_ROOT).'<br><br>';
print $langs->trans("BackupDesc2",DOL_DATA_ROOT).'<br>';
print $langs->trans("BackupDescX").'<br><br>';
print $langs->trans("BackupDesc3",DOL_DATA_ROOT).'<br>';
print $langs->trans("BackupDescY").'<br><br>';
?>
@ -124,9 +119,29 @@ print $langs->trans("BackupDescY").'<br><br>';
name="token" value="<?php echo $_SESSION['newtoken']; ?>" /> <input
type="hidden" name="export_type" value="server" />
<fieldset id="fieldsetexport">
<?php print '<legend>'.$langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b></legend>'; ?>
<table>
<fieldset id="fieldsetexport"><legend style="font-size: 3em">1</legend>
<?php
print $langs->trans("BackupDesc3",$dolibarr_main_db_name).'<br>';
//print $langs->trans("BackupDescY").'<br>';
print '<br>';
?>
<div id="backupdatabaseleft" class="fichehalfleft" >
<?php
print_titre($title?$title:$langs->trans("BackupDumpWizard"));
print '<table width="100%" class="'.($useinecm?'nobordernopadding':'liste').'">';
print '<tr class="liste_titre">';
print '<td class="liste_titre">';
print $langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b><br>';
print '</td>';
print '</tr>';
print '<tr '.$bc[false].'><td style="padding-left: 8px">';
?>
<table class="centpercent">
<tr>
<td valign="top">
@ -182,7 +197,7 @@ print $langs->trans("BackupDescY").'<br><br>';
$fullpathofmysqldump=$conf->global->SYSTEMTOOLS_MYSQLDUMP;
}
?><br>
<input type="text" name="mysqldump" size="80"
<input type="text" name="mysqldump" style="width: 80%"
value="<?php echo $fullpathofmysqldump; ?>" /></div>
<br>
@ -317,7 +332,7 @@ print $langs->trans("BackupDescY").'<br><br>';
$fullpathofpgdump=$conf->global->SYSTEMTOOLS_POSTGRESQLDUMP;
}
?><br>
<input type="text" name="postgresqldump" size="80"
<input type="text" name="postgresqldump" style="width: 80%"
value="<?php echo $fullpathofpgdump; ?>" /></div>
@ -357,12 +372,12 @@ print $langs->trans("BackupDescY").'<br><br>';
</tr>
</table>
</fieldset>
<fieldset>
<legend><?php echo $langs->trans("Destination"); ?></legend>
<label for="filename_template"> <?php echo $langs->trans("FileNameToGenerate"); ?></label>:
<input type="text" name="filename_template" size="60"
<!--<fieldset>
<legend><?php echo $langs->trans("Destination"); ?></legend> -->
<br>
<label for="filename_template"> <?php echo $langs->trans("FileNameToGenerate"); ?></label><br>
<input type="text" name="filename_template" style="width: 90%"
id="filename_template"
value="<?php
$prefix='dump';
@ -417,7 +432,8 @@ foreach($compression as $key => $val)
print '</div>';
print "\n";
?></fieldset>
?><!--</fieldset>--> <!-- End destination -->
<br>
<div align="center"><input type="submit" class="button"
@ -425,15 +441,38 @@ print "\n";
<br>
</div>
<?php
print '</td></tr></table>';
?>
</form>
</div>
<div id="backupdatabaseright" class="fichehalfright" style="height:400px; overflow: auto;">
<div class="ficheaddleft">
<?php
$filearray=dol_dir_list($conf->admin->dir_output.'/backup','files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1);
$result=$formfile->list_of_documents($filearray,null,'systemtools','',1,'backup/',1,0,$langs->trans("NoBackupFileAvailable"),0,$langs->trans("PreviousDumpFiles"));
print '<br>';
?>
</div>
</div>
</fieldset>
<br>
<fieldset><legend style="font-size: 3em">2</legend>
<?php
print $langs->trans("BackupDesc2",DOL_DATA_ROOT).'<br>';
print $langs->trans("BackupDescX").'<br><br>';
?>
</fieldset>
</form>
<?php
llxFooter();

View File

@ -66,13 +66,24 @@ jQuery(document).ready(function() {
print_fiche_titre($langs->trans("Restore"),'','setup');
print $langs->trans("RestoreDesc",DOL_DATA_ROOT).'<br><br>';
?>
<fieldset>
<legend style="font-size: 3em">1</legend>
<?php
print $langs->trans("RestoreDesc2",DOL_DATA_ROOT).'<br><br>';
print $langs->trans("RestoreDesc3",DOL_DATA_ROOT).'<br><br>';
?>
</fieldset>
<br>
<fieldset>
<legend style="font-size: 3em">2</legend>
<?php
print $langs->trans("RestoreDesc3",$dolibarr_main_db_name).'<br><br>';
?>
<fieldset id="fieldsetexport">
<?php print '<legend>'.$langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b></legend>'; ?>
<?php print $langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b>'; ?><br><br>
<table><tr><td valign="top">
<?php if ($conf->use_javascript_ajax) { ?>

View File

@ -88,10 +88,10 @@ if (!empty($MemoryLimit))
$form=new Form($db);
$formfile = new FormFile($db);
$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
llxHeader('','',$help_url);
//$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
//llxHeader('','',$help_url);
print_fiche_titre($langs->trans("Backup"),'','setup');
//print_fiche_titre($langs->trans("Backup"),'','setup');
// Start with empty buffer
@ -165,13 +165,18 @@ if ($what == 'mysql')
$paramclear.=' -p"'.str_replace(array('"','`'),array('\"','\`'),$dolibarr_main_db_pass).'"';
}
$_SESSION["commandbackuplastdone"]=$command." ".$paramcrypted;
$_SESSION["commandbackuptorun"]="";
/*
print '<b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n";
print '<textarea rows="'.ROWS_2.'" cols="120">'.$command." ".$paramcrypted.'</textarea><br>'."\n";
print '<br>';
//print $paramclear;
// Now run command and show result
print '<b>'.$langs->trans("BackupResult").':</b> ';
*/
$errormsg='';
@ -264,6 +269,9 @@ if ($what == 'mysqlnobin')
{
backup_tables($outputfile);
}
$_SESSION["commandbackuplastdone"]="";
$_SESSION["commandbackuptorun"]="";
}
// POSTGRESQL
@ -320,7 +328,9 @@ if ($what == 'postgresql')
$paramcrypted.=" -w ".$dolibarr_main_db_name;
$paramclear.=" -w ".$dolibarr_main_db_name;
print $langs->trans("RunCommandSummaryToLaunch").':<br>'."\n";
$_SESSION["commandbackuplastdone"]="";
$_SESSION["commandbackuptorun"]=$command." ".$paramcrypted;
/*print $langs->trans("RunCommandSummaryToLaunch").':<br>'."\n";
print '<textarea rows="'.ROWS_3.'" cols="120">'.$command." ".$paramcrypted.'</textarea><br>'."\n";
print '<br>';
@ -330,7 +340,7 @@ if ($what == 'postgresql')
print $langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser",$dolibarr_main_db_user,$dolibarr_main_db_user);
print '<br>';
print '<br>';
print '<br>';*/
$what='';
}
@ -339,34 +349,46 @@ if ($what == 'postgresql')
// Si on a demande une generation
if ($what)
{
//if ($what)
//{
if ($errormsg)
{
setEventMessage($langs->trans("Error")." : ".$errormsg, 'errors');
/*
print '<div class="error">'.$langs->trans("Error")." : ".$errormsg.'</div>';
// print '<a href="'.DOL_URL_ROOT.$relativepatherr.'">'.$langs->trans("DownloadErrorFile").'</a><br>';
print '<br>';
print '<br>';
print '<br>';*/
}
else
{
print '<div class="ok">';
print $langs->trans("BackupFileSuccessfullyCreated").'.<br>';
print $langs->trans("YouCanDownloadBackupFile");
print '</div>';
print '<br>';
{
if ($what)
{
setEventMessage($langs->trans("BackupFileSuccessfullyCreated").'.<br>'.$langs->trans("YouCanDownloadBackupFile"));
/*print '<div class="ok">';
print $langs->trans("BackupFileSuccessfullyCreated").'.<br>';
print $langs->trans("YouCanDownloadBackupFile");
print '</div>';
print '<br>';*/
}
else
{
setEventMessage($langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser",$dolibarr_main_db_user,$dolibarr_main_db_user));
}
}
}
//}
/*
$filearray=dol_dir_list($conf->admin->dir_output.'/backup','files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1);
$result=$formfile->list_of_documents($filearray,null,'systemtools','',1,'backup/',1,0,($langs->trans("NoBackupFileAvailable").'<br>'.$langs->trans("ToBuildBackupFileClickHere",DOL_URL_ROOT.'/admin/tools/dolibarr_export.php')),0,$langs->trans("PreviousDumpFiles"));
print '<br>';
*/
// Redirect t backup page
header("Location: dolibarr_export.php");
$time_end = time();
llxFooter();
$db->close();

View File

@ -24,10 +24,13 @@
require '../../main.inc.php';
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
include_once DOL_DOCUMENT_ROOT . '/core/lib/geturl.lib.php';
$langs->load("admin");
$langs->load("other");
$action=GETPOST('action','alpha');
if (! $user->admin) accessforbidden();
if (GETPOST('msg','alpha')) {
@ -42,14 +45,18 @@ $dolibarrroot=preg_replace('/([\\/]+)$/i','',DOL_DOCUMENT_ROOT);
$dolibarrroot=preg_replace('/([^\\/]+)$/i','',$dolibarrroot);
$dolibarrdataroot=preg_replace('/([\\/]+)$/i','',DOL_DATA_ROOT);
$dirins=DOL_DOCUMENT_ROOT.'/custom';
/*
* Actions
*/
if (GETPOST('action','alpha')=='install')
if ($action=='install')
{
$error=0;
// $original_file should match format module_modulename-x.y[.z].zip
$original_file=basename($_FILES["fileinstall"]["name"]);
$newfile=$conf->admin->dir_temp.'/'.$original_file.'/'.$original_file;
@ -71,33 +78,87 @@ if (GETPOST('action','alpha')=='install')
if (! $error)
{
@dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file);
dol_mkdir($conf->admin->dir_temp.'/'.$original_file);
if ($original_file)
{
@dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file);
dol_mkdir($conf->admin->dir_temp.'/'.$original_file);
}
$tmpdir=preg_replace('/\.zip$/','',$original_file).'.dir';
if ($tmpdir)
{
@dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$tmpdir);
dol_mkdir($conf->admin->dir_temp.'/'.$tmpdir);
}
$result=dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'],$newfile,1,0,$_FILES['fileinstall']['error']);
if ($result > 0)
{
$documentrootalt=DOL_DOCUMENT_ROOT.'/extensions';
$result=dol_uncompress($newfile,$documentrootalt);
$result=dol_uncompress($newfile,$conf->admin->dir_temp.'/'.$tmpdir);
if (! empty($result['error']))
{
$langs->load("errors");
setEventMessage($langs->trans($result['error'],$original_file), 'errors');
$error++;
}
else
{
setEventMessage($langs->trans("SetupIsReadyForUse"));
// Now we move the dir of the module
$modulename=preg_replace('/module_/', '', $original_file);
$modulename=preg_replace('/\-[\d]+\.[\d]+.*$/', '', $modulename);
// Search dir $modulename
$modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename;
//var_dump($modulenamedir);
if (! dol_is_dir($modulenamedir))
{
$modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename;
//var_dump($modulenamedir);
if (! dol_is_dir($modulenamedir))
{
setEventMessage($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat"), 'errors');
$error++;
}
}
if (! $error)
{
//var_dump($dirins);
@dol_delete_dir_recursive($dirins.'/'.$modulename);
$result=dolCopyDir($modulenamedir, $dirins.'/'.$modulename, '0444', 1);
if ($result <= 0)
{
setEventMessage($langs->trans("ErrorFailedToCopy"), 'errors');
$error++;
}
}
}
}
else
{
$error++;
}
}
if (! $error)
{
setEventMessage($langs->trans("SetupIsReadyForUse"));
}
}
/*
* View
*/
$dirins=DOL_DOCUMENT_ROOT.'/extensions';
$dirins_ok=(is_dir($dirins));
// Set dir where external modules are installed
if (! dol_is_dir($dirins))
{
dol_mkdir($dirins);
}
$dirins_ok=(dol_is_dir($dirins));
$wikihelp='EN:Installation_-_Upgrade|FR:Installation_-_Mise_à_jour|ES:Instalación_-_Actualización';
llxHeader('',$langs->trans("Upgrade"),$wikihelp);
@ -105,9 +166,45 @@ llxHeader('',$langs->trans("Upgrade"),$wikihelp);
print_fiche_titre($langs->trans("Upgrade"),'','setup');
print $langs->trans("CurrentVersion").' : <b>'.DOL_VERSION.'</b><br>';
print $langs->trans("LastStableVersion").' : <b>'.$langs->trans("FeatureNotYetAvailable").'</b><br>';
$result = getURLContent('http://sourceforge.net/projects/dolibarr/rss');
//var_dump($result['content']);
$sfurl = simplexml_load_string($result['content']);
if ($sfurl)
{
$title=$sfurl->channel[0]->item[0]->title;
function word_limiter($text, $limit = 30, $chars = '0123456789.')
{
if (strlen( $text ) > $limit)
{
$words = str_word_count($text, 2, $chars);
$words = array_reverse($words, TRUE);
foreach($words as $length => $word) {
if ($length + strlen( $word ) >= $limit)
{
array_shift($words);
} else {
break;
}
}
$words = array_reverse($words);
$text = implode(" ", $words) . '';
}
return $text;
}
$str = $title;
print $langs->trans("LastStableVersion").' : <b>'. word_limiter( $str ).'</b><br>';
}
else
{
print $langs->trans("LastStableVersion").' : <b>' .$langs->trans("UpdateServerOffline").'</b><br>';
}
print '<br>';
// Upgrade
print $langs->trans("Upgrade").'<br>';
print '<hr>';
print $langs->trans("ThisIsProcessToFollow").'<br>';
@ -127,20 +224,76 @@ print $langs->trans("RestoreLock",$dolibarrdataroot.'/install.lock').'<br>';
print '<br>';
print '<br>';
// Install external module
$allowonlineinstall=true;
$allowfromweb=1;
if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) $allowonlineinstall=false;
$fullurl='<a href="'.$urldolibarrmodules.'" target="_blank">'.$urldolibarrmodules.'</a>';
$message='';
if (! empty($allowonlineinstall))
{
if (! in_array('/custom',explode(',',$dolibarr_main_url_root_alt)))
{
$message=info_admin($langs->trans("ConfFileMuseContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
$allowfromweb=-1;
}
else
{
if ($dirins_ok)
{
if (! is_writable(dol_osencode($dirins)))
{
$langs->load("errors");
$message=info_admin($langs->trans("ErrorFailedToWriteInDir",$dirins));
$allowfromweb=0;
}
}
else
{
$message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
$allowfromweb=0;
}
}
}
else
{
$message=info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile",$dolibarrdataroot.'/installmodules.lock'));
$allowfromweb=0;
}
print $langs->trans("AddExtensionThemeModuleOrOther").'<br>';
print '<hr>';
print $langs->trans("ThisIsProcessToFollow").'<br>';
print '<b>'.$langs->trans("StepNb",1).'</b>: ';
print $langs->trans("FindPackageFromWebSite",$fullurl).'<br>';
print '<b>'.$langs->trans("StepNb",2).'</b>: ';
print $langs->trans("DownloadPackageFromWebSite",$fullurl).'<br>';
print '<b>'.$langs->trans("StepNb",3).'</b>: ';
print $langs->trans("UnpackPackageInDolibarrRoot",$dolibarrroot).'<br>';
if (! empty($conf->global->MAIN_ONLINE_INSTALL_MODULE))
if ($allowfromweb < 1)
{
if ($dirins_ok)
print $langs->trans("SomethingMakeInstallFromWebNotPossible");
print $message;
//print $langs->trans("SomethingMakeInstallFromWebNotPossible2");
print '<br>';
}
if ($allowfromweb >= 0)
{
if ($allowfromweb == 1) print $langs->trans("ThisIsProcessToFollow").'<br>';
else print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>';
print '<b>'.$langs->trans("StepNb",1).'</b>: ';
print $langs->trans("FindPackageFromWebSite",$fullurl).'<br>';
print '<b>'.$langs->trans("StepNb",2).'</b>: ';
print $langs->trans("DownloadPackageFromWebSite",$fullurl).'<br>';
print '<b>'.$langs->trans("StepNb",3).'</b>: ';
if ($allowfromweb == 1)
{
print $langs->trans("UnpackPackageInDolibarrRoot",$dirins).'<br>';
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
print '<input type="hidden" name="action" value="install">';
print $langs->trans("YouCanSubmitFile").' <input type="file" name="fileinstall"> ';
@ -149,16 +302,12 @@ if (! empty($conf->global->MAIN_ONLINE_INSTALL_MODULE))
}
else
{
$message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
setEventMessage($message, 'warnings');
print $langs->trans("UnpackPackageInDolibarrRoot",$dirins).'<br>';
print '<b>'.$langs->trans("StepNb",4).'</b>: ';
print $langs->trans("SetupIsReadyForUse").'<br>';
}
}
else
{
print '<b>'.$langs->trans("StepNb",4).'</b>: ';
print $langs->trans("SetupIsReadyForUse").'<br>';
}
print '</form>';
if (! empty($result['return']))
{

View File

@ -119,17 +119,17 @@ if ($resql)
print "<a href=\"card.php?id=".$obj->bid."\">".img_object($langs->trans("ShowBookmark"),"bookmark").' '.$obj->bid."</a>";
print '</td>';
$lieninterne=0;
$linkintern=0;
$title=dol_trunc($obj->title,24);
$lien=dol_trunc($obj->url,24);
$link=dol_trunc($obj->url,24);
// Title
print "<td>";
if ($obj->rowid)
{
// Lien interne societe
$lieninterne=1;
$lien="Dolibarr";
$linkintern=1;
$link="Dolibarr";
if (! $obj->title)
{
// For compatibility with old Dolibarr bookmarks
@ -140,16 +140,16 @@ if ($resql)
}
$title=img_object($langs->trans("ShowCompany"),"company").' '.$obj->title;
}
if ($lieninterne) print "<a href=\"".$obj->url."\">";
if ($linkintern) print "<a href=\"".$obj->url."\">";
print $title;
if ($lieninterne) print "</a>";
if ($linkintern) print "</a>";
print "</td>\n";
// Url
print "<td>";
if (! $lieninterne) print '<a href="'.$obj->url.'"'.($obj->target?' target="newlink"':'').'>';
print $lien;
if (! $lieninterne) print '</a>';
if (! $linkintern) print '<a href="'.$obj->url.'"'.($obj->target?' target="newlink"':'').'>';
print $link;
if (! $linkintern) print '</a>';
print "</td>\n";
// Target

View File

@ -49,6 +49,7 @@ if (!$user->admin) accessforbidden();
/*
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';

View File

@ -235,7 +235,9 @@ if ($socid)
$soc = new Societe($db);
$result = $soc->fetch($socid);
llxHeader("","",$langs->trans("Category"));
$title=$langs->trans("Category");
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$soc->name." - ".$title;
llxHeader("",$title);
// Show tabs
$head = societe_prepare_head($soc);
@ -339,9 +341,9 @@ else if ($id || $ref)
llxHeader("","",$langs->trans("CardProduct".$product->type));
$head=product_prepare_head($product, $user);
$head=product_prepare_head($product);
$titre=$langs->trans("CardProduct".$product->type);
$picto=($product->type==1?'service':'product');
$picto=($product->type== Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'category', $titre,0,$picto);

View File

@ -201,7 +201,7 @@ class Categorie extends CommonObject
$action='create';
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('HookModuleNamedao'));
$parameters=array('socid'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
@ -294,7 +294,7 @@ class Categorie extends CommonObject
$action='update';
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('HookCategorydao'));
$parameters=array();
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
@ -1000,7 +1000,7 @@ class Categorie extends CommonObject
/**
* Check if no category with same label already exists for this cat's parent or root and for this cat's type
*
* @return boolean 1 if already exist, 0 otherwise, -1 if error
* @return integer 1 if already exist, 0 otherwise, -1 if error
*/
function already_exists()
{
@ -1265,7 +1265,7 @@ class Categorie extends CommonObject
/**
* Return name and link of category (with picto)
*
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param string $option Sur quoi pointe le lien ('', 'xyz')
* @param int $maxlength Max length of text
* @return string Chaine avec URL
@ -1277,15 +1277,15 @@ class Categorie extends CommonObject
$result='';
$label=$langs->trans("ShowCategory").': '. ($this->ref?$this->ref:$this->label);
$lien = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>';
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>';
$picto='category';
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.dol_trunc(($this->ref?$this->ref:$this->label),$maxlength).$lienfin;
if ($withpicto != 2) $result.=$link.dol_trunc(($this->ref?$this->ref:$this->label),$maxlength).$linkend;
return $result;
}
@ -1295,11 +1295,9 @@ class Categorie extends CommonObject
*
* @param string $sdir Repertoire destination finale
* @param string $file Nom du fichier uploade
* @param int $maxWidth Largeur maximum que dois faire la miniature (160 par defaut)
* @param int $maxHeight Hauteur maximum que dois faire la miniature (120 par defaut)
* @return void
*/
function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120)
function add_photo($sdir, $file)
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -1321,36 +1319,11 @@ class Categorie extends CommonObject
if (file_exists($originImage))
{
// Cree fichier en taille vignette
$this->add_thumb($originImage,$maxWidth,$maxHeight);
$this->add_thumb($originImage);
}
}
}
/**
* Build thumb
*
* @param string $file Chemin du fichier d'origine
* @return void
*/
function add_thumb($file)
{
global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini, $quality;
require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php'; // This define also $maxwidthsmall, $quality, ...
if (file_exists($file))
{
// Create small thumbs for company (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
// Create mini thumbs for company (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($file, $maxwidthmini, $maxheightmini, '_mini', $quality);
}
}
/**
* Return tableau de toutes les photos de la categorie
*

View File

@ -333,7 +333,7 @@ class ActionComm extends CommonObject
$action='create';
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('actioncommdao'));
$parameters=array('actcomm'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
@ -421,7 +421,8 @@ class ActionComm extends CommonObject
$resql=$this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
$num=$this->db->num_rows($resql);
if ($num)
{
$obj = $this->db->fetch_object($resql);
@ -477,13 +478,15 @@ class ActionComm extends CommonObject
$this->elementtype = $obj->elementtype;
}
$this->db->free($resql);
return 1;
}
else
{
$this->error=$this->db->lasterror();
return -1;
}
return $num;
}
@ -654,7 +657,7 @@ class ActionComm extends CommonObject
$action='update';
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('actioncommdao'));
$parameters=array('actcomm'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
@ -957,7 +960,7 @@ class ActionComm extends CommonObject
* Return URL of event
* Use $this->id, $this->type_code, $this->label and $this->type_label
*
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlength Nombre de caracteres max dans libelle
* @param string $classname Force style class on a link
* @param string $option ''=Link to action,'birthday'=Link to contact
@ -970,13 +973,16 @@ class ActionComm extends CommonObject
$result='';
$tooltip = '<u>' . $langs->trans('ShowAction'.$objp->code) . '</u>';
$tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->label;
if (! empty($this->ref))
$tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
if (! empty($this->label))
$tooltip .= '<br><b>' . $langs->trans('Title') . ':</b> ' . $this->label;
$label = $this->label;
if (empty($label)) $label=$this->libelle; // For backward compatibility
$linkclose = '" title="'.dol_escape_htmltag($tooltip, 1).'" class="classfortooltip">';
if ($option=='birthday') $lien = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/contact/perso.php?id='.$this->id.$linkclose;
else $lien = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id.$linkclose;
$lienfin='</a>';
$linkclose = '" title="'.dol_escape_htmltag($tooltip, 1).'">';
if ($option=='birthday') $link = '<a class="'.$classname.' classfortooltip" href="'.DOL_URL_ROOT.'/contact/perso.php?id='.$this->id.$linkclose;
else $link = '<a class="'.$classname.' classfortooltip" href="'.DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id.$linkclose;
$linkend='</a>';
//print 'rrr'.$this->libelle.'-'.$withpicto;
if ($withpicto == 2)
@ -998,10 +1004,10 @@ class ActionComm extends CommonObject
{
$libelle.=(($this->type_code && $libelle!=$langs->transnoentities("Action".$this->type_code) && $langs->transnoentities("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->transnoentities("Action".$this->type_code).')':'');
}
$result.=$lien.img_object($langs->trans("ShowAction").': '.$libelle, ($overwritepicto?$overwritepicto:'action'), 'class="classfortooltip"').$lienfin;
$result.=$link.img_object($langs->trans("ShowAction").': '.$libelle, ($overwritepicto?$overwritepicto:'action'), 'class="classfortooltip"').$linkend;
}
if ($withpicto==1) $result.=' ';
$result.=$lien.$libelleshort.$lienfin;
$result.=$link.$libelleshort.$linkend;
return $result;
}

View File

@ -220,8 +220,8 @@ class ICal
}
if (($key == "DTSTAMP") or ($key == "LAST-MODIFIED") or ($key == "CREATED")) $value = $this->ical_date_to_unix($value);
if ($key == "RRULE" ) $value = $this->ical_rrule($value);
//if ($key == "RRULE" ) $value = $this->ical_rrule($value);
if (stristr($key,"DTSTART") or stristr($key,"DTEND") or stristr($key,"DTSTART;VALUE=DATE") or stristr($key,"DTEND;VALUE=DATE"))
{
if (stristr($key,"DTSTART;VALUE=DATE") or stristr($key,"DTEND;VALUE=DATE"))

View File

@ -614,7 +614,7 @@ else
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON u.rowid = ug.fk_user";
$sql.= " WHERE u.entity IN (".getEntity('user',1).")";
if ($usergroup > 0) $sql.= " AND ug.fk_usergroup = ".$usergroup;
if (GETPOST("usertodo","int",3) > 0) $sql.=" AND u.rowid = ".GETPOST("usertodo","int",3);
//if (GETPOST("usertodo","int",3) > 0) $sql.=" AND u.rowid = ".GETPOST("usertodo","int",3);
//print $sql;
$resql=$db->query($sql);
if ($resql)

View File

@ -1337,7 +1337,7 @@ if ($action == 'create')
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db);
$text .= '<br>';
$text .= $notify->confirmMessage('ASKPRICESUPPLIER_VALIDATE', $object->socid);
$text .= $notify->confirmMessage('ASKPRICESUPPLIER_VALIDATE', $object->socid, $object);
}
if (! $error)
@ -1346,9 +1346,9 @@ if ($action == 'create')
if (! $formconfirm) {
$parameters = array('lineid' => $lineid);
$formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified
// by
// hook
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
}
// Print form confirm

View File

@ -185,7 +185,7 @@ class AskPriceSupplier extends CommonObject
$price = $prod->price;
}
$line = new AskPriceSupplierLigne($this->db);
$line = new AskPriceSupplierLine($this->db);
$line->fk_product=$idproduct;
$line->desc=$productdesc;
@ -225,7 +225,7 @@ class AskPriceSupplier extends CommonObject
return -5;
}
$askpricesupplierligne=new AskPriceSupplierLigne($this->db);
$askpricesupplierligne=new AskPriceSupplierLine($this->db);
$askpricesupplierligne->fk_askpricesupplier=$this->id;
$askpricesupplierligne->fk_remise_except=$remise->id;
$askpricesupplierligne->desc=$remise->description; // Description ligne
@ -376,7 +376,7 @@ class AskPriceSupplier extends CommonObject
}
// Insert line
$this->line=new AskPriceSupplierLigne($this->db);
$this->line=new AskPriceSupplierLine($this->db);
$this->line->fk_askpricesupplier=$this->id;
$this->line->label=$label;
@ -525,10 +525,10 @@ class AskPriceSupplier extends CommonObject
}
// Update line
$this->line=new AskPriceSupplierLigne($this->db);
$this->line=new AskPriceSupplierLine($this->db);
// Stock previous line records
$staticline=new AskPriceSupplierLigne($this->db);
$staticline=new AskPriceSupplierLine($this->db);
$staticline->fetch($rowid);
$this->line->oldline = $staticline;
@ -621,7 +621,7 @@ class AskPriceSupplier extends CommonObject
{
if ($this->statut == 0)
{
$line=new AskPriceSupplierLigne($this->db);
$line=new AskPriceSupplierLine($this->db);
// For triggers
$line->fetch($lineid);
@ -1106,7 +1106,7 @@ class AskPriceSupplier extends CommonObject
{
$objp = $this->db->fetch_object($result);
$line = new AskPriceSupplierLigne($this->db);
$line = new AskPriceSupplierLine($this->db);
$line->rowid = $objp->rowid;
$line->fk_askpricesupplier = $objp->fk_askpricesupplier;
@ -2088,7 +2088,7 @@ class AskPriceSupplier extends CommonObject
$xnbp = 0;
while ($xnbp < $nbp)
{
$line=new AskPriceSupplierLigne($this->db);
$line=new AskPriceSupplierLine($this->db);
$line->desc=$langs->trans("Description")." ".$xnbp;
$line->qty=1;
$line->subprice=100;
@ -2240,21 +2240,21 @@ class AskPriceSupplier extends CommonObject
$label=$langs->trans("ShowAskpricesupplier").': '.$this->ref;
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
if ($option == '') {
$lien = '<a href="'.DOL_URL_ROOT.'/comm/askpricesupplier/card.php?id='.$this->id. $get_params .$linkclose;
$link = '<a href="'.DOL_URL_ROOT.'/comm/askpricesupplier/card.php?id='.$this->id. $get_params .$linkclose;
}
if ($option == 'document') {
$lien = '<a href="'.DOL_URL_ROOT.'/comm/askpricesupplier/document.php?id='.$this->id. $get_params .$linkclose;
$link = '<a href="'.DOL_URL_ROOT.'/comm/askpricesupplier/document.php?id='.$this->id. $get_params .$linkclose;
}
$lienfin='</a>';
$linkend='</a>';
$picto='askpricesupplier';
if ($withpicto)
$result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
$result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2)
$result.=' ';
$result.=$lien.$this->ref.$lienfin;
$result.=$link.$this->ref.$linkend;
return $result;
}
@ -2287,7 +2287,7 @@ class AskPriceSupplier extends CommonObject
{
$obj = $this->db->fetch_object($resql);
$this->lines[$i] = new AskPriceSupplierLigne($this->db);
$this->lines[$i] = new AskPriceSupplierLine($this->db);
$this->lines[$i]->id = $obj->rowid; // for backward compatibility
$this->lines[$i]->rowid = $obj->rowid;
$this->lines[$i]->label = $obj->custom_label;
@ -2412,10 +2412,10 @@ class AskPriceSupplier extends CommonObject
/**
* \class AskPriceSupplierLigne
* \class AskPriceSupplierLine
* \brief Class to manage askpricesupplier lines
*/
class AskPriceSupplierLigne extends CommonObject
class AskPriceSupplierLine extends CommonObject
{
var $db;
var $error;
@ -2689,7 +2689,7 @@ class AskPriceSupplierLigne extends CommonObject
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."askpricesupplierdet WHERE rowid = ".$this->rowid;
dol_syslog("AskPriceSupplierLigne::delete", LOG_DEBUG);
dol_syslog("AskPriceSupplierLine::delete", LOG_DEBUG);
if ($this->db->query($sql) )
{
@ -2852,7 +2852,7 @@ class AskPriceSupplierLigne extends CommonObject
$sql.= ",total_ttc=".price2num($this->total_ttc,'MT')."";
$sql.= " WHERE rowid = ".$this->rowid;
dol_syslog("AskPriceSupplierLigne::update_total", LOG_DEBUG);
dol_syslog("AskPriceSupplierLine::update_total", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)

View File

@ -7,6 +7,7 @@
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -31,11 +32,13 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
if (! empty($conf->expedition->enabled)) require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
@ -43,6 +46,7 @@ if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichin
$langs->load("companies");
if (! empty($conf->contrat->enabled)) $langs->load("contracts");
if (! empty($conf->commande->enabled)) $langs->load("orders");
if (! empty($conf->expedition->enabled)) $langs->load("sendings");
if (! empty($conf->facture->enabled)) $langs->load("bills");
if (! empty($conf->projet->enabled)) $langs->load("projects");
if (! empty($conf->ficheinter->enabled)) $langs->load("interventions");
@ -68,10 +72,15 @@ if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="nom";
$cancelbutton = GETPOST('cancel');
$object = new Client($db);
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('commcard','globalcard'));
$object = new Societe($db);
/*
* Actions
@ -215,7 +224,6 @@ if ($id > 0)
print '<table class="border" width="100%">';
print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td><td width="70%" colspan="3">';
$object->next_prev_filter="te.client in (1,2,3)";
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
print '</td></tr>';
@ -425,9 +433,9 @@ if ($id > 0)
print '</tr>';
}
// Level of prospect
if ($object->client == 2 || $object->client == 3)
{
// Level of prospect
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('ProspectLevel');
@ -453,7 +461,16 @@ if ($id > 0)
print '</td></tr>';
}
// Sales representative
// Other attributes
$parameters=array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields);
}
// Sales representative
include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php';
// Module Adherent
@ -610,7 +627,7 @@ if ($id > 0)
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'">'.$langs->trans("AllOrders").' <span class="badge">'.$num.'</span></a></td>';
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomerOrders",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'">'.$langs->trans("AllOrders").' <span class="badge">'.$num.'</span></a></td>';
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/commande/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
//if($num2 > 0) print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$object->id.'">'.img_picto($langs->trans("CreateInvoiceForThisCustomer"),'object_bill').'</a></td>';
//else print '<td width="20px" align="right"><a href="#">'.img_picto($langs->trans("NoOrdersToInvoice"),'object_bill').'</a></td>';
@ -647,6 +664,73 @@ if ($id > 0)
}
}
/*
* Last sendings
*/
if (! empty($conf->expedition->enabled) && $user->rights->expedition->lire) {
$sendingstatic = new Expedition($db);
$sql = 'SELECT e.rowid as id';
$sql.= ', e.ref';
$sql.= ', e.date_creation';
$sql.= ', e.fk_statut as statut';
$sql.= ', s.nom';
$sql.= ', s.rowid as socid';
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."expedition as e";
$sql.= " WHERE e.fk_soc = s.rowid AND s.rowid = ".$object->id;
$sql.= " AND e.entity = ".$conf->entity;
$sql.= ' GROUP BY e.rowid';
$sql.= ', e.ref';
$sql.= ', e.date_creation';
$sql.= ', e.fk_statut';
$sql.= ', s.nom';
$sql.= ', s.rowid';
$sql.= " ORDER BY e.date_creation DESC";
$resql = $db->query($sql);
if ($resql) {
$var = true;
$num = $db->num_rows($resql);
$i = 0;
if ($num > 0) {
print '<table class="noborder" width="100%">';
$tableaushown=1;
print '<tr class="liste_titre">';
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastSendings",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/expedition/list.php?socid='.$object->id.'">'.$langs->trans("AllSendings").' <span class="badge">'.$num.'</span></a></td>';
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/expedition/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
print '</tr></table></td>';
print '</tr>';
}
while ($i < $num && $i < $MAXLIST) {
$objp = $db->fetch_object($resql);
$var = ! $var;
print "<tr " . $bc[$var] . ">";
print '<td class="nowrap">';
$sendingstatic->id = $objp->id;
$sendingstatic->ref = $objp->ref;
print $sendingstatic->getNomUrl(1);
print '</td>';
if ($objp->date_creation > 0) {
print '<td align="right" width="80">'.dol_print_date($db->jdate($objp->date_creation),'day').'</td>';
} else {
print '<td align="right"><b>!!!</b></td>';
}
print '<td align="right" class="nowrap" width="100" >' . $sendingstatic->LibStatut($objp->statut, 5) . '</td>';
print "</tr>\n";
$i++;
}
$db->free($resql);
if ($num > 0)
print "</table>";
} else {
dol_print_error($db);
}
}
/*
* Last linked contracts
*/
@ -770,7 +854,7 @@ if ($id > 0)
$facturestatic = new Facture($db);
$sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.amount';
$sql.= ', f.total';
$sql.= ', f.total as total_ht';
$sql.= ', f.tva as total_tva';
$sql.= ', f.total_ttc';
$sql.= ', f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as statut';
@ -812,7 +896,7 @@ if ($id > 0)
$facturestatic->id = $objp->facid;
$facturestatic->ref = $objp->facnumber;
$facturestatic->type = $objp->type;
$facturestatic->total_ht = $objp->total;
$facturestatic->total_ht = $objp->total_ht;
$facturestatic->total_tva = $objp->total_tva;
$facturestatic->total_ttc = $objp->total_ttc;
print $facturestatic->getNomUrl(1);
@ -825,7 +909,7 @@ if ($id > 0)
{
print '<td align="right"><b>!!!</b></td>';
}
print '<td align="right" width="120">'.price($objp->total_ttc).'</td>';
print '<td align="right" width="120">'.price($objp->total_ht).'</td>';
print '<td align="right" class="nowrap" width="100" >'.($facturestatic->LibStatut($objp->paye,$objp->statut,5,$objp->am)).'</td>';
print "</tr>\n";

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 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>
*
* This program is free software; you can redistribute it and/or modify
@ -67,7 +67,7 @@ if (! empty($conf->commande->enabled)) $orderstatic=new Commande($db);
llxHeader();
print_fiche_titre($langs->trans("CustomerArea"));
print_fiche_titre($langs->trans("CommercialArea"));
print '<div class="fichecenter"><div class="fichethirdleft">';

View File

@ -302,7 +302,7 @@ if (empty($reshook))
$object->modelpdf = GETPOST('model');
$object->author = $user->id; // deprecated
$object->note = GETPOST('note');
$object->statut = 0;
$object->statut = Propal::STATUS_DRAFT;
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
@ -542,52 +542,80 @@ if (empty($reshook))
}
// Classify billed
else if ($action == 'classifybilled' && $user->rights->propal->cloturer) {
$object->cloture($user, 4, '');
else if ($action == 'classifybilled' && $user->rights->propal->cloturer)
{
$result=$object->cloture($user, 4, '');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
// Reopen proposal
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel'))
{
// prevent browser refresh from reopening proposal several times
if ($object->statut == 2 || $object->statut == 3 || $object->statut == 4) {
if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) {
$object->reopen($user, 1);
}
}
// Close proposal
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel'))
{
if (! GETPOST('statut')) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("CloseAs")), 'errors');
$action = 'statut';
} else {
// prevent browser refresh from closing proposal several times
if ($object->statut == 1) {
$object->cloture($user, GETPOST('statut'), GETPOST('note'));
if ($object->statut == Propal::STATUS_VALIDATED)
{
$result=$object->cloture($user, GETPOST('statut'), GETPOST('note'));
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
}
}
// Classify billed
else if ($action == 'classifybilled' && $user->rights->propal->cloturer) {
$object->cloture($user, 4, '');
else if ($action == 'classifybilled' && $user->rights->propal->cloturer)
{
$result=$object->cloture($user, 4, '');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
// Reopen proposal
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel'))
{
// prevent browser refresh from reopening proposal several times
if ($object->statut == 2 || $object->statut == 3 || $object->statut == 4) {
$object->reopen($user, 1);
if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED)
{
$result=$object->reopen($user, 1);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
}
// Close proposal
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel'))
{
if (! GETPOST('statut')) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("CloseAs")), 'errors');
$action = 'statut';
} else {
// prevent browser refresh from closing proposal several times
if ($object->statut == 1) {
if ($object->statut == Propal::STATUS_VALIDATED) {
$object->cloture($user, GETPOST('statut'), GETPOST('note'));
}
}
@ -1144,7 +1172,7 @@ if (empty($reshook))
if (! $error)
{
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('propaldao'));
$parameters = array('id' => $object->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been
@ -1671,7 +1699,7 @@ if ($action == 'create')
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db);
$text .= '<br>';
$text .= $notify->confirmMessage('PROPAL_VALIDATE', $object->socid);
$text .= $notify->confirmMessage('PROPAL_VALIDATE', $object->socid, $object);
}
if (! $error)
@ -1680,9 +1708,9 @@ if ($action == 'create')
if (! $formconfirm) {
$parameters = array('lineid' => $lineid);
$formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified
// by
// hook
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
}
// Print form confirm
@ -1735,7 +1763,7 @@ if ($action == 'create')
$absolute_discount = price2num($absolute_discount, 'MT');
$absolute_creditnote = price2num($absolute_creditnote, 'MT');
if ($absolute_discount) {
if ($object->statut > 0) {
if ($object->statut > Propal::STATUS_DRAFT) {
print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount, 0, $langs, 0, 0, -1, $conf->currency));
} else {
// Remise dispo de type non avoir
@ -1797,7 +1825,7 @@ if ($action == 'create')
} else {
if (! empty($object->fin_validite)) {
print dol_print_date($object->fin_validite, 'daytext');
if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay))
if ($object->statut == Propal::STATUS_VALIDATED && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay))
print img_warning($langs->trans("Late"));
} else {
print '&nbsp;';
@ -2081,7 +2109,7 @@ if ($action == 'create')
<input type="hidden" name="id" value="' . $object->id . '">
';
if (! empty($conf->use_javascript_ajax) && $object->statut == 0) {
if (! empty($conf->use_javascript_ajax) && $object->statut == Propal::STATUS_DRAFT) {
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
}
@ -2091,7 +2119,7 @@ if ($action == 'create')
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1);
// Form to add new line
if ($object->statut == 0 && $user->rights->propal->creer)
if ($object->statut == Propal::STATUS_DRAFT && $user->rights->propal->creer)
{
if ($action != 'editline')
{
@ -2154,7 +2182,7 @@ if ($action == 'create')
if ($action != 'statut' && $action != 'editline')
{
// Validate
if ($object->statut == 0 && $object->total_ttc >= 0 && count($object->lines) > 0 &&
if ($object->statut == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0 &&
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate)))
) {
@ -2168,18 +2196,18 @@ if ($action == 'create')
print '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a>';
}
// Edit
if ($object->statut == 1 && $user->rights->propal->creer) {
if ($object->statut == Propal::STATUS_VALIDATED && $user->rights->propal->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=modif">' . $langs->trans('Modify') . '</a></div>';
}
// ReOpen
if (($object->statut == 2 || $object->statut == 3 || $object->statut == 4) && $user->rights->propal->cloturer) {
if (($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) && $user->rights->propal->cloturer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=reopen' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#reopen') . '"';
print '>' . $langs->trans('ReOpen') . '</a></div>';
}
// Send
if ($object->statut == 1 || $object->statut == 2) {
if ($object->statut == Propal::STATUS_VALIDATED || $object->statut == Propal::STATUS_SIGNED) {
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=presend&amp;mode=init">' . $langs->trans('SendByMail') . '</a></div>';
} else
@ -2187,14 +2215,14 @@ if ($action == 'create')
}
// Create an order
if (! empty($conf->commande->enabled) && $object->statut == 2) {
if (! empty($conf->commande->enabled) && $object->statut == Propal::STATUS_SIGNED) {
if ($user->rights->commande->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/commande/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddOrder") . '</a></div>';
}
}
// Create contract
if ($conf->contrat->enabled && $object->statut == 2) {
if ($conf->contrat->enabled && $object->statut == Propal::STATUS_SIGNED) {
$langs->load("contracts");
if ($user->rights->contrat->creer) {
@ -2203,7 +2231,8 @@ if ($action == 'create')
}
// Create an invoice and classify billed
if ($object->statut == 2) {
if ($object->statut == Propal::STATUS_SIGNED)
{
if (! empty($conf->facture->enabled) && $user->rights->facture->creer)
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/compta/facture.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddBill") . '</a></div>';
@ -2217,7 +2246,7 @@ if ($action == 'create')
}
// Close
if ($object->statut == 1 && $user->rights->propal->cloturer) {
if ($object->statut == Propal::STATUS_VALIDATED && $user->rights->propal->cloturer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=statut' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close') . '"';
print '>' . $langs->trans('Close') . '</a></div>';
}

View File

@ -54,19 +54,56 @@ class Propal extends CommonObject
var $id;
var $socid; // Id client
var $client; // Objet societe client (a charger par fetch_client)
/**
* ID of the client
* @var int
*/
var $socid;
/**
* Client (loaded by fetch_client)
* @var Societe
*/
var $client;
var $contactid;
var $fk_project;
var $author;
var $ref;
var $ref_client;
var $statut; // 0 (draft), 1 (validated), 2 (signed), 3 (not signed), 4 (billed)
var $datec; // Date of creation
var $datev; // Date of validation
var $date; // Date of proposal
var $datep; // Same than date
/**
* Status of the quote
* Check the following constants:
* - STATUS_DRAFT
* - STATUS_VALIDATED
* - STATUS_SIGNED
* - STATUS_NOTSIGNED
* - STATUS_BILLED
* @var int
*/
var $statut;
/**
* Date of creation
* @var
*/
var $datec;
/**
* Date of validation
* @var
*/
var $datev;
/**
* Date of the quote
* @var
*/
var $date;
/**
* Same than date ¿?
* @var
*/
var $datep;
var $date_livraison;
var $fin_validite;
@ -79,9 +116,19 @@ class Propal extends CommonObject
var $total_localtax1; // Total Local Taxes 1
var $total_localtax2; // Total Local Taxes 2
var $total_ttc; // Total with tax
var $price; // deprecated (for compatibility)
var $tva; // deprecated (for compatibility)
var $total; // deprecated (for compatibility)
/**
* @deprecated
*/
var $price;
/**
* @deprecated
*/
var $tva;
/**
* @deprecated
*/
var $total;
var $cond_reglement_id;
var $cond_reglement_code;
@ -91,10 +138,16 @@ class Propal extends CommonObject
var $remise;
var $remise_percent;
var $remise_absolue;
var $note; // deprecated (for compatibility)
/**
* @deprecated
*/
var $note;
var $note_private;
var $note_public;
var $fk_delivery_address; // deprecated (for compatibility)
/**
* @deprecated
*/
var $fk_delivery_address;
var $fk_address;
var $address_type;
var $address;
@ -107,6 +160,9 @@ class Propal extends CommonObject
var $products=array();
var $extraparams=array();
/**
* @var PropaleLigne[]
*/
var $lines = array();
var $line;
@ -117,12 +173,32 @@ class Propal extends CommonObject
var $labelstatut_short=array();
var $specimen;
//Incorterms
var $fk_incoterms;
var $location_incoterms;
var $libelle_incoterms; //Used into tooltip
/**
* Draft status
*/
const STATUS_DRAFT = 0;
/**
* Validated status
*/
const STATUS_VALIDATED = 1;
/**
* Signed quote
*/
const STATUS_SIGNED = 2;
/**
* Not signed quote
*/
const STATUS_NOTSIGNED = 3;
/**
* Billed quote
*/
const STATUS_BILLED = 4;
/**
* Constructor
@ -358,7 +434,7 @@ class Propal extends CommonObject
// Check parameters
if ($type < 0) return -1;
if ($this->statut == 0)
if ($this->statut == self::STATUS_DRAFT)
{
$this->db->begin();
@ -522,7 +598,7 @@ class Propal extends CommonObject
if (empty($qty) && empty($special_code)) $special_code=3; // Set option tag
if (! empty($qty) && $special_code == 3) $special_code=0; // Remove option tag
if ($this->statut == 0)
if ($this->statut == self::STATUS_DRAFT)
{
$this->db->begin();
@ -647,7 +723,7 @@ class Propal extends CommonObject
*/
function deleteline($lineid)
{
if ($this->statut == 0)
if ($this->statut == self::STATUS_DRAFT)
{
$line=new PropaleLigne($this->db);
@ -882,7 +958,7 @@ class Propal extends CommonObject
$action='update';
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('propaldao'));
$parameters=array('socid'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
@ -1004,7 +1080,7 @@ class Propal extends CommonObject
}
$this->id=0;
$this->statut=0;
$this->statut=self::STATUS_DRAFT;
if (empty($conf->global->PROPALE_ADDON) || ! is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php"))
{
@ -1186,10 +1262,10 @@ class Propal extends CommonObject
//Incoterms
$this->fk_incoterms = $obj->fk_incoterms;
$this->location_incoterms = $obj->location_incoterms;
$this->location_incoterms = $obj->location_incoterms;
$this->libelle_incoterms = $obj->libelle_incoterms;
if ($obj->fk_statut == 0)
if ($obj->fk_statut == self::STATUS_DRAFT)
{
$this->brouillon = 1;
}
@ -1224,7 +1300,7 @@ class Propal extends CommonObject
$extrafieldsline=new ExtraFields($this->db);
$line = new PropaleLigne($this->db);
$extralabelsline=$extrafieldsline->fetch_name_optionals_label($line->table_element,true);
$num = $this->db->num_rows($result);
$i = 0;
@ -1277,7 +1353,7 @@ class Propal extends CommonObject
$line->date_end = $objp->date_end;
$line->fetch_optionals($line->id,$extralabelsline);
$this->lines[$i] = $line;
//dol_syslog("1 ".$line->fk_product);
//print "xx $i ".$this->lines[$i]->fk_product;
@ -1316,7 +1392,7 @@ class Propal extends CommonObject
$action='update';
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('propaldao'));
$parameters=array('id'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
@ -1382,8 +1458,8 @@ class Propal extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
$sql.= " SET ref = '".$num."',";
$sql.= " fk_statut = 1, date_valid='".$this->db->idate($now)."', fk_user_valid=".$user->id;
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
$sql.= " fk_statut = ".self::STATUS_VALIDATED.", date_valid='".$this->db->idate($now)."', fk_user_valid=".$user->id;
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
dol_syslog(get_class($this)."::valid", LOG_DEBUG);
$resql=$this->db->query($sql);
@ -1438,7 +1514,7 @@ class Propal extends CommonObject
$this->ref=$num;
$this->brouillon=0;
$this->statut = 1;
$this->statut = self::STATUS_VALIDATED;
$this->user_valid_id=$user->id;
$this->datev=$now;
@ -1473,7 +1549,7 @@ class Propal extends CommonObject
if (! empty($user->rights->propal->creer))
{
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET datep = '".$this->db->idate($date)."'";
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
dol_syslog(get_class($this)."::set_date", LOG_DEBUG);
if ($this->db->query($sql) )
@ -1502,7 +1578,7 @@ class Propal extends CommonObject
if (! empty($user->rights->propal->creer))
{
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fin_validite = ".($date_fin_validite!=''?"'".$this->db->idate($date_fin_validite)."'":'null');
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
if ($this->db->query($sql) )
{
$this->fin_validite = $date_fin_validite;
@ -1652,7 +1728,7 @@ class Propal extends CommonObject
$remise = price2num($remise);
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET remise_percent = ".$remise;
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
if ($this->db->query($sql) )
{
@ -1686,7 +1762,7 @@ class Propal extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."propal ";
$sql.= " SET remise_absolue = ".$remise;
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
if ($this->db->query($sql) )
{
@ -1778,7 +1854,6 @@ class Propal extends CommonObject
{
global $langs,$conf;
$this->statut = $statut;
$error=0;
$now=dol_now();
@ -1794,7 +1869,7 @@ class Propal extends CommonObject
$modelpdf=$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED?$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED:$this->modelpdf;
$trigger_name='PROPAL_CLOSE_REFUSED';
if ($statut == 2)
if ($statut == self::STATUS_SIGNED)
{
$trigger_name='PROPAL_CLOSE_SIGNED';
$modelpdf=$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL?$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->modelpdf;
@ -1806,12 +1881,12 @@ class Propal extends CommonObject
if ($result < 0)
{
$this->error=$this->db->error();
$this->error=$this->db->lasterror();
$this->db->rollback();
return -2;
}
}
if ($statut == 4)
if ($statut == self::STATUS_BILLED)
{
$trigger_name='PROPAL_CLASSIFY_BILLED';
}
@ -1837,7 +1912,9 @@ class Propal extends CommonObject
if ( ! $error )
{
$this->db->commit();
$this->statut = $statut;
$this->db->commit();
return 1;
}
else
@ -1848,7 +1925,7 @@ class Propal extends CommonObject
}
else
{
$this->error=$this->db->error();
$this->error=$this->db->lasterror();
$this->db->rollback();
return -1;
}
@ -1861,11 +1938,11 @@ class Propal extends CommonObject
*/
function classifyBilled()
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET fk_statut = 4';
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0 ;';
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET fk_statut = '.self::STATUS_BILLED;
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT.' ;';
if ($this->db->query($sql) )
{
$this->statut=4;
$this->statut=self::STATUS_BILLED;
return 1;
}
else
@ -1893,12 +1970,12 @@ class Propal extends CommonObject
*/
function set_draft($user)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = 0";
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = ".self::STATUS_DRAFT;
$sql.= " WHERE rowid = ".$this->id;
if ($this->db->query($sql))
{
$this->statut = 0;
$this->statut = self::STATUS_DRAFT;
$this->brouillon = 1;
return 1;
}
@ -1942,7 +2019,7 @@ class Propal extends CommonObject
$sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
}
if ($socid) $sql.= " AND s.rowid = ".$socid;
if ($draft) $sql.= " AND p.fk_statut = 0";
if ($draft) $sql.= " AND p.fk_statut = ".self::STATUS_DRAFT;
if ($notcurrentuser > 0) $sql.= " AND p.fk_user_author <> ".$user->id;
$sql.= $this->db->order($sortfield,$sortorder);
$sql.= $this->db->plimit($limit,$offset);
@ -2212,7 +2289,7 @@ class Propal extends CommonObject
function availability($availability_id)
{
dol_syslog('Propale::availability('.$availability_id.')');
if ($this->statut >= 0)
if ($this->statut >= self::STATUS_DRAFT)
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal';
$sql .= ' SET fk_availability = '.$availability_id;
@ -2246,7 +2323,7 @@ class Propal extends CommonObject
function demand_reason($demand_reason_id)
{
dol_syslog('Propale::demand_reason('.$demand_reason_id.')');
if ($this->statut >= 0)
if ($this->statut >= self::STATUS_DRAFT)
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal';
$sql .= ' SET fk_input_reason = '.$demand_reason_id;
@ -2353,11 +2430,11 @@ class Propal extends CommonObject
global $langs;
$langs->load("propal");
if ($statut==0) $statuttrans='statut0';
if ($statut==1) $statuttrans='statut1';
if ($statut==2) $statuttrans='statut3';
if ($statut==3) $statuttrans='statut5';
if ($statut==4) $statuttrans='statut6';
if ($statut==self::STATUS_DRAFT) $statuttrans='statut0';
if ($statut==self::STATUS_VALIDATED) $statuttrans='statut1';
if ($statut==self::STATUS_SIGNED) $statuttrans='statut3';
if ($statut==self::STATUS_NOTSIGNED) $statuttrans='statut5';
if ($statut==self::STATUS_BILLED) $statuttrans='statut6';
if ($mode == 0) return $this->labelstatut[$statut];
if ($mode == 1) return $this->labelstatut_short[$statut];
@ -2390,8 +2467,8 @@ class Propal extends CommonObject
$clause = " AND";
}
$sql.= $clause." p.entity = ".$conf->entity;
if ($mode == 'opened') $sql.= " AND p.fk_statut = 1";
if ($mode == 'signed') $sql.= " AND p.fk_statut = 2";
if ($mode == 'opened') $sql.= " AND p.fk_statut = ".self::STATUS_VALIDATED;
if ($mode == 'signed') $sql.= " AND p.fk_statut = ".self::STATUS_SIGNED;
if ($user->societe_id) $sql.= " AND p.fk_soc = ".$user->societe_id;
$resql=$this->db->query($sql);
@ -2402,17 +2479,17 @@ class Propal extends CommonObject
if ($mode == 'opened') {
$delay_warning=$conf->propal->cloture->warning_delay;
$statut = 1;
$statut = self::STATUS_VALIDATED;
$label = $langs->trans("PropalsToClose");
}
if ($mode == 'signed') {
$delay_warning=$conf->propal->facturation->warning_delay;
$statut = 2;
$statut = self::STATUS_SIGNED;
$label = $langs->trans("PropalsToBill");
}
$response = new WorkboardResponse();
$response->warning_delay = $delay_warning;
$response->warning_delay = $delay_warning/60/60/24;
$response->label = $label;
$response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut;
$response->img = img_object($langs->trans("Propals"),"propal");
@ -2658,27 +2735,27 @@ class Propal extends CommonObject
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
if ($option == '') {
$lien = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose;
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose;
}
if ($option == 'compta') { // deprecated
$lien = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose;
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose;
}
if ($option == 'expedition') {
$lien = '<a href="'.DOL_URL_ROOT.'/expedition/propal.php?id='.$this->id. $get_params .$linkclose;
$link = '<a href="'.DOL_URL_ROOT.'/expedition/propal.php?id='.$this->id. $get_params .$linkclose;
}
if ($option == 'document') {
$lien = '<a href="'.DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id. $get_params .$linkclose;
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id. $get_params .$linkclose;
}
$lienfin='</a>';
$linkend='</a>';
$picto='propal';
if ($withpicto)
$result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
$result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2)
$result.=' ';
$result.=$lien.$this->ref.$lienfin;
$result.=$link.$this->ref.$linkend;
return $result;
}
@ -2801,9 +2878,6 @@ class Propal extends CommonObject
*/
class PropaleLigne extends CommonObject
{
var $db;
var $error;
public $element='propaldet';
public $table_element='propaldet';
@ -2815,7 +2889,14 @@ class PropaleLigne extends CommonObject
var $fk_parent_line;
var $desc; // Description ligne
var $fk_product; // Id produit predefini
var $product_type = 0; // Type 0 = product, 1 = Service
/**
* Product type.
* Use the following constants:
* - Product::TYPE_PRODUCT
* - Product::TYPE_SERVICE
* @var int
*/
var $product_type = Product::TYPE_PRODUCT;
var $qty;
var $tva_tx;

View File

@ -126,7 +126,7 @@ if ($id > 0 || ! empty($ref))
if ($object->fin_validite)
{
print dol_print_date($object->fin_validite,'daytext');
if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
if ($object->statut == Propal::STATUS_VALIDATED && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
}
else
{

View File

@ -399,7 +399,8 @@ if ($resql)
print "</td></tr>\n";
$parameters=array();
$formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldListSearch',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</tr>\n";

View File

@ -144,7 +144,7 @@ if (empty($reshook))
// Reopen a closed order
else if ($action == 'reopen' && $user->rights->commande->creer)
{
if ($object->statut == 3)
if ($object->statut == STATUS_CANCELED || $object->statut == Commande::STATUS_CLOSED)
{
$result = $object->set_reopen($user);
if ($result > 0)
@ -253,7 +253,7 @@ if (empty($reshook))
$object->contactid = GETPOST('contactid');
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
// If creation from another object of another module (Example: origin=propal, originid=1)
if (! empty($origin) && ! empty($originid))
{
@ -523,7 +523,7 @@ if (empty($reshook))
{
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
}
// bank account
else if ($action == 'setbankaccount' && $user->rights->commande->creer) {
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
@ -1117,7 +1117,7 @@ if (empty($reshook))
if (! $error)
{
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('orderdao'));
$parameters = array('id' => $object->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
@ -1269,7 +1269,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$demand_reason_id = (!empty($objectsrc->demand_reason_id)?$objectsrc->demand_reason_id:(!empty($soc->demand_reason_id)?$soc->demand_reason_id:0));
$remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
$dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER)?-1:'';
$datedelivery = (! empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : '');
@ -1290,7 +1290,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$demand_reason_id = $soc->demand_reason_id;
$remise_percent = $soc->remise_percent;
$remise_absolue = 0;
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
$dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER)?-1:'';
$projectid = 0;
}
$absolute_discount=$soc->getAvailableDiscounts();
@ -1358,7 +1358,8 @@ if ($action == 'create' && $user->rights->commande->creer)
}
// Date
print '<tr><td class="fieldrequired">' . $langs->trans('Date') . '</td><td colspan="2">';
$form->select_date('', 're', '', '', '', "crea_commande", 1, 1);
//$form->select_date($dateorder, 're', '', '', '', "crea_commande", 1, 1);
$form->select_date('', 're', '', '', '', "crea_commande", 1, 1); // Always autofill date with current date
print '</td></tr>';
// Date de livraison
@ -1366,7 +1367,7 @@ if ($action == 'create' && $user->rights->commande->creer)
if (empty($datedelivery))
{
if (! empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) $datedelivery = time() + ((7*$conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60);
else $datedelivery=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
else $datedelivery=empty($conf->global->MAIN_AUTOFILL_DATE_DELIVERY)?-1:'';
}
$form->select_date($datedelivery, 'liv_', '', '', '', "crea_commande", 1, 1);
print "</td></tr>";
@ -1600,7 +1601,7 @@ if ($action == 'create' && $user->rights->commande->creer)
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db);
$text .= '<br>';
$text .= $notify->confirmMessage('ORDER_VALIDATE', $object->socid);
$text .= $notify->confirmMessage('ORDER_VALIDATE', $object->socid, $object);
}
$qualified_for_stock_change=0;
@ -1726,8 +1727,9 @@ if ($action == 'create' && $user->rights->commande->creer)
if (! $formconfirm) {
$parameters = array('lineid' => $lineid);
$formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified
// by hook
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
}
// Print form confirm
@ -1809,7 +1811,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$absolute_discount = price2num($absolute_discount, 'MT');
$absolute_creditnote = price2num($absolute_creditnote, 'MT');
if ($absolute_discount) {
if ($object->statut > 0) {
if ($object->statut > Commande::STATUS_DRAFT) {
print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency));
} else {
// Remise dispo de type remise fixe (not credit note)
@ -1988,10 +1990,10 @@ if ($action == 'create' && $user->rights->commande->creer)
print '</td>';
print '</tr>';
}
// Incoterms
if (!empty($conf->incoterm->enabled))
{
{
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('IncotermLabel');
@ -2005,13 +2007,13 @@ if ($action == 'create' && $user->rights->commande->creer)
{
print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
}
else
else
{
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id);
}
print '</td></tr>';
}
// Other attributes
$cols = 3;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
@ -2044,7 +2046,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Total HT
print '<tr><td>' . $langs->trans('AmountHT') . '</td>';
print '<td align="right">' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '</td>';
print '<td>' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '</td>';
// Margin Infos
if (! empty($conf->margin->enabled)) {
@ -2056,23 +2058,23 @@ if ($action == 'create' && $user->rights->commande->creer)
print '</tr>';
// Total TVA
print '<tr><td>' . $langs->trans('AmountVAT') . '</td><td align="right">' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
// Total VAT
print '<tr><td>' . $langs->trans('AmountVAT') . '</td><td>' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
// Amount Local Taxes
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1
{
print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
print '<td align="right">' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
print '<td>' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
}
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2 IRPF
{
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
print '<td align="right">' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
print '<td>' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
}
// Total TTC
print '<tr><td>' . $langs->trans('AmountTTC') . '</td><td align="right">' . price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
print '<tr><td>' . $langs->trans('AmountTTC') . '</td><td>' . price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
// Statut
print '<tr><td>' . $langs->trans('Status') . '</td><td>' . $object->getLibStatut(4) . '</td></tr>';
@ -2104,7 +2106,7 @@ if ($action == 'create' && $user->rights->commande->creer)
<input type="hidden" name="id" value="' . $object->id . '">
';
if (! empty($conf->use_javascript_ajax) && $object->statut == 0) {
if (! empty($conf->use_javascript_ajax) && $object->statut == Commande::STATUS_DRAFT) {
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
}
@ -2119,7 +2121,7 @@ if ($action == 'create' && $user->rights->commande->creer)
/*
* Form to add new line
*/
if ($object->statut == 0 && $user->rights->commande->creer)
if ($object->statut == Commande::STATUS_DRAFT && $user->rights->commande->creer)
{
if ($action != 'editline')
{
@ -2149,7 +2151,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// modified by hook
if (empty($reshook)) {
// Valid
if ($object->statut == 0 && $object->total_ttc >= 0 && $numlines > 0 &&
if ($object->statut == Commande::STATUS_DRAFT && $object->total_ttc >= 0 && $numlines > 0 &&
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))
)
@ -2157,7 +2159,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=validate">' . $langs->trans('Validate') . '</a></div>';
}
// Edit
if ($object->statut == 1 && $user->rights->commande->creer) {
if ($object->statut == Commande::STATUS_VALIDATED && $user->rights->commande->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id=' . $object->id . '&amp;action=modif">' . $langs->trans('Modify') . '</a></div>';
}
// Create event
@ -2168,7 +2170,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a>';
}
// Send
if ($object->statut > 0) {
if ($object->statut > Commande::STATUS_DRAFT) {
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send)) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=presend&amp;mode=init">' . $langs->trans('SendByMail') . '</a></div>';
} else
@ -2180,7 +2182,7 @@ if ($action == 'create' && $user->rights->commande->creer)
if (! empty($conf->expedition->enabled)) {
$numshipping = $object->nb_expedition();
if ($object->statut > 0 && $object->statut < 3 && $object->getNbOfProductsLines() > 0) {
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfProductsLines() > 0) {
if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer)) {
if ($user->rights->expedition->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/expedition/shipment.php?id=' . $object->id . '">' . $langs->trans('ShipProduct') . '</a></div>';
@ -2198,7 +2200,7 @@ if ($action == 'create' && $user->rights->commande->creer)
if ($conf->ficheinter->enabled) {
$langs->load("interventions");
if ($object->statut > 0 && $object->statut < 3 && $object->getNbOfServicesLines() > 0) {
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) {
if ($user->rights->ficheinter->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fichinter/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans('AddIntervention') . '</a></div>';
} else {
@ -2208,12 +2210,12 @@ if ($action == 'create' && $user->rights->commande->creer)
}
// Reopen a closed order
if ($object->statut == 3 && $user->rights->commande->creer) {
if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $user->rights->commande->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&amp;action=reopen">' . $langs->trans('ReOpen') . '</a></div>';
}
// Create contract
if ($conf->contrat->enabled && ($object->statut == 1 || $object->statut == 2)) {
if ($conf->contrat->enabled && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_ACCEPTED)) {
$langs->load("contracts");
if ($user->rights->contrat->creer) {
@ -2223,17 +2225,17 @@ if ($action == 'create' && $user->rights->commande->creer)
// Create bill and Classify billed
// Note: Even if module invoice is not enabled, we should be able to use button "Classified billed"
if ($object->statut > 0 && ! $object->billed) {
if ($object->statut > Commande::STATUS_DRAFT && ! $object->billed) {
if (! empty($conf->facture->enabled) && $user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/compta/facture.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("CreateBill") . '</a></div>';
}
if ($user->rights->commande->creer && $object->statut > 2 && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
if ($user->rights->commande->creer && $object->statut > Commande::STATUS_ACCEPTED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=classifybilled">' . $langs->trans("ClassifyBilled") . '</a></div>';
}
}
// Set to shipped
if (($object->statut == 1 || $object->statut == 2) && $user->rights->commande->cloturer) {
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_ACCEPTED) && $user->rights->commande->cloturer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=shipped">' . $langs->trans('ClassifyShipped') . '</a></div>';
}
@ -2243,10 +2245,10 @@ if ($action == 'create' && $user->rights->commande->creer)
}
// Cancel order
if ($object->statut == 1 &&
if ($object->statut == Commande::STATUS_VALIDATED &&
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->cloturer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->annuler)))
)
)
{
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=cancel">' . $langs->trans('Cancel') . '</a></div>';
}

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
@ -51,8 +51,17 @@ class Commande extends CommonOrder
var $id;
var $socid; // Id client
var $client; // Objet societe client (a charger par fetch_client)
/**
* Client ID
* @var int
*/
var $socid;
/**
* Client (loaded by fetch_client)
* @var Societe
*/
var $client;
var $ref;
var $ref_client;
@ -60,7 +69,19 @@ class Commande extends CommonOrder
var $ref_int;
var $contactid;
var $fk_project;
var $statut; // -1=Canceled, 0=Draft, 1=Validated, (2=Accepted/On process not managed for customer orders), 3=Closed (Sent/Received, billed or not)
/**
* Status of the order. Check the following constants:
* - STATUS_CANCELED
* - STATUS_DRAFT
* - STATUS_ACCEPTED
* - STATUS_CLOSED
* @var int
*/
var $statut;
/**
* @deprecated
*/
var $facturee; // deprecated
var $billed; // billed or not
@ -104,13 +125,46 @@ class Commande extends CommonOrder
var $user_author_id;
var $lines = array();
/**
* @var OrderLine[]
*/
var $lines = array();
//Incorterms
var $fk_incoterms;
var $location_incoterms;
var $libelle_incoterms; //Used into tooltip
// Pour board
var $nbtodo;
var $nbtodolate;
/**
* ERR Not engouch stock
*/
const STOCK_NOT_ENOUGH_FOR_ORDER = -3;
/**
* Canceled status
*/
const STATUS_CANCELED = -1;
/**
* Draft status
*/
const STATUS_DRAFT = 0;
/**
* Validated status
*/
const STATUS_VALIDATED = 1;
/**
* Accepted/On process not managed for customer orders
*/
const STATUS_ACCEPTED = 2;
/**
* Closed (Sent/Received, billed or not)
*/
const STATUS_CLOSED = 3;
/**
* Constructor
@ -199,7 +253,7 @@ class Commande extends CommonOrder
$error=0;
// Protection
if ($this->statut == 1)
if ($this->statut == self::STATUS_VALIDATED)
{
dol_syslog(get_class($this)."::valid no draft status", LOG_WARNING);
return 0;
@ -238,7 +292,7 @@ class Commande extends CommonOrder
// Validate
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
$sql.= " SET ref = '".$num."',";
$sql.= " fk_statut = 1,";
$sql.= " fk_statut = ".self::STATUS_VALIDATED.",";
$sql.= " date_valid='".$this->db->idate($now)."',";
$sql.= " fk_user_valid = ".$user->id;
$sql.= " WHERE rowid = ".$this->id;
@ -296,7 +350,7 @@ class Commande extends CommonOrder
// Rename directory if dir was a temporary ref
if (preg_match('/^[\(]?PROV/i', $this->ref))
{
// On renomme repertoire ($this->ref = ancienne ref, $numfa = nouvelle ref)
// On renomme repertoire ($this->ref = ancienne ref, $num = nouvelle ref)
// in order not to lose the attachments
$oldref = dol_sanitizeFileName($this->ref);
$newref = dol_sanitizeFileName($num);
@ -328,7 +382,7 @@ class Commande extends CommonOrder
if (! $error)
{
$this->ref = $num;
$this->statut = 1;
$this->statut = self::STATUS_VALIDATED;
}
if (! $error)
@ -357,7 +411,7 @@ class Commande extends CommonOrder
$error=0;
// Protection
if ($this->statut <= 0)
if ($this->statut <= self::STATUS_DRAFT)
{
return 0;
}
@ -372,7 +426,7 @@ class Commande extends CommonOrder
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
$sql.= " SET fk_statut = 0";
$sql.= " SET fk_statut = ".self::STATUS_DRAFT;
$sql.= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::set_draft", LOG_DEBUG);
@ -398,7 +452,7 @@ class Commande extends CommonOrder
if (!$error)
{
$this->statut=0;
$this->statut=self::STATUS_DRAFT;
$this->db->commit();
return $result;
}
@ -410,7 +464,7 @@ class Commande extends CommonOrder
}
}
$this->statut=0;
$this->statut=self::STATUS_DRAFT;
$this->db->commit();
return 1;
}
@ -435,7 +489,7 @@ class Commande extends CommonOrder
global $conf,$langs;
$error=0;
if ($this->statut != 3)
if ($this->statut != self::STATUS_CANCELED && $this->statut != self::STATUS_CLOSED)
{
dol_syslog(get_class($this)."::set_reopen order has not status closed", LOG_WARNING);
return 0;
@ -444,7 +498,7 @@ class Commande extends CommonOrder
$this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
$sql.= ' SET fk_statut=1, facture=0';
$sql.= ' SET fk_statut='.self::STATUS_VALIDATED.', facture=0';
$sql.= ' WHERE rowid = '.$this->id;
dol_syslog(get_class($this)."::set_reopen", LOG_DEBUG);
@ -459,13 +513,13 @@ class Commande extends CommonOrder
else
{
$error++;
$this->error=$this->db->error();
$this->error=$this->db->lasterror();
dol_print_error($this->db);
}
if (! $error)
{
$this->statut = 1;
$this->statut = self::STATUS_VALIDATED;
$this->billed = 0;
$this->facturee = 0; // deprecated
@ -504,10 +558,10 @@ class Commande extends CommonOrder
$now=dol_now();
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
$sql.= ' SET fk_statut = 3,';
$sql.= ' SET fk_statut = '.self::STATUS_CLOSED.',';
$sql.= ' fk_user_cloture = '.$user->id.',';
$sql.= " date_cloture = '".$this->db->idate($now)."'";
$sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > 0';
$sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT;
if ($this->db->query($sql))
{
@ -518,7 +572,7 @@ class Commande extends CommonOrder
if (! $error)
{
$this->statut=3;
$this->statut=self::STATUS_CLOSED;
$this->db->commit();
return 1;
@ -555,9 +609,9 @@ class Commande extends CommonOrder
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
$sql.= " SET fk_statut = -1";
$sql.= " SET fk_statut = ".self::STATUS_CANCELED;
$sql.= " WHERE rowid = ".$this->id;
$sql.= " AND fk_statut = 1";
$sql.= " AND fk_statut = ".self::STATUS_VALIDATED;
dol_syslog(get_class($this)."::cancel", LOG_DEBUG);
if ($this->db->query($sql))
@ -596,7 +650,7 @@ class Commande extends CommonOrder
if (! $error)
{
$this->statut=-1;
$this->statut=self::STATUS_CANCELED;
$this->db->commit();
return 1;
}
@ -624,8 +678,8 @@ class Commande extends CommonOrder
* Note that this->ref can be set or empty. If empty, we will use "(PROV)"
*
* @param User $user Objet user that make creation
* @param int $notrigger Disable all triggers
* @return int <0 if KO, >0 if OK
* @param int $notrigger Disable all triggers
* @return int <0 if KO, >0 if OK
*/
function create($user, $notrigger=0)
{
@ -633,22 +687,22 @@ class Commande extends CommonOrder
$error=0;
// Clean parameters
$this->brouillon = 1; // On positionne en mode brouillon la commande
$this->brouillon = 1; // set command as draft
dol_syslog(get_class($this)."::create user=".$user->id);
// Check parameters
if (! empty($this->ref)) // We check that ref is not already used
{
$result=self::isExistingObject($this->element, 0, $this->ref); // Check ref is not yet used
if ($result > 0)
{
$this->error='ErrorRefAlreadyExists';
dol_syslog(get_class($this)."::create ".$this->error,LOG_WARNING);
$this->db->rollback();
return -1;
}
}
{
$result=self::isExistingObject($this->element, 0, $this->ref); // Check ref is not yet used
if ($result > 0)
{
$this->error='ErrorRefAlreadyExists';
dol_syslog(get_class($this)."::create ".$this->error,LOG_WARNING);
$this->db->rollback();
return -1;
}
}
$soc = new Societe($this->db);
$result=$soc->fetch($this->socid);
@ -677,7 +731,7 @@ class Commande extends CommonOrder
$sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_account, fk_availability, fk_input_reason, date_livraison, fk_delivery_address";
$sql.= ", fk_shipping_method";
$sql.= ", remise_absolue, remise_percent";
$sql.= ", fk_incoterms, location_incoterms";
$sql.= ", fk_incoterms, location_incoterms";
$sql.= ", entity";
$sql.= ")";
$sql.= " VALUES ('(PROV)',".$this->socid.", '".$this->db->idate($now)."', ".$user->id;
@ -717,7 +771,7 @@ class Commande extends CommonOrder
$num=count($this->lines);
/*
* Insertion du detail des produits dans la base
* Insert products details into db
*/
for ($i=0;$i<$num;$i++)
{
@ -748,12 +802,15 @@ class Commande extends CommonOrder
$this->lines[$i]->fk_fournprice,
$this->lines[$i]->pa_ht,
$this->lines[$i]->label,
$this->lines[$i]->array_options
$this->lines[$i]->array_options
);
if ($result < 0)
{
$this->error=$this->db->lasterror();
dol_print_error($this->db);
if ($result != self::STOCK_NOT_ENOUGH_FOR_ORDER)
{
$this->error=$this->db->lasterror();
dol_print_error($this->db);
}
$this->db->rollback();
return -1;
}
@ -763,13 +820,16 @@ class Commande extends CommonOrder
}
}
// Mise a jour ref
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id;
// update ref
$initialref='(PROV'.$this->id.')';
if (! empty($this->ref)) $initialref=$this->ref;
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='".$this->db->escape($initialref)."' WHERE rowid=".$this->id;
if ($this->db->query($sql))
{
if ($this->id)
{
$this->ref="(PROV".$this->id.")";
$this->ref = $initialref;
// Add object linked
if (is_array($this->linked_objects) && ! empty($this->linked_objects))
@ -814,28 +874,25 @@ class Commande extends CommonOrder
if (! $error)
{
$action='create';
//$action='create';
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('orderdao'));
// TODO le hook fait double emploi avec le trigger !!
/*$hookmanager->initHooks(array('orderdao'));
$parameters=array('socid'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
{*/
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
if ($result < 0) $error++;
/* }
}
else if ($reshook < 0) $error++;
else if ($reshook < 0) $error++;*/
}
if (! $notrigger)
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('ORDER_CREATE',$user);
@ -843,29 +900,27 @@ class Commande extends CommonOrder
// End call triggers
}
if (!$error) {
if (! $error)
{
$this->db->commit();
return $this->id;
}
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
else
{
$this->db->rollback();
return -1*$error;
}
}
else
{
{
$this->error=$this->db->lasterror();
$this->db->rollback();
return -1;
}
}
}
else
{
{
dol_print_error($this->db);
$this->db->rollback();
return -1;
@ -914,7 +969,7 @@ class Commande extends CommonOrder
}
$this->id=0;
$this->statut=0;
$this->statut=self::STATUS_DRAFT;
// Clear fields
$this->user_author_id = $user->id;
@ -1159,7 +1214,7 @@ class Commande extends CommonOrder
// Check parameters
if ($type < 0) return -1;
if ($this->statut == 0)
if ($this->statut == self::STATUS_DRAFT)
{
$this->db->begin();
@ -1192,10 +1247,12 @@ class Commande extends CommonOrder
$result=$product->fetch($fk_product);
$product_type=$product->type;
if($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER && $product_type == 0 && $product->stock_reel < $qty) {
if($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER && $product_type == 0 && $product->stock_reel < $qty)
{
$this->error=$langs->trans('ErrorStockIsNotEnough');
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
$this->db->rollback();
return -3;
return self::STOCK_NOT_ENOUGH_FOR_ORDER;
}
}
@ -1466,14 +1523,14 @@ class Commande extends CommonOrder
//Incoterms
$this->fk_incoterms = $obj->fk_incoterms;
$this->location_incoterms = $obj->location_incoterms;
$this->location_incoterms = $obj->location_incoterms;
$this->libelle_incoterms = $obj->libelle_incoterms;
$this->extraparams = (array) json_decode($obj->extraparams, true);
$this->lines = array();
if ($this->statut == 0) $this->brouillon = 1;
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
// Retreive all extrafield for invoice
// fetch optionals attributes and labels
@ -1617,12 +1674,12 @@ class Commande extends CommonOrder
$line = new OrderLine($this->db);
$line->rowid = $objp->rowid; // \deprecated
$line->rowid = $objp->rowid;
$line->id = $objp->rowid;
$line->fk_commande = $objp->fk_commande;
$line->commande_id = $objp->fk_commande; // \deprecated
$line->commande_id = $objp->fk_commande;
$line->label = $objp->custom_label;
$line->desc = $objp->description; // Description ligne
$line->desc = $objp->description;
$line->product_type = $objp->product_type;
$line->qty = $objp->qty;
$line->tva_tx = $objp->tva_tx;
@ -1648,11 +1705,11 @@ class Commande extends CommonOrder
$line->special_code = $objp->special_code;
$line->fk_parent_line = $objp->fk_parent_line;
$line->ref = $objp->product_ref; // TODO deprecated
$line->ref = $objp->product_ref;
$line->product_ref = $objp->product_ref;
$line->libelle = $objp->product_label; // TODO deprecated
$line->libelle = $objp->product_label;
$line->product_label = $objp->product_label;
$line->product_desc = $objp->product_desc; // Description produit
$line->product_desc = $objp->product_desc;
$line->fk_product_type = $objp->fk_product_type; // Produit ou service
$line->date_start = $this->db->jdate($objp->date_start);
@ -1785,7 +1842,7 @@ class Commande extends CommonOrder
*
* TODO deprecated, move to Shipping class
*/
function livraison_array($filtre_statut=-1)
function livraison_array($filtre_statut=self::STATUS_CANCELED)
{
$delivery = new Livraison($this->db);
$deliveryArray = $delivery->livraison_array($filtre_statut);
@ -1800,7 +1857,7 @@ class Commande extends CommonOrder
*
* TODO FONCTION NON FINIE A FINIR
*/
function stock_array($filtre_statut=-1)
function stock_array($filtre_statut=self::STATUS_CANCELED)
{
$this->stocks = array();
@ -1842,7 +1899,7 @@ class Commande extends CommonOrder
{
global $user;
if ($this->statut == 0)
if ($this->statut == self::STATUS_DRAFT)
{
$this->db->begin();
@ -1925,7 +1982,7 @@ class Commande extends CommonOrder
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
$sql.= ' SET remise_percent = '.$remise;
$sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = 0 ;';
$sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = '.self::STATUS_DRAFT.' ;';
if ($this->db->query($sql))
{
@ -1959,7 +2016,7 @@ class Commande extends CommonOrder
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
$sql.= ' SET remise_absolue = '.$remise;
$sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = 0 ;';
$sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = '.self::STATUS_DRAFT.' ;';
dol_syslog(get_class($this)."::set_remise_absolue", LOG_DEBUG);
@ -1991,7 +2048,7 @@ class Commande extends CommonOrder
{
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
$sql.= " SET date_commande = ".($date ? $this->db->idate($date) : 'null');
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
dol_syslog(get_class($this)."::set_date",LOG_DEBUG);
$resql=$this->db->query($sql);
@ -2135,7 +2192,7 @@ class Commande extends CommonOrder
$sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
}
if ($socid) $sql.= " AND s.rowid = ".$socid;
if ($draft) $sql.= " AND c.fk_statut = 0";
if ($draft) $sql.= " AND c.fk_statut = ".self::STATUS_DRAFT;
if (is_object($excluser)) $sql.= " AND c.fk_user_author <> ".$excluser->id;
$sql.= $this->db->order($sortfield,$sortorder);
$sql.= $this->db->plimit($limit,$offset);
@ -2186,7 +2243,7 @@ class Commande extends CommonOrder
function availability($availability_id)
{
dol_syslog('Commande::availability('.$availability_id.')');
if ($this->statut >= 0)
if ($this->statut >= self::STATUS_DRAFT)
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
$sql .= ' SET fk_availability = '.$availability_id;
@ -2220,7 +2277,7 @@ class Commande extends CommonOrder
function demand_reason($demand_reason_id)
{
dol_syslog('Commande::demand_reason('.$demand_reason_id.')');
if ($this->statut >= 0)
if ($this->statut >= self::STATUS_DRAFT)
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
$sql .= ' SET fk_input_reason = '.$demand_reason_id;
@ -2291,7 +2348,7 @@ class Commande extends CommonOrder
$this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 1';
$sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > 0';
$sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT;
dol_syslog(get_class($this)."::classifyBilled", LOG_DEBUG);
if ($this->db->query($sql))
@ -2606,7 +2663,7 @@ class Commande extends CommonOrder
$action='create';
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('orderdao'));
$parameters=array('id'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
@ -2769,7 +2826,7 @@ class Commande extends CommonOrder
}
$sql.= $clause." c.entity = ".$conf->entity;
//$sql.= " AND c.fk_statut IN (1,2,3) AND c.facture = 0";
$sql.= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected
$sql.= " AND ((c.fk_statut IN (".self::STATUS_VALIDATED.",".self::STATUS_ACCEPTED.")) OR (c.fk_statut = ".self::STATUS_CLOSED." AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected
if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id;
$resql=$this->db->query($sql);
@ -2843,57 +2900,57 @@ class Commande extends CommonOrder
//print 'x'.$statut.'-'.$billed;
if ($mode == 0)
{
if ($statut==-1) return $langs->trans('StatusOrderCanceled');
if ($statut==0) return $langs->trans('StatusOrderDraft');
if ($statut==1) return $langs->trans('StatusOrderValidated');
if ($statut==2) return $langs->trans('StatusOrderSentShort');
if ($statut==3 && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBill');
if ($statut==3 && ($billed || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed');
if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceled');
if ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraft');
if ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidated');
if ($statut==self::STATUS_ACCEPTED) return $langs->trans('StatusOrderSentShort');
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBill');
if ($statut==self::STATUS_CLOSED && ($billed || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed');
}
elseif ($mode == 1)
{
if ($statut==-1) return $langs->trans('StatusOrderCanceledShort');
if ($statut==0) return $langs->trans('StatusOrderDraftShort');
if ($statut==1) return $langs->trans('StatusOrderValidatedShort');
if ($statut==2) return $langs->trans('StatusOrderSentShort');
if ($statut==3 && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBillShort');
if ($statut==3 && ($billed || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed');
if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceledShort');
if ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraftShort');
if ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidatedShort');
if ($statut==self::STATUS_ACCEPTED) return $langs->trans('StatusOrderSentShort');
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBillShort');
if ($statut==self::STATUS_CLOSED && ($billed || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed');
}
elseif ($mode == 2)
{
if ($statut==-1) return img_picto($langs->trans('StatusOrderCanceled'),'statut5').' '.$langs->trans('StatusOrderCanceledShort');
if ($statut==0) return img_picto($langs->trans('StatusOrderDraft'),'statut0').' '.$langs->trans('StatusOrderDraftShort');
if ($statut==1) return img_picto($langs->trans('StatusOrderValidated'),'statut1').' '.$langs->trans('StatusOrderValidatedShort');
if ($statut==2) return img_picto($langs->trans('StatusOrderSent'),'statut3').' '.$langs->trans('StatusOrderSentShort');
if ($statut==3 && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut7').' '.$langs->trans('StatusOrderToBillShort');
if ($statut==3 && ($billed || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed'),'statut6').' '.$langs->trans('StatusOrderProcessedShort');
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'),'statut5').' '.$langs->trans('StatusOrderCanceledShort');
if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'),'statut0').' '.$langs->trans('StatusOrderDraftShort');
if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated'),'statut1').' '.$langs->trans('StatusOrderValidatedShort');
if ($statut==self::STATUS_ACCEPTED) return img_picto($langs->trans('StatusOrderSent'),'statut3').' '.$langs->trans('StatusOrderSentShort');
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut7').' '.$langs->trans('StatusOrderToBillShort');
if ($statut==self::STATUS_CLOSED && ($billed || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed'),'statut6').' '.$langs->trans('StatusOrderProcessedShort');
}
elseif ($mode == 3)
{
if ($statut==-1) return img_picto($langs->trans('StatusOrderCanceled'),'statut5');
if ($statut==0) return img_picto($langs->trans('StatusOrderDraft'),'statut0');
if ($statut==1) return img_picto($langs->trans('StatusOrderValidated'),'statut1');
if ($statut==2) return img_picto($langs->trans('StatusOrderSentShort'),'statut3');
if ($statut==3 && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut7');
if ($statut==3 && ($billed || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed'),'statut6');
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'),'statut5');
if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'),'statut0');
if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated'),'statut1');
if ($statut==self::STATUS_ACCEPTED) return img_picto($langs->trans('StatusOrderSentShort'),'statut3');
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut7');
if ($statut==self::STATUS_CLOSED && ($billed || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed'),'statut6');
}
elseif ($mode == 4)
{
if ($statut==-1) return img_picto($langs->trans('StatusOrderCanceled'),'statut5').' '.$langs->trans('StatusOrderCanceled');
if ($statut==0) return img_picto($langs->trans('StatusOrderDraft'),'statut0').' '.$langs->trans('StatusOrderDraft');
if ($statut==1) return img_picto($langs->trans('StatusOrderValidated'),'statut1').' '.$langs->trans('StatusOrderValidated');
if ($statut==2) return img_picto($langs->trans('StatusOrderSentShort'),'statut3').' '.$langs->trans('StatusOrderSent');
if ($statut==3 && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut7').' '.$langs->trans('StatusOrderToBill');
if ($statut==3 && ($billed || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed'),'statut6').' '.$langs->trans('StatusOrderProcessed');
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'),'statut5').' '.$langs->trans('StatusOrderCanceled');
if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'),'statut0').' '.$langs->trans('StatusOrderDraft');
if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated'),'statut1').' '.$langs->trans('StatusOrderValidated');
if ($statut==self::STATUS_ACCEPTED) return img_picto($langs->trans('StatusOrderSentShort'),'statut3').' '.$langs->trans('StatusOrderSent');
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut7').' '.$langs->trans('StatusOrderToBill');
if ($statut==self::STATUS_CLOSED && ($billed || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed'),'statut6').' '.$langs->trans('StatusOrderProcessed');
}
elseif ($mode == 5)
{
if ($statut==-1) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderCanceledShort').' </span>'.img_picto($langs->trans('StatusOrderCanceled'),'statut5');
if ($statut==0) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDraftShort').' </span>'.img_picto($langs->trans('StatusOrderDraft'),'statut0');
if ($statut==1) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderValidatedShort').' </span>'.img_picto($langs->trans('StatusOrderValidated'),'statut1');
if ($statut==2) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderSentShort').' </span>'.img_picto($langs->trans('StatusOrderSent'),'statut3');
if ($statut==3 && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderToBillShort').' </span>'.img_picto($langs->trans('StatusOrderToBill'),'statut7');
if ($statut==3 && ($billed || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderProcessedShort').' </span>'.img_picto($langs->trans('StatusOrderProcessed'),'statut6');
if ($statut==self::STATUS_CANCELED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderCanceledShort').' </span>'.img_picto($langs->trans('StatusOrderCanceled'),'statut5');
if ($statut==self::STATUS_DRAFT) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDraftShort').' </span>'.img_picto($langs->trans('StatusOrderDraft'),'statut0');
if ($statut==self::STATUS_VALIDATED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderValidatedShort').' </span>'.img_picto($langs->trans('StatusOrderValidated'),'statut1');
if ($statut==self::STATUS_ACCEPTED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderSentShort').' </span>'.img_picto($langs->trans('StatusOrderSent'),'statut3');
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderToBillShort').' </span>'.img_picto($langs->trans('StatusOrderToBill'),'statut7');
if ($statut==self::STATUS_CLOSED && ($billed || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderProcessedShort').' </span>'.img_picto($langs->trans('StatusOrderProcessed'),'statut6');
}
}
@ -3243,56 +3300,44 @@ class Commande extends CommonOrder
*/
class OrderLine extends CommonOrderLine
{
var $db;
var $error;
public $element='commandedet';
public $table_element='commandedet';
var $oldline;
/**
* Id of parent order
* @var int
*/
public $fk_commande;
/**
* Id of parent order
* @var int
* @deprecated Use fk_commande
*/
public $commande_id;
// From llx_commandedet
var $rowid;
var $fk_parent_line;
var $fk_facture;
var $label;
var $desc; // Description ligne
var $fk_product; // Id produit predefini
var $product_type = 0; // Type 0 = product, 1 = Service
var $qty; // Quantity (example 2)
var $tva_tx; // VAT Rate for product/service (example 19.6)
var $localtax1_tx; // Local tax 1
var $localtax2_tx; // Local tax 2
var $localtax1_type; // Local tax 1 type
var $localtax2_type; // Local tax 2 type
var $subprice; // U.P. HT (example 100)
var $remise_percent; // % for line discount (example 20%)
var $fk_remise_except;
var $rang = 0;
var $fk_fournprice;
/**
* Buy price without taxes
* @var float
*/
var $pa_ht;
var $marge_tx;
var $marque_tx;
var $info_bits = 0; // Bit 0: 0 si TVA normal - 1 si TVA NPR
// Bit 1: 0 ligne normale - 1 si ligne de remise fixe
var $special_code = 0;
var $total_ht; // Total HT de la ligne toute quantite et incluant la remise ligne
var $total_tva; // Total TVA de la ligne toute quantite et incluant la remise ligne
var $total_localtax1; // Total local tax 1 for the line
var $total_localtax2; // Total local tax 2 for the line
var $total_ttc; // Total TTC de la ligne toute quantite et incluant la remise ligne
// Ne plus utiliser
var $remise;
var $price;
// From llx_product
var $ref; // deprecated
var $libelle; // deprecated
var $product_ref;
var $product_label; // Label produit
var $product_desc; // Description produit
/**
* @deprecated
*/
var $remise;
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
// Start and end date of the line

View File

@ -158,12 +158,12 @@ if ($resql)
print '<td>';
$result='';
$lien=$lienfin='';
$lien = '<a href="'.dol_buildpath('/commande/orderstoinvoice.php',1).'?socid='.$obj->rowid.'">';
$lienfin='</a>';
$link=$linkend='';
$link = '<a href="'.dol_buildpath('/commande/orderstoinvoice.php',1).'?socid='.$obj->rowid.'">';
$linkend='</a>';
$name=$obj->name;
$result.=($lien.img_object($langs->trans("ShowCompany").': '.$name,'company').$lienfin);
$result.=$lien.(dol_trunc($name,$maxlen)).$lienfin;
$result.=($link.img_object($langs->trans("ShowCompany").': '.$name,'company').$linkend);
$result.=$link.(dol_trunc($name,$maxlen)).$linkend;
print $result;
print '</td>';

View File

@ -7,6 +7,7 @@
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@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
@ -44,7 +45,7 @@ $orderyear=GETPOST("orderyear","int");
$ordermonth=GETPOST("ordermonth","int");
$deliveryyear=GETPOST("deliveryyear","int");
$deliverymonth=GETPOST("deliverymonth","int");
$search_ref=GETPOST('search_ref','alpha');
$search_ref=GETPOST('search_ref','alpha')!=''?GETPOST('search_ref','alpha'):GETPOST('sref','alpha');
$search_ref_customer=GETPOST('search_ref_customer','alpha');
$search_company=GETPOST('search_company','alpha');
$sall=GETPOST('sall');
@ -114,7 +115,7 @@ $help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Ped
llxHeader('',$langs->trans("Orders"),$help_url);
$sql = 'SELECT s.nom as name, s.rowid as socid, s.client, s.code_client, c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,';
$sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison, c.fk_statut, c.facture as facturee';
$sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as facturee';
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql.= ', '.MAIN_DB_PREFIX.'commande as c';
// We'll need this table joined to the select in order to filter by sale
@ -259,7 +260,7 @@ if ($resql)
if ($search_user > 0) $param.='&search_user='.$search_user;
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
if ($search_total_ht != '') $param.='&search_total_ht='.$search_total_ht;
$num = $db->num_rows($resql);
print_barre_liste($title, $page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
$i = 0;
@ -337,7 +338,7 @@ if ($resql)
$generic_commande = new Commande($db);
$generic_product = new Product($db);
while ($i < min($num,$limit))
while ($i < min($num,$limit))
{
$objp = $db->fetch_object($resql);
$var=!$var;
@ -368,7 +369,7 @@ if ($resql)
$nbprod++; // order contains real products
$generic_product->id = $generic_commande->lines[$lig]->fk_product;
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) {
$generic_product->load_stock(true);
$generic_product->load_stock();
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel;
} else {
$generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'];
@ -430,7 +431,7 @@ if ($resql)
// warning late icon
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && max($db->jdate($objp->date_commande),$db->jdate($objp->date_livraison)) < ($now - $conf->commande->client->warning_delay))
if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && max($db->jdate($objp->date_commande),$db->jdate($objp->date_delivery)) < ($now - $conf->commande->client->warning_delay))
print img_picto($langs->trans("Late"),"warning");
if(!empty($objp->note_private))
{
@ -482,7 +483,7 @@ if ($resql)
// Delivery date
print '<td align="center">';
print dol_print_date($db->jdate($objp->date_livraison), 'day');
print dol_print_date($db->jdate($objp->date_delivery), 'day');
print '</td>';
// Amount HT

View File

@ -30,7 +30,7 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
$langs->load("orders");
echo '<br>';
print_titre($langs->trans('RelatedOrders'));
print_titre($langs->trans('RelatedCustomerOrders'));
?>
<table class="noborder allwidth">

View File

@ -6,7 +6,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@@2byte.es>
* Copyright (C) 2012-2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2011-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -37,6 +37,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
@ -44,6 +46,8 @@ $langs->load("banks");
$langs->load("categories");
$langs->load("bills");
$langs->load("companies");
$langs->load("loan");
$langs->load("donations");
$id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('account','int'));
$ref = GETPOST('ref','alpha');
@ -74,6 +78,16 @@ if ($negpage)
$object = new Account($db);
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$paiementtype="";
$req_nb="";
$thirdparty="";
$req_desc="";
$req_debit="";
$req_credit="";
}
/*
* Action
*/
@ -148,11 +162,13 @@ llxHeader();
$societestatic=new Societe($db);
$userstatic=new User($db);
$chargestatic=new ChargeSociales($db);
$loanstatic=new Loan($db);
$memberstatic=new Adherent($db);
$paymentstatic=new Paiement($db);
$paymentsupplierstatic=new PaiementFourn($db);
$paymentvatstatic=new TVA($db);
$paymentsalstatic=new PaymentSalary($db);
$donstatic=new Don($db);
$bankstatic=new Account($db);
$banklinestatic=new AccountLine($db);
@ -387,7 +403,7 @@ if ($id > 0 || ! empty($ref))
print '<input name="label" class="flat" type="text" size="24" value="'.GETPOST("label").'">';
if ($nbcategories)
{
print '<br>'.$langs->trans("Category").': <select class="flat" name="cat1">'.$options.'</select>';
print '<br>'.$langs->trans("Rubrique").': <select class="flat" name="cat1">'.$options.'</select>';
}
print '</td>';
print '<td align=right><input name="debit" class="flat" type="text" size="4" value="'.GETPOST("debit").'"></td>';
@ -440,7 +456,10 @@ if ($id > 0 || ! empty($ref))
print '<td align="right"><input type="text" class="flat" name="req_debit" value="'.$req_debit.'" size="4"></td>';
print '<td align="right"><input type="text" class="flat" name="req_credit" value="'.$req_credit.'" size="4"></td>';
print '<td align="center">&nbsp;</td>';
print '<td align="center" width="40"><input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>';
print '<td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print "</tr>\n";
@ -606,6 +625,18 @@ if ($id > 0 || ! empty($ref))
$paymentsalstatic->ref=$links[$key]['url_id'];
print ' '.$paymentsalstatic->getNomUrl(2);
}
elseif ($links[$key]['type']=='payment_loan')
{
print '<a href="'.DOL_URL_ROOT.'/loan/payment/card.php?id='.$links[$key]['url_id'].'">';
print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
print '</a>';
}
elseif ($links[$key]['type']=='payment_donation')
{
print '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$links[$key]['url_id'].'">';
print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
print '</a>';
}
elseif ($links[$key]['type']=='banktransfert')
{
// Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail.
@ -705,6 +736,21 @@ if ($id > 0 || ! empty($ref))
$chargestatic->ref=$chargestatic->lib;
print $chargestatic->getNomUrl(1,16);
}
else if ($links[$key]['type']=='loan')
{
$loanstatic->id=$links[$key]['url_id'];
if (preg_match('/^\((.*)\)$/i',$links[$key]['label'],$reg))
{
if ($reg[1]=='loan') $reg[1]='Loan';
$loanstatic->label=$langs->trans($reg[1]);
}
else
{
$loanstatic->label=$links[$key]['label'];
}
$loanstatic->ref=$loanstatic->label;
print $loanstatic->getLinkUrl(1,16);
}
else if ($links[$key]['type']=='member')
{
$memberstatic->id=$links[$key]['url_id'];

View File

@ -137,7 +137,7 @@ $head=bank_prepare_head($acct);
dol_fiche_head($head,'annual',$langs->trans("FinancialAccount"),0,'account');
$title=$langs->trans("FinancialAccount")." : ".$acct->label;
$lien=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year_start=".($year_start-1)."'>".img_previous()."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year_start=".($year_start+1)."'>".img_next()."</a>":"");
$link=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year_start=".($year_start-1)."'>".img_previous()."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year_start=".($year_start+1)."'>".img_next()."</a>":"");
print '<table class="border" width="100%">';
@ -191,7 +191,7 @@ print '<br>';
// Affiche tableau
print '<table class="notopnoleftnoright" width="100%">';
print '<tr><td colspan="'.(1+($year_end-$year_start+1)*2).'" align="right">'.$lien.'</td></tr>';
print '<tr><td colspan="'.(1+($year_end-$year_start+1)*2).'" align="right">'.$link.'</td></tr>';
print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Month").'</td>';
for ($annee = $year_start ; $annee <= $year_end ; $annee++)

View File

@ -39,12 +39,12 @@ class Account extends CommonObject
public $table_element='bank_account';
/**
* //TODO: Discuss this. $rowid is preferred over $id
* @var
* @var int Use id instead of rowid
* @deprecated
*/
var $rowid;
var $id;
var $ref;
var $label;
//! 1=Compte courant/check/carte, 2=Compte liquide, 0=Compte épargne
@ -781,8 +781,8 @@ class Account extends CommonObject
$result=$this->deleteExtraFields();
if ($result < 0)
{
return -1;
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
return -1;
}
}
@ -968,9 +968,9 @@ class Account extends CommonObject
/**
* Renvoie nom clicable (avec eventuellement le picto)
* Return clicable name (with picto eventually)
*
* @param int $withpicto Inclut le picto dans le lien
* @param int $withpicto Include picto into link
* @param string $mode ''=Link to card, 'transactions'=Link to transactions card
* @return string Chaine avec URL
*/
@ -988,17 +988,17 @@ class Account extends CommonObject
if (empty($mode))
{
$lien = '<a href="'.DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id.$linkclose;
$lienfin='</a>';
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id.$linkclose;
$linkend='</a>';
}
else if ($mode == 'transactions')
{
$lien = '<a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$this->id.$linkclose;
$lienfin='</a>';
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$this->id.$linkclose;
$linkend='</a>';
}
if ($withpicto) $result.=($lien.img_object($label, 'account', 'class="classfortooltip"').$lienfin.' ');
$result.=$lien.$this->label.$lienfin;
if ($withpicto) $result.=($link.img_object($label, 'account', 'class="classfortooltip"').$linkend.' ');
$result.=$link.$this->label.$linkend;
return $result;
}
@ -1521,9 +1521,9 @@ class AccountLine extends CommonObject
/**
* Renvoie nom clicable (avec eventuellement le picto)
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlen Longueur max libelle
* @param string $option Option ('showall')
* @return string Chaine avec URL
@ -1534,11 +1534,11 @@ class AccountLine extends CommonObject
$result='';
$label=$langs->trans("ShowTransaction").': '.$this->rowid;
$lien = '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$this->rowid.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>';
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$this->rowid.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>';
if ($withpicto) $result.=($lien.img_object($label, 'account', 'class="classfortooltip"').$lienfin.' ');
$result.=$lien.$this->rowid.$lienfin;
if ($withpicto) $result.=($link.img_object($label, 'account', 'class="classfortooltip"').$linkend.' ');
$result.=$link.$this->rowid.$linkend;
if ($option == 'showall' || $option == 'showconciliated') $result.=' (';
if ($option == 'showall')

View File

@ -841,8 +841,8 @@ if ($mode == 'standard')
if ($nextmonth > 12) { $nextmonth=1; $nextyear++; }
// For month
$lien="<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"]!='all'?'':'&option=all')."&year=".$prevyear."&month=".$prevmonth."'>".img_previous()."</a> ".$langs->trans("Month")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".$nextyear."&month=".$nextmonth."'>".img_next()."</a>";
print '<tr><td align="right">'.$lien.'</td></tr>';
$link="<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"]!='all'?'':'&option=all')."&year=".$prevyear."&month=".$prevmonth."'>".img_previous()."</a> ".$langs->trans("Month")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".$nextyear."&month=".$nextmonth."'>".img_next()."</a>";
print '<tr><td align="right">'.$link.'</td></tr>';
print '<tr><td align="center">';
$file = "movement".$account."-".$year.$month.".png";
@ -855,8 +855,8 @@ if ($mode == 'standard')
// For year
$prevyear=$year-1;$nextyear=$year+1;
$lien="<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"]!='all'?'':'&option=all')."&year=".($prevyear)."'>".img_previous()."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".($nextyear)."'>".img_next()."</a>";
print '<tr><td align="right">'.$lien.'</td></tr>';
$link="<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"]!='all'?'':'&option=all')."&year=".($prevyear)."'>".img_previous()."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".($nextyear)."'>".img_next()."</a>";
print '<tr><td align="right">'.$link.'</td></tr>';
print '<tr><td align="center">';
print $show5;

View File

@ -111,8 +111,12 @@ foreach ($accounts as $key=>$type)
if ($acc->rappro)
{
$result=$acc->load_board($user,$acc->id);
print $acc->nbtodo;
if ($acc->nbtodolate) print ' ('.$acc->nbtodolate.img_warning($langs->trans("Late")).')';
if ($result<0) {
setEventMessage($acc->error, 'errors');
} else {
print $result->nbtodo;
if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';
}
}
else print $langs->trans("FeatureDisabled");
print '</td>';
@ -129,7 +133,7 @@ if (! $found) print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'
// Total
foreach ($total as $key=>$solde)
{
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total ").$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").' '.$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
}
print '</table>';
@ -182,7 +186,7 @@ if (! $found)
// Total
foreach ($total as $key=>$solde)
{
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total ").$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").' '.$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
}
print '</table>';
@ -223,8 +227,12 @@ foreach ($accounts as $key=>$type)
if ($acc->rappro)
{
$result=$acc->load_board($user,$acc->id);
print $acc->nbtodo;
if ($acc->nbtodolate) print ' ('.$acc->nbtodolate.img_warning($langs->trans("Late")).')';
if ($result<0) {
setEventMessage($acc->error, 'errors');
} else {
print $result->nbtodo;
if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';
}
}
else print $langs->trans("FeatureDisabled");
print '</td>';
@ -245,7 +253,7 @@ if (! $found)
// Total
foreach ($total as $key=>$solde)
{
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total ").$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").' '.$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
}
print "</table>";

View File

@ -4,6 +4,7 @@
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -21,7 +22,7 @@
/**
* \file htdocs/compta/bank/ligne.php
* \ingroup compta
* \ingroup bank
* \brief Page to edit a bank transaction record
*/
@ -33,6 +34,8 @@ $langs->load("categories");
$langs->load("compta");
$langs->load("bills");
if (! empty($conf->adherent->enabled)) $langs->load("members");
if (! empty($conf->don->enabled)) $langs->load("donations");
if (! empty($conf->loan->enabled)) $langs->load("loan");
$id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('account','int'));
@ -345,11 +348,29 @@ if ($result)
print $langs->trans("SalaryPayment");
print '</a>';
}
else if ($links[$key]['type']=='payment_loan') {
print '<a href="'.DOL_URL_ROOT.'/loan/payment/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowLoanPayment'),'payment').' ';
print $langs->trans("PaymentLoan");
print '</a>';
}
else if ($links[$key]['type']=='loan') {
print '<a href="'.DOL_URL_ROOT.'/loan/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowLoan'),'bill').' ';
print $langs->trans("Loan");
print '</a>';
}
else if ($links[$key]['type']=='member') {
print '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowMember'),'user').' ';
print $links[$key]['label'];
print '</a>';
}
else if ($links[$key]['type']=='payment_donation') {
print '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowDonation'),'payment').' ';
print $langs->trans("DonationPayment");
print '</a>';
}
else if ($links[$key]['type']=='banktransfert') {
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$links[$key]['url_id'].'">';

View File

@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$langs->load("banks");
$langs->load("categories");
@ -128,7 +128,7 @@ if (! empty($type))
{
$sql.= " AND b.fk_type = '".$db->escape($type)."' ";
}
//Search period criteria
// Search period criteria
if (dol_strlen($search_dt_start)>0) {
$sql .= " AND b.dateo >= '" . $db->idate($search_dt_start) . "'";
}
@ -178,9 +178,10 @@ if ($resql)
print '<form method="post" action="search.php" name="search_form">'."\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
$moreforfilter .= $langs->trans('Period') . ' ' . $langs->trans('StartDate') . ': ';
$moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 1, 1);
$moreforfilter .= $langs->trans('EndDate') . ':' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 1, 1);
$moreforfilter .= $langs->trans('Period') . ' ('.$langs->trans('DateOperationShort').') : ' . $langs->trans('StartDate') . ' ';
$moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 1);
$moreforfilter .= ' - ';
$moreforfilter .= $langs->trans('EndDate') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1);
if ($moreforfilter) {

View File

@ -329,8 +329,8 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
// Solde actuel
$var=!$var;
print '<tr class="liste_total">';
print '<td align="left" colspan="5">'.$langs->trans("FutureBalance").'</td>';
print '<td align="right" nowrap>'.price($solde).'</td>';
print '<td align="left" colspan="5">'.$langs->trans("FutureBalance").' ('.$acct->currency_code.')</td>';
print '<td align="right" nowrap>'.price($solde, 0, $langs, 0, 0, -1, $acct->currency_code).'</td>';
print '</tr>';
print "</table>";

View File

@ -79,7 +79,7 @@ if ($action == 'add')
$accountto=new Account($db);
$accountto->fetch(GETPOST('account_to','int'));
if ($accountto->id != $accountfrom->id)
if (($accountto->id != $accountfrom->id) && ($accountto->currency_code == $accountfrom->currency_code))
{
$db->begin();

View File

@ -349,7 +349,7 @@ class Deplacement extends CommonObject
/**
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @return string Chaine avec URL
*/
function getNomUrl($withpicto=0)
@ -359,15 +359,15 @@ class Deplacement extends CommonObject
$result='';
$label=$langs->trans("Show").': '.$this->ref;
$lien = '<a href="'.DOL_URL_ROOT.'/compta/deplacement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>';
$link = '<a href="'.DOL_URL_ROOT.'/compta/deplacement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>';
$picto='trip';
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
return $result;
}

View File

@ -1,593 +0,0 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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/compta/dons/card.php
* \ingroup don
* \brief Page of donation card
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/dons/modules_don.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/dons/class/don.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
if (! empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
$langs->load("companies");
$langs->load("donations");
$langs->load("bills");
$id=GETPOST('rowid')?GETPOST('rowid','int'):GETPOST('id','int');
$action=GETPOST('action','alpha');
$cancel=GETPOST('cancel');
$amount=GETPOST('amount');
$don = new Don($db);
$donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
// Security check
$result = restrictedArea($user, 'don', $id);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('doncard','globalcard'));
/*
* Actions
*/
if ($action == 'update')
{
if (! empty($cancel))
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit;
}
$error=0;
if (empty($donation_date))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Date")), 'errors');
$action = "create";
$error++;
}
if (empty($amount))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Amount")), 'errors');
$action = "create";
$error++;
}
if (! $error)
{
$don->fetch($id);
$don->firstname = $_POST["firstname"];
$don->lastname = $_POST["lastname"];
$don->societe = $_POST["societe"];
$don->address = $_POST["address"];
$don->amount = price2num($_POST["amount"]);
$don->town = $_POST["town"];
$don->zip = $_POST["zipcode"];
$don->country = $_POST["country"];
$don->email = $_POST["email"];
$don->date = $donation_date;
$don->note = $_POST["note"];
$don->public = $_POST["public"];
$don->fk_project = $_POST["projectid"];
$don->note_private= GETPOST("note_private");
$don->note_public = GETPOST("note_public");
$don->modepaiementid = $_POST["modepaiement"];
if ($don->update($user) > 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$don->id);
exit;
}
}
}
if ($action == 'add')
{
if (! empty($cancel))
{
header("Location: index.php");
exit;
}
$error=0;
if (empty($donation_date))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Date")), 'errors');
$action = "create";
$error++;
}
if (empty($amount))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Amount")), 'errors');
$action = "create";
$error++;
}
if (! $error)
{
$don->firstname = $_POST["firstname"];
$don->lastname = $_POST["lastname"];
$don->societe = $_POST["societe"];
$don->address = $_POST["address"];
$don->amount = price2num($_POST["amount"]);
$don->town = $_POST["town"];
$don->zip = $_POST["zipcode"];
$don->town = $_POST["town"];
$don->country = $_POST["country"];
$don->email = $_POST["email"];
$don->date = $donation_date;
$don->note_private= GETPOST("note_private");
$don->note_public = GETPOST("note_public");
$don->public = $_POST["public"];
$don->fk_project = $_POST["projectid"];
$don->modepaiementid = $_POST["modepaiement"];
if ($don->create($user) > 0)
{
header("Location: index.php");
exit;
}
}
}
if ($action == 'delete')
{
$don->delete($id);
header("Location: list.php");
exit;
}
if ($action == 'commentaire')
{
$don->fetch($id);
$don->update_note($_POST["commentaire"]);
}
if ($action == 'valid_promesse')
{
if ($don->valid_promesse($id, $user->id) >= 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit;
}
else {
setEventMessage($don->error, 'errors');
}
}
if ($action == 'set_cancel')
{
if ($don->set_cancel($id) >= 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit;
}
else {
setEventMessage($don->error, 'errors');
}
}
if ($action == 'set_paid')
{
if ($don->set_paye($id, $modepaiement) >= 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit;
}
else {
setEventMessage($don->error, 'errors');
}
}
if ($action == 'set_encaisse')
{
if ($don->set_encaisse($id) >= 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit;
}
else {
setEventMessage($don->error, 'errors');
}
}
/*
* Build doc
*/
if ($action == 'builddoc')
{
$object = new Don($db);
$object->fetch($id);
// Save last template used to generate document
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
// Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$result=don_create($db, $object->id, '', $object->modelpdf, $outputlangs);
if ($result <= 0)
{
dol_print_error($db,$result);
exit;
}
}
/*
* View
*/
llxHeader('',$langs->trans("Donations"),'EN:Module_Donations|FR:Module_Dons|ES:M&oacute;dulo_Donaciones');
$form=new Form($db);
$formfile = new FormFile($db);
$formcompany = new FormCompany($db);
/* ************************************************************************** */
/* */
/* Creation */
/* */
/* ************************************************************************** */
if ($action == 'create')
{
print_fiche_titre($langs->trans("AddDonation"));
print '<form name="add" action="card.php" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="border" width="100%">';
print '<input type="hidden" name="action" value="add">';
$nbrows=11;
if (! empty($conf->projet->enabled)) $nbrows++;
// Date
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
$form->select_date($donation_date?$donation_date:-1,'','','','',"add",1,1);
print '</td>';
print '<td rowspan="'.$nbrows.'" valign="top">'.$langs->trans("Comments").' :<br>';
print "<textarea name=\"note_private\" wrap=\"soft\" cols=\"40\" rows=\"15\">".GETPOST("note_private")."</textarea></td>";
print "</tr>";
// Amount
print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" value="'.$_POST["amount"].'" size="10"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
print $form->selectyesno("public",isset($_POST["public"])?$_POST["public"]:1,1);
print "</td></tr>\n";
print "<tr>".'<td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" value="'.$_POST["societe"].'" size="40"></td></tr>';
print "<tr>".'<td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" value="'.$_POST["firstname"].'" size="40"></td></tr>';
print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" value="'.$_POST["lastname"].'" size="40"></td></tr>';
print "<tr>".'<td>'.$langs->trans("Address").'</td><td>';
print '<textarea name="address" wrap="soft" cols="40" rows="3">'.$_POST["address"].'</textarea></td></tr>';
// Zip / Town
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$don->zip),'zipcode',array('town','selectcountry_id','state_id'),6);
print ' ';
print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$don->town),'town',array('zipcode','selectcountry_id','state_id'));
print '</tr>';
print "<tr>".'<td>'.$langs->trans("Country").'</td><td><input type="text" name="country" value="'.$_POST["country"].'" size="40"></td></tr>';
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" value="'.$_POST["email"].'" size="40"></td></tr>';
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
$form->select_types_paiements('', 'modepaiement', 'CRDT', 0, 1);
print "</td></tr>\n";
if (! empty($conf->projet->enabled))
{
$formproject=new FormProjets($db);
// Si module projet actif
print "<tr><td>".$langs->trans("Project")."</td><td>";
$formproject->select_projects('',$_POST["projectid"],"projectid");
print "</td></tr>\n";
}
// Other attributes
$parameters=array('colspan' => ' colspan="1"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$don,$action); // Note that $action and $object may have been modified by hook
print "</table>\n";
print '<br><div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
print "</form>\n";
}
/* ************************************************************ */
/* */
/* Fiche don en mode edition */
/* */
/* ************************************************************ */
if (! empty($id) && $action == 'edit')
{
$don->fetch($id);
$h=0;
$head[$h][0] = $_SERVER['PHP_SELF']."?id=".$don->id;
$head[$h][1] = $langs->trans("Card");
$hselected=$h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic');
print '<form name="update" action="card.php" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="border" width="100%">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="rowid" value="'.$don->id.'">';
// Ref
print "<tr>".'<td>'.$langs->trans("Ref").'</td><td colspan="2">';
print $don->getNomUrl();
print '</td>';
print '</tr>';
$nbrows=12;
if (! empty($conf->projet->enabled)) $nbrows++;
// Date
print "<tr>".'<td width="25%" class="fieldrequired">'.$langs->trans("Date").'</td><td>';
$form->select_date($don->date,'','','','',"update");
print '</td>';
print '<td rowspan="'.$nbrows.'" valign="top">'.$langs->trans("Comments").' :<br>';
print "<textarea name=\"note_private\" wrap=\"soft\" cols=\"40\" rows=\"15\">".$don->note_private."</textarea></td>";
print "</tr>";
// Amount
print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" size="10" value="'.$don->amount.'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
print $form->selectyesno("public",1,1);
print "</td>";
print "</tr>\n";
$langs->load("companies");
print "<tr>".'<td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40" value="'.$don->societe.'"></td></tr>';
print "<tr>".'<td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" size="40" value="'.$don->firstname.'"></td></tr>';
print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" size="40" value="'.$don->lastname.'"></td></tr>';
print "<tr>".'<td>'.$langs->trans("Address").'</td><td>';
print '<textarea name="address" wrap="soft" cols="40" rows="'.ROWS_3.'">'.$don->address.'</textarea></td></tr>';
// Zip / Town
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$don->zip),'zipcode',array('town','selectcountry_id','state_id'),6);
print ' ';
print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$don->town),'town',array('zipcode','selectcountry_id','state_id'));
print '</tr>';
print "<tr>".'<td>'.$langs->trans("Country").'</td><td><input type="text" name="country" size="40" value="'.$don->country.'"></td></tr>';
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" size="40" value="'.$don->email.'"></td></tr>';
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
if ($don->modepaiementid) $selected = $don->modepaiementid;
else $selected = '';
$form->select_types_paiements($selected, 'modepaiement', 'CRDT', 0, 1);
print "</td></tr>\n";
print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$don->getLibStatut(4).'</td></tr>';
// Project
if (! empty($conf->projet->enabled))
{
$formproject=new FormProjets($db);
$langs->load('projects');
print '<tr><td>'.$langs->trans('Project').'</td><td>';
$formproject->select_projects(-1, (isset($_POST["projectid"])?$_POST["projectid"]:$don->fk_project), 'projectid');
print '</td></tr>';
}
// Other attributes
$parameters=array('colspan' => ' colspan="1"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$don,$action); // Note that $action and $object may have been modified by hook
print "</table>\n";
print '<br><div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
print "</form>\n";
print "</div>\n";
}
/* ************************************************************ */
/* */
/* Fiche don en mode visu */
/* */
/* ************************************************************ */
if (! empty($id) && $action != 'edit')
{
$result=$don->fetch($id);
$h=0;
$head[$h][0] = $_SERVER['PHP_SELF']."?id=".$don->id;
$head[$h][1] = $langs->trans("Card");
$hselected=$h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic');
print "<form action=\"card.php\" method=\"post\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/dons/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$nbrows=12;
if (! empty($conf->projet->enabled)) $nbrows++;
// Ref
print "<tr>".'<td>'.$langs->trans("Ref").'</td><td colspan="2">';
print $form->showrefnav($don, 'rowid', $linkback, 1, 'rowid', 'ref', '');
print '</td>';
print '</tr>';
// Date
print '<tr><td width="25%">'.$langs->trans("Date").'</td><td>';
print dol_print_date($don->date,"day");
print "</td>";
print '<td rowspan="'.$nbrows.'" valign="top" width="50%">'.$langs->trans("Comments").' :<br>';
print nl2br($don->note_private).'</td></tr>';
print "<tr>".'<td>'.$langs->trans("Amount").'</td><td>'.price($don->amount,0,$langs,0,0,-1,$conf->currency).'</td></tr>';
print "<tr><td>".$langs->trans("PublicDonation")."</td><td>";
print yn($don->public);
print "</td></tr>\n";
print "<tr>".'<td>'.$langs->trans("Company").'</td><td>'.$don->societe.'</td></tr>';
print "<tr>".'<td>'.$langs->trans("Firstname").'</td><td>'.$don->firstname.'</td></tr>';
print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td>'.$don->lastname.'</td></tr>';
print "<tr>".'<td>'.$langs->trans("Address").'</td><td>'.dol_nl2br($don->address).'</td></tr>';
// Zip / Town
print "<tr>".'<td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>'.$don->zip.($don->zip && $don->town?' / ':'').$don->town.'</td></tr>';
// Country
print "<tr>".'<td>'.$langs->trans("Country").'</td><td>'.$don->country.'</td></tr>';
// EMail
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td>'.dol_print_email($don->email).'</td></tr>';
// Payment mode
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
$form->form_modes_reglement(null, $don->modepaiementid,'none');
print "</td></tr>\n";
print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$don->getLibStatut(4).'</td></tr>';
// Project
if (! empty($conf->projet->enabled))
{
print "<tr>".'<td>'.$langs->trans("Project").'</td><td>'.$don->projet.'</td></tr>';
}
// Other attributes
$parameters=array('colspan' => ' colspan="1"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$don,$action); // Note that $action and $object may have been modified by hook
print "</table>\n";
print "</form>\n";
print "</div>";
// TODO Gerer action emettre paiement
$resteapayer = 0;
/**
* Barre d'actions
*/
print '<div class="tabsAction">';
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=edit&rowid='.$don->id.'">'.$langs->trans('Modify').'</a></div>';
if ($don->statut == 0)
{
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$don->id.'&action=valid_promesse">'.$langs->trans("ValidPromess").'</a></div>';
}
if (($don->statut == 0 || $don->statut == 1) && $resteapayer == 0 && $don->paye == 0)
{
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$don->id.'&action=set_cancel">'.$langs->trans("ClassifyCanceled")."</a></div>";
}
// TODO Gerer action emettre paiement
if ($don->statut == 1 && $resteapayer > 0)
{
print '<div class="inline-block divButAction"><a class="butAction" href="paiement.php?rowid='.$don->id.'&action=create">'.$langs->trans("DoPayment")."</a></div>";
}
if ($don->statut == 1 && $resteapayer == 0 && $don->paye == 0)
{
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$don->id.'&action=set_paid">'.$langs->trans("ClassifyPaid")."</a></div>";
}
if ($user->rights->don->supprimer)
{
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$don->id.'&action=delete">'.$langs->trans("Delete")."</a></div>";
}
else
{
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans("Delete")."</a></div>";
}
print "</div>";
print '<table width="100%"><tr><td width="50%" valign="top">';
/*
* Documents generes
*/
$filename=dol_sanitizeFileName($don->id);
$filedir=$conf->don->dir_output . '/' . get_exdir($filename,2);
$urlsource=$_SERVER['PHP_SELF'].'?rowid='.$don->id;
// $genallowed=($fac->statut == 1 && ($fac->paye == 0 || $user->admin) && $user->rights->facture->creer);
// $delallowed=$user->rights->facture->supprimer;
$genallowed=1;
$delallowed=0;
$var=true;
print '<br>';
$formfile->show_documents('donation',$filename,$filedir,$urlsource,$genallowed,$delallowed);
print '</td><td>&nbsp;</td>';
print '</tr></table>';
}
llxFooter();
$db->close();

View File

@ -1,84 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/dons/stats.php
* \ingroup don
* \brief Page des statistiques de dons
*/
require '../../main.inc.php';
$langs->load("donations");
if (!$user->rights->don->lire) accessforbidden();
/*
* View
*/
llxHeader('',$langs->trans("Donations"),'EN:Module_Donations|FR:Module_Dons|ES:M&oacute;dulo_Donaciones');
print_fiche_titre($langs->trans("Statistics"));
$sql = "SELECT d.amount";
$sql .= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet as p";
$sql .= " ON p.rowid = d.fk_don_projet";
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$var=true;
$i=0;
$total=0;
while ($i < $num)
{
$objp = $db->fetch_object($result);
$total += $objp->amount;
$i++;
}
print '<table class="noborder" width="50%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td align="right">'.$langs->trans("Value").'</td></tr>';
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>'.$langs->trans("DonationsNumber").'</td><td align="right">'.$num.'</td></tr>';
$var=!$var;
print "<tr ".$bc[$var].">".'<td>'.$langs->trans("AmountTotal").'</td><td align="right">'.price($total).'</td>';
$var=!$var;
print "<tr ".$bc[$var].">".'<td>'.$langs->trans("Average").'</td><td align="right">'.price($total / ($num?$num:1)).'</td>';
print "</tr>";
print "</table>";
}
else
{
dol_print_error($db);
}
llxFooter();
$db->close();

View File

@ -5,13 +5,15 @@
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012-2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@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
@ -324,7 +326,7 @@ if (empty($reshook))
{
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
}
// bank account
else if ($action == 'setbankaccount' && $user->rights->facture->creer)
{
@ -1077,7 +1079,11 @@ if (empty($reshook))
$array_options = $lines[$i]->array_options;
}
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->situation_percent, $lines[$i]->fk_prev_id);
// View third's localtaxes for now
$localtax1_tx = get_localtax($lines[$i]->tva_tx, 1, $object->client);
$localtax2_tx = get_localtax($lines[$i]->tva_tx, 2, $object->client);
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $localtax1_tx, $localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->situation_percent, $lines[$i]->fk_prev_id);
if ($result > 0) {
$lineid = $result;
@ -1805,7 +1811,7 @@ if (empty($reshook))
if (! $error) {
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('invoicedao'));
$parameters = array('id' => $object->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
@ -2289,7 +2295,7 @@ if ($action == 'create')
print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms)?$objectsrc->location_incoterms:''));
print '</td></tr>';
}
// Other attributes
$parameters = array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"');
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
@ -2354,15 +2360,25 @@ if ($action == 'create')
print '<input type="hidden" name="origin" value="' . $objectsrc->element . '">';
print '<input type="hidden" name="originid" value="' . $objectsrc->id . '">';
$newclassname = $classname;
if ($newclassname == 'Propal')
$newclassname = 'CommercialProposal';
elseif ($newclassname == 'Commande')
$newclassname = 'Order';
elseif ($newclassname == 'Expedition')
$newclassname = 'Sending';
elseif ($newclassname == 'Fichinter')
$newclassname = 'Intervention';
switch ($classname) {
case 'Propal':
$newclassname = 'CommercialProposal';
break;
case 'Commande':
$newclassname = 'Order';
break;
case 'Expedition':
$newclassname = 'Sending';
break;
case 'Contrat':
$newclassname = 'Contract';
break;
case 'Fichinter':
$newclassname = 'Intervention';
break;
default:
$newclassname = $classname;
}
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $objectsrc->getNomUrl(1);
//We check if Origin document has already an invoice attached to it
@ -2587,7 +2603,7 @@ if ($action == 'create')
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db);
$text .= '<br>';
$text .= $notify->confirmMessage('BILL_VALIDATE', $object->socid);
$text .= $notify->confirmMessage('BILL_VALIDATE', $object->socid, $object);
}
$formquestion = array();
@ -2749,8 +2765,9 @@ if ($action == 'create')
if (! $formconfirm) {
$parameters = array('lineid' => $lineid);
$formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by
// hook
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
}
// Print form confirm
@ -3389,10 +3406,10 @@ if ($action == 'create')
print '</td>';
print '</tr>';
}
// Incoterms
if (!empty($conf->incoterm->enabled))
{
{
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('IncotermLabel');
@ -3406,7 +3423,7 @@ if ($action == 'create')
{
print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
}
else
else
{
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id);
}

View File

@ -147,16 +147,16 @@ if ($id > 0 || ! empty($ref))
if ($absolute_discount > 0)
{
print '. ';
if ($object->statut > 0 || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT)
if ($object->statut > Facture::STATUS_DRAFT || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT)
{
if ($object->statut == 0)
if ($object->statut == Facture::STATUS_DRAFT)
{
print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
print '. ';
}
else
{
if ($object->statut < 1 || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT)
if ($object->statut < Facture::STATUS_VALIDATED || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT)
{
$text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
print '<br>'.$text.'.<br>';
@ -181,7 +181,7 @@ if ($id > 0 || ! empty($ref))
{
if ($absolute_creditnote > 0) // If not linked will be added later
{
if ($object->statut == 0 && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT) print ' - '.$addabsolutediscount.'<br>';
if ($object->statut == Facture::STATUS_DRAFT && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT) print ' - '.$addabsolutediscount.'<br>';
else print '.';
}
else print '. ';
@ -189,9 +189,9 @@ if ($id > 0 || ! empty($ref))
if ($absolute_creditnote > 0)
{
// If validated, we show link "add credit note to payment"
if ($object->statut != 1 || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT)
if ($object->statut != Facture::STATUS_VALIDATED || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT)
{
if ($object->statut == 0 && $object->type != Facture::TYPE_DEPOSIT)
if ($object->statut == Facture::STATUS_DRAFT && $object->type != Facture::TYPE_DEPOSIT)
{
$text=$langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency));
print $form->textwithpicto($text,$langs->trans("CreditNoteDepositUse"));
@ -212,7 +212,7 @@ if ($id > 0 || ! empty($ref))
if (! $absolute_discount && ! $absolute_creditnote)
{
print $langs->trans("CompanyHasNoAbsoluteDiscount");
if ($object->statut == 0 && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT) print ' - '.$addabsolutediscount.'<br>';
if ($object->statut == Facture::STATUS_DRAFT && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT) print ' - '.$addabsolutediscount.'<br>';
else print '. ';
}
/*if ($object->statut == 0 && $object->type != 2 && $object->type != 3)

View File

@ -260,7 +260,7 @@ class FactureRec extends Facture
$this->rang = $obj->rang;
$this->special_code = $obj->special_code;
if ($this->statut == 0) $this->brouillon = 1;
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
/*
* Lines
@ -547,9 +547,9 @@ class FactureRec extends Facture
}
/**
* Renvoie nom clicable (avec eventuellement le picto)
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param string $option Sur quoi pointe le lien ('', 'withdraw')
* @return string Chaine avec URL
*/
@ -560,15 +560,15 @@ class FactureRec extends Facture
$result='';
$label=$langs->trans("ShowInvoice").': '.$this->ref;
$lien = '<a href="'.DOL_URL_ROOT.'/compta/facture/fiche-rec.php?facid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>';
$link = '<a href="'.DOL_URL_ROOT.'/compta/facture/fiche-rec.php?facid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>';
$picto='bill';
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
return $result;
}

View File

@ -95,10 +95,15 @@ class Facture extends CommonInvoice
var $note;
var $note_private;
var $note_public;
//! 0=draft,
//! 1=validated (need to be paid),
//! 2=classified paid partially (close_code='discount_vat','badcustomer') or completely (close_code=null),
//! 3=classified abandoned and no payment done (close_code='badcustomer','abandon' or 'replaced')
/**
* Check constants for more info:
* - STATUS_DRAFT
* - STATUS_VALIDATED
* - STATUS_PAID
* - STATUS_ABANDONED
* @var int
*/
var $statut;
//! Fermeture apres paiement partiel: discount_vat, badcustomer, abandon
//! Fermeture alors que aucun paiement: replaced (si remplace), abandon
@ -131,7 +136,7 @@ class Facture extends CommonInvoice
var $specimen;
var $fac_rec;
//Incoterms
var $fk_incoterms;
var $location_incoterms;
@ -182,6 +187,39 @@ class Facture extends CommonInvoice
*/
const TYPE_SITUATION = 5;
/**
* Draft
*/
const STATUS_DRAFT = 0;
/**
* Validated (need to be paid)
*/
const STATUS_VALIDATED = 1;
/**
* Classified paid.
* If paid partially, $this->close_code can be:
* - CLOSECODE_DISCOUNTVAT
* - CLOSECODE_BADDEBT
* If paid completelly, this->close_code will be null
*/
const STATUS_CLOSED = 2;
/**
* Classified abandoned and no payment done.
* $this->close_code can be:
* - CLOSECODE_BADDEBT
* - CLOSECODE_ABANDONED
* - CLOSECODE_REPLACED
*/
const STATUS_ABANDONED = 3;
const CLOSECODE_DISCOUNTVAT = 'discount_vat';
const CLOSECODE_BADDEBT = 'badcustomer';
const CLOSECODE_ABANDONED = 'abandon';
const CLOSECODE_REPLACED = 'replaced';
/**
* Constructor
*
@ -521,7 +559,7 @@ class Facture extends CommonInvoice
$action='create';
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('invoicedao'));
$parameters=array('invoiceid'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
@ -680,7 +718,7 @@ class Facture extends CommonInvoice
}
$this->id=0;
$this->statut=0;
$this->statut= self::STATUS_DRAFT;
// Clear fields
$this->date = dol_now(); // Date of invoice is set to current date when cloning. // TODO Best is to ask date into confirm box
@ -1002,10 +1040,10 @@ class Facture extends CommonInvoice
//Incoterms
$this->fk_incoterms = $obj->fk_incoterms;
$this->location_incoterms = $obj->location_incoterms;
$this->location_incoterms = $obj->location_incoterms;
$this->libelle_incoterms = $obj->libelle_incoterms;
if ($this->statut == 0) $this->brouillon = 1;
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
// Retreive all extrafield for invoice
// fetch optionals attributes and labels
@ -1542,7 +1580,7 @@ class Facture extends CommonInvoice
dol_syslog(get_class($this)."::set_paid rowid=".$this->id, LOG_DEBUG);
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture SET';
$sql.= ' fk_statut=2';
$sql.= ' fk_statut='.self::STATUS_CLOSED;
if (! $close_code) $sql.= ', paye=1';
if ($close_code) $sql.= ", close_code='".$this->db->escape($close_code)."'";
if ($close_note) $sql.= ", close_note='".$this->db->escape($close_note)."'";
@ -1597,7 +1635,7 @@ class Facture extends CommonInvoice
$this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
$sql.= ' SET paye=0, fk_statut=1, close_code=null, close_note=null';
$sql.= ' SET paye=0, fk_statut='.self::STATUS_VALIDATED.', close_code=null, close_note=null';
$sql.= ' WHERE rowid = '.$this->id;
dol_syslog(get_class($this)."::set_unpaid", LOG_DEBUG);
@ -1650,7 +1688,7 @@ class Facture extends CommonInvoice
$this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture SET';
$sql.= ' fk_statut=3';
$sql.= ' fk_statut='.self::STATUS_ABANDONED;
if ($close_code) $sql.= ", close_code='".$this->db->escape($close_code)."'";
if ($close_note) $sql.= ", close_note='".$this->db->escape($close_note)."'";
$sql.= ' WHERE rowid = '.$this->id;
@ -1801,7 +1839,7 @@ class Facture extends CommonInvoice
// Validate
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
$sql.= " SET facnumber='".$num."', fk_statut = 1, fk_user_valid = ".$user->id.", date_valid = '".$this->db->idate($now)."'";
$sql.= " SET facnumber='".$num."', fk_statut = ".self::STATUS_VALIDATED.", fk_user_valid = ".$user->id.", date_valid = '".$this->db->idate($now)."'";
if (! empty($conf->global->FAC_FORCE_DATE_VALIDATION)) // If option enabled, we force invoice date
{
$sql.= ", datef='".$this->db->idate($this->date)."'";
@ -1902,7 +1940,7 @@ class Facture extends CommonInvoice
{
$this->ref = $num;
$this->facnumber=$num;
$this->statut=1;
$this->statut= self::STATUS_VALIDATED;
$this->brouillon=0;
$this->date_validation=$now;
$i = 0;
@ -1946,7 +1984,7 @@ class Facture extends CommonInvoice
$error=0;
if ($this->statut == 0)
if ($this->statut == self::STATUS_DRAFT)
{
dol_syslog(get_class($this)."::set_draft already draft status", LOG_WARNING);
return 0;
@ -1955,7 +1993,7 @@ class Facture extends CommonInvoice
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."facture";
$sql.= " SET fk_statut = 0";
$sql.= " SET fk_statut = ".self::STATUS_DRAFT;
$sql.= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::set_draft", LOG_DEBUG);
@ -1986,7 +2024,7 @@ class Facture extends CommonInvoice
{
$old_statut=$this->statut;
$this->brouillon = 1;
$this->statut = 0;
$this->statut = self::STATUS_DRAFT;
// Call trigger
$result=$this->call_trigger('BILL_UNVALIDATE',$user);
if ($result < 0)
@ -2478,7 +2516,7 @@ class Facture extends CommonInvoice
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
$sql.= ' SET remise_percent = '.$remise;
$sql.= ' WHERE rowid = '.$this->id;
$sql.= ' AND fk_statut = 0';
$sql.= ' AND fk_statut = '.self::STATUS_DRAFT;
if ($this->db->query($sql))
{
@ -2513,7 +2551,7 @@ class Facture extends CommonInvoice
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
$sql.= ' SET remise_absolue = '.$remise;
$sql.= ' WHERE rowid = '.$this->id;
$sql.= ' AND fk_statut = 0';
$sql.= ' AND fk_statut = '.self::STATUS_DRAFT;
dol_syslog(get_class($this)."::set_remise_absolue", LOG_DEBUG);
@ -2813,7 +2851,7 @@ class Facture extends CommonInvoice
return $last;
}
}
else if ($this->statut == 0 && $facref == 'PROV') // Si facture brouillon et provisoire
else if ($this->statut == self::STATUS_DRAFT && $facref == 'PROV') // Si facture brouillon et provisoire
{
return 1;
}
@ -2853,7 +2891,7 @@ class Facture extends CommonInvoice
$sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
}
if ($socid) $sql.= " AND s.rowid = ".$socid;
if ($draft) $sql.= " AND f.fk_statut = 0";
if ($draft) $sql.= " AND f.fk_statut = ".self::STATUS_DRAFT;
if (is_object($excluser)) $sql.= " AND f.fk_user_author <> ".$excluser->id;
$sql.= $this->db->order($sortfield,$sortorder);
$sql.= $this->db->plimit($limit,$offset);
@ -2914,7 +2952,7 @@ class Facture extends CommonInvoice
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as ff ON f.rowid = ff.fk_facture_source";
$sql.= " WHERE (f.fk_statut = 1 OR (f.fk_statut = 3 AND f.close_code = 'abandon'))";
$sql.= " WHERE (f.fk_statut = ".self::STATUS_VALIDATED." OR (f.fk_statut = ".self::STATUS_ABANDONED." AND f.close_code = '".self::CLOSECODE_ABANDONED."'))";
$sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND f.paye = 0"; // Pas classee payee completement
$sql.= " AND pf.fk_paiement IS NULL"; // Aucun paiement deja fait
@ -2962,7 +3000,7 @@ class Facture extends CommonInvoice
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as ff ON (f.rowid = ff.fk_facture_source AND ff.type=".self::TYPE_REPLACEMENT.")";
$sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " AND f.fk_statut in (1,2)";
$sql.= " AND f.fk_statut in (".self::STATUS_VALIDATED.",".self::STATUS_CLOSED.")";
// $sql.= " WHERE f.fk_statut >= 1";
// $sql.= " AND (f.paye = 1"; // Classee payee completement
// $sql.= " OR f.close_code IS NOT NULL)"; // Classee payee partiellement
@ -2978,8 +3016,8 @@ class Facture extends CommonInvoice
while ($obj=$this->db->fetch_object($resql))
{
$qualified=0;
if ($obj->fk_statut == 1) $qualified=1;
if ($obj->fk_statut == 2) $qualified=1;
if ($obj->fk_statut == self::STATUS_VALIDATED) $qualified=1;
if ($obj->fk_statut == self::STATUS_CLOSED) $qualified=1;
if ($qualified)
{
//$ref=$obj->facnumber;
@ -3010,7 +3048,7 @@ class Facture extends CommonInvoice
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
if ($this->statut > 0 && $this->paye == 0)
if ($this->statut > self::STATUS_DRAFT && $this->paye == 0)
{
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
$bac = new CompanyBankAccount($this->db);
@ -3143,7 +3181,7 @@ class Facture extends CommonInvoice
}
$sql.= $clause." f.paye=0";
$sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND f.fk_statut = 1";
$sql.= " AND f.fk_statut = ".self::STATUS_VALIDATED;
if ($user->societe_id) $sql.= " AND f.fk_soc = ".$user->societe_id;
$resql=$this->db->query($sql);
@ -3569,7 +3607,7 @@ class Facture extends CommonInvoice
$this->db->commit();
return 1;
} else {
$this->error = $this->db->error();
$this->error = $this->db->lasterror();
dol_syslog(get_class($this) . "::update Error setFinal " . $sql, LOG_ERR);
$this->db->rollback();
return -1;
@ -3592,7 +3630,7 @@ class Facture extends CommonInvoice
$last = $res['max(situation_counter)'];
return ($last == $this->situation_counter);
} else {
$this->error = $this->db->error();
$this->error = $this->db->lasterror();
dol_syslog(get_class($this) . "::select Error " . $this->error, LOG_ERR);
$this->db->rollback();
return -1;
@ -3606,16 +3644,12 @@ class Facture extends CommonInvoice
*/
class FactureLigne extends CommonInvoiceLine
{
var $db;
var $error;
public $element='facturedet';
public $table_element='facturedet';
var $oldline;
//! From llx_facturedet
var $rowid;
//! Id facture
var $fk_facture;
//! Id parent line
@ -3623,17 +3657,9 @@ class FactureLigne extends CommonInvoiceLine
var $label; // deprecated
//! Description ligne
var $desc;
var $fk_product; // Id of predefined product
var $product_type = 0; // Type 0 = product, 1 = Service
var $qty; // Quantity (example 2)
var $tva_tx; // Taux tva produit/service (example 19.6)
var $localtax1_tx; // Local tax 1
var $localtax2_tx; // Local tax 2
var $localtax1_type; // Local tax 1 type
var $localtax2_type; // Local tax 2 type
var $subprice; // P.U. HT (example 100)
var $remise_percent; // % de la remise ligne (example 20%)
var $fk_remise_except; // Link to line into llx_remise_except
var $rang = 0;
@ -3642,10 +3668,6 @@ class FactureLigne extends CommonInvoiceLine
var $marge_tx;
var $marque_tx;
var $info_bits = 0; // Liste d'options cumulables:
// Bit 0: 0 si TVA normal - 1 si TVA NPR
// Bit 1: 0 si ligne normal - 1 si bit discount (link to line into llx_remise_except)
var $special_code; // Liste d'options non cumulabels:
// 1: frais de port
// 2: ecotaxe
@ -3654,15 +3676,6 @@ class FactureLigne extends CommonInvoiceLine
var $origin;
var $origin_id;
//! Total HT de la ligne toute quantite et incluant la remise ligne
var $total_ht;
//! Total TVA de la ligne toute quantite et incluant la remise ligne
var $total_tva;
var $total_localtax1; //Total Local tax 1 de la ligne
var $total_localtax2; //Total Local tax 2 de la ligne
//! Total TTC de la ligne toute quantite et incluant la remise ligne
var $total_ttc;
var $fk_code_ventilation = 0;
var $date_start;
@ -3691,16 +3704,6 @@ class FactureLigne extends CommonInvoiceLine
*/
public $fk_prev_id;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db = $db;
}
/**
* Load invoice line from database
*

View File

@ -523,12 +523,12 @@ else
*/
print '<div class="tabsAction">';
if ($object->statut == 0 && $user->rights->facture->creer)
if ($object->statut == Facture::STATUS_DRAFT && $user->rights->facture->creer)
{
echo '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;socid='.$object->thirdparty->id.'&amp;fac_rec='.$object->id.'">'.$langs->trans("CreateBill").'</a></div>';
}
if ($object->statut == 0 && $user->rights->facture->supprimer)
if ($object->statut == Facture::STATUS_DRAFT && $user->rights->facture->supprimer)
{
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$object->id.'">'.$langs->trans('Delete').'</a></div>';
}

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2014 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) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
@ -24,17 +24,19 @@
*/
/**
* \file htdocs/compta/facture/impayees.php
* \file htdocs/compta/facture/mergepdftool.php
* \ingroup facture
* \brief Page to list and build liste of unpaid invoices
* \brief Page to list and build doc of selected invoices
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
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';
$langs->load("mails");
$langs->load("bills");
@ -44,6 +46,18 @@ $action = GETPOST('action','alpha');
$option = GETPOST('option');
$mode=GETPOST('mode');
$builddoc_generatebutton=GETPOST('builddoc_generatebutton');
$month = GETPOST("month","int");
$year = GETPOST("year","int");
$filter = GETPOST("filtre");
if (GETPOST('button_search'))
{
$filter=GETPOST('filtre',2);
if ($filter != 'payed:0') $option='';
}
if ($option == 'late') $filter = 'paye:0';
if ($option == 'unpaidall') $filter = 'paye:0';
if ($mode == 'sendremind' && $filter == '') $filter = 'paye:0';
if ($filter == '') $filter = 'paye:0';
// Security check
if ($user->societe_id) $socid=$user->societe_id;
@ -54,6 +68,20 @@ if (! $user->rights->societe->client->voir || $socid) $diroutputpdf.='/private/'
$resultmasssend='';
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers
{
$search_ref="";
$search_ref_supplier="";
$search_label="";
$search_company="";
$search_amount_no_tax="";
$search_amount_all_tax="";
$year="";
$month="";
$filter="";
}
/*
* Action
@ -95,7 +123,7 @@ if ($action == 'presend' && GETPOST('sendmail'))
if ($result > 0) // Invoice was found
{
if ($object->statut != 1)
if ($object->statut != Facture::STATUS_VALIDATED)
{
continue; // Payment done or started or canceled
}
@ -297,8 +325,14 @@ if ($action == "builddoc" && $user->rights->facture->lire && ! GETPOST('button_s
dol_mkdir($diroutputpdf);
// Save merged file
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities("Invoices")));
if ($filter=='paye:0')
{
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
}
if ($year) $filename.='_'.$year;
if ($month) $filename.='_'.$month;
if ($pagecount)
{
$now=dol_now();
@ -306,6 +340,9 @@ if ($action == "builddoc" && $user->rights->facture->lire && ! GETPOST('button_s
$pdf->Output($file,'F');
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
$langs->load("exports");
setEventMessage($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')));
}
else
{
@ -340,9 +377,9 @@ if ($action == 'remove_file')
$form = new Form($db);
$formfile = new FormFile($db);
$formother = new FormOther($db);
$title=$langs->trans("BillsCustomersUnpaid");
if ($option=='late') $title=$langs->trans("BillsCustomersUnpaid");
$title=$langs->trans("MergingPDFTool");
llxHeader('',$title);
@ -410,14 +447,15 @@ $sql.= ",".MAIN_DB_PREFIX."facture as f";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture ";
$sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND f.type IN (0,1,3,5) AND f.fk_statut = 1";
$sql.= " AND f.paye = 0";
$sql.= " AND f.type IN (0,1,3,5)";
if ($filter == 'paye:0') $sql.= " AND f.fk_statut = 1";
//$sql.= " AND f.paye = 0";
if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if (! empty($socid)) $sql .= " AND s.rowid = ".$socid;
if (GETPOST('filtre'))
if ($filter && $filter != -1) // GETPOST('filtre') may be a string
{
$filtrearr = explode(",", GETPOST('filtre'));
$filtrearr = explode(",", $filter);
foreach ($filtrearr as $fil)
{
$filt = explode(":", $fil);
@ -427,10 +465,21 @@ if (GETPOST('filtre'))
if ($search_ref) $sql .= " AND f.facnumber LIKE '%".$db->escape($search_ref)."%'";
if ($search_refcustomer) $sql .= " AND f.ref_client LIKE '%".$db->escape($search_refcustomer)."%'";
if ($search_societe) $sql .= " AND s.nom LIKE '%".$db->escape($search_societe)."%'";
if ($search_paymentmode) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode."";
if ($search_paymentmode) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode."";
if ($search_montant_ht) $sql .= " AND f.total = '".$db->escape($search_montant_ht)."'";
if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$db->escape($search_montant_ttc)."'";
if (GETPOST('sf_ref')) $sql .= " AND f.facnumber LIKE '%".$db->escape(GETPOST('sf_ref'))."%'";
if ($month > 0)
{
if ($year > 0)
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
else
$sql.= " AND date_format(f.datef, '%m') = '$month'";
}
else if ($year > 0)
{
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
}
$sql.= " GROUP BY s.nom, s.rowid, s.email, f.rowid, f.facnumber, f.ref_client, f.increment, f.total, f.tva, f.total_ttc, f.localtax1, f.localtax2, f.revenuestamp,";
$sql.= " f.datef, f.date_lim_reglement, f.paye, f.fk_statut, f.type, fk_mode_reglement";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user ";
@ -438,7 +487,7 @@ $sql.= " ORDER BY ";
$listfield=explode(',',$sortfield);
foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.",";
$sql.= " f.facnumber DESC";
//print $sql;
//$sql .= $db->plimit($limit+1,$offset);
$resql = $db->query($sql);
@ -454,25 +503,28 @@ if ($resql)
$param="";
$param.=(! empty($socid)?"&amp;socid=".$socid:"");
$param.=(! empty($option)?"&amp;option=".$option:"");
if ($search_ref) $param.='&amp;search_ref='.urlencode($search_ref);
if ($search_refcustomer) $param.='&amp;search_ref='.urlencode($search_refcustomer);
if ($search_refcustomer) $param.='&amp;search_ref='.urlencode($search_refcustomer);
if ($search_societe) $param.='&amp;search_societe='.urlencode($search_societe);
if ($search_societe) $param.='&amp;search_paymentmode='.urlencode($search_paymentmode);
if ($search_montant_ht) $param.='&amp;search_montant_ht='.urlencode($search_montant_ht);
if ($search_montant_ttc) $param.='&amp;search_montant_ttc='.urlencode($search_montant_ttc);
if ($late) $param.='&amp;late='.urlencode($late);
if ($mode) $param.='&amp;mode='.urlencode($mode);
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);
$titre=(! empty($socid)?$langs->trans("BillsCustomersUnpaidForCompany",$soc->name):$langs->trans("BillsCustomersUnpaid"));
//$titre=(! empty($socid)?$langs->trans("BillsCustomersUnpaidForCompany",$soc->name):$langs->trans("BillsCustomersUnpaid"));
$titre=(! empty($socid)?$langs->trans("BillsCustomersForCompany",$soc->name):$langs->trans("BillsCustomers"));
if ($option == 'late') $titre.=' ('.$langs->trans("Late").')';
else $titre.=' ('.$langs->trans("All").')';
//else $titre.=' ('.$langs->trans("All").')';
$link='';
if (empty($option)) $link='<a href="'.$_SERVER["PHP_SELF"].'?option=late">'.$langs->trans("ShowUnpaidLateOnly").'</a>';
elseif ($option == 'late') $link='<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("ShowUnpaidAll").'</a>';
if (empty($option) || $option == 'late') $link.=($link?' - ':'').'<a href="'.$_SERVER["PHP_SELF"].'?option=unpaidall'.$param.'">'.$langs->trans("ShowUnpaidAll").'</a>';
if (empty($option) || $option == 'unpaidall') $link.=($link?' - ':'').'<a href="'.$_SERVER["PHP_SELF"].'?option=late'.$param.'">'.$langs->trans("ShowUnpaidLateOnly").'</a>';
$param.=(! empty($option)?"&amp;option=".$option:"");
print_fiche_titre($titre,$link);
//print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',0); // We don't want pagination on this page
@ -574,7 +626,11 @@ if ($resql)
print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_refcustomer" value="'.$search_refcustomer.'">';
print '</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="center">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
$syear = $year;
$formother->select_year($syear?$syear:-1,'year',1, 20, 5);
print '</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="10" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre" align="left">';
@ -586,21 +642,22 @@ if ($resql)
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right">';
$liststatus=array('paye:0'=>$langs->trans("Unpaid"), 'paye:1'=>$langs->trans("Paid"));
print $form->selectarray('filtre', $liststatus, $filter, 1);
print '</td>';
print '<td class="liste_titre" align="center">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print '<br>';
if (empty($mode))
{
print '<td class="liste_titre" align="center">';
if ($conf->use_javascript_ajax) print '<a href="#" id="checkall">'.$langs->trans("All").'</a> / <a href="#" id="checknone">'.$langs->trans("None").'</a>';
print '</td>';
}
else
{
print '<td class="liste_titre" align="center">';
if ($conf->use_javascript_ajax) print '<a href="#" id="checkallsend">'.$langs->trans("All").'</a> / <a href="#" id="checknonesend">'.$langs->trans("None").'</a>';
print '</td>';
}
print '</td>';
print "</tr>\n";
if ($num > 0)

View File

@ -229,15 +229,15 @@ if ($object->id > 0)
print '. ';
if ($absolute_discount > 0)
{
if ($object->statut > 0 || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT)
if ($object->statut > Facture::STATUS_DRAFT || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT)
{
if ($object->statut == 0)
if ($object->statut == Facture::STATUS_DRAFT)
{
print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)).'. ';
}
else
{
if ($object->statut < 1 || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT)
if ($object->statut < Facture::STATUS_VALIDATED || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT)
{
$text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
print '<br>'.$text.'.<br>';
@ -261,9 +261,9 @@ if ($object->id > 0)
if ($absolute_creditnote > 0)
{
// If validated, we show link "add credit note to payment"
if ($object->statut != 1 || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_CREDIT_NOTE)
if ($object->statut != Facture::STATUS_VALIDATED || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_CREDIT_NOTE)
{
if ($object->statut == 0 && $object->type != Facture::TYPE_DEPOSIT)
if ($object->statut == Facture::STATUS_DRAFT && $object->type != Facture::TYPE_DEPOSIT)
{
$text=$langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency));
print $form->textwithpicto($text,$langs->trans("CreditNoteDepositUse"));
@ -350,7 +350,7 @@ if ($object->id > 0)
else
{
print dol_print_date($object->date_lim_reglement,'daytext');
if ($object->date_lim_reglement < ($now - $conf->facture->client->warning_delay) && ! $object->paye && $object->statut == 1 && ! isset($object->am)) print img_warning($langs->trans('Late'));
if ($object->date_lim_reglement < ($now - $conf->facture->client->warning_delay) && ! $object->paye && $object->statut == Facture::STATUS_VALIDATED && ! isset($object->am)) print img_warning($langs->trans('Late'));
}
}
else
@ -473,7 +473,7 @@ if ($object->id > 0)
print "\n<div class=\"tabsAction\">\n";
// Add a withdraw request
if ($object->statut > 0 && $object->paye == 0 && $num == 0)
if ($object->statut > Facture::STATUS_DRAFT && $object->paye == 0 && $num == 0)
{
if ($user->rights->prelevement->bons->creer)
{
@ -488,7 +488,7 @@ if ($object->id > 0)
{
if ($num == 0)
{
if ($object->statut > 0) print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("AlreadyPayed")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
if ($object->statut > Facture::STATUS_DRAFT) print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("AlreadyPayed")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
else print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("Draft")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
}
else print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("RequestAlreadyDone")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';

View File

@ -30,8 +30,7 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
$langs->load("bills");
echo '<br>';
if ($num > 1) print_titre($langs->trans("RelatedBills"));
else print_titre($langs->trans("RelatedBill"));
print_titre($langs->trans("RelatedCustomerInvoices"));
?>
<table class="noborder allwidth">
<tr class="liste_titre">

View File

@ -127,7 +127,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire)
if (! empty($conf->don->enabled) && $user->rights->don->lire)
{
$langs->load("donations");
print '<form method="post" action="'.DOL_URL_ROOT.'/compta/dons/list.php">';
print '<form method="post" action="'.DOL_URL_ROOT.'/don/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchADonation").'</td></tr>';
@ -497,7 +497,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
// Last donations
if (! empty($conf->don->enabled) && $user->rights->societe->lire)
{
include_once DOL_DOCUMENT_ROOT.'/compta/dons/class/don.class.php';
include_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
$langs->load("boxes");
$donationstatic=new Don($db);

View File

@ -109,13 +109,21 @@ class Localtax extends CommonObject
if ($result < 0) $error++;
// End call triggers
//FIXME: Add rollback if trigger fail
return $this->id;
if (! $error)
{
$this->db->commit();
return $this->id;
}
else
{
$this->db->rollback();
return -1;
}
}
else
{
{
$this->error="Error ".$this->db->lasterror();
$this->db->rollback();
return -1;
}
}
@ -141,7 +149,9 @@ class Localtax extends CommonObject
$this->fk_user_creat=trim($this->fk_user_creat);
$this->fk_user_modif=trim($this->fk_user_modif);
// Update request
$this->db->begin();
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."localtax SET";
$sql.= " localtaxtype=".$this->ltt.",";
$sql.= " tms=".$this->db->idate($this->tms).",";
@ -160,20 +170,27 @@ class Localtax extends CommonObject
if (! $resql)
{
$this->error="Error ".$this->db->lasterror();
return -1;
$error++;
}
if (! $notrigger)
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('LOCALTAX_MODIFY',$user);
if ($result < 0) $error++;
// End call triggers
//FIXME: Add rollback if trigger fail
}
return 1;
if (! $error)
{
$this->db->commit();
return 1;
}
else
{
$this->db->rollback();
return -1;
}
}
@ -582,14 +599,14 @@ class Localtax extends CommonObject
$result='';
$label=$langs->trans("ShowVatPayment").': '.$this->ref;
$lien = '<a href="'.DOL_URL_ROOT.'/compta/localtax/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>';
$link = '<a href="'.DOL_URL_ROOT.'/compta/localtax/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>';
$picto='payment';
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
return $result;
}

View File

@ -768,9 +768,9 @@ class RemiseCheque extends CommonObject
}
/**
* Renvoie nom clicable (avec eventuellement le picto)
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param string $option Sur quoi pointe le lien
* @return string Chaine avec URL
*/
@ -781,12 +781,12 @@ class RemiseCheque extends CommonObject
$result='';
$label = $langs->trans("ShowCheckReceipt").': '.$this->ref;
$lien = '<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>';
$link = '<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>';
if ($withpicto) $result.=($lien.img_object($label, 'payment', 'class="classfortooltip"').$lienfin);
if ($withpicto) $result.=($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
return $result;
}

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