Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into new_event_with_multi_contact
This commit is contained in:
commit
bab43b043e
50
.travis.yml
50
.travis.yml
@ -2,19 +2,15 @@
|
|||||||
# from Dolibarr GitHub repository.
|
# from Dolibarr GitHub repository.
|
||||||
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
|
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
|
||||||
|
|
||||||
|
# We use dist: precise to have php 5.3 available
|
||||||
dist: precise
|
dist: precise
|
||||||
sudo: required
|
sudo: required
|
||||||
|
|
||||||
language: php
|
language: php
|
||||||
|
|
||||||
php:
|
# Start on every boot
|
||||||
- '5.3'
|
services:
|
||||||
- '5.4'
|
- memcached
|
||||||
- '5.5'
|
|
||||||
- '5.6'
|
|
||||||
- '7.0'
|
|
||||||
- '7.1'
|
|
||||||
- nightly
|
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
mariadb: '10.0'
|
mariadb: '10.0'
|
||||||
@ -34,9 +30,15 @@ addons:
|
|||||||
# We need pgloader for import mysql database into pgsql
|
# We need pgloader for import mysql database into pgsql
|
||||||
- pgloader
|
- pgloader
|
||||||
|
|
||||||
# Start on every boot
|
php:
|
||||||
services:
|
- '5.3'
|
||||||
- memcached
|
- '5.4'
|
||||||
|
- '5.5'
|
||||||
|
- '5.6'
|
||||||
|
- '7.0'
|
||||||
|
- '7.1'
|
||||||
|
#- hhvm only with dist: trusty
|
||||||
|
- nightly
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
@ -57,11 +59,22 @@ env:
|
|||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- php: 7.1
|
- php: hhvm
|
||||||
- php: nightly
|
- php: nightly
|
||||||
#- env: DB=postgresql
|
# We exclude some combinations not usefull to save Travis CPU
|
||||||
# TODO
|
exclude:
|
||||||
#- env: DB=sqlite
|
- php: '5.4'
|
||||||
|
env: DB=postgresql
|
||||||
|
- php: '5.5'
|
||||||
|
env: DB=postgresql
|
||||||
|
- php: '5.6'
|
||||||
|
env: DB=postgresql
|
||||||
|
- php: '7.0'
|
||||||
|
env: DB=postgresql
|
||||||
|
- php: hhvm
|
||||||
|
env: DB=postgresql
|
||||||
|
- php: nightly
|
||||||
|
env: DB=postgresql
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
@ -312,18 +325,21 @@ script:
|
|||||||
set +e
|
set +e
|
||||||
echo
|
echo
|
||||||
#cat $TRAVIS_BUILD_DIR/upgrade400500-2.log
|
#cat $TRAVIS_BUILD_DIR/upgrade400500-2.log
|
||||||
|
#cat $TRAVIS_BUILD_DIR/upgrade500600.log
|
||||||
|
#cat $TRAVIS_BUILD_DIR/upgrade500600-2.log
|
||||||
|
#cat $TRAVIS_BUILD_DIR/upgrade500600-3.log
|
||||||
#cat /tmp/dolibarr_install.log
|
#cat /tmp/dolibarr_install.log
|
||||||
|
|
||||||
- |
|
- |
|
||||||
echo "Unit testing"
|
echo "Unit testing"
|
||||||
# Ensure we catch errors. Set this to +e if you want to go to the end to see log file.
|
# Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file.
|
||||||
set -e
|
set -e
|
||||||
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
- |
|
- |
|
||||||
#echo "Output dolibarr.log"
|
#echo "Output dolibarr.log"
|
||||||
#echo cat documents/dolibarr.log
|
#cat documents/dolibarr.log
|
||||||
|
|
||||||
after_script:
|
after_script:
|
||||||
- |
|
- |
|
||||||
|
|||||||
96
ChangeLog
96
ChangeLog
@ -3,18 +3,107 @@ English Dolibarr ChangeLog
|
|||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 7.0.0 compared to 6.0.* *****
|
***** ChangeLog for 7.0.0 compared to 6.0.* *****
|
||||||
|
|
||||||
|
For developers:
|
||||||
|
NEW: Add hook addAdminLdapOptions and doAction in ldap admin page
|
||||||
|
NEW: complete_head_from_modules() in ldap_prepare_head()
|
||||||
|
|
||||||
|
WARNING:
|
||||||
|
|
||||||
|
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||||
|
* The methode "cloture" on contact were renamed into "closeAll".
|
||||||
|
* The substitution key for reference of object is now __REF__ whatever is the object (it replaces __ORDERREF__,
|
||||||
|
__PROPALREF__, ...)
|
||||||
|
* Some REST API to access the dictionary (country, town, ...) were moved into a common API.
|
||||||
|
* Page bank/index.php and bank/bankentries.php were renamed into bank/list.php and bank/bankentries_list.php to
|
||||||
|
follow page naming conventions (so default filter/sort order features can also work).
|
||||||
|
* The trigger ORDER_SUPPLIER_STATUS_ONPROCESS was renamed ORDER_SUPPLIER_STATUS_ORDERED
|
||||||
|
* The trigger ORDER_SUPPLIER_STATUS_RECEIVED_ALL was renamed ORDER_SUPPLIER_STATUS_RECEIVED_COMPLETELY
|
||||||
|
|
||||||
|
|
||||||
|
***** ChangeLog for 6.0.2 compared to 6.0.1 *****
|
||||||
|
FIX: #7148
|
||||||
|
FIX: #7288
|
||||||
|
FIX: #7366 renaming table with pgsql
|
||||||
|
FIX: #7435 Can't add payment term
|
||||||
|
FIX: #7461
|
||||||
|
FIX: #7464
|
||||||
|
FIX: #7471
|
||||||
|
FIX: #7473 Mass update of vat rates and other bugs on localtax
|
||||||
|
FIX: #7475
|
||||||
|
FIX: #7486 Empty value for multicurrency rate must be forbidden
|
||||||
|
FIX: #7490
|
||||||
|
FIX: #7505
|
||||||
|
FIX: #7510 Bug: extrafield content disappear when generate pdf within intervention
|
||||||
|
FIX: #7514
|
||||||
|
FIX: #7531 #7537
|
||||||
|
FIX: #7541
|
||||||
|
FIX: #7546
|
||||||
|
FIX: #7550
|
||||||
|
FIX: #7554
|
||||||
|
FIX: #7567
|
||||||
|
FIX: Accountancy export model for Agiris Isacompta
|
||||||
|
FIX: Allow create shipping if STOCK_SUPPORTS_SERVICES option is enabled
|
||||||
|
FIX: Bad preview on scroping when special file names
|
||||||
|
FIX: Generation of invoice from bulk action "Bill Orders"
|
||||||
|
FIX: Implementation of a Luracast recommandation for the REST api server (#7370)
|
||||||
|
FIX: Missing space in request
|
||||||
|
FIX: Only modified values must be modified
|
||||||
|
FIX: replenish if line test GETPOST on line 0
|
||||||
|
FIX: Stripe not working on live mode
|
||||||
|
FIX: wrong basePath in the swagger view
|
||||||
|
FIX: Implementation of a Luracast recommandation for the REST api server
|
||||||
|
|
||||||
|
***** ChangeLog for 6.0.1 compared to 6.0.* *****
|
||||||
|
FIX: #7000 Dashboard link for late pending payment supplier invoices do not work
|
||||||
|
FIX: #7325 Default VAT rate when editing template invoices is 0%
|
||||||
|
FIX: #7330
|
||||||
|
FIX: #7359
|
||||||
|
FIX: #7367
|
||||||
|
FIX: #7368
|
||||||
|
FIX: #7391
|
||||||
|
FIX: #7420
|
||||||
|
FIX: Add some missing attributes in Adherent:makeSubstitution (type, phone…
|
||||||
|
FIX: Bad const name
|
||||||
|
FIX: Bad link to unpayed suppliers invoices
|
||||||
|
FIX: Better protection to no send email when we change limit
|
||||||
|
FIX: Calculation in the activity box
|
||||||
|
FIX: Clean bad parameters when inserting line of template invoice
|
||||||
|
FIX: dateSelector was not taken into account
|
||||||
|
FIX: hidden option MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN
|
||||||
|
FIX: journalization for bank journal should not rely on a label.
|
||||||
|
FIX: menu enty when url is external link
|
||||||
|
FIX: missing supplier qty and supplier discount in available fields for product export.
|
||||||
|
FIX: multicompany better accuracy in rounding and with revenue stamp.
|
||||||
|
FIX: Must use pdf format page as default for merging PDF.
|
||||||
|
FIX: PDF output was sharing 2 different currencies in same total
|
||||||
|
FIX: Position of signature on strato template
|
||||||
|
FIX: Protection to avoid to apply credit note discount > remain to pay
|
||||||
|
FIX: Remove warning when using log into syslog
|
||||||
|
FIX: Responsive
|
||||||
|
FIX: Security fixes (filter onload js, less verbose error message in
|
||||||
|
FIX: SEPA recording payment must save one payment in bank per customer
|
||||||
|
FIX: Several problem with the last event box on project/tasks
|
||||||
|
FIX: Sign of amount in origin currency on credit note created from lines
|
||||||
|
FIX: Some page of admin were not responsive
|
||||||
|
FIX: SQL injection
|
||||||
|
FIX: time.php crashed without project id in param
|
||||||
|
FIX: transfer of line extrafields from order to invoice
|
||||||
|
FIX: Upgrade missing on field
|
||||||
|
FIX: View of timespent for another user
|
||||||
|
FIX: ODT generation
|
||||||
|
FIX: CVE-2017-9840, CVE-2017-14238, CVE-2017-14239, CVE-2017-14240, CVE-2017-14241,
|
||||||
|
CVE-2017-14242
|
||||||
|
|
||||||
***** ChangeLog for 6.0.0 compared to 5.0.* *****
|
***** ChangeLog for 6.0.0 compared to 5.0.* *****
|
||||||
|
|
||||||
NEW: Add experimental BlockeLog module (to log business events in a non reversible log file).
|
NEW: Add experimental BlockeLog module (to log business events in a non reversible log file).
|
||||||
NEW: Add a payment module for Stripe.
|
NEW: Add a payment module for Stripe.
|
||||||
NEW: Add module "Product variant" (like red, blue for the product shoes)
|
NEW: Add module "Product variant" (like red, blue for the product shoes)
|
||||||
NEW: Accountancy - Activate multi-journal & Add journal_label to database (FEC)
|
NEW: Accountancy - Activate multi-journal & Add journal_label to database (FEC)
|
||||||
NEW: Add a tracking id into mass emailing.
|
NEW: Add a tracking id into mass emailing.
|
||||||
NEW: Tax system more compatible with the new tax roollout in India (IGST / CGST / SGST).
|
NEW: Tax system more compatible with the new tax rollout in India (IGST / CGST / SGST).
|
||||||
NEW: Add calculation function for Loan schedule
|
NEW: Add calculation function for Loan schedule
|
||||||
NEW: Add "depends on" and "required by" into module informations
|
NEW: Add "depends on" and "required by" into module informations
|
||||||
NEW: Add hidden option THIRDPARTY_INCLUDE_PARENT_IN_LINKTO
|
NEW: Add hidden option THIRDPARTY_INCLUDE_PARENT_IN_LINKTO
|
||||||
@ -157,6 +246,9 @@ Following changes may create regression for some external modules, but were nece
|
|||||||
content by doing a print into function, sometimes by returning content into "resprint". This has been fixed to follow
|
content by doing a print into function, sometimes by returning content into "resprint". This has been fixed to follow
|
||||||
hook specifications so you must return output into "resprint".
|
hook specifications so you must return output into "resprint".
|
||||||
|
|
||||||
|
***** ChangeLog for 5.0.6 compared to 5.0.5 *****
|
||||||
|
FIX: Removed a bad symbolic link into custom directory.
|
||||||
|
FIX: Renaming a resource ref rename also the directory of attached files.
|
||||||
|
|
||||||
***** ChangeLog for 5.0.5 compared to 5.0.4 *****
|
***** ChangeLog for 5.0.5 compared to 5.0.4 *****
|
||||||
FIX: #7075 : bad path for document
|
FIX: #7075 : bad path for document
|
||||||
|
|||||||
@ -334,7 +334,7 @@ foreach my $target (sort keys %CHOOSEDTARGET) {
|
|||||||
}
|
}
|
||||||
foreach my $target (sort keys %CHOOSEDPUBLISH) {
|
foreach my $target (sort keys %CHOOSEDPUBLISH) {
|
||||||
if ($CHOOSEDPUBLISH{$target} < 0) { next; }
|
if ($CHOOSEDPUBLISH{$target} < 0) { next; }
|
||||||
if ($target eq 'ASSO') { $nbofpublishneedchangelog++; $nbofpublishneedtag++; }
|
if ($target eq 'ASSO') { $nbofpublishneedchangelog++; }
|
||||||
if ($target eq 'SF') { $nbofpublishneedchangelog++; $nbofpublishneedtag++; }
|
if ($target eq 'SF') { $nbofpublishneedchangelog++; $nbofpublishneedtag++; }
|
||||||
$nboftargetok++;
|
$nboftargetok++;
|
||||||
}
|
}
|
||||||
@ -366,7 +366,9 @@ if ($nboftargetok) {
|
|||||||
}
|
}
|
||||||
else # For a maintenance release
|
else # For a maintenance release
|
||||||
{
|
{
|
||||||
print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
#print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
||||||
|
print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. | grep -v "Merge branch" | grep -v "Merge pull" | grep "^ " | sed -e "s/^[0-9a-z]* *//" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
||||||
|
|
||||||
}
|
}
|
||||||
print "\n";
|
print "\n";
|
||||||
if (! $ret)
|
if (! $ret)
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
# \file build/makepack-dolibarrmodule.pl
|
# \file build/makepack-dolibarrmodule.pl
|
||||||
# \brief Package builder (tgz, zip, rpm, deb, exe)
|
# \brief Package builder (tgz, zip, rpm, deb, exe)
|
||||||
# \author (c)2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
# \author (c)2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
# \contributor (c)2017 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
use Cwd;
|
use Cwd;
|
||||||
@ -134,7 +135,15 @@ foreach my $PROJECT (@PROJECTLIST) {
|
|||||||
# Get version $MAJOR, $MINOR and $BUILD
|
# Get version $MAJOR, $MINOR and $BUILD
|
||||||
print "Version detected for module ".$PROJECT.": ";
|
print "Version detected for module ".$PROJECT.": ";
|
||||||
$result=open(IN,"<".$SOURCE."/htdocs/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php");
|
$result=open(IN,"<".$SOURCE."/htdocs/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php");
|
||||||
if (! $result) { die "Error: Can't open descriptor file ".$SOURCE."/htdocs/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php for reading.\n"; }
|
$custom=false;
|
||||||
|
if (! $result) {
|
||||||
|
$result=open(IN,"<".$SOURCE."/htdocs/custom/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php");
|
||||||
|
if (! $result) {
|
||||||
|
die "Error: Can't open descriptor file ".$SOURCE."/htdocs/(or /htdocs/custom/)".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php for reading.\n";
|
||||||
|
}else{
|
||||||
|
$custom = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
while(<IN>)
|
while(<IN>)
|
||||||
{
|
{
|
||||||
if ($_ =~ /this->version\s*=\s*'([\d\.]+)'/) { $PROJVERSION=$1; break; }
|
if ($_ =~ /this->version\s*=\s*'([\d\.]+)'/) { $PROJVERSION=$1; break; }
|
||||||
@ -294,6 +303,9 @@ foreach my $PROJECT (@PROJECTLIST) {
|
|||||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.old`;
|
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.old`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.postgres`;
|
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.postgres`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf*sav*`;
|
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf*sav*`;
|
||||||
|
if($custom){
|
||||||
|
$ret=`cp -r $BUILDROOT/$PROJECTLC/htdocs/custom/* $BUILDROOT/$PROJECTLC/htdocs/.`;
|
||||||
|
}
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom`;
|
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom2`;
|
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom2`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/test`;
|
$ret=`rm -fr $BUILDROOT/$PROJECTLC/test`;
|
||||||
|
|||||||
@ -163,6 +163,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/bookmarks
|
%_datadir/dolibarr/htdocs/bookmarks
|
||||||
%_datadir/dolibarr/htdocs/cashdesk
|
%_datadir/dolibarr/htdocs/cashdesk
|
||||||
%_datadir/dolibarr/htdocs/categories
|
%_datadir/dolibarr/htdocs/categories
|
||||||
|
%_datadir/dolibarr/htdocs/collab
|
||||||
%_datadir/dolibarr/htdocs/comm
|
%_datadir/dolibarr/htdocs/comm
|
||||||
%_datadir/dolibarr/htdocs/commande
|
%_datadir/dolibarr/htdocs/commande
|
||||||
%_datadir/dolibarr/htdocs/compta
|
%_datadir/dolibarr/htdocs/compta
|
||||||
|
|||||||
@ -60,14 +60,14 @@ $db->begin();
|
|||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/user/class/user.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/user/class/user.class.php");
|
||||||
|
|
||||||
// Create invoice object
|
// Create user object
|
||||||
$obj = new User($db);
|
$obj = new User($db);
|
||||||
//$obj->initAsSpecimen();
|
//$obj->initAsSpecimen();
|
||||||
|
|
||||||
$obj->login = 'ABCDEF';
|
$obj->login = 'ABCDEF';
|
||||||
$obj->nom = 'ABCDEF';
|
$obj->nom = 'ABCDEF';
|
||||||
|
|
||||||
// Create invoice
|
// Create user
|
||||||
$idobject=$obj->create($user);
|
$idobject=$obj->create($user);
|
||||||
if ($idobject > 0)
|
if ($idobject > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -67,7 +67,7 @@ $db->begin();
|
|||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
|
||||||
|
|
||||||
// Create invoice object
|
// Create contract object
|
||||||
$obj = new Contrat($db);
|
$obj = new Contrat($db);
|
||||||
$obj->socid=$argv[1];
|
$obj->socid=$argv[1];
|
||||||
|
|
||||||
|
|||||||
@ -149,7 +149,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
|||||||
$condpayment = trim($fields[36]);
|
$condpayment = trim($fields[36]);
|
||||||
if ($condpayment == 'A la commande') $condpayment = 'A réception de commande';
|
if ($condpayment == 'A la commande') $condpayment = 'A réception de commande';
|
||||||
if ($condpayment == 'A reception facture') $condpayment = 'Réception de facture';
|
if ($condpayment == 'A reception facture') $condpayment = 'Réception de facture';
|
||||||
$object->cond_reglement_id = dol_getIdFromCode($db, $condpayment, 'c_payment_term', 'libelle_facture', 'rowid');
|
$object->cond_reglement_id = dol_getIdFromCode($db, $condpayment, 'c_payment_term', 'libelle_facture', 'rowid', 1);
|
||||||
if (empty($object->cond_reglement_id))
|
if (empty($object->cond_reglement_id))
|
||||||
{
|
{
|
||||||
print " - Error cant find payment mode for ".$condpayment."\n";
|
print " - Error cant find payment mode for ".$condpayment."\n";
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
1
dev/resources/iso-normes/code_nace.txt
Normal file
1
dev/resources/iso-normes/code_nace.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
http://ec.europa.eu/eurostat/ramon/nomenclatures/index.cfm?TargetUrl=LST_CLS_DLD&StrNom=NACE_REV2&StrLanguageCode=FR&StrLayoutCode=#
|
||||||
@ -126,7 +126,7 @@
|
|||||||
<rule ref="Generic.Metrics.CyclomaticComplexity">
|
<rule ref="Generic.Metrics.CyclomaticComplexity">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="complexity" value="120" />
|
<property name="complexity" value="120" />
|
||||||
<property name="absoluteComplexity" value="250" />
|
<property name="absoluteComplexity" value="300" />
|
||||||
</properties>
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
<rule ref="Generic.Metrics.NestingLevel">
|
<rule ref="Generic.Metrics.NestingLevel">
|
||||||
|
|||||||
@ -15,7 +15,7 @@ then
|
|||||||
echo "This push local files to transifex for project $project."
|
echo "This push local files to transifex for project $project."
|
||||||
echo "Note: If you push a language file (not source), file will be skipped if transifex file is newer."
|
echo "Note: If you push a language file (not source), file will be skipped if transifex file is newer."
|
||||||
echo " Using -f will overwrite translation but not memory."
|
echo " Using -f will overwrite translation but not memory."
|
||||||
echo "Usage: ./dev/translation/txpush.sh (source|xx_XX|all) [-r dolibarr.file] [-f] [--no-interactive]"
|
echo "Usage: ./dev/translation/txpush.sh (source|xx_XX|all) [-r ".$project.".file] [-f] [--no-interactive]"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ $langs->load("salaries");
|
|||||||
|
|
||||||
$mesg = '';
|
$mesg = '';
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
$cancel = GETPOST('cancel');
|
$cancel = GETPOST('cancel','alpha');
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$rowid = GETPOST('rowid', 'int');
|
$rowid = GETPOST('rowid', 'int');
|
||||||
|
|
||||||
@ -53,12 +53,10 @@ if (! $user->rights->accounting->chartofaccount) accessforbidden();
|
|||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST('sortfield','alpha');
|
||||||
$sortorder = GETPOST("sortorder", 'sortorder');
|
$sortorder = GETPOST('sortorder','alpha');
|
||||||
$page = GETPOST("page", 'int');
|
$page = GETPOST('page','int');
|
||||||
if ($page == - 1) {
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
$page = 0;
|
|
||||||
}
|
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
@ -69,8 +67,8 @@ $arrayfields=array(
|
|||||||
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
|
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
|
||||||
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||||
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0),
|
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0),
|
||||||
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>0),
|
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
|
||||||
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0),
|
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
|
||||||
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
|
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -84,8 +82,8 @@ $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'accounting
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction')) { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha')) { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
@ -190,13 +188,14 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
$params='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($search_account) $params.= '&search_account='.urlencode($search_account);
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
if ($search_label) $params.= '&search_label='.urlencode($search_label);
|
if ($search_account) $param.= '&search_account='.urlencode($search_account);
|
||||||
if ($search_accountparent) $params.= '&search_accountparent='.urlencode($search_accountparent);
|
if ($search_label) $param.= '&search_label='.urlencode($search_label);
|
||||||
if ($search_pcgtype) $params.= '&search_pcgtype='.urlencode($search_pcgtype);
|
if ($search_accountparent) $param.= '&search_accountparent='.urlencode($search_accountparent);
|
||||||
if ($search_pcgsubtype) $params.= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
|
if ($search_pcgtype) $param.= '&search_pcgtype='.urlencode($search_pcgtype);
|
||||||
|
if ($search_pcgsubtype) $param.= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
|
||||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||||
|
|
||||||
|
|
||||||
@ -212,7 +211,7 @@ if ($resql)
|
|||||||
|
|
||||||
$htmlbuttonadd = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
|
$htmlbuttonadd = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
|
||||||
|
|
||||||
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $htmlbuttonadd);
|
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $htmlbuttonadd, '', $limit);
|
||||||
|
|
||||||
// Box to select active chart of account
|
// Box to select active chart of account
|
||||||
print $langs->trans("Selectchartofaccounts") . " : ";
|
print $langs->trans("Selectchartofaccounts") . " : ";
|
||||||
@ -264,8 +263,8 @@ if ($resql)
|
|||||||
if (! empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"],"aa.account_number","",$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"],"aa.account_number","",$param,'',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"],"aa.label","",$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"],"aa.label","",$param,'',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"],"aa.account_parent", "", $param,'align="left"',$sortfield,$sortorder);
|
if (! empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"],"aa.account_parent", "", $param,'align="left"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'],$_SERVER["PHP_SELF"],'aa.pcg_type','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'],$_SERVER["PHP_SELF"],'aa.pcg_type','',$param,'',$sortfield,$sortorder,'',$arrayfields['aa.pcg_type']['help']);
|
||||||
if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'],$_SERVER["PHP_SELF"],'aa.pcg_subtype','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'],$_SERVER["PHP_SELF"],'aa.pcg_subtype','',$param,'',$sortfield,$sortorder,'',$arrayfields['aa.pcg_subtype']['help']);
|
||||||
if (! empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'],$_SERVER["PHP_SELF"],'aa.active','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'],$_SERVER["PHP_SELF"],'aa.active','',$param,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|||||||
@ -87,9 +87,6 @@ $hookmanager->initHooks(array('admin'));
|
|||||||
// This page is a generic page to edit dictionaries
|
// This page is a generic page to edit dictionaries
|
||||||
// Put here declaration of dictionaries properties
|
// Put here declaration of dictionaries properties
|
||||||
|
|
||||||
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
|
||||||
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,25,0,26,0,31,32,0);
|
|
||||||
|
|
||||||
// Name of SQL tables of dictionaries
|
// Name of SQL tables of dictionaries
|
||||||
$tabname=array();
|
$tabname=array();
|
||||||
|
|
||||||
@ -148,75 +145,10 @@ $tabfieldcheck=array();
|
|||||||
$tabfieldcheck[31] = array();
|
$tabfieldcheck[31] = array();
|
||||||
$tabfieldcheck[32] = array();
|
$tabfieldcheck[32] = array();
|
||||||
|
|
||||||
// Complete all arrays with entries found into modules
|
|
||||||
complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck);
|
|
||||||
|
|
||||||
|
|
||||||
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
|
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
|
||||||
$elementList = array();
|
$elementList = array();
|
||||||
$sourceList=array();
|
$sourceList=array();
|
||||||
if ($id == 11)
|
|
||||||
{
|
|
||||||
$langs->load("orders");
|
|
||||||
$langs->load("contracts");
|
|
||||||
$langs->load("projects");
|
|
||||||
$langs->load("propal");
|
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("interventions");
|
|
||||||
$elementList = array(
|
|
||||||
'' => '',
|
|
||||||
'societe' => $langs->trans('ThirdParty'),
|
|
||||||
// 'proposal' => $langs->trans('Proposal'),
|
|
||||||
// 'order' => $langs->trans('Order'),
|
|
||||||
// 'invoice' => $langs->trans('Bill'),
|
|
||||||
'invoice_supplier' => $langs->trans('SupplierBill'),
|
|
||||||
'order_supplier' => $langs->trans('SupplierOrder'),
|
|
||||||
// 'intervention' => $langs->trans('InterventionCard'),
|
|
||||||
// 'contract' => $langs->trans('Contract'),
|
|
||||||
'project' => $langs->trans('Project'),
|
|
||||||
'project_task' => $langs->trans('Task'),
|
|
||||||
'agenda' => $langs->trans('Agenda'),
|
|
||||||
// old deprecated
|
|
||||||
'contrat' => $langs->trans('Contract'),
|
|
||||||
'propal' => $langs->trans('Proposal'),
|
|
||||||
'commande' => $langs->trans('Order'),
|
|
||||||
'facture' => $langs->trans('Bill'),
|
|
||||||
'resource' => $langs->trans('Resource'),
|
|
||||||
// 'facture_fourn' => $langs->trans('SupplierBill'),
|
|
||||||
'fichinter' => $langs->trans('InterventionCard')
|
|
||||||
);
|
|
||||||
if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty');
|
|
||||||
|
|
||||||
complete_elementList_with_modules($elementList);
|
|
||||||
|
|
||||||
asort($elementList);
|
|
||||||
$sourceList = array(
|
|
||||||
'internal' => $langs->trans('Internal'),
|
|
||||||
'external' => $langs->trans('External')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if ($id == 25)
|
|
||||||
{
|
|
||||||
// We save list of template email Dolibarr can manage. This list can found by a grep into code on "->param['models']"
|
|
||||||
$elementList = array();
|
|
||||||
if ($conf->propal->enabled) $elementList['propal_send']=$langs->trans('MailToSendProposal');
|
|
||||||
if ($conf->commande->enabled) $elementList['order_send']=$langs->trans('MailToSendOrder');
|
|
||||||
if ($conf->facture->enabled) $elementList['facture_send']=$langs->trans('MailToSendInvoice');
|
|
||||||
if ($conf->expedition->enabled) $elementList['shipping_send']=$langs->trans('MailToSendShipment');
|
|
||||||
if ($conf->ficheinter->enabled) $elementList['fichinter_send']=$langs->trans('MailToSendIntervention');
|
|
||||||
if ($conf->supplier_proposal->enabled) $elementList['supplier_proposal_send']=$langs->trans('MailToSendSupplierRequestForQuotation');
|
|
||||||
if ($conf->fournisseur->enabled) $elementList['order_supplier_send']=$langs->trans('MailToSendSupplierOrder');
|
|
||||||
if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice');
|
|
||||||
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
|
|
||||||
|
|
||||||
$parameters=array('elementList'=>$elementList);
|
|
||||||
$reshook=$hookmanager->executeHooks('emailElementlist',$parameters); // Note that $action and $object may have been modified by some hooks
|
|
||||||
if ($reshook == 0) {
|
|
||||||
foreach ($hookmanager->resArray as $item => $value) {
|
|
||||||
$elementList[$item] = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -289,7 +221,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||||
{
|
{
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
|
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2))
|
if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2))
|
||||||
@ -602,6 +534,7 @@ if ($id)
|
|||||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
// Form to add a new line
|
// Form to add a new line
|
||||||
@ -689,7 +622,6 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id == 4) print '<td></td>';
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -730,7 +662,6 @@ if ($id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id == 4) print '<td></td>';
|
|
||||||
print '<td colspan="3" align="right">';
|
print '<td colspan="3" align="right">';
|
||||||
if ($tabname[$id] != MAIN_DB_PREFIX.'c_email_templates' || $action != 'edit')
|
if ($tabname[$id] != MAIN_DB_PREFIX.'c_email_templates' || $action != 'edit')
|
||||||
{
|
{
|
||||||
@ -739,19 +670,9 @@ if ($id)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates')
|
|
||||||
{
|
|
||||||
print '<tr><td colspan="8">* '.$langs->trans("AvailableVariables").": ";
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
|
||||||
$tmp=FormMail::getAvailableSubstitKey('formemail');
|
|
||||||
print implode(', ', $tmp);
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$colspan=count($fieldlist)+3;
|
$colspan=count($fieldlist)+3;
|
||||||
if ($id == 4) $colspan++;
|
|
||||||
|
|
||||||
if (! empty($alabelisused) && $id != 25) // If there is one label among fields, we show legend of *
|
if (! empty($alabelisused)) // If there is one label among fields, we show legend of *
|
||||||
{
|
{
|
||||||
print '<tr><td colspan="'.$colspan.'">* '.$langs->trans("LabelUsedByDefault").'.</td></tr>';
|
print '<tr><td colspan="'.$colspan.'">* '.$langs->trans("LabelUsedByDefault").'.</td></tr>';
|
||||||
}
|
}
|
||||||
@ -783,9 +704,38 @@ if ($id)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Title of lines
|
// Title line with search boxes
|
||||||
print '<tr class="liste_titre liste_titre_add">';
|
print '<tr class="liste_titre liste_titre_add">';
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
|
{
|
||||||
|
$showfield=1; // By defaut
|
||||||
|
|
||||||
|
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
||||||
|
|
||||||
|
if ($showfield)
|
||||||
|
{
|
||||||
|
if ($value == 'country')
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre"></td>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '<td class="liste_titre"></td>';
|
||||||
|
print '<td class="liste_titre" colspan="2" align="right">';
|
||||||
|
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||||
|
print $searchpicto;
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Title of lines
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
// Determine le nom du champ par rapport aux noms possibles
|
// Determine le nom du champ par rapport aux noms possibles
|
||||||
// dans les dictionnaires de donnees
|
// dans les dictionnaires de donnees
|
||||||
@ -853,44 +803,11 @@ if ($id)
|
|||||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
|
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Favorite - Only activated on country dictionary
|
|
||||||
if ($id == 4) print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder);
|
|
||||||
|
|
||||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder);
|
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print getTitleFieldOfList('');
|
print getTitleFieldOfList('');
|
||||||
print getTitleFieldOfList('');
|
print getTitleFieldOfList('');
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Title line with search boxes
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
foreach ($fieldlist as $field => $value)
|
|
||||||
{
|
|
||||||
$showfield=1; // By defaut
|
|
||||||
|
|
||||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
|
||||||
|
|
||||||
if ($showfield)
|
|
||||||
{
|
|
||||||
if ($value == 'country')
|
|
||||||
{
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone');
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<td class="liste_titre"></td>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($id == 4) print '<td></td>';
|
|
||||||
print '<td class="liste_titre"></td>';
|
|
||||||
print '<td class="liste_titre" colspan="2" align="right">';
|
|
||||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
|
||||||
print $searchpicto;
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
// Lines with values
|
// Lines with values
|
||||||
@ -1098,16 +1015,6 @@ if ($id)
|
|||||||
if ($param) $url .= '&'.$param;
|
if ($param) $url .= '&'.$param;
|
||||||
$url.='&';
|
$url.='&';
|
||||||
|
|
||||||
// Favorite
|
|
||||||
// Only activated on country dictionary
|
|
||||||
if ($id == 4)
|
|
||||||
{
|
|
||||||
print '<td align="center" class="nowrap">';
|
|
||||||
if ($iserasable) print '<a href="'.$url.'action='.$acts[$obj->favorite].'_favorite">'.$actl[$obj->favorite].'</a>';
|
|
||||||
else print $langs->trans("AlwaysActive");
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Active
|
// Active
|
||||||
print '<td align="center" class="nowrap">';
|
print '<td align="center" class="nowrap">';
|
||||||
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
||||||
@ -1139,68 +1046,10 @@ if ($id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Show list of dictionary to show
|
|
||||||
*/
|
|
||||||
|
|
||||||
$lastlineisempty=false;
|
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
//print '<td>'.$langs->trans("Module").'</td>';
|
|
||||||
print '<td colspan="2">'.$langs->trans("Dictionary").'</td>';
|
|
||||||
print '<td>'.$langs->trans("Table").'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
$showemptyline='';
|
|
||||||
foreach ($taborder as $i)
|
|
||||||
{
|
|
||||||
if (isset($tabname[$i]) && empty($tabcond[$i])) continue;
|
|
||||||
|
|
||||||
if ($i)
|
|
||||||
{
|
|
||||||
if ($showemptyline)
|
|
||||||
{
|
|
||||||
print '<tr class="oddeven"><td width="30%"> </td><td> </td><td> </td></tr>';
|
|
||||||
$showemptyline=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$value=$tabname[$i];
|
|
||||||
print '<tr class="oddeven"><td width="50%">';
|
|
||||||
if (! empty($tabcond[$i]))
|
|
||||||
{
|
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$i.'">'.$langs->trans($tablib[$i]).'</a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $langs->trans($tablib[$i]);
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
print '<td>';
|
|
||||||
/*if (empty($tabcond[$i]))
|
|
||||||
{
|
|
||||||
print info_admin($langs->trans("DictionaryDisabledSinceNoModuleNeedIt"),1);
|
|
||||||
}*/
|
|
||||||
print '</td>';
|
|
||||||
print '<td>'.$tabname[$i].'</td></tr>';
|
|
||||||
$lastlineisempty=false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (! $lastlineisempty)
|
|
||||||
{
|
|
||||||
$showemptyline=1;
|
|
||||||
$lastlineisempty=true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print '</table>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|||||||
@ -37,10 +37,10 @@ $langs->load("accountancy");
|
|||||||
|
|
||||||
$mesg = '';
|
$mesg = '';
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
$backtopage = GETPOST('backtopage');
|
$backtopage = GETPOST('backtopage','alpha');
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$rowid = GETPOST('rowid', 'int');
|
$rowid = GETPOST('rowid', 'int');
|
||||||
$cancel = GETPOST('cancel');
|
$cancel = GETPOST('cancel','alpha');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ $object = new AccountingAccount($db);
|
|||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel'))
|
if (GETPOST('cancel','alpha'))
|
||||||
{
|
{
|
||||||
$urltogo=$backtopage?$backtopage:dol_buildpath('/accountancy/admin/account.php',1);
|
$urltogo=$backtopage?$backtopage:dol_buildpath('/accountancy/admin/account.php',1);
|
||||||
header("Location: ".$urltogo);
|
header("Location: ".$urltogo);
|
||||||
@ -327,7 +327,7 @@ if ($action == 'create') {
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
} else {
|
} else {
|
||||||
// View mode
|
// View mode
|
||||||
$linkback = '<a href="../admin/account.php">' . $langs->trans("BackToChartofaccounts") . '</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php">' . $langs->trans("BackToList") . '</a>';
|
||||||
|
|
||||||
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
|
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ $langs->load("accountancy");
|
|||||||
$mesg = '';
|
$mesg = '';
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$rowid = GETPOST('rowid', 'int');
|
$rowid = GETPOST('rowid', 'int');
|
||||||
$cancel = GETPOST('cancel');
|
$cancel = GETPOST('cancel','alpha');
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
$cat_id = GETPOST('account_category');
|
$cat_id = GETPOST('account_category');
|
||||||
$selectcpt = GETPOST('cpt_bk', 'array');
|
$selectcpt = GETPOST('cpt_bk', 'array');
|
||||||
@ -98,7 +98,7 @@ dol_fiche_head();
|
|||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
// Category
|
// Category
|
||||||
print '<tr><td>' . $langs->trans("AccountingCategory") . '</td>';
|
print '<tr><td class="titlefield">' . $langs->trans("AccountingCategory") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 1);
|
$formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 1);
|
||||||
print '<input class="button" type="submit" value="' . $langs->trans("Select") . '">';
|
print '<input class="button" type="submit" value="' . $langs->trans("Select") . '">';
|
||||||
@ -110,14 +110,26 @@ if (! empty($cat_id))
|
|||||||
if ($return < 0) {
|
if ($return < 0) {
|
||||||
setEventMessages(null, $accountingcategory->errors, 'errors');
|
setEventMessages(null, $accountingcategory->errors, 'errors');
|
||||||
}
|
}
|
||||||
print '<tr><td>' . $langs->trans("AddAccountFromBookKeepingWithNoCategories") . '</td>';
|
print '<tr><td class="tdtop">' . $langs->trans("AddAccountFromBookKeepingWithNoCategories") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
|
|
||||||
|
$arraykeyvalue=array();
|
||||||
|
foreach($accountingcategory->lines_cptbk as $key => $val)
|
||||||
|
{
|
||||||
|
$arraykeyvalue[length_accountg($val->numero_compte)] = length_accountg($val->numero_compte) . ' (' . $val->label_compte . ($val->doc_ref?' '.$val->doc_ref:'').')';
|
||||||
|
}
|
||||||
|
|
||||||
if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) {
|
if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) {
|
||||||
print '<select class="flat minwidth200" size="' . count($obj) . '" name="cpt_bk[]" multiple>';
|
|
||||||
|
print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, null, null, "90%");
|
||||||
|
print '<br>';
|
||||||
|
/*print '<select class="flat minwidth200" size="8" name="cpt_bk[]" multiple>';
|
||||||
foreach ( $accountingcategory->lines_cptbk as $cpt ) {
|
foreach ( $accountingcategory->lines_cptbk as $cpt ) {
|
||||||
print '<option value="' . length_accountg($cpt->numero_compte) . '">' . length_accountg($cpt->numero_compte) . ' (' . $cpt->label_compte . ' ' . $cpt->doc_ref . ')</option>';
|
print '<option value="' . length_accountg($cpt->numero_compte) . '">' . length_accountg($cpt->numero_compte) . ' (' . $cpt->label_compte . ' ' . $cpt->doc_ref . ')</option>';
|
||||||
}
|
}
|
||||||
print '</select><br>';
|
print '</select><br>';
|
||||||
|
print ajax_combobox('cpt_bk');
|
||||||
|
*/
|
||||||
print '<input class="button" type="submit" id="" class="action-delete" value="' . $langs->trans("Add") . '"> ';
|
print '<input class="button" type="submit" id="" class="action-delete" value="' . $langs->trans("Add") . '"> ';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|||||||
@ -1,16 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
|
||||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
|
||||||
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
|
||||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
|
||||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
|
||||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
|
|
||||||
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
|
||||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
|
||||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -52,7 +42,7 @@ $langs->load("hrm");
|
|||||||
|
|
||||||
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
$id=GETPOST('id','int');
|
$id=32;
|
||||||
$rowid=GETPOST('rowid','alpha');
|
$rowid=GETPOST('rowid','alpha');
|
||||||
$code=GETPOST('code','alpha');
|
$code=GETPOST('code','alpha');
|
||||||
|
|
||||||
@ -100,7 +90,7 @@ $tablib[32]= "DictionaryAccountancyCategory";
|
|||||||
|
|
||||||
// Requests to extract data
|
// Requests to extract data
|
||||||
$tabsql=array();
|
$tabsql=array();
|
||||||
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
||||||
|
|
||||||
// Criteria to sort dictionaries
|
// Criteria to sort dictionaries
|
||||||
$tabsqlsort=array();
|
$tabsqlsort=array();
|
||||||
@ -108,15 +98,15 @@ $tabsqlsort[32]="position ASC";
|
|||||||
|
|
||||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||||
$tabfield=array();
|
$tabfield=array();
|
||||||
$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
|
$tabfield[32]= "code,label,range_account,category_type,formula,position,country";
|
||||||
|
|
||||||
// Nom des champs d'edition pour modification d'un enregistrement
|
// Nom des champs d'edition pour modification d'un enregistrement
|
||||||
$tabfieldvalue=array();
|
$tabfieldvalue=array();
|
||||||
$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country";
|
$tabfieldvalue[32]= "code,label,range_account,category_type,formula,position,country_id";
|
||||||
|
|
||||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||||
$tabfieldinsert=array();
|
$tabfieldinsert=array();
|
||||||
$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
|
$tabfieldinsert[32]= "code,label,range_account,category_type,formula,position,fk_country";
|
||||||
|
|
||||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||||
// Example: "" if id field is "rowid" and has autoincrement on
|
// Example: "" if id field is "rowid" and has autoincrement on
|
||||||
@ -167,24 +157,17 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
$ok=1;
|
$ok=1;
|
||||||
foreach ($listfield as $f => $value)
|
foreach ($listfield as $f => $value)
|
||||||
{
|
{
|
||||||
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp','DictionaryAccountancysystem','DictionaryAccountancyCategory'))) continue; // For some pages, country is not mandatory
|
|
||||||
if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
|
|
||||||
if ($value == 'formula' && empty($_POST['formula'])) continue;
|
if ($value == 'formula' && empty($_POST['formula'])) continue;
|
||||||
if ((! isset($_POST[$value]) || $_POST[$value]=='')
|
if ($value == 'range_account' && empty($_POST['range_account'])) continue;
|
||||||
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy')) // Fields that are not mandatory
|
if ($value == 'country') continue; // country_id required but not country
|
||||||
&& (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10
|
if (! isset($_POST[$value]) || $_POST[$value]=='')
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
$ok=0;
|
$ok=0;
|
||||||
$fieldnamekey=$listfield[$f];
|
$fieldnamekey=$listfield[$f];
|
||||||
// We take translate key of field
|
// We take translate key of field
|
||||||
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
|
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
|
||||||
if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
|
|
||||||
if ($fieldnamekey == 'module') $fieldnamekey='Module';
|
|
||||||
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
|
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
|
||||||
if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
|
if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
|
||||||
if ($fieldnamekey == 'taux') $fieldnamekey = 'Rate';
|
|
||||||
if ($fieldnamekey == 'type') $fieldnamekey = 'Type';
|
if ($fieldnamekey == 'type') $fieldnamekey = 'Type';
|
||||||
if ($fieldnamekey == 'position') $fieldnamekey = 'Position';
|
if ($fieldnamekey == 'position') $fieldnamekey = 'Position';
|
||||||
if ($fieldnamekey == 'category_type') $fieldnamekey = 'Calculated';
|
if ($fieldnamekey == 'category_type') $fieldnamekey = 'Calculated';
|
||||||
@ -192,11 +175,6 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Other checks
|
|
||||||
if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"],array('system','systemauto'))) {
|
|
||||||
$ok=0;
|
|
||||||
setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors');
|
|
||||||
}
|
|
||||||
if (isset($_POST["code"]))
|
if (isset($_POST["code"]))
|
||||||
{
|
{
|
||||||
if ($_POST["code"]=='0')
|
if ($_POST["code"]=='0')
|
||||||
@ -207,21 +185,14 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||||
{
|
{
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
|
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
if (isset($_POST["country"]) && ($_POST["country"]=='0'))
|
if (isset($_POST["country"]) && ($_POST["country"] <= 0))
|
||||||
{
|
|
||||||
if (in_array($tablib[$id],array('DictionaryCompanyType','DictionaryHolidayTypes'))) // Field country is no mandatory for such dictionaries
|
|
||||||
{
|
|
||||||
$_POST["country"]='';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$ok=0;
|
$ok=0;
|
||||||
setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")), null, 'errors');
|
setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Clean some parameters
|
// Clean some parameters
|
||||||
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null
|
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null
|
||||||
@ -262,14 +233,11 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
$i=0;
|
$i=0;
|
||||||
foreach ($listfieldinsert as $f => $value)
|
foreach ($listfieldinsert as $f => $value)
|
||||||
{
|
{
|
||||||
if ($value == 'price' || preg_match('/^amount/i',$value) || $value == 'taux') {
|
if ($value == 'entity') {
|
||||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
|
||||||
}
|
|
||||||
else if ($value == 'entity') {
|
|
||||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||||
}
|
}
|
||||||
if ($i) $sql.=",";
|
if ($i) $sql.=",";
|
||||||
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
if ($_POST[$listfieldvalue[$i]] == '' && ! $listfieldvalue[$i] == 'formula') $sql.="null"; // For vat, we want/accept code = ''
|
||||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -310,15 +278,15 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($listfieldmodify as $field)
|
foreach ($listfieldmodify as $field)
|
||||||
{
|
{
|
||||||
if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') {
|
if ($field == 'fk_country' && $_POST['country'] > 0) {
|
||||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
$_POST[$listfieldvalue[$i]] = $_POST['country'];
|
||||||
}
|
}
|
||||||
else if ($field == 'entity') {
|
else if ($field == 'entity') {
|
||||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||||
}
|
}
|
||||||
if ($i) $sql.=",";
|
if ($i) $sql.=",";
|
||||||
$sql.= $field."=";
|
$sql.= $field."=";
|
||||||
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
if ($_POST[$listfieldvalue[$i]] == '' && ! $listfieldvalue[$i] == 'range_account') $sql.="null"; // For range_account, we want/accept code = ''
|
||||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -458,11 +426,15 @@ $titlepicto='title_setup';
|
|||||||
|
|
||||||
print load_fiche_titre($titre,$linkback,$titlepicto);
|
print load_fiche_titre($titre,$linkback,$titlepicto);
|
||||||
|
|
||||||
|
if ($id == 32)
|
||||||
|
{
|
||||||
|
print $langs->trans("AccountingAccountGroupsDesc", $langs->transnoentitiesnoconv("ByPersonalizedAccountGroups")).'<br><br>';
|
||||||
|
}
|
||||||
|
|
||||||
// Confirmation de la suppression de la ligne
|
// Confirmation de la suppression de la ligne
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id.($search_country_id>0?'&search_country_id='.$search_country_id:''), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
||||||
}
|
}
|
||||||
//var_dump($elementList);
|
//var_dump($elementList);
|
||||||
|
|
||||||
@ -508,6 +480,7 @@ if ($id)
|
|||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
// Form to add a new line
|
// Form to add a new line
|
||||||
@ -536,18 +509,15 @@ if ($id)
|
|||||||
{
|
{
|
||||||
$valuetoshow=$langs->trans("Label");
|
$valuetoshow=$langs->trans("Label");
|
||||||
}
|
}
|
||||||
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; }
|
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments"); }
|
||||||
if ($fieldlist[$field]=='country') {
|
if ($fieldlist[$field]=='country') {
|
||||||
if (in_array('region_id',$fieldlist)) { print '<td> </td>'; continue; } // For region page, we do not show the country input
|
|
||||||
$valuetoshow=$langs->trans("Country");
|
$valuetoshow=$langs->trans("Country");
|
||||||
}
|
}
|
||||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $valuetoshow=''; }
|
|
||||||
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
|
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
|
||||||
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); }
|
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); }
|
||||||
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); }
|
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); }
|
||||||
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
|
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
|
||||||
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
|
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Comment"); }
|
||||||
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Direction"); }
|
|
||||||
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
||||||
|
|
||||||
if ($valuetoshow != '')
|
if ($valuetoshow != '')
|
||||||
@ -617,8 +587,7 @@ if ($id)
|
|||||||
$paramwithsearch = $param;
|
$paramwithsearch = $param;
|
||||||
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
||||||
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
||||||
if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
|
if (GETPOST('from','alpha')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
|
||||||
|
|
||||||
// There is several pages
|
// There is several pages
|
||||||
if ($num > $listlimit)
|
if ($num > $listlimit)
|
||||||
{
|
{
|
||||||
@ -700,8 +669,7 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); }
|
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); }
|
||||||
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
|
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
|
||||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||||
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
|
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Comment"); }
|
||||||
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Direction"); }
|
|
||||||
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
||||||
// Affiche nom du champ
|
// Affiche nom du champ
|
||||||
if ($showfield)
|
if ($showfield)
|
||||||
@ -742,6 +710,7 @@ if ($id)
|
|||||||
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
|
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
|
||||||
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
print '<td></td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -759,17 +728,9 @@ if ($id)
|
|||||||
$showfield=1;
|
$showfield=1;
|
||||||
$align="left";
|
$align="left";
|
||||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||||
if ($value == 'type_template')
|
if ($value == 'category_type')
|
||||||
{
|
{
|
||||||
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
$valuetoshow = yn($valuetoshow);
|
||||||
}
|
|
||||||
if ($value == 'element')
|
|
||||||
{
|
|
||||||
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
|
||||||
}
|
|
||||||
else if ($value == 'source')
|
|
||||||
{
|
|
||||||
$valuetoshow = isset($sourceList[$valuetoshow])?$sourceList[$valuetoshow]:$valuetoshow;
|
|
||||||
}
|
}
|
||||||
else if ($valuetoshow=='all') {
|
else if ($valuetoshow=='all') {
|
||||||
$valuetoshow=$langs->trans('All');
|
$valuetoshow=$langs->trans('All');
|
||||||
@ -785,12 +746,6 @@ if ($id)
|
|||||||
$valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country);
|
$valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($fieldlist[$field]=='libelle_facture') {
|
|
||||||
$langs->load("bills");
|
|
||||||
$key=$langs->trans("PaymentCondition".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "PaymentCondition".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
|
||||||
$valuetoshow=nl2br($valuetoshow);
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') {
|
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') {
|
||||||
$key=$langs->trans("Country".strtoupper($obj->code));
|
$key=$langs->trans("Country".strtoupper($obj->code));
|
||||||
$valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
$valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||||
@ -804,83 +759,11 @@ if ($id)
|
|||||||
$key=$langs->trans("Action".strtoupper($obj->code));
|
$key=$langs->trans("Action".strtoupper($obj->code));
|
||||||
$valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
$valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||||
}
|
}
|
||||||
else if (! empty($obj->code_iso) && $fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_currencies') {
|
|
||||||
$key=$langs->trans("Currency".strtoupper($obj->code_iso));
|
|
||||||
$valuetoshow=($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso)?$key:$obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_typent') {
|
|
||||||
$key=$langs->trans(strtoupper($obj->code));
|
|
||||||
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_prospectlevel') {
|
|
||||||
$key=$langs->trans(strtoupper($obj->code));
|
|
||||||
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_civility') {
|
|
||||||
$key=$langs->trans("Civility".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_type_contact') {
|
|
||||||
$langs->load('agenda');
|
|
||||||
$key=$langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_payment_term') {
|
|
||||||
$langs->load("bills");
|
|
||||||
$key=$langs->trans("PaymentConditionShort".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paiement') {
|
|
||||||
$langs->load("bills");
|
|
||||||
$key=$langs->trans("PaymentType".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_reason') {
|
|
||||||
$key=$langs->trans("DemandReasonType".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_method') {
|
|
||||||
$langs->load("orders");
|
|
||||||
$key=$langs->trans($obj->code);
|
|
||||||
$valuetoshow=($obj->code && $key != $obj->code)?$key:$obj->{$fieldlist[$field]};
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_shipment_mode') {
|
|
||||||
$langs->load("sendings");
|
|
||||||
$key=$langs->trans("SendingMethod".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "SendingMethod".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field] == 'libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paper_format')
|
|
||||||
{
|
|
||||||
$key = $langs->trans('PaperFormat'.strtoupper($obj->code));
|
|
||||||
$valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees')
|
|
||||||
{
|
|
||||||
$langs->load('trips');
|
|
||||||
$key = $langs->trans(strtoupper($obj->code));
|
|
||||||
$valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') {
|
else if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') {
|
||||||
$showfield=0;
|
$showfield=0;
|
||||||
}
|
}
|
||||||
else if ($fieldlist[$field]=='label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') {
|
|
||||||
$langs->load("products");
|
|
||||||
$valuetoshow=$langs->trans($obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='short_label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') {
|
|
||||||
$langs->load("products");
|
|
||||||
$valuetoshow = $langs->trans($obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if (in_array($fieldlist[$field],array('recuperableonly')))
|
|
||||||
{
|
|
||||||
$align="center";
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') {
|
|
||||||
$valuetoshow = length_accountg($valuetoshow);
|
|
||||||
}
|
|
||||||
|
|
||||||
$class='tddict';
|
$class='tddict';
|
||||||
if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto';
|
|
||||||
// Show value for field
|
// Show value for field
|
||||||
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
||||||
}
|
}
|
||||||
@ -891,14 +774,9 @@ if ($id)
|
|||||||
if (isset($obj->code))
|
if (isset($obj->code))
|
||||||
{
|
{
|
||||||
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $canbedisabled = 0; }
|
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $canbedisabled = 0; }
|
||||||
else if ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; }
|
|
||||||
else if ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) { $iserasable=0; }
|
|
||||||
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $canbedisabled=0; $canbedisabled = 0; }
|
|
||||||
$canbemodified=$iserasable;
|
$canbemodified=$iserasable;
|
||||||
if ($obj->code == 'RECEP') $canbemodified=1;
|
|
||||||
|
|
||||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
|
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
|
||||||
if ($param) $url .= '&'.$param;
|
if ($param) $url .= '&'.$param;
|
||||||
@ -909,10 +787,7 @@ if ($id)
|
|||||||
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO'))) print $langs->trans("AlwaysActive");
|
print $langs->trans("AlwaysActive");
|
||||||
else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) print $langs->trans("Deprecated");
|
|
||||||
else if (isset($obj->type) && in_array($obj->type, array('system')) && ! empty($obj->active) && $obj->code != 'AC_OTH') print $langs->trans("UsedOnlyWithTypeOption");
|
|
||||||
else print $langs->trans("AlwaysActive");
|
|
||||||
}
|
}
|
||||||
print "</td>";
|
print "</td>";
|
||||||
|
|
||||||
@ -937,8 +812,8 @@ if ($id)
|
|||||||
print '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories.php?action=display&account_category='.$obj->rowid.'">'.$langs->trans("Setup").'</a>';
|
print '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories.php?action=display&account_category='.$obj->rowid.'">'.$langs->trans("Setup").'</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
|
||||||
}
|
}
|
||||||
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -948,6 +823,7 @@ if ($id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
@ -984,16 +860,17 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex
|
|||||||
{
|
{
|
||||||
if ($fieldlist[$field] == 'country')
|
if ($fieldlist[$field] == 'country')
|
||||||
{
|
{
|
||||||
if (in_array('region_id',$fieldlist))
|
|
||||||
{
|
|
||||||
print '<td>';
|
|
||||||
//print join(',',$fieldlist);
|
|
||||||
print '</td>';
|
|
||||||
continue;
|
|
||||||
} // For state page, we do not show the country input (we link to region, not country)
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$fieldname='country';
|
$fieldname='country';
|
||||||
|
if ($context == 'add')
|
||||||
|
{
|
||||||
|
$fieldname='country_id';
|
||||||
|
print $form->select_country(GETPOST('country_id','int'), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:$mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:$mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
elseif ($fieldlist[$field] == 'country_id')
|
elseif ($fieldlist[$field] == 'country_id')
|
||||||
@ -1006,130 +883,14 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($fieldlist[$field] == 'region')
|
elseif ($fieldlist[$field] == 'category_type') {
|
||||||
{
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$formcompany->select_region($region_id,'region');
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
elseif ($fieldlist[$field] == 'region_id')
|
|
||||||
{
|
|
||||||
$region_id = (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:0);
|
|
||||||
print '<td>';
|
|
||||||
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$region_id.'">';
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
elseif ($fieldlist[$field] == 'lang')
|
|
||||||
{
|
|
||||||
print '<td>';
|
|
||||||
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'lang');
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
// Le type de template
|
|
||||||
elseif ($fieldlist[$field] == 'type_template')
|
|
||||||
{
|
|
||||||
print '<td>';
|
|
||||||
print $form->selectarray('type_template', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
// Le type de l'element (pour les type de contact)
|
|
||||||
elseif ($fieldlist[$field] == 'element')
|
|
||||||
{
|
|
||||||
print '<td>';
|
|
||||||
print $form->selectarray('element', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
// La source de l'element (pour les type de contact)
|
|
||||||
elseif ($fieldlist[$field] == 'source')
|
|
||||||
{
|
|
||||||
print '<td>';
|
|
||||||
print $form->selectarray('source', $sourceList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm")
|
|
||||||
{
|
|
||||||
print '<td>';
|
|
||||||
print 'user<input type="hidden" name="type" value="user">';
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
|
|
||||||
if ($fieldlist[$field] == 'type_cdr') print '<td align="center">';
|
|
||||||
else print '<td>';
|
|
||||||
if ($fieldlist[$field] == 'type_cdr') {
|
|
||||||
print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
|
||||||
} else {
|
|
||||||
print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1);
|
print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1);
|
||||||
}
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
elseif (in_array($fieldlist[$field],array('nbjour','decalage','taux','localtax1','localtax2'))) {
|
|
||||||
$align="left";
|
|
||||||
if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) $align="center"; // Fields aligned on right
|
|
||||||
print '<td align="'.$align.'">';
|
|
||||||
print '<input type="text" class="flat" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" size="3" name="'.$fieldlist[$field].'">';
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
|
|
||||||
print '<td><textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea></td>';
|
|
||||||
}
|
|
||||||
elseif (in_array($fieldlist[$field], array('content')))
|
|
||||||
{
|
|
||||||
if ($tabname == MAIN_DB_PREFIX.'c_email_templates')
|
|
||||||
{
|
|
||||||
print '<td colspan="4"></td></tr><tr class="pair nohover"><td colspan="5">'; // To create an artificial CR for the current tr we are on
|
|
||||||
}
|
|
||||||
else print '<td>';
|
|
||||||
if ($context != 'hide')
|
|
||||||
{
|
|
||||||
//print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
|
|
||||||
$okforextended=true;
|
|
||||||
if ($tabname == MAIN_DB_PREFIX.'c_email_templates' && empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended=false;
|
|
||||||
$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_5, '90%');
|
|
||||||
print $doleditor->Create(1);
|
|
||||||
}
|
|
||||||
else print ' ';
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) {
|
|
||||||
print '<td><input type="text" class="flat minwidth75" value="'.price((! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')).'" name="'.$fieldlist[$field].'"></td>';
|
|
||||||
}
|
|
||||||
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||||
print '<td><input type="text" class="flat minwidth100" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
|
print '<td><input type="text" class="flat minwidth100" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
|
||||||
}
|
}
|
||||||
elseif ($fieldlist[$field]=='unit') {
|
|
||||||
print '<td>';
|
|
||||||
$units = array(
|
|
||||||
'mm' => $langs->trans('SizeUnitmm'),
|
|
||||||
'cm' => $langs->trans('SizeUnitcm'),
|
|
||||||
'point' => $langs->trans('SizeUnitpoint'),
|
|
||||||
'inch' => $langs->trans('SizeUnitinch')
|
|
||||||
);
|
|
||||||
print $form->selectarray('unit', $units, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 0, 0, 0);
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
// Le type de taxe locale
|
|
||||||
elseif ($fieldlist[$field] == 'localtax1_type' || $fieldlist[$field] == 'localtax2_type')
|
|
||||||
{
|
|
||||||
print '<td align="center">';
|
|
||||||
print $form->selectarray($fieldlist[$field], $localtax_typeList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
elseif ($fieldlist[$field] == 'accountancy_code' || $fieldlist[$field] == 'accountancy_code_sell' || $fieldlist[$field] == 'accountancy_code_buy')
|
|
||||||
{
|
|
||||||
print '<td>';
|
|
||||||
if (! empty($conf->accounting->enabled))
|
|
||||||
{
|
|
||||||
$fieldname = $fieldlist[$field];
|
|
||||||
$accountancy_account = (! empty($obj->$fieldname) ? $obj->$fieldname : 0);
|
|
||||||
print $formaccounting->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$fieldname = $fieldlist[$field];
|
|
||||||
print '<input type="text" size="10" class="flat" value="'.(isset($obj->$fieldname)?$obj->$fieldname:'').'" name="'.$fieldlist[$field].'">';
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -1137,8 +898,7 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex
|
|||||||
if ($fieldlist[$field]=='code') $class='maxwidth100';
|
if ($fieldlist[$field]=='code') $class='maxwidth100';
|
||||||
if ($fieldlist[$field]=='position') $class='maxwidth50';
|
if ($fieldlist[$field]=='position') $class='maxwidth50';
|
||||||
if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent';
|
if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent';
|
||||||
if ($fieldlist[$field]=='tracking') $class='quatrevingtpercent';
|
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='category_type') $size='size="2" ';
|
||||||
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
|
|
||||||
print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
@ -37,8 +37,8 @@ $langs->load("bills");
|
|||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
|
|
||||||
// Security check
|
// Security access
|
||||||
if (empty($user->admin) && empty($user->rights->accounting->chartofaccount))
|
if (empty($user->rights->accounting->chartofaccount))
|
||||||
{
|
{
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
@ -53,13 +53,6 @@ $main_option = array (
|
|||||||
$model_option = array (
|
$model_option = array (
|
||||||
'ACCOUNTING_EXPORT_SEPARATORCSV',
|
'ACCOUNTING_EXPORT_SEPARATORCSV',
|
||||||
'ACCOUNTING_EXPORT_DATE'
|
'ACCOUNTING_EXPORT_DATE'
|
||||||
/*
|
|
||||||
'ACCOUNTING_EXPORT_PIECE',
|
|
||||||
'ACCOUNTING_EXPORT_GLOBAL_ACCOUNT',
|
|
||||||
'ACCOUNTING_EXPORT_LABEL',
|
|
||||||
'ACCOUNTING_EXPORT_AMOUNT',
|
|
||||||
'ACCOUNTING_EXPORT_DEVISE'
|
|
||||||
*/
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -121,17 +114,13 @@ llxHeader();
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
// $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||||
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
|
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
|
||||||
|
|
||||||
$head = admin_accounting_prepare_head();
|
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
|
|
||||||
dol_fiche_head($head, 'export', $langs->trans("Configuration"), -1, 'cron');
|
|
||||||
|
|
||||||
$var = true;
|
$var = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -245,8 +234,6 @@ if ($num2) {
|
|||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
|
|
||||||
print '<div class="center"><input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '" name="button"></div>';
|
print '<div class="center"><input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '" name="button"></div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|||||||
@ -20,6 +20,7 @@
|
|||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Page to show a fiscal year
|
* \brief Page to show a fiscal year
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/fiscalyear.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/fiscalyear.lib.php';
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
|
* Copyright (C) 2017 Laurent Destailleur <eldy@destailleur.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -19,7 +20,6 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,10 +37,9 @@ $langs->load("compta");
|
|||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
$langs->load("salaries");
|
|
||||||
|
|
||||||
// Security check
|
// Security access
|
||||||
if (empty($user->admin))
|
if (empty($user->rights->accounting->chartofaccount))
|
||||||
{
|
{
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
@ -160,20 +159,15 @@ llxHeader();
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
//$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||||
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
|
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
|
||||||
|
|
||||||
$head = admin_accounting_prepare_head($accounting);
|
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
|
|
||||||
dol_fiche_head($head, 'general', $langs->trans("Configuration"), -1, 'cron');
|
|
||||||
|
|
||||||
|
|
||||||
// Default mode for calculating turnover (parameter ACCOUNTING_MODE)
|
// Default mode for calculating turnover (parameter ACCOUNTING_MODE)
|
||||||
|
/*
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -200,7 +194,7 @@ print "</table>\n";
|
|||||||
|
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
*/
|
||||||
|
|
||||||
// Others params
|
// Others params
|
||||||
|
|
||||||
@ -287,18 +281,11 @@ foreach ($list as $key)
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
|
|
||||||
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="button"></div>';
|
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="button"></div>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print '<div class="opacitymedium">'.$langs->trans("AccountancySetupDoneFromAccountancyMenu", $langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")).'</div>';
|
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
|||||||
@ -174,7 +174,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||||
{
|
{
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
|
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,6 +354,7 @@ if ($action == $acts[1])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -423,6 +424,7 @@ if ($id)
|
|||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
// Form to add a new line
|
// Form to add a new line
|
||||||
@ -489,7 +491,7 @@ if ($id)
|
|||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
fieldList($fieldlist,$obj,$tabname[$id],'add');
|
fieldListJournal($fieldlist,$obj,$tabname[$id],'add');
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td colspan="4" align="right">';
|
print '<td colspan="4" align="right">';
|
||||||
@ -526,8 +528,25 @@ if ($id)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Title line with search boxes
|
||||||
|
print '<tr class="liste_titre_filter liste_titre_add">';
|
||||||
|
print '<td class="liste_titre"></td>';
|
||||||
|
print '<td class="liste_titre"></td>';
|
||||||
|
print '<td class="liste_titre"></td>';
|
||||||
|
print '<td class="liste_titre"></td>';
|
||||||
|
print '<td class="liste_titre"></td>';
|
||||||
|
print '<td class="liste_titre"></td>';
|
||||||
|
print '<td class="liste_titre" align="center">';
|
||||||
|
if ($filterfound)
|
||||||
|
{
|
||||||
|
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||||
|
print $searchpicto;
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Title of lines
|
// Title of lines
|
||||||
print '<tr class="liste_titre liste_titre_add">';
|
print '<tr class="liste_titre">';
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
// Determine le nom du champ par rapport aux noms possibles
|
// Determine le nom du champ par rapport aux noms possibles
|
||||||
@ -561,23 +580,6 @@ if ($id)
|
|||||||
print getTitleFieldOfList('');
|
print getTitleFieldOfList('');
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Title line with search boxes
|
|
||||||
print '<tr class="liste_titre_filter">';
|
|
||||||
print '<td class="liste_titre"></td>';
|
|
||||||
print '<td class="liste_titre"></td>';
|
|
||||||
print '<td class="liste_titre"></td>';
|
|
||||||
print '<td class="liste_titre"></td>';
|
|
||||||
print '<td class="liste_titre"></td>';
|
|
||||||
print '<td class="liste_titre"></td>';
|
|
||||||
print '<td class="liste_titre" align="center">';
|
|
||||||
if ($filterfound)
|
|
||||||
{
|
|
||||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
|
||||||
print $searchpicto;
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
// Lines with values
|
// Lines with values
|
||||||
@ -594,7 +596,7 @@ if ($id)
|
|||||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||||
|
|
||||||
// Show fields
|
// Show fields
|
||||||
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit');
|
if (empty($reshook)) fieldListJournal($fieldlist,$obj,$tabname[$id],'edit');
|
||||||
|
|
||||||
print '<td align="center" colspan="4">';
|
print '<td align="center" colspan="4">';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
@ -691,6 +693,7 @@ if ($id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
@ -711,7 +714,7 @@ $db->close();
|
|||||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
function fieldListJournal($fieldlist, $obj='', $tabname='', $context='')
|
||||||
{
|
{
|
||||||
global $conf,$langs,$db;
|
global $conf,$langs,$db;
|
||||||
global $form, $mysoc;
|
global $form, $mysoc;
|
||||||
|
|||||||
@ -90,8 +90,8 @@ $arrayfields=array();
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
@ -312,6 +312,7 @@ if ($result)
|
|||||||
$texte=$langs->trans("ListOfProductsServices");
|
$texte=$langs->trans("ListOfProductsServices");
|
||||||
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
|
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
|
||||||
|
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
@ -448,6 +449,7 @@ if ($result)
|
|||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
// Example : Adding jquery code
|
// Example : Adding jquery code
|
||||||
print '<script type="text/javascript" language="javascript">
|
print '<script type="text/javascript" language="javascript">
|
||||||
|
|||||||
@ -28,7 +28,9 @@ require '../../main.inc.php';
|
|||||||
|
|
||||||
// Class
|
// Class
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
|
|
||||||
@ -51,9 +53,8 @@ if ($search_accountancy_code_end == - 1) {
|
|||||||
$search_accountancy_code_end = '';
|
$search_accountancy_code_end = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST("button_export_csv_x") || GETPOST("button_export_csv.x") || GETPOST("button_export_csv")) {
|
if (GETPOST("exportcsv")) $action = 'export_csv';
|
||||||
$action = 'export_csv';
|
|
||||||
}
|
|
||||||
|
|
||||||
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||||
|
|
||||||
@ -66,8 +67,18 @@ $formother = new FormOther($db);
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
if (empty($search_date_start)) {
|
if (empty($search_date_start)) {
|
||||||
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
|
||||||
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||||
|
$year_start = dol_print_date(dol_now(), '%Y');
|
||||||
|
$year_end = $year_start + 1;
|
||||||
|
$month_end = $month_start - 1;
|
||||||
|
if ($month_end < 1)
|
||||||
|
{
|
||||||
|
$month_end = 12;
|
||||||
|
$year_end--;
|
||||||
|
}
|
||||||
|
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||||
|
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||||
}
|
}
|
||||||
if ($sortorder == "")
|
if ($sortorder == "")
|
||||||
$sortorder = "ASC";
|
$sortorder = "ASC";
|
||||||
@ -136,7 +147,7 @@ if ($action == 'export_csv') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
$title_page = $langs->trans("AccountBalance") . (($search_date_start || $search_date_end) ? ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end) : '');
|
$title_page = $langs->trans("AccountBalance");
|
||||||
|
|
||||||
llxHeader('', $title_page);
|
llxHeader('', $title_page);
|
||||||
|
|
||||||
@ -156,7 +167,7 @@ else {
|
|||||||
|
|
||||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
|
||||||
$button = '<input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . ' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
$button = '<input type="submit" name="exportcsv" class="butAction" value="' . $langs->trans("Export") . ' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
||||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $result, 'title_accountancy', 0, $button);
|
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $result, 'title_accountancy', 0, $button);
|
||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
@ -199,7 +210,7 @@ else {
|
|||||||
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
|
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Solde", $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|||||||
@ -569,7 +569,7 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
print_liste_field_titre("AccountAccountingShort");
|
print_liste_field_titre("AccountAccountingShort");
|
||||||
print_liste_field_titre("SubledgerAccount");
|
print_liste_field_titre("SubledgerAccount");
|
||||||
print_liste_field_titre("Labelcompte");
|
print_liste_field_titre("LabelAccount");
|
||||||
print_liste_field_titre("Label");
|
print_liste_field_titre("Label");
|
||||||
print_liste_field_titre("Debit", "", "", "", "", 'align="right"');
|
print_liste_field_titre("Debit", "", "", "", "", 'align="right"');
|
||||||
print_liste_field_titre("Credit", "", "", "", "", 'align="right"');
|
print_liste_field_titre("Credit", "", "", "", "", 'align="right"');
|
||||||
|
|||||||
@ -108,8 +108,8 @@ if ($action != 'export_file' && ! isset($_POST['begin']) && ! isset($_GET['begin
|
|||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
@ -370,6 +370,7 @@ print '<div class="inline-block divButAction"><a class="butActionDelete" name="b
|
|||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
@ -398,7 +399,7 @@ print '</td>';
|
|||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('From').' ';
|
print $langs->trans('From').' ';
|
||||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||||
{
|
{
|
||||||
@ -411,7 +412,7 @@ else
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('to').' ';
|
print $langs->trans('to').' ';
|
||||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||||
{
|
{
|
||||||
@ -488,8 +489,8 @@ while ($i < min($num, $limit))
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
if ($num < $limit) print '<td align="left" colspan="6">'.$langs->trans("Total").'</td>';
|
if ($num < $limit) print '<td align="left" colspan="7">'.$langs->trans("Total").'</td>';
|
||||||
else print '<td align="left" colspan="6">'.$langs->trans("Totalforthispage").'</td>';
|
else print '<td align="left" colspan="7">'.$langs->trans("Totalforthispage").'</td>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print price($total_debit);
|
print price($total_debit);
|
||||||
@ -501,6 +502,7 @@ print '<td colspan="2"></td>';
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
|||||||
@ -315,7 +315,7 @@ while ($i < min($num, $limit))
|
|||||||
|
|
||||||
// Affiche un lien vers la facture client/fournisseur
|
// Affiche un lien vers la facture client/fournisseur
|
||||||
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
|
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
|
||||||
print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>' . $line->label_operation . '</td>' : '<td>' . $line->label_operation . '<br /><span style="font-size:0.8em">(' . length_accounta($line->subledger_account) . ')</span></td>';
|
print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>' . $line->label_operation . '</td>' : '<td>' . $line->label_operation . '<br><span style="font-size:0.8em">(' . length_accounta($line->subledger_account) . ')</span></td>';
|
||||||
|
|
||||||
|
|
||||||
print '<td align="right">' . ($line->debit ? price($line->debit) :''). '</td>';
|
print '<td align="right">' . ($line->debit ? price($line->debit) :''). '</td>';
|
||||||
|
|||||||
@ -196,7 +196,7 @@ llxHeader ( '', 'Compta - Grand Livre' );
|
|||||||
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
|
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
|
||||||
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
|
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
|
||||||
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
|
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
|
||||||
print_liste_field_titre("Labelcompte", "liste.php", "bk_label_compte" );
|
print_liste_field_titre("LabelAccount", "liste.php", "bk_label_compte" );
|
||||||
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
|
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
|
||||||
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
|
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
|
||||||
// print_liste_field_titre("Amount", "liste.php", "bk.montant" );
|
// print_liste_field_titre("Amount", "liste.php", "bk.montant" );
|
||||||
|
|||||||
@ -205,7 +205,7 @@ llxHeader ( '', 'Compta - Grand Livre' );
|
|||||||
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
|
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
|
||||||
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
|
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
|
||||||
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
|
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
|
||||||
print_liste_field_titre("Labelcompte", "liste.php", "bk_label_compte" );
|
print_liste_field_titre("LabelAccount", "liste.php", "bk_label_compte" );
|
||||||
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
|
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
|
||||||
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
|
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
|
||||||
print_liste_field_titre("Amount", "liste.php", "bk.montant" );
|
print_liste_field_titre("Amount", "liste.php", "bk.montant" );
|
||||||
|
|||||||
@ -286,7 +286,7 @@ class AccountancyCategory
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($mysoc->country_id)) {
|
if (! empty($mysoc->country_id)) {
|
||||||
$sql = "SELECT t.rowid, t.account_number, t.label as name_cpt, cat.code, cat.position, cat.label as name_cat, cat.sens ";
|
$sql = "SELECT t.rowid, t.account_number, t.label as account_label, cat.code, cat.position, cat.label as name_cat, cat.sens ";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t, " . MAIN_DB_PREFIX . "c_accounting_category as cat";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t, " . MAIN_DB_PREFIX . "c_accounting_category as cat";
|
||||||
$sql .= " WHERE t.fk_accounting_category IN ( SELECT c.rowid ";
|
$sql .= " WHERE t.fk_accounting_category IN ( SELECT c.rowid ";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
|
||||||
@ -316,7 +316,7 @@ class AccountancyCategory
|
|||||||
'code' => $obj->code,
|
'code' => $obj->code,
|
||||||
'position' => $obj->position,
|
'position' => $obj->position,
|
||||||
'account_number' => $obj->account_number,
|
'account_number' => $obj->account_number,
|
||||||
'name_cpt' => $obj->name_cpt,
|
'account_label' => $obj->account_label,
|
||||||
'sens' => $obj->sens
|
'sens' => $obj->sens
|
||||||
);
|
);
|
||||||
$i ++;
|
$i ++;
|
||||||
@ -336,20 +336,26 @@ class AccountancyCategory
|
|||||||
*
|
*
|
||||||
* @param int $cpt Id accounting account
|
* @param int $cpt Id accounting account
|
||||||
* @param string $month Specifig month - Can be empty
|
* @param string $month Specifig month - Can be empty
|
||||||
* @param string $year Specific year
|
* @param string $date_start Date start
|
||||||
* @param int $sens Sens of the account 0: credit - debit 1: debit - credit
|
* @param string $date_end Date end
|
||||||
*
|
* @param int $sens Sens of the account: 0: credit - debit, 1: debit - credit
|
||||||
|
* @param string $thirdparty_code Thirdparty code
|
||||||
* @return integer Result in table
|
* @return integer Result in table
|
||||||
*/
|
*/
|
||||||
public function getResult($cpt, $month, $year, $sens) {
|
public function getResult($cpt, $month, $date_start, $date_end, $sens, $thirdparty_code='nofilter')
|
||||||
|
{
|
||||||
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
|
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
|
||||||
$sql .= " WHERE t.numero_compte = '" . $cpt."'";
|
$sql .= " WHERE t.numero_compte = '" . $cpt."'";
|
||||||
$sql .= " AND YEAR(t.doc_date) = " . $year;
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
|
$sql.= " AND t.doc_date >= '".$this->db->idate($date_start)."' AND t.doc_date <= '".$this->db->idate($date_end)."'";
|
||||||
if (! empty($month)) {
|
if (! empty($month)) {
|
||||||
$sql .= " AND MONTH(t.doc_date) = " . $month;
|
$sql .= " AND MONTH(t.doc_date) = " . $month;
|
||||||
}
|
}
|
||||||
|
if ($thirdparty_code != 'nofilter')
|
||||||
|
{
|
||||||
|
$sql .= " AND thirdparty_code = '".$this->db->escape($thirdparty_code)."'";
|
||||||
|
}
|
||||||
|
|
||||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -375,62 +381,13 @@ class AccountancyCategory
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to call category from a specific country
|
* Return list of personalized groups
|
||||||
*
|
*
|
||||||
* @return array Result in table
|
* @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups
|
||||||
|
* @return array Array of groups
|
||||||
*/
|
*/
|
||||||
public function getCatsCal() {
|
public function getCats($categorytype=-1)
|
||||||
global $db, $langs, $user, $mysoc;
|
{
|
||||||
|
|
||||||
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
|
|
||||||
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($mysoc->country_id)) {
|
|
||||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
|
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
|
|
||||||
$sql .= " WHERE c.active = 1 AND c.category_type = 1 ";
|
|
||||||
$sql .= " AND c.fk_country = " . $mysoc->country_id;
|
|
||||||
$sql .= " ORDER BY c.position ASC";
|
|
||||||
} else {
|
|
||||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
|
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co";
|
|
||||||
$sql .= " WHERE c.active = 1 AND c.category_type = 1 AND c.fk_country = co.rowid";
|
|
||||||
$sql .= " AND co.code = '" . $mysoc->country_code . "'";
|
|
||||||
$sql .= " ORDER BY c.position ASC";
|
|
||||||
}
|
|
||||||
|
|
||||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
|
||||||
$resql = $this->db->query($sql);
|
|
||||||
if ($resql) {
|
|
||||||
$i = 0;
|
|
||||||
$obj = '';
|
|
||||||
$num = $this->db->num_rows($resql);
|
|
||||||
$data = array ();
|
|
||||||
if ($num) {
|
|
||||||
while ( $i < $num ) {
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
|
||||||
$position = $obj->position;
|
|
||||||
$data[$position] = array (
|
|
||||||
'code' => $obj->code,
|
|
||||||
'label' => $obj->label,
|
|
||||||
'formula' => $obj->formula
|
|
||||||
);
|
|
||||||
$i ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $data;
|
|
||||||
} else {
|
|
||||||
$this->error = "Error " . $this->db->lasterror();
|
|
||||||
$this->errors[] = $this->error;
|
|
||||||
dol_syslog(__METHOD__ . " " . implode(',', $this->errors), LOG_ERR);
|
|
||||||
|
|
||||||
return - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCats() {
|
|
||||||
global $db, $langs, $user, $mysoc;
|
global $db, $langs, $user, $mysoc;
|
||||||
|
|
||||||
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
|
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
|
||||||
@ -442,17 +399,18 @@ class AccountancyCategory
|
|||||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
|
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
|
||||||
$sql .= " WHERE c.active = 1 ";
|
$sql .= " WHERE c.active = 1 ";
|
||||||
|
if ($categorytype >= 0) $sql.=" AND c.category_type = 1";
|
||||||
$sql .= " AND c.fk_country = " . $mysoc->country_id;
|
$sql .= " AND c.fk_country = " . $mysoc->country_id;
|
||||||
$sql .= " ORDER BY c.position ASC";
|
$sql .= " ORDER BY c.position ASC";
|
||||||
} else {
|
} else { // Note: this should not happen
|
||||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
|
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co";
|
||||||
$sql .= " WHERE c.active = 1 AND c.fk_country = co.rowid";
|
$sql .= " WHERE c.active = 1 AND c.fk_country = co.rowid";
|
||||||
|
if ($categorytype >= 0) $sql.=" AND c.category_type = 1";
|
||||||
$sql .= " AND co.code = '" . $mysoc->country_code . "'";
|
$sql .= " AND co.code = '" . $mysoc->country_code . "'";
|
||||||
$sql .= " ORDER BY c.position ASC";
|
$sql .= " ORDER BY c.position ASC";
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -466,9 +424,9 @@ class AccountancyCategory
|
|||||||
$data[] = array (
|
$data[] = array (
|
||||||
'rowid' => $obj->rowid,
|
'rowid' => $obj->rowid,
|
||||||
'code' => $obj->code,
|
'code' => $obj->code,
|
||||||
'position' => $obj->position,
|
|
||||||
'label' => $obj->label,
|
'label' => $obj->label,
|
||||||
'formula' => $obj->formula,
|
'formula' => $obj->formula,
|
||||||
|
'position' => $obj->position,
|
||||||
'category_type' => $obj->category_type
|
'category_type' => $obj->category_type
|
||||||
);
|
);
|
||||||
$i++;
|
$i++;
|
||||||
@ -487,13 +445,19 @@ class AccountancyCategory
|
|||||||
|
|
||||||
// calcule
|
// calcule
|
||||||
|
|
||||||
|
/* I try to replace this with dol_eval()
|
||||||
|
|
||||||
const PATTERN = '/(?:\-?\d+(?:\.?\d+)?[\+\-\*\/])+\-?\d+(?:\.?\d+)?/';
|
const PATTERN = '/(?:\-?\d+(?:\.?\d+)?[\+\-\*\/])+\-?\d+(?:\.?\d+)?/';
|
||||||
|
|
||||||
const PARENTHESIS_DEPTH = 10;
|
const PARENTHESIS_DEPTH = 10;
|
||||||
|
|
||||||
public function calculate($input){
|
public function calculate($input)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
|
||||||
if(strpos($input, '+') != null || strpos($input, '-') != null || strpos($input, '/') != null || strpos($input, '*') != null){
|
if(strpos($input, '+') != null || strpos($input, '-') != null || strpos($input, '/') != null || strpos($input, '*') != null){
|
||||||
// Remove white spaces and invalid math chars
|
// Remove white spaces and invalid math chars
|
||||||
|
$input = str_replace($langs->trans("ThousandSeparator"), '', $input);
|
||||||
$input = str_replace(',', '.', $input);
|
$input = str_replace(',', '.', $input);
|
||||||
$input = preg_replace('[^0-9\.\+\-\*\/\(\)]', '', $input);
|
$input = preg_replace('[^0-9\.\+\-\*\/\(\)]', '', $input);
|
||||||
|
|
||||||
@ -535,28 +499,41 @@ class AccountancyCategory
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get cpts of category
|
* Get all accounting account of a group.
|
||||||
|
* You must choose between first parameter (personalized group) or the second (free criteria filter)
|
||||||
*
|
*
|
||||||
* @param int $cat_id Id accounting account category
|
* @param int $cat_id Id if personalized accounting group/category
|
||||||
*
|
* @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts
|
||||||
* @return array Result in table
|
* @return array Array of accounting accounts
|
||||||
*/
|
*/
|
||||||
public function getCptsCat($cat_id) {
|
public function getCptsCat($cat_id, $predefinedgroupwhere='')
|
||||||
|
{
|
||||||
global $mysoc;
|
global $mysoc;
|
||||||
$sql = "";
|
$sql = '';
|
||||||
|
|
||||||
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
|
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
|
||||||
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
|
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT t.rowid, t.account_number, t.label as name_cpt";
|
if (! empty($cat_id))
|
||||||
|
{
|
||||||
|
$sql = "SELECT t.rowid, t.account_number, t.label as account_label";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
||||||
$sql .= " WHERE t.fk_accounting_category = ".$cat_id;
|
$sql .= " WHERE t.fk_accounting_category = ".$cat_id;
|
||||||
$sql .= " ORDER BY t.account_number ";
|
$sql .= " ORDER BY t.account_number ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql = "SELECT t.rowid, t.account_number, t.label as account_label";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
||||||
|
$sql .= " WHERE ".$predefinedgroupwhere;
|
||||||
|
$sql .= " ORDER BY t.account_number ";
|
||||||
|
}
|
||||||
//echo $sql;
|
//echo $sql;
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -566,12 +543,13 @@ class AccountancyCategory
|
|||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
$data = array();
|
$data = array();
|
||||||
if ($num) {
|
if ($num) {
|
||||||
while ( $obj = $this->db->fetch_object($resql) ) {
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
$name_cat = $obj->name_cat;
|
$name_cat = $obj->name_cat;
|
||||||
$data[] = array (
|
$data[] = array (
|
||||||
'id' => $obj->rowid,
|
'id' => $obj->rowid,
|
||||||
'account_number' => $obj->account_number,
|
'account_number' => $obj->account_number,
|
||||||
'name_cpt' => $obj->name_cpt,
|
'account_label' => $obj->account_label,
|
||||||
);
|
);
|
||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -419,7 +419,7 @@ class AccountancyExport
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export format : Agiris
|
* Export format : Agiris Isacompta
|
||||||
*
|
*
|
||||||
* @param array $objectLines data
|
* @param array $objectLines data
|
||||||
*
|
*
|
||||||
@ -433,30 +433,23 @@ class AccountancyExport
|
|||||||
|
|
||||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||||
|
|
||||||
print $line->id . $this->separator;
|
print $line->piece_num . $this->separator;
|
||||||
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator;
|
print $line->label_operation . $this->separator;
|
||||||
print $date . $this->separator;
|
print $date . $this->separator;
|
||||||
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator;
|
print $line->label_operation . $this->separator;
|
||||||
|
|
||||||
if (empty($line->subledger_account)) {
|
if (empty($line->subledger_account)) {
|
||||||
print length_accountg($line->numero_compte) . $this->separator;
|
print length_accountg($line->numero_compte) . $this->separator;
|
||||||
} else {
|
} else {
|
||||||
// FIXME Because the subledger_account is already an accounting account, does we really need
|
print length_accounta($line->subledger_account) . $this->separator;
|
||||||
// to concat 4011 or 401 to it ?
|
|
||||||
if (substr($line->numero_compte, 0, 1) == 'C' || substr($line->numero_compte, 0, 1) == '9') {
|
|
||||||
print '411' . substr(str_replace(" ", "", $line->subledger_account), 0, 5) . $this->separator;
|
|
||||||
}
|
|
||||||
if (substr($line->numero_compte, 0, 1) == 'F' || substr($line->numero_compte, 0, 1) == '0') {
|
|
||||||
print '401' . substr(str_replace(" ", "", $line->subledger_account), 0, 5) . $this->separator;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print length_accounta($line->subledger_account) . $this->separator;
|
print $line->doc_ref . $this->separator;
|
||||||
print price($line->debit) . $this->separator;
|
print price($line->debit) . $this->separator;
|
||||||
print price($line->credit) . $this->separator;
|
print price($line->credit) . $this->separator;
|
||||||
print price($line->montant).$this->separator;
|
print price($line->montant).$this->separator;
|
||||||
print $line->sens.$this->separator;
|
print $line->sens.$this->separator;
|
||||||
print $line->code_journal . $this->separator;
|
print $line->code_journal;
|
||||||
print $this->end_line;
|
print $this->end_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -107,7 +107,7 @@ class AccountancySystem
|
|||||||
|
|
||||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_system";
|
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_system";
|
||||||
$sql .= " (date_creation, fk_user_author, numero, label)";
|
$sql .= " (date_creation, fk_user_author, numero, label)";
|
||||||
$sql .= " VALUES ('" . $this->db->idate($now) . "'," . $user->id . ",'" . $this->numero . "','" . $this->label . "')";
|
$sql .= " VALUES ('" . $this->db->idate($now) . "'," . $user->id . ",'" . $this->db->escape($this->numero) . "','" . $this->db->escape($this->label) . "')";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -179,8 +179,8 @@ class AccountingAccount extends CommonObject
|
|||||||
$sql .= ", " . $conf->entity;
|
$sql .= ", " . $conf->entity;
|
||||||
$sql .= ", " . (empty($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'");
|
$sql .= ", " . (empty($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'");
|
||||||
$sql .= ", " . (empty($this->pcg_type) ? 'NULL' : "'" . $this->db->escape($this->pcg_type) . "'");
|
$sql .= ", " . (empty($this->pcg_type) ? 'NULL' : "'" . $this->db->escape($this->pcg_type) . "'");
|
||||||
$sql .= ", " . (empty($this->pcg_subtype) ? 'NULL' : "'" . $this->pcg_subtype . "'");
|
$sql .= ", " . (empty($this->pcg_subtype) ? 'NULL' : "'" . $this->db->escape($this->pcg_subtype) . "'");
|
||||||
$sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->account_number . "'");
|
$sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->db->escape($this->account_number) . "'");
|
||||||
$sql .= ", " . (empty($this->account_parent) ? 'NULL' : "'" . $this->db->escape($this->account_parent) . "'");
|
$sql .= ", " . (empty($this->account_parent) ? 'NULL' : "'" . $this->db->escape($this->account_parent) . "'");
|
||||||
$sql .= ", " . (empty($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'");
|
$sql .= ", " . (empty($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'");
|
||||||
$sql .= ", " . (empty($this->account_category) ? 'NULL' : "'" . $this->db->escape($this->account_category) . "'");
|
$sql .= ", " . (empty($this->account_category) ? 'NULL' : "'" . $this->db->escape($this->account_category) . "'");
|
||||||
|
|||||||
@ -1224,18 +1224,17 @@ class BookKeeping extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Delete bookkepping by piece number
|
* Delete bookkepping by piece number
|
||||||
*
|
*
|
||||||
* @param int $piecenum peicenum to delete
|
* @param int $piecenum Piecenum to delete
|
||||||
* @param string $mode Mode
|
|
||||||
* @return int Result
|
* @return int Result
|
||||||
*/
|
*/
|
||||||
function deleteMvtNum($piecenum, $mode) {
|
function deleteMvtNum($piecenum) {
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// first check if line not yet in bookkeeping
|
// first check if line not yet in bookkeeping
|
||||||
$sql = "DELETE";
|
$sql = "DELETE";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element. $mode;
|
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sql .= " WHERE piece_num = " . $piecenum;
|
$sql .= " WHERE piece_num = " . $piecenum;
|
||||||
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
*
|
*
|
||||||
@ -108,29 +108,6 @@ if ($action == 'validatehistory') {
|
|||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
} elseif ($action == 'fixaccountancycode') {
|
|
||||||
$error = 0;
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
|
||||||
$sql1 .= " SET fk_code_ventilation = 0";
|
|
||||||
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
|
||||||
$sql1 .= ' (SELECT accnt.rowid ';
|
|
||||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
|
||||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
|
||||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
|
||||||
|
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
|
||||||
|
|
||||||
$resql1 = $db->query($sql1);
|
|
||||||
if (! $resql1) {
|
|
||||||
$error ++;
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessage($db->lasterror(), 'errors');
|
|
||||||
} else {
|
|
||||||
$db->commit();
|
|
||||||
setEventMessage($langs->trans('Done'), 'mesgs');
|
|
||||||
}
|
|
||||||
} elseif ($action == 'cleanaccountancycode') {
|
} elseif ($action == 'cleanaccountancycode') {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
$db->begin();
|
||||||
@ -144,7 +121,7 @@ if ($action == 'validatehistory') {
|
|||||||
$sql1.= " AND f.entity IN (" . getEntity('accountancy') . ")";
|
$sql1.= " AND f.entity IN (" . getEntity('accountancy') . ")";
|
||||||
$sql1.=")";
|
$sql1.=")";
|
||||||
|
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
dol_syslog("htdocs/accountancy/customer/index.php cleanaccountancycode", LOG_DEBUG);
|
||||||
|
|
||||||
$resql1 = $db->query($sql1);
|
$resql1 = $db->query($sql1);
|
||||||
if (! $resql1) {
|
if (! $resql1) {
|
||||||
@ -169,13 +146,29 @@ $textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
|
|||||||
|
|
||||||
print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
|
print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
|
||||||
|
|
||||||
|
// Clean database
|
||||||
|
$db->begin();
|
||||||
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||||
|
$sql1 .= " SET fk_code_ventilation = 0";
|
||||||
|
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||||
|
$sql1 .= ' (SELECT accnt.rowid ';
|
||||||
|
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||||
|
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||||
|
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||||
|
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||||
|
$resql1 = $db->query($sql1);
|
||||||
|
if (! $resql1) {
|
||||||
|
$error ++;
|
||||||
|
$db->rollback();
|
||||||
|
setEventMessage($db->lasterror(), 'errors');
|
||||||
|
} else {
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
// End clean database
|
||||||
|
|
||||||
print $langs->trans("DescVentilCustomer") . '<br>';
|
print $langs->trans("DescVentilCustomer") . '<br>';
|
||||||
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
//print '<div class="inline-block divButAction">';
|
|
||||||
// TODO Remove this. Should be done always or into the repair.php script.
|
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
|
||||||
//print '</div>';
|
|
||||||
|
|
||||||
$sql = "SELECT count(*) FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
$sql = "SELECT count(*) FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||||
$sql .= " , " . MAIN_DB_PREFIX . "facture as f";
|
$sql .= " , " . MAIN_DB_PREFIX . "facture as f";
|
||||||
@ -205,6 +198,7 @@ $buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?ye
|
|||||||
|
|
||||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||||
@ -213,8 +207,8 @@ for($i = 1; $i <= 12; $i ++) {
|
|||||||
}
|
}
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') . " AS codecomptable,";
|
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,";
|
||||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
@ -240,8 +234,20 @@ if ($resql) {
|
|||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print '<td align="left">' . $row[1] . '</td>';
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("Unknown");
|
||||||
|
}
|
||||||
|
else print length_accountg($row[0]);
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="left">';
|
||||||
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||||
|
}
|
||||||
|
else print $row[1];
|
||||||
|
print '</td>';
|
||||||
for($i = 2; $i <= 12; $i ++) {
|
for($i = 2; $i <= 12; $i ++) {
|
||||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||||
}
|
}
|
||||||
@ -254,13 +260,14 @@ if ($resql) {
|
|||||||
print $db->lasterror(); // Show last sql error
|
print $db->lasterror(); // Show last sql error
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||||
@ -269,8 +276,8 @@ for($i = 1; $i <= 12; $i ++) {
|
|||||||
}
|
}
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') . " AS codecomptable,";
|
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,";
|
||||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
@ -296,8 +303,22 @@ if ($resql) {
|
|||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print '<td align="left">' . $row[1] . '</td>';
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("Unknown");
|
||||||
|
}
|
||||||
|
else print length_accountg($row[0]);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td align="left">';
|
||||||
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||||
|
}
|
||||||
|
else print $row[1];
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
for($i = 2; $i <= 12; $i ++) {
|
for($i = 2; $i <= 12; $i ++) {
|
||||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||||
}
|
}
|
||||||
@ -310,7 +331,7 @@ if ($resql) {
|
|||||||
print $db->lasterror(); // Show last sql error
|
print $db->lasterror(); // Show last sql error
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ?
|
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ?
|
||||||
@ -321,6 +342,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||||
|
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
|
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
@ -362,10 +384,12 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
print $db->lasterror(); // Show last sql error
|
print $db->lasterror(); // Show last sql error
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
if (! empty($conf->margin->enabled)) {
|
if (! empty($conf->margin->enabled)) {
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>';
|
print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
@ -408,6 +432,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
print $db->lasterror(); // Show last sql error
|
print $db->lasterror(); // Show last sql error
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -130,6 +130,8 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
llxHeader('', $langs->trans("CustomersVentilation") . ' - ' . $langs->trans("Dispatched"));
|
llxHeader('', $langs->trans("CustomersVentilation") . ' - ' . $langs->trans("Dispatched"));
|
||||||
|
|
||||||
print '<script type="text/javascript">
|
print '<script type="text/javascript">
|
||||||
|
|||||||
@ -33,6 +33,8 @@ require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
@ -60,6 +62,10 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
|||||||
$search_amount = GETPOST('search_amount', 'alpha');
|
$search_amount = GETPOST('search_amount', 'alpha');
|
||||||
$search_account = GETPOST('search_account', 'alpha');
|
$search_account = GETPOST('search_account', 'alpha');
|
||||||
$search_vat = GETPOST('search_vat', 'alpha');
|
$search_vat = GETPOST('search_vat', 'alpha');
|
||||||
|
$search_day=GETPOST("search_day","int");
|
||||||
|
$search_month=GETPOST("search_month","int");
|
||||||
|
$search_year=GETPOST("search_year","int");
|
||||||
|
|
||||||
$btn_ventil = GETPOST('ventil', 'alpha');
|
$btn_ventil = GETPOST('ventil', 'alpha');
|
||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
@ -95,8 +101,8 @@ $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOU
|
|||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||||
@ -109,6 +115,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
$search_account = '';
|
$search_account = '';
|
||||||
$search_vat = '';
|
$search_vat = '';
|
||||||
|
$search_month = '';
|
||||||
|
$search_year = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mass actions
|
// Mass actions
|
||||||
@ -174,6 +182,7 @@ if ($massaction == 'ventil') {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
|
|
||||||
llxHeader('', $langs->trans("Ventilation"));
|
llxHeader('', $langs->trans("Ventilation"));
|
||||||
|
|
||||||
@ -216,6 +225,19 @@ if (strlen(trim($search_account))) {
|
|||||||
if (strlen(trim($search_vat))) {
|
if (strlen(trim($search_vat))) {
|
||||||
$sql .= natural_search("l.tva_tx",$search_vat,1);
|
$sql .= natural_search("l.tva_tx",$search_vat,1);
|
||||||
}
|
}
|
||||||
|
if ($search_month > 0)
|
||||||
|
{
|
||||||
|
if ($search_year > 0 && empty($search_day))
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
|
||||||
|
else if ($search_year > 0 && ! empty($search_day))
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
|
||||||
|
else
|
||||||
|
$sql.= " AND date_format(f.datef, '%m') = '".$db->escape($search_month)."'";
|
||||||
|
}
|
||||||
|
else if ($search_year > 0)
|
||||||
|
{
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||||
|
}
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||||
} else {
|
} else {
|
||||||
@ -246,6 +268,15 @@ if ($result) {
|
|||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
|
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
|
||||||
|
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||||
|
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||||
|
if ($search_year) $param.='&search_year='.urlencode($search_year);
|
||||||
|
if ($search_invoice) $param.='&search_invoice='.urlencode($search_invoice);
|
||||||
|
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
||||||
|
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
||||||
|
if ($search_amount) $param.='&search_amount='.urlencode($search_amount);
|
||||||
|
if ($search_vat) $param.='&search_vat='.urlencode($search_vat);
|
||||||
|
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
'ventil'=>$langs->trans("Ventilate")
|
'ventil'=>$langs->trans("Ventilate")
|
||||||
@ -280,7 +311,11 @@ if ($result) {
|
|||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre center">';
|
||||||
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||||
|
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||||
|
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||||
|
print '</td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
||||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
|
|||||||
@ -104,29 +104,6 @@ if ($action == 'validatehistory') {
|
|||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
} elseif ($action == 'fixaccountancycode') {
|
|
||||||
$error = 0;
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
|
||||||
$sql1 .= " SET fk_code_ventilation = 0";
|
|
||||||
$sql1 .= ' WHERE erd.fk_code_ventilation NOT IN ';
|
|
||||||
$sql1 .= ' (SELECT accnt.rowid ';
|
|
||||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
|
||||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
|
||||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
|
||||||
|
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
|
||||||
|
|
||||||
$resql1 = $db->query($sql1);
|
|
||||||
if (! $resql1) {
|
|
||||||
$error ++;
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessage($db->lasterror(), 'errors');
|
|
||||||
} else {
|
|
||||||
$db->commit();
|
|
||||||
setEventMessage($langs->trans('Done'), 'mesgs');
|
|
||||||
}
|
|
||||||
} elseif ($action == 'cleanaccountancycode') {
|
} elseif ($action == 'cleanaccountancycode') {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
$db->begin();
|
||||||
@ -140,7 +117,7 @@ if ($action == 'validatehistory') {
|
|||||||
$sql1.= " AND er.entity IN (" . getEntity('accountancy') . ")";
|
$sql1.= " AND er.entity IN (" . getEntity('accountancy') . ")";
|
||||||
$sql1.=")";
|
$sql1.=")";
|
||||||
|
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
dol_syslog("htdocs/accountancy/customer/index.php cleanaccountancycode", LOG_DEBUG);
|
||||||
|
|
||||||
$resql1 = $db->query($sql1);
|
$resql1 = $db->query($sql1);
|
||||||
if (! $resql1) {
|
if (! $resql1) {
|
||||||
@ -168,13 +145,25 @@ print $langs->trans("DescVentilExpenseReport") . '<br>';
|
|||||||
print $langs->trans("DescVentilExpenseReportMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
print $langs->trans("DescVentilExpenseReportMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
//print '<div class="inline-block divButAction">';
|
// Clean database
|
||||||
// TODO Remove this. Should be done always or into the repair.php script.
|
$db->begin();
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||||
//print '</div>';
|
$sql1 .= " SET fk_code_ventilation = 0";
|
||||||
|
$sql1 .= ' WHERE erd.fk_code_ventilation NOT IN ';
|
||||||
|
$sql1 .= ' (SELECT accnt.rowid ';
|
||||||
|
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||||
|
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||||
|
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||||
|
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||||
|
$resql1 = $db->query($sql1);
|
||||||
|
if (! $resql1) {
|
||||||
|
$error ++;
|
||||||
|
$db->rollback();
|
||||||
|
setEventMessage($db->lasterror(), 'errors');
|
||||||
|
} else {
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
// End clean database
|
||||||
|
|
||||||
|
|
||||||
$y = $year_current;
|
$y = $year_current;
|
||||||
@ -186,6 +175,7 @@ $buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?ye
|
|||||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||||
|
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||||
@ -194,8 +184,8 @@ for($i = 1; $i <= 12; $i ++) {
|
|||||||
}
|
}
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
|
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
@ -217,8 +207,20 @@ if ($resql) {
|
|||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print '<td align="left">' . $row[1] . '</td>';
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("Unknown");
|
||||||
|
}
|
||||||
|
else print length_accountg($row[0]);
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="left">';
|
||||||
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||||
|
}
|
||||||
|
else print $row[1];
|
||||||
|
print '</td>';
|
||||||
for($i = 2; $i <= 12; $i ++) {
|
for($i = 2; $i <= 12; $i ++) {
|
||||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||||
}
|
}
|
||||||
@ -231,7 +233,7 @@ if ($resql) {
|
|||||||
print $db->lasterror(); // Show last sql error
|
print $db->lasterror(); // Show last sql error
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -239,6 +241,7 @@ print '<br>';
|
|||||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
||||||
|
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||||
@ -247,8 +250,8 @@ for($i = 1; $i <= 12; $i ++) {
|
|||||||
}
|
}
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
|
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
@ -270,8 +273,20 @@ if ($resql) {
|
|||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print '<td align="left">' . $row[1] . '</td>';
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("Unknown");
|
||||||
|
}
|
||||||
|
else print length_accountg($row[0]);
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="left">';
|
||||||
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||||
|
}
|
||||||
|
else print $row[1];
|
||||||
|
print '</td>';
|
||||||
for($i = 2; $i <= 12; $i ++) {
|
for($i = 2; $i <= 12; $i ++) {
|
||||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||||
}
|
}
|
||||||
@ -284,7 +299,7 @@ if ($resql) {
|
|||||||
print $db->lasterror(); // Show last sql error
|
print $db->lasterror(); // Show last sql error
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -296,6 +311,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||||
|
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
@ -334,6 +350,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
print $db->lasterror(); // Show last sql error
|
print $db->lasterror(); // Show last sql error
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -32,6 +32,8 @@ require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
@ -58,6 +60,10 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
|||||||
$search_amount = GETPOST('search_amount', 'alpha');
|
$search_amount = GETPOST('search_amount', 'alpha');
|
||||||
$search_account = GETPOST('search_account', 'alpha');
|
$search_account = GETPOST('search_account', 'alpha');
|
||||||
$search_vat = GETPOST('search_vat', 'alpha');
|
$search_vat = GETPOST('search_vat', 'alpha');
|
||||||
|
$search_day=GETPOST("search_day","int");
|
||||||
|
$search_month=GETPOST("search_month","int");
|
||||||
|
$search_year=GETPOST("search_year","int");
|
||||||
|
|
||||||
$btn_ventil = GETPOST('ventil', 'alpha');
|
$btn_ventil = GETPOST('ventil', 'alpha');
|
||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
@ -91,8 +97,8 @@ $accounting = new AccountingAccount($db);
|
|||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||||
@ -103,14 +109,16 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
$search_account = '';
|
$search_account = '';
|
||||||
$search_vat = '';
|
$search_vat = '';
|
||||||
|
$search_month = '';
|
||||||
|
$search_year = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mass actions
|
// Mass actions
|
||||||
$objectclass='Skeleton';
|
$objectclass='ExpenseReport';
|
||||||
$objectlabel='Skeleton';
|
$objectlabel='ExpenseReport';
|
||||||
$permtoread = $user->rights->accounting->read;
|
$permtoread = $user->rights->expensereport->read;
|
||||||
$permtodelete = $user->rights->accounting->delete;
|
$permtodelete = $user->rights->expensereport->delete;
|
||||||
$uploaddir = $conf->accounting->dir_output;
|
$uploaddir = $conf->expensereport->dir_output;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
|
|
||||||
if ($massaction == 'ventil') {
|
if ($massaction == 'ventil') {
|
||||||
@ -169,6 +177,7 @@ if ($massaction == 'ventil') {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
|
|
||||||
llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
||||||
|
|
||||||
@ -203,6 +212,19 @@ if (strlen(trim($search_account))) {
|
|||||||
if (strlen(trim($search_vat))) {
|
if (strlen(trim($search_vat))) {
|
||||||
$sql .= natural_search("erd.tva_tx",$search_vat,1);
|
$sql .= natural_search("erd.tva_tx",$search_vat,1);
|
||||||
}
|
}
|
||||||
|
if ($search_month > 0)
|
||||||
|
{
|
||||||
|
if ($search_year > 0 && empty($search_day))
|
||||||
|
$sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
|
||||||
|
else if ($search_year > 0 && ! empty($search_day))
|
||||||
|
$sql.= " AND erd.date BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
|
||||||
|
else
|
||||||
|
$sql.= " AND date_format(erd.date, '%m') = '".$db->escape($search_month)."'";
|
||||||
|
}
|
||||||
|
else if ($search_year > 0)
|
||||||
|
{
|
||||||
|
$sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||||
|
}
|
||||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||||
|
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
@ -228,6 +250,15 @@ if ($result) {
|
|||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
|
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
|
||||||
|
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||||
|
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||||
|
if ($search_year) $param.='&search_year='.urlencode($search_year);
|
||||||
|
if ($search_expensereport) $param.='&search_expensereport='.urlencode($search_expensereport);
|
||||||
|
if ($search_label) $param.='&search_label='.urlencode($search_label);
|
||||||
|
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
||||||
|
if ($search_amount) $param.='&search_amount='.urlencode($search_amount);
|
||||||
|
if ($search_vat) $param.='&search_vat='.urlencode($search_vat);
|
||||||
|
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
'ventil'=>$langs->trans("Ventilate")
|
'ventil'=>$langs->trans("Ventilate")
|
||||||
@ -263,7 +294,11 @@ if ($result) {
|
|||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_expensereport" value="' . dol_escape_htmltag($search_expensereport) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_expensereport" value="' . dol_escape_htmltag($search_expensereport) . '"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre center">';
|
||||||
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||||
|
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||||
|
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||||
|
print '</td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||||
@ -313,6 +348,7 @@ if ($result) {
|
|||||||
// Ref Expense report
|
// Ref Expense report
|
||||||
print '<td>' . $expensereport_static->getNomUrl(1) . '</td>';
|
print '<td>' . $expensereport_static->getNomUrl(1) . '</td>';
|
||||||
|
|
||||||
|
// Date
|
||||||
print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
|
print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
|
||||||
|
|
||||||
// Fees label
|
// Fees label
|
||||||
|
|||||||
@ -72,13 +72,13 @@ print "<br>\n";
|
|||||||
|
|
||||||
// STEPS
|
// STEPS
|
||||||
$step++;
|
$step++;
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("AccountingJournals").'</strong>');
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("AccountingJournals").'</strong>');
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
$step++;
|
$step++;
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").'</strong>');
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").'</strong>');
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
$step++;
|
$step++;
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").'</strong>');
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").'</strong>');
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
@ -87,15 +87,20 @@ print "<br>\n";
|
|||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
$step++;
|
$step++;
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>')."\n";
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
$step++;
|
$step++;
|
||||||
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>';
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong>')."\n";
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
$step++;
|
||||||
|
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>';
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
if (! empty($conf->tax->enabled))
|
if (! empty($conf->tax->enabled))
|
||||||
{
|
{
|
||||||
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong>';
|
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong>';
|
||||||
$step++;
|
$step++;
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
@ -111,31 +116,29 @@ if (! empty($conf->tax->enabled))
|
|||||||
if (! empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
|
if (! empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
|
||||||
{
|
{
|
||||||
$step++;
|
$step++;
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong>');
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong>');
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if (! empty($conf->loan->enabled))
|
if (! empty($conf->loan->enabled))
|
||||||
{
|
{
|
||||||
$step++;
|
$step++;
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").'-'.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").'-'.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
}
|
}
|
||||||
if (! empty($conf->don->enabled))
|
if (! empty($conf->don->enabled))
|
||||||
{
|
{
|
||||||
$step++;
|
$step++;
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDonationAccounts").'</strong>');
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDonationAccounts").'</strong>');
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
$step++;
|
$step++;
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").'</strong>');
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").'</strong>');
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
$step++;
|
|
||||||
$textlink='<strong>'.$langs->transnoentitiesnoconv("MenuBankCash").'</strong>';
|
print '<br>';
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, $textlink);
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
|
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
@ -147,15 +150,15 @@ $step = 0;
|
|||||||
$langs->loadLangs(array('bills', 'trips'));
|
$langs->loadLangs(array('bills', 'trips'));
|
||||||
|
|
||||||
$step++;
|
$step++;
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>')."\n";
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>')."\n";
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
$step++;
|
$step++;
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>')."\n";
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>')."\n";
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
$step++;
|
$step++;
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>')."\n";
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>')."\n";
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
$step++;
|
$step++;
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
use Stripe\BankAccount;
|
|
||||||
|
|
||||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
@ -70,6 +68,7 @@ $in_bookkeeping = GETPOST('in_bookkeeping','aZ09');
|
|||||||
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
|
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
@ -104,12 +103,15 @@ $idpays = $mysoc->country_id;
|
|||||||
|
|
||||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_account,";
|
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_account,";
|
||||||
$sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,";
|
$sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,";
|
||||||
$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, bu1.type as typeop,";
|
$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, bu1.type as typeop_company,";
|
||||||
$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, bu2.type as typeop";
|
$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, bu2.type as typeop_user,";
|
||||||
|
$sql .= " bu3.type as typeop_payment, bu4.type as typeop_payment_supplier";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
|
||||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid";
|
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='user'";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='user'";
|
||||||
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='payment'";
|
||||||
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu4 ON bu4.fk_bank = b.rowid AND bu4.type='payment_supplier'";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u on bu2.url_id=u.rowid";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u on bu2.url_id=u.rowid";
|
||||||
$sql .= " WHERE ba.fk_accountancy_journal=" . $id_journal;
|
$sql .= " WHERE ba.fk_accountancy_journal=" . $id_journal;
|
||||||
@ -147,6 +149,7 @@ $result = $db->query($sql);
|
|||||||
if ($result) {
|
if ($result) {
|
||||||
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
//print $sql;
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
$account_supplier = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word
|
$account_supplier = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word
|
||||||
@ -172,13 +175,31 @@ if ($result) {
|
|||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
|
|
||||||
// Set accountancy code (for bank and thirdparty)
|
$lineisapurchase = -1;
|
||||||
|
$lineisasale = -1;
|
||||||
|
// Old method to detect if it's a sale or purchase
|
||||||
|
if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)') $lineisapurchase=1;
|
||||||
|
if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)') $lineisasale=1;
|
||||||
|
// Try a more reliable method to detect if record is a supplier payment or a customer payment
|
||||||
|
if ($lineisapurchase < 0)
|
||||||
|
{
|
||||||
|
if ($obj->typeop_payment_supplier == 'payment_supplier') $lineisapurchase = 1;
|
||||||
|
}
|
||||||
|
if ($lineisasale < 0)
|
||||||
|
{
|
||||||
|
if ($obj->typeop_payment == 'payment') $lineisasale = 1;
|
||||||
|
}
|
||||||
|
//var_dump($obj->type_payment); var_dump($obj->type_payment_supplier);
|
||||||
|
//var_dump($lineisapurchase); //var_dump($lineisasale);
|
||||||
|
|
||||||
|
// Set accountancy code for bank
|
||||||
$compta_bank = $obj->account_number;
|
$compta_bank = $obj->account_number;
|
||||||
|
|
||||||
|
// Set accountancy code for thirdparty
|
||||||
$compta_soc = 'NotDefined';
|
$compta_soc = 'NotDefined';
|
||||||
if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)')
|
if ($lineisapurchase > 0)
|
||||||
$compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $account_supplier);
|
$compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $account_supplier);
|
||||||
if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)')
|
if ($lineisasale > 0)
|
||||||
$compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer);
|
$compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer);
|
||||||
|
|
||||||
$tabcompany[$obj->rowid] = array (
|
$tabcompany[$obj->rowid] = array (
|
||||||
@ -187,6 +208,7 @@ if ($result) {
|
|||||||
'code_compta' => $compta_soc,
|
'code_compta' => $compta_soc,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Set accountancy code for user
|
||||||
$compta_user = (! empty($obj->accountancy_code) ? $obj->accountancy_code : $account_employee);
|
$compta_user = (! empty($obj->accountancy_code) ? $obj->accountancy_code : $account_employee);
|
||||||
|
|
||||||
$tabuser[$obj->rowid] = array (
|
$tabuser[$obj->rowid] = array (
|
||||||
@ -202,6 +224,7 @@ if ($result) {
|
|||||||
$tabpay[$obj->rowid]["type_payment"] = $obj->fk_type; // CHQ, VIR, LIQ, CB, ...
|
$tabpay[$obj->rowid]["type_payment"] = $obj->fk_type; // CHQ, VIR, LIQ, CB, ...
|
||||||
$tabpay[$obj->rowid]["ref"] = $obj->label; // By default. Not unique. May be changed later
|
$tabpay[$obj->rowid]["ref"] = $obj->label; // By default. Not unique. May be changed later
|
||||||
$tabpay[$obj->rowid]["fk_bank"] = $obj->rowid;
|
$tabpay[$obj->rowid]["fk_bank"] = $obj->rowid;
|
||||||
|
$tabpay[$obj->rowid]["bank_account_ref"] = $obj->baref;
|
||||||
$tabpay[$obj->rowid]["fk_bank_account"] = $obj->fk_account;
|
$tabpay[$obj->rowid]["fk_bank_account"] = $obj->fk_account;
|
||||||
if (preg_match('/^\((.*)\)$/i', $obj->label, $reg)) {
|
if (preg_match('/^\((.*)\)$/i', $obj->label, $reg)) {
|
||||||
$tabpay[$obj->rowid]["lib"] = $langs->trans($reg[1]);
|
$tabpay[$obj->rowid]["lib"] = $langs->trans($reg[1]);
|
||||||
@ -214,7 +237,7 @@ if ($result) {
|
|||||||
//var_dump($tabpay);
|
//var_dump($tabpay);
|
||||||
|
|
||||||
// By default
|
// By default
|
||||||
$tabpay[$obj->rowid]['type'] = 'unknown'; // Can be SOLD, miscellaneous entry, payment of patient, or old record with no links in bank_url.
|
$tabpay[$obj->rowid]['type'] = 'unknown'; // Can be SOLD, miscellaneous entry, payment of patient, or any old record with no links in bank_url.
|
||||||
$tabtype[$obj->rowid] = 'unknown';
|
$tabtype[$obj->rowid] = 'unknown';
|
||||||
|
|
||||||
// get_url may return -1 which is not traversable
|
// get_url may return -1 which is not traversable
|
||||||
@ -399,7 +422,6 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = $val["fk_bank"];
|
$bookkeeping->fk_docdet = $val["fk_bank"];
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_operation = $val["label"];
|
|
||||||
$bookkeeping->label_compte = $langs->trans("Bank");
|
$bookkeeping->label_compte = $langs->trans("Bank");
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
||||||
@ -410,21 +432,28 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->date_create = $now;
|
||||||
|
|
||||||
// No subledger_account value for the bank line
|
// No subledger_account value for the bank line but add a specific label_operation
|
||||||
if ($tabtype[$key] == 'payment') {
|
if ($tabtype[$key] == 'payment') {
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
|
||||||
} else if ($tabtype[$key] == 'payment_supplier') {
|
} else if ($tabtype[$key] == 'payment_supplier') {
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
|
||||||
} else if ($tabtype[$key] == 'payment_expensereport') {
|
} else if ($tabtype[$key] == 'payment_expensereport') {
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
|
||||||
} else if ($tabtype[$key] == 'payment_salary') {
|
} else if ($tabtype[$key] == 'payment_salary') {
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
|
||||||
} else if ($tabtype[$key] == 'payment_vat') {
|
} else if ($tabtype[$key] == 'payment_vat') {
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->label_operation = $ref;
|
||||||
} else if ($tabtype[$key] == 'payment_donation') {
|
} else if ($tabtype[$key] == 'payment_donation') {
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->label_operation = $ref;
|
||||||
} else if ($tabtype[$key] == 'payment_various') {
|
} else if ($tabtype[$key] == 'payment_various') {
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->label_operation = $ref;
|
||||||
} else if ($tabtype[$key] == 'unknown') {
|
} else if ($tabtype[$key] == 'unknown') {
|
||||||
// ???
|
// ???
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
@ -461,7 +490,6 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$bookkeeping->doc_type = 'bank';
|
$bookkeeping->doc_type = 'bank';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = $val["fk_bank"];
|
$bookkeeping->fk_docdet = $val["fk_bank"];
|
||||||
$bookkeeping->label_operation = $tabcompany[$key]['name'];
|
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||||
$bookkeeping->debit = ($mt < 0 ? - $mt : 0);
|
$bookkeeping->debit = ($mt < 0 ? - $mt : 0);
|
||||||
@ -472,55 +500,55 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->date_create = $now;
|
||||||
|
|
||||||
if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
|
if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
|
||||||
$bookkeeping->label_operation = '';
|
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
|
||||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||||
$bookkeeping->label_compte = '';
|
$bookkeeping->label_compte = '';
|
||||||
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
|
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
|
||||||
$bookkeeping->label_operation = '';
|
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
|
||||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||||
$bookkeeping->label_compte = '';
|
$bookkeeping->label_compte = '';
|
||||||
} else if ($tabtype[$key] == 'payment_expensereport') {
|
} else if ($tabtype[$key] == 'payment_expensereport') {
|
||||||
$bookkeeping->label_operation = $tabuser[$key]['name'];
|
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
|
||||||
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
||||||
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
||||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||||
$bookkeeping->label_compte = '';
|
$bookkeeping->label_compte = '';
|
||||||
} else if ($tabtype[$key] == 'payment_salary') {
|
} else if ($tabtype[$key] == 'payment_salary') {
|
||||||
$bookkeeping->label_operation = $tabuser[$key]['name'];
|
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
|
||||||
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
||||||
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
||||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||||
$bookkeeping->label_compte = '';
|
$bookkeeping->label_compte = '';
|
||||||
} else if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
|
} else if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
|
||||||
$bookkeeping->label_operation = '';
|
$bookkeeping->label_operation = $ref;
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_compte = $objmid->labelc;
|
$bookkeeping->label_compte = $objmid->labelc;
|
||||||
} else if ($tabtype[$key] == 'payment_vat') {
|
} else if ($tabtype[$key] == 'payment_vat') {
|
||||||
$bookkeeping->label_operation = '';
|
$bookkeeping->label_operation = $ref;
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_compte = '';
|
$bookkeeping->label_compte = '';
|
||||||
} else if ($tabtype[$key] == 'payment_donation') {
|
} else if ($tabtype[$key] == 'payment_donation') {
|
||||||
$bookkeeping->label_operation = '';
|
$bookkeeping->label_operation = $ref;
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_compte = '';
|
$bookkeeping->label_compte = '';
|
||||||
} else if ($tabtype[$key] == 'payment_various') {
|
} else if ($tabtype[$key] == 'payment_various') {
|
||||||
$bookkeeping->label_operation = '';
|
$bookkeeping->label_operation = $ref;
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_compte = '';
|
$bookkeeping->label_compte = '';
|
||||||
} else if ($tabtype[$key] == 'banktransfert') {
|
} else if ($tabtype[$key] == 'banktransfert') {
|
||||||
$bookkeeping->label_operation = '';
|
$bookkeeping->label_operation = $ref;
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
@ -604,6 +632,8 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Export
|
// Export
|
||||||
if ($action == 'exportcsv') { // ISO and not UTF8 !
|
if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
@ -651,9 +681,9 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print " " . $sep;
|
print " " . $sep;
|
||||||
if ($companystatic->name == '') {
|
if ($companystatic->name == '') {
|
||||||
print '"' . $langs->trans('Bank') . " - " . utf8_decode($reflabel) . '"' . $sep;
|
print '"' . $val['bank_account_ref'] . " - " . utf8_decode($reflabel) . '"' . $sep;
|
||||||
} else {
|
} else {
|
||||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||||
}
|
}
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||||
@ -695,9 +725,9 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||||||
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
||||||
print " " . $sep;
|
print " " . $sep;
|
||||||
if ($companystatic->name == '') {
|
if ($companystatic->name == '') {
|
||||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($reflabel) . '"' . $sep;
|
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($reflabel) . '"' . $sep;
|
||||||
} else {
|
} else {
|
||||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||||
}
|
}
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||||
@ -726,7 +756,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
llxHeader('', $langs->trans("FinanceJournal"));
|
llxHeader('', $langs->trans("FinanceJournal"));
|
||||||
|
|
||||||
$nom = $langs->trans("FinanceJournal") . ' - ' . $accountingjournalstatic->getNomUrl(1);
|
$nom = $langs->trans("FinanceJournal") . ' - ' . $accountingjournalstatic->getNomUrl(1);
|
||||||
$builddate = time();
|
$builddate=dol_now();
|
||||||
//$description = $langs->trans("DescFinanceJournal") . '<br>';
|
//$description = $langs->trans("DescFinanceJournal") . '<br>';
|
||||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||||
|
|
||||||
@ -737,18 +767,34 @@ if (empty($action) || $action == 'view') {
|
|||||||
|
|
||||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||||
|
|
||||||
|
|
||||||
|
// Test that setup is complete
|
||||||
|
$sql='SELECT COUNT(rowid) as nb FROM '.MAIN_DB_PREFIX.'bank_account WHERE fk_accountancy_journal IS NULL';
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$obj=$db->fetch_object($resql);
|
||||||
|
if ($obj->nb > 0)
|
||||||
|
{
|
||||||
|
print '<br>'.img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount");
|
||||||
|
print ' : '.$langs->trans("AccountancyAreaDescBank", 9, '<strong>'.$langs->transnoentitiesnoconv("MenuBankCash").'</strong>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
|
|
||||||
|
|
||||||
// Button to write into Ledger
|
// Button to write into Ledger
|
||||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|
||||||
|| empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
|
|| empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
|
||||||
|| empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
|| empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
||||||
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
print '<br>'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print '<div class="tabsAction tabsActionNoBottom">';
|
print '<div class="tabsAction tabsActionNoBottom">';
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
// TODO Avoid using js. We can use a direct link with $param
|
// TODO Avoid using js. We can use a direct link with $param
|
||||||
@ -756,15 +802,15 @@ if (empty($action) || $action == 'view') {
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function launch_export() {
|
function launch_export() {
|
||||||
console.log("Set value into form and submit");
|
console.log("Set value into form and submit");
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("exportcsv");
|
$("div.fiche form input[name=\"action\"]").val("exportcsv");
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
$("div.fiche form input[type=\"submit\"]").click();
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
function writebookkeeping() {
|
function writebookkeeping() {
|
||||||
console.log("Set value into form and submit");
|
console.log("Set value into form and submit");
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("writebookkeeping");
|
$("div.fiche form input[name=\"action\"]").val("writebookkeeping");
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
$("div.fiche form input[type=\"submit\"]").click();
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
@ -774,6 +820,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
print '<div class="div-table-responsive">';
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre\">";
|
||||||
print "<td></td>";
|
print "<td></td>";
|
||||||
@ -781,7 +828,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ObjectsRef") . ")</td>";
|
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ObjectsRef") . ")</td>";
|
||||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||||
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||||
print "<td>" . $langs->trans("Label") . "</td>";
|
print "<td>" . $langs->trans("LabelOperation") . "</td>";
|
||||||
print "<td>" . $langs->trans("PaymentMode") . "</td>";
|
print "<td>" . $langs->trans("PaymentMode") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||||
@ -797,8 +844,10 @@ if (empty($action) || $action == 'view') {
|
|||||||
// Bank
|
// Bank
|
||||||
foreach ( $tabbq[$key] as $k => $mt )
|
foreach ( $tabbq[$key] as $k => $mt )
|
||||||
{
|
{
|
||||||
|
//var_dump($tabpay[$key]);
|
||||||
|
print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td><!-- Bank bank.rowid=".$key."--></td>";
|
print "<td></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $ref . "</td>";
|
print "<td>" . $ref . "</td>";
|
||||||
// Ledger account
|
// Ledger account
|
||||||
@ -819,11 +868,14 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
else print $accounttoshow;*/
|
else print $accounttoshow;*/
|
||||||
print "</td>";
|
print "</td>";
|
||||||
if ($val['soclib'] == '') {
|
print "<td>";
|
||||||
print "<td>" . $langs->trans("Bank") . " - " . $reflabel . "</td>";
|
//var_dump($tabpay[$key]);
|
||||||
} else {
|
print $langs->trans("Bank");
|
||||||
print "<td>" . $langs->trans("Bank") . " - " . $val['soclib'] . "</td>";
|
print ' '.$val['bank_account_ref'];
|
||||||
|
if (! empty($val['soclib'])) {
|
||||||
|
print " - " . $val['soclib'];
|
||||||
}
|
}
|
||||||
|
print "</td>";
|
||||||
print "<td>" . $val["type_payment"] . "</td>";
|
print "<td>" . $val["type_payment"] . "</td>";
|
||||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
@ -834,14 +886,15 @@ if (empty($action) || $action == 'view') {
|
|||||||
if (is_array($tabtp[$key])) {
|
if (is_array($tabtp[$key])) {
|
||||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||||
if ($k != 'type') {
|
if ($k != 'type') {
|
||||||
|
print '<!-- Thirdparty bank.rowid='.$key.' -->';
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td><!-- Thirdparty bank.rowid=".$key." --></td>";
|
print "<td></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $ref . "</td>";
|
print "<td>" . $ref . "</td>";
|
||||||
// Ledger account
|
// Ledger account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$account_ledger = $k;
|
$account_ledger = $k;
|
||||||
|
// Try to force general ledger account depending on type
|
||||||
if ($tabtype[$key] == 'payment') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
if ($tabtype[$key] == 'payment') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||||
if ($tabtype[$key] == 'payment_supplier') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
if ($tabtype[$key] == 'payment_supplier') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||||
if ($tabtype[$key] == 'payment_expensereport') $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
if ($tabtype[$key] == 'payment_expensereport') $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||||
@ -878,7 +931,11 @@ if (empty($action) || $action == 'view') {
|
|||||||
{
|
{
|
||||||
if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined')
|
if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined')
|
||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
/*var_dump($tabpay[$key]);
|
||||||
|
var_dump($tabtype[$key]);
|
||||||
|
var_dump($tabbq[$key]);*/
|
||||||
|
//print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||||
|
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown").'</span>';
|
||||||
}
|
}
|
||||||
else print $accounttoshowsubledger;
|
else print $accounttoshowsubledger;
|
||||||
}
|
}
|
||||||
@ -893,8 +950,9 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||||
|
print '<!-- Wait bank.rowid='.$key.' -->';
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td><!-- Wait bank.rowid=".$key." --></td>";
|
print "<td></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $ref . "</td>";
|
print "<td>" . $ref . "</td>";
|
||||||
// Ledger account
|
// Ledger account
|
||||||
@ -924,6 +982,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
}
|
}
|
||||||
@ -936,7 +995,7 @@ $db->close();
|
|||||||
* Return source for doc_ref of a bank transaction
|
* Return source for doc_ref of a bank transaction
|
||||||
*
|
*
|
||||||
* @param string $val Array of val
|
* @param string $val Array of val
|
||||||
* @param string $typerecord Type of record
|
* @param string $typerecord Type of record ('payment', 'payment_supplier', 'payment_expensereport', 'payment_vat', ...)
|
||||||
* @return string|unknown
|
* @return string|unknown
|
||||||
*/
|
*/
|
||||||
function getSourceDocRef($val, $typerecord)
|
function getSourceDocRef($val, $typerecord)
|
||||||
|
|||||||
@ -298,7 +298,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
$bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %';
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||||
@ -498,7 +498,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$nomlink = '';
|
$nomlink = '';
|
||||||
$periodlink = '';
|
$periodlink = '';
|
||||||
$exportlink = '';
|
$exportlink = '';
|
||||||
$builddate = time();
|
$builddate=dol_now();
|
||||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||||
|
|
||||||
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||||
@ -510,19 +510,20 @@ if (empty($action) || $action == 'view') {
|
|||||||
|
|
||||||
// Button to write into Ledger
|
// Button to write into Ledger
|
||||||
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
||||||
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
print '<br>'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||||
}
|
}
|
||||||
print '<div class="tabsAction tabsActionNoBottom">';
|
print '<div class="tabsAction tabsActionNoBottom">';
|
||||||
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
||||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
}
|
}
|
||||||
//print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
//print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
// TODO Avoid using js. We can use a direct link with $param
|
||||||
print '
|
print '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function launch_export() {
|
function launch_export() {
|
||||||
@ -543,6 +544,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
print '<div class="div-table-responsive">';
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre\">";
|
||||||
print "<td></td>";
|
print "<td></td>";
|
||||||
@ -550,7 +552,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ExpenseReportRef") . ")</td>";
|
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ExpenseReportRef") . ")</td>";
|
||||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||||
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||||
print "<td>" . $langs->trans("Label") . "</td>";
|
print "<td>" . $langs->trans("LabelOperation") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -657,7 +659,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
// Subledger account
|
// Subledger account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).($numtax?' - Localtax '.$numtax:'');
|
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
@ -668,6 +670,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -224,7 +224,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping->doc_ref = $val["refsologest"];
|
||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->date_create = $now;
|
||||||
$bookkeeping->doc_type = 'supplier_invoice';
|
$bookkeeping->doc_type = 'supplier_invoice';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
@ -272,7 +272,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping->doc_ref = $val["refsologest"];
|
||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->date_create = $now;
|
||||||
$bookkeeping->doc_type = 'supplier_invoice';
|
$bookkeeping->doc_type = 'supplier_invoice';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
@ -326,7 +326,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping->doc_ref = $val["refsologest"];
|
||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->date_create = $now;
|
||||||
$bookkeeping->doc_type = 'supplier_invoice';
|
$bookkeeping->doc_type = 'supplier_invoice';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
@ -335,7 +335,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'');
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:'');
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||||
@ -419,7 +419,6 @@ $form = new Form($db);
|
|||||||
// Export
|
// Export
|
||||||
if ($action == 'exportcsv') {
|
if ($action == 'exportcsv') {
|
||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
$journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||||
|
|
||||||
@ -445,7 +444,7 @@ if ($action == 'exportcsv') {
|
|||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
print '"' . $key . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
print '"' . $val["refsologest"] . '"' . $sep;
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
||||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
||||||
@ -465,11 +464,11 @@ if ($action == 'exportcsv') {
|
|||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '"' . $key . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
print '"' . $val["refsologest"] . '"' . $sep;
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print " " . $sep;
|
print '""' . $sep;
|
||||||
print '"' . utf8_decode ( dol_trunc($accountingaccount->label, 32) ) . '"' . $sep;
|
print '"' . utf8_decode ( dol_trunc($accountingaccount->label, 32) ) . '"' . $sep;
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
@ -478,6 +477,7 @@ if ($action == 'exportcsv') {
|
|||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
$listoftax = array(0, 1, 2);
|
$listoftax = array(0, 1, 2);
|
||||||
foreach ($listoftax as $numtax) {
|
foreach ($listoftax as $numtax) {
|
||||||
@ -489,13 +489,13 @@ if ($action == 'exportcsv') {
|
|||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '"' . $key . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
print '"' . $val["refsologest"] . '"' . $sep;
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print " " . $sep;
|
print '""' . $sep;
|
||||||
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key] . '"' . $sep;
|
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key] . '"' . $sep;
|
||||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'') . '"' . $sep;
|
print '"' . utf8_decode(dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . join(', ',$def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:'') . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
||||||
print '"' . $journal . '"' ;
|
print '"' . $journal . '"' ;
|
||||||
@ -514,7 +514,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$nomlink = '';
|
$nomlink = '';
|
||||||
$periodlink = '';
|
$periodlink = '';
|
||||||
$exportlink = '';
|
$exportlink = '';
|
||||||
$builddate = time();
|
$builddate=dol_now();
|
||||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$description .= $langs->trans("DepositsAreNotIncluded");
|
$description .= $langs->trans("DepositsAreNotIncluded");
|
||||||
@ -532,29 +532,30 @@ if (empty($action) || $action == 'view') {
|
|||||||
// Button to write into Ledger
|
// Button to write into Ledger
|
||||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
||||||
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||||
}
|
}
|
||||||
print '<div class="tabsAction tabsActionNoBottom">';
|
print '<div class="tabsAction tabsActionNoBottom">';
|
||||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
}
|
}
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
// TODO Avoid using js. We can use a direct link with $param
|
||||||
print '
|
print '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function launch_export() {
|
function launch_export() {
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("exportcsv");
|
$("div.fiche form input[name=\"action\"]").val("exportcsv");
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
$("div.fiche form input[type=\"submit\"]").click();
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
function writebookkeeping() {
|
function writebookkeeping() {
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("writebookkeeping");
|
$("div.fiche form input[name=\"action\"]").val("writebookkeeping");
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
$("div.fiche form input[type=\"submit\"]").click();
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
@ -564,6 +565,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
print '<div class="div-table-responsive">';
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre\">";
|
||||||
print "<td></td>";
|
print "<td></td>";
|
||||||
@ -571,7 +573,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
||||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||||
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||||
print "<td>" . $langs->trans("Label") . "</td>";
|
print "<td>" . $langs->trans("LabelOperation") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -625,6 +627,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Product / Service
|
// Product / Service
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
@ -681,7 +684,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
// Subledger account
|
// Subledger account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).($numtax?' - Localtax '.$numtax:'');
|
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
@ -692,6 +695,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -353,7 +353,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'');
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:'');
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||||
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
|
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
|
||||||
@ -441,7 +441,6 @@ $form = new Form($db);
|
|||||||
if ($action == 'exportcsv') {
|
if ($action == 'exportcsv') {
|
||||||
|
|
||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||||
|
|
||||||
@ -472,7 +471,7 @@ if ($action == 'exportcsv') {
|
|||||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
print '"' . $sell_journal . '"';
|
print '"' . $journal . '"';
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,12 +486,12 @@ if ($action == 'exportcsv') {
|
|||||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print " " . $sep;
|
print '""' . $sep;
|
||||||
print '"' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
|
print '"' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
|
||||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . $sell_journal . '"';
|
print '"' . $journal . '"';
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -512,12 +511,12 @@ if ($action == 'exportcsv') {
|
|||||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print " " . $sep;
|
print '""' . $sep;
|
||||||
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key] . '"' . $sep;
|
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key] . ' %"' . $sep;
|
||||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'') . '"' . $sep;
|
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . join(', ',$def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:'') . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . $sell_journal . '"';
|
print '"' . $journal . '"';
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -535,7 +534,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$nomlink = '';
|
$nomlink = '';
|
||||||
$periodlink = '';
|
$periodlink = '';
|
||||||
$exportlink = '';
|
$exportlink = '';
|
||||||
$builddate = time();
|
$builddate=dol_now();
|
||||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
||||||
$description .= $langs->trans("DepositsAreNotIncluded");
|
$description .= $langs->trans("DepositsAreNotIncluded");
|
||||||
@ -552,29 +551,30 @@ if (empty($action) || $action == 'view') {
|
|||||||
// Button to write into Ledger
|
// Button to write into Ledger
|
||||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||||
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||||
}
|
}
|
||||||
print '<div class="tabsAction tabsActionNoBottom">';
|
print '<div class="tabsAction tabsActionNoBottom">';
|
||||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
}
|
}
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
// TODO Avoid using js. We can use a direct link with $param
|
||||||
print '
|
print '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function launch_export() {
|
function launch_export() {
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("exportcsv");
|
$("div.fiche form input[name=\"action\"]").val("exportcsv");
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
$("div.fiche form input[type=\"submit\"]").click();
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
function writebookkeeping() {
|
function writebookkeeping() {
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("writebookkeeping");
|
$("div.fiche form input[name=\"action\"]").val("writebookkeeping");
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
$("div.fiche form input[type=\"submit\"]").click();
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
@ -584,6 +584,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
print '<div class="div-table-responsive">';
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre\">";
|
||||||
print "<td></td>";
|
print "<td></td>";
|
||||||
@ -591,7 +592,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
||||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||||
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||||
print "<td>" . $langs->trans("Label") . "</td>";
|
print "<td>" . $langs->trans("LabelOperation") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -697,7 +698,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
// Subledger account
|
// Subledger account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).($numtax?' - Localtax '.$numtax:'');
|
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
@ -708,6 +709,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -1,302 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2016/17 Jamal Elbaz <jamelbaz@gmail.com>
|
|
||||||
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file htdocs/accountancy/report/result.php
|
|
||||||
* \ingroup Advanced accountancy
|
|
||||||
* \brief Page for accounting result
|
|
||||||
*/
|
|
||||||
require '../../main.inc.php';
|
|
||||||
|
|
||||||
// Class
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancycategory.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
|
||||||
|
|
||||||
$error = 0;
|
|
||||||
|
|
||||||
// Langs
|
|
||||||
$langs->load("accountancy");
|
|
||||||
$langs->load("compta");
|
|
||||||
|
|
||||||
$mesg = '';
|
|
||||||
$action = GETPOST('action','aZ09');
|
|
||||||
$cat_id = GETPOST('account_category');
|
|
||||||
$selectcpt = GETPOST('cpt_bk');
|
|
||||||
$id = GETPOST('id', 'int');
|
|
||||||
$rowid = GETPOST('rowid', 'int');
|
|
||||||
$cancel = GETPOST('cancel');
|
|
||||||
$simple_report = GETPOST('simple_report');
|
|
||||||
|
|
||||||
|
|
||||||
// Filter
|
|
||||||
$year = GETPOST('year','int');
|
|
||||||
if ($year == 0) {
|
|
||||||
$year_current = strftime("%Y", time());
|
|
||||||
$year_start = $year_current;
|
|
||||||
} else {
|
|
||||||
$year_current = $year;
|
|
||||||
$year_start = $year;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($cat_id == 0){
|
|
||||||
$cat_id = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Security check
|
|
||||||
if ($user->societe_id > 0)
|
|
||||||
accessforbidden();
|
|
||||||
if (! $user->rights->accounting->comptarapport->lire)
|
|
||||||
accessforbidden();
|
|
||||||
|
|
||||||
$AccCat = new AccountancyCategory($db);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* View
|
|
||||||
*/
|
|
||||||
|
|
||||||
llxheader('', $langs->trans('ReportInOut'));
|
|
||||||
|
|
||||||
$formaccounting = new FormAccounting($db);
|
|
||||||
$form = new Form($db);
|
|
||||||
|
|
||||||
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
|
|
||||||
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
|
|
||||||
|
|
||||||
$nom = $langs->trans("ReportInOut").', '.$langs->trans("ByAccounts");
|
|
||||||
$nomlink = '';
|
|
||||||
$periodlink = '';
|
|
||||||
$exportlink = '';
|
|
||||||
$builddate = time();
|
|
||||||
$description = '';
|
|
||||||
$period = $langs->trans("Detail").' '. $form->selectyesno('simple_report',$simple_report,0) . " " .$textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear ;
|
|
||||||
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
|
|
||||||
|
|
||||||
$moreforfilter='';
|
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
|
||||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
|
||||||
|
|
||||||
$months = array( $langs->trans("JanuaryMin"),
|
|
||||||
$langs->trans("FebruaryMin"),
|
|
||||||
$langs->trans("MarchMin"),
|
|
||||||
$langs->trans("AprilMin"),
|
|
||||||
$langs->trans("MayMin"),
|
|
||||||
$langs->trans("JuneMin"),
|
|
||||||
$langs->trans("JulyMin"),
|
|
||||||
$langs->trans("AugustMin"),
|
|
||||||
$langs->trans("SeptemberMin"),
|
|
||||||
$langs->trans("OctoberMin"),
|
|
||||||
$langs->trans("NovemberMin"),
|
|
||||||
$langs->trans("DecemberMin"),
|
|
||||||
);
|
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<th class="liste_titre">'.$langs->trans("Account").'</th>';
|
|
||||||
print '<th class="liste_titre">'.$langs->trans("Description").'</th>';
|
|
||||||
print '<th class="liste_titre" align="center">N-1</th>';
|
|
||||||
print '<th class="liste_titre" align="center">'.$langs->trans("NReal").'</th>';
|
|
||||||
foreach($months as $k => $v){
|
|
||||||
print '<th class="liste_titre" align="center">'.$langs->trans($v).'</th>';
|
|
||||||
}
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//All categories
|
|
||||||
$cats = $AccCat->getCats();
|
|
||||||
if ($catsCalcule < 0) dol_print_error($db, $AccCat->error, $AccCat->errors);
|
|
||||||
|
|
||||||
$j=1;
|
|
||||||
$sommes = array();
|
|
||||||
|
|
||||||
foreach($cats as $cat ){
|
|
||||||
if(!empty($cat['category_type'])){ // category calculed
|
|
||||||
|
|
||||||
$formula = $cat['formula'];
|
|
||||||
|
|
||||||
print "<tr class='liste_titre'>";
|
|
||||||
print '<td colspan="2">' . $cat['label'] . '</td>';
|
|
||||||
|
|
||||||
$vars = array();
|
|
||||||
|
|
||||||
// Previous Fiscal year (N-1)
|
|
||||||
foreach($sommes as $code => $det){
|
|
||||||
$vars[$code] = $det['NP'];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$result = strtr($formula, $vars);
|
|
||||||
|
|
||||||
|
|
||||||
$r = $AccCat->calculate($result);
|
|
||||||
|
|
||||||
print '<td align="right"><font color="blue">' . price($r) . '</td>';
|
|
||||||
$code = $cat['code']; // code categorie de calcule
|
|
||||||
$sommes[$code]['NP'] += $r;
|
|
||||||
|
|
||||||
// Current fiscal year (N)
|
|
||||||
if (is_array($sommes) && ! empty($sommes)){
|
|
||||||
foreach($sommes as $code => $det){
|
|
||||||
$vars[$code] = $det['N'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = strtr($formula, $vars);
|
|
||||||
|
|
||||||
$r = $AccCat->calculate($result);
|
|
||||||
|
|
||||||
print '<td align="right"><font color="blue">' . price($r) . '</td>';
|
|
||||||
$sommes[$code]['N'] += $r;
|
|
||||||
|
|
||||||
// Detail by month
|
|
||||||
foreach($months as $k => $v){
|
|
||||||
foreach($sommes as $code => $det){
|
|
||||||
$vars[$code] = $det['M'][$k];
|
|
||||||
}
|
|
||||||
$result = strtr($formula, $vars);
|
|
||||||
$r = $AccCat->calculate($result);
|
|
||||||
print '<td align="right"><font color="blue">' . price($r) . '</td>';
|
|
||||||
$sommes[$code]['M'][$k] += $r;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
|
|
||||||
}else{ // normal category
|
|
||||||
|
|
||||||
$totCat = array();
|
|
||||||
$totCat['M'] = array();
|
|
||||||
|
|
||||||
// get cpts of category
|
|
||||||
$cpts = $AccCat->getCptsCat($cat['rowid']);
|
|
||||||
|
|
||||||
|
|
||||||
print "<tr class='liste_titre'>";
|
|
||||||
print '<td colspan="2">' . $cat['label'] . '</td>';
|
|
||||||
|
|
||||||
foreach($cpts as $i => $cpt){
|
|
||||||
$var = ! $var;
|
|
||||||
|
|
||||||
$code = $cat['code'];
|
|
||||||
|
|
||||||
// N-1
|
|
||||||
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
|
|
||||||
|
|
||||||
if ($return < 0) {
|
|
||||||
setEventMessages(null, $AccCat->errors, 'errors');
|
|
||||||
$resultNP=0;
|
|
||||||
} else {
|
|
||||||
$resultNP=$AccCat->sdc;
|
|
||||||
}
|
|
||||||
|
|
||||||
//N
|
|
||||||
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
|
|
||||||
if ($return < 0) {
|
|
||||||
setEventMessages(null, $AccCat->errors, 'errors');
|
|
||||||
$resultN=0;
|
|
||||||
} else {
|
|
||||||
$resultN=$AccCat->sdc;
|
|
||||||
}
|
|
||||||
|
|
||||||
$totCat['NP'] += $resultNP;
|
|
||||||
$totCat['N'] += $resultN;
|
|
||||||
|
|
||||||
foreach($months as $k => $v){
|
|
||||||
$return = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
|
|
||||||
if ($return < 0) {
|
|
||||||
setEventMessages(null, $AccCat->errors, 'errors');
|
|
||||||
$resultM=0;
|
|
||||||
} else {
|
|
||||||
$resultM=$AccCat->sdc;
|
|
||||||
}
|
|
||||||
$totCat['M'][$k] += $resultM;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<td align="right">' . price($totCat['NP']) . '</td>';
|
|
||||||
print '<td align="right">' . price($totCat['N']) . '</td>';
|
|
||||||
|
|
||||||
foreach($totCat['M'] as $k => $v){
|
|
||||||
print '<td align="right">' . price($v) . '</td>';
|
|
||||||
}
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
foreach($cpts as $i => $cpt){
|
|
||||||
$var = ! $var;
|
|
||||||
|
|
||||||
$code = $cat['code'];
|
|
||||||
|
|
||||||
// N-1
|
|
||||||
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
|
|
||||||
|
|
||||||
if ($return < 0) {
|
|
||||||
setEventMessages(null, $AccCat->errors, 'errors');
|
|
||||||
$resultNP=0;
|
|
||||||
} else {
|
|
||||||
$resultNP=$AccCat->sdc;
|
|
||||||
}
|
|
||||||
|
|
||||||
//N
|
|
||||||
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
|
|
||||||
if ($return < 0) {
|
|
||||||
setEventMessages(null, $AccCat->errors, 'errors');
|
|
||||||
$resultN=0;
|
|
||||||
} else {
|
|
||||||
$resultN=$AccCat->sdc;
|
|
||||||
}
|
|
||||||
|
|
||||||
$sommes[$code]['NP'] += $resultNP;
|
|
||||||
$sommes[$code]['N'] += $resultN;
|
|
||||||
print '<tr'. $bc[$var].'>';
|
|
||||||
if ($simple_report == 'yes') {
|
|
||||||
print '<td>' . length_accountg($cpt['account_number']) . '</td>';
|
|
||||||
print '<td>' . $cpt['name_cpt'] . '</td>';
|
|
||||||
print '<td align="right">' . price($resultNP) . '</td>';
|
|
||||||
print '<td align="right">' . price($resultN) . '</td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach($months as $k => $v){
|
|
||||||
$return = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
|
|
||||||
if ($return < 0) {
|
|
||||||
setEventMessages(null, $AccCat->errors, 'errors');
|
|
||||||
$resultM=0;
|
|
||||||
} else {
|
|
||||||
$resultM=$AccCat->sdc;
|
|
||||||
}
|
|
||||||
$sommes[$code]['M'][$k] += $resultM;
|
|
||||||
if ($simple_report == 'yes') {
|
|
||||||
print '<td align="right">' . price($resultM) . '</td>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</table>";
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
llxFooter();
|
|
||||||
$db->close();
|
|
||||||
@ -105,29 +105,6 @@ if ($action == 'validatehistory') {
|
|||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
} elseif ($action == 'fixaccountancycode') {
|
|
||||||
$error = 0;
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
|
||||||
$sql1 .= " SET fk_code_ventilation = 0";
|
|
||||||
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
|
||||||
$sql1 .= ' (SELECT accnt.rowid ';
|
|
||||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
|
||||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
|
||||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
|
||||||
|
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
|
||||||
|
|
||||||
$resql1 = $db->query($sql1);
|
|
||||||
if (! $resql1) {
|
|
||||||
$error ++;
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessage($db->lasterror(), 'errors');
|
|
||||||
} else {
|
|
||||||
$db->commit();
|
|
||||||
setEventMessage($langs->trans('Done'), 'mesgs');
|
|
||||||
}
|
|
||||||
} elseif ($action == 'cleanaccountancycode') {
|
} elseif ($action == 'cleanaccountancycode') {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
$db->begin();
|
||||||
@ -140,7 +117,7 @@ if ($action == 'validatehistory') {
|
|||||||
$sql1.= " AND f.entity IN (" . getEntity('accountancy') . ")";
|
$sql1.= " AND f.entity IN (" . getEntity('accountancy') . ")";
|
||||||
$sql1.= ")";
|
$sql1.= ")";
|
||||||
|
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
dol_syslog("htdocs/accountancy/customer/index.php cleanaccountancycode", LOG_DEBUG);
|
||||||
|
|
||||||
$resql1 = $db->query($sql1);
|
$resql1 = $db->query($sql1);
|
||||||
if (! $resql1) {
|
if (! $resql1) {
|
||||||
@ -168,10 +145,25 @@ print $langs->trans("DescVentilSupplier") . '<br>';
|
|||||||
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
//print '<div class="inline-block divButAction">';
|
// Clean database
|
||||||
// TODO Remove this. Should be done always or into the repair.php script.
|
$db->begin();
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
||||||
//print '</div>';
|
$sql1 .= " SET fk_code_ventilation = 0";
|
||||||
|
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||||
|
$sql1 .= ' (SELECT accnt.rowid ';
|
||||||
|
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||||
|
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||||
|
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||||
|
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||||
|
$resql1 = $db->query($sql1);
|
||||||
|
if (! $resql1) {
|
||||||
|
$error ++;
|
||||||
|
$db->rollback();
|
||||||
|
setEventMessage($db->lasterror(), 'errors');
|
||||||
|
} else {
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
// End clean database
|
||||||
|
|
||||||
|
|
||||||
$y = $year_current;
|
$y = $year_current;
|
||||||
@ -182,6 +174,7 @@ $buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?ye
|
|||||||
|
|
||||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||||
@ -190,8 +183,8 @@ for($i = 1; $i <= 12; $i ++) {
|
|||||||
}
|
}
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
|
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
@ -213,8 +206,20 @@ if ($resql) {
|
|||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print '<td align="left">' . $row[1] . '</td>';
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("Unknown");
|
||||||
|
}
|
||||||
|
else print length_accountg($row[0]);
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="left">';
|
||||||
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||||
|
}
|
||||||
|
else print $row[1];
|
||||||
|
print '</td>';
|
||||||
for($i = 2; $i <= 12; $i ++) {
|
for($i = 2; $i <= 12; $i ++) {
|
||||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||||
}
|
}
|
||||||
@ -227,8 +232,7 @@ if ($resql) {
|
|||||||
print $db->lasterror(); // Show last sql error
|
print $db->lasterror(); // Show last sql error
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -236,6 +240,7 @@ print '<br>';
|
|||||||
|
|
||||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||||
@ -244,8 +249,8 @@ for($i = 1; $i <= 12; $i ++) {
|
|||||||
}
|
}
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
|
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
@ -267,8 +272,20 @@ if ($resql) {
|
|||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print '<td align="left">' . $row[1] . '</td>';
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("Unknown");
|
||||||
|
}
|
||||||
|
else print length_accountg($row[0]);
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="left">';
|
||||||
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||||
|
}
|
||||||
|
else print $row[1];
|
||||||
|
print '</td>';
|
||||||
for($i = 2; $i <= 12; $i ++) {
|
for($i = 2; $i <= 12; $i ++) {
|
||||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||||
}
|
}
|
||||||
@ -281,7 +298,7 @@ if ($resql) {
|
|||||||
print $db->lasterror(); // Show last sql error
|
print $db->lasterror(); // Show last sql error
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -293,6 +310,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||||
|
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
@ -333,6 +351,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
print $db->lasterror(); // Show last sql error
|
print $db->lasterror(); // Show last sql error
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,8 @@ require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
@ -60,6 +62,10 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
|||||||
$search_amount = GETPOST('search_amount', 'alpha');
|
$search_amount = GETPOST('search_amount', 'alpha');
|
||||||
$search_account = GETPOST('search_account', 'alpha');
|
$search_account = GETPOST('search_account', 'alpha');
|
||||||
$search_vat = GETPOST('search_vat', 'alpha');
|
$search_vat = GETPOST('search_vat', 'alpha');
|
||||||
|
$search_day=GETPOST("search_day","int");
|
||||||
|
$search_month=GETPOST("search_month","int");
|
||||||
|
$search_year=GETPOST("search_year","int");
|
||||||
|
|
||||||
$btn_ventil = GETPOST('ventil', 'alpha');
|
$btn_ventil = GETPOST('ventil', 'alpha');
|
||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
@ -96,8 +102,8 @@ $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUN
|
|||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||||
@ -110,6 +116,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
$search_account = '';
|
$search_account = '';
|
||||||
$search_vat = '';
|
$search_vat = '';
|
||||||
|
$search_month = '';
|
||||||
|
$search_year = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mass actions
|
// Mass actions
|
||||||
@ -176,6 +184,7 @@ if ($massaction == 'ventil') {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
|
|
||||||
llxHeader('', $langs->trans("SuppliersVentilation"));
|
llxHeader('', $langs->trans("SuppliersVentilation"));
|
||||||
|
|
||||||
@ -218,6 +227,19 @@ if (strlen(trim($search_account))) {
|
|||||||
if (strlen(trim($search_vat))) {
|
if (strlen(trim($search_vat))) {
|
||||||
$sql .= natural_search("l.tva_tx",$search_vat,1);
|
$sql .= natural_search("l.tva_tx",$search_vat,1);
|
||||||
}
|
}
|
||||||
|
if ($search_month > 0)
|
||||||
|
{
|
||||||
|
if ($search_year > 0 && empty($search_day))
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
|
||||||
|
else if ($search_year > 0 && ! empty($search_day))
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
|
||||||
|
else
|
||||||
|
$sql.= " AND date_format(f.datef, '%m') = '".$db->escape($search_month)."'";
|
||||||
|
}
|
||||||
|
else if ($search_year > 0)
|
||||||
|
{
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||||
|
}
|
||||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||||
|
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
@ -243,6 +265,15 @@ if ($result) {
|
|||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
|
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
|
||||||
|
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||||
|
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||||
|
if ($search_year) $param.='&search_year='.urlencode($search_year);
|
||||||
|
if ($search_invoice) $param.='&search_invoice='.urlencode($search_invoice);
|
||||||
|
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
||||||
|
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
||||||
|
if ($search_amount) $param.='&search_amount='.urlencode($search_amount);
|
||||||
|
if ($search_vat) $param.='&search_vat='.urlencode($search_vat);
|
||||||
|
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
'ventil'=>$langs->trans("Ventilate")
|
'ventil'=>$langs->trans("Ventilate")
|
||||||
@ -279,7 +310,11 @@ if ($result) {
|
|||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre center">';
|
||||||
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||||
|
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||||
|
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||||
|
print '</td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
||||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
|
|||||||
@ -240,9 +240,9 @@ $constantes=array(
|
|||||||
print load_fiche_titre($langs->trans("MembersCards"),'','');
|
print load_fiche_titre($langs->trans("MembersCards"),'','');
|
||||||
|
|
||||||
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||||
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
|
$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
|
||||||
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
|
$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
|
||||||
$helptext.='%YEAR%, %MONTH%, %DAY%';
|
$helptext.='__YEAR__, __MONTH__, __DAY__';
|
||||||
|
|
||||||
form_constantes($constantes, 0, $helptext);
|
form_constantes($constantes, 0, $helptext);
|
||||||
|
|
||||||
@ -257,43 +257,9 @@ $constantes=array('ADHERENT_ETIQUETTE_TYPE','ADHERENT_ETIQUETTE_TEXT');
|
|||||||
print load_fiche_titre($langs->trans("MembersTickets"),'','');
|
print load_fiche_titre($langs->trans("MembersTickets"),'','');
|
||||||
|
|
||||||
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||||
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
|
$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
|
||||||
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
|
$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
|
||||||
$helptext.='%YEAR%, %MONTH%, %DAY%';
|
$helptext.='__YEAR__, __MONTH__, __DAY__';
|
||||||
|
|
||||||
form_constantes($constantes, 0, $helptext);
|
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Editing global variables not related to a specific theme
|
|
||||||
*/
|
|
||||||
$constantes=array(
|
|
||||||
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT',
|
|
||||||
'ADHERENT_AUTOREGISTER_NOTIF_MAIL',
|
|
||||||
'ADHERENT_AUTOREGISTER_MAIL_SUBJECT',
|
|
||||||
'ADHERENT_AUTOREGISTER_MAIL',
|
|
||||||
'ADHERENT_MAIL_VALID_SUBJECT',
|
|
||||||
'ADHERENT_MAIL_VALID',
|
|
||||||
'ADHERENT_MAIL_COTIS_SUBJECT',
|
|
||||||
'ADHERENT_MAIL_COTIS',
|
|
||||||
'ADHERENT_MAIL_RESIL_SUBJECT',
|
|
||||||
'ADHERENT_MAIL_RESIL',
|
|
||||||
'ADHERENT_MAIL_FROM',
|
|
||||||
);
|
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("Other"),'','');
|
|
||||||
|
|
||||||
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
|
||||||
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
|
|
||||||
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
|
|
||||||
$helptext.='%YEAR%, %MONTH%, %DAY%';
|
|
||||||
|
|
||||||
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
|
||||||
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
|
|
||||||
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
|
|
||||||
//$helptext.='%YEAR%, %MONTH%, %DAY%'; // Not supported
|
|
||||||
|
|
||||||
form_constantes($constantes, 0, $helptext);
|
form_constantes($constantes, 0, $helptext);
|
||||||
|
|
||||||
|
|||||||
190
htdocs/adherents/admin/adherent_emails.php
Normal file
190
htdocs/adherents/admin/adherent_emails.php
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
|
||||||
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/adherents/admin/adherent.php
|
||||||
|
* \ingroup member
|
||||||
|
* \brief Page to setup the module Foundation
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
|
||||||
|
|
||||||
|
$langs->load("admin");
|
||||||
|
$langs->load("members");
|
||||||
|
|
||||||
|
if (! $user->admin) accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
|
$type=array('yesno','texte','chaine');
|
||||||
|
|
||||||
|
$action = GETPOST('action','alpha');
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
//
|
||||||
|
if ($action == 'updateall')
|
||||||
|
{
|
||||||
|
$db->begin();
|
||||||
|
$res1=$res2=$res3=$res4=$res5=$res6=0;
|
||||||
|
$res1=dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
$res2=dolibarr_set_const($db, 'ADHERENT_MAIL_REQUIRED', GETPOST('ADHERENT_MAIL_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
$res3=dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
$res4=dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
// Use vat for invoice creation
|
||||||
|
if ($conf->facture->enabled)
|
||||||
|
{
|
||||||
|
$res4=dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
$res5=dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
|
||||||
|
{
|
||||||
|
$res6=dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0)
|
||||||
|
{
|
||||||
|
setEventMessages('ErrorFailedToSaveDate', null, 'errors');
|
||||||
|
$db->rollback();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action mise a jour ou ajout d'une constante
|
||||||
|
if ($action == 'update' || $action == 'add')
|
||||||
|
{
|
||||||
|
$constname=GETPOST('constname','alpha');
|
||||||
|
$constvalue=(GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue'));
|
||||||
|
|
||||||
|
if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE' || $constname=='ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) $constvalue='';
|
||||||
|
if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
|
||||||
|
{
|
||||||
|
if ($constvalue) $constvalue=0;
|
||||||
|
else $constvalue=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$consttype=GETPOST('consttype','alpha');
|
||||||
|
$constnote=GETPOST('constnote');
|
||||||
|
$res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
|
||||||
|
|
||||||
|
if (! $res > 0) $error++;
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action activation d'un sous module du module adherent
|
||||||
|
if ($action == 'set')
|
||||||
|
{
|
||||||
|
$result=dolibarr_set_const($db, GETPOST('name','alpha'),GETPOST('value'),'',0,'',$conf->entity);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
print $db->error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action desactivation d'un sous module du module adherent
|
||||||
|
if ($action == 'unset')
|
||||||
|
{
|
||||||
|
$result=dolibarr_del_const($db,GETPOST('name','alpha'),$conf->entity);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
print $db->error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
|
$help_url='EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
|
||||||
|
|
||||||
|
llxHeader('',$langs->trans("MembersSetup"),$help_url);
|
||||||
|
|
||||||
|
|
||||||
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
|
print load_fiche_titre($langs->trans("MembersSetup"),$linkback,'title_setup');
|
||||||
|
|
||||||
|
|
||||||
|
$head = member_admin_prepare_head();
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'emails', $langs->trans("Members"), -1, 'user');
|
||||||
|
|
||||||
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="action" value="updateall">';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Editing global variables not related to a specific theme
|
||||||
|
*/
|
||||||
|
$constantes=array(
|
||||||
|
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT',
|
||||||
|
'ADHERENT_AUTOREGISTER_NOTIF_MAIL',
|
||||||
|
'ADHERENT_AUTOREGISTER_MAIL_SUBJECT',
|
||||||
|
'ADHERENT_AUTOREGISTER_MAIL',
|
||||||
|
'ADHERENT_MAIL_VALID_SUBJECT',
|
||||||
|
'ADHERENT_MAIL_VALID',
|
||||||
|
'ADHERENT_MAIL_COTIS_SUBJECT',
|
||||||
|
'ADHERENT_MAIL_COTIS',
|
||||||
|
'ADHERENT_MAIL_RESIL_SUBJECT',
|
||||||
|
'ADHERENT_MAIL_RESIL',
|
||||||
|
'ADHERENT_MAIL_FROM',
|
||||||
|
);
|
||||||
|
|
||||||
|
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||||
|
$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
|
||||||
|
$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
|
||||||
|
$helptext.='__YEAR__, __MONTH__, __DAY__';
|
||||||
|
|
||||||
|
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||||
|
$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
|
||||||
|
$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
|
||||||
|
//$helptext.='__YEAR__, __MONTH__, __DAY__'; // Not supported
|
||||||
|
|
||||||
|
form_constantes($constantes, 0, $helptext);
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
@ -43,6 +43,12 @@ if (! $user->admin) accessforbidden();
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if ($action == 'setMEMBER_ENABLE_PUBLIC')
|
||||||
|
{
|
||||||
|
if (GETPOST('value')) dolibarr_set_const($db, 'MEMBER_ENABLE_PUBLIC', 1, 'chaine', 0, '', $conf->entity);
|
||||||
|
else dolibarr_set_const($db, 'MEMBER_ENABLE_PUBLIC', 0, 'chaine', 0, '', $conf->entity);
|
||||||
|
}
|
||||||
|
|
||||||
if ($action == 'update')
|
if ($action == 'update')
|
||||||
{
|
{
|
||||||
$public=GETPOST('MEMBER_ENABLE_PUBLIC');
|
$public=GETPOST('MEMBER_ENABLE_PUBLIC');
|
||||||
@ -94,7 +100,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
|||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
|
||||||
dol_fiche_head($head, 'public', $langs->trans("Members"), -1, 'user');
|
dol_fiche_head($head, 'website', $langs->trans("Members"), -1, 'user');
|
||||||
|
|
||||||
if ($conf->use_javascript_ajax)
|
if ($conf->use_javascript_ajax)
|
||||||
{
|
{
|
||||||
@ -135,6 +141,31 @@ if ($conf->use_javascript_ajax)
|
|||||||
print $langs->trans("BlankSubscriptionFormDesc").'<br><br>';
|
print $langs->trans("BlankSubscriptionFormDesc").'<br><br>';
|
||||||
|
|
||||||
|
|
||||||
|
$enabledisablehtml = $langs->trans("EnablePublicSubscriptionForm").' ';
|
||||||
|
if (empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
||||||
|
{
|
||||||
|
// Button off, click to enable
|
||||||
|
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=1'.$param.'">';
|
||||||
|
$enabledisablehtml.=img_picto($langs->trans("Disabled"),'switch_off');
|
||||||
|
$enabledisablehtml.='</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Button on, click to disable
|
||||||
|
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=0'.$param.'">';
|
||||||
|
$enabledisablehtml.=img_picto($langs->trans("Activated"),'switch_on');
|
||||||
|
$enabledisablehtml.='</a>';
|
||||||
|
}
|
||||||
|
print $enabledisablehtml;
|
||||||
|
print '<input type="hidden" id="MEMBER_ENABLE_PUBLIC" name="MEMBER_ENABLE_PUBLIC" value="'.(empty($conf->global->MEMBER_ENABLE_PUBLIC)?0:1).'">';
|
||||||
|
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
if (! empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
||||||
|
{
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -142,13 +173,6 @@ print '<td>'.$langs->trans("Parameter").'</td>';
|
|||||||
print '<td align="right">'.$langs->trans("Value").'</td>';
|
print '<td align="right">'.$langs->trans("Value").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Allow public form
|
|
||||||
print '<tr class="oddeven"><td>';
|
|
||||||
print $langs->trans("EnablePublicSubscriptionForm");
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $form->selectyesno("MEMBER_ENABLE_PUBLIC",(! empty($conf->global->MEMBER_ENABLE_PUBLIC)?$conf->global->MEMBER_ENABLE_PUBLIC:0),1);
|
|
||||||
print "</td></tr>\n";
|
|
||||||
|
|
||||||
// Force Type
|
// Force Type
|
||||||
$adht = new AdherentType($db);
|
$adht = new AdherentType($db);
|
||||||
print '<tr class="oddeven drag" id="trforcetype"><td>';
|
print '<tr class="oddeven drag" id="trforcetype"><td>';
|
||||||
@ -174,42 +198,41 @@ print '</td><td align="right">';
|
|||||||
print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT",(! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)?$conf->global->MEMBER_NEWFORM_EDITAMOUNT:0),1);
|
print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT",(! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)?$conf->global->MEMBER_NEWFORM_EDITAMOUNT:0),1);
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|
||||||
if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled))
|
|
||||||
{
|
|
||||||
// Jump to an online payment page
|
// Jump to an online payment page
|
||||||
print '<tr class="oddeven" id="trpayment"><td>';
|
print '<tr class="oddeven" id="trpayment"><td>';
|
||||||
print $langs->trans("MEMBER_NEWFORM_PAYONLINE");
|
print $langs->trans("MEMBER_NEWFORM_PAYONLINE");
|
||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
$listofval=array();
|
$listofval=array();
|
||||||
|
$listofval['-1']=$langs->trans('No');
|
||||||
|
$listofval['all']=$langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')';
|
||||||
if (! empty($conf->paybox->enabled)) $listofval['paybox']='Paybox';
|
if (! empty($conf->paybox->enabled)) $listofval['paybox']='Paybox';
|
||||||
if (! empty($conf->paypal->enabled)) $listofval['paypal']='PayPal';
|
if (! empty($conf->paypal->enabled)) $listofval['paypal']='PayPal';
|
||||||
if (! empty($conf->stripe->enabled)) $listofval['stripe']='Stripe';
|
if (! empty($conf->stripe->enabled)) $listofval['stripe']='Stripe';
|
||||||
print $form->selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,(! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''),1);
|
print $form->selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,(! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''),0);
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled))
|
|
||||||
{
|
|
||||||
// Jump to an online payment page
|
// Jump to an online payment page
|
||||||
print '<tr class="oddeven" id="tremail"><td>';
|
print '<tr class="oddeven" id="tremail"><td>';
|
||||||
print $langs->trans("MEMBER_PAYONLINE_SENDEMAIL");
|
print $langs->trans("MEMBER_PAYONLINE_SENDEMAIL");
|
||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
print '<input type="text" id="MEMBER_PAYONLINE_SENDEMAIL" name="MEMBER_PAYONLINE_SENDEMAIL" size="24" value="'.(! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL)?$conf->global->MEMBER_PAYONLINE_SENDEMAIL:'').'">';
|
print '<input type="text" id="MEMBER_PAYONLINE_SENDEMAIL" name="MEMBER_PAYONLINE_SENDEMAIL" size="24" value="'.(! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL)?$conf->global->MEMBER_PAYONLINE_SENDEMAIL:'').'">';
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
}
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
|
|
||||||
print '<center>';
|
print '<center>';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
print '</center>';
|
print '</center>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
|
||||||
|
if (! empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
||||||
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
//print $langs->trans('FollowingLinksArePublic').'<br>';
|
//print $langs->trans('FollowingLinksArePublic').'<br>';
|
||||||
print img_picto('','object_globe.png').' '.$langs->trans('BlankSubscriptionForm').':<br>';
|
print img_picto('','object_globe.png').' '.$langs->trans('BlankSubscriptionForm').':<br>';
|
||||||
@ -219,15 +242,8 @@ if ($conf->multicompany->enabled) {
|
|||||||
$entity_qr='';
|
$entity_qr='';
|
||||||
}
|
}
|
||||||
print '<a target="_blank" href="'.DOL_URL_ROOT.'/public/members/new.php'.$entity_qr.'">'.DOL_MAIN_URL_ROOT.'/public/members/new.php'.$entity_qr.'</a>';
|
print '<a target="_blank" href="'.DOL_URL_ROOT.'/public/members/new.php'.$entity_qr.'">'.DOL_MAIN_URL_ROOT.'/public/members/new.php'.$entity_qr.'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
print '<table class="border" cellspacing="0" cellpadding="3">';
|
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Description").'</td><td>'.$langs->trans("URL").'</td></tr>';
|
|
||||||
print '<tr><td>'.$langs->trans("BlankSubscriptionForm").'</td><td>'..'</td></tr>';
|
|
||||||
print '<tr><td>'.$langs->trans("PublicMemberList").'</td><td>'.img_picto('','object_globe.png').' '.'<a target="_blank" href="'.DOL_URL_ROOT.'/public/members/public_list.php'.'">'.DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.'</a></td></tr>';
|
|
||||||
print '<tr><td>'.$langs->trans("PublicMemberCard").'</td><td>'.img_picto('','object_globe.png').' '.DOL_MAIN_URL_ROOT.'/public/members/public_card.php?id=xxx'.'</td></tr>';
|
|
||||||
print '</table>';
|
|
||||||
*/
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
@ -38,6 +38,28 @@ $langs->load("members");
|
|||||||
|
|
||||||
$id = GETPOST('id','int')?GETPOST('id','int'):GETPOST('rowid','int');
|
$id = GETPOST('id','int')?GETPOST('id','int'):GETPOST('rowid','int');
|
||||||
|
|
||||||
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
|
$page = GETPOST("page",'int');
|
||||||
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
|
$offset = $limit * $page;
|
||||||
|
$pageprev = $page - 1;
|
||||||
|
$pagenext = $page + 1;
|
||||||
|
if (! $sortfield) $sortfield='a.datep,a.id';
|
||||||
|
if (! $sortorder) $sortorder='DESC';
|
||||||
|
|
||||||
|
if (GETPOST('actioncode','array'))
|
||||||
|
{
|
||||||
|
$actioncode=GETPOST('actioncode','array',3);
|
||||||
|
if (! count($actioncode)) $actioncode='0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
|
||||||
|
}
|
||||||
|
$search_agenda_label=GETPOST('search_agenda_label');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$result=restrictedArea($user,'adherent',$id);
|
$result=restrictedArea($user,'adherent',$id);
|
||||||
|
|
||||||
@ -56,7 +78,26 @@ if ($result > 0)
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// None
|
$parameters=array('id'=>$id, 'objcanvas'=>$objcanvas);
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
// Cancel
|
||||||
|
if (GETPOST('cancel','alpha') && ! empty($backtopage))
|
||||||
|
{
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Purge search criteria
|
||||||
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||||
|
{
|
||||||
|
$actioncode='';
|
||||||
|
$search_agenda_label='';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -87,7 +128,7 @@ if ($object->id > 0)
|
|||||||
|
|
||||||
dol_fiche_head($head, 'agenda', $langs->trans("Member"), -1, 'user');
|
dol_fiche_head($head, 'agenda', $langs->trans("Member"), -1, 'user');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'rowid', $linkback);
|
dol_banner_tab($object, 'rowid', $linkback);
|
||||||
|
|
||||||
@ -103,25 +144,33 @@ if ($object->id > 0)
|
|||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
/*
|
//print '<div class="tabsAction">';
|
||||||
* Barre d'action
|
//print '</div>';
|
||||||
*/
|
|
||||||
|
|
||||||
print '<div class="tabsAction">';
|
|
||||||
|
|
||||||
|
$morehtmlcenter = '';
|
||||||
if (! empty($conf->agenda->enabled))
|
if (! empty($conf->agenda->enabled))
|
||||||
{
|
{
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id.'">'.$langs->trans("AddAction").'</a></div>';
|
$morehtmlcenter.='<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id.'">'.$langs->trans("AddAction").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
|
||||||
|
{
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
$out='';
|
$param='&id='.$id;
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("ActionsOnMember"),$out,'');
|
print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $morehtmlcenter, 0, -1, '', '', '', '', 0, 1, 1);
|
||||||
|
|
||||||
// List of actions
|
// List of all actions
|
||||||
show_actions_done($conf,$langs,$db,$object,null,0,'','');
|
$filters=array();
|
||||||
|
$filters['search_agenda_label']=$search_agenda_label;
|
||||||
|
|
||||||
|
// TODO Replace this with same code than into listactions.php
|
||||||
|
show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -76,6 +76,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
|
|||||||
*/
|
*/
|
||||||
function assign_values(&$action, $id)
|
function assign_values(&$action, $id)
|
||||||
{
|
{
|
||||||
|
global $limit, $offset, $sortfield, $sortorder;
|
||||||
global $conf, $db, $langs, $user;
|
global $conf, $db, $langs, $user;
|
||||||
global $form;
|
global $form;
|
||||||
|
|
||||||
@ -114,14 +115,14 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
|
|||||||
|
|
||||||
if ($action == 'list')
|
if ($action == 'list')
|
||||||
{
|
{
|
||||||
$this->LoadListDatas($GLOBALS['limit'], $GLOBALS['offset'], $GLOBALS['sortfield'], $GLOBALS['sortorder']);
|
$this->LoadListDatas($limit, $offset, $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch datas list
|
* Fetch datas list and save into ->list_datas
|
||||||
*
|
*
|
||||||
* @param int $limit Limit number of responses
|
* @param int $limit Limit number of responses
|
||||||
* @param int $offset Offset for first response
|
* @param int $offset Offset for first response
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2012-2016 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2012-2016 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
@ -121,14 +121,22 @@ $hookmanager->initHooks(array('membercard','globalcard'));
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($cancel) $action='';
|
$parameters=array('id'=>$id, 'rowid'=>$id, 'objcanvas'=>$objcanvas, 'confirm'=>$confirm);
|
||||||
|
|
||||||
$parameters=array('id'=>$id, 'rowid'=>$id, 'objcanvas'=>$objcanvas);
|
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
|
if ($cancel)
|
||||||
|
{
|
||||||
|
if (! empty($backtopage))
|
||||||
|
{
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
|
||||||
if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer))
|
if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer))
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
@ -215,7 +223,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
// User creation
|
// User creation
|
||||||
$company = new Societe($db);
|
$company = new Societe($db);
|
||||||
$result=$company->create_from_member($object,GETPOST('companyname'));
|
$result=$company->create_from_member($object, GETPOST('companyname', 'alpha'), GETPOST('companyalias', 'alpha'));
|
||||||
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
@ -230,6 +238,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if ($action == 'confirm_sendinfo' && $confirm == 'yes')
|
if ($action == 'confirm_sendinfo' && $confirm == 'yes')
|
||||||
{
|
{
|
||||||
if ($object->email)
|
if ($object->email)
|
||||||
@ -242,7 +251,7 @@ if (empty($reshook))
|
|||||||
$langs->load("mails");
|
$langs->load("mails");
|
||||||
setEventMessages($langs->trans("MailSuccessfulySent", $from, $object->email), null, 'mesgs');
|
setEventMessages($langs->trans("MailSuccessfulySent", $from, $object->email), null, 'mesgs');
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if ($action == 'update' && ! $cancel && $user->rights->adherent->creer)
|
if ($action == 'update' && ! $cancel && $user->rights->adherent->creer)
|
||||||
{
|
{
|
||||||
@ -715,10 +724,21 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Actions when printing a doc from card
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||||
|
|
||||||
// Actions to build doc
|
// Actions to build doc
|
||||||
$upload_dir = $conf->adherent->dir_output;
|
$upload_dir = $conf->adherent->dir_output;
|
||||||
$permissioncreate=$user->rights->adherent->creer;
|
$permissioncreate=$user->rights->adherent->creer;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||||
|
|
||||||
|
// Actions to send emails
|
||||||
|
$trigger_name='MEMBER_SENTBYMAIL';
|
||||||
|
$paramname='id';
|
||||||
|
$mode='emailfrommember';
|
||||||
|
$trackid='mem'.$object->id;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -813,6 +833,7 @@ else
|
|||||||
print '<form name="formsoc" action="'.$_SERVER["PHP_SELF"].'" method="post" enctype="multipart/form-data">';
|
print '<form name="formsoc" action="'.$_SERVER["PHP_SELF"].'" method="post" enctype="multipart/form-data">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
|
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
|
||||||
|
|
||||||
dol_fiche_head('');
|
dol_fiche_head('');
|
||||||
|
|
||||||
@ -822,7 +843,7 @@ else
|
|||||||
// Login
|
// Login
|
||||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||||
{
|
{
|
||||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="member_login" class="maxwidth200" value="'.(isset($_POST["member_login"])?GETPOST("member_login", 'alpha', 2):$object->login).'"></td></tr>';
|
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="member_login" class="minwidth300" maxlength="50" value="'.(isset($_POST["member_login"])?GETPOST("member_login", 'alpha', 2):$object->login).'"></td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Password
|
// Password
|
||||||
@ -831,7 +852,7 @@ else
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||||
$generated_password=getRandomPassword(false);
|
$generated_password=getRandomPassword(false);
|
||||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Password").'</span></td><td>';
|
print '<tr><td><span class="fieldrequired">'.$langs->trans("Password").'</span></td><td>';
|
||||||
print '<input size="30" maxsize="32" type="text" name="password" value="'.$generated_password.'">';
|
print '<input type="text" class="minwidth300" maxlength="50" name="password" value="'.$generated_password.'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -854,7 +875,7 @@ else
|
|||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
// Company
|
// Company
|
||||||
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40" value="'.(GETPOST('societe','alpha')?GETPOST('societe','alpha'):$object->societe).'"></td></tr>';
|
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(GETPOST('societe','alpha')?GETPOST('societe','alpha'):$object->societe).'"></td></tr>';
|
||||||
|
|
||||||
// Civility
|
// Civility
|
||||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
|
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
|
||||||
@ -862,15 +883,15 @@ else
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Lastname
|
// Lastname
|
||||||
print '<tr><td id="tdlastname">'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" value="'.(GETPOST('lastname','alpha')?GETPOST('lastname','alpha'):$object->lastname).'" size="40"></td>';
|
print '<tr><td id="tdlastname">'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="minwidth300" maxlength="50" value="'.(GETPOST('lastname','alpha')?GETPOST('lastname','alpha'):$object->lastname).'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Firstname
|
// Firstname
|
||||||
print '<tr><td id="tdfirstname">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" size="40" value="'.(GETPOST('firstname','alpha')?GETPOST('firstname','alpha'):$object->firstname).'"></td>';
|
print '<tr><td id="tdfirstname">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="minwidth300" maxlength="50" value="'.(GETPOST('firstname','alpha')?GETPOST('firstname','alpha'):$object->firstname).'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// EMail
|
// EMail
|
||||||
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED?'<span class="fieldrequired">':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'</span>':'').'</td><td><input type="text" name="member_email" size="40" value="'.(GETPOST('member_email','alpha')?GETPOST('member_email','alpha'):$object->email).'"></td></tr>';
|
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED?'<span class="fieldrequired">':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'</span>':'').'</td><td><input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOST('member_email','alpha')?GETPOST('member_email','alpha'):$object->email).'"></td></tr>';
|
||||||
|
|
||||||
// Address
|
// Address
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>';
|
||||||
@ -956,8 +977,15 @@ else
|
|||||||
|
|
||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
print '<input type="submit" name="button" class="button" value="'.$langs->trans("AddMember").'">';
|
print '<input type="submit" name="button" class="button" value="'.$langs->trans("AddMember").'">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'" onclick="history.go(-1)" />';
|
if (! empty($backtopage))
|
||||||
|
{
|
||||||
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
||||||
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
@ -1053,13 +1081,13 @@ else
|
|||||||
// Login
|
// Login
|
||||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||||
{
|
{
|
||||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="login" class="maxwidth200" value="'.(isset($_POST["login"])?GETPOST("login",'alpha',2):$object->login).'"></td></tr>';
|
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="login" class="minwidth300" maxlength="50" value="'.(isset($_POST["login"])?GETPOST("login",'alpha',2):$object->login).'"></td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Password
|
// Password
|
||||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||||
{
|
{
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Password").'</td><td><input type="password" name="pass" class="maxwdith200" value="'.(isset($_POST["pass"])?GETPOST("pass",'',2):$object->pass).'"></td></tr>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Password").'</td><td><input type="password" name="pass" class="minwidth300" maxlength="50" value="'.(isset($_POST["pass"])?GETPOST("pass",'',2):$object->pass).'"></td></tr>';
|
||||||
}
|
}
|
||||||
// Morphy
|
// Morphy
|
||||||
$morphys["phy"] = $langs->trans("Physical");
|
$morphys["phy"] = $langs->trans("Physical");
|
||||||
@ -1082,7 +1110,7 @@ else
|
|||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Company
|
// Company
|
||||||
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth100" value="'.(isset($_POST["societe"])?GETPOST("societe",'',2):$object->societe).'"></td></tr>';
|
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(isset($_POST["societe"])?GETPOST("societe",'',2):$object->societe).'"></td></tr>';
|
||||||
|
|
||||||
// Civility
|
// Civility
|
||||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
|
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
|
||||||
@ -1091,11 +1119,11 @@ else
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Lastname
|
// Lastname
|
||||||
print '<tr><td id="tdlastname">'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="minwidth100" value="'.(isset($_POST["lastname"])?GETPOST("lastname",'',2):$object->lastname).'"></td>';
|
print '<tr><td id="tdlastname">'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="minwidth300" maxlength="50" value="'.(isset($_POST["lastname"])?GETPOST("lastname",'',2):$object->lastname).'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Firstname
|
// Firstname
|
||||||
print '<tr><td id="tdfirstname">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="minwidth100" value="'.(isset($_POST["firstname"])?GETPOST("firstname",'',3):$object->firstname).'"></td>';
|
print '<tr><td id="tdfirstname">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="minwidth300" maxlength="50" value="'.(isset($_POST["firstname"])?GETPOST("firstname",'',3):$object->firstname).'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Photo
|
// Photo
|
||||||
@ -1114,7 +1142,7 @@ else
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// EMail
|
// EMail
|
||||||
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED?'<span class="fieldrequired">':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'</span>':'').'</td><td><input type="text" name="member_email" size="40" value="'.(isset($_POST["member_email"])?GETPOST("member_email",'',2):$object->email).'"></td></tr>';
|
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED?'<span class="fieldrequired">':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'</span>':'').'</td><td><input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(isset($_POST["member_email"])?GETPOST("member_email",'',2):$object->email).'"></td></tr>';
|
||||||
|
|
||||||
// Address
|
// Address
|
||||||
print '<tr><td>'.$langs->trans("Address").'</td><td>';
|
print '<tr><td>'.$langs->trans("Address").'</td><td>';
|
||||||
@ -1225,7 +1253,7 @@ else
|
|||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'" onclick="history.go(-1)" />';
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
@ -1291,18 +1319,25 @@ else
|
|||||||
// Confirm create third party
|
// Confirm create third party
|
||||||
if ($action == 'create_thirdparty')
|
if ($action == 'create_thirdparty')
|
||||||
{
|
{
|
||||||
$name = $object->getFullName($langs);
|
$companyalias='';
|
||||||
if (! empty($name))
|
$fullname = $object->getFullName($langs);
|
||||||
|
|
||||||
|
if ($object->morphy == 'mor')
|
||||||
{
|
{
|
||||||
if ($object->societe) $name.=' ('.$object->societe.')';
|
$companyname=$object->societe;
|
||||||
|
if (! empty($fullname)) $companyalias=$fullname;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$name=$object->societe;
|
$companyname=$fullname;
|
||||||
|
if (! empty($object->societe)) $companyalias=$object->societe;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a form array
|
// Create a form array
|
||||||
$formquestion=array( array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $name));
|
$formquestion=array(
|
||||||
|
array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $companyname, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"'),
|
||||||
|
array('label' => $langs->trans("AliasNames"), 'type' => 'text', 'name' => 'companyalias', 'value' => $companyalias, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"')
|
||||||
|
);
|
||||||
|
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1);
|
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1);
|
||||||
}
|
}
|
||||||
@ -1319,8 +1354,8 @@ else
|
|||||||
$texttosend=$object->makeSubstitution($adht->getMailOnValid());
|
$texttosend=$object->makeSubstitution($adht->getMailOnValid());
|
||||||
|
|
||||||
$tmp=$langs->trans("SendAnEMailToMember");
|
$tmp=$langs->trans("SendAnEMailToMember");
|
||||||
$tmp.='<br>('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
|
$tmp.='<br>'.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
|
||||||
$tmp.=$langs->trans("MailRecipient").': <b>'.$object->email.'</b>)';
|
$tmp.='<br>'.$langs->trans("MailRecipient").': <b>'.$object->email.'</b>';
|
||||||
$helpcontent='';
|
$helpcontent='';
|
||||||
$helpcontent.='<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
|
$helpcontent.='<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
|
||||||
$helpcontent.='<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
|
$helpcontent.='<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
|
||||||
@ -1344,10 +1379,10 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Confirm send card by mail
|
// Confirm send card by mail
|
||||||
if ($action == 'sendinfo')
|
/*if ($action == 'sendinfo')
|
||||||
{
|
{
|
||||||
print $form->formconfirm("card.php?rowid=".$id,$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail",$object->email),"confirm_sendinfo",'',0,1);
|
print $form->formconfirm("card.php?rowid=".$id,$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail",$object->email),"confirm_sendinfo",'',0,1);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// Confirm terminate
|
// Confirm terminate
|
||||||
if ($action == 'resign')
|
if ($action == 'resign')
|
||||||
@ -1403,7 +1438,7 @@ else
|
|||||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++;
|
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++;
|
||||||
if (! empty($conf->societe->enabled)) $rowspan++;
|
if (! empty($conf->societe->enabled)) $rowspan++;
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'rowid', $linkback);
|
dol_banner_tab($object, 'rowid', $linkback);
|
||||||
|
|
||||||
@ -1590,6 +1625,31 @@ else
|
|||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
if ($action != 'valid' && $action != 'editlogin' && $action != 'editthirdparty')
|
if ($action != 'valid' && $action != 'editlogin' && $action != 'editthirdparty')
|
||||||
{
|
{
|
||||||
|
// Send
|
||||||
|
if ($object->statut == 1) {
|
||||||
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendByMail') . '</a></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send card by email
|
||||||
|
// TODO Remove this to replace with a template
|
||||||
|
/*
|
||||||
|
if ($user->rights->adherent->creer)
|
||||||
|
{
|
||||||
|
if ($object->statut >= 1)
|
||||||
|
{
|
||||||
|
if ($object->email) print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$object->id.'&action=sendinfo">'.$langs->trans("SendCardByMail")."</a></div>\n";
|
||||||
|
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans("SendCardByMail")."</a></div>\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("SendCardByMail")."</font></div>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("SendCardByMail")."</font></div>";
|
||||||
|
}*/
|
||||||
|
|
||||||
// Modify
|
// Modify
|
||||||
if ($user->rights->adherent->creer)
|
if ($user->rights->adherent->creer)
|
||||||
{
|
{
|
||||||
@ -1626,24 +1686,6 @@ else
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send card by email
|
|
||||||
if ($user->rights->adherent->creer)
|
|
||||||
{
|
|
||||||
if ($object->statut >= 1)
|
|
||||||
{
|
|
||||||
if ($object->email) print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$object->id.'&action=sendinfo">'.$langs->trans("SendCardByMail")."</a></div>\n";
|
|
||||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans("SendCardByMail")."</a></div>\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("SendCardByMail")."</font></div>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("SendCardByMail")."</font></div>";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Terminate
|
// Terminate
|
||||||
if ($object->statut >= 1)
|
if ($object->statut >= 1)
|
||||||
{
|
{
|
||||||
@ -1720,7 +1762,13 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Select mail models is same action as presend
|
||||||
|
if (GETPOST('modelselected')) {
|
||||||
|
$action = 'presend';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action != 'presend')
|
||||||
|
{
|
||||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||||
print '<a name="builddoc"></a>'; // ancre
|
print '<a name="builddoc"></a>'; // ancre
|
||||||
|
|
||||||
@ -1743,24 +1791,42 @@ else
|
|||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
||||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||||
|
|
||||||
// Link for paypal payment
|
|
||||||
/*
|
|
||||||
if (! empty($conf->paypal->enabled) && $object->statut != 0) {
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';
|
|
||||||
print showPaypalPaymentUrl('invoice', $object->ref);
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Shon online payment link
|
||||||
|
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
|
||||||
|
|
||||||
|
if ($useonlinepayment)
|
||||||
|
{
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||||
|
print showOnlinePaymentUrl('membersubscription', $object->ref);
|
||||||
|
}
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
|
$MAX = 10;
|
||||||
|
|
||||||
|
$morehtmlright = '<a href="'.DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id.'">';
|
||||||
|
$morehtmlright.= $langs->trans("SeeAll");
|
||||||
|
$morehtmlright.= '</a>';
|
||||||
|
|
||||||
// List of actions on element
|
// List of actions on element
|
||||||
/* Already in tab Agenda/Events
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||||
$formactions = new FormActions($db);
|
$formactions = new FormActions($db);
|
||||||
$somethingshown = $formactions->showactions($object, 'member', $socid);
|
$somethingshown = $formactions->showactions($object, 'member', $socid, 1, 'listactions', $MAX, '', $morehtmlright);
|
||||||
*/
|
|
||||||
print '</div></div></div>';
|
|
||||||
|
|
||||||
|
print '</div></div></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Presend form
|
||||||
|
$modelmail='member';
|
||||||
|
$defaulttopic='SendMemberRef';
|
||||||
|
$diroutput = $conf->adherent->dir_output;
|
||||||
|
$trackid = 'mem'.$object->id;
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -46,6 +46,10 @@ $mesg='';
|
|||||||
|
|
||||||
$adherentstatic=new Adherent($db);
|
$adherentstatic=new Adherent($db);
|
||||||
|
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
// fetch optionals attributes and labels
|
||||||
|
$extralabels = $extrafields->fetch_name_optionals_label('adherent');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -65,9 +69,14 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
|
|||||||
$sql.= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,";
|
$sql.= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,";
|
||||||
$sql.= " t.libelle as type,";
|
$sql.= " t.libelle as type,";
|
||||||
$sql.= " c.code as country_code, c.label as country";
|
$sql.= " c.code as country_code, c.label as country";
|
||||||
|
// Add fields from extrafields
|
||||||
|
foreach ($extrafields->attribute_label as $key => $val)
|
||||||
|
$sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid";
|
||||||
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)";
|
||||||
$sql.= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
|
$sql.= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
|
||||||
|
$sql.= " AND d.entity IN (".getEntity('adherent').")";
|
||||||
if (is_numeric($foruserid)) $sql.=" AND d.rowid=".$foruserid;
|
if (is_numeric($foruserid)) $sql.=" AND d.rowid=".$foruserid;
|
||||||
if ($foruserlogin) $sql.=" AND d.login='".$db->escape($foruserlogin)."'";
|
if ($foruserlogin) $sql.=" AND d.login='".$db->escape($foruserlogin)."'";
|
||||||
$sql.= " ORDER BY d.rowid ASC";
|
$sql.= " ORDER BY d.rowid ASC";
|
||||||
@ -84,32 +93,50 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
|
|||||||
|
|
||||||
if ($objp->country == '-') $objp->country='';
|
if ($objp->country == '-') $objp->country='';
|
||||||
|
|
||||||
|
$adherentstatic->id=$objp->rowid;
|
||||||
$adherentstatic->lastname=$objp->lastname;
|
$adherentstatic->lastname=$objp->lastname;
|
||||||
$adherentstatic->firstname=$objp->firstname;
|
$adherentstatic->firstname=$objp->firstname;
|
||||||
|
|
||||||
|
// format extrafiled so they can be parsed in function complete_substitutions_array
|
||||||
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
|
{
|
||||||
|
$adherentstatic->array_options = array();
|
||||||
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
|
{
|
||||||
|
$tmpkey='options_'.$key;
|
||||||
|
if (!empty($objp->$tmpkey))
|
||||||
|
{
|
||||||
|
$adherentstatic->array_options[$tmpkey] = $objp->$tmpkey;
|
||||||
|
}
|
||||||
|
//if (!empty($objp->$key))
|
||||||
|
// $objp->array_options[$tmpkey] = $objp->$key;
|
||||||
|
//$objp->array_options[$tmpkey] = $extrafields->showOutputField($key, $objp->$tmpkey, '', 1); //$objp->$tmpkey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// List of values to scan for a replacement
|
// List of values to scan for a replacement
|
||||||
$substitutionarray = array (
|
$substitutionarray = array (
|
||||||
'%ID%'=>$objp->rowid,
|
'__ID__'=>$objp->rowid,
|
||||||
'%LOGIN%'=>$objp->login,
|
'__LOGIN__'=>$objp->login,
|
||||||
'%FIRSTNAME%'=>$objp->firstname,
|
'__FIRSTNAME__'=>$objp->firstname,
|
||||||
'%LASTNAME%'=>$objp->lastname,
|
'__LASTNAME__'=>$objp->lastname,
|
||||||
'%FULLNAME%'=>$adherentstatic->getFullName($langs),
|
'__FULLNAME__'=>$adherentstatic->getFullName($langs),
|
||||||
'%COMPANY%'=>$objp->company,
|
'__COMPANY__'=>$objp->company,
|
||||||
'%ADDRESS%'=>$objp->address,
|
'__ADDRESS__'=>$objp->address,
|
||||||
'%ZIP%'=>$objp->zip,
|
'__ZIP__'=>$objp->zip,
|
||||||
'%TOWN%'=>$objp->town,
|
'__TOWN__'=>$objp->town,
|
||||||
'%COUNTRY%'=>$objp->country,
|
'__COUNTRY__'=>$objp->country,
|
||||||
'%COUNTRY_CODE%'=>$objp->country_code,
|
'__COUNTRY_CODE__'=>$objp->country_code,
|
||||||
'%EMAIL%'=>$objp->email,
|
'__EMAIL__'=>$objp->email,
|
||||||
'%BIRTH%'=>dol_print_date($objp->birth,'day'),
|
'__BIRTH__'=>dol_print_date($objp->birth,'day'),
|
||||||
'%TYPE%'=>$objp->type,
|
'__TYPE__'=>$objp->type,
|
||||||
'%YEAR%'=>$year,
|
'__YEAR__'=>$year,
|
||||||
'%MONTH%'=>$month,
|
'__MONTH__'=>$month,
|
||||||
'%DAY%'=>$day,
|
'__DAY__'=>$day,
|
||||||
'%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT,
|
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
|
||||||
'%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/"
|
'__SERVER__'=>"http://".$_SERVER["SERVER_NAME"]."/"
|
||||||
);
|
);
|
||||||
complete_substitutions_array($substitutionarray, $langs);
|
complete_substitutions_array($substitutionarray, $langs, $adherentstatic);
|
||||||
|
|
||||||
// For business cards
|
// For business cards
|
||||||
if (empty($mode) || $mode=='card' || $mode=='cardlogin')
|
if (empty($mode) || $mode=='card' || $mode=='cardlogin')
|
||||||
@ -152,7 +179,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
|
|||||||
// For labels
|
// For labels
|
||||||
if ($mode == 'label')
|
if ($mode == 'label')
|
||||||
{
|
{
|
||||||
if (empty($conf->global->ADHERENT_ETIQUETTE_TEXT)) $conf->global->ADHERENT_ETIQUETTE_TEXT="%FULLNAME%\n%ADDRESS%\n%ZIP% %TOWN%\n%COUNTRY%";
|
if (empty($conf->global->ADHERENT_ETIQUETTE_TEXT)) $conf->global->ADHERENT_ETIQUETTE_TEXT="__FULLNAME__\n__ADDRESS__\n__ZIP__ __TOWN__\n__COUNTRY__";
|
||||||
$textleft=make_substitutions($conf->global->ADHERENT_ETIQUETTE_TEXT, $substitutionarray);
|
$textleft=make_substitutions($conf->global->ADHERENT_ETIQUETTE_TEXT, $substitutionarray);
|
||||||
$textheader='';
|
$textheader='';
|
||||||
$textfooter='';
|
$textfooter='';
|
||||||
|
|||||||
@ -199,6 +199,9 @@ class Adherent extends CommonObject
|
|||||||
$infos.= $langs->transnoentities("Town").": ".$this->town."\n";
|
$infos.= $langs->transnoentities("Town").": ".$this->town."\n";
|
||||||
$infos.= $langs->transnoentities("Country").": ".$this->country."\n";
|
$infos.= $langs->transnoentities("Country").": ".$this->country."\n";
|
||||||
$infos.= $langs->transnoentities("EMail").": ".$this->email."\n";
|
$infos.= $langs->transnoentities("EMail").": ".$this->email."\n";
|
||||||
|
$infos.= $langs->transnoentities("PhonePro").": ".$this->phone."\n";
|
||||||
|
$infos.= $langs->transnoentities("PhonePerso").": ".$this->phone_perso."\n";
|
||||||
|
$infos.= $langs->transnoentities("PhoneMobile").": ".$this->phone_mobile."\n";
|
||||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||||
{
|
{
|
||||||
$infos.= $langs->transnoentities("Login").": ".$this->login."\n";
|
$infos.= $langs->transnoentities("Login").": ".$this->login."\n";
|
||||||
@ -210,8 +213,6 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
// Substitutions
|
// Substitutions
|
||||||
$substitutionarray=array(
|
$substitutionarray=array(
|
||||||
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
|
|
||||||
'__ID__'=>$msgishtml?dol_htmlentitiesbr($this->id):$this->id,
|
|
||||||
'__CIVILITY__'=>$this->getCivilityLabel(),
|
'__CIVILITY__'=>$this->getCivilityLabel(),
|
||||||
'__FIRSTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname,
|
'__FIRSTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname,
|
||||||
'__LASTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->lastname):$this->lastname,
|
'__LASTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->lastname):$this->lastname,
|
||||||
@ -219,37 +220,16 @@ class Adherent extends CommonObject
|
|||||||
'__COMPANY__'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe,
|
'__COMPANY__'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe,
|
||||||
'__ADDRESS__'=>$msgishtml?dol_htmlentitiesbr($this->address):$this->address,
|
'__ADDRESS__'=>$msgishtml?dol_htmlentitiesbr($this->address):$this->address,
|
||||||
'__ZIP__'=>$msgishtml?dol_htmlentitiesbr($this->zip):$this->zip,
|
'__ZIP__'=>$msgishtml?dol_htmlentitiesbr($this->zip):$this->zip,
|
||||||
'__TOWN_'=>$msgishtml?dol_htmlentitiesbr($this->town):$this->town,
|
'__TOWN__'=>$msgishtml?dol_htmlentitiesbr($this->town):$this->town,
|
||||||
'__COUNTRY__'=>$msgishtml?dol_htmlentitiesbr($this->country):$this->country,
|
'__COUNTRY__'=>$msgishtml?dol_htmlentitiesbr($this->country):$this->country,
|
||||||
'__EMAIL__'=>$msgishtml?dol_htmlentitiesbr($this->email):$this->email,
|
'__EMAIL__'=>$msgishtml?dol_htmlentitiesbr($this->email):$this->email,
|
||||||
'__BIRTH__'=>$msgishtml?dol_htmlentitiesbr($birthday):$birthday,
|
'__BIRTH__'=>$msgishtml?dol_htmlentitiesbr($birthday):$birthday,
|
||||||
'__PHOTO__'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo,
|
'__PHOTO__'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo,
|
||||||
'__LOGIN__'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login,
|
'__LOGIN__'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login,
|
||||||
'__PASSWORD__'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass,
|
'__PASSWORD__'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass,
|
||||||
// For backward compatibility
|
'__PHONE__'=>$msgishtml?dol_htmlentitiesbr($this->phone):$this->phone,
|
||||||
'%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT,
|
'__PHONEPRO__'=>$msgishtml?dol_htmlentitiesbr($this->phone_perso):$this->phone_perso,
|
||||||
'%ID%'=>$msgishtml?dol_htmlentitiesbr($this->id):$this->id,
|
'__PHONEMOBILE__'=>$msgishtml?dol_htmlentitiesbr($this->phone_mobile):$this->phone_mobile,
|
||||||
'%CIVILITY%'=>$this->getCivilityLabel(),
|
|
||||||
'%FIRSTNAME%'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname,
|
|
||||||
'%LASTNAME%'=>$msgishtml?dol_htmlentitiesbr($this->lastname):$this->lastname,
|
|
||||||
'%FULLNAME%'=>$msgishtml?dol_htmlentitiesbr($this->getFullName($langs)):$this->getFullName($langs),
|
|
||||||
'%COMPANY%'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe,
|
|
||||||
'%ADDRESS%'=>$msgishtml?dol_htmlentitiesbr($this->address):$this->address,
|
|
||||||
'%ZIP%'=>$msgishtml?dol_htmlentitiesbr($this->zip):$this->zip,
|
|
||||||
'%TOWN%'=>$msgishtml?dol_htmlentitiesbr($this->town):$this->town,
|
|
||||||
'%COUNTRY%'=>$msgishtml?dol_htmlentitiesbr($this->country):$this->country,
|
|
||||||
'%EMAIL%'=>$msgishtml?dol_htmlentitiesbr($this->email):$this->email,
|
|
||||||
'%BIRTH%'=>$msgishtml?dol_htmlentitiesbr($birthday):$birthday,
|
|
||||||
'%PHOTO%'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo,
|
|
||||||
'%LOGIN%'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login,
|
|
||||||
'%PASSWORD%'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass,
|
|
||||||
'%INFOS%'=>$msgishtml?dol_htmlentitiesbr($infos):$infos,
|
|
||||||
'%SOCIETE%'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe,
|
|
||||||
'%PRENOM%'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname,
|
|
||||||
'%NOM%'=>$msgishtml?dol_htmlentitiesbr($this->lastname):$this->lastname,
|
|
||||||
'%CP%'=>$msgishtml?dol_htmlentitiesbr($this->zip):$this->zip,
|
|
||||||
'%VILLE%'=>$msgishtml?dol_htmlentitiesbr($this->town):$this->town,
|
|
||||||
'%PAYS%'=>$msgishtml?dol_htmlentitiesbr($this->country):$this->country,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
complete_substitutions_array($substitutionarray, $langs, $this);
|
complete_substitutions_array($substitutionarray, $langs, $this);
|
||||||
@ -317,10 +297,10 @@ class Adherent extends CommonObject
|
|||||||
$sql.= " '".$this->db->idate($this->datec)."'";
|
$sql.= " '".$this->db->idate($this->datec)."'";
|
||||||
$sql.= ", ".($this->login?"'".$this->db->escape($this->login)."'":"null");
|
$sql.= ", ".($this->login?"'".$this->db->escape($this->login)."'":"null");
|
||||||
$sql.= ", ".($user->id>0?$user->id:"null"); // Can be null because member can be created by a guest or a script
|
$sql.= ", ".($user->id>0?$user->id:"null"); // Can be null because member can be created by a guest or a script
|
||||||
$sql.= ", null, null, '".$this->morphy."'";
|
$sql.= ", null, null, '".$this->db->escape($this->morphy)."'";
|
||||||
$sql.= ", '".$this->typeid."'";
|
$sql.= ", ".$this->typeid;
|
||||||
$sql.= ", ".$conf->entity;
|
$sql.= ", ".$conf->entity;
|
||||||
$sql.= ", ".(! empty($this->import_key) ? "'".$this->import_key."'":"null");
|
$sql.= ", ".(! empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'":"null");
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||||
@ -439,17 +419,17 @@ class Adherent extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||||
$sql.= " civility = ".(!is_null($this->civility_id)?"'".$this->civility_id."'":"null");
|
$sql.= " civility = ".($this->civility_id?"'".$this->db->escape($this->civility_id)."'":"null");
|
||||||
$sql.= ", firstname = ".($this->firstname?"'".$this->db->escape($this->firstname)."'":"null");
|
$sql.= ", firstname = ".($this->firstname?"'".$this->db->escape($this->firstname)."'":"null");
|
||||||
$sql.= ", lastname = ".($this->lastname?"'".$this->db->escape($this->lastname)."'":"null");
|
$sql.= ", lastname = ".($this->lastname?"'".$this->db->escape($this->lastname)."'":"null");
|
||||||
$sql.= ", login = ".($this->login?"'".$this->db->escape($this->login)."'":"null");
|
$sql.= ", login = ".($this->login?"'".$this->db->escape($this->login)."'":"null");
|
||||||
$sql.= ", societe = ".($this->societe?"'".$this->db->escape($this->societe)."'":"null");
|
$sql.= ", societe = ".($this->societe?"'".$this->db->escape($this->societe)."'":"null");
|
||||||
$sql.= ", fk_soc=" .($this->fk_soc > 0?"'".$this->fk_soc."'":"null");
|
$sql.= ", fk_soc = ".($this->fk_soc > 0?$this->db->escape($this->fk_soc):"null");
|
||||||
$sql.= ", address = ".($this->address?"'".$this->db->escape($this->address)."'":"null");
|
$sql.= ", address = ".($this->address?"'".$this->db->escape($this->address)."'":"null");
|
||||||
$sql.= ", zip = ".($this->zip?"'".$this->db->escape($this->zip)."'":"null");
|
$sql.= ", zip = ".($this->zip?"'".$this->db->escape($this->zip)."'":"null");
|
||||||
$sql.= ", town = ".($this->town?"'".$this->db->escape($this->town)."'":"null");
|
$sql.= ", town = ".($this->town?"'".$this->db->escape($this->town)."'":"null");
|
||||||
$sql.= ", country=".($this->country_id>0?"'".$this->country_id."'":"null");
|
$sql.= ", country = ".($this->country_id>0?$this->db->escape($this->country_id):"null");
|
||||||
$sql.= ", state_id=".($this->state_id>0?"'".$this->state_id."'":"null");
|
$sql.= ", state_id = ".($this->state_id>0?$this->db->escape($this->state_id):"null");
|
||||||
$sql.= ", email = '".$this->db->escape($this->email)."'";
|
$sql.= ", email = '".$this->db->escape($this->email)."'";
|
||||||
$sql.= ", skype = '".$this->db->escape($this->skype)."'";
|
$sql.= ", skype = '".$this->db->escape($this->skype)."'";
|
||||||
$sql.= ", phone = ".($this->phone?"'".$this->db->escape($this->phone)."'":"null");
|
$sql.= ", phone = ".($this->phone?"'".$this->db->escape($this->phone)."'":"null");
|
||||||
@ -457,7 +437,7 @@ class Adherent extends CommonObject
|
|||||||
$sql.= ", phone_mobile = ".($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null");
|
$sql.= ", phone_mobile = ".($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null");
|
||||||
$sql.= ", note_private = ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
|
$sql.= ", note_private = ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
|
||||||
$sql.= ", note_public = ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null");
|
$sql.= ", note_public = ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null");
|
||||||
$sql.= ", photo=" .($this->photo?"'".$this->photo."'":"null");
|
$sql.= ", photo = ".($this->photo?"'".$this->db->escape($this->photo)."'":"null");
|
||||||
$sql.= ", public = '".$this->db->escape($this->public)."'";
|
$sql.= ", public = '".$this->db->escape($this->public)."'";
|
||||||
$sql.= ", statut = ".$this->statut;
|
$sql.= ", statut = ".$this->statut;
|
||||||
$sql.= ", fk_adherent_type = ".$this->typeid;
|
$sql.= ", fk_adherent_type = ".$this->typeid;
|
||||||
@ -740,7 +720,6 @@ class Adherent extends CommonObject
|
|||||||
$error++;
|
$error++;
|
||||||
$this->error .= $this->db->lasterror();
|
$this->error .= $this->db->lasterror();
|
||||||
$errorflag=-1;
|
$errorflag=-1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove subscription
|
// Remove subscription
|
||||||
@ -1184,7 +1163,7 @@ class Adherent extends CommonObject
|
|||||||
// Load other properties
|
// Load other properties
|
||||||
$result=$this->fetch_subscriptions();
|
$result=$this->fetch_subscriptions();
|
||||||
|
|
||||||
return $result;
|
return $this->id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1583,12 +1562,13 @@ class Adherent extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $withpictoimg 0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small)
|
* @param int $withpictoimg 0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small)
|
||||||
* @param int $maxlen length max label
|
* @param int $maxlen length max label
|
||||||
* @param string $option Page for link
|
* @param string $option Page for link ('card', 'category', 'subscription', ...)
|
||||||
* @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login, 'ref'=Show ref
|
* @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login, 'ref'=Show ref
|
||||||
* @param string $morecss Add more css on link
|
* @param string $morecss Add more css on link
|
||||||
|
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||||
* @return string Chaine avec URL
|
* @return string Chaine avec URL
|
||||||
*/
|
*/
|
||||||
function getNomUrl($withpictoimg=0,$maxlen=0,$option='card',$mode='',$morecss='')
|
function getNomUrl($withpictoimg=0, $maxlen=0, $option='card', $mode='', $morecss='', $save_lastsearch_value=-1)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
@ -1612,15 +1592,21 @@ class Adherent extends CommonObject
|
|||||||
$label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs);
|
$label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs);
|
||||||
$label.='</div>';
|
$label.='</div>';
|
||||||
|
|
||||||
if ($option == 'card' || $option == 'category')
|
$url = DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id;
|
||||||
{
|
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id.'"';
|
|
||||||
}
|
|
||||||
if ($option == 'subscription')
|
if ($option == 'subscription')
|
||||||
{
|
{
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$this->id.'"';
|
$url = DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($option != 'nolink')
|
||||||
|
{
|
||||||
|
// Add param to save lastsearch_values or not
|
||||||
|
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
|
||||||
|
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
|
||||||
|
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
|
||||||
|
}
|
||||||
|
|
||||||
|
$link = '<a href="'.$url.'"';
|
||||||
$linkclose="";
|
$linkclose="";
|
||||||
if (empty($notooltip))
|
if (empty($notooltip))
|
||||||
{
|
{
|
||||||
@ -1973,25 +1959,49 @@ class Adherent extends CommonObject
|
|||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
$info=array();
|
$info=array();
|
||||||
|
$keymodified=false;
|
||||||
|
|
||||||
// Object classes
|
// Object classes
|
||||||
$info["objectclass"]=explode(',',$conf->global->LDAP_MEMBER_OBJECT_CLASS);
|
$info["objectclass"]=explode(',',$conf->global->LDAP_MEMBER_OBJECT_CLASS);
|
||||||
|
|
||||||
$this->fullname=$this->getFullName($langs);
|
$this->fullname=$this->getFullName($langs);
|
||||||
|
|
||||||
|
// For avoid ldap error when firstname and lastname are empty
|
||||||
|
if ($this->morphy == 'mor' && empty($this->fullname)) {
|
||||||
|
$this->fullname = $this->societe;
|
||||||
|
$this->lastname = $this->societe;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Possible LDAP KEY (constname => varname)
|
||||||
|
$ldapkey = array(
|
||||||
|
'LDAP_MEMBER_FIELD_FULLNAME' => 'fullname',
|
||||||
|
'LDAP_MEMBER_FIELD_NAME' => 'lastname',
|
||||||
|
'LDAP_MEMBER_FIELD_LOGIN' => 'login',
|
||||||
|
'LDAP_MEMBER_FIELD_LOGIN_SAMBA' => 'login',
|
||||||
|
'LDAP_MEMBER_FIELD_MAIL' => 'email'
|
||||||
|
);
|
||||||
|
|
||||||
// Member
|
// Member
|
||||||
if ($this->fullname && ! empty($conf->global->LDAP_MEMBER_FIELD_FULLNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FULLNAME] = $this->fullname;
|
foreach ($ldapkey as $constname => $varname)
|
||||||
if ($this->lastname && ! empty($conf->global->LDAP_MEMBER_FIELD_NAME)) $info[$conf->global->LDAP_MEMBER_FIELD_NAME] = $this->lastname;
|
{
|
||||||
|
if (! empty($this->$varname) && ! empty($conf->global->$constname))
|
||||||
|
{
|
||||||
|
$info[$conf->global->$constname] = $this->$varname;
|
||||||
|
|
||||||
|
// Check if it is the LDAP key and if its value has been changed
|
||||||
|
if (! empty($conf->global->LDAP_KEY_MEMBERS) && $conf->global->LDAP_KEY_MEMBERS == $conf->global->$constname)
|
||||||
|
{
|
||||||
|
if (! empty($this->oldcopy) && $this->$varname != $this->oldcopy->$varname) $keymodified=true; // For check if LDAP key has been modified
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($this->firstname && ! empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname;
|
if ($this->firstname && ! empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname;
|
||||||
if ($this->login && ! empty($conf->global->LDAP_MEMBER_FIELD_LOGIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LOGIN] = $this->login;
|
|
||||||
if ($this->pass && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
|
|
||||||
if ($this->pass && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // md5 for OpenLdap TODO add type of encryption
|
|
||||||
if ($this->poste && ! empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste;
|
if ($this->poste && ! empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste;
|
||||||
|
if ($this->societe && ! empty($conf->global->LDAP_MEMBER_FIELD_COMPANY)) $info[$conf->global->LDAP_MEMBER_FIELD_COMPANY] = $this->societe;
|
||||||
if ($this->address && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address;
|
if ($this->address && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address;
|
||||||
if ($this->zip && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip;
|
if ($this->zip && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip;
|
||||||
if ($this->town && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town;
|
if ($this->town && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town;
|
||||||
if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code;
|
if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code;
|
||||||
if ($this->email && ! empty($conf->global->LDAP_MEMBER_FIELD_MAIL)) $info[$conf->global->LDAP_MEMBER_FIELD_MAIL] = $this->email;
|
|
||||||
if ($this->skype && ! empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype;
|
if ($this->skype && ! empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype;
|
||||||
if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone;
|
if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone;
|
||||||
if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
|
if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
|
||||||
@ -2003,6 +2013,35 @@ class Adherent extends CommonObject
|
|||||||
if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut;
|
if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut;
|
||||||
if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap');
|
if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap');
|
||||||
|
|
||||||
|
// When password is modified
|
||||||
|
if (! empty($this->pass))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
|
||||||
|
if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption)
|
||||||
|
}
|
||||||
|
// Set LDAP password if possible
|
||||||
|
else if ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->DATABASE_PWD_ENCRYPTED))
|
||||||
|
{
|
||||||
|
// Just for the default MD5 !
|
||||||
|
if (empty($conf->global->MAIN_SECURITY_HASH_ALGO))
|
||||||
|
{
|
||||||
|
if ($this->pass_indatabase_crypted && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) {
|
||||||
|
// Create OpenLDAP MD5 password from Dolibarr MD5 password
|
||||||
|
// Note: This suppose that "pass_indatabase_crypted" is a md5 (guaranted by the previous test if "(empty($conf->global->MAIN_SECURITY_HASH_ALGO))"
|
||||||
|
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = '{md5}'.base64_encode(hex2bin($this->pass_indatabase_crypted));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Use $this->pass_indatabase value if exists
|
||||||
|
else if (! empty($this->pass_indatabase))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte
|
||||||
|
if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 4); // md5 for OpenLdap TODO add type of encryption
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Subscriptions
|
// Subscriptions
|
||||||
if ($this->first_subscription_date && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE] = dol_print_date($this->first_subscription_date,'dayhourldap');
|
if ($this->first_subscription_date && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE] = dol_print_date($this->first_subscription_date,'dayhourldap');
|
||||||
if (isset($this->first_subscription_amount) && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT] = $this->first_subscription_amount;
|
if (isset($this->first_subscription_amount) && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT] = $this->first_subscription_amount;
|
||||||
|
|||||||
@ -22,7 +22,6 @@
|
|||||||
* \file htdocs/adherents/class/adherent_type.class.php
|
* \file htdocs/adherents/class/adherent_type.class.php
|
||||||
* \ingroup member
|
* \ingroup member
|
||||||
* \brief File of class to manage members types
|
* \brief File of class to manage members types
|
||||||
* \author Rodolphe Quiedeville
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||||
@ -58,10 +57,12 @@ class AdherentType extends CommonObject
|
|||||||
public $subscription;
|
public $subscription;
|
||||||
/** @var string Public note */
|
/** @var string Public note */
|
||||||
public $note;
|
public $note;
|
||||||
/** @var bool Can vote*/
|
/** @var integer Can vote */
|
||||||
public $vote;
|
public $vote;
|
||||||
/** @var bool Email sent during validation */
|
/** @var string Email sent during validation */
|
||||||
public $mail_valid;
|
public $mail_valid;
|
||||||
|
/** @var array Array of members */
|
||||||
|
public $members=array();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -80,14 +81,19 @@ class AdherentType extends CommonObject
|
|||||||
* Fonction qui permet de creer le status de l'adherent
|
* Fonction qui permet de creer le status de l'adherent
|
||||||
*
|
*
|
||||||
* @param User $user User making creation
|
* @param User $user User making creation
|
||||||
|
* @param int $notrigger 1=do not execute triggers, 0 otherwise
|
||||||
* @return int >0 if OK, < 0 if KO
|
* @return int >0 if OK, < 0 if KO
|
||||||
*/
|
*/
|
||||||
function create($user)
|
function create($user,$notrigger=0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
$error=0;
|
||||||
|
|
||||||
$this->statut=(int) $this->statut;
|
$this->statut=(int) $this->statut;
|
||||||
$this->label=(!empty($this->libelle)?trim($this->libelle):trim($this->label));
|
$this->label=trim($this->label);
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type (";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type (";
|
||||||
$sql.= "libelle";
|
$sql.= "libelle";
|
||||||
@ -102,29 +108,58 @@ class AdherentType extends CommonObject
|
|||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent_type");
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent_type");
|
||||||
return $this->update($user);
|
|
||||||
|
$result = $this->update($user,1);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $notrigger)
|
||||||
|
{
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('MEMBER_TYPE_CREATE',$user);
|
||||||
|
if ($result < 0) { $error++; }
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
return $this->id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error().' sql='.$sql;
|
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
||||||
|
$this->db->rollback();
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Met a jour en base donnees du type
|
* Met a jour en base donnees du type
|
||||||
*
|
*
|
||||||
* @param User $user Object user making change
|
* @param User $user Object user making change
|
||||||
|
* @param int $notrigger 1=do not execute triggers, 0 otherwise
|
||||||
* @return int >0 if OK, < 0 if KO
|
* @return int >0 if OK, < 0 if KO
|
||||||
*/
|
*/
|
||||||
function update($user)
|
function update($user,$notrigger=0)
|
||||||
{
|
{
|
||||||
global $hookmanager,$conf;
|
global $conf, $hookmanager;
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$this->label=(!empty($this->libelle)?trim($this->libelle):trim($this->label));
|
$this->label=trim($this->label);
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type ";
|
||||||
$sql.= "SET ";
|
$sql.= "SET ";
|
||||||
@ -158,12 +193,30 @@ class AdherentType extends CommonObject
|
|||||||
}
|
}
|
||||||
else if ($reshook < 0) $error++;
|
else if ($reshook < 0) $error++;
|
||||||
|
|
||||||
|
if (! $error && ! $notrigger)
|
||||||
|
{
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('MEMBER_TYPE_MODIFY',$user);
|
||||||
|
if ($result < 0) { $error++; }
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error().' sql='.$sql;
|
$this->db->rollback();
|
||||||
|
dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR);
|
||||||
|
return -$error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,31 +224,31 @@ class AdherentType extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Fonction qui permet de supprimer le status de l'adherent
|
* Fonction qui permet de supprimer le status de l'adherent
|
||||||
*
|
*
|
||||||
* @param int $rowid Id of member type to delete
|
|
||||||
* @return int >0 if OK, 0 if not found, < 0 if KO
|
* @return int >0 if OK, 0 if not found, < 0 if KO
|
||||||
*/
|
*/
|
||||||
function delete($rowid='')
|
function delete()
|
||||||
{
|
{
|
||||||
if (empty($rowid)) $rowid=$this->id;
|
global $user;
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type WHERE rowid = ".$rowid;
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type";
|
||||||
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if ($this->db->affected_rows($resql))
|
// Call trigger
|
||||||
{
|
$result=$this->call_trigger('MEMBER_TYPE_DELETE',$user);
|
||||||
|
if ($result < 0) { $error++; $this->db->rollback(); return -2; }
|
||||||
|
// End call triggers
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 0;
|
$this->db->rollback();
|
||||||
}
|
$this->error=$this->db->lasterror();
|
||||||
}
|
return -1;
|
||||||
else
|
|
||||||
{
|
|
||||||
print "Err : ".$this->db->error();
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,13 +276,13 @@ class AdherentType extends CommonObject
|
|||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->ref = $obj->rowid;
|
$this->ref = $obj->rowid;
|
||||||
$this->label = $obj->label;
|
$this->label = $obj->label;
|
||||||
$this->libelle = $obj->label; // For backward compatibility
|
|
||||||
$this->statut = $obj->statut;
|
$this->statut = $obj->statut;
|
||||||
$this->subscription = $obj->subscription;
|
$this->subscription = $obj->subscription;
|
||||||
$this->mail_valid = $obj->mail_valid;
|
$this->mail_valid = $obj->mail_valid;
|
||||||
$this->note = $obj->note;
|
$this->note = $obj->note;
|
||||||
$this->vote = $obj->vote;
|
$this->vote = $obj->vote;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -250,7 +303,7 @@ class AdherentType extends CommonObject
|
|||||||
|
|
||||||
$adherenttypes = array();
|
$adherenttypes = array();
|
||||||
|
|
||||||
$sql = "SELECT rowid, libelle";
|
$sql = "SELECT rowid, libelle as label";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
||||||
$sql.= " WHERE entity IN (".getEntity('adherent').")";
|
$sql.= " WHERE entity IN (".getEntity('adherent').")";
|
||||||
|
|
||||||
@ -266,7 +319,7 @@ class AdherentType extends CommonObject
|
|||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
$adherenttypes[$obj->rowid] = $langs->trans($obj->libelle);
|
$adherenttypes[$obj->rowid] = $langs->trans($obj->label);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -278,12 +331,61 @@ class AdherentType extends CommonObject
|
|||||||
return $adherenttypes;
|
return $adherenttypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return array of Member objects for member type this->id (or all if this->id not defined)
|
||||||
|
*
|
||||||
|
* @param string $excludefilter Filter to exclude
|
||||||
|
* @param int $mode 0=Return array of member instance, 1=Return array of members id only
|
||||||
|
* @return mixed Array of members or -1 on error
|
||||||
|
*/
|
||||||
|
function listMembersForMemberType($excludefilter='', $mode=0)
|
||||||
|
{
|
||||||
|
global $conf, $user;
|
||||||
|
|
||||||
|
$ret=array();
|
||||||
|
|
||||||
|
$sql = "SELECT a.rowid";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a";
|
||||||
|
$sql.= " WHERE a.entity IN (".getEntity('member').")";
|
||||||
|
$sql.= " AND a.fk_adherent_type = ".$this->id;
|
||||||
|
if (! empty($excludefilter)) $sql.=' AND ('.$excludefilter.')';
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::listUsersForGroup", LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
if (! array_key_exists($obj->rowid, $ret))
|
||||||
|
{
|
||||||
|
if ($mode != 1)
|
||||||
|
{
|
||||||
|
$memberstatic=new Adherent($this->db);
|
||||||
|
$memberstatic->fetch($obj->rowid);
|
||||||
|
$ret[$obj->rowid]=$memberstatic;
|
||||||
|
}
|
||||||
|
else $ret[$obj->rowid]=$obj->rowid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->free($resql);
|
||||||
|
|
||||||
|
$this->members=$ret;
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return clicable name (with picto eventually)
|
* Return clicable name (with picto eventually)
|
||||||
*
|
*
|
||||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||||
* @param int $maxlen length max libelle
|
* @param int $maxlen length max label
|
||||||
* @return string String with URL
|
* @return string String with URL
|
||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0,$maxlen=0)
|
function getNomUrl($withpicto=0,$maxlen=0)
|
||||||
@ -291,7 +393,7 @@ class AdherentType extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
$label=$langs->trans("ShowTypeCard",$this->libelle);
|
$label=$langs->trans("ShowTypeCard",$this->label);
|
||||||
|
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$link = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
@ -300,11 +402,10 @@ class AdherentType extends CommonObject
|
|||||||
|
|
||||||
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
$result.=$link.($maxlen?dol_trunc($this->libelle,$maxlen):$this->libelle).$linkend;
|
$result.=$link.($maxlen?dol_trunc($this->label,$maxlen):$this->label).$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getLibStatut
|
* getLibStatut
|
||||||
*
|
*
|
||||||
@ -315,6 +416,88 @@ class AdherentType extends CommonObject
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
|
||||||
|
*
|
||||||
|
* @param array $info Info array loaded by _load_ldap_info
|
||||||
|
* @param int $mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
|
||||||
|
* 1=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb)
|
||||||
|
* 2=Return key only (uid=qqq)
|
||||||
|
* @return string DN
|
||||||
|
*/
|
||||||
|
function _load_ldap_dn($info,$mode=0)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
$dn='';
|
||||||
|
if ($mode==0) $dn=$conf->global->LDAP_KEY_MEMBERS_TYPES."=".$info[$conf->global->LDAP_KEY_MEMBERS_TYPES].",".$conf->global->LDAP_MEMBER_TYPE_DN;
|
||||||
|
if ($mode==1) $dn=$conf->global->LDAP_MEMBER_TYPE_DN;
|
||||||
|
if ($mode==2) $dn=$conf->global->LDAP_KEY_MEMBERS_TYPES."=".$info[$conf->global->LDAP_KEY_MEMBERS_TYPES];
|
||||||
|
return $dn;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the info array (array of LDAP values) that will be used to call LDAP functions
|
||||||
|
*
|
||||||
|
* @return array Tableau info des attributs
|
||||||
|
*/
|
||||||
|
function _load_ldap_info()
|
||||||
|
{
|
||||||
|
global $conf,$langs;
|
||||||
|
|
||||||
|
$info=array();
|
||||||
|
|
||||||
|
// Object classes
|
||||||
|
$info["objectclass"]=explode(',',$conf->global->LDAP_MEMBER_TYPE_OBJECT_CLASS);
|
||||||
|
|
||||||
|
// Champs
|
||||||
|
if ($this->label && ! empty($conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME)) $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME] = $this->label;
|
||||||
|
if ($this->note && ! empty($conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION] = $this->note;
|
||||||
|
if (! empty($conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS))
|
||||||
|
{
|
||||||
|
$valueofldapfield=array();
|
||||||
|
foreach($this->members as $key=>$val) // This is array of users for group into dolibarr database.
|
||||||
|
{
|
||||||
|
$member=new Adherent($this->db);
|
||||||
|
$member->fetch($val->id);
|
||||||
|
$info2 = $member->_load_ldap_info();
|
||||||
|
$valueofldapfield[] = $member->_load_ldap_dn($info2);
|
||||||
|
}
|
||||||
|
$info[$conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS] = (!empty($valueofldapfield)?$valueofldapfield:'');
|
||||||
|
}
|
||||||
|
return $info;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise an instance with random values.
|
||||||
|
* Used to build previews or test instances.
|
||||||
|
* id must be 0 if object instance is a specimen.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function initAsSpecimen()
|
||||||
|
{
|
||||||
|
global $conf, $user, $langs;
|
||||||
|
|
||||||
|
// Initialise parametres
|
||||||
|
$this->id = 0;
|
||||||
|
$this->ref = 'MTSPEC';
|
||||||
|
$this->specimen=1;
|
||||||
|
|
||||||
|
$this->label='MEMBERS TYPE SPECIMEN';
|
||||||
|
$this->note='This is a note';
|
||||||
|
$this->mail_valid='This is welcome email';
|
||||||
|
$this->subscription=1;
|
||||||
|
$this->vote=0;
|
||||||
|
|
||||||
|
$this->statut=1;
|
||||||
|
|
||||||
|
// Members of this member type is just me
|
||||||
|
$this->members=array(
|
||||||
|
$user->id => $user
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getMailOnValid
|
* getMailOnValid
|
||||||
*
|
*
|
||||||
@ -342,6 +525,7 @@ class AdherentType extends CommonObject
|
|||||||
function getMailOnSubscription()
|
function getMailOnSubscription()
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
// mail_subscription not defined so never used
|
// mail_subscription not defined so never used
|
||||||
if (! empty($this->mail_subscription) && trim(dol_htmlentitiesbr_decode($this->mail_subscription))) // Property not yet defined
|
if (! empty($this->mail_subscription) && trim(dol_htmlentitiesbr_decode($this->mail_subscription))) // Property not yet defined
|
||||||
{
|
{
|
||||||
@ -361,6 +545,7 @@ class AdherentType extends CommonObject
|
|||||||
function getMailOnResiliate()
|
function getMailOnResiliate()
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
// NOTE mail_resiliate not defined so never used
|
// NOTE mail_resiliate not defined so never used
|
||||||
if (! empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) // Property not yet defined
|
if (! empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) // Property not yet defined
|
||||||
{
|
{
|
||||||
@ -371,4 +556,5 @@ class AdherentType extends CommonObject
|
|||||||
return $conf->global->ADHERENT_MAIL_RESIL;
|
return $conf->global->ADHERENT_MAIL_RESIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr>
|
/* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr>
|
||||||
|
* Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -19,6 +20,7 @@ use Luracast\Restler\RestException;
|
|||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API class for members
|
* API class for members
|
||||||
@ -357,4 +359,38 @@ class Members extends DolibarrApi
|
|||||||
return $member->subscription($start_date, $amount, 0, '', $label, '', '', '', $end_date);
|
return $member->subscription($start_date, $amount, 0, '', $label, '', '', '', $end_date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get categories for a member
|
||||||
|
*
|
||||||
|
* @param int $id ID of member
|
||||||
|
* @param string $sortfield Sort field
|
||||||
|
* @param string $sortorder Sort order
|
||||||
|
* @param int $limit Limit for list
|
||||||
|
* @param int $page Page number
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*
|
||||||
|
* @url GET {id}/categories
|
||||||
|
*/
|
||||||
|
function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
|
||||||
|
{
|
||||||
|
if (! DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$categories = new Categorie($this->db);
|
||||||
|
|
||||||
|
$result = $categories->getListForItem($id, 'member', $sortfield, $sortorder, $limit, $page);
|
||||||
|
|
||||||
|
if (empty($result)) {
|
||||||
|
throw new RestException(404, 'No category found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($result < 0) {
|
||||||
|
throw new RestException(503, 'Error when retrieve category list : '.$categories->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -272,7 +272,6 @@ class MembersTypes extends DolibarrApi
|
|||||||
$object = parent::_cleanObjectDatas($object);
|
$object = parent::_cleanObjectDatas($object);
|
||||||
|
|
||||||
unset($object->cotisation);
|
unset($object->cotisation);
|
||||||
unset($object->libelle);
|
|
||||||
|
|
||||||
unset($object->array_options);
|
unset($object->array_options);
|
||||||
unset($object->linkedObjectsIds);
|
unset($object->linkedObjectsIds);
|
||||||
|
|||||||
@ -110,7 +110,7 @@ if ($id > 0)
|
|||||||
|
|
||||||
dol_fiche_head($head, 'document', $langs->trans("Member"), -1, 'user');
|
dol_fiche_head($head, 'document', $langs->trans("Member"), -1, 'user');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'rowid', $linkback);
|
dol_banner_tab($object, 'rowid', $linkback);
|
||||||
|
|
||||||
|
|||||||
@ -59,7 +59,7 @@ $AdherentsResilies=array();
|
|||||||
$AdherentType=array();
|
$AdherentType=array();
|
||||||
|
|
||||||
// Liste les adherents
|
// Liste les adherents
|
||||||
$sql = "SELECT t.rowid, t.libelle, t.subscription,";
|
$sql = "SELECT t.rowid, t.libelle as label, t.subscription,";
|
||||||
$sql.= " d.statut, count(d.rowid) as somme";
|
$sql.= " d.statut, count(d.rowid) as somme";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d";
|
||||||
@ -81,7 +81,7 @@ if ($result)
|
|||||||
$adhtype=new AdherentType($db);
|
$adhtype=new AdherentType($db);
|
||||||
$adhtype->id=$objp->rowid;
|
$adhtype->id=$objp->rowid;
|
||||||
$adhtype->subscription=$objp->subscription;
|
$adhtype->subscription=$objp->subscription;
|
||||||
$adhtype->libelle=$objp->libelle;
|
$adhtype->label=$objp->label;
|
||||||
$AdherentType[$objp->rowid]=$adhtype;
|
$AdherentType[$objp->rowid]=$adhtype;
|
||||||
|
|
||||||
if ($objp->statut == -1) { $MemberToValidate[$objp->rowid]=$objp->somme; }
|
if ($objp->statut == -1) { $MemberToValidate[$objp->rowid]=$objp->somme; }
|
||||||
@ -273,7 +273,7 @@ $max=5;
|
|||||||
|
|
||||||
$sql = "SELECT a.rowid, a.statut, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
|
$sql = "SELECT a.rowid, a.statut, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
|
||||||
$sql.= " a.tms as datem, datefin as date_end_subscription,";
|
$sql.= " a.tms as datem, datefin as date_end_subscription,";
|
||||||
$sql.= " ta.rowid as typeid, ta.libelle, ta.subscription";
|
$sql.= " ta.rowid as typeid, ta.libelle as label, ta.subscription";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta";
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta";
|
||||||
$sql.= " WHERE a.entity IN (".getEntity('adherent').")";
|
$sql.= " WHERE a.entity IN (".getEntity('adherent').")";
|
||||||
$sql.= " AND a.fk_adherent_type = ta.rowid";
|
$sql.= " AND a.fk_adherent_type = ta.rowid";
|
||||||
@ -310,7 +310,7 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
$staticmember->ref=$staticmember->getFullName($langs);
|
$staticmember->ref=$staticmember->getFullName($langs);
|
||||||
$statictype->id=$obj->typeid;
|
$statictype->id=$obj->typeid;
|
||||||
$statictype->libelle=$obj->libelle;
|
$statictype->label=$obj->label;
|
||||||
print '<td>'.$staticmember->getNomUrl(1,32).'</td>';
|
print '<td>'.$staticmember->getNomUrl(1,32).'</td>';
|
||||||
print '<td>'.$statictype->getNomUrl(1,32).'</td>';
|
print '<td>'.$statictype->getNomUrl(1,32).'</td>';
|
||||||
print '<td>'.dol_print_date($db->jdate($obj->datem),'dayhour').'</td>';
|
print '<td>'.dol_print_date($db->jdate($obj->datem),'dayhour').'</td>';
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2006 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2006-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -59,26 +59,23 @@ if (! $result)
|
|||||||
|
|
||||||
if ($action == 'dolibarr2ldap')
|
if ($action == 'dolibarr2ldap')
|
||||||
{
|
{
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
$ldap=new Ldap();
|
$ldap=new Ldap();
|
||||||
$result=$ldap->connect_bind();
|
$result=$ldap->connect_bind();
|
||||||
|
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
$olddn=$dn; // We can say that old dn = dn as we force synchro
|
$olddn=$dn; // We can say that old dn = dn as we force synchro
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user,$olddn);
|
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||||
|
|
||||||
if ($result >= 0)
|
|
||||||
{
|
|
||||||
setEventMessages($langs->trans("MemberSynchronized"), null, 'mesgs');
|
|
||||||
$db->commit();
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
if ($result >= 0) {
|
||||||
|
setEventMessages($langs->trans("MemberSynchronized"), null, 'mesgs');
|
||||||
|
}
|
||||||
|
else {
|
||||||
setEventMessages($ldap->errors, $ldap->error, 'errors');
|
setEventMessages($ldap->errors, $ldap->error, 'errors');
|
||||||
$db->rollback();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +93,7 @@ $head = member_prepare_head($object);
|
|||||||
|
|
||||||
dol_fiche_head($head, 'ldap', $langs->trans("Member"), 0, 'user');
|
dol_fiche_head($head, 'ldap', $langs->trans("Member"), 0, 'user');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'rowid', $linkback);
|
dol_banner_tab($object, 'rowid', $linkback);
|
||||||
|
|
||||||
@ -218,13 +215,11 @@ if ($result > 0)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error('',$ldap->error);
|
setEventMessages($ldap->error, $ldap->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -129,7 +129,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,8 +138,8 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array('socid'=>$socid);
|
$parameters=array('socid'=>$socid);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
@ -249,8 +249,9 @@ foreach ($search_array_options as $key => $val)
|
|||||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||||
$typ=$extrafields->attribute_type[$tmpkey];
|
$typ=$extrafields->attribute_type[$tmpkey];
|
||||||
$mode=0;
|
$mode=0;
|
||||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||||
|
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||||
{
|
{
|
||||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||||
}
|
}
|
||||||
@ -314,7 +315,7 @@ if ($search_type > 0)
|
|||||||
{
|
{
|
||||||
$membertype=new AdherentType($db);
|
$membertype=new AdherentType($db);
|
||||||
$result=$membertype->fetch(GETPOST("type",'int'));
|
$result=$membertype->fetch(GETPOST("type",'int'));
|
||||||
$titre.=" (".$membertype->libelle.")";
|
$titre.=" (".$membertype->label.")";
|
||||||
}
|
}
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
@ -697,7 +698,7 @@ while ($i < min($num, $limit))
|
|||||||
if (! empty($arrayfields['t.libelle']['checked']))
|
if (! empty($arrayfields['t.libelle']['checked']))
|
||||||
{
|
{
|
||||||
$membertypestatic->id=$obj->type_id;
|
$membertypestatic->id=$obj->type_id;
|
||||||
$membertypestatic->libelle=$obj->type;
|
$membertypestatic->label=$obj->type;
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
print $membertypestatic->getNomUrl(1,32);
|
print $membertypestatic->getNomUrl(1,32);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -824,7 +825,7 @@ while ($i < min($num, $limit))
|
|||||||
if (! empty($arrayfields['d.datec']['checked']))
|
if (! empty($arrayfields['d.datec']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="center" class="nowrap">';
|
print '<td align="center" class="nowrap">';
|
||||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
@ -832,7 +833,7 @@ while ($i < min($num, $limit))
|
|||||||
if (! empty($arrayfields['d.tms']['checked']))
|
if (! empty($arrayfields['d.tms']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="center" class="nowrap">';
|
print '<td align="center" class="nowrap">';
|
||||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,7 +74,7 @@ if ($id)
|
|||||||
print "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
|
print "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'rowid', $linkback);
|
dol_banner_tab($object, 'rowid', $linkback);
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2012-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -109,7 +109,7 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
|
|||||||
{
|
{
|
||||||
// Creation user
|
// Creation user
|
||||||
$company = new Societe($db);
|
$company = new Societe($db);
|
||||||
$result=$company->create_from_member($object,$_POST["companyname"]);
|
$result=$company->create_from_member($object, GETPOST('companyname', 'alpha'), GETPOST('companyalias', 'alpha'));
|
||||||
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
@ -461,7 +461,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
$paiement = new Paiement($db);
|
$paiement = new Paiement($db);
|
||||||
$paiement->datepaye = $paymentdate;
|
$paiement->datepaye = $paymentdate;
|
||||||
$paiement->amounts = $amounts;
|
$paiement->amounts = $amounts;
|
||||||
$paiement->paiementid = dol_getIdFromCode($db,$operation,'c_paiement');
|
$paiement->paiementid = dol_getIdFromCode($db,$operation,'c_paiement','code','id',1);
|
||||||
$paiement->num_paiement = $num_chq;
|
$paiement->num_paiement = $num_chq;
|
||||||
$paiement->note = $label;
|
$paiement->note = $label;
|
||||||
|
|
||||||
@ -601,7 +601,7 @@ if ($rowid > 0)
|
|||||||
|
|
||||||
dol_fiche_head($head, 'subscription', $langs->trans("Member"), -1, 'user');
|
dol_fiche_head($head, 'subscription', $langs->trans("Member"), -1, 'user');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'rowid', $linkback);
|
dol_banner_tab($object, 'rowid', $linkback);
|
||||||
|
|
||||||
@ -789,14 +789,10 @@ if ($rowid > 0)
|
|||||||
if ($object->statut > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'&action=addsubscription">'.$langs->trans("AddSubscription")."</a></div>";
|
if ($object->statut > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'&action=addsubscription">'.$langs->trans("AddSubscription")."</a></div>";
|
||||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("AddSubscription").'</a></div>';
|
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("AddSubscription").'</a></div>';
|
||||||
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<br>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* List of subscriptions
|
* List of subscriptions
|
||||||
*/
|
*/
|
||||||
@ -882,23 +878,20 @@ if ($rowid > 0)
|
|||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Link for paypal payment
|
// Shon online payment link
|
||||||
if (! empty($conf->paypal->enabled))
|
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
|
||||||
|
|
||||||
|
if ($useonlinepayment)
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
|
print '<br>';
|
||||||
print showPaypalPaymentUrl('membersubscription',$object->ref);
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||||
|
print showOnlinePaymentUrl('membersubscription', $object->ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Link for stripe payment
|
|
||||||
if (! empty($conf->stripe->enabled))
|
|
||||||
{
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/stripe/lib/stripe.lib.php';
|
|
||||||
print showStripePaymentUrl('membersubscription',$object->ref);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add new subscription form
|
* Add new subscription form
|
||||||
@ -967,19 +960,25 @@ if ($rowid > 0)
|
|||||||
// Confirm create third party
|
// Confirm create third party
|
||||||
if ($action == 'create_thirdparty')
|
if ($action == 'create_thirdparty')
|
||||||
{
|
{
|
||||||
$name = $object->getFullName($langs);
|
$companyalias='';
|
||||||
if (! empty($name))
|
$fullname = $object->getFullName($langs);
|
||||||
|
|
||||||
|
if ($object->morphy == 'mor')
|
||||||
{
|
{
|
||||||
if ($object->morphy == 'mor' && ! empty($object->societe)) $name=$object->societe.' ('.$name.')';
|
$companyname=$object->societe;
|
||||||
else if ($object->societe) $name.=' ('.$object->societe.')';
|
if (! empty($fullname)) $companyalias=$fullname;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$name=$object->societe;
|
$companyname=$fullname;
|
||||||
|
if (! empty($object->societe)) $companyalias=$object->societe;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a form array
|
// Create a form array
|
||||||
$formquestion=array(array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $name));
|
$formquestion=array(
|
||||||
|
array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $companyname, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"'),
|
||||||
|
array('label' => $langs->trans("AliasNames"), 'type' => 'text', 'name' => 'companyalias', 'value' => $companyalias, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"')
|
||||||
|
);
|
||||||
|
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1);
|
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,7 @@ $errmsg='';
|
|||||||
$action=GETPOST("action",'alpha');
|
$action=GETPOST("action",'alpha');
|
||||||
$rowid=GETPOST("rowid","int")?GETPOST("rowid","int"):GETPOST("id","int");
|
$rowid=GETPOST("rowid","int")?GETPOST("rowid","int"):GETPOST("id","int");
|
||||||
$typeid=GETPOST("typeid","int");
|
$typeid=GETPOST("typeid","int");
|
||||||
$cancel=GETPOST('cancel');
|
$cancel=GETPOST('cancel','alpha');
|
||||||
$confirm=GETPOST('confirm');
|
$confirm=GETPOST('confirm');
|
||||||
|
|
||||||
if (! $user->rights->adherent->cotisation->lire)
|
if (! $user->rights->adherent->cotisation->lire)
|
||||||
@ -402,21 +402,15 @@ if ($rowid && $action != 'edit')
|
|||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
||||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||||
|
|
||||||
// Link for paypal payment
|
|
||||||
/*
|
|
||||||
if (! empty($conf->paypal->enabled) && $object->statut != 0) {
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';
|
|
||||||
print showPaypalPaymentUrl('invoice', $object->ref);
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
// List of actions on element
|
// List of actions on element
|
||||||
/*
|
/*
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||||
$formactions = new FormActions($db);
|
$formactions = new FormActions($db);
|
||||||
$somethingshown = $formactions->showactions($object, 'invoice', $socid);
|
$somethingshown = $formactions->showactions($object, 'invoice', $socid, 1);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '</div></div></div>';
|
print '</div></div></div>';
|
||||||
|
|||||||
@ -75,8 +75,8 @@ $result=restrictedArea($user,'adherent','','','cotisation');
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array('socid'=>$socid);
|
$parameters=array('socid'=>$socid);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|||||||
@ -37,6 +37,7 @@ $langs->load("members");
|
|||||||
$rowid = GETPOST('rowid','int');
|
$rowid = GETPOST('rowid','int');
|
||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$cancel = GETPOST('cancel','alpha');
|
$cancel = GETPOST('cancel','alpha');
|
||||||
|
$backtopage = GETPOST('backtopage','alpha');
|
||||||
|
|
||||||
$search_lastname = GETPOST('search_lastname','alpha');
|
$search_lastname = GETPOST('search_lastname','alpha');
|
||||||
$search_login = GETPOST('search_login','alpha');
|
$search_login = GETPOST('search_login','alpha');
|
||||||
@ -64,6 +65,8 @@ $mail_valid=GETPOST("mail_valid");
|
|||||||
// Security check
|
// Security check
|
||||||
$result=restrictedArea($user,'adherent',$rowid,'adherent_type');
|
$result=restrictedArea($user,'adherent',$rowid,'adherent_type');
|
||||||
|
|
||||||
|
$object = new AdherentType($db);
|
||||||
|
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
@ -87,23 +90,47 @@ $hookmanager->initHooks(array('membertypecard','globalcard'));
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if ($cancel) {
|
||||||
|
|
||||||
|
$action='';
|
||||||
|
|
||||||
|
if (! empty($backtopage))
|
||||||
|
{
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($action == 'add' && $user->rights->adherent->configurer)
|
if ($action == 'add' && $user->rights->adherent->configurer)
|
||||||
{
|
{
|
||||||
if (! $cancel)
|
|
||||||
{
|
|
||||||
$object = new AdherentType($db);
|
|
||||||
|
|
||||||
$object->label = trim($label);
|
$object->label = trim($label);
|
||||||
$object->subscription = (int) trim($subscription);
|
$object->subscription = (int) trim($subscription);
|
||||||
$object->note = trim($comment);
|
$object->note = trim($comment);
|
||||||
$object->mail_valid = (boolean) trim($mail_valid);
|
$object->mail_valid = trim($mail_valid);
|
||||||
$object->vote = (boolean) trim($vote);
|
$object->vote = (boolean) trim($vote);
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
if ($ret < 0) $error++;
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
if ($object->label)
|
if (empty($object->label)) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")), null, 'errors');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."adherent_type WHERE libelle='".$db->escape($object->label)."'";
|
||||||
|
$result = $db->query($sql);
|
||||||
|
if ($result) {
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
}
|
||||||
|
if ($num) {
|
||||||
|
$error++;
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans("ErrorLabelAlreadyExists",$login), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
{
|
{
|
||||||
$id=$object->create($user);
|
$id=$object->create($user);
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
@ -113,48 +140,64 @@ if ($action == 'add' && $user->rights->adherent->configurer)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg=$object->error;
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label"));
|
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == 'update' && $user->rights->adherent->configurer)
|
if ($action == 'update' && $user->rights->adherent->configurer)
|
||||||
{
|
{
|
||||||
if (! $cancel)
|
$object->fetch($rowid);
|
||||||
{
|
|
||||||
$object = new AdherentType($db);
|
$object->oldcopy = clone $object;
|
||||||
$object->id = $rowid;
|
|
||||||
$object->label = trim($label);
|
$object->label = trim($label);
|
||||||
$object->subscription = (int) trim($subscription);
|
$object->subscription = (int) trim($subscription);
|
||||||
$object->note = trim($comment);
|
$object->note = trim($comment);
|
||||||
$object->mail_valid = (boolean) trim($mail_valid);
|
$object->mail_valid = trim($mail_valid);
|
||||||
$object->vote = (boolean) trim($vote);
|
$object->vote = (boolean) trim($vote);
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
if ($ret < 0) $error++;
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
$object->update($user);
|
$ret=$object->update($user);
|
||||||
|
|
||||||
header("Location: ".$_SERVER["PHP_SELF"]."?rowid=".$_POST["rowid"]);
|
if ($ret >= 0 && ! count($object->errors))
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("MemberTypeModified"), null, 'mesgs');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
|
header("Location: ".$_SERVER["PHP_SELF"]."?rowid=".$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == 'delete' && $user->rights->adherent->configurer)
|
if ($action == 'confirm_delete' && $user->rights->adherent->configurer)
|
||||||
{
|
{
|
||||||
$object = new AdherentType($db);
|
$object->fetch($rowid);
|
||||||
$object->delete($rowid);
|
$res=$object->delete();
|
||||||
|
|
||||||
|
if ($res > 0)
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("MemberTypeDeleted"), null, 'mesgs');
|
||||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("MemberTypeCanNotBeDeleted"), null, 'errors');
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -308,13 +351,21 @@ if ($rowid > 0)
|
|||||||
{
|
{
|
||||||
$object = new AdherentType($db);
|
$object = new AdherentType($db);
|
||||||
$object->fetch($rowid);
|
$object->fetch($rowid);
|
||||||
$object->fetch_optionals($rowid,$extralabels);
|
$object->fetch_optionals($object->id,$extralabels);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Confirmation suppression
|
||||||
|
*/
|
||||||
|
if ($action == 'delete')
|
||||||
|
{
|
||||||
|
print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".$object->id,$langs->trans("DeleteAMemberType"),$langs->trans("ConfirmDeleteMemberType",$object->label),"confirm_delete", '',0,1);
|
||||||
|
}
|
||||||
|
|
||||||
$head = member_type_prepare_head($object);
|
$head = member_type_prepare_head($object);
|
||||||
|
|
||||||
dol_fiche_head($head, 'card', $langs->trans("MemberType"), -1, 'group');
|
dol_fiche_head($head, 'card', $langs->trans("MemberType"), -1, 'group');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'rowid', $linkback);
|
dol_banner_tab($object, 'rowid', $linkback);
|
||||||
|
|
||||||
@ -345,7 +396,6 @@ if ($rowid > 0)
|
|||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Buttons
|
* Buttons
|
||||||
*/
|
*/
|
||||||
@ -359,7 +409,7 @@ if ($rowid > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add
|
// Add
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&typeid='.$object->id.'">'.$langs->trans("AddMember").'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&typeid='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.$langs->trans("AddMember").'</a></div>';
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
if ($user->rights->adherent->configurer)
|
if ($user->rights->adherent->configurer)
|
||||||
@ -390,13 +440,13 @@ if ($rowid > 0)
|
|||||||
}
|
}
|
||||||
if ($status != '')
|
if ($status != '')
|
||||||
{
|
{
|
||||||
$sql.= " AND d.statut IN (".$status.")"; // Peut valoir un nombre ou liste de nombre separes par virgules
|
$sql.= " AND d.statut IN (".$db->escape($status).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
|
||||||
}
|
}
|
||||||
if ($action == 'search')
|
if ($action == 'search')
|
||||||
{
|
{
|
||||||
if (GETPOST('search'))
|
if (GETPOST('search'))
|
||||||
{
|
{
|
||||||
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search'));
|
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search','alpha'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! empty($search_lastname))
|
if (! empty($search_lastname))
|
||||||
@ -459,7 +509,7 @@ if ($rowid > 0)
|
|||||||
$titre.=" (".$membertype->label.")";
|
$titre.=" (".$membertype->label.")";
|
||||||
}
|
}
|
||||||
|
|
||||||
$param="&rowid=".$rowid;
|
$param="&rowid=".$object->id;
|
||||||
if (! empty($status)) $param.="&status=".$status;
|
if (! empty($status)) $param.="&status=".$status;
|
||||||
if (! empty($search_lastname)) $param.="&search_lastname=".$search_lastname;
|
if (! empty($search_lastname)) $param.="&search_lastname=".$search_lastname;
|
||||||
if (! empty($search_firstname)) $param.="&search_firstname=".$search_firstname;
|
if (! empty($search_firstname)) $param.="&search_firstname=".$search_firstname;
|
||||||
@ -473,7 +523,7 @@ if ($rowid > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
print '<input class="flat" type="hidden" name="rowid" value="'.$rowid.'" size="12"></td>';
|
print '<input class="flat" type="hidden" name="rowid" value="'.$object->id.'" size="12"></td>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
|
print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
|
||||||
@ -593,12 +643,12 @@ if ($rowid > 0)
|
|||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if ($user->rights->adherent->creer)
|
if ($user->rights->adherent->creer)
|
||||||
{
|
{
|
||||||
print '<a href="card.php?rowid='.$objp->rowid.'&action=edit&return=list.php">'.img_edit().'</a>';
|
print '<a href="card.php?rowid='.$objp->rowid.'&action=edit&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.img_edit().'</a>';
|
||||||
}
|
}
|
||||||
print ' ';
|
print ' ';
|
||||||
if ($user->rights->adherent->supprimer)
|
if ($user->rights->adherent->supprimer)
|
||||||
{
|
{
|
||||||
print '<a href="card.php?rowid='.$objp->rowid.'&action=resign&return=list.php">'.img_picto($langs->trans("Resiliate"),'disable.png').'</a>';
|
print '<a href="card.php?rowid='.$objp->rowid.'&action=resign">'.img_picto($langs->trans("Resiliate"),'disable.png').'</a>';
|
||||||
}
|
}
|
||||||
print "</td>";
|
print "</td>";
|
||||||
|
|
||||||
@ -631,15 +681,14 @@ if ($rowid > 0)
|
|||||||
if ($action == 'edit')
|
if ($action == 'edit')
|
||||||
{
|
{
|
||||||
$object = new AdherentType($db);
|
$object = new AdherentType($db);
|
||||||
$object->id = $rowid;
|
|
||||||
$object->fetch($rowid);
|
$object->fetch($rowid);
|
||||||
$object->fetch_optionals($rowid,$extralabels);
|
$object->fetch_optionals($object->id,$extralabels);
|
||||||
|
|
||||||
$head = member_type_prepare_head($object);
|
$head = member_type_prepare_head($object);
|
||||||
|
|
||||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'">';
|
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
print '<input type="hidden" name="rowid" value="'.$object->id.'">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
|
|
||||||
dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
|
dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
|
||||||
@ -706,7 +755,7 @@ if ($rowid > 0)
|
|||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="submit" name="button" class="button" value="'.$langs->trans("Cancel").'">';
|
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print "</form>";
|
print "</form>";
|
||||||
|
|||||||
191
htdocs/adherents/type_ldap.php
Normal file
191
htdocs/adherents/type_ldap.php
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2006-2017 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/adherents/type_ldap.php
|
||||||
|
* \ingroup ldap
|
||||||
|
* \brief Page fiche LDAP members types
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/ldap.lib.php';
|
||||||
|
|
||||||
|
$langs->load("members");
|
||||||
|
$langs->load("admin");
|
||||||
|
$langs->load("ldap");
|
||||||
|
|
||||||
|
$id = GETPOST('rowid', 'int');
|
||||||
|
$action = GETPOST('action','alpha');
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
$result=restrictedArea($user,'adherent',$id,'adherent_type');
|
||||||
|
|
||||||
|
$object = new AdherentType($db);
|
||||||
|
$object->fetch($id);
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
|
$hookmanager->initHooks(array('membertypeldapcard','globalcard'));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
if ($action == 'dolibarr2ldap')
|
||||||
|
{
|
||||||
|
$ldap = new Ldap();
|
||||||
|
$result = $ldap->connect_bind();
|
||||||
|
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$object->listMembersForMemberType();
|
||||||
|
|
||||||
|
$info = $object->_load_ldap_info();
|
||||||
|
$dn = $object->_load_ldap_dn($info);
|
||||||
|
$olddn = $dn; // We can say that old dn = dn as we force synchro
|
||||||
|
|
||||||
|
$result = $ldap->update($dn, $info, $user, $olddn);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($result >= 0) {
|
||||||
|
setEventMessages($langs->trans("MemberTypeSynchronized"), null, 'mesgs');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setEventMessages($ldap->error, $ldap->errors, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
llxHeader();
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
|
$head = member_type_prepare_head($object);
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'ldap', $langs->trans("MemberType"), -1, 'group');
|
||||||
|
|
||||||
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
|
dol_banner_tab($object, 'rowid', $linkback);
|
||||||
|
|
||||||
|
print '<div class="fichecenter">';
|
||||||
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
// LDAP DN
|
||||||
|
print '<tr><td>LDAP '.$langs->trans("LDAPMemberTypeDn").'</td><td class="valeur">'.$conf->global->LDAP_MEMBER_TYPE_DN."</td></tr>\n";
|
||||||
|
|
||||||
|
// LDAP Cle
|
||||||
|
print '<tr><td>LDAP '.$langs->trans("LDAPNamingAttribute").'</td><td class="valeur">'.$conf->global->LDAP_KEY_MEMBERS_TYPES."</td></tr>\n";
|
||||||
|
|
||||||
|
// LDAP Server
|
||||||
|
print '<tr><td>LDAP '.$langs->trans("Type").'</td><td class="valeur">'.$conf->global->LDAP_SERVER_TYPE."</td></tr>\n";
|
||||||
|
print '<tr><td>LDAP '.$langs->trans("Version").'</td><td class="valeur">'.$conf->global->LDAP_SERVER_PROTOCOLVERSION."</td></tr>\n";
|
||||||
|
print '<tr><td>LDAP '.$langs->trans("LDAPPrimaryServer").'</td><td class="valeur">'.$conf->global->LDAP_SERVER_HOST."</td></tr>\n";
|
||||||
|
print '<tr><td>LDAP '.$langs->trans("LDAPSecondaryServer").'</td><td class="valeur">'.$conf->global->LDAP_SERVER_HOST_SLAVE."</td></tr>\n";
|
||||||
|
print '<tr><td>LDAP '.$langs->trans("LDAPServerPort").'</td><td class="valeur">'.$conf->global->LDAP_SERVER_PORT."</td></tr>\n";
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Barre d'actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
|
if ($conf->global->LDAP_MEMBER_TYPE_ACTIVE == 1)
|
||||||
|
{
|
||||||
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</div>\n";
|
||||||
|
|
||||||
|
if ($conf->global->LDAP_MEMBER_TYPE_ACTIVE == 1) print "<br>\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Affichage attributs LDAP
|
||||||
|
print load_fiche_titre($langs->trans("LDAPInformationsForThisMemberType"));
|
||||||
|
|
||||||
|
print '<table width="100%" class="noborder">';
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans("LDAPAttributes").'</td>';
|
||||||
|
print '<td>'.$langs->trans("Value").'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Lecture LDAP
|
||||||
|
$ldap=new Ldap();
|
||||||
|
$result=$ldap->connect_bind();
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$info=$object->_load_ldap_info();
|
||||||
|
$dn=$object->_load_ldap_dn($info,1);
|
||||||
|
$search = "(".$object->_load_ldap_dn($info,2).")";
|
||||||
|
$records = $ldap->getAttribute($dn,$search);
|
||||||
|
|
||||||
|
//print_r($records);
|
||||||
|
|
||||||
|
// Affichage arbre
|
||||||
|
if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
|
||||||
|
{
|
||||||
|
if (! is_array($records))
|
||||||
|
{
|
||||||
|
print '<tr '.$bc[false].'><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result=show_ldap_content($records,0,$records['count'],true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<tr '.$bc[false].'><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$ldap->unbind();
|
||||||
|
$ldap->close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($ldap->error, $ldap->errors, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
@ -80,8 +80,7 @@ if ($action == "save" && empty($cancel))
|
|||||||
{
|
{
|
||||||
$param='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
|
$param='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
|
||||||
//print "param=".$param." - ".$_POST[$param];
|
//print "param=".$param." - ".$_POST[$param];
|
||||||
if (GETPOST($param,'alpha')) $res = dolibarr_set_const($db,$param,GETPOST($param,'alpha'),'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db,$param,(GETPOST($param,'alpha')?GETPOST($param,'alpha'):''),'chaine',0,'',$conf->entity);
|
||||||
else $res = dolibarr_del_const($db,$param,$conf->entity);
|
|
||||||
if (! $res > 0) $error++;
|
if (! $res > 0) $error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,6 +164,8 @@ if (! empty($triggers))
|
|||||||
if ($module == 'shipping') $module = 'expedition_bon';
|
if ($module == 'shipping') $module = 'expedition_bon';
|
||||||
if ($module == 'member') $module = 'adherent';
|
if ($module == 'member') $module = 'adherent';
|
||||||
if ($module == 'project') $module = 'projet';
|
if ($module == 'project') $module = 'projet';
|
||||||
|
if ($module == 'proposal_supplier') $module = 'supplier_proposal';
|
||||||
|
|
||||||
//print 'module='.$module.'<br>';
|
//print 'module='.$module.'<br>';
|
||||||
if (! empty($conf->$module->enabled))
|
if (! empty($conf->$module->enabled))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -373,11 +373,12 @@ $formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AG
|
|||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
// AGENDA_DEFAULT_FILTER_STATUS
|
// AGENDA_DEFAULT_FILTER_STATUS
|
||||||
|
// TODO Remove to use the default generic feature
|
||||||
print '<tr class="oddeven">'."\n";
|
print '<tr class="oddeven">'."\n";
|
||||||
print '<td>'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").'</td>'."\n";
|
print '<td>'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").'</td>'."\n";
|
||||||
print '<td align="center"> </td>'."\n";
|
print '<td align="center"> </td>'."\n";
|
||||||
print '<td align="right">'."\n";
|
print '<td align="right">'."\n";
|
||||||
$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2);
|
$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100');
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
// AGENDA_DEFAULT_VIEW
|
// AGENDA_DEFAULT_VIEW
|
||||||
|
|||||||
@ -399,7 +399,7 @@ print '</table>';
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '<br /><br />';
|
print '<br><br>';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
@ -45,11 +45,19 @@ if (! $user->admin) accessforbidden();
|
|||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
|
$contextpage=array('admincompany','globaladmin');
|
||||||
|
$hookmanager->initHooks($contextpage);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ($action == 'update' && empty($_POST["cancel"]))
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if ( ($action == 'update' && ! GETPOST("cancel",'alpha'))
|
||||||
|| ($action == 'updateedit') )
|
|| ($action == 'updateedit') )
|
||||||
{
|
{
|
||||||
$tmparray=getCountry(GETPOST('country_id','int'),'all',$db,$langs,0);
|
$tmparray=getCountry(GETPOST('country_id','int'),'all',$db,$langs,0);
|
||||||
@ -63,18 +71,18 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
|
|||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_COUNTRY", $s,'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_COUNTRY", $s,'chaine',0,'',$conf->entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM",$_POST["nom"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom",'nohtml'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS",$_POST["address"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("address",'nohtml'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN",$_POST["town"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("town",'nohtml'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP",$_POST["zipcode"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("zipcode",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE",$_POST["state_id"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", GETPOST("state_id",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_MONNAIE",$_POST["currency"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_MONNAIE", GETPOST("currency",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL",$_POST["tel"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL", GETPOST("tel",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX",$_POST["fax"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX", GETPOST("fax",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL",$_POST["mail"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL", GETPOST("mail",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB",$_POST["web"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB", GETPOST("web",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE",$_POST["note"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE", GETPOST("note",'none'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD",$_POST["barcode"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
$varforimage='logo'; $dirforimage=$conf->mycompany->dir_output.'/logos/';
|
$varforimage='logo'; $dirforimage=$conf->mycompany->dir_output.'/logos/';
|
||||||
if ($_FILES[$varforimage]["tmp_name"])
|
if ($_FILES[$varforimage]["tmp_name"])
|
||||||
@ -144,26 +152,26 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MANAGERS",$_POST["MAIN_INFO_SOCIETE_MANAGERS"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MANAGERS", GETPOST("MAIN_INFO_SOCIETE_MANAGERS",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_CAPITAL",$_POST["capital"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_CAPITAL", GETPOST("capital",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE",$_POST["forme_juridique_code"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE", GETPOST("forme_juridique_code",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SIREN",$_POST["siren"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SIREN", GETPOST("siren",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SIRET",$_POST["siret"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SIRET", GETPOST("siret",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_APE",$_POST["ape"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_APE", GETPOST("ape",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_RCS",$_POST["rcs"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_RCS", GETPOST("rcs",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_PROFID5",$_POST["MAIN_INFO_PROFID5"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_PROFID5", GETPOST("MAIN_INFO_PROFID5",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_PROFID6",$_POST["MAIN_INFO_PROFID6"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_PROFID6", GETPOST("MAIN_INFO_PROFID6",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",$_POST["tva"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT",$_POST["object"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT", GETPOST("object",'nohtml'),'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START",$_POST["fiscalmonthstart"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START", GETPOST("SOCIETE_FISCAL_MONTH_START",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
dolibarr_set_const($db, "FACTURE_TVAOPTION",$_POST["optiontva"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "FACTURE_TVAOPTION", GETPOST("optiontva",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
// Local taxes
|
// Local taxes
|
||||||
dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION",$_POST["optionlocaltax1"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION", GETPOST("optionlocaltax1",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION",$_POST["optionlocaltax2"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION", GETPOST("optionlocaltax2",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
if($_POST["optionlocaltax1"]=="localtax1on")
|
if($_POST["optionlocaltax1"]=="localtax1on")
|
||||||
{
|
{
|
||||||
@ -173,9 +181,9 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", GETPOST('lt1'),'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", GETPOST('lt1','alpha'),'chaine',0,'',$conf->entity);
|
||||||
}
|
}
|
||||||
dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC1", $_POST["clt1"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC1", GETPOST("clt1",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
}
|
}
|
||||||
if($_POST["optionlocaltax2"]=="localtax2on")
|
if($_POST["optionlocaltax2"]=="localtax2on")
|
||||||
{
|
{
|
||||||
@ -185,9 +193,9 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", GETPOST('lt2'),'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", GETPOST('lt2','alpha'),'chaine',0,'',$conf->entity);
|
||||||
}
|
}
|
||||||
dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC2", $_POST["clt2"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC2", GETPOST("clt2",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action != 'updateedit' && ! $error)
|
if ($action != 'updateedit' && ! $error)
|
||||||
@ -311,20 +319,20 @@ if ($action == 'edit' || $action == 'updateedit')
|
|||||||
// Name
|
// Name
|
||||||
|
|
||||||
print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
|
print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
|
||||||
print '<input name="nom" id="name" class="minwidth200" value="'. ($conf->global->MAIN_INFO_SOCIETE_NOM?$conf->global->MAIN_INFO_SOCIETE_NOM:$_POST["nom"]) . '" autofocus="autofocus"></td></tr>'."\n";
|
print '<input name="nom" id="name" class="minwidth200" value="'. ($conf->global->MAIN_INFO_SOCIETE_NOM?$conf->global->MAIN_INFO_SOCIETE_NOM: GETPOST("nom",'nohtml')) . '" autofocus="autofocus"></td></tr>'."\n";
|
||||||
|
|
||||||
// Addresse
|
// Addresse
|
||||||
|
|
||||||
print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';
|
print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';
|
||||||
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_SOCIETE_ADDRESS?$conf->global->MAIN_INFO_SOCIETE_ADDRESS:$_POST["address"]) . '</textarea></td></tr>'."\n";
|
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_SOCIETE_ADDRESS?$conf->global->MAIN_INFO_SOCIETE_ADDRESS: GETPOST("address",'nohtml')) . '</textarea></td></tr>'."\n";
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>';
|
print '<tr class="oddeven"><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>';
|
||||||
print '<input class="minwidth100" name="zipcode" id="zipcode" value="'. ($conf->global->MAIN_INFO_SOCIETE_ZIP?$conf->global->MAIN_INFO_SOCIETE_ZIP:$_POST["zipcode"]) . '"></td></tr>'."\n";
|
print '<input class="minwidth100" name="zipcode" id="zipcode" value="'. ($conf->global->MAIN_INFO_SOCIETE_ZIP?$conf->global->MAIN_INFO_SOCIETE_ZIP: GETPOST("zipcode",'alpha')) . '"></td></tr>'."\n";
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>';
|
print '<tr class="oddeven"><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>';
|
||||||
print '<input name="town" class="minwidth100" id="town" value="'. ($conf->global->MAIN_INFO_SOCIETE_TOWN?$conf->global->MAIN_INFO_SOCIETE_TOWN:$_POST["town"]) . '"></td></tr>'."\n";
|
print '<input name="town" class="minwidth100" id="town" value="'. ($conf->global->MAIN_INFO_SOCIETE_TOWN?$conf->global->MAIN_INFO_SOCIETE_TOWN: GETPOST("town",'nohtml')) . '"></td></tr>'."\n";
|
||||||
|
|
||||||
// Country
|
// Country
|
||||||
|
|
||||||
@ -394,7 +402,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
|||||||
// Note
|
// Note
|
||||||
|
|
||||||
print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';
|
print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';
|
||||||
print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(! empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? $conf->global->MAIN_INFO_SOCIETE_NOTE : '').'</textarea></td></tr>';
|
print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOST('note','none') ? GETPOST('note','none') : $conf->global->MAIN_INFO_SOCIETE_NOTE).'</textarea></td></tr>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -547,8 +555,8 @@ if ($action == 'edit' || $action == 'updateedit')
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td><label for="fiscalmonthstart">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
|
print '<tr class="oddeven"><td><label for="SOCIETE_FISCAL_MONTH_START">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
|
||||||
print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START,'fiscalmonthstart',0,1) . '</td></tr>';
|
print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START,'SOCIETE_FISCAL_MONTH_START',0,1) . '</td></tr>';
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
|
|||||||
@ -162,7 +162,7 @@ foreach ($list as $key)
|
|||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
print '<br /><br /><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
print '<br><br><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -69,8 +69,8 @@ $hookmanager->initHooks(array('admindefaultvalues','globaladmin'));
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array('socid'=>$socid);
|
$parameters=array('socid'=>$socid);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
@ -243,12 +243,13 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|||||||
print '<input type="hidden" id="action" name="action" value="">';
|
print '<input type="hidden" id="action" name="action" value="">';
|
||||||
print '<input type="hidden" id="mode" name="mode" value="'.dol_escape_htmltag($mode).'">';
|
print '<input type="hidden" id="mode" name="mode" value="'.dol_escape_htmltag($mode).'">';
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
// Page
|
// Page
|
||||||
$texthelp=$langs->trans("PageUrlForDefaultValues");
|
$texthelp=$langs->trans("PageUrlForDefaultValues");
|
||||||
if ($mode == 'createform') $texthelp.=$langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php');
|
if ($mode == 'createform') $texthelp.=$langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php', 'societe/card.php?abc=val1&def=val2');
|
||||||
else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php');
|
else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php', 'societe/card.php?abc=val1&def=val2');
|
||||||
$texturl=$form->textwithpicto($langs->trans("Url"), $texthelp);
|
$texturl=$form->textwithpicto($langs->trans("Url"), $texthelp);
|
||||||
print_liste_field_titre($texturl,$_SERVER["PHP_SELF"],'page,param','',$param,'',$sortfield,$sortorder);
|
print_liste_field_titre($texturl,$_SERVER["PHP_SELF"],'page,param','',$param,'',$sortfield,$sortorder);
|
||||||
// Field
|
// Field
|
||||||
@ -268,12 +269,12 @@ if ($mode != 'focus')
|
|||||||
{
|
{
|
||||||
if ($mode != 'sortorder')
|
if ($mode != 'sortorder')
|
||||||
{
|
{
|
||||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object')); // Must match list into GETPOST
|
$substitutionarray=getCommonSubstitutionArray($langs, 2, array('object','objectamount')); // Must match list into GETPOST
|
||||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
unset($substitutionarray['__USER_SIGNATURE__']);
|
||||||
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||||
foreach($substitutionarray as $key => $val)
|
foreach($substitutionarray as $key => $val)
|
||||||
{
|
{
|
||||||
$texthelp.=$key.'<br>';
|
$texthelp.=$key.' -> '.$val.'<br>';
|
||||||
}
|
}
|
||||||
$textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, ''); // No tooltip on click, this also triggers the sort click
|
$textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, ''); // No tooltip on click, this also triggers the sort click
|
||||||
}
|
}
|
||||||
@ -301,13 +302,13 @@ print '<input type="text" class="flat minwidth200 maxwidthonsmartphone" name="de
|
|||||||
print '</td>'."\n";
|
print '</td>'."\n";
|
||||||
// Field
|
// Field
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" class="flat maxwidth100" name="defaultkey" value="">';
|
print '<input type="text" class="flat maxwidth100onsmartphone" name="defaultkey" value="">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// Value
|
// Value
|
||||||
if ($mode != 'focus')
|
if ($mode != 'focus')
|
||||||
{
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" class="flat maxwidthonsmartphone" name="defaultvalue" value="">';
|
print '<input type="text" class="flat maxwidth100onsmartphone" name="defaultvalue" value="">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Limit to superadmin
|
// Limit to superadmin
|
||||||
@ -409,6 +410,7 @@ else
|
|||||||
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|||||||
@ -138,6 +138,16 @@ if ($action == 'update')
|
|||||||
}
|
}
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_DISABLE_METEO",$_POST["MAIN_DISABLE_METEO"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_DISABLE_METEO",$_POST["MAIN_DISABLE_METEO"],'chaine',0,'',$conf->entity);
|
||||||
|
dolibarr_set_const($db, "MAIN_USE_METEO_WITH_PERCENTAGE",GETPOST("MAIN_USE_METEO_WITH_PERCENTAGE"),'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
|
// For update value with percentage
|
||||||
|
$plus='';
|
||||||
|
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $plus = '_PERCENTAGE';
|
||||||
|
// Update values
|
||||||
|
for($i=0;$i<4;$i++) {
|
||||||
|
if(isset($_POST['MAIN_METEO'.$plus.'_LEVEL'.$i])) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'),'chaine',0,'',$conf->entity);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -196,13 +206,6 @@ if ($action == 'edit')
|
|||||||
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '</td></tr>';
|
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -244,21 +247,30 @@ else
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
// Boutons d'action
|
|
||||||
print '<div class="tabsAction">';
|
|
||||||
print '<a class="butAction" href="delais.php?action=edit">'.$langs->trans("Modify").'</a>';
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
// Show logo for weather
|
// Show logo for weather
|
||||||
print $langs->trans("DescWeather").'<br>';
|
print $langs->trans("DescWeather").'<br>';
|
||||||
|
|
||||||
|
if($action == 'edit') {
|
||||||
|
|
||||||
|
$str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->trans('MeteoPercentageMod'));
|
||||||
|
$str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->trans('MeteoStdMod'));
|
||||||
|
if(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std;
|
||||||
|
else $str_mode_enabled = $str_mode_percentage;
|
||||||
|
print '<a href="#" onclick="return false;" id="change_mode">'.$str_mode_enabled.'</a>';
|
||||||
|
print '<input type="hidden" id="MAIN_USE_METEO_WITH_PERCENTAGE" name="MAIN_USE_METEO_WITH_PERCENTAGE" value="'.$conf->global->MAIN_USE_METEO_WITH_PERCENTAGE.'" />';
|
||||||
|
|
||||||
|
print '<br><br>';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) print $langs->trans('MeteoStdModEnabled');
|
||||||
|
else print $langs->trans('MeteoPercentageModEnabled');
|
||||||
|
print '<br><br>';
|
||||||
|
}
|
||||||
|
|
||||||
$offset=0;
|
$offset=0;
|
||||||
$cursor=10; // By default
|
$cursor=10; // By default
|
||||||
//if (! empty($conf->global->MAIN_METEO_OFFSET)) $offset=$conf->global->MAIN_METEO_OFFSET;
|
//if (! empty($conf->global->MAIN_METEO_OFFSET)) $offset=$conf->global->MAIN_METEO_OFFSET;
|
||||||
@ -267,36 +279,143 @@ $level0=$offset; if (! empty($conf->global->MAIN_METEO_LEVEL0)) $level
|
|||||||
$level1=$offset+1*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL1)) $level1=$conf->global->MAIN_METEO_LEVEL1;
|
$level1=$offset+1*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL1)) $level1=$conf->global->MAIN_METEO_LEVEL1;
|
||||||
$level2=$offset+2*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL2)) $level2=$conf->global->MAIN_METEO_LEVEL2;
|
$level2=$offset+2*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL2)) $level2=$conf->global->MAIN_METEO_LEVEL2;
|
||||||
$level3=$offset+3*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL3)) $level3=$conf->global->MAIN_METEO_LEVEL3;
|
$level3=$offset+3*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL3)) $level3=$conf->global->MAIN_METEO_LEVEL3;
|
||||||
$text=''; $options='height="60px"';
|
$text=''; $options='class="valignmiddle" height="60px"';
|
||||||
print '<table>';
|
|
||||||
print '<tr>';
|
|
||||||
print '<td>';
|
if ($action == 'edit') {
|
||||||
|
|
||||||
|
|
||||||
|
print '<div id="standard" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '' : 'style="display:none;"').'>';
|
||||||
|
|
||||||
|
print '<div>';
|
||||||
|
print '<div class="inline-block" style="padding-right: 20px">';
|
||||||
print img_weather($text,'weather-clear.png', $options);
|
print img_weather($text,'weather-clear.png', $options);
|
||||||
print '</td><td>= '.$level0.'</td>';
|
print '= <input type="text" size="2" name="MAIN_METEO_LEVEL0" value="'.$level0.'"/></td>';
|
||||||
print '<td> </td>';
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
print '<td>';
|
|
||||||
print img_weather($text,'weather-few-clouds.png',$options);
|
print img_weather($text,'weather-few-clouds.png',$options);
|
||||||
print '</td><td><= '.$level1.'</td>';
|
print '<= <input type="text" size="2" name="MAIN_METEO_LEVEL1" value="'.$level1.'"/></td>';
|
||||||
print '<td> </td>';
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
print '<td>';
|
|
||||||
print img_weather($text,'weather-clouds.png',$options);
|
print img_weather($text,'weather-clouds.png',$options);
|
||||||
print '</td><td><= '.$level2.'</td>';
|
print '<= <input type="text" size="2" name="MAIN_METEO_LEVEL2" value="'.$level2.'"/></td>';
|
||||||
print '</tr>';
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
|
||||||
print '<tr><td>';
|
|
||||||
print img_weather($text,'weather-many-clouds.png',$options);
|
print img_weather($text,'weather-many-clouds.png',$options);
|
||||||
print '</td><td><= '.$level3.'</td>';
|
print '<= <input type="text" size="2" name="MAIN_METEO_LEVEL3" value="'.$level3.'"/></td>';
|
||||||
print '<td> </td>';
|
print '</div>';
|
||||||
print '<td>';
|
print '</div>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '<div id="percentage" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'style="display:none;"' : '').'>';
|
||||||
|
|
||||||
|
print '<div>';
|
||||||
|
print '<div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-clear.png',$options);
|
||||||
|
print '= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.'"/> %</td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-few-clouds.png',$options);
|
||||||
|
print '<= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL1" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.'"/> %</td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-clouds.png',$options);
|
||||||
|
print '<= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL2" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.'"/> %</td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-many-clouds.png',$options);
|
||||||
|
print '<= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL3" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.'"/> %</td>';
|
||||||
|
print '</div>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$("#change_mode").click(function() {
|
||||||
|
var use_percent = $("#MAIN_USE_METEO_WITH_PERCENTAGE");
|
||||||
|
var str_mode_std = "<?php print $str_mode_std; ?>";
|
||||||
|
var str_mode_percentage = "<?php print $str_mode_percentage; ?>";
|
||||||
|
|
||||||
|
if(use_percent.val() == 1) {
|
||||||
|
use_percent.val(0);
|
||||||
|
$("#standard").show();
|
||||||
|
$("#percentage").hide();
|
||||||
|
$(this).html(str_mode_std);
|
||||||
|
} else {
|
||||||
|
use_percent.val(1);
|
||||||
|
$("#standard").hide();
|
||||||
|
$("#percentage").show();
|
||||||
|
$(this).html(str_mode_percentage);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
|
||||||
|
|
||||||
|
print '<div>';
|
||||||
|
print '<div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-clear.png',$options);
|
||||||
|
print '= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.' %</td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-few-clouds.png',$options);
|
||||||
|
print '<= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.' %</td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-clouds.png',$options);
|
||||||
|
print '<= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.' %</td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-many-clouds.png',$options);
|
||||||
|
print '<= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.' %</td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
print img_weather($text,'weather-storm.png',$options);
|
print img_weather($text,'weather-storm.png',$options);
|
||||||
print '</td><td>> '.$level3.'</td>';
|
print '> '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.' %</td>';
|
||||||
print '<td> </td>';
|
print '</div>';
|
||||||
print '<td> </td>';
|
print '</div>';
|
||||||
print '<td> </td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
print '</table>';
|
} else {
|
||||||
|
|
||||||
|
print '<div>';
|
||||||
|
print '<div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-clear.png',$options);
|
||||||
|
print '= '.$level0;
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-few-clouds.png',$options);
|
||||||
|
print '<= '.$level1;
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-clouds.png',$options);
|
||||||
|
print '<= '.$level2;
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-many-clouds.png',$options);
|
||||||
|
print '<= '.$level3;
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-storm.png',$options);
|
||||||
|
print '> '.$level3;
|
||||||
|
print '</div>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
if($action == 'edit') {
|
||||||
|
|
||||||
|
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
|
||||||
|
print '<br></form>';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Boutons d'action
|
||||||
|
print '<br><div class="tabsAction">';
|
||||||
|
print '<a class="butAction" href="delais.php?action=edit">'.$langs->trans("Modify").'</a></div>';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
||||||
@ -54,6 +54,7 @@ $action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
|||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
$id=GETPOST('id','int');
|
$id=GETPOST('id','int');
|
||||||
$rowid=GETPOST('rowid','alpha');
|
$rowid=GETPOST('rowid','alpha');
|
||||||
|
$entity=GETPOST('entity','int');
|
||||||
$code=GETPOST('code','alpha');
|
$code=GETPOST('code','alpha');
|
||||||
|
|
||||||
$allowed=$user->admin;
|
$allowed=$user->admin;
|
||||||
@ -67,7 +68,7 @@ $actl[0] = img_picto($langs->trans("Disabled"),'switch_off');
|
|||||||
$actl[1] = img_picto($langs->trans("Activated"),'switch_on');
|
$actl[1] = img_picto($langs->trans("Activated"),'switch_on');
|
||||||
|
|
||||||
$listoffset=GETPOST('listoffset');
|
$listoffset=GETPOST('listoffset');
|
||||||
$listlimit=GETPOST('listlimit')>0?GETPOST('listlimit'):1000;
|
$listlimit=GETPOST('listlimit')>0?GETPOST('listlimit'):1000; // To avoid too long dictionaries
|
||||||
$active = 1;
|
$active = 1;
|
||||||
|
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
@ -181,8 +182,8 @@ $tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as
|
|||||||
$tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c";
|
$tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c";
|
||||||
$tabsql[10]= "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
|
$tabsql[10]= "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
|
||||||
$tabsql[11]= "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
|
$tabsql[11]= "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
|
||||||
$tabsql[12]= "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder FROM ".MAIN_DB_PREFIX.'c_payment_term AS c';
|
$tabsql[12]= "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity = " . getEntity($tabname[12]);
|
||||||
$tabsql[13]= "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.accountancy_code FROM ".MAIN_DB_PREFIX."c_paiement AS c";
|
$tabsql[13]= "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.accountancy_code, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity = " . getEntity($tabname[13]);
|
||||||
$tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.libelle, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1";
|
$tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.libelle, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1";
|
||||||
$tabsql[15]= "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format";
|
$tabsql[15]= "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format";
|
||||||
$tabsql[16]= "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
$tabsql[16]= "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
||||||
@ -259,8 +260,8 @@ $tabfield[8] = "code,libelle,country_id,country".(! empty($conf->global->SOCIETE
|
|||||||
$tabfield[9] = "code,label,unicode";
|
$tabfield[9] = "code,label,unicode";
|
||||||
$tabfield[10]= "country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
|
$tabfield[10]= "country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
|
||||||
$tabfield[11]= "element,source,code,libelle,position";
|
$tabfield[11]= "element,source,code,libelle,position";
|
||||||
$tabfield[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder";
|
$tabfield[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder,entity";
|
||||||
$tabfield[13]= "code,libelle,type,accountancy_code";
|
$tabfield[13]= "code,libelle,type,accountancy_code,entity";
|
||||||
$tabfield[14]= "code,libelle,price,organization,country_id,country";
|
$tabfield[14]= "code,libelle,price,organization,country_id,country";
|
||||||
$tabfield[15]= "code,libelle,width,height,unit";
|
$tabfield[15]= "code,libelle,width,height,unit";
|
||||||
$tabfield[16]= "code,libelle,sortorder";
|
$tabfield[16]= "code,libelle,sortorder";
|
||||||
@ -335,8 +336,8 @@ $tabfieldinsert[8] = "code,libelle,fk_country".(! empty($conf->global->SOCIETE_S
|
|||||||
$tabfieldinsert[9] = "code_iso,label,unicode";
|
$tabfieldinsert[9] = "code_iso,label,unicode";
|
||||||
$tabfieldinsert[10]= "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
|
$tabfieldinsert[10]= "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
|
||||||
$tabfieldinsert[11]= "element,source,code,libelle,position";
|
$tabfieldinsert[11]= "element,source,code,libelle,position";
|
||||||
$tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder";
|
$tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder,entity";
|
||||||
$tabfieldinsert[13]= "code,libelle,type,accountancy_code";
|
$tabfieldinsert[13]= "code,libelle,type,accountancy_code,entity";
|
||||||
$tabfieldinsert[14]= "code,libelle,price,organization,fk_pays";
|
$tabfieldinsert[14]= "code,libelle,price,organization,fk_pays";
|
||||||
$tabfieldinsert[15]= "code,label,width,height,unit";
|
$tabfieldinsert[15]= "code,label,width,height,unit";
|
||||||
$tabfieldinsert[16]= "code,label,sortorder";
|
$tabfieldinsert[16]= "code,label,sortorder";
|
||||||
@ -620,6 +621,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
|
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
|
||||||
if ($value == 'color' && empty($_POST['color'])) continue;
|
if ($value == 'color' && empty($_POST['color'])) continue;
|
||||||
if ($value == 'formula' && empty($_POST['formula'])) continue;
|
if ($value == 'formula' && empty($_POST['formula'])) continue;
|
||||||
|
if ($value == 'sortorder') continue; // For a column name 'sortorder', we use the field name 'position'
|
||||||
if ((! isset($_POST[$value]) || $_POST[$value]=='')
|
if ((! isset($_POST[$value]) || $_POST[$value]=='')
|
||||||
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy')) // Fields that are not mandatory
|
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy')) // Fields that are not mandatory
|
||||||
&& (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10
|
&& (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10
|
||||||
@ -662,7 +664,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||||
{
|
{
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
|
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2))
|
if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2))
|
||||||
@ -732,10 +734,14 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
||||||
}
|
}
|
||||||
else if ($value == 'entity') {
|
else if ($value == 'entity') {
|
||||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
$_POST[$listfieldvalue[$i]] = getEntity($tabname[$id]);
|
||||||
}
|
}
|
||||||
if ($i) $sql.=",";
|
if ($i) $sql.=",";
|
||||||
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
if ($listfieldvalue[$i] == 'sortorder') // For column name 'sortorder', we use the field name 'position'
|
||||||
|
{
|
||||||
|
$sql.="'".(int) $db->escape($_POST['position'])."'";
|
||||||
|
}
|
||||||
|
elseif ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
||||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -780,15 +786,20 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
||||||
}
|
}
|
||||||
else if ($field == 'entity') {
|
else if ($field == 'entity') {
|
||||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
$_POST[$listfieldvalue[$i]] = getEntity($tabname[$id]);
|
||||||
}
|
}
|
||||||
if ($i) $sql.=",";
|
if ($i) $sql.=",";
|
||||||
$sql.= $field."=";
|
$sql.= $field."=";
|
||||||
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
if ($listfieldvalue[$i] == 'sortorder') // For column name 'sortorder', we use the field name 'position'
|
||||||
|
{
|
||||||
|
$sql.="'".(int) $db->escape($_POST['position'])."'";
|
||||||
|
}
|
||||||
|
elseif ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
||||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
||||||
|
$sql.= " AND entity = '".getEntity($tabname[$id])."'";
|
||||||
|
|
||||||
dol_syslog("actionmodify", LOG_DEBUG);
|
dol_syslog("actionmodify", LOG_DEBUG);
|
||||||
//print $sql;
|
//print $sql;
|
||||||
@ -811,7 +822,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
|||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "DELETE FROM ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = " . (int) $entity : '');
|
||||||
|
|
||||||
dol_syslog("delete", LOG_DEBUG);
|
dol_syslog("delete", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -835,10 +846,10 @@ if ($action == $acts[0])
|
|||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = " . (int) $entity : '');
|
||||||
}
|
}
|
||||||
elseif ($code) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = " . (int) $entity : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -855,10 +866,10 @@ if ($action == $acts[1])
|
|||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = " . (int) $entity : '');
|
||||||
}
|
}
|
||||||
elseif ($code) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = " . (int) $entity : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -875,10 +886,10 @@ if ($action == 'activate_favorite')
|
|||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = " . (int) $entity : '');
|
||||||
}
|
}
|
||||||
elseif ($code) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = " . (int) $entity : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -895,10 +906,10 @@ if ($action == 'disable_favorite')
|
|||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = " . (int) $entity : '');
|
||||||
}
|
}
|
||||||
elseif ($code) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = " . (int) $entity : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -950,6 +961,7 @@ print "<br>\n";
|
|||||||
$param = '&id='.$id;
|
$param = '&id='.$id;
|
||||||
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
|
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
|
||||||
if ($search_code != '') $param.= '&search_code='.urlencode($search_country_id);
|
if ($search_code != '') $param.= '&search_code='.urlencode($search_country_id);
|
||||||
|
if ($entity != '') $param.= '&entity=' . (int) $entity;
|
||||||
$paramwithsearch = $param;
|
$paramwithsearch = $param;
|
||||||
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
||||||
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
||||||
@ -1007,15 +1019,22 @@ if ($id)
|
|||||||
if ($tabname[$id])
|
if ($tabname[$id])
|
||||||
{
|
{
|
||||||
$alabelisused=0;
|
$alabelisused=0;
|
||||||
|
$withentity=null;
|
||||||
|
|
||||||
$fieldlist=explode(',',$tabfield[$id]);
|
$fieldlist=explode(',',$tabfield[$id]);
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
// Line for title
|
// Line for title
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
|
if ($fieldlist[$field] == 'entity') {
|
||||||
|
$withentity = getEntity($tabname[$id]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Determine le nom du champ par rapport aux noms possibles
|
// Determine le nom du champ par rapport aux noms possibles
|
||||||
// dans les dictionnaires de donnees
|
// dans les dictionnaires de donnees
|
||||||
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
||||||
@ -1109,6 +1128,8 @@ if ($id)
|
|||||||
if ($id == 4) print '<td></td>';
|
if ($id == 4) print '<td></td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
|
if (! is_null($withentity))
|
||||||
|
print '<input type="hidden" name="entity" value="'.$withentity.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td style="min-width: 26px;"></td>';
|
print '<td style="min-width: 26px;"></td>';
|
||||||
print '<td style="min-width: 26px;"></td>';
|
print '<td style="min-width: 26px;"></td>';
|
||||||
@ -1141,7 +1162,7 @@ if ($id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($id == 4) print '<td></td>';
|
if ($id == 4) print '<td></td>';
|
||||||
print '<td colspan="3" align="right">';
|
print '<td colspan="3" align="center">';
|
||||||
if ($action != 'edit')
|
if ($action != 'edit')
|
||||||
{
|
{
|
||||||
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
|
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
|
||||||
@ -1153,11 +1174,7 @@ if ($id)
|
|||||||
if ($id == 4) $colspan++;
|
if ($id == 4) $colspan++;
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
/*if (! empty($alabelisused) && $id != 25) // If there is one label among fields, we show legend of *
|
|
||||||
{
|
|
||||||
print '* '.$langs->trans("LabelUsedByDefault").'.<br>';
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
@ -1177,11 +1194,13 @@ if ($id)
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
// There is several pages
|
// There is several pages
|
||||||
if ($num > $listlimit)
|
if ($num > $listlimit || $page)
|
||||||
{
|
{
|
||||||
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
|
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
|
||||||
|
print '<div class="clearboth"></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
// Title line with search boxes
|
// Title line with search boxes
|
||||||
@ -1189,7 +1208,9 @@ if ($id)
|
|||||||
$filterfound=0;
|
$filterfound=0;
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
$showfield=1; // By defaut
|
if ($fieldlist[$field] == 'entity') continue;
|
||||||
|
|
||||||
|
$showfield=1; // By default
|
||||||
|
|
||||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
||||||
|
|
||||||
@ -1231,6 +1252,8 @@ if ($id)
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
|
if ($fieldlist[$field] == 'entity') continue;
|
||||||
|
|
||||||
// Determine le nom du champ par rapport aux noms possibles
|
// Determine le nom du champ par rapport aux noms possibles
|
||||||
// dans les dictionnaires de donnees
|
// dans les dictionnaires de donnees
|
||||||
$showfield=1; // By defaut
|
$showfield=1; // By defaut
|
||||||
@ -1341,12 +1364,16 @@ if ($id)
|
|||||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||||
|
|
||||||
// Show fields
|
// Show fields
|
||||||
if (empty($reshook)) fieldList($fieldlist, $obj, $tabname[$id], 'edit');
|
if (empty($reshook)) {
|
||||||
|
$withentity = fieldList($fieldlist, $obj, $tabname[$id], 'edit');
|
||||||
|
}
|
||||||
|
|
||||||
print '<td colspan="3" align="center">';
|
print '<td colspan="3" align="center">';
|
||||||
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
|
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||||
|
if (! is_null($withentity))
|
||||||
|
print '<input type="hidden" name="entity" value="'.$withentity.'">';
|
||||||
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||||
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -1361,11 +1388,19 @@ if ($id)
|
|||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
|
$withentity=null;
|
||||||
|
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
$showfield=1;
|
$showfield=1;
|
||||||
$align="left";
|
$align="left";
|
||||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||||
|
|
||||||
|
if ($fieldlist[$field] == 'entity') {
|
||||||
|
$withentity = $valuetoshow;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ($value == 'element')
|
if ($value == 'element')
|
||||||
{
|
{
|
||||||
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
||||||
@ -1580,7 +1615,8 @@ if ($id)
|
|||||||
// If rowidcol not defined
|
// If rowidcol not defined
|
||||||
if (empty($rowidcol) || in_array($id, array(6,7,8,13,17,19,27))) $rowidcol='rowid';
|
if (empty($rowidcol) || in_array($id, array(6,7,8,13,17,19,27))) $rowidcol='rowid';
|
||||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.((! empty($obj->{$rowidcol}) || $obj->{$rowidcol} == '0')?$obj->{$rowidcol}:(! empty($obj->code)?urlencode($obj->code):'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
|
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.((! empty($obj->{$rowidcol}) || $obj->{$rowidcol} == '0')?$obj->{$rowidcol}:(! empty($obj->code)?urlencode($obj->code):'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
|
||||||
if ($param) $url .= '&'.$param;
|
if (! empty($param)) $url .= '&'.$param;
|
||||||
|
if (! is_null($withentity)) $url .= '&entity='.$withentity;
|
||||||
$url.='&';
|
$url.='&';
|
||||||
|
|
||||||
// Favorite
|
// Favorite
|
||||||
@ -1626,6 +1662,7 @@ if ($id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
@ -1641,6 +1678,8 @@ else
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$lastlineisempty=false;
|
$lastlineisempty=false;
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
//print '<td>'.$langs->trans("Module").'</td>';
|
//print '<td>'.$langs->trans("Module").'</td>';
|
||||||
@ -1693,6 +1732,7 @@ else
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -1709,7 +1749,7 @@ $db->close();
|
|||||||
* @param Object $obj If we show a particular record, obj is filled with record fields
|
* @param Object $obj If we show a particular record, obj is filled with record fields
|
||||||
* @param string $tabname Name of SQL table
|
* @param string $tabname Name of SQL table
|
||||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||||
* @return void
|
* @return string '' or value of entity into table
|
||||||
*/
|
*/
|
||||||
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||||
{
|
{
|
||||||
@ -1723,8 +1763,15 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
|||||||
$formcompany = new FormCompany($db);
|
$formcompany = new FormCompany($db);
|
||||||
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
|
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
|
||||||
|
|
||||||
|
$withentity='';
|
||||||
|
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
|
if ($fieldlist[$field] == 'entity') {
|
||||||
|
$withentity = $obj->{$fieldlist[$field]};
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (in_array($fieldlist[$field], array('code', 'libelle', 'type')) && $tabname == MAIN_DB_PREFIX."c_actioncomm" && in_array($obj->type, array('system','systemauto')))
|
if (in_array($fieldlist[$field], array('code', 'libelle', 'type')) && $tabname == MAIN_DB_PREFIX."c_actioncomm" && in_array($obj->type, array('system','systemauto')))
|
||||||
{
|
{
|
||||||
$hidden = (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'');
|
$hidden = (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'');
|
||||||
@ -1900,6 +1947,8 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if ($fieldlist[$field]=='sortorder') $fieldlist[$field]='position';
|
||||||
|
|
||||||
$classtd=''; $class='';
|
$classtd=''; $class='';
|
||||||
if ($fieldlist[$field]=='code') $classtd='width100';
|
if ($fieldlist[$field]=='code') $classtd='width100';
|
||||||
if ($fieldlist[$field]=='affect') $class='maxwidth50';
|
if ($fieldlist[$field]=='affect') $class='maxwidth50';
|
||||||
@ -1934,5 +1983,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $withentity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -42,7 +42,7 @@ if (!$res) die("Include of main fails");
|
|||||||
global $lang, $user, $conf;
|
global $lang, $user, $conf;
|
||||||
|
|
||||||
|
|
||||||
dol_include_once('/dolistore/class/dolistore.class.php');
|
require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php';
|
||||||
$dolistore = new Dolistore();
|
$dolistore = new Dolistore();
|
||||||
|
|
||||||
$id_product = GETPOST('id_product', 'int');
|
$id_product = GETPOST('id_product', 'int');
|
||||||
@ -65,3 +65,4 @@ try {
|
|||||||
else if ($trace[0]['args'][0] == 401) die('Bad auth key');
|
else if ($trace[0]['args'][0] == 401) die('Bad auth key');
|
||||||
else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV);
|
else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -48,6 +48,7 @@ class PrestaShopWebservice
|
|||||||
const PSCOMPATIBLEVERSIONMIN = '1.4.0.0';
|
const PSCOMPATIBLEVERSIONMIN = '1.4.0.0';
|
||||||
const PSCOMPATIBLEVERSIONMAX = '1.6.99.99';
|
const PSCOMPATIBLEVERSIONMAX = '1.6.99.99';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PrestaShopWebservice constructor. Throw an exception when CURL is not installed/activated
|
* PrestaShopWebservice constructor. Throw an exception when CURL is not installed/activated
|
||||||
* <code>
|
* <code>
|
||||||
@ -79,6 +80,7 @@ class PrestaShopWebservice
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Take the status code and throw an exception if the server didn't return 200 or 201 code
|
* Take the status code and throw an exception if the server didn't return 200 or 201 code
|
||||||
|
*
|
||||||
* @param int $status_code Status code of an HTTP return
|
* @param int $status_code Status code of an HTTP return
|
||||||
*/
|
*/
|
||||||
protected function checkStatusCode($status_code)
|
protected function checkStatusCode($status_code)
|
||||||
@ -86,18 +88,29 @@ class PrestaShopWebservice
|
|||||||
$error_label = 'This call to PrestaShop Web Services failed and returned an HTTP status of %d. That means: %s.';
|
$error_label = 'This call to PrestaShop Web Services failed and returned an HTTP status of %d. That means: %s.';
|
||||||
switch($status_code)
|
switch($status_code)
|
||||||
{
|
{
|
||||||
case 200: case 201: break;
|
case 200:
|
||||||
case 204: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'No content'));break;
|
case 201:
|
||||||
case 400: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Bad Request'));break;
|
break;
|
||||||
case 401: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Unauthorized'));break;
|
case 204:
|
||||||
case 404: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Not Found'));break;
|
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'No content'));
|
||||||
case 405: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Method Not Allowed'));break;
|
case 400:
|
||||||
case 500: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Internal Server Error'));break;
|
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Bad Request'));
|
||||||
default: throw new PrestaShopWebserviceException('This call to PrestaShop Web Services returned an unexpected HTTP status of:' . $status_code);
|
case 401:
|
||||||
|
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Unauthorized'));
|
||||||
|
case 404:
|
||||||
|
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Not Found'));
|
||||||
|
case 405:
|
||||||
|
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Method Not Allowed'));
|
||||||
|
case 500:
|
||||||
|
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Internal Server Error'));
|
||||||
|
default:
|
||||||
|
throw new PrestaShopWebserviceException('This call to PrestaShop Web Services returned an unexpected HTTP status of:' . $status_code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles a CURL request to PrestaShop Webservice. Can throw exception.
|
* Handles a CURL request to PrestaShop Webservice. Can throw exception.
|
||||||
|
*
|
||||||
* @param string $url Resource name
|
* @param string $url Resource name
|
||||||
* @param mixed $curl_params CURL parameters (sent to curl_set_opt)
|
* @param mixed $curl_params CURL parameters (sent to curl_set_opt)
|
||||||
* @return array status_code, response
|
* @return array status_code, response
|
||||||
@ -178,11 +191,23 @@ class PrestaShopWebservice
|
|||||||
return array('status_code' => $status_code, 'response' => $body, 'header' => $header);
|
return array('status_code' => $status_code, 'response' => $body, 'header' => $header);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output debug info
|
||||||
|
*
|
||||||
|
* @param string $title Title
|
||||||
|
* @param string $content Content
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function printDebug($title, $content)
|
public function printDebug($title, $content)
|
||||||
{
|
{
|
||||||
echo '<div style="display:table;background:#CCC;font-size:8pt;padding:7px"><h6 style="font-size:9pt;margin:0">'.$title.'</h6><pre>'.htmlentities($content).'</pre></div>';
|
echo '<div style="display:table;background:#CCC;font-size:8pt;padding:7px"><h6 style="font-size:9pt;margin:0">'.$title.'</h6><pre>'.htmlentities($content).'</pre></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return version
|
||||||
|
*
|
||||||
|
* @return string Version
|
||||||
|
*/
|
||||||
public function getVersion()
|
public function getVersion()
|
||||||
{
|
{
|
||||||
return $this->version;
|
return $this->version;
|
||||||
@ -190,6 +215,7 @@ class PrestaShopWebservice
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load XML from string. Can throw exception
|
* Load XML from string. Can throw exception
|
||||||
|
*
|
||||||
* @param string $response String from a CURL response
|
* @param string $response String from a CURL response
|
||||||
* @return SimpleXMLElement status_code, response
|
* @return SimpleXMLElement status_code, response
|
||||||
*/
|
*/
|
||||||
@ -260,7 +286,7 @@ class PrestaShopWebservice
|
|||||||
* $xml = $ws->get(array('resource' => 'orders', 'id' => 1));
|
* $xml = $ws->get(array('resource' => 'orders', 'id' => 1));
|
||||||
* // Here in $xml, a SimpleXMLElement object you can parse
|
* // Here in $xml, a SimpleXMLElement object you can parse
|
||||||
* foreach ($xml->children()->children() as $attName => $attValue)
|
* foreach ($xml->children()->children() as $attName => $attValue)
|
||||||
* echo $attName.' = '.$attValue.'<br />';
|
* echo $attName.' = '.$attValue.'<br>';
|
||||||
* }
|
* }
|
||||||
* catch (PrestaShopWebserviceException $ex)
|
* catch (PrestaShopWebserviceException $ex)
|
||||||
* {
|
* {
|
||||||
@ -336,7 +362,9 @@ class PrestaShopWebservice
|
|||||||
* 'id' => ID of a resource you want to edit,<br>
|
* 'id' => ID of a resource you want to edit,<br>
|
||||||
* 'putXml' => Modified XML string of a resource<br><br>
|
* 'putXml' => Modified XML string of a resource<br><br>
|
||||||
* Examples are given in the tutorial</p>
|
* Examples are given in the tutorial</p>
|
||||||
|
*
|
||||||
* @param array $options Array representing resource to edit.
|
* @param array $options Array representing resource to edit.
|
||||||
|
* @return SimpleXMLElement status_code, response
|
||||||
*/
|
*/
|
||||||
public function edit($options)
|
public function edit($options)
|
||||||
{
|
{
|
||||||
@ -359,49 +387,6 @@ class PrestaShopWebservice
|
|||||||
self::checkStatusCode($request['status_code']);// check the response validity
|
self::checkStatusCode($request['status_code']);// check the response validity
|
||||||
return self::parseXML($request['response']);
|
return self::parseXML($request['response']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete (DELETE) a resource.
|
|
||||||
* Unique parameter must take : <br><br>
|
|
||||||
* 'resource' => Resource name<br>
|
|
||||||
* 'id' => ID or array which contains IDs of a resource(s) you want to delete<br><br>
|
|
||||||
* <code>
|
|
||||||
* <?php
|
|
||||||
* require_once('./PrestaShopWebservice.php');
|
|
||||||
* try
|
|
||||||
* {
|
|
||||||
* $ws = new PrestaShopWebservice('http://mystore.com/', 'ZQ88PRJX5VWQHCWE4EE7SQ7HPNX00RAJ', false);
|
|
||||||
* $xml = $ws->delete(array('resource' => 'orders', 'id' => 1));
|
|
||||||
* // Following code will not be executed if an exception is thrown.
|
|
||||||
* echo 'Successfully deleted.';
|
|
||||||
* }
|
|
||||||
* catch (PrestaShopWebserviceException $ex)
|
|
||||||
* {
|
|
||||||
* echo 'Error : '.$ex->getMessage();
|
|
||||||
* }
|
|
||||||
* ?>
|
|
||||||
* </code>
|
|
||||||
* @param array $options Array representing resource to delete.
|
|
||||||
*/
|
|
||||||
public function delete($options)
|
|
||||||
{
|
|
||||||
if (isset($options['url']))
|
|
||||||
$url = $options['url'];
|
|
||||||
elseif (isset($options['resource']) && isset($options['id']))
|
|
||||||
if (is_array($options['id']))
|
|
||||||
$url = $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']';
|
|
||||||
else
|
|
||||||
$url = $this->url.'/api/'.$options['resource'].'/'.$options['id'];
|
|
||||||
if (isset($options['id_shop']))
|
|
||||||
$url .= '&id_shop='.$options['id_shop'];
|
|
||||||
if (isset($options['id_group_shop']))
|
|
||||||
$url .= '&id_group_shop='.$options['id_group_shop'];
|
|
||||||
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE'));
|
|
||||||
self::checkStatusCode($request['status_code']);// check the response validity
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -19,10 +19,11 @@
|
|||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class DolistoreModel
|
* Class Dolistore
|
||||||
*/
|
*/
|
||||||
class Dolistore extends DolistoreModel
|
class Dolistore
|
||||||
{
|
{
|
||||||
// params
|
// params
|
||||||
public $start // beginning of pagination
|
public $start // beginning of pagination
|
||||||
@ -37,7 +38,33 @@ class Dolistore extends DolistoreModel
|
|||||||
, $lang // the integer representing the lang in the store
|
, $lang // the integer representing the lang in the store
|
||||||
, $debug_api; // usefull if no dialog
|
, $debug_api; // usefull if no dialog
|
||||||
|
|
||||||
function __construct($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0))
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
|
||||||
|
$this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace';
|
||||||
|
$this->shop_url = 'https://www.dolistore.com/index.php?controller=product&id_product=';
|
||||||
|
$this->vat_rate = 1.2; // 20% de TVA
|
||||||
|
$this->debug_api = false;
|
||||||
|
|
||||||
|
$langtmp = explode('_', $langs->defaultlang);
|
||||||
|
$lang = $langtmp[0];
|
||||||
|
$lang_array = array('en'=>0, 'fr'=>1, 'es'=>2, 'it'=>3, 'de'=>4); // Into table ps_lang of Prestashop - 1
|
||||||
|
if (! in_array($lang, array_keys($lang_array))) $lang = 'en';
|
||||||
|
$this->lang = $lang_array[$lang];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load data from remote Dolistore market place.
|
||||||
|
* This fills ->categories
|
||||||
|
*
|
||||||
|
* @param array $options Options
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function getRemoteData($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0))
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
@ -47,21 +74,10 @@ class Dolistore extends DolistoreModel
|
|||||||
$this->categorie = $options['categorie'];
|
$this->categorie = $options['categorie'];
|
||||||
$this->search = $options['search'];
|
$this->search = $options['search'];
|
||||||
|
|
||||||
$this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace';
|
|
||||||
$this->shop_url = 'https://www.dolistore.com/index.php?controller=product&id_product=';
|
|
||||||
$this->vat_rate = 1.2; // 20% de TVA
|
|
||||||
$this->debug_api = false;
|
|
||||||
|
|
||||||
if ($this->end == 0) {
|
if ($this->end == 0) {
|
||||||
$this->end = $this->per_page;
|
$this->end = $this->per_page;
|
||||||
}
|
}
|
||||||
|
|
||||||
$langtmp = explode('_', $langs->defaultlang);
|
|
||||||
$lang = $langtmp[0];
|
|
||||||
$lang_array = array('fr'=>1, 'en'=>2, 'es'=>3, 'it'=>4, 'de'=>5);
|
|
||||||
if (! in_array($lang, array_keys($lang_array))) $lang = 'en';
|
|
||||||
$this->lang = $lang_array[$lang]; // 1=fr 2=en ...
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV,
|
$this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV,
|
||||||
$conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api);
|
$conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api);
|
||||||
@ -69,6 +85,7 @@ class Dolistore extends DolistoreModel
|
|||||||
// Here we set the option array for the Webservice : we want products resources
|
// Here we set the option array for the Webservice : we want products resources
|
||||||
$opt = array();
|
$opt = array();
|
||||||
$opt['resource'] = 'products';
|
$opt['resource'] = 'products';
|
||||||
|
|
||||||
// make a search to limit the id returned.
|
// make a search to limit the id returned.
|
||||||
if ($this->search != '') {
|
if ($this->search != '') {
|
||||||
$opt2 = array();
|
$opt2 = array();
|
||||||
@ -96,7 +113,9 @@ class Dolistore extends DolistoreModel
|
|||||||
$opt['sort'] = 'id_desc';
|
$opt['sort'] = 'id_desc';
|
||||||
$opt['filter[active]'] = '[1]';
|
$opt['filter[active]'] = '[1]';
|
||||||
$opt['limit'] = "$this->start,$this->end";
|
$opt['limit'] = "$this->start,$this->end";
|
||||||
// Call
|
// $opt['filter[id]'] contais list of product id that are result of search
|
||||||
|
|
||||||
|
// Call API to get the detail
|
||||||
$xml = $this->api->get($opt);
|
$xml = $this->api->get($opt);
|
||||||
$this->products = $xml->products->children();
|
$this->products = $xml->products->children();
|
||||||
|
|
||||||
@ -118,6 +137,144 @@ class Dolistore extends DolistoreModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return tree of Dolistore categories. $this->categories must have been loaded before.
|
||||||
|
*
|
||||||
|
* @param int $parent Id of parent category
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function get_categories($parent = 0)
|
||||||
|
{
|
||||||
|
if (!isset($this->categories)) die('not possible');
|
||||||
|
if ($parent != 0) {
|
||||||
|
$html = '<ul>';
|
||||||
|
} else {
|
||||||
|
$html = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$nbofcateg = count($this->categories);
|
||||||
|
for ($i = 0; $i < $nbofcateg; $i++)
|
||||||
|
{
|
||||||
|
$cat = $this->categories[$i];
|
||||||
|
if ($cat->is_root_category == 1 && $parent == 0) {
|
||||||
|
$html .= '<li class="root"><h3 class="nomargesupinf"><a class="nomargesupinf link2cat" href="?mode=marketplace&categorie='.$cat->id.'" '
|
||||||
|
.'title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'"'
|
||||||
|
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a></h3>';
|
||||||
|
$html .= self::get_categories($cat->id);
|
||||||
|
$html .= "</li>\n";
|
||||||
|
} elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau
|
||||||
|
$select = ($cat->id == $this->categorie) ? ' selected' : '';
|
||||||
|
$html .= '<li><a class="link2cat'.$select.'" href="?mode=marketplace&categorie='.$cat->id.'"'
|
||||||
|
.' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'" '
|
||||||
|
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a>';
|
||||||
|
$html .= self::get_categories($cat->id);
|
||||||
|
$html .= "</li>\n";
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($html == '<ul>') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
if ($parent != 0) {
|
||||||
|
return $html.'</ul>';
|
||||||
|
} else {
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return list of product formated for output
|
||||||
|
*
|
||||||
|
* @return string HTML output
|
||||||
|
*/
|
||||||
|
function get_products()
|
||||||
|
{
|
||||||
|
global $langs, $conf;
|
||||||
|
$html = "";
|
||||||
|
$parity = "pair";
|
||||||
|
$last_month = time() - (30 * 24 * 60 * 60);
|
||||||
|
foreach ($this->products as $product) {
|
||||||
|
$parity = ($parity == "impair") ? 'pair' : 'impair';
|
||||||
|
|
||||||
|
// check new product ?
|
||||||
|
$newapp = '';
|
||||||
|
if ($last_month < strtotime($product->date_add)) {
|
||||||
|
$newapp .= '<span class="newApp">'.$langs->trans('New').'</span> ';
|
||||||
|
}
|
||||||
|
|
||||||
|
// check updated ?
|
||||||
|
if ($last_month < strtotime($product->date_upd) && $newapp == '') {
|
||||||
|
$newapp .= '<span class="updatedApp">'.$langs->trans('Updated').'</span> ';
|
||||||
|
}
|
||||||
|
|
||||||
|
// add image or default ?
|
||||||
|
if ($product->id_default_image != '') {
|
||||||
|
$image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.$product->id.'&id_image='.$product->id_default_image;
|
||||||
|
$images = '<a href="'.$image_url.'" class="fancybox" rel="gallery'.$product->id.'" title="'.$product->name->language[$this->lang].', '.$langs->trans('Version').' '.$product->module_version.'">'.
|
||||||
|
'<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
|
||||||
|
} else {
|
||||||
|
$images = '<img src="'.DOL_URL_ROOT.'/admin/dolistore/img/NoImageAvailable.png" />';
|
||||||
|
}
|
||||||
|
|
||||||
|
// free or pay ?
|
||||||
|
if ($product->price > 0) {
|
||||||
|
$price = '<h3>'.price(round((float) $product->price * $this->vat_rate, 2)).' €</h3>';
|
||||||
|
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
|
||||||
|
} else {
|
||||||
|
$price = '<h3>'.$langs->trans('Free').'</h3>';
|
||||||
|
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/Download-128.png" /></a>';
|
||||||
|
$download_link.= '<br><br><a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
//checking versions
|
||||||
|
if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) {
|
||||||
|
if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) {
|
||||||
|
//compatible
|
||||||
|
$version = '<span class="compatible">'.$langs->trans('CompatibleUpTo', $product->dolibarr_max,
|
||||||
|
$product->dolibarr_min, $product->dolibarr_max).'</span>';
|
||||||
|
$compatible = '';
|
||||||
|
} else {
|
||||||
|
//never compatible, module expired
|
||||||
|
$version = '<span class="notcompatible">'.$langs->trans('NotCompatible', DOL_VERSION,
|
||||||
|
$product->dolibarr_min, $product->dolibarr_max).'</span>';
|
||||||
|
$compatible = 'NotCompatible';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//need update
|
||||||
|
$version = '<span class="compatibleafterupdate">'.$langs->trans('CompatibleAfterUpdate', DOL_VERSION,
|
||||||
|
$product->dolibarr_min, $product->dolibarr_max).'</span>';
|
||||||
|
$compatible = 'NotCompatible';
|
||||||
|
}
|
||||||
|
|
||||||
|
//.'<br><a class="inline-block valignmiddle" target="_blank" href="'.$this->shop_url.$product->id.'"><span class="details button">'.$langs->trans("SeeInMarkerPlace").'</span></a>
|
||||||
|
|
||||||
|
//output template
|
||||||
|
$html .= '<tr class="app '.$parity.' '.$compatible.'">
|
||||||
|
<td align="center" width="210"><div class="newAppParent">'.$newapp.$images.'</div></td>
|
||||||
|
<td class="margeCote"><h2 class="appTitle">'.$product->name->language[$this->lang]
|
||||||
|
.'<br/><small>'.$version.'</small></h2>
|
||||||
|
<small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'</small><br><br>'.$product->description_short->language[$this->lang].'</td>
|
||||||
|
<td style="display:none;" class="long_description">'.$product->description->language[$this->lang].'</td>
|
||||||
|
<td class="margeCote" align="center">'.$price.'
|
||||||
|
</td>
|
||||||
|
<td class="margeCote">'.$download_link.'</td>
|
||||||
|
</tr>';
|
||||||
|
}
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_previous_link($text = '<<')
|
||||||
|
{
|
||||||
|
return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_next_link($text = '>>')
|
||||||
|
{
|
||||||
|
return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
function get_previous_url()
|
function get_previous_url()
|
||||||
{
|
{
|
||||||
$param_array = array();
|
$param_array = array();
|
||||||
@ -182,135 +339,3 @@ class Dolistore extends DolistoreModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class DolistoreModel
|
|
||||||
*/
|
|
||||||
class DolistoreModel
|
|
||||||
{
|
|
||||||
|
|
||||||
function get_categories($parent = 0)
|
|
||||||
{
|
|
||||||
if (!isset($this->categories)) die('not possible');
|
|
||||||
if ($parent != 0) {
|
|
||||||
$html = '<ul>';
|
|
||||||
} else {
|
|
||||||
$html = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$nbofcateg = count($this->categories);
|
|
||||||
for ($i = 0; $i < $nbofcateg; $i++)
|
|
||||||
{
|
|
||||||
$cat = $this->categories[$i];
|
|
||||||
if ($cat->is_root_category == 1 && $parent == 0) {
|
|
||||||
$html .= '<li class="root"><h3 class="nomargesupinf"><a class="nomargesupinf link2cat" href="?mode=marketplace&categorie='.$cat->id.'" '
|
|
||||||
.'title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'"'
|
|
||||||
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a></h3>';
|
|
||||||
$html .= self::get_categories($cat->id);
|
|
||||||
$html .= "</li>\n";
|
|
||||||
} elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau
|
|
||||||
$select = ($cat->id == $this->categorie) ? ' selected' : '';
|
|
||||||
$html .= '<li><a class="link2cat'.$select.'" href="?mode=marketplace&categorie='.$cat->id.'"'
|
|
||||||
.' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'" '
|
|
||||||
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a>';
|
|
||||||
$html .= self::get_categories($cat->id);
|
|
||||||
$html .= "</li>\n";
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($html == '<ul>') {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
if ($parent != 0) {
|
|
||||||
return $html.'</ul>';
|
|
||||||
} else {
|
|
||||||
return $html;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_products()
|
|
||||||
{
|
|
||||||
global $langs, $conf;
|
|
||||||
$html = "";
|
|
||||||
$parity = "pair";
|
|
||||||
$last_month = time() - (30 * 24 * 60 * 60);
|
|
||||||
foreach ($this->products as $product) {
|
|
||||||
$parity = ($parity == "impair") ? 'pair' : 'impair';
|
|
||||||
|
|
||||||
// check new product ?
|
|
||||||
$newapp = '';
|
|
||||||
if ($last_month < strtotime($product->date_add)) {
|
|
||||||
$newapp .= '<span class="newApp">'.$langs->trans('New').'</span> ';
|
|
||||||
}
|
|
||||||
|
|
||||||
// check updated ?
|
|
||||||
if ($last_month < strtotime($product->date_upd) && $newapp == '') {
|
|
||||||
$newapp .= '<span class="updatedApp">'.$langs->trans('Updated').'</span> ';
|
|
||||||
}
|
|
||||||
|
|
||||||
// add image or default ?
|
|
||||||
if ($product->id_default_image != '') {
|
|
||||||
$image_url = dol_buildPath('/dolistore/ajax/image.php?id_product=', 2).$product->id.'&id_image='.$product->id_default_image;
|
|
||||||
$images = '<a href="'.$image_url.'" class="fancybox" rel="gallery'.$product->id.'" title="'.$product->name->language[$this->lang].', '.$langs->trans('Version').' '.$product->module_version.'">'.
|
|
||||||
'<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
|
|
||||||
} else {
|
|
||||||
$images = '<img src="'.dol_buildPath('/dolistore/img/NoImageAvailable.png', 2).'" />';
|
|
||||||
}
|
|
||||||
|
|
||||||
// free or pay ?
|
|
||||||
if ($product->price > 0) {
|
|
||||||
$price = '<h3>'.price(round((float) $product->price * $this->vat_rate, 2)).' €</h3>';
|
|
||||||
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.dol_buildPath('/dolistore/img/follow.png',
|
|
||||||
2).'" /></a>';
|
|
||||||
} else {
|
|
||||||
$price = $langs->trans('Free');
|
|
||||||
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.dol_buildPath('/dolistore/img/Download-128.png',
|
|
||||||
2).'" /></a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
//checking versions
|
|
||||||
if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) {
|
|
||||||
if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) {
|
|
||||||
//compatible
|
|
||||||
$version = '<span class="compatible">'.$langs->trans('CompatibleUpTo', $product->dolibarr_max,
|
|
||||||
$product->dolibarr_min, $product->dolibarr_max).'</span>';
|
|
||||||
$compatible = '';
|
|
||||||
} else {
|
|
||||||
//never compatible, module expired
|
|
||||||
$version = '<span class="notcompatible">'.$langs->trans('NotCompatible', DOL_VERSION,
|
|
||||||
$product->dolibarr_min, $product->dolibarr_max).'</span>';
|
|
||||||
$compatible = 'NotCompatible';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//need update
|
|
||||||
$version = '<span class="compatibleafterupdate">'.$langs->trans('CompatibleAfterUpdate', DOL_VERSION,
|
|
||||||
$product->dolibarr_min, $product->dolibarr_max).'</span>';
|
|
||||||
$compatible = 'NotCompatible';
|
|
||||||
}
|
|
||||||
|
|
||||||
//output template
|
|
||||||
$html .= '<tr class="app '.$parity.' '.$compatible.'">
|
|
||||||
<td align="center" width="210"><div class="newAppParent">'.$newapp.$images.'</div></td>
|
|
||||||
<td class="margeCote"><h2 class="appTitle"><a target="_blank" href="'.$this->shop_url.$product->id.'">'.$product->name->language[$this->lang].'</a><span class="details button">Details</span>'
|
|
||||||
.'<br/><small>'.$version.'</small></h2>
|
|
||||||
<small> '.dol_print_date(strtotime($product->date_upd)).' - '.$langs->trans('Référence').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'</small><br><br>'.$product->description_short->language[$this->lang].'</td>
|
|
||||||
<td style="display:none;" class="long_description">'.$product->description->language[$this->lang].'</td>
|
|
||||||
<td class="margeCote" align="right">'.$price.'</td>
|
|
||||||
<td class="margeCote">'.$download_link.'</td>
|
|
||||||
</tr>';
|
|
||||||
}
|
|
||||||
return $html;
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_previous_link($text = '<<')
|
|
||||||
{
|
|
||||||
return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_next_link($text = '>>')
|
|
||||||
{
|
|
||||||
return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,72 +0,0 @@
|
|||||||
<html><head><title>CRUD Tutorial - Customer's list</title></head><body>
|
|
||||||
<?php
|
|
||||||
/*
|
|
||||||
* 2007-2013 PrestaShop
|
|
||||||
*
|
|
||||||
* NOTICE OF LICENSE
|
|
||||||
*
|
|
||||||
* This source file is subject to the Open Software License (OSL 3.0)
|
|
||||||
* that is bundled with this package in the file LICENSE.txt.
|
|
||||||
* It is also available through the world-wide-web at this URL:
|
|
||||||
* http://opensource.org/licenses/osl-3.0.php
|
|
||||||
* If you did not receive a copy of the license and are unable to
|
|
||||||
* obtain it through the world-wide-web, please send an email
|
|
||||||
* to license@prestashop.com so we can send you a copy immediately.
|
|
||||||
*
|
|
||||||
* DISCLAIMER
|
|
||||||
*
|
|
||||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
|
||||||
* versions in the future. If you wish to customize PrestaShop for your
|
|
||||||
* needs please refer to http://www.prestashop.com for more information.
|
|
||||||
*
|
|
||||||
* @author PrestaShop SA <contact@prestashop.com>
|
|
||||||
* @copyright 2007-2013 PrestaShop SA
|
|
||||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
|
||||||
* International Registered Trademark & Property of PrestaShop SA
|
|
||||||
* PrestaShop Webservice Library
|
|
||||||
* @package PrestaShopWebservice
|
|
||||||
*/
|
|
||||||
// Here we define constants /!\ You need to replace this parameters
|
|
||||||
//https://dolistorecatalogpublickey1234567@vmdevwww.dolistore.com/api/
|
|
||||||
define('DEBUG', true); // Debug mode
|
|
||||||
define('PS_SHOP_PATH', 'http://vmdevwww.dolistore.com/'); // Root path of your PrestaShop store
|
|
||||||
define('PS_WS_AUTH_KEY', 'dolistorecatalogpublickey1234567'); // Auth key (Get it in your Back Office)
|
|
||||||
require_once('./PSWebServiceLibrary.php');
|
|
||||||
// Here we make the WebService Call
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
|
|
||||||
|
|
||||||
// Here we set the option array for the Webservice : we want customers resources
|
|
||||||
$opt['resource'] = 'categories';
|
|
||||||
$opt['id'] = '1';
|
|
||||||
|
|
||||||
// Call
|
|
||||||
$xml = $webService->get($opt);
|
|
||||||
// Here we get the elements from children of customers markup "customer"
|
|
||||||
$resources = $xml->categories->children();
|
|
||||||
}
|
|
||||||
catch (PrestaShopWebserviceException $e)
|
|
||||||
{
|
|
||||||
// Here we are dealing with errors
|
|
||||||
$trace = $e->getTrace();
|
|
||||||
if ($trace[0]['args'][0] == 404) echo 'Bad ID';
|
|
||||||
else if ($trace[0]['args'][0] == 401) echo 'Bad auth key';
|
|
||||||
else echo 'Other error';
|
|
||||||
}
|
|
||||||
// We set the Title
|
|
||||||
echo "<h1>Categories's List</h1>";
|
|
||||||
echo '<table border="5">';
|
|
||||||
// if $resources is set we can lists element in it otherwise do nothing cause there's an error
|
|
||||||
if (isset($resources))
|
|
||||||
{
|
|
||||||
echo '<tr><th>Id</th></tr>';
|
|
||||||
foreach ($resources as $resource)
|
|
||||||
{
|
|
||||||
// Iterates on the found IDs
|
|
||||||
echo '<tr><td>'.$resource->attributes().'</td></tr>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo '</table>';
|
|
||||||
?>
|
|
||||||
</body></html>
|
|
||||||
@ -115,7 +115,9 @@ div.divsearchfield {
|
|||||||
tr.app {
|
tr.app {
|
||||||
height:250px;
|
height:250px;
|
||||||
}
|
}
|
||||||
|
tr.app td {
|
||||||
|
border-bottom: 1px solid #888;
|
||||||
|
}
|
||||||
div#newsDoli.tabBar {
|
div#newsDoli.tabBar {
|
||||||
margin-top: 50px;
|
margin-top: 50px;
|
||||||
margin-right: 30px;
|
margin-right: 30px;
|
||||||
@ -225,6 +227,7 @@ tr.NotCompatible:hover{
|
|||||||
}
|
}
|
||||||
#listing-content{
|
#listing-content{
|
||||||
width: 75%;
|
width: 75%;
|
||||||
|
float: right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
span.details{
|
span.details{
|
||||||
|
|||||||
622
htdocs/admin/emailsenderprofile_card.php
Normal file
622
htdocs/admin/emailsenderprofile_card.php
Normal file
@ -0,0 +1,622 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) ---Put here your own copyright and developer email---
|
||||||
|
*
|
||||||
|
* 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 emailsenderprofile_card.php
|
||||||
|
* \ingroup monmodule
|
||||||
|
* \brief Page to create/edit/view emailsenderprofile
|
||||||
|
*/
|
||||||
|
|
||||||
|
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||||
|
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||||
|
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||||
|
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||||
|
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check anti CSRF attack test
|
||||||
|
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check anti CSRF attack test
|
||||||
|
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test done when option MAIN_SECURITY_CSRF_WITH_TOKEN is on.
|
||||||
|
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
|
||||||
|
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test
|
||||||
|
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
|
||||||
|
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
|
||||||
|
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
|
||||||
|
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||||
|
|
||||||
|
// Load Dolibarr environment
|
||||||
|
$res=0;
|
||||||
|
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||||
|
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include($_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php");
|
||||||
|
// Try main.inc.php into web root detected using web root caluclated from SCRIPT_FILENAME
|
||||||
|
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
|
||||||
|
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
|
||||||
|
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/main.inc.php");
|
||||||
|
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php");
|
||||||
|
// Try main.inc.php using relative path
|
||||||
|
if (! $res && file_exists("../main.inc.php")) $res=@include("../main.inc.php");
|
||||||
|
if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php");
|
||||||
|
if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php");
|
||||||
|
if (! $res) die("Include of main fails");
|
||||||
|
|
||||||
|
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||||
|
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
|
||||||
|
dol_include_once('/monmodule/class/emailsenderprofile.class.php');
|
||||||
|
dol_include_once('/monmodule/lib/emailsenderprofile.lib.php');
|
||||||
|
|
||||||
|
// Load traductions files requiredby by page
|
||||||
|
$langs->loadLangs(array("monmodule@monmodule","other"));
|
||||||
|
|
||||||
|
// Get parameters
|
||||||
|
$id = GETPOST('id', 'int');
|
||||||
|
$ref = GETPOST('ref', 'alpha');
|
||||||
|
$action = GETPOST('action', 'alpha');
|
||||||
|
$cancel = GETPOST('cancel', 'aZ09');
|
||||||
|
$backtopage = GETPOST('backtopage', 'alpha');
|
||||||
|
|
||||||
|
// Initialize technical objects
|
||||||
|
$object=new EmailSenderProfile($db);
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
$diroutputmassaction=$conf->monmodule->dir_output . '/temp/massgeneration/'.$user->id;
|
||||||
|
$hookmanager->initHooks(array('emailsenderprofilecard')); // Note that conf->hooks_modules contains array
|
||||||
|
// Fetch optionals attributes and labels
|
||||||
|
$extralabels = $extrafields->fetch_name_optionals_label('emailsenderprofile');
|
||||||
|
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||||
|
|
||||||
|
// Initialize array of search criterias
|
||||||
|
$search_all=trim(GETPOST("search_all",'alpha'));
|
||||||
|
$search=array();
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($action) && empty($id) && empty($ref)) $action='view';
|
||||||
|
|
||||||
|
// Security check - Protection if external user
|
||||||
|
//if ($user->societe_id > 0) access_forbidden();
|
||||||
|
//if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||||
|
//$result = restrictedArea($user, 'monmodule', $id);
|
||||||
|
|
||||||
|
// fetch optionals attributes and labels
|
||||||
|
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
|
||||||
|
// Load object
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ACTIONS
|
||||||
|
*
|
||||||
|
* Put here all code to do according to value of "action" parameter
|
||||||
|
*/
|
||||||
|
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
if ($cancel)
|
||||||
|
{
|
||||||
|
if (! empty($backtopage))
|
||||||
|
{
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action to add record
|
||||||
|
if ($action == 'add' && ! empty($user->rights->monmodule->create))
|
||||||
|
{
|
||||||
|
foreach ($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
|
||||||
|
|
||||||
|
$object->$key=GETPOST($key,'alpha');
|
||||||
|
if ($val['notnull'] > 0 && $object->$key == '')
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv($val['label'])), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$result=$object->createCommon($user);
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
// Creation OK
|
||||||
|
$urltogo=$backtopage?$backtopage:dol_buildpath('/monmodule/emailsenderprofile_list.php',1);
|
||||||
|
header("Location: ".$urltogo);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Creation KO
|
||||||
|
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
|
||||||
|
else setEventMessages($object->error, null, 'errors');
|
||||||
|
$action='create';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$action='create';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action to update record
|
||||||
|
if ($action == 'update' && ! empty($user->rights->monmodule->create))
|
||||||
|
{
|
||||||
|
foreach ($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
|
||||||
|
|
||||||
|
$object->$key=GETPOST($key,'alpha');
|
||||||
|
if ($val['notnull'] > 0 && $object->$key == '')
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv($val['label'])), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$result=$object->updateCommon($user);
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$action='view';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Creation KO
|
||||||
|
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
|
||||||
|
else setEventMessages($object->error, null, 'errors');
|
||||||
|
$action='edit';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$action='edit';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action to delete
|
||||||
|
if ($action == 'confirm_delete' && ! empty($user->rights->monmodule->delete))
|
||||||
|
{
|
||||||
|
$result=$object->deleteCommon($user);
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
// Delete OK
|
||||||
|
setEventMessages("RecordDeleted", null, 'mesgs');
|
||||||
|
header("Location: ".dol_buildpath('/monmodule/emailsenderprofile_list.php',1));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
|
||||||
|
else setEventMessages($object->error, null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actions when printing a doc from card
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||||
|
|
||||||
|
// Actions to send emails
|
||||||
|
$trigger_name='MYOBJECT_SENTBYMAIL';
|
||||||
|
$autocopy='MAIN_MAIL_AUTOCOPY_MYOBJECT_TO';
|
||||||
|
$trackid='emailsenderprofile'.$object->id;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* VIEW
|
||||||
|
*
|
||||||
|
* Put here all code to build page
|
||||||
|
*/
|
||||||
|
|
||||||
|
$form=new Form($db);
|
||||||
|
$formfile=new FormFile($db);
|
||||||
|
|
||||||
|
llxHeader('','EmailSenderProfile','');
|
||||||
|
|
||||||
|
// Example : Adding jquery code
|
||||||
|
print '<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
function init_myfunc()
|
||||||
|
{
|
||||||
|
jQuery("#myid").removeAttr(\'disabled\');
|
||||||
|
jQuery("#myid").attr(\'disabled\',\'disabled\');
|
||||||
|
}
|
||||||
|
init_myfunc();
|
||||||
|
jQuery("#mybutton").click(function() {
|
||||||
|
init_myfunc();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
|
||||||
|
|
||||||
|
// Part to create
|
||||||
|
if ($action == 'create')
|
||||||
|
{
|
||||||
|
print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("EmailSenderProfile")));
|
||||||
|
|
||||||
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="action" value="add">';
|
||||||
|
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||||
|
|
||||||
|
dol_fiche_head(array(), '');
|
||||||
|
|
||||||
|
print '<table class="border centpercent">'."\n";
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;
|
||||||
|
print '<tr id="field_'.$key.'">';
|
||||||
|
print '<td';
|
||||||
|
print ' class="titlefieldcreate';
|
||||||
|
if ($val['notnull'] > 0) print ' fieldrequired';
|
||||||
|
if ($val['type'] == 'text') print ' tdtop';
|
||||||
|
print '"';
|
||||||
|
print '>';
|
||||||
|
print $langs->trans($val['label']);
|
||||||
|
print '</td>';
|
||||||
|
print '<td>';
|
||||||
|
$defaultcss='minwidth100';
|
||||||
|
if ($val['type'] == 'text')
|
||||||
|
{
|
||||||
|
print '<textarea class="flat quatrevingtpercent" rows="'.ROWS_4.'" name="'.$key.'">';
|
||||||
|
print GETPOST($key,'none');
|
||||||
|
print '</textarea>';
|
||||||
|
}
|
||||||
|
elseif (is_array($val['arrayofkeyval']))
|
||||||
|
{
|
||||||
|
print $form->selectarray($key, $val['arrayofkeyval'], GETPOST($key, 'int'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$cssforinput = empty($val['css'])?$defaultcss:$val['css'];
|
||||||
|
print '<input class="flat'.($cssforinput?' '.$cssforinput:'').'" class="'.$cssforinput.'" type="text" name="'.$key.'" value="'.(GETPOST($key,'alpha')?GETPOST($key,'alpha'):'').'">';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Other attributes
|
||||||
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
|
||||||
|
|
||||||
|
print '</table>'."\n";
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
print '<div class="center">';
|
||||||
|
print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">';
|
||||||
|
print ' ';
|
||||||
|
print '<input type="button" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" onclick="javascript:history.go(-1)">'; // Cancel for create doe not post form
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Part to edit record
|
||||||
|
if (($id || $ref) && $action == 'edit')
|
||||||
|
{
|
||||||
|
print load_fiche_titre($langs->trans("EmailSenderProfile"));
|
||||||
|
|
||||||
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
print '<input type="hidden" name="action" value="update">';
|
||||||
|
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||||
|
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||||
|
|
||||||
|
dol_fiche_head();
|
||||||
|
|
||||||
|
print '<table class="border centpercent">'."\n";
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;
|
||||||
|
|
||||||
|
print '<tr><td';
|
||||||
|
print ' class="titlefieldcreate';
|
||||||
|
if ($val['notnull'] > 0) print ' fieldrequired';
|
||||||
|
if ($val['type'] == 'text') print ' tdtop';
|
||||||
|
print '"';
|
||||||
|
print '>'.$langs->trans($val['label']).'</td>';
|
||||||
|
print '<td>';
|
||||||
|
$defaultcss='minwidth100';
|
||||||
|
if ($val['type'] == 'text')
|
||||||
|
{
|
||||||
|
print '<textarea class="flat quatrevingtpercent" rows="'.ROWS_4.'" name="'.$key.'">';
|
||||||
|
print GETPOST($key,'none')?GETPOST($key,'none'):$object->$key;
|
||||||
|
print '</textarea>';
|
||||||
|
}
|
||||||
|
elseif (is_array($val['arrayofkeyval']))
|
||||||
|
{
|
||||||
|
print $form->selectarray($key, $val['arrayofkeyval'], GETPOST($key, 'int')!=''?GETPOST($key, 'int'):$object->$key);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$cssforinput = empty($val['css'])?$defaultcss:$val['css'];
|
||||||
|
print '<input class="flat'.($cssforinput?' '.$cssforinput:'').'" type="text" name="'.$key.'" value="'.(GETPOST($key,'alpha')?GETPOST($key,'alpha'):$object->$key).'">';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Other attributes
|
||||||
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||||
|
print ' <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Part to show record
|
||||||
|
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create')))
|
||||||
|
{
|
||||||
|
$res = $object->fetch_optionals($object->id, $extralabels);
|
||||||
|
|
||||||
|
$head = emailsenderprofilePrepareHead($object);
|
||||||
|
dol_fiche_head($head, 'card', $langs->trans("EmailSenderProfile"), -1, 'emailsenderprofile@monmodule');
|
||||||
|
|
||||||
|
$formconfirm = '';
|
||||||
|
|
||||||
|
// Confirmation to delete
|
||||||
|
if ($action == 'delete') {
|
||||||
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteEmailSenderProfile'), $langs->trans('ConfirmDeleteEmailSenderProfile'), 'confirm_delete', '', 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Confirmation of action xxxx
|
||||||
|
if ($action == 'xxx')
|
||||||
|
{
|
||||||
|
$formquestion=array();
|
||||||
|
/*
|
||||||
|
$formquestion = array(
|
||||||
|
// 'text' => $langs->trans("ConfirmClone"),
|
||||||
|
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||||
|
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||||
|
// array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1)));
|
||||||
|
}*/
|
||||||
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $formconfirm) {
|
||||||
|
$parameters = array('lineid' => $lineid);
|
||||||
|
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
|
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
||||||
|
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print form confirm
|
||||||
|
print $formconfirm;
|
||||||
|
|
||||||
|
|
||||||
|
// Object card
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
$linkback = '<a href="' .dol_buildpath('/monmodule/emailsenderprofile_list.php',1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||||
|
|
||||||
|
$morehtmlref='<div class="refidno">';
|
||||||
|
/*
|
||||||
|
// Ref bis
|
||||||
|
$morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->monmodule->creer, 'string', '', 0, 1);
|
||||||
|
$morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->monmodule->creer, 'string', '', null, null, '', 1);
|
||||||
|
// Thirdparty
|
||||||
|
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
|
||||||
|
// Project
|
||||||
|
if (! empty($conf->projet->enabled))
|
||||||
|
{
|
||||||
|
$langs->load("projects");
|
||||||
|
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||||
|
if ($user->rights->monmodule->creer)
|
||||||
|
{
|
||||||
|
if ($action != 'classify')
|
||||||
|
{
|
||||||
|
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||||
|
if ($action == 'classify') {
|
||||||
|
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||||
|
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||||
|
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||||
|
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||||
|
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||||
|
$morehtmlref.='</form>';
|
||||||
|
} else {
|
||||||
|
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (! empty($object->fk_project)) {
|
||||||
|
$proj = new Project($db);
|
||||||
|
$proj->fetch($object->fk_project);
|
||||||
|
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||||
|
$morehtmlref.=$proj->ref;
|
||||||
|
$morehtmlref.='</a>';
|
||||||
|
} else {
|
||||||
|
$morehtmlref.='';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
$morehtmlref.='</div>';
|
||||||
|
|
||||||
|
|
||||||
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||||
|
|
||||||
|
|
||||||
|
print '<div class="fichecenter">';
|
||||||
|
print '<div class="fichehalfleft">';
|
||||||
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
print '<table class="border centpercent">'."\n";
|
||||||
|
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (in_array($key, array('rowid', 'ref', 'entity', 'note_public', 'note_private', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key', 'status'))) continue;
|
||||||
|
|
||||||
|
print '<tr><td';
|
||||||
|
print ' class="titlefield';
|
||||||
|
if ($val['notnull'] > 0) print ' fieldrequired';
|
||||||
|
print '"';
|
||||||
|
print '>'.$langs->trans($val['label']).'</td>';
|
||||||
|
print '<td>';
|
||||||
|
print dol_escape_htmltag($object->$key, 1, 1);
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
//if ($key == 'targetsrcfile3') break; // key used for break on second column
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="fichehalfright">';
|
||||||
|
print '<div class="ficheaddleft">';
|
||||||
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
|
$alreadyoutput = 1;
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if ($alreadyoutput)
|
||||||
|
{
|
||||||
|
//if ($key == 'targetsrcfile3') $alreadyoutput = 0; // key used for break on second column
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array($key, array('rowid', 'ref', 'entity', 'note_public', 'note_private', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key', 'status'))) continue;
|
||||||
|
|
||||||
|
print '<tr><td';
|
||||||
|
print ' class="titlefield';
|
||||||
|
if ($val['notnull'] > 0) print ' fieldrequired';
|
||||||
|
print '"';
|
||||||
|
print '>'.$langs->trans($val['label']).'</td>';
|
||||||
|
print '<td>';
|
||||||
|
print dol_escape_htmltag($object->$key, 1, 1);
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Other attributes
|
||||||
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
print '</div>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '<div class="clearboth"></div><br>';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
|
// Buttons for actions
|
||||||
|
if ($action != 'presend' && $action != 'editline') {
|
||||||
|
print '<div class="tabsAction">'."\n";
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
// Send
|
||||||
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendByMail') . '</a></div>'."\n";
|
||||||
|
|
||||||
|
if ($user->rights->monmodule->write)
|
||||||
|
{
|
||||||
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a></div>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if ($user->rights->sellyoursaas->create)
|
||||||
|
{
|
||||||
|
if ($object->status == 1)
|
||||||
|
{
|
||||||
|
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=disable">'.$langs->trans("Disable").'</a></div>'."\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=enable">'.$langs->trans("Enable").'</a></div>'."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ($user->rights->monmodule->delete)
|
||||||
|
{
|
||||||
|
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a></div>'."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '</div>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Select mail models is same action as presend
|
||||||
|
if (GETPOST('modelselected')) {
|
||||||
|
$action = 'presend';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action != 'presend')
|
||||||
|
{
|
||||||
|
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||||
|
print '<a name="builddoc"></a>'; // ancre
|
||||||
|
// Documents
|
||||||
|
$comref = dol_sanitizeFileName($object->ref);
|
||||||
|
$relativepath = $comref . '/' . $comref . '.pdf';
|
||||||
|
$filedir = $conf->monmodule->dir_output . '/' . $comref;
|
||||||
|
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
||||||
|
$genallowed = $user->rights->monmodule->creer;
|
||||||
|
$delallowed = $user->rights->monmodule->supprimer;
|
||||||
|
print $formfile->showdocuments('monmodule', $comref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
|
||||||
|
|
||||||
|
|
||||||
|
// Show links to link elements
|
||||||
|
$linktoelem = $form->showLinkToObjectBlock($object, null, array('emailsenderprofile'));
|
||||||
|
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||||
|
|
||||||
|
|
||||||
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
|
$MAXEVENT = 10;
|
||||||
|
|
||||||
|
// List of actions on element
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||||
|
$formactions = new FormActions($db);
|
||||||
|
$somethingshown = $formactions->showactions($object, 'emailsenderprofile', $socid, 1, '', $MAXEVENT);
|
||||||
|
|
||||||
|
print '</div></div></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Presend form
|
||||||
|
$modelmail='emailsenderprofile';
|
||||||
|
$defaulttopic='Information';
|
||||||
|
$diroutput = $conf->monmodule->dir_output;
|
||||||
|
$trackid = 'emailsenderprofile'.$object->id;
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// End of page
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
661
htdocs/admin/emailsenderprofile_list.php
Normal file
661
htdocs/admin/emailsenderprofile_list.php
Normal file
@ -0,0 +1,661 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) ---Put here your own copyright and developer email---
|
||||||
|
*
|
||||||
|
* 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 emailsenderprofile_list.php
|
||||||
|
* \ingroup monmodule
|
||||||
|
* \brief List page for emailsenderprofile
|
||||||
|
*/
|
||||||
|
|
||||||
|
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||||
|
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||||
|
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||||
|
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||||
|
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check anti CSRF attack test
|
||||||
|
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check anti CSRF attack test
|
||||||
|
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test done when option MAIN_SECURITY_CSRF_WITH_TOKEN is on.
|
||||||
|
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
|
||||||
|
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test
|
||||||
|
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
|
||||||
|
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
|
||||||
|
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
|
||||||
|
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||||
|
|
||||||
|
|
||||||
|
// Load Dolibarr environment
|
||||||
|
$res=0;
|
||||||
|
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||||
|
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include($_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php");
|
||||||
|
// Try main.inc.php into web root detected using web root caluclated from SCRIPT_FILENAME
|
||||||
|
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
|
||||||
|
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
|
||||||
|
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/main.inc.php");
|
||||||
|
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php");
|
||||||
|
// Try main.inc.php using relative path
|
||||||
|
if (! $res && file_exists("../main.inc.php")) $res=@include("../main.inc.php");
|
||||||
|
if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php");
|
||||||
|
if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php");
|
||||||
|
if (! $res) die("Include of main fails");
|
||||||
|
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||||
|
dol_include_once('/monmodule/class/emailsenderprofile.class.php');
|
||||||
|
|
||||||
|
// Load traductions files requiredby by page
|
||||||
|
$langs->loadLangs(array("monmodule@monmodule","other"));
|
||||||
|
|
||||||
|
$action = GETPOST('action','alpha'); // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||||
|
$massaction = GETPOST('massaction','alpha'); // The bulk action (combo box choice into lists)
|
||||||
|
$show_files = GETPOST('show_files','int'); // Show files area generated by bulk actions ?
|
||||||
|
$confirm = GETPOST('confirm','alpha'); // Result of a confirmation
|
||||||
|
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
|
||||||
|
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
|
||||||
|
$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'emailsenderprofilelist'; // To manage different context of search
|
||||||
|
$backtopage = GETPOST('backtopage','alpha'); // Go back to a dedicated page
|
||||||
|
$optioncss = GETPOST('optioncss','aZ'); // Option for the css output (always '' except when 'print')
|
||||||
|
|
||||||
|
$id = GETPOST('id','int');
|
||||||
|
|
||||||
|
// Load variable for pagination
|
||||||
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
|
$sortfield = GETPOST('sortfield','alpha');
|
||||||
|
$sortorder = GETPOST('sortorder','alpha');
|
||||||
|
$page = GETPOST('page','int');
|
||||||
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
|
$offset = $limit * $page;
|
||||||
|
$pageprev = $page - 1;
|
||||||
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
|
// Initialize technical objects
|
||||||
|
$object=new EmailSenderProfile($db);
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
$diroutputmassaction=$conf->monmodule->dir_output . '/temp/massgeneration/'.$user->id;
|
||||||
|
$hookmanager->initHooks(array('emailsenderprofilelist')); // Note that conf->hooks_modules contains array
|
||||||
|
// Fetch optionals attributes and labels
|
||||||
|
$extralabels = $extrafields->fetch_name_optionals_label('emailsenderprofile');
|
||||||
|
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||||
|
|
||||||
|
// Default sort order (if not yet defined by previous GETPOST)
|
||||||
|
if (! $sortfield) $sortfield="t.".key($object->fields); // Set here default search field. By default 1st field in definition.
|
||||||
|
if (! $sortorder) $sortorder="ASC";
|
||||||
|
|
||||||
|
// Protection if external user
|
||||||
|
$socid=0;
|
||||||
|
if ($user->societe_id > 0)
|
||||||
|
{
|
||||||
|
//$socid = $user->societe_id;
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize array of search criterias
|
||||||
|
$search_all=trim(GETPOST("search_all",'alpha'));
|
||||||
|
$search=array();
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha');
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of fields to search into when doing a "search in all"
|
||||||
|
$fieldstosearchall = array();
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Definition of fields for list
|
||||||
|
$arrayfields=array();
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
// If $val['visible']==0, then we never show the field
|
||||||
|
if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']);
|
||||||
|
}
|
||||||
|
// Extra fields
|
||||||
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
|
{
|
||||||
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
|
{
|
||||||
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ACTIONS
|
||||||
|
*
|
||||||
|
* Put here all code to do according to value of "$action" parameter
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
// Selection of new fields
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
|
// Purge search criteria
|
||||||
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
|
{
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
$search[$key]='';
|
||||||
|
}
|
||||||
|
$toselect='';
|
||||||
|
$search_array_options=array();
|
||||||
|
}
|
||||||
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')
|
||||||
|
|| GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha'))
|
||||||
|
{
|
||||||
|
$massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mass actions
|
||||||
|
$objectclass='EmailSenderProfile';
|
||||||
|
$objectlabel='EmailSenderProfile';
|
||||||
|
$permtoread = $user->rights->monmodule->read;
|
||||||
|
$permtodelete = $user->rights->monmodule->delete;
|
||||||
|
$uploaddir = $conf->monmodule->dir_output;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* VIEW
|
||||||
|
*
|
||||||
|
* Put here all code to build page
|
||||||
|
*/
|
||||||
|
|
||||||
|
$form=new Form($db);
|
||||||
|
|
||||||
|
$now=dol_now();
|
||||||
|
|
||||||
|
//$help_url="EN:Module_EmailSenderProfile|FR:Module_EmailSenderProfile_FR|ES:Módulo_EmailSenderProfile";
|
||||||
|
$help_url='';
|
||||||
|
$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("EmailSenderProfiles"));
|
||||||
|
|
||||||
|
|
||||||
|
// Build and execute select
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
$sql = 'SELECT ';
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
$sql.='t.'.$key.', ';
|
||||||
|
}
|
||||||
|
// Add fields from extrafields
|
||||||
|
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||||
|
// Add fields from hooks
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
|
$sql=preg_replace('/, $/','', $sql);
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."emailsenderprofile as t";
|
||||||
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."emailsenderprofile_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||||
|
$sql.= " WHERE t.entity IN (".getEntity('emailsenderprofile').")";
|
||||||
|
foreach($search as $key => $val)
|
||||||
|
{
|
||||||
|
$mode_search=(($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))?1:0);
|
||||||
|
if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search));
|
||||||
|
}
|
||||||
|
if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||||
|
// Add where from extra fields
|
||||||
|
foreach ($search_array_options as $key => $val)
|
||||||
|
{
|
||||||
|
$crit=$val;
|
||||||
|
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||||
|
$typ=$extrafields->attribute_type[$tmpkey];
|
||||||
|
$mode_search=0;
|
||||||
|
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||||
|
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||||
|
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||||
|
{
|
||||||
|
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Add where from hooks
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
|
|
||||||
|
/* If a group by is required
|
||||||
|
$sql.= " GROUP BY "
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
$sql.='t.'.$key.', ';
|
||||||
|
}
|
||||||
|
// Add fields from extrafields
|
||||||
|
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : '');
|
||||||
|
// Add where from hooks
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
|
*/
|
||||||
|
|
||||||
|
$sql.=$db->order($sortfield,$sortorder);
|
||||||
|
|
||||||
|
// Count total nb of records
|
||||||
|
$nbtotalofrecords = '';
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
|
{
|
||||||
|
$result = $db->query($sql);
|
||||||
|
$nbtotalofrecords = $db->num_rows($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
|
|
||||||
|
dol_syslog($script_file, LOG_DEBUG);
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if (! $resql)
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
// Direct jump if only one record found
|
||||||
|
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$id = $obj->rowid;
|
||||||
|
header("Location: ".DOL_URL_ROOT.'/monmodule/emailsenderprofile_card.php?id='.$id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Output page
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
|
llxHeader('', $title, $help_url);
|
||||||
|
|
||||||
|
// Example : Adding jquery code
|
||||||
|
print '<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
function init_myfunc()
|
||||||
|
{
|
||||||
|
jQuery("#myid").removeAttr(\'disabled\');
|
||||||
|
jQuery("#myid").attr(\'disabled\',\'disabled\');
|
||||||
|
}
|
||||||
|
init_myfunc();
|
||||||
|
jQuery("#mybutton").click(function() {
|
||||||
|
init_myfunc();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
|
||||||
|
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||||
|
|
||||||
|
$param='';
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||||
|
foreach($search as $key => $val)
|
||||||
|
{
|
||||||
|
$param.= '&search_'.$key.'='.urlencode($search[$key]);
|
||||||
|
}
|
||||||
|
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||||
|
// Add $param from extra fields
|
||||||
|
foreach ($search_array_options as $key => $val)
|
||||||
|
{
|
||||||
|
$crit=$val;
|
||||||
|
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||||
|
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of mass actions available
|
||||||
|
$arrayofmassactions = array(
|
||||||
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
|
);
|
||||||
|
if ($user->rights->monmodule->delete) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||||
|
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||||
|
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|
||||||
|
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||||
|
print '<input type="hidden" name="action" value="list">';
|
||||||
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||||
|
|
||||||
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||||
|
|
||||||
|
if ($sall)
|
||||||
|
{
|
||||||
|
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||||
|
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
|
||||||
|
}
|
||||||
|
|
||||||
|
$moreforfilter = '';
|
||||||
|
$moreforfilter.='<div class="divsearchfield">';
|
||||||
|
$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
|
||||||
|
$moreforfilter.= '</div>';
|
||||||
|
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
|
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||||
|
else $moreforfilter = $hookmanager->resPrint;
|
||||||
|
|
||||||
|
if (! empty($moreforfilter))
|
||||||
|
{
|
||||||
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||||
|
print $moreforfilter;
|
||||||
|
print '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||||
|
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||||
|
$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||||
|
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||||
|
|
||||||
|
|
||||||
|
// Fields title search
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
||||||
|
$align='';
|
||||||
|
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
||||||
|
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
|
||||||
|
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||||
|
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
|
||||||
|
}
|
||||||
|
// Extra fields
|
||||||
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
|
{
|
||||||
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
|
{
|
||||||
|
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||||
|
{
|
||||||
|
$align=$extrafields->getAlignFlag($key);
|
||||||
|
$typeofextrafield=$extrafields->attribute_type[$key];
|
||||||
|
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||||
|
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attribute_computed[$key]))
|
||||||
|
{
|
||||||
|
$crit=$val;
|
||||||
|
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||||
|
$searchclass='';
|
||||||
|
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
||||||
|
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
||||||
|
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Fields from hook
|
||||||
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
// Rest of fields search
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (! in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
||||||
|
$align='';
|
||||||
|
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
||||||
|
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
|
||||||
|
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||||
|
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
|
||||||
|
}
|
||||||
|
// Action column
|
||||||
|
print '<td class="liste_titre" align="right">';
|
||||||
|
$searchpicto=$form->showFilterButtons();
|
||||||
|
print $searchpicto;
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>'."\n";
|
||||||
|
|
||||||
|
|
||||||
|
// Fields title label
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
||||||
|
$align='';
|
||||||
|
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
||||||
|
if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
|
||||||
|
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||||
|
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
|
||||||
|
}
|
||||||
|
// Extra fields
|
||||||
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
|
{
|
||||||
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
|
{
|
||||||
|
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||||
|
{
|
||||||
|
$align=$extrafields->getAlignFlag($key);
|
||||||
|
$sortonfield = "ef.".$key;
|
||||||
|
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
|
||||||
|
print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Hook fields
|
||||||
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
// Rest of fields title
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (! in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
||||||
|
$align='';
|
||||||
|
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
||||||
|
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
|
||||||
|
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||||
|
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
|
||||||
|
}
|
||||||
|
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
|
||||||
|
print '</tr>'."\n";
|
||||||
|
|
||||||
|
|
||||||
|
// Detect if we need a fetch on each output line
|
||||||
|
$needToFetchEachLine=0;
|
||||||
|
foreach ($extrafields->attribute_computed as $key => $val)
|
||||||
|
{
|
||||||
|
if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Loop on record
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
$i=0;
|
||||||
|
$totalarray=array();
|
||||||
|
while ($i < min($num, $limit))
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
if (empty($obj)) break; // Should not happen
|
||||||
|
|
||||||
|
// Store properties in $object
|
||||||
|
$object->id = $obj->rowid;
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (isset($obj->$key)) $object->$key = $obj->$key;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show here line of result
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
||||||
|
$align='';
|
||||||
|
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
||||||
|
if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
|
||||||
|
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||||
|
if (! empty($arrayfields['t.'.$key]['checked']))
|
||||||
|
{
|
||||||
|
print '<td'.($align?' class="'.$align.'"':'').'>';
|
||||||
|
if (in_array($val['type'], array('date','datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour');
|
||||||
|
elseif ($key == 'ref') print $object->getNomUrl(1, '', 0, '', 1);
|
||||||
|
elseif ($key == 'status') print $object->getLibStatut(3);
|
||||||
|
else print $obj->$key;
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
if (! empty($val['isameasure']))
|
||||||
|
{
|
||||||
|
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
|
||||||
|
$totalarray['val']['t.'.$key] += $obj->$key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Extra fields
|
||||||
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
|
{
|
||||||
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
|
{
|
||||||
|
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||||
|
{
|
||||||
|
print '<td';
|
||||||
|
$align=$extrafields->getAlignFlag($key);
|
||||||
|
if ($align) print ' align="'.$align.'"';
|
||||||
|
print '>';
|
||||||
|
$tmpkey='options_'.$key;
|
||||||
|
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
if (! empty($val['isameasure']))
|
||||||
|
{
|
||||||
|
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey;
|
||||||
|
$totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Fields from hook
|
||||||
|
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
// Rest of fields
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (! in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
||||||
|
$align='';
|
||||||
|
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
|
||||||
|
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
|
||||||
|
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||||
|
if (! empty($arrayfields['t.'.$key]['checked']))
|
||||||
|
{
|
||||||
|
print '<td'.($align?' class="'.$align.'"':'').'>';
|
||||||
|
if (in_array($val['type'], array('date','datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour');
|
||||||
|
elseif ($key == 'status') print $object->getLibStatut(3);
|
||||||
|
else print $obj->$key;
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
if (! empty($val['isameasure']))
|
||||||
|
{
|
||||||
|
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
|
||||||
|
$totalarray['val']['t.'.$key] += $obj->$key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Action column
|
||||||
|
print '<td class="nowrap" align="center">';
|
||||||
|
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||||
|
{
|
||||||
|
$selected=0;
|
||||||
|
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
||||||
|
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show total line
|
||||||
|
if (isset($totalarray['pos']))
|
||||||
|
{
|
||||||
|
print '<tr class="liste_total">';
|
||||||
|
$i=0;
|
||||||
|
while ($i < $totalarray['nbfield'])
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($i == 1)
|
||||||
|
{
|
||||||
|
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||||
|
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||||
|
}
|
||||||
|
else print '<td></td>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no record found
|
||||||
|
if ($num == 0)
|
||||||
|
{
|
||||||
|
$colspan=1;
|
||||||
|
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
|
||||||
|
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$db->free($resql);
|
||||||
|
|
||||||
|
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
|
print '</table>'."\n";
|
||||||
|
print '</div>'."\n";
|
||||||
|
|
||||||
|
print '</form>'."\n";
|
||||||
|
|
||||||
|
if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
|
||||||
|
{
|
||||||
|
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
|
||||||
|
{
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
|
||||||
|
$formfile = new FormFile($db);
|
||||||
|
|
||||||
|
// Show list of available documents
|
||||||
|
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||||
|
$urlsource.=str_replace('&','&',$param);
|
||||||
|
|
||||||
|
$filedir=$diroutputmassaction;
|
||||||
|
$genallowed=$user->rights->monmodule->read;
|
||||||
|
$delallowed=$user->rights->monmodule->read;
|
||||||
|
|
||||||
|
print $formfile->showdocuments('massfilesarea_monmodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// End of page
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
@ -221,8 +221,37 @@ elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS')
|
|||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
}
|
}
|
||||||
|
} elseif ($action == 'set_FICHINTER_WITHOUT_DURATION') {
|
||||||
|
$val = GETPOST('FICHINTER_WITHOUT_DURATION', 'alpha');
|
||||||
|
$res = dolibarr_set_const($db, "FICHINTER_WITHOUT_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '',
|
||||||
|
$conf->entity);
|
||||||
|
|
||||||
|
if (!$res > 0) {
|
||||||
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
|
}
|
||||||
|
} elseif ($action == 'set_FICHINTER_DATE_WITHOUT_HOUR') {
|
||||||
|
$val = GETPOST('FICHINTER_DATE_WITHOUT_HOUR', 'alpha');
|
||||||
|
$res = dolibarr_set_const($db, "FICHINTER_DATE_WITHOUT_HOUR", ($val == 'on' ? 1 : 0), 'bool', 0, '',
|
||||||
|
$conf->entity);
|
||||||
|
|
||||||
|
if (!$res > 0) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -575,6 +604,40 @@ print '<input type="submit" class="button" value="' . $langs->trans("Modify") .
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
// Use duration
|
||||||
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||||
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
|
print '<input type="hidden" name="action" value="set_FICHINTER_WITHOUT_DURATION">';
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>';
|
||||||
|
print $langs->trans("UseDurationOnFichinter");
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="center">';
|
||||||
|
print '<input type="checkbox" name="FICHINTER_WITHOUT_DURATION"' . ($conf->global->FICHINTER_WITHOUT_DURATION?' checked':'') . '>';
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="right">';
|
||||||
|
print '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">';
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
print '</form>';
|
||||||
|
// use date without hour
|
||||||
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||||
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
|
print '<input type="hidden" name="action" value="set_FICHINTER_DATE_WITHOUT_HOUR">';
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>';
|
||||||
|
print $langs->trans("UseDateWithoutHourOnFichinter");
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="center">';
|
||||||
|
print '<input type="checkbox" name="FICHINTER_DATE_WITHOUT_HOUR"' . ($conf->global->FICHINTER_DATE_WITHOUT_HOUR?' checked':'') . '>';
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="right">';
|
||||||
|
print '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">';
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -47,15 +47,22 @@ if (! $user->admin) accessforbidden();
|
|||||||
|
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
|
|
||||||
|
|
||||||
if (! defined("MAIN_MOTD")) define("MAIN_MOTD","");
|
if (! defined("MAIN_MOTD")) define("MAIN_MOTD","");
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
|
$contextpage=array('adminihm','globaladmin');
|
||||||
|
$hookmanager->initHooks($contextpage);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel'))
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (GETPOST('cancel','alpha'))
|
||||||
{
|
{
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
@ -82,8 +89,8 @@ if ($action == 'removebackgroundlogin' && ! empty($conf->global->MAIN_LOGIN_BACK
|
|||||||
|
|
||||||
if ($action == 'update')
|
if ($action == 'update')
|
||||||
{
|
{
|
||||||
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["main_lang_default"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["MAIN_LANG_DEFAULT"],'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["main_multilangs"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["MAIN_MULTILANGS"],'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"],'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
@ -99,6 +106,10 @@ if ($action == 'update')
|
|||||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity);
|
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity);
|
||||||
else dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', $val,'chaine',0,'',$conf->entity);
|
else dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', $val,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
|
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_VERMENU_BACK1'),array()))));
|
||||||
|
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_VERMENU_BACK1', $conf->entity);
|
||||||
|
else dolibarr_set_const($db, 'THEME_ELDY_VERMENU_BACK1', $val,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array()))));
|
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array()))));
|
||||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
|
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
|
||||||
else dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', $val,'chaine',0,'',$conf->entity);
|
else dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', $val,'chaine',0,'',$conf->entity);
|
||||||
@ -230,15 +241,15 @@ if ($action == 'edit') // Edit
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Default language
|
// Default language
|
||||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultLanguage").'</td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans("DefaultLanguage").'</td><td>';
|
||||||
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'main_lang_default', 1, 0, 0, 0, 0, 'minwidth300');
|
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Multilingual GUI
|
// Multilingual GUI
|
||||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>';
|
||||||
print $form->selectyesno('main_multilangs',$conf->global->MAIN_MULTILANGS,1);
|
print $form->selectyesno('MAIN_MULTILANGS',$conf->global->MAIN_MULTILANGS,1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -349,9 +360,8 @@ if ($action == 'edit') // Edit
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Message of the day on home page
|
// Message of the day on home page
|
||||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object'));
|
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount'));
|
||||||
complete_substitutions_array($substitutionarray, $langs);
|
complete_substitutions_array($substitutionarray, $langs);
|
||||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans('TranslationKey');
|
|
||||||
|
|
||||||
print '<tr><td class="titlefield">';
|
print '<tr><td class="titlefield">';
|
||||||
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||||
@ -359,7 +369,7 @@ if ($action == 'edit') // Edit
|
|||||||
{
|
{
|
||||||
$texthelp.=$key.'<br>';
|
$texthelp.=$key.'<br>';
|
||||||
}
|
}
|
||||||
print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, '');
|
print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
|
||||||
|
|
||||||
print '</td><td colspan="2">';
|
print '</td><td colspan="2">';
|
||||||
|
|
||||||
@ -379,16 +389,15 @@ if ($action == 'edit') // Edit
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Message on login page
|
// Message on login page
|
||||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','user'));
|
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount','user'));
|
||||||
complete_substitutions_array($substitutionarray, $langs);
|
complete_substitutions_array($substitutionarray, $langs);
|
||||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans('TranslationKey');
|
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||||
foreach($substitutionarray as $key => $val)
|
foreach($substitutionarray as $key => $val)
|
||||||
{
|
{
|
||||||
$texthelp.=$key.'<br>';
|
$texthelp.=$key.'<br>';
|
||||||
}
|
}
|
||||||
print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, '');
|
print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin');
|
||||||
print '</td><td colspan="2">';
|
print '</td><td colspan="2">';
|
||||||
$doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME)?$conf->global->MAIN_HOME:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
|
$doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME)?$conf->global->MAIN_HOME:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
|
|||||||
@ -70,13 +70,13 @@ if (! empty($conf->global->MAIN_MOTD_SETUPPAGE))
|
|||||||
|
|
||||||
print $langs->trans("SetupDescription1").' ';
|
print $langs->trans("SetupDescription1").' ';
|
||||||
print $langs->trans("AreaForAdminOnly").' ';
|
print $langs->trans("AreaForAdminOnly").' ';
|
||||||
print $langs->trans("SetupDescription2", $langs->trans("MenuCompanySetup"), $langs->trans("Modules"))."<br><br>";
|
print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySetup"), $langs->transnoentities("Modules"))."<br><br>";
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
// Show info setup company
|
// Show info setup company
|
||||||
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1;
|
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1;
|
||||||
print img_picto('','puce').' '.$langs->trans("SetupDescription3", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit'), $langs->trans("Setup"), $langs->trans("MenuCompanySetup"));
|
print img_picto('','puce').' '.$langs->trans("SetupDescription3", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit'), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup"));
|
||||||
if (! empty($setupcompanynotcomplete))
|
if (! empty($setupcompanynotcomplete))
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
@ -88,7 +88,7 @@ print '<br>';
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
// Show info setup module
|
// Show info setup module
|
||||||
print img_picto('','puce').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->trans("Setup"), $langs->trans("Modules"));
|
print img_picto('','puce').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules"));
|
||||||
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled
|
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
@ -38,10 +38,19 @@ if (!$user->admin)
|
|||||||
|
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
|
$hookmanager->initHooks(array('adminldap','globaladmin'));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
if ($action == 'setvalue' && $user->admin)
|
if ($action == 'setvalue' && $user->admin)
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
@ -59,6 +68,7 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
if (! dolibarr_set_const($db, 'LDAP_SYNCHRO_ACTIVE',GETPOST("activesynchro"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_SYNCHRO_ACTIVE',GETPOST("activesynchro"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_CONTACT_ACTIVE',GETPOST("activecontact"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_CONTACT_ACTIVE',GETPOST("activecontact"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_ACTIVE',GETPOST("activemembers"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_ACTIVE',GETPOST("activemembers"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_TYPE_ACTIVE',GETPOST("activememberstypes"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -71,8 +81,7 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -127,7 +136,6 @@ print '</td></tr>';
|
|||||||
// Synchro contact active
|
// Synchro contact active
|
||||||
if (! empty($conf->societe->enabled))
|
if (! empty($conf->societe->enabled))
|
||||||
{
|
{
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPDnContactActive").'</td><td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPDnContactActive").'</td><td>';
|
||||||
$arraylist=array();
|
$arraylist=array();
|
||||||
$arraylist['0']=$langs->trans("No");
|
$arraylist['0']=$langs->trans("No");
|
||||||
@ -139,7 +147,6 @@ if (! empty($conf->societe->enabled))
|
|||||||
// Synchro member active
|
// Synchro member active
|
||||||
if (! empty($conf->adherent->enabled))
|
if (! empty($conf->adherent->enabled))
|
||||||
{
|
{
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPDnMemberActive").'</td><td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPDnMemberActive").'</td><td>';
|
||||||
$arraylist=array();
|
$arraylist=array();
|
||||||
$arraylist['0']=$langs->trans("No");
|
$arraylist['0']=$langs->trans("No");
|
||||||
@ -149,6 +156,23 @@ if (! empty($conf->adherent->enabled))
|
|||||||
print '</td><td>'.$langs->trans("LDAPDnMemberActiveExample").'</td></tr>';
|
print '</td><td>'.$langs->trans("LDAPDnMemberActiveExample").'</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Synchro member type active
|
||||||
|
if (! empty($conf->adherent->enabled))
|
||||||
|
{
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPDnMemberTypeActive").'</td><td>';
|
||||||
|
$arraylist=array();
|
||||||
|
$arraylist['0']=$langs->trans("No");
|
||||||
|
$arraylist['1']=$langs->trans("DolibarrToLDAP");
|
||||||
|
$arraylist['ldap2dolibarr']=$langs->trans("LDAPToDolibarr").' ('.$langs->trans("SupportedForLDAPImportScriptOnly").')';
|
||||||
|
print $form->selectarray('activememberstypes',$arraylist,$conf->global->LDAP_MEMBER_TYPE_ACTIVE);
|
||||||
|
print '</td><td>'.$langs->trans("LDAPDnMemberTypeActiveExample").'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fields from hook
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('addAdminLdapOptions',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||||
print '<td>'.$langs->trans("Value").'</td>';
|
print '<td>'.$langs->trans("Value").'</td>';
|
||||||
|
|||||||
@ -220,8 +220,9 @@ if (function_exists("ldap_connect"))
|
|||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
// Get a gid number for objectclass PosixGroup
|
// Get a gid number for objectclass PosixGroup
|
||||||
if(in_array('posixGroup',$info['objectclass']))
|
if (in_array('posixGroup',$info['objectclass'])) {
|
||||||
$info['gidNumber'] = $ldap->getNextGroupGid();
|
$info['gidNumber'] = $ldap->getNextGroupGid('LDAP_KEY_GROUPS');
|
||||||
|
}
|
||||||
|
|
||||||
$result1=$ldap->delete($dn); // To be sure to delete existing records
|
$result1=$ldap->delete($dn); // To be sure to delete existing records
|
||||||
$result2=$ldap->add($dn,$info,$user); // Now the test
|
$result2=$ldap->add($dn,$info,$user); // Now the test
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
@ -68,6 +68,7 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_MOBILE',GETPOST("fieldmobile"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_MOBILE',GETPOST("fieldmobile"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FAX',GETPOST("fieldfax"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FAX',GETPOST("fieldfax"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_COMPANY',GETPOST("fieldcompany"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ADDRESS',GETPOST("fieldaddress"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ADDRESS',GETPOST("fieldaddress"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ZIP',GETPOST("fieldzip"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ZIP',GETPOST("fieldzip"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_TOWN',GETPOST("fieldtown"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_TOWN',GETPOST("fieldtown"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
@ -282,6 +283,14 @@ print '</td><td>'.$langs->trans("LDAPFieldFaxExample").'</td>';
|
|||||||
print '<td align="right"> </td>';
|
print '<td align="right"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
// Company
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldCompany").'</td><td>';
|
||||||
|
print '<input size="25" type="text" name="fieldcompany" value="'.$conf->global->LDAP_MEMBER_FIELD_COMPANY.'">';
|
||||||
|
print '</td><td>'.$langs->trans("LDAPFieldCompanyExample").'</td>';
|
||||||
|
print '<td align="right"> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Address
|
// Address
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldAddress").'</td><td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldAddress").'</td><td>';
|
||||||
|
|||||||
252
htdocs/admin/ldap_members_types.php
Normal file
252
htdocs/admin/ldap_members_types.php
Normal file
@ -0,0 +1,252 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/admin/ldap_members_types.php
|
||||||
|
* \ingroup ldap
|
||||||
|
* \brief Page to setup LDAP synchronization for members types
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/ldap.lib.php';
|
||||||
|
|
||||||
|
$langs->load("admin");
|
||||||
|
$langs->load("errors");
|
||||||
|
|
||||||
|
if (!$user->admin)
|
||||||
|
accessforbidden();
|
||||||
|
|
||||||
|
$action = GETPOST('action','aZ09');
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ($action == 'setvalue' && $user->admin)
|
||||||
|
{
|
||||||
|
$error=0;
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_TYPE_DN',GETPOST("membertype"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_TYPE_OBJECT_CLASS',GETPOST("objectclass"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_TYPE_FIELD_FULLNAME',GETPOST("fieldfullname"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_TYPE_FIELD_DESCRIPTION',GETPOST("fielddescription"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS',GETPOST("fieldmembertypemembers"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
|
||||||
|
// This one must be after the others
|
||||||
|
$valkey='';
|
||||||
|
$key=GETPOST("key");
|
||||||
|
if ($key) $valkey=$conf->global->$key;
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_KEY_MEMBERS_TYPES',$valkey,'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$db->commit();
|
||||||
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
llxHeader('',$langs->trans("LDAPSetup"),'EN:Module_LDAP_En|FR:Module_LDAP|ES:Módulo_LDAP');
|
||||||
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
|
|
||||||
|
print load_fiche_titre($langs->trans("LDAPSetup"),$linkback,'title_setup');
|
||||||
|
|
||||||
|
$head = ldap_prepare_head();
|
||||||
|
|
||||||
|
// Test si fonction LDAP actives
|
||||||
|
if (! function_exists("ldap_connect"))
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'memberstypes', $langs->trans("LDAPSetup"), -1);
|
||||||
|
|
||||||
|
|
||||||
|
print $langs->trans("LDAPDescMembersTypes").'<br>';
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?action=setvalue">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
|
||||||
|
$form=new Form($db);
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
$var=true;
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td colspan="4">'.$langs->trans("LDAPSynchronizeMembersTypes").'</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
// DN pour les types de membres
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td width="25%"><span class="fieldrequired">'.$langs->trans("LDAPMemberTypeDn").'</span></td><td>';
|
||||||
|
print '<input size="48" type="text" name="membertype" value="'.$conf->global->LDAP_MEMBER_TYPE_DN.'">';
|
||||||
|
print '</td><td>'.$langs->trans("LDAPMemberTypepDnExample").'</td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// List of object class used to define attributes in structure
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td width="25%"><span class="fieldrequired">'.$langs->trans("LDAPMemberTypeObjectClassList").'</span></td><td>';
|
||||||
|
print '<input size="48" type="text" name="objectclass" value="'.$conf->global->LDAP_MEMBER_TYPE_OBJECT_CLASS.'">';
|
||||||
|
print '</td><td>'.$langs->trans("LDAPMemberTypeObjectClassListExample").'</td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
print '<br>';
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
$var=true;
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td width="25%">'.$langs->trans("LDAPDolibarrMapping").'</td>';
|
||||||
|
print '<td colspan="2">'.$langs->trans("LDAPLdapMapping").'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans("LDAPNamingAttribute").'</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
// Filtre
|
||||||
|
|
||||||
|
// Common name
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldName").'</td><td>';
|
||||||
|
print '<input size="25" type="text" name="fieldfullname" value="'.$conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME.'">';
|
||||||
|
print '</td><td>'.$langs->trans("LDAPFieldCommonNameExample").'</td>';
|
||||||
|
print '<td align="right"><input type="radio" name="key" value="LDAP_MEMBER_TYPE_FIELD_FULLNAME"'.(($conf->global->LDAP_KEY_MEMBERS_TYPES && $conf->global->LDAP_KEY_MEMBERS_TYPES==$conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME)?' checked':'')."></td>";
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Description
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldDescription").'</td><td>';
|
||||||
|
print '<input size="25" type="text" name="fielddescription" value="'.$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION.'">';
|
||||||
|
print '</td><td>'.$langs->trans("LDAPFieldDescriptionExample").'</td>';
|
||||||
|
print '<td align="right"><input type="radio" name="key" value="LDAP_MEMBER_TYPE_FIELD_DESCRIPTION"'.(($conf->global->LDAP_KEY_MEMBERS_TYPES && $conf->global->LDAP_KEY_MEMBER_TYPES==$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION)?' checked':'')."></td>";
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// User group
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldGroupMembers").'</td><td>';
|
||||||
|
print '<input size="25" type="text" name="fieldmembertypemembers" value="'.$conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS.'">';
|
||||||
|
print '</td><td>'.$langs->trans("LDAPFieldGroupMembersExample").'</td>';
|
||||||
|
print '<td align="right"><input type="radio" name="key" value="LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS"'.(($conf->global->LDAP_KEY_MEMBERS_TYPES && $conf->global->LDAP_KEY_MEMBERS_TYPES==$conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS)?' checked':'')."></td>";
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print info_admin($langs->trans("LDAPDescValues"));
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></div>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test de la connexion
|
||||||
|
*/
|
||||||
|
if ($conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1')
|
||||||
|
{
|
||||||
|
$butlabel=$langs->trans("LDAPTestSynchroMemberType");
|
||||||
|
$testlabel='testmembertype';
|
||||||
|
$key=$conf->global->LDAP_KEY_MEMBERS_TYPES;
|
||||||
|
$dn=$conf->global->LDAP_MEMBER_TYPE_DN;
|
||||||
|
$objectclass=$conf->global->LDAP_MEMBER_TYPE_OBJECT_CLASS;
|
||||||
|
|
||||||
|
show_ldap_test_button($butlabel,$testlabel,$key,$dn,$objectclass);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (function_exists("ldap_connect"))
|
||||||
|
{
|
||||||
|
if ($_GET["action"] == 'testmembertype')
|
||||||
|
{
|
||||||
|
// Creation objet
|
||||||
|
$object=new AdherentType($db);
|
||||||
|
$object->initAsSpecimen();
|
||||||
|
|
||||||
|
// Test synchro
|
||||||
|
$ldap=new Ldap();
|
||||||
|
$result=$ldap->connect_bind();
|
||||||
|
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$info=$object->_load_ldap_info();
|
||||||
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
|
// Get a gid number for objectclass PosixGroup
|
||||||
|
if (in_array('posixGroup',$info['objectclass'])) {
|
||||||
|
$info['gidNumber'] = $ldap->getNextGroupGid('LDAP_KEY_MEMBERS_TYPES');
|
||||||
|
}
|
||||||
|
|
||||||
|
$result1=$ldap->delete($dn); // To be sure to delete existing records
|
||||||
|
$result2=$ldap->add($dn,$info,$user); // Now the test
|
||||||
|
$result3=$ldap->delete($dn); // Clean what we did
|
||||||
|
|
||||||
|
if ($result2 > 0)
|
||||||
|
{
|
||||||
|
print img_picto('','info').' ';
|
||||||
|
print '<font class="ok">'.$langs->trans("LDAPSynchroOK").'</font><br>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print img_picto('','error').' ';
|
||||||
|
print '<font class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions");
|
||||||
|
print ': '.$ldap->error;
|
||||||
|
print '</font><br>';
|
||||||
|
print $langs->trans("ErrorLDAPMakeManualTest",$conf->ldap->dir_temp).'<br>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<br>\n";
|
||||||
|
print "LDAP input file used for test:<br><br>\n";
|
||||||
|
print nl2br($ldap->dump_content($dn,$info));
|
||||||
|
print "\n<br>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print img_picto('','error').' ';
|
||||||
|
print '<font class="error">'.$langs->trans("LDAPSynchroKO");
|
||||||
|
print ': '.$ldap->error;
|
||||||
|
print '</font><br>';
|
||||||
|
print $langs->trans("ErrorLDAPMakeManualTest",$conf->ldap->dir_temp).'<br>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
@ -65,6 +65,11 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_MOBILE',GETPOST("fieldmobile"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_MOBILE',GETPOST("fieldmobile"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_FAX',GETPOST("fieldfax"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_FAX',GETPOST("fieldfax"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_COMPANY',GETPOST("fieldcompany"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_ADDRESS',GETPOST("fieldaddress"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_ZIP',GETPOST("fieldzip"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_TOWN',GETPOST("fieldtown"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_COUNTRY',GETPOST("fieldcountry"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_DESCRIPTION',GETPOST("fielddescription"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_DESCRIPTION',GETPOST("fielddescription"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_SID',GETPOST("fieldsid"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_SID',GETPOST("fieldsid"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_TITLE',GETPOST("fieldtitle"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_TITLE',GETPOST("fieldtitle"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
@ -208,7 +213,7 @@ print '</tr>';
|
|||||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td><td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldpassword" value="'.$conf->global->LDAP_FIELD_PASSWORD.'">';
|
print '<input size="25" type="text" name="fieldpassword" value="'.$conf->global->LDAP_FIELD_PASSWORD.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_PASSWORD"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PASSWORD)?' checked':'')."></td>";
|
print '<td align="right"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Password crypted
|
// Password crypted
|
||||||
@ -216,7 +221,7 @@ print '</tr>';
|
|||||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPasswordCrypted").'</td><td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPasswordCrypted").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldpasswordcrypted" value="'.$conf->global->LDAP_FIELD_PASSWORD_CRYPTED.'">';
|
print '<input size="25" type="text" name="fieldpasswordcrypted" value="'.$conf->global->LDAP_FIELD_PASSWORD_CRYPTED.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_PASSWORD_CRYPTED"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PASSWORD_CRYPTED)?' checked':'')."></td>";
|
print '<td align="right"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Mail
|
// Mail
|
||||||
@ -259,12 +264,52 @@ print '</td><td>'.$langs->trans("LDAPFieldFaxExample").'</td>';
|
|||||||
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_FAX"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FAX)?' checked':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_FAX"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FAX)?' checked':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
// Company
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldCompany").'</td><td>';
|
||||||
|
print '<input size="25" type="text" name="fieldcompany" value="'.$conf->global->LDAP_FIELD_COMPANY.'">';
|
||||||
|
print '</td><td>'.$langs->trans("LDAPFieldCompanyExample").'</td>';
|
||||||
|
print '<td align="right"> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Address
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldAddress").'</td><td>';
|
||||||
|
print '<input size="25" type="text" name="fieldaddress" value="'.$conf->global->LDAP_FIELD_ADDRESS.'">';
|
||||||
|
print '</td><td>'.$langs->trans("LDAPFieldAddressExample").'</td>';
|
||||||
|
print '<td align="right"> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// ZIP
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldZip").'</td><td>';
|
||||||
|
print '<input size="25" type="text" name="fieldzip" value="'.$conf->global->LDAP_FIELD_ZIP.'">';
|
||||||
|
print '</td><td>'.$langs->trans("LDAPFieldZipExample").'</td>';
|
||||||
|
print '<td align="right"> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// TOWN
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldTown").'</td><td>';
|
||||||
|
print '<input size="25" type="text" name="fieldtown" value="'.$conf->global->LDAP_FIELD_TOWN.'">';
|
||||||
|
print '</td><td>'.$langs->trans("LDAPFieldTownExample").'</td>';
|
||||||
|
print '<td align="right"> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// COUNTRY
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldCountry").'</td><td>';
|
||||||
|
print '<input size="25" type="text" name="fieldcountry" value="'.$conf->global->LDAP_FIELD_COUNTRY.'">';
|
||||||
|
print '</td><td> </td>';
|
||||||
|
print '<td align="right"> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldTitle").'</td><td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldTitle").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldtitle" value="'.$conf->global->LDAP_FIELD_TITLE.'">';
|
print '<input size="25" type="text" name="fieldtitle" value="'.$conf->global->LDAP_FIELD_TITLE.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldTitleExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldTitleExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_TITLE"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_TITLE)?' checked':'')."></td>";
|
print '<td align="right"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Note
|
// Note
|
||||||
@ -272,7 +317,7 @@ print '</tr>';
|
|||||||
print '<tr class="oddeven"><td>'.$langs->trans("Note").'</td><td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("Note").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fielddescription" value="'.$conf->global->LDAP_FIELD_DESCRIPTION.'">';
|
print '<input size="25" type="text" name="fielddescription" value="'.$conf->global->LDAP_FIELD_DESCRIPTION.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldDescriptionExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldDescriptionExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_DESCRIPTION"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_DESCRIPTION)?' checked':'')."></td>";
|
print '<td align="right"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Sid
|
// Sid
|
||||||
|
|||||||
@ -120,7 +120,7 @@ print '</tr>';
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
print '<br /><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
print '<br><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
@ -427,10 +427,27 @@ if ($action == 'edit')
|
|||||||
print '"></td></tr>';
|
print '"></td></tr>';
|
||||||
|
|
||||||
// Default from type
|
// Default from type
|
||||||
|
|
||||||
$liste = array();
|
$liste = array();
|
||||||
$liste['user'] = $langs->trans('UserEmail');
|
$liste['user'] = $langs->trans('UserEmail');
|
||||||
$liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL)?$langs->trans("NotDefined"):$conf->global->MAIN_INFO_SOCIETE_MAIL).')';
|
$liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL)?$langs->trans("NotDefined"):$conf->global->MAIN_INFO_SOCIETE_MAIL).')';
|
||||||
|
/*
|
||||||
|
$sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE active = 1';
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
$i=0;
|
||||||
|
while($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
if ($obj)
|
||||||
|
{
|
||||||
|
$liste['senderprofile_'.$obj->rowid] = $obj->label.' <'.$obj->email.'>';
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else dol_print_error($db);*/
|
||||||
|
|
||||||
print '<tr '.$bc[$var?1:0].'><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td><td>';
|
print '<tr '.$bc[$var?1:0].'><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td><td>';
|
||||||
print $form->selectarray('MAIN_MAIL_DEFAULT_FROMTYPE', $liste, $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE, 0);
|
print $form->selectarray('MAIN_MAIL_DEFAULT_FROMTYPE', $liste, $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE, 0);
|
||||||
@ -569,13 +586,46 @@ else
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Default from type
|
// Default from type
|
||||||
|
$liste = array();
|
||||||
|
$liste['user'] = $langs->trans('UserEmail');
|
||||||
|
$liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL)?$langs->trans("NotDefined"):$conf->global->MAIN_INFO_SOCIETE_MAIL).')';
|
||||||
|
$sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE active = 1';
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
$i=0;
|
||||||
|
while($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
if ($obj)
|
||||||
|
{
|
||||||
|
$liste['senderprofile_'.$obj->rowid] = $obj->label.' <'.$obj->email.'>';
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
|
|
||||||
print '<tr '.$bc[$var?1:0].'><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td>';
|
print '<tr '.$bc[$var?1:0].'><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user'){
|
if ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user')
|
||||||
|
{
|
||||||
print $langs->trans('UserEmail');
|
print $langs->trans('UserEmail');
|
||||||
} else {
|
}
|
||||||
print $langs->trans('CompanyEmail');
|
else if ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'company')
|
||||||
|
{
|
||||||
|
print $langs->trans('CompanyEmail').' '.dol_escape_htmltag('<'.$mysoc->email.'>');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$id = preg_replace('/senderprofile_/', '', $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE);
|
||||||
|
if ($id > 0)
|
||||||
|
{
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/class/emailsenderprofile.class.php';
|
||||||
|
$emailsenderprofile = new EmailSenderProfile($db);
|
||||||
|
$emailsenderprofile->fetch($id);
|
||||||
|
print $emailsenderprofile->label.' '.dol_escape_htmltag('<'.$emailsenderprofile->email.'>');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -28,8 +28,8 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/admin/mails_templates.php
|
* \file htdocs/admin/mails_templates.php
|
||||||
* \ingroup setup
|
* \ingroup core
|
||||||
* \brief Page to administer data tables
|
* \brief Page to administer emails templates
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
@ -52,8 +52,12 @@ $confirm=GETPOST('confirm','alpha');
|
|||||||
$id=GETPOST('id','int');
|
$id=GETPOST('id','int');
|
||||||
$rowid=GETPOST('rowid','alpha');
|
$rowid=GETPOST('rowid','alpha');
|
||||||
$search_label=GETPOST('search_label','alpha');
|
$search_label=GETPOST('search_label','alpha');
|
||||||
|
$search_type_template=GETPOST('search_type_template','alpha');
|
||||||
|
$search_lang=GETPOST('search_lang','alpha');
|
||||||
|
$search_fk_user=GETPOST('search_fk_user','intcomma');
|
||||||
|
$search_topic=GETPOST('search_topic','alpha');
|
||||||
|
|
||||||
$allowed=$user->admin;
|
$allowed=1;
|
||||||
if (! $allowed) accessforbidden();
|
if (! $allowed) accessforbidden();
|
||||||
|
|
||||||
$acts[0] = "activate";
|
$acts[0] = "activate";
|
||||||
@ -73,6 +77,9 @@ $offset = $listlimit * $page ;
|
|||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
|
if (empty($sortfield)) $sortfield='label, lang, position';
|
||||||
|
if (empty($sortorder)) $sortorder='ASC';
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$hookmanager->initHooks(array('emailtemplates'));
|
$hookmanager->initHooks(array('emailtemplates'));
|
||||||
|
|
||||||
@ -82,30 +89,24 @@ $tabname[25]= MAIN_DB_PREFIX."c_email_templates";
|
|||||||
|
|
||||||
// Criteria to sort dictionaries
|
// Criteria to sort dictionaries
|
||||||
$tabsqlsort=array();
|
$tabsqlsort=array();
|
||||||
$tabsqlsort[25]="label ASC";
|
$tabsqlsort[25]="label ASC, lang ASC, position ASC";
|
||||||
|
|
||||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||||
$tabfield=array();
|
$tabfield=array();
|
||||||
$tabfield[25]= "label,type_template,lang,private,position,topic,content";
|
$tabfield[25]= "label,type_template,lang,fk_user,private,position,topic,joinfiles,content";
|
||||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfield[25].=',content_lines';
|
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfield[25].=',content_lines';
|
||||||
|
|
||||||
// Nom des champs d'edition pour modification d'un enregistrement
|
// Nom des champs d'edition pour modification d'un enregistrement
|
||||||
$tabfieldvalue=array();
|
$tabfieldvalue=array();
|
||||||
$tabfieldvalue[25]= "label,type_template,lang,private,position,topic,content";
|
$tabfieldvalue[25]= "label,type_template,fk_user,lang,private,position,topic,joinfiles,content";
|
||||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldvalue[25].=',content_lines';
|
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldvalue[25].=',content_lines';
|
||||||
|
|
||||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||||
$tabfieldinsert=array();
|
$tabfieldinsert=array();
|
||||||
$tabfieldinsert[25]= "label,type_template,lang,private,position,topic,content";
|
$tabfieldinsert[25]= "label,type_template,fk_user,lang,private,position,topic,joinfiles,content";
|
||||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldinsert[25].=',content_lines';
|
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldinsert[25].=',content_lines';
|
||||||
$tabfieldinsert[25].=',entity'; // Must be at end because not into other arrays
|
$tabfieldinsert[25].=',entity'; // Must be at end because not into other arrays
|
||||||
|
|
||||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
|
||||||
// Example: "" if id field is "rowid" and has autoincrement on
|
|
||||||
// "nameoffield" if id field is not "rowid" or has not autoincrement on
|
|
||||||
$tabrowid=array();
|
|
||||||
$tabrowid[25]= "";
|
|
||||||
|
|
||||||
// Condition to show dictionary in setup page
|
// Condition to show dictionary in setup page
|
||||||
$tabcond=array();
|
$tabcond=array();
|
||||||
$tabcond[25]= true;
|
$tabcond[25]= true;
|
||||||
@ -117,22 +118,35 @@ $formmail=new FormMail($db);
|
|||||||
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
|
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
|
||||||
{
|
{
|
||||||
$tmp=FormMail::getAvailableSubstitKey('formemail');
|
$tmp=FormMail::getAvailableSubstitKey('formemail');
|
||||||
$tmp['__(AnyTranslationKey)__']='__(AnyTranslationKey)__';
|
$tmp['__(AnyTranslationKey)__']='Translation';
|
||||||
$helpsubstit = $langs->trans("AvailableVariables").':<br>'.implode('<br>', $tmp);
|
$helpsubstit = $langs->trans("AvailableVariables").':<br>';
|
||||||
$helpsubstitforlines = $langs->trans("AvailableVariables").':<br>'.implode('<br>', $tmp);
|
$helpsubstitforlines = $langs->trans("AvailableVariables").':<br>';
|
||||||
|
foreach($tmp as $key => $val)
|
||||||
|
{
|
||||||
|
$helpsubstit.=$key.' -> '.$val.'<br>';
|
||||||
|
$helpsubstitforlines.=$key.' -> '.$val.'<br>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$tmp=FormMail::getAvailableSubstitKey('formemailwithlines');
|
$tmp=FormMail::getAvailableSubstitKey('formemailwithlines');
|
||||||
$tmp['__(AnyTranslationKey)__']='__(AnyTranslationKey)__';
|
$tmp['__(AnyTranslationKey)__']='Translation';
|
||||||
$helpsubstit = $langs->trans("AvailableVariables").':<br>'.implode('<br>', $tmp);
|
$helpsubstit = $langs->trans("AvailableVariables").':<br>';
|
||||||
|
$helpsubstitforlines = $langs->trans("AvailableVariables").':<br>';
|
||||||
|
foreach($tmp as $key => $val)
|
||||||
|
{
|
||||||
|
$helpsubstit.=$key.' -> '.$val.'<br>';
|
||||||
|
}
|
||||||
$tmp=FormMail::getAvailableSubstitKey('formemailforlines');
|
$tmp=FormMail::getAvailableSubstitKey('formemailforlines');
|
||||||
$helpsubstitforlines = $langs->trans("AvailableVariables").':<br>'.implode('<br>', $tmp);
|
foreach($tmp as $key => $val)
|
||||||
|
{
|
||||||
|
$helpsubstitforlines.=$key.' -> '.$val.'<br>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$tabhelp=array();
|
$tabhelp=array();
|
||||||
$tabhelp[25] = array('topic'=>$helpsubstit,'content'=>$helpsubstit,'content_lines'=>$helpsubstitforlines,'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
|
$tabhelp[25] = array('topic'=>$helpsubstit,'joinfiles'=>$langs->trans('AttachMainDocByDefault'), 'content'=>$helpsubstit,'content_lines'=>$helpsubstitforlines,'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
|
||||||
|
|
||||||
// List of check for fields (NOT USED YET)
|
// List of check for fields (NOT USED YET)
|
||||||
$tabfieldcheck=array();
|
$tabfieldcheck=array();
|
||||||
@ -154,7 +168,12 @@ if ($conf->supplier_proposal->enabled) $elementList['supplier_proposal_send']=$l
|
|||||||
if ($conf->fournisseur->enabled) $elementList['order_supplier_send']=$langs->trans('MailToSendSupplierOrder');
|
if ($conf->fournisseur->enabled) $elementList['order_supplier_send']=$langs->trans('MailToSendSupplierOrder');
|
||||||
if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice');
|
if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice');
|
||||||
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
|
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
|
||||||
|
if ($conf->adherent->enabled) $elementList['member']=$langs->trans('MailToMember');
|
||||||
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
|
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
|
||||||
|
$elementList['user']=$langs->trans('MailToUser');
|
||||||
|
$elementList['all'] =$langs->trans('VisibleEverywhere');
|
||||||
|
$elementList['none']=$langs->trans('VisibleNowhere');
|
||||||
|
|
||||||
|
|
||||||
$parameters=array('elementList'=>$elementList);
|
$parameters=array('elementList'=>$elementList);
|
||||||
$reshook=$hookmanager->executeHooks('emailElementlist',$parameters); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('emailElementlist',$parameters); // Note that $action and $object may have been modified by some hooks
|
||||||
@ -171,8 +190,8 @@ $id = 25;
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
@ -184,6 +203,10 @@ if (empty($reshook))
|
|||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_label='';
|
$search_label='';
|
||||||
|
$search_type_template='';
|
||||||
|
$search_lang='';
|
||||||
|
$search_fk_user='';
|
||||||
|
$search_topic='';
|
||||||
$toselect='';
|
$toselect='';
|
||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
@ -200,12 +223,14 @@ if (empty($reshook))
|
|||||||
$ok=1;
|
$ok=1;
|
||||||
foreach ($listfield as $f => $value)
|
foreach ($listfield as $f => $value)
|
||||||
{
|
{
|
||||||
|
// Not mandatory fields
|
||||||
|
if ($value == 'joinfiles') continue;
|
||||||
if ($value == 'content') continue;
|
if ($value == 'content') continue;
|
||||||
if ($value == 'content_lines') continue;
|
if ($value == 'content_lines') continue;
|
||||||
if ($value == 'content') $value='content-'.$rowid;
|
|
||||||
if ($value == 'content_lines') $value='content_lines-'.$rowid;
|
|
||||||
|
|
||||||
if ((! isset($_POST[$value]) || $_POST[$value]=='') && $value != 'lang')
|
if (GETPOST('actionmodify') && $value == 'topic') $_POST['topic']=$_POST['topic-'.$rowid];
|
||||||
|
|
||||||
|
if ((! isset($_POST[$value]) || $_POST[$value]=='' || $_POST[$value]=='-1') && $value != 'lang' && $value != 'fk_user' && $value != 'position')
|
||||||
{
|
{
|
||||||
$ok=0;
|
$ok=0;
|
||||||
$fieldnamekey=$listfield[$f];
|
$fieldnamekey=$listfield[$f];
|
||||||
@ -214,7 +239,11 @@ if (empty($reshook))
|
|||||||
if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
|
if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
|
||||||
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
|
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
|
||||||
if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
|
if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
|
||||||
if ($fieldnamekey == 'type') $fieldnamekey = 'Type';
|
if ($fieldnamekey == 'type_template') $fieldnamekey = 'TypeOfTemplate';
|
||||||
|
if ($fieldnamekey == 'fk_user') $fieldnamekey = 'Owner';
|
||||||
|
if ($fieldnamekey == 'private') $fieldnamekey = 'Private';
|
||||||
|
if ($fieldnamekey == 'position') $fieldnamekey = 'Position';
|
||||||
|
if ($fieldnamekey == 'topic') $fieldnamekey = 'Topic';
|
||||||
|
|
||||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||||
}
|
}
|
||||||
@ -223,46 +252,26 @@ if (empty($reshook))
|
|||||||
// Si verif ok et action add, on ajoute la ligne
|
// Si verif ok et action add, on ajoute la ligne
|
||||||
if ($ok && GETPOST('actionadd'))
|
if ($ok && GETPOST('actionadd'))
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id])
|
|
||||||
{
|
|
||||||
// Recupere id libre pour insertion
|
|
||||||
$newid=0;
|
|
||||||
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
|
|
||||||
$result = $db->query($sql);
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($result);
|
|
||||||
$newid=($obj->newid + 1);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add new entry
|
// Add new entry
|
||||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||||
// List of fields
|
// List of fields
|
||||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
|
||||||
$sql.= $tabrowid[$id].",";
|
|
||||||
$sql.= $tabfieldinsert[$id];
|
$sql.= $tabfieldinsert[$id];
|
||||||
$sql.=",active)";
|
$sql.=",active)";
|
||||||
$sql.= " VALUES(";
|
$sql.= " VALUES(";
|
||||||
|
|
||||||
// List of values
|
// List of values
|
||||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
|
||||||
$sql.= $newid.",";
|
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach ($listfieldinsert as $f => $value)
|
foreach ($listfieldinsert as $f => $value)
|
||||||
{
|
{
|
||||||
|
//var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value);
|
||||||
$keycode=$listfieldvalue[$i];
|
$keycode=$listfieldvalue[$i];
|
||||||
if ($value == 'lang') $keycode='langcode';
|
if ($value == 'lang') $keycode='langcode';
|
||||||
|
|
||||||
//var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value);
|
|
||||||
if ($value == 'entity') $_POST[$keycode] = $conf->entity;
|
if ($value == 'entity') $_POST[$keycode] = $conf->entity;
|
||||||
if ($i) $sql.=",";
|
if ($i) $sql.=",";
|
||||||
|
if ($value == 'fk_user' && ! ($_POST[$keycode] > 0)) $_POST[$keycode]='';
|
||||||
if ($value == 'private' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='0';
|
if ($value == 'private' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='0';
|
||||||
if ($value == 'position' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='1';
|
if ($value == 'position' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='1';
|
||||||
if ($_POST[$keycode] == '' || ($keycode == 'langcode' && empty($_POST[$keycode]))) $sql.="null"; // For vat, we want/accept code = ''
|
if ($_POST[$keycode] == '' && $keycode != 'langcode') $sql.="null"; // lang must be '' if not defined so the unique key that include lang will work
|
||||||
else $sql.="'".$db->escape($_POST[$keycode])."'";
|
else $sql.="'".$db->escape($_POST[$keycode])."'";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -289,23 +298,20 @@ if (empty($reshook))
|
|||||||
// Si verif ok et action modify, on modifie la ligne
|
// Si verif ok et action modify, on modifie la ligne
|
||||||
if ($ok && GETPOST('actionmodify'))
|
if ($ok && GETPOST('actionmodify'))
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
$rowidcol="rowid";
|
||||||
else { $rowidcol="rowid"; }
|
|
||||||
|
|
||||||
// Modify entry
|
// Modify entry
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||||
// Modifie valeur des champs
|
// Modifie valeur des champs
|
||||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldmodify))
|
|
||||||
{
|
|
||||||
$sql.= $tabrowid[$id]."=";
|
|
||||||
$sql.= "'".$db->escape($rowid)."', ";
|
|
||||||
}
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($listfieldmodify as $field)
|
foreach ($listfieldmodify as $field)
|
||||||
{
|
{
|
||||||
$keycode=$listfieldvalue[$i];
|
$keycode=$listfieldvalue[$i];
|
||||||
if ($field == 'lang') $keycode='langcode';
|
if ($field == 'lang') $keycode='langcode';
|
||||||
|
|
||||||
|
if ($field == 'fk_user' && ! ($_POST['fk_user'] > 0)) $_POST['fk_user']='';
|
||||||
|
if ($field == 'topic') $_POST['topic']=$_POST['topic-'.$rowid];
|
||||||
|
if ($field == 'joinfiles') $_POST['joinfiles']=$_POST['joinfiles-'.$rowid];
|
||||||
if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid];
|
if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid];
|
||||||
if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid];
|
if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid];
|
||||||
if ($field == 'entity') $_POST[$keycode] = $conf->entity;
|
if ($field == 'entity') $_POST[$keycode] = $conf->entity;
|
||||||
@ -320,7 +326,11 @@ if (empty($reshook))
|
|||||||
dol_syslog("actionmodify", LOG_DEBUG);
|
dol_syslog("actionmodify", LOG_DEBUG);
|
||||||
//print $sql;
|
//print $sql;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if (! $resql)
|
if ($resql)
|
||||||
|
{
|
||||||
|
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($db->error(), null, 'errors');
|
setEventMessages($db->error(), null, 'errors');
|
||||||
}
|
}
|
||||||
@ -329,8 +339,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
$rowidcol="rowid";
|
||||||
else { $rowidcol="rowid"; }
|
|
||||||
|
|
||||||
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
|
||||||
|
|
||||||
@ -352,15 +361,9 @@ if (empty($reshook))
|
|||||||
// activate
|
// activate
|
||||||
if ($action == $acts[0])
|
if ($action == $acts[0])
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
$rowidcol="rowid";
|
||||||
else { $rowidcol="rowid"; }
|
|
||||||
|
|
||||||
if ($rowid) {
|
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
|
||||||
elseif ($code) {
|
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'";
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
@ -372,15 +375,9 @@ if (empty($reshook))
|
|||||||
// disable
|
// disable
|
||||||
if ($action == $acts[1])
|
if ($action == $acts[1])
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
$rowidcol="rowid";
|
||||||
else { $rowidcol="rowid"; }
|
|
||||||
|
|
||||||
if ($rowid) {
|
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
|
||||||
elseif ($code) {
|
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'";
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
@ -408,18 +405,22 @@ print load_fiche_titre($titre,$linkback,$titlepicto);
|
|||||||
|
|
||||||
$h = 0;
|
$h = 0;
|
||||||
|
|
||||||
|
|
||||||
|
if ($user->admin && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates'))
|
||||||
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/mails.php";
|
$head[$h][0] = DOL_URL_ROOT."/admin/mails.php";
|
||||||
$head[$h][1] = $langs->trans("OutGoingEmailSetup");
|
$head[$h][1] = $langs->trans("OutGoingEmailSetup");
|
||||||
$head[$h][2] = 'common';
|
$head[$h][2] = 'common';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
if ($conf->mailing->enabled)
|
if (! empty($conf->mailing->enabled))
|
||||||
{
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/mails_emailing.php";
|
$head[$h][0] = DOL_URL_ROOT."/admin/mails_emailing.php";
|
||||||
$head[$h][1] = $langs->trans("OutGoingEmailSetupForEmailing");
|
$head[$h][1] = $langs->trans("OutGoingEmailSetupForEmailing");
|
||||||
$head[$h][2] = 'common_emailing';
|
$head[$h][2] = 'common_emailing';
|
||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php";
|
$head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php";
|
||||||
$head[$h][1] = $langs->trans("DictionaryEMailTemplates");
|
$head[$h][1] = $langs->trans("DictionaryEMailTemplates");
|
||||||
@ -437,15 +438,23 @@ if ($action == 'delete')
|
|||||||
//var_dump($elementList);
|
//var_dump($elementList);
|
||||||
|
|
||||||
|
|
||||||
$sql="SELECT rowid as rowid, label, type_template, lang, private, position, topic, content_lines, content, active";
|
$sql="SELECT rowid as rowid, label, type_template, lang, fk_user, private, position, topic, joinfiles, content_lines, content, active";
|
||||||
$sql.=" FROM ".MAIN_DB_PREFIX."c_email_templates";
|
$sql.=" FROM ".MAIN_DB_PREFIX."c_email_templates";
|
||||||
$sql.=" WHERE entity IN (".getEntity('email_template').")";
|
$sql.=" WHERE entity IN (".getEntity('email_template').")";
|
||||||
if ($search_label) $sql.=natural_search('label', $search_label);
|
if (! $user->admin)
|
||||||
|
{
|
||||||
|
$sql.=" AND (private = 0 OR (private = 1 AND fk_user = ".$user->id."))"; // Show only public and private to me
|
||||||
|
$sql.=" AND (active = 1 OR fk_user = ".$user->id.")"; // Show only active or owned by me
|
||||||
|
}
|
||||||
if (empty($conf->global->MAIN_MULTILANGS))
|
if (empty($conf->global->MAIN_MULTILANGS))
|
||||||
{
|
{
|
||||||
$sql.= " AND (lang = '".$langs->defaultlang."' OR lang IS NULL)";
|
$sql.= " AND (lang = '".$langs->defaultlang."' OR lang IS NULL OR lang = '')";
|
||||||
}
|
}
|
||||||
|
if ($search_label) $sql.=natural_search('label', $search_label);
|
||||||
|
if ($search_type_template != '' && $search_type_template != '-1') $sql.=natural_search('type_template', $search_type_template);
|
||||||
|
if ($search_lang) $sql.=natural_search('lang', $search_lang);
|
||||||
|
if ($search_fk_user != '' && $search_fk_user != '-1') $sql.=natural_search('fk_user', $search_fk_user, 2);
|
||||||
|
if ($search_topic) $sql.=natural_search('topic', $search_topic);
|
||||||
if ($sortfield)
|
if ($sortfield)
|
||||||
{
|
{
|
||||||
// If sort order is "country", we use country_code instead
|
// If sort order is "country", we use country_code instead
|
||||||
@ -473,17 +482,14 @@ $fieldlist=explode(',',$tabfield[$id]);
|
|||||||
$alabelisused=0;
|
$alabelisused=0;
|
||||||
$var=false;
|
$var=false;
|
||||||
|
|
||||||
$fieldlist=explode(',',$tabfield[$id]);
|
|
||||||
|
|
||||||
//if ($action != 'edit')
|
|
||||||
//{
|
|
||||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
// Line for title
|
// Line to enter new values (title)
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
@ -492,11 +498,17 @@ $fieldlist=explode(',',$tabfield[$id]);
|
|||||||
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
||||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||||
$align="left";
|
$align="left";
|
||||||
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
|
if ($fieldlist[$field]=='fk_user') { $valuetoshow=$langs->trans("Owner");}
|
||||||
|
if ($fieldlist[$field]=='lang') { $valuetoshow=(empty($conf->global->MAIN_MULTILANGS) ? ' ' : $langs->trans("Language")); }
|
||||||
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
|
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
|
||||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
||||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
|
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
|
||||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||||
|
if ($fieldlist[$field]=='private') { $align='center'; }
|
||||||
|
if ($fieldlist[$field]=='position') { $align='center'; }
|
||||||
|
|
||||||
|
if ($fieldlist[$field]=='topic') { $valuetoshow=''; }
|
||||||
|
if ($fieldlist[$field]=='joinfiles') { $valuetoshow=''; }
|
||||||
if ($fieldlist[$field]=='content') { $valuetoshow=''; }
|
if ($fieldlist[$field]=='content') { $valuetoshow=''; }
|
||||||
if ($fieldlist[$field]=='content_lines') { $valuetoshow=''; }
|
if ($fieldlist[$field]=='content_lines') { $valuetoshow=''; }
|
||||||
|
|
||||||
@ -514,73 +526,89 @@ $fieldlist=explode(',',$tabfield[$id]);
|
|||||||
}
|
}
|
||||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
||||||
}
|
}
|
||||||
|
print '<td>';
|
||||||
print '<td colspan="3">';
|
|
||||||
print '<input type="hidden" name="id" value="' . $id . '">';
|
print '<input type="hidden" name="id" value="' . $id . '">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Line to enter new values
|
|
||||||
print "<tr ".$bcnd[$var].">";
|
|
||||||
|
|
||||||
$obj = new stdClass();
|
$obj = new stdClass();
|
||||||
// If data was already input, we define them in obj to populate input fields.
|
// If data was already input, we define them in obj to populate input fields.
|
||||||
if (GETPOST('actionadd'))
|
if (GETPOST('actionadd'))
|
||||||
{
|
{
|
||||||
foreach ($fieldlist as $key=>$val)
|
foreach ($fieldlist as $key => $val) {
|
||||||
{
|
|
||||||
if (GETPOST($val) != '')
|
if (GETPOST($val) != '')
|
||||||
$obj->$val = GETPOST($val);
|
$obj->$val = GETPOST($val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmpaction = 'create';
|
$tmpaction = 'create';
|
||||||
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
$parameters = array(
|
||||||
|
'fieldlist' => $fieldlist,
|
||||||
|
'tabname' => $tabname[$id]
|
||||||
|
);
|
||||||
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
$error = $hookmanager->error;
|
||||||
|
$errors = $hookmanager->errors;
|
||||||
|
|
||||||
|
|
||||||
|
// Line to enter new values (input fields)
|
||||||
|
print "<tr " . $bcnd[$var] . ">";
|
||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates' && $action == 'edit')
|
if ($action == 'edit') {
|
||||||
{
|
|
||||||
fieldList($fieldlist, $obj, $tabname[$id], 'hide');
|
fieldList($fieldlist, $obj, $tabname[$id], 'hide');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
fieldList($fieldlist, $obj, $tabname[$id], 'add');
|
fieldList($fieldlist, $obj, $tabname[$id], 'add');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td align="right" colspan="3">';
|
print '<td align="right">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
$fieldsforcontent = array('content');
|
$fieldsforcontent = array('topic', 'joinfiles', 'content');
|
||||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
|
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $fieldsforcontent = array('content','content_lines'); }
|
||||||
{
|
|
||||||
$fieldsforcontent = array('content', 'content_lines');
|
|
||||||
}
|
|
||||||
foreach ($fieldsforcontent as $tmpfieldlist)
|
foreach ($fieldsforcontent as $tmpfieldlist)
|
||||||
{
|
{
|
||||||
print '<tr class="impair nodrag nodrop nohover"><td colspan="5">';
|
print '<tr class="impair nodrag nodrop nohover"><td colspan="6" class="nobottom">';
|
||||||
if ($tmpfieldlist == 'content') print '<strong>'.$form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong><br>';
|
// Label
|
||||||
if ($tmpfieldlist == 'content_lines') print '<strong>'.$form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong><br>';
|
if ($tmpfieldlist == 'topic')
|
||||||
|
|
||||||
if ($context != 'hide')
|
|
||||||
{
|
{
|
||||||
|
print '<strong>' . $form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> ';
|
||||||
|
}
|
||||||
|
if ($tmpfieldlist == 'joinfiles')
|
||||||
|
{
|
||||||
|
print '<strong>' . $form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> ';
|
||||||
|
}
|
||||||
|
if ($tmpfieldlist == 'content')
|
||||||
|
print '<strong>' . $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> ';
|
||||||
|
if ($tmpfieldlist == 'content_lines')
|
||||||
|
print '<strong>' . $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong><br>';
|
||||||
|
// Input field
|
||||||
|
if ($tmpfieldlist == 'topic') {
|
||||||
|
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">';
|
||||||
|
}
|
||||||
|
else if ($tmpfieldlist == 'joinfiles') {
|
||||||
|
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($context != 'hide') {
|
||||||
// print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
|
// print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
|
||||||
$okforextended = true;
|
$okforextended = true;
|
||||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended=false;
|
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
|
||||||
|
$okforextended = false;
|
||||||
$doleditor = new DolEditor($tmpfieldlist, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 120, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%');
|
$doleditor = new DolEditor($tmpfieldlist, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 120, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%');
|
||||||
print $doleditor->Create(1);
|
print $doleditor->Create(1);
|
||||||
}
|
}
|
||||||
else print ' ';
|
else
|
||||||
|
print ' ';
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($tmpfieldlist == 'content')
|
if ($tmpfieldlist == 'topic') {
|
||||||
{
|
print '<td align="center" rowspan="' . (count($fieldsforcontent)) . '">';
|
||||||
print '<td align="center" colspan="3" rowspan="'.(count($fieldsforcontent)).'">';
|
if ($action != 'edit') {
|
||||||
if ($action != 'edit')
|
|
||||||
{
|
|
||||||
print '<input type="submit" class="button" name="actionadd" value="' . $langs->trans("Add") . '">';
|
print '<input type="submit" class="button" name="actionadd" value="' . $langs->trans("Add") . '">';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -595,16 +623,18 @@ $fieldlist=explode(',',$tabfield[$id]);
|
|||||||
//print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
//print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
//}
|
|
||||||
|
|
||||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
// List of available record in database
|
// List of available record in database
|
||||||
@ -637,12 +667,31 @@ if ($resql)
|
|||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
if ($value == 'label') print '<td class="liste_titre"><input type="text" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
if ($value == 'label') print '<td class="liste_titre"><input type="text" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||||
|
elseif ($value == 'lang')
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
elseif ($value == 'fk_user')
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
$restrictid=array();
|
||||||
|
if (! $user->admin) $restrictid=array($user->id);
|
||||||
|
//var_dump($restrictid);
|
||||||
|
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth200');
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
elseif ($value == 'topic') print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
|
||||||
|
elseif ($value == 'type_template')
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre">'.$form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100onsmartphone').'</td>';
|
||||||
|
}
|
||||||
elseif (! in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>';
|
elseif (! in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>';
|
||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>';
|
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
|
||||||
// Action column
|
// Action column
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right" width="64">';
|
||||||
$searchpicto=$form->showFilterButtons();
|
$searchpicto=$form->showFilterButtons();
|
||||||
print $searchpicto;
|
print $searchpicto;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -667,10 +716,15 @@ if ($resql)
|
|||||||
*/
|
*/
|
||||||
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut
|
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut
|
||||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||||
|
if ($fieldlist[$field]=='fk_user') { $valuetoshow=$langs->trans("Owner"); }
|
||||||
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
|
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
|
||||||
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
|
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
|
||||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
|
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
|
||||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||||
|
if ($fieldlist[$field]=='private') { $align='center'; }
|
||||||
|
if ($fieldlist[$field]=='position') { $align='center'; }
|
||||||
|
|
||||||
|
if ($fieldlist[$field]=='joinfiles') { $valuetoshow=$langs->trans("FilesAttachedToEmail"); $align='center'; }
|
||||||
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); $showfield=0;}
|
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); $showfield=0;}
|
||||||
if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); $showfield=0; }
|
if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); $showfield=0; }
|
||||||
|
|
||||||
@ -688,7 +742,6 @@ if ($resql)
|
|||||||
|
|
||||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder);
|
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print getTitleFieldOfList('');
|
print getTitleFieldOfList('');
|
||||||
print getTitleFieldOfList('');
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if ($num)
|
if ($num)
|
||||||
@ -696,9 +749,8 @@ if ($resql)
|
|||||||
// Lines with values
|
// Lines with values
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
|
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
//print_r($obj);
|
|
||||||
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
||||||
|
|
||||||
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
|
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
|
||||||
@ -711,7 +763,8 @@ if ($resql)
|
|||||||
// Show fields
|
// Show fields
|
||||||
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit');
|
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit');
|
||||||
|
|
||||||
print '<td colspan="3" align="center">';
|
print '<td></td><td></td><td></td>';
|
||||||
|
print '<td align="center">';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||||
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||||
@ -719,10 +772,10 @@ if ($resql)
|
|||||||
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
$fieldsforcontent = array('content');
|
$fieldsforcontent = array('topic', 'joinfiles', 'content');
|
||||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
|
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
|
||||||
{
|
{
|
||||||
$fieldsforcontent = array('content', 'content_lines');
|
$fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines');
|
||||||
}
|
}
|
||||||
foreach ($fieldsforcontent as $tmpfieldlist)
|
foreach ($fieldsforcontent as $tmpfieldlist)
|
||||||
{
|
{
|
||||||
@ -733,15 +786,28 @@ if ($resql)
|
|||||||
$class = 'tddict';
|
$class = 'tddict';
|
||||||
// Show value for field
|
// Show value for field
|
||||||
if ($showfield) {
|
if ($showfield) {
|
||||||
|
// Show line for topic, joinfiles and content
|
||||||
print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$rowid.' ">';
|
print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$rowid.' ">';
|
||||||
print '<td colspan="5">'; // To create an artificial CR for the current tr we are on
|
print '<td colspan="8">';
|
||||||
|
if ($tmpfieldlist == 'topic')
|
||||||
|
{
|
||||||
|
print '<strong>' . $form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> ';
|
||||||
|
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">';
|
||||||
|
}
|
||||||
|
if ($tmpfieldlist == 'joinfiles')
|
||||||
|
{
|
||||||
|
print '<strong>' . $form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> ';
|
||||||
|
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'-'.$rowid.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">';
|
||||||
|
}
|
||||||
|
if ($tmpfieldlist == 'content')
|
||||||
|
{
|
||||||
$okforextended = true;
|
$okforextended = true;
|
||||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false;
|
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false;
|
||||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
|
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
|
||||||
print $doleditor->Create(1);
|
print $doleditor->Create(1);
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td></td><td></td><td></td>';
|
print '<td></td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -770,49 +836,70 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
$valuetoshow = $valuetoshow.' - '.$langs->trans("Language_".$valuetoshow);
|
$valuetoshow = $valuetoshow.' - '.$langs->trans("Language_".$valuetoshow);
|
||||||
}
|
}
|
||||||
|
if ($value == 'fk_user')
|
||||||
|
{
|
||||||
|
if ($valuetoshow > 0)
|
||||||
|
{
|
||||||
|
$fuser=new User($db);
|
||||||
|
$fuser->fetch($valuetoshow);
|
||||||
|
$valuetoshow = $fuser->getNomUrl(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($value == 'private')
|
||||||
|
{
|
||||||
|
$align="center";
|
||||||
|
if ($valuetoshow) $valuetoshow=yn($valuetoshow);
|
||||||
|
else $valuetoshow='';
|
||||||
|
}
|
||||||
|
if ($value == 'position')
|
||||||
|
{
|
||||||
|
$align="center";
|
||||||
|
}
|
||||||
|
if ($value == 'joinfiles')
|
||||||
|
{
|
||||||
|
$align="center";
|
||||||
|
if ($valuetoshow) $valuetoshow=1;
|
||||||
|
else $valuetoshow='';
|
||||||
|
}
|
||||||
|
|
||||||
$class='tddict';
|
$class='tddict';
|
||||||
// Show value for field
|
// Show value for field
|
||||||
if ($showfield)
|
if ($showfield)
|
||||||
{
|
{
|
||||||
print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
print '<!-- '.$fieldlist[$field].' -->';
|
||||||
|
print '<td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can an entry be erased or disabled ?
|
// Can an entry be erased or disabled ?
|
||||||
$iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default
|
$iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default
|
||||||
$canbemodified=$iserasable;
|
if (! $user->admin && $obj->fk_user != $user->id)
|
||||||
|
{
|
||||||
|
$iserasable=0;
|
||||||
|
$canbedisabled=0;
|
||||||
|
$canbemodified=0;
|
||||||
|
}
|
||||||
|
|
||||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
|
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
|
||||||
if ($param) $url .= '&'.$param;
|
if ($param) $url .= '&'.$param;
|
||||||
$url.='&';
|
$url.='&';
|
||||||
|
|
||||||
// Active
|
// Status / Active
|
||||||
print '<td align="center" class="nowrap">';
|
print '<td align="center" class="nowrap">';
|
||||||
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
||||||
else
|
|
||||||
{
|
|
||||||
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO'))) print $langs->trans("AlwaysActive");
|
|
||||||
else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) print $langs->trans("Deprecated");
|
|
||||||
else if (isset($obj->type) && in_array($obj->type, array('system')) && ! empty($obj->active) && $obj->code != 'AC_OTH') print $langs->trans("UsedOnlyWithTypeOption");
|
|
||||||
else print $langs->trans("AlwaysActive");
|
|
||||||
}
|
|
||||||
print "</td>";
|
print "</td>";
|
||||||
|
|
||||||
// Modify link
|
// Modify link / Delete link
|
||||||
if ($canbemodified) print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
|
print '<td align="center" width="64">';
|
||||||
else print '<td> </td>';
|
if ($canbemodified) print '<a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a>';
|
||||||
|
|
||||||
// Delete link
|
|
||||||
if ($iserasable)
|
if ($iserasable)
|
||||||
{
|
{
|
||||||
print '<td align="center">';
|
print ' <a href="'.$url.'action=delete">'.img_delete().'</a>';
|
||||||
if ($user->admin) print '<a href="'.$url.'action=delete">'.img_delete().'</a>';
|
|
||||||
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
|
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
|
||||||
print '</td>';
|
|
||||||
}
|
}
|
||||||
else print '<td> </td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$fieldsforcontent = array('content');
|
$fieldsforcontent = array('content');
|
||||||
@ -854,6 +941,7 @@ else {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
@ -875,7 +963,7 @@ $db->close();
|
|||||||
*/
|
*/
|
||||||
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||||
{
|
{
|
||||||
global $conf,$langs,$db;
|
global $conf, $langs, $user, $db;
|
||||||
global $form;
|
global $form;
|
||||||
global $region_id;
|
global $region_id;
|
||||||
global $elementList,$sourceList,$localtax_typeList;
|
global $elementList,$sourceList,$localtax_typeList;
|
||||||
@ -883,11 +971,43 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
|||||||
|
|
||||||
$formadmin = new FormAdmin($db);
|
$formadmin = new FormAdmin($db);
|
||||||
$formcompany = new FormCompany($db);
|
$formcompany = new FormCompany($db);
|
||||||
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
|
|
||||||
|
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
if ($fieldlist[$field] == 'lang')
|
if ($fieldlist[$field] == 'fk_user')
|
||||||
|
{
|
||||||
|
print '<td>';
|
||||||
|
if ($user->admin)
|
||||||
|
{
|
||||||
|
print $form->select_dolusers($obj->{$fieldlist[$field]}, 'fk_user', 1, null, 0, '', null, 0, 0, 1, '', 0, '', 'maxwidth200');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($context == 'add') // I am not admin and we show the add form
|
||||||
|
{
|
||||||
|
print $user->getNomUrl(1); // Me
|
||||||
|
$forcedvalue=$user->id;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($obj && ! empty($obj->{$fieldlist[$field]}) && $obj->{$fieldlist[$field]} > 0)
|
||||||
|
{
|
||||||
|
$fuser=new User($db);
|
||||||
|
$fuser->fetch($obj->{$fieldlist[$field]});
|
||||||
|
print $fuser->getNomUrl(1);
|
||||||
|
$forcedvalue=$fuser->id;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$forcedvalue=$obj->{$fieldlist[$field]};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$keyname=$fieldlist[$field];
|
||||||
|
print '<input type="hidden" value="'.$forcedvalue.'" name="'.$keyname.'">';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
elseif ($fieldlist[$field] == 'lang')
|
||||||
{
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||||
@ -912,21 +1032,48 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
|||||||
elseif ($fieldlist[$field] == 'type_template')
|
elseif ($fieldlist[$field] == 'type_template')
|
||||||
{
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->selectarray('type_template', $elementList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1);
|
if ($context == 'edit' && ! empty($obj->{$fieldlist[$field]}) && ! in_array($obj->{$fieldlist[$field]}, array_keys($elementList)))
|
||||||
print '</td>';
|
{
|
||||||
|
// Current tempalte type is an unknown type, so we must keep it as it is.
|
||||||
|
print '<input type="hidden" name="type_template" value="'.$obj->{$fieldlist[$field]}.'">';
|
||||||
|
print $obj->{$fieldlist[$field]};
|
||||||
}
|
}
|
||||||
elseif (in_array($fieldlist[$field], array('content','content_lines'))) continue;
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td>';
|
print $form->selectarray('type_template', $elementList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1);
|
||||||
$size=''; $class='';
|
}
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
elseif ($context == 'add' & in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
|
||||||
|
elseif ($context == 'edit' & in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
|
||||||
|
elseif ($context == 'hide' & in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$size=''; $class=''; $classtd='';
|
||||||
if ($fieldlist[$field]=='code') $class='maxwidth100';
|
if ($fieldlist[$field]=='code') $class='maxwidth100';
|
||||||
if ($fieldlist[$field]=='private') $class='maxwidth50';
|
if ($fieldlist[$field]=='private') { $class='maxwidth50'; $classtd='center'; }
|
||||||
if ($fieldlist[$field]=='position') $class='maxwidth50';
|
if ($fieldlist[$field]=='position') { $class='maxwidth50'; $classtd='center'; }
|
||||||
if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent';
|
if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent';
|
||||||
if ($fieldlist[$field]=='topic') $class='quatrevingtpercent';
|
if ($fieldlist[$field]=='topic') $class='quatrevingtpercent';
|
||||||
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
|
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
|
||||||
|
|
||||||
|
print '<td'.($classtd?' class="'.$classtd.'"':'').'>';
|
||||||
|
if ($fieldlist[$field]=='private')
|
||||||
|
{
|
||||||
|
if (empty($user->admin))
|
||||||
|
{
|
||||||
|
print $form->selectyesno($fieldlist[$field], '1', 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="1" name="'.$fieldlist[$field].'">';
|
||||||
|
print $form->selectyesno($fieldlist[$field], (isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,25 +85,25 @@ if ($action == 'update')
|
|||||||
}
|
}
|
||||||
|
|
||||||
$menu = new Menubase($db);
|
$menu = new Menubase($db);
|
||||||
$result=$menu->fetch($_POST['menuId']);
|
$result=$menu->fetch(GETPOST('menuId', 'int'));
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$menu->titre=$_POST['titre'];
|
$menu->titre=GETPOST('titre', 'alpha');
|
||||||
$menu->leftmenu=$_POST['leftmenu'];
|
$menu->leftmenu=GETPOST('leftmenu', 'alpha');
|
||||||
$menu->url=$_POST['url'];
|
$menu->url=GETPOST('url','alpha');
|
||||||
$menu->langs=$_POST['langs'];
|
$menu->langs=GETPOST('langs','alpha');
|
||||||
$menu->position=$_POST['position'];
|
$menu->position=GETPOST('position','int');
|
||||||
$menu->enabled=$_POST['enabled'];
|
$menu->enabled=GETPOST('enabled','alpha');
|
||||||
$menu->perms=$_POST['perms'];
|
$menu->perms=GETPOST('perms','alpha');
|
||||||
$menu->target=$_POST['target'];
|
$menu->target=GETPOST('target','alpha');
|
||||||
$menu->user=$_POST['user'];
|
$menu->user=GETPOST('user','alpha');
|
||||||
if (is_numeric($_POST['menuIdParent']))
|
if (is_numeric(GETPOST('menuIdParent','alpha')))
|
||||||
{
|
{
|
||||||
$menu->fk_menu=$_POST['menuIdParent'];
|
$menu->fk_menu=GETPOST('menuIdParent','alpha');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($_POST['type'] == 'top') $menu->fk_menu=0;
|
if (GETPOST('type','alpha') == 'top') $menu->fk_menu=0;
|
||||||
else $menu->fk_menu=-1;
|
else $menu->fk_menu=-1;
|
||||||
$menu->fk_mainmenu=$mainmenu;
|
$menu->fk_mainmenu=$mainmenu;
|
||||||
$menu->fk_leftmenu=$leftmenu;
|
$menu->fk_leftmenu=$leftmenu;
|
||||||
@ -123,7 +123,6 @@ if ($action == 'update')
|
|||||||
{
|
{
|
||||||
setEventMessages($menu->error, $menu->errors, 'errors');
|
setEventMessages($menu->error, $menu->errors, 'errors');
|
||||||
}
|
}
|
||||||
$_GET["menuId"] = $_POST['menuId'];
|
|
||||||
$action = "edit";
|
$action = "edit";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -148,9 +147,9 @@ if ($action == 'add')
|
|||||||
}
|
}
|
||||||
|
|
||||||
$leftmenu=''; $mainmenu='';
|
$leftmenu=''; $mainmenu='';
|
||||||
if (! empty($_POST['menuId']) && ! is_numeric($_POST['menuId']))
|
if (GETPOST('menuId','int') && ! is_numeric(GETPOST('menuId','int')))
|
||||||
{
|
{
|
||||||
$tmp=explode('&',$_POST['menuId']);
|
$tmp=explode('&',GETPOST('menuId','int'));
|
||||||
foreach($tmp as $s)
|
foreach($tmp as $s)
|
||||||
{
|
{
|
||||||
if (preg_match('/fk_mainmenu=/',$s))
|
if (preg_match('/fk_mainmenu=/',$s))
|
||||||
@ -197,7 +196,7 @@ if ($action == 'add')
|
|||||||
$action = 'create';
|
$action = 'create';
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (! $error && empty($_POST['menuId']) && $_POST['type'] == 'left')
|
if (! $error && ! $_POST['menuId'] && $_POST['type'] == 'left')
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorLeftMenuMustHaveAParentId"), null, 'errors');
|
setEventMessages($langs->trans("ErrorLeftMenuMustHaveAParentId"), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
@ -207,23 +206,23 @@ if ($action == 'add')
|
|||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$menu = new Menubase($db);
|
$menu = new Menubase($db);
|
||||||
$menu->menu_handler=preg_replace('/_menu$/','',$_POST['menu_handler']);
|
$menu->menu_handler=preg_replace('/_menu$/','',GETPOST('menu_handler','aZ09'));
|
||||||
$menu->type=$_POST['type'];
|
$menu->type=GETPOST('type','alpha');
|
||||||
$menu->titre=$_POST['titre'];
|
$menu->titre=GETPOST('titre','alpha');
|
||||||
$menu->url=$_POST['url'];
|
$menu->url=GETPOST('url','alpha');
|
||||||
$menu->langs=$_POST['langs'];
|
$menu->langs=GETPOST('langs','alpha');
|
||||||
$menu->position=$_POST['position'];
|
$menu->position=GETPOST('position','int');
|
||||||
$menu->enabled=$_POST['enabled'];
|
$menu->enabled=GETPOST('enabled','alpha');
|
||||||
$menu->perms=$_POST['perms'];
|
$menu->perms=GETPOST('perms','alpha');
|
||||||
$menu->target=$_POST['target'];
|
$menu->target=GETPOST('target','alpha');
|
||||||
$menu->user=$_POST['user'];
|
$menu->user=GETPOST('user','alpha');
|
||||||
if (is_numeric($_POST['menuId']))
|
if (is_numeric(GETPOST('menuId','int')))
|
||||||
{
|
{
|
||||||
$menu->fk_menu=$_POST['menuId'];
|
$menu->fk_menu=GETPOST('menuId','int');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($_POST['type'] == 'top') $menu->fk_menu=0;
|
if (GETPOST('type','alpha') == 'top') $menu->fk_menu=0;
|
||||||
else $menu->fk_menu=-1;
|
else $menu->fk_menu=-1;
|
||||||
$menu->fk_mainmenu=$mainmenu;
|
$menu->fk_mainmenu=$mainmenu;
|
||||||
$menu->fk_leftmenu=$leftmenu;
|
$menu->fk_leftmenu=$leftmenu;
|
||||||
@ -232,7 +231,7 @@ if ($action == 'add')
|
|||||||
$result=$menu->create($user);
|
$result=$menu->create($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$_POST['menu_handler']);
|
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".GETPOST('menu_handler','aZ09'));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -306,7 +305,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print load_fiche_titre($langs->trans("NewMenu"),'','title_setup');
|
print load_fiche_titre($langs->trans("NewMenu"),'','title_setup');
|
||||||
|
|
||||||
print '<form action="./edit.php?action=add&menuId='.$_GET['menuId'].'" method="post" name="formmenucreate">';
|
print '<form action="./edit.php?action=add&menuId='.GETPOST('menuId', 'int').'" method="post" name="formmenucreate">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
@ -314,8 +313,8 @@ if ($action == 'create')
|
|||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Id
|
// Id
|
||||||
$parent_rowid = $_GET['menuId'];
|
$parent_rowid = GETPOST('menuId', 'int');
|
||||||
if ($_GET['menuId'])
|
if (GETPOST('menuId', 'int'))
|
||||||
{
|
{
|
||||||
$sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".GETPOST('menuId', 'int');
|
$sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".GETPOST('menuId', 'int');
|
||||||
$res = $db->query($sql);
|
$res = $db->query($sql);
|
||||||
@ -375,35 +374,35 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td><input type="text" size="48" id="menuId" name="menuId" value="'.($_POST["menuId"]?$_POST["menuId"]:'').'"></td>';
|
print '<td><input type="text" size="48" id="menuId" name="menuId" value="'.(GETPOST("menuId", 'int')?GETPOST("menuId", 'int'):'').'"></td>';
|
||||||
}
|
}
|
||||||
print '<td>'.$langs->trans('DetailMenuIdParent');
|
print '<td>'.$langs->trans('DetailMenuIdParent');
|
||||||
print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
|
print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.$_POST["titre"].'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
|
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.dol_escape_htmltag(GETPOST("titre",'alpha')).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
|
||||||
|
|
||||||
// URL
|
// URL
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" size="60" name="url" value="'.$_POST["url"].'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
|
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" size="60" name="url" value="'.GETPOST("url",'alpha').'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" size="30" name="langs" value="'.$parent_langs.'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
|
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" size="30" name="langs" value="'.$parent_langs.'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
|
||||||
|
|
||||||
// Position
|
// Position
|
||||||
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" size="5" name="position" value="'.(isset($_POST["position"])?$_POST["position"]:100).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
|
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" size="5" name="position" value="'.dol_escape_htmltag(isset($_POST["position"])?$_POST["position"]:100).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
|
||||||
|
|
||||||
// Target
|
// Target
|
||||||
print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">';
|
print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">';
|
||||||
print '<option value=""'.($menu->target==""?' selected':'').'>'.$langs->trans('').'</option>';
|
print '<option value=""'.($menu->target==""?' selected':'').'> </option>';
|
||||||
print '<option value="_blank"'.($menu->target=="_blank"?' selected':'').'>'.$langs->trans('_blank').'</option>';
|
print '<option value="_blank"'.($menu->target=="_blank"?' selected':'').'>'.$langs->trans('_blank').'</option>';
|
||||||
print '</select></td></td><td>'.$langs->trans('DetailTarget').'</td></tr>';
|
print '</select></td></td><td>'.$langs->trans('DetailTarget').'</td></tr>';
|
||||||
|
|
||||||
// Enabled
|
// Enabled
|
||||||
print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" size="60" name="enabled" value="'.$_POST["enabled"].'"></td><td>'.$langs->trans('DetailEnabled').'</td></tr>';
|
print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" size="60" name="enabled" value="'.GETPOST("enabled",'alpha').'"></td><td>'.$langs->trans('DetailEnabled').'</td></tr>';
|
||||||
|
|
||||||
// Perms
|
// Perms
|
||||||
print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" size="60" name="perms" value="'.$_POST["perms"].'"></td><td>'.$langs->trans('DetailRight').'</td></tr>';
|
print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" size="60" name="perms" value="'.GETPOST('perms','alpha').'"></td><td>'.$langs->trans('DetailRight').'</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
@ -426,14 +425,14 @@ elseif ($action == 'edit')
|
|||||||
print '<form action="./edit.php?action=update" method="POST" name="formmenuedit">';
|
print '<form action="./edit.php?action=update" method="POST" name="formmenuedit">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="handler_origine" value="'.$menu_handler.'">';
|
print '<input type="hidden" name="handler_origine" value="'.$menu_handler.'">';
|
||||||
print '<input type="hidden" name="menuId" value="'.$_GET['menuId'].'">';
|
print '<input type="hidden" name="menuId" value="'.GETPOST('menuId', 'int').'">';
|
||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
$menu = new Menubase($db);
|
$menu = new Menubase($db);
|
||||||
$result=$menu->fetch($_GET['menuId']);
|
$result=$menu->fetch(GETPOST('menuId', 'int'));
|
||||||
//var_dump($menu);
|
//var_dump($menu);
|
||||||
|
|
||||||
// Id
|
// Id
|
||||||
@ -472,20 +471,20 @@ elseif ($action == 'edit')
|
|||||||
//print '<tr><td>'.$langs->trans('Level').'</td><td>'.$menu->level.'</td><td>'.$langs->trans('DetailLevel').'</td></tr>';
|
//print '<tr><td>'.$langs->trans('Level').'</td><td>'.$menu->level.'</td><td>'.$langs->trans('DetailLevel').'</td></tr>';
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.$menu->titre.'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
|
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.dol_escape_htmltag($menu->titre).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
|
||||||
|
|
||||||
// Url
|
// Url
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" class="quatrevingtpercent" name="url" value="'.$menu->url.'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
|
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" class="quatrevingtpercent" name="url" value="'.$menu->url.'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" size="30" name="langs" value="'.$menu->langs.'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
|
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" size="30" name="langs" value="'.dol_escape_htmltag($menu->langs).'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
|
||||||
|
|
||||||
// Position
|
// Position
|
||||||
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" size="5" name="position" value="'.$menu->position.'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
|
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" size="5" name="position" value="'.$menu->position.'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
|
||||||
|
|
||||||
// Target
|
// Target
|
||||||
print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">';
|
print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">';
|
||||||
print '<option value=""'.($menu->target==""?' selected':'').'>'.$langs->trans('').'</option>';
|
print '<option value=""'.($menu->target==""?' selected':'').'> </option>';
|
||||||
print '<option value="_blank"'.($menu->target=="_blank"?' selected':'').'>'.$langs->trans('_blank').'</option>';
|
print '<option value="_blank"'.($menu->target=="_blank"?' selected':'').'>'.$langs->trans('_blank').'</option>';
|
||||||
print '</select></td><td>'.$langs->trans('DetailTarget').'</td></tr>';
|
print '</select></td><td>'.$langs->trans('DetailTarget').'</td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -366,7 +366,7 @@ if ($mode == 'desc')
|
|||||||
if ($mode == 'feature')
|
if ($mode == 'feature')
|
||||||
{
|
{
|
||||||
$text.='<br><strong>'.$langs->trans("DependsOn").':</strong> ';
|
$text.='<br><strong>'.$langs->trans("DependsOn").':</strong> ';
|
||||||
if (count($objMod->requiredby)) $text.=join(',', $objMod->depends);
|
if (count($objMod->depends)) $text.=join(',', $objMod->depends);
|
||||||
else $text.=$langs->trans("None");
|
else $text.=$langs->trans("None");
|
||||||
$text.='<br><strong>'.$langs->trans("RequiredBy").':</strong> ';
|
$text.='<br><strong>'.$langs->trans("RequiredBy").':</strong> ';
|
||||||
if (count($objMod->requiredby)) $text.=join(',', $objMod->requiredby);
|
if (count($objMod->requiredby)) $text.=join(',', $objMod->requiredby);
|
||||||
|
|||||||
@ -51,11 +51,11 @@ $search_version=GETPOST('search_version','alpha');
|
|||||||
// For dolistore search
|
// For dolistore search
|
||||||
$options = array();
|
$options = array();
|
||||||
$options['per_page'] = 20;
|
$options['per_page'] = 20;
|
||||||
$options['categorie'] = GETPOST('categorie', 'int') + 0;
|
$options['categorie'] = ((GETPOST('categorie', 'int')?GETPOST('categorie', 'int'):0) + 0);
|
||||||
$options['start'] = GETPOST('start', 'int') + 0;
|
$options['start'] = ((GETPOST('start', 'int')?GETPOST('start', 'int'):0) + 0);
|
||||||
$options['end'] = GETPOST('end', 'int') + 0;
|
$options['end'] = ((GETPOST('end', 'int')?GETPOST('end', 'int'):0) + 0);
|
||||||
$options['search'] = GETPOST('search_keyword', 'alpha');
|
$options['search'] = GETPOST('search_keyword', 'alpha');
|
||||||
$dolistore = new Dolistore($options);
|
$dolistore = new Dolistore();
|
||||||
|
|
||||||
|
|
||||||
if (! $user->admin)
|
if (! $user->admin)
|
||||||
@ -254,7 +254,7 @@ if ($action == 'reset' && $user->admin)
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$morejs = array("/admin/dolistore/js/dolistore.js.php");
|
//$morejs = array("/admin/dolistore/js/dolistore.js.php");
|
||||||
$morecss = array("/admin/dolistore/css/dolistore.css");
|
$morecss = array("/admin/dolistore/css/dolistore.css");
|
||||||
|
|
||||||
// Set dir where external modules are installed
|
// Set dir where external modules are installed
|
||||||
@ -623,7 +623,7 @@ if ($mode == 'common')
|
|||||||
$imginfo="info_black";
|
$imginfo="info_black";
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr>'."\n";
|
print '<tr class="oddeven">'."\n";
|
||||||
|
|
||||||
// Picto + Name of module
|
// Picto + Name of module
|
||||||
print ' <td width="200px">';
|
print ' <td width="200px">';
|
||||||
@ -832,44 +832,54 @@ if ($mode == 'marketplace')
|
|||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1)
|
if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1)
|
||||||
{
|
{
|
||||||
print '<span class="opacitymedium">'.$langs->trans('DOLISTOREdescriptionLong').'</span>';
|
// $options is array with filter criterias
|
||||||
|
//var_dump($options);
|
||||||
|
$dolistore->getRemoteData($options);
|
||||||
|
|
||||||
|
print '<span class="opacitymedium">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
|
||||||
|
|
||||||
|
$previouslink = $dolistore->get_previous_link();
|
||||||
|
$nextlink = $dolistore->get_next_link();
|
||||||
|
|
||||||
|
print '<div class="liste_titre liste_titre_bydiv centpercent"><div class="divsearchfield">'
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<br><br>
|
<form method="POST" class="centpercent" id="searchFormList" action="<?php echo $dolistore->url ?>">
|
||||||
|
|
||||||
<div class="tabBar">
|
|
||||||
<form method="POST" id="searchFormList" action="<?php echo $dolistore->url ?>">
|
|
||||||
<input type="hidden" name="mode" value="marketplace" />
|
<input type="hidden" name="mode" value="marketplace" />
|
||||||
<div class="divsearchfield"><?php echo $langs->trans('Mot-cle') ?>:
|
<div class="divsearchfield"><?php echo $langs->trans('Keyword') ?>:
|
||||||
<input name="search_keyword" placeholder="<?php echo $langs->trans('Chercher un module') ?>" id="search_keyword" type="text" size="50" value="<?php echo $options['search'] ?>"><br>
|
<input name="search_keyword" placeholder="<?php echo $langs->trans('Chercher un module') ?>" id="search_keyword" type="text" size="50" value="<?php echo $options['search'] ?>"><br>
|
||||||
</div>
|
</div>
|
||||||
<div class="divsearchfield">
|
<div class="divsearchfield">
|
||||||
<input class="button butAction searchDolistore" value="<?php echo $langs->trans('Rechercher') ?>" type="submit">
|
<input class="button" value="<?php echo $langs->trans('Rechercher') ?>" type="submit">
|
||||||
<a class="button butActionDelete" href="<?php echo $dolistore->url ?>"><?php echo $langs->trans('Tout afficher') ?></a>
|
<a class="button" href="<?php echo $dolistore->url ?>"><?php echo $langs->trans('Reset') ?></a>
|
||||||
</div><br><br><br style="clear: both">
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="divsearchfield right">
|
||||||
|
<?php
|
||||||
|
print $previouslink;
|
||||||
|
print $nextlink;
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
print '</div></div>';
|
||||||
|
print '<div class="clearboth"></div>';
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div id="category-tree-left">
|
<div id="category-tree-left">
|
||||||
<ul class="tree">
|
<ul class="tree">
|
||||||
<?php echo $dolistore->get_categories(); ?>
|
<?php echo $dolistore->get_categories(); ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div id="listing-content">
|
<div id="listing-content">
|
||||||
<table summary="list_of_modules" id="list_of_modules" class="liste" width="100%">
|
<table summary="list_of_modules" id="list_of_modules" class="productlist centpercent">
|
||||||
<thead>
|
|
||||||
<tr class="liste_titre">
|
|
||||||
<td colspan="100%"><?php echo $dolistore->get_previous_link() ?> <?php echo $dolistore->get_next_link() ?> <span style="float:right"><?php echo $langs->trans('AchatTelechargement') ?></span></td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody id="listOfModules">
|
<tbody id="listOfModules">
|
||||||
<?php echo $dolistore->get_products($categorie); ?>
|
<?php echo $dolistore->get_products($categorie); ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
|
||||||
<tr class="liste_titre">
|
|
||||||
<td colspan="100%"><?php echo $dolistore->get_previous_link() ?> <?php echo $dolistore->get_next_link() ?> <span style="float:right"><?php echo $langs->trans('AchatTelechargement') ?></span></td>
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -884,7 +894,7 @@ if ($mode == 'deploy')
|
|||||||
{
|
{
|
||||||
dol_fiche_head($head, $mode, '', -1);
|
dol_fiche_head($head, $mode, '', -1);
|
||||||
|
|
||||||
|
$dolibarrdataroot=preg_replace('/([\\/]+)$/i','',DOL_DATA_ROOT);
|
||||||
$allowonlineinstall=true;
|
$allowonlineinstall=true;
|
||||||
$allowfromweb=1;
|
$allowfromweb=1;
|
||||||
if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) $allowonlineinstall=false;
|
if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) $allowonlineinstall=false;
|
||||||
@ -911,7 +921,6 @@ if ($mode == 'deploy')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
$message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
|
$message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
|
||||||
$allowfromweb=0;
|
$allowfromweb=0;
|
||||||
}
|
}
|
||||||
@ -975,7 +984,6 @@ if ($mode == 'deploy')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (! empty($result['return']))
|
if (! empty($result['return']))
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -989,8 +997,6 @@ if ($mode == 'deploy')
|
|||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($mode == 'develop')
|
if ($mode == 'develop')
|
||||||
{
|
{
|
||||||
dol_fiche_head($head, $mode, '', -1);
|
dol_fiche_head($head, $mode, '', -1);
|
||||||
|
|||||||
@ -78,14 +78,23 @@ if (preg_match('/del_(.*)/',$action,$reg))
|
|||||||
|
|
||||||
if ($action == 'add_currency')
|
if ($action == 'add_currency')
|
||||||
{
|
{
|
||||||
|
$error=0;
|
||||||
|
|
||||||
$langs->loadCacheCurrencies('');
|
$langs->loadCacheCurrencies('');
|
||||||
|
|
||||||
$code = GETPOST('code', 'alpha');
|
$code = GETPOST('code', 'alpha');
|
||||||
$rate = GETPOST('rate', 'alpha');
|
$rate = price2num(GETPOST('rate', 'alpha'));
|
||||||
$currency = new MultiCurrency($db);
|
$currency = new MultiCurrency($db);
|
||||||
$currency->code = $code;
|
$currency->code = $code;
|
||||||
$currency->name = !empty($langs->cache_currencies[$code]['label']) ? $langs->cache_currencies[$code]['label'].' ('.$langs->getCurrencySymbol($code).')' : $code;
|
$currency->name = !empty($langs->cache_currencies[$code]['label']) ? $langs->cache_currencies[$code]['label'].' ('.$langs->getCurrencySymbol($code).')' : $code;
|
||||||
|
|
||||||
|
if (empty($rate))
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Rate")), null, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
if ($currency->create($user) > 0)
|
if ($currency->create($user) > 0)
|
||||||
{
|
{
|
||||||
if ($currency->addRate($rate)) setEventMessages($langs->trans('RecordSaved'), array());
|
if ($currency->addRate($rate)) setEventMessages($langs->trans('RecordSaved'), array());
|
||||||
@ -93,8 +102,11 @@ if ($action == 'add_currency')
|
|||||||
}
|
}
|
||||||
else setEventMessages($langs->trans('ErrorAddCurrencyFail'), $currency->errors, 'errors');
|
else setEventMessages($langs->trans('ErrorAddCurrencyFail'), $currency->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
elseif ($action == 'update_currency')
|
elseif ($action == 'update_currency')
|
||||||
{
|
{
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
$submit = GETPOST('submit', 'alpha');
|
$submit = GETPOST('submit', 'alpha');
|
||||||
|
|
||||||
if ($submit == $langs->trans('Modify'))
|
if ($submit == $langs->trans('Modify'))
|
||||||
@ -103,11 +115,19 @@ elseif ($action == 'update_currency')
|
|||||||
$rate = price2num(GETPOST('rate', 'alpha'));
|
$rate = price2num(GETPOST('rate', 'alpha'));
|
||||||
$currency = new MultiCurrency($db);
|
$currency = new MultiCurrency($db);
|
||||||
|
|
||||||
|
if (empty($rate))
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Rate")), null, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
if ($currency->fetch($fk_multicurrency) > 0)
|
if ($currency->fetch($fk_multicurrency) > 0)
|
||||||
{
|
{
|
||||||
$currency->updateRate($rate);
|
$currency->updateRate($rate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
elseif ($submit == $langs->trans('Delete'))
|
elseif ($submit == $langs->trans('Delete'))
|
||||||
{
|
{
|
||||||
$fk_multicurrency = GETPOST('fk_multicurrency', 'int');
|
$fk_multicurrency = GETPOST('fk_multicurrency', 'int');
|
||||||
@ -235,7 +255,7 @@ print '</td></tr>';
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '<br />';
|
print '<br>';
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
|
if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
|
||||||
{
|
{
|
||||||
@ -279,7 +299,6 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_alternateCurrencySource").'</td>';
|
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_alternateCurrencySource").'</td>';
|
||||||
print '<td align="center" width="20"> </td>';
|
print '<td align="center" width="20"> </td>';
|
||||||
@ -293,7 +312,7 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '<br />';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -327,7 +346,6 @@ foreach ($TCurrency as &$currency)
|
|||||||
{
|
{
|
||||||
if ($currency->code == $conf->currency) continue;
|
if ($currency->code == $conf->currency) continue;
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$currency->code.' - '.$currency->name.'</td>';
|
print '<td>'.$currency->code.' - '.$currency->name.'</td>';
|
||||||
print '<td align="center" width="20"> </td>';
|
print '<td align="center" width="20"> </td>';
|
||||||
|
|||||||
@ -233,7 +233,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print "<br />";
|
print "<br>";
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("OtherOptions"),'','');
|
print load_fiche_titre($langs->trans("OtherOptions"),'','');
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2012-2105 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2012-2107 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -75,6 +75,10 @@ if ($action == 'update')
|
|||||||
dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"],'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"],'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
|
|
||||||
|
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", $_POST["MAIN_PDF_MAIN_HIDE_SECOND_TAX"],'chaine',0,'',$conf->entity);
|
||||||
|
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", $_POST["MAIN_PDF_MAIN_HIDE_THIRD_TAX"],'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -130,7 +134,8 @@ if ($action == 'edit') // Edit
|
|||||||
|
|
||||||
// Misc options
|
// Misc options
|
||||||
print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'','').'<br>';
|
print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'','').'<br>';
|
||||||
$var=true;
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table summary="more" class="noborder" width="100%">';
|
print '<table summary="more" class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
@ -157,13 +162,15 @@ if ($action == 'edit') // Edit
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
// Addresses
|
// Addresses
|
||||||
print load_fiche_titre($langs->trans("PDFAddressForging"),'','').'<br>';
|
print load_fiche_titre($langs->trans("PDFAddressForging"),'','').'<br>';
|
||||||
$var=true;
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table summary="more" class="noborder" width="100%">';
|
print '<table summary="more" class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
@ -246,12 +253,48 @@ if ($action == 'edit') // Edit
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
// Localtaxes
|
||||||
|
if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2))
|
||||||
|
{
|
||||||
|
$locales ='';
|
||||||
|
$text='';
|
||||||
|
|
||||||
|
if ($mysoc->useLocalTax(1))
|
||||||
|
{
|
||||||
|
$locales = $langs->transcountry("LT1",$mysoc->country_code);
|
||||||
|
$text ='<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT1",$mysoc->country_code)) . '</td><td>';
|
||||||
|
$text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_SECOND_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX : 0, 1);
|
||||||
|
$text .= '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mysoc->useLocalTax(2))
|
||||||
|
{
|
||||||
|
$locales.=($locales?' & ':'').$langs->transcountry("LT2",$mysoc->country_code);
|
||||||
|
|
||||||
|
$text.= '<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT2",$mysoc->country_code)) . '</td><td>';
|
||||||
|
$text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_THIRD_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX : 0, 1);
|
||||||
|
$text.= '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print load_fiche_titre($langs->trans("PDFLocaltax",$locales),'','');
|
||||||
|
|
||||||
|
print '<table summary="more" class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||||
|
print $text;
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
print load_fiche_titre($langs->trans("Other"),'','').'<br>';
|
print load_fiche_titre($langs->trans("Other"),'','').'<br>';
|
||||||
$var=true;
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table summary="more" class="noborder" width="100%">';
|
print '<table summary="more" class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
@ -291,6 +334,7 @@ if ($action == 'edit') // Edit
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '<br><div class="center">';
|
print '<br><div class="center">';
|
||||||
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
|
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
|
||||||
@ -303,12 +347,11 @@ if ($action == 'edit') // Edit
|
|||||||
}
|
}
|
||||||
else // Show
|
else // Show
|
||||||
{
|
{
|
||||||
$var=true;
|
|
||||||
|
|
||||||
// Misc options
|
// Misc options
|
||||||
print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'','');
|
print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'','');
|
||||||
|
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table summary="more" class="noborder" width="100%">';
|
print '<table summary="more" class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
@ -353,12 +396,14 @@ else // Show
|
|||||||
print empty($conf->global->MAIN_PDF_MARGIN_BOTTOM)?10:$conf->global->MAIN_PDF_MARGIN_BOTTOM;
|
print empty($conf->global->MAIN_PDF_MARGIN_BOTTOM)?10:$conf->global->MAIN_PDF_MARGIN_BOTTOM;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("PDFAddressForging"),'','');
|
print load_fiche_titre($langs->trans("PDFAddressForging"),'','');
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
@ -441,16 +486,50 @@ else // Show
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</table>'."\n";
|
print '</table>'."\n";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
// Localtaxes
|
||||||
|
if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2))
|
||||||
|
{
|
||||||
|
$locales ='';
|
||||||
|
$text='';
|
||||||
|
|
||||||
|
if ($mysoc->useLocalTax(1))
|
||||||
|
{
|
||||||
|
$locales = $langs->transcountry("LT1",$mysoc->country_code);
|
||||||
|
$text ='<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT1",$mysoc->country_code)) . '</td><td>';
|
||||||
|
$text .= yn($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX,1);
|
||||||
|
$text .= '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mysoc->useLocalTax(2))
|
||||||
|
{
|
||||||
|
$locales.=($locales?' & ':'').$langs->transcountry("LT2",$mysoc->country_code);
|
||||||
|
|
||||||
|
$text.= '<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT2",$mysoc->country_code)) . '</td><td>';
|
||||||
|
$text.= yn($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX,1);
|
||||||
|
$text.= '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print load_fiche_titre($langs->trans("PDFLocaltax",$locales),'','');
|
||||||
|
|
||||||
|
print '<table summary="more" class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||||
|
print $text;
|
||||||
|
print '</table>';
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
print load_fiche_titre($langs->trans("Other"),'','');
|
print load_fiche_titre($langs->trans("Other"),'','');
|
||||||
$var=true;
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table summary="more" class="noborder" width="100%">';
|
print '<table summary="more" class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px" colspan="2">'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px" colspan="2">'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
// Encrypt and protect PDF
|
// Encrypt and protect PDF
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
@ -514,14 +593,17 @@ else // Show
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Library
|
* Library
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print load_fiche_titre($langs->trans("Library"));
|
print load_fiche_titre($langs->trans("Library"));
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">'."\n";
|
print '<table class="noborder" width="100%">'."\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">'."\n";
|
print '<tr class="liste_titre">'."\n";
|
||||||
@ -529,7 +611,6 @@ else // Show
|
|||||||
print '<td>'.$langs->trans("Value").'</td>'."\n";
|
print '<td>'.$langs->trans("Value").'</td>'."\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$var=false;
|
|
||||||
if (! empty($dolibarr_pdf_force_fpdf))
|
if (! empty($dolibarr_pdf_force_fpdf))
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -580,6 +661,7 @@ else // Show
|
|||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
if (! empty($dolibarr_pdf_force_fpdf))
|
if (! empty($dolibarr_pdf_force_fpdf))
|
||||||
{
|
{
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user