Merge branch 'develop' into commercial-name
Conflicts: htdocs/comm/card.php
This commit is contained in:
commit
8b8171c700
19
.travis.yml
19
.travis.yml
@ -104,16 +104,15 @@ before_script:
|
|||||||
script:
|
script:
|
||||||
- cd htdocs/install
|
- cd htdocs/install
|
||||||
- date
|
- date
|
||||||
# - php upgrade.php 3.4.0 3.5.0 > upgrade.log
|
# - php upgrade.php 3.4.0 3.5.0 ignoredbversion > upgrade340350.log
|
||||||
# - php upgrade2.php 3.4.0 3.5.0 > upgrade2.log
|
# - php upgrade2.php 3.4.0 3.5.0 ignoredbversion > upgrade340350-2.log
|
||||||
- php upgrade.php 3.5.0 3.6.0 >> upgrade.log
|
- php upgrade.php 3.5.0 3.6.0 ignoredbversion > upgrade350360.log
|
||||||
- php upgrade2.php 3.5.0 3.6.0 >> upgrade2.log
|
- php upgrade2.php 3.5.0 3.6.0 ignoredbversion > upgrade350360-2.log
|
||||||
- php upgrade.php 3.6.0 3.7.0 >> upgrade.log
|
- php upgrade.php 3.6.0 3.7.0 ignoredbversion > upgrade360370.log
|
||||||
# - cat upgrade360370.log
|
- php upgrade2.php 3.6.0 3.7.0 ignoredbversion > upgrade360370-2.log
|
||||||
- php upgrade2.php 3.6.0 3.7.0 >> upgrade2.log
|
- php upgrade.php 3.7.0 3.8.0 ignoredbversion > upgrade370380.log
|
||||||
- php upgrade.php 3.7.0 3.8.0 >> upgrade.log
|
- php upgrade2.php 3.7.0 3.8.0 ignoredbversion > upgrade370380-2.log
|
||||||
- php upgrade2.php 3.7.0 3.8.0 >> upgrade2.log
|
# - cat upgrade370380-2.log
|
||||||
# - cat upgrade2.log
|
|
||||||
- cd ../..
|
- cd ../..
|
||||||
- date
|
- date
|
||||||
- phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
- phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||||
|
|||||||
14
.tx/config
14
.tx/config
@ -1,6 +1,6 @@
|
|||||||
[main]
|
[main]
|
||||||
host = https://www.transifex.com
|
host = https://www.transifex.com
|
||||||
lang_map = uz: uz_UZ
|
lang_map = uz: uz_UZ, sw: sw_SW
|
||||||
|
|
||||||
[dolibarr.accountancy]
|
[dolibarr.accountancy]
|
||||||
file_filter = htdocs/langs/<lang>/accountancy.lang
|
file_filter = htdocs/langs/<lang>/accountancy.lang
|
||||||
@ -146,6 +146,12 @@ source_file = htdocs/langs/en_US/holiday.lang
|
|||||||
source_lang = en_US
|
source_lang = en_US
|
||||||
type = MOZILLAPROPERTIES
|
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]
|
[dolibarr.install]
|
||||||
file_filter = htdocs/langs/<lang>/install.lang
|
file_filter = htdocs/langs/<lang>/install.lang
|
||||||
source_file = htdocs/langs/en_US/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
|
source_lang = en_US
|
||||||
type = MOZILLAPROPERTIES
|
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]
|
[dolibarr.mailmanspip]
|
||||||
file_filter = htdocs/langs/<lang>/mailmanspip.lang
|
file_filter = htdocs/langs/<lang>/mailmanspip.lang
|
||||||
source_file = htdocs/langs/en_US/mailmanspip.lang
|
source_file = htdocs/langs/en_US/mailmanspip.lang
|
||||||
|
|||||||
@ -3,28 +3,30 @@ How to contribute to Dolibarr
|
|||||||
|
|
||||||
Bug reports and feature requests
|
Bug reports and feature requests
|
||||||
--------------------------------
|
--------------------------------
|
||||||
Issues are tracked at [Doliforge](https://doliforge.org/projects/dolibarr)
|
** NEW **
|
||||||
|
|
||||||
*You need to create an account before being able to use the "Bugs & Tasks" feature.*
|
Issues are now managed on [GitHub](https://github.com/Dolibarr/dolibarr/Issues).
|
||||||
|
|
||||||
1. Use the search engine to check if nobody's already reported your problem.
|
1. Please [use the search engine](https://help.github.com/articles/searching-issues) to check if nobody's already reported your problem.
|
||||||
2. Choose the right section. (Bugs or Task and Feature Request).
|
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).
|
3. Report with as much detail as possible ([Use screenshots or even screencasts whenever possible](https://help.github.com/articles/issue-attachments)).
|
||||||
|
|
||||||
Code
|
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
|
### 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.
|
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.
|
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
|
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.
|
against the oldest version affected that's still supported.
|
||||||
@ -40,23 +42,36 @@ Please don't edit the ChangeLog file. A project manager will update it from your
|
|||||||
Use clear commit messages with the following structure:
|
Use clear commit messages with the following structure:
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
KEYWORD Short description
|
KEYWORD Short description (may be the bug number #456)
|
||||||
|
|
||||||
Long description (Can span accross multiple lines).
|
Long description (Can span accross multiple lines).
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
Where KEYWORD is one of:
|
Where KEYWORD is one of:
|
||||||
|
|
||||||
- "FIXED:" for bug fixes. In upper case to appear into ChangeLog. (May be followed by the bug number i.e: #456)
|
- "Fixed" for bug fixes (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)
|
- "Closed" for a commit to close a feature request issue (May be followed by the bug number i.e: #456)
|
||||||
- void, don't put a keyword if the commit is not introducing feature or closing a bug.
|
- void, don't put a keyword if the commit is not introducing feature or closing a bug.
|
||||||
|
|
||||||
|
### Pull Requests
|
||||||
|
When submitting a pull request, use following syntax:
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
KEYWORD Short description (may be the bug number #456)
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
Where KEYWORD is one of:
|
||||||
|
|
||||||
|
- "FIXED" or "Fixed" for bug fixes. In upper case to appear into ChangeLog. (May be followed by the bug number i.e: #456)
|
||||||
|
- "NEW" or "New" for new features. In upper case to appear into ChangeLog. (May be followed by the task number i.e: #123)
|
||||||
|
|
||||||
|
|
||||||
### Resources
|
### Resources
|
||||||
[Developer documentation](http://wiki.dolibarr.org/index.php/Developer_documentation)
|
[Developer documentation](http://wiki.dolibarr.org/index.php/Developer_documentation)
|
||||||
|
|
||||||
Translations
|
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).
|
All other translations are managed online at [Transifex](https://www.transifex.com/projects/p/dolibarr).
|
||||||
|
|
||||||
|
|||||||
10
ChangeLog
10
ChangeLog
@ -2,6 +2,13 @@
|
|||||||
English Dolibarr ChangeLog
|
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.* *****
|
***** ChangeLog for 3.8 compared to 3.7.* *****
|
||||||
For users:
|
For users:
|
||||||
- New: Add Option to not change date on cloning project
|
- 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:
|
Dolibarr better:
|
||||||
- Removed hoo supplierorderdao into supplier order creation. This is a business event, so we must use the
|
- Removed hoo supplierorderdao into supplier order creation. This is a business event, so we must use the
|
||||||
trigger ORDER_SUPPLIER_CREATE instead.
|
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.* *****
|
***** ChangeLog for 3.7 compared to 3.6.* *****
|
||||||
|
|||||||
@ -172,6 +172,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/contrat
|
%_datadir/dolibarr/htdocs/contrat
|
||||||
%_datadir/dolibarr/htdocs/core
|
%_datadir/dolibarr/htdocs/core
|
||||||
%_datadir/dolibarr/htdocs/cron
|
%_datadir/dolibarr/htdocs/cron
|
||||||
|
%_datadir/dolibarr/htdocs/don
|
||||||
%_datadir/dolibarr/htdocs/ecm
|
%_datadir/dolibarr/htdocs/ecm
|
||||||
%_datadir/dolibarr/htdocs/expedition
|
%_datadir/dolibarr/htdocs/expedition
|
||||||
%_datadir/dolibarr/htdocs/expensereport
|
%_datadir/dolibarr/htdocs/expensereport
|
||||||
@ -186,6 +187,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/install
|
%_datadir/dolibarr/htdocs/install
|
||||||
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
||||||
%_datadir/dolibarr/htdocs/livraison
|
%_datadir/dolibarr/htdocs/livraison
|
||||||
|
%_datadir/dolibarr/htdocs/loan
|
||||||
%_datadir/dolibarr/htdocs/mailmanspip
|
%_datadir/dolibarr/htdocs/mailmanspip
|
||||||
%_datadir/dolibarr/htdocs/margin
|
%_datadir/dolibarr/htdocs/margin
|
||||||
%_datadir/dolibarr/htdocs/opensurvey
|
%_datadir/dolibarr/htdocs/opensurvey
|
||||||
|
|||||||
@ -252,6 +252,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/contrat
|
%_datadir/dolibarr/htdocs/contrat
|
||||||
%_datadir/dolibarr/htdocs/core
|
%_datadir/dolibarr/htdocs/core
|
||||||
%_datadir/dolibarr/htdocs/cron
|
%_datadir/dolibarr/htdocs/cron
|
||||||
|
%_datadir/dolibarr/htdocs/don
|
||||||
%_datadir/dolibarr/htdocs/ecm
|
%_datadir/dolibarr/htdocs/ecm
|
||||||
%_datadir/dolibarr/htdocs/expedition
|
%_datadir/dolibarr/htdocs/expedition
|
||||||
%_datadir/dolibarr/htdocs/expensereport
|
%_datadir/dolibarr/htdocs/expensereport
|
||||||
@ -266,6 +267,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/install
|
%_datadir/dolibarr/htdocs/install
|
||||||
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
||||||
%_datadir/dolibarr/htdocs/livraison
|
%_datadir/dolibarr/htdocs/livraison
|
||||||
|
%_datadir/dolibarr/htdocs/loan
|
||||||
%_datadir/dolibarr/htdocs/mailmanspip
|
%_datadir/dolibarr/htdocs/mailmanspip
|
||||||
%_datadir/dolibarr/htdocs/margin
|
%_datadir/dolibarr/htdocs/margin
|
||||||
%_datadir/dolibarr/htdocs/opensurvey
|
%_datadir/dolibarr/htdocs/opensurvey
|
||||||
|
|||||||
@ -169,6 +169,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/contrat
|
%_datadir/dolibarr/htdocs/contrat
|
||||||
%_datadir/dolibarr/htdocs/core
|
%_datadir/dolibarr/htdocs/core
|
||||||
%_datadir/dolibarr/htdocs/cron
|
%_datadir/dolibarr/htdocs/cron
|
||||||
|
%_datadir/dolibarr/htdocs/don
|
||||||
%_datadir/dolibarr/htdocs/ecm
|
%_datadir/dolibarr/htdocs/ecm
|
||||||
%_datadir/dolibarr/htdocs/expedition
|
%_datadir/dolibarr/htdocs/expedition
|
||||||
%_datadir/dolibarr/htdocs/expensereport
|
%_datadir/dolibarr/htdocs/expensereport
|
||||||
@ -183,6 +184,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/install
|
%_datadir/dolibarr/htdocs/install
|
||||||
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
||||||
%_datadir/dolibarr/htdocs/livraison
|
%_datadir/dolibarr/htdocs/livraison
|
||||||
|
%_datadir/dolibarr/htdocs/loan
|
||||||
%_datadir/dolibarr/htdocs/mailmanspip
|
%_datadir/dolibarr/htdocs/mailmanspip
|
||||||
%_datadir/dolibarr/htdocs/margin
|
%_datadir/dolibarr/htdocs/margin
|
||||||
%_datadir/dolibarr/htdocs/opensurvey
|
%_datadir/dolibarr/htdocs/opensurvey
|
||||||
|
|||||||
@ -180,6 +180,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/contrat
|
%_datadir/dolibarr/htdocs/contrat
|
||||||
%_datadir/dolibarr/htdocs/core
|
%_datadir/dolibarr/htdocs/core
|
||||||
%_datadir/dolibarr/htdocs/cron
|
%_datadir/dolibarr/htdocs/cron
|
||||||
|
%_datadir/dolibarr/htdocs/don
|
||||||
%_datadir/dolibarr/htdocs/ecm
|
%_datadir/dolibarr/htdocs/ecm
|
||||||
%_datadir/dolibarr/htdocs/expedition
|
%_datadir/dolibarr/htdocs/expedition
|
||||||
%_datadir/dolibarr/htdocs/expensereport
|
%_datadir/dolibarr/htdocs/expensereport
|
||||||
@ -194,6 +195,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/install
|
%_datadir/dolibarr/htdocs/install
|
||||||
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
||||||
%_datadir/dolibarr/htdocs/livraison
|
%_datadir/dolibarr/htdocs/livraison
|
||||||
|
%_datadir/dolibarr/htdocs/loan
|
||||||
%_datadir/dolibarr/htdocs/mailmanspip
|
%_datadir/dolibarr/htdocs/mailmanspip
|
||||||
%_datadir/dolibarr/htdocs/margin
|
%_datadir/dolibarr/htdocs/margin
|
||||||
%_datadir/dolibarr/htdocs/opensurvey
|
%_datadir/dolibarr/htdocs/opensurvey
|
||||||
|
|||||||
@ -32,13 +32,18 @@ then
|
|||||||
for dir in `find htdocs/langs/$3* -type d`
|
for dir in `find htdocs/langs/$3* -type d`
|
||||||
do
|
do
|
||||||
dirshort=`basename $dir`
|
dirshort=`basename $dir`
|
||||||
|
|
||||||
#echo $dirshort
|
#echo $dirshort
|
||||||
|
|
||||||
export aa=`echo $dirshort | nawk -F"_" '{ print $1 }'`
|
export aa=`echo $dirshort | nawk -F"_" '{ print $1 }'`
|
||||||
export bb=`echo $dirshort | nawk -F"_" '{ print $2 }'`
|
export bb=`echo $dirshort | nawk -F"_" '{ print $2 }'`
|
||||||
aaupper=`echo $dirshort | nawk -F"_" '{ print toupper($1) }'`
|
aaupper=`echo $dirshort | nawk -F"_" '{ print toupper($1) }'`
|
||||||
|
if [ $aaupper = "EN" ]
|
||||||
|
then
|
||||||
|
aaupper="US"
|
||||||
|
fi
|
||||||
bblower=`echo $dirshort | nawk -F"_" '{ print tolower($2) }'`
|
bblower=`echo $dirshort | nawk -F"_" '{ print tolower($2) }'`
|
||||||
if [ "$aa" != "$bblower" ]
|
if [ "$aa" != "$bblower" -a "$dirshort" != "en_US" ]
|
||||||
then
|
then
|
||||||
reflang="htdocs/langs/"$aa"_"$aaupper
|
reflang="htdocs/langs/"$aa"_"$aaupper
|
||||||
if [ -d $reflang ]
|
if [ -d $reflang ]
|
||||||
@ -48,6 +53,15 @@ then
|
|||||||
echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
|
echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
|
||||||
./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}/*.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
|
||||||
fi
|
fi
|
||||||
done;
|
done;
|
||||||
|
|||||||
@ -174,7 +174,7 @@ $targetcontent=$sourcecontent;
|
|||||||
// Substitute class name
|
// Substitute class name
|
||||||
$targetcontent=preg_replace('/skeleton_class\.class\.php/', $classmin.'.class.php', $targetcontent);
|
$targetcontent=preg_replace('/skeleton_class\.class\.php/', $classmin.'.class.php', $targetcontent);
|
||||||
$targetcontent=preg_replace('/\$element=\'skeleton\'/', '\$element=\''.$classmin.'\'', $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);
|
$targetcontent=preg_replace('/Skeleton_Class/', $classname, $targetcontent);
|
||||||
|
|
||||||
// Substitute comments
|
// Substitute comments
|
||||||
@ -252,7 +252,13 @@ foreach($property as $key => $prop)
|
|||||||
if ($addfield)
|
if ($addfield)
|
||||||
{
|
{
|
||||||
$varprop.="\t\t\$sql.= \" ";
|
$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.='".(! isset($this->'.$prop['field'].') || dol_strlen($this->'.$prop['field'].')==0?\'NULL\':"\'".$this->db->idate(';
|
||||||
$varprop.="\$this->".$prop['field']."";
|
$varprop.="\$this->".$prop['field']."";
|
||||||
@ -268,6 +274,12 @@ foreach($property as $key => $prop)
|
|||||||
if ($i < count($property)) $varprop.=",";
|
if ($i < count($property)) $varprop.=",";
|
||||||
$varprop.='";';
|
$varprop.='";';
|
||||||
}
|
}
|
||||||
|
elseif ($prop['field']=='fk_user_mod' || $prop['field']=='fk_user_author')
|
||||||
|
{
|
||||||
|
$varprop.='".$user->id."';
|
||||||
|
if ($i < count($property)) $varprop.=",";
|
||||||
|
$varprop.='";';
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$varprop.='".(! isset($this->'.$prop['field'].')?\'NULL\':"\'".';
|
$varprop.='".(! isset($this->'.$prop['field'].')?\'NULL\':"\'".';
|
||||||
@ -289,11 +301,17 @@ $i=0;
|
|||||||
foreach($property as $key => $prop)
|
foreach($property as $key => $prop)
|
||||||
{
|
{
|
||||||
$i++;
|
$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.="\t\t\$sql.= \" ";
|
||||||
$varprop.=$prop['field'].'=';
|
$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')
|
// (dol_strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null')
|
||||||
$varprop.='".(dol_strlen($this->'.$prop['field'].')!=0 ? "\'".$this->db->idate(';
|
$varprop.='".(dol_strlen($this->'.$prop['field'].')!=0 ? "\'".$this->db->idate(';
|
||||||
@ -301,6 +319,9 @@ foreach($property as $key => $prop)
|
|||||||
$varprop.=')."\'" : \'null\').';
|
$varprop.=')."\'" : \'null\').';
|
||||||
$varprop.='"';
|
$varprop.='"';
|
||||||
}
|
}
|
||||||
|
elseif ($prop['field']=='fk_user_mod') {
|
||||||
|
$varprop.='".$user->id."';
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$varprop.="\".";
|
$varprop.="\".";
|
||||||
@ -325,6 +346,7 @@ $targetcontent=preg_replace('/\$sql\.= " t\.field2";/', '', $targetcontent);
|
|||||||
|
|
||||||
// Substitute select set parameters
|
// Substitute select set parameters
|
||||||
$varprop="\n";
|
$varprop="\n";
|
||||||
|
$varpropline="\n";
|
||||||
$cleanparam='';
|
$cleanparam='';
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach($property as $key => $prop)
|
foreach($property as $key => $prop)
|
||||||
@ -338,11 +360,22 @@ foreach($property as $key => $prop)
|
|||||||
if ($prop['istime']) $varprop.=')';
|
if ($prop['istime']) $varprop.=')';
|
||||||
$varprop.=";";
|
$varprop.=";";
|
||||||
$varprop.="\n";
|
$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->prop1 = \$obj->field1;/', $varprop, $targetcontent);
|
||||||
$targetcontent=preg_replace('/\$this->prop2 = \$obj->field2;/', '', $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
|
// Substitute initasspecimen parameters
|
||||||
$varprop="\n";
|
$varprop="\n";
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 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---
|
* Copyright (C) ---Put here your own copyright and developer email---
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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 $element='skeleton'; //!< Id that identify managed objects
|
||||||
var $table_element='skeleton'; //!< Name of table without prefix where object is stored
|
var $table_element='skeleton'; //!< Name of table without prefix where object is stored
|
||||||
|
|
||||||
|
var $lines=array();
|
||||||
|
|
||||||
var $id;
|
var $id;
|
||||||
var $prop1;
|
var $prop1;
|
||||||
var $prop2;
|
var $prop2;
|
||||||
@ -103,11 +106,11 @@ class Skeleton_Class extends CommonObject
|
|||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Uncomment this and change MYOBJECT to your own tag if you
|
// 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
|
//// Call triggers
|
||||||
//$result=$this->call_trigger('MYOBJECT_CREATE',$user);
|
//$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
|
//// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,11 +118,6 @@ class Skeleton_Class extends CommonObject
|
|||||||
// Commit or rollback
|
// Commit or rollback
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
foreach($this->errors as $errmsg)
|
|
||||||
{
|
|
||||||
dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
|
|
||||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
|
||||||
}
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1*$error;
|
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
|
* Update object into database
|
||||||
@ -368,3 +429,10 @@ class Skeleton_Class extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Skeleton_ClassLine
|
||||||
|
{
|
||||||
|
var $id;
|
||||||
|
var $prop1;
|
||||||
|
var $prop2;
|
||||||
|
}
|
||||||
|
|||||||
@ -60,6 +60,7 @@ $rc = 0;
|
|||||||
|
|
||||||
$lPrimary = isset($argv[1])?$argv[1]:'';
|
$lPrimary = isset($argv[1])?$argv[1]:'';
|
||||||
$lSecondary = isset($argv[2])?$argv[2]:'';
|
$lSecondary = isset($argv[2])?$argv[2]:'';
|
||||||
|
$lEnglish = 'en_US';
|
||||||
$filesToProcess = isset($argv[3])?$argv[3]:'';
|
$filesToProcess = isset($argv[3])?$argv[3]:'';
|
||||||
|
|
||||||
if (empty($lPrimary) || empty($lSecondary) || empty($filesToProcess))
|
if (empty($lPrimary) || empty($lSecondary) || empty($filesToProcess))
|
||||||
@ -73,6 +74,7 @@ if (empty($lPrimary) || empty($lSecondary) || empty($filesToProcess))
|
|||||||
|
|
||||||
$aPrimary = array();
|
$aPrimary = array();
|
||||||
$aSecondary = array();
|
$aSecondary = array();
|
||||||
|
$aEnglish = array();
|
||||||
|
|
||||||
// Define array $filesToProcess
|
// Define array $filesToProcess
|
||||||
if ($filesToProcess == 'all')
|
if ($filesToProcess == 'all')
|
||||||
@ -96,6 +98,7 @@ foreach($filesToProcess as $fileToProcess)
|
|||||||
{
|
{
|
||||||
$lPrimaryFile = 'htdocs/langs/'.$lPrimary.'/'.$fileToProcess;
|
$lPrimaryFile = 'htdocs/langs/'.$lPrimary.'/'.$fileToProcess;
|
||||||
$lSecondaryFile = 'htdocs/langs/'.$lSecondary.'/'.$fileToProcess;
|
$lSecondaryFile = 'htdocs/langs/'.$lSecondary.'/'.$fileToProcess;
|
||||||
|
$lEnglishFile = 'htdocs/langs/'.$lEnglish.'/'.$fileToProcess;
|
||||||
$output = $lSecondaryFile . '.delta';
|
$output = $lSecondaryFile . '.delta';
|
||||||
|
|
||||||
print "---- Process language file ".$lSecondaryFile."\n";
|
print "---- Process language file ".$lSecondaryFile."\n";
|
||||||
@ -114,6 +117,13 @@ foreach($filesToProcess as $fileToProcess)
|
|||||||
continue;
|
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
|
// Start reading and parsing Secondary
|
||||||
|
|
||||||
if ( $handle = fopen($lSecondaryFile, 'r') )
|
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!
|
// Start reading and parsing Primary. See rules in header!
|
||||||
|
|
||||||
$arrayofkeytoalwayskeep=array('DIRECTION','FONTFORPDF','FONTSIZEFORPDF','SeparatorDecimal','SeparatorThousand');
|
$arrayofkeytoalwayskeep=array('DIRECTION','FONTFORPDF','FONTSIZEFORPDF','SeparatorDecimal','SeparatorThousand');
|
||||||
@ -246,7 +315,11 @@ foreach($filesToProcess as $fileToProcess)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// String exists in both files and does not match
|
// 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";
|
//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");
|
fwrite($oh, $key."=".(empty($aSecondary[$key])?$aPrimary[$key]:$aSecondary[$key])."\n");
|
||||||
|
|||||||
@ -13,7 +13,7 @@ then
|
|||||||
echo "This pull remote transifex files to local dir."
|
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 "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 " 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
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -26,13 +26,21 @@ fi
|
|||||||
|
|
||||||
if [ "x$1" = "xall" ]
|
if [ "x$1" = "xall" ]
|
||||||
then
|
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
|
cd htdocs/lang
|
||||||
|
for dir in `find htdocs/langs/* -type d`
|
||||||
do
|
do
|
||||||
echo "tx pull -l $fic $2 $3"
|
fic=`basename $dir`
|
||||||
tx pull -l $fic $2 $3
|
if [ $fic != "en_US" ]
|
||||||
|
then
|
||||||
|
echo "tx pull -l $fic $2 $3"
|
||||||
|
tx pull -l $fic $2 $3
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
cd -
|
||||||
else
|
else
|
||||||
echo "tx pull -l $1 $2 $3 $4"
|
echo "tx pull -l $1 $2 $3 $4 $5"
|
||||||
tx pull -l $1 $2 $3 $4
|
tx pull -l $1 $2 $3 $4 $5
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo Think to launch also:
|
||||||
|
echo "> dev/fixaltlanguages.sh fix all"
|
||||||
|
|||||||
@ -249,7 +249,11 @@ if ($action == 'export_csv')
|
|||||||
$purchase_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
$purchase_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
||||||
|
|
||||||
header('Content-Type: text/csv');
|
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
|
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export
|
||||||
{
|
{
|
||||||
|
|||||||
@ -271,7 +271,11 @@ if ($action == 'export_csv')
|
|||||||
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
||||||
|
|
||||||
header('Content-Type: text/csv');
|
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);
|
$companystatic = new Client($db);
|
||||||
|
|
||||||
|
|||||||
@ -1548,9 +1548,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 int $maxlen length max libelle
|
||||||
* @param string $option Page lien
|
* @param string $option Page lien
|
||||||
* @return string Chaine avec URL
|
* @return string Chaine avec URL
|
||||||
@ -1568,25 +1568,25 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
if ($option == 'card')
|
if ($option == 'card')
|
||||||
{
|
{
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id.$linkclose;
|
$link = '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id.$linkclose;
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
}
|
}
|
||||||
if ($option == 'subscription')
|
if ($option == 'subscription')
|
||||||
{
|
{
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$this->id.$linkclose;
|
$link = '<a href="'.DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$this->id.$linkclose;
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
}
|
}
|
||||||
if ($option == 'category')
|
if ($option == 'category')
|
||||||
{
|
{
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/categories/categorie.php?id='.$this->id.'&type=3'.$linkclose;
|
$link = '<a href="'.DOL_URL_ROOT.'/categories/categorie.php?id='.$this->id.'&type=3'.$linkclose;
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$picto='user';
|
$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.=' ';
|
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;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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
|
* @param int $maxlen length max libelle
|
||||||
* @return string String with URL
|
* @return string String with URL
|
||||||
*/
|
*/
|
||||||
@ -279,14 +279,14 @@ class AdherentType extends CommonObject
|
|||||||
$result='';
|
$result='';
|
||||||
$label=$langs->trans("ShowTypeCard",$this->libelle);
|
$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">';
|
$link = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
$picto='group';
|
$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.=' ';
|
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;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -90,7 +90,7 @@ class Cotisation extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ class Cotisation extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -181,7 +181,7 @@ class Cotisation extends CommonObject
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -217,7 +217,7 @@ class Cotisation extends CommonObject
|
|||||||
$result=$member->fetch($this->fk_adherent);
|
$result=$member->fetch($this->fk_adherent);
|
||||||
$result=$member->update_end_date($user);
|
$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
|
$result=$accountline->delete($user); // Return false if refused because line is conciliated
|
||||||
if ($result > 0)
|
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
|
* @return string Chaine avec URL
|
||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0)
|
function getNomUrl($withpicto=0)
|
||||||
@ -266,14 +266,14 @@ class Cotisation extends CommonObject
|
|||||||
$result='';
|
$result='';
|
||||||
$label=$langs->trans("ShowSubscription").': '.$this->ref;
|
$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">';
|
$link = '<a href="'.DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
$picto='payment';
|
$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 && $withpicto != 2) $result.=' ';
|
||||||
$result.=$lien.$this->ref.$lienfin;
|
$result.=$link.$this->ref.$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -622,9 +622,29 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br>';
|
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"> </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();
|
llxFooter();
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -229,7 +229,7 @@ $sql.= ", note";
|
|||||||
$sql.= ", entity";
|
$sql.= ", entity";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."const";
|
$sql.= " FROM ".MAIN_DB_PREFIX."const";
|
||||||
$sql.= " WHERE entity IN (".$user->entity.",".$conf->entity.")";
|
$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
|
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";
|
$sql.= " ORDER BY entity, name ASC";
|
||||||
|
|
||||||
|
|||||||
@ -171,7 +171,7 @@ else if ($action == 'setdoc')
|
|||||||
// on passe donc par une variable pour avoir un affichage coherent
|
// on passe donc par une variable pour avoir un affichage coherent
|
||||||
$conf->global->FACTURE_ADDON_PDF = $value;
|
$conf->global->FACTURE_ADDON_PDF = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// On active le modele
|
// On active le modele
|
||||||
$ret = delDocumentModel($value, $type);
|
$ret = delDocumentModel($value, $type);
|
||||||
if ($ret > 0)
|
if ($ret > 0)
|
||||||
@ -341,7 +341,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
// Check if there is a filter on country
|
// Check if there is a filter on country
|
||||||
preg_match('/\-(.*)_(.*)$/',$classname,$reg);
|
preg_match('/\-(.*)_(.*)$/',$classname,$reg);
|
||||||
if (! empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue;
|
if (! empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue;
|
||||||
|
|
||||||
$classname = preg_replace('/\-.*$/','',$classname);
|
$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')
|
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>';
|
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Example for credit invoice
|
// Example for credit invoice
|
||||||
$facture->type=2;
|
$facture->type=2;
|
||||||
$nextval=$module->getNextValue($mysoc,$facture);
|
$nextval=$module->getNextValue($mysoc,$facture);
|
||||||
@ -630,7 +630,6 @@ print '</table>';
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Modes de reglement
|
* Modes de reglement
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInInvoice"));
|
print_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInInvoice"));
|
||||||
@ -811,7 +810,27 @@ print '</tr>'."\n";
|
|||||||
print "</table>\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"> </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();
|
llxFooter();
|
||||||
|
|
||||||
|
|||||||
119
htdocs/admin/loan.php
Normal file
119
htdocs/admin/loan.php
Normal 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();
|
||||||
@ -162,11 +162,11 @@ $var=true;
|
|||||||
|
|
||||||
if (! empty($conf->global->ADHERENT_USE_MAILMAN))
|
if (! empty($conf->global->ADHERENT_USE_MAILMAN))
|
||||||
{
|
{
|
||||||
//$lien=img_picto($langs->trans("Active"),'tick').' ';
|
//$link=img_picto($langs->trans("Active"),'tick').' ';
|
||||||
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_MAILMAN">';
|
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_MAILMAN">';
|
||||||
//$lien.=$langs->trans("Disable");
|
//$link.=$langs->trans("Disable");
|
||||||
$lien.=img_picto($langs->trans("Activated"),'switch_on');
|
$link.=img_picto($langs->trans("Activated"),'switch_on');
|
||||||
$lien.='</a>';
|
$link.='</a>';
|
||||||
// Edition des varibales globales
|
// Edition des varibales globales
|
||||||
$constantes=array(
|
$constantes=array(
|
||||||
'ADHERENT_MAILMAN_ADMINPW',
|
'ADHERENT_MAILMAN_ADMINPW',
|
||||||
@ -175,7 +175,7 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN))
|
|||||||
'ADHERENT_MAILMAN_LISTS'
|
'ADHERENT_MAILMAN_LISTS'
|
||||||
);
|
);
|
||||||
|
|
||||||
print_fiche_titre($langs->trans('MailmanTitle'), $lien,'');
|
print_fiche_titre($langs->trans('MailmanTitle'), $link,'');
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
@ -207,11 +207,11 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_MAILMAN">';
|
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_MAILMAN">';
|
||||||
//$lien.=img_$langs->trans("Activate")
|
//$link.=img_$langs->trans("Activate")
|
||||||
$lien.=img_picto($langs->trans("Disabled"),'switch_off');
|
$link.=img_picto($langs->trans("Disabled"),'switch_off');
|
||||||
$lien.='</a>';
|
$link.='</a>';
|
||||||
print_fiche_titre($langs->trans('MailmanTitle'), $lien,'');
|
print_fiche_titre($langs->trans('MailmanTitle'), $link,'');
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require '../main.inc.php';
|
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/lib/admin.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/triggers/interface_50_modNotification_Notification.class.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)
|
if ($action == 'setvalue' && $user->admin)
|
||||||
{
|
{
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
$result=dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM", $_POST["email_from"], 'chaine', 0, '', $conf->entity);
|
$result=dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM", $_POST["email_from"], 'chaine', 0, '', $conf->entity);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
//var_dump($_POST);
|
||||||
foreach($_POST as $key => $val)
|
foreach($_POST as $key => $val)
|
||||||
{
|
{
|
||||||
if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_/',$key)) continue;
|
if (! preg_match('/^NOTIF_(.*)_key$/', $key, $reg)) continue;
|
||||||
//print $key.' - '.$val.'<br>';
|
|
||||||
$result=dolibarr_set_const($db, $key, $val, 'chaine', 0, '', $conf->entity);
|
$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)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
$db->commit();
|
||||||
|
|
||||||
setEventMessage($langs->trans("SetupSaved"));
|
setEventMessage($langs->trans("SetupSaved"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$db->rollback();
|
||||||
|
|
||||||
setEventMessage($langs->trans("Error"),'errors');
|
setEventMessage($langs->trans("Error"),'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,6 +110,7 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
$notify = new Notify($db);
|
||||||
|
|
||||||
llxHeader('',$langs->trans("NotificationSetup"));
|
llxHeader('',$langs->trans("NotificationSetup"));
|
||||||
|
|
||||||
@ -107,7 +140,53 @@ print '</table>';
|
|||||||
|
|
||||||
print '<br>';
|
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">';
|
||||||
|
$nb = $notify->countDefinedNotifications($notifiedevent['code'], 0);
|
||||||
|
print $nb;
|
||||||
|
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 '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
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("Code").'</td>';
|
||||||
print '<td>'.$langs->trans("Label").'</td>';
|
print '<td>'.$langs->trans("Label").'</td>';
|
||||||
print '<td>'.$langs->trans("FixedEmailTarget").'</td>';
|
print '<td>'.$langs->trans("FixedEmailTarget").'</td>';
|
||||||
|
print '<td>'.$langs->trans("Threshold").'</td>';
|
||||||
|
print '<td>'.'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Load array of available notifications
|
// Load array of available notifications
|
||||||
$notificationtrigger=new InterfaceNotification($db);
|
$notificationtrigger=new InterfaceNotification($db);
|
||||||
$listofnotifiedevents=$notificationtrigger->getListOfManagedEvents();
|
$listofnotifiedevents=$notificationtrigger->getListOfManagedEvents();
|
||||||
|
|
||||||
|
$var=true;
|
||||||
foreach($listofnotifiedevents as $notifiedevent)
|
foreach($listofnotifiedevents as $notifiedevent)
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
@ -136,18 +218,47 @@ foreach($listofnotifiedevents as $notifiedevent)
|
|||||||
print '<td>'.$notifiedevent['code'].'</td>';
|
print '<td>'.$notifiedevent['code'].'</td>';
|
||||||
print '<td>'.$label.'</td>';
|
print '<td>'.$label.'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$param='NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'];
|
// Notification with threshold
|
||||||
$value=GETPOST($param)?GETPOST($param,'alpha'):$conf->global->$param;
|
foreach($conf->global as $key => $val)
|
||||||
$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);
|
if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_(.*)/', $key, $reg)) continue;
|
||||||
$showwarning=0;
|
|
||||||
foreach($arrayemail as $key=>$valuedet)
|
$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;
|
||||||
$valuedet=trim($valuedet);
|
|
||||||
if (! empty($valuedet) && ! isValidEmail($valuedet)) $showwarning++;
|
$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);
|
||||||
if ((! empty($conf->global->$param)) && $showwarning) $s.=' '.img_warning($langs->trans("ErrorBadEMail"));
|
$showwarning=0;
|
||||||
print $form->textwithpicto($s,$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
|
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 '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 "<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>";
|
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"> </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();
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
|||||||
@ -124,11 +124,11 @@ $var=true;
|
|||||||
*/
|
*/
|
||||||
if (! empty($conf->global->ADHERENT_USE_SPIP))
|
if (! empty($conf->global->ADHERENT_USE_SPIP))
|
||||||
{
|
{
|
||||||
//$lien=img_picto($langs->trans("Active"),'tick').' ';
|
//$link=img_picto($langs->trans("Active"),'tick').' ';
|
||||||
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">';
|
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">';
|
||||||
//$lien.=$langs->trans("Disable");
|
//$link.=$langs->trans("Disable");
|
||||||
$lien.=img_picto($langs->trans("Activated"),'switch_on');
|
$link.=img_picto($langs->trans("Activated"),'switch_on');
|
||||||
$lien.='</a>';
|
$link.='</a>';
|
||||||
// Edition des varibales globales
|
// Edition des varibales globales
|
||||||
$constantes=array(
|
$constantes=array(
|
||||||
'ADHERENT_SPIP_SERVEUR',
|
'ADHERENT_SPIP_SERVEUR',
|
||||||
@ -137,18 +137,18 @@ if (! empty($conf->global->ADHERENT_USE_SPIP))
|
|||||||
'ADHERENT_SPIP_PASS'
|
'ADHERENT_SPIP_PASS'
|
||||||
);
|
);
|
||||||
|
|
||||||
print_fiche_titre($langs->trans('SPIPTitle'), $lien, '');
|
print_fiche_titre($langs->trans('SPIPTitle'), $link, '');
|
||||||
print '<br>';
|
print '<br>';
|
||||||
form_constantes($constantes);
|
form_constantes($constantes);
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">';
|
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">';
|
||||||
//$lien.=$langs->trans("Activate");
|
//$link.=$langs->trans("Activate");
|
||||||
$lien.=img_picto($langs->trans("Disabled"),'switch_off');
|
$link.=img_picto($langs->trans("Disabled"),'switch_off');
|
||||||
$lien.='</a>';
|
$link.='</a>';
|
||||||
print_fiche_titre($langs->trans('SPIPTitle'), $lien, '');
|
print_fiche_titre($langs->trans('SPIPTitle'), $link, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -443,14 +443,16 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table><br/>';
|
print '</table><br>';
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Other options
|
* 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_titre($langs->trans("OtherOptions"));
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -459,16 +461,38 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
|||||||
print '<td width="80"> </td>';
|
print '<td width="80"> </td>';
|
||||||
print "</tr>\n";
|
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 '<tr '.$bc[$var].'><td colspan="2">';
|
||||||
print $langs->trans("FreeLegalTextOnInvoices").' ('.$langs->trans("AddCRIfTooLong").')<br>';
|
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 '<textarea name="SUPPLIER_INVOICE_FREE_TEXT" class="flat" cols="120">'.$conf->global->SUPPLIER_INVOICE_FREE_TEXT.'</textarea>';
|
||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|
||||||
|
print '</table><br>';
|
||||||
|
|
||||||
print '</form>';
|
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"> </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();
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
|||||||
@ -439,14 +439,16 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table><br/>';
|
print '</table><br>';
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Other options
|
* 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_FREE_TEXT">';
|
||||||
|
|
||||||
print_titre($langs->trans("OtherOptions"));
|
print_titre($langs->trans("OtherOptions"));
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -455,16 +457,39 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
|||||||
print '<td width="80"> </td>';
|
print '<td width="80"> </td>';
|
||||||
print "</tr>\n";
|
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_ORDER_FREE_TEXT">';
|
|
||||||
print '<tr '.$bc[$var].'><td colspan="2">';
|
print '<tr '.$bc[$var].'><td colspan="2">';
|
||||||
print $langs->trans("FreeLegalTextOnOrders").' ('.$langs->trans("AddCRIfTooLong").')<br>';
|
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 '<textarea name="SUPPLIER_ORDER_FREE_TEXT" class="flat" cols="120">'.$conf->global->SUPPLIER_ORDER_FREE_TEXT.'</textarea>';
|
||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|
||||||
|
print '</table><br>';
|
||||||
|
|
||||||
print '</form>';
|
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"> </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();
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
|||||||
@ -119,17 +119,17 @@ if ($resql)
|
|||||||
print "<a href=\"card.php?id=".$obj->bid."\">".img_object($langs->trans("ShowBookmark"),"bookmark").' '.$obj->bid."</a>";
|
print "<a href=\"card.php?id=".$obj->bid."\">".img_object($langs->trans("ShowBookmark"),"bookmark").' '.$obj->bid."</a>";
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
$lieninterne=0;
|
$linkintern=0;
|
||||||
$title=dol_trunc($obj->title,24);
|
$title=dol_trunc($obj->title,24);
|
||||||
$lien=dol_trunc($obj->url,24);
|
$link=dol_trunc($obj->url,24);
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
print "<td>";
|
print "<td>";
|
||||||
if ($obj->rowid)
|
if ($obj->rowid)
|
||||||
{
|
{
|
||||||
// Lien interne societe
|
// Lien interne societe
|
||||||
$lieninterne=1;
|
$linkintern=1;
|
||||||
$lien="Dolibarr";
|
$link="Dolibarr";
|
||||||
if (! $obj->title)
|
if (! $obj->title)
|
||||||
{
|
{
|
||||||
// For compatibility with old Dolibarr bookmarks
|
// For compatibility with old Dolibarr bookmarks
|
||||||
@ -140,16 +140,16 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
$title=img_object($langs->trans("ShowCompany"),"company").' '.$obj->title;
|
$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;
|
print $title;
|
||||||
if ($lieninterne) print "</a>";
|
if ($linkintern) print "</a>";
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
// Url
|
// Url
|
||||||
print "<td>";
|
print "<td>";
|
||||||
if (! $lieninterne) print '<a href="'.$obj->url.'"'.($obj->target?' target="newlink"':'').'>';
|
if (! $linkintern) print '<a href="'.$obj->url.'"'.($obj->target?' target="newlink"':'').'>';
|
||||||
print $lien;
|
print $link;
|
||||||
if (! $lieninterne) print '</a>';
|
if (! $linkintern) print '</a>';
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
// Target
|
// Target
|
||||||
|
|||||||
@ -1265,7 +1265,7 @@ class Categorie extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Return name and link of category (with picto)
|
* 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 string $option Sur quoi pointe le lien ('', 'xyz')
|
||||||
* @param int $maxlength Max length of text
|
* @param int $maxlength Max length of text
|
||||||
* @return string Chaine avec URL
|
* @return string Chaine avec URL
|
||||||
@ -1277,15 +1277,15 @@ class Categorie extends CommonObject
|
|||||||
$result='';
|
$result='';
|
||||||
$label=$langs->trans("ShowCategory").': '. ($this->ref?$this->ref:$this->label);
|
$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">';
|
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
$picto='category';
|
$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 && $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;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -957,7 +957,7 @@ class ActionComm extends CommonObject
|
|||||||
* Return URL of event
|
* Return URL of event
|
||||||
* Use $this->id, $this->type_code, $this->label and $this->type_label
|
* 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 int $maxlength Nombre de caracteres max dans libelle
|
||||||
* @param string $classname Force style class on a link
|
* @param string $classname Force style class on a link
|
||||||
* @param string $option ''=Link to action,'birthday'=Link to contact
|
* @param string $option ''=Link to action,'birthday'=Link to contact
|
||||||
@ -974,9 +974,9 @@ class ActionComm extends CommonObject
|
|||||||
$label = $this->label;
|
$label = $this->label;
|
||||||
if (empty($label)) $label=$this->libelle; // For backward compatibility
|
if (empty($label)) $label=$this->libelle; // For backward compatibility
|
||||||
$linkclose = '" title="'.dol_escape_htmltag($tooltip, 1).'" class="classfortooltip">';
|
$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;
|
if ($option=='birthday') $link = '<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;
|
else $link = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id.$linkclose;
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
//print 'rrr'.$this->libelle.'-'.$withpicto;
|
//print 'rrr'.$this->libelle.'-'.$withpicto;
|
||||||
|
|
||||||
if ($withpicto == 2)
|
if ($withpicto == 2)
|
||||||
@ -998,10 +998,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).')':'');
|
$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.=' ';
|
if ($withpicto==1) $result.=' ';
|
||||||
$result.=$lien.$libelleshort.$lienfin;
|
$result.=$link.$libelleshort.$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1337,7 +1337,7 @@ if ($action == 'create')
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
|
||||||
$notify = new Notify($db);
|
$notify = new Notify($db);
|
||||||
$text .= '<br>';
|
$text .= '<br>';
|
||||||
$text .= $notify->confirmMessage('ASKPRICESUPPLIER_VALIDATE', $object->socid);
|
$text .= $notify->confirmMessage('ASKPRICESUPPLIER_VALIDATE', $object->socid, $object);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -1346,9 +1346,9 @@ if ($action == 'create')
|
|||||||
|
|
||||||
if (! $formconfirm) {
|
if (! $formconfirm) {
|
||||||
$parameters = array('lineid' => $lineid);
|
$parameters = array('lineid' => $lineid);
|
||||||
$formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified
|
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
// by
|
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
||||||
// hook
|
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print form confirm
|
// Print form confirm
|
||||||
|
|||||||
@ -185,7 +185,7 @@ class AskPriceSupplier extends CommonObject
|
|||||||
$price = $prod->price;
|
$price = $prod->price;
|
||||||
}
|
}
|
||||||
|
|
||||||
$line = new AskPriceSupplierLigne($this->db);
|
$line = new AskPriceSupplierLine($this->db);
|
||||||
|
|
||||||
$line->fk_product=$idproduct;
|
$line->fk_product=$idproduct;
|
||||||
$line->desc=$productdesc;
|
$line->desc=$productdesc;
|
||||||
@ -225,7 +225,7 @@ class AskPriceSupplier extends CommonObject
|
|||||||
return -5;
|
return -5;
|
||||||
}
|
}
|
||||||
|
|
||||||
$askpricesupplierligne=new AskPriceSupplierLigne($this->db);
|
$askpricesupplierligne=new AskPriceSupplierLine($this->db);
|
||||||
$askpricesupplierligne->fk_askpricesupplier=$this->id;
|
$askpricesupplierligne->fk_askpricesupplier=$this->id;
|
||||||
$askpricesupplierligne->fk_remise_except=$remise->id;
|
$askpricesupplierligne->fk_remise_except=$remise->id;
|
||||||
$askpricesupplierligne->desc=$remise->description; // Description ligne
|
$askpricesupplierligne->desc=$remise->description; // Description ligne
|
||||||
@ -376,7 +376,7 @@ class AskPriceSupplier extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Insert line
|
// Insert line
|
||||||
$this->line=new AskPriceSupplierLigne($this->db);
|
$this->line=new AskPriceSupplierLine($this->db);
|
||||||
|
|
||||||
$this->line->fk_askpricesupplier=$this->id;
|
$this->line->fk_askpricesupplier=$this->id;
|
||||||
$this->line->label=$label;
|
$this->line->label=$label;
|
||||||
@ -525,10 +525,10 @@ class AskPriceSupplier extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update line
|
// Update line
|
||||||
$this->line=new AskPriceSupplierLigne($this->db);
|
$this->line=new AskPriceSupplierLine($this->db);
|
||||||
|
|
||||||
// Stock previous line records
|
// Stock previous line records
|
||||||
$staticline=new AskPriceSupplierLigne($this->db);
|
$staticline=new AskPriceSupplierLine($this->db);
|
||||||
$staticline->fetch($rowid);
|
$staticline->fetch($rowid);
|
||||||
$this->line->oldline = $staticline;
|
$this->line->oldline = $staticline;
|
||||||
|
|
||||||
@ -621,7 +621,7 @@ class AskPriceSupplier extends CommonObject
|
|||||||
{
|
{
|
||||||
if ($this->statut == 0)
|
if ($this->statut == 0)
|
||||||
{
|
{
|
||||||
$line=new AskPriceSupplierLigne($this->db);
|
$line=new AskPriceSupplierLine($this->db);
|
||||||
|
|
||||||
// For triggers
|
// For triggers
|
||||||
$line->fetch($lineid);
|
$line->fetch($lineid);
|
||||||
@ -1106,7 +1106,7 @@ class AskPriceSupplier extends CommonObject
|
|||||||
{
|
{
|
||||||
$objp = $this->db->fetch_object($result);
|
$objp = $this->db->fetch_object($result);
|
||||||
|
|
||||||
$line = new AskPriceSupplierLigne($this->db);
|
$line = new AskPriceSupplierLine($this->db);
|
||||||
|
|
||||||
$line->rowid = $objp->rowid;
|
$line->rowid = $objp->rowid;
|
||||||
$line->fk_askpricesupplier = $objp->fk_askpricesupplier;
|
$line->fk_askpricesupplier = $objp->fk_askpricesupplier;
|
||||||
@ -2088,7 +2088,7 @@ class AskPriceSupplier extends CommonObject
|
|||||||
$xnbp = 0;
|
$xnbp = 0;
|
||||||
while ($xnbp < $nbp)
|
while ($xnbp < $nbp)
|
||||||
{
|
{
|
||||||
$line=new AskPriceSupplierLigne($this->db);
|
$line=new AskPriceSupplierLine($this->db);
|
||||||
$line->desc=$langs->trans("Description")." ".$xnbp;
|
$line->desc=$langs->trans("Description")." ".$xnbp;
|
||||||
$line->qty=1;
|
$line->qty=1;
|
||||||
$line->subprice=100;
|
$line->subprice=100;
|
||||||
@ -2240,21 +2240,21 @@ class AskPriceSupplier extends CommonObject
|
|||||||
$label=$langs->trans("ShowAskpricesupplier").': '.$this->ref;
|
$label=$langs->trans("ShowAskpricesupplier").': '.$this->ref;
|
||||||
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
if ($option == '') {
|
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') {
|
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';
|
$picto='askpricesupplier';
|
||||||
|
|
||||||
|
|
||||||
if ($withpicto)
|
if ($withpicto)
|
||||||
$result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
$result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
||||||
if ($withpicto && $withpicto != 2)
|
if ($withpicto && $withpicto != 2)
|
||||||
$result.=' ';
|
$result.=' ';
|
||||||
$result.=$lien.$this->ref.$lienfin;
|
$result.=$link.$this->ref.$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2287,7 +2287,7 @@ class AskPriceSupplier extends CommonObject
|
|||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$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]->id = $obj->rowid; // for backward compatibility
|
||||||
$this->lines[$i]->rowid = $obj->rowid;
|
$this->lines[$i]->rowid = $obj->rowid;
|
||||||
$this->lines[$i]->label = $obj->custom_label;
|
$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
|
* \brief Class to manage askpricesupplier lines
|
||||||
*/
|
*/
|
||||||
class AskPriceSupplierLigne extends CommonObject
|
class AskPriceSupplierLine extends CommonObject
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
var $error;
|
var $error;
|
||||||
@ -2689,7 +2689,7 @@ class AskPriceSupplierLigne extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."askpricesupplierdet WHERE rowid = ".$this->rowid;
|
$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) )
|
if ($this->db->query($sql) )
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -2852,7 +2852,7 @@ class AskPriceSupplierLigne extends CommonObject
|
|||||||
$sql.= ",total_ttc=".price2num($this->total_ttc,'MT')."";
|
$sql.= ",total_ttc=".price2num($this->total_ttc,'MT')."";
|
||||||
$sql.= " WHERE rowid = ".$this->rowid;
|
$sql.= " WHERE rowid = ".$this->rowid;
|
||||||
|
|
||||||
dol_syslog("AskPriceSupplierLigne::update_total", LOG_DEBUG);
|
dol_syslog("AskPriceSupplierLine::update_total", LOG_DEBUG);
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||||
|
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -32,11 +33,13 @@
|
|||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.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.'/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.'/contact/class/contact.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.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->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->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->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->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->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';
|
if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
|
||||||
@ -44,6 +47,7 @@ if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichin
|
|||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
if (! empty($conf->contrat->enabled)) $langs->load("contracts");
|
if (! empty($conf->contrat->enabled)) $langs->load("contracts");
|
||||||
if (! empty($conf->commande->enabled)) $langs->load("orders");
|
if (! empty($conf->commande->enabled)) $langs->load("orders");
|
||||||
|
if (! empty($conf->expedition->enabled)) $langs->load("sendings");
|
||||||
if (! empty($conf->facture->enabled)) $langs->load("bills");
|
if (! empty($conf->facture->enabled)) $langs->load("bills");
|
||||||
if (! empty($conf->projet->enabled)) $langs->load("projects");
|
if (! empty($conf->projet->enabled)) $langs->load("projects");
|
||||||
if (! empty($conf->ficheinter->enabled)) $langs->load("interventions");
|
if (! empty($conf->ficheinter->enabled)) $langs->load("interventions");
|
||||||
@ -221,7 +225,6 @@ if ($id > 0)
|
|||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td><td width="70%" colspan="3">';
|
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 $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -667,6 +670,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
|
* Last linked contracts
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1671,7 +1671,7 @@ if ($action == 'create')
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
|
||||||
$notify = new Notify($db);
|
$notify = new Notify($db);
|
||||||
$text .= '<br>';
|
$text .= '<br>';
|
||||||
$text .= $notify->confirmMessage('PROPAL_VALIDATE', $object->socid);
|
$text .= $notify->confirmMessage('PROPAL_VALIDATE', $object->socid, $object);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -1680,9 +1680,9 @@ if ($action == 'create')
|
|||||||
|
|
||||||
if (! $formconfirm) {
|
if (! $formconfirm) {
|
||||||
$parameters = array('lineid' => $lineid);
|
$parameters = array('lineid' => $lineid);
|
||||||
$formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified
|
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
// by
|
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
||||||
// hook
|
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print form confirm
|
// Print form confirm
|
||||||
|
|||||||
@ -107,6 +107,9 @@ class Propal extends CommonObject
|
|||||||
var $products=array();
|
var $products=array();
|
||||||
var $extraparams=array();
|
var $extraparams=array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var PropaleLigne[]
|
||||||
|
*/
|
||||||
var $lines = array();
|
var $lines = array();
|
||||||
var $line;
|
var $line;
|
||||||
|
|
||||||
@ -2658,27 +2661,27 @@ class Propal extends CommonObject
|
|||||||
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
|
$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">';
|
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
if ($option == '') {
|
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
|
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') {
|
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') {
|
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';
|
$picto='propal';
|
||||||
|
|
||||||
|
|
||||||
if ($withpicto)
|
if ($withpicto)
|
||||||
$result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
$result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
||||||
if ($withpicto && $withpicto != 2)
|
if ($withpicto && $withpicto != 2)
|
||||||
$result.=' ';
|
$result.=' ';
|
||||||
$result.=$lien.$this->ref.$lienfin;
|
$result.=$link.$this->ref.$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2801,9 +2804,6 @@ class Propal extends CommonObject
|
|||||||
*/
|
*/
|
||||||
class PropaleLigne extends CommonObject
|
class PropaleLigne extends CommonObject
|
||||||
{
|
{
|
||||||
var $db;
|
|
||||||
var $error;
|
|
||||||
|
|
||||||
public $element='propaldet';
|
public $element='propaldet';
|
||||||
public $table_element='propaldet';
|
public $table_element='propaldet';
|
||||||
|
|
||||||
|
|||||||
@ -406,7 +406,8 @@ if ($resql)
|
|||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|
||||||
$parameters=array();
|
$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";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|||||||
@ -253,7 +253,7 @@ if (empty($reshook))
|
|||||||
$object->contactid = GETPOST('contactid');
|
$object->contactid = GETPOST('contactid');
|
||||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||||
|
|
||||||
// If creation from another object of another module (Example: origin=propal, originid=1)
|
// If creation from another object of another module (Example: origin=propal, originid=1)
|
||||||
if (! empty($origin) && ! empty($originid))
|
if (! empty($origin) && ! empty($originid))
|
||||||
{
|
{
|
||||||
@ -523,7 +523,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// bank account
|
// bank account
|
||||||
else if ($action == 'setbankaccount' && $user->rights->commande->creer) {
|
else if ($action == 'setbankaccount' && $user->rights->commande->creer) {
|
||||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||||
@ -1600,7 +1600,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
|
||||||
$notify = new Notify($db);
|
$notify = new Notify($db);
|
||||||
$text .= '<br>';
|
$text .= '<br>';
|
||||||
$text .= $notify->confirmMessage('ORDER_VALIDATE', $object->socid);
|
$text .= $notify->confirmMessage('ORDER_VALIDATE', $object->socid, $object);
|
||||||
}
|
}
|
||||||
|
|
||||||
$qualified_for_stock_change=0;
|
$qualified_for_stock_change=0;
|
||||||
@ -1726,8 +1726,9 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
|
|
||||||
if (! $formconfirm) {
|
if (! $formconfirm) {
|
||||||
$parameters = array('lineid' => $lineid);
|
$parameters = array('lineid' => $lineid);
|
||||||
$formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified
|
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
// by hook
|
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
||||||
|
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print form confirm
|
// Print form confirm
|
||||||
@ -1988,10 +1989,10 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Incoterms
|
// Incoterms
|
||||||
if (!empty($conf->incoterm->enabled))
|
if (!empty($conf->incoterm->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||||
print $langs->trans('IncotermLabel');
|
print $langs->trans('IncotermLabel');
|
||||||
@ -2005,13 +2006,13 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
{
|
{
|
||||||
print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
|
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 $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>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$cols = 3;
|
$cols = 3;
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||||
@ -2044,7 +2045,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
|
|
||||||
// Total HT
|
// Total HT
|
||||||
print '<tr><td>' . $langs->trans('AmountHT') . '</td>';
|
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
|
// Margin Infos
|
||||||
if (! empty($conf->margin->enabled)) {
|
if (! empty($conf->margin->enabled)) {
|
||||||
@ -2056,23 +2057,23 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Total TVA
|
// Total VAT
|
||||||
print '<tr><td>' . $langs->trans('AmountVAT') . '</td><td align="right">' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
print '<tr><td>' . $langs->trans('AmountVAT') . '</td><td>' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||||
|
|
||||||
// Amount Local Taxes
|
// Amount Local Taxes
|
||||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1
|
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1
|
||||||
{
|
{
|
||||||
print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
|
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
|
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2 IRPF
|
||||||
{
|
{
|
||||||
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
|
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
|
// 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
|
// Statut
|
||||||
print '<tr><td>' . $langs->trans('Status') . '</td><td>' . $object->getLibStatut(4) . '</td></tr>';
|
print '<tr><td>' . $langs->trans('Status') . '</td><td>' . $object->getLibStatut(4) . '</td></tr>';
|
||||||
@ -2243,10 +2244,10 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cancel order
|
// Cancel order
|
||||||
if ($object->statut == 1 &&
|
if ($object->statut == 1 &&
|
||||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->cloturer))
|
((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)))
|
|| (! 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 . '&action=cancel">' . $langs->trans('Cancel') . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=cancel">' . $langs->trans('Cancel') . '</a></div>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -104,13 +104,21 @@ class Commande extends CommonOrder
|
|||||||
|
|
||||||
var $user_author_id;
|
var $user_author_id;
|
||||||
|
|
||||||
var $lines = array();
|
/**
|
||||||
|
* @var OrderLine[]
|
||||||
|
*/
|
||||||
|
var $lines = array();
|
||||||
|
|
||||||
//Incorterms
|
//Incorterms
|
||||||
var $fk_incoterms;
|
var $fk_incoterms;
|
||||||
var $location_incoterms;
|
var $location_incoterms;
|
||||||
var $libelle_incoterms; //Used into tooltip
|
var $libelle_incoterms; //Used into tooltip
|
||||||
|
|
||||||
|
// Pour board
|
||||||
|
var $nbtodo;
|
||||||
|
var $nbtodolate;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ERR Not engouch stock
|
* ERR Not engouch stock
|
||||||
*/
|
*/
|
||||||
@ -629,8 +637,8 @@ class Commande extends CommonOrder
|
|||||||
* Note that this->ref can be set or empty. If empty, we will use "(PROV)"
|
* Note that this->ref can be set or empty. If empty, we will use "(PROV)"
|
||||||
*
|
*
|
||||||
* @param User $user Objet user that make creation
|
* @param User $user Objet user that make creation
|
||||||
* @param int $notrigger Disable all triggers
|
* @param int $notrigger Disable all triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function create($user, $notrigger=0)
|
function create($user, $notrigger=0)
|
||||||
{
|
{
|
||||||
@ -638,22 +646,22 @@ class Commande extends CommonOrder
|
|||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
// Clean parameters
|
// 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);
|
dol_syslog(get_class($this)."::create user=".$user->id);
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (! empty($this->ref)) // We check that ref is not already used
|
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
|
$result=self::isExistingObject($this->element, 0, $this->ref); // Check ref is not yet used
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$this->error='ErrorRefAlreadyExists';
|
$this->error='ErrorRefAlreadyExists';
|
||||||
dol_syslog(get_class($this)."::create ".$this->error,LOG_WARNING);
|
dol_syslog(get_class($this)."::create ".$this->error,LOG_WARNING);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$soc = new Societe($this->db);
|
$soc = new Societe($this->db);
|
||||||
$result=$soc->fetch($this->socid);
|
$result=$soc->fetch($this->socid);
|
||||||
@ -682,7 +690,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.= ", 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.= ", fk_shipping_method";
|
||||||
$sql.= ", remise_absolue, remise_percent";
|
$sql.= ", remise_absolue, remise_percent";
|
||||||
$sql.= ", fk_incoterms, location_incoterms";
|
$sql.= ", fk_incoterms, location_incoterms";
|
||||||
$sql.= ", entity";
|
$sql.= ", entity";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
$sql.= " VALUES ('(PROV)',".$this->socid.", '".$this->db->idate($now)."', ".$user->id;
|
$sql.= " VALUES ('(PROV)',".$this->socid.", '".$this->db->idate($now)."', ".$user->id;
|
||||||
@ -722,7 +730,7 @@ class Commande extends CommonOrder
|
|||||||
$num=count($this->lines);
|
$num=count($this->lines);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Insertion du detail des produits dans la base
|
* Insert products details into db
|
||||||
*/
|
*/
|
||||||
for ($i=0;$i<$num;$i++)
|
for ($i=0;$i<$num;$i++)
|
||||||
{
|
{
|
||||||
@ -753,7 +761,7 @@ class Commande extends CommonOrder
|
|||||||
$this->lines[$i]->fk_fournprice,
|
$this->lines[$i]->fk_fournprice,
|
||||||
$this->lines[$i]->pa_ht,
|
$this->lines[$i]->pa_ht,
|
||||||
$this->lines[$i]->label,
|
$this->lines[$i]->label,
|
||||||
$this->lines[$i]->array_options
|
$this->lines[$i]->array_options
|
||||||
);
|
);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
@ -771,13 +779,16 @@ class Commande extends CommonOrder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mise a jour ref
|
// update ref
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id;
|
$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->db->query($sql))
|
||||||
{
|
{
|
||||||
if ($this->id)
|
if ($this->id)
|
||||||
{
|
{
|
||||||
$this->ref="(PROV".$this->id.")";
|
$this->ref = $initialref;
|
||||||
|
|
||||||
// Add object linked
|
// Add object linked
|
||||||
if (is_array($this->linked_objects) && ! empty($this->linked_objects))
|
if (is_array($this->linked_objects) && ! empty($this->linked_objects))
|
||||||
@ -1476,7 +1487,7 @@ class Commande extends CommonOrder
|
|||||||
|
|
||||||
//Incoterms
|
//Incoterms
|
||||||
$this->fk_incoterms = $obj->fk_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->libelle_incoterms = $obj->libelle_incoterms;
|
||||||
|
|
||||||
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
||||||
@ -1627,12 +1638,12 @@ class Commande extends CommonOrder
|
|||||||
|
|
||||||
$line = new OrderLine($this->db);
|
$line = new OrderLine($this->db);
|
||||||
|
|
||||||
$line->rowid = $objp->rowid; // \deprecated
|
$line->rowid = $objp->rowid;
|
||||||
$line->id = $objp->rowid;
|
$line->id = $objp->rowid;
|
||||||
$line->fk_commande = $objp->fk_commande;
|
$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->label = $objp->custom_label;
|
||||||
$line->desc = $objp->description; // Description ligne
|
$line->desc = $objp->description;
|
||||||
$line->product_type = $objp->product_type;
|
$line->product_type = $objp->product_type;
|
||||||
$line->qty = $objp->qty;
|
$line->qty = $objp->qty;
|
||||||
$line->tva_tx = $objp->tva_tx;
|
$line->tva_tx = $objp->tva_tx;
|
||||||
@ -1658,11 +1669,11 @@ class Commande extends CommonOrder
|
|||||||
$line->special_code = $objp->special_code;
|
$line->special_code = $objp->special_code;
|
||||||
$line->fk_parent_line = $objp->fk_parent_line;
|
$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->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_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->fk_product_type = $objp->fk_product_type; // Produit ou service
|
||||||
|
|
||||||
$line->date_start = $this->db->jdate($objp->date_start);
|
$line->date_start = $this->db->jdate($objp->date_start);
|
||||||
@ -3253,56 +3264,44 @@ class Commande extends CommonOrder
|
|||||||
*/
|
*/
|
||||||
class OrderLine extends CommonOrderLine
|
class OrderLine extends CommonOrderLine
|
||||||
{
|
{
|
||||||
var $db;
|
|
||||||
var $error;
|
|
||||||
|
|
||||||
public $element='commandedet';
|
public $element='commandedet';
|
||||||
public $table_element='commandedet';
|
public $table_element='commandedet';
|
||||||
|
|
||||||
var $oldline;
|
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
|
// From llx_commandedet
|
||||||
var $rowid;
|
|
||||||
var $fk_parent_line;
|
var $fk_parent_line;
|
||||||
var $fk_facture;
|
var $fk_facture;
|
||||||
var $label;
|
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 $fk_remise_except;
|
||||||
var $rang = 0;
|
var $rang = 0;
|
||||||
var $fk_fournprice;
|
var $fk_fournprice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Buy price without taxes
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
var $pa_ht;
|
var $pa_ht;
|
||||||
var $marge_tx;
|
var $marge_tx;
|
||||||
var $marque_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;
|
* @deprecated
|
||||||
var $price;
|
*/
|
||||||
|
var $remise;
|
||||||
// From llx_product
|
|
||||||
var $ref; // deprecated
|
|
||||||
var $libelle; // deprecated
|
|
||||||
var $product_ref;
|
|
||||||
var $product_label; // Label produit
|
|
||||||
var $product_desc; // Description produit
|
|
||||||
|
|
||||||
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
// Start and end date of the line
|
// Start and end date of the line
|
||||||
|
|||||||
@ -158,12 +158,12 @@ if ($resql)
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
$lien=$lienfin='';
|
$link=$linkend='';
|
||||||
$lien = '<a href="'.dol_buildpath('/commande/orderstoinvoice.php',1).'?socid='.$obj->rowid.'">';
|
$link = '<a href="'.dol_buildpath('/commande/orderstoinvoice.php',1).'?socid='.$obj->rowid.'">';
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
$name=$obj->name;
|
$name=$obj->name;
|
||||||
$result.=($lien.img_object($langs->trans("ShowCompany").': '.$name,'company').$lienfin);
|
$result.=($link.img_object($langs->trans("ShowCompany").': '.$name,'company').$linkend);
|
||||||
$result.=$lien.(dol_trunc($name,$maxlen)).$lienfin;
|
$result.=$link.(dol_trunc($name,$maxlen)).$linkend;
|
||||||
|
|
||||||
print $result;
|
print $result;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@@2byte.es>
|
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@@2byte.es>
|
||||||
* Copyright (C) 2012-2014 Marcos García <marcosgdf@gmail.com>
|
* 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -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/paiement/class/paiement.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.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.'/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.'/fourn/class/paiementfourn.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.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("categories");
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
$langs->load("loan");
|
||||||
|
$langs->load("donations");
|
||||||
|
|
||||||
$id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('account','int'));
|
$id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('account','int'));
|
||||||
$ref = GETPOST('ref','alpha');
|
$ref = GETPOST('ref','alpha');
|
||||||
@ -148,11 +152,13 @@ llxHeader();
|
|||||||
$societestatic=new Societe($db);
|
$societestatic=new Societe($db);
|
||||||
$userstatic=new User($db);
|
$userstatic=new User($db);
|
||||||
$chargestatic=new ChargeSociales($db);
|
$chargestatic=new ChargeSociales($db);
|
||||||
|
$loanstatic=new Loan($db);
|
||||||
$memberstatic=new Adherent($db);
|
$memberstatic=new Adherent($db);
|
||||||
$paymentstatic=new Paiement($db);
|
$paymentstatic=new Paiement($db);
|
||||||
$paymentsupplierstatic=new PaiementFourn($db);
|
$paymentsupplierstatic=new PaiementFourn($db);
|
||||||
$paymentvatstatic=new TVA($db);
|
$paymentvatstatic=new TVA($db);
|
||||||
$paymentsalstatic=new PaymentSalary($db);
|
$paymentsalstatic=new PaymentSalary($db);
|
||||||
|
$donstatic=new Don($db);
|
||||||
$bankstatic=new Account($db);
|
$bankstatic=new Account($db);
|
||||||
$banklinestatic=new AccountLine($db);
|
$banklinestatic=new AccountLine($db);
|
||||||
|
|
||||||
@ -606,6 +612,18 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$paymentsalstatic->ref=$links[$key]['url_id'];
|
$paymentsalstatic->ref=$links[$key]['url_id'];
|
||||||
print ' '.$paymentsalstatic->getNomUrl(2);
|
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')
|
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.
|
// Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail.
|
||||||
@ -705,6 +723,21 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$chargestatic->ref=$chargestatic->lib;
|
$chargestatic->ref=$chargestatic->lib;
|
||||||
print $chargestatic->getNomUrl(1,16);
|
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')
|
else if ($links[$key]['type']=='member')
|
||||||
{
|
{
|
||||||
$memberstatic->id=$links[$key]['url_id'];
|
$memberstatic->id=$links[$key]['url_id'];
|
||||||
|
|||||||
@ -137,7 +137,7 @@ $head=bank_prepare_head($acct);
|
|||||||
dol_fiche_head($head,'annual',$langs->trans("FinancialAccount"),0,'account');
|
dol_fiche_head($head,'annual',$langs->trans("FinancialAccount"),0,'account');
|
||||||
|
|
||||||
$title=$langs->trans("FinancialAccount")." : ".$acct->label;
|
$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%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ print '<br>';
|
|||||||
// Affiche tableau
|
// Affiche tableau
|
||||||
print '<table class="notopnoleftnoright" width="100%">';
|
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>';
|
print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Month").'</td>';
|
||||||
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||||
|
|||||||
@ -39,12 +39,12 @@ class Account extends CommonObject
|
|||||||
public $table_element='bank_account';
|
public $table_element='bank_account';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* //TODO: Discuss this. $rowid is preferred over $id
|
* @var int Use id instead of rowid
|
||||||
* @var
|
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
var $rowid;
|
var $rowid;
|
||||||
var $id;
|
var $id;
|
||||||
|
|
||||||
var $ref;
|
var $ref;
|
||||||
var $label;
|
var $label;
|
||||||
//! 1=Compte courant/check/carte, 2=Compte liquide, 0=Compte épargne
|
//! 1=Compte courant/check/carte, 2=Compte liquide, 0=Compte épargne
|
||||||
@ -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
|
* @param string $mode ''=Link to card, 'transactions'=Link to transactions card
|
||||||
* @return string Chaine avec URL
|
* @return string Chaine avec URL
|
||||||
*/
|
*/
|
||||||
@ -988,17 +988,17 @@ class Account extends CommonObject
|
|||||||
|
|
||||||
if (empty($mode))
|
if (empty($mode))
|
||||||
{
|
{
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id.$linkclose;
|
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id.$linkclose;
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
}
|
}
|
||||||
else if ($mode == 'transactions')
|
else if ($mode == 'transactions')
|
||||||
{
|
{
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$this->id.$linkclose;
|
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$this->id.$linkclose;
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($label, 'account', 'class="classfortooltip"').$lienfin.' ');
|
if ($withpicto) $result.=($link.img_object($label, 'account', 'class="classfortooltip"').$linkend.' ');
|
||||||
$result.=$lien.$this->label.$lienfin;
|
$result.=$link.$this->label.$linkend;
|
||||||
return $result;
|
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 int $maxlen Longueur max libelle
|
||||||
* @param string $option Option ('showall')
|
* @param string $option Option ('showall')
|
||||||
* @return string Chaine avec URL
|
* @return string Chaine avec URL
|
||||||
@ -1534,11 +1534,11 @@ class AccountLine extends CommonObject
|
|||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
$label=$langs->trans("ShowTransaction").': '.$this->rowid;
|
$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">';
|
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$this->rowid.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($label, 'account', 'class="classfortooltip"').$lienfin.' ');
|
if ($withpicto) $result.=($link.img_object($label, 'account', 'class="classfortooltip"').$linkend.' ');
|
||||||
$result.=$lien.$this->rowid.$lienfin;
|
$result.=$link.$this->rowid.$linkend;
|
||||||
|
|
||||||
if ($option == 'showall' || $option == 'showconciliated') $result.=' (';
|
if ($option == 'showall' || $option == 'showconciliated') $result.=' (';
|
||||||
if ($option == 'showall')
|
if ($option == 'showall')
|
||||||
|
|||||||
@ -841,8 +841,8 @@ if ($mode == 'standard')
|
|||||||
if ($nextmonth > 12) { $nextmonth=1; $nextyear++; }
|
if ($nextmonth > 12) { $nextmonth=1; $nextyear++; }
|
||||||
|
|
||||||
// For month
|
// 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>";
|
$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">'.$lien.'</td></tr>';
|
print '<tr><td align="right">'.$link.'</td></tr>';
|
||||||
|
|
||||||
print '<tr><td align="center">';
|
print '<tr><td align="center">';
|
||||||
$file = "movement".$account."-".$year.$month.".png";
|
$file = "movement".$account."-".$year.$month.".png";
|
||||||
@ -855,8 +855,8 @@ if ($mode == 'standard')
|
|||||||
|
|
||||||
// For year
|
// For year
|
||||||
$prevyear=$year-1;$nextyear=$year+1;
|
$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>";
|
$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">'.$lien.'</td></tr>';
|
print '<tr><td align="right">'.$link.'</td></tr>';
|
||||||
|
|
||||||
print '<tr><td align="center">';
|
print '<tr><td align="center">';
|
||||||
print $show5;
|
print $show5;
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -21,7 +22,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/compta/bank/ligne.php
|
* \file htdocs/compta/bank/ligne.php
|
||||||
* \ingroup compta
|
* \ingroup bank
|
||||||
* \brief Page to edit a bank transaction record
|
* \brief Page to edit a bank transaction record
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -33,6 +34,7 @@ $langs->load("categories");
|
|||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
if (! empty($conf->adherent->enabled)) $langs->load("members");
|
if (! empty($conf->adherent->enabled)) $langs->load("members");
|
||||||
|
if (! empty($conf->don->enabled)) $langs->load("donations");
|
||||||
|
|
||||||
|
|
||||||
$id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('account','int'));
|
$id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('account','int'));
|
||||||
@ -350,6 +352,12 @@ if ($result)
|
|||||||
print img_object($langs->trans('ShowMember'),'user').' ';
|
print img_object($langs->trans('ShowMember'),'user').' ';
|
||||||
print $links[$key]['label'];
|
print $links[$key]['label'];
|
||||||
print '</a>';
|
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') {
|
else if ($links[$key]['type']=='banktransfert') {
|
||||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$links[$key]['url_id'].'">';
|
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$links[$key]['url_id'].'">';
|
||||||
|
|||||||
@ -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.'/societe/class/societe.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.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("banks");
|
||||||
$langs->load("categories");
|
$langs->load("categories");
|
||||||
@ -128,7 +128,7 @@ if (! empty($type))
|
|||||||
{
|
{
|
||||||
$sql.= " AND b.fk_type = '".$db->escape($type)."' ";
|
$sql.= " AND b.fk_type = '".$db->escape($type)."' ";
|
||||||
}
|
}
|
||||||
//Search period criteria
|
// Search period criteria
|
||||||
if (dol_strlen($search_dt_start)>0) {
|
if (dol_strlen($search_dt_start)>0) {
|
||||||
$sql .= " AND b.dateo >= '" . $db->idate($search_dt_start) . "'";
|
$sql .= " AND b.dateo >= '" . $db->idate($search_dt_start) . "'";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -349,7 +349,7 @@ class Deplacement extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Return clicable name (with picto eventually)
|
* 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
|
* @return string Chaine avec URL
|
||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0)
|
function getNomUrl($withpicto=0)
|
||||||
@ -359,15 +359,15 @@ class Deplacement extends CommonObject
|
|||||||
$result='';
|
$result='';
|
||||||
$label=$langs->trans("Show").': '.$this->ref;
|
$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">';
|
$link = '<a href="'.DOL_URL_ROOT.'/compta/deplacement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
$picto='trip';
|
$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 && $withpicto != 2) $result.=' ';
|
||||||
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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ó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").'"> <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").'"> <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> </td>';
|
|
||||||
|
|
||||||
print '</tr></table>';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
|
||||||
$db->close();
|
|
||||||
@ -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ó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();
|
|
||||||
@ -324,7 +324,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// bank account
|
// bank account
|
||||||
else if ($action == 'setbankaccount' && $user->rights->facture->creer)
|
else if ($action == 'setbankaccount' && $user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
@ -2289,7 +2289,7 @@ if ($action == 'create')
|
|||||||
print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms)?$objectsrc->location_incoterms:''));
|
print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms)?$objectsrc->location_incoterms:''));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters = array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"');
|
$parameters = array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"');
|
||||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
|
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
|
||||||
@ -2587,7 +2587,7 @@ if ($action == 'create')
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
|
||||||
$notify = new Notify($db);
|
$notify = new Notify($db);
|
||||||
$text .= '<br>';
|
$text .= '<br>';
|
||||||
$text .= $notify->confirmMessage('BILL_VALIDATE', $object->socid);
|
$text .= $notify->confirmMessage('BILL_VALIDATE', $object->socid, $object);
|
||||||
}
|
}
|
||||||
$formquestion = array();
|
$formquestion = array();
|
||||||
|
|
||||||
@ -2749,8 +2749,9 @@ if ($action == 'create')
|
|||||||
|
|
||||||
if (! $formconfirm) {
|
if (! $formconfirm) {
|
||||||
$parameters = array('lineid' => $lineid);
|
$parameters = array('lineid' => $lineid);
|
||||||
$formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by
|
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
// hook
|
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
||||||
|
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print form confirm
|
// Print form confirm
|
||||||
@ -3389,10 +3390,10 @@ if ($action == 'create')
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Incoterms
|
// Incoterms
|
||||||
if (!empty($conf->incoterm->enabled))
|
if (!empty($conf->incoterm->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||||
print $langs->trans('IncotermLabel');
|
print $langs->trans('IncotermLabel');
|
||||||
@ -3406,7 +3407,7 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
|
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 $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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')
|
* @param string $option Sur quoi pointe le lien ('', 'withdraw')
|
||||||
* @return string Chaine avec URL
|
* @return string Chaine avec URL
|
||||||
*/
|
*/
|
||||||
@ -560,15 +560,15 @@ class FactureRec extends Facture
|
|||||||
$result='';
|
$result='';
|
||||||
$label=$langs->trans("ShowInvoice").': '.$this->ref;
|
$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">';
|
$link = '<a href="'.DOL_URL_ROOT.'/compta/facture/fiche-rec.php?facid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
$picto='bill';
|
$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 && $withpicto != 2) $result.=' ';
|
||||||
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3606,16 +3606,12 @@ class Facture extends CommonInvoice
|
|||||||
*/
|
*/
|
||||||
class FactureLigne extends CommonInvoiceLine
|
class FactureLigne extends CommonInvoiceLine
|
||||||
{
|
{
|
||||||
var $db;
|
|
||||||
var $error;
|
|
||||||
|
|
||||||
public $element='facturedet';
|
public $element='facturedet';
|
||||||
public $table_element='facturedet';
|
public $table_element='facturedet';
|
||||||
|
|
||||||
var $oldline;
|
var $oldline;
|
||||||
|
|
||||||
//! From llx_facturedet
|
//! From llx_facturedet
|
||||||
var $rowid;
|
|
||||||
//! Id facture
|
//! Id facture
|
||||||
var $fk_facture;
|
var $fk_facture;
|
||||||
//! Id parent line
|
//! Id parent line
|
||||||
@ -3623,17 +3619,9 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
var $label; // deprecated
|
var $label; // deprecated
|
||||||
//! Description ligne
|
//! Description ligne
|
||||||
var $desc;
|
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 $localtax1_type; // Local tax 1 type
|
||||||
var $localtax2_type; // Local tax 2 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 $fk_remise_except; // Link to line into llx_remise_except
|
||||||
var $rang = 0;
|
var $rang = 0;
|
||||||
|
|
||||||
@ -3642,10 +3630,6 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
var $marge_tx;
|
var $marge_tx;
|
||||||
var $marque_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:
|
var $special_code; // Liste d'options non cumulabels:
|
||||||
// 1: frais de port
|
// 1: frais de port
|
||||||
// 2: ecotaxe
|
// 2: ecotaxe
|
||||||
@ -3654,15 +3638,6 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
var $origin;
|
var $origin;
|
||||||
var $origin_id;
|
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 $fk_code_ventilation = 0;
|
||||||
|
|
||||||
var $date_start;
|
var $date_start;
|
||||||
@ -3691,16 +3666,6 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
*/
|
*/
|
||||||
public $fk_prev_id;
|
public $fk_prev_id;
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param DoliDB $db Database handler
|
|
||||||
*/
|
|
||||||
function __construct($db)
|
|
||||||
{
|
|
||||||
$this->db = $db;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load invoice line from database
|
* Load invoice line from database
|
||||||
*
|
*
|
||||||
|
|||||||
@ -127,7 +127,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire)
|
|||||||
if (! empty($conf->don->enabled) && $user->rights->don->lire)
|
if (! empty($conf->don->enabled) && $user->rights->don->lire)
|
||||||
{
|
{
|
||||||
$langs->load("donations");
|
$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 '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<table class="noborder nohover" width="100%">';
|
print '<table class="noborder nohover" width="100%">';
|
||||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchADonation").'</td></tr>';
|
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
|
// Last donations
|
||||||
if (! empty($conf->don->enabled) && $user->rights->societe->lire)
|
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");
|
$langs->load("boxes");
|
||||||
$donationstatic=new Don($db);
|
$donationstatic=new Don($db);
|
||||||
|
|||||||
@ -582,14 +582,14 @@ class Localtax extends CommonObject
|
|||||||
$result='';
|
$result='';
|
||||||
$label=$langs->trans("ShowVatPayment").': '.$this->ref;
|
$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">';
|
$link = '<a href="'.DOL_URL_ROOT.'/compta/localtax/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
$picto='payment';
|
$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 && $withpicto != 2) $result.=' ';
|
||||||
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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
|
* @param string $option Sur quoi pointe le lien
|
||||||
* @return string Chaine avec URL
|
* @return string Chaine avec URL
|
||||||
*/
|
*/
|
||||||
@ -781,12 +781,12 @@ class RemiseCheque extends CommonObject
|
|||||||
$result='';
|
$result='';
|
||||||
$label = $langs->trans("ShowCheckReceipt").': '.$this->ref;
|
$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">';
|
$link = '<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$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 && $withpicto != 2) $result.=' ';
|
||||||
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -737,9 +737,9 @@ class Paiement 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
|
* @param string $option Sur quoi pointe le lien
|
||||||
* @return string Chaine avec URL
|
* @return string Chaine avec URL
|
||||||
*/
|
*/
|
||||||
@ -750,12 +750,12 @@ class Paiement extends CommonObject
|
|||||||
$result='';
|
$result='';
|
||||||
$label = $langs->trans("ShowPayment").': '.$this->ref;
|
$label = $langs->trans("ShowPayment").': '.$this->ref;
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$link = '<a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowPayment"), 'payment', 'class="classfortooltip"').$lienfin);
|
if ($withpicto) $result.=($link.img_object($langs->trans("ShowPayment"), 'payment', 'class="classfortooltip"').$linkend);
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -178,7 +178,7 @@ if ($_GET["action"] == 'create')
|
|||||||
|
|
||||||
print '<table cellspacing="0" class="border" width="100%" cellpadding="2">';
|
print '<table cellspacing="0" class="border" width="100%" cellpadding="2">';
|
||||||
|
|
||||||
print "<tr class=\"liste_titre\"><td colspan=\"3\">Charge</td>";
|
print "<tr class=\"liste_titre\"><td colspan=\"3\">".$langs->trans("SocialContribution")."</td>";
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="2"><a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$chid.'">'.$chid.'</a></td></tr>';
|
print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="2"><a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$chid.'">'.$chid.'</a></td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("Type")."</td><td colspan=\"2\">".$charge->type_libelle."</td></tr>\n";
|
print '<tr><td>'.$langs->trans("Type")."</td><td colspan=\"2\">".$charge->type_libelle."</td></tr>\n";
|
||||||
|
|||||||
@ -1113,17 +1113,17 @@ class BonPrelevement extends CommonObject
|
|||||||
$result='';
|
$result='';
|
||||||
$label = $langs->trans("ShowWithdraw").': '.$this->ref;
|
$label = $langs->trans("ShowWithdraw").': '.$this->ref;
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$link = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
if ($option == 'xxx')
|
if ($option == 'xxx')
|
||||||
{
|
{
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$link = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($label, 'payment', 'class="classfortooltip"').$lienfin.' ');
|
if ($withpicto) $result.=($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend.' ');
|
||||||
$result.=$lien.$this->ref.$lienfin;
|
$result.=$link.$this->ref.$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -127,7 +127,7 @@ if ($result)
|
|||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<form action="list.php" method="GET">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_line" value="'. dol_escape_htmltag($search_line).'" size="6"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat" name="search_line" value="'. dol_escape_htmltag($search_line).'" size="6"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_bon" value="'. dol_escape_htmltag($search_bon).'" size="8"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat" name="search_bon" value="'. dol_escape_htmltag($search_bon).'" size="8"></td>';
|
||||||
|
|||||||
@ -651,7 +651,7 @@ if ($conf->donation->enabled)
|
|||||||
$var = !$var;
|
$var = !$var;
|
||||||
print "<tr ".$bc[$var]."><td> </td>";
|
print "<tr ".$bc[$var]."><td> </td>";
|
||||||
|
|
||||||
print "<td>".$langs->trans("Donation")." <a href=\"".DOL_URL_ROOT."/compta/dons/list.php?search_company=".$obj->name."&search_name=".$obj->firstname." ".$obj->lastname."\">".$obj->name. " ".$obj->firstname." ".$obj->lastname."</a></td>\n";
|
print "<td>".$langs->trans("Donation")." <a href=\"".DOL_URL_ROOT."/don/list.php?search_company=".$obj->name."&search_name=".$obj->firstname." ".$obj->lastname."\">".$obj->name. " ".$obj->firstname." ".$obj->lastname."</a></td>\n";
|
||||||
|
|
||||||
if ($modecompta == 'CREANCES-DETTES') print '<td align="right">'.price($obj->amount).'</td>';
|
if ($modecompta == 'CREANCES-DETTES') print '<td align="right">'.price($obj->amount).'</td>';
|
||||||
print '<td align="right">'.price($obj->amount).'</td>';
|
print '<td align="right">'.price($obj->amount).'</td>';
|
||||||
|
|||||||
@ -211,7 +211,7 @@ if ($action == 'create')
|
|||||||
$datesp=dol_get_first_day($pastmonthyear,$pastmonth,false); $dateep=dol_get_last_day($pastmonthyear,$pastmonth,false);
|
$datesp=dol_get_first_day($pastmonthyear,$pastmonth,false); $dateep=dol_get_last_day($pastmonthyear,$pastmonth,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<form name='add' action=\"card.php\" method=\"post\">\n";
|
print '<form name="salary" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
|
|
||||||
|
|||||||
@ -490,14 +490,14 @@ class PaymentSalary extends CommonObject
|
|||||||
$result='';
|
$result='';
|
||||||
$label=$langs->trans("ShowSalaryPayment").': '.$this->ref;
|
$label=$langs->trans("ShowSalaryPayment").': '.$this->ref;
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/salaries/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$link = '<a href="'.DOL_URL_ROOT.'/compta/salaries/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
$picto='payment';
|
$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 && $withpicto != 2) $result.=' ';
|
||||||
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -408,9 +408,9 @@ class ChargeSociales 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 int $maxlen Longueur max libelle
|
||||||
* @return string Chaine avec URL
|
* @return string Chaine avec URL
|
||||||
*/
|
*/
|
||||||
@ -423,12 +423,12 @@ class ChargeSociales extends CommonObject
|
|||||||
if (empty($this->ref)) $this->ref=$this->lib;
|
if (empty($this->ref)) $this->ref=$this->lib;
|
||||||
$label = $langs->trans("ShowSocialContribution").': '.$this->ref;
|
$label = $langs->trans("ShowSocialContribution").': '.$this->ref;
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$link = '<a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($label, 'bill', 'class="classfortooltip"').$lienfin.' ');
|
if ($withpicto) $result.=($link.img_object($label, 'bill', 'class="classfortooltip"').$linkend.' ');
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
if ($withpicto != 2) $result.=$lien.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$lienfin;
|
if ($withpicto != 2) $result.=$link.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -576,9 +576,9 @@ class PaymentSocialContribution 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 int $maxlen Longueur max libelle
|
||||||
* @return string Chaine avec URL
|
* @return string Chaine avec URL
|
||||||
*/
|
*/
|
||||||
@ -593,12 +593,12 @@ class PaymentSocialContribution extends CommonObject
|
|||||||
|
|
||||||
if (!empty($this->id))
|
if (!empty($this->id))
|
||||||
{
|
{
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$link = '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$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 && $withpicto != 2) $result.=' ';
|
||||||
if ($withpicto != 2) $result.=$lien.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$lienfin;
|
if ($withpicto != 2) $result.=$link.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$linkend;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@ -640,14 +640,14 @@ class Tva extends CommonObject
|
|||||||
$result='';
|
$result='';
|
||||||
$label=$langs->trans("ShowVatPayment").': '.$this->ref;
|
$label=$langs->trans("ShowVatPayment").': '.$this->ref;
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$link = '<a href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
$picto='payment';
|
$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 && $withpicto != 2) $result.=' ';
|
||||||
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -315,12 +315,12 @@ $dolibarr_main_db_prefix='';
|
|||||||
|
|
||||||
// multicompany_transverse_mode
|
// multicompany_transverse_mode
|
||||||
// Prerequisite: Need external module "multicompany"
|
// Prerequisite: Need external module "multicompany"
|
||||||
// Pyramidal (0): The rights and groups are managed in each entity,
|
// Pyramidal (0): The rights and groups are managed in each entity. Each user belongs to the entity he was created into.
|
||||||
// users belong to the entity for their rights.
|
// Transversal (1): The user is created and managed only into master entity but can login to all entities if he is admmin
|
||||||
// Transversal (1): The groups can belong only to the master entity
|
// of entity or belongs to at least one user group created into entity.
|
||||||
// and that the user belongs to a particular entity
|
|
||||||
// Default value: 0 (pyramidal)
|
// Default value: 0 (pyramidal)
|
||||||
// Examples:
|
// Examples:
|
||||||
// $multicompany_transverse_mode='1';
|
// $multicompany_transverse_mode='1';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -895,17 +895,17 @@ class Contact extends CommonObject
|
|||||||
$label = '<u>' . $langs->trans("ShowContact") . '</u>';
|
$label = '<u>' . $langs->trans("ShowContact") . '</u>';
|
||||||
$label.= '<br><b>' . $langs->trans("Name") . ':</b> '.$this->getFullName($langs);
|
$label.= '<br><b>' . $langs->trans("Name") . ':</b> '.$this->getFullName($langs);
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
if ($option == 'xxx')
|
if ($option == 'xxx')
|
||||||
{
|
{
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($label, 'contact', 'class="classfortooltip"').$lienfin.' ');
|
if ($withpicto) $result.=($link.img_object($label, 'contact', 'class="classfortooltip"').$linkend.' ');
|
||||||
$result.=$lien.($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs)).$lienfin;
|
$result.=$link.($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs)).$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1053,7 +1053,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
print '<br><center><input type="submit" class="button" value="'.$langs->trans("Create").'"></center>';
|
print '<br><div align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'"></div>';
|
||||||
|
|
||||||
if (is_object($objectsrc))
|
if (is_object($objectsrc))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -89,23 +89,7 @@ class Contrat extends CommonObject
|
|||||||
var $product;
|
var $product;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Which is the correct one?
|
* @var int Id of user author of the contract
|
||||||
* Author of the contract
|
|
||||||
* @var
|
|
||||||
*/
|
|
||||||
var $user_author;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: Which is the correct one?
|
|
||||||
* Author of the contract
|
|
||||||
* @var User
|
|
||||||
*/
|
|
||||||
public $user_creation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: Which is the correct one?
|
|
||||||
* Author of the contract
|
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
public $fk_user_author;
|
public $fk_user_author;
|
||||||
|
|
||||||
@ -117,38 +101,37 @@ class Contrat extends CommonObject
|
|||||||
public $user_author_id;
|
public $user_author_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var User
|
* @var User Object user that create the contract. Set by the info method.
|
||||||
|
*/
|
||||||
|
public $user_creation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var User Object user that close the contract. Set by the info method.
|
||||||
*/
|
*/
|
||||||
public $user_cloture;
|
public $user_cloture;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date of creation
|
* @var int Date of creation
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
var $date_creation;
|
var $date_creation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date of last modification
|
* @var int Date of last modification. Not filled until you call ->info()
|
||||||
* Not filled until you call ->info()
|
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
public $date_modification;
|
public $date_modification;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date of validation
|
* @var int Date of validation
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
var $date_validation;
|
var $date_validation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when contract was signed
|
* @var int Date when contract was signed
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
var $date_contrat;
|
var $date_contrat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date of contract closure
|
* @var int Date of contract closure
|
||||||
* @var int
|
|
||||||
* @deprecated we close contract lines, not a contract
|
* @deprecated we close contract lines, not a contract
|
||||||
*/
|
*/
|
||||||
var $date_cloture;
|
var $date_cloture;
|
||||||
@ -157,21 +140,15 @@ class Contrat extends CommonObject
|
|||||||
var $commercial_suivi_id;
|
var $commercial_suivi_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use note_private or note_public instead
|
* @var string Private note
|
||||||
*/
|
|
||||||
var $note;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Private note
|
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
var $note_private;
|
var $note_private;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public note
|
* @var string Public note
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
var $note_public;
|
var $note_public;
|
||||||
|
|
||||||
var $modelpdf;
|
var $modelpdf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -184,8 +161,7 @@ class Contrat extends CommonObject
|
|||||||
var $extraparams=array();
|
var $extraparams=array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contract lines
|
* @var ContratLigne[] Contract lines
|
||||||
* @var ContratLigne[]
|
|
||||||
*/
|
*/
|
||||||
var $lines=array();
|
var $lines=array();
|
||||||
|
|
||||||
@ -569,7 +545,6 @@ class Contrat extends CommonObject
|
|||||||
$this->commercial_signature_id = $result["fk_commercial_signature"];
|
$this->commercial_signature_id = $result["fk_commercial_signature"];
|
||||||
$this->commercial_suivi_id = $result["fk_commercial_suivi"];
|
$this->commercial_suivi_id = $result["fk_commercial_suivi"];
|
||||||
|
|
||||||
$this->note = $result["note_private"]; // deprecated
|
|
||||||
$this->note_private = $result["note_private"];
|
$this->note_private = $result["note_private"];
|
||||||
$this->note_public = $result["note_public"];
|
$this->note_public = $result["note_public"];
|
||||||
$this->modelpdf = $result["model_pdf"];
|
$this->modelpdf = $result["model_pdf"];
|
||||||
@ -726,7 +701,7 @@ class Contrat extends CommonObject
|
|||||||
// Retreive all extrafield for propal
|
// Retreive all extrafield for propal
|
||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$line->fetch_optionals($line->id,$extralabelsline);
|
$line->fetch_optionals($line->id,$extralabelsline);
|
||||||
|
|
||||||
$this->lines[] = $line;
|
$this->lines[] = $line;
|
||||||
|
|
||||||
//dol_syslog("1 ".$line->desc);
|
//dol_syslog("1 ".$line->desc);
|
||||||
@ -822,13 +797,13 @@ class Contrat extends CommonObject
|
|||||||
if ($line->statut == 4 && (! empty($line->date_fin_prevue) && $line->date_fin_prevue < $now)) $this->nbofservicesexpired++;
|
if ($line->statut == 4 && (! empty($line->date_fin_prevue) && $line->date_fin_prevue < $now)) $this->nbofservicesexpired++;
|
||||||
if ($line->statut == 5) $this->nbofservicesclosed++;
|
if ($line->statut == 5) $this->nbofservicesclosed++;
|
||||||
|
|
||||||
|
|
||||||
// Retreive all extrafield for propal
|
// Retreive all extrafield for propal
|
||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
|
|
||||||
$line->fetch_optionals($line->id,$extralabelsline);
|
$line->fetch_optionals($line->id,$extralabelsline);
|
||||||
|
|
||||||
|
|
||||||
$this->lines[] = $line;
|
$this->lines[] = $line;
|
||||||
|
|
||||||
$total_ttc+=$objp->total_ttc;
|
$total_ttc+=$objp->total_ttc;
|
||||||
@ -1742,9 +1717,9 @@ class Contrat 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 $maxlength Max length of ref
|
* @param int $maxlength Max length of ref
|
||||||
* @return string Chaine avec URL
|
* @return string Chaine avec URL
|
||||||
*/
|
*/
|
||||||
@ -1755,15 +1730,15 @@ class Contrat extends CommonObject
|
|||||||
$result='';
|
$result='';
|
||||||
$label=$langs->trans("ShowContract").': '.$this->ref;
|
$label=$langs->trans("ShowContract").': '.$this->ref;
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$link = '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
$picto='contract';
|
$picto='contract';
|
||||||
|
|
||||||
|
|
||||||
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 && $withpicto != 2) $result.=' ';
|
||||||
if ($withpicto != 2) $result.=$lien.($maxlength?dol_trunc($this->ref,$maxlength):$this->ref).$lienfin;
|
if ($withpicto != 2) $result.=$link.($maxlength?dol_trunc($this->ref,$maxlength):$this->ref).$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2290,9 +2265,9 @@ class ContratLigne 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 $maxlength Max length
|
* @param int $maxlength Max length
|
||||||
* @return string Chaine avec URL
|
* @return string Chaine avec URL
|
||||||
*/
|
*/
|
||||||
@ -2303,15 +2278,15 @@ class ContratLigne extends CommonObject
|
|||||||
$result='';
|
$result='';
|
||||||
$label=$langs->trans("ShowContractOfService").': '.$this->label;
|
$label=$langs->trans("ShowContractOfService").': '.$this->label;
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$this->fk_contrat.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$link = '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$this->fk_contrat.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
$picto='contract';
|
$picto='contract';
|
||||||
|
|
||||||
|
|
||||||
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 && $withpicto != 2) $result.=' ';
|
||||||
if ($withpicto != 2) $result.=$lien.$this->label.$lienfin;
|
if ($withpicto != 2) $result.=$link.$this->label.$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -89,8 +89,11 @@ class box_activity extends ModeleBoxes
|
|||||||
// compute the year limit to show
|
// compute the year limit to show
|
||||||
$tmpdate= dol_time_plus_duree(dol_now(), -1*$nbofyears, "y");
|
$tmpdate= dol_time_plus_duree(dol_now(), -1*$nbofyears, "y");
|
||||||
|
|
||||||
|
$cumuldata = array();
|
||||||
|
|
||||||
// list the summary of the bills
|
// list the summary of the bills
|
||||||
if (! empty($conf->facture->enabled) && $user->rights->facture->lire) {
|
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||||
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
$facturestatic=new Facture($db);
|
$facturestatic=new Facture($db);
|
||||||
|
|
||||||
@ -130,9 +133,11 @@ class box_activity extends ModeleBoxes
|
|||||||
} else {
|
} else {
|
||||||
$data = dol_readcachefile($cachedir, $filename);
|
$data = dol_readcachefile($cachedir, $filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$cumuldata=array_merge($cumuldata, $data);
|
||||||
if (! empty($data)) {
|
if (! empty($data)) {
|
||||||
$j=0;
|
$j=0;
|
||||||
while ($line < count($data)) {
|
while ($line < count($cumuldata)) {
|
||||||
$billurl="viewstatut=2&paye=1&year=".$data[$j]->annee;
|
$billurl="viewstatut=2&paye=1&year=".$data[$j]->annee;
|
||||||
$this->info_box_contents[$line][0] = array(
|
$this->info_box_contents[$line][0] = array(
|
||||||
'td' => 'align="left" width="16"',
|
'td' => 'align="left" width="16"',
|
||||||
@ -193,7 +198,7 @@ class box_activity extends ModeleBoxes
|
|||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num = $db->num_rows($result) + $line;
|
$num = $db->num_rows($result);
|
||||||
$j=0;
|
$j=0;
|
||||||
while ($j < $num) {
|
while ($j < $num) {
|
||||||
$data[$j]=$db->fetch_object($result);
|
$data[$j]=$db->fetch_object($result);
|
||||||
@ -209,10 +214,12 @@ class box_activity extends ModeleBoxes
|
|||||||
} else {
|
} else {
|
||||||
$data = dol_readcachefile($cachedir, $filename);
|
$data = dol_readcachefile($cachedir, $filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$cumuldata=array_merge($cumuldata, $data);
|
||||||
if (! empty($data)) {
|
if (! empty($data)) {
|
||||||
$j=0;
|
$j=0;
|
||||||
|
|
||||||
while ($line < count($data)) {
|
while ($line < count($cumuldata)) {
|
||||||
$billurl="viewstatut=".$data[$j]->fk_statut."&paye=0";
|
$billurl="viewstatut=".$data[$j]->fk_statut."&paye=0";
|
||||||
$this->info_box_contents[$line][0] = array(
|
$this->info_box_contents[$line][0] = array(
|
||||||
'td' => 'align="left" width="16"',
|
'td' => 'align="left" width="16"',
|
||||||
@ -233,7 +240,7 @@ class box_activity extends ModeleBoxes
|
|||||||
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||||
);
|
);
|
||||||
$totalnb += $data[$j]->nb;
|
$totalnb += $data[$j]->nb;
|
||||||
$this->info_box_contents[$line][3] = array(
|
$this->info_box_contents[$line][3] = array(
|
||||||
'td' => 'align="right"',
|
'td' => 'align="right"',
|
||||||
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
|
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
|
||||||
);
|
);
|
||||||
@ -286,7 +293,7 @@ class box_activity extends ModeleBoxes
|
|||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num = $db->num_rows($result) + $line;
|
$num = $db->num_rows($result);
|
||||||
$j=0;
|
$j=0;
|
||||||
while ($j < $num) {
|
while ($j < $num) {
|
||||||
$data[$j]=$db->fetch_object($result);
|
$data[$j]=$db->fetch_object($result);
|
||||||
@ -302,9 +309,11 @@ class box_activity extends ModeleBoxes
|
|||||||
} else {
|
} else {
|
||||||
$data = dol_readcachefile($cachedir, $filename);
|
$data = dol_readcachefile($cachedir, $filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$cumuldata=array_merge($cumuldata, $data);
|
||||||
if (! empty($data)) {
|
if (! empty($data)) {
|
||||||
$j=0;
|
$j=0;
|
||||||
while ($line < count($data)) {
|
while ($line < count($cumuldata)) {
|
||||||
$this->info_box_contents[$line][0] = array(
|
$this->info_box_contents[$line][0] = array(
|
||||||
'td' => 'align="left" width="16"',
|
'td' => 'align="left" width="16"',
|
||||||
'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=".$data[$j]->fk_statut,
|
'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=".$data[$j]->fk_statut,
|
||||||
@ -342,7 +351,8 @@ class box_activity extends ModeleBoxes
|
|||||||
}
|
}
|
||||||
|
|
||||||
// list the summary of the propals
|
// list the summary of the propals
|
||||||
if (! empty($conf->propal->enabled) && $user->rights->propal->lire) {
|
if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
||||||
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||||
$propalstatic=new Propal($db);
|
$propalstatic=new Propal($db);
|
||||||
|
|
||||||
@ -350,7 +360,8 @@ class box_activity extends ModeleBoxes
|
|||||||
$filename = '/boxactivity-propal'.$fileid;
|
$filename = '/boxactivity-propal'.$fileid;
|
||||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||||
$data = array();
|
$data = array();
|
||||||
if ($refresh) {
|
if ($refresh)
|
||||||
|
{
|
||||||
$sql = "SELECT p.fk_statut, SUM(p.total) as Mnttot, COUNT(*) as nb";
|
$sql = "SELECT p.fk_statut, SUM(p.total) as Mnttot, COUNT(*) as nb";
|
||||||
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p";
|
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p";
|
||||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
@ -365,9 +376,10 @@ class box_activity extends ModeleBoxes
|
|||||||
$sql.= " ORDER BY p.fk_statut DESC";
|
$sql.= " ORDER BY p.fk_statut DESC";
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
if ($result) {
|
|
||||||
$num = $db->num_rows($result) + $line;
|
|
||||||
$j=0;
|
$j=0;
|
||||||
while ($j < $num) {
|
while ($j < $num) {
|
||||||
$data[$j]=$db->fetch_object($result);
|
$data[$j]=$db->fetch_object($result);
|
||||||
@ -380,26 +392,31 @@ class box_activity extends ModeleBoxes
|
|||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$data = dol_readcachefile($cachedir, $filename);
|
$data = dol_readcachefile($cachedir, $filename);
|
||||||
}
|
}
|
||||||
if (! empty($data)) {
|
|
||||||
|
$cumuldata=array_merge($cumuldata, $data);
|
||||||
|
if (! empty($data))
|
||||||
|
{
|
||||||
$j=0;
|
$j=0;
|
||||||
while ($line < count($data)) {
|
while ($line < count($cumuldata))
|
||||||
$this->info_box_contents[$line][] = array(
|
{
|
||||||
|
$this->info_box_contents[$line][0] = array(
|
||||||
'td' => 'align="left" width="16"',
|
'td' => 'align="left" width="16"',
|
||||||
'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$data[$j]->fk_statut,
|
'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$data[$j]->fk_statut,
|
||||||
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
||||||
'logo' => 'object_propal'
|
'logo' => 'object_propal'
|
||||||
);
|
);
|
||||||
|
|
||||||
$objp = $db->fetch_object($result);
|
$this->info_box_contents[$line][1] = array(
|
||||||
$this->info_box_contents[$line][] = array(
|
|
||||||
'td' => 'align="left"',
|
'td' => 'align="left"',
|
||||||
'text' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
'text' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$line][] = array(
|
$this->info_box_contents[$line][2] = array(
|
||||||
'td' => 'align="right"',
|
'td' => 'align="right"',
|
||||||
'text' => $data[$j]->nb,
|
'text' => $data[$j]->nb,
|
||||||
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
||||||
@ -407,12 +424,12 @@ class box_activity extends ModeleBoxes
|
|||||||
);
|
);
|
||||||
$totalnb += $data[$j]->nb;
|
$totalnb += $data[$j]->nb;
|
||||||
|
|
||||||
$this->info_box_contents[$line][] = array(
|
$this->info_box_contents[$line][3] = array(
|
||||||
'td' => 'align="right"',
|
'td' => 'align="right"',
|
||||||
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
|
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
|
||||||
);
|
);
|
||||||
$totalMnt += $data[$j]->Mnttot;
|
$totalMnt += $data[$j]->Mnttot;
|
||||||
$this->info_box_contents[$line][] = array(
|
$this->info_box_contents[$line][4] = array(
|
||||||
'td' => 'align="right" width="18"',
|
'td' => 'align="right" width="18"',
|
||||||
'text' => $propalstatic->LibStatut($data[$j]->fk_statut,3),
|
'text' => $propalstatic->LibStatut($data[$j]->fk_statut,3),
|
||||||
);
|
);
|
||||||
@ -423,38 +440,24 @@ class box_activity extends ModeleBoxes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the sum in the bottom of the boxes
|
// Add the sum in the bottom of the boxes
|
||||||
$this->info_box_contents[$line][1] = array(
|
$this->info_box_contents[$line][0] = array('tr' => 'class="liste_total"');
|
||||||
'td' => 'align="left" ',
|
$this->info_box_contents[$line][1] = array('td' => 'align="left" class="liste_total" ', 'text' => $langs->trans("Total")." ".$textHead);
|
||||||
'text' => $langs->trans("Total")." ".$textHead,
|
$this->info_box_contents[$line][2] = array('td' => 'align="right" class="liste_total" ', 'text' => $totalnb);
|
||||||
);
|
$this->info_box_contents[$line][3] = array('td' => 'align="right" class="liste_total" ', 'text' => '');
|
||||||
$this->info_box_contents[$line][2] = array(
|
$this->info_box_contents[$line][4] = array('td' => 'align="right" class="liste_total" ', 'text' => "");
|
||||||
'td' => 'align="right" ',
|
|
||||||
'text' => $totalnb,
|
|
||||||
);
|
|
||||||
$this->info_box_contents[$line][3] = array(
|
|
||||||
'td' => 'align="right" ',
|
|
||||||
'text' => price($totalMnt,1,$langs,0,0,-1,$conf->currency)
|
|
||||||
);
|
|
||||||
$this->info_box_contents[$line][4] = array(
|
|
||||||
'td' => 'align="right" ',
|
|
||||||
'text' => "",
|
|
||||||
);
|
|
||||||
$this->info_box_contents[$line][5] = array(
|
|
||||||
'td' => 'align="right"',
|
|
||||||
'text' => "",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Method to show box
|
/**
|
||||||
*
|
* Method to show box
|
||||||
* @param array $head Array with properties of box title
|
*
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $head Array with properties of box title
|
||||||
* @return void
|
* @param array $contents Array with properties of box lines
|
||||||
*/
|
* @return void
|
||||||
function showBox($head = null, $contents = null)
|
*/
|
||||||
{
|
function showBox($head = null, $contents = null)
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
{
|
||||||
}
|
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,7 +62,7 @@ class box_contacts extends ModeleBoxes
|
|||||||
|
|
||||||
if ($user->rights->societe->lire)
|
if ($user->rights->societe->lire)
|
||||||
{
|
{
|
||||||
$sql = "SELECT sp.rowid, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc";
|
$sql = "SELECT sp.rowid as id, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc";
|
||||||
$sql.= ", s.nom as socname";
|
$sql.= ", s.nom as socname";
|
||||||
$sql.= ", s.code_client";
|
$sql.= ", s.code_client";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||||
@ -87,7 +87,8 @@ class box_contacts extends ModeleBoxes
|
|||||||
$datec=$db->jdate($objp->datec);
|
$datec=$db->jdate($objp->datec);
|
||||||
$datem=$db->jdate($objp->tms);
|
$datem=$db->jdate($objp->tms);
|
||||||
|
|
||||||
$contactstatic->lastname=$objp->lastname;
|
$contactstatic->id=$objp->id;
|
||||||
|
$contactstatic->lastname=$objp->lastname;
|
||||||
$contactstatic->firstname=$objp->firstname;
|
$contactstatic->firstname=$objp->firstname;
|
||||||
$contactstatic->civility_id=$objp->civility_id;
|
$contactstatic->civility_id=$objp->civility_id;
|
||||||
|
|
||||||
|
|||||||
@ -85,8 +85,8 @@ class CMailFile
|
|||||||
* CMailFile
|
* CMailFile
|
||||||
*
|
*
|
||||||
* @param string $subject Topic/Subject of mail
|
* @param string $subject Topic/Subject of mail
|
||||||
* @param string $to Recipients emails (RFC 2822: "Nom firstname <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]")
|
* @param string $to Recipients emails (RFC 2822: "Name firstname <email>[, ...]" or "email[, ...]" or "<email>[, ...]"). Note: the keyword '__SUPERVISOREMAIL__' is not allowed here and must be replaced by caller.
|
||||||
* @param string $from Sender email (RFC 2822: "Nom firstname <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]")
|
* @param string $from Sender email (RFC 2822: "Name firstname <email>[, ...]" or "email[, ...]" or "<email>[, ...]")
|
||||||
* @param string $msg Message
|
* @param string $msg Message
|
||||||
* @param array $filename_list List of files to attach (full path of filename on file system)
|
* @param array $filename_list List of files to attach (full path of filename on file system)
|
||||||
* @param array $mimetype_list List of MIME type of attached files
|
* @param array $mimetype_list List of MIME type of attached files
|
||||||
@ -98,9 +98,7 @@ class CMailFile
|
|||||||
* @param string $errors_to Email errors
|
* @param string $errors_to Email errors
|
||||||
* @param string $css Css option
|
* @param string $css Css option
|
||||||
*/
|
*/
|
||||||
function __construct($subject,$to,$from,$msg,
|
function __construct($subject,$to,$from,$msg,$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0,$errors_to='',$css='')
|
||||||
$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),
|
|
||||||
$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0,$errors_to='',$css='')
|
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -1023,9 +1021,9 @@ class CMailFile
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an address for SMTP protocol
|
* Return a formatted address string for SMTP protocol
|
||||||
*
|
*
|
||||||
* @param string $address Example: 'John Doe <john@doe.com>' or 'john@doe.com'
|
* @param string $address Example: 'John Doe <john@doe.com>, Alan Smith <alan@smith.com>' or 'john@doe.com, alan@smith.com'
|
||||||
* @param int $format 0=auto, 1=emails with <>, 2=emails without <>, 3=auto + label between "
|
* @param int $format 0=auto, 1=emails with <>, 2=emails without <>, 3=auto + label between "
|
||||||
* @param int $encode 1=Encode name to RFC2822
|
* @param int $encode 1=Encode name to RFC2822
|
||||||
* @return string If format 0: '<john@doe.com>' or 'John Doe <john@doe.com>' or '=?UTF-8?B?Sm9obiBEb2U=?= <john@doe.com>'
|
* @return string If format 0: '<john@doe.com>' or 'John Doe <john@doe.com>' or '=?UTF-8?B?Sm9obiBEb2U=?= <john@doe.com>'
|
||||||
|
|||||||
@ -400,5 +400,100 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobjectline.class.php';
|
|||||||
*/
|
*/
|
||||||
abstract class CommonInvoiceLine extends CommonObjectLine
|
abstract class CommonInvoiceLine extends CommonObjectLine
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Quantity
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $qty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit price before taxes
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
public $subprice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type of the product. 0 for product 1 for service
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $product_type = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Id of corresponding product
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $fk_product;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VAT %
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
public $tva_tx;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Local tax 1 %
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
public $localtax1_tx;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Local tax 2 %
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
public $localtax2_tx;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Percent of discount
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
public $remise_percent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Total amount before taxes
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
public $total_ht;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Total VAT amount
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
public $total_tva;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Total local tax 1 amount
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
public $total_localtax1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Total local tax 2 amount
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
public $total_localtax2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Total amount with taxes
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
public $total_ttc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 int
|
||||||
|
*/
|
||||||
|
public $info_bits = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
*/
|
||||||
|
public function __construct(DoliDB $db)
|
||||||
|
{
|
||||||
|
$this->db = $db;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -35,46 +35,69 @@
|
|||||||
*/
|
*/
|
||||||
abstract class CommonObject
|
abstract class CommonObject
|
||||||
{
|
{
|
||||||
public $db;
|
/**
|
||||||
|
* @var DoliDb Database handler (result of a new DoliDB)
|
||||||
|
*/
|
||||||
|
public $db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var error Error string
|
* @var string Error string
|
||||||
* @deprecated Use instead the array of error strings
|
* @deprecated Use instead the array of error strings
|
||||||
*/
|
*/
|
||||||
public $error;
|
public $error;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var errors Aray of error string
|
* @var string[] Array of error strings
|
||||||
*/
|
*/
|
||||||
public $errors;
|
public $errors;
|
||||||
|
|
||||||
public $canvas; // Contains canvas name if it is
|
/**
|
||||||
public $context=array(); // Use to pass context information
|
* @var string Can be used to pass information when only object is provied to method
|
||||||
|
*/
|
||||||
|
public $context=array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Contains canvas name if record is an alternative canvas record
|
||||||
|
*/
|
||||||
|
public $canvas;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Key value used to track if data is coming from import wizard
|
||||||
|
*/
|
||||||
|
public $import_key;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var mixed Contains data to manage extrafields
|
||||||
|
*/
|
||||||
|
public $array_options=array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int[] Array of linked objects ids. Loaded by ->fetchObjectLinked
|
||||||
|
*/
|
||||||
|
public $linkedObjectsIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var mixed Array of linked objects. Loaded by ->fetchObjectLinked
|
||||||
|
*/
|
||||||
|
public $linkedObjects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Column name of the ref field.
|
||||||
|
*/
|
||||||
|
protected $table_ref_field = '';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Following var are used by some objects only. We keep this property here in CommonObject to be able to provide common method using them.
|
||||||
|
|
||||||
public $name;
|
public $name;
|
||||||
public $lastname;
|
public $lastname;
|
||||||
public $firstname;
|
public $firstname;
|
||||||
public $civility_id;
|
public $civility_id;
|
||||||
public $import_key;
|
|
||||||
|
|
||||||
public $array_options=array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var Societe
|
|
||||||
*/
|
|
||||||
public $thirdparty;
|
public $thirdparty;
|
||||||
|
|
||||||
public $linkedObjectsIds; // Loaded by ->fetchObjectLinked
|
|
||||||
public $linkedObjects; // Loaded by ->fetchObjectLinked
|
|
||||||
|
|
||||||
// No constructor as it is an abstract class
|
// No constructor as it is an abstract class
|
||||||
|
|
||||||
/**
|
|
||||||
* Column name of the ref field.
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $table_ref_field = '';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check an object id/ref exists
|
* Check an object id/ref exists
|
||||||
@ -2662,10 +2685,9 @@ abstract class CommonObject
|
|||||||
* @param string $buyer Object of buyer third party
|
* @param string $buyer Object of buyer third party
|
||||||
* @param string $selected Object line selected
|
* @param string $selected Object line selected
|
||||||
* @param int $dateSelector 1=Show also date range input fields
|
* @param int $dateSelector 1=Show also date range input fields
|
||||||
* @param int $permtoedit Permission to edit line
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0, $permtoedit=0)
|
function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0)
|
||||||
{
|
{
|
||||||
global $conf, $hookmanager, $inputalsopricewithtax, $usemargins, $langs, $user;
|
global $conf, $hookmanager, $inputalsopricewithtax, $usemargins, $langs, $user;
|
||||||
|
|
||||||
@ -2758,7 +2780,7 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected,$extrafieldsline,$permtoedit);
|
$this->printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected,$extrafieldsline);
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
@ -2770,7 +2792,7 @@ abstract class CommonObject
|
|||||||
* TODO Move this into an output class file (htmlline.class.php)
|
* TODO Move this into an output class file (htmlline.class.php)
|
||||||
*
|
*
|
||||||
* @param string $action GET/POST action
|
* @param string $action GET/POST action
|
||||||
* @param array $line Selected object line to output
|
* @param CommonObjectLine $line Selected object line to output
|
||||||
* @param string $var Is it a an odd line (true)
|
* @param string $var Is it a an odd line (true)
|
||||||
* @param int $num Number of line (0)
|
* @param int $num Number of line (0)
|
||||||
* @param int $i I
|
* @param int $i I
|
||||||
@ -2779,13 +2801,14 @@ abstract class CommonObject
|
|||||||
* @param string $buyer Object of buyer third party
|
* @param string $buyer Object of buyer third party
|
||||||
* @param string $selected Object line selected
|
* @param string $selected Object line selected
|
||||||
* @param object $extrafieldsline Object of extrafield line attribute
|
* @param object $extrafieldsline Object of extrafield line attribute
|
||||||
* @param int $permtoedit Permission to edit
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected=0,$extrafieldsline=0,$permtoedit=0)
|
function printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected=0,$extrafieldsline=0)
|
||||||
{
|
{
|
||||||
global $conf,$langs,$user,$object,$hookmanager;
|
global $conf,$langs,$user,$object,$hookmanager;
|
||||||
global $form,$bc,$bcdd;
|
global $form,$bc,$bcdd, $object_rights;
|
||||||
|
|
||||||
|
$object_rights = $this->getRights();
|
||||||
|
|
||||||
$element=$this->element;
|
$element=$this->element;
|
||||||
|
|
||||||
@ -3860,4 +3883,16 @@ abstract class CommonObject
|
|||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the rights used for this class
|
||||||
|
* @return stdClass
|
||||||
|
*/
|
||||||
|
public function getRights()
|
||||||
|
{
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
return $user->rights->{$this->element};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,19 @@
|
|||||||
*/
|
*/
|
||||||
abstract class CommonObjectLine extends CommonObject
|
abstract class CommonObjectLine extends CommonObject
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Id of the line
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Id of the line
|
||||||
|
* @var int
|
||||||
|
* @deprecated Try to use id property as possible
|
||||||
|
*/
|
||||||
|
public $rowid;
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
// Currently we need function at end of file CommonObject for all object lines. Should find a way to avoid duplicate code.
|
// Currently we need function at end of file CommonObject for all object lines. Should find a way to avoid duplicate code.
|
||||||
|
|||||||
@ -22,6 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobjectline.class.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class CommonOrder
|
* \class CommonOrder
|
||||||
@ -36,8 +37,141 @@ abstract class CommonOrder extends CommonObject
|
|||||||
* \class CommonOrderLine
|
* \class CommonOrderLine
|
||||||
* \brief Superclass for orders classes
|
* \brief Superclass for orders classes
|
||||||
*/
|
*/
|
||||||
abstract class CommonOrderLine extends CommonObject
|
abstract class CommonOrderLine extends CommonObjectLine
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Product ref
|
||||||
|
* @var string
|
||||||
|
* @deprecated Use product_ref
|
||||||
|
*/
|
||||||
|
public $ref;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Product ref
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $product_ref;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Product label
|
||||||
|
* @var string
|
||||||
|
* @deprecated Use product_label
|
||||||
|
*/
|
||||||
|
public $libelle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Product label
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $product_label;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Product description
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $product_desc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Quantity
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $qty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
var $price;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit price before taxes
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
public $subprice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type of the product. 0 for product 1 for service
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $product_type = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description of the line
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $desc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Id of corresponding product
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $fk_product;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Percent line discount
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
public $remise_percent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VAT %
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
public $tva_tx;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Local tax 1 %
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
public $localtax1_tx;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Local tax 2 %
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
public $localtax2_tx;
|
||||||
|
|
||||||
|
public $localtax1_type;
|
||||||
|
public $localtax2_type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Total amount before taxes
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
public $total_ht;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Total VAT amount
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
public $total_tva;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Total local tax 1 amount
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
public $total_localtax1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Total local tax 2 amount
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
public $total_localtax2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Total amount with taxes
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
public $total_ttc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 int
|
||||||
|
*/
|
||||||
|
public $info_bits = 0;
|
||||||
|
|
||||||
|
public $special_code = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -379,16 +379,6 @@ class Conf
|
|||||||
$this->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER=1;
|
$this->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->productbatch->enabled))
|
|
||||||
{
|
|
||||||
$this->global->STOCK_CALCULATE_ON_BILL=0;
|
|
||||||
$this->global->STOCK_CALCULATE_ON_VALIDATE_ORDER=0;
|
|
||||||
$this->global->STOCK_CALCULATE_ON_SHIPMENT=1;
|
|
||||||
$this->global->STOCK_CALCULATE_ON_SUPPLIER_BILL=0;
|
|
||||||
$this->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER=0;
|
|
||||||
$this->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// conf->currency
|
// conf->currency
|
||||||
if (empty($this->global->MAIN_MONNAIE)) $this->global->MAIN_MONNAIE='EUR';
|
if (empty($this->global->MAIN_MONNAIE)) $this->global->MAIN_MONNAIE='EUR';
|
||||||
$this->currency=$this->global->MAIN_MONNAIE;
|
$this->currency=$this->global->MAIN_MONNAIE;
|
||||||
@ -448,6 +438,9 @@ class Conf
|
|||||||
// Default pdf use dash between lines
|
// Default pdf use dash between lines
|
||||||
if (! isset($this->global->MAIN_PDF_DASH_BETWEEN_LINES)) $this->global->MAIN_PDF_DASH_BETWEEN_LINES=1;
|
if (! isset($this->global->MAIN_PDF_DASH_BETWEEN_LINES)) $this->global->MAIN_PDF_DASH_BETWEEN_LINES=1;
|
||||||
|
|
||||||
|
// Set default value to MAIN_SHOW_LOGO
|
||||||
|
if (! isset($this->global->MAIN_SHOW_LOGO)) $this->global->MAIN_SHOW_LOGO=1;
|
||||||
|
|
||||||
// Default max file size for upload
|
// Default max file size for upload
|
||||||
$this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : $this->global->MAIN_UPLOAD_DOC * 1024);
|
$this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : $this->global->MAIN_UPLOAD_DOC * 1024);
|
||||||
|
|
||||||
@ -455,8 +448,8 @@ class Conf
|
|||||||
if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,askpricesupplier,facture,categorie,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda,adherent'; // '' means 'all'. Note that contact is added here as it should be a module later.
|
if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,askpricesupplier,facture,categorie,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda,adherent'; // '' means 'all'. Note that contact is added here as it should be a module later.
|
||||||
|
|
||||||
// Enable select2
|
// Enable select2
|
||||||
if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)) $conf->global->MAIN_USE_JQUERY_MULTISELECT='select2';
|
if (empty($this->global->MAIN_USE_JQUERY_MULTISELECT)) $this->global->MAIN_USE_JQUERY_MULTISELECT='select2';
|
||||||
|
|
||||||
// Timeouts
|
// Timeouts
|
||||||
if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) $this->global->MAIN_USE_CONNECT_TIMEOUT=10;
|
if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) $this->global->MAIN_USE_CONNECT_TIMEOUT=10;
|
||||||
if (empty($this->global->MAIN_USE_RESPONSE_TIMEOUT)) $this->global->MAIN_USE_RESPONSE_TIMEOUT=30;
|
if (empty($this->global->MAIN_USE_RESPONSE_TIMEOUT)) $this->global->MAIN_USE_RESPONSE_TIMEOUT=30;
|
||||||
|
|||||||
@ -435,23 +435,23 @@ class DiscountAbsolute
|
|||||||
|
|
||||||
if ($option == 'invoice') {
|
if ($option == 'invoice') {
|
||||||
$label=$langs->trans("ShowDiscount").': '.$this->ref_facture_source;
|
$label=$langs->trans("ShowDiscount").': '.$this->ref_facture_source;
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$this->fk_facture_source.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$link = '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$this->fk_facture_source.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
$ref=$this->ref_facture_source;
|
$ref=$this->ref_facture_source;
|
||||||
$picto='bill';
|
$picto='bill';
|
||||||
}
|
}
|
||||||
if ($option == 'discount') {
|
if ($option == 'discount') {
|
||||||
$label=$langs->trans("Discount");
|
$label=$langs->trans("Discount");
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$this->fk_soc.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$link = '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$this->fk_soc.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$lienfin='</a>';
|
$linkend='</a>';
|
||||||
$ref=$langs->trans("Discount");
|
$ref=$langs->trans("Discount");
|
||||||
$picto='generic';
|
$picto='generic';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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 && $withpicto != 2) $result.=' ';
|
||||||
$result.=$lien.$ref.$lienfin;
|
$result.=$link.$ref.$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -65,7 +65,7 @@ class DolGraph
|
|||||||
var $bgcolorgrid=array(255,255,255); // array(R,G,B)
|
var $bgcolorgrid=array(255,255,255); // array(R,G,B)
|
||||||
var $datacolor; // array(array(R,G,B),...)
|
var $datacolor; // array(array(R,G,B),...)
|
||||||
|
|
||||||
protected $stringtoshow; // To store string to output graph into HTML page
|
private $_stringtoshow; // To store string to output graph into HTML page
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -530,7 +530,7 @@ class ExtraFields
|
|||||||
$sql.= " ".($perms?"'".$this->db->escape($perms)."'":"null").",";
|
$sql.= " ".($perms?"'".$this->db->escape($perms)."'":"null").",";
|
||||||
$sql.= " '".$pos."',";
|
$sql.= " '".$pos."',";
|
||||||
$sql.= " '".$alwayseditable."',";
|
$sql.= " '".$alwayseditable."',";
|
||||||
$sql.= " '".$param."'";
|
$sql.= " '".$param."',";
|
||||||
$sql.= " ".$list;
|
$sql.= " ".$list;
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
dol_syslog(get_class($this)."::update_label", LOG_DEBUG);
|
dol_syslog(get_class($this)."::update_label", LOG_DEBUG);
|
||||||
@ -567,10 +567,12 @@ class ExtraFields
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
if ( empty($elementtype) ) return array();
|
||||||
|
|
||||||
if ($elementtype == 'thirdparty') $elementtype='societe';
|
if ($elementtype == 'thirdparty') $elementtype='societe';
|
||||||
|
|
||||||
$array_name_label=array();
|
$array_name_label=array();
|
||||||
|
|
||||||
// For avoid conflicts with external modules
|
// For avoid conflicts with external modules
|
||||||
if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return $array_name_label;
|
if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return $array_name_label;
|
||||||
|
|
||||||
@ -1054,6 +1056,7 @@ class ExtraFields
|
|||||||
elseif ($type == 'link')
|
elseif ($type == 'link')
|
||||||
{
|
{
|
||||||
$out='';
|
$out='';
|
||||||
|
|
||||||
$param_list=array_keys($param['options']);
|
$param_list=array_keys($param['options']);
|
||||||
// 0 : ObjectName
|
// 0 : ObjectName
|
||||||
// 1 : classPath
|
// 1 : classPath
|
||||||
@ -1062,7 +1065,7 @@ class ExtraFields
|
|||||||
$object = new $InfoFieldList[0]($this->db);
|
$object = new $InfoFieldList[0]($this->db);
|
||||||
$object->fetch($value);
|
$object->fetch($value);
|
||||||
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="20" value="'.$object->ref.'" >';
|
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="20" value="'.$object->ref.'" >';
|
||||||
|
|
||||||
}
|
}
|
||||||
/* Add comments
|
/* Add comments
|
||||||
if ($type == 'date') $out.=' (YYYY-MM-DD)';
|
if ($type == 'date') $out.=' (YYYY-MM-DD)';
|
||||||
@ -1292,14 +1295,15 @@ class ExtraFields
|
|||||||
elseif ($type == 'link')
|
elseif ($type == 'link')
|
||||||
{
|
{
|
||||||
$out='';
|
$out='';
|
||||||
$param_list=array_keys($params['options']);
|
// only if something to display (perf)
|
||||||
// 0 : ObjectName
|
|
||||||
// 1 : classPath
|
|
||||||
$InfoFieldList = explode(":", $param_list[0]);
|
|
||||||
dol_include_once($InfoFieldList[1]);
|
|
||||||
$object = new $InfoFieldList[0]($this->db);
|
|
||||||
if ($value)
|
if ($value)
|
||||||
{
|
{
|
||||||
|
$param_list=array_keys($params['options']);
|
||||||
|
// 0 : ObjectName
|
||||||
|
// 1 : classPath
|
||||||
|
$InfoFieldList = explode(":", $param_list[0]);
|
||||||
|
dol_include_once($InfoFieldList[1]);
|
||||||
|
$object = new $InfoFieldList[0]($this->db);
|
||||||
$object->fetch($value);
|
$object->fetch($value);
|
||||||
$value=$object->getNomUrl(3);
|
$value=$object->getNomUrl(3);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
|||||||
/**
|
/**
|
||||||
* Class to manage fiscal year
|
* Class to manage fiscal year
|
||||||
*/
|
*/
|
||||||
class Fiscalyear
|
class Fiscalyear extends CommonObject
|
||||||
{
|
{
|
||||||
public $element='fiscalyear';
|
public $element='fiscalyear';
|
||||||
public $table_element='accounting_fiscalyear';
|
public $table_element='accounting_fiscalyear';
|
||||||
|
|||||||
@ -395,12 +395,13 @@ class Form
|
|||||||
$htmltext=str_replace("\n","",$htmltext);
|
$htmltext=str_replace("\n","",$htmltext);
|
||||||
|
|
||||||
$htmltext=str_replace('"',""",$htmltext);
|
$htmltext=str_replace('"',""",$htmltext);
|
||||||
if ($tooltipon == 2 || $tooltipon == 3) $paramfortooltipimg=' class="classfortooltip'.($extracss?' '.$extracss:'').'" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td img tag to store tooltip
|
if ($tooltipon == 2 || $tooltipon == 3) $paramfortooltipimg=' class="classfortooltip inline-block'.($extracss?' '.$extracss:'').'" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td img tag to store tooltip
|
||||||
else $paramfortooltipimg =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag
|
else $paramfortooltipimg =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag
|
||||||
if ($tooltipon == 1 || $tooltipon == 3) $paramfortooltiptd=' class="classfortooltip'.($extracss?' '.$extracss:'').'" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td tag to store tooltip
|
if ($tooltipon == 1 || $tooltipon == 3) $paramfortooltiptd=' class="classfortooltip inline-block'.($extracss?' '.$extracss:'').'" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td tag to store tooltip
|
||||||
else $paramfortooltiptd =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag
|
else $paramfortooltiptd =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag
|
||||||
$s="";
|
$s="";
|
||||||
if (empty($notabs)) $s.='<table class="nobordernopadding" summary=""><tr>';
|
if (empty($notabs)) $s.='<table class="nobordernopadding" summary=""><tr>';
|
||||||
|
elseif ($notabs == 2) $s.='<div class="inline-block nowrap">';
|
||||||
if ($direction < 0) {
|
if ($direction < 0) {
|
||||||
$s.='<'.$tag.$paramfortooltipimg;
|
$s.='<'.$tag.$paramfortooltipimg;
|
||||||
if ($tag == 'td') {
|
if ($tag == 'td') {
|
||||||
@ -411,8 +412,8 @@ class Form
|
|||||||
// Use another method to help avoid having a space in value in order to use this value with jquery
|
// Use another method to help avoid having a space in value in order to use this value with jquery
|
||||||
// TODO add this in css
|
// TODO add this in css
|
||||||
//if ($text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.(($direction < 0)?' ':'').$text.(($direction > 0)?' ':'').'</'.$tag.'>';
|
//if ($text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.(($direction < 0)?' ':'').$text.(($direction > 0)?' ':'').'</'.$tag.'>';
|
||||||
$paramfortooltiptd.= (($direction < 0)?' style="padding-left: 3px !important;"':'');
|
$paramfortooltiptd.= (($direction < 0)?' class="inline-block" style="padding-left: 3px !important;"':'');
|
||||||
$paramfortooltiptd.= (($direction > 0)?' style="padding-right: 3px !important;"':'');
|
$paramfortooltiptd.= (($direction > 0)?' class="inline-block" style="padding-right: 3px !important;"':'');
|
||||||
if ((string) $text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>';
|
if ((string) $text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>';
|
||||||
if ($direction > 0) {
|
if ($direction > 0) {
|
||||||
$s.='<'.$tag.$paramfortooltipimg;
|
$s.='<'.$tag.$paramfortooltipimg;
|
||||||
@ -422,6 +423,7 @@ class Form
|
|||||||
$s.= '>'.$img.'</'.$tag.'>';
|
$s.= '>'.$img.'</'.$tag.'>';
|
||||||
}
|
}
|
||||||
if (empty($notabs)) $s.='</tr></table>';
|
if (empty($notabs)) $s.='</tr></table>';
|
||||||
|
elseif ($notabs == 2) $s.='</div>';
|
||||||
|
|
||||||
return $s;
|
return $s;
|
||||||
}
|
}
|
||||||
@ -583,7 +585,7 @@ class Form
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_incoterms";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_incoterms";
|
||||||
$sql.= " WHERE active = 1";
|
$sql.= " WHERE active = 1";
|
||||||
$sql.= " ORDER BY code ASC";
|
$sql.= " ORDER BY code ASC";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG);
|
dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -593,14 +595,14 @@ class Form
|
|||||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||||
$out .= ajax_combobox($htmlname, $events);
|
$out .= ajax_combobox($htmlname, $events);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($page))
|
if (!empty($page))
|
||||||
{
|
{
|
||||||
$out .= '<form method="post" action="'.$page.'">';
|
$out .= '<form method="post" action="'.$page.'">';
|
||||||
$out .= '<input type="hidden" name="action" value="set_incoterms">';
|
$out .= '<input type="hidden" name="action" value="set_incoterms">';
|
||||||
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
$out.= '<select id="'.$htmlname.'" class="flat selectincoterm" name="'.$htmlname.'" '.$htmloption.'>';
|
$out.= '<select id="'.$htmlname.'" class="flat selectincoterm" name="'.$htmlname.'" '.$htmloption.'>';
|
||||||
$out.= '<option value=""></option>';
|
$out.= '<option value=""></option>';
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
@ -627,17 +629,17 @@ class Form
|
|||||||
{
|
{
|
||||||
$out.= '<option value="'.$row['rowid'].'">';
|
$out.= '<option value="'.$row['rowid'].'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['code']) $out.= $row['code'];
|
if ($row['code']) $out.= $row['code'];
|
||||||
|
|
||||||
$out.= '</option>';
|
$out.= '</option>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$out.= '</select>';
|
$out.= '</select>';
|
||||||
|
|
||||||
$out .= '<input id="location_incoterms" name="location_incoterms" size="14" value="'.$location_incoterms.'">';
|
$out .= '<input id="location_incoterms" name="location_incoterms" size="14" value="'.$location_incoterms.'">';
|
||||||
|
|
||||||
if (!empty($page))
|
if (!empty($page))
|
||||||
{
|
{
|
||||||
$out .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'"></form>';
|
$out .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'"></form>';
|
||||||
}
|
}
|
||||||
@ -1641,7 +1643,7 @@ class Form
|
|||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/class/priceparser.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
|
||||||
$num = $this->db->num_rows($result);
|
$num = $this->db->num_rows($result);
|
||||||
|
|
||||||
$out.='<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
$out.='<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||||
@ -2022,7 +2024,7 @@ class Form
|
|||||||
$result=$this->db->query($sql);
|
$result=$this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/class/priceparser.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
|
||||||
|
|
||||||
$num = $this->db->num_rows($result);
|
$num = $this->db->num_rows($result);
|
||||||
|
|
||||||
@ -2191,7 +2193,7 @@ class Form
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/class/priceparser.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
|
||||||
$form.= '<option value="0"> </option>';
|
$form.= '<option value="0"> </option>';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -4445,7 +4447,7 @@ class Form
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$selected=($useempty?'':' selected="selected"');
|
$selected=(($useempty && $value != '0' && $value != 'no')?'':' selected="selected"');
|
||||||
$resultyesno .= '<option value="'.$yes.'">'.$langs->trans("Yes").'</option>'."\n";
|
$resultyesno .= '<option value="'.$yes.'">'.$langs->trans("Yes").'</option>'."\n";
|
||||||
$resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans("No").'</option>'."\n";
|
$resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans("No").'</option>'."\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -550,7 +550,11 @@ class FormFile
|
|||||||
|
|
||||||
// Execute hooks
|
// Execute hooks
|
||||||
$parameters=array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''),'modulepart'=>$modulepart);
|
$parameters=array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''),'modulepart'=>$modulepart);
|
||||||
if (is_object($hookmanager)) $out.= $hookmanager->executeHooks('formBuilddocOptions',$parameters,$GLOBALS['object']);
|
if (is_object($hookmanager))
|
||||||
|
{
|
||||||
|
$reshook = $hookmanager->executeHooks('formBuilddocOptions',$parameters,$GLOBALS['object']);
|
||||||
|
$out.= $hookmanager->resPrint;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get list of files
|
// Get list of files
|
||||||
|
|||||||
@ -782,7 +782,7 @@ class FormOther
|
|||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
|
|
||||||
$montharray = monthArray($langs); // Get array
|
$montharray = monthArray($langs, 1); // Get array
|
||||||
|
|
||||||
$select_month = '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
$select_month = '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||||
if ($useempty)
|
if ($useempty)
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2006-2011 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -25,11 +25,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class Ldap
|
* Class to manage LDAP features
|
||||||
* \brief Class to manage LDAP features
|
|
||||||
*/
|
*/
|
||||||
class Ldap
|
class Ldap
|
||||||
{
|
{
|
||||||
|
var $error;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tableau des serveurs (IP addresses ou nom d'hotes)
|
* Tableau des serveurs (IP addresses ou nom d'hotes)
|
||||||
*/
|
*/
|
||||||
@ -78,7 +79,7 @@ class Ldap
|
|||||||
var $name;
|
var $name;
|
||||||
var $firstname;
|
var $firstname;
|
||||||
var $login;
|
var $login;
|
||||||
var $phone;
|
var $phone;
|
||||||
var $skype;
|
var $skype;
|
||||||
var $fax;
|
var $fax;
|
||||||
var $mail;
|
var $mail;
|
||||||
@ -414,9 +415,10 @@ class Ldap
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=@ldap_error($this->connection);
|
$this->ldapErrorCode = @ldap_errno($this->connection);
|
||||||
$this->errno=@ldap_errno($this->connection);
|
$this->ldapErrorText = @ldap_error($this->connection);
|
||||||
dol_syslog(get_class($this)."::add failed: ".$this->errno." ".$this->error, LOG_ERR);
|
$this->error=$this->ldapErrorCode." ".$this->ldapErrorText;
|
||||||
|
dol_syslog(get_class($this)."::add failed: ".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,14 +61,15 @@ class Notify
|
|||||||
*
|
*
|
||||||
* @param string $action Id of action in llx_c_action_trigger
|
* @param string $action Id of action in llx_c_action_trigger
|
||||||
* @param int $socid Id of third party
|
* @param int $socid Id of third party
|
||||||
|
* @param Object $object Object the notification is about
|
||||||
* @return string Message
|
* @return string Message
|
||||||
*/
|
*/
|
||||||
function confirmMessage($action,$socid)
|
function confirmMessage($action,$socid,$object)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("mails");
|
$langs->load("mails");
|
||||||
|
|
||||||
$nb=$this->countDefinedNotifications($action,$socid);
|
$nb=$this->countDefinedNotifications($action,$socid,$object);
|
||||||
if ($nb <= 0) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("NoNotificationsWillBeSent");
|
if ($nb <= 0) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("NoNotificationsWillBeSent");
|
||||||
if ($nb == 1) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("ANotificationsWillBeSent");
|
if ($nb == 1) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("ANotificationsWillBeSent");
|
||||||
if ($nb >= 2) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("SomeNotificationsWillBeSent",$nb);
|
if ($nb >= 2) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("SomeNotificationsWillBeSent",$nb);
|
||||||
@ -76,22 +77,26 @@ class Notify
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return number of notifications activated for action code and third party
|
* Return number of notifications activated for action code (and third party)
|
||||||
*
|
*
|
||||||
* @param string $action Code of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage)
|
* @param string $notifcode Code of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage)
|
||||||
* @param int $socid Id of third party
|
* @param int $socid Id of third party or 0 for all thirdparties
|
||||||
* @return int <0 if KO, nb of notifications sent if OK
|
* @param Object $object Object the notification is about
|
||||||
|
* @return int <0 if KO, nb of notifications sent if OK
|
||||||
*/
|
*/
|
||||||
function countDefinedNotifications($action,$socid)
|
function countDefinedNotifications($notifcode,$socid,$object=null)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
$num=0;
|
$num=0;
|
||||||
|
|
||||||
|
$valueforthreshold = 0;
|
||||||
|
if (is_object($object)) $valueforthreshold = $object->total_ht;
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$sql = "SELECT n.rowid";
|
$sql = "SELECT COUNT(n.rowid) as nb";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n,";
|
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."socpeople as c,";
|
$sql.= " ".MAIN_DB_PREFIX."socpeople as c,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
||||||
@ -99,36 +104,52 @@ class Notify
|
|||||||
$sql.= " WHERE n.fk_contact = c.rowid";
|
$sql.= " WHERE n.fk_contact = c.rowid";
|
||||||
$sql.= " AND a.rowid = n.fk_action";
|
$sql.= " AND a.rowid = n.fk_action";
|
||||||
$sql.= " AND n.fk_soc = s.rowid";
|
$sql.= " AND n.fk_soc = s.rowid";
|
||||||
if (is_numeric($action)) $sql.= " AND n.fk_action = ".$action; // Old usage
|
if ($notifcode)
|
||||||
else $sql.= " AND a.code = '".$action."'"; // New usage
|
{
|
||||||
|
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
|
||||||
|
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
|
||||||
|
}
|
||||||
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
|
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
|
||||||
$sql.= " AND s.rowid = ".$socid;
|
if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::countDefinedNotifications ".$action.", ".$socid."", LOG_DEBUG);
|
dol_syslog(get_class($this)."::countDefinedNotifications ".$notifcode.", ".$socid."", LOG_DEBUG);
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num = $this->db->num_rows($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
if ($obj) $num = $obj->nb;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$this->error=$this->db->error.' sql='.$sql;
|
$this->error=$this->db->lasterror();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
|
||||||
// List of notifications enabled for fixed email
|
// List of notifications enabled for fixed email
|
||||||
foreach($conf->global as $key => $val)
|
foreach($conf->global as $key => $val)
|
||||||
{
|
{
|
||||||
if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$action.'/', $key, $reg)) continue;
|
if ($notifcode)
|
||||||
$num++;
|
{
|
||||||
|
if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_.*_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$threshold = (float) $reg[1];
|
||||||
|
if ($valueforthreshold < $threshold) continue;
|
||||||
|
|
||||||
|
$tmpemail=explode(',',$val);
|
||||||
|
$num+=count($tmpemail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO return array with list of email instead of number, + type of notification (contacts or fixed email)
|
|
||||||
if ($error) return -1;
|
if ($error) return -1;
|
||||||
return $num;
|
return $num;
|
||||||
}
|
}
|
||||||
@ -137,17 +158,17 @@ class Notify
|
|||||||
* Check if notification are active for couple action/company.
|
* Check if notification are active for couple action/company.
|
||||||
* If yes, send mail and save trace into llx_notify.
|
* If yes, send mail and save trace into llx_notify.
|
||||||
*
|
*
|
||||||
* @param string $action Code of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage)
|
* @param string $notifcode Code of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage)
|
||||||
* @param Object $object Object the notification deals on
|
* @param Object $object Object the notification deals on
|
||||||
* @return int <0 if KO, or number of changes if OK
|
* @return int <0 if KO, or number of changes if OK
|
||||||
*/
|
*/
|
||||||
function send($action, $object)
|
function send($notifcode, $object)
|
||||||
{
|
{
|
||||||
global $conf,$langs,$mysoc,$dolibarr_main_url_root;
|
global $user,$conf,$langs,$mysoc,$dolibarr_main_url_root;
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::send action=".$action.", object=".$object->id);
|
dol_syslog(get_class($this)."::send notifcode=".$notifcode.", object=".$object->id);
|
||||||
|
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
|
|
||||||
@ -166,7 +187,20 @@ class Notify
|
|||||||
$link = '';
|
$link = '';
|
||||||
$num = 0;
|
$num = 0;
|
||||||
|
|
||||||
if (! in_array($action, array('BILL_VALIDATE', 'ORDER_VALIDATE', 'PROPAL_VALIDATE', 'FICHINTER_VALIDATE', 'ORDER_SUPPLIER_APPROVE', 'ORDER_SUPPLIER_REFUSE', 'SHIPPING_VALIDATE')))
|
if (! in_array(
|
||||||
|
$notifcode,
|
||||||
|
array(
|
||||||
|
'BILL_VALIDATE',
|
||||||
|
'ORDER_VALIDATE',
|
||||||
|
'PROPAL_VALIDATE',
|
||||||
|
'FICHINTER_VALIDATE',
|
||||||
|
'ORDER_SUPPLIER_VALIDATE',
|
||||||
|
'ORDER_SUPPLIER_APPROVE',
|
||||||
|
'ORDER_SUPPLIER_REFUSE',
|
||||||
|
'SHIPPING_VALIDATE'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -181,8 +215,8 @@ class Notify
|
|||||||
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql.= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action";
|
$sql.= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action";
|
||||||
$sql.= " AND n.fk_soc = s.rowid";
|
$sql.= " AND n.fk_soc = s.rowid";
|
||||||
if (is_numeric($action)) $sql.= " AND n.fk_action = ".$action; // Old usage
|
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
|
||||||
else $sql.= " AND a.code = '".$action."'"; // New usage
|
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
|
||||||
$sql .= " AND s.rowid = ".$object->socid;
|
$sql .= " AND s.rowid = ".$object->socid;
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
@ -197,8 +231,8 @@ class Notify
|
|||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
|
|
||||||
$sendto = $obj->firstname . " " . $obj->lastname . " <".$obj->email.">";
|
$sendto = dolGetFirstLastname($obj->firstname,$obj->lastname) . " <".$obj->email.">";
|
||||||
$actiondefid = $obj->adid;
|
$notifcodedefid = $obj->adid;
|
||||||
|
|
||||||
if (dol_strlen($obj->email))
|
if (dol_strlen($obj->email))
|
||||||
{
|
{
|
||||||
@ -210,7 +244,7 @@ class Notify
|
|||||||
$outputlangs->setDefaultLang($obj->default_lang);
|
$outputlangs->setDefaultLang($obj->default_lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($action) {
|
switch ($notifcode) {
|
||||||
case 'BILL_VALIDATE':
|
case 'BILL_VALIDATE':
|
||||||
$link='/compta/facture.php?facid='.$object->id;
|
$link='/compta/facture.php?facid='.$object->id;
|
||||||
$dir_output = $conf->facture->dir_output;
|
$dir_output = $conf->facture->dir_output;
|
||||||
@ -235,6 +269,14 @@ class Notify
|
|||||||
$object_type = 'ficheinter';
|
$object_type = 'ficheinter';
|
||||||
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref);
|
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref);
|
||||||
break;
|
break;
|
||||||
|
case 'ORDER_SUPPLIER_VALIDATE':
|
||||||
|
$link='/fourn/commande/card.php?id='.$object->id;
|
||||||
|
$dir_output = $conf->fournisseur->dir_output.'/commande/';
|
||||||
|
$object_type = 'order_supplier';
|
||||||
|
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
|
||||||
|
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderValidatedBy",$object->ref,$user->getFullName($langs));
|
||||||
|
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
|
||||||
|
break;
|
||||||
case 'ORDER_SUPPLIER_APPROVE':
|
case 'ORDER_SUPPLIER_APPROVE':
|
||||||
$link='/fourn/commande/card.php?id='.$object->id;
|
$link='/fourn/commande/card.php?id='.$object->id;
|
||||||
$dir_output = $conf->fournisseur->dir_output.'/commande/';
|
$dir_output = $conf->fournisseur->dir_output.'/commande/';
|
||||||
@ -294,7 +336,7 @@ class Notify
|
|||||||
if ($mailfile->sendfile())
|
if ($mailfile->sendfile())
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, objet_id, email)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, objet_id, email)";
|
||||||
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$actiondefid.", ".$object->socid.", ".$obj->cid.", '".$obj->type."', '".$object_type."', ".$object->id.", '".$this->db->escape($obj->email)."')";
|
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".$object->socid.", ".$obj->cid.", '".$obj->type."', '".$object_type."', ".$object->id.", '".$this->db->escape($obj->email)."')";
|
||||||
if (! $this->db->query($sql))
|
if (! $this->db->query($sql))
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
@ -328,113 +370,150 @@ class Notify
|
|||||||
// Check notification using fixed email
|
// Check notification using fixed email
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$param='NOTIFICATION_FIXEDEMAIL_'.$action;
|
foreach($conf->global as $key => $val)
|
||||||
if (! empty($conf->global->$param))
|
{
|
||||||
{
|
if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue;
|
||||||
$sendto = $conf->global->$param;
|
|
||||||
$actiondefid = dol_getIdFromCode($this->db, $action, 'c_action_trigger', 'code', 'rowid');
|
|
||||||
if ($actiondefid <= 0) dol_print_error($this->db, 'Failed to get id from code');
|
|
||||||
|
|
||||||
$object_type = '';
|
$threshold = (float) $reg[1];
|
||||||
|
if ($object->total_ht <= $threshold)
|
||||||
|
{
|
||||||
|
dol_syslog("A notification is requested for notifcode = ".$notifcode." but amount = ".$object->total_ht." so lower than threshold = ".$threshold.". We discard this notification");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$param='NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_'.$reg[1];
|
||||||
|
|
||||||
|
$sendto = $conf->global->$param;
|
||||||
|
$notifcodedefid = dol_getIdFromCode($this->db, $notifcode, 'c_action_trigger', 'code', 'rowid');
|
||||||
|
if ($notifcodedefid <= 0) dol_print_error($this->db, 'Failed to get id from code');
|
||||||
|
|
||||||
|
$object_type = '';
|
||||||
$link = '';
|
$link = '';
|
||||||
$num++;
|
$num++;
|
||||||
|
|
||||||
switch ($action) {
|
switch ($notifcode) {
|
||||||
case 'BILL_VALIDATE':
|
case 'BILL_VALIDATE':
|
||||||
$link='/compta/facture.php?facid='.$object->id;
|
$link='/compta/facture.php?facid='.$object->id;
|
||||||
$dir_output = $conf->facture->dir_output;
|
$dir_output = $conf->facture->dir_output;
|
||||||
$object_type = 'facture';
|
$object_type = 'facture';
|
||||||
$mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated",$object->ref);
|
$mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated",$object->ref);
|
||||||
break;
|
break;
|
||||||
case 'ORDER_VALIDATE':
|
case 'ORDER_VALIDATE':
|
||||||
$link='/commande/card.php?id='.$object->id;
|
$link='/commande/card.php?id='.$object->id;
|
||||||
$dir_output = $conf->commande->dir_output;
|
$dir_output = $conf->commande->dir_output;
|
||||||
$object_type = 'order';
|
$object_type = 'order';
|
||||||
$mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$object->ref);
|
$mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$object->ref);
|
||||||
break;
|
break;
|
||||||
case 'PROPAL_VALIDATE':
|
case 'PROPAL_VALIDATE':
|
||||||
$link='/comm/propal.php?id='.$object->id;
|
$link='/comm/propal.php?id='.$object->id;
|
||||||
$dir_output = $conf->propal->dir_output;
|
$dir_output = $conf->propal->dir_output;
|
||||||
$object_type = 'propal';
|
$object_type = 'propal';
|
||||||
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$object->ref);
|
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$object->ref);
|
||||||
break;
|
break;
|
||||||
case 'FICHINTER_VALIDATE':
|
case 'FICHINTER_VALIDATE':
|
||||||
$link='/fichinter/card.php?id='.$object->id;
|
$link='/fichinter/card.php?id='.$object->id;
|
||||||
$dir_output = $conf->facture->dir_output;
|
$dir_output = $conf->facture->dir_output;
|
||||||
$object_type = 'ficheinter';
|
$object_type = 'ficheinter';
|
||||||
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref);
|
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref);
|
||||||
break;
|
break;
|
||||||
case 'ORDER_SUPPLIER_APPROVE':
|
case 'ORDER_SUPPLIER_VALIDATE':
|
||||||
$link='/fourn/commande/card.php?id='.$object->id;
|
$link='/fourn/commande/card.php?id='.$object->id;
|
||||||
$dir_output = $conf->fournisseur->dir_output.'/commande/';
|
$dir_output = $conf->fournisseur->dir_output.'/commande/';
|
||||||
$object_type = 'order_supplier';
|
$object_type = 'order_supplier';
|
||||||
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
|
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
|
||||||
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$object->ref,$user->getFullName($langs));
|
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderValidatedBy",$object->ref,$user->getFullName($langs));
|
||||||
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
|
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
|
||||||
break;
|
break;
|
||||||
case 'ORDER_SUPPLIER_REFUSE':
|
case 'ORDER_SUPPLIER_APPROVE':
|
||||||
$link='/fourn/commande/card.php?id='.$object->id;
|
$link='/fourn/commande/card.php?id='.$object->id;
|
||||||
$dir_output = $conf->fournisseur->dir_output.'/commande/';
|
$dir_output = $conf->fournisseur->dir_output.'/commande/';
|
||||||
$object_type = 'order_supplier';
|
$object_type = 'order_supplier';
|
||||||
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
|
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
|
||||||
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$object->ref,$user->getFullName($langs));
|
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$object->ref,$user->getFullName($langs));
|
||||||
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
|
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
|
||||||
break;
|
break;
|
||||||
case 'SHIPPING_VALIDATE':
|
case 'ORDER_SUPPLIER_REFUSE':
|
||||||
$dir_output = $conf->expedition->dir_output.'/sending/';
|
$link='/fourn/commande/card.php?id='.$object->id;
|
||||||
$object_type = 'order_supplier';
|
$dir_output = $conf->fournisseur->dir_output.'/commande/';
|
||||||
$mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated",$object->ref);
|
$object_type = 'order_supplier';
|
||||||
break;
|
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
|
||||||
}
|
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$object->ref,$user->getFullName($langs));
|
||||||
$ref = dol_sanitizeFileName($object->ref);
|
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
|
||||||
$pdf_path = $dir_output."/".$ref."/".$ref.".pdf";
|
break;
|
||||||
if (! dol_is_file($pdf_path))
|
case 'SHIPPING_VALIDATE':
|
||||||
{
|
$dir_output = $conf->expedition->dir_output.'/sending/';
|
||||||
// We can't add PDF as it is not generated yet.
|
$object_type = 'order_supplier';
|
||||||
$filepdf = '';
|
$mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated",$object->ref);
|
||||||
}
|
break;
|
||||||
else
|
}
|
||||||
{
|
$ref = dol_sanitizeFileName($object->ref);
|
||||||
$filepdf = $pdf_path;
|
$pdf_path = $dir_output."/".$ref."/".$ref.".pdf";
|
||||||
}
|
if (! dol_is_file($pdf_path))
|
||||||
|
{
|
||||||
|
// We can't add PDF as it is not generated yet.
|
||||||
|
$filepdf = '';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$filepdf = $pdf_path;
|
||||||
|
}
|
||||||
|
|
||||||
$subject = '['.$application.'] '.$langs->transnoentitiesnoconv("DolibarrNotification");
|
$subject = '['.$application.'] '.$langs->transnoentitiesnoconv("DolibarrNotification");
|
||||||
|
|
||||||
$message = $langs->transnoentities("YouReceiveMailBecauseOfNotification",$application,$mysoc->name)."\n";
|
$message = $langs->transnoentities("YouReceiveMailBecauseOfNotification",$application,$mysoc->name)."\n";
|
||||||
$message.= $langs->transnoentities("YouReceiveMailBecauseOfNotification2",$application,$mysoc->name)."\n";
|
$message.= $langs->transnoentities("YouReceiveMailBecauseOfNotification2",$application,$mysoc->name)."\n";
|
||||||
$message.= "\n";
|
$message.= "\n";
|
||||||
$message.= $mesg;
|
$message.= $mesg;
|
||||||
if ($link) $message=dol_concatdesc($message,$urlwithroot.$link);
|
if ($link) $message=dol_concatdesc($message,$urlwithroot.$link);
|
||||||
|
|
||||||
$mailfile = new CMailFile(
|
// Replace keyword __SUPERVISOREMAIL__
|
||||||
$subject,
|
if (preg_match('/__SUPERVISOREMAIL__/', $sendto))
|
||||||
$sendto,
|
{
|
||||||
$replyto,
|
$newval='';
|
||||||
$message,
|
if ($user->fk_user > 0)
|
||||||
array($file),
|
{
|
||||||
array($mimefile),
|
$supervisoruser=new User($this->db);
|
||||||
array($filename[count($filename)-1]),
|
$supervisoruser->fetch($user->fk_user);
|
||||||
'',
|
if ($supervisoruser->email) $newval=trim(dolGetFirstLastname($supervisoruser->firstname, $supervisoruser->lastname).' <'.$supervisoruser->email.'>');
|
||||||
'',
|
}
|
||||||
0,
|
dol_syslog("Replace the __SUPERVISOREMAIL__ key into recipient email string with ".$newval);
|
||||||
-1
|
$sendto = preg_replace('/__SUPERVISOREMAIL__/', $newval, $sendto);
|
||||||
);
|
$sendto = preg_replace('/^[\s,]+/','',$sendto); // Clean start of string
|
||||||
|
$sendto = preg_replace('/[\s,]+$/','',$sendto); // Clean end of string
|
||||||
|
}
|
||||||
|
|
||||||
if ($mailfile->sendfile())
|
if ($sendto)
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, objet_id, email)";
|
$mailfile = new CMailFile(
|
||||||
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$actiondefid.", ".$object->socid.", null, '".$obj->type."', '".$object_type."', ".$object->id.", '".$this->db->escape($conf->global->$param)."')";
|
$subject,
|
||||||
if (! $this->db->query($sql))
|
$sendto,
|
||||||
{
|
$replyto,
|
||||||
dol_print_error($this->db);
|
$message,
|
||||||
}
|
array($file),
|
||||||
}
|
array($mimefile),
|
||||||
else
|
array($filename[count($filename)-1]),
|
||||||
{
|
'',
|
||||||
$error++;
|
'',
|
||||||
$this->errors[]=$mailfile->error;
|
0,
|
||||||
}
|
-1
|
||||||
}
|
);
|
||||||
|
|
||||||
|
if ($mailfile->sendfile())
|
||||||
|
{
|
||||||
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, objet_id, email)";
|
||||||
|
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".$object->socid.", null, 'email', '".$object_type."', ".$object->id.", '".$this->db->escape($conf->global->$param)."')";
|
||||||
|
if (! $this->db->query($sql))
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$this->errors[]=$mailfile->error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) return $num;
|
if (! $error) return $num;
|
||||||
|
|||||||
@ -315,7 +315,7 @@ class DoliDBSqlite3 extends DoliDB
|
|||||||
* @param string $login login
|
* @param string $login login
|
||||||
* @param string $passwd password
|
* @param string $passwd password
|
||||||
* @param string $name name of database (not used for mysql, used for pgsql)
|
* @param string $name name of database (not used for mysql, used for pgsql)
|
||||||
* @param string $port Port of database server
|
* @param integer $port Port of database server
|
||||||
* @return resource Database access handler
|
* @return resource Database access handler
|
||||||
* @see close
|
* @see close
|
||||||
*/
|
*/
|
||||||
@ -530,7 +530,7 @@ class DoliDBSqlite3 extends DoliDB
|
|||||||
/**
|
/**
|
||||||
* Return datas as an array
|
* Return datas as an array
|
||||||
*
|
*
|
||||||
* @param Resultset $resultset Resultset of request
|
* @param resource $resultset Resultset of request
|
||||||
* @return array Array
|
* @return array Array
|
||||||
*/
|
*/
|
||||||
function fetch_row($resultset)
|
function fetch_row($resultset)
|
||||||
@ -588,7 +588,7 @@ class DoliDBSqlite3 extends DoliDB
|
|||||||
/**
|
/**
|
||||||
* Free last resultset used.
|
* Free last resultset used.
|
||||||
*
|
*
|
||||||
* @param resultset $resultset Curseur de la requete voulue
|
* @param integer $resultset Curseur de la requete voulue
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function free($resultset=0)
|
function free($resultset=0)
|
||||||
@ -709,7 +709,7 @@ class DoliDBSqlite3 extends DoliDB
|
|||||||
*
|
*
|
||||||
* @param string $fieldorvalue Field name or value to encrypt
|
* @param string $fieldorvalue Field name or value to encrypt
|
||||||
* @param int $withQuotes Return string with quotes
|
* @param int $withQuotes Return string with quotes
|
||||||
* @return return XXX(field) or XXX('value') or field or 'value'
|
* @return string XXX(field) or XXX('value') or field or 'value'
|
||||||
*/
|
*/
|
||||||
function encrypt($fieldorvalue, $withQuotes=0)
|
function encrypt($fieldorvalue, $withQuotes=0)
|
||||||
{
|
{
|
||||||
@ -1277,7 +1277,7 @@ class DoliDBSqlite3 extends DoliDB
|
|||||||
* Cette fonction est l'equivalent de la fonction MONTH de MySql.
|
* Cette fonction est l'equivalent de la fonction MONTH de MySql.
|
||||||
*
|
*
|
||||||
* @param string $date Date
|
* @param string $date Date
|
||||||
* @return integer
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function dbMONTH($date)
|
public static function dbMONTH($date)
|
||||||
{
|
{
|
||||||
@ -1320,7 +1320,7 @@ class DoliDBSqlite3 extends DoliDB
|
|||||||
* dbWEEKDAY
|
* dbWEEKDAY
|
||||||
*
|
*
|
||||||
* @param int $date Date
|
* @param int $date Date
|
||||||
* @return string
|
* @return double
|
||||||
*/
|
*/
|
||||||
public static function dbWEEKDAY($date) {
|
public static function dbWEEKDAY($date) {
|
||||||
$arr = date_parse($date);
|
$arr = date_parse($date);
|
||||||
@ -1472,7 +1472,7 @@ class DoliDBSqlite3 extends DoliDB
|
|||||||
* week_mode
|
* week_mode
|
||||||
*
|
*
|
||||||
* @param string $mode Mode
|
* @param string $mode Mode
|
||||||
* @return string Week format
|
* @return integer Week format
|
||||||
*/
|
*/
|
||||||
private static function week_mode($mode) {
|
private static function week_mode($mode) {
|
||||||
$week_format= ($mode & 7);
|
$week_format= ($mode & 7);
|
||||||
|
|||||||
@ -84,7 +84,7 @@ function CreateXmlFooter()
|
|||||||
/**
|
/**
|
||||||
* SendError
|
* SendError
|
||||||
*
|
*
|
||||||
* @param unknown_type $number Number
|
* @param integer $number Number
|
||||||
* @param unknown_type $text Text
|
* @param unknown_type $text Text
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -30,7 +30,7 @@ require 'commands.php';
|
|||||||
/**
|
/**
|
||||||
* SendError
|
* SendError
|
||||||
*
|
*
|
||||||
* @param string $number Number
|
* @param integer $number Number
|
||||||
* @param string $text Text
|
* @param string $text Text
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2005-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This file is a modified version of datepicker.php from phpBSM to fix some
|
* This file is a modified version of datepicker.php from phpBSM to fix some
|
||||||
* bugs, to add new features and to dramatically increase speed.
|
* bugs, to add new features and to dramatically increase speed.
|
||||||
|
|||||||
@ -122,7 +122,28 @@ function updateTotal(days,mode)
|
|||||||
var nbline = document.getElementById('numberOfLines').value;
|
var nbline = document.getElementById('numberOfLines').value;
|
||||||
for (var i=0;i<nbline;i++)
|
for (var i=0;i<nbline;i++)
|
||||||
{
|
{
|
||||||
var id='task['+i+']['+days+']';
|
var id='timespent['+i+']['+days+']';
|
||||||
|
var taskTime= new Date(0);
|
||||||
|
var element=document.getElementById(id);
|
||||||
|
if(element)
|
||||||
|
{
|
||||||
|
/* alert(element.value);*/
|
||||||
|
if (element.value)
|
||||||
|
{
|
||||||
|
result=parseTime(element.value,taskTime);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result=parseTime(element.innerHTML,taskTime);
|
||||||
|
}
|
||||||
|
if (result >= 0)
|
||||||
|
{
|
||||||
|
total.setHours(total.getHours()+taskTime.getHours());
|
||||||
|
total.setMinutes(total.getMinutes()+taskTime.getMinutes());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var id='timeadded['+i+']['+days+']';
|
||||||
var taskTime= new Date(0);
|
var taskTime= new Date(0);
|
||||||
var element=document.getElementById(id);
|
var element=document.getElementById(id);
|
||||||
if(element)
|
if(element)
|
||||||
@ -152,7 +173,23 @@ function updateTotal(days,mode)
|
|||||||
var nbline = document.getElementById('numberOfLines').value;
|
var nbline = document.getElementById('numberOfLines').value;
|
||||||
for (var i=0;i<nbline;i++)
|
for (var i=0;i<nbline;i++)
|
||||||
{
|
{
|
||||||
var id='task['+i+']['+days+']';
|
var id='timespent['+i+']['+days+']';
|
||||||
|
var taskTime= new Date(0);
|
||||||
|
var element=document.getElementById(id);
|
||||||
|
if(element)
|
||||||
|
{
|
||||||
|
if (element.value)
|
||||||
|
{
|
||||||
|
total+=parseInt(element.value);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
total+=parseInt(element.innerHTML);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var id='timeadded['+i+']['+days+']';
|
||||||
var taskTime= new Date(0);
|
var taskTime= new Date(0);
|
||||||
var element=document.getElementById(id);
|
var element=document.getElementById(id);
|
||||||
if(element)
|
if(element)
|
||||||
|
|||||||
@ -386,6 +386,12 @@ function dolibarr_del_const($db, $name, $entity=1)
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
if (empty($name))
|
||||||
|
{
|
||||||
|
dol_print_error('','Error call dolibar_del_const with parameter name empty');
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const";
|
||||||
$sql.= " WHERE (".$db->decrypt('name')." = '".$db->escape($name)."'";
|
$sql.= " WHERE (".$db->decrypt('name')." = '".$db->escape($name)."'";
|
||||||
if (is_numeric($name)) $sql.= " OR rowid = '".$db->escape($name)."'";
|
if (is_numeric($name)) $sql.= " OR rowid = '".$db->escape($name)."'";
|
||||||
@ -438,7 +444,7 @@ function dolibarr_get_const($db, $name, $entity=1)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert a parameter (key,value) into database.
|
* Insert a parameter (key,value) into database (delete old key then insert it again).
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
* @param string $name Name of constant
|
* @param string $name Name of constant
|
||||||
|
|||||||
@ -120,7 +120,7 @@ function bank_admin_prepare_head($object)
|
|||||||
* Check SWIFT informations for a bank account
|
* Check SWIFT informations for a bank account
|
||||||
*
|
*
|
||||||
* @param Account $account A bank account
|
* @param Account $account A bank account
|
||||||
* @return int True if informations are valid, false otherwise
|
* @return boolean True if informations are valid, false otherwise
|
||||||
*/
|
*/
|
||||||
function checkSwiftForAccount($account)
|
function checkSwiftForAccount($account)
|
||||||
{
|
{
|
||||||
@ -137,7 +137,7 @@ function checkSwiftForAccount($account)
|
|||||||
* Check IBAN number informations for a bank account
|
* Check IBAN number informations for a bank account
|
||||||
*
|
*
|
||||||
* @param Account $account A bank account
|
* @param Account $account A bank account
|
||||||
* @return int True if informations are valid, false otherwise
|
* @return boolean True if informations are valid, false otherwise
|
||||||
*/
|
*/
|
||||||
function checkIbanForAccount($account)
|
function checkIbanForAccount($account)
|
||||||
{
|
{
|
||||||
@ -156,7 +156,7 @@ function checkIbanForAccount($account)
|
|||||||
* Check account number informations for a bank account
|
* Check account number informations for a bank account
|
||||||
*
|
*
|
||||||
* @param Account $account A bank account
|
* @param Account $account A bank account
|
||||||
* @return int True if informations are valid, false otherwise
|
* @return boolean True if informations are valid, false otherwise
|
||||||
*/
|
*/
|
||||||
function checkBanForAccount($account)
|
function checkBanForAccount($account)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -471,7 +471,7 @@ function show_projects($conf,$langs,$db,$object,$backtopage='')
|
|||||||
print_fiche_titre($langs->trans("ProjectsDedicatedToThisThirdParty"),$buttoncreate,'');
|
print_fiche_titre($langs->trans("ProjectsDedicatedToThisThirdParty"),$buttoncreate,'');
|
||||||
print "\n".'<table class="noborder" width=100%>';
|
print "\n".'<table class="noborder" width=100%>';
|
||||||
|
|
||||||
$sql = "SELECT p.rowid,p.title,p.ref,p.public, p.dateo as do, p.datee as de";
|
$sql = "SELECT p.rowid as id, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||||
$sql .= " WHERE p.fk_soc = ".$object->id;
|
$sql .= " WHERE p.fk_soc = ".$object->id;
|
||||||
$sql .= " ORDER BY p.dateo DESC";
|
$sql .= " ORDER BY p.dateo DESC";
|
||||||
@ -483,23 +483,24 @@ function show_projects($conf,$langs,$db,$object,$backtopage='')
|
|||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Ref").'</td><td>'.$langs->trans("Name").'</td><td align="center">'.$langs->trans("DateStart").'</td><td align="center">'.$langs->trans("DateEnd").'</td>';
|
print '<td>'.$langs->trans("Ref").'</td><td>'.$langs->trans("Name").'</td><td align="center">'.$langs->trans("DateStart").'</td><td align="center">'.$langs->trans("DateEnd").'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans("Status").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
|
|
||||||
$projectstatic = new Project($db);
|
$projecttmp = new Project($db);
|
||||||
|
|
||||||
$i=0;
|
$i=0;
|
||||||
$var=false;
|
$var=false;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
$projectstatic->fetch($obj->rowid);
|
$projecttmp->fetch($obj->id);
|
||||||
|
|
||||||
// To verify role of users
|
// To verify role of users
|
||||||
$userAccess = $projectstatic->restrictedProjectArea($user);
|
$userAccess = $projecttmp->restrictedProjectArea($user);
|
||||||
|
|
||||||
if ($user->rights->projet->lire && $userAccess > 0)
|
if ($user->rights->projet->lire && $userAccess > 0)
|
||||||
{
|
{
|
||||||
@ -507,13 +508,15 @@ function show_projects($conf,$langs,$db,$object,$backtopage='')
|
|||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowProject"),($obj->public?'projectpub':'project'))." ".$obj->ref.'</a></td>';
|
print '<td><a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$projecttmp->id.'">'.img_object($langs->trans("ShowProject"),($obj->public?'projectpub':'project'))." ".$obj->ref.'</a></td>';
|
||||||
// Label
|
// Label
|
||||||
print '<td>'.$obj->title.'</td>';
|
print '<td>'.$obj->title.'</td>';
|
||||||
// Date start
|
// Date start
|
||||||
print '<td align="center">'.dol_print_date($db->jdate($obj->do),"day").'</td>';
|
print '<td align="center">'.dol_print_date($db->jdate($obj->do),"day").'</td>';
|
||||||
// Date end
|
// Date end
|
||||||
print '<td align="center">'.dol_print_date($db->jdate($obj->de),"day").'</td>';
|
print '<td align="center">'.dol_print_date($db->jdate($obj->de),"day").'</td>';
|
||||||
|
// Status
|
||||||
|
print '<td align="right">'.$projecttmp->getLibStatut(5).'</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -813,11 +813,12 @@ function num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $ha
|
|||||||
* This replace old function monthArrayOrSelected.
|
* This replace old function monthArrayOrSelected.
|
||||||
*
|
*
|
||||||
* @param Translate $outputlangs Object langs
|
* @param Translate $outputlangs Object langs
|
||||||
|
* @param int $short 1=Return short label
|
||||||
* @return array Month string or array if selected < 0
|
* @return array Month string or array if selected < 0
|
||||||
*/
|
*/
|
||||||
function monthArray($outputlangs)
|
function monthArray($outputlangs,$short=0)
|
||||||
{
|
{
|
||||||
$montharray = array (
|
$montharray = array (
|
||||||
1 => $outputlangs->trans("January"),
|
1 => $outputlangs->trans("January"),
|
||||||
2 => $outputlangs->trans("February"),
|
2 => $outputlangs->trans("February"),
|
||||||
3 => $outputlangs->trans("March"),
|
3 => $outputlangs->trans("March"),
|
||||||
@ -832,6 +833,24 @@ function monthArray($outputlangs)
|
|||||||
12 => $outputlangs->trans("December")
|
12 => $outputlangs->trans("December")
|
||||||
);
|
);
|
||||||
|
|
||||||
return $montharray;
|
if (! empty($short))
|
||||||
|
{
|
||||||
|
$montharray = array (
|
||||||
|
1 => $outputlangs->trans("Jan"),
|
||||||
|
2 => $outputlangs->trans("Feb"),
|
||||||
|
3 => $outputlangs->trans("Mar"),
|
||||||
|
4 => $outputlangs->trans("Apr"),
|
||||||
|
5 => $outputlangs->trans("May"),
|
||||||
|
6 => $outputlangs->trans("Jun"),
|
||||||
|
7 => $outputlangs->trans("Jul"),
|
||||||
|
8 => $outputlangs->trans("Aug"),
|
||||||
|
9 => $outputlangs->trans("Sep"),
|
||||||
|
10 => $outputlangs->trans("Oct"),
|
||||||
|
11 => $outputlangs->trans("Nov"),
|
||||||
|
12 => $outputlangs->trans("Dec")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $montharray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
90
htdocs/core/lib/donation.lib.php
Normal file
90
htdocs/core/lib/donation.lib.php
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
/* 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
|
||||||
|
* 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/core/lib/donation.lib.php
|
||||||
|
* \ingroup Donation
|
||||||
|
* \brief Library of donation functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare array with list of admin tabs
|
||||||
|
*
|
||||||
|
* @param Donation $object Donation
|
||||||
|
* @return array Array of tabs to show
|
||||||
|
*/
|
||||||
|
function donation_admin_prepare_head($object)
|
||||||
|
{
|
||||||
|
global $langs, $conf;
|
||||||
|
|
||||||
|
$h = 0;
|
||||||
|
$head = array ();
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT . '/don/admin/donation.php';
|
||||||
|
$head[$h][1] = $langs->trans("Miscellaneous");
|
||||||
|
$head[$h][2] = 'general';
|
||||||
|
$h ++;
|
||||||
|
|
||||||
|
// Show more tabs from modules
|
||||||
|
// Entries must be declared in modules descriptor with line
|
||||||
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||||
|
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||||
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation_admin');
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT . '/don/admin/donation_extrafields.php';
|
||||||
|
$head[$h][1] = $langs->trans("ExtraFields");
|
||||||
|
$head[$h][2] = 'attributes';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation_admin', 'remove');
|
||||||
|
|
||||||
|
return $head;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare array with list of tabs
|
||||||
|
*
|
||||||
|
* @param Donation $object Donation
|
||||||
|
* @return array Array of tabs to show
|
||||||
|
*/
|
||||||
|
function donation_prepare_head($object)
|
||||||
|
{
|
||||||
|
global $langs, $conf;
|
||||||
|
|
||||||
|
$h = 0;
|
||||||
|
$head = array ();
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT . '/don/card.php?id=' . $object->id;
|
||||||
|
$head[$h][1] = $langs->trans("Card");
|
||||||
|
$head[$h][2] = 'card';
|
||||||
|
$h ++;
|
||||||
|
|
||||||
|
// Show more tabs from modules
|
||||||
|
// Entries must be declared in modules descriptor with line
|
||||||
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||||
|
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||||
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation');
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT . '/don/info.php?id=' . $object->id;
|
||||||
|
$head[$h][1] = $langs->trans("Info");
|
||||||
|
$head[$h][2] = 'info';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation', 'remove');
|
||||||
|
|
||||||
|
return $head;
|
||||||
|
}
|
||||||
@ -592,16 +592,17 @@ function dol_strtoupper($utf8_string)
|
|||||||
* This function works only if syslog module is enabled.
|
* This function works only if syslog module is enabled.
|
||||||
* This must not use any call to other function calling dol_syslog (avoid infinite loop).
|
* This must not use any call to other function calling dol_syslog (avoid infinite loop).
|
||||||
*
|
*
|
||||||
* @param string $message Line to log. Ne doit pas etre traduit si level = LOG_ERR
|
* @param string $message Line to log.
|
||||||
* @param int $level Log level
|
* @param int $level Log level
|
||||||
* 0=Show nothing
|
* 0=Show nothing
|
||||||
* On Windows LOG_ERR=4, LOG_WARNING=5, LOG_NOTICE=LOG_INFO=6, LOG_DEBUG=6 si define_syslog_variables ou PHP 5.3+, 7 si dolibarr
|
* On Windows LOG_ERR=4, LOG_WARNING=5, LOG_NOTICE=LOG_INFO=6, LOG_DEBUG=6 si define_syslog_variables ou PHP 5.3+, 7 si dolibarr
|
||||||
* On Linux LOG_ERR=3, LOG_WARNING=4, LOG_INFO=6, LOG_DEBUG=7
|
* On Linux LOG_ERR=3, LOG_WARNING=4, LOG_INFO=6, LOG_DEBUG=7
|
||||||
* @param int $ident 1=Increase ident of 1, -1=Decrease ident of 1
|
* @param int $ident 1=Increase ident of 1, -1=Decrease ident of 1
|
||||||
* @param string $suffixinfilename When output is a file, append this suffix into default log filename.
|
* @param string $suffixinfilename When output is a file, append this suffix into default log filename.
|
||||||
|
* @param string $restricttologhandler Output log only for this log handler
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='')
|
function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='', $restricttologhandler='')
|
||||||
{
|
{
|
||||||
global $conf, $user;
|
global $conf, $user;
|
||||||
|
|
||||||
@ -624,7 +625,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
|
|||||||
$conf->logbuffer[] = dol_print_date(time(),"%Y-%m-%d %H:%M:%S")." ".$message;
|
$conf->logbuffer[] = dol_print_date(time(),"%Y-%m-%d %H:%M:%S")." ".$message;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Remove this. MAIN_ENABLE_LOG_HTML should be deprecated and use a HTML handler
|
//TODO: Remove this. MAIN_ENABLE_LOG_HTML should be deprecated and use a log handler dedicated to HTML output
|
||||||
// If enable html log tag enabled and url parameter log defined, we show output log on HTML comments
|
// If enable html log tag enabled and url parameter log defined, we show output log on HTML comments
|
||||||
if (! empty($conf->global->MAIN_ENABLE_LOG_HTML) && ! empty($_GET["log"]))
|
if (! empty($conf->global->MAIN_ENABLE_LOG_HTML) && ! empty($_GET["log"]))
|
||||||
{
|
{
|
||||||
@ -648,10 +649,10 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
|
|||||||
else if (! empty($_SERVER['COMPUTERNAME'])) $data['ip'] = $_SERVER['COMPUTERNAME'].(empty($_SERVER['USERNAME'])?'':'@'.$_SERVER['USERNAME']);
|
else if (! empty($_SERVER['COMPUTERNAME'])) $data['ip'] = $_SERVER['COMPUTERNAME'].(empty($_SERVER['USERNAME'])?'':'@'.$_SERVER['USERNAME']);
|
||||||
// This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it).
|
// This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it).
|
||||||
else if (! empty($_SERVER['LOGNAME'])) $data['ip'] = '???@'.$_SERVER['LOGNAME'];
|
else if (! empty($_SERVER['LOGNAME'])) $data['ip'] = '???@'.$_SERVER['LOGNAME'];
|
||||||
|
|
||||||
// Loop on each log handler and send output
|
// Loop on each log handler and send output
|
||||||
foreach ($conf->loghandlers as $loghandlerinstance)
|
foreach ($conf->loghandlers as $loghandlerinstance)
|
||||||
{
|
{
|
||||||
|
if ($restricttologhandler && $loghandlerinstance->code != $restricttologhandler) continue;
|
||||||
$loghandlerinstance->export($data,$suffixinfilename);
|
$loghandlerinstance->export($data,$suffixinfilename);
|
||||||
}
|
}
|
||||||
unset($data);
|
unset($data);
|
||||||
@ -1633,14 +1634,14 @@ function dol_print_address($address, $htmlid, $mode, $id)
|
|||||||
/**
|
/**
|
||||||
* Return true if email syntax is ok
|
* Return true if email syntax is ok
|
||||||
*
|
*
|
||||||
* @param string $address email (Ex: "toto@titi.com", "John Do <johndo@titi.com>")
|
* @param string $address email (Ex: "toto@titi.com", "John Do <johndo@titi.com>")
|
||||||
* @return boolean true if email syntax is OK, false if KO or empty string
|
* @param int $acceptsupervisorkey If 1, the special string '__SUPERVISOREMAIL__' is also accepted as valid
|
||||||
|
* @return boolean true if email syntax is OK, false if KO or empty string
|
||||||
*/
|
*/
|
||||||
function isValidEmail($address)
|
function isValidEmail($address, $acceptsupervisorkey=0)
|
||||||
{
|
{
|
||||||
if (filter_var($address, FILTER_VALIDATE_EMAIL)) {
|
if ($acceptsupervisorkey && $address == '__SUPERVISOREMAIL__') return true;
|
||||||
return true;
|
if (filter_var($address, FILTER_VALIDATE_EMAIL)) return true;
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2116,7 +2117,7 @@ function img_edit_remove($titlealt = 'default', $other='')
|
|||||||
* Show logo editer/modifier fiche
|
* Show logo editer/modifier fiche
|
||||||
*
|
*
|
||||||
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
|
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
|
||||||
* @param float $float Si il faut y mettre le style "float: right"
|
* @param integer $float Si il faut y mettre le style "float: right"
|
||||||
* @param string $other Add more attributes on img
|
* @param string $other Add more attributes on img
|
||||||
* @return string Return tag img
|
* @return string Return tag img
|
||||||
*/
|
*/
|
||||||
@ -2133,7 +2134,7 @@ function img_edit($titlealt = 'default', $float = 0, $other = '')
|
|||||||
* Show logo view card
|
* Show logo view card
|
||||||
*
|
*
|
||||||
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
|
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
|
||||||
* @param float $float Si il faut y mettre le style "float: right"
|
* @param integer $float Si il faut y mettre le style "float: right"
|
||||||
* @param string $other Add more attributes on img
|
* @param string $other Add more attributes on img
|
||||||
* @return string Return tag img
|
* @return string Return tag img
|
||||||
*/
|
*/
|
||||||
@ -2279,15 +2280,16 @@ function img_previous($titlealt = 'default')
|
|||||||
*
|
*
|
||||||
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
|
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
|
||||||
* @param int $selected Selected
|
* @param int $selected Selected
|
||||||
|
* @param string $moreclass Add more CSS classes
|
||||||
* @return string Return img tag
|
* @return string Return img tag
|
||||||
*/
|
*/
|
||||||
function img_down($titlealt = 'default', $selected = 0)
|
function img_down($titlealt = 'default', $selected = 0, $moreclass='')
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
if ($titlealt == 'default') $titlealt = $langs->trans('Down');
|
if ($titlealt == 'default') $titlealt = $langs->trans('Down');
|
||||||
|
|
||||||
return img_picto($titlealt, ($selected ? '1downarrow_selected.png' : '1downarrow.png'), 'class="imgdown"');
|
return img_picto($titlealt, ($selected ? '1downarrow_selected.png' : '1downarrow.png'), 'class="imgdown'.($moreclass?" ".$moreclass:"").'"');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2295,15 +2297,16 @@ function img_down($titlealt = 'default', $selected = 0)
|
|||||||
*
|
*
|
||||||
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
|
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
|
||||||
* @param int $selected Selected
|
* @param int $selected Selected
|
||||||
|
* @param string $moreclass Add more CSS classes
|
||||||
* @return string Return img tag
|
* @return string Return img tag
|
||||||
*/
|
*/
|
||||||
function img_up($titlealt = 'default', $selected = 0)
|
function img_up($titlealt = 'default', $selected = 0, $moreclass='')
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
if ($titlealt == 'default') $titlealt = $langs->trans('Up');
|
if ($titlealt == 'default') $titlealt = $langs->trans('Up');
|
||||||
|
|
||||||
return img_picto($titlealt, ($selected ? '1uparrow_selected.png' : '1uparrow.png'), 'class="imgup"');
|
return img_picto($titlealt, ($selected ? '1uparrow_selected.png' : '1uparrow.png'), 'class="imgup'.($moreclass?" ".$moreclass:"").'"');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2446,7 +2449,7 @@ function img_searchclear($titlealt = 'default', $other = '')
|
|||||||
* Show information for admin users
|
* Show information for admin users
|
||||||
*
|
*
|
||||||
* @param string $text Text info
|
* @param string $text Text info
|
||||||
* @param string $infoonimgalt Info is shown only on alt of star picto, otherwise it is show on output after the star picto
|
* @param integer $infoonimgalt Info is shown only on alt of star picto, otherwise it is show on output after the star picto
|
||||||
* @param int $nodiv No div
|
* @param int $nodiv No div
|
||||||
* @return string String with info text
|
* @return string String with info text
|
||||||
*/
|
*/
|
||||||
@ -2495,7 +2498,7 @@ function dol_print_error($db='',$error='')
|
|||||||
if ($_SERVER['DOCUMENT_ROOT']) // Mode web
|
if ($_SERVER['DOCUMENT_ROOT']) // Mode web
|
||||||
{
|
{
|
||||||
$out.=$langs->trans("DolibarrHasDetectedError").".<br>\n";
|
$out.=$langs->trans("DolibarrHasDetectedError").".<br>\n";
|
||||||
if (! empty($conf->global->MAIN_FEATURES_LEVEL)) $out.="You use an experimental level of features, so please do NOT report any bugs, except if problem is confirmed moving option MAIN_FEATURES_LEVEL back to 0.<br>\n";
|
if (! empty($conf->global->MAIN_FEATURES_LEVEL)) $out.="You use an experimental or develop level of features, so please do NOT report any bugs, except if problem is confirmed moving option MAIN_FEATURES_LEVEL back to 0.<br>\n";
|
||||||
$out.=$langs->trans("InformationToHelpDiagnose").":<br>\n";
|
$out.=$langs->trans("InformationToHelpDiagnose").":<br>\n";
|
||||||
|
|
||||||
$out.="<b>".$langs->trans("Date").":</b> ".dol_print_date(time(),'dayhourlog')."<br>\n";
|
$out.="<b>".$langs->trans("Date").":</b> ".dol_print_date(time(),'dayhourlog')."<br>\n";
|
||||||
@ -2621,7 +2624,7 @@ function print_liste_field_titre($name, $file="", $field="", $begin="", $morepar
|
|||||||
* Get title line of an array
|
* Get title line of an array
|
||||||
*
|
*
|
||||||
* @param string $name Label of field
|
* @param string $name Label of field
|
||||||
* @param int $thead 0=To use with standard table forat, 1=To use inside <thead><tr>, 2=To use with <div>
|
* @param int $thead 0=To use with standard table format, 1=To use inside <thead><tr>, 2=To use with <div>
|
||||||
* @param string $file Url used when we click on sort picto
|
* @param string $file Url used when we click on sort picto
|
||||||
* @param string $field Field to use for new sorting. Empty if this field is not sortable.
|
* @param string $field Field to use for new sorting. Empty if this field is not sortable.
|
||||||
* @param string $begin ("" by defaut)
|
* @param string $begin ("" by defaut)
|
||||||
@ -2866,7 +2869,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
|
|||||||
* @param int $page Number of page
|
* @param int $page Number of page
|
||||||
* @param string $file Lien
|
* @param string $file Lien
|
||||||
* @param string $options Autres parametres d'url a propager dans les liens ("" par defaut)
|
* @param string $options Autres parametres d'url a propager dans les liens ("" par defaut)
|
||||||
* @param boolean|int $nextpage Do we show a next page button
|
* @param integer $nextpage Do we show a next page button
|
||||||
* @param string $betweenarrows HTML Content to show between arrows
|
* @param string $betweenarrows HTML Content to show between arrows
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@ -2923,7 +2926,7 @@ function vatrate($rate,$addpercent=false,$info_bits=0,$usestarfornpr=0)
|
|||||||
* Function used into PDF and HTML pages
|
* Function used into PDF and HTML pages
|
||||||
*
|
*
|
||||||
* @param float $amount Amount to format
|
* @param float $amount Amount to format
|
||||||
* @param string $form Type of format, HTML or not (not by default)
|
* @param integer $form Type of format, HTML or not (not by default)
|
||||||
* @param Translate $outlangs Object langs for output
|
* @param Translate $outlangs Object langs for output
|
||||||
* @param int $trunc 1=Truncate if there is too much decimals (default), 0=Does not truncate
|
* @param int $trunc 1=Truncate if there is too much decimals (default), 0=Does not truncate
|
||||||
* @param int $rounding Minimum number of decimal to show. If 0, no change, if -1, we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOTAL)
|
* @param int $rounding Minimum number of decimal to show. If 0, no change, if -1, we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOTAL)
|
||||||
@ -3622,7 +3625,7 @@ function get_default_npr($thirdparty_seller, $thirdparty_buyer, $idprod=0, $idpr
|
|||||||
* @param Societe $thirdparty_buyer Thirdparty buyer
|
* @param Societe $thirdparty_buyer Thirdparty buyer
|
||||||
* @param int $local Localtax to process (1 or 2)
|
* @param int $local Localtax to process (1 or 2)
|
||||||
* @param int $idprod Id product
|
* @param int $idprod Id product
|
||||||
* @return float localtax, -1 si ne peut etre determine
|
* @return integer localtax, -1 si ne peut etre determine
|
||||||
* @see get_default_tva, get_default_npr
|
* @see get_default_tva, get_default_npr
|
||||||
*/
|
*/
|
||||||
function get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $idprod=0)
|
function get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $idprod=0)
|
||||||
@ -3664,7 +3667,7 @@ function get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $id
|
|||||||
* Return yes or no in current language
|
* Return yes or no in current language
|
||||||
*
|
*
|
||||||
* @param string $yesno Value to test (1, 'yes', 'true' or 0, 'no', 'false')
|
* @param string $yesno Value to test (1, 'yes', 'true' or 0, 'no', 'false')
|
||||||
* @param string $case 1=Yes/No, 0=yes/no, 2=Disabled checkbox, 3=Disabled checkbox + Yes/No
|
* @param integer $case 1=Yes/No, 0=yes/no, 2=Disabled checkbox, 3=Disabled checkbox + Yes/No
|
||||||
* @param int $color 0=texte only, 1=Text is formated with a color font style ('ok' or 'error'), 2=Text is formated with 'ok' color.
|
* @param int $color 0=texte only, 1=Text is formated with a color font style ('ok' or 'error'), 2=Text is formated with 'ok' color.
|
||||||
* @return string HTML string
|
* @return string HTML string
|
||||||
*/
|
*/
|
||||||
@ -3805,7 +3808,7 @@ function picto_required()
|
|||||||
* Clean a string from all HTML tags and entities
|
* Clean a string from all HTML tags and entities
|
||||||
*
|
*
|
||||||
* @param string $StringHtml String to clean
|
* @param string $StringHtml String to clean
|
||||||
* @param string $removelinefeed Replace also all lines feeds by a space, otherwise only last one are removed
|
* @param integer $removelinefeed Replace also all lines feeds by a space, otherwise only last one are removed
|
||||||
* @param string $pagecodeto Encoding of input/output string
|
* @param string $pagecodeto Encoding of input/output string
|
||||||
* @return string String cleaned
|
* @return string String cleaned
|
||||||
*
|
*
|
||||||
@ -3926,9 +3929,7 @@ function dol_htmlcleanlastbr($stringtodecode)
|
|||||||
*/
|
*/
|
||||||
function dol_html_entity_decode($a,$b,$c='UTF-8')
|
function dol_html_entity_decode($a,$b,$c='UTF-8')
|
||||||
{
|
{
|
||||||
// We use @ to avoid warning on PHP4 that does not support entity decoding to UTF8;
|
return html_entity_decode($a,$b,$c);
|
||||||
$ret=@html_entity_decode($a,$b,$c);
|
|
||||||
return $ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -4183,7 +4184,7 @@ function print_date_range($date_start,$date_end,$format = '',$outputlangs='')
|
|||||||
* @param int $date_end End date
|
* @param int $date_end End date
|
||||||
* @param string $format Output format
|
* @param string $format Output format
|
||||||
* @param Translate $outputlangs Output language
|
* @param Translate $outputlangs Output language
|
||||||
* @param string $withparenthesis 1=Add parenthesis, 0=non parenthesis
|
* @param integer $withparenthesis 1=Add parenthesis, 0=non parenthesis
|
||||||
* @return string String
|
* @return string String
|
||||||
*/
|
*/
|
||||||
function get_date_range($date_start,$date_end,$format = '',$outputlangs='', $withparenthesis=1)
|
function get_date_range($date_start,$date_end,$format = '',$outputlangs='', $withparenthesis=1)
|
||||||
@ -4845,7 +4846,7 @@ function printCommonFooter($zone='private')
|
|||||||
print 'MAIN_OPTIMIZE_SPEED='.(isset($conf->global->MAIN_OPTIMIZE_SPEED)?$conf->global->MAIN_OPTIMIZE_SPEED:'off');
|
print 'MAIN_OPTIMIZE_SPEED='.(isset($conf->global->MAIN_OPTIMIZE_SPEED)?$conf->global->MAIN_OPTIMIZE_SPEED:'off');
|
||||||
if ($micro_start_time)
|
if ($micro_start_time)
|
||||||
{
|
{
|
||||||
$micro_end_time=dol_microtime_float(true);
|
$micro_end_time=dol_microtime_float();
|
||||||
print ' - Build time: '.ceil(1000*($micro_end_time-$micro_start_time)).' ms';
|
print ' - Build time: '.ceil(1000*($micro_end_time-$micro_start_time)).' ms';
|
||||||
}
|
}
|
||||||
if (function_exists("memory_get_usage"))
|
if (function_exists("memory_get_usage"))
|
||||||
@ -4952,7 +4953,7 @@ function dol_getmypid()
|
|||||||
* @param string $value The value to look for.
|
* @param string $value The value to look for.
|
||||||
* If param $numeric is 0, can contains several keywords separated with a space, like "keyword1 keyword2" = We want record field like keyword1 and field like keyword2
|
* If param $numeric is 0, can contains several keywords separated with a space, like "keyword1 keyword2" = We want record field like keyword1 and field like keyword2
|
||||||
* If param $numeric is 1, can contains an operator <>= like "<10" or ">=100.5 < 1000"
|
* If param $numeric is 1, can contains an operator <>= like "<10" or ">=100.5 < 1000"
|
||||||
* @param string $numeric 0=value is list of keywords, 1=value is a numeric test
|
* @param integer $numeric 0=value is list of keywords, 1=value is a numeric test
|
||||||
* @return string $res The statement to append to the SQL query
|
* @return string $res The statement to append to the SQL query
|
||||||
*/
|
*/
|
||||||
function natural_search($fields, $value, $numeric=0)
|
function natural_search($fields, $value, $numeric=0)
|
||||||
|
|||||||
@ -1885,7 +1885,7 @@ function colorArrayToHex($arraycolor,$colorifnotfound='888888')
|
|||||||
function colorStringToArray($stringcolor,$colorifnotfound=array(88,88,88))
|
function colorStringToArray($stringcolor,$colorifnotfound=array(88,88,88))
|
||||||
{
|
{
|
||||||
if (is_array($stringcolor)) return $stringcolor; // If already into correct output format, we return as is
|
if (is_array($stringcolor)) return $stringcolor; // If already into correct output format, we return as is
|
||||||
$tmp=preg_match('/^([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])$/',$stringcolor,$reg);
|
$tmp=preg_match('/^#?([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])$/',$stringcolor,$reg);
|
||||||
if (! $tmp)
|
if (! $tmp)
|
||||||
{
|
{
|
||||||
$tmp=explode(',',$stringcolor);
|
$tmp=explode(',',$stringcolor);
|
||||||
|
|||||||
77
htdocs/core/lib/loan.lib.php
Normal file
77
htdocs/core/lib/loan.lib.php
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2014 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
|
||||||
|
* 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/core/lib/loan.lib.php
|
||||||
|
* \ingroup loan
|
||||||
|
* \brief Library for loan module
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare array with list of tabs
|
||||||
|
*
|
||||||
|
* @param Object $object Object related to tabs
|
||||||
|
* @return array Array of tabs to show
|
||||||
|
*/
|
||||||
|
function loan_prepare_head($object)
|
||||||
|
{
|
||||||
|
global $langs, $conf;
|
||||||
|
|
||||||
|
$tab = 0;
|
||||||
|
$head = array();
|
||||||
|
|
||||||
|
$head[$tab][0] = DOL_URL_ROOT.'/loan/card.php?id='.$object->id;
|
||||||
|
$head[$tab][1] = $langs->trans('Card');
|
||||||
|
$head[$tab][2] = 'card';
|
||||||
|
$tab++;
|
||||||
|
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||||
|
{
|
||||||
|
$nbNote = (empty($object->note_private)?0:1)+(empty($object->note_public)?0:1);
|
||||||
|
$head[$tab][0] = DOL_URL_ROOT."/loan/note.php?id=".$object->id;
|
||||||
|
$head[$tab][1] = $langs->trans("Notes");
|
||||||
|
if($nbNote > 0) $head[$tab][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||||
|
$head[$tab][2] = 'note';
|
||||||
|
$tab++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show more tabs from modules
|
||||||
|
// Entries must be declared in modules descriptor with line
|
||||||
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||||
|
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||||
|
complete_head_from_modules($conf, $langs, $object, $head, $tab,'loan');
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
$upload_dir = $conf->loan->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||||
|
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||||
|
$head[$tab][0] = DOL_URL_ROOT.'/loan/document.php?id='.$object->id;
|
||||||
|
$head[$tab][1] = $langs->trans("Documents");
|
||||||
|
if($nbFiles > 0) $head[$tab][1].= ' ('.$nbFiles.')';
|
||||||
|
$head[$tab][2] = 'documents';
|
||||||
|
$tab++;
|
||||||
|
|
||||||
|
$head[$tab][0] = DOL_URL_ROOT.'/loan/info.php?id='.$object->id;
|
||||||
|
$head[$tab][1] = $langs->trans("Info");
|
||||||
|
$head[$tab][2] = 'info';
|
||||||
|
$tab++;
|
||||||
|
|
||||||
|
complete_head_from_modules($conf,$langs,$object,$head,$tab,'loan','remove');
|
||||||
|
|
||||||
|
return $head;
|
||||||
|
}
|
||||||
@ -969,7 +969,7 @@ function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$w,$h,$al
|
|||||||
* @param int $hideref Hide reference
|
* @param int $hideref Hide reference
|
||||||
* @param int $hidedesc Hide description
|
* @param int $hidedesc Hide description
|
||||||
* @param int $issupplierline Is it a line for a supplier object ?
|
* @param int $issupplierline Is it a line for a supplier object ?
|
||||||
* @return void
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hideref=0,$hidedesc=0,$issupplierline=0)
|
function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hideref=0,$hidedesc=0,$issupplierline=0)
|
||||||
{
|
{
|
||||||
@ -1187,7 +1187,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
|
|||||||
* @param int $i Current line number
|
* @param int $i Current line number
|
||||||
* @param Translate $outputlangs Object langs for output
|
* @param Translate $outputlangs Object langs for output
|
||||||
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
|
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
|
||||||
* @return void
|
* @return null|string
|
||||||
*/
|
*/
|
||||||
function pdf_getlinenum($object,$i,$outputlangs,$hidedetails=0)
|
function pdf_getlinenum($object,$i,$outputlangs,$hidedetails=0)
|
||||||
{
|
{
|
||||||
@ -1213,7 +1213,7 @@ function pdf_getlinenum($object,$i,$outputlangs,$hidedetails=0)
|
|||||||
* @param int $i Current line number
|
* @param int $i Current line number
|
||||||
* @param Translate $outputlangs Object langs for output
|
* @param Translate $outputlangs Object langs for output
|
||||||
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
|
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
|
||||||
* @return void
|
* @return null|string
|
||||||
*/
|
*/
|
||||||
function pdf_getlineref($object,$i,$outputlangs,$hidedetails=0)
|
function pdf_getlineref($object,$i,$outputlangs,$hidedetails=0)
|
||||||
{
|
{
|
||||||
@ -1238,7 +1238,7 @@ function pdf_getlineref($object,$i,$outputlangs,$hidedetails=0)
|
|||||||
* @param int $i Current line number
|
* @param int $i Current line number
|
||||||
* @param Translate $outputlangs Object langs for output
|
* @param Translate $outputlangs Object langs for output
|
||||||
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
|
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
|
||||||
* @return void
|
* @return null|string
|
||||||
*/
|
*/
|
||||||
function pdf_getlineref_supplier($object,$i,$outputlangs,$hidedetails=0)
|
function pdf_getlineref_supplier($object,$i,$outputlangs,$hidedetails=0)
|
||||||
{
|
{
|
||||||
@ -1597,7 +1597,7 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
|
|||||||
* @param Object $object Object
|
* @param Object $object Object
|
||||||
* @param string $type Type
|
* @param string $type Type
|
||||||
* @param Translate $outputlangs Object langs for output
|
* @param Translate $outputlangs Object langs for output
|
||||||
* @return void
|
* @return integer
|
||||||
*/
|
*/
|
||||||
function pdf_getTotalQty($object,$type,$outputlangs)
|
function pdf_getTotalQty($object,$type,$outputlangs)
|
||||||
{
|
{
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user