Merge branch 'develop' into constants
Conflicts: htdocs/commande/card.php htdocs/compta/facture/class/facture.class.php
This commit is contained in:
commit
cc1d298f29
32
.travis.yml
32
.travis.yml
@ -18,10 +18,15 @@ services:
|
||||
language: php
|
||||
php:
|
||||
# - "5.2" is not supported because pyrus to install PHP_Codesniffer is not available
|
||||
- "5.3"
|
||||
- "5.4"
|
||||
- "5.5"
|
||||
- "5.6"
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: 7.0
|
||||
|
||||
env:
|
||||
- DB=mysql
|
||||
@ -99,16 +104,15 @@ before_script:
|
||||
script:
|
||||
- cd htdocs/install
|
||||
- date
|
||||
# - php upgrade.php 3.4.0 3.5.0 > upgrade.log
|
||||
# - php upgrade2.php 3.4.0 3.5.0 > upgrade2.log
|
||||
- php upgrade.php 3.5.0 3.6.0 >> upgrade.log
|
||||
- php upgrade2.php 3.5.0 3.6.0 >> upgrade2.log
|
||||
- php upgrade.php 3.6.0 3.7.0 >> upgrade.log
|
||||
# - cat upgrade360370.log
|
||||
- php upgrade2.php 3.6.0 3.7.0 >> upgrade2.log
|
||||
- php upgrade.php 3.7.0 3.8.0 >> upgrade.log
|
||||
- php upgrade2.php 3.7.0 3.8.0 >> upgrade2.log
|
||||
# - cat upgrade2.log
|
||||
# - php upgrade.php 3.4.0 3.5.0 ignoredbversion > upgrade340350.log
|
||||
# - php upgrade2.php 3.4.0 3.5.0 ignoredbversion > upgrade340350-2.log
|
||||
- php upgrade.php 3.5.0 3.6.0 ignoredbversion > upgrade350360.log
|
||||
- php upgrade2.php 3.5.0 3.6.0 ignoredbversion > upgrade350360-2.log
|
||||
- php upgrade.php 3.6.0 3.7.0 ignoredbversion > upgrade360370.log
|
||||
- php upgrade2.php 3.6.0 3.7.0 ignoredbversion > upgrade360370-2.log
|
||||
- php upgrade.php 3.7.0 3.8.0 ignoredbversion > upgrade370380.log
|
||||
- php upgrade2.php 3.7.0 3.8.0 ignoredbversion > upgrade370380-2.log
|
||||
# - cat upgrade370380-2.log
|
||||
- cd ../..
|
||||
- date
|
||||
- phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||
|
||||
14
.tx/config
14
.tx/config
@ -1,6 +1,6 @@
|
||||
[main]
|
||||
host = https://www.transifex.com
|
||||
lang_map = uz: uz_UZ
|
||||
lang_map = uz: uz_UZ, sw: sw_SW
|
||||
|
||||
[dolibarr.accountancy]
|
||||
file_filter = htdocs/langs/<lang>/accountancy.lang
|
||||
@ -146,6 +146,12 @@ source_file = htdocs/langs/en_US/holiday.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.incoterm]
|
||||
file_filter = htdocs/langs/<lang>/incoterm.lang
|
||||
source_file = htdocs/langs/en_US/incoterm.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.install]
|
||||
file_filter = htdocs/langs/<lang>/install.lang
|
||||
source_file = htdocs/langs/en_US/install.lang
|
||||
@ -176,6 +182,12 @@ source_file = htdocs/langs/en_US/link.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.loan]
|
||||
file_filter = htdocs/langs/<lang>/loan.lang
|
||||
source_file = htdocs/langs/en_US/loan.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.mailmanspip]
|
||||
file_filter = htdocs/langs/<lang>/mailmanspip.lang
|
||||
source_file = htdocs/langs/en_US/mailmanspip.lang
|
||||
|
||||
@ -3,28 +3,30 @@ How to contribute to Dolibarr
|
||||
|
||||
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.
|
||||
2. Choose the right section. (Bugs or Task and Feature Request).
|
||||
3. Report with as much detail as possible (Use screenshots or even screencasts whenever possible).
|
||||
1. Please [use the search engine](https://help.github.com/articles/searching-issues) to check if nobody's already reported your problem.
|
||||
2. [Create an issue](https://help.github.com/articles/creating-an-issue). Choose an appropriate title. Prepend appropriately with Bug or Feature Request.
|
||||
3. Report with as much detail as possible ([Use screenshots or even screencasts whenever possible](https://help.github.com/articles/issue-attachments)).
|
||||
|
||||
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
|
||||
|
||||
1. Fork the [GitHub repository](https://github.com/Dolibarr/dolibarr).
|
||||
1. [Fork](https://help.github.com/articles/fork-a-repo) the [GitHub repository](https://github.com/Dolibarr/dolibarr).
|
||||
2. Clone your fork.
|
||||
3. Choose a branch(See the Branches section below).
|
||||
3. Choose a branch(See the [Branches](#branches) section below).
|
||||
4. Commit and push your changes.
|
||||
5. Make a pull request.
|
||||
5. [Make a pull request](https://help.github.com/articles/creating-a-pull-request).
|
||||
|
||||
### Branches
|
||||
### <a name=branches></a>Branches
|
||||
|
||||
Unless you're fixing a bug, all pull request should be made against the *develop* branch.
|
||||
Unless you're fixing a bug, all pull requests should be made against the *develop* branch.
|
||||
|
||||
If you're fixing a bug, it is preferred that you cook your fix and pull request it
|
||||
against the oldest version affected that's still supported.
|
||||
@ -40,23 +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:
|
||||
|
||||
<pre>
|
||||
KEYWORD Short description
|
||||
KEYWORD Short description (may be the bug number #456)
|
||||
|
||||
Long description (Can span accross multiple lines).
|
||||
</pre>
|
||||
|
||||
Where KEYWORD is one of:
|
||||
|
||||
- "FIXED:" for bug fixes (May be followed by the bug number i.e: #456)
|
||||
- "NEW:" for new features (May be followed by the task number i.e: #123)
|
||||
- "Fixed" for bug fixes (May be followed by the bug number i.e: #456)
|
||||
- "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.
|
||||
|
||||
### 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
|
||||
[Developer documentation](http://wiki.dolibarr.org/index.php/Developer_documentation)
|
||||
|
||||
Translations
|
||||
------------
|
||||
en_US and delta languages (i.e: fr_XX) are maintained in the repository. See Code section above.
|
||||
The source language (en_US) is maintained in the repository. See the [Code](#code) section above.
|
||||
|
||||
All other translations are managed online at [Transifex](https://www.transifex.com/projects/p/dolibarr).
|
||||
|
||||
|
||||
24
ChangeLog
24
ChangeLog
@ -2,6 +2,13 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
WARNING: Do not try to make any Dolibarr upgrade if you are running Mysql version 5.5.40.
|
||||
Mysql version 5.5.40 has a very critical bug making your data beeing definitely lost.
|
||||
You may also experience troubles with Mysql 5.5.41 with error "Lost connection" during migration.
|
||||
Upgrading to any other version or database system is abolutely required BEFORE trying to
|
||||
make a migration.
|
||||
|
||||
|
||||
***** ChangeLog for 3.8 compared to 3.7.* *****
|
||||
For users:
|
||||
- New: Add Option to not change date on cloning project
|
||||
@ -14,8 +21,10 @@ For users:
|
||||
MARGIN_PMP_AS_DEFAULT_BUY_PRICE to replace with first supplier price.
|
||||
- Introduce option MAIN_HTML_TITLE to start to control format of html title content.
|
||||
- Add extrafields on bank account cards.
|
||||
- Added delay between mails in Newsletter module
|
||||
- [ task #1793 ] Create new permission to restrict commercial agent margin to logged user
|
||||
- Added delay between mails in Newsletter module.
|
||||
- [ task #1793 ] Create new permission to restrict commercial agent margin to logged user.
|
||||
- Add experimental module ask supplier price to request supplier quotation.
|
||||
- Add experimental module batch management.
|
||||
|
||||
For translators:
|
||||
- Update language files.
|
||||
@ -25,6 +34,13 @@ For developers:
|
||||
- New: Function yn can show a visual checkbox.
|
||||
- New: Introduced select2 jquery plugin.
|
||||
|
||||
WARNING: Following changes may create regression for some external modules, but was necessary to make
|
||||
Dolibarr better:
|
||||
- Removed hoo supplierorderdao into supplier order creation. This is a business event, so we must use the
|
||||
trigger ORDER_SUPPLIER_CREATE instead.
|
||||
- Hooks 'printLeftBlock' and 'formConfirm' are now compliant with hook development rules. They are
|
||||
"addreplace" hooks, so you must return content with "->resprints='mycontent'" and not with "return 'mycontent'"
|
||||
|
||||
|
||||
***** ChangeLog for 3.7 compared to 3.6.* *****
|
||||
For users:
|
||||
@ -154,6 +170,7 @@ For translators:
|
||||
- New: When a translation is not available we always jump to en_US and only en_US.
|
||||
|
||||
For developers:
|
||||
- New: Syslog module can be set to use ChromePHP plugin to output log server into browser console.
|
||||
- New: Add a css style "cursorpointer".
|
||||
- New: Select list of users can return user into hierarchy.
|
||||
- New: getBrowserInfo can return type of layout of browser (classic/phone/tablet)
|
||||
@ -218,11 +235,14 @@ Dolibarr better:
|
||||
- Fix: [ bug #1827 ] Tax reports gives incorrect amounts when using external modules that create lines with special codes
|
||||
- Fix: [ bug #1822 ] SQL error in clientfourn.php report with PostgreSQL
|
||||
- Fix: [ bug #1832 ] SQL error when adding a product with no price defined to an object
|
||||
- Fix: [ bug #1833 ] user permissions in contact/note.php not working
|
||||
- Fix: [ bug #1826 ] Supplier payment types are not translated into fourn/facture/paiement.php
|
||||
- Fix: [ bug #1830 ] Salaries payment only allows checking accounts
|
||||
- Fix: [ bug #1825 ] External agenda: hide/show checkbox doesn't work
|
||||
- Fix: [ bug #1790 ] Email form behaves in an unexpected way when pressing Enter key
|
||||
- Fix: Bad SEPA xml file creation
|
||||
- Fix: [ bug #1892 ] PHP Fatal error when using USER_UPDATE_SESSION trigger and adding a supplier invoice payment
|
||||
- Fix: Showing system error if not enough stock of product into orders creation with lines
|
||||
|
||||
***** ChangeLog for 3.6.2 compared to 3.6.1 *****
|
||||
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
dolibarr (3.7.0-3) UNRELEASED; urgency=low
|
||||
dolibarr (3.8.0-3) UNRELEASED; urgency=low
|
||||
|
||||
[ Laurent Destailleur (eldy) ]
|
||||
* New upstream release.
|
||||
|
||||
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 21 Oct 2014 12:00:00 +0100
|
||||
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 3 Mar 2015 12:00:00 +0100
|
||||
|
||||
@ -451,15 +451,18 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/documents`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/document`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`;
|
||||
# Removed known external modules to avoir any error when packaging on test env
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ancotec*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/bootstrap*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/factory*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/management*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/timesheet*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/eldy/*.new`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/test`;
|
||||
|
||||
@ -172,8 +172,10 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/contrat
|
||||
%_datadir/dolibarr/htdocs/core
|
||||
%_datadir/dolibarr/htdocs/cron
|
||||
%_datadir/dolibarr/htdocs/don
|
||||
%_datadir/dolibarr/htdocs/ecm
|
||||
%_datadir/dolibarr/htdocs/expedition
|
||||
%_datadir/dolibarr/htdocs/expensereport
|
||||
%_datadir/dolibarr/htdocs/exports
|
||||
%_datadir/dolibarr/htdocs/externalsite
|
||||
%_datadir/dolibarr/htdocs/fichinter
|
||||
@ -185,6 +187,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/install
|
||||
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
||||
%_datadir/dolibarr/htdocs/livraison
|
||||
%_datadir/dolibarr/htdocs/loan
|
||||
%_datadir/dolibarr/htdocs/mailmanspip
|
||||
%_datadir/dolibarr/htdocs/margin
|
||||
%_datadir/dolibarr/htdocs/opensurvey
|
||||
|
||||
@ -252,8 +252,10 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/contrat
|
||||
%_datadir/dolibarr/htdocs/core
|
||||
%_datadir/dolibarr/htdocs/cron
|
||||
%_datadir/dolibarr/htdocs/don
|
||||
%_datadir/dolibarr/htdocs/ecm
|
||||
%_datadir/dolibarr/htdocs/expedition
|
||||
%_datadir/dolibarr/htdocs/expensereport
|
||||
%_datadir/dolibarr/htdocs/exports
|
||||
%_datadir/dolibarr/htdocs/externalsite
|
||||
%_datadir/dolibarr/htdocs/fichinter
|
||||
@ -265,6 +267,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/install
|
||||
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
||||
%_datadir/dolibarr/htdocs/livraison
|
||||
%_datadir/dolibarr/htdocs/loan
|
||||
%_datadir/dolibarr/htdocs/mailmanspip
|
||||
%_datadir/dolibarr/htdocs/margin
|
||||
%_datadir/dolibarr/htdocs/opensurvey
|
||||
|
||||
@ -169,8 +169,10 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/contrat
|
||||
%_datadir/dolibarr/htdocs/core
|
||||
%_datadir/dolibarr/htdocs/cron
|
||||
%_datadir/dolibarr/htdocs/don
|
||||
%_datadir/dolibarr/htdocs/ecm
|
||||
%_datadir/dolibarr/htdocs/expedition
|
||||
%_datadir/dolibarr/htdocs/expensereport
|
||||
%_datadir/dolibarr/htdocs/exports
|
||||
%_datadir/dolibarr/htdocs/externalsite
|
||||
%_datadir/dolibarr/htdocs/fichinter
|
||||
@ -182,6 +184,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/install
|
||||
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
||||
%_datadir/dolibarr/htdocs/livraison
|
||||
%_datadir/dolibarr/htdocs/loan
|
||||
%_datadir/dolibarr/htdocs/mailmanspip
|
||||
%_datadir/dolibarr/htdocs/margin
|
||||
%_datadir/dolibarr/htdocs/opensurvey
|
||||
|
||||
@ -180,8 +180,10 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/contrat
|
||||
%_datadir/dolibarr/htdocs/core
|
||||
%_datadir/dolibarr/htdocs/cron
|
||||
%_datadir/dolibarr/htdocs/don
|
||||
%_datadir/dolibarr/htdocs/ecm
|
||||
%_datadir/dolibarr/htdocs/expedition
|
||||
%_datadir/dolibarr/htdocs/expensereport
|
||||
%_datadir/dolibarr/htdocs/exports
|
||||
%_datadir/dolibarr/htdocs/externalsite
|
||||
%_datadir/dolibarr/htdocs/fichinter
|
||||
@ -193,6 +195,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/install
|
||||
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
||||
%_datadir/dolibarr/htdocs/livraison
|
||||
%_datadir/dolibarr/htdocs/loan
|
||||
%_datadir/dolibarr/htdocs/mailmanspip
|
||||
%_datadir/dolibarr/htdocs/margin
|
||||
%_datadir/dolibarr/htdocs/opensurvey
|
||||
|
||||
68
dev/fixaltlanguages.sh
Executable file
68
dev/fixaltlanguages.sh
Executable file
@ -0,0 +1,68 @@
|
||||
#!/bin/sh
|
||||
# Recursively deduplicate file lines on a per file basis
|
||||
# Useful to deduplicate language files
|
||||
#
|
||||
# Needs awk 4.0 for the inplace fixing command
|
||||
#
|
||||
# Raphaël Doursenaud - rdoursenaud@gpcsolutions.fr
|
||||
|
||||
# Syntax
|
||||
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
|
||||
then
|
||||
echo "Scan alternate language files and remove entries found into parent file"
|
||||
echo "Usage: fixaltlanguages.sh (list|fix) (all|file.lang) [xx_XX]"
|
||||
exit
|
||||
fi
|
||||
if [ "x$2" = "x" ]
|
||||
then
|
||||
echo "Scan alternate language files and remove entries found into parent file"
|
||||
echo "Usage: fixaltlanguages.sh (list|fix) (all|file.lang) [xx_XX]"
|
||||
exit
|
||||
fi
|
||||
|
||||
# To detect
|
||||
if [ "x$1" = "xlist" ]
|
||||
then
|
||||
echo Feature not available
|
||||
fi
|
||||
|
||||
# To fix
|
||||
if [ "x$1" = "xfix" ]
|
||||
then
|
||||
for dir in `find htdocs/langs/$3* -type d`
|
||||
do
|
||||
dirshort=`basename $dir`
|
||||
|
||||
#echo $dirshort
|
||||
|
||||
export aa=`echo $dirshort | nawk -F"_" '{ print $1 }'`
|
||||
export bb=`echo $dirshort | nawk -F"_" '{ print $2 }'`
|
||||
aaupper=`echo $dirshort | nawk -F"_" '{ print toupper($1) }'`
|
||||
if [ $aaupper = "EN" ]
|
||||
then
|
||||
aaupper="US"
|
||||
fi
|
||||
bblower=`echo $dirshort | nawk -F"_" '{ print tolower($2) }'`
|
||||
if [ "$aa" != "$bblower" -a "$dirshort" != "en_US" ]
|
||||
then
|
||||
reflang="htdocs/langs/"$aa"_"$aaupper
|
||||
if [ -d $reflang ]
|
||||
then
|
||||
echo "***** Process language "$aa"_"$bb" - Search original into "$reflang
|
||||
echo $dirshort est une langue alternative de $reflang
|
||||
echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
|
||||
./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
|
||||
for fic in `ls htdocs/langs/${aa}_${bb}/*.delta`; do f=`echo $fic | sed -e 's/\.delta//'`; echo $f; mv $f.delta $f; done
|
||||
for fic in `ls htdocs/langs/${aa}_${bb}/*.lang`;
|
||||
do f=`cat $fic | wc -l`;
|
||||
#echo $f lines into file $fic;
|
||||
if [ $f = 1 ]
|
||||
then
|
||||
echo Only one line remainging into file $fic, we delete it;
|
||||
rm $fic
|
||||
fi;
|
||||
done
|
||||
fi
|
||||
fi
|
||||
done;
|
||||
fi
|
||||
@ -10,6 +10,7 @@
|
||||
# Syntax
|
||||
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
|
||||
then
|
||||
echo "This script detect or clean files with CR+LF into files with LF only. All source files are included, also files into includes."
|
||||
echo "Usage: fixdosfiles.sh [list|fix]"
|
||||
fi
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
# Syntax
|
||||
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
|
||||
then
|
||||
echo "Detect duplicate translation keys inside a file (there is no cross file check)."
|
||||
echo "Usage: detectduplicatelangkey.sh (list|fix)"
|
||||
fi
|
||||
|
||||
|
||||
@ -9,17 +9,19 @@
|
||||
# Syntax
|
||||
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
|
||||
then
|
||||
echo "Find exact duplicated lines into file (not cross file checking)"
|
||||
echo "Usage: deduplicatefilelinesrecursively.sh [list|fix]"
|
||||
fi
|
||||
|
||||
# To detect
|
||||
if [ "x$1" = "xlist" ]
|
||||
then
|
||||
for file in `find . -type f -name *.lang`
|
||||
for file in `find htdocs/langs/en_US -type f -name *.lang`
|
||||
do
|
||||
if [ `sort "$file" | uniq -d | wc -l` -gt 0 ]
|
||||
if [ `sort "$file" | grep -v '^$' | uniq -d | wc -l` -gt 0 ]
|
||||
then
|
||||
echo "$file"
|
||||
echo "***** $file"
|
||||
sort "$file" | grep -v '^$' | uniq -d
|
||||
fi
|
||||
done
|
||||
fi
|
||||
@ -27,7 +29,7 @@ fi
|
||||
# To fix
|
||||
if [ "x$1" = "xfix" ]
|
||||
then
|
||||
for file in `find . -type f -name *.lang`
|
||||
for file in `find htdocs/langs/en_US -type f -name *.lang`
|
||||
do
|
||||
awk -i inplace ' !x[$0]++' "$file"
|
||||
done;
|
||||
@ -10,6 +10,7 @@
|
||||
# Syntax
|
||||
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
|
||||
then
|
||||
echo "Fix permissions of files"
|
||||
echo "Usage: fixperms.sh (list|fix)"
|
||||
fi
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
# Syntax
|
||||
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
|
||||
then
|
||||
echo "Detect and fix bad UTF8 encoded files (UTF8 must not use BOM char)"
|
||||
echo "Usage: fixutf8bomfiles.sh (list|fix) [addincludes]"
|
||||
fi
|
||||
|
||||
|
||||
@ -174,7 +174,7 @@ $targetcontent=$sourcecontent;
|
||||
// Substitute class name
|
||||
$targetcontent=preg_replace('/skeleton_class\.class\.php/', $classmin.'.class.php', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$element=\'skeleton\'/', '\$element=\''.$classmin.'\'', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$table_element=\'skeleton\'/', '\$table_element=\''.$classmin.'\'', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$table_element=\'skeleton\'/', '\$table_element=\''.$tablenoprefix.'\'', $targetcontent);
|
||||
$targetcontent=preg_replace('/Skeleton_Class/', $classname, $targetcontent);
|
||||
|
||||
// Substitute comments
|
||||
@ -252,7 +252,13 @@ foreach($property as $key => $prop)
|
||||
if ($addfield)
|
||||
{
|
||||
$varprop.="\t\t\$sql.= \" ";
|
||||
if ($prop['istime'])
|
||||
if ($prop['field']=='datec')
|
||||
{
|
||||
$varprop.='"."\'".$this->db->idate(dol_now())."\'"."';
|
||||
if ($i < count($property)) $varprop.=",";
|
||||
$varprop.='";';
|
||||
}
|
||||
elseif ($prop['istime'])
|
||||
{
|
||||
$varprop.='".(! isset($this->'.$prop['field'].') || dol_strlen($this->'.$prop['field'].')==0?\'NULL\':"\'".$this->db->idate(';
|
||||
$varprop.="\$this->".$prop['field']."";
|
||||
@ -268,6 +274,12 @@ foreach($property as $key => $prop)
|
||||
if ($i < count($property)) $varprop.=",";
|
||||
$varprop.='";';
|
||||
}
|
||||
elseif ($prop['field']=='fk_user_mod' || $prop['field']=='fk_user_author')
|
||||
{
|
||||
$varprop.='".$user->id."';
|
||||
if ($i < count($property)) $varprop.=",";
|
||||
$varprop.='";';
|
||||
}
|
||||
else
|
||||
{
|
||||
$varprop.='".(! isset($this->'.$prop['field'].')?\'NULL\':"\'".';
|
||||
@ -289,11 +301,17 @@ $i=0;
|
||||
foreach($property as $key => $prop)
|
||||
{
|
||||
$i++;
|
||||
if ($prop['field'] != 'rowid' && $prop['field'] != 'id')
|
||||
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && $prop['field'] != 'datec' && $prop['field'] != 'fk_user_author')
|
||||
{
|
||||
$varprop.="\t\t\$sql.= \" ";
|
||||
$varprop.=$prop['field'].'=';
|
||||
if ($prop['istime'])
|
||||
if ($prop['field']=='tms') {
|
||||
$varprop.='".(dol_strlen($this->'.$prop['field'].')!=0 ? "\'".$this->db->idate(';
|
||||
$varprop.='$this->'.$prop['field'];
|
||||
$varprop.=')."\'" : "\'".$this->db->idate(dol_now())."\'").';
|
||||
$varprop.='"';
|
||||
}
|
||||
elseif ($prop['istime'])
|
||||
{
|
||||
// (dol_strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null')
|
||||
$varprop.='".(dol_strlen($this->'.$prop['field'].')!=0 ? "\'".$this->db->idate(';
|
||||
@ -301,6 +319,9 @@ foreach($property as $key => $prop)
|
||||
$varprop.=')."\'" : \'null\').';
|
||||
$varprop.='"';
|
||||
}
|
||||
elseif ($prop['field']=='fk_user_mod') {
|
||||
$varprop.='".$user->id."';
|
||||
}
|
||||
else
|
||||
{
|
||||
$varprop.="\".";
|
||||
@ -325,6 +346,7 @@ $targetcontent=preg_replace('/\$sql\.= " t\.field2";/', '', $targetcontent);
|
||||
|
||||
// Substitute select set parameters
|
||||
$varprop="\n";
|
||||
$varpropline="\n";
|
||||
$cleanparam='';
|
||||
$i=0;
|
||||
foreach($property as $key => $prop)
|
||||
@ -338,11 +360,22 @@ foreach($property as $key => $prop)
|
||||
if ($prop['istime']) $varprop.=')';
|
||||
$varprop.=";";
|
||||
$varprop.="\n";
|
||||
|
||||
$varpropline.="\t\t\t\t\$line->".$prop['field']." = ";
|
||||
if ($prop['istime']) $varpropline.='$this->db->jdate(';
|
||||
$varpropline.='$obj->'.$prop['field'];
|
||||
if ($prop['istime']) $varpropline.=')';
|
||||
$varpropline.=";";
|
||||
$varpropline.="\n";
|
||||
}
|
||||
}
|
||||
$targetcontent=preg_replace('/\$this->prop1 = \$obj->field1;/', $varprop, $targetcontent);
|
||||
$targetcontent=preg_replace('/\$this->prop2 = \$obj->field2;/', '', $targetcontent);
|
||||
|
||||
//Substirute fetchAll
|
||||
$targetcontent=preg_replace('/\$line->prop1 = \$obj->field1;/', $varpropline, $targetcontent);
|
||||
$targetcontent=preg_replace('/\$line->prop2 = \$obj->field2;/', '', $targetcontent);
|
||||
|
||||
|
||||
// Substitute initasspecimen parameters
|
||||
$varprop="\n";
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -41,6 +42,8 @@ class Skeleton_Class extends CommonObject
|
||||
var $element='skeleton'; //!< Id that identify managed objects
|
||||
var $table_element='skeleton'; //!< Name of table without prefix where object is stored
|
||||
|
||||
var $lines=array();
|
||||
|
||||
var $id;
|
||||
var $prop1;
|
||||
var $prop2;
|
||||
@ -103,11 +106,11 @@ class Skeleton_Class extends CommonObject
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
// want this action to call a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//$result=$this->call_trigger('MYOBJECT_CREATE',$user);
|
||||
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||
//if ($result < 0) $error++;
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
@ -115,11 +118,6 @@ class Skeleton_Class extends CommonObject
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
@ -175,6 +173,69 @@ class Skeleton_Class extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param string $sortorder Sort Order
|
||||
* @param string $sortfield Sort field
|
||||
* @param int $limit offset limit
|
||||
* @param int $offset offset limit
|
||||
* @param array $filter filter array
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetchAll($sortorder, $sortfield, $limit, $offset, $filter = array())
|
||||
{
|
||||
global $langs;
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
$sql.= " t.field1,";
|
||||
$sql.= " t.field2";
|
||||
//...
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."mytable as t";
|
||||
|
||||
// Manage filter
|
||||
$sqlwhere=array();
|
||||
if (count($filter)>0) {
|
||||
foreach ( $filter as $key => $value ) {
|
||||
//$sqlwhere []= ' AND '. $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||
}
|
||||
}
|
||||
if (count($sqlwhere)>0) {
|
||||
$sql.= ' WHERE '.implode(' AND ', $sqlwhere);
|
||||
}
|
||||
$sql .= " ORDER BY " . $sortfield . " " . $sortorder . " " . $this->db->plimit($limit + 1, $offset);
|
||||
|
||||
$this->lines = array ();
|
||||
|
||||
dol_syslog(get_class($this)."::fetchAll", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$line=new Skeleton_ClassLine();
|
||||
|
||||
$line->id = $obj->rowid;
|
||||
$line->prop1 = $obj->field1;
|
||||
$line->prop2 = $obj->field2;
|
||||
|
||||
$this->lines[]=$line;
|
||||
//...
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return $num;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetchAll ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
@ -368,3 +429,10 @@ class Skeleton_Class extends CommonObject
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Skeleton_ClassLine
|
||||
{
|
||||
var $id;
|
||||
var $prop1;
|
||||
var $prop2;
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
*
|
||||
* Usage:
|
||||
* cd htdocs/langs
|
||||
* ../../dev/translation/strip_language_file.php <primary_lang_dir> <secondary_lang_dir> [file.lang|all]
|
||||
* ./dev/translation/strip_language_file.php <primary_lang_dir> <secondary_lang_dir> [file.lang|all]
|
||||
*
|
||||
* To rename all .delta files, you can do
|
||||
* for fic in `ls *.delta`; do f=`echo $fic | sed -e 's/\.delta//'`; echo $f; mv $f.delta $f; done
|
||||
@ -60,24 +60,26 @@ $rc = 0;
|
||||
|
||||
$lPrimary = isset($argv[1])?$argv[1]:'';
|
||||
$lSecondary = isset($argv[2])?$argv[2]:'';
|
||||
$lEnglish = 'en_US';
|
||||
$filesToProcess = isset($argv[3])?$argv[3]:'';
|
||||
|
||||
if (empty($lPrimary) || empty($lSecondary) || empty($filesToProcess))
|
||||
{
|
||||
$rc = 1;
|
||||
$msg = '***** Script to clean language files *****'."\n";
|
||||
$msg.= 'Usage: ../../dev/translation/strip_language_file.php xx_XX xx_YY [file.lang|all]'."\n";
|
||||
$msg.= 'Usage: ./dev/translation/strip_language_file.php xx_XX xx_YY [file.lang|all]'."\n";
|
||||
print $msg . "(rc=$rc).\n";
|
||||
exit($rc);
|
||||
}
|
||||
|
||||
$aPrimary = array();
|
||||
$aSecondary = array();
|
||||
$aEnglish = array();
|
||||
|
||||
// Define array $filesToProcess
|
||||
if ($filesToProcess == 'all')
|
||||
{
|
||||
$dir = new DirectoryIterator($lPrimary);
|
||||
$dir = new DirectoryIterator('htdocs/langs/'.$lPrimary);
|
||||
while($dir->valid()) {
|
||||
if(!$dir->isDot() && $dir->isFile() && ! preg_match('/^\./',$dir->getFilename())) {
|
||||
$files[] = $dir->getFilename();
|
||||
@ -94,8 +96,9 @@ else $filesToProcess=explode(',',$filesToProcess);
|
||||
// Loop on each file
|
||||
foreach($filesToProcess as $fileToProcess)
|
||||
{
|
||||
$lPrimaryFile = $lPrimary.'/'.$fileToProcess;
|
||||
$lSecondaryFile = $lSecondary.'/'.$fileToProcess;
|
||||
$lPrimaryFile = 'htdocs/langs/'.$lPrimary.'/'.$fileToProcess;
|
||||
$lSecondaryFile = 'htdocs/langs/'.$lSecondary.'/'.$fileToProcess;
|
||||
$lEnglishFile = 'htdocs/langs/'.$lEnglish.'/'.$fileToProcess;
|
||||
$output = $lSecondaryFile . '.delta';
|
||||
|
||||
print "---- Process language file ".$lSecondaryFile."\n";
|
||||
@ -114,6 +117,13 @@ foreach($filesToProcess as $fileToProcess)
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! is_readable($lEnglishFile) ) {
|
||||
$rc = 3;
|
||||
$msg = "Cannot read english language file $lEnglishFile. We discard this file.";
|
||||
print $msg . "\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
// Start reading and parsing Secondary
|
||||
|
||||
if ( $handle = fopen($lSecondaryFile, 'r') )
|
||||
@ -172,6 +182,65 @@ foreach($filesToProcess as $fileToProcess)
|
||||
}
|
||||
|
||||
|
||||
// Start reading and parsing English
|
||||
|
||||
if ( $handle = fopen($lEnglishFile, 'r') )
|
||||
{
|
||||
print "Read English File $lEnglishFile:\n";
|
||||
$cnt = 0;
|
||||
while (($line = fgets($handle)) !== false)
|
||||
{
|
||||
$cnt++;
|
||||
|
||||
// strip comments
|
||||
if ( preg_match("/^\w*#/", $line) ) {
|
||||
continue;
|
||||
}
|
||||
// strip empty lines
|
||||
if ( preg_match("/^\w*$/", $line) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$a = mb_split('=', trim($line), 2);
|
||||
if ( count($a) != 2 ) {
|
||||
print "ERROR in file $lEnglishFile, line $cnt: " . trim($line) . "\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
list($key, $value) = $a;
|
||||
|
||||
// key is redundant
|
||||
if ( array_key_exists($key, $aEnglish) ) {
|
||||
print "Key $key is redundant in file $lEnglishFile (line: $cnt).\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
// String has no value
|
||||
if ( $value == '' ) {
|
||||
print "Key $key has no value in file $lEnglishFile (line: $cnt).\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
$aEnglish[$key] = trim($value);
|
||||
}
|
||||
if ( ! feof($handle) )
|
||||
{
|
||||
$rc = 5;
|
||||
$msg = "Unexpected fgets() fail";
|
||||
print $msg . " (rc=$rc).\n";
|
||||
exit($rc);
|
||||
}
|
||||
fclose($handle);
|
||||
}
|
||||
else {
|
||||
$rc = 6;
|
||||
$msg = "Cannot open file $lEnglishFile";
|
||||
print $msg . " (rc=$rc).\n";
|
||||
exit($rc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Start reading and parsing Primary. See rules in header!
|
||||
|
||||
$arrayofkeytoalwayskeep=array('DIRECTION','FONTFORPDF','FONTSIZEFORPDF','SeparatorDecimal','SeparatorThousand');
|
||||
@ -246,7 +315,11 @@ foreach($filesToProcess as $fileToProcess)
|
||||
}
|
||||
|
||||
// String exists in both files and does not match
|
||||
if ((! empty($aSecondary[$key]) && $aSecondary[$key] != $aPrimary[$key]) || in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/',$key) || preg_match('/^FormatHour/',$key))
|
||||
if (
|
||||
(! empty($aSecondary[$key]) && $aSecondary[$key] != $aPrimary[$key]
|
||||
&& ! empty($aEnglish[$key]) && $aSecondary[$key] != $aEnglish[$key])
|
||||
|| in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/',$key) || preg_match('/^FormatHour/',$key)
|
||||
)
|
||||
{
|
||||
//print "Key $key differs so we add it into new secondary language (line: $cnt).\n";
|
||||
fwrite($oh, $key."=".(empty($aSecondary[$key])?$aPrimary[$key]:$aSecondary[$key])."\n");
|
||||
@ -270,8 +343,8 @@ foreach($filesToProcess as $fileToProcess)
|
||||
|
||||
print "Output can be found at $output.\n";
|
||||
|
||||
print "To rename all .delta files, you can do\n";
|
||||
print 'for fic in `ls *.delta`; do f=`echo $fic | sed -e \'s/\.delta//\'`; echo $f; mv $f.delta $f; done'."\n";
|
||||
print "To rename all .delta files, you can do:\n";
|
||||
print '> for fic in `ls htdocs/langs/'.$lSecondary.'/*.delta`; do f=`echo $fic | sed -e \'s/\.delta//\'`; echo $f; mv $f.delta $f; done'."\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ then
|
||||
echo "This pull remote transifex files to local dir."
|
||||
echo "Note: If you pull a language file (not source), file will be skipped if local file is newer."
|
||||
echo " Using -f will overwrite local file (does not work with 'all')."
|
||||
echo "Usage: ./dev/translation/txpull.sh (all|xx_XX) [-r dolibarr.file] [-f]"
|
||||
echo "Usage: ./dev/translation/txpull.sh (all|xx_XX) [-r dolibarr.file] [-f] [-s]"
|
||||
exit
|
||||
fi
|
||||
|
||||
@ -26,13 +26,21 @@ fi
|
||||
|
||||
if [ "x$1" = "xall" ]
|
||||
then
|
||||
for fic in ar_SA bg_BG bs_BA ca_ES cs_CZ da_DK de_DE el_GR es_ES et_EE eu_ES fa_IR fi_FI fr_FR he_IL hr_HR hu_HU id_ID is_IS it_IT ja_JP ka_GE ko_KR lt_LT lv_LV mk_MK nb_NO nl_NL pl_PL pt_PT ro_RO ru_RU ru_UA sk_SK sl_SI sq_AL sv_SE th_TH tr_TR uk_UA uz_UZ vi_VN zh_CN zh_TW
|
||||
cd htdocs/lang
|
||||
for dir in `find htdocs/langs/* -type d`
|
||||
do
|
||||
echo "tx pull -l $fic $2 $3"
|
||||
tx pull -l $fic $2 $3
|
||||
fic=`basename $dir`
|
||||
if [ $fic != "en_US" ]
|
||||
then
|
||||
echo "tx pull -l $fic $2 $3"
|
||||
tx pull -l $fic $2 $3
|
||||
fi
|
||||
done
|
||||
cd -
|
||||
else
|
||||
echo "tx pull -l $1 $2 $3 $4"
|
||||
tx pull -l $1 $2 $3 $4
|
||||
echo "tx pull -l $1 $2 $3 $4 $5"
|
||||
tx pull -l $1 $2 $3 $4 $5
|
||||
fi
|
||||
|
||||
echo Think to launch also:
|
||||
echo "> dev/fixaltlanguages.sh fix all"
|
||||
|
||||
@ -249,7 +249,11 @@ if ($action == 'export_csv')
|
||||
$purchase_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
||||
|
||||
header('Content-Type: text/csv');
|
||||
header('Content-Disposition: attachment;filename=journal_achats.csv');
|
||||
if ($conf->global->EXPORT_PREFIX_SPEC)
|
||||
$filename=$conf->global->EXPORT_PREFIX_SPEC."_"."journal_achats.csv";
|
||||
else
|
||||
$filename="journal_achats.csv";
|
||||
header('Content-Disposition: attachment;filename='.$filename);
|
||||
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export
|
||||
{
|
||||
|
||||
@ -271,7 +271,11 @@ if ($action == 'export_csv')
|
||||
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
||||
|
||||
header('Content-Type: text/csv');
|
||||
header('Content-Disposition: attachment;filename=journal_ventes.csv');
|
||||
if ($conf->global->EXPORT_PREFIX_SPEC)
|
||||
$filename=$conf->global->EXPORT_PREFIX_SPEC."_"."journal_ventes.csv";
|
||||
else
|
||||
$filename="journal_ventes.csv";
|
||||
header('Content-Disposition: attachment;filename='.$filename);
|
||||
|
||||
$companystatic = new Client($db);
|
||||
|
||||
|
||||
@ -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 string $option Page lien
|
||||
* @return string Chaine avec URL
|
||||
@ -1568,25 +1568,25 @@ class Adherent extends CommonObject
|
||||
|
||||
if ($option == 'card')
|
||||
{
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id.$linkclose;
|
||||
$lienfin='</a>';
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id.$linkclose;
|
||||
$linkend='</a>';
|
||||
}
|
||||
if ($option == 'subscription')
|
||||
{
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$this->id.$linkclose;
|
||||
$lienfin='</a>';
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$this->id.$linkclose;
|
||||
$linkend='</a>';
|
||||
}
|
||||
if ($option == 'category')
|
||||
{
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/categories/categorie.php?id='.$this->id.'&type=3'.$linkclose;
|
||||
$lienfin='</a>';
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/categories/categorie.php?id='.$this->id.'&type=3'.$linkclose;
|
||||
$linkend='</a>';
|
||||
}
|
||||
|
||||
$picto='user';
|
||||
|
||||
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
||||
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
$result.=$lien.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$lienfin;
|
||||
$result.=$link.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -1721,8 +1721,8 @@ class Adherent extends CommonObject
|
||||
/**
|
||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||
*
|
||||
* @param User $user Objet user
|
||||
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
||||
* @param User $user Objet user
|
||||
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
||||
*/
|
||||
function load_board($user)
|
||||
{
|
||||
|
||||
@ -266,9 +266,9 @@ class AdherentType extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Renvoie nom clicable (avec eventuellement le picto)
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param int $maxlen length max libelle
|
||||
* @return string String with URL
|
||||
*/
|
||||
@ -279,14 +279,14 @@ class AdherentType extends CommonObject
|
||||
$result='';
|
||||
$label=$langs->trans("ShowTypeCard",$this->libelle);
|
||||
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$lienfin='</a>';
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
$picto='group';
|
||||
|
||||
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
||||
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
$result.=$lien.($maxlen?dol_trunc($this->libelle,$maxlen):$this->libelle).$lienfin;
|
||||
$result.=$link.($maxlen?dol_trunc($this->libelle,$maxlen):$this->libelle).$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -90,7 +90,7 @@ class Cotisation extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -140,7 +140,7 @@ class Cotisation extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -181,7 +181,7 @@ class Cotisation extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->error();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -217,7 +217,7 @@ class Cotisation extends CommonObject
|
||||
$result=$member->fetch($this->fk_adherent);
|
||||
$result=$member->update_end_date($user);
|
||||
|
||||
if ($accountline->rowid > 0) // If we found bank account line (this means this->fk_bank defined)
|
||||
if ($accountline->id > 0) // If we found bank account line (this means this->fk_bank defined)
|
||||
{
|
||||
$result=$accountline->delete($user); // Return false if refused because line is conciliated
|
||||
if ($result > 0)
|
||||
@ -254,9 +254,9 @@ class Cotisation extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Renvoie nom clicable (avec eventuellement le picto)
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @return string Chaine avec URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0)
|
||||
@ -266,14 +266,14 @@ class Cotisation extends CommonObject
|
||||
$result='';
|
||||
$label=$langs->trans("ShowSubscription").': '.$this->ref;
|
||||
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$lienfin='</a>';
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
$picto='payment';
|
||||
|
||||
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
||||
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
$result.=$lien.$this->ref.$lienfin;
|
||||
$result.=$link.$this->ref.$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
599
htdocs/admin/askpricesupplier.php
Normal file
599
htdocs/admin/askpricesupplier.php
Normal file
@ -0,0 +1,599 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (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/>.
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/askpricesupplier/class/askpricesupplier.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php';
|
||||
$langs->load("admin");
|
||||
$langs->load("errors");
|
||||
$langs->load('other');
|
||||
$langs->load('askpricesupplier');
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$type='askpricesupplier';
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
$error=0;
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconstaskpricesupplier=GETPOST('maskconstaskpricesupplier','alpha');
|
||||
$maskaskpricesupplier=GETPOST('maskaskpricesupplier','alpha');
|
||||
if ($maskconstaskpricesupplier) $res = dolibarr_set_const($db,$maskconstaskpricesupplier,$maskaskpricesupplier,'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessage($langs->trans("SetupSaved"));
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->trans("Error"),'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'specimen')
|
||||
{
|
||||
$modele=GETPOST('module','alpha');
|
||||
|
||||
$askpricesupplier = new AskPriceSupplier($db);
|
||||
$askpricesupplier->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/askpricesupplier/doc/pdf_".$modele.".modules.php");
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound)
|
||||
{
|
||||
require_once $file;
|
||||
|
||||
$module = new $classname($db);
|
||||
|
||||
if ($module->write_file($askpricesupplier,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=askpricesupplier&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($module->error,'errors');
|
||||
dol_syslog($module->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorModuleNotFound"),'errors');
|
||||
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'set_ASKPRICESUPPLIER_DRAFT_WATERMARK')
|
||||
{
|
||||
$draft = GETPOST('ASKPRICESUPPLIER_DRAFT_WATERMARK','alpha');
|
||||
|
||||
$res = dolibarr_set_const($db, "ASKPRICESUPPLIER_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessage($langs->trans("SetupSaved"));
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->trans("Error"),'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'set_ASKPRICESUPPLIER_FREE_TEXT')
|
||||
{
|
||||
$freetext = GETPOST('ASKPRICESUPPLIER_FREE_TEXT'); // No alpha here, we want exact string
|
||||
|
||||
$res = dolibarr_set_const($db, "ASKPRICESUPPLIER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessage($langs->trans("SetupSaved"));
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->trans("Error"),'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER')
|
||||
{
|
||||
$res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER",$value,'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessage($langs->trans("SetupSaved"));
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->trans("Error"),'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
||||
if ($action == 'setModuleOptions')
|
||||
{
|
||||
$post_size=count($_POST);
|
||||
|
||||
$db->begin();
|
||||
|
||||
for($i=0;$i < $post_size;$i++)
|
||||
{
|
||||
if (array_key_exists('param'.$i,$_POST))
|
||||
{
|
||||
$param=GETPOST("param".$i,'alpha');
|
||||
$value=GETPOST("value".$i,'alpha');
|
||||
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
}
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans("SetupSaved"));
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
setEventMessage($langs->trans("Error"),'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Activate a model
|
||||
if ($action == 'set')
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
|
||||
else if ($action == 'del')
|
||||
{
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($conf->global->ASKPRICESUPPLIER_ADDON_PDF == "$value") dolibarr_del_const($db, 'ASKPRICESUPPLIER_ADDON_PDF',$conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'setdoc')
|
||||
{
|
||||
if (dolibarr_set_const($db, "ASKPRICESUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
||||
{
|
||||
$conf->global->ASKPRICESUPPLIER_ADDON_PDF = $value;
|
||||
}
|
||||
|
||||
// On active le modele
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'setmod')
|
||||
{
|
||||
// TODO Verifier si module numerotation choisi peut etre active
|
||||
// par appel methode canBeActivated
|
||||
|
||||
dolibarr_set_const($db, "ASKPRICESUPPLIER_ADDON",$value,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Affiche page
|
||||
*/
|
||||
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
|
||||
|
||||
llxHeader('',$langs->trans("AskPriceSupplierSetup"));
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
//if ($mesg) print $mesg;
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("AskPriceSupplierSetup"),$linkback,'setup');
|
||||
|
||||
$head = askpricesupplier_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'general', $langs->trans("CommRequests"), 0, 'askpricesupplier');
|
||||
|
||||
/*
|
||||
* Module numerotation
|
||||
*/
|
||||
print_titre($langs->trans("AskPriceSupplierNumberingModules"));
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Name")."</td>\n";
|
||||
print '<td>'.$langs->trans("Description")."</td>\n";
|
||||
print '<td class="nowrap">'.$langs->trans("Example")."</td>\n";
|
||||
print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
|
||||
print '<td align="center" width="16">'.$langs->trans("ShortInfo").'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
clearstatcache();
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/askpricesupplier/");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
$var=true;
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (substr($file, 0, 21) == 'mod_askpricesupplier_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file)-4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
|
||||
// Show example of numbering module
|
||||
print '<td class="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
if (preg_match('/^Error/',$tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
||||
else print $tmp;
|
||||
print '</td>'."\n";
|
||||
|
||||
print '<td align="center">';
|
||||
if ($conf->global->ASKPRICESUPPLIER_ADDON == "$file")
|
||||
{
|
||||
print img_picto($langs->trans("Activated"),'switch_on');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.$file.'">';
|
||||
print img_picto($langs->trans("Disabled"),'switch_off');
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$askpricesupplier=new AskPriceSupplier($db);
|
||||
$askpricesupplier->initAsSpecimen();
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$askpricesupplier->type=0;
|
||||
$nextval=$module->getNextValue($mysoc,$askpricesupplier);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
print "</table><br>\n";
|
||||
|
||||
|
||||
/*
|
||||
* Document templates generators
|
||||
*/
|
||||
|
||||
print_titre($langs->trans("AskPriceSupplierPDFModules"));
|
||||
|
||||
// Load array def with activated templates
|
||||
$def = array();
|
||||
$sql = "SELECT nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE type = '".$type."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0;
|
||||
$num_rows=$db->num_rows($resql);
|
||||
while ($i < $num_rows)
|
||||
{
|
||||
$array = $db->fetch_array($resql);
|
||||
array_push($def, $array[0]);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||
print "<tr class=\"liste_titre\">\n";
|
||||
print " <td>".$langs->trans("Name")."</td>\n";
|
||||
print " <td>".$langs->trans("Description")."</td>\n";
|
||||
print '<td align="center" width="40">'.$langs->trans("Status")."</td>\n";
|
||||
print '<td align="center" width="40">'.$langs->trans("Default")."</td>\n";
|
||||
print '<td align="center" width="40">'.$langs->trans("ShortInfo").'</td>';
|
||||
print '<td align="center" width="40">'.$langs->trans("Preview").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
$var=true;
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('','/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/askpricesupplier".$valdir);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle=opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
$filelist[]=$file;
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
foreach($filelist as $file)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
|
||||
{
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db);
|
||||
|
||||
$modulequalified=1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
|
||||
|
||||
if ($modulequalified)
|
||||
{
|
||||
$var = !$var;
|
||||
print '<tr '.$bc[$var].'><td width="100">';
|
||||
print (empty($module->name)?$name:$module->name);
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module,'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
print '</td>';
|
||||
|
||||
// Active
|
||||
if (in_array($name, $def))
|
||||
{
|
||||
print '<td align="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
|
||||
print img_picto($langs->trans("Enabled"),'switch_on');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
// Defaut
|
||||
print "<td align=\"center\">";
|
||||
if ($conf->global->ASKPRICESUPPLIER_ADDON_PDF == "$name")
|
||||
{
|
||||
print img_picto($langs->trans("Default"),'on');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
|
||||
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1);
|
||||
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1);
|
||||
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1);
|
||||
//$htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
|
||||
//$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
|
||||
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftProposal").': '.yn($module->option_draft_watermark,1,1);
|
||||
|
||||
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
// Preview
|
||||
print '<td align="center">';
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_object($langs->trans("PreviewNotAvailable"),'generic');
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
/*
|
||||
* Other options
|
||||
*
|
||||
*/
|
||||
print_titre($langs->trans("OtherOptions"));
|
||||
|
||||
$var=true;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print "<td>".$langs->trans("Parameter")."</td>\n";
|
||||
print '<td width="60" align="center">'.$langs->trans("Value")."</td>\n";
|
||||
print "<td> </td>\n";
|
||||
print "</tr>";
|
||||
|
||||
$var=! $var;
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_ASKPRICESUPPLIER_FREE_TEXT">';
|
||||
print '<tr '.$bc[$var].'><td colspan="2">';
|
||||
print $langs->trans("FreeLegalTextOnAskPriceSupplier").' ('.$langs->trans("AddCRIfTooLong").')<br>';
|
||||
print '<textarea name="ASKPRICESUPPLIER_FREE_TEXT" class="flat" cols="120">'.$conf->global->ASKPRICESUPPLIER_FREE_TEXT.'</textarea>';
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
$var=!$var;
|
||||
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"set_ASKPRICESUPPLIER_DRAFT_WATERMARK\">";
|
||||
print '<tr '.$bc[$var].'><td colspan="2">';
|
||||
print $langs->trans("WatermarkOnDraftAskPriceSupplier").'<br>';
|
||||
print '<input size="50" class="flat" type="text" name="ASKPRICESUPPLIER_DRAFT_WATERMARK" value="'.$conf->global->ASKPRICESUPPLIER_DRAFT_WATERMARK.'">';
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
if ($conf->banque->enabled)
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER").'</td><td> </td><td align="right">';
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER))
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER&value=1">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER&value=0">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER").'</td><td> </td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Directory
|
||||
*/
|
||||
print '<br>';
|
||||
print_titre($langs->trans("PathToDocuments"));
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||
print "<tr class=\"liste_titre\">\n";
|
||||
print " <td>".$langs->trans("Name")."</td>\n";
|
||||
print " <td>".$langs->trans("Value")."</td>\n";
|
||||
print "</tr>\n";
|
||||
print "<tr ".$bc[false].">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->askpricesupplier->dir_output."</td>\n</tr>\n";
|
||||
print "</table>\n<br>";
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
@ -622,9 +622,29 @@ else
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
/*
|
||||
* Notifications
|
||||
*/
|
||||
|
||||
print_titre($langs->trans("Notifications"));
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td align="center" width="60"></td>';
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr '.$bc[$var].'><td colspan="2">';
|
||||
print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
|
||||
print '</td><td align="right">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -229,7 +229,7 @@ $sql.= ", note";
|
||||
$sql.= ", entity";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."const";
|
||||
$sql.= " WHERE entity IN (".$user->entity.",".$conf->entity.")";
|
||||
if (empty($user->entity) && $debug) {} // to force for superadmin
|
||||
if ((empty($user->entity) || $user->admin) && $debug) {} // to force for superadmin
|
||||
else $sql.= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits
|
||||
$sql.= " ORDER BY entity, name ASC";
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
||||
* Copyright (C) 2012-2013 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
|
||||
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2011-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -316,7 +316,7 @@ $tabcond[13]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabl
|
||||
$tabcond[14]= (! empty($conf->product->enabled) && ! empty($conf->ecotax->enabled));
|
||||
$tabcond[15]= true;
|
||||
$tabcond[16]= (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS));
|
||||
$tabcond[17]= ! empty($conf->deplacement->enabled);
|
||||
$tabcond[17]= (! empty($conf->deplacement->enabled) || ! empty($conf->expensereport->enabled));
|
||||
$tabcond[18]= ! empty($conf->expedition->enabled);
|
||||
$tabcond[19]= ! empty($conf->societe->enabled);
|
||||
$tabcond[20]= ! empty($conf->fournisseur->enabled);
|
||||
|
||||
@ -171,7 +171,7 @@ else if ($action == 'setdoc')
|
||||
// on passe donc par une variable pour avoir un affichage coherent
|
||||
$conf->global->FACTURE_ADDON_PDF = $value;
|
||||
}
|
||||
|
||||
|
||||
// On active le modele
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
@ -341,7 +341,7 @@ foreach ($dirmodels as $reldir)
|
||||
// Check if there is a filter on country
|
||||
preg_match('/\-(.*)_(.*)$/',$classname,$reg);
|
||||
if (! empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue;
|
||||
|
||||
|
||||
$classname = preg_replace('/\-.*$/','',$classname);
|
||||
if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php')
|
||||
{
|
||||
@ -416,7 +416,7 @@ foreach ($dirmodels as $reldir)
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Example for credit invoice
|
||||
$facture->type=2;
|
||||
$nextval=$module->getNextValue($mysoc,$facture);
|
||||
@ -630,7 +630,6 @@ print '</table>';
|
||||
|
||||
/*
|
||||
* Modes de reglement
|
||||
*
|
||||
*/
|
||||
print '<br>';
|
||||
print_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInInvoice"));
|
||||
@ -811,7 +810,27 @@ print '</tr>'."\n";
|
||||
print "</table>\n";
|
||||
|
||||
|
||||
//dol_fiche_end();
|
||||
/*
|
||||
* Notifications
|
||||
*/
|
||||
print '<br>';
|
||||
print_titre($langs->trans("Notifications"));
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td align="center" width="60"></td>';
|
||||
print '<td width="80"> </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();
|
||||
|
||||
|
||||
@ -221,7 +221,7 @@ else if ($action == 'set_FICHINTER_DRAFT_WATERMARK')
|
||||
elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS')
|
||||
{
|
||||
$val = GETPOST('FICHINTER_PRINT_PRODUCTS','alpha');
|
||||
$res = dolibarr_set_const($db, "FICHINTER_PRINT_PRODUCTS",($val == 'on'),'bool',0,'',$conf->entity);
|
||||
$res = dolibarr_set_const($db, "FICHINTER_PRINT_PRODUCTS",($val == 'on' ? 1 : 0),'bool',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
|
||||
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))
|
||||
{
|
||||
//$lien=img_picto($langs->trans("Active"),'tick').' ';
|
||||
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_MAILMAN">';
|
||||
//$lien.=$langs->trans("Disable");
|
||||
$lien.=img_picto($langs->trans("Activated"),'switch_on');
|
||||
$lien.='</a>';
|
||||
//$link=img_picto($langs->trans("Active"),'tick').' ';
|
||||
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_MAILMAN">';
|
||||
//$link.=$langs->trans("Disable");
|
||||
$link.=img_picto($langs->trans("Activated"),'switch_on');
|
||||
$link.='</a>';
|
||||
// Edition des varibales globales
|
||||
$constantes=array(
|
||||
'ADHERENT_MAILMAN_ADMINPW',
|
||||
@ -175,7 +175,7 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN))
|
||||
'ADHERENT_MAILMAN_LISTS'
|
||||
);
|
||||
|
||||
print_fiche_titre($langs->trans('MailmanTitle'), $lien,'');
|
||||
print_fiche_titre($langs->trans('MailmanTitle'), $link,'');
|
||||
|
||||
print '<br>';
|
||||
|
||||
@ -207,11 +207,11 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN))
|
||||
}
|
||||
else
|
||||
{
|
||||
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_MAILMAN">';
|
||||
//$lien.=img_$langs->trans("Activate")
|
||||
$lien.=img_picto($langs->trans("Disabled"),'switch_off');
|
||||
$lien.='</a>';
|
||||
print_fiche_titre($langs->trans('MailmanTitle'), $lien,'');
|
||||
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_MAILMAN">';
|
||||
//$link.=img_$langs->trans("Activate")
|
||||
$link.=img_picto($langs->trans("Disabled"),'switch_off');
|
||||
$link.='</a>';
|
||||
print_fiche_titre($langs->trans('MailmanTitle'), $link,'');
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@ -120,7 +120,7 @@ print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// Use a flip-hide menu
|
||||
if (isset($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL > 0)
|
||||
if (isset($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/triggers/interface_50_modNotification_Notification.class.php';
|
||||
|
||||
@ -48,25 +49,56 @@ $action = GETPOST("action");
|
||||
|
||||
if ($action == 'setvalue' && $user->admin)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$result=dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM", $_POST["email_from"], 'chaine', 0, '', $conf->entity);
|
||||
if ($result < 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
//var_dump($_POST);
|
||||
foreach($_POST as $key => $val)
|
||||
{
|
||||
if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_/',$key)) continue;
|
||||
//print $key.' - '.$val.'<br>';
|
||||
$result=dolibarr_set_const($db, $key, $val, 'chaine', 0, '', $conf->entity);
|
||||
if (! preg_match('/^NOTIF_(.*)_key$/', $key, $reg)) continue;
|
||||
|
||||
$newval='';
|
||||
$newkey='';
|
||||
|
||||
$shortkey=preg_replace('/_key$/','',$key);
|
||||
//print $shortkey.'<br>';
|
||||
|
||||
if (preg_match('/^NOTIF_(.*)_old_(.*)_key/',$key,$reg))
|
||||
{
|
||||
dolibarr_del_const($db, 'NOTIFICATION_FIXEDEMAIL_'.$reg[1].'_THRESHOLD_HIGHER_'.$reg[2], $conf->entity);
|
||||
|
||||
$newkey='NOTIFICATION_FIXEDEMAIL_'.$reg[1].'_THRESHOLD_HIGHER_'.((int) GETPOST($shortkey.'_amount'));
|
||||
$newval=GETPOST($shortkey.'_key');
|
||||
//print $newkey.' - '.$newval.'<br>';
|
||||
}
|
||||
else if (preg_match('/^NOTIF_(.*)_new_key/',$key,$reg))
|
||||
{
|
||||
// Add a new entry
|
||||
$newkey='NOTIFICATION_FIXEDEMAIL_'.$reg[1].'_THRESHOLD_HIGHER_'.((int) GETPOST($shortkey.'_amount'));
|
||||
$newval=GETPOST($shortkey.'_key');
|
||||
}
|
||||
|
||||
if ($newkey && $newval)
|
||||
{
|
||||
$result=dolibarr_set_const($db, $newkey, $newval, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
|
||||
setEventMessage($langs->trans("SetupSaved"));
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
|
||||
setEventMessage($langs->trans("Error"),'errors');
|
||||
}
|
||||
}
|
||||
@ -78,6 +110,7 @@ if ($action == 'setvalue' && $user->admin)
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$notify = new Notify($db);
|
||||
|
||||
llxHeader('',$langs->trans("NotificationSetup"));
|
||||
|
||||
@ -107,7 +140,53 @@ print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print_fiche_titre($langs->trans("ListOfAvailableNotifications"),'','');
|
||||
|
||||
if ($conf->societe->enabled)
|
||||
{
|
||||
print_fiche_titre($langs->trans("ListOfNotificationsPerContact"),'','');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Module").'</td>';
|
||||
print '<td>'.$langs->trans("Code").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
print '<td align="right">'.$langs->trans("NbOfTargetedContacts").'</td>';
|
||||
print '<td>'.'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Load array of available notifications
|
||||
$notificationtrigger=new InterfaceNotification($db);
|
||||
$listofnotifiedevents=$notificationtrigger->getListOfManagedEvents();
|
||||
|
||||
$var=true;
|
||||
foreach($listofnotifiedevents as $notifiedevent)
|
||||
{
|
||||
$var=!$var;
|
||||
$label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
|
||||
|
||||
if ($notifiedevent['elementtype'] == 'order_supplier') $elementLabel = $langs->trans('SupplierOrder');
|
||||
elseif ($notifiedevent['elementtype'] == 'propal') $elementLabel = $langs->trans('Proposal');
|
||||
elseif ($notifiedevent['elementtype'] == 'facture') $elementLabel = $langs->trans('Bill');
|
||||
elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order');
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$elementLabel.'</td>';
|
||||
print '<td>'.$notifiedevent['code'].'</td>';
|
||||
print '<td>'.$label.'</td>';
|
||||
print '<td align="right">';
|
||||
$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 '<tr class="liste_titre">';
|
||||
@ -115,12 +194,15 @@ print '<td>'.$langs->trans("Module").'</td>';
|
||||
print '<td>'.$langs->trans("Code").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
print '<td>'.$langs->trans("FixedEmailTarget").'</td>';
|
||||
print '<td>'.$langs->trans("Threshold").'</td>';
|
||||
print '<td>'.'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Load array of available notifications
|
||||
$notificationtrigger=new InterfaceNotification($db);
|
||||
$listofnotifiedevents=$notificationtrigger->getListOfManagedEvents();
|
||||
|
||||
$var=true;
|
||||
foreach($listofnotifiedevents as $notifiedevent)
|
||||
{
|
||||
$var=!$var;
|
||||
@ -136,18 +218,47 @@ foreach($listofnotifiedevents as $notifiedevent)
|
||||
print '<td>'.$notifiedevent['code'].'</td>';
|
||||
print '<td>'.$label.'</td>';
|
||||
print '<td>';
|
||||
$param='NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'];
|
||||
$value=GETPOST($param)?GETPOST($param,'alpha'):$conf->global->$param;
|
||||
$s='<input type="text" size="32" name="'.$param.'" value="'.dol_escape_htmltag($value).'">'; // Do not use type="email" here, we must be able to enter a list of email with , separator.
|
||||
$arrayemail=explode(',',$value);
|
||||
$showwarning=0;
|
||||
foreach($arrayemail as $key=>$valuedet)
|
||||
{
|
||||
$valuedet=trim($valuedet);
|
||||
if (! empty($valuedet) && ! isValidEmail($valuedet)) $showwarning++;
|
||||
}
|
||||
if ((! empty($conf->global->$param)) && $showwarning) $s.=' '.img_warning($langs->trans("ErrorBadEMail"));
|
||||
print $form->textwithpicto($s,$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
|
||||
// Notification with threshold
|
||||
foreach($conf->global as $key => $val)
|
||||
{
|
||||
if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_(.*)/', $key, $reg)) continue;
|
||||
|
||||
$param='NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_'.$reg[1];
|
||||
$value=GETPOST('NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key')?GETPOST('NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key','alpha'):$conf->global->$param;
|
||||
|
||||
$s='<input type="text" size="32" name="NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key" value="'.dol_escape_htmltag($value).'">'; // Do not use type="email" here, we must be able to enter a list of email with , separator.
|
||||
$arrayemail=explode(',',$value);
|
||||
$showwarning=0;
|
||||
foreach($arrayemail as $key=>$valuedet)
|
||||
{
|
||||
$valuedet=trim($valuedet);
|
||||
if (! empty($valuedet) && ! isValidEmail($valuedet,1)) $showwarning++;
|
||||
}
|
||||
if ((! empty($conf->global->$param)) && $showwarning) $s.=' '.img_warning($langs->trans("ErrorBadEMail"));
|
||||
print $form->textwithpicto($s,$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'<br>'.$langs->trans("YouCanAlsoUseSupervisorKeyword"),1,'help','',0,2);
|
||||
print '<br>';
|
||||
}
|
||||
// New entry input fields
|
||||
$s='<input type="text" size="32" name="NOTIF_'.$notifiedevent['code'].'_new_key" value="">'; // Do not use type="email" here, we must be able to enter a list of email with , separator.
|
||||
print $form->textwithpicto($s,$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'<br>'.$langs->trans("YouCanAlsoUseSupervisorKeyword"),1,'help','',0,2);
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
// Notification with threshold
|
||||
foreach($conf->global as $key => $val)
|
||||
{
|
||||
if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_(.*)/', $key, $reg)) continue;
|
||||
|
||||
print $langs->trans("AmountHT").' >= <input type="text" size="4" name="NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_amount" value="'.dol_escape_htmltag($reg[1]).'">';
|
||||
print '<br>';
|
||||
}
|
||||
// New entry input fields
|
||||
print $langs->trans("AmountHT").' >= <input type="text" size="4" name="NOTIF_'.$notifiedevent['code'].'_new_amount" value="">';
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
// TODO Add link to show message content
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ llxHeader('',$langs->trans("DefaultRights"));
|
||||
print_fiche_titre($langs->trans("SecuritySetup"),'','setup');
|
||||
|
||||
print $langs->trans("DefaultRightsDesc");
|
||||
print " ".$langs->trans("OnlyActiveElementsAreShown")."<br>\n";
|
||||
print " ".$langs->trans("OnlyActiveElementsAreShown")."<br><br>\n";
|
||||
|
||||
$db->begin();
|
||||
|
||||
@ -115,16 +115,15 @@ foreach ($modulesdir as $dir)
|
||||
|
||||
$db->commit();
|
||||
|
||||
// Show warning about external users
|
||||
print info_admin(showModulesExludedForExternal($modules)).'<br>'."\n";
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
$head=security_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'default', $langs->trans("Security"));
|
||||
|
||||
|
||||
// Show warning about external users
|
||||
print info_admin(showModulesExludedForExternal($modules)).'<br>'."\n";
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Affiche lignes des permissions
|
||||
|
||||
@ -643,6 +643,27 @@ print "</tr>\n";
|
||||
print "<tr ".$bc[false].">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->propal->dir_output."</td>\n</tr>\n";
|
||||
print "</table>\n<br>";
|
||||
|
||||
$db->close();
|
||||
|
||||
/*
|
||||
* Notifications
|
||||
*/
|
||||
|
||||
print_titre($langs->trans("Notifications"));
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td align="center" width="60"></td>';
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr '.$bc[$var].'><td colspan="2">';
|
||||
print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
|
||||
print '</td><td align="right">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -208,7 +208,7 @@ $formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestF
|
||||
|
||||
// List of document
|
||||
$filearray=dol_dir_list($upload_dir, "files", 0, '', '', 'name', SORT_ASC, 1);
|
||||
$formfile->list_of_documents($filearray, '', 'admin_temp', '');
|
||||
$formfile->list_of_documents($filearray, null, 'admin_temp', '');
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -124,11 +124,11 @@ $var=true;
|
||||
*/
|
||||
if (! empty($conf->global->ADHERENT_USE_SPIP))
|
||||
{
|
||||
//$lien=img_picto($langs->trans("Active"),'tick').' ';
|
||||
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">';
|
||||
//$lien.=$langs->trans("Disable");
|
||||
$lien.=img_picto($langs->trans("Activated"),'switch_on');
|
||||
$lien.='</a>';
|
||||
//$link=img_picto($langs->trans("Active"),'tick').' ';
|
||||
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">';
|
||||
//$link.=$langs->trans("Disable");
|
||||
$link.=img_picto($langs->trans("Activated"),'switch_on');
|
||||
$link.='</a>';
|
||||
// Edition des varibales globales
|
||||
$constantes=array(
|
||||
'ADHERENT_SPIP_SERVEUR',
|
||||
@ -137,18 +137,18 @@ if (! empty($conf->global->ADHERENT_USE_SPIP))
|
||||
'ADHERENT_SPIP_PASS'
|
||||
);
|
||||
|
||||
print_fiche_titre($langs->trans('SPIPTitle'), $lien, '');
|
||||
print_fiche_titre($langs->trans('SPIPTitle'), $link, '');
|
||||
print '<br>';
|
||||
form_constantes($constantes);
|
||||
print '<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">';
|
||||
//$lien.=$langs->trans("Activate");
|
||||
$lien.=img_picto($langs->trans("Disabled"),'switch_off');
|
||||
$lien.='</a>';
|
||||
print_fiche_titre($langs->trans('SPIPTitle'), $lien, '');
|
||||
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">';
|
||||
//$link.=$langs->trans("Activate");
|
||||
$link.=img_picto($langs->trans("Disabled"),'switch_off');
|
||||
$link.='</a>';
|
||||
print_fiche_titre($langs->trans('SPIPTitle'), $link, '');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -443,14 +443,16 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
}
|
||||
|
||||
print '</table><br/>';
|
||||
print '<br>';
|
||||
print '</table><br>';
|
||||
|
||||
/*
|
||||
* Other options
|
||||
*
|
||||
*/
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_SUPPLIER_INVOICE_FREE_TEXT">';
|
||||
|
||||
print_titre($langs->trans("OtherOptions"));
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
@ -459,16 +461,38 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_SUPPLIER_INVOICE_FREE_TEXT">';
|
||||
print '<tr '.$bc[$var].'><td colspan="2">';
|
||||
print $langs->trans("FreeLegalTextOnInvoices").' ('.$langs->trans("AddCRIfTooLong").')<br>';
|
||||
print '<textarea name="SUPPLIER_INVOICE_FREE_TEXT" class="flat" cols="120">'.$conf->global->SUPPLIER_INVOICE_FREE_TEXT.'</textarea>';
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
$db->close();
|
||||
|
||||
/*
|
||||
* Notifications
|
||||
*/
|
||||
|
||||
print_titre($langs->trans("Notifications"));
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td align="center" width="60"></td>';
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr '.$bc[$var].'><td colspan="2">';
|
||||
print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
|
||||
print '</td><td align="right">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -439,14 +439,16 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
}
|
||||
|
||||
print '</table><br/>';
|
||||
print '<br>';
|
||||
print '</table><br>';
|
||||
|
||||
/*
|
||||
* Other options
|
||||
*
|
||||
*/
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_SUPPLIER_ORDER_FREE_TEXT">';
|
||||
|
||||
print_titre($langs->trans("OtherOptions"));
|
||||
print '<table class="noborder" width="100%">';
|
||||
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 "</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 $langs->trans("FreeLegalTextOnOrders").' ('.$langs->trans("AddCRIfTooLong").')<br>';
|
||||
print '<textarea name="SUPPLIER_ORDER_FREE_TEXT" class="flat" cols="120">'.$conf->global->SUPPLIER_ORDER_FREE_TEXT.'</textarea>';
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
/*
|
||||
* Notifications
|
||||
*/
|
||||
|
||||
print_titre($langs->trans("Notifications"));
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td align="center" width="60"></td>';
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr '.$bc[$var].'><td colspan="2">';
|
||||
print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
|
||||
print '</td><td align="right">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -66,6 +66,11 @@ else if ($conf->db->type == 'mssql')
|
||||
//$sqls[0] = "";
|
||||
//$base=3;
|
||||
}
|
||||
else if ($conf->db->type == 'sqlite' || $conf->db->type == 'sqlite3')
|
||||
{
|
||||
//$sql = "SELECT name, type FROM sqlite_master";
|
||||
$base = 4;
|
||||
}
|
||||
|
||||
|
||||
if (! $base)
|
||||
@ -169,6 +174,40 @@ else
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
if ($base == 4)
|
||||
{
|
||||
// Sqlite by PDO or by Sqlite3
|
||||
print '<table class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("TableName").'</td>';
|
||||
print '<td>'.$langs->trans("NbOfRecord").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$sql = "SELECT name, type FROM sqlite_master where type='table' and name not like 'sqlite%' ORDER BY name";
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
$var=True;
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
|
||||
$rescount = $db->query("SELECT COUNT(*) FROM " . $row[0]);
|
||||
if ($rescount) {
|
||||
$row_count = $db->fetch_row($rescount);
|
||||
$count = $row_count[0];
|
||||
} else {
|
||||
$count = '?';
|
||||
}
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>'.$row[0].'</td>';
|
||||
print '<td>'.$count.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -179,7 +179,7 @@ $c=getServerTimeZoneInt('summer');
|
||||
$daylight=(is_numeric($c) && is_numeric($b))?round($c-$b):'unknown';
|
||||
//print $a." ".$b." ".$c." ".$daylight;
|
||||
$val=($a>=0?'+':'').$a;
|
||||
$val.=' ('.($a==='unknown'?'unknown':($a>=0?'+':'').($a*3600)).')';
|
||||
$val.=' ('.($a=='unknown'?'unknown':($a>=0?'+':'').($a*3600)).')';
|
||||
$val.=' '.getServerTimeZoneString();
|
||||
$val.=' '.$langs->trans("DaylingSavingTime").': '.($daylight==='unknown'?'unknown':($a==$c?yn($daylight):yn(0).($daylight?' ('.$langs->trans('YesInSummer').')':'')));
|
||||
print $form->textwithtooltip($val,$txt,2,1,img_info(''));
|
||||
|
||||
@ -108,7 +108,7 @@ $db->close();
|
||||
/**
|
||||
* Function to get list of updated or modified files
|
||||
*
|
||||
* @param object $dir SimpleXMLElement of files to test
|
||||
* @param SimpleXMLElement $dir SimpleXMLElement of files to test
|
||||
* @param string $path Path of file
|
||||
* @return array Array of filenames
|
||||
*/
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
|
||||
require '../../main.inc.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/geturl.lib.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("other");
|
||||
@ -105,7 +106,41 @@ llxHeader('',$langs->trans("Upgrade"),$wikihelp);
|
||||
print_fiche_titre($langs->trans("Upgrade"),'','setup');
|
||||
|
||||
print $langs->trans("CurrentVersion").' : <b>'.DOL_VERSION.'</b><br>';
|
||||
print $langs->trans("LastStableVersion").' : <b>'.$langs->trans("FeatureNotYetAvailable").'</b><br>';
|
||||
|
||||
$result = getURLContent('http://sourceforge.net/projects/dolibarr/rss');
|
||||
//var_dump($result['content']);
|
||||
$sfurl = simplexml_load_string($result['content']);
|
||||
if ($sfurl)
|
||||
{
|
||||
$title=$sfurl->channel[0]->item[0]->title;
|
||||
|
||||
function word_limiter($text, $limit = 30, $chars = '0123456789.')
|
||||
{
|
||||
if (strlen( $text ) > $limit)
|
||||
{
|
||||
$words = str_word_count($text, 2, $chars);
|
||||
$words = array_reverse($words, TRUE);
|
||||
foreach($words as $length => $word) {
|
||||
if ($length + strlen( $word ) >= $limit)
|
||||
{
|
||||
array_shift($words);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
$words = array_reverse($words);
|
||||
$text = implode(" ", $words) . '';
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
$str = $title;
|
||||
print $langs->trans("LastStableVersion").' : <b>'. word_limiter( $str ).'</b><br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("LastStableVersion").' : <b>' .$langs->trans("UpdateServerOffline").'</b><br>';
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
print $langs->trans("Upgrade").'<br>';
|
||||
|
||||
@ -119,17 +119,17 @@ if ($resql)
|
||||
print "<a href=\"card.php?id=".$obj->bid."\">".img_object($langs->trans("ShowBookmark"),"bookmark").' '.$obj->bid."</a>";
|
||||
print '</td>';
|
||||
|
||||
$lieninterne=0;
|
||||
$linkintern=0;
|
||||
$title=dol_trunc($obj->title,24);
|
||||
$lien=dol_trunc($obj->url,24);
|
||||
$link=dol_trunc($obj->url,24);
|
||||
|
||||
// Title
|
||||
print "<td>";
|
||||
if ($obj->rowid)
|
||||
{
|
||||
// Lien interne societe
|
||||
$lieninterne=1;
|
||||
$lien="Dolibarr";
|
||||
$linkintern=1;
|
||||
$link="Dolibarr";
|
||||
if (! $obj->title)
|
||||
{
|
||||
// For compatibility with old Dolibarr bookmarks
|
||||
@ -140,16 +140,16 @@ if ($resql)
|
||||
}
|
||||
$title=img_object($langs->trans("ShowCompany"),"company").' '.$obj->title;
|
||||
}
|
||||
if ($lieninterne) print "<a href=\"".$obj->url."\">";
|
||||
if ($linkintern) print "<a href=\"".$obj->url."\">";
|
||||
print $title;
|
||||
if ($lieninterne) print "</a>";
|
||||
if ($linkintern) print "</a>";
|
||||
print "</td>\n";
|
||||
|
||||
// Url
|
||||
print "<td>";
|
||||
if (! $lieninterne) print '<a href="'.$obj->url.'"'.($obj->target?' target="newlink"':'').'>';
|
||||
print $lien;
|
||||
if (! $lieninterne) print '</a>';
|
||||
if (! $linkintern) print '<a href="'.$obj->url.'"'.($obj->target?' target="newlink"':'').'>';
|
||||
print $link;
|
||||
if (! $linkintern) print '</a>';
|
||||
print "</td>\n";
|
||||
|
||||
// Target
|
||||
|
||||
@ -235,7 +235,9 @@ if ($socid)
|
||||
$soc = new Societe($db);
|
||||
$result = $soc->fetch($socid);
|
||||
|
||||
llxHeader("","",$langs->trans("Category"));
|
||||
$title=$langs->trans("Category");
|
||||
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$soc->name." - ".$title;
|
||||
llxHeader("",$title);
|
||||
|
||||
// Show tabs
|
||||
$head = societe_prepare_head($soc);
|
||||
|
||||
@ -1000,7 +1000,7 @@ class Categorie extends CommonObject
|
||||
/**
|
||||
* Check if no category with same label already exists for this cat's parent or root and for this cat's type
|
||||
*
|
||||
* @return boolean 1 if already exist, 0 otherwise, -1 if error
|
||||
* @return integer 1 if already exist, 0 otherwise, -1 if error
|
||||
*/
|
||||
function already_exists()
|
||||
{
|
||||
@ -1265,7 +1265,7 @@ class Categorie extends CommonObject
|
||||
/**
|
||||
* Return name and link of category (with picto)
|
||||
*
|
||||
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param string $option Sur quoi pointe le lien ('', 'xyz')
|
||||
* @param int $maxlength Max length of text
|
||||
* @return string Chaine avec URL
|
||||
@ -1277,15 +1277,15 @@ class Categorie extends CommonObject
|
||||
$result='';
|
||||
$label=$langs->trans("ShowCategory").': '. ($this->ref?$this->ref:$this->label);
|
||||
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$lienfin='</a>';
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
$picto='category';
|
||||
|
||||
|
||||
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
||||
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$lien.dol_trunc(($this->ref?$this->ref:$this->label),$maxlength).$lienfin;
|
||||
if ($withpicto != 2) $result.=$link.dol_trunc(($this->ref?$this->ref:$this->label),$maxlength).$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -1295,11 +1295,9 @@ class Categorie extends CommonObject
|
||||
*
|
||||
* @param string $sdir Repertoire destination finale
|
||||
* @param string $file Nom du fichier uploade
|
||||
* @param int $maxWidth Largeur maximum que dois faire la miniature (160 par defaut)
|
||||
* @param int $maxHeight Hauteur maximum que dois faire la miniature (120 par defaut)
|
||||
* @return void
|
||||
*/
|
||||
function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120)
|
||||
function add_photo($sdir, $file)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
@ -1321,30 +1319,11 @@ class Categorie extends CommonObject
|
||||
if (file_exists($originImage))
|
||||
{
|
||||
// Cree fichier en taille vignette
|
||||
$this->add_thumb($originImage,$maxWidth,$maxHeight);
|
||||
$this->add_thumb($originImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build thumb
|
||||
*
|
||||
* @param string $file Chemin du fichier d'origine
|
||||
* @param int $maxWidth Largeur maximum que dois faire la miniature (160 par defaut)
|
||||
* @param int $maxHeight Hauteur maximum que dois faire la miniature (120 par defaut)
|
||||
* @return void
|
||||
*/
|
||||
function add_thumb($file, $maxWidth = 160, $maxHeight = 120)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php';
|
||||
|
||||
if (file_exists($file))
|
||||
{
|
||||
vignette($file,$maxWidth,$maxHeight);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return tableau de toutes les photos de la categorie
|
||||
*
|
||||
|
||||
@ -957,7 +957,7 @@ class ActionComm extends CommonObject
|
||||
* Return URL of event
|
||||
* Use $this->id, $this->type_code, $this->label and $this->type_label
|
||||
*
|
||||
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param int $maxlength Nombre de caracteres max dans libelle
|
||||
* @param string $classname Force style class on a link
|
||||
* @param string $option ''=Link to action,'birthday'=Link to contact
|
||||
@ -974,9 +974,9 @@ class ActionComm extends CommonObject
|
||||
$label = $this->label;
|
||||
if (empty($label)) $label=$this->libelle; // For backward compatibility
|
||||
$linkclose = '" title="'.dol_escape_htmltag($tooltip, 1).'" class="classfortooltip">';
|
||||
if ($option=='birthday') $lien = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/contact/perso.php?id='.$this->id.$linkclose;
|
||||
else $lien = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id.$linkclose;
|
||||
$lienfin='</a>';
|
||||
if ($option=='birthday') $link = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/contact/perso.php?id='.$this->id.$linkclose;
|
||||
else $link = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id.$linkclose;
|
||||
$linkend='</a>';
|
||||
//print 'rrr'.$this->libelle.'-'.$withpicto;
|
||||
|
||||
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).')':'');
|
||||
}
|
||||
$result.=$lien.img_object($langs->trans("ShowAction").': '.$libelle, ($overwritepicto?$overwritepicto:'action'), 'class="classfortooltip"').$lienfin;
|
||||
$result.=$link.img_object($langs->trans("ShowAction").': '.$libelle, ($overwritepicto?$overwritepicto:'action'), 'class="classfortooltip"').$linkend;
|
||||
}
|
||||
if ($withpicto==1) $result.=' ';
|
||||
$result.=$lien.$libelleshort.$lienfin;
|
||||
$result.=$link.$libelleshort.$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -347,7 +348,6 @@ if (! empty($conf->use_javascript_ajax))
|
||||
$s='';
|
||||
$s.='<script type="text/javascript">' . "\n";
|
||||
$s.='jQuery(document).ready(function () {' . "\n";
|
||||
$s.='jQuery("#check_mytasks").click(function() { jQuery(".family_mytasks").toggle(); jQuery(".family_other").toggle(); });' . "\n";
|
||||
$s.='jQuery("#check_birthday").click(function() { jQuery(".family_birthday").toggle(); });' . "\n";
|
||||
$s.='jQuery(".family_birthday").toggle();' . "\n";
|
||||
if ($action=="show_week" || $action=="show_month" || empty($action))
|
||||
@ -361,19 +361,20 @@ if (! empty($conf->use_javascript_ajax))
|
||||
$s.='<div class="nowrap clear float"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked="true" disabled="disabled"> ' . $langs->trans("LocalAgenda").' </div>';
|
||||
if (is_array($showextcals) && count($showextcals) > 0)
|
||||
{
|
||||
$s.='<script type="text/javascript">' . "\n";
|
||||
$s.='jQuery(document).ready(function () {
|
||||
jQuery("table input[name^=\"check_ext\"]").click(function() {
|
||||
var name = $(this).attr("name");
|
||||
|
||||
jQuery(".family_ext" + name.replace("check_ext", "")).toggle();
|
||||
});
|
||||
});' . "\n";
|
||||
$s.='</script>' . "\n";
|
||||
|
||||
foreach ($showextcals as $val)
|
||||
{
|
||||
$htmlname = dol_string_nospecial($val['name']);
|
||||
$htmlname = dol_string_nospecial($htmlname,'_',array("\.","#"));
|
||||
$s.='<script type="text/javascript">' . "\n";
|
||||
$s.='jQuery(document).ready(function () {' . "\n";
|
||||
$s.=' jQuery("#check_' . $htmlname . '").click(function() {';
|
||||
$s.=' /* alert("'.$htmlname.'"); */';
|
||||
$s.=' jQuery(".family_' . $htmlname . '").toggle();';
|
||||
$s.=' });' . "\n";
|
||||
$s.='});' . "\n";
|
||||
$s.='</script>' . "\n";
|
||||
$s.='<div class="nowrap float"><input type="checkbox" id="check_' . $htmlname . '" name="check_' . $htmlname . '" checked="true"> ' . $val ['name'] . ' </div>';
|
||||
$htmlname = md5($val['name']);
|
||||
$s.='<div class="nowrap float"><input type="checkbox" id="check_ext' . $htmlname . '" name="check_ext' . $htmlname . '" checked="true"> ' . $val['name'] . ' </div>';
|
||||
}
|
||||
}
|
||||
$s.='<div class="nowrap float"><input type="checkbox" id="check_birthday" name="check_birthday"> '.$langs->trans("AgendaShowBirthdayEvents").' </div>';
|
||||
@ -1174,7 +1175,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
$numicals[dol_string_nospecial($event->icalname)]++;
|
||||
}
|
||||
$color=$event->icalcolor;
|
||||
$cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unmovable');
|
||||
$cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other unmovable');
|
||||
}
|
||||
else if ($event->type_code == 'BIRTHDAY')
|
||||
{
|
||||
|
||||
@ -305,16 +305,16 @@ if ($conf->use_javascript_ajax)
|
||||
{
|
||||
foreach ($showextcals as $val)
|
||||
{
|
||||
$htmlname = dol_string_nospecial($val['name']);
|
||||
$htmlname = md5($val['name']);
|
||||
$s.='<script type="text/javascript">' . "\n";
|
||||
$s.='jQuery(document).ready(function () {' . "\n";
|
||||
$s.=' jQuery("#check_' . $htmlname . '").click(function() {';
|
||||
$s.=' jQuery("#check_ext' . $htmlname . '").click(function() {';
|
||||
$s.=' /* alert("'.$htmlname.'"); */';
|
||||
$s.=' jQuery(".family_' . $htmlname . '").toggle();';
|
||||
$s.=' jQuery(".family_ext' . $htmlname . '").toggle();';
|
||||
$s.=' });' . "\n";
|
||||
$s.='});' . "\n";
|
||||
$s.='</script>' . "\n";
|
||||
$s.='<div class="nowrap float"><input type="checkbox" id="check_' . $htmlname . '" name="check_' . $htmlname . '" checked="true"> ' . $val ['name'] . ' </div>';
|
||||
$s.='<div class="nowrap float"><input type="checkbox" id="check_ext' . $htmlname . '" name="check_ext' . $htmlname . '" checked="true"> ' . $val ['name'] . ' </div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -614,7 +614,7 @@ else
|
||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON u.rowid = ug.fk_user";
|
||||
$sql.= " WHERE u.entity IN (".getEntity('user',1).")";
|
||||
if ($usergroup > 0) $sql.= " AND ug.fk_usergroup = ".$usergroup;
|
||||
if (GETPOST("usertodo","int",3) > 0) $sql.=" AND u.rowid = ".GETPOST("usertodo","int",3);
|
||||
//if (GETPOST("usertodo","int",3) > 0) $sql.=" AND u.rowid = ".GETPOST("usertodo","int",3);
|
||||
//print $sql;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
@ -869,7 +869,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
||||
}
|
||||
|
||||
$color=$event->icalcolor;
|
||||
$cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unsortable');
|
||||
$cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other unsortable');
|
||||
}
|
||||
else if ($event->type_code == 'BIRTHDAY')
|
||||
{
|
||||
|
||||
151
htdocs/comm/admin/askpricesupplier_extrafields.php
Normal file
151
htdocs/comm/admin/askpricesupplier_extrafields.php
Normal file
@ -0,0 +1,151 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.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/>.
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("admin");
|
||||
$langs->load('askpricesupplier');
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$form = new Form($db);
|
||||
|
||||
// List of supported format
|
||||
$tmptype2label=ExtraFields::$type2label;
|
||||
$type2label=array('');
|
||||
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$attrname=GETPOST('attrname', 'alpha');
|
||||
$elementtype='askpricesupplier'; //Must be the $table_element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$textobject=$langs->transnoentitiesnoconv("CommRequests");
|
||||
|
||||
|
||||
llxHeader('',$langs->trans("AskPriceSupplierSetup"));
|
||||
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("AskPriceSupplierSetup"),$linkback,'setup');
|
||||
|
||||
|
||||
$head = askpricesupplier_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'attributes', $langs->trans("CommRequests"), 0, 'askpricesupplier');
|
||||
|
||||
|
||||
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
|
||||
print '<br>';
|
||||
|
||||
// Load attribute_label
|
||||
$extrafields->fetch_name_optionals_label($elementtype);
|
||||
|
||||
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="center">'.$langs->trans("Position").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
print '<td>'.$langs->trans("AttributeCode").'</td>';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Size").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Unique").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Required").'</td>';
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
foreach($extrafields->attribute_type as $key => $value)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<td>".$extrafields->attribute_pos[$key]."</td>\n";
|
||||
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
|
||||
print "<td>".$key."</td>\n";
|
||||
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
|
||||
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
|
||||
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
|
||||
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
|
||||
print " <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
|
||||
print "</tr>";
|
||||
// $i++;
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
// Buttons
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=create">'.$langs->trans("NewAttribute").'</a></div>';
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Creation d'un champ optionnel
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Edition d'un champ optionnel */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'edit' && ! empty($attrname))
|
||||
{
|
||||
print "<br>";
|
||||
print_titre($langs->trans("FieldEdition", $attrname));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
153
htdocs/comm/admin/askpricesupplierdet_extrafields.php
Normal file
153
htdocs/comm/admin/askpricesupplierdet_extrafields.php
Normal file
@ -0,0 +1,153 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.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/>.
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("other");
|
||||
$langs->load("askpricesupplier");
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$form = new Form($db);
|
||||
|
||||
// List of supported format
|
||||
$tmptype2label=ExtraFields::$type2label;
|
||||
$type2label=array('');
|
||||
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$attrname=GETPOST('attrname', 'alpha');
|
||||
|
||||
$elementtype='askpricesupplierdet'; //Must be the $table_element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$textobject=$langs->transnoentitiesnoconv("CommRequests");
|
||||
|
||||
llxHeader('',$langs->trans("AskPriceSupplierSetup"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("AskPriceSupplierSetup"),$linkback,'setup');
|
||||
|
||||
$head = askpricesupplier_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'attributeslines', $langs->trans("CommRequests"), 0, 'askpricesupplier');
|
||||
|
||||
|
||||
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
|
||||
print '<br>';
|
||||
|
||||
// Load attribute_label
|
||||
$extrafields->fetch_name_optionals_label($elementtype);
|
||||
|
||||
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
print '<td>'.$langs->trans("AttributeCode").'</td>';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Size").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Unique").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Required").'</td>';
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
foreach($extrafields->attribute_type as $key => $value)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
|
||||
print "<td>".$key."</td>\n";
|
||||
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
|
||||
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
|
||||
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
|
||||
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
|
||||
print " <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
// Buttons
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Creation d'un champ optionnel */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Edition d'un champ optionnel */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'edit' && ! empty($attrname))
|
||||
{
|
||||
print "<br>";
|
||||
print_titre($langs->trans("FieldEdition", $attrname));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
1821
htdocs/comm/askpricesupplier/card.php
Normal file
1821
htdocs/comm/askpricesupplier/card.php
Normal file
File diff suppressed because it is too large
Load Diff
2872
htdocs/comm/askpricesupplier/class/askpricesupplier.class.php
Normal file
2872
htdocs/comm/askpricesupplier/class/askpricesupplier.class.php
Normal file
File diff suppressed because it is too large
Load Diff
127
htdocs/comm/askpricesupplier/document.php
Normal file
127
htdocs/comm/askpricesupplier/document.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.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/comm/propal/document.php
|
||||
* \ingroup propal
|
||||
* \brief Management page of documents attached to a business proposal
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/askpricesupplier/class/askpricesupplier.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
$langs->load('compta');
|
||||
$langs->load('other');
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$confirm = GETPOST('confirm','alpha');
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref','alpha');
|
||||
|
||||
// Security check
|
||||
$socid='';
|
||||
if (! empty($user->societe_id))
|
||||
{
|
||||
$action='';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
$result = restrictedArea($user, 'askpricesupplier', $id);
|
||||
|
||||
// Get parameters
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="name";
|
||||
|
||||
$object = new AskPriceSupplier($db);
|
||||
$object->fetch($id,$ref);
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
$upload_dir = $conf->askpricesupplier->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans('CommRequest'),'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur');
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$upload_dir = $conf->askpricesupplier->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
|
||||
$head = askpricesupplier_prepare_head($object);
|
||||
dol_fiche_head($head, 'document', $langs->trans('CommRequest'), 0, 'askpricesupplier');
|
||||
|
||||
// Construit liste des fichiers
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
$totalsize=0;
|
||||
foreach($filearray as $key => $file)
|
||||
{
|
||||
$totalsize+=$file['size'];
|
||||
}
|
||||
|
||||
print '<table class="border"width="100%">';
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/comm/askpricesupplier/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
|
||||
print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','');
|
||||
print '</td></tr>';
|
||||
|
||||
// Supplier
|
||||
print "<tr><td>".$langs->trans("Supplier")."</td>";
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
$modulepart = 'askpricesupplier';
|
||||
$permission = $user->rights->askpricesupplier->creer;
|
||||
$param = '&id=' . $object->id;
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("ErrorUnknown");
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
377
htdocs/comm/askpricesupplier/index.php
Normal file
377
htdocs/comm/askpricesupplier/index.php
Normal file
@ -0,0 +1,377 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2004 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>
|
||||
*
|
||||
* 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/comm/propal/index.php
|
||||
* \ingroup propal
|
||||
* \brief Home page of proposal area
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT .'/comm/askpricesupplier/class/askpricesupplier.class.php';
|
||||
|
||||
$langs->load("askpricesupplier");
|
||||
$langs->load("companies");
|
||||
|
||||
// Security check
|
||||
$socid=GETPOST('socid','int');
|
||||
if (isset($user->societe_id) && $user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
$result = restrictedArea($user, 'askpricesupplier');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
$now=dol_now();
|
||||
$askpricesupplierstatic=new AskPriceSupplier($db);
|
||||
$companystatic=new Societe($db);
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$help_url="EN:Module_Ask_Price_Supplier|FR:Module_Demande_de_prix_fournisseur";
|
||||
|
||||
llxHeader("",$langs->trans("AskPriceSupplierArea"),$help_url);
|
||||
|
||||
print_fiche_titre($langs->trans("AskPriceSupplierArea"));
|
||||
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
|
||||
/*
|
||||
* Search form
|
||||
*/
|
||||
$var=false;
|
||||
print '<table class="noborder nohover" width="100%">';
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/askpricesupplier/list.php">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchRequest").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("Ref").':</td><td><input type="text" class="flat" name="sref" size=18></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||
print '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Other").':</td><td><input type="text" class="flat" name="sall" size="18"></td>';
|
||||
print '</tr>';
|
||||
print "</form></table><br>\n";
|
||||
|
||||
|
||||
/*
|
||||
* Statistics
|
||||
*/
|
||||
|
||||
$sql = "SELECT count(p.rowid), p.fk_statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."askpricesupplier as p";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE p.fk_soc = s.rowid";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
if ($user->societe_id) $sql.=' AND p.fk_soc = '.$user->societe_id;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
$sql.= " AND p.fk_statut IN (0,1,2,3,4)";
|
||||
$sql.= " GROUP BY p.fk_statut";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$total=0;
|
||||
$totalinprocess=0;
|
||||
$dataseries=array();
|
||||
$vals=array();
|
||||
// -1=Canceled, 0=Draft, 1=Validated, (2=Accepted/On process not managed for customer orders), 3=Closed (Sent/Received, billed or not)
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
if ($row)
|
||||
{
|
||||
//if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1))
|
||||
{
|
||||
$vals[$row[1]]=$row[0];
|
||||
$totalinprocess+=$row[0];
|
||||
}
|
||||
$total+=$row[0];
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("CommRequests").'</td></tr>'."\n";
|
||||
$var=true;
|
||||
$listofstatus=array(0,1,2,3,4);
|
||||
foreach ($listofstatus as $status)
|
||||
{
|
||||
$dataseries[]=array('label'=>$askpricesupplierstatic->LibStatut($status,1),'data'=>(isset($vals[$status])?(int) $vals[$status]:0));
|
||||
if (! $conf->use_javascript_ajax)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>'.$askpricesupplierstatic->LibStatut($status,0).'</td>';
|
||||
print '<td align="right"><a href="list.php?statut='.$status.'">'.(isset($vals[$status])?$vals[$status]:0).'</a></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print '<tr><td align="center" colspan="2">';
|
||||
$data=array('series'=>$dataseries);
|
||||
dol_print_graph('stats',300,180,$data,1,'pie',1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">'.$total.'</td></tr>';
|
||||
print "</table><br>";
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Draft askprice
|
||||
*/
|
||||
if (! empty($conf->askpricesupplier->enabled))
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.ref, s.nom as socname, s.rowid as socid, s.canvas, s.client";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."askpricesupplier as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.fk_soc = s.rowid";
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
$sql.= " AND c.fk_statut = 0";
|
||||
if ($socid) $sql.= " AND c.fk_soc = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("DraftRequests").'</td></tr>';
|
||||
$langs->load("askpricesupplier");
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
$var = True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
$obj = $db->fetch_object($resql);
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
$askpricesupplierstatic->id=$obj->rowid;
|
||||
$askpricesupplierstatic->ref=$obj->ref;
|
||||
print '<td class="nowrap">'.$askpricesupplierstatic->getNomUrl(1).'</td>';
|
||||
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->socname;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
print '<td>'.$companystatic->getNomUrl(1,'customer',24).'</td>';
|
||||
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
$max=5;
|
||||
|
||||
/*
|
||||
* Last modified askprice
|
||||
*/
|
||||
|
||||
$sql = "SELECT c.rowid, c.ref, c.fk_statut, s.nom as socname, s.rowid as socid, s.canvas, s.client,";
|
||||
$sql.= " date_cloture as datec";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."askpricesupplier as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.fk_soc = s.rowid";
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
//$sql.= " AND c.fk_statut > 2";
|
||||
if ($socid) $sql .= " AND c.fk_soc = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
$sql.= " ORDER BY c.tms DESC";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4">'.$langs->trans("LastModifiedRequests",$max).'</td></tr>';
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
$var = True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="20%" class="nowrap">';
|
||||
|
||||
$askpricesupplierstatic->id=$obj->rowid;
|
||||
$askpricesupplierstatic->ref=$obj->ref;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td width="96" class="nobordernopadding nowrap">';
|
||||
print $askpricesupplierstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td width="16" class="nobordernopadding nowrap">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
|
||||
print '<td width="16" align="right" class="nobordernopadding">';
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->askpricesupplier->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
print $formfile->getDocumentsLink($askpricesupplierstatic->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td>';
|
||||
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->socname;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
print '<td>'.$companystatic->getNomUrl(1,'customer').'</td>';
|
||||
|
||||
print '<td>'.dol_print_date($db->jdate($obj->datec),'day').'</td>';
|
||||
print '<td align="right">'.$askpricesupplierstatic->LibStatut($obj->fk_statut,5).'</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
else dol_print_error($db);
|
||||
|
||||
|
||||
/*
|
||||
* Opened askprice
|
||||
*/
|
||||
if (! empty($conf->askpricesupplier->enabled) && $user->rights->askpricesupplier->lire)
|
||||
{
|
||||
$langs->load("askpricesupplier");
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, p.rowid as askpricesupplierid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datec as dp";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."askpricesupplier as p";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE p.fk_soc = s.rowid";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
$sql.= " AND p.fk_statut = 1";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
$sql.= " ORDER BY p.rowid DESC";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$total = 0;
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
if ($num > 0)
|
||||
{
|
||||
$var=true;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="5">'.$langs->trans("RequestsOpened").' <a href="'.DOL_URL_ROOT.'/comm/askpricesupplier/list.php?viewstatut=1"><span class="badge">'.$num.'</span></a></td></tr>';
|
||||
|
||||
$nbofloop=min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD)?500:$conf->global->MAIN_MAXLIST_OVERLOAD));
|
||||
while ($i < $nbofloop)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
// Ref
|
||||
print '<td class="nowrap" width="140">';
|
||||
|
||||
$askpricesupplierstatic->id=$obj->askpricesupplierid;
|
||||
$askpricesupplierstatic->ref=$obj->ref;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
print $askpricesupplierstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td width="18" class="nobordernopadding nowrap">';
|
||||
if ($db->jdate($obj->dfv) < ($now - $conf->askpricesupplier->cloture->warning_delay)) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td width="16" align="center" class="nobordernopadding">';
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->askpricesupplier->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->askpricesupplierid;
|
||||
print $formfile->getDocumentsLink($askpricesupplierstatic->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print "</td>";
|
||||
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->socname;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
print '<td align="left">'.$companystatic->getNomUrl(1,'customer',44).'</td>'."\n";
|
||||
|
||||
print '<td align="right">';
|
||||
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td align="center" width="14">'.$askpricesupplierstatic->LibStatut($obj->fk_statut,3).'</td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
$i++;
|
||||
$total += $obj->total_ttc;
|
||||
}
|
||||
if ($num > $nbofloop)
|
||||
{
|
||||
print '<tr class="liste_total"><td colspan="5">'.$langs->trans("XMoreLines", ($num - $nbofloop))."</td></tr>";
|
||||
}
|
||||
else if ($total>0)
|
||||
{
|
||||
print '<tr class="liste_total"><td colspan="3">'.$langs->trans("Total")."</td><td align=\"right\">".price($total)."</td><td> </td></tr>";
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
print '</div></div></div>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
65
htdocs/comm/askpricesupplier/info.php
Normal file
65
htdocs/comm/askpricesupplier/info.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* 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/comm/propal/info.php
|
||||
* \ingroup propal
|
||||
* \brief Page d'affichage des infos d'une proposition commerciale
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/askpricesupplier/class/askpricesupplier.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php';
|
||||
|
||||
$langs->load('askpricesupplier');
|
||||
$langs->load('compta');
|
||||
|
||||
$id=GETPOST('id','int');
|
||||
$socid=GETPOST('socid','int');
|
||||
|
||||
// Security check
|
||||
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'askpricesupplier', $id);
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans('CommRequest'),'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur');
|
||||
|
||||
$object = new AskPriceSupplier($db);
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$head = askpricesupplier_prepare_head($object);
|
||||
dol_fiche_head($head, 'info', $langs->trans('CommRequest'), 0, 'askpricesupplier');
|
||||
|
||||
$object->info($object->id);
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
dol_print_object_info($object);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
425
htdocs/comm/askpricesupplier/list.php
Normal file
425
htdocs/comm/askpricesupplier/list.php
Normal file
@ -0,0 +1,425 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.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/comm/propal/list.php
|
||||
* \ingroup propal
|
||||
* \brief Page of commercial proposals card and list
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaskpricesupplier.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/askpricesupplier/class/askpricesupplier.class.php';
|
||||
if (! empty($conf->projet->enabled))
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
$langs->load('companies');
|
||||
$langs->load('askpricesupplier');
|
||||
$langs->load('compta');
|
||||
$langs->load('bills');
|
||||
$langs->load('orders');
|
||||
$langs->load('products');
|
||||
|
||||
$socid=GETPOST('socid','int');
|
||||
|
||||
$search_user=GETPOST('search_user','int');
|
||||
$search_sale=GETPOST('search_sale','int');
|
||||
$search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha');
|
||||
$search_societe=GETPOST('search_societe','alpha');
|
||||
$search_montant_ht=GETPOST('search_montant_ht','alpha');
|
||||
$search_author=GETPOST('search_author','alpha');
|
||||
$viewstatut=$db->escape(GETPOST('viewstatut'));
|
||||
$object_statut=$db->escape(GETPOST('askpricesupplier_statut'));
|
||||
|
||||
$sall=GETPOST("sall");
|
||||
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
|
||||
$year=GETPOST("year");
|
||||
$month=GETPOST("month");
|
||||
|
||||
// Nombre de ligne pour choix de produit/service predefinis
|
||||
$NBLINES=4;
|
||||
|
||||
// Security check
|
||||
$module='askpricesupplier';
|
||||
$dbtable='';
|
||||
$objectid='';
|
||||
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
||||
if (! empty($socid))
|
||||
{
|
||||
$objectid=$socid;
|
||||
$module='societe';
|
||||
$dbtable='&societe';
|
||||
}
|
||||
$result = restrictedArea($user, $module, $objectid, $dbtable);
|
||||
|
||||
if (GETPOST("button_removefilter") || GETPOST("button_removefilter_x")) // Both tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_categ='';
|
||||
$search_user='';
|
||||
$search_sale='';
|
||||
$search_ref='';
|
||||
$search_societe='';
|
||||
$search_montant_ht='';
|
||||
$search_author='';
|
||||
$year='';
|
||||
$month='';
|
||||
$viewstatut='';
|
||||
$object_statut='';
|
||||
}
|
||||
|
||||
if($object_statut != '')
|
||||
$viewstatut=$object_statut;
|
||||
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('askpricesupplierlist'));
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
$parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans('CommRequest'),'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur');
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
$formaskpricesupplier = new FormAskPriceSupplier($db);
|
||||
$companystatic=new Societe($db);
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
if (! $sortfield) $sortfield='p.date_livraison';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
$limit = $conf->liste_limit;
|
||||
|
||||
|
||||
$sql = 'SELECT s.rowid, s.nom as name, s.town, s.client, s.code_client,';
|
||||
$sql.= ' p.rowid as askpricesupplierid, p.note_private, p.total_ht, p.ref, p.fk_statut, p.fk_user_author, p.date_livraison as dp,';
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,";
|
||||
$sql.= ' u.login';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'askpricesupplier as p';
|
||||
if ($sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'askpricesupplierdet as pd ON p.rowid=pd.fk_askpricesupplier';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid';
|
||||
// We'll need this table joined to the select in order to filter by sale
|
||||
if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if ($search_user > 0)
|
||||
{
|
||||
$sql.=", ".MAIN_DB_PREFIX."element_contact as c";
|
||||
$sql.=", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||
}
|
||||
$sql.= ' WHERE p.fk_soc = s.rowid';
|
||||
$sql.= ' AND p.entity = '.$conf->entity;
|
||||
if (! $user->rights->societe->client->voir && ! $socid) //restriction
|
||||
{
|
||||
$sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
}
|
||||
if ($search_ref) {
|
||||
$sql .= natural_search('p.ref', $search_ref);
|
||||
}
|
||||
if ($search_societe) {
|
||||
$sql .= natural_search('s.nom', $search_societe);
|
||||
}
|
||||
if ($search_author)
|
||||
{
|
||||
$sql.= " AND u.login LIKE '%".$db->escape(trim($search_author))."%'";
|
||||
}
|
||||
if ($search_montant_ht)
|
||||
{
|
||||
$sql.= " AND p.total_ht='".$db->escape(price2num(trim($search_montant_ht)))."'";
|
||||
}
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array('s.nom', 'p.note_private', 'p.note_public', 'pd.description'), $sall);
|
||||
}
|
||||
if ($socid) $sql.= ' AND s.rowid = '.$socid;
|
||||
if ($viewstatut <> '')
|
||||
{
|
||||
$sql.= ' AND p.fk_statut IN ('.$viewstatut.')';
|
||||
}
|
||||
if ($month > 0)
|
||||
{
|
||||
if ($year > 0 && empty($day))
|
||||
$sql.= " AND p.date_livraison BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
|
||||
else if ($year > 0 && ! empty($day))
|
||||
$sql.= " AND p.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'";
|
||||
else
|
||||
$sql.= " AND date_format(p.date_livraison, '%m') = '".$month."'";
|
||||
}
|
||||
else if ($year > 0)
|
||||
{
|
||||
$sql.= " AND p.date_livraison BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
}
|
||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
|
||||
if ($search_user > 0)
|
||||
{
|
||||
$sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='askpricesupplier' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$search_user;
|
||||
}
|
||||
|
||||
|
||||
$sql.= ' ORDER BY '.$sortfield.' '.$sortorder.', p.ref DESC';
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
|
||||
$sql.= $db->plimit($limit + 1,$offset);
|
||||
$result=$db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$objectstatic=new AskPriceSupplier($db);
|
||||
$userstatic=new User($db);
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
if ($socid)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
}
|
||||
|
||||
$param='&socid='.$socid.'&viewstatut='.$viewstatut;
|
||||
if ($month) $param.='&month='.$month;
|
||||
if ($year) $param.='&year='.$year;
|
||||
if ($search_ref) $param.='&search_ref=' .$search_ref;
|
||||
if ($search_societe) $param.='&search_societe=' .$search_societe;
|
||||
if ($search_user > 0) $param.='&search_user='.$search_user;
|
||||
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
|
||||
if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht;
|
||||
if ($search_author) $param.='&search_author='.$search_author;
|
||||
print_barre_liste($langs->trans('ListOfAskPriceSupplier').' '.($socid?'- '.$soc->name:''), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
||||
$i = 0;
|
||||
print '<table class="liste" width="100%">';
|
||||
|
||||
$moreforfilter='';
|
||||
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->societe->client->voir || $socid)
|
||||
{
|
||||
$langs->load("commercial");
|
||||
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
|
||||
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
|
||||
$moreforfilter.=' ';
|
||||
}
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->societe->client->voir || $socid)
|
||||
{
|
||||
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
|
||||
$moreforfilter.=$form->select_dolusers($search_user,'search_user',1);
|
||||
}
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" colspan="10">';
|
||||
print $moreforfilter;
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('AskPriceSupplierDate'),$_SERVER["PHP_SELF"],'p.date_livraison','',$param, 'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="12" name="search_societe" value="'.$search_societe.'">';
|
||||
print '</td>';
|
||||
|
||||
// Date
|
||||
print '<td class="liste_titre" colspan="1" align="center">';
|
||||
//print $langs->trans('Month').': ';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||
//print ' '.$langs->trans('Year').': ';
|
||||
$syear = $year;
|
||||
$formother->select_year($syear,'year',1, 20, 5);
|
||||
print '</td>';
|
||||
|
||||
// Amount
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="10" name="search_montant_ht" value="'.$search_montant_ht.'">';
|
||||
print '</td>';
|
||||
// Author
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input class="flat" size="10" type="text" name="search_author" value="'.$search_author.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$formaskpricesupplier->selectAskPriceSupplierStatus($viewstatut,1);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" name="button_search" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" name="button_removefilter" class="liste_titre" src="'.img_picto($langs->trans("RemoveFilter"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$var=true;
|
||||
$total=0;
|
||||
$subtotal=0;
|
||||
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$now = dol_now();
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td class="nowrap">';
|
||||
|
||||
$objectstatic->id=$objp->askpricesupplierid;
|
||||
$objectstatic->ref=$objp->ref;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
print $objectstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
|
||||
if ($objp->fk_statut == 1 && $db->jdate($objp->dfv) < ($now - $conf->askpricesupplier->cloture->warning_delay)) print img_warning($langs->trans("Late"));
|
||||
if (! empty($objp->note_private))
|
||||
{
|
||||
print ' <span class="note">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/askpricesupplier/note.php?id='.$objp->askpricesupplierid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';
|
||||
print '</span>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Ref
|
||||
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
|
||||
$filename=dol_sanitizeFileName($objp->ref);
|
||||
$filedir=$conf->askpricesupplier->dir_output . '/' . dol_sanitizeFileName($objp->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->askpricesupplierid;
|
||||
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print "</td>\n";
|
||||
|
||||
$url = DOL_URL_ROOT.'/comm/card.php?socid='.$objp->rowid;
|
||||
|
||||
// Company
|
||||
$companystatic->id=$objp->rowid;
|
||||
$companystatic->name=$objp->name;
|
||||
$companystatic->client=$objp->client;
|
||||
$companystatic->code_client=$objp->code_client;
|
||||
print '<td>';
|
||||
print $companystatic->getNomUrl(1,'customer');
|
||||
print '</td>';
|
||||
|
||||
// Date askprice
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->dp), 'day');
|
||||
print "</td>\n";
|
||||
|
||||
print '<td align="right">'.price($objp->total_ht)."</td>\n";
|
||||
|
||||
$userstatic->id=$objp->fk_user_author;
|
||||
$userstatic->login=$objp->login;
|
||||
print '<td align="center">';
|
||||
if ($userstatic->id) print $userstatic->getLoginUrl(1);
|
||||
else print ' ';
|
||||
print "</td>\n";
|
||||
|
||||
print '<td align="right">'.$objectstatic->LibStatut($objp->fk_statut,5)."</td>\n";
|
||||
|
||||
print '<td> </td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$total += $objp->total_ht;
|
||||
$subtotal += $objp->total_ht;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($total>0)
|
||||
{
|
||||
if($num<$limit){
|
||||
$var=!$var;
|
||||
print '<tr class="liste_total"><td align="left">'.$langs->trans("TotalHT").'</td>';
|
||||
print '<td colspan="3" align="right">'.price($total).'</td><td colspan="3"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr class="liste_total"><td align="left">'.$langs->trans("TotalHTforthispage").'</td>';
|
||||
print '<td colspan="3" align="right">'.price($total).'</td><td colspan="3"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
113
htdocs/comm/askpricesupplier/note.php
Normal file
113
htdocs/comm/askpricesupplier/note.php
Normal file
@ -0,0 +1,113 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* 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/comm/propal/note.php
|
||||
* \ingroup propal
|
||||
* \brief Fiche d'information sur une proposition commerciale
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/askpricesupplier/class/askpricesupplier.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php';
|
||||
|
||||
$langs->load('askpricesupplier');
|
||||
$langs->load('compta');
|
||||
$langs->load('bills');
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
$ref=GETPOST('ref','alpha');
|
||||
$action=GETPOST('action','alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'askpricesupplier', $id, 'askpricesupplier');
|
||||
|
||||
$object = new AskPriceSupplier($db);
|
||||
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* Actions */
|
||||
/******************************************************************************/
|
||||
|
||||
$permissionnote=$user->rights->askpricesupplier->creer; // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* Affichage fiche */
|
||||
/******************************************************************************/
|
||||
|
||||
llxHeader('',$langs->trans('CommRequest'),'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur');
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
if ($mesg) print $mesg;
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
if ($object->fetch($id, $ref))
|
||||
{
|
||||
$societe = new Societe($db);
|
||||
if ( $societe->fetch($object->socid) )
|
||||
{
|
||||
$head = askpricesupplier_prepare_head($object);
|
||||
dol_fiche_head($head, 'note', $langs->trans('CommRequest'), 0, 'askpricesupplier');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/askpricesupplier/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans('BackToList').'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
|
||||
print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','');
|
||||
print '</td></tr>';
|
||||
|
||||
// Customer
|
||||
if ( is_null($object->client) )
|
||||
$object->fetch_thirdparty();
|
||||
print "<tr><td>".$langs->trans("Supplier")."</td>";
|
||||
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('AskPriceSupplierDate').'</td><td colspan="3">';
|
||||
print dol_print_date($object->date_livraison,'daytext');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<br>';
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
0
htdocs/comm/askpricesupplier/tpl/index.html
Normal file
0
htdocs/comm/askpricesupplier/tpl/index.html
Normal file
74
htdocs/comm/askpricesupplier/tpl/linkedobjectblock.tpl.php
Normal file
74
htdocs/comm/askpricesupplier/tpl/linkedobjectblock.tpl.php
Normal file
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
|
||||
<?php
|
||||
|
||||
global $user;
|
||||
|
||||
$langs = $GLOBALS['langs'];
|
||||
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
echo '<br>';
|
||||
print_titre($langs->trans('RelatedAskPriceSupplier'));
|
||||
?>
|
||||
<table class="noborder allwidth">
|
||||
<tr class="liste_titre">
|
||||
<td><?php echo $langs->trans("Ref"); ?></td>
|
||||
<td></td>
|
||||
<td align="center"><?php echo $langs->trans("Date"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("AmountHTShort"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("Status"); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$var=true;
|
||||
$total=0;
|
||||
foreach($linkedObjectBlock as $object)
|
||||
{
|
||||
$var=!$var;
|
||||
?>
|
||||
<tr <?php echo $bc[$var]; ?> ><td>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/comm/askpricesupplier/card.php?id='.$object->id ?>"><?php echo img_object($langs->trans("ShowAskPriceSupplier"),"askpricesupplier").' '.$object->ref; ?></a></td>
|
||||
<td></td>
|
||||
<td align="center"><?php echo dol_print_date($object->datec,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->askpricesupplier->lire) {
|
||||
$total = $total + $object->total_ht;
|
||||
echo price($object->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $object->getLibStatut(3); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
<tr class="liste_total">
|
||||
<td align="left" colspan="3"><?php echo $langs->trans('TotalHT'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->askpricesupplier->lire) {
|
||||
echo price($total);
|
||||
} ?></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
@ -7,6 +7,7 @@
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -31,11 +32,13 @@
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
if (! empty($conf->expedition->enabled)) require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
||||
if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
|
||||
@ -43,6 +46,7 @@ if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichin
|
||||
$langs->load("companies");
|
||||
if (! empty($conf->contrat->enabled)) $langs->load("contracts");
|
||||
if (! empty($conf->commande->enabled)) $langs->load("orders");
|
||||
if (! empty($conf->expedition->enabled)) $langs->load("sendings");
|
||||
if (! empty($conf->facture->enabled)) $langs->load("bills");
|
||||
if (! empty($conf->projet->enabled)) $langs->load("projects");
|
||||
if (! empty($conf->ficheinter->enabled)) $langs->load("interventions");
|
||||
@ -68,10 +72,15 @@ if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="nom";
|
||||
$cancelbutton = GETPOST('cancel');
|
||||
|
||||
$object = new Client($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('commcard','globalcard'));
|
||||
|
||||
$object = new Societe($db);
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -215,7 +224,6 @@ if ($id > 0)
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td><td width="70%" colspan="3">';
|
||||
$object->next_prev_filter="te.client in (1,2,3)";
|
||||
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
|
||||
print '</td></tr>';
|
||||
|
||||
@ -400,7 +408,7 @@ if ($id > 0)
|
||||
// display amount and link to unpaid bill
|
||||
$outstandigBills = $object->get_OutstandingBill();
|
||||
if ($outstandigBills != 0)
|
||||
print " / <a href='".DOL_URL_ROOT."/compta/facture/list.php?socid=".$object->id."&search_status=1'>".price($outstandigBills).'</a>';
|
||||
print " (".$langs->trans("CurrentOutstandingBill")." <a href='".DOL_URL_ROOT."/compta/facture/list.php?socid=".$object->id."&search_status=1'>".price($outstandigBills, '', $langs, 0, 0, -1, $conf->currency).'</a>)';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -425,9 +433,9 @@ if ($id > 0)
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Level of prospect
|
||||
if ($object->client == 2 || $object->client == 3)
|
||||
{
|
||||
// Level of prospect
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('ProspectLevel');
|
||||
@ -453,7 +461,16 @@ if ($id > 0)
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Sales representative
|
||||
// Other attributes
|
||||
$parameters=array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||
{
|
||||
print $object->showOptionals($extrafields);
|
||||
}
|
||||
|
||||
// Sales representative
|
||||
include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php';
|
||||
|
||||
// Module Adherent
|
||||
@ -647,6 +664,73 @@ if ($id > 0)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Last sendings
|
||||
*/
|
||||
if (! empty($conf->expedition->enabled) && $user->rights->expedition->lire) {
|
||||
$sendingstatic = new Expedition($db);
|
||||
|
||||
$sql = 'SELECT e.rowid as id';
|
||||
$sql.= ', e.ref';
|
||||
$sql.= ', e.date_creation';
|
||||
$sql.= ', e.fk_statut as statut';
|
||||
$sql.= ', s.nom';
|
||||
$sql.= ', s.rowid as socid';
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."expedition as e";
|
||||
$sql.= " WHERE e.fk_soc = s.rowid AND s.rowid = ".$object->id;
|
||||
$sql.= " AND e.entity = ".$conf->entity;
|
||||
$sql.= ' GROUP BY e.rowid';
|
||||
$sql.= ', e.ref';
|
||||
$sql.= ', e.date_creation';
|
||||
$sql.= ', e.fk_statut';
|
||||
$sql.= ', s.nom';
|
||||
$sql.= ', s.rowid';
|
||||
$sql.= " ORDER BY e.date_creation DESC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$var = true;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num > 0) {
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$tableaushown=1;
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastSendings",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/expedition/list.php?socid='.$object->id.'">'.$langs->trans("AllSendings").' <span class="badge">'.$num.'</span></a></td>';
|
||||
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/expedition/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
while ($i < $num && $i < $MAXLIST) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var = ! $var;
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
print '<td class="nowrap">';
|
||||
$sendingstatic->id = $objp->id;
|
||||
$sendingstatic->ref = $objp->ref;
|
||||
print $sendingstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
if ($objp->date_creation > 0) {
|
||||
print '<td align="right" width="80">'.dol_print_date($db->jdate($objp->date_creation),'day').'</td>';
|
||||
} else {
|
||||
print '<td align="right"><b>!!!</b></td>';
|
||||
}
|
||||
|
||||
print '<td align="right" class="nowrap" width="100" >' . $sendingstatic->LibStatut($objp->statut, 5) . '</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
if ($num > 0)
|
||||
print "</table>";
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Last linked contracts
|
||||
*/
|
||||
|
||||
@ -103,6 +103,21 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
print "</table></form><br>\n";
|
||||
}
|
||||
|
||||
// Search supplier order
|
||||
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire)
|
||||
{
|
||||
$var=false;
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/fourn/commande/list.php">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="noborder nohover" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchASupplierOrder").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print '<label for="search_ref">'.$langs->trans("Ref").'</label>:</td><td><input type="text" class="flat" name="search_ref" id="search_ref" size=18></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||
print '<tr '.$bc[$var].'><td class="nowrap"><label for="search_all">'.$langs->trans("Other").'</label>:</td><td><input type="text" class="flat" name="search_all" id="search_all" size="18"></td>';
|
||||
print '</tr>';
|
||||
print "</table></form><br>\n";
|
||||
}
|
||||
|
||||
// Search contract
|
||||
if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
|
||||
{
|
||||
|
||||
@ -53,6 +53,7 @@ $langs->load('orders');
|
||||
$langs->load('products');
|
||||
$langs->load("deliveries");
|
||||
$langs->load('sendings');
|
||||
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
|
||||
if (! empty($conf->margin->enabled))
|
||||
$langs->load('margins');
|
||||
|
||||
@ -241,6 +242,12 @@ if (empty($reshook))
|
||||
$object->set_ref_client($user, $_POST['ref_client']);
|
||||
}
|
||||
|
||||
// Set incoterm
|
||||
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled))
|
||||
{
|
||||
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||
}
|
||||
|
||||
// Create proposal
|
||||
else if ($action == 'add' && $user->rights->propal->creer)
|
||||
{
|
||||
@ -296,6 +303,8 @@ if (empty($reshook))
|
||||
$object->author = $user->id; // deprecated
|
||||
$object->note = GETPOST('note');
|
||||
$object->statut = 0;
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
|
||||
$id = $object->create_from($user);
|
||||
} else {
|
||||
@ -319,6 +328,8 @@ if (empty($reshook))
|
||||
$object->modelpdf = GETPOST('model');
|
||||
$object->author = $user->id; // deprecated
|
||||
$object->note = GETPOST('note');
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
|
||||
$object->origin = GETPOST('origin');
|
||||
$object->origin_id = GETPOST('originid');
|
||||
@ -768,8 +779,21 @@ if (empty($reshook))
|
||||
|
||||
$desc = dol_concatdesc($desc, $product_desc);
|
||||
|
||||
// Add dimensions into product description
|
||||
/*if (empty($conf->global->MAIN_PRODUCT_DISABLE_AUTOADD_DIM))
|
||||
{
|
||||
$text='';
|
||||
if ($prod->weight) $text.=($text?"\n":"").$outputlangs->trans("Weight").': '.$prod->weight.' '.$prod->weight_units;
|
||||
if ($prod->length) $text.=($text?"\n":"").$outputlangs->trans("Length").': '.$prod->length.' '.$prod->length_units;
|
||||
if ($prod->surface) $text.=($text?"\n":"").$outputlangs->trans("Surface").': '.$prod->surface.' '.$prod->surface_units;
|
||||
if ($prod->volume) $text.=($text?"\n":"").$outputlangs->trans("Volume").': '.$prod->volume.' '.$prod->volume_units;
|
||||
|
||||
$desc = dol_concatdesc($desc, $text);
|
||||
}*/
|
||||
|
||||
// Add custom code and origin country into description
|
||||
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) {
|
||||
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code)))
|
||||
{
|
||||
$tmptxt = '(';
|
||||
if (! empty($prod->customcode))
|
||||
$tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
|
||||
@ -1393,6 +1417,16 @@ if ($action == 'create')
|
||||
print $form->selectarray('model', $liste, ($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : $conf->global->PROPALE_ADDON_PDF));
|
||||
print "</td></tr>";
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $soc->libelle_incoterms, 1).'</label></td>';
|
||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||
print $form->select_incoterms((!empty($soc->fk_incoterms) ? $soc->fk_incoterms : ''), (!empty($soc->location_incoterms)?$soc->location_incoterms:''));
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled) && $socid > 0)
|
||||
{
|
||||
@ -1637,7 +1671,7 @@ if ($action == 'create')
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
|
||||
$notify = new Notify($db);
|
||||
$text .= '<br>';
|
||||
$text .= $notify->confirmMessage('PROPAL_VALIDATE', $object->socid);
|
||||
$text .= $notify->confirmMessage('PROPAL_VALIDATE', $object->socid, $object);
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -1646,9 +1680,9 @@ if ($action == 'create')
|
||||
|
||||
if (! $formconfirm) {
|
||||
$parameters = array('lineid' => $lineid);
|
||||
$formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified
|
||||
// by
|
||||
// hook
|
||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
||||
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
|
||||
}
|
||||
|
||||
// Print form confirm
|
||||
@ -1953,14 +1987,36 @@ if ($action == 'create')
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
{
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('IncotermLabel');
|
||||
print '<td><td align="right">';
|
||||
if ($user->rights->propal->creer) print '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||
else print ' ';
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
if ($action != 'editincoterm')
|
||||
{
|
||||
print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$cols = 3;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
// Amount HT
|
||||
print '<tr><td height="10" width="25%">' . $langs->trans('AmountHT') . '</td>';
|
||||
print '<td align="right" class="nowrap"><b>' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';
|
||||
print '<td></td>';
|
||||
print '<td align="right" class="nowrap" colspan="2"><b>' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';
|
||||
|
||||
// Margin Infos
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
@ -1972,27 +2028,27 @@ if ($action == 'create')
|
||||
|
||||
// Amount VAT
|
||||
print '<tr><td height="10">' . $langs->trans('AmountVAT') . '</td>';
|
||||
print '<td align="right" class="nowrap">' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||
print '<td></td></tr>';
|
||||
print '<td align="right" class="nowrap" colspan="2">' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1
|
||||
{
|
||||
print '<tr><td height="10">' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
|
||||
print '<td align="right" class="nowrap">' . price($object->total_localtax1, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||
print '<td align="right" class="nowrap" colspan="2">' . price($object->total_localtax1, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||
print '<td></td></tr>';
|
||||
}
|
||||
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2
|
||||
{
|
||||
print '<tr><td height="10">' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
|
||||
print '<td align="right" class="nowrap">' . price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||
print '<td></td></tr>';
|
||||
print '<td align="right" class="nowrap" colspan="2">' . price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Amount TTC
|
||||
print '<tr><td height="10">' . $langs->trans('AmountTTC') . '</td>';
|
||||
print '<td align="right" class="nowrap">' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||
print '<td></td></tr>';
|
||||
print '<td align="right" class="nowrap" colspan="2">' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td height="10">' . $langs->trans('Status') . '</td><td align="left" colspan="2">' . $object->getLibStatut(4) . '</td></tr>';
|
||||
|
||||
@ -107,6 +107,9 @@ class Propal extends CommonObject
|
||||
var $products=array();
|
||||
var $extraparams=array();
|
||||
|
||||
/**
|
||||
* @var PropaleLigne[]
|
||||
*/
|
||||
var $lines = array();
|
||||
var $line;
|
||||
|
||||
@ -117,6 +120,11 @@ class Propal extends CommonObject
|
||||
var $labelstatut_short=array();
|
||||
|
||||
var $specimen;
|
||||
|
||||
//Incorterms
|
||||
var $fk_incoterms;
|
||||
var $location_incoterms;
|
||||
var $libelle_incoterms; //Used into tooltip
|
||||
|
||||
|
||||
/**
|
||||
@ -748,6 +756,8 @@ class Propal extends CommonObject
|
||||
$sql.= ", fk_availability";
|
||||
$sql.= ", fk_input_reason";
|
||||
$sql.= ", fk_projet";
|
||||
$sql.= ", fk_incoterms";
|
||||
$sql.= ", location_incoterms";
|
||||
$sql.= ", entity";
|
||||
$sql.= ") ";
|
||||
$sql.= " VALUES (";
|
||||
@ -775,6 +785,8 @@ class Propal extends CommonObject
|
||||
$sql.= ", ".$this->availability_id;
|
||||
$sql.= ", ".$this->demand_reason_id;
|
||||
$sql.= ", ".($this->fk_project?$this->fk_project:"null");
|
||||
$sql.= ", ".(int) $this->fk_incoterms;
|
||||
$sql.= ", '".$this->db->escape($this->location_incoterms)."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
@ -1095,6 +1107,8 @@ class Propal extends CommonObject
|
||||
$sql.= ", p.fk_mode_reglement";
|
||||
$sql.= ', p.fk_account';
|
||||
$sql.= ", p.fk_shipping_method";
|
||||
$sql.= ", p.fk_incoterms, p.location_incoterms";
|
||||
$sql.= ", i.libelle as libelle_incoterms";
|
||||
$sql.= ", c.label as statut_label";
|
||||
$sql.= ", ca.code as availability_code, ca.label as availability";
|
||||
$sql.= ", dr.code as demand_reason_code, dr.label as demand_reason";
|
||||
@ -1105,6 +1119,7 @@ class Propal extends CommonObject
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON p.fk_availability = ca.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON p.fk_incoterms = i.rowid';
|
||||
$sql.= " WHERE p.fk_statut = c.id";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
if ($ref) $sql.= " AND p.ref='".$ref."'";
|
||||
@ -1172,6 +1187,11 @@ class Propal extends CommonObject
|
||||
$this->user_valid_id = $obj->fk_user_valid;
|
||||
$this->user_close_id = $obj->fk_user_cloture;
|
||||
|
||||
//Incoterms
|
||||
$this->fk_incoterms = $obj->fk_incoterms;
|
||||
$this->location_incoterms = $obj->location_incoterms;
|
||||
$this->libelle_incoterms = $obj->libelle_incoterms;
|
||||
|
||||
if ($obj->fk_statut == 0)
|
||||
{
|
||||
$this->brouillon = 1;
|
||||
@ -1203,6 +1223,11 @@ class Propal extends CommonObject
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafieldsline=new ExtraFields($this->db);
|
||||
$line = new PropaleLigne($this->db);
|
||||
$extralabelsline=$extrafieldsline->fetch_name_optionals_label($line->table_element,true);
|
||||
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
@ -1212,7 +1237,8 @@ class Propal extends CommonObject
|
||||
|
||||
$line = new PropaleLigne($this->db);
|
||||
|
||||
$line->rowid = $objp->rowid;
|
||||
$line->rowid = $objp->rowid; //Deprecated
|
||||
$line->id = $objp->rowid;
|
||||
$line->fk_propal = $objp->fk_propal;
|
||||
$line->fk_parent_line = $objp->fk_parent_line;
|
||||
$line->product_type = $objp->product_type;
|
||||
@ -1253,6 +1279,8 @@ class Propal extends CommonObject
|
||||
$line->date_start = $objp->date_start;
|
||||
$line->date_end = $objp->date_end;
|
||||
|
||||
$line->fetch_optionals($line->id,$extralabelsline);
|
||||
|
||||
$this->lines[$i] = $line;
|
||||
//dol_syslog("1 ".$line->fk_product);
|
||||
//print "xx $i ".$this->lines[$i]->fk_product;
|
||||
@ -1266,12 +1294,6 @@ class Propal extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Retreive all extrafield for propal
|
||||
// fetch optionals attributes and labels
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -2639,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);
|
||||
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
if ($option == '') {
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose;
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose;
|
||||
}
|
||||
if ($option == 'compta') { // deprecated
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose;
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose;
|
||||
}
|
||||
if ($option == 'expedition') {
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/expedition/propal.php?id='.$this->id. $get_params .$linkclose;
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/expedition/propal.php?id='.$this->id. $get_params .$linkclose;
|
||||
}
|
||||
if ($option == 'document') {
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id. $get_params .$linkclose;
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id. $get_params .$linkclose;
|
||||
}
|
||||
$lienfin='</a>';
|
||||
$linkend='</a>';
|
||||
|
||||
$picto='propal';
|
||||
|
||||
|
||||
if ($withpicto)
|
||||
$result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
||||
$result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
||||
if ($withpicto && $withpicto != 2)
|
||||
$result.=' ';
|
||||
$result.=$lien.$this->ref.$lienfin;
|
||||
$result.=$link.$this->ref.$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -2782,9 +2804,6 @@ class Propal extends CommonObject
|
||||
*/
|
||||
class PropaleLigne extends CommonObject
|
||||
{
|
||||
var $db;
|
||||
var $error;
|
||||
|
||||
public $element='propaldet';
|
||||
public $table_element='propaldet';
|
||||
|
||||
|
||||
@ -182,9 +182,9 @@ if ($search_author)
|
||||
{
|
||||
$sql.= " AND u.login LIKE '%".$db->escape(trim($search_author))."%'";
|
||||
}
|
||||
if ($search_montant_ht)
|
||||
if ($search_montant_ht != '')
|
||||
{
|
||||
$sql.= " AND p.total_ht='".$db->escape(price2num(trim($search_montant_ht)))."'";
|
||||
$sql.= natural_search("p.total_ht", $search_montant_ht, 1);
|
||||
}
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array('s.nom', 'p.note_private', 'p.note_public', 'pd.description'), $sall);
|
||||
@ -316,12 +316,12 @@ if ($result)
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" colspan="1"> </td>';
|
||||
// Amount
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input class="flat" type="text" size="10" name="search_montant_ht" value="'.$search_montant_ht.'">';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="6" name="search_montant_ht" value="'.$search_montant_ht.'">';
|
||||
print '</td>';
|
||||
// Author
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input class="flat" size="10" type="text" name="search_author" value="'.$search_author.'">';
|
||||
print '<input class="flat" size="6" type="text" name="search_author" value="'.$search_author.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$formpropal->selectProposalStatus($viewstatut,1);
|
||||
|
||||
@ -399,7 +399,8 @@ if ($resql)
|
||||
print "</td></tr>\n";
|
||||
|
||||
$parameters=array();
|
||||
$formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSearch',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -55,6 +55,7 @@ $langs->load('propal');
|
||||
$langs->load('deliveries');
|
||||
$langs->load('sendings');
|
||||
$langs->load('products');
|
||||
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
|
||||
if (! empty($conf->margin->enabled))
|
||||
$langs->load('margins');
|
||||
|
||||
@ -84,10 +85,7 @@ $extrafields = new ExtraFields($db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Load object
|
||||
if ($id > 0 || ! empty($ref)) {
|
||||
$ret = $object->fetch($id, $ref);
|
||||
$ret = $object->fetch_thirdparty();
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not includ_once
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('ordercard','globalcard'));
|
||||
@ -222,13 +220,13 @@ if (empty($reshook))
|
||||
if ($datecommande == '') {
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentities('Date')), 'errors');
|
||||
$action = 'create';
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($socid < 1) {
|
||||
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), 'errors');
|
||||
$action = 'create';
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
@ -253,6 +251,8 @@ if (empty($reshook))
|
||||
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
|
||||
$object->fk_delivery_address = GETPOST('fk_address');
|
||||
$object->contactid = GETPOST('contactid');
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
|
||||
// If creation from another object of another module (Example: origin=propal, originid=1)
|
||||
if (! empty($origin) && ! empty($originid))
|
||||
@ -350,7 +350,7 @@ if (empty($reshook))
|
||||
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $date_start, $date_end, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options);
|
||||
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -365,14 +365,14 @@ if (empty($reshook))
|
||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
// modified by hook
|
||||
if ($reshook < 0)
|
||||
$error ++;
|
||||
$error++;
|
||||
} else {
|
||||
setEventMessage($srcobject->error, 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
setEventMessage($object->error, 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
// Required extrafield left blank, error message already defined by setOptionalsFromPost()
|
||||
@ -408,7 +408,7 @@ if (empty($reshook))
|
||||
$result = $object->add_contact(GETPOST('contactid'), 'CUSTOMER', 'external');
|
||||
if ($result < 0) {
|
||||
setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -518,6 +518,12 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Set incoterm
|
||||
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled))
|
||||
{
|
||||
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||
}
|
||||
|
||||
// bank account
|
||||
else if ($action == 'setbankaccount' && $user->rights->commande->creer) {
|
||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
@ -573,24 +579,24 @@ if (empty($reshook))
|
||||
|
||||
if (empty($idprod) && ($price_ht < 0) && ($qty < 0)) {
|
||||
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && GETPOST('type') < 0) {
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not ''
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
if ($qty == '') {
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc)) {
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) {
|
||||
@ -846,7 +852,7 @@ if (empty($reshook))
|
||||
|
||||
if ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) {
|
||||
setEventMessage($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
$type = GETPOST('type');
|
||||
@ -855,7 +861,7 @@ if (empty($reshook))
|
||||
// Check parameters
|
||||
if (GETPOST('type') < 0) {
|
||||
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1119,10 +1125,10 @@ if (empty($reshook))
|
||||
if (empty($reshook)) {
|
||||
$result = $object->insertExtraFields();
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
} else if ($reshook < 0)
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($error)
|
||||
@ -1413,6 +1419,16 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $objectsrc->libelle_incoterms, 1).'</label></td>';
|
||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||
print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms)?$objectsrc->location_incoterms:''));
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'socid'=>$socid);
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
|
||||
@ -1584,7 +1600,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
|
||||
$notify = new Notify($db);
|
||||
$text .= '<br>';
|
||||
$text .= $notify->confirmMessage('ORDER_VALIDATE', $object->socid);
|
||||
$text .= $notify->confirmMessage('ORDER_VALIDATE', $object->socid, $object);
|
||||
}
|
||||
|
||||
$qualified_for_stock_change=0;
|
||||
@ -1710,8 +1726,9 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
if (! $formconfirm) {
|
||||
$parameters = array('lineid' => $lineid);
|
||||
$formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified
|
||||
// by hook
|
||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
||||
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
|
||||
}
|
||||
|
||||
// Print form confirm
|
||||
@ -1973,6 +1990,29 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
{
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('IncotermLabel');
|
||||
print '<td><td align="right">';
|
||||
if ($user->rights->commande->creer) print '<a href="'.DOL_URL_ROOT.'/commande/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||
else print ' ';
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
if ($action != 'editincoterm')
|
||||
{
|
||||
print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$cols = 3;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
@ -2005,7 +2045,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Total HT
|
||||
print '<tr><td>' . $langs->trans('AmountHT') . '</td>';
|
||||
print '<td align="right">' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '</td>';
|
||||
print '<td>' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '</td>';
|
||||
|
||||
// Margin Infos
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
@ -2017,23 +2057,23 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
print '</tr>';
|
||||
|
||||
// Total TVA
|
||||
print '<tr><td>' . $langs->trans('AmountVAT') . '</td><td align="right">' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
// Total VAT
|
||||
print '<tr><td>' . $langs->trans('AmountVAT') . '</td><td>' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1
|
||||
{
|
||||
print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
|
||||
print '<td align="right">' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
print '<td>' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
}
|
||||
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2 IRPF
|
||||
{
|
||||
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
|
||||
print '<td align="right">' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
print '<td>' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
}
|
||||
|
||||
// Total TTC
|
||||
print '<tr><td>' . $langs->trans('AmountTTC') . '</td><td align="right">' . price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
print '<tr><td>' . $langs->trans('AmountTTC') . '</td><td>' . price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td>' . $langs->trans('Status') . '</td><td>' . $object->getLibStatut(4) . '</td></tr>';
|
||||
@ -2204,7 +2244,11 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
}
|
||||
|
||||
// Cancel order
|
||||
if ($object->statut == Commande::STATUS_VALIDATED && $user->rights->commande->annuler) {
|
||||
if ($object->statut == Commande::STATUS_VALIDATED &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->cloturer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->annuler)))
|
||||
)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=cancel">' . $langs->trans('Cancel') . '</a></div>';
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
@ -133,7 +133,25 @@ class Commande extends CommonOrder
|
||||
|
||||
var $user_author_id;
|
||||
|
||||
var $lines = array();
|
||||
/**
|
||||
* @var OrderLine[]
|
||||
*/
|
||||
var $lines = array();
|
||||
|
||||
//Incorterms
|
||||
var $fk_incoterms;
|
||||
var $location_incoterms;
|
||||
var $libelle_incoterms; //Used into tooltip
|
||||
|
||||
// Pour board
|
||||
var $nbtodo;
|
||||
var $nbtodolate;
|
||||
|
||||
|
||||
/**
|
||||
* ERR Not engouch stock
|
||||
*/
|
||||
const STOCK_NOT_ENOUGH_FOR_ORDER = -3;
|
||||
|
||||
|
||||
/**
|
||||
@ -648,8 +666,8 @@ class Commande extends CommonOrder
|
||||
* Note that this->ref can be set or empty. If empty, we will use "(PROV)"
|
||||
*
|
||||
* @param User $user Objet user that make creation
|
||||
* @param int $notrigger Disable all triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param int $notrigger Disable all triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function create($user, $notrigger=0)
|
||||
{
|
||||
@ -657,22 +675,22 @@ class Commande extends CommonOrder
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
$this->brouillon = 1; // On positionne en mode brouillon la commande
|
||||
$this->brouillon = 1; // set command as draft
|
||||
|
||||
dol_syslog(get_class($this)."::create user=".$user->id);
|
||||
|
||||
// Check parameters
|
||||
if (! empty($this->ref)) // We check that ref is not already used
|
||||
{
|
||||
$result=self::isExistingObject($this->element, 0, $this->ref); // Check ref is not yet used
|
||||
if ($result > 0)
|
||||
{
|
||||
$this->error='ErrorRefAlreadyExists';
|
||||
dol_syslog(get_class($this)."::create ".$this->error,LOG_WARNING);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
{
|
||||
$result=self::isExistingObject($this->element, 0, $this->ref); // Check ref is not yet used
|
||||
if ($result > 0)
|
||||
{
|
||||
$this->error='ErrorRefAlreadyExists';
|
||||
dol_syslog(get_class($this)."::create ".$this->error,LOG_WARNING);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
$soc = new Societe($this->db);
|
||||
$result=$soc->fetch($this->socid);
|
||||
@ -701,6 +719,7 @@ class Commande extends CommonOrder
|
||||
$sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_account, fk_availability, fk_input_reason, date_livraison, fk_delivery_address";
|
||||
$sql.= ", fk_shipping_method";
|
||||
$sql.= ", remise_absolue, remise_percent";
|
||||
$sql.= ", fk_incoterms, location_incoterms";
|
||||
$sql.= ", entity";
|
||||
$sql.= ")";
|
||||
$sql.= " VALUES ('(PROV)',".$this->socid.", '".$this->db->idate($now)."', ".$user->id;
|
||||
@ -723,6 +742,8 @@ class Commande extends CommonOrder
|
||||
$sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:'NULL');
|
||||
$sql.= ", ".($this->remise_absolue>0?$this->remise_absolue:'NULL');
|
||||
$sql.= ", ".($this->remise_percent>0?$this->remise_percent:0);
|
||||
$sql.= ", ".(int) $this->fk_incoterms;
|
||||
$sql.= ", '".$this->db->escape($this->location_incoterms)."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
@ -738,7 +759,7 @@ class Commande extends CommonOrder
|
||||
$num=count($this->lines);
|
||||
|
||||
/*
|
||||
* Insertion du detail des produits dans la base
|
||||
* Insert products details into db
|
||||
*/
|
||||
for ($i=0;$i<$num;$i++)
|
||||
{
|
||||
@ -769,12 +790,15 @@ class Commande extends CommonOrder
|
||||
$this->lines[$i]->fk_fournprice,
|
||||
$this->lines[$i]->pa_ht,
|
||||
$this->lines[$i]->label,
|
||||
$this->lines[$i]->array_options
|
||||
$this->lines[$i]->array_options
|
||||
);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_print_error($this->db);
|
||||
if ($result != self::STOCK_NOT_ENOUGH_FOR_ORDER)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -784,13 +808,16 @@ class Commande extends CommonOrder
|
||||
}
|
||||
}
|
||||
|
||||
// Mise a jour ref
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id;
|
||||
// update ref
|
||||
$initialref='(PROV'.$this->id.')';
|
||||
if (! empty($this->ref)) $initialref=$this->ref;
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='".$this->db->escape($initialref)."' WHERE rowid=".$this->id;
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if ($this->id)
|
||||
{
|
||||
$this->ref="(PROV".$this->id.")";
|
||||
$this->ref = $initialref;
|
||||
|
||||
// Add object linked
|
||||
if (is_array($this->linked_objects) && ! empty($this->linked_objects))
|
||||
@ -1213,10 +1240,12 @@ class Commande extends CommonOrder
|
||||
$result=$product->fetch($fk_product);
|
||||
$product_type=$product->type;
|
||||
|
||||
if($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER && $product_type == 0 && $product->stock_reel < $qty) {
|
||||
if($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER && $product_type == 0 && $product->stock_reel < $qty)
|
||||
{
|
||||
$this->error=$langs->trans('ErrorStockIsNotEnough');
|
||||
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
return self::STOCK_NOT_ENOUGH_FOR_ORDER;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1418,6 +1447,8 @@ class Commande extends CommonOrder
|
||||
$sql.= ', c.fk_shipping_method';
|
||||
$sql.= ', c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed';
|
||||
$sql.= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.fk_delivery_address, c.extraparams';
|
||||
$sql.= ', c.fk_incoterms, c.location_incoterms';
|
||||
$sql.= ", i.libelle as libelle_incoterms";
|
||||
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
|
||||
$sql.= ', cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc';
|
||||
$sql.= ', ca.code as availability_code';
|
||||
@ -1427,6 +1458,7 @@ class Commande extends CommonOrder
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON (c.fk_mode_reglement = p.id)';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON (c.fk_availability = ca.rowid)';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON (c.fk_input_reason = ca.rowid)';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid';
|
||||
$sql.= " WHERE c.entity = ".$conf->entity;
|
||||
if ($id) $sql.= " AND c.rowid=".$id;
|
||||
if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'";
|
||||
@ -1482,6 +1514,11 @@ class Commande extends CommonOrder
|
||||
$this->shipping_method_id = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null;
|
||||
$this->fk_delivery_address = $obj->fk_delivery_address;
|
||||
|
||||
//Incoterms
|
||||
$this->fk_incoterms = $obj->fk_incoterms;
|
||||
$this->location_incoterms = $obj->location_incoterms;
|
||||
$this->libelle_incoterms = $obj->libelle_incoterms;
|
||||
|
||||
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
||||
|
||||
$this->lines = array();
|
||||
@ -1630,12 +1667,12 @@ class Commande extends CommonOrder
|
||||
|
||||
$line = new OrderLine($this->db);
|
||||
|
||||
$line->rowid = $objp->rowid; // \deprecated
|
||||
$line->rowid = $objp->rowid;
|
||||
$line->id = $objp->rowid;
|
||||
$line->fk_commande = $objp->fk_commande;
|
||||
$line->commande_id = $objp->fk_commande; // \deprecated
|
||||
$line->commande_id = $objp->fk_commande;
|
||||
$line->label = $objp->custom_label;
|
||||
$line->desc = $objp->description; // Description ligne
|
||||
$line->desc = $objp->description;
|
||||
$line->product_type = $objp->product_type;
|
||||
$line->qty = $objp->qty;
|
||||
$line->tva_tx = $objp->tva_tx;
|
||||
@ -1661,11 +1698,11 @@ class Commande extends CommonOrder
|
||||
$line->special_code = $objp->special_code;
|
||||
$line->fk_parent_line = $objp->fk_parent_line;
|
||||
|
||||
$line->ref = $objp->product_ref; // TODO deprecated
|
||||
$line->ref = $objp->product_ref;
|
||||
$line->product_ref = $objp->product_ref;
|
||||
$line->libelle = $objp->product_label; // TODO deprecated
|
||||
$line->libelle = $objp->product_label;
|
||||
$line->product_label = $objp->product_label;
|
||||
$line->product_desc = $objp->product_desc; // Description produit
|
||||
$line->product_desc = $objp->product_desc;
|
||||
$line->fk_product_type = $objp->fk_product_type; // Produit ou service
|
||||
|
||||
$line->date_start = $this->db->jdate($objp->date_start);
|
||||
@ -3256,56 +3293,44 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
class OrderLine extends CommonOrderLine
|
||||
{
|
||||
var $db;
|
||||
var $error;
|
||||
|
||||
public $element='commandedet';
|
||||
public $table_element='commandedet';
|
||||
|
||||
var $oldline;
|
||||
|
||||
/**
|
||||
* Id of parent order
|
||||
* @var int
|
||||
*/
|
||||
public $fk_commande;
|
||||
|
||||
/**
|
||||
* Id of parent order
|
||||
* @var int
|
||||
* @deprecated Use fk_commande
|
||||
*/
|
||||
public $commande_id;
|
||||
|
||||
// From llx_commandedet
|
||||
var $rowid;
|
||||
var $fk_parent_line;
|
||||
var $fk_facture;
|
||||
var $label;
|
||||
var $desc; // Description ligne
|
||||
var $fk_product; // Id produit predefini
|
||||
var $product_type = 0; // Type 0 = product, 1 = Service
|
||||
|
||||
var $qty; // Quantity (example 2)
|
||||
var $tva_tx; // VAT Rate for product/service (example 19.6)
|
||||
var $localtax1_tx; // Local tax 1
|
||||
var $localtax2_tx; // Local tax 2
|
||||
var $localtax1_type; // Local tax 1 type
|
||||
var $localtax2_type; // Local tax 2 type
|
||||
var $subprice; // U.P. HT (example 100)
|
||||
var $remise_percent; // % for line discount (example 20%)
|
||||
var $fk_remise_except;
|
||||
var $rang = 0;
|
||||
var $fk_fournprice;
|
||||
|
||||
/**
|
||||
* Buy price without taxes
|
||||
* @var float
|
||||
*/
|
||||
var $pa_ht;
|
||||
var $marge_tx;
|
||||
var $marque_tx;
|
||||
var $info_bits = 0; // Bit 0: 0 si TVA normal - 1 si TVA NPR
|
||||
// Bit 1: 0 ligne normale - 1 si ligne de remise fixe
|
||||
var $special_code = 0;
|
||||
var $total_ht; // Total HT de la ligne toute quantite et incluant la remise ligne
|
||||
var $total_tva; // Total TVA de la ligne toute quantite et incluant la remise ligne
|
||||
var $total_localtax1; // Total local tax 1 for the line
|
||||
var $total_localtax2; // Total local tax 2 for the line
|
||||
var $total_ttc; // Total TTC de la ligne toute quantite et incluant la remise ligne
|
||||
|
||||
// Ne plus utiliser
|
||||
var $remise;
|
||||
var $price;
|
||||
|
||||
// From llx_product
|
||||
var $ref; // deprecated
|
||||
var $libelle; // deprecated
|
||||
var $product_ref;
|
||||
var $product_label; // Label produit
|
||||
var $product_desc; // Description produit
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
var $remise;
|
||||
|
||||
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||
// Start and end date of the line
|
||||
|
||||
@ -158,12 +158,12 @@ if ($resql)
|
||||
print '<td>';
|
||||
|
||||
$result='';
|
||||
$lien=$lienfin='';
|
||||
$lien = '<a href="'.dol_buildpath('/commande/orderstoinvoice.php',1).'?socid='.$obj->rowid.'">';
|
||||
$lienfin='</a>';
|
||||
$link=$linkend='';
|
||||
$link = '<a href="'.dol_buildpath('/commande/orderstoinvoice.php',1).'?socid='.$obj->rowid.'">';
|
||||
$linkend='</a>';
|
||||
$name=$obj->name;
|
||||
$result.=($lien.img_object($langs->trans("ShowCompany").': '.$name,'company').$lienfin);
|
||||
$result.=$lien.(dol_trunc($name,$maxlen)).$lienfin;
|
||||
$result.=($link.img_object($langs->trans("ShowCompany").': '.$name,'company').$linkend);
|
||||
$result.=$link.(dol_trunc($name,$maxlen)).$linkend;
|
||||
|
||||
print $result;
|
||||
print '</td>';
|
||||
|
||||
@ -51,6 +51,7 @@ $sall=GETPOST('sall');
|
||||
$socid=GETPOST('socid','int');
|
||||
$search_user=GETPOST('search_user','int');
|
||||
$search_sale=GETPOST('search_sale','int');
|
||||
$search_total_ht=GETPOST('search_total_ht','alpha');
|
||||
|
||||
// Security check
|
||||
$id = (GETPOST('orderid')?GETPOST('orderid'):GETPOST('id','int'));
|
||||
@ -79,6 +80,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$search_ref='';
|
||||
$search_ref_customer='';
|
||||
$search_company='';
|
||||
$search_total_ht='';
|
||||
$orderyear='';
|
||||
$ordermonth='';
|
||||
$deliverymonth='';
|
||||
@ -96,6 +98,7 @@ $parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hook
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -198,7 +201,10 @@ if ($search_user > 0)
|
||||
{
|
||||
$sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
}
|
||||
|
||||
if ($search_total_ht != '')
|
||||
{
|
||||
$sql.= natural_search('c.total_ht', $search_total_ht, 1);
|
||||
}
|
||||
$sql.= ' ORDER BY '.$sortfield.' '.$sortorder;
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
@ -252,6 +258,7 @@ if ($resql)
|
||||
if ($search_ref_customer) $param.='&search_ref_customer='.$search_ref_customer;
|
||||
if ($search_user > 0) $param.='&search_user='.$search_user;
|
||||
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
|
||||
if ($search_total_ht != '') $param.='&search_total_ht='.$search_total_ht;
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
print_barre_liste($title, $page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
|
||||
@ -316,7 +323,9 @@ if ($resql)
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="deliverymonth" value="'.$deliverymonth.'">';
|
||||
$formother->select_year($deliveryyear?$deliveryyear:-1,'deliveryyear',1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="6" name="search_total_ht" value="'.$search_total_ht.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print "</td></tr>\n";
|
||||
@ -328,7 +337,8 @@ if ($resql)
|
||||
|
||||
$generic_commande = new Commande($db);
|
||||
$generic_product = new Product($db);
|
||||
while ($i < min($num,$limit)) {
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
@ -358,7 +368,7 @@ if ($resql)
|
||||
$nbprod++; // order contains real products
|
||||
$generic_product->id = $generic_commande->lines[$lig]->fk_product;
|
||||
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) {
|
||||
$generic_product->load_stock(true);
|
||||
$generic_product->load_stock();
|
||||
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel;
|
||||
} else {
|
||||
$generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'];
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@@2byte.es>
|
||||
* Copyright (C) 2012-2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2011-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -37,6 +37,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
@ -44,6 +46,8 @@ $langs->load("banks");
|
||||
$langs->load("categories");
|
||||
$langs->load("bills");
|
||||
$langs->load("companies");
|
||||
$langs->load("loan");
|
||||
$langs->load("donations");
|
||||
|
||||
$id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('account','int'));
|
||||
$ref = GETPOST('ref','alpha');
|
||||
@ -148,11 +152,13 @@ llxHeader();
|
||||
$societestatic=new Societe($db);
|
||||
$userstatic=new User($db);
|
||||
$chargestatic=new ChargeSociales($db);
|
||||
$loanstatic=new Loan($db);
|
||||
$memberstatic=new Adherent($db);
|
||||
$paymentstatic=new Paiement($db);
|
||||
$paymentsupplierstatic=new PaiementFourn($db);
|
||||
$paymentvatstatic=new TVA($db);
|
||||
$paymentsalstatic=new PaymentSalary($db);
|
||||
$donstatic=new Don($db);
|
||||
$bankstatic=new Account($db);
|
||||
$banklinestatic=new AccountLine($db);
|
||||
|
||||
@ -606,6 +612,18 @@ if ($id > 0 || ! empty($ref))
|
||||
$paymentsalstatic->ref=$links[$key]['url_id'];
|
||||
print ' '.$paymentsalstatic->getNomUrl(2);
|
||||
}
|
||||
elseif ($links[$key]['type']=='payment_loan')
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/loan/payment/card.php?id='.$links[$key]['url_id'].'">';
|
||||
print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
|
||||
print '</a>';
|
||||
}
|
||||
elseif ($links[$key]['type']=='payment_donation')
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$links[$key]['url_id'].'">';
|
||||
print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
|
||||
print '</a>';
|
||||
}
|
||||
elseif ($links[$key]['type']=='banktransfert')
|
||||
{
|
||||
// Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail.
|
||||
@ -705,6 +723,21 @@ if ($id > 0 || ! empty($ref))
|
||||
$chargestatic->ref=$chargestatic->lib;
|
||||
print $chargestatic->getNomUrl(1,16);
|
||||
}
|
||||
else if ($links[$key]['type']=='loan')
|
||||
{
|
||||
$loanstatic->id=$links[$key]['url_id'];
|
||||
if (preg_match('/^\((.*)\)$/i',$links[$key]['label'],$reg))
|
||||
{
|
||||
if ($reg[1]=='loan') $reg[1]='Loan';
|
||||
$loanstatic->label=$langs->trans($reg[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$loanstatic->label=$links[$key]['label'];
|
||||
}
|
||||
$loanstatic->ref=$loanstatic->label;
|
||||
print $loanstatic->getLinkUrl(1,16);
|
||||
}
|
||||
else if ($links[$key]['type']=='member')
|
||||
{
|
||||
$memberstatic->id=$links[$key]['url_id'];
|
||||
|
||||
@ -137,7 +137,7 @@ $head=bank_prepare_head($acct);
|
||||
dol_fiche_head($head,'annual',$langs->trans("FinancialAccount"),0,'account');
|
||||
|
||||
$title=$langs->trans("FinancialAccount")." : ".$acct->label;
|
||||
$lien=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year_start=".($year_start-1)."'>".img_previous()."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year_start=".($year_start+1)."'>".img_next()."</a>":"");
|
||||
$link=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year_start=".($year_start-1)."'>".img_previous()."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year_start=".($year_start+1)."'>".img_next()."</a>":"");
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -191,7 +191,7 @@ print '<br>';
|
||||
// Affiche tableau
|
||||
print '<table class="notopnoleftnoright" width="100%">';
|
||||
|
||||
print '<tr><td colspan="'.(1+($year_end-$year_start+1)*2).'" align="right">'.$lien.'</td></tr>';
|
||||
print '<tr><td colspan="'.(1+($year_end-$year_start+1)*2).'" align="right">'.$link.'</td></tr>';
|
||||
|
||||
print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Month").'</td>';
|
||||
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||
|
||||
@ -1,477 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copytight (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.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/compta/bank/bankid_fr.php
|
||||
* \ingroup banque
|
||||
* \brief Fiche creation compte bancaire
|
||||
*/
|
||||
|
||||
require('../../main.inc.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
$langs->load("banks");
|
||||
$langs->load("categories");
|
||||
$langs->load("bills");
|
||||
|
||||
$action=GETPOST('action');
|
||||
$id=GETPOST('id','int');
|
||||
$ref=GETPOST('ref');
|
||||
|
||||
// Security check
|
||||
if (isset($_GET["id"]) || isset($_GET["ref"]))
|
||||
{
|
||||
$id = isset($_GET["id"])?$_GET["id"]:(isset($_GET["ref"])?$_GET["ref"]:'');
|
||||
}
|
||||
$fieldid = isset($_GET["ref"])?'ref':'rowid';
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fieldid);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'update' && ! $_POST["cancel"])
|
||||
{
|
||||
// Modification
|
||||
$account = new Account($db);
|
||||
$account->fetch($id);
|
||||
|
||||
$account->bank = trim($_POST["bank"]);
|
||||
$account->code_banque = trim($_POST["code_banque"]);
|
||||
$account->code_guichet = trim($_POST["code_guichet"]);
|
||||
$account->number = trim($_POST["number"]);
|
||||
$account->cle_rib = trim($_POST["cle_rib"]);
|
||||
$account->bic = trim($_POST["bic"]);
|
||||
$account->iban = trim($_POST["iban"]);
|
||||
$account->domiciliation = trim($_POST["domiciliation"]);
|
||||
$account->proprio = trim($_POST["proprio"]);
|
||||
$account->owner_address = trim($_POST["owner_address"]);
|
||||
$account->state_id = trim($_POST["state_id"]);
|
||||
//$account->country_id = trim($_POST["country_id"]); // We do not change this.
|
||||
|
||||
if ($account->id)
|
||||
{
|
||||
$result = $account->update_bban($user);
|
||||
if ($result >= 0)
|
||||
{
|
||||
$_GET["id"]=$_POST["id"]; // Force chargement page en mode visu
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($account->error, 'errors');
|
||||
$action='edit'; // Force chargement page edition
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->banque->configurer)
|
||||
{
|
||||
// Modification
|
||||
$account = new Account($db);
|
||||
$account->fetch($id);
|
||||
$account->delete();
|
||||
|
||||
header("Location: ".DOL_URL_ROOT."/compta/bank/index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Affichage page en mode creation */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if (($_GET["id"] || $_GET["ref"]) && $action != 'edit')
|
||||
{
|
||||
$account = new Account($db);
|
||||
if ($_GET["id"])
|
||||
{
|
||||
$result=$account->fetch($id);
|
||||
}
|
||||
if ($_GET["ref"])
|
||||
{
|
||||
$result=$account->fetch(0,$_GET["ref"]);
|
||||
$_GET["id"]=$account->id;
|
||||
}
|
||||
|
||||
// Onglets
|
||||
$head=bank_prepare_head($account);
|
||||
dol_fiche_head($head, 'bankid', $langs->trans("FinancialAccount"),0,'account');
|
||||
|
||||
// Confirmation de la suppression
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete");
|
||||
|
||||
}
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($account, 'ref', $linkback, 1, 'ref');
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
|
||||
print '<td colspan="3">'.$account->label.'</td></tr>';
|
||||
|
||||
// Type
|
||||
print '<tr><td valign="top">'.$langs->trans("AccountType").'</td>';
|
||||
print '<td colspan="3">'.$account->type_lib[$account->type].'</td></tr>';
|
||||
|
||||
// Currency
|
||||
print '<tr><td valign="top">'.$langs->trans("Currency").'</td>';
|
||||
print '<td colspan="3">';
|
||||
$selectedcode=$account->account_currency_code;
|
||||
if (! $selectedcode) $selectedcode=$conf->currency;
|
||||
print $langs->trans("Currency".$selectedcode);
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
|
||||
print '<td colspan="3">'.$account->getLibStatut(4).'</td></tr>';
|
||||
|
||||
if ($account->type == 0 || $account->type == 1)
|
||||
{
|
||||
// Country
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountCountry").'</td><td colspan="3">';
|
||||
$img=picto_from_langcode($account->country_code);
|
||||
print $img?$img.' ':'';
|
||||
print getCountry($account->getCountryCode(), 0, $db);
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankName").'</td>';
|
||||
print '<td colspan="3">'.$account->bank.'</td></tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_banque.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_guichet.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_banque.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td colspan="3">'.$account->number.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td colspan="3">'.$account->cle_rib.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ibankey="IBANNumber";
|
||||
$bickey="BICNumber";
|
||||
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
|
||||
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans($ibankey).'</td>';
|
||||
print '<td colspan="3">'.$account->iban.' ';
|
||||
if (! empty($account->iban)) {
|
||||
if (! checkIbanForAccount($account)) {
|
||||
print img_picto($langs->trans("IbanNotValid"),'warning');
|
||||
} else {
|
||||
print img_picto($langs->trans("IbanValid"),'info');
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans($bickey).'</td>';
|
||||
print '<td colspan="3">'.$account->bic.' ';
|
||||
if (! empty($account->bic)) {
|
||||
if (! checkSwiftForAccount($account)) {
|
||||
print img_picto($langs->trans("SwiftNotValid"),'warning');
|
||||
} else {
|
||||
print img_picto($langs->trans("SwiftValid"),'info');
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
|
||||
print nl2br($account->domiciliation);
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td><td colspan="3">';
|
||||
print $account->proprio;
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">';
|
||||
print nl2br($account->owner_address);
|
||||
print "</td></tr>\n";
|
||||
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
// Check BBAN
|
||||
if (! checkBanForAccount($account))
|
||||
{
|
||||
print '<div class="warning">'.$langs->trans("RIBControlError").'</div>';
|
||||
}
|
||||
|
||||
print "\n</div>\n";
|
||||
|
||||
|
||||
/*
|
||||
* Barre d'actions
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->banque->configurer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$account->id.'">'.$langs->trans("Modify").'</a>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Edition */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($_GET["id"] && $action == 'edit' && $user->rights->banque->configurer)
|
||||
{
|
||||
$account = new Account($db);
|
||||
$account->fetch($id);
|
||||
|
||||
print_fiche_titre($langs->trans("EditFinancialAccount"));
|
||||
print "<br>";
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$account->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$_GET["id"].'">'."\n\n";
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3">'.$account->ref;
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
|
||||
print '<td colspan="3">'.$account->label;
|
||||
print '</td></tr>';
|
||||
|
||||
// Type
|
||||
print '<tr><td valign="top">'.$langs->trans("AccountType").'</td>';
|
||||
print '<td colspan="3">'.$account->type_lib[$account->type];
|
||||
print '</td></tr>';
|
||||
|
||||
// Currency
|
||||
print '<tr><td valign="top">'.$langs->trans("Currency").'</td>';
|
||||
print '<td colspan="3">';
|
||||
$selectedcode=$account->account_currency_code;
|
||||
if (! $selectedcode) $selectedcode=$conf->currency;
|
||||
print $langs->trans("Currency".$selectedcode);
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
|
||||
print '<td colspan="3">'.$account->getLibStatut(4);
|
||||
print '</td></tr>';
|
||||
|
||||
if ($account->type == 0 || $account->type == 1)
|
||||
{
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountCountry").'</td><td colspan="3">';
|
||||
$img=picto_from_langcode($account->country_code);
|
||||
print $img?$img.' ':'';
|
||||
print getCountry($account->getCountryCode(), 0, $db);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// If bank account
|
||||
print '<tr><td valign="top">'.$langs->trans("BankName").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.$account->bank.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td><input size="18" type="text" class="flat" name="number" value="'.$account->number.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ibankey="IBANNumber";
|
||||
$bickey="BICNumber";
|
||||
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
|
||||
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
|
||||
|
||||
// IBAN
|
||||
print '<tr><td valign="top">'.$langs->trans($ibankey).'</td>';
|
||||
print '<td colspan="3"><input size="34" maxlength="34" type="text" class="flat" name="iban" value="'.$account->iban.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans($bickey).'</td>';
|
||||
print '<td colspan="3"><input size="11" maxlength="11" type="text" class="flat" name="bic" value="'.$account->bic.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
|
||||
print "<textarea class=\"flat\" name=\"domiciliation\" rows=\"2\" cols=\"40\">";
|
||||
print $account->domiciliation;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="proprio" value="'.$account->proprio.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">';
|
||||
print "<textarea class=\"flat\" name=\"owner_address\" rows=\"2\" cols=\"40\">";
|
||||
print $account->owner_address;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<div align="center">';
|
||||
print '<input value="'.$langs->trans("Save").'" type="submit" class="button">';
|
||||
print ' <input name="cancel" value="'.$langs->trans("Cancel").'" type="submit" class="button">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copytight (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.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
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copytight (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copytight (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -21,19 +21,20 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/bank/card.php
|
||||
* \ingroup banque
|
||||
* \ingroup bank
|
||||
* \brief Page to create/view a bank account
|
||||
*/
|
||||
|
||||
require('../../main.inc.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbank.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formbank.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
||||
|
||||
$langs->load("banks");
|
||||
$langs->load("bills");
|
||||
$langs->load("categories");
|
||||
$langs->load("companies");
|
||||
$langs->load("compta");
|
||||
@ -71,6 +72,18 @@ if ($_POST["action"] == 'add')
|
||||
$account->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1;
|
||||
$account->url = $_POST["url"];
|
||||
|
||||
$account->bank = trim($_POST["bank"]);
|
||||
$account->code_banque = trim($_POST["code_banque"]);
|
||||
$account->code_guichet = trim($_POST["code_guichet"]);
|
||||
$account->number = trim($_POST["number"]);
|
||||
$account->cle_rib = trim($_POST["cle_rib"]);
|
||||
$account->bic = trim($_POST["bic"]);
|
||||
$account->iban = trim($_POST["iban"]);
|
||||
$account->domiciliation = trim($_POST["domiciliation"]);
|
||||
|
||||
$account->proprio = trim($_POST["proprio"]);
|
||||
$account->owner_address = trim($_POST["owner_address"]);
|
||||
|
||||
$account->account_number = trim($_POST["account_number"]);
|
||||
$account->accountancy_journal = trim($_POST["accountancy_journal"]);
|
||||
|
||||
@ -82,8 +95,8 @@ if ($_POST["action"] == 'add')
|
||||
$account->state_id = $_POST["account_state_id"];
|
||||
$account->country_id = $_POST["account_country_id"];
|
||||
|
||||
$account->min_allowed = $_POST["account_min_allowed"];
|
||||
$account->min_desired = $_POST["account_min_desired"];
|
||||
$account->min_allowed = GETPOST("account_min_allowed",'int');
|
||||
$account->min_desired = GETPOST("account_min_desired",'int');
|
||||
$account->comment = trim($_POST["account_comment"]);
|
||||
|
||||
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number))
|
||||
@ -157,8 +170,8 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
||||
$account->state_id = $_POST["account_state_id"];
|
||||
$account->country_id = $_POST["account_country_id"];
|
||||
|
||||
$account->min_allowed = $_POST["account_min_allowed"];
|
||||
$account->min_desired = $_POST["account_min_desired"];
|
||||
$account->min_allowed = GETPOST("account_min_allowed",'int');
|
||||
$account->min_desired = GETPOST("account_min_desired",'int');
|
||||
$account->comment = trim($_POST["account_comment"]);
|
||||
|
||||
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number))
|
||||
@ -233,8 +246,12 @@ if ($action == 'create')
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print 'jQuery(document).ready(function () {
|
||||
jQuery("#selecttype").change(function() {
|
||||
document.formsoc.action.value="create";
|
||||
document.formsoc.submit();
|
||||
});
|
||||
jQuery("#selectaccount_country_id").change(function() {
|
||||
document.formsoc.action.value="create";
|
||||
document.formsoc.submit();
|
||||
@ -251,12 +268,12 @@ if ($action == 'create')
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td valign="top" class="fieldrequired" width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<tr><td valign="top" class="fieldrequired" width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.($_POST["ref"]?$_POST["ref"]:$account->ref).'" maxlength="12"></td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="label" value="'.$_POST["label"].'"></td></tr>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="label" value="'.GETPOST("label").'"></td></tr>';
|
||||
|
||||
// Type
|
||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
||||
@ -280,15 +297,17 @@ if ($action == 'create')
|
||||
print $form->selectarray("clos",array(0=>$account->status[0],1=>$account->status[1]),(isset($_POST["clos"])?$_POST["clos"]:$account->clos));
|
||||
print '</td></tr>';
|
||||
|
||||
// Country
|
||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("BankAccountCountry").'</td>';
|
||||
print '<td colspan="3">';
|
||||
// Country
|
||||
$selectedcode='';
|
||||
if (isset($_POST["account_country_id"]))
|
||||
{
|
||||
$selectedcode=$_POST["account_country_id"]?$_POST["account_country_id"]:$account->country_code;
|
||||
}
|
||||
else if (empty($selectedcode)) $selectedcode=$mysoc->country_code;
|
||||
$account->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
|
||||
|
||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("BankAccountCountry").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->select_country($selectedcode,'account_country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
print '</td></tr>';
|
||||
@ -314,10 +333,10 @@ if ($action == 'create')
|
||||
print '<td colspan="3">';
|
||||
// Editor wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('account_comment',$account->comment,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70);
|
||||
$doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$account->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,4,70);
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => 3);
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$account,$action); // Note that $action and $object may have been modified by hook
|
||||
@ -326,7 +345,6 @@ if ($action == 'create')
|
||||
print $account->showOptionals($extrafields,'edit',$parameters);
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
@ -335,7 +353,7 @@ if ($action == 'create')
|
||||
|
||||
// Sold
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("InitialBankBalance").'</td>';
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="solde" value="'.($_POST["solde"]?$_POST["solde"]:price2num($account->solde)).'"></td></tr>';
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="solde" value="'.(GETPOST("solde")?GETPOST("solde"):price2num($account->solde)).'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Date").'</td>';
|
||||
print '<td colspan="3">';
|
||||
@ -349,27 +367,126 @@ if ($action == 'create')
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_desired" value="'.($_POST["account_min_desired"]?$_POST["account_min_desired"]:$account->account_min_desired).'"></td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
if ($_POST["type"] == 0 || $_POST["type"] == 1)
|
||||
{
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// If bank account
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("BankName").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.$account->bank.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td><input size="18" type="text" class="flat" name="number" value="'.$account->number.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$ibankey="IBANNumber";
|
||||
$bickey="BICNumber";
|
||||
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
|
||||
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
|
||||
|
||||
// IBAN
|
||||
print '<tr><td>'.$langs->trans($ibankey).'</td>';
|
||||
print '<td colspan="3"><input size="34" maxlength="34" type="text" class="flat" name="iban" value="'.$account->iban.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans($bickey).'</td>';
|
||||
print '<td colspan="3"><input size="11" maxlength="11" type="text" class="flat" name="bic" value="'.$account->bic.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
|
||||
print "<textarea class=\"flat\" name=\"domiciliation\" rows=\"2\" cols=\"40\">";
|
||||
print $account->domiciliation;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="proprio" value="'.$account->proprio.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">';
|
||||
print "<textarea class=\"flat\" name=\"owner_address\" rows=\"2\" cols=\"40\">";
|
||||
print $account->owner_address;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
// Accountancy code
|
||||
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED))
|
||||
{
|
||||
print '<tr><td valign="top" class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.$account->account_number.'"></td></tr>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number'):$account->account_number).'"></td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.$account->account_number.'"></td></tr>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number'):$account->account_number).'"></td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy journal
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<tr><td valign="top">'.$langs->trans("AccountancyJournal").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="accountancy_journal" value="'.$account->accountancy_journal.'"></td></tr>';
|
||||
print '<td colspan="3"><input type="text" name="accountancy_journal" value="'.(GETPOST("accountancy_journal")?GETPOST('accountancy_journal'):$account->accountancy_journal).'"></td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
@ -482,7 +599,7 @@ else
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
|
||||
print '<td colspan="3">'.$account->comment.'</td></tr>';
|
||||
print '<td colspan="3">'.dol_htmlentitiesbr($account->comment).'</td></tr>';
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => 3);
|
||||
@ -495,6 +612,118 @@ else
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
if ($account->type == 0 || $account->type == 1)
|
||||
{
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("BankName").'</td>';
|
||||
print '<td colspan="3">'.$account->bank.'</td></tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_banque.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_guichet.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_banque.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td colspan="3">'.$account->number.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td colspan="3">'.$account->cle_rib.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ibankey="IBANNumber";
|
||||
$bickey="BICNumber";
|
||||
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
|
||||
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans($ibankey).'</td>';
|
||||
print '<td colspan="3">'.$account->iban.' ';
|
||||
if (! empty($account->iban)) {
|
||||
if (! checkIbanForAccount($account)) {
|
||||
print img_picto($langs->trans("IbanNotValid"),'warning');
|
||||
} else {
|
||||
print img_picto($langs->trans("IbanValid"),'info');
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans($bickey).'</td>';
|
||||
print '<td colspan="3">'.$account->bic.' ';
|
||||
if (! empty($account->bic)) {
|
||||
if (! checkSwiftForAccount($account)) {
|
||||
print img_picto($langs->trans("SwiftNotValid"),'warning');
|
||||
} else {
|
||||
print img_picto($langs->trans("SwiftValid"),'info');
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
|
||||
print nl2br($account->domiciliation);
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td><td colspan="3">';
|
||||
print $account->proprio;
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">';
|
||||
print nl2br($account->owner_address);
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
// Accountancy code
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
@ -549,6 +778,13 @@ else
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print 'jQuery(document).ready(function () {
|
||||
jQuery("#selecttype").change(function() {
|
||||
document.formsoc.action.value="edit";
|
||||
document.formsoc.submit();
|
||||
});
|
||||
})'."\n";
|
||||
|
||||
print 'jQuery(document).ready(function () {
|
||||
jQuery("#selectaccount_country_id").change(function() {
|
||||
document.formsoc.action.value="edit";
|
||||
document.formsoc.submit();
|
||||
@ -598,11 +834,13 @@ else
|
||||
|
||||
// Country
|
||||
$account->country_id=$account->country_id?$account->country_id:$mysoc->country_id;
|
||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Country").'</td>';
|
||||
print '<td colspan="3">';
|
||||
$selectedcode=$account->country_code;
|
||||
if (isset($_POST["account_country_id"])) $selectedcode=$_POST["account_country_id"];
|
||||
else if (empty($selectedcode)) $selectedcode=$mysoc->country_code;
|
||||
$account->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
|
||||
|
||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Country").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->select_country($selectedcode,'account_country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
print '</td></tr>';
|
||||
@ -643,9 +881,9 @@ else
|
||||
// Comment
|
||||
print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
|
||||
print '<td colspan="3">';
|
||||
// Editor wysiwyg
|
||||
// Editor wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('account_comment',(isset($_POST["account_comment"])?$_POST["account_comment"]:$account->comment),'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70);
|
||||
$doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$account->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,4,70);
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
@ -656,11 +894,110 @@ else
|
||||
{
|
||||
print $account->showOptionals($extrafields,'edit');
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
if ($_POST["type"] == 0 || $_POST["type"] == 1)
|
||||
{
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// If bank account
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("BankName").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.$account->bank.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td><input size="18" type="text" class="flat" name="number" value="'.$account->number.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ibankey="IBANNumber";
|
||||
$bickey="BICNumber";
|
||||
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
|
||||
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
|
||||
|
||||
// IBAN
|
||||
print '<tr><td valign="top">'.$langs->trans($ibankey).'</td>';
|
||||
print '<td colspan="3"><input size="34" maxlength="34" type="text" class="flat" name="iban" value="'.$account->iban.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans($bickey).'</td>';
|
||||
print '<td colspan="3"><input size="11" maxlength="11" type="text" class="flat" name="bic" value="'.$account->bic.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
|
||||
print "<textarea class=\"flat\" name=\"domiciliation\" rows=\"2\" cols=\"40\">";
|
||||
print $account->domiciliation;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="proprio" value="'.$account->proprio.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">';
|
||||
print "<textarea class=\"flat\" name=\"owner_address\" rows=\"2\" cols=\"40\">";
|
||||
print $account->owner_address;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Accountancy code
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copytight (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copytight (C) 2013 Charles-Fr BENKE <charles.fr@benke.fr>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Charles-Fr BENKE <charles.fr@benke.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
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copytight (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -23,7 +24,7 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/bank/class/account.class.php
|
||||
* \ingroup banque
|
||||
* \ingroup bank
|
||||
* \brief File of class to manage bank accounts
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
||||
@ -38,12 +39,12 @@ class Account extends CommonObject
|
||||
public $table_element='bank_account';
|
||||
|
||||
/**
|
||||
* //TODO: Discuss this. $rowid is preferred over $id
|
||||
* @var
|
||||
* @var int Use id instead of rowid
|
||||
* @deprecated
|
||||
*/
|
||||
var $rowid;
|
||||
var $id;
|
||||
|
||||
var $ref;
|
||||
var $label;
|
||||
//! 1=Compte courant/check/carte, 2=Compte liquide, 0=Compte épargne
|
||||
@ -389,7 +390,17 @@ class Account extends CommonObject
|
||||
$sql.= ", entity";
|
||||
$sql.= ", account_number";
|
||||
$sql.= ", accountancy_journal";
|
||||
$sql.= ", currency_code";
|
||||
$sql.= ", bank";
|
||||
$sql.= ", code_banque";
|
||||
$sql.= ", code_guichet";
|
||||
$sql.= ", number";
|
||||
$sql.= ", cle_rib";
|
||||
$sql.= ", bic";
|
||||
$sql.= ", iban_prefix";
|
||||
$sql.= ", domiciliation";
|
||||
$sql.= ", proprio";
|
||||
$sql.= ", owner_address";
|
||||
$sql.= ", currency_code";
|
||||
$sql.= ", rappro";
|
||||
$sql.= ", min_allowed";
|
||||
$sql.= ", min_desired";
|
||||
@ -403,6 +414,16 @@ class Account extends CommonObject
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", '".$this->db->escape($this->account_number)."'";
|
||||
$sql.= ", '".$this->db->escape($this->accountancy_journal)."'";
|
||||
$sql.= ", '".$this->db->escape($this->bank)."'";
|
||||
$sql.= ", '".$this->code_banque."'";
|
||||
$sql.= ", '".$this->code_guichet."'";
|
||||
$sql.= ", '".$this->number."'";
|
||||
$sql.= ", '".$this->cle_rib."'";
|
||||
$sql.= ", '".$this->bic."'";
|
||||
$sql.= ", '".$this->iban."'";
|
||||
$sql.= ", '".$this->db->escape($this->domiciliation)."'";
|
||||
$sql.= ", '".$this->db->escape($this->proprio)."'";
|
||||
$sql.= ", '".$this->db->escape($this->owner_address)."'";
|
||||
$sql.= ", '".$this->currency_code."'";
|
||||
$sql.= ", ".$this->rappro;
|
||||
$sql.= ", ".price2num($this->min_allowed);
|
||||
@ -447,7 +468,7 @@ class Account extends CommonObject
|
||||
$this->error=$this->db->lasterror();
|
||||
return -3;
|
||||
}
|
||||
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
$hookmanager->initHooks(array('bankdao'));
|
||||
$parameters=array('id'=>$this->id);
|
||||
@ -492,8 +513,6 @@ class Account extends CommonObject
|
||||
global $langs,$conf, $hookmanager;
|
||||
|
||||
// Clean parameters
|
||||
if (! $this->min_allowed) $this->min_allowed=0;
|
||||
if (! $this->min_desired) $this->min_desired=0;
|
||||
$this->state_id = ($this->state_id?$this->state_id:$this->state_id);
|
||||
$this->country_id = ($this->country_id?$this->country_id:$this->country_id);
|
||||
|
||||
@ -524,10 +543,21 @@ class Account extends CommonObject
|
||||
$sql.= ",account_number = '".$this->account_number."'";
|
||||
$sql.= ",accountancy_journal = '".$this->accountancy_journal."'";
|
||||
|
||||
$sql.= ",bank = '".$this->db->escape($this->bank)."'";
|
||||
$sql.= ",code_banque='".$this->code_banque."'";
|
||||
$sql.= ",code_guichet='".$this->code_guichet."'";
|
||||
$sql.= ",number='".$this->number."'";
|
||||
$sql.= ",cle_rib='".$this->cle_rib."'";
|
||||
$sql.= ",bic='".$this->bic."'";
|
||||
$sql.= ",iban_prefix = '".$this->iban."'";
|
||||
$sql.= ",domiciliation='".$this->db->escape($this->domiciliation)."'";
|
||||
$sql.= ",proprio = '".$this->db->escape($this->proprio)."'";
|
||||
$sql.= ",owner_address = '".$this->db->escape($this->owner_address)."'";
|
||||
|
||||
$sql.= ",currency_code = '".$this->currency_code."'";
|
||||
|
||||
$sql.= ",min_allowed = '".price2num($this->min_allowed)."'";
|
||||
$sql.= ",min_desired = '".price2num($this->min_desired)."'";
|
||||
$sql.= ",min_allowed = ".($this->min_allowed != '' ? price2num($this->min_allowed) : "null");
|
||||
$sql.= ",min_desired = ".($this->min_desired != '' ? price2num($this->min_desired) : "null");
|
||||
$sql.= ",comment = '".$this->db->escape($this->comment)."'";
|
||||
|
||||
$sql.= ",state_id = ".($this->state_id>0?"'".$this->state_id."'":"null");
|
||||
@ -540,7 +570,7 @@ class Account extends CommonObject
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
$hookmanager->initHooks(array('bankdao'));
|
||||
$parameters=array('id'=>$this->id);
|
||||
@ -557,8 +587,8 @@ class Account extends CommonObject
|
||||
}
|
||||
}
|
||||
else if ($reshook < 0) return -1;
|
||||
|
||||
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
@ -704,15 +734,15 @@ class Account extends CommonObject
|
||||
$this->min_allowed = $obj->min_allowed;
|
||||
$this->min_desired = $obj->min_desired;
|
||||
$this->comment = $obj->comment;
|
||||
|
||||
|
||||
// Retreive all extrafield for thirdparty
|
||||
// fetch optionals attributes and labels
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
|
||||
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
@ -744,7 +774,7 @@ class Account extends CommonObject
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
|
||||
|
||||
// Remove extrafields
|
||||
if ((empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
||||
{
|
||||
@ -755,7 +785,7 @@ class Account extends CommonObject
|
||||
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
@ -887,7 +917,7 @@ class Account extends CommonObject
|
||||
*
|
||||
* @param User $user Objet user
|
||||
* @param int $filteraccountid To get info for a particular account id
|
||||
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
||||
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
||||
*/
|
||||
function load_board($user,$filteraccountid=0)
|
||||
{
|
||||
@ -910,7 +940,7 @@ class Account extends CommonObject
|
||||
$langs->load("banks");
|
||||
$now=dol_now();
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/WorkboardResponse.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
|
||||
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay=$conf->bank->rappro->warning_delay/60/60/24;
|
||||
@ -938,9 +968,9 @@ class Account extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Renvoie nom clicable (avec eventuellement le picto)
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
* @param int $withpicto Inclut le picto dans le lien
|
||||
* @param int $withpicto Include picto into link
|
||||
* @param string $mode ''=Link to card, 'transactions'=Link to transactions card
|
||||
* @return string Chaine avec URL
|
||||
*/
|
||||
@ -958,17 +988,17 @@ class Account extends CommonObject
|
||||
|
||||
if (empty($mode))
|
||||
{
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id.$linkclose;
|
||||
$lienfin='</a>';
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id.$linkclose;
|
||||
$linkend='</a>';
|
||||
}
|
||||
else if ($mode == 'transactions')
|
||||
{
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$this->id.$linkclose;
|
||||
$lienfin='</a>';
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$this->id.$linkclose;
|
||||
$linkend='</a>';
|
||||
}
|
||||
|
||||
if ($withpicto) $result.=($lien.img_object($label, 'account', 'class="classfortooltip"').$lienfin.' ');
|
||||
$result.=$lien.$this->label.$lienfin;
|
||||
if ($withpicto) $result.=($link.img_object($label, 'account', 'class="classfortooltip"').$linkend.' ');
|
||||
$result.=$link.$this->label.$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -1044,7 +1074,7 @@ class Account extends CommonObject
|
||||
*
|
||||
* @return int 0=No bank code need + Account number is enough
|
||||
* 1=Need 2 fields for bank code: Bank, Desk (France, Spain, ...) + Account number and key
|
||||
* 2=Neek 1 field for bank code: Bank only (Sort code for Great Britain, BSB for Australia) + Account number
|
||||
* 2=Need 1 field for bank code: Bank only (Sort code for Great Britain, BSB for Australia) + Account number
|
||||
*/
|
||||
function useDetailedBBAN()
|
||||
{
|
||||
@ -1491,9 +1521,9 @@ class AccountLine extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Renvoie nom clicable (avec eventuellement le picto)
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param int $maxlen Longueur max libelle
|
||||
* @param string $option Option ('showall')
|
||||
* @return string Chaine avec URL
|
||||
@ -1504,11 +1534,11 @@ class AccountLine extends CommonObject
|
||||
|
||||
$result='';
|
||||
$label=$langs->trans("ShowTransaction").': '.$this->rowid;
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$this->rowid.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$lienfin='</a>';
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$this->rowid.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($withpicto) $result.=($lien.img_object($label, 'account', 'class="classfortooltip"').$lienfin.' ');
|
||||
$result.=$lien.$this->rowid.$lienfin;
|
||||
if ($withpicto) $result.=($link.img_object($label, 'account', 'class="classfortooltip"').$linkend.' ');
|
||||
$result.=$link.$this->rowid.$linkend;
|
||||
|
||||
if ($option == 'showall' || $option == 'showconciliated') $result.=' (';
|
||||
if ($option == 'showall')
|
||||
|
||||
@ -841,8 +841,8 @@ if ($mode == 'standard')
|
||||
if ($nextmonth > 12) { $nextmonth=1; $nextyear++; }
|
||||
|
||||
// For month
|
||||
$lien="<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"]!='all'?'':'&option=all')."&year=".$prevyear."&month=".$prevmonth."'>".img_previous()."</a> ".$langs->trans("Month")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".$nextyear."&month=".$nextmonth."'>".img_next()."</a>";
|
||||
print '<tr><td align="right">'.$lien.'</td></tr>';
|
||||
$link="<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"]!='all'?'':'&option=all')."&year=".$prevyear."&month=".$prevmonth."'>".img_previous()."</a> ".$langs->trans("Month")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".$nextyear."&month=".$nextmonth."'>".img_next()."</a>";
|
||||
print '<tr><td align="right">'.$link.'</td></tr>';
|
||||
|
||||
print '<tr><td align="center">';
|
||||
$file = "movement".$account."-".$year.$month.".png";
|
||||
@ -855,8 +855,8 @@ if ($mode == 'standard')
|
||||
|
||||
// For year
|
||||
$prevyear=$year-1;$nextyear=$year+1;
|
||||
$lien="<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"]!='all'?'':'&option=all')."&year=".($prevyear)."'>".img_previous()."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".($nextyear)."'>".img_next()."</a>";
|
||||
print '<tr><td align="right">'.$lien.'</td></tr>';
|
||||
$link="<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"]!='all'?'':'&option=all')."&year=".($prevyear)."'>".img_previous()."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".($nextyear)."'>".img_next()."</a>";
|
||||
print '<tr><td align="right">'.$link.'</td></tr>';
|
||||
|
||||
print '<tr><td align="center">';
|
||||
print $show5;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copytight (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.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
|
||||
@ -174,7 +174,11 @@ foreach ($accounts as $key=>$type)
|
||||
$total[$acc->currency_code] += $solde;
|
||||
}
|
||||
}
|
||||
if (! $found) print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'</td></tr>';
|
||||
if (! $found)
|
||||
{
|
||||
$var = !$var;
|
||||
print '<tr '.$bc[false].'><td colspan="6">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
// Total
|
||||
foreach ($total as $key=>$solde)
|
||||
{
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -21,7 +22,7 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/bank/ligne.php
|
||||
* \ingroup compta
|
||||
* \ingroup bank
|
||||
* \brief Page to edit a bank transaction record
|
||||
*/
|
||||
|
||||
@ -33,6 +34,7 @@ $langs->load("categories");
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
if (! empty($conf->adherent->enabled)) $langs->load("members");
|
||||
if (! empty($conf->don->enabled)) $langs->load("donations");
|
||||
|
||||
|
||||
$id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('account','int'));
|
||||
@ -350,6 +352,12 @@ if ($result)
|
||||
print img_object($langs->trans('ShowMember'),'user').' ';
|
||||
print $links[$key]['label'];
|
||||
print '</a>';
|
||||
}
|
||||
else if ($links[$key]['type']=='payment_donation') {
|
||||
print '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$links[$key]['url_id'].'">';
|
||||
print img_object($langs->trans('ShowDonation'),'payment').' ';
|
||||
print $langs->trans("DonationPayment");
|
||||
print '</a>';
|
||||
}
|
||||
else if ($links[$key]['type']=='banktransfert') {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$links[$key]['url_id'].'">';
|
||||
|
||||
@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
|
||||
$langs->load("banks");
|
||||
$langs->load("categories");
|
||||
@ -128,7 +128,7 @@ if (! empty($type))
|
||||
{
|
||||
$sql.= " AND b.fk_type = '".$db->escape($type)."' ";
|
||||
}
|
||||
//Search period criteria
|
||||
// Search period criteria
|
||||
if (dol_strlen($search_dt_start)>0) {
|
||||
$sql .= " AND b.dateo >= '" . $db->idate($search_dt_start) . "'";
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copytight (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
/* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008-2009 Laurent Destailleur (Eldy) <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
*
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copytight (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copytight (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@ -93,9 +93,10 @@ if ($conf->salaries->enabled)
|
||||
|
||||
print_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
|
||||
|
||||
$sql = "SELECT s.rowid, s.amount, s.label, s.datev as dm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
|
||||
$sql.= " WHERE s.entity = ".$conf->entity;
|
||||
$sql = "SELECT s.rowid, s.amount, s.label, s.datev as dm, s.salary, u.salary as current_salary";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE s.entity IN (".getEntity('user',1).")";
|
||||
$sql.= " AND u.rowid = s.fk_user";
|
||||
if ($year > 0)
|
||||
{
|
||||
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
|
||||
@ -132,11 +133,11 @@ if ($conf->salaries->enabled)
|
||||
|
||||
print "<td>".$obj->label."</td>\n";
|
||||
|
||||
print '<td align="right">'.price($obj->amount)."</td>";
|
||||
print '<td align="right">'.($obj->salary?price($obj->salary):'')."</td>";
|
||||
|
||||
// Ref payment
|
||||
$sal_static->id=$obj->rowid;
|
||||
$sal_static->ref=$obj->rowid;
|
||||
$sal_static->id=$obj->rowid;
|
||||
$sal_static->ref=$obj->rowid;
|
||||
print '<td align="left">'.$sal_static->getNomUrl(1)."</td>\n";
|
||||
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
|
||||
@ -146,7 +147,7 @@ if ($conf->salaries->enabled)
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
print '<td align="right">'."</td>";
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
|
||||
@ -349,7 +349,7 @@ class Deplacement extends CommonObject
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @return string Chaine avec URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0)
|
||||
@ -359,15 +359,15 @@ class Deplacement extends CommonObject
|
||||
$result='';
|
||||
$label=$langs->trans("Show").': '.$this->ref;
|
||||
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/deplacement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$lienfin='</a>';
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/compta/deplacement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
$picto='trip';
|
||||
|
||||
|
||||
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
||||
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
||||
if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
@ -58,6 +58,7 @@ $langs->load('compta');
|
||||
$langs->load('products');
|
||||
$langs->load('banks');
|
||||
$langs->load('main');
|
||||
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
|
||||
if (! empty($conf->margin->enabled))
|
||||
$langs->load('margins');
|
||||
|
||||
@ -318,6 +319,12 @@ if (empty($reshook))
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
// Set incoterm
|
||||
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled))
|
||||
{
|
||||
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||
}
|
||||
|
||||
// bank account
|
||||
else if ($action == 'setbankaccount' && $user->rights->facture->creer)
|
||||
{
|
||||
@ -680,6 +687,8 @@ if (empty($reshook))
|
||||
$object->fk_account = GETPOST('fk_account', 'int');
|
||||
$object->remise_absolue = $_POST['remise_absolue'];
|
||||
$object->remise_percent = $_POST['remise_percent'];
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
|
||||
// Proprietes particulieres a facture de remplacement
|
||||
$object->fk_facture_source = $_POST['fac_replacement'];
|
||||
@ -724,6 +733,8 @@ if (empty($reshook))
|
||||
$object->fk_account = GETPOST('fk_account', 'int');
|
||||
$object->remise_absolue = $_POST['remise_absolue'];
|
||||
$object->remise_percent = $_POST['remise_percent'];
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
|
||||
// Proprietes particulieres a facture avoir
|
||||
$object->fk_facture_source = $_POST['fac_avoir'];
|
||||
@ -852,6 +863,8 @@ if (empty($reshook))
|
||||
$object->amount = $_POST['amount'];
|
||||
$object->remise_absolue = $_POST['remise_absolue'];
|
||||
$object->remise_percent = $_POST['remise_percent'];
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
|
||||
if (GETPOST('type') == Facture::TYPE_SITUATION)
|
||||
{
|
||||
@ -1949,11 +1962,11 @@ if ($action == 'create')
|
||||
// Outstanding Bill
|
||||
$outstandigBills = $soc->get_OutstandingBill();
|
||||
print ' (' . $langs->trans('CurrentOutstandingBill') . ': ';
|
||||
print price($outstandigBills, '', $langs, 0, 0, - 1, $conf->currency);
|
||||
print price($outstandigBills, '', $langs, 0, 0, -1, $conf->currency);
|
||||
if ($soc->outstanding_limit != '')
|
||||
{
|
||||
if ($outstandigBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
|
||||
print ' / ' . price($soc->outstanding_limit);
|
||||
print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency);
|
||||
}
|
||||
print ')';
|
||||
print '</td>';
|
||||
@ -2267,6 +2280,16 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $objectsrc->libelle_incoterms, 1).'</label></td>';
|
||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||
print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms)?$objectsrc->location_incoterms:''));
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"');
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
|
||||
@ -2564,7 +2587,7 @@ if ($action == 'create')
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
|
||||
$notify = new Notify($db);
|
||||
$text .= '<br>';
|
||||
$text .= $notify->confirmMessage('BILL_VALIDATE', $object->socid);
|
||||
$text .= $notify->confirmMessage('BILL_VALIDATE', $object->socid, $object);
|
||||
}
|
||||
$formquestion = array();
|
||||
|
||||
@ -2726,8 +2749,9 @@ if ($action == 'create')
|
||||
|
||||
if (! $formconfirm) {
|
||||
$parameters = array('lineid' => $lineid);
|
||||
$formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by
|
||||
// hook
|
||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
||||
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
|
||||
}
|
||||
|
||||
// Print form confirm
|
||||
@ -3367,6 +3391,29 @@ if ($action == 'create')
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
{
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('IncotermLabel');
|
||||
print '<td><td align="right">';
|
||||
if ($user->rights->facture->creer) print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||
else print ' ';
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
if ($action != 'editincoterm')
|
||||
{
|
||||
print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$cols = 5;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
@ -547,9 +547,9 @@ class FactureRec extends Facture
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoie nom clicable (avec eventuellement le picto)
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param string $option Sur quoi pointe le lien ('', 'withdraw')
|
||||
* @return string Chaine avec URL
|
||||
*/
|
||||
@ -560,15 +560,15 @@ class FactureRec extends Facture
|
||||
$result='';
|
||||
$label=$langs->trans("ShowInvoice").': '.$this->ref;
|
||||
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/facture/fiche-rec.php?facid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$lienfin='</a>';
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/compta/facture/fiche-rec.php?facid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
$picto='bill';
|
||||
|
||||
|
||||
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
||||
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
||||
if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -136,6 +136,11 @@ class Facture extends CommonInvoice
|
||||
var $specimen;
|
||||
|
||||
var $fac_rec;
|
||||
|
||||
//Incoterms
|
||||
var $fk_incoterms;
|
||||
var $location_incoterms;
|
||||
var $libelle_incoterms; //Used into tooltip
|
||||
|
||||
/**
|
||||
* @var int Situation cycle reference number
|
||||
@ -283,6 +288,8 @@ class Facture extends CommonInvoice
|
||||
$this->mode_reglement_id = $_facrec->mode_reglement_id;
|
||||
$this->remise_absolue = $_facrec->remise_absolue;
|
||||
$this->remise_percent = $_facrec->remise_percent;
|
||||
$this->fk_incoterms = $_facrec->fk_incoterms;
|
||||
$this->location_incoterms= $_facrec->location_incoterms;
|
||||
|
||||
// Clean parametres
|
||||
if (! $this->type) $this->type = self::TYPE_STANDARD;
|
||||
@ -317,6 +324,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= ", fk_facture_source, fk_user_author, fk_projet";
|
||||
$sql.= ", fk_cond_reglement, fk_mode_reglement, date_lim_reglement, model_pdf";
|
||||
$sql.= ", situation_cycle_ref, situation_counter, situation_final";
|
||||
$sql.= ", fk_incoterms, location_incoterms";
|
||||
$sql.= ")";
|
||||
$sql.= " VALUES (";
|
||||
$sql.= "'(PROV)'";
|
||||
@ -342,6 +350,8 @@ class Facture extends CommonInvoice
|
||||
$sql.= ", ".($this->situation_cycle_ref?"'".$this->db->escape($this->situation_cycle_ref)."'":"null");
|
||||
$sql.= ", ".($this->situation_counter?"'".$this->db->escape($this->situation_counter)."'":"null");
|
||||
$sql.= ", ".($this->situation_final?$this->situation_final:0);
|
||||
$sql.= ", ".(int) $this->fk_incoterms;
|
||||
$sql.= ", '".$this->db->escape($this->location_incoterms)."'";
|
||||
$sql.=")";
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
@ -963,9 +973,12 @@ class Facture extends CommonInvoice
|
||||
$sql.= ', f.fk_account';
|
||||
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
|
||||
$sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc';
|
||||
$sql.= ', f.fk_incoterms, f.location_incoterms';
|
||||
$sql.= ", i.libelle as libelle_incoterms";
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON f.fk_incoterms = i.rowid';
|
||||
$sql.= ' WHERE f.entity = '.$conf->entity;
|
||||
if ($rowid) $sql.= " AND f.rowid=".$rowid;
|
||||
if ($ref) $sql.= " AND f.facnumber='".$this->db->escape($ref)."'";
|
||||
@ -1025,6 +1038,11 @@ class Facture extends CommonInvoice
|
||||
$this->situation_final = $obj->situation_final;
|
||||
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
||||
|
||||
//Incoterms
|
||||
$this->fk_incoterms = $obj->fk_incoterms;
|
||||
$this->location_incoterms = $obj->location_incoterms;
|
||||
$this->libelle_incoterms = $obj->libelle_incoterms;
|
||||
|
||||
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
|
||||
|
||||
// Retreive all extrafield for invoice
|
||||
@ -3269,6 +3287,8 @@ class Facture extends CommonInvoice
|
||||
$this->note_public='This is a comment (public)';
|
||||
$this->note_private='This is a comment (private)';
|
||||
$this->note='This is a comment (private)';
|
||||
$this->fk_incoterms=0;
|
||||
$this->location_incoterms='';
|
||||
|
||||
if (empty($option) || $option != 'nolines')
|
||||
{
|
||||
@ -3624,16 +3644,12 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
class FactureLigne extends CommonInvoiceLine
|
||||
{
|
||||
var $db;
|
||||
var $error;
|
||||
|
||||
public $element='facturedet';
|
||||
public $table_element='facturedet';
|
||||
|
||||
var $oldline;
|
||||
|
||||
//! From llx_facturedet
|
||||
var $rowid;
|
||||
//! Id facture
|
||||
var $fk_facture;
|
||||
//! Id parent line
|
||||
@ -3641,17 +3657,9 @@ class FactureLigne extends CommonInvoiceLine
|
||||
var $label; // deprecated
|
||||
//! Description ligne
|
||||
var $desc;
|
||||
var $fk_product; // Id of predefined product
|
||||
var $product_type = 0; // Type 0 = product, 1 = Service
|
||||
|
||||
var $qty; // Quantity (example 2)
|
||||
var $tva_tx; // Taux tva produit/service (example 19.6)
|
||||
var $localtax1_tx; // Local tax 1
|
||||
var $localtax2_tx; // Local tax 2
|
||||
var $localtax1_type; // Local tax 1 type
|
||||
var $localtax2_type; // Local tax 2 type
|
||||
var $subprice; // P.U. HT (example 100)
|
||||
var $remise_percent; // % de la remise ligne (example 20%)
|
||||
var $fk_remise_except; // Link to line into llx_remise_except
|
||||
var $rang = 0;
|
||||
|
||||
@ -3660,10 +3668,6 @@ class FactureLigne extends CommonInvoiceLine
|
||||
var $marge_tx;
|
||||
var $marque_tx;
|
||||
|
||||
var $info_bits = 0; // Liste d'options cumulables:
|
||||
// Bit 0: 0 si TVA normal - 1 si TVA NPR
|
||||
// Bit 1: 0 si ligne normal - 1 si bit discount (link to line into llx_remise_except)
|
||||
|
||||
var $special_code; // Liste d'options non cumulabels:
|
||||
// 1: frais de port
|
||||
// 2: ecotaxe
|
||||
@ -3672,15 +3676,6 @@ class FactureLigne extends CommonInvoiceLine
|
||||
var $origin;
|
||||
var $origin_id;
|
||||
|
||||
//! Total HT de la ligne toute quantite et incluant la remise ligne
|
||||
var $total_ht;
|
||||
//! Total TVA de la ligne toute quantite et incluant la remise ligne
|
||||
var $total_tva;
|
||||
var $total_localtax1; //Total Local tax 1 de la ligne
|
||||
var $total_localtax2; //Total Local tax 2 de la ligne
|
||||
//! Total TTC de la ligne toute quantite et incluant la remise ligne
|
||||
var $total_ttc;
|
||||
|
||||
var $fk_code_ventilation = 0;
|
||||
|
||||
var $date_start;
|
||||
@ -3709,16 +3704,6 @@ class FactureLigne extends CommonInvoiceLine
|
||||
*/
|
||||
public $fk_prev_id;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load invoice line from database
|
||||
*
|
||||
|
||||
@ -187,13 +187,13 @@ if ($search_societe)
|
||||
{
|
||||
$sql .= natural_search('s.nom', $search_societe);
|
||||
}
|
||||
if ($search_montant_ht)
|
||||
if ($search_montant_ht != '')
|
||||
{
|
||||
$sql.= ' AND f.total = \''.$db->escape(price2num(trim($search_montant_ht))).'\'';
|
||||
$sql.= natural_search('f.total', $search_montant_ht, 1);
|
||||
}
|
||||
if ($search_montant_ttc)
|
||||
if ($search_montant_ttc != '')
|
||||
{
|
||||
$sql.= ' AND f.total_ttc = \''.$db->escape(price2num(trim($search_montant_ttc))).'\'';
|
||||
$sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
|
||||
}
|
||||
if ($search_status != '')
|
||||
{
|
||||
@ -263,8 +263,8 @@ if ($resql)
|
||||
if ($search_societe) $param.='&search_societe=' .$search_societe;
|
||||
if ($search_sale > 0) $param.='&search_sale=' .$search_sale;
|
||||
if ($search_user > 0) $param.='&search_user=' .$search_user;
|
||||
if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht;
|
||||
if ($search_montant_ttc) $param.='&search_montant_ttc='.$search_montant_ttc;
|
||||
if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht;
|
||||
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc;
|
||||
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
|
||||
|
||||
$i = 0;
|
||||
@ -323,9 +323,9 @@ if ($resql)
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="left"> </td>';
|
||||
print '<td class="liste_titre" align="left"><input class="flat" type="text" name="search_societe" value="'.$search_societe.'"></td>';
|
||||
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="10" name="search_montant_ht" value="'.$search_montant_ht.'"></td>';
|
||||
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_montant_ht" value="'.$search_montant_ht.'"></td>';
|
||||
print '<td class="liste_titre" align="right"> </td>';
|
||||
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="10" name="search_montant_ttc" value="'.$search_montant_ttc.'"></td>';
|
||||
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_montant_ttc" value="'.$search_montant_ttc.'"></td>';
|
||||
print '<td class="liste_titre" align="right"> </td>';
|
||||
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
|
||||
@ -196,7 +196,7 @@ if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
|
||||
|
||||
if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire)
|
||||
{
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, x.rowid, x.date_debut as date, x.tms as dm, x.total_ttc";
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, x.rowid, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as x, ".MAIN_DB_PREFIX."user as u";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE u.rowid = x.fk_user_author";
|
||||
@ -218,7 +218,7 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("BoxTitleLastModifiedExpenses",min($max,$num)).'</td>';
|
||||
print '<td align="right">'.$langs->trans("FeesAmount").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalTTC").'</td>';
|
||||
print '<td align="right">'.$langs->trans("DateModificationShort").'</td>';
|
||||
print '<td width="16"> </td>';
|
||||
print '</tr>';
|
||||
@ -239,9 +239,9 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$expensereportstatic->getNomUrl(1).'</td>';
|
||||
print '<td>'.$userstatic->getNomUrl(1).'</td>';
|
||||
print '<td align="right">'.$obj->total_ttc.'</td>';
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td align="right">'.dol_print_date($db->jdate($obj->dm),'day').'</td>';
|
||||
//print '<td>'.$expensereportstatic->LibStatut($obj->fk_statut,3).'</td>';
|
||||
print '<td>'.$expensereportstatic->LibStatut($obj->status,3).'</td>';
|
||||
print '</tr>';
|
||||
$var=!$var;
|
||||
$i++;
|
||||
|
||||
@ -127,7 +127,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire)
|
||||
if (! empty($conf->don->enabled) && $user->rights->don->lire)
|
||||
{
|
||||
$langs->load("donations");
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/compta/dons/list.php">';
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/don/list.php">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="noborder nohover" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchADonation").'</td></tr>';
|
||||
@ -497,7 +497,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
// Last donations
|
||||
if (! empty($conf->don->enabled) && $user->rights->societe->lire)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/dons/class/don.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
|
||||
|
||||
$langs->load("boxes");
|
||||
$donationstatic=new Don($db);
|
||||
|
||||
@ -582,14 +582,14 @@ class Localtax extends CommonObject
|
||||
$result='';
|
||||
$label=$langs->trans("ShowVatPayment").': '.$this->ref;
|
||||
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/localtax/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$lienfin='</a>';
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/compta/localtax/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
$picto='payment';
|
||||
|
||||
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin);
|
||||
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
||||
if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -768,9 +768,9 @@ class RemiseCheque extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoie nom clicable (avec eventuellement le picto)
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param string $option Sur quoi pointe le lien
|
||||
* @return string Chaine avec URL
|
||||
*/
|
||||
@ -781,12 +781,12 @@ class RemiseCheque extends CommonObject
|
||||
$result='';
|
||||
$label = $langs->trans("ShowCheckReceipt").': '.$this->ref;
|
||||
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$lienfin='</a>';
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($withpicto) $result.=($lien.img_object($label, 'payment', 'class="classfortooltip"').$lienfin);
|
||||
if ($withpicto) $result.=($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
||||
if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -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
|
||||
* @return string Chaine avec URL
|
||||
*/
|
||||
@ -750,12 +750,12 @@ class Paiement extends CommonObject
|
||||
$result='';
|
||||
$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">';
|
||||
$lienfin='</a>';
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$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 != 2) $result.=$lien.$this->ref.$lienfin;
|
||||
if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -178,7 +178,7 @@ if ($_GET["action"] == 'create')
|
||||
|
||||
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("Type")."</td><td colspan=\"2\">".$charge->type_libelle."</td></tr>\n";
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user