forked from Wavyzz/dolibarr
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -76,9 +76,9 @@ script:
|
||||
# - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/AllTests.php
|
||||
# - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/BuildDocTest.php
|
||||
# - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/WebservicesOtherTest.php
|
||||
# - phpcs --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ .
|
||||
# - phpcs --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ htdocs/core/class/dolgraph.class.php
|
||||
- phpcs --warning-severity=0 -s --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ .
|
||||
- phpcs --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ .
|
||||
# - phpcs --warning-severity=0 -s --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ .
|
||||
- phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||
|
||||
after_script:
|
||||
|
||||
36
ChangeLog
36
ChangeLog
@@ -6,8 +6,8 @@ English Dolibarr ChangeLog
|
||||
For users:
|
||||
- New: Add hidden option BANK_DISABLE_DIRECT_INPUT.
|
||||
- New: More options to select status of users into select user list.
|
||||
- New: [ task #862 ] Add ODT on shipments
|
||||
- New: [ task #149 ] Add # of notes and attachments in tabs
|
||||
- New: [ task #862 ] Add ODT on shipments.
|
||||
- New: [ task #149 ] Add # of notes and attachments in tabs.
|
||||
- New: Can edit customer ref at eny time.
|
||||
- New: [ task #877 ] Reorganize menus.
|
||||
- New: [ task #858 ] Holiday module: note on manual holiday assignation.
|
||||
@@ -40,20 +40,22 @@ For users:
|
||||
- New: Add Maghreb regions and departments.
|
||||
- New: A more responsive desgin for statistic box of home page.
|
||||
- Qual: Implement same rule for return value of all command line scripts (0 when success, <>0 if error).
|
||||
- New: [ task #1005 ] Adapting to Spanish legislation bill numbering
|
||||
- New: [ task #1011 ] Now supplier order and invoice deal with payment terms and mode
|
||||
- New: [ task #1014 ] Add option to recursivly add parent category
|
||||
- New: [ task #1016 ] Can define a specific numbering for deposits
|
||||
- New: [ task #918 ] Stock replenishment
|
||||
- Fix: [ bug #992 ] Proforma invoices don't have a separated numeric count
|
||||
- New: Add pdf link into supplier invoice list and supplier order list
|
||||
- New: Genrate auto the PDF for supplier invoice
|
||||
- New: Add category into filter webservice thirdparty method getListOfThirdParties
|
||||
- New: Allow to define margin or mark rate during quoting, ordering, invoicing
|
||||
- New: User permissions on margin module
|
||||
- New: Add ref supplier into muscadet model
|
||||
- New: [ task #1005 ] Adapting to Spanish legislation bill numbering.
|
||||
- New: [ task #1011 ] Now supplier order and invoice deal with payment terms and mode.
|
||||
- New: [ task #1014 ] Add option to recursivly add parent category.
|
||||
- New: [ task #1016 ] Can define a specific numbering for deposits.
|
||||
- New: [ task #918 ] Stock replenishment.
|
||||
- Fix: [ bug #992 ] Proforma invoices don't have a separated numeric count.
|
||||
- New: Add pdf link into supplier invoice list and supplier order list.
|
||||
- New: Genrate auto the PDF for supplier invoice.
|
||||
- New: Add category into filter webservice thirdparty method getListOfThirdParties.
|
||||
- New: Allow to define margin or mark rate during quoting, ordering, invoicing.
|
||||
- New: User permissions on margin module.
|
||||
- New: Add ref supplier into muscadet model.
|
||||
- New: Can use tag {mm} before {yy} even when there is a reset into numbering masks.
|
||||
- New: [ task #1060 ] Register fields localtax(1|2)_type into details tables
|
||||
- New: [ task #1060 ] Register fields localtax(1|2)_type into details tables.
|
||||
- New: [ task #923 ] Localtax support for ODT templates.
|
||||
- New: [ task #90 ] Barcode search.
|
||||
|
||||
For translators:
|
||||
- Qual: Normalized sort order of all languages files with english reference files.
|
||||
@@ -103,6 +105,8 @@ All content added must be tagged by a '<div>' with css class="login_block_elem"
|
||||
this was not a good pratice, since object->id is already known, there is no need to provide id as
|
||||
parameter. All methods addline in this case were modified to remove this parameter.
|
||||
|
||||
4) Method ->classer_facturee() is deprecated. It must be replace with ->classifyBilled().
|
||||
|
||||
|
||||
***** ChangeLog for 3.4.1 compared to 3.4.0 *****
|
||||
Fix: Display buying price on line edit when no supplier price is defined
|
||||
@@ -127,7 +131,7 @@ Fix: Edit propal line was losing product supplier price id
|
||||
Fix: Delete linked element to supplier invoice when deleted
|
||||
Fix: [ bug #1061 ] Bad info shipped products
|
||||
Fix: [ bug #1062 ] Documents lost in propals and contracts validating
|
||||
Fix: Supplier price displayed on document lines didnt take discount
|
||||
Fix: Supplier price displayed on document lines and margin infos didnt take discount
|
||||
Qual: Add travis-ci integration
|
||||
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ with format .DEB (for Debian, Ubuntu, ...).
|
||||
|
||||
# To build a debian package, you need first
|
||||
# With Ubuntu 12.04
|
||||
# apt-get install debhelper dpkg-source gpg lintian git-buildpackage pkg-php-tools schroot sbuild
|
||||
# apt-get install debhelper dpkg-source gpg lintian git-buildpackage pkg-php-tools schroot sbuild dh-linktree dh-make-php
|
||||
# With Debian 7
|
||||
# apt-get install debhelper dpkg gnupg lintian git-buildpackage pkg-php-tools schroot sbuild
|
||||
# apt-get install debhelper dpkg gnupg lintian git-buildpackage pkg-php-tools schroot sbuild dh-linktree dh-make-php
|
||||
|
||||
|
||||
# To generate gpg key for email used into changelog
|
||||
@@ -125,25 +125,29 @@ from origin/upstream and origin/pristine.
|
||||
* Staying into git root directory, run
|
||||
> git-import-orig -vv ../tcpdf_x.y.z+dfsg.orig.tar.xz
|
||||
|
||||
Note: If there was errors managed manually, you may need to make a git commit
|
||||
Note: If there was errors solved manually, you may need to make a git commit
|
||||
|
||||
* Add an entry into debian/changelog
|
||||
> dh "My comment" will add entry.
|
||||
For example: dch -v x.y.z-1 "New upstream release." for a new version
|
||||
|
||||
Warning: Date must have format reported by "date -R"
|
||||
Warning: Entry added here is used by next step. Name and email must match value into debian/control file.
|
||||
Warning: Name and email must match value into debian/control file (Entry added here is used by next step).
|
||||
|
||||
* We try to build package
|
||||
> rm -fr ../build-area
|
||||
> git-buildpackage -us -uc
|
||||
|
||||
Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file
|
||||
|
||||
|
||||
* If package .deb is ok:
|
||||
Note: If there was errors managed manually, you may need to make a git commit but do not use option "amend" previous commit
|
||||
> git-buildpackage --git-tag
|
||||
> git push --all
|
||||
> git push --all ou git push origin --all
|
||||
> git push --tags
|
||||
|
||||
* Compilation par un développeur debian et envoi par
|
||||
* Compilation is then done by a debian developer and sent
|
||||
> sbuild ...
|
||||
> dput ...
|
||||
|
||||
@@ -170,3 +174,41 @@ from git clone dir and make link to git.
|
||||
* If local branch upstream and pristine-tar does not exists, create it
|
||||
from origin/upstream and origin/pristine.
|
||||
|
||||
* If new upstream is available onto sourceforge, launch:
|
||||
> debian/get-orig-source.sh
|
||||
|
||||
* Staying into git root directory, run
|
||||
> git-import-orig -vv ../dolibarr-3.3.4.tgz
|
||||
|
||||
Note: If there was errors solved manually after get-orig-sources.sh, you may need to make a git commit
|
||||
|
||||
* Add an entry into debian/changelog
|
||||
> dh "My comment" will add entry.
|
||||
For example: dch -v x.y.z-1 "New upstream release." for a new version
|
||||
Then modify changelog to replace "unstable" with "UNRELEASED".
|
||||
|
||||
Warning: Date must have format reported by "date -R"
|
||||
Warning: Name and email must match value into debian/control file (Entry added here is used by next step).
|
||||
|
||||
* We try to build package
|
||||
> rm -fr ../build-area
|
||||
> git-buildpackage -us -uc
|
||||
|
||||
Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file
|
||||
|
||||
* If package .deb is ok:
|
||||
Note: If there was errors managed manually, you may need to make a git commit but do not use option "amend" previous commit
|
||||
> git-buildpackage --git-tag
|
||||
> git push --all ou git push origin --all
|
||||
> git push --tags
|
||||
|
||||
* Compilation is then done by a debian developer and sent
|
||||
> sbuild ...
|
||||
> dput ...
|
||||
|
||||
* Go into page. You should see new package into unstable.
|
||||
http://packages.qa.debian.org/t/tcpdf.html
|
||||
|
||||
* Package will be into release when test will be moved as stable.
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
# run with
|
||||
# debian/get-orig-source.sh [x.y.z]
|
||||
# Scan for new official sources and download file
|
||||
# run with debian/get-orig-source.sh [x.y.z]
|
||||
|
||||
tmpdir=$(mktemp -d)
|
||||
echo "tmpdir = $tmpdir"
|
||||
@@ -12,29 +12,12 @@ uscan --noconf --force-download --no-symlink --verbose --destdir=$tmpdir $uscan_
|
||||
|
||||
cd $tmpdir
|
||||
|
||||
tgzfile=$(echo *.tar.gz)
|
||||
version=$(echo "$tgzfile" | perl -pi -e 's/^dolibarr_//; s/\.zip$//; s/_/./g; s/\+nmu1//; s/$/+dfsg/;')
|
||||
|
||||
# Extract the zip file
|
||||
tar -xvf $tgzfile
|
||||
srcdir=$(find . -maxdepth 1 -mindepth 1 -type d | sed -e 's/\.\///')
|
||||
|
||||
if [ ! -d "$srcdir" ]; then
|
||||
echo "ERROR: Failed to identify the extracted directory in $tmpdir (got $srcdir)" >&2
|
||||
rm -rf $tmpdir
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Repack as tar.xz
|
||||
tar Jcf dolibarr_${version}.orig.tar.xz $srcdir
|
||||
tgzfile=$(echo *.tgz)
|
||||
version=$(echo "$tgzfile" | perl -pi -e 's/^dolibarr-//; s/\.tgz$//; s/_/./g; s/\+nmu1//; ')
|
||||
|
||||
cd - >/dev/null
|
||||
|
||||
if [ -e ../dolibarr_${version}.orig.tar.xz ]; then
|
||||
echo "Not overwriting ../dolibarr_${version}.orig.tar.xz";
|
||||
else
|
||||
echo "Created ../dolibarr_${version}.orig.tar.xz"
|
||||
mv $tmpdir/dolibarr_${version}.orig.tar.xz ../
|
||||
fi
|
||||
mv $tmpdir/dolibarr-${version}.tgz ../
|
||||
echo "File ../dolibarr-${version}.tgz is ready for git-import"
|
||||
|
||||
#rm -rf $tmpdir
|
||||
rm -rf $tmpdir
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
version=3
|
||||
|
||||
#http://sf.net/dolibarr/dolibarr-(.+)\.tgz
|
||||
http://www.dolibarr.org/files/stable/package_debian-ubuntu/dolibarr_(.+)\.tar\.gz
|
||||
http://www.dolibarr.org/files/stable/standard/dolibarr-(.+)\.tgz
|
||||
|
||||
@@ -340,6 +340,7 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/template`; # Package not valid for most linux distributions (errors reported into compile.js). Package should be embed by modules to avoid problems.
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpmailer`; # Package not valid for most linux distributions (errors reported into file LICENSE). Package should be embed by modules to avoid problems.
|
||||
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/license.txt`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`;
|
||||
|
||||
@@ -31,5 +31,5 @@ How to have such a service ?
|
||||
Try to make "Add file" and select Remote URL and enter http://www.dolibarr.org/files/stable/package_rpm_generic/dolibarr-3.3.2-3.src.rpm
|
||||
|
||||
Then add into advanded - attributes
|
||||
OBS:Screenshots http://www.dolibarr.org/images/phocagallery/dolibarr_screenshot1.png
|
||||
OBS:Screenshots http://www.dolibarr.org/images/dolibarr_screenshot1.png
|
||||
OBS:QualityCategory Testing
|
||||
6
build/sitemap/README
Normal file
6
build/sitemap/README
Normal file
@@ -0,0 +1,6 @@
|
||||
# Format of sitemap file is available at
|
||||
# http://www.sitemaps.org/protocol.html
|
||||
|
||||
# To build a sitemap from urllist-bing.txt, run
|
||||
# google-sitemapgen --config=config-bing.xml --testing
|
||||
|
||||
169
build/sitemap/config-bing.xml
Normal file
169
build/sitemap/config-bing.xml
Normal file
@@ -0,0 +1,169 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
sitemap_gen.py example configuration script
|
||||
|
||||
This file specifies a set of sample input parameters for the
|
||||
sitemap_gen.py client.
|
||||
|
||||
You should copy this file into "config.xml" and modify it for
|
||||
your server.
|
||||
|
||||
|
||||
********************************************************* -->
|
||||
|
||||
|
||||
<!-- ** MODIFY **
|
||||
The "site" node describes your basic web site.
|
||||
|
||||
Required attributes:
|
||||
base_url - the top-level URL of the site being mapped
|
||||
store_into - the webserver path to the desired output file.
|
||||
This should end in '.xml' or '.xml.gz'
|
||||
(the script will create this file)
|
||||
|
||||
Optional attributes:
|
||||
verbose - an integer from 0 (quiet) to 3 (noisy) for
|
||||
how much diagnostic output the script gives
|
||||
suppress_search_engine_notify="1"
|
||||
- disables notifying search engines about the new map
|
||||
(same as the "testing" command-line argument.)
|
||||
default_encoding
|
||||
- names a character encoding to use for URLs and
|
||||
file paths. (Example: "UTF-8")
|
||||
-->
|
||||
<site
|
||||
base_url="http://wiki.dolibarr.org/"
|
||||
store_into="sitemap-wiki-bing.xml.gz"
|
||||
verbose="1"
|
||||
>
|
||||
|
||||
<!-- ********************************************************
|
||||
INPUTS
|
||||
|
||||
All the various nodes in this section control where the script
|
||||
looks to find URLs.
|
||||
|
||||
MODIFY or DELETE these entries as appropriate for your server.
|
||||
********************************************************* -->
|
||||
|
||||
<!-- ** MODIFY or DELETE **
|
||||
"url" nodes specify individual URLs to include in the map.
|
||||
|
||||
Required attributes:
|
||||
href - the URL
|
||||
|
||||
Optional attributes:
|
||||
lastmod - timestamp of last modification (ISO8601 format)
|
||||
changefreq - how often content at this URL is usually updated
|
||||
priority - value 0.0 to 1.0 of relative importance in your site
|
||||
-->
|
||||
<!--
|
||||
<url href="http://www.example.com/stats?q=name" />
|
||||
<url
|
||||
href="http://www.example.com/stats?q=age"
|
||||
lastmod="2004-11-14T01:00:00-07:00"
|
||||
changefreq="yearly"
|
||||
priority="0.3"
|
||||
/>
|
||||
-->
|
||||
|
||||
<!-- ** MODIFY or DELETE **
|
||||
"urllist" nodes name text files with lists of URLs.
|
||||
An example file "example_urllist.txt" is provided.
|
||||
|
||||
Required attributes:
|
||||
path - path to the file
|
||||
|
||||
Optional attributes:
|
||||
encoding - encoding of the file if not US-ASCII
|
||||
-->
|
||||
<urllist path="urllist-wiki.txt" encoding="UTF-8" />
|
||||
|
||||
<!-- ** MODIFY or DELETE **
|
||||
"directory" nodes tell the script to walk the file system
|
||||
and include all files and directories in the Sitemap.
|
||||
|
||||
Required attributes:
|
||||
path - path to begin walking from
|
||||
url - URL equivalent of that path
|
||||
|
||||
Optional attributes:
|
||||
default_file - name of the index or default file for directory URLs
|
||||
-->
|
||||
<!--
|
||||
<directory path="/var/www/icons" url="http://www.example.com/images/" />
|
||||
<directory
|
||||
path="/var/www/docroot"
|
||||
url="http://www.example.com/"
|
||||
default_file="index.html"
|
||||
/>
|
||||
-->
|
||||
|
||||
<!-- ** MODIFY or DELETE **
|
||||
"accesslog" nodes tell the script to scan webserver log files to
|
||||
extract URLs on your site. Both Common Logfile Format (Apache's default
|
||||
logfile) and Extended Logfile Format (IIS's default logfile) can be read.
|
||||
|
||||
Required attributes:
|
||||
path - path to the file
|
||||
|
||||
Optional attributes:
|
||||
encoding - encoding of the file if not US-ASCII
|
||||
-->
|
||||
<!--
|
||||
<accesslog path="/etc/httpd/logs/access.log" encoding="UTF-8" />
|
||||
<accesslog path="/etc/httpd/logs/access.log.0" encoding="UTF-8" />
|
||||
<accesslog path="/etc/httpd/logs/access.log.1.gz" encoding="UTF-8" />
|
||||
-->
|
||||
|
||||
<!-- ** MODIFY or DELETE **
|
||||
"sitemap" nodes tell the script to scan other Sitemap files. This can
|
||||
be useful to aggregate the results of multiple runs of this script into
|
||||
a single Sitemap.
|
||||
|
||||
Required attributes:
|
||||
path - path to the file
|
||||
-->
|
||||
<!--
|
||||
<sitemap path="/var/www/docroot/subpath/sitemap.xml" />
|
||||
-->
|
||||
|
||||
<!-- ********************************************************
|
||||
FILTERS
|
||||
|
||||
Filters specify wild-card patterns that the script compares
|
||||
against all URLs it finds. Filters can be used to exclude
|
||||
certain URLs from your Sitemap, for instance if you have
|
||||
hidden content that you hope the search engines don't find.
|
||||
|
||||
Filters can be either type="wildcard", which means standard
|
||||
path wildcards (* and ?) are used to compare against URLs,
|
||||
or type="regexp", which means regular expressions are used
|
||||
to compare.
|
||||
|
||||
Filters are applied in the order specified in this file.
|
||||
|
||||
An action="drop" filter causes exclusion of matching URLs.
|
||||
An action="pass" filter causes inclusion of matching URLs,
|
||||
shortcutting any other later filters that might also match.
|
||||
If no filter at all matches a URL, the URL will be included.
|
||||
Together you can build up fairly complex rules.
|
||||
|
||||
The default action is "drop".
|
||||
The default type is "wildcard".
|
||||
|
||||
You can MODIFY or DELETE these entries as appropriate for
|
||||
your site. However, unlike above, the example entries in
|
||||
this section are not contrived and may be useful to you as
|
||||
they are.
|
||||
********************************************************* -->
|
||||
|
||||
<!-- Exclude URLs that end with a '~' (IE: emacs backup files) -->
|
||||
<filter action="drop" type="wildcard" pattern="*~" />
|
||||
|
||||
<!-- Exclude URLs within UNIX-style hidden files or directories -->
|
||||
<filter action="drop" type="regexp" pattern="/\.[^/]*" />
|
||||
|
||||
<filter action="drop" type="regexp" pattern="title=" />
|
||||
|
||||
</site>
|
||||
1
build/sitemap/urllist-wiki.txt
Normal file
1
build/sitemap/urllist-wiki.txt
Normal file
@@ -0,0 +1 @@
|
||||
http://wiki.dolibarr.org/
|
||||
@@ -37,8 +37,6 @@ htdocs/customleave
|
||||
htdocs/customgoogle
|
||||
htdocs/document
|
||||
htdocs/documents
|
||||
htdocs/includes/ckeditor/_source
|
||||
htdocs/includes/ckeditor/*_source.js
|
||||
htdocs/includes/fckeditor/_samples
|
||||
htdocs/includes/fckeditor/_testcases
|
||||
htdocs/includes/nusoap/samples
|
||||
|
||||
@@ -56,8 +56,8 @@ $contactid=GETPOST('contactid','int');
|
||||
$socid = GETPOST('socid','int');
|
||||
$id = GETPOST('id','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user,'societe',$id,'&societe');
|
||||
//$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', '', 'id');
|
||||
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', '', 'id');
|
||||
if ($user->societe_id && $socid) $result = restrictedArea($user,'societe',$socid);
|
||||
|
||||
$error=GETPOST("error");
|
||||
$mesg='';
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2006 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 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
|
||||
@@ -115,9 +116,13 @@ if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
|
||||
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
||||
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
|
||||
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
||||
if ($search_nom) $sql.= " AND s.nom LIKE '%".$db->escape($search_nom)."%'";
|
||||
if ($search_nom) {
|
||||
$sql .= natural_search('s.nom', $search_nom);
|
||||
}
|
||||
if ($search_zipcode) $sql.= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'";
|
||||
if ($search_town) $sql.= " AND s.town LIKE '%".$db->escape($search_town)."%'";
|
||||
if ($search_town) {
|
||||
$sql .= natural_search('s.town', $search_town);
|
||||
}
|
||||
if ($search_code) $sql.= " AND s.code_client LIKE '%".$db->escape($search_code)."%'";
|
||||
if ($search_compta) $sql.= " AND s.code_compta LIKE '%".$db->escape($search_compta)."%'";
|
||||
// Insert sale filter
|
||||
|
||||
@@ -1807,6 +1807,7 @@ class Propal extends CommonObject
|
||||
* Class invoiced the Propal
|
||||
*
|
||||
* @return int <0 si ko, >0 si ok
|
||||
* @deprecated
|
||||
*/
|
||||
function classer_facturee()
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
* 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
|
||||
@@ -160,21 +161,17 @@ if (! $user->rights->societe->client->voir && ! $socid) //restriction
|
||||
{
|
||||
$sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
}
|
||||
if ($search_town) //restriction
|
||||
{
|
||||
$sql.= " AND s.town LIKE '%".$db->escape(trim($search_town))."%'";
|
||||
if ($search_town) {//restriction
|
||||
$sql .= natural_search('s.town', $search_town);
|
||||
}
|
||||
if ($search_ref)
|
||||
{
|
||||
$sql.= " AND p.ref LIKE '%".$db->escape(trim($search_ref))."%'";
|
||||
if ($search_ref) {
|
||||
$sql .= natural_search('p.ref', $search_ref);
|
||||
}
|
||||
if ($search_refcustomer)
|
||||
{
|
||||
$sql.= " AND p.ref_client LIKE '%".$db->escape(trim($search_refcustomer))."%'";
|
||||
if ($search_refcustomer) {
|
||||
$sql .= natural_search('p.ref_client', $search_refcustomer);
|
||||
}
|
||||
if ($search_societe)
|
||||
{
|
||||
$sql.= " AND s.nom LIKE '%".$db->escape(trim($search_societe))."%'";
|
||||
if ($search_societe) {
|
||||
$sql .= natural_search('s.nom', $search_societe);
|
||||
}
|
||||
if ($search_author)
|
||||
{
|
||||
@@ -184,7 +181,13 @@ if ($search_montant_ht)
|
||||
{
|
||||
$sql.= " AND p.total_ht='".$db->escape(price2num(trim($search_montant_ht)))."'";
|
||||
}
|
||||
if ($sall) $sql.= " AND (s.nom LIKE '%".$db->escape($sall)."%' OR p.note_private LIKE '%".$db->escape($sall)."%' OR pd.description LIKE '%".$db->escape($sall)."%')";
|
||||
if ($sall) {
|
||||
/*$scrit = explode(' ', $sall);
|
||||
foreach ($scrit as $crit) {
|
||||
$sql.= " AND (s.nom LIKE '%".$db->escape($crit)."%' OR p.note LIKE '%".$db->escape($crit)."%' OR pd.description LIKE '%".$db->escape($crit)."%')";
|
||||
}*/
|
||||
$sql .= natural_search(array('s.nom', 'p.note_private', 'pd.description'), $sall);
|
||||
}
|
||||
if ($socid) $sql.= ' AND s.rowid = '.$socid;
|
||||
if ($viewstatut <> '')
|
||||
{
|
||||
@@ -289,7 +292,7 @@ if ($result)
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="16" name="search_societe" value="'.$search_societe.'">';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td class="liste_titre"><input class="flat" type="text" size="16" name="search_town" value="'.$search_town.'"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="10" type="text" name="search_refcustomer" value="'.$search_refcustomer.'">';
|
||||
print '</td>';
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* 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
|
||||
@@ -193,10 +194,16 @@ if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
|
||||
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
||||
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
|
||||
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
||||
if ($search_nom) $sql .= " AND s.nom LIKE '%".$db->escape(strtolower($search_nom))."%'";
|
||||
if ($search_nom) {
|
||||
$sql .= natural_search('s.nom', $search_nom);
|
||||
}
|
||||
if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape(strtolower($search_zipcode))."%'";
|
||||
if ($search_town) $sql .= " AND s.town LIKE '%".$db->escape(strtolower($search_town))."%'";
|
||||
if ($search_state) $sql .= " AND d.nom LIKE '%".$db->escape(strtolower($search_state))."%'";
|
||||
if ($search_town) {
|
||||
$sql .= natural_search('s.town', $search_town);
|
||||
}
|
||||
if ($search_state) {
|
||||
$sql .= natural_search('d.nom', $search_state);
|
||||
}
|
||||
if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'";
|
||||
// Insert levels filters
|
||||
if ($search_levels)
|
||||
@@ -208,9 +215,8 @@ if ($search_sale)
|
||||
{
|
||||
$sql .= " AND sc.fk_user = ".$db->escape($search_sale);
|
||||
}
|
||||
if ($socname)
|
||||
{
|
||||
$sql .= " AND s.nom LIKE '%".$db->escape($socname)."%'";
|
||||
if ($socname) {
|
||||
$sql .= natural_search('s.nom', $search_nom);
|
||||
$sortfield = "s.nom";
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
|
||||
@@ -2222,6 +2222,7 @@ class Commande extends CommonOrder
|
||||
* Classify the order as invoiced
|
||||
*
|
||||
* @return int <0 if ko, >0 if ok
|
||||
* @deprecated
|
||||
*/
|
||||
function classer_facturee()
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 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
|
||||
@@ -125,13 +126,12 @@ $sql.= ' WHERE c.fk_soc = s.rowid';
|
||||
$sql.= ' AND c.entity = '.$conf->entity;
|
||||
if ($socid) $sql.= ' AND s.rowid = '.$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($sref)
|
||||
{
|
||||
$sql.= " AND c.ref LIKE '%".$db->escape($sref)."%'";
|
||||
if ($sref) {
|
||||
$sql .= natural_search('c.ref', $sref);
|
||||
}
|
||||
if ($sall)
|
||||
{
|
||||
$sql.= " AND (c.ref LIKE '%".$db->escape($sall)."%' OR c.note LIKE '%".$db->escape($sall)."%')";
|
||||
$sql .= natural_search(array('c.ref', 'c.note_private'), $sall);
|
||||
}
|
||||
if ($viewstatut <> '')
|
||||
{
|
||||
@@ -187,7 +187,7 @@ else if ($deliveryyear > 0)
|
||||
}
|
||||
if (!empty($snom))
|
||||
{
|
||||
$sql.= ' AND s.nom LIKE \'%'.$db->escape($snom).'%\'';
|
||||
$sql .= natural_search('s.nom', $snom);
|
||||
}
|
||||
if (!empty($sref_client))
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2013 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) 2012 Andreu Bisquerra Gaya <jove@bisquerra.com>
|
||||
@@ -96,9 +96,8 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
}
|
||||
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
$langs->load('bills');
|
||||
$langs->load('products');
|
||||
$langs->load('main');
|
||||
@@ -127,7 +126,7 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
|
||||
$lineid = GETPOST('lineid','int');
|
||||
$userid = GETPOST('userid','int');
|
||||
$search_ref = GETPOST('sf_ref')?GETPOST('sf_ref'):GETPOST('search_ref');
|
||||
$closeOrders = GETPOST('autocloseorders') != '' ? true : false;
|
||||
$closeOrders = GETPOST('autocloseorders') ? true : false;
|
||||
|
||||
// Security check
|
||||
$fieldid = GETPOST('ref','alpha')?'facnumber':'rowid';
|
||||
@@ -214,8 +213,9 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
|
||||
$result=$objectsrc->fetch($orders_id[$ii]);
|
||||
if ($result > 0)
|
||||
{
|
||||
if($closeOrders) {
|
||||
$objectsrc->classer_facturee();
|
||||
if ($closeOrders)
|
||||
{
|
||||
$objectsrc->classifyBilled();
|
||||
$objectsrc->setStatut(3);
|
||||
}
|
||||
$lines = $objectsrc->lines;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2003 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 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
|
||||
@@ -75,11 +76,11 @@ if (trim($search_ref) != '')
|
||||
}
|
||||
if (trim($search_company) != '')
|
||||
{
|
||||
$sql.= ' AND d.societe LIKE \'%'.$db->escape(trim($search_company)) . '%\'';
|
||||
$sql .= natural_search('d.societe', $search_company);
|
||||
}
|
||||
if (trim($search_name) != '')
|
||||
{
|
||||
$sql.= ' AND d.lastname LIKE \'%'.$db->escape(trim($search_name)) . '%\' OR d.firstname LIKE \'%'.$db->escape(trim($search_name)) . '%\'';
|
||||
$sql .= natural_search(array('d.lastname', 'd.firstname'), $search_name);
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
@@ -95,6 +95,7 @@ class FactureRec extends Facture
|
||||
|
||||
// Clean parameters
|
||||
$this->titre=trim($this->titre);
|
||||
$this->usenewprice=empty($this->usenewprice)?0:$this->usenewprice;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@@ -122,9 +123,9 @@ class FactureRec extends Facture
|
||||
$sql.= ", usenewprice";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'".$this->titre."'";
|
||||
$sql.= ", '".$facsrc->socid."'";
|
||||
$sql.= ", ".$facsrc->socid;
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", ".$this->db->idate($now);
|
||||
$sql.= ", '".$this->db->idate($now)."'";
|
||||
$sql.= ", ".(!empty($facsrc->amount)?$facsrc->amount:'0');
|
||||
$sql.= ", ".(!empty($facsrc->remise)?$this->remise:'0');
|
||||
$sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
|
||||
@@ -133,7 +134,7 @@ class FactureRec extends Facture
|
||||
$sql.= ", ".(! empty($facsrc->fk_project)?"'".$facsrc->fk_project."'":"null");
|
||||
$sql.= ", '".$facsrc->cond_reglement_id."'";
|
||||
$sql.= ", '".$facsrc->mode_reglement_id."'";
|
||||
$sql.= ", '".$this->usenewprice."'";
|
||||
$sql.= ", ".$this->usenewprice;
|
||||
$sql.= ")";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
@@ -575,5 +576,28 @@ class FactureRec extends Facture
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialise an instance with random values.
|
||||
* Used to build previews or test instances.
|
||||
* id must be 0 if object instance is a specimen.
|
||||
*
|
||||
* @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines
|
||||
* @return void
|
||||
*/
|
||||
function initAsSpecimen($option='')
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
$now=dol_now();
|
||||
$arraynow=dol_getdate($now);
|
||||
$nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']);
|
||||
|
||||
parent::initAsSpecimen($option);
|
||||
|
||||
$this->usenewprice = 1;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* 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
|
||||
@@ -174,11 +175,11 @@ if ($filtre)
|
||||
}
|
||||
if ($search_ref)
|
||||
{
|
||||
$sql.= ' AND f.facnumber LIKE \'%'.$db->escape(trim($search_ref)).'%\'';
|
||||
$sql .= natural_search('f.facnumber', $search_ref);
|
||||
}
|
||||
if ($search_societe)
|
||||
{
|
||||
$sql.= ' AND s.nom LIKE \'%'.$db->escape(trim($search_societe)).'%\'';
|
||||
$sql .= natural_search('s.nom', $search_societe);
|
||||
}
|
||||
if ($search_montant_ht)
|
||||
{
|
||||
@@ -219,7 +220,7 @@ if (! $sall)
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= ' AND (s.nom LIKE \'%'.$db->escape($sall).'%\' OR f.facnumber LIKE \'%'.$db->escape($sall).'%\' OR f.note LIKE \'%'.$db->escape($sall).'%\' OR fd.description LIKE \'%'.$db->escape($sall).'%\')';
|
||||
$sql .= natural_search(array('s.nom', 'f.facnumber', 'f.note_public', 'fd.description'), $sall);
|
||||
}
|
||||
$sql.= ' ORDER BY ';
|
||||
$listfield=explode(',',$sortfield);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 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
|
||||
@@ -112,7 +113,7 @@ else
|
||||
if (GETPOST("search_account") > 0) $sql .=" AND b.fk_account=".GETPOST("search_account",'int');
|
||||
if (GETPOST("search_paymenttype") != "") $sql .=" AND c.code='".GETPOST("search_paymenttype")."'";
|
||||
if (GETPOST("search_amount")) $sql .=" AND p.amount=".price2num(GETPOST("search_amount"));
|
||||
if (GETPOST("search_company")) $sql .=" AND s.nom LIKE '%".$db->escape(GETPOST("search_company"))."%'";
|
||||
if (GETPOST("search_company")) $sql .= natural_search('s.nom', GETPOST('search_company'));
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
@@ -14,9 +14,10 @@
|
||||
// dolibarr_main_url_root
|
||||
// This parameter defines the root URL of your Dolibarr index.php page.
|
||||
// It must link to the htdocs directory htdocs.
|
||||
// In most cases, this is autodetected but it still required to show full
|
||||
// url bookmarks for some services (ie: agenda rss export url, ...) or
|
||||
// when using Apache dir aliases (autodetect fails).
|
||||
// In most cases, this is autodetected but it's still required
|
||||
// * to show full url bookmarks for some services (ie: agenda rss export url, ...)
|
||||
// * or when using Apache dir aliases (autodetect fails)
|
||||
// * or when using nginx (autodetect fails)
|
||||
// Examples:
|
||||
// $dolibarr_main_url_root='http://localhost';
|
||||
// $dolibarr_main_url_root='http://mydolibarrvirtualhost';
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Raphaël Doursenaud <rdoursenaud@gpcsolutions.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
|
||||
@@ -148,21 +149,17 @@ else
|
||||
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
|
||||
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
||||
|
||||
if ($search_lastname) // filter on lastname
|
||||
{
|
||||
$sql .= " AND p.lastname LIKE '%".$db->escape($search_lastname)."%'";
|
||||
if ($search_lastname) { // filter on lastname
|
||||
$sql .= natural_search('p.lastname', $search_lastname);
|
||||
}
|
||||
if ($search_firstname) // filter on firstname
|
||||
{
|
||||
$sql .= " AND p.firstname LIKE '%".$db->escape($search_firstname)."%'";
|
||||
if ($search_firstname) { // filter on firstname
|
||||
$sql .= natural_search('p.firstname', $search_firstname);
|
||||
}
|
||||
if ($search_societe) // filtre sur la societe
|
||||
{
|
||||
$sql .= " AND s.nom LIKE '%".$db->escape($search_societe)."%'";
|
||||
if ($search_societe) { // filtre sur la societe
|
||||
$sql .= natural_search('s.nom', $search_societe);
|
||||
}
|
||||
if (strlen($search_poste)) // filtre sur la societe
|
||||
{
|
||||
$sql .= " AND p.poste LIKE '%".$db->escape($search_poste)."%'";
|
||||
if (strlen($search_poste)) { // filtre sur la societe
|
||||
$sql .= natural_search('p.poste', $search_poste);
|
||||
}
|
||||
if (strlen($search_phone))
|
||||
{
|
||||
@@ -206,11 +203,7 @@ else if ($type == "p") // filtre sur type
|
||||
}
|
||||
if ($sall)
|
||||
{
|
||||
// For natural search
|
||||
$scrit = explode(' ', $sall);
|
||||
foreach ($scrit as $crit) {
|
||||
$sql .= " AND (p.lastname LIKE '%".$db->escape($crit)."%' OR p.firstname LIKE '%".$db->escape($crit)."%' OR p.email LIKE '%".$db->escape($crit)."%')";
|
||||
}
|
||||
$sql .= natural_search(array('p.lastname', 'p.firstname', 'p.email'), $sall);
|
||||
}
|
||||
if (! empty($socid))
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* 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
|
||||
@@ -79,9 +80,15 @@ $sql.= " WHERE c.fk_soc = s.rowid ";
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($search_nom) $sql.= " AND s.nom LIKE '%".$db->escape($search_nom)."%'";
|
||||
if ($search_contract) $sql.= " AND (".(is_numeric($search_contract)?"c.rowid = ".$db->escape($search_contract)." OR ":'')." c.ref LIKE '%".$db->escape($search_contract)."%')";
|
||||
if ($sall) $sql.= " AND (s.nom LIKE '%".$db->escape($sall)."%' OR cd.label LIKE '%".$db->escape($sall)."%' OR cd.description LIKE '%".$db->escape($sall)."%')";
|
||||
if ($search_nom) {
|
||||
$sql .= natural_search('s.nom', $search_nom);
|
||||
}
|
||||
if ($search_contract) {
|
||||
$sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract);
|
||||
}
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array('s.nom', 'cd.label', 'cd.description'), $sall);
|
||||
}
|
||||
$sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut,";
|
||||
$sql.= " s.nom, s.rowid";
|
||||
$sql.= " ORDER BY $sortfield $sortorder";
|
||||
|
||||
@@ -247,10 +247,20 @@ abstract class CommonDocGenerator
|
||||
$array_key.'_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement),
|
||||
$array_key.'_payment_term_code'=>$object->cond_reglement_code,
|
||||
$array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):$object->cond_reglement),
|
||||
$array_key.'_total_ht'=>price($object->total_ht),
|
||||
$array_key.'_total_vat'=>price($object->total_tva),
|
||||
$array_key.'_total_ttc'=>price($object->total_ttc),
|
||||
$array_key.'_total_discount_ht' => price($object->getTotalDiscount()),
|
||||
|
||||
$array_key.'_total_ht_locale'=>price($object->total_ht,0,$outputlangs),
|
||||
$array_key.'_total_vat_locale'=>price($object->total_tva,0,$outputlangs),
|
||||
$array_key.'_total_localtax1_locale'=>price($object->total_localtax1,0,$outputlangs),
|
||||
$array_key.'_total_localtax2_locale'=>price($object->total_localtax2,0,$outputlangs),
|
||||
$array_key.'_total_ttc_locale'=>price($object->total_ttc,0,$outputlangs),
|
||||
$array_key.'_total_discount_ht_locale' => price($object->getTotalDiscount(),0,$outputlangs),
|
||||
$array_key.'_total_ht'=>price2num($object->total_ht),
|
||||
$array_key.'_total_vat'=>price2num($object->total_tva),
|
||||
$array_key.'_total_localtax1'=>price2num($object->total_localtax1),
|
||||
$array_key.'_total_localtax2'=>price2num($object->total_localtax2),
|
||||
$array_key.'_total_ttc'=>price2num($object->total_ttc),
|
||||
$array_key.'_total_discount_ht' => price2num($object->getTotalDiscount()),
|
||||
|
||||
$array_key.'_vatrate'=>vatrate($object->tva),
|
||||
$array_key.'_note_private'=>$object->note,
|
||||
$array_key.'_note'=>$object->note_public,
|
||||
|
||||
@@ -1471,14 +1471,15 @@ abstract class CommonObject
|
||||
|
||||
/**
|
||||
* Update total_ht, total_ttc, total_vat, total_localtax1, total_localtax2 for an object (sum of lines).
|
||||
* Must be called at end of methods addline, updateline.
|
||||
* Must be called at end of methods addline or updateline.
|
||||
*
|
||||
* @param int $exclspec Exclude special product (product_type=9)
|
||||
* @param int $roundingadjust -1=Use default method (MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND if defined, or 0), 0=Force use total of rounding, 1=Force use rounding of total
|
||||
* @param int $nodatabaseupdate 1=Do not update database. Update only properties of object.
|
||||
* @param Societe $seller If roundingadjust is 0, it means we recalculate total for lines before calculating total for object. For this, we need seller object.
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update_price($exclspec=0,$roundingadjust=-1,$nodatabaseupdate=0)
|
||||
function update_price($exclspec=0,$roundingadjust=-1,$nodatabaseupdate=0,$seller='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@@ -1535,7 +1536,8 @@ abstract class CommonObject
|
||||
// By default, no adjustement is required ($forcedroundingmode = -1)
|
||||
if ($forcedroundingmode == 0) // Check if we need adjustement onto line for vat
|
||||
{
|
||||
$tmpcal=calcul_price_total($obj->qty, $obj->up, $obj->remise_percent, $obj->vatrate, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->product_type);
|
||||
$localtax_array=array($obj->localtax1_type,$obj->localtax1_tx,$obj->localtax2_type,$obj->localtax2_tx);
|
||||
$tmpcal=calcul_price_total($obj->qty, $obj->up, $obj->remise_percent, $obj->vatrate, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->product_type, $seller, $localtax_array);
|
||||
$diff=price2num($tmpcal[1] - $obj->total_tva, 'MT', 1);
|
||||
if ($diff)
|
||||
{
|
||||
@@ -3116,7 +3118,7 @@ abstract class CommonObject
|
||||
if (empty($line->pa_ht) && isset($line->fk_fournprice) && !$force_price) {
|
||||
$product = new ProductFournisseur($this->db);
|
||||
if ($product->fetch_product_fournisseur_price($line->fk_fournprice))
|
||||
$line->pa_ht = $product->fourn_unitprice;
|
||||
$line->pa_ht = $product->fourn_unitprice * (1 - $product->fourn_remise_percent / 100);
|
||||
if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == "2" && $product->fourn_unitcharges > 0)
|
||||
$line->pa_ht += $product->fourn_unitcharges;
|
||||
}
|
||||
|
||||
@@ -432,7 +432,7 @@ class FormMail
|
||||
if (! empty($this->withtocc) && is_array($this->withtocc))
|
||||
{
|
||||
$out.= " ".$langs->trans("or")." ";
|
||||
$out.= $form->selectarray("receivercc", $this->withto, GETPOST("receivercc"), 1);
|
||||
$out.= $form->selectarray("receivercc", $this->withtocc, GETPOST("receivercc"), 1);
|
||||
}
|
||||
}
|
||||
$out.= "</td></tr>\n";
|
||||
@@ -454,7 +454,7 @@ class FormMail
|
||||
if (! empty($this->withtoccc) && is_array($this->withtoccc))
|
||||
{
|
||||
$out.= " ".$langs->trans("or")." ";
|
||||
$out.= $form->selectarray("receiverccc", $this->withto, GETPOST("receiverccc"), 1);
|
||||
$out.= $form->selectarray("receiverccc", $this->withtoccc, GETPOST("receiverccc"), 1);
|
||||
}
|
||||
}
|
||||
//if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print ' '.info_admin("+ ".$conf->global->MAIN_MAIL_AUTOCOPY_TO,1);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
/* Copyright (C) 2013 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
|
||||
@@ -17,102 +16,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/login/functions_myopenid.php
|
||||
* \file htdocs/core/class/openid.class.php
|
||||
* \ingroup core
|
||||
* \brief Authentication functions for OpenId mode
|
||||
* \brief Class to manage authentication with OpenId
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Check validity of user/password/entity
|
||||
* If test is ko, reason must be filled into $_SESSION["dol_loginmesg"]
|
||||
*
|
||||
* @param string $usertotest Login
|
||||
* @param string $passwordtotest Password
|
||||
* @param int $entitytotest Number of instance (always 1 if module multicompany not enabled)
|
||||
* @return string Login if OK, '' if KO
|
||||
*/
|
||||
function check_user_password_myopenid($usertotest,$passwordtotest,$entitytotest)
|
||||
{
|
||||
global $_POST,$db,$conf,$langs;
|
||||
|
||||
dol_syslog("functions_dolibarr::check_user_password_myopenid usertotest=".$usertotest);
|
||||
|
||||
$login='';
|
||||
|
||||
// Get identity from user and redirect browser to OpenID Server
|
||||
if (isset($_POST['username']))
|
||||
{
|
||||
$openid = new SimpleOpenID();
|
||||
$openid->SetIdentity($_POST['username']);
|
||||
$protocol = ($conf->file->main_force_https ? 'https://' : 'http://');
|
||||
$openid->SetTrustRoot($protocol . $_SERVER["HTTP_HOST"]);
|
||||
$openid->SetRequiredFields(array('email','fullname'));
|
||||
$_SESSION['dol_entity'] = $_POST["entity"];
|
||||
//$openid->SetOptionalFields(array('dob','gender','postcode','country','language','timezone'));
|
||||
if ($openid->GetOpenIDServer())
|
||||
{
|
||||
$openid->SetApprovedURL($protocol . $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"]); // Send Response from OpenID server to this script
|
||||
$openid->Redirect(); // This will redirect user to OpenID Server
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = $openid->GetError();
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Perform HTTP Request to OpenID server to validate key
|
||||
elseif($_GET['openid_mode'] == 'id_res')
|
||||
{
|
||||
$openid = new SimpleOpenID();
|
||||
$openid->SetIdentity($_GET['openid_identity']);
|
||||
$openid_validation_result = $openid->ValidateWithServer();
|
||||
if ($openid_validation_result == true)
|
||||
{
|
||||
// OK HERE KEY IS VALID
|
||||
|
||||
$sql ="SELECT login";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."user";
|
||||
$sql.=" WHERE openid = '".$db->escape($_GET['openid_identity'])."'";
|
||||
$sql.=" AND entity IN (0," . ($_SESSION["dol_entity"] ? $_SESSION["dol_entity"] : 1) . ")";
|
||||
|
||||
dol_syslog("functions_dolibarr::check_user_password_myopenid sql=".$sql);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj=$db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$login=$obj->login;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if($openid->IsError() == true)
|
||||
{
|
||||
// ON THE WAY, WE GOT SOME ERROR
|
||||
$error = $openid->GetError();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Signature Verification Failed
|
||||
//echo "INVALID AUTHORIZATION";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if ($_GET['openid_mode'] == 'cancel')
|
||||
{
|
||||
// User Canceled your Request
|
||||
//echo "USER CANCELED REQUEST";
|
||||
return false;
|
||||
}
|
||||
|
||||
return $login;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage OpenID
|
||||
*/
|
||||
@@ -416,9 +324,22 @@ class SimpleOpenID
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function GetOpenIDServer()
|
||||
|
||||
/**
|
||||
* Get openid server
|
||||
*
|
||||
* @param string $url Url to found endpoint
|
||||
* @return string Endpoint
|
||||
*/
|
||||
function GetOpenIDServer($url='')
|
||||
{
|
||||
$response = $this->CURL_Request($this->openid_url_identity);
|
||||
global $conf;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||
if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
|
||||
|
||||
$response = getURLContent($url);
|
||||
|
||||
list($servers, $delegates) = $this->HTML2OpenIDServer($response);
|
||||
if (count($servers) == 0){
|
||||
$this->ErrorStore('OPENID_NOSERVERSFOUND');
|
||||
@@ -517,6 +438,61 @@ class SimpleOpenID
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get XRDS response and set possible servers.
|
||||
*
|
||||
* @param string $url Url of endpoint to request
|
||||
* @return string First endpoint OpenID server found. False if it failed to found.
|
||||
*/
|
||||
function sendDiscoveryRequestToGetXRDS($url='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||
if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
|
||||
|
||||
dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS get XRDS');
|
||||
|
||||
$addheaders=array('Accept: application/xrds+xml');
|
||||
$response = getURLContent($url, 'GET', '', 1, $addheaders);
|
||||
/* response should like this:
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xrds:XRDS xmlns:xrds="xri://$xrds" xmlns="xri://$xrd*($v*2.0)">
|
||||
<XRD>
|
||||
<Service priority="0">
|
||||
<Type>http://specs.openid.net/auth/2.0/server</Type>
|
||||
<Type>http://openid.net/srv/ax/1.0</Type>
|
||||
...
|
||||
<URI>https://www.google.com/accounts/o8/ud</URI>
|
||||
</Service>
|
||||
</XRD>
|
||||
</xrds:XRDS>
|
||||
*/
|
||||
$content=$response['content'];
|
||||
|
||||
$server='';
|
||||
if (preg_match('/'.preg_quote('<URI>','/').'(.*)'.preg_quote('</URI>','/').'/is', $content, $reg))
|
||||
{
|
||||
$server=$reg[1];
|
||||
}
|
||||
|
||||
if (empty($server))
|
||||
{
|
||||
$this->ErrorStore('OPENID_NOSERVERSFOUND');
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS found endpoint = '.$server);
|
||||
$this->SetOpenIDServer($server);
|
||||
return $server;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -209,7 +209,7 @@ class DoliDBPgsql extends DoliDB
|
||||
}
|
||||
|
||||
// tinyint type conversion
|
||||
$line=str_replace('tinyint','smallint',$line);
|
||||
$line=preg_replace('/tinyint\(?[0-9]*\)?/','smallint',$line);
|
||||
|
||||
// nuke unsigned
|
||||
$line=preg_replace('/(int\w+|smallint)\s+unsigned/i','\\1',$line);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 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
|
||||
@@ -60,6 +61,15 @@ function societe_prepare_head($object)
|
||||
$head[$h][2] = 'supplier';
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (($object->localtax1_assuj || $object->localtax2_assuj) && (isset($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL > 0) )
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/localtaxes.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("LocalTaxes");
|
||||
$head[$h][2] = 'localtaxes';
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* 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
|
||||
@@ -2870,13 +2871,13 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="")
|
||||
* Get type and rate of localtaxes for a particular vat rate/country fo thirdparty
|
||||
* TODO
|
||||
* This function is called to retrieve type for building PDF. Such call of function must be removed.
|
||||
* Instead this function must be called when adding a line to get array of localtax and type and
|
||||
* provide it to function calcul_price_total.
|
||||
* Instead this function must be called when adding a line to get (array of localtax and type) and
|
||||
* provide it to the function calcul_price_total.
|
||||
*
|
||||
* @param real $vatrate VAT Rate
|
||||
* @param int $local Number of localtax (1 or 2, or 0 to return 1+2)
|
||||
* @param int $local Number of localtax (1 or 2, or 0 to return 1 & 2)
|
||||
* @param int $thirdparty Company object
|
||||
* @return array array(Type of local tax (1 to 7 / 0 if not found), rate or amount of localtax)
|
||||
* @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...)
|
||||
*/
|
||||
function getLocalTaxesFromRate($vatrate, $local, $thirdparty)
|
||||
{
|
||||
@@ -3477,16 +3478,18 @@ function dol_html_entity_decode($a,$b,$c='UTF-8')
|
||||
|
||||
/**
|
||||
* Replace htmlentities functions to manage errors
|
||||
* http://php.net/manual/en/function.htmlentities.php
|
||||
*
|
||||
* @param string $a Operand a
|
||||
* @param string $b Operand b
|
||||
* @param string $c Operand c
|
||||
* @return string String encoded
|
||||
* @param string $string The input string.
|
||||
* @param int $flags Flags(see PHP doc above)
|
||||
* @param string $encoding Encoding
|
||||
* @param bool $double_encode When double_encode is turned off PHP will not encode existing html entities
|
||||
* @return string $ret Encoded string
|
||||
*/
|
||||
function dol_htmlentities($a,$b,$c='UTF-8')
|
||||
function dol_htmlentities($string, $flags=null, $encoding='UTF-8', $double_encode=false)
|
||||
{
|
||||
// We use @ to avoid warning on PHP4 that does not support entity decoding to UTF8;
|
||||
$ret=@htmlentities($a,$b,$c);
|
||||
$ret=@htmlentities($string, $flags, $encoding, $double_encode);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@@ -4436,4 +4439,40 @@ if (! function_exists('getmypid'))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Natural search
|
||||
*
|
||||
* @param mixed $fields String or array of strings filled with the fields names in the SQL query
|
||||
* @param string $value The value to look for
|
||||
* @return string $res The statement to append to the SQL query
|
||||
*/
|
||||
function natural_search($fields, $value)
|
||||
{
|
||||
global $db;
|
||||
$crits = explode(' ', $value);
|
||||
$res = "";
|
||||
if (! is_array($fields)) {
|
||||
$fields = array($fields);
|
||||
}
|
||||
$end = count($fields);
|
||||
$end2 = count($crits);
|
||||
$j = 0;
|
||||
foreach ($crits as $crit) {
|
||||
$i = 0;
|
||||
foreach ($fields as $field) {
|
||||
if ( $i > 0 && $i < $end){
|
||||
$res .= " OR ";
|
||||
}
|
||||
$res .= $field . " LIKE '%" . $db->escape(trim($crit)) . "%'";
|
||||
$i++;
|
||||
}
|
||||
if ($end > 1) $res .= ')';
|
||||
if ($j < $end2 - 1) $res .= " AND ";
|
||||
if ($end > 1 && $j < $end2 - 1) $res .= '(';
|
||||
$j++;
|
||||
}
|
||||
return " AND " . ($end > 1? '(' : '') . $res;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -17,20 +17,21 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/lib/functions2.lib.php
|
||||
* \brief A set of functions for Dolibarr
|
||||
* This file contains all rare functions.
|
||||
* \file htdocs/core/lib/geturl.lib.php
|
||||
* \brief This file contains functions dedicated to get URL.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function get content from an URL (use proxy if proxy defined)
|
||||
*
|
||||
* @param string $url URL to call.
|
||||
* @param string $postorget 'post' = POST, 'get='GET'
|
||||
* @param string $postorget 'POST', 'GET', 'HEAD'
|
||||
* @param string $param Paraemeters of URL (x=value1&y=value2)
|
||||
* @return array returns an associtive array containing the response from the server.
|
||||
* @param string $followlocation 1=Follow location, 0=Do not follow
|
||||
* @param array $addheaders Array of string to add into header. Example: ('Accept: application/xrds+xml', ....)
|
||||
* @return array Returns an associative array containing the response from the server array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...)
|
||||
*/
|
||||
function getURLContent($url,$postorget='GET',$param='')
|
||||
function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addheaders=array())
|
||||
{
|
||||
//declaring of global variables
|
||||
global $conf, $langs;
|
||||
@@ -52,6 +53,11 @@ function getURLContent($url,$postorget='GET',$param='')
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
||||
curl_setopt($ch, CURLOPT_SSLVERSION, 3); // Force SSLv3
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Dolibarr geturl function');
|
||||
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, ($followlocation?true:false));
|
||||
if (count($addheaders)) curl_setopt($ch, CURLOPT_HTTPHEADER, $addheaders);
|
||||
curl_setopt($ch, CURLINFO_HEADER_OUT, true); // To be able to retrieve request header and log it
|
||||
|
||||
//turning off the server and peer verification(TrustManager Concept).
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
@@ -60,9 +66,21 @@ function getURLContent($url,$postorget='GET',$param='')
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, empty($conf->global->MAIN_USE_CONNECT_TIMEOUT)?5:$conf->global->MAIN_USE_CONNECT_TIMEOUT);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT)?30:$conf->global->MAIN_USE_RESPONSE_TIMEOUT);
|
||||
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
||||
if ($postorget == 'POST') curl_setopt($ch, CURLOPT_POST, 1);
|
||||
else curl_setopt($ch, CURLOPT_POST, 0);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // We want response
|
||||
if ($postorget == 'POST')
|
||||
{
|
||||
curl_setopt($ch, CURLOPT_POST, 1); // POST
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // Setting param x=a&y=z as POST fields
|
||||
}
|
||||
else if ($postorget == 'HEAD')
|
||||
{
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD'); // HTTP request is 'HEAD'
|
||||
curl_setopt($ch, CURLOPT_NOBODY, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
curl_setopt($ch, CURLOPT_POST, 0); // GET
|
||||
}
|
||||
|
||||
//if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled.
|
||||
if ($USE_PROXY)
|
||||
@@ -73,19 +91,19 @@ function getURLContent($url,$postorget='GET',$param='')
|
||||
if ($PROXY_USER) curl_setopt($ch, CURLOPT_PROXYUSERPWD, $PROXY_USER. ":" . $PROXY_PASS);
|
||||
}
|
||||
|
||||
//setting the nvpreq as POST FIELD to curl
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
|
||||
|
||||
//getting response from server
|
||||
$response = curl_exec($ch);
|
||||
|
||||
$status = curl_getinfo($ch, CURLINFO_HEADER_OUT); // Reading of request must be done after sending request
|
||||
dol_syslog("getURLContent request=".$status);
|
||||
|
||||
dol_syslog("getURLContent response=".$response);
|
||||
|
||||
$rep=array();
|
||||
$rep['content']=$response;
|
||||
$rep['curl_error_no']='';
|
||||
$rep['curl_error_msg']='';
|
||||
|
||||
dol_syslog("getURLContent response=".$response);
|
||||
|
||||
if (curl_errno($ch))
|
||||
{
|
||||
// moving to display page to display curl errors
|
||||
@@ -106,3 +124,4 @@ function getURLContent($url,$postorget='GET',$param='')
|
||||
return $rep;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -72,9 +72,9 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
|
||||
// Clean parameters
|
||||
if (empty($txtva)) $txtva=0;
|
||||
|
||||
if (empty($seller) || ! is_object($seller))
|
||||
{
|
||||
dol_syslog("calcul_price_total Warning: function is called with parameter seller that is missing", LOG_WARNING);
|
||||
if (! is_object($mysoc)) // mysoc may be not defined (during migration process)
|
||||
{
|
||||
$mysoc=new Societe($db);
|
||||
@@ -83,6 +83,10 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
$seller=$mysoc; // If sell is done to a customer, $seller is not provided, we use $mysoc
|
||||
//var_dump($seller->country_id);exit;
|
||||
}
|
||||
if (empty($localtaxes_array) || ! is_array($localtaxes_array))
|
||||
{
|
||||
dol_syslog("calcul_price_total Warning: function is called with parameter localtaxes_array that is missing", LOG_WARNING);
|
||||
}
|
||||
// Too verbose. Enable for debug only
|
||||
//dol_syslog("calcul_price_total qty=".$qty." pu=".$pu." remiserpercent_ligne=".$remise_percent_ligne." txtva=".$txtva." uselocaltax1_rate=".$uselocaltax1_rate." uselocaltax2_rate=".$uselocaltax2_rate);
|
||||
|
||||
|
||||
116
htdocs/core/login/functions_openid.php
Normal file
116
htdocs/core/login/functions_openid.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-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/core/login/functions_openid.php
|
||||
* \ingroup core
|
||||
* \brief Authentication functions for OpenId mode
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/openid.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Check validity of user/password/entity
|
||||
* If test is ko, reason must be filled into $_SESSION["dol_loginmesg"]
|
||||
*
|
||||
* @param string $usertotest Login
|
||||
* @param string $passwordtotest Password
|
||||
* @param int $entitytotest Number of instance (always 1 if module multicompany not enabled)
|
||||
* @return string Login if OK, '' if KO
|
||||
*/
|
||||
function check_user_password_openid($usertotest,$passwordtotest,$entitytotest)
|
||||
{
|
||||
global $_POST,$db,$conf,$langs;
|
||||
|
||||
dol_syslog("functions_openid::check_user_password_openid usertotest=".$usertotest);
|
||||
|
||||
$login='';
|
||||
|
||||
// Get identity from user and redirect browser to OpenID Server
|
||||
if (isset($_POST['username']))
|
||||
{
|
||||
$openid = new SimpleOpenID();
|
||||
$openid->SetIdentity($_POST['username']);
|
||||
$protocol = ($conf->file->main_force_https ? 'https://' : 'http://');
|
||||
$openid->SetTrustRoot($protocol . $_SERVER["HTTP_HOST"]);
|
||||
$openid->SetRequiredFields(array('email','fullname'));
|
||||
$_SESSION['dol_entity'] = $_POST["entity"];
|
||||
//$openid->SetOptionalFields(array('dob','gender','postcode','country','language','timezone'));
|
||||
if ($openid->sendDiscoveryRequestToGetXRDS())
|
||||
{
|
||||
$openid->SetApprovedURL($protocol . $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"]); // Send Response from OpenID server to this script
|
||||
$openid->Redirect(); // This will redirect user to OpenID Server
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = $openid->GetError();
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Perform HTTP Request to OpenID server to validate key
|
||||
elseif($_GET['openid_mode'] == 'id_res')
|
||||
{
|
||||
$openid = new SimpleOpenID();
|
||||
$openid->SetIdentity($_GET['openid_identity']);
|
||||
$openid_validation_result = $openid->ValidateWithServer();
|
||||
if ($openid_validation_result == true)
|
||||
{
|
||||
// OK HERE KEY IS VALID
|
||||
|
||||
$sql ="SELECT login";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."user";
|
||||
$sql.=" WHERE openid = '".$db->escape($_GET['openid_identity'])."'";
|
||||
$sql.=" AND entity IN (0," . ($_SESSION["dol_entity"] ? $_SESSION["dol_entity"] : 1) . ")";
|
||||
|
||||
dol_syslog("functions_openid::check_user_password_openid sql=".$sql);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj=$db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$login=$obj->login;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if($openid->IsError() == true)
|
||||
{
|
||||
// ON THE WAY, WE GOT SOME ERROR
|
||||
$error = $openid->GetError();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Signature Verification Failed
|
||||
//echo "INVALID AUTHORIZATION";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if ($_GET['openid_mode'] == 'cancel')
|
||||
{
|
||||
// User Canceled your Request
|
||||
//echo "USER CANCELED REQUEST";
|
||||
return false;
|
||||
}
|
||||
|
||||
return $login;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -114,10 +114,20 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
'object_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement),
|
||||
'object_payment_term_code'=>$object->cond_reglement_code,
|
||||
'object_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):$object->cond_reglement),
|
||||
'object_total_ht'=>price($object->total_ht,0,$outputlangs),
|
||||
'object_total_vat'=>price($object->total_tva,0,$outputlangs),
|
||||
'object_total_ttc'=>price($object->total_ttc,0,$outputlangs),
|
||||
'object_total_discount_ht' => price($object->getTotalDiscount(), 0, $outputlangs),
|
||||
|
||||
'object_total_ht_locale'=>price($object->total_ht, 0, $outputlangs),
|
||||
'object_total_vat_locale'=>price($object->total_tva, 0, $outputlangs),
|
||||
'object_total_localtax1_locale'=>price($object->total_localtax1, 0, $outputlangs),
|
||||
'object_total_localtax2_locale'=>price($object->total_localtax2, 0, $outputlangs),
|
||||
'object_total_ttc_locale'=>price($object->total_ttc, 0, $outputlangs),
|
||||
'object_total_discount_ht_locale' => price($object->getTotalDiscount(), 0, $outputlangs),
|
||||
'object_total_ht'=>price2num($object->total_ht),
|
||||
'object_total_vat'=>price2num($object->total_tva),
|
||||
'object_total_localtax1'=>price2num($object->total_localtax1),
|
||||
'object_total_localtax2'=>price2num($object->total_localtax2),
|
||||
'object_total_ttc'=>price2num($object->total_ttc),
|
||||
'object_total_discount_ht' => price2num($object->getTotalDiscount()),
|
||||
|
||||
'object_vatrate'=>vatrate($object->tva),
|
||||
'object_note_private'=>$object->note,
|
||||
'object_note'=>$object->note_public,
|
||||
|
||||
@@ -114,10 +114,20 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
|
||||
'object_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement),
|
||||
'object_payment_term_code'=>$object->cond_reglement_code,
|
||||
'object_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):$object->cond_reglement),
|
||||
'object_total_ht'=>price($object->total_ht,0,$outputlangs),
|
||||
'object_total_vat'=>price($object->total_tva,0,$outputlangs),
|
||||
'object_total_ttc'=>price($object->total_ttc,0,$outputlangs),
|
||||
'object_total_discount_ht' => price($object->getTotalDiscount(), 0, $outputlangs),
|
||||
|
||||
'object_total_ht_locale'=>price($object->total_ht, 0, $outputlangs),
|
||||
'object_total_vat_locale'=>price($object->total_tva, 0, $outputlangs),
|
||||
'object_total_localtax1_locale'=>price($object->total_localtax1, 0, $outputlangs),
|
||||
'object_total_localtax2_locale'=>price($object->total_localtax2, 0, $outputlangs),
|
||||
'object_total_ttc_locale'=>price($object->total_ttc, 0, $outputlangs),
|
||||
'object_total_discount_ht_locale' => price($object->getTotalDiscount(), 0, $outputlangs),
|
||||
'object_total_ht'=>price2num($object->total_ht),
|
||||
'object_total_vat'=>price2num($object->total_tva),
|
||||
'object_total_localtax1'=>price2num($object->total_localtax1),
|
||||
'object_total_localtax2'=>price2num($object->total_localtax2),
|
||||
'object_total_ttc'=>price2num($object->total_ttc),
|
||||
'object_total_discount_ht' => price2num($object->getTotalDiscount()),
|
||||
|
||||
'object_vatrate'=>vatrate($object->tva),
|
||||
'object_note_private'=>$object->note,
|
||||
'object_note'=>$object->note_public,
|
||||
|
||||
@@ -124,10 +124,20 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
'object_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement),
|
||||
'object_payment_term_code'=>$object->cond_reglement_code,
|
||||
'object_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):$object->cond_reglement),
|
||||
|
||||
'object_total_ht_locale'=>price($object->total_ht, 0, $outputlangs),
|
||||
'object_total_vat_locale'=>price($object->total_tva, 0, $outputlangs),
|
||||
'object_total_localtax1_locale'=>price($object->total_localtax1, 0, $outputlangs),
|
||||
'object_total_localtax2_locale'=>price($object->total_localtax2, 0, $outputlangs),
|
||||
'object_total_ttc_locale'=>price($object->total_ttc, 0, $outputlangs),
|
||||
'object_total_discount_ht_locale' => price($object->getTotalDiscount(), 0, $outputlangs),
|
||||
'object_total_ht'=>price2num($object->total_ht),
|
||||
'object_total_vat'=>price2num($object->total_tva),
|
||||
'object_total_localtax1'=>price2num($object->total_localtax1),
|
||||
'object_total_localtax2'=>price2num($object->total_localtax2),
|
||||
'object_total_ttc'=>price2num($object->total_ttc),
|
||||
'object_total_discount_ht' => price2num($object->getTotalDiscount(), 0, $outputlangs),
|
||||
'object_total_discount_ht' => price2num($object->getTotalDiscount()),
|
||||
|
||||
'object_vatrate'=>(isset($object->tva)?vatrate($object->tva):''),
|
||||
'object_note_private'=>$object->note,
|
||||
'object_note'=>$object->note_public,
|
||||
|
||||
@@ -152,6 +152,27 @@ if ($forgetpasslink || $helpcenterlink)
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication))
|
||||
{
|
||||
$langs->load("users");
|
||||
|
||||
//if (! empty($conf->global->MAIN_OPENIDURL_PERUSER)) $url=
|
||||
echo '<br>';
|
||||
echo '<div align="center" style="margin-top: 4px;">';
|
||||
|
||||
$url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
|
||||
if (! empty($url)) print '<a class="alogin" href="'.$url.'">'.$langs->trans("LoginUsingOpenID").'</a>';
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<font class="warning">'.$langs->trans("ErrorOpenIDSetupNotComplete",'MAIN_AUTHENTICATION_OPENID_URL').'</font>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* 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
|
||||
@@ -73,9 +74,15 @@ $sql.= ", ".MAIN_DB_PREFIX."fichinter as f)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid ";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
if ($search_ref) $sql .= " AND f.ref LIKE '%".$db->escape($search_ref)."%'";
|
||||
if ($search_company) $sql .= " AND s.nom LIKE '%".$db->escape($search_company)."%'";
|
||||
if ($search_desc) $sql .= " AND (f.description LIKE '%".$db->escape($search_desc)."%' OR fd.description LIKE '%".$db->escape($search_desc)."%')";
|
||||
if ($search_ref) {
|
||||
$sql .= natural_search('f.ref', $search_ref);
|
||||
}
|
||||
if ($search_company) {
|
||||
$sql .= natural_search('s.nom', $search_company);
|
||||
}
|
||||
if ($search_desc) {
|
||||
$sql .= natural_search(array('f.description', 'fd.description'), $search_desc);
|
||||
}
|
||||
if (! $user->rights->societe->client->voir && empty($socid))
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid)
|
||||
|
||||
@@ -145,12 +145,13 @@ if (empty($dolibarr_main_data_root))
|
||||
define('DOL_CLASS_PATH', 'class/'); // Filesystem path to class dir (defined only for some code that want to be compatible with old versions without this parameter)
|
||||
define('DOL_DATA_ROOT', $dolibarr_main_data_root); // Filesystem data (documents)
|
||||
define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem core php (htdocs)
|
||||
// Define DOL_MAIN_URL_ROOT and DOL_URL_ROOT
|
||||
// Try to autodetec DOL_MAIN_URL_ROOT and DOL_URL_ROOT.
|
||||
// Note: autodetect works only in case 1, 2, 3 and 4 of phpunit test CoreTest.php. For case 5, 6, only setting value into conf.php will works.
|
||||
$tmp='';
|
||||
$found=0;
|
||||
$real_dolibarr_main_document_root=str_replace('\\','/',realpath($dolibarr_main_document_root)); // A) Ex: C:/xxx/dolibarr/htdocs
|
||||
$pathroot=$_SERVER["DOCUMENT_ROOT"]; // B) Ex: C:/Program Files/wamp/www/
|
||||
$paths=explode('/',str_replace('\\','/',$_SERVER["SCRIPT_NAME"])); // C) Ex: /dolibarr/htdocs/admin/system/phpinfo.php
|
||||
$real_dolibarr_main_document_root=str_replace('\\','/',realpath($dolibarr_main_document_root)); // A) Value found into config file, to say where are store htdocs files. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
|
||||
$pathroot=$_SERVER["DOCUMENT_ROOT"]; // B) Value reported by web server setup, to say where is root of web server instance. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
|
||||
$paths=explode('/',str_replace('\\','/',$_SERVER["SCRIPT_NAME"])); // C) Value reported by web server, to say full path on filesystem of a file. Ex: /dolibarr/htdocs/admin/system/phpinfo.php
|
||||
$concatpath='';
|
||||
foreach($paths as $tmppath) // We check to find (B+start of C)=A
|
||||
{
|
||||
|
||||
@@ -1200,7 +1200,8 @@ class CommandeFournisseur extends CommonOrder
|
||||
}
|
||||
if ($result == 0 || $result == -1)
|
||||
{
|
||||
$this->error="No price found for this quantity. Quantity may be too low ?";
|
||||
$langs->load("errors");
|
||||
$this->error = "Ref " . $prod->ref . " " . $langs->trans("ErrorQtyTooLowForThisSupplier");
|
||||
$this->db->rollback();
|
||||
dol_syslog(get_class($this)."::addline result=".$result." - ".$this->error, LOG_DEBUG);
|
||||
return -1;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* 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
|
||||
@@ -92,11 +93,11 @@ $sql.= " AND cf.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($sref)
|
||||
{
|
||||
$sql.= " AND cf.ref LIKE '%".$db->escape($sref)."%'";
|
||||
$sql .= natural_search('cf.ref', $sref);
|
||||
}
|
||||
if ($snom)
|
||||
{
|
||||
$sql.= " AND s.nom LIKE '%".$db->escape($snom)."%'";
|
||||
$sql .= natural_search('s.nom', $snom);
|
||||
}
|
||||
if ($suser)
|
||||
{
|
||||
@@ -108,7 +109,7 @@ if ($sttc)
|
||||
}
|
||||
if ($sall)
|
||||
{
|
||||
$sql.= " AND (cf.ref LIKE '%".$db->escape($sall)."%' OR cf.note LIKE '%".$db->escape($sall)."%')";
|
||||
$sql .= natural_search(array('cf.ref', 'cf.note_public'), $sall);
|
||||
}
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
|
||||
|
||||
@@ -929,7 +929,7 @@ elseif ($action == 'calculate')
|
||||
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
$result=$object->update_price(0,($calculationrule=='totalofround'?0:1));
|
||||
$result=$object->update_price(0, ($calculationrule=='totalofround'?0:1), 0, $object->thirdparty);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_print_error($db,$result);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* 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
|
||||
@@ -130,12 +131,12 @@ if (GETPOST('filtre'))
|
||||
|
||||
if (GETPOST("search_ref"))
|
||||
{
|
||||
if (is_numeric(GETPOST("search_ref"))) $sql .= " AND (fac.rowid = ".GETPOST("search_ref",'int')." OR fac.ref = '".$db->escape(GETPOST("search_ref"))."')"; // For backward compatibility
|
||||
else $sql .= " AND fac.ref LIKE '%".$db->escape(GETPOST("search_ref"))."%'";
|
||||
if (is_numeric(GETPOST("search_ref"))) $sql .= natural_search(array('fac.rowid', 'fac.ref'), GETPOST('search_ref'));// For backward compatibility
|
||||
else $sql .= natural_search('fac.ref', GETPOST("search_ref"));
|
||||
}
|
||||
if (GETPOST("search_ref_supplier"))
|
||||
{
|
||||
$sql .= " AND fac.ref_supplier LIKE '%".$db->escape(GETPOST("search_ref_supplier"))."%'";
|
||||
$sql .= natural_search('fac.ref_supplier', GETPOST('search_ref_supplier'));
|
||||
}
|
||||
if ($month > 0)
|
||||
{
|
||||
@@ -150,12 +151,12 @@ else if ($year > 0)
|
||||
}
|
||||
if (GETPOST("search_libelle"))
|
||||
{
|
||||
$sql .= " AND fac.libelle LIKE '%".$db->escape(GETPOST("search_libelle"))."%'";
|
||||
$sql .= natural_search('fac.libelle', GETPOST('search_libelle'));
|
||||
}
|
||||
|
||||
if (GETPOST("search_societe"))
|
||||
{
|
||||
$sql .= " AND s.nom LIKE '%".$db->escape(GETPOST("search_societe"))."%'";
|
||||
$sql .= natural_search('s.nom', GETPOST('search_societe'));
|
||||
}
|
||||
|
||||
if (GETPOST("search_montant_ht"))
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.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
|
||||
@@ -88,15 +89,18 @@ $sql.= " WHERE s.fk_stcomm = st.id AND s.fournisseur = 1";
|
||||
$sql.= " AND s.entity IN (".getEntity('societe', 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;
|
||||
if ($socname)
|
||||
{
|
||||
$sql .= " AND s.nom LIKE '%".$db->escape($socname)."%'";
|
||||
if ($socname) {
|
||||
$sql .= natural_search('s.nom', $socname);
|
||||
$sortfield = "s.nom";
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
if ($search_nom) $sql .= " AND s.nom LIKE '%".$db->escape($search_nom)."%'";
|
||||
if ($search_nom) {
|
||||
$sql .= natural_search('s.nom', $search_nom);
|
||||
}
|
||||
if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'";
|
||||
if ($search_town) $sql .= " AND s.town LIKE '%".$db->escape($search_town)."%'";
|
||||
if ($search_town) {
|
||||
$sql .= natural_search('s.town', $search_town);
|
||||
}
|
||||
if ($search_code_fournisseur) $sql .= " AND s.code_fournisseur LIKE '%".$db->escape($search_code_fournisseur)."%'";
|
||||
if ($search_compta_fournisseur) $sql .= " AND s.code_compta_fournisseur LIKE '%".$db->escape($search_compta_fournisseur)."%'";
|
||||
if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'";
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
* 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
|
||||
@@ -35,35 +36,32 @@ $langs->load("suppliers");
|
||||
|
||||
if (!$user->rights->produit->lire && !$user->rights->service->lire) accessforbidden();
|
||||
|
||||
$sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"];
|
||||
$sRefSupplier=isset($_GET["srefsupplier"])?$_GET["srefsupplier"]:$_POST["srefsupplier"];
|
||||
$snom=isset($_GET["snom"])?$_GET["snom"]:$_POST["snom"];
|
||||
$sref = GETPOST('sref');
|
||||
$sRefSupplier = GETPOST('srefsupplier');
|
||||
$snom = GETPOST('snom');
|
||||
$type = GETPOST('type');
|
||||
|
||||
$type=isset($_GET["type"])?$_GET["type"]:$_POST["type"];
|
||||
|
||||
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
||||
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
||||
$page = $_GET["page"];
|
||||
$sortfield = GETPOST('sortfield');
|
||||
$sortorder = GETPOST('sortorder');
|
||||
$page = GETPOST('page');
|
||||
if ($page < 0) {
|
||||
$page = 0 ; }
|
||||
$page = 0 ;
|
||||
}
|
||||
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
if (! $sortfield) $sortfield="p.ref";
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield = 'p.ref';
|
||||
if (! $sortorder) $sortorder = 'DESC';
|
||||
|
||||
if (! empty($_POST["button_removefilter"]))
|
||||
if (GETPOST('button_removefilter'))
|
||||
{
|
||||
$sref="";
|
||||
$sRefSupplier="";
|
||||
$snom="";
|
||||
$sref = '';
|
||||
$sRefSupplier = '';
|
||||
$snom = '';
|
||||
}
|
||||
|
||||
if ($_GET["fourn_id"] > 0 || $_POST["fourn_id"] > 0)
|
||||
{
|
||||
$fourn_id = isset($_GET["fourn_id"])?$_GET["fourn_id"]:$_POST["fourn_id"];
|
||||
}
|
||||
$fourn_id = GETPOST('fourn_id', 'int');
|
||||
|
||||
if (isset($_REQUEST['catid']))
|
||||
{
|
||||
@@ -96,38 +94,33 @@ if ($catid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.f
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as ppf ON p.rowid = ppf.fk_product";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ppf.fk_soc = s.rowid";
|
||||
$sql.= " WHERE p.entity IN (".getEntity('product', 1).")";
|
||||
if ($_POST["mode"] == 'search')
|
||||
if (GETPOST('mode', 'alpha') == 'search')
|
||||
{
|
||||
$sql .= " AND (p.ref LIKE '%".$_POST["sall"]."%'";
|
||||
$sql .= " OR p.label LIKE '%".$_POST["sall"]."%')";
|
||||
if ($sRefSupplier)
|
||||
{
|
||||
$sql .= " AND ppf.ref_fourn LIKE '%".$sRefSupplier."%'";
|
||||
}
|
||||
$sql .= natural_search(array('p.ref', 'p.label'), GETPOST('mode', 'alpha'));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($_GET["type"] || $_POST["type"])
|
||||
if (GETPOST('type'))
|
||||
{
|
||||
$sql .= " AND p.fk_product_type = ".(isset($_GET["type"])?$_GET["type"]:$_POST["type"]);
|
||||
$sql .= " AND p.fk_product_type = " . GETPOST('type','int');
|
||||
}
|
||||
if ($sref)
|
||||
{
|
||||
$sql .= " AND p.ref LIKE '%".$sref."%'";
|
||||
}
|
||||
if ($sRefSupplier)
|
||||
{
|
||||
$sql .= " AND ppf.ref_fourn LIKE '%".$sRefSupplier."%'";
|
||||
$sql .= natural_search('p.ref', $sref);
|
||||
}
|
||||
if ($snom)
|
||||
{
|
||||
$sql .= " AND p.label LIKE '%".$snom."%'";
|
||||
$sql .= natural_search('p.label', $snom);
|
||||
}
|
||||
if($catid)
|
||||
{
|
||||
$sql .= " AND cp.fk_categorie = ".$catid;
|
||||
}
|
||||
}
|
||||
if ($sRefSupplier)
|
||||
{
|
||||
$sql .= natural_search('ppf.ref_fourn', $sRefSupplier);
|
||||
}
|
||||
if ($fourn_id > 0)
|
||||
{
|
||||
$sql .= " AND ppf.fk_soc = ".$fourn_id;
|
||||
|
||||
@@ -46,6 +46,10 @@ create table llx_commandedet_extrafields
|
||||
|
||||
ALTER TABLE llx_commandedet_extrafields ADD INDEX idx_commandedet_extrafields (fk_object);
|
||||
|
||||
|
||||
ALTER TABLE llx_facturedet_rec ADD COLUMN info_bits integer DEFAULT 0 after total_ttc; -- TVA NPR ou non
|
||||
|
||||
|
||||
create table llx_facturedet_extrafields
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
|
||||
@@ -43,6 +43,7 @@ create table llx_facturedet_rec
|
||||
total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1 for total quantity of line
|
||||
total_localtax2 double(24,8) DEFAULT 0, -- total LocalTax2 for total quantity of line
|
||||
total_ttc double(24,8), -- Total TTC de la ligne toute quantity et incluant remise ligne et globale
|
||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||
special_code integer UNSIGNED DEFAULT 0, -- code pour les lignes speciales
|
||||
rang integer DEFAULT 0 -- ordre d'affichage
|
||||
|
||||
|
||||
26
htdocs/install/mysql/tables/llx_soc_localtaxes
Normal file
26
htdocs/install/mysql/tables/llx_soc_localtaxes
Normal file
@@ -0,0 +1,26 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2013 Juanjo Menent <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/>.
|
||||
--
|
||||
-- ===========================================================================
|
||||
|
||||
create table llx_soc_localtaxes
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_soc integer,
|
||||
fk_tva integer,
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||
)ENGINE=innodb;
|
||||
22
htdocs/install/mysql/tables/llx_soc_localtaxes.key.sql
Normal file
22
htdocs/install/mysql/tables/llx_soc_localtaxes.key.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 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/>.
|
||||
--
|
||||
-- ============================================================================
|
||||
|
||||
|
||||
ALTER TABLE llx_soc_localtax ADD UNIQUE INDEX uk_soc_localtax_tax (fk_soc, fk_tax);
|
||||
|
||||
ALTER TABLE llx_propal ADD INDEX idx_soc_localtax_fk_soc (fk_soc);
|
||||
@@ -51,5 +51,5 @@ create table llx_socpeople
|
||||
default_lang varchar(6),
|
||||
canvas varchar(32), -- type of canvas if used (null by default)
|
||||
import_key varchar(14),
|
||||
statut tinyint(4)
|
||||
statut tinyint
|
||||
)ENGINE=innodb;
|
||||
|
||||
@@ -85,6 +85,8 @@ LocalTax1IsUsedES=Subjecte a RE
|
||||
LocalTax1IsNotUsedES=No subjecte a RE
|
||||
LocalTax2IsUsedES=Subjecte a IRPF
|
||||
LocalTax2IsNotUsedES=No subjecte a IRPF
|
||||
LocalTax1ES=RE
|
||||
LocalTax2ES=IRPF
|
||||
ThirdPartyEMail=%s
|
||||
WrongCustomerCode=Codi client incorrecte
|
||||
WrongSupplierCode=Códi proveïdor incorrecte
|
||||
|
||||
@@ -85,6 +85,8 @@ LocalTax1IsUsedES= RE is used
|
||||
LocalTax1IsNotUsedES= RE is not used
|
||||
LocalTax2IsUsedES= IRPF is used
|
||||
LocalTax2IsNotUsedES= IRPF is not used
|
||||
LocalTax1ES=RE
|
||||
LocalTax2ES=IRPF
|
||||
ThirdPartyEMail=%s
|
||||
WrongCustomerCode=Customer code invalid
|
||||
WrongSupplierCode=Supplier code invalid
|
||||
|
||||
@@ -126,6 +126,7 @@ ErrorFailedToAddContact=Failed to add contact
|
||||
ErrorDateMustBeBeforeToday=The date can not be greater than today
|
||||
ErrorPaymentModeDefinedToWithoutSetup=A payment mode was set to type %s but setup of module Invoice was not completed to define information to show for this payment mode.
|
||||
ErrorPHPNeedModule=Error, your PHP must have module <b>%s</b> installed to use this feature.
|
||||
ErrorOpenIDSetupNotComplete=You setup Dolibarr config file to allow OpenID authentication, but URL of OpenID service is not defined into constant %s
|
||||
|
||||
# Warnings
|
||||
WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined
|
||||
|
||||
@@ -388,7 +388,7 @@ OtherInformations=Other informations
|
||||
Quantity=Quantity
|
||||
Qty=Qty
|
||||
ChangedBy=Changed by
|
||||
ReCalculate=Rebuild
|
||||
ReCalculate=Recalculate
|
||||
ResultOk=Success
|
||||
ResultKo=Failure
|
||||
Reporting=Reporting
|
||||
|
||||
@@ -117,4 +117,5 @@ DontDowngradeSuperAdmin=Only a superadmin can downgrade a superadmin
|
||||
HierarchicalResponsible=Hierarchical responsible
|
||||
HierarchicView=Hierarchical view
|
||||
UseTypeFieldToChange=Use field Type to change
|
||||
|
||||
OpenIDURL=OpenID URL
|
||||
LoginUsingOpenID=Login using OpenID
|
||||
@@ -8,5 +8,5 @@ descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Create a customer invoice automatically a
|
||||
descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE=Create a customer invoice automatically after a contract is validated
|
||||
descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Create a customer invoice automatically after a customer order is closed
|
||||
descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Classify linked source proposal to billed when customer order is set to paid
|
||||
descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classify linked source customer order to billed when customer invoice is set to paid
|
||||
descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classify the customer's order as invoiced when the bill(s) are higher than the order
|
||||
descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is set to paid
|
||||
descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is validated
|
||||
|
||||
@@ -85,6 +85,8 @@ LocalTax1IsUsedES=Sujeto a RE
|
||||
LocalTax1IsNotUsedES=No sujeto a RE
|
||||
LocalTax2IsUsedES=Sujeto a IRPF
|
||||
LocalTax2IsNotUsedES=No sujeto a IRPF
|
||||
LocalTax1ES=RE
|
||||
LocalTax2ES=IRPF
|
||||
ThirdPartyEMail=%s
|
||||
WrongCustomerCode=Código cliente incorrecto
|
||||
WrongSupplierCode=Código proveedor incorrecto
|
||||
|
||||
@@ -85,6 +85,8 @@ LocalTax1IsUsedES= Assujetti à RE
|
||||
LocalTax1IsNotUsedES= Non assujetti à RE
|
||||
LocalTax2IsUsedES= Assujetti à IRPF
|
||||
LocalTax2IsNotUsedES= Non assujetti à IRPF
|
||||
LocalTax1ES=RE
|
||||
LocalTax2ES=IRPF
|
||||
ThirdPartyEMail=%s
|
||||
WrongCustomerCode=Code client incorrect
|
||||
WrongSupplierCode=Code fournisseur incorrect
|
||||
|
||||
@@ -126,6 +126,7 @@ ErrorFailedToAddContact=Echec à l'ajout du contact
|
||||
ErrorDateMustBeBeforeToday=La date ne peut pas être supérieure à aujourd'hui
|
||||
ErrorPaymentModeDefinedToWithoutSetup=Un mode de paiement a été défini de type %s mais la configuration du module Facture n'a pas été complété pour définir les informations afficher pour ce mode de paiment.
|
||||
ErrorPHPNeedModule=Erreur, votre PHP doit avoir le module <b>%s</b> installé pour utiliser cette fonctionnalité.
|
||||
ErrorOpenIDSetupNotComplete=Vous avez configuré Dolibarr pour accepter l'authentication OpenID, mais l'URL du service OpenID n'est pas défini dans la constante %s
|
||||
|
||||
# Warnings
|
||||
WarningMandatorySetupNotComplete=Les informations de configuration obligatoire doivent être renseignées
|
||||
|
||||
@@ -117,3 +117,5 @@ DontDowngradeSuperAdmin=Seul un superadministrateur peut rétrograder un superad
|
||||
HierarchicalResponsible=Responsable hiérarchique
|
||||
HierarchicView=Vue hiérarchique
|
||||
UseTypeFieldToChange=Modifier le champ Type pour changer
|
||||
OpenIDURL=URL de connexion OpenID
|
||||
LoginUsingOpenID=Se logguer via OpenID
|
||||
@@ -9,4 +9,4 @@ descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE=Créer une facture client automatiqueme
|
||||
descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Créer une facture client automatiquement à la clôture d'une commande client
|
||||
descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Classer facturée la proposition commerciale source quand la commande client dérivée est classée payée
|
||||
descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classer facturée la ou les commandes clients source quand la facture client dérivée est classée payée
|
||||
descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classer facturée la commande client source lorsque la facture ou les factures sont supérieures à la commande
|
||||
descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classer facturée la ou les commandes clients source lorsque la facture client dérivée est validée
|
||||
|
||||
@@ -443,7 +443,7 @@ if (! defined('NOLOGIN'))
|
||||
$login = checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmode);
|
||||
if ($login)
|
||||
{
|
||||
$dol_authmode=$conf->authmode; // This properties is defined only when logged to say what mode was successfully used
|
||||
$dol_authmode=$conf->authmode; // This properties is defined only when logged, to say what mode was successfully used
|
||||
$dol_tz=$_POST["tz"];
|
||||
$dol_tz_string=$_POST["tz_string"];
|
||||
$dol_dst=0;
|
||||
|
||||
@@ -103,7 +103,7 @@ function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localta
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$product = new ProductFournisseur($db);
|
||||
if ($product->fetch_product_fournisseur_price($fk_pa)) {
|
||||
$paht_ret = $product->fourn_unitprice;
|
||||
$paht_ret = $product->fourn_unitprice * (1 - $product->fourn_remise_percent / 100);
|
||||
if ($conf->global->MARGIN_TYPE == "2" && $product->fourn_unitcharges > 0)
|
||||
$paht_ret += $product->fourn_unitcharges;
|
||||
}
|
||||
|
||||
@@ -141,33 +141,19 @@ else
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND pl.lang = '".$langs->getDefaultLang() ."'";
|
||||
}
|
||||
$sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
|
||||
if ($sall)
|
||||
{
|
||||
if ($sall) {
|
||||
// For natural search
|
||||
$scrit = explode(' ', $sall);
|
||||
$params = array('p.ref', 'p.label', 'p.description', 'p.note');
|
||||
// multilang
|
||||
if ($conf->global->MAIN_MULTILANGS) // si l'option est active
|
||||
{
|
||||
foreach ($scrit as $crit) {
|
||||
$sql.= " AND (p.ref LIKE '%".$db->escape($crit)."%' OR p.label LIKE '%".$db->escape($crit)."%' OR p.description LIKE '%".$db->escape($crit)."%' OR p.note LIKE '%".$db->escape($crit)."%' OR pl.description LIKE '%".$db->escape($sall)."%' OR pl.note LIKE '%".$db->escape($sall)."%'";
|
||||
if (! empty($conf->barcode->enabled))
|
||||
{
|
||||
$sql.= " OR p.barcode LIKE '%".$db->escape($crit)."%'";
|
||||
}
|
||||
$sql.= ')';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($scrit as $crit) {
|
||||
$sql.= " AND (p.ref LIKE '%".$db->escape($crit)."%' OR p.label LIKE '%".$db->escape($crit)."%' OR p.description LIKE '%".$db->escape($crit)."%' OR p.note LIKE '%".$db->escape($crit)."%'";
|
||||
if (! empty($conf->barcode->enabled))
|
||||
{
|
||||
$sql.= " OR p.barcode LIKE '%".$db->escape($crit)."%'";
|
||||
}
|
||||
$sql.= ')';
|
||||
$params[] = 'pl.description';
|
||||
$params[] = 'pl.note';
|
||||
}
|
||||
if (! empty($conf->barcode->enabled)) {
|
||||
$params[] = 'p.barcode';
|
||||
}
|
||||
$sql .= natural_search($params, $sall);
|
||||
}
|
||||
// if the type is not 1, we show all products (type = 0,2,3)
|
||||
if (dol_strlen($type))
|
||||
@@ -175,16 +161,19 @@ else
|
||||
if ($type == 1) $sql.= " AND p.fk_product_type = '1'";
|
||||
else $sql.= " AND p.fk_product_type <> '1'";
|
||||
}
|
||||
if ($sref) $sql.= " AND p.ref LIKE '%".$sref."%'";
|
||||
if ($sref) {
|
||||
$sql .= natural_search('p.ref', $sref);
|
||||
}
|
||||
if ($sbarcode) $sql.= " AND p.barcode LIKE '%".$sbarcode."%'";
|
||||
if ($snom)
|
||||
{
|
||||
$params = array('p.label');
|
||||
// multilang
|
||||
if ($conf->global->MAIN_MULTILANGS) // si l'option est active
|
||||
{
|
||||
$sql.= " AND (p.label LIKE '%".$db->escape($snom)."%' OR (pl.label IS NOT null AND pl.label LIKE '%".$db->escape($snom)."%'))";
|
||||
$params[] = 'pl.label';
|
||||
}
|
||||
else $sql.= " AND p.label LIKE '%".$db->escape($snom)."%'";
|
||||
$sql .= natural_search($params, $snom);
|
||||
}
|
||||
if (isset($tosell) && dol_strlen($tosell) > 0) $sql.= " AND p.tosell = ".$db->escape($tosell);
|
||||
if (isset($tobuy) && dol_strlen($tobuy) > 0) $sql.= " AND p.tobuy = ".$db->escape($tobuy);
|
||||
|
||||
@@ -137,7 +137,9 @@ if ($action == 'order' && isset($_POST['valid'])) {
|
||||
$id = $order->create($user);
|
||||
if ($id < 0) {
|
||||
$fail++;
|
||||
setEventMessage($langs->trans('OrderFail'), 'errors');
|
||||
$msg = $langs->trans('OrderFail') . " : ";
|
||||
$msg .= $order->error;
|
||||
setEventMessage($msg, 'errors');
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@@ -163,8 +165,6 @@ $sql .= ', p.tms as datem, p.duration, p.tobuy, p.seuil_stock_alerte,';
|
||||
$sql .= ' SUM(COALESCE(s.reel, 0)) as stock_physique';
|
||||
$sql .= ', p.desiredstock';
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'product as p';
|
||||
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_fournisseur_price as pf';
|
||||
$sql .= ' ON p.rowid = pf.fk_product';
|
||||
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_stock as s';
|
||||
$sql .= ' ON p.rowid = s.fk_product';
|
||||
$sql.= ' WHERE p.entity IN (' . getEntity("product", 1) . ')';
|
||||
@@ -205,7 +205,7 @@ if (!empty($canvas)) {
|
||||
$sql .= ' GROUP BY p.rowid, p.ref, p.label, p.price';
|
||||
$sql .= ', p.price_ttc, p.price_base_type,p.fk_product_type, p.tms';
|
||||
$sql .= ', p.duration, p.tobuy, p.seuil_stock_alerte';
|
||||
$sql .= ', p.desiredstock';
|
||||
$sql .= ', p.desiredstock, s.fk_product';
|
||||
$sql .= ' HAVING p.desiredstock > SUM(COALESCE(s.reel, 0))';
|
||||
$sql .= ' AND p.desiredstock > 0';
|
||||
if ($salert == 'on') {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Bariley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2010 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
|
||||
@@ -84,17 +85,17 @@ if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$pro
|
||||
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
|
||||
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||
if ($_GET["search_ref"])
|
||||
if ($search_ref)
|
||||
{
|
||||
$sql.= " AND p.ref LIKE '%".$db->escape($search_ref)."%'";
|
||||
$sql .= natural_search('p.ref', $search_ref);
|
||||
}
|
||||
if ($_GET["search_label"])
|
||||
if ($search_label)
|
||||
{
|
||||
$sql.= " AND p.title LIKE '%".$db->escape($search_label)."%'";
|
||||
$sql .= natural_search('p.title', $search_label);
|
||||
}
|
||||
if ($_GET["search_societe"])
|
||||
if ($search_societe)
|
||||
{
|
||||
$sql.= " AND s.nom LIKE '%".$db->escape($search_societe)."%'";
|
||||
$sql .= natural_search('s.nom', $search_societe);
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||
|
||||
@@ -1665,6 +1665,41 @@ class Societe extends CommonObject
|
||||
return $contacts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoie la liste des contacts de cette societe
|
||||
*
|
||||
* @return array $contacts tableau des contacts
|
||||
*/
|
||||
function contact_array_objects()
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
|
||||
$contacts = array();
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = '".$this->id."'";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$nump = $this->db->num_rows($resql);
|
||||
if ($nump)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $nump)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$contact = new Contact($this->db);
|
||||
$contact->fetch($obj->rowid);
|
||||
$contacts[] = $contact;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
return $contacts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property of contact from its id
|
||||
*
|
||||
|
||||
@@ -58,6 +58,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
* Search area
|
||||
*/
|
||||
$rowspan=2;
|
||||
if (! empty($conf->barcode->enabled)) $rowspan++;
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/societe/societe.php">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="noborder nohover" width="100%">';
|
||||
@@ -66,6 +67,13 @@ print '<td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||
print "<tr ".$bc[false]."><td>";
|
||||
print $langs->trans("Name").':</td><td><input class="flat" type="text" size="14" name="search_nom_only"></td>';
|
||||
print '<td rowspan="'.$rowspan.'"><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
|
||||
if (! empty($conf->barcode->enabled))
|
||||
{
|
||||
print "<tr ".$bc[false]."><td>";
|
||||
print $langs->trans("BarCode").':</td><td><input class="flat" type="text" size="14" name="sbarcode"></td>';
|
||||
//print '<td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print "<tr ".$bc[false]."><td>";
|
||||
print $langs->trans("Other").':</td><td><input class="flat" type="text" size="14" name="search_all"></td>';
|
||||
//print '<td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td>';
|
||||
|
||||
268
htdocs/societe/localtaxes.php
Normal file
268
htdocs/societe/localtaxes.php
Normal file
@@ -0,0 +1,268 @@
|
||||
<?php
|
||||
/* Copyright (C) 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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/societe/localtaxes.php
|
||||
* \ingroup societe
|
||||
* \brief Page of third party localtaxes rates
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid','int');
|
||||
$vatid = GETPOST('vatid','int');
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'societe', $socid, '&societe');
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('localtaxesthirdparty'));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array('id'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors);
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$contactstatic = new Contact($db);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
/*
|
||||
* Fiche categorie de client et/ou fournisseur
|
||||
*/
|
||||
if ($socid)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
|
||||
|
||||
$soc = new Societe($db);
|
||||
$result = $soc->fetch($socid);
|
||||
llxHeader("",$langs->trans("LocalTaxes"),'');
|
||||
|
||||
if (! empty($conf->notification->enabled)) $langs->load("mails");
|
||||
$head = societe_prepare_head($soc);
|
||||
|
||||
dol_fiche_head($head, 'localtaxes', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="25%">'.$langs->trans("ThirdPartyName").'</td><td colspan="3">';
|
||||
print $form->showrefnav($soc,'socid','',0,'rowid','nom');
|
||||
print '</td></tr>';
|
||||
|
||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$soc->prefix_comm.'</td></tr>';
|
||||
}
|
||||
|
||||
if ($soc->client)
|
||||
{
|
||||
print '<tr><td>';
|
||||
print $langs->trans('CustomerCode').'</td><td colspan="3">';
|
||||
print $soc->code_client;
|
||||
if ($soc->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($soc->fournisseur)
|
||||
{
|
||||
print '<tr><td>';
|
||||
print $langs->trans('SupplierCode').'</td><td colspan="3">';
|
||||
print $soc->code_fournisseur;
|
||||
if ($soc->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if (! empty($conf->barcode->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="3">'.$soc->barcode.'</td></tr>';
|
||||
}
|
||||
|
||||
print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">";
|
||||
dol_print_address($soc->address, 'gmap', 'thirdparty', $soc->id);
|
||||
print "</td></tr>";
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$soc->zip."</td>";
|
||||
print '<td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$soc->town."</td></tr>";
|
||||
|
||||
// Country
|
||||
if ($soc->country) {
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
$img=picto_from_langcode($soc->country_code);
|
||||
print ($img?$img.' ':'');
|
||||
print $soc->country;
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.$langs->trans('EMail').'</td><td colspan="3">';
|
||||
print dol_print_email($soc->email,0,$soc->id,'AC_EMAIL');
|
||||
print '</td></tr>';
|
||||
|
||||
// Web
|
||||
print '<tr><td>'.$langs->trans('Web').'</td><td colspan="3">';
|
||||
print dol_print_url($soc->url);
|
||||
print '</td></tr>';
|
||||
|
||||
// Phone / Fax
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->tel,$soc->country_code,0,$soc->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').'</td></tr>';
|
||||
|
||||
|
||||
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
|
||||
{
|
||||
print '<tr><td class="nowrap">'.$langs->transcountry('LocalTax1IsUsed',$mysoc->country_code).'</td><td colspan="3">';
|
||||
print yn($soc->localtax1_assuj);
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="nowrap">'.$langs->transcountry('LocalTax2IsUsed',$mysoc->country_code).'</td><td colspan="3">';
|
||||
print yn($soc->localtax2_assuj);
|
||||
print '</td></tr>';
|
||||
}
|
||||
elseif($mysoc->localtax1_assuj=="1")
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry('LocalTax1IsUsed',$mysoc->country_code).'</td><td colspan="3">';
|
||||
print yn($soc->localtax1_assuj);
|
||||
print '</td></tr>';
|
||||
}
|
||||
elseif($mysoc->localtax2_assuj=="1")
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry('LocalTax2IsUsed',$mysoc->country_code).'</td><td colspan="3">';
|
||||
print yn($soc->localtax2_assuj);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
// TODO: Improve and move to tpl
|
||||
|
||||
// Localtaxes
|
||||
|
||||
print '<table id="tablelines" class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre nodrag nodrop">';
|
||||
|
||||
// Description
|
||||
print '<td>'.$langs->trans('Description').'</td>';
|
||||
|
||||
// VAT
|
||||
print '<td align="right" width="80">'.$langs->trans('VAT').' (%)</td>';
|
||||
|
||||
// Localtax 1
|
||||
if ($mysoc->localtax1_assuj=="1" && $soc->localtax1_assuj)
|
||||
print '<td align="right" width="80">'.$langs->transcountry('LocalTax1',$mysoc->country_code).' (%)</td>';
|
||||
|
||||
if ($mysoc->localtax2_assuj=="1" && $soc->localtax2_assuj)
|
||||
print '<td align="right" width="80">'.$langs->transcountry('LocalTax2',$mysoc->country_code).' (%)</td>';
|
||||
|
||||
//print '<td width="10"></td>';
|
||||
if ($user->rights->societe->creer)
|
||||
print '<td width="10" class="nowrap"></td>'; // No width to allow autodim
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
$sql = "SELECT DISTINCT t.rowid, t.note, t.taux, t.localtax1, t.localtax2, t.recuperableonly";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
|
||||
$sql.= " WHERE t.fk_pays = p.rowid";
|
||||
$sql.= " AND t.active = 1";
|
||||
$sql.= " AND p.code IN ('".$mysoc->country_code."')";
|
||||
$sql.= " ORDER BY t.taux ASC, t.recuperableonly ASC";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$var=True;
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if ($action == 'edit' && $obj->rowid==$vatid && $user->rights->societe->creer)
|
||||
{
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?socid='.$soc->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="updatetva">';
|
||||
print '<input type="hidden" name="vatid" value="'.$vatid.'">';
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
print '<td>'.$obj->note.'</td>';
|
||||
print '<td align="right">'.$obj->taux.'</td>';
|
||||
|
||||
if ($mysoc->localtax1_assuj=="1" && $soc->localtax1_assuj)
|
||||
print '<td align="right"><input size="4" type="text" class="flat" name="localtax1" value="'.$obj->localtax1.'"></td>';
|
||||
if ($mysoc->localtax2_assuj=="1" && $soc->localtax2_assuj)
|
||||
print '<td align="right"><input size="4" type="text" class="flat" name="localtax2" value="'.$obj->localtax2.'"></td>';
|
||||
|
||||
print '<td align="right"><input type="submit" class="button" name="save" value="'.$langs->trans('Save').'">';
|
||||
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'"></td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
print '<td>'.$obj->note.'</td>';
|
||||
print '<td align="right">'.$obj->taux.'</td>';
|
||||
if ($mysoc->localtax1_assuj=="1" && $soc->localtax1_assuj)
|
||||
print '<td align="right">'.$obj->localtax1.'</td>';
|
||||
if ($mysoc->localtax2_assuj=="1" && $soc->localtax2_assuj)
|
||||
print '<td align="right">'.$obj->localtax2.'</td>';
|
||||
if ($user->rights->societe->creer)
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&socid='.$soc->id.'&vatid='.$obj->rowid.'">'.img_edit().'</a></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
@@ -41,6 +41,7 @@ $result = restrictedArea($user,'societe',$socid,'');
|
||||
$search_nom=trim(GETPOST("search_nom"));
|
||||
$search_nom_only=trim(GETPOST("search_nom_only"));
|
||||
$search_all=trim(GETPOST("search_all"));
|
||||
$sbarcode=trim(GETPOST("sbarcode"));
|
||||
$search_town=trim(GETPOST("search_town"));
|
||||
$socname=trim(GETPOST("socname"));
|
||||
$search_idprof1=trim(GETPOST('search_idprof1'));
|
||||
@@ -70,14 +71,14 @@ $pagenext = $page + 1;
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Recherche
|
||||
// special search
|
||||
if ($mode == 'search')
|
||||
{
|
||||
$search_nom=$socname;
|
||||
|
||||
$sql = "SELECT s.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
if ($search_sale || !$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
// We'll need this table joined to the select in order to filter by categ
|
||||
if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as cs";
|
||||
$sql.= " WHERE s.entity IN (".getEntity('societe', 1).")";
|
||||
@@ -158,6 +159,7 @@ if (GETPOST("button_removefilter_x"))
|
||||
$search_sale='';
|
||||
$socname="";
|
||||
$search_nom="";
|
||||
$sbarcode="";
|
||||
$search_town="";
|
||||
$search_idprof1='';
|
||||
$search_idprof2='';
|
||||
@@ -185,7 +187,7 @@ if ($socname)
|
||||
*/
|
||||
$title=$langs->trans("ListOfThirdParties");
|
||||
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.town, s.datec, s.datea,";
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.barcode, s.town, s.datec, s.datea,";
|
||||
$sql.= " st.libelle as stcomm, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,";
|
||||
$sql.= " s.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idprof4";
|
||||
// We'll need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
@@ -195,7 +197,7 @@ if ($search_categ) $sql .= ", cs.fk_categorie, cs.fk_societe";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."c_stcomm as st";
|
||||
// We'll need this table joined to the select in order to filter by sale
|
||||
if ($search_sale || !$user->rights->societe->client->voir) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
// We'll need this table joined to the select in order to filter by categ
|
||||
if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as cs";
|
||||
$sql.= " WHERE s.fk_stcomm = st.id";
|
||||
@@ -250,6 +252,7 @@ if ($search_idprof6) $sql .= " AND s.idprof6 LIKE '%".$db->escape($search_idprof
|
||||
if ($search_type > 0 && in_array($search_type,array('1,3','2,3'))) $sql .= " AND s.client IN (".$db->escape($search_type).")";
|
||||
if ($search_type > 0 && in_array($search_type,array('4'))) $sql .= " AND s.fournisseur = 1";
|
||||
if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0";
|
||||
if (!empty($conf->barcode->enabled) && $sbarcode) $sql.= " AND s.barcode LIKE '%".$db->escape($sbarcode)."%'";
|
||||
//print $sql;
|
||||
|
||||
// Count total nb of records
|
||||
@@ -270,6 +273,7 @@ if ($resql)
|
||||
$i = 0;
|
||||
|
||||
$params = "&socname=".$socname."&search_nom=".$search_nom."&search_town=".$search_town;
|
||||
$params.= ($sbarcode?"&sbarcode=".$sbarcode:"");
|
||||
$params.= '&search_idprof1='.$search_idprof1;
|
||||
$params.= '&search_idprof2='.$search_idprof2;
|
||||
$params.= '&search_idprof3='.$search_idprof3;
|
||||
@@ -328,6 +332,7 @@ if ($resql)
|
||||
// Lines of titles
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$params,"",$sortfield,$sortorder);
|
||||
if (! empty($conf->barcode->enabled)) print_liste_field_titre($langs->trans("BarCode"), $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","",$params,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"),$textprofid[1],1,0),$_SERVER["PHP_SELF"],"s.siren","",$params,'class="nowrap"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"),$textprofid[2],1,0),$_SERVER["PHP_SELF"],"s.siret","",$params,'class="nowrap"',$sortfield,$sortorder);
|
||||
@@ -344,24 +349,33 @@ if ($resql)
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
if (! empty($search_nom_only) && empty($search_nom)) $search_nom=$search_nom_only;
|
||||
print '<input class="flat" type="text" name="search_nom" value="'.$search_nom.'">';
|
||||
print '</td><td class="liste_titre">';
|
||||
print '</td>';
|
||||
// Barcode
|
||||
if (! empty($conf->barcode->enabled))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="sbarcode" size="6" value="'.$sbarcode.'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Town
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="10" type="text" name="search_town" value="'.$search_town.'">';
|
||||
print '</td>';
|
||||
// IdProf1
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="8" type="text" name="search_idprof1" value="'.$search_idprof1.'">';
|
||||
print '<input class="flat" size="4" type="text" name="search_idprof1" value="'.$search_idprof1.'">';
|
||||
print '</td>';
|
||||
// IdProf2
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="8" type="text" name="search_idprof2" value="'.$search_idprof2.'">';
|
||||
print '<input class="flat" size="4" type="text" name="search_idprof2" value="'.$search_idprof2.'">';
|
||||
print '</td>';
|
||||
// IdProf3
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="8" type="text" name="search_idprof3" value="'.$search_idprof3.'">';
|
||||
print '<input class="flat" size="4" type="text" name="search_idprof3" value="'.$search_idprof3.'">';
|
||||
print '</td>';
|
||||
// IdProf4
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="8" type="text" name="search_idprof4" value="'.$search_idprof4.'">';
|
||||
print '<input class="flat" size="4" type="text" name="search_idprof4" value="'.$search_idprof4.'">';
|
||||
print '</td>';
|
||||
// Type (customer/prospect/supplier)
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
@@ -387,7 +401,8 @@ if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var]."><td>";
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<td>";
|
||||
$companystatic->id=$obj->rowid;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
@@ -395,6 +410,11 @@ if ($resql)
|
||||
$companystatic->status=$obj->status;
|
||||
print $companystatic->getNomUrl(1,'',100);
|
||||
print "</td>\n";
|
||||
// Barcode
|
||||
if (! empty($conf->barcode->enabled))
|
||||
{
|
||||
print '<td>'.$objp->barcode.'</td>';
|
||||
}
|
||||
print "<td>".$obj->town."</td>\n";
|
||||
print "<td>".$obj->idprof1."</td>\n";
|
||||
print "<td>".$obj->idprof2."</td>\n";
|
||||
|
||||
@@ -1049,7 +1049,7 @@ else
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
if (isset($conf->authmode) && preg_match('/myopenid/',$conf->authmode)) $rowspan++;
|
||||
if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) $rowspan++;
|
||||
if (! empty($conf->societe->enabled)) $rowspan++;
|
||||
if (! empty($conf->adherent->enabled)) $rowspan++;
|
||||
|
||||
@@ -1212,10 +1212,9 @@ else
|
||||
print '<td>'.dol_print_date($object->datepreviouslogin,"dayhour").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
if (isset($conf->authmode) && preg_match('/myopenid/',$conf->authmode))
|
||||
if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER))
|
||||
{
|
||||
print '<tr><td valign="top">'.$langs->trans("url_openid").'</td>';
|
||||
print '<tr><td valign="top">'.$langs->trans("OpenIDURL").'</td>';
|
||||
print '<td>'.$object->openid.'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
@@ -1512,7 +1511,10 @@ else
|
||||
*/
|
||||
if ($action == 'edit' && ($canedituser || $caneditfield || $caneditpassword || ($user->id == $object->id)))
|
||||
{
|
||||
$rowspan=14;
|
||||
$rowspan=15;
|
||||
if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) $rowspan++;
|
||||
if (! empty($conf->societe->enabled)) $rowspan++;
|
||||
if (! empty($conf->adherent->enabled)) $rowspan++;
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST" name="updateuser" enctype="multipart/form-data">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@@ -1520,9 +1522,6 @@ else
|
||||
print '<input type="hidden" name="entity" value="'.$object->entity.'">';
|
||||
print '<table width="100%" class="border">';
|
||||
|
||||
if (! empty($conf->societe->enabled)) $rowspan++;
|
||||
if (! empty($conf->adherent->enabled)) $rowspan++;
|
||||
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $object->id;
|
||||
@@ -1791,14 +1790,14 @@ else
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// openid
|
||||
if (isset($conf->authmode) && preg_match('/myopenid/',$conf->authmode))
|
||||
// OpenID url
|
||||
if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER))
|
||||
{
|
||||
print "<tr>".'<td valign="top">'.$langs->trans("url_openid").'</td>';
|
||||
print "<tr>".'<td valign="top">'.$langs->trans("OpenIDURL").'</td>';
|
||||
print '<td>';
|
||||
if ($caneditfield && !$object->ldap_sid)
|
||||
if ($caneditfield)
|
||||
{
|
||||
print '<input size="40" type="text" name="openid" class="flat" value="'.$object->openid.'">';
|
||||
print '<input size="40" type="url" name="openid" class="flat" value="'.$object->openid.'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -121,6 +121,8 @@ class AllTests
|
||||
$suite->addTestSuite('ContratTest');
|
||||
require_once dirname(__FILE__).'/FactureTest.php';
|
||||
$suite->addTestSuite('FactureTest');
|
||||
require_once dirname(__FILE__).'/FactureRecTest.php';
|
||||
$suite->addTestSuite('FactureRecTest');
|
||||
require_once dirname(__FILE__).'/FactureTestRounding.php';
|
||||
$suite->addTestSuite('FactureTestRounding');
|
||||
require_once dirname(__FILE__).'/FactureFournisseurTest.php';
|
||||
|
||||
@@ -135,6 +135,7 @@ class CoreTest extends PHPUnit_Framework_TestCase
|
||||
global $dolibarr_main_db_type;
|
||||
global $dolibarr_main_db_prefix;
|
||||
|
||||
// Case 1:
|
||||
// Test for subdir dolibarr (that point to htdocs) in root directory /var/www
|
||||
// URL: http://localhost/dolibarrnew/admin/system/phpinfo.php
|
||||
$_SERVER["HTTPS"]='';
|
||||
@@ -143,10 +144,8 @@ class CoreTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER["DOCUMENT_ROOT"]='/var/www';
|
||||
$_SERVER["SCRIPT_NAME"]='/dolibarrnew/admin/system/phpinfo.php';
|
||||
$expectedresult='/dolibarrnew';
|
||||
// Put this into conf.php if you want to test alt
|
||||
//$dolibarr_main_url_root='http://localhost/dolibarralias';
|
||||
//$dolibarr_main_url_root_alt='http://localhost/dolibarralias/custom2';
|
||||
|
||||
// Case 2:
|
||||
// Test for subdir aaa (that point to dolibarr) in root directory /var/www
|
||||
// URL: http://localhost/aaa/htdocs/admin/system/phpinfo.php
|
||||
$_SERVER["HTTPS"]='';
|
||||
@@ -155,10 +154,8 @@ class CoreTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER["DOCUMENT_ROOT"]='/var/www';
|
||||
$_SERVER["SCRIPT_NAME"]='/aaa/htdocs/admin/system/phpinfo.php';
|
||||
$expectedresult='/aaa/htdocs';
|
||||
// Put this into conf.php if you want to test alt
|
||||
//$dolibarr_main_url_root='http://localhost/dolibarralias';
|
||||
//$dolibarr_main_url_root_alt='http://localhost/dolibarralias/custom2';
|
||||
|
||||
// Case 3:
|
||||
// Test for virtual host localhostdolibarrnew that point to htdocs directory with
|
||||
// a direct document root
|
||||
// URL: http://localhostdolibarrnew/admin/system/phpinfo.php
|
||||
@@ -168,10 +165,8 @@ class CoreTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER["DOCUMENT_ROOT"]='/home/ldestail/workspace/dolibarr/htdocs';
|
||||
$_SERVER["SCRIPT_NAME"]='/admin/system/phpinfo.php';
|
||||
$expectedresult='';
|
||||
// Put this into conf.php if you want to test alt
|
||||
//$dolibarr_main_url_root='http://localhost/dolibarralias';
|
||||
//$dolibarr_main_url_root_alt='http://localhost/dolibarralias/custom2';
|
||||
|
||||
// Case 4:
|
||||
// Test for virtual host localhostdolibarrnew that point to htdocs directory with
|
||||
// a symbolic link
|
||||
// URL: http://localhostdolibarrnew/admin/system/phpinfo.php
|
||||
@@ -181,10 +176,8 @@ class CoreTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER["DOCUMENT_ROOT"]='/var/www/dolibarr'; // This is a link that point to /home/ldestail/workspace/dolibarr/htdocs
|
||||
$_SERVER["SCRIPT_NAME"]='/admin/system/phpinfo.php';
|
||||
$expectedresult='';
|
||||
// Put this into conf.php if you want to test alt
|
||||
//$dolibarr_main_url_root='http://localhost/dolibarralias';
|
||||
//$dolibarr_main_url_root_alt='http://localhost/dolibarralias/custom2';
|
||||
|
||||
// Case 5:
|
||||
// Test for alias /dolibarralias
|
||||
// URL: http://localhost/dolibarralias/admin/system/phpinfo.php
|
||||
$_SERVER["HTTPS"]='';
|
||||
@@ -195,8 +188,18 @@ class CoreTest extends PHPUnit_Framework_TestCase
|
||||
$expectedresult='/dolibarralias';
|
||||
// Put this into conf.php because autodetect will fails in this case
|
||||
//$dolibarr_main_url_root='http://localhost/dolibarralias';
|
||||
//$dolibarr_main_url_root_alt='http://localhost/dolibarralias/custom2';
|
||||
|
||||
// Case 6:
|
||||
// Test when using nginx
|
||||
// URL: https://localhost/dolibarr/admin/system/phpinfo.php
|
||||
$_SERVER["HTTPS"]='';
|
||||
$_SERVER["SERVER_NAME"]='localhost';
|
||||
$_SERVER["SERVER_PORT"]='80';
|
||||
$_SERVER["DOCUMENT_ROOT"]='/var/www/dolibarr/htdocs';
|
||||
$_SERVER["SCRIPT_NAME"]='/dolibarr/admin/system/phpinfo.php';
|
||||
$expectedresult='/dolibarr';
|
||||
// Put this into conf.php because autodetect will fails in this case
|
||||
//$dolibarr_main_url_root='http://localhost/dolibarr';
|
||||
|
||||
// Force to rerun filefunc.inc.php
|
||||
include dirname(__FILE__).'/../../htdocs/filefunc.inc.php';
|
||||
|
||||
199
test/phpunit/FactureRecTest.php
Normal file
199
test/phpunit/FactureRecTest.php
Normal file
@@ -0,0 +1,199 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file test/phpunit/FactureRecTest.php
|
||||
* \ingroup test
|
||||
* \brief PHPUnit test
|
||||
* \remarks To run this script as CLI: phpunit filename.php
|
||||
*/
|
||||
|
||||
global $conf,$user,$langs,$db;
|
||||
//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
|
||||
require_once dirname(__FILE__).'/../../htdocs/compta/facture/class/facture.class.php';
|
||||
require_once dirname(__FILE__).'/../../htdocs/compta/facture/class/facture-rec.class.php';
|
||||
|
||||
if (empty($user->id))
|
||||
{
|
||||
print "Load permissions for admin user nb 1\n";
|
||||
$user->fetch(1);
|
||||
$user->getrights();
|
||||
}
|
||||
$conf->global->MAIN_DISABLE_ALL_MAILS=1;
|
||||
|
||||
|
||||
/**
|
||||
* Class for PHPUnit tests
|
||||
*
|
||||
* @backupGlobals disabled
|
||||
* @backupStaticAttributes enabled
|
||||
* @remarks backupGlobals must be disabled to have db,conf,user and lang not erased.
|
||||
*/
|
||||
class FactureRecTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $savconf;
|
||||
protected $savuser;
|
||||
protected $savlangs;
|
||||
protected $savdb;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* We save global variables into local variables
|
||||
*
|
||||
* @return FactureTest
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
$this->savlangs=$langs;
|
||||
$this->savdb=$db;
|
||||
|
||||
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
|
||||
//print " - db ".$db->db;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->rollback();
|
||||
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* testFactureCreate
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function testFactureRecCreate()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$localobjectinv=new Facture($this->savdb);
|
||||
$localobjectinv->initAsSpecimen();
|
||||
$localobjectinv->create($user);
|
||||
|
||||
$localobject=new FactureRec($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$result=$localobject->create($user, $localobjectinv->id);
|
||||
|
||||
$this->assertLessThan($result, 0);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Edit an object to test updates
|
||||
*
|
||||
* @param mixed &$localobject Object Facture
|
||||
* @return void
|
||||
*/
|
||||
public function changeProperties(&$localobject)
|
||||
{
|
||||
$localobject->note_private='New note';
|
||||
//$localobject->note='New note after update';
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare all public properties values of 2 objects
|
||||
*
|
||||
* @param Object $oA Object operand 1
|
||||
* @param Object $oB Object operand 2
|
||||
* @param boolean $ignoretype False will not report diff if type of value differs
|
||||
* @param array $fieldstoignorearray Array of fields to ignore in diff
|
||||
* @return array Array with differences
|
||||
*/
|
||||
public function objCompare($oA,$oB,$ignoretype=true,$fieldstoignorearray=array('id'))
|
||||
{
|
||||
$retAr=array();
|
||||
|
||||
if (get_class($oA) !== get_class($oB))
|
||||
{
|
||||
$retAr[]="Supplied objects are not of same class.";
|
||||
}
|
||||
else
|
||||
{
|
||||
$oVarsA=get_object_vars($oA);
|
||||
$oVarsB=get_object_vars($oB);
|
||||
$aKeys=array_keys($oVarsA);
|
||||
foreach($aKeys as $sKey)
|
||||
{
|
||||
if (in_array($sKey,$fieldstoignorearray)) continue;
|
||||
if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey])
|
||||
{
|
||||
$retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
|
||||
}
|
||||
if ($ignoretype && $oVarsA[$sKey] != $oVarsB[$sKey])
|
||||
{
|
||||
$retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $retAr;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user