Merge branch 'develop' into patch-243
1
.gitignore
vendored
@ -26,3 +26,4 @@ htdocs/includes/autoload.php
|
|||||||
htdocs/includes/bin/
|
htdocs/includes/bin/
|
||||||
htdocs/includes/composer/
|
htdocs/includes/composer/
|
||||||
/.pydevproject
|
/.pydevproject
|
||||||
|
/dolibarr_genesis.mp4
|
||||||
|
|||||||
@ -8,3 +8,7 @@ linters:
|
|||||||
|
|
||||||
fixers:
|
fixers:
|
||||||
enable: true
|
enable: true
|
||||||
|
|
||||||
|
files:
|
||||||
|
ignore:
|
||||||
|
- 'htdocs/includes/*'
|
||||||
|
|||||||
@ -347,7 +347,7 @@ script:
|
|||||||
mysql -e 'DROP DATABASE IF EXISTS travis;'
|
mysql -e 'DROP DATABASE IF EXISTS travis;'
|
||||||
mysql -e 'CREATE DATABASE IF NOT EXISTS travis;'
|
mysql -e 'CREATE DATABASE IF NOT EXISTS travis;'
|
||||||
mysql -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;'
|
mysql -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;'
|
||||||
mysql -e 'FLUSH PRIVILEGES;'
|
mysql -e 'FLUSH PRIVILEGES;'
|
||||||
mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||||
fi
|
fi
|
||||||
if [ "$DB" = 'postgresql' ]; then
|
if [ "$DB" = 'postgresql' ]; then
|
||||||
@ -362,7 +362,7 @@ script:
|
|||||||
#echo 'ALTER TABLE "llx_accounting_account" DROP CONSTRAINT "idx_16390_primary"' | psql travis
|
#echo 'ALTER TABLE "llx_accounting_account" DROP CONSTRAINT "idx_16390_primary"' | psql travis
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
|
|
||||||
- |
|
- |
|
||||||
echo "Upgrading Dolibarr"
|
echo "Upgrading Dolibarr"
|
||||||
# Ensure we catch errors. Set this to +e if you want to go to the end to see log files.
|
# Ensure we catch errors. Set this to +e if you want to go to the end to see log files.
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|
||||||
Dolibarr is released under the terms of the GNU General Public License as
|
Dolibarr is released under the terms of the GNU General Public License as
|
||||||
published by the Free Software Foundation; either version 3 of the License,
|
published by the Free Software Foundation; either version 3 of the License,
|
||||||
or (at your option) any later version (GPL-3+).
|
or (at your option) any later version (GPL-3+).
|
||||||
More information: https://www.gnu.org/licenses/gpl-3.0.txt
|
More information: https://www.gnu.org/licenses/gpl-3.0.txt
|
||||||
@ -15,13 +15,13 @@ PHP libraries:
|
|||||||
AdoDb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
|
AdoDb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
|
||||||
CKEditor 4.12.1 LGPL-2.1+ Yes Editor WYSIWYG
|
CKEditor 4.12.1 LGPL-2.1+ Yes Editor WYSIWYG
|
||||||
EvalMath 1.0 BSD Yes Safe math expressions evaluation
|
EvalMath 1.0 BSD Yes Safe math expressions evaluation
|
||||||
Escpos-php ? MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
||||||
GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
|
GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
|
||||||
Mobiledetect 2.8.33 MIT License Yes Detect mobile devices browsers
|
Mobiledetect 2.8.33 MIT License Yes Detect mobile devices browsers
|
||||||
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
|
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
|
||||||
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
|
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
|
||||||
ParseDown 1.6 MIT License Yes Markdown parser
|
ParseDown 1.6 MIT License Yes Markdown parser
|
||||||
PHPDebugBar 1.15.0 MIT License Yes Used only by the module "debugbar" for developers
|
PHPDebugBar 1.15.0 MIT License Yes Used only by the module "debugbar" for developers
|
||||||
PHPExcel 1.8.1 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
|
PHPExcel 1.8.1 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
|
||||||
PHPSpreadSheet ? LGPL-2.1+ Yes Read/Write XLS files, read ODS files
|
PHPSpreadSheet ? LGPL-2.1+ Yes Read/Write XLS files, read ODS files
|
||||||
php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
|
php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
|
||||||
@ -37,7 +37,7 @@ TCPDF 6.3.2 LGPL-3+ Yes
|
|||||||
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
|
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
|
||||||
|
|
||||||
JS libraries:
|
JS libraries:
|
||||||
Ace 1.4.6 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
Ace 1.4.6 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||||
jQuery 3.4.1 MIT License Yes JS library
|
jQuery 3.4.1 MIT License Yes JS library
|
||||||
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
|
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
|
||||||
jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect
|
jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect
|
||||||
|
|||||||
106
ChangeLog
@ -23,10 +23,84 @@ Following changes may create regressions for some external modules, but were nec
|
|||||||
* If you have developed your own emailing target selector and used parent::add_to_target(...), you must now use parent::addToTargets(...)
|
* If you have developed your own emailing target selector and used parent::add_to_target(...), you must now use parent::addToTargets(...)
|
||||||
* Removed function dol_micro_time. Use native PHP microtime instead.
|
* Removed function dol_micro_time. Use native PHP microtime instead.
|
||||||
* The trigger BON_PRELEVEMENT_CREATE has been renamed into DIRECT_DEBIT_ORDER_CREATE.
|
* The trigger BON_PRELEVEMENT_CREATE has been renamed into DIRECT_DEBIT_ORDER_CREATE.
|
||||||
|
* The constant INVOICE_SHOW_POS_IN_EXPORT has been renamed into INVOICE_SHOW_POS.
|
||||||
|
* If your logo was visible on the menu bar, you must upload a new logo into 'Home-Setup-Company/Organization' to have it visible agin in menu.
|
||||||
|
* All properties 'libstatut', 'labelstatut', 'labelstatus' were renamed into 'labelStatus'.
|
||||||
|
* All properties 'labelstatusshort' and 'labelstatut_short' were renamed into 'labelStatusShort'.
|
||||||
|
* All properties 'type_libelle' were renamed into 'type_label'.
|
||||||
|
* Renamed property of thirdparty "statut_commercial" into "status_prospect_label"
|
||||||
|
|
||||||
|
***** ChangeLog for 10.0.3 compared to 10.0.2 *****
|
||||||
|
IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card.
|
||||||
|
The unit were not saved correctly in database making calculation on shipments wrong.
|
||||||
|
Update to this version must be done if you use them and have installed version 10.0.0, 10.0.1 or 10.0.2 and set some products after installing or upgrading to one of this version.
|
||||||
|
Once update is done you must then edit (manually) the product that has bad unit to set the correct unit to have features restored.
|
||||||
|
|
||||||
|
FIX: #11702
|
||||||
|
FIX: #11861 No consistent code to manage measuring units
|
||||||
|
FIX: #11942
|
||||||
|
FIX: #12026
|
||||||
|
FIX: #12040
|
||||||
|
FIX: #12041
|
||||||
|
FIX: #12054
|
||||||
|
FIX: #12083
|
||||||
|
FIX: #12088
|
||||||
|
FIX: CVE-2019-17578 CVE-2019-17577 CVE-2019-17576
|
||||||
|
FIX: Clean the + of categories on the product view only in POS module
|
||||||
|
FIX: access to public interface when origin email has an alias.
|
||||||
|
FIX: Alias name is not into the email recipient label.
|
||||||
|
FIX: allow standalone credit note even if no invoice
|
||||||
|
FIX: an admin can not access his own permissions after enabling advanced permissions
|
||||||
|
FIX: Attachement of linked files on ticket when sending a message
|
||||||
|
FIX: avoid non numeric warning
|
||||||
|
FIX: Bad currency var used in stripe for connect
|
||||||
|
FIX: Bad list of ticket on public interface for ticket emailcollector
|
||||||
|
FIX: Can't modify vendor invoice if transfered into accountancy
|
||||||
|
FIX: change product type must be allowed if we activate hidden conf
|
||||||
|
FIX: colspan on VAT quadri report
|
||||||
|
FIX: CSS
|
||||||
|
FIX: Debug feature orderstoinvoice for suppliers
|
||||||
|
FIX: do not output return code on screen after a select of bank account
|
||||||
|
FIX: Edit of ticket module parameters erased others
|
||||||
|
FIX: empty cache when we want to load specific warehouses in select
|
||||||
|
FIX: escape email alias
|
||||||
|
FIX: expedition.class.php
|
||||||
|
FIX: Export of leave request show the number of open days
|
||||||
|
FIX: Filtering the HTTP Header "Accept-Language".
|
||||||
|
FIX: Filter on project on ticket list
|
||||||
|
FIX: Filter "Open all" of ticket was ko.
|
||||||
|
FIX: Force downlaod of file with .noexe as octet-stream mime type
|
||||||
|
FIX: form not closed.
|
||||||
|
FIX: hidden conf to prevent from changing product_type
|
||||||
|
FIX: If product account not suggested during bind, it is not preselected
|
||||||
|
FIX: If we share invoice, we need to see discount created from a deposit on each entity
|
||||||
|
FIX: Import of product using units
|
||||||
|
FIX: label of thirdparty is wrong on open project list
|
||||||
|
FIX: Look and feel v10
|
||||||
|
FIX: missing begin()
|
||||||
|
FIX: missing "$this->id" in "fetch" function
|
||||||
|
FIX: navigation on ticket tab of projects
|
||||||
|
FIX: new invoice with generic thirdparty in takepos
|
||||||
|
FIX: Pb in units of shipments
|
||||||
|
FIX: regression with option to hide picto on top menu
|
||||||
|
FIX: selection of project i am contact of.
|
||||||
|
FIX: Send email from expense report card.
|
||||||
|
FIX: shipping card: missing user error messages when classifying closed or billed
|
||||||
|
FIX: SQL injection on qty
|
||||||
|
FIX: stripe payment when there is a quote into address
|
||||||
|
FIX: Substitution of __PROJECT_XXX__ not done
|
||||||
|
FIX: TakePOS no invoice validation control and good payment translate
|
||||||
|
FIX: the access of the bank account of one user
|
||||||
|
FIX: top menu right padding
|
||||||
|
FIX: Update of leave request when CSRF with token is on
|
||||||
|
FIX: Var not enough sanitized
|
||||||
|
FIX: wrong test
|
||||||
|
FIX: XSS
|
||||||
|
FIX: Payment from POS ware not recorded.
|
||||||
|
FIX: Can validate invoice with amount including tax of zero for the case of having a final invoice with
|
||||||
|
VAT that includes a deposit without vat.
|
||||||
|
|
||||||
***** ChangeLog for 10.0.2 compared to 10.0.1 *****
|
***** ChangeLog for 10.0.2 compared to 10.0.1 *****
|
||||||
|
|
||||||
FIX: #10460 compatibility with MariaDB 10.4
|
FIX: #10460 compatibility with MariaDB 10.4
|
||||||
FIX: #11401 Adherent unknown language key
|
FIX: #11401 Adherent unknown language key
|
||||||
FIX: #11422 Can't edit his own events with standard rights
|
FIX: #11422 Can't edit his own events with standard rights
|
||||||
@ -44,17 +118,17 @@ FIX: #11752
|
|||||||
FIX: #11789 FIX: #11790
|
FIX: #11789 FIX: #11790
|
||||||
FIX: #11804 list of tickets from a customer card display ALL tickets
|
FIX: #11804 list of tickets from a customer card display ALL tickets
|
||||||
FIX: #11834
|
FIX: #11834
|
||||||
FIX: Add char $ and ; in sanitizing of filenames.
|
FIX: add char $ and ; in sanitizing of filenames
|
||||||
FIX: Add comment before protected functions
|
FIX: add comment before protected functions
|
||||||
FIX: Add log and type of content in dolWebsiteOutput and
|
FIX: add log and type of content in dolWebsiteOutput and
|
||||||
FIX: Add repair.php option 'restore' to restore user picture after v10
|
FIX: add repair.php option 'restore' to restore user picture after v10
|
||||||
FIX: amount opened on thirdparty card dont care of credit note not converted
|
FIX: amount opened on thirdparty card dont care of credit note not converted
|
||||||
FIX: Api of documents work with value 'thirdparty'
|
FIX: API of documents work with value 'thirdparty'
|
||||||
FIX: author in message / ticket API
|
FIX: author in message / ticket API
|
||||||
FIX: avoid sql error if fk_project is empty during update
|
FIX: avoid SQL error if fk_project is empty during update
|
||||||
FIX: avoid Warning: A non-numeric value encountered
|
FIX: avoid Warning: A non-numeric value encountered
|
||||||
FIX: bad consistency in list of invoice for direct debit order.
|
FIX: bad consistency in list of invoice for direct debit order
|
||||||
FIX: Bad error management in zip compress and web site export
|
FIX: bad error management in zip compress and web site export
|
||||||
FIX: bad substitution for extrafields type checkbox
|
FIX: bad substitution for extrafields type checkbox
|
||||||
FIX: better help message with multicompany
|
FIX: better help message with multicompany
|
||||||
FIX: calculation of $products_dispatched
|
FIX: calculation of $products_dispatched
|
||||||
@ -63,11 +137,11 @@ FIX: Can't delete a draft leave even if it should
|
|||||||
FIX: Can't save setup of mailman module
|
FIX: Can't save setup of mailman module
|
||||||
FIX: column jabberid missing
|
FIX: column jabberid missing
|
||||||
FIX: Confirmation of deletion
|
FIX: Confirmation of deletion
|
||||||
FIX: Consistency in direct debit order lists.
|
FIX: Consistency in direct debit order lists
|
||||||
FIX: Content send before header warning
|
FIX: Content send before header warning
|
||||||
FIX: credit note can be split
|
FIX: credit note can be split
|
||||||
FIX: credit note used on list
|
FIX: credit note used on list
|
||||||
FIX: Css was saved on wrong website.
|
FIX: CSS was saved on wrong website
|
||||||
FIX: delivery extrafields
|
FIX: delivery extrafields
|
||||||
FIX: Disabling a website does not put it offline
|
FIX: Disabling a website does not put it offline
|
||||||
FIX: display only stripe sources for customer
|
FIX: display only stripe sources for customer
|
||||||
@ -84,13 +158,13 @@ FIX: Fatal situation if payment removed on expense report. Action
|
|||||||
FIX: filepath of generated documents doesn't handle products with special characters
|
FIX: filepath of generated documents doesn't handle products with special characters
|
||||||
FIX: for MAIN_MAXTABS_IN_CARD = $i card
|
FIX: for MAIN_MAXTABS_IN_CARD = $i card
|
||||||
FIX: gzip and bzip2 must use option -f
|
FIX: gzip and bzip2 must use option -f
|
||||||
FIX: It was possible to create cashfence without entering data.
|
FIX: it was possible to create cashfence without entering data
|
||||||
FIX: javascript error when using dol_use_jmobile=1
|
FIX: javascript error when using dol_use_jmobile=1
|
||||||
FIX: logout redirect to takepos.php
|
FIX: logout redirect to takepos.php
|
||||||
FIX: Look and feel v10
|
FIX: Look and feel v10
|
||||||
FIX: Make protected all pfd models functions
|
FIX: Make protected all pfd models functions
|
||||||
FIX: management of extrafields in modulebuilder
|
FIX: management of extrafields in modulebuilder
|
||||||
FIX: Missing div for buttons in tax, loan, various payment modules
|
FIX: missing div for buttons in tax, loan, various payment modules
|
||||||
FIX: missing include (dol_convert_file not found)
|
FIX: missing include (dol_convert_file not found)
|
||||||
FIX: Missing some replacements in website module
|
FIX: Missing some replacements in website module
|
||||||
FIX: missing test on permission on button to delete ledger record
|
FIX: missing test on permission on button to delete ledger record
|
||||||
@ -114,13 +188,13 @@ FIX: Return code of pdf_einstein.modules.php and proformat
|
|||||||
FIX: round for application fee in stripe
|
FIX: round for application fee in stripe
|
||||||
FIX: Sens of the balance (Debit - Credit in accountancy not contrary)
|
FIX: Sens of the balance (Debit - Credit in accountancy not contrary)
|
||||||
FIX: Several pb in export of documents
|
FIX: Several pb in export of documents
|
||||||
FIX: SQL syntax error and CSRF check on vat reports
|
FIX: SQL syntax error and CSRF check on VAT reports
|
||||||
FIX: takepos layout clear or focus search
|
FIX: takepos layout clear or focus search
|
||||||
FIX: too many record in sql request. Whena criteria is a filter, we must
|
FIX: too many record in sql request. When a criteria is a filter, we must
|
||||||
FIX: Translation of month
|
FIX: Translation of month
|
||||||
FIX: USEDOLIBARREDITOR not always set
|
FIX: USEDOLIBARREDITOR not always set
|
||||||
FIX: VAT number for Monaco (it uses FR)
|
FIX: VAT number for Monaco (it uses FR)
|
||||||
FIX: vulenrability in uploading file found by 美创科技安全实验室
|
FIX: vulnerability in uploading file found by 美创科技安全实验室
|
||||||
FIX: wrong display (and hidden input) for already dispatched quantity
|
FIX: wrong display (and hidden input) for already dispatched quantity
|
||||||
FIX: wrong parameters (same error in branch 9, 10, develop)
|
FIX: wrong parameters (same error in branch 9, 10, develop)
|
||||||
FIX: Wrong variable. Must be PROJECT_HIDE_UNSELECTABLES
|
FIX: Wrong variable. Must be PROJECT_HIDE_UNSELECTABLES
|
||||||
|
|||||||
@ -164,7 +164,7 @@ foreach ($files as $filetmp) {
|
|||||||
if (filetype($file)=="file") {
|
if (filetype($file)=="file") {
|
||||||
$md5=md5_file($file);
|
$md5=md5_file($file);
|
||||||
$checksumconcat[]=$md5;
|
$checksumconcat[]=$md5;
|
||||||
fputs($fp, ' <md5file name="'.basename($file).'">'.$md5.'</md5file>'."\n");
|
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fputs($fp, ' </dir>'."\n");
|
fputs($fp, ' </dir>'."\n");
|
||||||
@ -207,7 +207,7 @@ foreach ($files as $filetmp) {
|
|||||||
if (filetype($file)=="file") {
|
if (filetype($file)=="file") {
|
||||||
$md5=md5_file($file);
|
$md5=md5_file($file);
|
||||||
$checksumconcat[]=$md5;
|
$checksumconcat[]=$md5;
|
||||||
fputs($fp, ' <md5file name="'.basename($file).'">'.$md5.'</md5file>'."\n");
|
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fputs($fp, ' </dir>'."\n");
|
fputs($fp, ' </dir>'."\n");
|
||||||
|
|||||||
10
build/gource/README.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Command to run gource on Dolibarr git project.
|
||||||
|
|
||||||
|
cd ~/git/dolibarr
|
||||||
|
gource -a 0.5 -c 4 -i 0 --max-files 0 --dir-name-depth 2 --max-file-lag 0.1 --max-user-speed 150 --user-friction 1 --user-scale 3 --file-filter svgs --file-filter _source --file-filter tests --file-show-filter htdocs --date-format "%d %b %Y" -logo doc/images/appicon_64.png --highlight-users --highlight-colour FFFF88 -s 0.5 -1280x720 -r 25 -title 'Dolibarr ERP CRM Genesis' --stop-at-end --filename-time 2 --user-image-dir build/gource/avatars --hide filenames
|
||||||
|
|
||||||
|
|
||||||
|
# To build a mp4 video
|
||||||
|
# Change -crf 1 to -crf 50 for max compression (best is 5)
|
||||||
|
cd ~/git/dolibarr
|
||||||
|
gource -a 0.5 -c 4 -i 0 --max-files 0 --dir-name-depth 2 --max-file-lag 0.1 --max-user-speed 150 --user-friction 1 --user-scale 3 --file-filter svgs --file-filter _source --file-filter tests --file-show-filter htdocs --date-format "%d %b %Y" -logo doc/images/appicon_64.png --highlight-users --highlight-colour FFFF88 -s 0.4 -1280x720 -r 25 -title 'Dolibarr ERP CRM Genesis' --stop-at-end --filename-time 2 --user-image-dir build/gource/avatars --hide filenames -o - | ffmpeg -y -r 25 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset slow -pix_fmt yuv420p -crf 5 -threads 0 -bf 0 dolibarr_genesis.mp4
|
||||||
1
build/gource/avatars/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/*.png
|
||||||
1
build/gource/avatars/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
Directory that will be filled with avatars images of developers for gource
|
||||||
49
build/gource/getavatars.pl
Executable file
@ -0,0 +1,49 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
#fetch Gravatars
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use LWP::Simple;
|
||||||
|
use Digest::MD5 qw(md5_hex);
|
||||||
|
|
||||||
|
my $size = 90;
|
||||||
|
my $output_dir = './avatars';
|
||||||
|
|
||||||
|
die("no .git/ directory found in current path\n") unless -d './avatars';
|
||||||
|
|
||||||
|
mkdir($output_dir) unless -d $output_dir;
|
||||||
|
|
||||||
|
open(GITLOG, q/git log --pretty=format:"%ae|%an" |/) or die("failed to read git-log: $!\n");
|
||||||
|
|
||||||
|
my %processed_authors;
|
||||||
|
|
||||||
|
while(<GITLOG>) {
|
||||||
|
chomp;
|
||||||
|
my($email, $author) = split(/\|/, $_);
|
||||||
|
|
||||||
|
next if $processed_authors{$author}++;
|
||||||
|
|
||||||
|
my $author_image_file = $output_dir . '/' . $author . '.png';
|
||||||
|
|
||||||
|
#skip images we have
|
||||||
|
next if -e $author_image_file;
|
||||||
|
|
||||||
|
#try and fetch image
|
||||||
|
|
||||||
|
my $grav_url = "http://www.gravatar.com/avatar/".md5_hex(lc $email)."?d=404&size=".$size;
|
||||||
|
|
||||||
|
warn "fetching image for '$author' $email ($grav_url)...\n";
|
||||||
|
|
||||||
|
my $rc = getstore($grav_url, $author_image_file);
|
||||||
|
|
||||||
|
sleep(1);
|
||||||
|
|
||||||
|
if($rc != 200) {
|
||||||
|
unlink($author_image_file);
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
close GITLOG;
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0)
|
|||||||
$fuser = new User($db);
|
$fuser = new User($db);
|
||||||
$fuser->fetch(mt_rand(1, 2));
|
$fuser->fetch(mt_rand(1, 2));
|
||||||
$fuser->getRights();
|
$fuser->getRights();
|
||||||
|
|
||||||
$result=$object->create($fuser);
|
$result=$object->create($fuser);
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -61,8 +61,8 @@ $user->getrights();
|
|||||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product"; $productsid = array();
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product"; $productsid = array();
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql); $i = 0;
|
$num = $db->num_rows($resql); $i = 0;
|
||||||
while ($i < $num) { $row = $db->fetch_row($resql); $productsid[$i] = $row[0]; $i++; }
|
while ($i < $num) { $row = $db->fetch_row($resql); $productsid[$i] = $row[0]; $i++; }
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array();
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array();
|
||||||
|
|||||||
@ -176,7 +176,7 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0)
|
|||||||
$fuser = new User($db);
|
$fuser = new User($db);
|
||||||
$fuser->fetch(mt_rand(1, 2));
|
$fuser->fetch(mt_rand(1, 2));
|
||||||
$fuser->getRights();
|
$fuser->getRights();
|
||||||
|
|
||||||
$object->contactid = $contids[$socids[$socid]][0];
|
$object->contactid = $contids[$socids[$socid]][0];
|
||||||
$object->socid = $socids[$socid];
|
$object->socid = $socids[$socid];
|
||||||
$object->datep = $dates[mt_rand(1, count($dates)-1)];
|
$object->datep = $dates[mt_rand(1, count($dates)-1)];
|
||||||
@ -200,7 +200,7 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0)
|
|||||||
}
|
}
|
||||||
$xnbp++;
|
$xnbp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result=$object->valid($fuser);
|
$result=$object->valid($fuser);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -64,22 +64,34 @@ $user->getrights();
|
|||||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product"; $productsid = array();
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product"; $productsid = array();
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql); $i = 0;
|
$num = $db->num_rows($resql); $i = 0;
|
||||||
while ($i < $num) { $row = $db->fetch_row($resql); $productsid[$i] = $row[0]; $i++; }
|
while ($i < $num) {
|
||||||
|
$row = $db->fetch_row($resql);
|
||||||
|
$productsid[$i] = $row[0];
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array();
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array();
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql); $i = 0;
|
$num = $db->num_rows($resql); $i = 0;
|
||||||
while ($i < $num) { $row = $db->fetch_row($resql); $societesid[$i] = $row[0]; $i++; }
|
while ($i < $num) {
|
||||||
|
$row = $db->fetch_row($resql);
|
||||||
|
$societesid[$i] = $row[0];
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
} else { print "err"; }
|
} else { print "err"; }
|
||||||
|
|
||||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande"; $commandesid = array();
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande"; $commandesid = array();
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql); $i = 0;
|
$num = $db->num_rows($resql); $i = 0;
|
||||||
while ($i < $num) { $row = $db->fetch_row($resql); $commandesid[$i] = $row[0]; $i++; }
|
while ($i < $num) {
|
||||||
|
$row = $db->fetch_row($resql);
|
||||||
|
$commandesid[$i] = $row[0];
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
} else { print "err"; }
|
} else { print "err"; }
|
||||||
|
|
||||||
|
|
||||||
@ -116,7 +128,6 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++)
|
|||||||
$contact->firstname = $listoflastname[mt_rand(0, count($listoflastname)-1)];
|
$contact->firstname = $listoflastname[mt_rand(0, count($listoflastname)-1)];
|
||||||
if ( $contact->create($user) )
|
if ( $contact->create($user) )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
dev/initdemo/documents_demo/adherent/1/photos/person5.jpeg
Normal file
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
BIN
dev/initdemo/documents_demo/adherent/2/photos/pierrecurie.jpg
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
BIN
dev/initdemo/documents_demo/adherent/3/photos/person9.jpeg
Normal file
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
BIN
dev/initdemo/documents_demo/adherent/4/photos/person2.jpeg
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
@ -122,14 +122,14 @@
|
|||||||
<rule ref="Generic.Functions.CallTimePassByReference" />
|
<rule ref="Generic.Functions.CallTimePassByReference" />
|
||||||
|
|
||||||
<rule ref="Generic.Functions.FunctionCallArgumentSpacing" />
|
<rule ref="Generic.Functions.FunctionCallArgumentSpacing" />
|
||||||
|
|
||||||
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceBeforeEquals">
|
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceBeforeEquals">
|
||||||
<severity>0</severity>
|
<severity>0</severity>
|
||||||
</rule>
|
</rule>
|
||||||
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceBeforeEquals">
|
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceBeforeEquals">
|
||||||
<severity>0</severity>
|
<severity>0</severity>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
<!-- Disallow several spaces after comma -->
|
<!-- Disallow several spaces after comma -->
|
||||||
<!-- We want to allow this because we want to be able to align params on several similare functions on different lines -->
|
<!-- We want to allow this because we want to be able to align params on several similare functions on different lines -->
|
||||||
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma">
|
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma">
|
||||||
@ -186,7 +186,7 @@
|
|||||||
<!-- Check indent are done with spaces and with correct number -->
|
<!-- Check indent are done with spaces and with correct number -->
|
||||||
<!-- Disabled as this does not support tab -->
|
<!-- Disabled as this does not support tab -->
|
||||||
<!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> -->
|
<!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> -->
|
||||||
<!-- TODO Enable this
|
|
||||||
<arg name="tab-width" value="4"/>
|
<arg name="tab-width" value="4"/>
|
||||||
<rule ref="Generic.WhiteSpace.ScopeIndent">
|
<rule ref="Generic.WhiteSpace.ScopeIndent">
|
||||||
<properties>
|
<properties>
|
||||||
@ -194,14 +194,14 @@
|
|||||||
<property name="tabIndent" value="true"/>
|
<property name="tabIndent" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
-->
|
|
||||||
|
|
||||||
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace.Indent" />
|
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace.Indent" />
|
||||||
|
|
||||||
<!-- There MUST NOT be trailing whitespace at the end of non-blank lines. -->
|
<!-- There MUST NOT be trailing whitespace at the end of non-blank lines. -->
|
||||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
|
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="ignoreBlankLines" value="true"/>
|
<property name="ignoreBlankLines" value="false"/>
|
||||||
</properties>
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile">
|
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile">
|
||||||
@ -213,6 +213,8 @@
|
|||||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
|
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
|
||||||
<severity>0</severity>
|
<severity>0</severity>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
|
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen" />
|
||||||
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" />
|
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" />
|
||||||
|
|
||||||
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen" />
|
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen" />
|
||||||
@ -337,7 +339,7 @@
|
|||||||
<rule ref="PEAR.Commenting.InlineComment" />
|
<rule ref="PEAR.Commenting.InlineComment" />
|
||||||
|
|
||||||
<!-- Check position of { after a control structure like if (), while (), etc... -->
|
<!-- Check position of { after a control structure like if (), while (), etc... -->
|
||||||
<!--
|
<!--
|
||||||
<rule ref="PEAR.ControlStructures.ControlSignature" />
|
<rule ref="PEAR.ControlStructures.ControlSignature" />
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@ -375,7 +377,7 @@
|
|||||||
<rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket">
|
<rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket">
|
||||||
<severity>0</severity>
|
<severity>0</severity>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
<rule ref="PEAR.Functions.FunctionCallSignature.EmptyLine">
|
<rule ref="PEAR.Functions.FunctionCallSignature.EmptyLine">
|
||||||
<severity>0</severity>
|
<severity>0</severity>
|
||||||
</rule>
|
</rule>
|
||||||
|
|||||||
@ -58,7 +58,7 @@ foreach my $file (keys %filelist) {
|
|||||||
$ARGV[1]="$DESTI/$file";
|
$ARGV[1]="$DESTI/$file";
|
||||||
|
|
||||||
print "Convert file $ARGV[0] into $ARGV[1]\n";
|
print "Convert file $ARGV[0] into $ARGV[1]\n";
|
||||||
|
|
||||||
# MySQL to PostgreSQL dump file converter
|
# MySQL to PostgreSQL dump file converter
|
||||||
#
|
#
|
||||||
# For usage: perl mysql2pgsql.perl --help
|
# For usage: perl mysql2pgsql.perl --help
|
||||||
@ -76,18 +76,18 @@ foreach my $file (keys %filelist) {
|
|||||||
# 4) add debug option
|
# 4) add debug option
|
||||||
# see rest of changelog at http://cvs.linux.hr/cvsweb.cgi/sql/mysql2pgsql
|
# see rest of changelog at http://cvs.linux.hr/cvsweb.cgi/sql/mysql2pgsql
|
||||||
# 2003-12-16 jsp -- Joe Speigle <joe.speigle@jklh.us>:
|
# 2003-12-16 jsp -- Joe Speigle <joe.speigle@jklh.us>:
|
||||||
# converts: s/\) *Type=MyISAM;/);/i, enum data type -> references,
|
# converts: s/\) *Type=MyISAM;/);/i, enum data type -> references,
|
||||||
# auto_increment->sequences
|
# auto_increment->sequences
|
||||||
# 2004-01-13 jsp -- moved project to gborg; both the above declined ownership
|
# 2004-01-13 jsp -- moved project to gborg; both the above declined ownership
|
||||||
# 2004-06-29 converts: year(4), year(2)
|
# 2004-06-29 converts: year(4), year(2)
|
||||||
# homepage: gborg.postgresql.org
|
# homepage: gborg.postgresql.org
|
||||||
|
|
||||||
GetOptions("debug", "help");
|
GetOptions("debug", "help");
|
||||||
|
|
||||||
my $DEBUG = $opt_debug || 0;
|
my $DEBUG = $opt_debug || 0;
|
||||||
my $HELP = $opt_help || 0;
|
my $HELP = $opt_help || 0;
|
||||||
|
|
||||||
|
|
||||||
if (($HELP) || ! defined($ARGV[0]) || ! defined($ARGV[1])) {
|
if (($HELP) || ! defined($ARGV[0]) || ! defined($ARGV[1])) {
|
||||||
print "Usage: perl $0 {--verbose|--help|--debug} mysql_dump_file.sql pg_dump_file.sql\n";
|
print "Usage: perl $0 {--verbose|--help|--debug} mysql_dump_file.sql pg_dump_file.sql\n";
|
||||||
print "\t* OPTIONS\n";
|
print "\t* OPTIONS\n";
|
||||||
@ -106,15 +106,15 @@ foreach my $file (keys %filelist) {
|
|||||||
print "\tpg_dump_file.sql (undefined)\n";
|
print "\tpg_dump_file.sql (undefined)\n";
|
||||||
}
|
}
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
open(IN,"<$ARGV[0]") || die "can't open mysql dump file $ARGV[0]";
|
open(IN,"<$ARGV[0]") || die "can't open mysql dump file $ARGV[0]";
|
||||||
open(OUT,">$ARGV[1]") || die "can't open pg dump file $ARGV[1]";
|
open(OUT,">$ARGV[1]") || die "can't open pg dump file $ARGV[1]";
|
||||||
print OUT "-- Generated by $PROG\n";
|
print OUT "-- Generated by $PROG\n";
|
||||||
print OUT "-- (c) 2004, PostgreSQL Inc.\n";
|
print OUT "-- (c) 2004, PostgreSQL Inc.\n";
|
||||||
print OUT "-- (c) 2005, Laurent Destailleur.\n";
|
print OUT "-- (c) 2005, Laurent Destailleur.\n";
|
||||||
print OUT "\n";
|
print OUT "\n";
|
||||||
|
|
||||||
# Output for create table and create index
|
# Output for create table and create index
|
||||||
sub output_create {
|
sub output_create {
|
||||||
# If command ends with "xxx,);", we change to "xxx);"
|
# If command ends with "xxx,);", we change to "xxx);"
|
||||||
@ -128,7 +128,7 @@ foreach my $file (keys %filelist) {
|
|||||||
print OUT $create_index;
|
print OUT $create_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Reset when moving from each "create table" to "insert" part of dump
|
# Reset when moving from each "create table" to "insert" part of dump
|
||||||
sub reset_vars() {
|
sub reset_vars() {
|
||||||
$create_sql="";
|
$create_sql="";
|
||||||
@ -137,24 +137,24 @@ foreach my $file (keys %filelist) {
|
|||||||
$enum_column='';
|
$enum_column='';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Boucle sur contenu fichier source
|
# Boucle sur contenu fichier source
|
||||||
#----------------------------------
|
#----------------------------------
|
||||||
while(<IN>) {
|
while(<IN>) {
|
||||||
|
|
||||||
# comments or empty lines
|
# comments or empty lines
|
||||||
if (/^-- \$Id/) {
|
if (/^-- \$Id/) {
|
||||||
$_ =~ s/\$//g;
|
$_ =~ s/\$//g;
|
||||||
print OUT $_;
|
print OUT $_;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
# comments or empty lines
|
# comments or empty lines
|
||||||
if (/^#/ || /^$/ || /^--/) {
|
if (/^#/ || /^$/ || /^--/) {
|
||||||
print OUT $_;
|
print OUT $_;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if (/^USE\s*([^;]*);/) {
|
if (/^USE\s*([^;]*);/) {
|
||||||
print OUT "\\c ". $1;
|
print OUT "\\c ". $1;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if ($create_sql ne "") { # we are inside create table statement so lets process datatypes
|
if ($create_sql ne "") { # we are inside create table statement so lets process datatypes
|
||||||
@ -167,14 +167,14 @@ foreach my $file (keys %filelist) {
|
|||||||
# LDR Added "innodb" and "engine"
|
# LDR Added "innodb" and "engine"
|
||||||
}
|
}
|
||||||
elsif (/(ISAM|innodb)/i) { # end of create table sequence
|
elsif (/(ISAM|innodb)/i) { # end of create table sequence
|
||||||
s/\) *type=(MyISAM|innodb);/);/i;
|
s/\) *type=(MyISAM|innodb);/);/i;
|
||||||
s/\) *engine=(MyISAM|innodb);/);/i;
|
s/\) *engine=(MyISAM|innodb);/);/i;
|
||||||
$create_sql =~ s/,$//g; # strip last , inside create table
|
$create_sql =~ s/,$//g; # strip last , inside create table
|
||||||
$create_sql .= $_;
|
$create_sql .= $_;
|
||||||
&output_create;
|
&output_create;
|
||||||
&reset_vars();
|
&reset_vars();
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
# enum -> check
|
# enum -> check
|
||||||
if (/([\w\"]*)\s+enum\s*\(((?:['"][\?\w]+['"]\s*,)+['"][\?\w]+['"])\)(.*)$/i) {
|
if (/([\w\"]*)\s+enum\s*\(((?:['"][\?\w]+['"]\s*,)+['"][\?\w]+['"])\)(.*)$/i) {
|
||||||
@ -189,7 +189,7 @@ foreach my $file (keys %filelist) {
|
|||||||
$enum_datafield{$enum_column} =~ s/\"/\'/g;
|
$enum_datafield{$enum_column} =~ s/\"/\'/g;
|
||||||
$_ = qq~ $enum_column CHAR($maxlength) CHECK ($enum_column IN ($enum_datafield{$enum_column})) $suite\n~;
|
$_ = qq~ $enum_column CHAR($maxlength) CHECK ($enum_column IN ($enum_datafield{$enum_column})) $suite\n~;
|
||||||
# int, auto_increment -> serial
|
# int, auto_increment -> serial
|
||||||
} elsif (/^[\s\t]*(\w*)\s*.*int.*auto_increment/i) {
|
} elsif (/^[\s\t]*(\w*)\s*.*int.*auto_increment/i) {
|
||||||
$seq = qq~${table}_${1}_seq~;
|
$seq = qq~${table}_${1}_seq~;
|
||||||
s/[\s\t]*([a-zA-Z_0-9]*)\s*.*int.*auto_increment[^,]*/ $1 SERIAL PRIMARY KEY/ig;
|
s/[\s\t]*([a-zA-Z_0-9]*)\s*.*int.*auto_increment[^,]*/ $1 SERIAL PRIMARY KEY/ig;
|
||||||
$create_sql.=$_;
|
$create_sql.=$_;
|
||||||
@ -211,40 +211,40 @@ foreach my $file (keys %filelist) {
|
|||||||
elsif (/tinyint/i) {
|
elsif (/tinyint/i) {
|
||||||
s/tinyint/smallint/g;
|
s/tinyint/smallint/g;
|
||||||
}
|
}
|
||||||
|
|
||||||
# nuke unsigned
|
# nuke unsigned
|
||||||
s/(int\w+|smallint)\s+unsigned/$1/gi;
|
s/(int\w+|smallint)\s+unsigned/$1/gi;
|
||||||
|
|
||||||
|
|
||||||
# blob -> text
|
# blob -> text
|
||||||
s/\w*blob/text/gi;
|
s/\w*blob/text/gi;
|
||||||
|
|
||||||
# tinytext/mediumtext -> text
|
# tinytext/mediumtext -> text
|
||||||
s/tinytext/text/gi;
|
s/tinytext/text/gi;
|
||||||
s/mediumtext/text/gi;
|
s/mediumtext/text/gi;
|
||||||
|
|
||||||
# char -> varchar
|
# char -> varchar
|
||||||
# PostgreSQL would otherwise pad with spaces as opposed
|
# PostgreSQL would otherwise pad with spaces as opposed
|
||||||
# to MySQL! Your user interface may depend on this!
|
# to MySQL! Your user interface may depend on this!
|
||||||
s/(\s+)char/${1}varchar/gi;
|
s/(\s+)char/${1}varchar/gi;
|
||||||
|
|
||||||
# nuke date representation (not supported in PostgreSQL)
|
# nuke date representation (not supported in PostgreSQL)
|
||||||
s/datetime default '[^']+'/datetime/i;
|
s/datetime default '[^']+'/datetime/i;
|
||||||
s/date default '[^']+'/datetime/i;
|
s/date default '[^']+'/datetime/i;
|
||||||
s/time default '[^']+'/datetime/i;
|
s/time default '[^']+'/datetime/i;
|
||||||
|
|
||||||
# change not null datetime field to null valid ones
|
# change not null datetime field to null valid ones
|
||||||
# (to support remapping of "zero time" to null
|
# (to support remapping of "zero time" to null
|
||||||
s/datetime not null/datetime/i;
|
s/datetime not null/datetime/i;
|
||||||
s/datetime/timestamp/i;
|
s/datetime/timestamp/i;
|
||||||
|
|
||||||
# nuke size of timestamp
|
# nuke size of timestamp
|
||||||
s/timestamp\([^)]*\)/timestamp/i;
|
s/timestamp\([^)]*\)/timestamp/i;
|
||||||
|
|
||||||
# double -> numeric
|
# double -> numeric
|
||||||
s/^double/numeric/i;
|
s/^double/numeric/i;
|
||||||
s/(\s*)double/${1}numeric/i;
|
s/(\s*)double/${1}numeric/i;
|
||||||
|
|
||||||
# float -> numeric
|
# float -> numeric
|
||||||
s/^float/numeric/i;
|
s/^float/numeric/i;
|
||||||
s/(\s*)float/${1}numeric/i;
|
s/(\s*)float/${1}numeric/i;
|
||||||
@ -261,7 +261,7 @@ foreach my $file (keys %filelist) {
|
|||||||
$create_sql.=$_;
|
$create_sql.=$_;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
# unique key [name] (field)
|
# unique key [name] (field)
|
||||||
if (/unique key\s*(\w*)\s*\((\w+)\)/i) {
|
if (/unique key\s*(\w*)\s*\((\w+)\)/i) {
|
||||||
s/unique key\s*(\w*)\s*\((\w+)\)/UNIQUE\($2\)/i;
|
s/unique key\s*(\w*)\s*\((\w+)\)/UNIQUE\($2\)/i;
|
||||||
@ -288,30 +288,30 @@ foreach my $file (keys %filelist) {
|
|||||||
$create_index .= "CREATE INDEX $idxname ON $table ($fieldlist);\n";
|
$create_index .= "CREATE INDEX $idxname ON $table ($fieldlist);\n";
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
# index(field)
|
# index(field)
|
||||||
if (/index\s*(\w*)\s*\((\w+)\)/i) {
|
if (/index\s*(\w*)\s*\((\w+)\)/i) {
|
||||||
my $idxname=($1?"$1":"idx_${table}_$2");
|
my $idxname=($1?"$1":"idx_${table}_$2");
|
||||||
$create_index .= "CREATE INDEX $idxname ON $table ($2);\n";
|
$create_index .= "CREATE INDEX $idxname ON $table ($2);\n";
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
# primary key
|
# primary key
|
||||||
if (/\bkey\b/i && !/^\s+primary key\s+/i) {
|
if (/\bkey\b/i && !/^\s+primary key\s+/i) {
|
||||||
s/KEY(\s+)[^(]*(\s+)/$1 UNIQUE $2/i; # hack off name of the non-primary key
|
s/KEY(\s+)[^(]*(\s+)/$1 UNIQUE $2/i; # hack off name of the non-primary key
|
||||||
}
|
}
|
||||||
|
|
||||||
# key(xxx)
|
# key(xxx)
|
||||||
if (/key\s*\((\w+)\)/i) {
|
if (/key\s*\((\w+)\)/i) {
|
||||||
my $idxname="idx_${table}_$1";
|
my $idxname="idx_${table}_$1";
|
||||||
$create_index .= "CREATE INDEX $idxname ON $table ($1);\n";
|
$create_index .= "CREATE INDEX $idxname ON $table ($1);\n";
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Quote column names
|
# Quote column names
|
||||||
s/(^\s*)([^\s\-\(]+)(\s*)/$1"$2"$3/gi if (!/\bkey\b/i);
|
s/(^\s*)([^\s\-\(]+)(\s*)/$1"$2"$3/gi if (!/\bkey\b/i);
|
||||||
|
|
||||||
# Remap colums with names of existing system attribute
|
# Remap columns with names of existing system attribute
|
||||||
if (/"oid"/i) {
|
if (/"oid"/i) {
|
||||||
s/"oid"/"_oid"/g;
|
s/"oid"/"_oid"/g;
|
||||||
print STDERR "WARNING: table $table uses column \"oid\" which is renamed to \"_oid\"\nYou should fix application manually! Press return to continue.";
|
print STDERR "WARNING: table $table uses column \"oid\" which is renamed to \"_oid\"\nYou should fix application manually! Press return to continue.";
|
||||||
@ -330,13 +330,13 @@ foreach my $file (keys %filelist) {
|
|||||||
s!\x85!... !g; # \ldots
|
s!\x85!... !g; # \ldots
|
||||||
s!\x92!`!g;
|
s!\x92!`!g;
|
||||||
}
|
}
|
||||||
|
|
||||||
# fix dates '0000-00-00 00:00:00' (should be null)
|
# fix dates '0000-00-00 00:00:00' (should be null)
|
||||||
s/'0000-00-00 00:00:00'/null/gi;
|
s/'0000-00-00 00:00:00'/null/gi;
|
||||||
s/'0000-00-00'/null/gi;
|
s/'0000-00-00'/null/gi;
|
||||||
s/'00:00:00'/null/gi;
|
s/'00:00:00'/null/gi;
|
||||||
s/([12]\d\d\d)([01]\d)([0-3]\d)([0-2]\d)([0-6]\d)([0-6]\d)/'$1-$2-$3 $4:$5:$6'/;
|
s/([12]\d\d\d)([01]\d)([0-3]\d)([0-2]\d)([0-6]\d)([0-6]\d)/'$1-$2-$3 $4:$5:$6'/;
|
||||||
|
|
||||||
if (/create\s+table\s+(\w+)/i) {
|
if (/create\s+table\s+(\w+)/i) {
|
||||||
$create_sql = $_;
|
$create_sql = $_;
|
||||||
/create\s*table\s*(\w+)/i;
|
/create\s*table\s*(\w+)/i;
|
||||||
@ -345,11 +345,11 @@ foreach my $file (keys %filelist) {
|
|||||||
print OUT $_;
|
print OUT $_;
|
||||||
}
|
}
|
||||||
} # end of if inside create_table
|
} # end of if inside create_table
|
||||||
} # END while(<IN>)
|
} # END while(<IN>)
|
||||||
|
|
||||||
close IN;
|
close IN;
|
||||||
close OUT;
|
close OUT;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print "\n";
|
print "\n";
|
||||||
@ -358,4 +358,4 @@ print "\n";
|
|||||||
print "Press a key to finish...\n";
|
print "Press a key to finish...\n";
|
||||||
$stop=<STDIN>;
|
$stop=<STDIN>;
|
||||||
|
|
||||||
0;
|
0;
|
||||||
|
|||||||
@ -17,14 +17,14 @@ fi
|
|||||||
# To detec
|
# To detec
|
||||||
if [ "x$1" = "xlist" ]
|
if [ "x$1" = "xlist" ]
|
||||||
then
|
then
|
||||||
find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'documents\/website' | grep CRLF
|
find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'documents\/website' | grep -v 'documents\/mdedias' | grep CRLF
|
||||||
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'documents\/website' | grep -v 'htdocs\/includes' | grep CRLF
|
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'documents\/website' | grep -v 'documents\/mdedias' | grep -v 'htdocs\/includes' | grep CRLF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# To convert
|
# To convert
|
||||||
if [ "x$1" = "xfix" ]
|
if [ "x$1" = "xfix" ]
|
||||||
then
|
then
|
||||||
for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'documents\/website' | grep CRLF | awk -F':' '{ print $1 }' `
|
for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'documents\/website' | grep -v 'documents\/mdedias' | grep CRLF | awk -F':' '{ print $1 }' `
|
||||||
do
|
do
|
||||||
echo "Fix file $fic"
|
echo "Fix file $fic"
|
||||||
dos2unix "$fic"
|
dos2unix "$fic"
|
||||||
|
|||||||
@ -149,9 +149,9 @@ foreach ($langstrings_3d AS $filename => $file)
|
|||||||
$keys = array_keys($langstrings_full, $value);
|
$keys = array_keys($langstrings_full, $value);
|
||||||
if (count($keys)>1)
|
if (count($keys)>1)
|
||||||
{
|
{
|
||||||
foreach ($keys AS $key) {
|
foreach ($keys AS $key) {
|
||||||
$dups[$value][$filename][$linenum] = trim($langstrings_3dtrans[$filename][$linenum]);
|
$dups[$value][$filename][$linenum] = trim($langstrings_3dtrans[$filename][$linenum]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,7 +46,7 @@ $search_pcgtype = GETPOST('search_pcgtype', 'alpha');
|
|||||||
$search_pcgsubtype = GETPOST('search_pcgsubtype', 'alpha');
|
$search_pcgsubtype = GETPOST('search_pcgsubtype', 'alpha');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0) accessforbidden();
|
if ($user->socid > 0) accessforbidden();
|
||||||
if (! $user->rights->accounting->chartofaccount) accessforbidden();
|
if (! $user->rights->accounting->chartofaccount) accessforbidden();
|
||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
@ -138,7 +138,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ChartLoaded"), null);
|
setEventMessages($langs->trans("ChartLoaded"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -71,7 +71,7 @@ $search_country_id = GETPOST('search_country_id', 'int');
|
|||||||
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0) accessforbidden();
|
if ($user->socid > 0) accessforbidden();
|
||||||
if (! $user->rights->accounting->chartofaccount) accessforbidden();
|
if (! $user->rights->accounting->chartofaccount) accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
@ -456,7 +456,7 @@ if ($id)
|
|||||||
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 '<div class="div-table-responsive">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
// Form to add a new line
|
// Form to add a new line
|
||||||
if ($tabname[$id])
|
if ($tabname[$id])
|
||||||
@ -677,7 +677,6 @@ if ($id)
|
|||||||
{
|
{
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
|
|
||||||
$showfield=1;
|
$showfield=1;
|
||||||
$class="left";
|
$class="left";
|
||||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||||
|
|||||||
@ -220,7 +220,7 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
// Chart of account
|
// Chart of account
|
||||||
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("Chartofaccounts") . '</span></td>';
|
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("Chartofaccounts") . '</span></td>';
|
||||||
@ -273,7 +273,6 @@ if ($action == 'create') {
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
elseif ($id > 0 || $ref) {
|
elseif ($id > 0 || $ref) {
|
||||||
|
|
||||||
$result = $object->fetch($id, $ref, 1);
|
$result = $object->fetch($id, $ref, 1);
|
||||||
|
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
@ -292,7 +291,7 @@ elseif ($id > 0 || $ref) {
|
|||||||
print '<input type="hidden" name="id" value="' . $id . '">';
|
print '<input type="hidden" name="id" value="' . $id . '">';
|
||||||
print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
|
print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
// Account number
|
// Account number
|
||||||
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
|
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
|
||||||
@ -349,7 +348,7 @@ elseif ($id > 0 || $ref) {
|
|||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<tr><td class="titlefield">' . $langs->trans("Label") . '</td>';
|
print '<tr><td class="titlefield">' . $langs->trans("Label") . '</td>';
|
||||||
|
|||||||
@ -104,7 +104,7 @@ print '<input type="hidden" name="action" value="display">';
|
|||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
// Select the category
|
// Select the category
|
||||||
print '<tr><td class="titlefield">' . $langs->trans("AccountingCategory") . '</td>';
|
print '<tr><td class="titlefield">' . $langs->trans("AccountingCategory") . '</td>';
|
||||||
@ -130,7 +130,6 @@ if (! empty($cat_id))
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) {
|
if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) {
|
||||||
|
|
||||||
print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, null, null, "90%");
|
print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, null, null, "90%");
|
||||||
print '<br>';
|
print '<br>';
|
||||||
/*print '<select class="flat minwidth200" size="8" name="cpt_bk[]" multiple>';
|
/*print '<select class="flat minwidth200" size="8" name="cpt_bk[]" multiple>';
|
||||||
@ -153,7 +152,6 @@ print '</form>';
|
|||||||
|
|
||||||
|
|
||||||
if ($action == 'display' || $action == 'delete') {
|
if ($action == 'display' || $action == 'delete') {
|
||||||
|
|
||||||
print "<table class='noborder' width='100%'>\n";
|
print "<table class='noborder' width='100%'>\n";
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre">'.$langs->trans("AccountAccounting")."</td>";
|
print '<td class="liste_titre">'.$langs->trans("AccountAccounting")."</td>";
|
||||||
|
|||||||
@ -170,7 +170,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
|||||||
}
|
}
|
||||||
if (isset($_POST["code"]))
|
if (isset($_POST["code"]))
|
||||||
{
|
{
|
||||||
if ($_POST["code"]=='0')
|
if ($_POST["code"]=='0')
|
||||||
{
|
{
|
||||||
$ok=0;
|
$ok=0;
|
||||||
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
||||||
@ -449,7 +449,7 @@ if ($id)
|
|||||||
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 '<div class="div-table-responsive">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
// Form to add a new line
|
// Form to add a new line
|
||||||
if ($tabname[$id])
|
if ($tabname[$id])
|
||||||
@ -468,7 +468,7 @@ if ($id)
|
|||||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||||
$class="left";
|
$class="left";
|
||||||
if ($fieldlist[$field]=='type') {
|
if ($fieldlist[$field]=='type') {
|
||||||
if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") {
|
if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") {
|
||||||
$valuetoshow=$form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
|
$valuetoshow=$form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
|
||||||
} else {
|
} else {
|
||||||
$valuetoshow=$langs->trans("Type");
|
$valuetoshow=$langs->trans("Type");
|
||||||
@ -501,7 +501,7 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='range_account') {
|
if ($fieldlist[$field]=='range_account') {
|
||||||
$valuetoshow=$langs->trans("Comment");
|
$valuetoshow=$langs->trans("Comment");
|
||||||
}
|
}
|
||||||
if ($fieldlist[$field]=='category_type') {
|
if ($fieldlist[$field]=='category_type') {
|
||||||
$valuetoshow=$langs->trans("Calculated");
|
$valuetoshow=$langs->trans("Calculated");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -742,7 +742,6 @@ if ($id)
|
|||||||
{
|
{
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
|
|
||||||
$showfield=1;
|
$showfield=1;
|
||||||
$class="left";
|
$class="left";
|
||||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||||
|
|||||||
@ -96,10 +96,9 @@ 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">';
|
||||||
|
|
||||||
// Define main accounts for closure
|
// Define main accounts for closure
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
foreach ($list_account_main as $key) {
|
foreach ($list_account_main as $key) {
|
||||||
|
|
||||||
print '<tr class="oddeven value">';
|
print '<tr class="oddeven value">';
|
||||||
// Param
|
// Param
|
||||||
$label = $langs->trans($key);
|
$label = $langs->trans($key);
|
||||||
|
|||||||
@ -83,7 +83,6 @@ if (GETPOST('change_chart', 'alpha'))
|
|||||||
$chartofaccounts = GETPOST('chartofaccounts', 'int');
|
$chartofaccounts = GETPOST('chartofaccounts', 'int');
|
||||||
|
|
||||||
if (! empty($chartofaccounts)) {
|
if (! empty($chartofaccounts)) {
|
||||||
|
|
||||||
if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
|
if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
@ -141,10 +140,9 @@ print '<input type="hidden" name="action" value="update">';
|
|||||||
|
|
||||||
// Define main accounts for thirdparty
|
// Define main accounts for thirdparty
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
foreach ($list_account_main as $key) {
|
foreach ($list_account_main as $key) {
|
||||||
|
|
||||||
print '<tr class="oddeven value">';
|
print '<tr class="oddeven value">';
|
||||||
// Param
|
// Param
|
||||||
$label = $langs->trans($key);
|
$label = $langs->trans($key);
|
||||||
@ -169,10 +167,9 @@ print '<br>';
|
|||||||
|
|
||||||
// Define default accounts
|
// Define default accounts
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
foreach ($list_account as $key) {
|
foreach ($list_account as $key) {
|
||||||
|
|
||||||
print '<tr class="oddeven value">';
|
print '<tr class="oddeven value">';
|
||||||
// Param
|
// Param
|
||||||
$label = $langs->trans($key);
|
$label = $langs->trans($key);
|
||||||
|
|||||||
@ -114,7 +114,7 @@ if ($action == 'update') {
|
|||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
// reload
|
// reload
|
||||||
@ -195,7 +195,7 @@ print '<input type="hidden" name="action" value="update">';
|
|||||||
* Main Options
|
* Main Options
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="3">' . $langs->trans('Options') . '</td>';
|
print '<td colspan="3">' . $langs->trans('Options') . '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -203,7 +203,6 @@ print "</tr>\n";
|
|||||||
$num = count($main_option);
|
$num = count($main_option);
|
||||||
if ($num) {
|
if ($num) {
|
||||||
foreach ($main_option as $key) {
|
foreach ($main_option as $key) {
|
||||||
|
|
||||||
print '<tr class="oddeven value">';
|
print '<tr class="oddeven value">';
|
||||||
|
|
||||||
// Param
|
// Param
|
||||||
@ -224,7 +223,7 @@ print "<br>\n";
|
|||||||
/*
|
/*
|
||||||
* Export model
|
* Export model
|
||||||
*/
|
*/
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="2">' . $langs->trans("Modelcsv") . '</td>';
|
print '<td colspan="2">' . $langs->trans("Modelcsv") . '</td>';
|
||||||
@ -255,7 +254,7 @@ print "<br>\n";
|
|||||||
|
|
||||||
$num2 = count($model_option);
|
$num2 = count($model_option);
|
||||||
if ($num2) {
|
if ($num2) {
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="3">' . $langs->trans('OtherOptions') . '</td>';
|
print '<td colspan="3">' . $langs->trans('OtherOptions') . '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|||||||
@ -43,9 +43,9 @@ if (! $sortorder) $sortorder="ASC";
|
|||||||
$langs->loadLangs(array("admin","compta"));
|
$langs->loadLangs(array("admin","compta"));
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
if (! $user->rights->accounting->fiscalyear) // If we can read accounting records, we should be able to see fiscal year.
|
if (! $user->rights->accounting->fiscalyear->write) // If we can read accounting records, we should be able to see fiscal year.
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -112,7 +112,7 @@ if ($result)
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
|
|
||||||
$addbutton.= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->rights->accounting->fiscalyear);
|
$addbutton.= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->rights->accounting->fiscalyear->write);
|
||||||
|
|
||||||
|
|
||||||
$title = $langs->trans('AccountingPeriods');
|
$title = $langs->trans('AccountingPeriods');
|
||||||
@ -120,7 +120,7 @@ if ($result)
|
|||||||
|
|
||||||
// Load attribute_label
|
// Load attribute_label
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="tagtable liste" width="100%">';
|
print '<table class="tagtable liste centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>' . $langs->trans("Ref") . '</td>';
|
print '<td>' . $langs->trans("Ref") . '</td>';
|
||||||
print '<td>' . $langs->trans("Label") . '</td>';
|
print '<td>' . $langs->trans("Label") . '</td>';
|
||||||
|
|||||||
@ -31,9 +31,9 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php';
|
|||||||
$langs->loadLangs(array("admin","compta"));
|
$langs->loadLangs(array("admin","compta"));
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
if (empty($user->rights->accounting->fiscalyear))
|
if (empty($user->rights->accounting->fiscalyear->write))
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -163,7 +163,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans("Label") . '</td><td><input name="label" size="32" value="' . GETPOST('label', 'alpha') . '"></td></tr>';
|
print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans("Label") . '</td><td><input name="label" size="32" value="' . GETPOST('label', 'alpha') . '"></td></tr>';
|
||||||
@ -211,7 +211,7 @@ if ($action == 'create')
|
|||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
print '<input type="hidden" name="id" value="' . $id . '">';
|
print '<input type="hidden" name="id" value="' . $id . '">';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
@ -261,7 +261,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
dol_fiche_head($head, 'card', $langs->trans("Fiscalyear"), 0, 'cron');
|
dol_fiche_head($head, 'card', $langs->trans("Fiscalyear"), 0, 'cron');
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
$linkback = '<a href="' . DOL_URL_ROOT . '/accountancy/admin/fiscalyear.php">' . $langs->trans("BackToList") . '</a>';
|
$linkback = '<a href="' . DOL_URL_ROOT . '/accountancy/admin/fiscalyear.php">' . $langs->trans("BackToList") . '</a>';
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
if (! empty($user->rights->accounting->fiscalyear))
|
if (! empty($user->rights->accounting->fiscalyear->write))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Barre d'actions
|
* Barre d'actions
|
||||||
|
|||||||
@ -30,9 +30,9 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php';
|
|||||||
$langs->loadLangs(array("admin","compta"));
|
$langs->loadLangs(array("admin","compta"));
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
if (! $user->rights->accounting->fiscalyear)
|
if (! $user->rights->accounting->fiscalyear->write)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
|
|||||||
@ -88,11 +88,11 @@ if ($action == 'setlistsorttodo') {
|
|||||||
if (! $res > 0)
|
if (! $res > 0)
|
||||||
$error ++;
|
$error ++;
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans("Error"), null, 'mesgs');
|
setEventMessages($langs->trans("Error"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setlistsortdone') {
|
if ($action == 'setlistsortdone') {
|
||||||
@ -100,11 +100,11 @@ if ($action == 'setlistsortdone') {
|
|||||||
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity);
|
||||||
if (! $res > 0)
|
if (! $res > 0)
|
||||||
$error ++;
|
$error ++;
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans("Error"), null, 'mesgs');
|
setEventMessages($langs->trans("Error"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setmanagezero') {
|
if ($action == 'setmanagezero') {
|
||||||
@ -112,11 +112,11 @@ if ($action == 'setmanagezero') {
|
|||||||
$res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity);
|
||||||
if (! $res > 0)
|
if (! $res > 0)
|
||||||
$error ++;
|
$error ++;
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans("Error"), null, 'mesgs');
|
setEventMessages($langs->trans("Error"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setdisabledirectinput') {
|
if ($action == 'setdisabledirectinput') {
|
||||||
@ -124,11 +124,11 @@ if ($action == 'setdisabledirectinput') {
|
|||||||
$res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity);
|
||||||
if (! $res > 0)
|
if (! $res > 0)
|
||||||
$error ++;
|
$error ++;
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans("Error"), null, 'mesgs');
|
setEventMessages($langs->trans("Error"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setenabledraftexport') {
|
if ($action == 'setenabledraftexport') {
|
||||||
@ -136,11 +136,11 @@ if ($action == 'setenabledraftexport') {
|
|||||||
$res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport, 'yesno', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport, 'yesno', 0, '', $conf->entity);
|
||||||
if (! $res > 0)
|
if (! $res > 0)
|
||||||
$error ++;
|
$error ++;
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans("Error"), null, 'mesgs');
|
setEventMessages($langs->trans("Error"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setenablesubsidiarylist') {
|
if ($action == 'setenablesubsidiarylist') {
|
||||||
@ -172,7 +172,7 @@ print '<input type="hidden" name="action" value="update">';
|
|||||||
|
|
||||||
// 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 centpercent">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>' . $langs->trans('OptionMode') . '</td><td>' . $langs->trans('Description') . '</td>';
|
print '<td>' . $langs->trans('OptionMode') . '</td><td>' . $langs->trans('Description') . '</td>';
|
||||||
@ -202,7 +202,7 @@ print '<br>';
|
|||||||
|
|
||||||
// Others params
|
// Others params
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="2">' . $langs->trans('OtherOptions') . '</td>';
|
print '<td colspan="2">' . $langs->trans('OtherOptions') . '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|||||||
@ -412,7 +412,7 @@ if ($id)
|
|||||||
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 '<div class="div-table-responsive">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
// Form to add a new line
|
// Form to add a new line
|
||||||
if ($tabname[$id])
|
if ($tabname[$id])
|
||||||
@ -609,7 +609,6 @@ if ($id)
|
|||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
|
|
||||||
$showfield=1;
|
$showfield=1;
|
||||||
$class="left";
|
$class="left";
|
||||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||||
|
|||||||
@ -117,7 +117,6 @@ if ($action == 'update') {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (in_array($accounting_product_mode, $accounting_product_modes)) {
|
if (in_array($accounting_product_mode, $accounting_product_modes)) {
|
||||||
|
|
||||||
if (! dolibarr_set_const($db, 'ACCOUNTING_PRODUCT_MODE', $accounting_product_mode, 'chaine', 0, '', $conf->entity)) {
|
if (! dolibarr_set_const($db, 'ACCOUNTING_PRODUCT_MODE', $accounting_product_mode, 'chaine', 0, '', $conf->entity)) {
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
@ -129,7 +128,6 @@ if ($action == 'update') {
|
|||||||
if (! empty($btn_changeaccount)) {
|
if (! empty($btn_changeaccount)) {
|
||||||
//$msg = '<div><span class="accountingprocessing">' . $langs->trans("Processing") . '...</span></div>';
|
//$msg = '<div><span class="accountingprocessing">' . $langs->trans("Processing") . '...</span></div>';
|
||||||
if (! empty($chk_prod)) {
|
if (! empty($chk_prod)) {
|
||||||
|
|
||||||
$accounting = new AccountingAccount($db);
|
$accounting = new AccountingAccount($db);
|
||||||
|
|
||||||
//$msg .= '<div><span class="accountingprocessing">' . count($chk_prod) . ' ' . $langs->trans("SelectedLines") . '</span></div>';
|
//$msg .= '<div><span class="accountingprocessing">' . count($chk_prod) . ' ' . $langs->trans("SelectedLines") . '</span></div>';
|
||||||
@ -327,7 +325,7 @@ if ($result)
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
// Select mode
|
// Select mode
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>' . $langs->trans('Options') . '</td><td>' . $langs->trans('Description') . '</td>';
|
print '<td>' . $langs->trans('Options') . '</td><td>' . $langs->trans('Description') . '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|||||||
@ -279,8 +279,8 @@ if ($action != 'export_csv')
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affiche le compte comptable en debut de ligne
|
// Show first line of a break
|
||||||
print "<tr>";
|
print '<tr class="trforbreak">';
|
||||||
print '<td colspan="6" style="font-weight:bold; border-bottom: 1pt solid black;">' . $line->numero_compte . ($root_account_description ? ' - ' . $root_account_description : '') . '</td>';
|
print '<td colspan="6" style="font-weight:bold; border-bottom: 1pt solid black;">' . $line->numero_compte . ($root_account_description ? ' - ' . $root_account_description : '') . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|||||||
@ -70,7 +70,7 @@ if ($result) {
|
|||||||
|
|
||||||
$y = $year_current;
|
$y = $year_current;
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td width=150>' . $langs->trans("Label") . '</td>';
|
print '<td width=150>' . $langs->trans("Label") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i++)
|
for($i = 1; $i <= 12; $i++)
|
||||||
@ -105,7 +105,6 @@ if ($resql) {
|
|||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
while ( $i < $num ) {
|
while ( $i < $num ) {
|
||||||
|
|
||||||
$row = $db->fetch_row($resql);
|
$row = $db->fetch_row($resql);
|
||||||
|
|
||||||
print '<tr class="oddeven"><td width="14%">' . length_accountg($row[0]) . '</td>';
|
print '<tr class="oddeven"><td width="14%">' . length_accountg($row[0]) . '</td>';
|
||||||
|
|||||||
@ -45,7 +45,7 @@ $mode = GETPOST('mode', 'aZ09'); // '' or 'tmp'
|
|||||||
$piece_num = GETPOST("piece_num", 'int'); // id of transaction (several lines share the same transaction id)
|
$piece_num = GETPOST("piece_num", 'int'); // id of transaction (several lines share the same transaction id)
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0) {
|
if ($user->socid > 0) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,6 @@ $object = new BookKeeping($db);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == "confirm_update") {
|
if ($action == "confirm_update") {
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
|
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
|
||||||
@ -355,7 +354,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
/*print '<tr>';
|
/*print '<tr>';
|
||||||
print '<td class="titlefieldcreate fieldrequired">' . $langs->trans("NumPiece") . '</td>';
|
print '<td class="titlefieldcreate fieldrequired">' . $langs->trans("NumPiece") . '</td>';
|
||||||
@ -585,7 +584,6 @@ if ($action == 'create')
|
|||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("ListeMvts"), '', '');
|
print load_fiche_titre($langs->trans("ListeMvts"), '', '');
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">';
|
||||||
@ -601,7 +599,6 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
if (count($object->linesmvt) > 0) {
|
if (count($object->linesmvt) > 0) {
|
||||||
|
|
||||||
$total_debit = 0;
|
$total_debit = 0;
|
||||||
$total_credit = 0;
|
$total_credit = 0;
|
||||||
|
|
||||||
|
|||||||
@ -155,6 +155,12 @@ $arrayfields=array(
|
|||||||
|
|
||||||
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']);
|
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']);
|
||||||
|
|
||||||
|
$listofformat=AccountancyExport::getType();
|
||||||
|
$formatexportset = $conf->global->ACCOUNTING_EXPORT_MODELCSV;
|
||||||
|
if (empty($listofformat[$formatexportset])) $formatexportset = 1;
|
||||||
|
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -310,7 +316,6 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) {
|
if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) {
|
||||||
|
|
||||||
$import_key = GETPOST('importkey', 'alpha');
|
$import_key = GETPOST('importkey', 'alpha');
|
||||||
|
|
||||||
if (! empty($import_key)) {
|
if (! empty($import_key)) {
|
||||||
@ -325,7 +330,6 @@ if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->suppri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouvements->supprimer_tous) {
|
if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouvements->supprimer_tous) {
|
||||||
|
|
||||||
$delyear = GETPOST('delyear', 'int');
|
$delyear = GETPOST('delyear', 'int');
|
||||||
if ($delyear==-1) {
|
if ($delyear==-1) {
|
||||||
$delyear=0;
|
$delyear=0;
|
||||||
@ -356,7 +360,6 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->supprimer) {
|
if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->supprimer) {
|
||||||
|
|
||||||
$mvt_num = GETPOST('mvt_num', 'int');
|
$mvt_num = GETPOST('mvt_num', 'int');
|
||||||
|
|
||||||
if (! empty($mvt_num)) {
|
if (! empty($mvt_num)) {
|
||||||
@ -373,10 +376,96 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($action == 'setreexport') {
|
||||||
|
$setreexport = GETPOST('value', 'int');
|
||||||
|
if (! dolibarr_set_const($db, "ACCOUNTING_REEXPORT", $setreexport, 'yesno', 0, '', $conf->entity)) $error++;
|
||||||
|
|
||||||
|
if (! $error) {
|
||||||
|
if ($conf->global->ACCOUNTING_REEXPORT == 1) {
|
||||||
|
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs');
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'mesgs');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build and execute select (used by page and export action)
|
||||||
|
// must de set after the action that set $filter
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
|
$sql = 'SELECT';
|
||||||
|
$sql .= ' t.rowid,';
|
||||||
|
$sql .= " t.doc_date,";
|
||||||
|
$sql .= " t.doc_type,";
|
||||||
|
$sql .= " t.doc_ref,";
|
||||||
|
$sql .= " t.fk_doc,";
|
||||||
|
$sql .= " t.fk_docdet,";
|
||||||
|
$sql .= " t.thirdparty_code,";
|
||||||
|
$sql .= " t.subledger_account,";
|
||||||
|
$sql .= " t.subledger_label,";
|
||||||
|
$sql .= " t.numero_compte,";
|
||||||
|
$sql .= " t.label_compte,";
|
||||||
|
$sql .= " t.label_operation,";
|
||||||
|
$sql .= " t.debit,";
|
||||||
|
$sql .= " t.credit,";
|
||||||
|
$sql .= " t.lettering_code,";
|
||||||
|
$sql .= " t.montant,";
|
||||||
|
$sql .= " t.sens,";
|
||||||
|
$sql .= " t.fk_user_author,";
|
||||||
|
$sql .= " t.import_key,";
|
||||||
|
$sql .= " t.code_journal,";
|
||||||
|
$sql .= " t.journal_label,";
|
||||||
|
$sql .= " t.piece_num,";
|
||||||
|
$sql .= " t.date_creation,";
|
||||||
|
$sql .= " t.tms as date_modification,";
|
||||||
|
$sql .= " t.date_export";
|
||||||
|
$sql .= ' FROM ' . MAIN_DB_PREFIX . $object->table_element . ' as t';
|
||||||
|
// Manage filter
|
||||||
|
$sqlwhere = array ();
|
||||||
|
if (count($filter) > 0) {
|
||||||
|
foreach ($filter as $key => $value) {
|
||||||
|
if ($key == 't.doc_date') {
|
||||||
|
$sqlwhere[] = $key . '=\'' . $db->idate($value) . '\'';
|
||||||
|
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
|
||||||
|
$sqlwhere[] = $key . '\'' . $db->idate($value) . '\'';
|
||||||
|
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
|
||||||
|
$sqlwhere[] = $key . '\'' . $db->escape($value) . '\'';
|
||||||
|
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
|
||||||
|
$sqlwhere[] = $key . '=' . $value;
|
||||||
|
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
|
||||||
|
$sqlwhere[] = $key . ' LIKE \'' . $db->escape($value) . '%\'';
|
||||||
|
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
|
||||||
|
$sqlwhere[] = $key . '\'' . $db->idate($value) . '\'';
|
||||||
|
} elseif ($key == 't.tms>=' || $key == 't.tms<=') {
|
||||||
|
$sqlwhere[] = $key . '\'' . $db->idate($value) . '\'';
|
||||||
|
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
|
||||||
|
$sqlwhere[] = $key . '\'' . $db->idate($value) . '\'';
|
||||||
|
} elseif ($key == 't.credit' || $key == 't.debit') {
|
||||||
|
$sqlwhere[] = natural_search($key, $value, 1, 1);
|
||||||
|
} else {
|
||||||
|
$sqlwhere[] = natural_search($key, $value, 0, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sql.= ' WHERE t.entity IN (' . getEntity('accountancy') . ')';
|
||||||
|
if ($conf->global->ACCOUNTING_REEXPORT == 0) {
|
||||||
|
$sql .= " AND t.date_export IS NULL";
|
||||||
|
}
|
||||||
|
if (count($sqlwhere) > 0) {
|
||||||
|
$sql .= ' AND ' . implode(' AND ', $sqlwhere);
|
||||||
|
}
|
||||||
|
if (! empty($sortfield)) {
|
||||||
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
|
}
|
||||||
|
//print $sql;
|
||||||
|
|
||||||
|
|
||||||
// Export into a file with format defined into setup (FEC, CSV, ...)
|
// Export into a file with format defined into setup (FEC, CSV, ...)
|
||||||
|
// Must be after definition of $sql
|
||||||
if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
|
if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
|
||||||
|
// TODO Replace the fetchAll + ->export later that consume too much memory on large export with the query($sql) and loop on each line to export them.
|
||||||
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT);
|
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT);
|
||||||
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -387,55 +476,54 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
|
|||||||
{
|
{
|
||||||
// Export files
|
// Export files
|
||||||
$accountancyexport = new AccountancyExport($db);
|
$accountancyexport = new AccountancyExport($db);
|
||||||
$accountancyexport->export($object->lines);
|
$accountancyexport->export($object->lines, $formatexportset);
|
||||||
|
|
||||||
if (! empty($accountancyexport->errors))
|
if (! empty($accountancyexport->errors))
|
||||||
{
|
{
|
||||||
setEventMessages('', $accountancyexport->errors, 'errors');
|
setEventMessages('', $accountancyexport->errors, 'errors');
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Specify as export : update field date_export
|
// Specify as export : update field date_export
|
||||||
// TODO Move in class bookKeeping
|
|
||||||
$error=0;
|
$error=0;
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
if (is_array($object->lines)) {
|
if (is_array($object->lines))
|
||||||
foreach ($object->lines as $movement) {
|
{
|
||||||
|
foreach ($object->lines as $movement)
|
||||||
|
{
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping";
|
$sql = " UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping";
|
||||||
$sql .= " SET date_export = '" . $db->idate($now) . "'";
|
$sql .= " SET date_export = '" . $db->idate($now) . "'";
|
||||||
$sql .= " WHERE rowid = " . $movement->id;
|
$sql .= " WHERE rowid = " . $movement->id;
|
||||||
|
|
||||||
dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=" . $sql, LOG_DEBUG);
|
dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=" . $sql, LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if (! $result)
|
||||||
$db->commit();
|
{
|
||||||
// setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs');
|
$error++;
|
||||||
} else {
|
break;
|
||||||
$db->rollback();
|
|
||||||
// setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$db->commit();
|
||||||
|
// setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$db->rollback();
|
||||||
|
setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setreexport') {
|
|
||||||
$export = 0;
|
|
||||||
$setreexport = GETPOST('value', 'int');
|
|
||||||
if (! dolibarr_set_const($db, "ACCOUNTING_REEXPORT", $setreexport, 'yesno', 0, '', $conf->entity)) $error++;
|
|
||||||
|
|
||||||
if (! $error) {
|
|
||||||
if ($conf->global->ACCOUNTING_REEXPORT == 1) {
|
|
||||||
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs');
|
|
||||||
} else {
|
|
||||||
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'mesgs');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -443,31 +531,49 @@ if ($action == 'setreexport') {
|
|||||||
|
|
||||||
$title_page = $langs->trans("Bookkeeping");
|
$title_page = $langs->trans("Bookkeeping");
|
||||||
|
|
||||||
llxHeader('', $title_page);
|
// Count total nb of records
|
||||||
|
|
||||||
// List
|
|
||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
$nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT);
|
{
|
||||||
if ($nbtotalofrecords < 0) {
|
$resql = $db->query($sql);
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
$nbtotalofrecords = $db->num_rows($resql);
|
||||||
|
if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
|
||||||
|
{
|
||||||
|
$page = 0;
|
||||||
|
$offset = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
|
||||||
|
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
|
||||||
|
{
|
||||||
|
$num = $nbtotalofrecords;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
|
|
||||||
// TODO Do not use this
|
$resql=$db->query($sql);
|
||||||
$result = $object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT);
|
if (! $resql)
|
||||||
if ($result < 0) {
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
dol_print_error($db);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$num=count($object->lines);
|
|
||||||
|
// Output page
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
|
llxHeader('', $title_page);
|
||||||
|
|
||||||
|
|
||||||
if ($action == 'delmouv') {
|
if ($action == 'delmouv') {
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?mvt_num='.GETPOST('mvt_num').$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?mvt_num='.GETPOST('mvt_num').$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1);
|
||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
}
|
}
|
||||||
if ($action == 'delbookkeepingyear') {
|
if ($action == 'delbookkeepingyear') {
|
||||||
|
|
||||||
$form_question = array ();
|
$form_question = array ();
|
||||||
$delyear = GETPOST('delyear');
|
$delyear = GETPOST('delyear');
|
||||||
$deljournal = GETPOST('deljournal');
|
$deljournal = GETPOST('deljournal');
|
||||||
@ -502,35 +608,32 @@ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&con
|
|||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
|
|
||||||
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="list">';
|
print '<input type="hidden" name="action" value="list">';
|
||||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
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="formfilteraction" id="formfilteraction" value="list">';
|
||||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
|
|
||||||
$button .= '<a class="butAction" title="" name="button_export_file" href="'.$_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:'').'">';
|
|
||||||
|
|
||||||
$listofformat=AccountancyExport::getType();
|
|
||||||
if (count($filter)) $buttonLabel = $langs->trans("ExportFilteredList");
|
if (count($filter)) $buttonLabel = $langs->trans("ExportFilteredList");
|
||||||
else $buttonLabel = $langs->trans("ExportList");
|
else $buttonLabel = $langs->trans("ExportList");
|
||||||
|
|
||||||
// Button re-export
|
// Button re-export
|
||||||
if (! empty($conf->global->ACCOUNTING_REEXPORT)) {
|
if (! empty($conf->global->ACCOUNTING_REEXPORT)) {
|
||||||
$newcardbutton ='<a href="'.$_SERVER['PHP_SELF'].'?action=setreexport&value=0'.($param?'&'.$param:'').'">'.img_picto($langs->trans("Activated"), 'switch_on').'</a> ';
|
$newcardbutton ='<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&value=0'.($param?'&'.$param:'').'">'.img_picto($langs->trans("Activated"), 'switch_on').'</a> ';
|
||||||
} else {
|
} else {
|
||||||
$newcardbutton ='<a href="'.$_SERVER['PHP_SELF'].'?action=setreexport&value=1'.($param?'&'.$param:'').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> ';
|
$newcardbutton ='<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&value=1'.($param?'&'.$param:'').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> ';
|
||||||
}
|
}
|
||||||
$newcardbutton.= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>';
|
$newcardbutton.= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>';
|
||||||
|
|
||||||
$newcardbutton.= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:''), $user->rights->accounting->mouvements->export);
|
$newcardbutton.= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:''), $user->rights->accounting->mouvements->export);
|
||||||
|
|
||||||
$newcardbutton.= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param);
|
$newcardbutton.= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param);
|
||||||
|
|
||||||
$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create', '', $user->rights->accounting->mouvements->creer);
|
$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create', '', $user->rights->accounting->mouvements->creer);
|
||||||
|
|
||||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit);
|
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit);
|
||||||
|
|
||||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||||
@ -542,7 +645,7 @@ if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
|||||||
else $moreforfilter = $hookmanager->resPrint;
|
else $moreforfilter = $hookmanager->resPrint;
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="tagtable liste" width="100%">';
|
print '<table class="tagtable liste centpercent">';
|
||||||
|
|
||||||
// Filters lines
|
// Filters lines
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
@ -650,7 +753,6 @@ if (! empty($arrayfields['t.code_journal']['checked']))
|
|||||||
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Fields from hook
|
// Fields from hook
|
||||||
$parameters=array('arrayfields'=>$arrayfields);
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
@ -727,170 +829,177 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
if ($num > 0)
|
$line = new BookKeepingLine();
|
||||||
|
|
||||||
|
// Loop on record
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
$i=0;
|
||||||
|
$totalarray=array();
|
||||||
|
while ($i < min($num, $limit))
|
||||||
{
|
{
|
||||||
$i=0;
|
$obj = $db->fetch_object($resql);
|
||||||
$totalarray=array();
|
if (empty($obj)) break; // Should not happen
|
||||||
while ($i < min($num, $limit))
|
|
||||||
|
$line->id = $obj->rowid;
|
||||||
|
$line->doc_date = $db->jdate($obj->doc_date);
|
||||||
|
$line->doc_type = $obj->doc_type;
|
||||||
|
$line->doc_ref = $obj->doc_ref;
|
||||||
|
$line->fk_doc = $obj->fk_doc;
|
||||||
|
$line->fk_docdet = $obj->fk_docdet;
|
||||||
|
$line->thirdparty_code = $obj->thirdparty_code;
|
||||||
|
$line->subledger_account = $obj->subledger_account;
|
||||||
|
$line->subledger_label = $obj->subledger_label;
|
||||||
|
$line->numero_compte = $obj->numero_compte;
|
||||||
|
$line->label_compte = $obj->label_compte;
|
||||||
|
$line->label_operation = $obj->label_operation;
|
||||||
|
$line->debit = $obj->debit;
|
||||||
|
$line->credit = $obj->credit;
|
||||||
|
$line->montant = $obj->montant;
|
||||||
|
$line->sens = $obj->sens;
|
||||||
|
$line->lettering_code = $obj->lettering_code;
|
||||||
|
$line->fk_user_author = $obj->fk_user_author;
|
||||||
|
$line->import_key = $obj->import_key;
|
||||||
|
$line->code_journal = $obj->code_journal;
|
||||||
|
$line->journal_label = $obj->journal_label;
|
||||||
|
$line->piece_num = $obj->piece_num;
|
||||||
|
$line->date_creation = $db->jdate($obj->date_creation);
|
||||||
|
$line->date_modification = $db->jdate($obj->date_modification);
|
||||||
|
$line->date_export = $db->jdate($obj->date_export);
|
||||||
|
|
||||||
|
$total_debit += $line->debit;
|
||||||
|
$total_credit += $line->credit;
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
|
// Piece number
|
||||||
|
if (! empty($arrayfields['t.piece_num']['checked']))
|
||||||
{
|
{
|
||||||
$line = $object->lines[$i];
|
print '<td>';
|
||||||
|
$object->id = $line->id;
|
||||||
$total_debit += $line->debit;
|
$object->piece_num = $line->piece_num;
|
||||||
$total_credit += $line->credit;
|
print $object->getNomUrl(1, '', 0, '', 1);
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
|
|
||||||
// Piece number
|
|
||||||
if (! empty($arrayfields['t.piece_num']['checked']))
|
|
||||||
{
|
|
||||||
print '<td>';
|
|
||||||
$object->id = $line->id;
|
|
||||||
$object->piece_num = $line->piece_num;
|
|
||||||
print $object->getNomUrl(1, '', 0, '', 1);
|
|
||||||
print '</td>';
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Document date
|
|
||||||
if (! empty($arrayfields['t.doc_date']['checked']))
|
|
||||||
{
|
|
||||||
print '<td class="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Document ref
|
|
||||||
if (! empty($arrayfields['t.doc_ref']['checked']))
|
|
||||||
{
|
|
||||||
print '<td class="nowrap">' . $line->doc_ref . '</td>';
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Account number
|
|
||||||
if (! empty($arrayfields['t.numero_compte']['checked']))
|
|
||||||
{
|
|
||||||
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Subledger account
|
|
||||||
if (! empty($arrayfields['t.subledger_account']['checked']))
|
|
||||||
{
|
|
||||||
print '<td>' . length_accounta($line->subledger_account) . '</td>';
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Label operation
|
|
||||||
if (! empty($arrayfields['t.label_operation']['checked']))
|
|
||||||
{
|
|
||||||
print '<td>' . $line->label_operation . '</td>';
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Amount debit
|
|
||||||
if (! empty($arrayfields['t.debit']['checked']))
|
|
||||||
{
|
|
||||||
print '<td class="nowrap right">' . ($line->debit ? price($line->debit) : ''). '</td>';
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
|
||||||
if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield'];
|
|
||||||
$totalarray['totaldebit'] += $line->debit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Amount credit
|
|
||||||
if (! empty($arrayfields['t.credit']['checked']))
|
|
||||||
{
|
|
||||||
print '<td class="nowrap right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
|
||||||
if (! $i) $totalarray['totalcreditfield']=$totalarray['nbfield'];
|
|
||||||
$totalarray['totalcredit'] += $line->credit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lettering code
|
|
||||||
if (! empty($arrayfields['t.lettering_code']['checked']))
|
|
||||||
{
|
|
||||||
print '<td class="center">' . $line->lettering_code . '</td>';
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Journal code
|
|
||||||
if (! empty($arrayfields['t.code_journal']['checked']))
|
|
||||||
{
|
|
||||||
$accountingjournal = new AccountingJournal($db);
|
|
||||||
$result = $accountingjournal->fetch('', $line->code_journal);
|
|
||||||
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
|
|
||||||
print '<td class="center">' . $journaltoshow . '</td>';
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fields from hook
|
|
||||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
|
||||||
print $hookmanager->resPrint;
|
|
||||||
|
|
||||||
// Creation operation date
|
|
||||||
if (! empty($arrayfields['t.date_creation']['checked']))
|
|
||||||
{
|
|
||||||
print '<td class="center">' . dol_print_date($line->date_creation, 'dayhour') . '</td>';
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Modification operation date
|
|
||||||
if (! empty($arrayfields['t.tms']['checked']))
|
|
||||||
{
|
|
||||||
print '<td class="center">' . dol_print_date($line->date_modification, 'dayhour') . '</td>';
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Exported operation date
|
|
||||||
if (! empty($arrayfields['t.date_export']['checked']))
|
|
||||||
{
|
|
||||||
print '<td align="center">' . dol_print_date($line->date_export, 'dayhour') . '</td>';
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Action column
|
|
||||||
print '<td class="nowraponall center">';
|
|
||||||
if (empty($line->date_export)) {
|
|
||||||
if ($user->rights->accounting->mouvements->creer) {
|
|
||||||
print '<a href="' . DOL_URL_ROOT . '/accountancy/bookkeeping/card.php?piece_num=' . $line->piece_num . $param . '&page=' . $page . ($sortfield ? '&sortfield=' . $sortfield : '') . ($sortorder ? '&sortorder=' . $sortorder : '') . '">' . img_edit() . '</a>';
|
|
||||||
}
|
|
||||||
if ($user->rights->accounting->mouvements->supprimer) {
|
|
||||||
print ' <a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . ($sortfield ? '&sortfield=' . $sortfield : '') . ($sortorder ? '&sortorder=' . $sortorder : '') . '">' . img_delete() . '</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
if (! $i) $totalarray['nbfield']++;
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
$i++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show total line
|
// Document date
|
||||||
if (isset($totalarray['totaldebitfield']) || isset($totalarray['totalcreditfield']))
|
if (! empty($arrayfields['t.doc_date']['checked']))
|
||||||
{
|
{
|
||||||
$i=0;
|
print '<td class="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
|
||||||
print '<tr class="liste_total">';
|
if (! $i) $totalarray['nbfield']++;
|
||||||
while ($i < $totalarray['nbfield'])
|
|
||||||
{
|
|
||||||
$i++;
|
|
||||||
if ($i == 1)
|
|
||||||
{
|
|
||||||
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
|
|
||||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
|
||||||
}
|
|
||||||
elseif ($totalarray['totaldebitfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totaldebit']).'</td>';
|
|
||||||
elseif ($totalarray['totalcreditfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totalcredit']).'</td>';
|
|
||||||
else print '<td></td>';
|
|
||||||
}
|
|
||||||
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
|
|
||||||
print $hookmanager->resPrint;
|
|
||||||
|
|
||||||
print '</tr>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Document ref
|
||||||
|
if (! empty($arrayfields['t.doc_ref']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="nowrap">' . $line->doc_ref . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Account number
|
||||||
|
if (! empty($arrayfields['t.numero_compte']['checked']))
|
||||||
|
{
|
||||||
|
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Subledger account
|
||||||
|
if (! empty($arrayfields['t.subledger_account']['checked']))
|
||||||
|
{
|
||||||
|
print '<td>' . length_accounta($line->subledger_account) . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Label operation
|
||||||
|
if (! empty($arrayfields['t.label_operation']['checked']))
|
||||||
|
{
|
||||||
|
print '<td>' . $line->label_operation . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Amount debit
|
||||||
|
if (! empty($arrayfields['t.debit']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="nowrap right">' . ($line->debit ? price($line->debit) : ''). '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totaldebit';
|
||||||
|
$totalarray['val']['totaldebit'] += $line->debit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Amount credit
|
||||||
|
if (! empty($arrayfields['t.credit']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="nowrap right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totalcredit';
|
||||||
|
$totalarray['val']['totalcredit'] += $line->credit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lettering code
|
||||||
|
if (! empty($arrayfields['t.lettering_code']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="center">' . $line->lettering_code . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Journal code
|
||||||
|
if (! empty($arrayfields['t.code_journal']['checked']))
|
||||||
|
{
|
||||||
|
$accountingjournal = new AccountingJournal($db);
|
||||||
|
$result = $accountingjournal->fetch('', $line->code_journal);
|
||||||
|
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
|
||||||
|
print '<td class="center">' . $journaltoshow . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fields from hook
|
||||||
|
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
|
// Creation operation date
|
||||||
|
if (! empty($arrayfields['t.date_creation']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="center">' . dol_print_date($line->date_creation, 'dayhour') . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Modification operation date
|
||||||
|
if (! empty($arrayfields['t.tms']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="center">' . dol_print_date($line->date_modification, 'dayhour') . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exported operation date
|
||||||
|
if (! empty($arrayfields['t.date_export']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="center">' . dol_print_date($line->date_export, 'dayhour') . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action column
|
||||||
|
print '<td class="nowraponall center">';
|
||||||
|
if (empty($line->date_export)) {
|
||||||
|
if ($user->rights->accounting->mouvements->creer) {
|
||||||
|
print '<a href="' . DOL_URL_ROOT . '/accountancy/bookkeeping/card.php?piece_num=' . $line->piece_num . $param . '&page=' . $page . ($sortfield ? '&sortfield=' . $sortfield : '') . ($sortorder ? '&sortorder=' . $sortorder : '') . '">' . img_edit() . '</a>';
|
||||||
|
}
|
||||||
|
if ($user->rights->accounting->mouvements->supprimer) {
|
||||||
|
print ' <a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . ($sortfield ? '&sortfield=' . $sortfield : '') . ($sortorder ? '&sortorder=' . $sortorder : '') . '">' . img_delete() . '</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show total line
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||||
|
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -37,9 +37,6 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
|||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("accountancy"));
|
$langs->loadLangs(array("accountancy"));
|
||||||
|
|
||||||
$page = GETPOST("page");
|
|
||||||
$sortorder = GETPOST("sortorder");
|
|
||||||
$sortfield = GETPOST("sortfield");
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
|
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
|
||||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
|
$search_date_end = dol_mktime(0, 0, 0, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
|
||||||
@ -71,9 +68,9 @@ $offset = $limit * $page;
|
|||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if ($sortorder == "") $sortorder = "ASC";
|
if ($sortorder == "") $sortorder = "ASC";
|
||||||
if ($sortfield == "") $sortfield = "t.rowid";
|
if ($sortfield == "") $sortfield = "t.doc_date,t.rowid";
|
||||||
|
|
||||||
if (empty($search_date_start) && empty($search_date_end)) {
|
if (empty($search_date_start) && empty($search_date_end) && GETPOSTISSET('search_date_startday') && GETPOSTISSET('search_date_startmonth') && GETPOSTISSET('search_date_starthour')) {
|
||||||
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
||||||
$sql.= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
|
$sql.= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
|
||||||
$sql.= $db->plimit(1);
|
$sql.= $db->plimit(1);
|
||||||
@ -182,7 +179,6 @@ if (! empty($search_credit)) {
|
|||||||
|
|
||||||
|
|
||||||
if ($action == 'delmouvconfirm') {
|
if ($action == 'delmouvconfirm') {
|
||||||
|
|
||||||
$mvt_num = GETPOST('mvt_num', 'int');
|
$mvt_num = GETPOST('mvt_num', 'int');
|
||||||
|
|
||||||
if (! empty($mvt_num)) {
|
if (! empty($mvt_num)) {
|
||||||
@ -232,7 +228,6 @@ if ($action == 'delmouv') {
|
|||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
}
|
}
|
||||||
if ($action == 'delbookkeepingyear') {
|
if ($action == 'delbookkeepingyear') {
|
||||||
|
|
||||||
$form_question = array ();
|
$form_question = array ();
|
||||||
$delyear = GETPOST('delyear');
|
$delyear = GETPOST('delyear');
|
||||||
|
|
||||||
@ -255,6 +250,14 @@ if ($action == 'delbookkeepingyear') {
|
|||||||
|
|
||||||
|
|
||||||
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="action" value="list">';
|
||||||
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" 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.'">';
|
||||||
|
|
||||||
|
|
||||||
$newcardbutton.= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
|
$newcardbutton.= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
|
||||||
$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create');
|
$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create');
|
||||||
@ -265,12 +268,11 @@ if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($lim
|
|||||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $viewflat.$newcardbutton, '', $limit);
|
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $viewflat.$newcardbutton, '', $limit);
|
||||||
|
|
||||||
// Reverse sort order
|
// Reverse sort order
|
||||||
if ( preg_match('/^asc/i', $sortorder) )
|
if (preg_match('/^asc/i', $sortorder)) $sortorder = "asc";
|
||||||
$sortorder = "asc";
|
else $sortorder = "desc";
|
||||||
else
|
|
||||||
$sortorder = "desc";
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<div class="div-table-responsive">';
|
||||||
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
@ -300,6 +302,7 @@ print '<td class="liste_titre right" colspan="2">';
|
|||||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||||
print $searchpicto;
|
print $searchpicto;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF']);
|
print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF']);
|
||||||
@ -313,8 +316,6 @@ print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "
|
|||||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60"', $sortfield, $sortorder, 'center ');
|
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60"', $sortfield, $sortorder, 'center ');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
|
|
||||||
$total_debit = 0;
|
$total_debit = 0;
|
||||||
$total_credit = 0;
|
$total_credit = 0;
|
||||||
@ -335,7 +336,6 @@ while ($i < min($num, $limit))
|
|||||||
|
|
||||||
// Is it a break ?
|
// Is it a break ?
|
||||||
if ($accountg != $displayed_account_number || ! isset($displayed_account_number)) {
|
if ($accountg != $displayed_account_number || ! isset($displayed_account_number)) {
|
||||||
|
|
||||||
// Affiche un Sous-Total par compte comptable
|
// Affiche un Sous-Total par compte comptable
|
||||||
if (isset($displayed_account_number)) {
|
if (isset($displayed_account_number)) {
|
||||||
print '<tr class="liste_total"><td class="right" colspan="5">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td>';
|
print '<tr class="liste_total"><td class="right" colspan="5">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td>';
|
||||||
@ -376,8 +376,8 @@ while ($i < min($num, $limit))
|
|||||||
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 class="right">' . ($line->debit ? price($line->debit) :''). '</td>';
|
print '<td class="nowrap right">' . ($line->debit ? price($line->debit) :''). '</td>';
|
||||||
print '<td class="right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
print '<td class="nowrap right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
||||||
|
|
||||||
$accountingjournal = new AccountingJournal($db);
|
$accountingjournal = new AccountingJournal($db);
|
||||||
$result = $accountingjournal->fetch('', $line->code_journal);
|
$result = $accountingjournal->fetch('', $line->code_journal);
|
||||||
@ -397,27 +397,32 @@ while ($i < min($num, $limit))
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affiche un Sous-Total du dernier compte comptable affiché
|
// Show sub-total of last shown account
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td class="right" colspan="5">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td>';
|
print '<td class="right" colspan="5">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td>';
|
||||||
print "<td> </td>\n";
|
print '<td class="nowraponall center">';
|
||||||
print "<td> </td>\n";
|
print price($sous_total_debit - $sous_total_credit);
|
||||||
|
print '</td>';
|
||||||
|
print '<td></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|
||||||
// Affiche le Total
|
// Show total
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td class="right" colspan="5">'.$langs->trans("Total").':</td>';
|
print '<td class="right" colspan="5">'.$langs->trans("Total").':</td>';
|
||||||
print '<td class="right">';
|
print '<td class="nowraponall right">';
|
||||||
print price($total_debit);
|
print price($total_debit);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="right">';
|
print '<td class="nowraponall right">';
|
||||||
print price($total_credit);
|
print price($total_credit);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td colspan="2"></td>';
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
|
|||||||
@ -83,7 +83,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST("socid", 'int');
|
$socid = GETPOST("socid", 'int');
|
||||||
// if ($user->societe_id) $socid=$user->societe_id;
|
// if ($user->socid) $socid=$user->socid;
|
||||||
|
|
||||||
$lettering = new Lettering($db);
|
$lettering = new Lettering($db);
|
||||||
$object = new Societe($db);
|
$object = new Societe($db);
|
||||||
@ -100,7 +100,6 @@ if ($result < 0)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'lettering') {
|
if ($action == 'lettering') {
|
||||||
|
|
||||||
$result = $lettering->updateLettering($toselect);
|
$result = $lettering->updateLettering($toselect);
|
||||||
|
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
@ -140,7 +139,7 @@ dol_fiche_head($head, 'lettering_customer', $langs->trans("ThirdParty"), 0, 'com
|
|||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
|
dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
@ -198,6 +197,7 @@ if ($resql) {
|
|||||||
|
|
||||||
$param="&socid=".$socid;
|
$param="&socid=".$socid;
|
||||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '" method="POST">';
|
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
||||||
|
|
||||||
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
|
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
|
||||||
@ -205,7 +205,7 @@ if ($resql) {
|
|||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="liste" width="100%">'."\n";
|
print '<table class="liste centpercent">'."\n";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -251,7 +251,6 @@ if ($resql) {
|
|||||||
$tmp = '';
|
$tmp = '';
|
||||||
|
|
||||||
while ( $obj = $db->fetch_object($resql) ) {
|
while ( $obj = $db->fetch_object($resql) ) {
|
||||||
|
|
||||||
if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
|
if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
|
||||||
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
|
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
|
||||||
|
|
||||||
|
|||||||
@ -83,7 +83,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST("socid", 'int');
|
$socid = GETPOST("socid", 'int');
|
||||||
// if ($user->societe_id) $socid=$user->societe_id;
|
// if ($user->socid) $socid=$user->socid;
|
||||||
|
|
||||||
$lettering = new Lettering($db);
|
$lettering = new Lettering($db);
|
||||||
$object = new Societe($db);
|
$object = new Societe($db);
|
||||||
@ -99,7 +99,6 @@ if ($result<0)
|
|||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
if ($action == 'lettering') {
|
if ($action == 'lettering') {
|
||||||
|
|
||||||
$result = $lettering->updateLettering($toselect);
|
$result = $lettering->updateLettering($toselect);
|
||||||
|
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
@ -139,7 +138,7 @@ dol_fiche_head($head, 'lettering_supplier', $langs->trans("ThirdParty"), 0, 'com
|
|||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
|
dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
@ -196,6 +195,7 @@ if ($resql) {
|
|||||||
|
|
||||||
$param="&socid=".$socid;
|
$param="&socid=".$socid;
|
||||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid=' . $object->id . '" method="POST">';
|
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid=' . $object->id . '" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
||||||
|
|
||||||
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
|
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
|
||||||
@ -203,7 +203,7 @@ if ($resql) {
|
|||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="liste" width="100%">'."\n";
|
print '<table class="liste centpercent">'."\n";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -248,7 +248,6 @@ if ($resql) {
|
|||||||
$solde = 0;
|
$solde = 0;
|
||||||
$tmp = '';
|
$tmp = '';
|
||||||
while ($obj = $db->fetch_object($resql)) {
|
while ($obj = $db->fetch_object($resql)) {
|
||||||
|
|
||||||
if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
|
if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
|
||||||
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
|
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
|
||||||
|
|
||||||
|
|||||||
@ -224,22 +224,23 @@ class AccountancyExport
|
|||||||
/**
|
/**
|
||||||
* Function who chose which export to use with the default config, and make the export into a file
|
* Function who chose which export to use with the default config, and make the export into a file
|
||||||
*
|
*
|
||||||
* @param array $TData data
|
* @param array $TData Array with data
|
||||||
* @return void
|
* @param int $formatexportset Id of export format
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function export(&$TData)
|
public function export(&$TData, $formatexportset)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
global $search_date_end; // Used into /accountancy/tpl/export_journal.tpl.php
|
global $search_date_end; // Used into /accountancy/tpl/export_journal.tpl.php
|
||||||
|
|
||||||
// Define name of file to save
|
// Define name of file to save
|
||||||
$filename = 'general_ledger-'.$this->getFormatCode($conf->global->ACCOUNTING_EXPORT_MODELCSV);
|
$filename = 'general_ledger-'.$this->getFormatCode($formatexportset);
|
||||||
$type_export = 'general_ledger';
|
$type_export = 'general_ledger';
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||||
|
|
||||||
|
|
||||||
switch ($conf->global->ACCOUNTING_EXPORT_MODELCSV) {
|
switch ($formatexportset) {
|
||||||
case self::$EXPORT_TYPE_CONFIGURABLE :
|
case self::$EXPORT_TYPE_CONFIGURABLE :
|
||||||
$this->exportConfigurable($TData);
|
$this->exportConfigurable($TData);
|
||||||
break;
|
break;
|
||||||
@ -548,7 +549,6 @@ class AccountancyExport
|
|||||||
$end_line = "\n";
|
$end_line = "\n";
|
||||||
|
|
||||||
foreach ($objectLines as $line) {
|
foreach ($objectLines as $line) {
|
||||||
|
|
||||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||||
|
|
||||||
print $line->id . $separator;
|
print $line->id . $separator;
|
||||||
@ -584,7 +584,6 @@ class AccountancyExport
|
|||||||
$end_line = "\n";
|
$end_line = "\n";
|
||||||
|
|
||||||
foreach ($objectLines as $line) {
|
foreach ($objectLines as $line) {
|
||||||
|
|
||||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||||
|
|
||||||
print $line->piece_num . $separator;
|
print $line->piece_num . $separator;
|
||||||
@ -624,7 +623,6 @@ class AccountancyExport
|
|||||||
$end_line = "\n";
|
$end_line = "\n";
|
||||||
|
|
||||||
foreach ($objectLines as $line) {
|
foreach ($objectLines as $line) {
|
||||||
|
|
||||||
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
||||||
|
|
||||||
print $date . $separator;
|
print $date . $separator;
|
||||||
@ -926,91 +924,130 @@ class AccountancyExport
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function exportLDCompta($objectLines)
|
public function exportLDCompta($objectLines)
|
||||||
{
|
{
|
||||||
|
|
||||||
$separator = ';';
|
$separator = ';';
|
||||||
$end_line = "\n";
|
$end_line = "\r\n";
|
||||||
|
|
||||||
foreach ($objectLines as $line) {
|
foreach ($objectLines as $line) {
|
||||||
|
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
|
||||||
|
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
|
||||||
|
|
||||||
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
|
// TYPE
|
||||||
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
|
$type_enregistrement = 'E'; // For write movement
|
||||||
|
print $type_enregistrement . $separator;
|
||||||
|
// JNAL
|
||||||
|
print substr($line->code_journal, 0, 2) . $separator;
|
||||||
|
// NECR
|
||||||
|
print $line->id . $separator;
|
||||||
|
// NPIE
|
||||||
|
print $line->piece_num . $separator;
|
||||||
|
// DATP
|
||||||
|
print $date_document . $separator;
|
||||||
|
// LIBE
|
||||||
|
print $line->label_operation . $separator;
|
||||||
|
// DATH
|
||||||
|
print $line->date_lim_reglement . $separator;
|
||||||
|
// CNPI
|
||||||
|
if ($line->doc_type == 'supplier_invoice') {
|
||||||
|
if ($line->montant < 0) {
|
||||||
|
$nature_piece = 'AF';
|
||||||
|
} else {
|
||||||
|
$nature_piece = 'FF';
|
||||||
|
}
|
||||||
|
} elseif ($line->doc_type == 'customer_invoice') {
|
||||||
|
if ($line->montant < 0) {
|
||||||
|
$nature_piece = 'AC';
|
||||||
|
} else {
|
||||||
|
$nature_piece = 'FC';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$nature_piece = '';
|
||||||
|
}
|
||||||
|
print $nature_piece . $separator;
|
||||||
|
// RACI
|
||||||
|
/*
|
||||||
|
if (! empty($line->subledger_account)) {
|
||||||
|
if ($line->doc_type == 'supplier_invoice') {
|
||||||
|
$racine_subledger_account = '40';
|
||||||
|
} elseif ($line->doc_type == 'customer_invoice') {
|
||||||
|
$racine_subledger_account = '41';
|
||||||
|
} else {
|
||||||
|
$nature_piece = '';
|
||||||
|
}
|
||||||
|
print $racine_subledger_account . $separator;
|
||||||
|
} else {
|
||||||
|
print $separator;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
print $separator; // deprecated CPTG & CPTA use instead
|
||||||
|
// MONT
|
||||||
|
print price(abs($line->montant), 0, '', 1, 2) . $separator;
|
||||||
|
// CODC
|
||||||
|
print $line->sens . $separator;
|
||||||
|
// CPTG
|
||||||
|
print length_accountg($line->numero_compte) . $separator;
|
||||||
|
// DATE
|
||||||
|
print $date_creation . $separator;
|
||||||
|
// CLET
|
||||||
|
print $line->lettering_code . $separator;
|
||||||
|
// DATL
|
||||||
|
print $line->date_lettering . $separator;
|
||||||
|
// CPTA
|
||||||
|
if (! empty($line->subledger_account)) {
|
||||||
|
print length_accounta($line->subledger_account) . $separator;
|
||||||
|
} else {
|
||||||
|
print $separator;
|
||||||
|
}
|
||||||
|
// CNAT
|
||||||
|
if ($line->doc_type == 'supplier_invoice' && ! empty($line->subledger_account)) {
|
||||||
|
print 'F' . $separator;
|
||||||
|
} elseif ($line->doc_type == 'customer_invoice' && ! empty($line->subledger_account)) {
|
||||||
|
print 'C' . $separator;
|
||||||
|
} else {
|
||||||
|
print $separator;
|
||||||
|
}
|
||||||
|
// SECT
|
||||||
|
print $separator;
|
||||||
|
// CTRE
|
||||||
|
print $separator;
|
||||||
|
// NORL
|
||||||
|
print $separator;
|
||||||
|
// DATV
|
||||||
|
print $separator;
|
||||||
|
// REFD
|
||||||
|
print $line->doc_ref . $separator;
|
||||||
|
// CODH
|
||||||
|
print $separator;
|
||||||
|
// NSEQ
|
||||||
|
print $separator;
|
||||||
|
// MTDV
|
||||||
|
print '0' . $separator;
|
||||||
|
// CODV
|
||||||
|
print $separator;
|
||||||
|
// TXDV
|
||||||
|
print '0' . $separator;
|
||||||
|
// MOPM
|
||||||
|
print $separator;
|
||||||
|
// BONP
|
||||||
|
print $separator;
|
||||||
|
// BQAF
|
||||||
|
print $separator;
|
||||||
|
// ECES
|
||||||
|
print $separator;
|
||||||
|
// TXTL
|
||||||
|
print $separator;
|
||||||
|
// ECRM
|
||||||
|
print $separator;
|
||||||
|
// DATK
|
||||||
|
print $separator;
|
||||||
|
// HEUK
|
||||||
|
print $separator;
|
||||||
|
|
||||||
// TYPE
|
print $end_line;
|
||||||
$type_enregistrement = 'E'; // For write movement
|
}
|
||||||
print $type_enregistrement . $separator;
|
}
|
||||||
// JNAL
|
|
||||||
print substr($line->code_journal, 0, 2) . $separator;
|
|
||||||
// NECR
|
|
||||||
print $line->id . $separator;
|
|
||||||
// NPIE
|
|
||||||
print $line->piece_num . $separator;
|
|
||||||
// DATP
|
|
||||||
print $date_document . $separator;
|
|
||||||
// LIBE
|
|
||||||
print $line->label_operation . $separator;
|
|
||||||
// DATH
|
|
||||||
print $line->date_lim_reglement . $separator;
|
|
||||||
// CNPI
|
|
||||||
if ($line->doc_type == 'supplier_invoice') {
|
|
||||||
if ($line->montant < 0) {
|
|
||||||
$nature_piece = 'AF';
|
|
||||||
} else {
|
|
||||||
$nature_piece = 'FF';
|
|
||||||
}
|
|
||||||
} elseif ($line->doc_type == 'customer_invoice') {
|
|
||||||
if ($line->montant < 0) {
|
|
||||||
$nature_piece = 'AC';
|
|
||||||
} else {
|
|
||||||
$nature_piece = 'FC';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$nature_piece = '';
|
|
||||||
}
|
|
||||||
print $nature_piece . $separator;
|
|
||||||
// RACI
|
|
||||||
/*
|
|
||||||
if (! empty($line->subledger_account)) {
|
|
||||||
if ($line->doc_type == 'supplier_invoice') {
|
|
||||||
$racine_subledger_account = '40';
|
|
||||||
} elseif ($line->doc_type == 'customer_invoice') {
|
|
||||||
$racine_subledger_account = '41';
|
|
||||||
} else {
|
|
||||||
$nature_piece = '';
|
|
||||||
}
|
|
||||||
print $racine_subledger_account . $separator;
|
|
||||||
} else {
|
|
||||||
print $separator;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// MONT
|
|
||||||
print price(abs($line->montant)) . $separator;
|
|
||||||
// CODC
|
|
||||||
print $line->sens . $separator;
|
|
||||||
// CPTG
|
|
||||||
print length_accountg($line->numero_compte) . $separator;
|
|
||||||
// DATE
|
|
||||||
print $date_creation . $separator;
|
|
||||||
// CLET
|
|
||||||
print $line->lettering_code . $separator;
|
|
||||||
// DATL
|
|
||||||
print $line->date_lettering . $separator;
|
|
||||||
// CPTA
|
|
||||||
if (! empty($line->subledger_account)) {
|
|
||||||
print length_accounta($line->subledger_account) . $separator;
|
|
||||||
}
|
|
||||||
// CNAT
|
|
||||||
if ($line->doc_type == 'supplier_invoice' && ! empty($line->subledger_account)) {
|
|
||||||
print 'F';
|
|
||||||
} elseif ($line->doc_type == 'customer_invoice' && ! empty($line->subledger_account)) {
|
|
||||||
print 'C';
|
|
||||||
} else {
|
|
||||||
print '';
|
|
||||||
}
|
|
||||||
print $end_line;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export format : Charlemagne
|
* Export format : Charlemagne
|
||||||
@ -1046,7 +1083,6 @@ class AccountancyExport
|
|||||||
print $end_line;
|
print $end_line;
|
||||||
|
|
||||||
foreach($objectLines as $line) {
|
foreach($objectLines as $line) {
|
||||||
|
|
||||||
$date = dol_print_date($line->doc_date, '%Y%m%d');
|
$date = dol_print_date($line->doc_date, '%Y%m%d');
|
||||||
print $date . $separator; //Date
|
print $date . $separator; //Date
|
||||||
|
|
||||||
|
|||||||
@ -154,7 +154,7 @@ class AccountingAccount extends CommonObject
|
|||||||
* @param int $rowid Id
|
* @param int $rowid Id
|
||||||
* @param string $account_number Account number
|
* @param string $account_number Account number
|
||||||
* @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active char of account
|
* @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active char of account
|
||||||
* @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC'.
|
* @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC' (better and faster than previous parameter if you have chart of account code).
|
||||||
* @return int <0 if KO, 0 if not found, Id of record if OK and found
|
* @return int <0 if KO, 0 if not found, Id of record if OK and found
|
||||||
*/
|
*/
|
||||||
public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0, $limittoachartaccount = '')
|
public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0, $limittoachartaccount = '')
|
||||||
@ -407,7 +407,6 @@ class AccountingAccount extends CommonObject
|
|||||||
$result = $this->checkUsage();
|
$result = $this->checkUsage();
|
||||||
|
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// if (! $error) {
|
// if (! $error) {
|
||||||
@ -639,11 +638,11 @@ class AccountingAccount extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Renvoi le libelle d'un statut donne
|
* Renvoi le libelle d'un statut donne
|
||||||
*
|
*
|
||||||
* @param int $statut Id statut
|
* @param int $status Id status
|
||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
* @return string Label of status
|
* @return string Label of status
|
||||||
*/
|
*/
|
||||||
public function LibStatut($statut, $mode = 0)
|
public function LibStatut($status, $mode = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs;
|
global $langs;
|
||||||
@ -651,34 +650,33 @@ class AccountingAccount extends CommonObject
|
|||||||
|
|
||||||
if ($mode == 0)
|
if ($mode == 0)
|
||||||
{
|
{
|
||||||
$prefix='';
|
if ($status == 1) return $langs->trans('Enabled');
|
||||||
if ($statut == 1) return $langs->trans('Enabled');
|
elseif ($status == 0) return $langs->trans('Disabled');
|
||||||
elseif ($statut == 0) return $langs->trans('Disabled');
|
|
||||||
}
|
}
|
||||||
elseif ($mode == 1)
|
elseif ($mode == 1)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return $langs->trans('Enabled');
|
if ($status == 1) return $langs->trans('Enabled');
|
||||||
elseif ($statut == 0) return $langs->trans('Disabled');
|
elseif ($status == 0) return $langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
elseif ($mode == 2)
|
elseif ($mode == 2)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
|
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
|
||||||
elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
|
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
elseif ($mode == 3)
|
elseif ($mode == 3)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4');
|
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4');
|
||||||
elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5');
|
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5');
|
||||||
}
|
}
|
||||||
elseif ($mode == 4)
|
elseif ($mode == 4)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
|
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
|
||||||
elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
|
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
elseif ($mode == 5)
|
elseif ($mode == 5)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4');
|
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4');
|
||||||
elseif ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
|
elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1584,9 +1584,7 @@ class BookKeeping extends CommonObject
|
|||||||
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
|
||||||
while ($obj = $this->db->fetch_object($result)) {
|
while ($obj = $this->db->fetch_object($result)) {
|
||||||
|
|
||||||
$line = new BookKeepingLine();
|
$line = new BookKeepingLine();
|
||||||
|
|
||||||
$line->id = $obj->rowid;
|
$line->id = $obj->rowid;
|
||||||
@ -1966,6 +1964,7 @@ class BookKeepingLine
|
|||||||
public $credit;
|
public $credit;
|
||||||
public $montant;
|
public $montant;
|
||||||
public $sens;
|
public $sens;
|
||||||
|
public $lettering_code;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var int ID
|
||||||
@ -1976,5 +1975,12 @@ class BookKeepingLine
|
|||||||
public $code_journal;
|
public $code_journal;
|
||||||
public $journal_label;
|
public $journal_label;
|
||||||
public $piece_num;
|
public $piece_num;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var integer|string date_creation
|
||||||
|
*/
|
||||||
public $date_creation;
|
public $date_creation;
|
||||||
|
|
||||||
|
public $date_modification;
|
||||||
|
public $date_export;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -149,7 +149,6 @@ class Lettering extends BookKeeping
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ($obj->type == 'payment') {
|
} elseif ($obj->type == 'payment') {
|
||||||
|
|
||||||
$sql = 'SELECT DISTINCT bk.rowid, fac.ref, fac.ref, pay.fk_bank, fac.rowid as fact_id';
|
$sql = 'SELECT DISTINCT bk.rowid, fac.ref, fac.ref, pay.fk_bank, fac.rowid as fact_id';
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
|
||||||
|
|||||||
132
htdocs/accountancy/closure/index.php
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2019 Open-DSI <support@open-dsi.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/accountancy/closure/index.php
|
||||||
|
* \ingroup Accountancy
|
||||||
|
* \brief Home closure page
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||||
|
|
||||||
|
// Load translation files required by the page
|
||||||
|
$langs->loadLangs(array("compta","bills","other","main","accountancy"));
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
if (empty($conf->accounting->enabled)) {
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
|
if ($user->socid > 0)
|
||||||
|
accessforbidden();
|
||||||
|
if (! $user->rights->accounting->fiscalyear->write)
|
||||||
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
|
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||||
|
if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$year_start = dol_print_date(dol_now(), '%Y');
|
||||||
|
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||||
|
}
|
||||||
|
$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);
|
||||||
|
$year_current = $year_start;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
llxHeader('', $langs->trans("Closure"));
|
||||||
|
|
||||||
|
$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>';
|
||||||
|
|
||||||
|
|
||||||
|
print load_fiche_titre($langs->trans("Closure") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
|
||||||
|
|
||||||
|
print '<span class="opacitymedium">'.$langs->trans("DescClosure") . '</span><br>';
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
|
$y = $year_current;
|
||||||
|
|
||||||
|
$buttonbind = '<a class="butAction" href="./validate.php">' . $langs->trans("ValidateMovements") . '</a>';
|
||||||
|
|
||||||
|
print_barre_liste($langs->trans("OverviewOfMovementsNotValidated"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
|
print '<table class="noborder centpercent">';
|
||||||
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
|
if ($j > 12) $j-=12;
|
||||||
|
print '<td width="60" class="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||||
|
}
|
||||||
|
print '<td width="60" class="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
|
$sql = "SELECT COUNT(b.rowid) as detail,";
|
||||||
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
|
if ($j > 12) $j-=12;
|
||||||
|
$sql .= " SUM(" . $db->ifsql('MONTH(b.doc_date)=' . $j, '1', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
|
}
|
||||||
|
$sql .= " COUNT(b.rowid) as total";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as b";
|
||||||
|
$sql .= " WHERE b.doc_date >= '" . $db->idate($search_date_start) . "'";
|
||||||
|
$sql .= " AND b.doc_date <= '" . $db->idate($search_date_end) . "'";
|
||||||
|
$sql .= " AND b.entity IN (" . getEntity('bookkeeping', 0) . ")"; // We don't share object for accountancy
|
||||||
|
|
||||||
|
dol_syslog('htdocs/accountancy/closure/index.php sql=' . $sql, LOG_DEBUG);
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
while ($row = $db->fetch_row($resql)) {
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
|
print '<td class="right">' . $row[$i] . '</td>';
|
||||||
|
}
|
||||||
|
print '<td class="right"><b>' . $row[13] . '</b></td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->free($resql);
|
||||||
|
} else {
|
||||||
|
print $db->lasterror(); // Show last sql error
|
||||||
|
}
|
||||||
|
print "</table>\n";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
// End of page
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
157
htdocs/accountancy/closure/validate.php
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2019 Open-DSI <support@open-dsi.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/accountancy/closure/validate.php
|
||||||
|
* \ingroup Accountancy
|
||||||
|
* \brief Validate entries page
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||||
|
|
||||||
|
// Load translation files required by the page
|
||||||
|
$langs->loadLangs(array("compta","bills","other","main","accountancy"));
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
if (empty($conf->accounting->enabled)) {
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
|
if ($user->socid > 0)
|
||||||
|
accessforbidden();
|
||||||
|
if (! $user->rights->accounting->fiscalyear->write)
|
||||||
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
|
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||||
|
if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$year_start = dol_print_date(dol_now(), '%Y');
|
||||||
|
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||||
|
}
|
||||||
|
$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);
|
||||||
|
$year_current = $year_start;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ($action == 'validate')
|
||||||
|
{
|
||||||
|
$now = dol_now();
|
||||||
|
|
||||||
|
// Update database
|
||||||
|
$db->begin();
|
||||||
|
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping as b";
|
||||||
|
$sql .= " SET b.date_validated = '" . $db->idate($now) . "'";
|
||||||
|
$sql .= ' WHERE b.date_validated IS NULL';
|
||||||
|
|
||||||
|
dol_syslog("htdocs/accountancy/closure/validate.php validate", LOG_DEBUG);
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if (! $resql1) {
|
||||||
|
$error ++;
|
||||||
|
$db->rollback();
|
||||||
|
setEventMessages($db->lasterror(), null, 'errors');
|
||||||
|
} else {
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
// End clean database
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
llxHeader('', $langs->trans("ValidateMovements"));
|
||||||
|
|
||||||
|
$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>';
|
||||||
|
|
||||||
|
|
||||||
|
print load_fiche_titre($langs->trans("ValidateMovements") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
|
||||||
|
|
||||||
|
print $langs->trans("DescValidateMovements") . '<br>';
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
|
$y = $year_current;
|
||||||
|
|
||||||
|
print_barre_liste($langs->trans("SelectMonthAndValidate"), '', '', '', '', '', '', -1, '', '', 0, '', 'class="right"', 0, 1, 1);
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
|
print '<table class="noborder centpercent">';
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
|
if ($j > 12) $j-=12;
|
||||||
|
print '<td class="center">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||||
|
}
|
||||||
|
print '<td><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
$sql = "SELECT COUNT(b.rowid) as detail,";
|
||||||
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
|
if ($j > 12) $j-=12;
|
||||||
|
$sql .= " SUM(" . $db->ifsql('MONTH(b.doc_date)=' . $j, '1', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
|
}
|
||||||
|
$sql .= " COUNT(b.rowid) as total";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as b";
|
||||||
|
$sql .= " WHERE b.doc_date >= '" . $db->idate($search_date_start) . "'";
|
||||||
|
$sql .= " AND b.doc_date <= '" . $db->idate($search_date_end) . "'";
|
||||||
|
$sql .= " AND b.entity IN (" . getEntity('bookkeeping', 0) . ")"; // We don't share object for accountancy
|
||||||
|
|
||||||
|
dol_syslog('htdocs/accountancy/closure/index.php sql=' . $sql, LOG_DEBUG);
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
while ($row = $db->fetch_row($resql)) {
|
||||||
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
|
print '<td class="nowrap center">' . $row[$i] . '<br><br>';
|
||||||
|
print '<input id="cb'.$row[$i].'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$row[$i].'"'.($selected?' checked="checked"':'').'>';
|
||||||
|
print '</td>' ;
|
||||||
|
}
|
||||||
|
print '<td class="valigntop"><b>' . $row[13] . '</b></td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->free($resql);
|
||||||
|
} else {
|
||||||
|
print $db->lasterror(); // Show last sql error
|
||||||
|
}
|
||||||
|
print '</tr>';
|
||||||
|
print "</table>\n";
|
||||||
|
|
||||||
|
print '<br><div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?month=' . $year_current . '&action=validate"">' . $langs->trans("ValidateMovements") . '</a></div>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
// End of page
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
@ -38,7 +38,7 @@ $codeventil = GETPOST('codeventil');
|
|||||||
$id = GETPOST('id');
|
$id = GETPOST('id');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
@ -112,7 +112,6 @@ if (! empty($id)) {
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
if ($num_lines) {
|
if ($num_lines) {
|
||||||
|
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
|
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
|
||||||
@ -124,7 +123,7 @@ if (! empty($id)) {
|
|||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
// Ref facture
|
// Ref facture
|
||||||
print '<tr><td>' . $langs->trans("Invoice") . '</td>';
|
print '<tr><td>' . $langs->trans("Invoice") . '</td>';
|
||||||
|
|||||||
@ -29,6 +29,7 @@
|
|||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
@ -38,7 +39,7 @@ $langs->loadLangs(array("compta","bills","other","main","accountancy"));
|
|||||||
if (empty($conf->accounting->enabled)) {
|
if (empty($conf->accounting->enabled)) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
if (! $user->rights->accounting->bind->write)
|
if (! $user->rights->accounting->bind->write)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
@ -65,6 +66,8 @@ $year_current = $year_start;
|
|||||||
// Validate History
|
// Validate History
|
||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
|
|
||||||
|
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -97,12 +100,11 @@ if ($action == 'clean' || $action == 'validatehistory')
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'validatehistory') {
|
if ($action == 'validatehistory') {
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
|
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
|
||||||
if ($db->type == 'pgsql') {
|
/*if ($db->type == 'pgsql') {
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
||||||
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
||||||
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
|
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
|
||||||
@ -115,16 +117,83 @@ if ($action == 'validatehistory') {
|
|||||||
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity;
|
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity;
|
||||||
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
|
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
|
||||||
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
// Customer Invoice lines (must be same request than into page list.php for manual binding)
|
||||||
|
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype,";
|
||||||
|
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||||
|
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
|
||||||
|
$sql.= " p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
|
||||||
|
$sql.= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
|
||||||
|
$sql.= " co.code as country_code, co.label as country_label,";
|
||||||
|
$sql.= " s.tva_intra";
|
||||||
|
$sql.= " FROM " . MAIN_DB_PREFIX . "facture as f";
|
||||||
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||||
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
||||||
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
|
||||||
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||||
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
|
||||||
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '" . $chartaccountcode."' AND aa2.entity = " . $conf->entity;
|
||||||
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '" . $chartaccountcode."' AND aa3.entity = " . $conf->entity;
|
||||||
|
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||||
|
$sql.= " AND l.product_type <= 2";
|
||||||
|
|
||||||
dol_syslog('htdocs/accountancy/customer/index.php');
|
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||||
|
$result = $db->query($sql);
|
||||||
$resql1 = $db->query($sql1);
|
if (! $result) {
|
||||||
if (! $resql1) {
|
$error++;
|
||||||
$error ++;
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessages($db->lasterror(), null, 'errors');
|
setEventMessages($db->lasterror(), null, 'errors');
|
||||||
} else {
|
} else {
|
||||||
|
$num_lines = $db->num_rows($result);
|
||||||
|
|
||||||
|
$isSellerInEEC = isInEEC($mysoc);
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
|
||||||
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
|
// Search suggested account for product/service
|
||||||
|
$suggestedaccountingaccountfor = '';
|
||||||
|
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||||
|
$objp->code_sell_p = $objp->code_sell;
|
||||||
|
$objp->aarowid_suggest = $objp->aarowid;
|
||||||
|
$suggestedaccountingaccountfor = '';
|
||||||
|
} else {
|
||||||
|
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||||
|
$objp->code_sell_p = $objp->code_sell_intra;
|
||||||
|
$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||||
|
$suggestedaccountingaccountfor = 'eec';
|
||||||
|
} else { // Foreign sale
|
||||||
|
$objp->code_sell_p = $objp->code_sell_export;
|
||||||
|
$objp->aarowid_suggest = $objp->aarowid_export;
|
||||||
|
$suggestedaccountingaccountfor = 'export';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($objp->aarowid_suggest > 0)
|
||||||
|
{
|
||||||
|
$sqlupdate = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
||||||
|
$sqlupdate.= " SET fk_code_ventilation = ".$objp->aarowid_suggest;
|
||||||
|
$sqlupdate.= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".$objp->rowid;
|
||||||
|
|
||||||
|
$resqlupdate = $db->query($sqlupdate);
|
||||||
|
if (! $resqlupdate)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
setEventMessages($db->lasterror(), null, 'errors');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($error)
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
|
}
|
||||||
|
else {
|
||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
@ -156,7 +225,7 @@ print_barre_liste($langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '',
|
|||||||
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
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" class="left">' . $langs->trans("Label") . '</td>';
|
print '<td width="200" class="left">' . $langs->trans("Label") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
@ -195,7 +264,6 @@ if ($resql) {
|
|||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
if ($row[0] == 'tobind')
|
if ($row[0] == 'tobind')
|
||||||
{
|
{
|
||||||
@ -232,7 +300,7 @@ print_barre_liste($langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '',
|
|||||||
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', '');
|
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', '');
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
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" class="left">' . $langs->trans("Label") . '</td>';
|
print '<td width="200" class="left">' . $langs->trans("Label") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
@ -271,7 +339,6 @@ if ($resql) {
|
|||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
if ($row[0] == 'tobind')
|
if ($row[0] == 'tobind')
|
||||||
{
|
{
|
||||||
@ -312,7 +379,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
//print load_fiche_titre($langs->trans("OtherInfo"), '', '');
|
//print load_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre"><td width="400" class="left">' . $langs->trans("TotalVente") . '</td>';
|
print '<tr class="liste_titre"><td width="400" class="left">' . $langs->trans("TotalVente") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
@ -364,7 +431,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
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 '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
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 ++) {
|
||||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
@ -398,7 +465,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
while ($row = $db->fetch_row($resql)) {
|
while ($row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr><td>' . $row[0] . '</td>';
|
print '<tr><td>' . $row[0] . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
print '<td class="nowrap right">' . price(price2num($row[$i])) . '</td>';
|
print '<td class="nowrap right">' . price(price2num($row[$i])) . '</td>';
|
||||||
|
|||||||
@ -72,7 +72,7 @@ if (! $sortorder) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
if (! $user->rights->accounting->bind->write)
|
if (! $user->rights->accounting->bind->write)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
@ -358,6 +358,7 @@ if ($result) {
|
|||||||
// Ref Invoice
|
// Ref Invoice
|
||||||
print '<td class="nowraponall">' . $facture_static->getNomUrl(1) . '</td>';
|
print '<td class="nowraponall">' . $facture_static->getNomUrl(1) . '</td>';
|
||||||
|
|
||||||
|
// Date invoice
|
||||||
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
|
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
|
||||||
|
|
||||||
// Ref Product
|
// Ref Product
|
||||||
@ -377,7 +378,13 @@ if ($result) {
|
|||||||
|
|
||||||
print '<td class="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
print '<td class="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||||
|
|
||||||
print '<td>' . $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')</td>';
|
// Country
|
||||||
|
print '<td>';
|
||||||
|
if ($objp->country_code)
|
||||||
|
{
|
||||||
|
print $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
print '<td>' . $objp->tva_intra . '</td>';
|
print '<td>' . $objp->tva_intra . '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -83,7 +83,7 @@ if (! $sortorder) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
if (! $user->rights->accounting->bind->write)
|
if (! $user->rights->accounting->bind->write)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
@ -129,8 +129,8 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Mass actions
|
// Mass actions
|
||||||
$objectclass='AccountingAccount';
|
$objectclass='AccountingAccount';
|
||||||
$permtoread = $user->rights->accounting->read;
|
$permissiontoread = $user->rights->accounting->read;
|
||||||
$permtodelete = $user->rights->accounting->delete;
|
$permissiontodelete = $user->rights->accounting->delete;
|
||||||
$uploaddir = $conf->accounting->dir_output;
|
$uploaddir = $conf->accounting->dir_output;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
}
|
}
|
||||||
@ -180,8 +180,6 @@ if ($massaction == 'ventil') {
|
|||||||
}
|
}
|
||||||
$msg.='</div>';
|
$msg.='</div>';
|
||||||
$msg.= '<div>' . $langs->trans("EndProcessing") . '</div>';
|
$msg.= '<div>' . $langs->trans("EndProcessing") . '</div>';
|
||||||
//} else {
|
|
||||||
// setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,9 +219,9 @@ $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
|||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
||||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.fk_pcg_version = '" . $chartaccountcode."' AND aa2.entity = " . $conf->entity;
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '" . $chartaccountcode."' AND aa2.entity = " . $conf->entity;
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.fk_pcg_version = '" . $chartaccountcode."' AND aa3.entity = " . $conf->entity;
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '" . $chartaccountcode."' AND aa3.entity = " . $conf->entity;
|
||||||
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||||
$sql.= " AND l.product_type <= 2";
|
$sql.= " AND l.product_type <= 2";
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
@ -249,7 +247,7 @@ if (strlen(trim($search_account))) {
|
|||||||
$sql .= natural_search("aa.account_number", $search_account);
|
$sql .= natural_search("aa.account_number", $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", price2num($search_vat), 1);
|
||||||
}
|
}
|
||||||
$sql.=dolSqlDateFilter('f.datef', $search_day, $search_month, $search_year);
|
$sql.=dolSqlDateFilter('f.datef', $search_day, $search_month, $search_year);
|
||||||
if (strlen(trim($search_country))) {
|
if (strlen(trim($search_country))) {
|
||||||
@ -408,12 +406,13 @@ if ($result) {
|
|||||||
|
|
||||||
$isSellerInEEC = isInEEC($mysoc);
|
$isSellerInEEC = isInEEC($mysoc);
|
||||||
|
|
||||||
while ( $i < min($num_lines, $limit) ) {
|
$accountingaccount_codetotid_cache = array();
|
||||||
|
|
||||||
|
while ($i < min($num_lines, $limit)) {
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
$objp->code_sell_l = '';
|
$objp->code_sell_l = '';
|
||||||
$objp->code_sell_p = '';
|
$objp->code_sell_p = '';
|
||||||
$objp->aarowid_suggest = '';
|
|
||||||
|
|
||||||
$product_static->ref = $objp->product_ref;
|
$product_static->ref = $objp->product_ref;
|
||||||
$product_static->id = $objp->product_id;
|
$product_static->id = $objp->product_id;
|
||||||
@ -425,7 +424,7 @@ if ($result) {
|
|||||||
$facture_static->type = $objp->ftype;
|
$facture_static->type = $objp->ftype;
|
||||||
|
|
||||||
$code_sell_p_notset = '';
|
$code_sell_p_notset = '';
|
||||||
$objp->aarowid_suggest = $objp->aarowid;
|
$objp->aarowid_suggest = ''; // Will be set later
|
||||||
|
|
||||||
$isBuyerInEEC = isInEEC($objp);
|
$isBuyerInEEC = isInEEC($objp);
|
||||||
|
|
||||||
@ -459,8 +458,9 @@ if ($result) {
|
|||||||
}
|
}
|
||||||
if ($objp->code_sell_l == -1) $objp->code_sell_l='';
|
if ($objp->code_sell_l == -1) $objp->code_sell_l='';
|
||||||
|
|
||||||
|
// Search suggested account for product/service
|
||||||
$suggestedaccountingaccountfor = '';
|
$suggestedaccountingaccountfor = '';
|
||||||
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||||
$objp->code_sell_p = $objp->code_sell;
|
$objp->code_sell_p = $objp->code_sell;
|
||||||
$objp->aarowid_suggest = $objp->aarowid;
|
$objp->aarowid_suggest = $objp->aarowid;
|
||||||
$suggestedaccountingaccountfor = '';
|
$suggestedaccountingaccountfor = '';
|
||||||
@ -476,8 +476,8 @@ if ($result) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($objp->code_sell)) {
|
if (! empty($objp->code_sell_p)) {
|
||||||
//$objp->code_sell_p = $objp->code_sell; // Code on product
|
// Value was defined previously
|
||||||
} else {
|
} else {
|
||||||
$code_sell_p_notset = 'color:orange';
|
$code_sell_p_notset = 'color:orange';
|
||||||
}
|
}
|
||||||
@ -520,6 +520,7 @@ if ($result) {
|
|||||||
print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''));
|
print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
// Country
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$labelcountry=($objp->country_code && ($langs->trans("Country".$objp->country_code)!="Country".$objp->country_code))?$langs->trans("Country".$objp->country_code):$objp->country_label;
|
$labelcountry=($objp->country_code && ($langs->trans("Country".$objp->country_code)!="Country".$objp->country_code))?$langs->trans("Country".$objp->country_code):$objp->country_label;
|
||||||
print $labelcountry;
|
print $labelcountry;
|
||||||
@ -548,13 +549,35 @@ if ($result) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Suggested accounting account
|
// Suggested accounting account
|
||||||
|
// $objp->code_sell_l = default (it takes the country into consideration), $objp->code_sell_p is value for product (it takes the country into consideration too)
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
|
$suggestedid = $objp->aarowid_suggest;
|
||||||
|
/*var_dump($suggestedid);
|
||||||
|
var_dump($objp->code_sell_p);
|
||||||
|
var_dump($objp->code_sell_l);*/
|
||||||
|
if (empty($suggestedid) && empty($objp->code_sell_p) && ! empty($objp->code_sell_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC))
|
||||||
|
{
|
||||||
|
if (empty($accountingaccount_codetotid_cache[$objp->code_sell_l]))
|
||||||
|
{
|
||||||
|
$tmpaccount = new AccountingAccount($db);
|
||||||
|
$tmpaccount->fetch(0, $objp->code_sell_l, 1);
|
||||||
|
if ($tmpaccount->id > 0) {
|
||||||
|
$suggestedid = $tmpaccount->id;
|
||||||
|
}
|
||||||
|
$accountingaccount_codetotid_cache[$objp->code_sell_l] = $tmpaccount->id;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$suggestedid = $accountingaccount_codetotid_cache[$objp->code_sell_l];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print $formaccounting->select_account($suggestedid, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Column with checkbox
|
// Column with checkbox
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
//var_dump($objp->aarowid);var_dump($objp->aarowid_intra);var_dump($objp->aarowid_export);var_dump($objp->aarowid_suggest);
|
||||||
|
$ischecked = $objp->aarowid_suggest;
|
||||||
|
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($ischecked ? "checked" : "") . '/>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|||||||
@ -42,7 +42,7 @@ $codeventil = GETPOST('codeventil');
|
|||||||
$id = GETPOST('id');
|
$id = GETPOST('id');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ if (! empty($id)) {
|
|||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td class="titlefield">' . $langs->trans("ExpenseReport") . '</td>';
|
print '<tr><td class="titlefield">' . $langs->trans("ExpenseReport") . '</td>';
|
||||||
|
|||||||
@ -36,7 +36,7 @@ $langs->loadLangs(array("compta","bills","other","main","accountancy"));
|
|||||||
if (empty($conf->accounting->enabled)) {
|
if (empty($conf->accounting->enabled)) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
if (! $user->rights->accounting->bind->write)
|
if (! $user->rights->accounting->bind->write)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
@ -94,7 +94,6 @@ if ($action == 'clean' || $action == 'validatehistory')
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'validatehistory') {
|
if ($action == 'validatehistory') {
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
@ -153,7 +152,7 @@ print_barre_liste($langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '',
|
|||||||
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
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" class="left">' . $langs->trans("Label") . '</td>';
|
print '<td width="200" class="left">' . $langs->trans("Label") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
@ -187,7 +186,6 @@ if ($resql) {
|
|||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
if ($row[0] == 'tobind')
|
if ($row[0] == 'tobind')
|
||||||
{
|
{
|
||||||
@ -225,7 +223,7 @@ print_barre_liste($langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '',
|
|||||||
|
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
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" class="left">' . $langs->trans("Label") . '</td>';
|
print '<td width="200" class="left">' . $langs->trans("Label") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
@ -259,7 +257,6 @@ if ($resql) {
|
|||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
if ($row[0] == 'tobind')
|
if ($row[0] == 'tobind')
|
||||||
{
|
{
|
||||||
@ -300,7 +297,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
//print load_fiche_titre($langs->trans("OtherInfo"), '', '');
|
//print load_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre"><td width="400" class="left">' . $langs->trans("Total") . '</td>';
|
print '<tr class="liste_titre"><td width="400" class="left">' . $langs->trans("Total") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
|
|||||||
@ -67,7 +67,7 @@ if (! $sortorder) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
if (! $user->rights->accounting->bind->write)
|
if (! $user->rights->accounting->bind->write)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|||||||
@ -77,7 +77,7 @@ if (! $sortorder) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
if (! $user->rights->accounting->bind->write)
|
if (! $user->rights->accounting->bind->write)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
@ -112,8 +112,8 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|||||||
// Mass actions
|
// Mass actions
|
||||||
$objectclass='ExpenseReport';
|
$objectclass='ExpenseReport';
|
||||||
$objectlabel='ExpenseReport';
|
$objectlabel='ExpenseReport';
|
||||||
$permtoread = $user->rights->expensereport->read;
|
$permissiontoread = $user->rights->expensereport->read;
|
||||||
$permtodelete = $user->rights->expensereport->delete;
|
$permissiontodelete = $user->rights->expensereport->delete;
|
||||||
$uploaddir = $conf->expensereport->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';
|
||||||
|
|
||||||
@ -161,8 +161,6 @@ if ($massaction == 'ventil') {
|
|||||||
}
|
}
|
||||||
$msg.='</div>';
|
$msg.='</div>';
|
||||||
$msg.= '<div>' . $langs->trans("EndProcessing") . '</div>';
|
$msg.= '<div>' . $langs->trans("EndProcessing") . '</div>';
|
||||||
//} else {
|
|
||||||
// setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
|||||||
$langs->loadLangs(array("compta","bills","other","accountancy","loans","banks","admin","dict"));
|
$langs->loadLangs(array("compta","bills","other","accountancy","loans","banks","admin","dict"));
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
|
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
|
||||||
@ -88,7 +88,7 @@ if ($conf->accounting->enabled)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("AccountancyArea"), $showtutorial . $resultboxes['selectboxlist'], 'accountancy');
|
print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial);
|
||||||
|
|
||||||
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
|
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
* 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-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2017-2018 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2017-2018 Frédéric France <frederic.france@netlogic.fr>
|
||||||
@ -80,7 +80,7 @@ $now = dol_now();
|
|||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0 && empty($id_journal))
|
if ($user->socid > 0 && empty($id_journal))
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
@ -167,7 +167,6 @@ $journal_label = $accountingjournalstatic->label;
|
|||||||
dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG);
|
dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
@ -268,10 +267,8 @@ if ($result) {
|
|||||||
|
|
||||||
// get_url may return -1 which is not traversable
|
// get_url may return -1 which is not traversable
|
||||||
if (is_array($links) && count($links) > 0) {
|
if (is_array($links) && count($links) > 0) {
|
||||||
|
|
||||||
// Now loop on each link of record in bank.
|
// Now loop on each link of record in bank.
|
||||||
foreach ($links as $key => $val) {
|
foreach ($links as $key => $val) {
|
||||||
|
|
||||||
if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various')))
|
if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various')))
|
||||||
{
|
{
|
||||||
// So we excluded 'company' and 'user' here. We want only payment lines
|
// So we excluded 'company' and 'user' here. We want only payment lines
|
||||||
@ -326,11 +323,11 @@ if ($result) {
|
|||||||
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
|
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
|
||||||
if ($reg[1] == 'socialcontribution')
|
if ($reg[1] == 'socialcontribution')
|
||||||
$reg[1] = 'SocialContribution';
|
$reg[1] = 'SocialContribution';
|
||||||
$chargestatic->lib = $langs->trans($reg[1]);
|
$chargestatic->label = $langs->trans($reg[1]);
|
||||||
} else {
|
} else {
|
||||||
$chargestatic->lib = $links[$key]['label'];
|
$chargestatic->label = $links[$key]['label'];
|
||||||
}
|
}
|
||||||
$chargestatic->ref = $chargestatic->lib;
|
$chargestatic->ref = $chargestatic->label;
|
||||||
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
|
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
|
||||||
$tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id;
|
$tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id;
|
||||||
|
|
||||||
@ -387,7 +384,9 @@ if ($result) {
|
|||||||
$tabpay[$obj->rowid]["paymentvariousid"] = $paymentvariousstatic->id;
|
$tabpay[$obj->rowid]["paymentvariousid"] = $paymentvariousstatic->id;
|
||||||
$paymentvariousstatic->fetch($paymentvariousstatic->id);
|
$paymentvariousstatic->fetch($paymentvariousstatic->id);
|
||||||
$account_various = (! empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word
|
$account_various = (! empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word
|
||||||
$tabtp[$obj->rowid][$account_various] += $obj->amount;
|
$account_subledger = (! empty($paymentvariousstatic->subledger_account) ? $paymentvariousstatic->subledger_account : ''); // NotDefined is a reserved word
|
||||||
|
$tabpay[$obj->rowid]["account_various"] = $account_various;
|
||||||
|
$tabtp[$obj->rowid][$account_subledger] += $obj->amount;
|
||||||
} elseif ($links[$key]['type'] == 'payment_loan') {
|
} elseif ($links[$key]['type'] == 'payment_loan') {
|
||||||
$paymentloanstatic->id = $links[$key]['url_id'];
|
$paymentloanstatic->id = $links[$key]['url_id'];
|
||||||
$paymentloanstatic->ref = $links[$key]['url_id'];
|
$paymentloanstatic->ref = $links[$key]['url_id'];
|
||||||
@ -660,11 +659,11 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$accountingaccount->fetch(null, $k, true);
|
$accountingaccount->fetch(null, $k, true);
|
||||||
$bookkeeping->label_compte = $accountingaccount->label;
|
$bookkeeping->label_compte = $accountingaccount->label;
|
||||||
} elseif ($tabtype[$key] == 'payment_various') {
|
} elseif ($tabtype[$key] == 'payment_various') {
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = $k;
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $tabpay[$obj->rowid]["account_various"];
|
||||||
|
|
||||||
$accountingaccount->fetch(null, $k, true);
|
$accountingaccount->fetch(null, $bookkeeping->numero_compte, true);
|
||||||
$bookkeeping->label_compte = $accountingaccount->label;
|
$bookkeeping->label_compte = $accountingaccount->label;
|
||||||
} elseif ($tabtype[$key] == 'banktransfert') {
|
} elseif ($tabtype[$key] == 'banktransfert') {
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
@ -997,7 +996,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
|
|
||||||
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|
||||||
|| ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
|| ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
||||||
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
@ -1123,6 +1122,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
if ($tabtype[$key] == 'payment_salary') $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
if ($tabtype[$key] == 'payment_salary') $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||||
if ($tabtype[$key] == 'payment_vat') $account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT;
|
if ($tabtype[$key] == 'payment_vat') $account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT;
|
||||||
if ($tabtype[$key] == 'member') $account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT;
|
if ($tabtype[$key] == 'member') $account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT;
|
||||||
|
if ($tabtype[$key] == 'payment_various') $account_ledger = $tabpay[$key]["account_various"];
|
||||||
$accounttoshow = length_accounta($account_ledger);
|
$accounttoshow = length_accounta($account_ledger);
|
||||||
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
|
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
|
||||||
{
|
{
|
||||||
@ -1156,7 +1156,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
// Subledger account
|
// Subledger account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
|
|
||||||
if (in_array($tabtype[$key], array('payment', 'payment_supplier', 'payment_expensereport', 'payment_salary'))) // Type of payment with subledger
|
if (in_array($tabtype[$key], array('payment', 'payment_supplier', 'payment_expensereport', 'payment_salary', 'payment_various'))) // Type of payment with subledger
|
||||||
{
|
{
|
||||||
$accounttoshowsubledger = length_accounta($k);
|
$accounttoshowsubledger = length_accounta($k);
|
||||||
if ($accounttoshow != $accounttoshowsubledger)
|
if ($accounttoshow != $accounttoshowsubledger)
|
||||||
|
|||||||
@ -56,7 +56,7 @@ if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
|
|||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -115,7 +115,6 @@ $sql .= " ORDER BY er.date_debut";
|
|||||||
dol_syslog('accountancy/journal/expensereportsjournal.php', LOG_DEBUG);
|
dol_syslog('accountancy/journal/expensereportsjournal.php', LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
|
||||||
$taber = array ();
|
$taber = array ();
|
||||||
$tabht = array ();
|
$tabht = array ();
|
||||||
$tabtva = array ();
|
$tabtva = array ();
|
||||||
@ -307,49 +306,49 @@ if ($action == 'writebookkeeping') {
|
|||||||
|
|
||||||
foreach ($arrayofvat[$key] as $k => $mt) {
|
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
// get compte id and label
|
// get compte id and label
|
||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping->doc_ref = $val["ref"];
|
||||||
$bookkeeping->date_creation = $now;
|
$bookkeeping->date_creation = $now;
|
||||||
$bookkeeping->doc_type = 'expense_report';
|
$bookkeeping->doc_type = 'expense_report';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
|
|
||||||
$accountingaccount->fetch($k, null, true);
|
$accountingaccount->fetch($k, null, true);
|
||||||
$bookkeeping->label_compte = $accountingaccount->label;
|
$bookkeeping->label_compte = $accountingaccount->label;
|
||||||
|
|
||||||
$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;
|
||||||
$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
|
$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
|
||||||
$bookkeeping->code_journal = $journal;
|
$bookkeeping->code_journal = $journal;
|
||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
$bookkeeping->entity = $conf->entity;
|
$bookkeeping->entity = $conf->entity;
|
||||||
|
|
||||||
$totaldebit += $bookkeeping->debit;
|
$totaldebit += $bookkeeping->debit;
|
||||||
$totalcredit += $bookkeeping->credit;
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
$errorforline++;
|
|
||||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -439,53 +438,52 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
foreach ($taber as $key => $val) {
|
foreach ($taber as $key => $val) {
|
||||||
$date = dol_print_date($val["date"], 'day');
|
$date = dol_print_date($val["date"], 'day');
|
||||||
|
|
||||||
$userstatic->id = $tabuser[$key]['id'];
|
$userstatic->id = $tabuser[$key]['id'];
|
||||||
$userstatic->name = $tabuser[$key]['name'];
|
$userstatic->name = $tabuser[$key]['name'];
|
||||||
|
|
||||||
// Fees
|
// Fees
|
||||||
foreach ($tabht[$key] as $k => $mt) {
|
foreach ($tabht[$key] as $k => $mt) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
$accountingaccount->fetch(null, $k, true);
|
$accountingaccount->fetch(null, $k, true);
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["ref"] . '"' . $sep;
|
print '"' . $val["ref"] . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||||
print "\n";
|
print "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
// VAT
|
||||||
// VAT
|
foreach ($tabtva[$key] as $k => $mt) {
|
||||||
foreach ($tabtva[$key] as $k => $mt) {
|
if ($mt) {
|
||||||
if ($mt) {
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $val["ref"] . '"' . $sep;
|
||||||
print '"' . $val["ref"] . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . dol_trunc($langs->trans("VAT")) . '"' . $sep;
|
||||||
print '"' . dol_trunc($langs->trans("VAT")) . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
print "\n";
|
||||||
print "\n";
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
foreach ($tabttc[$key] as $k => $mt) {
|
foreach ($tabttc[$key] as $k => $mt) {
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["ref"] . '"' . $sep;
|
print '"' . $val["ref"] . '"' . $sep;
|
||||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . dol_trunc($userstatic->name) . '"' . $sep;
|
print '"' . dol_trunc($userstatic->name) . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||||
}
|
}
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($action) || $action == 'view') {
|
if (empty($action) || $action == 'view') {
|
||||||
|
|
||||||
llxHeader('', $langs->trans("ExpenseReportsJournal"));
|
llxHeader('', $langs->trans("ExpenseReportsJournal"));
|
||||||
|
|
||||||
$nom = $langs->trans("ExpenseReportsJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
|
$nom = $langs->trans("ExpenseReportsJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
|
||||||
@ -640,29 +638,29 @@ if (empty($action) || $action == 'view') {
|
|||||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||||
|
|
||||||
foreach ($arrayofvat[$key] as $k => $mt) {
|
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<!-- VAT -->";
|
print "<!-- VAT -->";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
||||||
// Account
|
// Account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accountg($k);
|
$accountoshow = length_accountg($k);
|
||||||
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
||||||
|
}
|
||||||
|
else print $accountoshow;
|
||||||
|
print "</td>";
|
||||||
|
// Subledger account
|
||||||
|
print "<td>";
|
||||||
|
print '</td>';
|
||||||
|
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
|
||||||
|
print "</td>";
|
||||||
|
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
|
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
|
print "</tr>";
|
||||||
}
|
}
|
||||||
else print $accountoshow;
|
|
||||||
print "</td>";
|
|
||||||
// Subledger account
|
|
||||||
print "<td>";
|
|
||||||
print '</td>';
|
|
||||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
|
|
||||||
print "</td>";
|
|
||||||
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
|
||||||
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
|
||||||
print "</tr>";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,7 +56,7 @@ if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
|
|||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
$hookmanager->initHooks(array('purchasesjournal'));
|
$hookmanager->initHooks(array('purchasesjournal'));
|
||||||
@ -242,7 +242,6 @@ if ($action == 'writebookkeeping') {
|
|||||||
$invoicestatic = new FactureFournisseur($db);
|
$invoicestatic = new FactureFournisseur($db);
|
||||||
|
|
||||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||||
|
|
||||||
$errorforline = 0;
|
$errorforline = 0;
|
||||||
|
|
||||||
$totalcredit = 0;
|
$totalcredit = 0;
|
||||||
@ -295,7 +294,61 @@ if ($action == 'writebookkeeping') {
|
|||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
foreach ($tabttc[$key] as $k => $mt) {
|
foreach ($tabttc[$key] as $k => $mt) {
|
||||||
//if ($mt) {
|
$bookkeeping = new BookKeeping($db);
|
||||||
|
$bookkeeping->doc_date = $val["date"];
|
||||||
|
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||||
|
$bookkeeping->doc_ref = $val["refsologest"];
|
||||||
|
$bookkeeping->date_creation = $now;
|
||||||
|
$bookkeeping->doc_type = 'supplier_invoice';
|
||||||
|
$bookkeeping->fk_doc = $key;
|
||||||
|
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||||
|
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||||
|
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
|
||||||
|
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||||
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||||
|
|
||||||
|
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true);
|
||||||
|
$bookkeeping->label_compte = $accountingaccount->label;
|
||||||
|
|
||||||
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount");
|
||||||
|
$bookkeeping->montant = $mt;
|
||||||
|
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
||||||
|
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
|
||||||
|
$bookkeeping->credit = ($mt > 0) ? $mt : 0;
|
||||||
|
$bookkeeping->code_journal = $journal;
|
||||||
|
$bookkeeping->journal_label = $journal_label;
|
||||||
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
$bookkeeping->entity = $conf->entity;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
|
$result = $bookkeeping->create($user);
|
||||||
|
if ($result < 0) {
|
||||||
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
$errorforinvoice[$key]='alreadyjournalized';
|
||||||
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
$errorforinvoice[$key]='other';
|
||||||
|
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Product / Service
|
||||||
|
if (! $errorforline)
|
||||||
|
{
|
||||||
|
foreach ($tabht[$key] as $k => $mt) {
|
||||||
|
// get compte id and label
|
||||||
|
if ($accountingaccount->fetch(null, $k, true)) {
|
||||||
$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"];
|
||||||
@ -303,20 +356,17 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->date_creation = $now;
|
$bookkeeping->date_creation = $now;
|
||||||
$bookkeeping->doc_type = 'supplier_invoice';
|
$bookkeeping->doc_type = 'supplier_invoice';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
$bookkeeping->numero_compte = $k;
|
||||||
|
|
||||||
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true);
|
|
||||||
$bookkeeping->label_compte = $accountingaccount->label;
|
$bookkeeping->label_compte = $accountingaccount->label;
|
||||||
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label;
|
||||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount");
|
|
||||||
$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;
|
||||||
$bookkeeping->credit = ($mt > 0) ? $mt : 0;
|
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
|
||||||
$bookkeeping->code_journal = $journal;
|
$bookkeeping->code_journal = $journal;
|
||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
@ -342,62 +392,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Product / Service
|
|
||||||
if (! $errorforline)
|
|
||||||
{
|
|
||||||
foreach ($tabht[$key] as $k => $mt) {
|
|
||||||
//if ($mt) {
|
|
||||||
// get compte id and label
|
|
||||||
if ($accountingaccount->fetch(null, $k, true)) {
|
|
||||||
$bookkeeping = new BookKeeping($db);
|
|
||||||
$bookkeeping->doc_date = $val["date"];
|
|
||||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
|
||||||
$bookkeeping->doc_ref = $val["refsologest"];
|
|
||||||
$bookkeeping->date_creation = $now;
|
|
||||||
$bookkeeping->doc_type = 'supplier_invoice';
|
|
||||||
$bookkeeping->fk_doc = $key;
|
|
||||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
|
||||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
|
||||||
$bookkeeping->subledger_account = '';
|
|
||||||
$bookkeeping->subledger_label = '';
|
|
||||||
$bookkeeping->numero_compte = $k;
|
|
||||||
$bookkeeping->label_compte = $accountingaccount->label;
|
|
||||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label;
|
|
||||||
$bookkeeping->montant = $mt;
|
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
|
||||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
|
||||||
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
|
|
||||||
$bookkeeping->code_journal = $journal;
|
|
||||||
$bookkeeping->journal_label = $journal_label;
|
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
|
||||||
$bookkeeping->entity = $conf->entity;
|
|
||||||
|
|
||||||
$totaldebit += $bookkeeping->debit;
|
|
||||||
$totalcredit += $bookkeeping->credit;
|
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
|
||||||
if ($result < 0) {
|
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
$errorforline++;
|
|
||||||
$errorforinvoice[$key]='alreadyjournalized';
|
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
$errorforline++;
|
|
||||||
$errorforinvoice[$key]='other';
|
|
||||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -716,7 +711,6 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($action) || $action == 'view') {
|
if (empty($action) || $action == 'view') {
|
||||||
|
|
||||||
llxHeader('', $langs->trans("PurchasesJournal"));
|
llxHeader('', $langs->trans("PurchasesJournal"));
|
||||||
|
|
||||||
$nom = $langs->trans("PurchasesJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
|
$nom = $langs->trans("PurchasesJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
|
||||||
@ -867,34 +861,32 @@ if (empty($action) || $action == 'view') {
|
|||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
foreach ($tabttc[$key] as $k => $mt) {
|
foreach ($tabttc[$key] as $k => $mt) {
|
||||||
//if ($mt) {
|
print '<tr class="oddeven">';
|
||||||
print '<tr class="oddeven">';
|
print "<!-- Thirdparty -->";
|
||||||
print "<!-- Thirdparty -->";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
// Account
|
||||||
// Account
|
print "<td>";
|
||||||
print "<td>";
|
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER);
|
||||||
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER);
|
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
||||||
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
{
|
||||||
{
|
print '<span class="error">'.$langs->trans("MainAccountForSuppliersNotDefined").'</span>';
|
||||||
print '<span class="error">'.$langs->trans("MainAccountForSuppliersNotDefined").'</span>';
|
}
|
||||||
}
|
else print $accountoshow;
|
||||||
else print $accountoshow;
|
print '</td>';
|
||||||
print '</td>';
|
// Subledger account
|
||||||
// Subledger account
|
print "<td>";
|
||||||
print "<td>";
|
$accountoshow = length_accounta($k);
|
||||||
$accountoshow = length_accounta($k);
|
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
||||||
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
{
|
||||||
{
|
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
}
|
||||||
}
|
else print $accountoshow;
|
||||||
else print $accountoshow;
|
print '</td>';
|
||||||
print '</td>';
|
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
|
print '<td class="right nowraponall">'. ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print '<td class="right nowraponall">'. ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print "</tr>";
|
||||||
print "</tr>";
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Product / Service
|
// Product / Service
|
||||||
@ -902,30 +894,28 @@ if (empty($action) || $action == 'view') {
|
|||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
$accountingaccount->fetch(null, $k, true);
|
$accountingaccount->fetch(null, $k, true);
|
||||||
|
|
||||||
//if ($mt) {
|
print '<tr class="oddeven">';
|
||||||
print '<tr class="oddeven">';
|
print "<!-- Product -->";
|
||||||
print "<!-- Product -->";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
// Account
|
||||||
// Account
|
print "<td>";
|
||||||
print "<td>";
|
$accountoshow = length_accountg($k);
|
||||||
$accountoshow = length_accountg($k);
|
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
||||||
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
{
|
||||||
{
|
print '<span class="error">'.$langs->trans("ProductAccountNotDefined").'</span>';
|
||||||
print '<span class="error">'.$langs->trans("ProductAccountNotDefined").'</span>';
|
}
|
||||||
}
|
else print $accountoshow;
|
||||||
else print $accountoshow;
|
print "</td>";
|
||||||
print "</td>";
|
// Subledger account
|
||||||
// Subledger account
|
print "<td>";
|
||||||
print "<td>";
|
print '</td>';
|
||||||
print '</td>';
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label . "</td>";
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label . "</td>";
|
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print "</tr>";
|
||||||
print "</tr>";
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
|
|||||||
@ -58,7 +58,7 @@ if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
|
|||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
$hookmanager->initHooks(array('sellsjournal'));
|
$hookmanager->initHooks(array('sellsjournal'));
|
||||||
@ -124,7 +124,7 @@ if ($in_bookkeeping == 'already')
|
|||||||
if ($in_bookkeeping == 'notyet')
|
if ($in_bookkeeping == 'notyet')
|
||||||
{
|
{
|
||||||
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
|
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
|
||||||
// $sql .= " AND fd.rowid NOT IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account
|
// $sql .= " AND fd.rowid NOT IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account
|
||||||
}
|
}
|
||||||
$sql .= " ORDER BY f.datef";
|
$sql .= " ORDER BY f.datef";
|
||||||
//print $sql;
|
//print $sql;
|
||||||
@ -255,7 +255,6 @@ if ($action == 'writebookkeeping') {
|
|||||||
$invoicestatic = new Facture($db);
|
$invoicestatic = new Facture($db);
|
||||||
|
|
||||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||||
|
|
||||||
$errorforline = 0;
|
$errorforline = 0;
|
||||||
|
|
||||||
$totalcredit = 0;
|
$totalcredit = 0;
|
||||||
@ -306,7 +305,61 @@ if ($action == 'writebookkeeping') {
|
|||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
foreach ($tabttc[$key] as $k => $mt) {
|
foreach ($tabttc[$key] as $k => $mt) {
|
||||||
//if ($mt) {
|
$bookkeeping = new BookKeeping($db);
|
||||||
|
$bookkeeping->doc_date = $val["date"];
|
||||||
|
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||||
|
$bookkeeping->doc_ref = $val["ref"];
|
||||||
|
$bookkeeping->date_creation = $now;
|
||||||
|
$bookkeeping->doc_type = 'customer_invoice';
|
||||||
|
$bookkeeping->fk_doc = $key;
|
||||||
|
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||||
|
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||||
|
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||||
|
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||||
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||||
|
|
||||||
|
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
|
||||||
|
$bookkeeping->label_compte = $accountingaccount->label;
|
||||||
|
|
||||||
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount");
|
||||||
|
$bookkeeping->montant = $mt;
|
||||||
|
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
||||||
|
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
|
||||||
|
$bookkeeping->credit = ($mt < 0) ? -$mt : 0;
|
||||||
|
$bookkeeping->code_journal = $journal;
|
||||||
|
$bookkeeping->journal_label = $journal_label;
|
||||||
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
$bookkeeping->entity = $conf->entity;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
|
$result = $bookkeeping->create($user);
|
||||||
|
if ($result < 0) {
|
||||||
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
$errorforinvoice[$key]='alreadyjournalized';
|
||||||
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
$errorforinvoice[$key]='other';
|
||||||
|
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Product / Service
|
||||||
|
if (! $errorforline)
|
||||||
|
{
|
||||||
|
foreach ($tabht[$key] as $k => $mt) {
|
||||||
|
// get compte id and label
|
||||||
|
if ($accountingaccount->fetch(null, $k, true)) {
|
||||||
$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"];
|
||||||
@ -316,18 +369,15 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
$bookkeeping->numero_compte = $k;
|
||||||
|
|
||||||
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
|
|
||||||
$bookkeeping->label_compte = $accountingaccount->label;
|
$bookkeeping->label_compte = $accountingaccount->label;
|
||||||
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label;
|
||||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount");
|
|
||||||
$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;
|
||||||
$bookkeeping->credit = ($mt < 0) ? -$mt : 0;
|
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
||||||
$bookkeeping->code_journal = $journal;
|
$bookkeeping->code_journal = $journal;
|
||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
@ -353,62 +403,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Product / Service
|
|
||||||
if (! $errorforline)
|
|
||||||
{
|
|
||||||
foreach ($tabht[$key] as $k => $mt) {
|
|
||||||
//if ($mt) {
|
|
||||||
// get compte id and label
|
|
||||||
if ($accountingaccount->fetch(null, $k, true)) {
|
|
||||||
$bookkeeping = new BookKeeping($db);
|
|
||||||
$bookkeeping->doc_date = $val["date"];
|
|
||||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
|
||||||
$bookkeeping->date_creation = $now;
|
|
||||||
$bookkeeping->doc_type = 'customer_invoice';
|
|
||||||
$bookkeeping->fk_doc = $key;
|
|
||||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
|
||||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
|
||||||
$bookkeeping->subledger_account = '';
|
|
||||||
$bookkeeping->subledger_label = '';
|
|
||||||
$bookkeeping->numero_compte = $k;
|
|
||||||
$bookkeeping->label_compte = $accountingaccount->label;
|
|
||||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label;
|
|
||||||
$bookkeeping->montant = $mt;
|
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
|
||||||
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
|
|
||||||
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
|
||||||
$bookkeeping->code_journal = $journal;
|
|
||||||
$bookkeeping->journal_label = $journal_label;
|
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
|
||||||
$bookkeeping->entity = $conf->entity;
|
|
||||||
|
|
||||||
$totaldebit += $bookkeeping->debit;
|
|
||||||
$totalcredit += $bookkeeping->credit;
|
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
|
||||||
if ($result < 0) {
|
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
$errorforline++;
|
|
||||||
$errorforinvoice[$key]='alreadyjournalized';
|
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
$errorforline++;
|
|
||||||
$errorforinvoice[$key]='other';
|
|
||||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -654,7 +649,6 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||||||
|
|
||||||
|
|
||||||
if (empty($action) || $action == 'view') {
|
if (empty($action) || $action == 'view') {
|
||||||
|
|
||||||
llxHeader('', $langs->trans("SellsJournal"));
|
llxHeader('', $langs->trans("SellsJournal"));
|
||||||
|
|
||||||
$nom = $langs->trans("SellsJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
|
$nom = $langs->trans("SellsJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
|
||||||
@ -803,34 +797,32 @@ if (empty($action) || $action == 'view') {
|
|||||||
// Third party
|
// Third party
|
||||||
foreach ($tabttc[$key] as $k => $mt)
|
foreach ($tabttc[$key] as $k => $mt)
|
||||||
{
|
{
|
||||||
//if ($mt) {
|
print '<tr class="oddeven">';
|
||||||
print '<tr class="oddeven">';
|
print "<!-- Thirdparty -->";
|
||||||
print "<!-- Thirdparty -->";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
// Account
|
||||||
// Account
|
print "<td>";
|
||||||
print "<td>";
|
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER);
|
||||||
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER);
|
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
||||||
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
{
|
||||||
{
|
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
|
||||||
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
|
}
|
||||||
}
|
else print $accountoshow;
|
||||||
else print $accountoshow;
|
print '</td>';
|
||||||
print '</td>';
|
// Subledger account
|
||||||
// Subledger account
|
print "<td>";
|
||||||
print "<td>";
|
$accountoshow = length_accounta($k);
|
||||||
$accountoshow = length_accounta($k);
|
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
||||||
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
{
|
||||||
{
|
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
}
|
||||||
}
|
else print $accountoshow;
|
||||||
else print $accountoshow;
|
print '</td>';
|
||||||
print '</td>';
|
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
|
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print "</tr>";
|
||||||
print "</tr>";
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Product / Service
|
// Product / Service
|
||||||
@ -839,30 +831,28 @@ if (empty($action) || $action == 'view') {
|
|||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
$accountingaccount->fetch(null, $k, true);
|
$accountingaccount->fetch(null, $k, true);
|
||||||
|
|
||||||
//if ($mt) {
|
print '<tr class="oddeven">';
|
||||||
print '<tr class="oddeven">';
|
print "<!-- Product -->";
|
||||||
print "<!-- Product -->";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
// Account
|
||||||
// Account
|
print "<td>";
|
||||||
print "<td>";
|
$accountoshow = length_accountg($k);
|
||||||
$accountoshow = length_accountg($k);
|
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
||||||
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
{
|
||||||
{
|
print '<span class="error">'.$langs->trans("ProductNotDefined").'</span>';
|
||||||
print '<span class="error">'.$langs->trans("ProductNotDefined").'</span>';
|
}
|
||||||
}
|
else print $accountoshow;
|
||||||
else print $accountoshow;
|
print "</td>";
|
||||||
print "</td>";
|
// Subledger account
|
||||||
// Subledger account
|
print "<td>";
|
||||||
print "<td>";
|
print '</td>';
|
||||||
print '</td>';
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . "</td>";
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . "</td>";
|
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print "</tr>";
|
||||||
print "</tr>";
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
|
|||||||
@ -42,7 +42,7 @@ $codeventil = GETPOST('codeventil');
|
|||||||
$id = GETPOST('id');
|
$id = GETPOST('id');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ if (! empty($id)) {
|
|||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
// ref invoice
|
// ref invoice
|
||||||
print '<tr><td>' . $langs->trans("BillsSuppliers") . '</td>';
|
print '<tr><td>' . $langs->trans("BillsSuppliers") . '</td>';
|
||||||
|
|||||||
@ -27,6 +27,7 @@
|
|||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
@ -36,7 +37,7 @@ $langs->loadLangs(array("compta","bills","other","main","accountancy"));
|
|||||||
if (empty($conf->accounting->enabled)) {
|
if (empty($conf->accounting->enabled)) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
if (! $user->rights->accounting->bind->write)
|
if (! $user->rights->accounting->bind->write)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
@ -63,6 +64,7 @@ $year_current = $year_start;
|
|||||||
// Validate History
|
// Validate History
|
||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
|
|
||||||
|
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -95,12 +97,11 @@ if ($action == 'clean' || $action == 'validatehistory')
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'validatehistory') {
|
if ($action == 'validatehistory') {
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
|
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
|
||||||
if ($db->type == 'pgsql') {
|
/*if ($db->type == 'pgsql') {
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
|
||||||
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
||||||
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
|
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
|
||||||
@ -113,16 +114,85 @@ if ($action == 'validatehistory') {
|
|||||||
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity;
|
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity;
|
||||||
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
|
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
|
||||||
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
// Supplier Invoice Lines (must be same request than into page list.php for manual binding)
|
||||||
|
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
|
||||||
|
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||||
|
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
|
||||||
|
$sql.= " aa.rowid as aarowid,";
|
||||||
|
$sql.= " co.code as country_code, co.label as country_label,";
|
||||||
|
$sql.= " s.tva_intra";
|
||||||
|
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||||
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
||||||
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
||||||
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||||
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
|
||||||
|
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||||
|
$sql.= " AND l.product_type <= 2";
|
||||||
|
|
||||||
dol_syslog('htdocs/accountancy/supplier/index.php');
|
dol_syslog('htdocs/accountancy/supplier/index.php');
|
||||||
|
|
||||||
$resql1 = $db->query($sql1);
|
$result = $db->query($sql);
|
||||||
if (! $resql1) {
|
if (! $result) {
|
||||||
$error ++;
|
$error++;
|
||||||
$db->rollback();
|
|
||||||
setEventMessages($db->lasterror(), null, 'errors');
|
setEventMessages($db->lasterror(), null, 'errors');
|
||||||
} else {
|
} else {
|
||||||
|
$num_lines = $db->num_rows($result);
|
||||||
|
|
||||||
|
$isSellerInEEC = isInEEC($mysoc);
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
|
||||||
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
|
// Search suggested account for product/service
|
||||||
|
$suggestedaccountingaccountfor = '';
|
||||||
|
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||||
|
$objp->code_buy_p = $objp->code_buy;
|
||||||
|
$objp->aarowid_suggest = $objp->aarowid;
|
||||||
|
$suggestedaccountingaccountfor = '';
|
||||||
|
} else {
|
||||||
|
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||||
|
//$objp->code_buy_p = $objp->code_buy_intra;
|
||||||
|
$objp->code_buy_p = $objp->code_buy;
|
||||||
|
//$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||||
|
$objp->aarowid_suggest = $objp->aarowid;
|
||||||
|
$suggestedaccountingaccountfor = 'eec';
|
||||||
|
} else { // Foreign sale
|
||||||
|
//$objp->code_buy_p = $objp->code_buy_export;
|
||||||
|
$objp->code_buy_p = $objp->code_buy;
|
||||||
|
//$objp->aarowid_suggest = $objp->aarowid_export;
|
||||||
|
$objp->aarowid_suggest = $objp->aarowid;
|
||||||
|
$suggestedaccountingaccountfor = 'export';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($objp->aarowid_suggest > 0)
|
||||||
|
{
|
||||||
|
$sqlupdate = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
|
||||||
|
$sqlupdate.= " SET fk_code_ventilation = ".$objp->aarowid_suggest;
|
||||||
|
$sqlupdate.= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".$objp->rowid;
|
||||||
|
|
||||||
|
$resqlupdate = $db->query($sqlupdate);
|
||||||
|
if (! $resqlupdate)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
setEventMessages($db->lasterror(), null, 'errors');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($error)
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
|
}
|
||||||
|
else {
|
||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
@ -153,7 +223,7 @@ print_barre_liste($langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '',
|
|||||||
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
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" class="left">' . $langs->trans("Label") . '</td>';
|
print '<td width="200" class="left">' . $langs->trans("Label") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
@ -187,7 +257,6 @@ if ($resql) {
|
|||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
if ($row[0] == 'tobind')
|
if ($row[0] == 'tobind')
|
||||||
{
|
{
|
||||||
@ -224,7 +293,7 @@ print_barre_liste($langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '',
|
|||||||
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', '');
|
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', '');
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
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" class="left">' . $langs->trans("Label") . '</td>';
|
print '<td width="200" class="left">' . $langs->trans("Label") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
@ -258,7 +327,6 @@ if ($resql) {
|
|||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
if ($row[0] == 'tobind')
|
if ($row[0] == 'tobind')
|
||||||
{
|
{
|
||||||
@ -298,7 +366,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
//print load_fiche_titre($langs->trans("OtherInfo"), '', '');
|
//print load_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre"><td width="400" class="left">' . $langs->trans("Total") . '</td>';
|
print '<tr class="liste_titre"><td width="400" class="left">' . $langs->trans("Total") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
|
|||||||
@ -74,7 +74,7 @@ if (! $sortorder) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
if (! $user->rights->accounting->bind->write)
|
if (! $user->rights->accounting->bind->write)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
@ -192,12 +192,12 @@ if ($search_lineid) {
|
|||||||
if (strlen(trim($search_invoice))) {
|
if (strlen(trim($search_invoice))) {
|
||||||
$sql .= natural_search("f.ref", $search_invoice);
|
$sql .= natural_search("f.ref", $search_invoice);
|
||||||
}
|
}
|
||||||
|
if (strlen(trim($search_label))) {
|
||||||
|
$sql .= natural_search("f.libelle", $search_label);
|
||||||
|
}
|
||||||
if (strlen(trim($search_ref))) {
|
if (strlen(trim($search_ref))) {
|
||||||
$sql .= natural_search("p.ref", $search_ref);
|
$sql .= natural_search("p.ref", $search_ref);
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_label))) {
|
|
||||||
$sql .= natural_search("p.label", $search_label);
|
|
||||||
}
|
|
||||||
if (strlen(trim($search_desc))) {
|
if (strlen(trim($search_desc))) {
|
||||||
$sql .= natural_search("l.description", $search_desc);
|
$sql .= natural_search("l.description", $search_desc);
|
||||||
}
|
}
|
||||||
@ -300,14 +300,13 @@ if ($result) {
|
|||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" 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"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
print '<td class="liste_titre center nowraponall">';
|
print '<td class="liste_titre center nowraponall">';
|
||||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.$search_day.'">';
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||||
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.$search_month.'">';
|
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||||
$formother->select_year($search_year, 'search_year', 1, 20, 5);
|
$formother->select_year($search_year, 'search_year', 1, 20, 5);
|
||||||
print '</td>';
|
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_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||||
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||||
@ -368,6 +367,7 @@ if ($result) {
|
|||||||
print $objp->invoice_label;
|
print $objp->invoice_label;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
// Date invoice
|
||||||
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
|
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
|
||||||
|
|
||||||
// Ref product
|
// Ref product
|
||||||
@ -388,7 +388,12 @@ if ($result) {
|
|||||||
|
|
||||||
print '<td class="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
print '<td class="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||||
|
|
||||||
print '<td>' . $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')</td>';
|
print '<td>';
|
||||||
|
if ($objp->country_code)
|
||||||
|
{
|
||||||
|
print $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
print '<td>' . $objp->tva_intra . '</td>';
|
print '<td>' . $objp->tva_intra . '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -83,7 +83,7 @@ if (! $sortorder) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
if (! $user->rights->accounting->bind->write)
|
if (! $user->rights->accounting->bind->write)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
@ -133,8 +133,8 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Mass actions
|
// Mass actions
|
||||||
$objectclass='AccountingAccount';
|
$objectclass='AccountingAccount';
|
||||||
$permtoread = $user->rights->accounting->read;
|
$permissiontoread = $user->rights->accounting->read;
|
||||||
$permtodelete = $user->rights->accounting->delete;
|
$permissiontodelete = $user->rights->accounting->delete;
|
||||||
$uploaddir = $conf->accounting->dir_output;
|
$uploaddir = $conf->accounting->dir_output;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
}
|
}
|
||||||
@ -184,8 +184,6 @@ if ($massaction == 'ventil') {
|
|||||||
}
|
}
|
||||||
$msg.='</div>';
|
$msg.='</div>';
|
||||||
$msg.= '<div>' . $langs->trans("EndProcessing") . '</div>';
|
$msg.= '<div>' . $langs->trans("EndProcessing") . '</div>';
|
||||||
//} else {
|
|
||||||
// setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +222,7 @@ $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
|||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
||||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
|
||||||
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||||
$sql.= " AND l.product_type <= 2";
|
$sql.= " AND l.product_type <= 2";
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
@ -234,12 +232,12 @@ if ($search_lineid) {
|
|||||||
if (strlen(trim($search_invoice))) {
|
if (strlen(trim($search_invoice))) {
|
||||||
$sql .= natural_search("f.ref", $search_invoice);
|
$sql .= natural_search("f.ref", $search_invoice);
|
||||||
}
|
}
|
||||||
|
if (strlen(trim($search_label))) {
|
||||||
|
$sql .= natural_search("f.libelle", $search_label);
|
||||||
|
}
|
||||||
if (strlen(trim($search_ref))) {
|
if (strlen(trim($search_ref))) {
|
||||||
$sql .= natural_search("p.ref", $search_ref);
|
$sql .= natural_search("p.ref", $search_ref);
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_label))) {
|
|
||||||
$sql .= natural_search("p.label", $search_label);
|
|
||||||
}
|
|
||||||
if (strlen(trim($search_desc))) {
|
if (strlen(trim($search_desc))) {
|
||||||
$sql .= natural_search("l.description", $search_desc);
|
$sql .= natural_search("l.description", $search_desc);
|
||||||
}
|
}
|
||||||
@ -309,14 +307,15 @@ if ($result) {
|
|||||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||||
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
|
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
|
||||||
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||||
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||||
if ($search_year) $param.='&search_year='.urlencode($search_year);
|
if ($search_year) $param.='&search_year='.urlencode($search_year);
|
||||||
if ($search_invoice) $param.='&search_invoice='.urlencode($search_invoice);
|
if ($search_invoice) $param.='&search_invoice='.urlencode($search_invoice);
|
||||||
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
||||||
|
if ($search_label) $param.='&search_label='.urlencode($search_label);
|
||||||
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
||||||
if ($search_amount) $param.='&search_amount='.urlencode($search_amount);
|
if ($search_amount) $param.='&search_amount='.urlencode($search_amount);
|
||||||
if ($search_vat) $param.='&search_vat='.urlencode($search_vat);
|
if ($search_vat) $param.='&search_vat='.urlencode($search_vat);
|
||||||
@ -362,14 +361,13 @@ if ($result) {
|
|||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" 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"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
print '<td class="liste_titre center nowraponall">';
|
print '<td class="liste_titre center nowraponall">';
|
||||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.$search_day.'">';
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||||
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.$search_month.'">';
|
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||||
$formother->select_year($search_year, 'search_year', 1, 20, 5);
|
$formother->select_year($search_year, 'search_year', 1, 20, 5);
|
||||||
print '</td>';
|
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 maxwidth100" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||||
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||||
@ -465,7 +463,7 @@ if ($result) {
|
|||||||
|
|
||||||
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
|
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
|
||||||
|
|
||||||
// Ref product
|
// Ref Product
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($product_static->id > 0)
|
if ($product_static->id > 0)
|
||||||
print $product_static->getNomUrl(1);
|
print $product_static->getNomUrl(1);
|
||||||
@ -473,7 +471,7 @@ if ($result) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
print '<td>';
|
print '<td class="tdoverflowonsmartphone">';
|
||||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
||||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
|
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
|
||||||
@ -521,12 +519,14 @@ if ($result) {
|
|||||||
|
|
||||||
// Suggested accounting account
|
// Suggested accounting account
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
|
$suggestedid = $objp->aarowid_suggest;
|
||||||
|
print $formaccounting->select_account($suggestedid, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Column with checkbox
|
// Column with checkbox
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
$ischecked = $objp->aarowid_suggest;
|
||||||
|
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($ischecked ? "checked" : "") . '/>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|||||||
@ -154,7 +154,7 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|||||||
print '<input type="hidden" name="action" value="updateall">';
|
print '<input type="hidden" name="action" value="updateall">';
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("MemberMainOptions"), '', '');
|
print load_fiche_titre($langs->trans("MemberMainOptions"), '', '');
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Description").'</td>';
|
print '<td>'.$langs->trans("Description").'</td>';
|
||||||
print '<td>'.$langs->trans("Value").'</td>';
|
print '<td>'.$langs->trans("Value").'</td>';
|
||||||
|
|||||||
@ -163,7 +163,7 @@ if (! empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
|||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||||
@ -178,7 +178,7 @@ if (! empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
|||||||
$listofval = array(-1 => $langs->trans("Undefined"));
|
$listofval = array(-1 => $langs->trans("Undefined"));
|
||||||
$listofval += $adht->liste_array();
|
$listofval += $adht->liste_array();
|
||||||
$forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1;
|
$forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1;
|
||||||
print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listetype)>1?1:0);
|
print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listofval)>1?1:0);
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
|
|||||||
@ -26,17 +26,12 @@ if (empty($conf) || ! is_object($conf))
|
|||||||
|
|
||||||
$contact = $GLOBALS['objcanvas']->control->object;
|
$contact = $GLOBALS['objcanvas']->control->object;
|
||||||
|
|
||||||
?>
|
echo "<!-- BEGIN PHP TEMPLATE ADHERENTCARD_VIEW.TPL.PHP DEFAULT -->\n";
|
||||||
|
echo $this->control->tpl['showhead'];
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE ADHERENTCARD_VIEW.TPL.PHP DEFAULT -->
|
|
||||||
<?php echo $this->control->tpl['showhead']; ?>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors']);
|
dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors']);
|
||||||
?>
|
if (! empty($this->control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user'];
|
||||||
|
if (! empty($this->control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?>
|
||||||
<?php if (! empty($this->control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user']; ?>
|
|
||||||
<?php if (! empty($this->control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?>
|
|
||||||
|
|
||||||
<table class="border allwidth">
|
<table class="border allwidth">
|
||||||
|
|
||||||
@ -121,29 +116,28 @@ dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors'
|
|||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<?php echo $this->control->tpl['showend']; ?>
|
<?php echo $this->control->tpl['showend'];
|
||||||
|
|
||||||
<?php if (empty($user->societe_id)) { ?>
|
if (empty($user->socid)) {
|
||||||
<div class="tabsAction">
|
echo '<div class="tabsAction">';
|
||||||
|
|
||||||
<?php if ($user->rights->adherent->creer) { ?>
|
if ($user->rights->adherent->creer) {
|
||||||
<a class="butAction" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=edit&canvas='.$canvas; ?>"><?php echo $langs->trans('Modify'); ?></a>
|
echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=edit&canvas='.$canvas.'">'.$langs->trans('Modify').'</a>';
|
||||||
<?php } ?>
|
}
|
||||||
|
|
||||||
<?php if (! $this->control->tpl['user_id'] && $user->rights->user->user->creer) { ?>
|
if (! $this->control->tpl['user_id'] && $user->rights->user->user->creer) {
|
||||||
<a class="butAction" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=create_user&canvas='.$canvas; ?>"><?php echo $langs->trans("CreateDolibarrLogin"); ?></a>
|
echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=create_user&canvas='.$canvas.'">'.$langs->trans("CreateDolibarrLogin").'</a>';
|
||||||
<?php } ?>
|
}
|
||||||
|
|
||||||
<?php if ($user->rights->adherent->supprimer) { ?>
|
if ($user->rights->adherent->supprimer) {
|
||||||
<a class="butActionDelete" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=delete&canvas='.$canvas; ?>"><?php echo $langs->trans('Delete'); ?></a>
|
echo '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=delete&canvas='.$canvas.'">'.$langs->trans('Delete').'</a>';
|
||||||
<?php } ?>
|
}
|
||||||
|
|
||||||
</div><br>
|
echo '</div><br>';
|
||||||
<?php }
|
}
|
||||||
|
|
||||||
echo $this->control->tpl['actionstodo'];
|
echo $this->control->tpl['actionstodo'];
|
||||||
|
|
||||||
echo $this->control->tpl['actionsdone'];
|
echo $this->control->tpl['actionsdone'];
|
||||||
?>
|
|
||||||
|
|
||||||
<!-- END PHP TEMPLATE -->
|
echo "<!-- END PHP TEMPLATE -->\n";
|
||||||
|
|||||||
@ -70,6 +70,8 @@ $extrafields = new ExtraFields($db);
|
|||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
|
||||||
|
$socialnetworks = getArrayOfSocialNetworks();
|
||||||
|
|
||||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||||
$object->getCanvas($id);
|
$object->getCanvas($id);
|
||||||
$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
|
$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
|
||||||
@ -302,10 +304,16 @@ if (empty($reshook))
|
|||||||
$object->phone_perso = trim(GETPOST("phone_perso", 'alpha'));
|
$object->phone_perso = trim(GETPOST("phone_perso", 'alpha'));
|
||||||
$object->phone_mobile= trim(GETPOST("phone_mobile", 'alpha'));
|
$object->phone_mobile= trim(GETPOST("phone_mobile", 'alpha'));
|
||||||
$object->email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
|
$object->email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
|
||||||
$object->skype = trim(GETPOST("skype", 'alpha'));
|
$object->socialnetworks = array();
|
||||||
$object->twitter = trim(GETPOST("twitter", 'alpha'));
|
foreach ($socialnetworks as $key => $value) {
|
||||||
$object->facebook = trim(GETPOST("facebook", 'alpha'));
|
if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') {
|
||||||
$object->linkedin = trim(GETPOST("linkedin", 'alpha'));
|
$object->socialnetworks[$key] = trim(GETPOST($key, 'alphanohtml'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//$object->skype = trim(GETPOST("skype", 'alpha'));
|
||||||
|
//$object->twitter = trim(GETPOST("twitter", 'alpha'));
|
||||||
|
//$object->facebook = trim(GETPOST("facebook", 'alpha'));
|
||||||
|
//$object->linkedin = trim(GETPOST("linkedin", 'alpha'));
|
||||||
$object->birth = $birthdate;
|
$object->birth = $birthdate;
|
||||||
|
|
||||||
$object->typeid = GETPOST("typeid", 'int');
|
$object->typeid = GETPOST("typeid", 'int');
|
||||||
@ -448,10 +456,10 @@ if (empty($reshook))
|
|||||||
$phone=GETPOST("phone", 'alpha');
|
$phone=GETPOST("phone", 'alpha');
|
||||||
$phone_perso=GETPOST("phone_perso", 'alpha');
|
$phone_perso=GETPOST("phone_perso", 'alpha');
|
||||||
$phone_mobile=GETPOST("phone_mobile", 'alpha');
|
$phone_mobile=GETPOST("phone_mobile", 'alpha');
|
||||||
$skype=GETPOST("member_skype", 'alpha');
|
// $skype=GETPOST("member_skype", 'alpha');
|
||||||
$twitter=GETPOST("member_twitter", 'alpha');
|
// $twitter=GETPOST("member_twitter", 'alpha');
|
||||||
$facebook=GETPOST("member_facebook", 'alpha');
|
// $facebook=GETPOST("member_facebook", 'alpha');
|
||||||
$linkedin=GETPOST("member_linkedin", 'alpha');
|
// $linkedin=GETPOST("member_linkedin", 'alpha');
|
||||||
$email=preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
|
$email=preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
|
||||||
$login=GETPOST("member_login", 'alpha');
|
$login=GETPOST("member_login", 'alpha');
|
||||||
$pass=GETPOST("password", 'alpha');
|
$pass=GETPOST("password", 'alpha');
|
||||||
@ -478,11 +486,19 @@ if (empty($reshook))
|
|||||||
$object->phone = $phone;
|
$object->phone = $phone;
|
||||||
$object->phone_perso = $phone_perso;
|
$object->phone_perso = $phone_perso;
|
||||||
$object->phone_mobile= $phone_mobile;
|
$object->phone_mobile= $phone_mobile;
|
||||||
|
$object->socialnetworks = array();
|
||||||
|
if (! empty($conf->socialnetworks->enabled)) {
|
||||||
|
foreach ($socialnetworks as $key => $value) {
|
||||||
|
if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') {
|
||||||
|
$object->socialnetworks[$key] = GETPOST("member_".$key, 'alphanohtml');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$object->skype = $skype;
|
// $object->skype = $skype;
|
||||||
$object->twitter = $twitter;
|
// $object->twitter = $twitter;
|
||||||
$object->facebook = $facebook;
|
// $object->facebook = $facebook;
|
||||||
$object->linkedin = $linkedin;
|
// $object->linkedin = $linkedin;
|
||||||
|
|
||||||
$object->email = $email;
|
$object->email = $email;
|
||||||
$object->login = $login;
|
$object->login = $login;
|
||||||
@ -802,7 +818,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// 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;
|
$permissiontoadd=$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
|
// Actions to send emails
|
||||||
@ -867,6 +883,18 @@ else
|
|||||||
$object->country=$tmparray['label'];
|
$object->country=$tmparray['label'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($socid)) {
|
||||||
|
$object = new Societe($db);
|
||||||
|
if ($socid > 0) $object->fetch($socid);
|
||||||
|
|
||||||
|
if (! ($object->id > 0))
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
print($langs->trans('ErrorRecordNotFound'));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$adht = new AdherentType($db);
|
$adht = new AdherentType($db);
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("NewMember"), '', 'members');
|
print load_fiche_titre($langs->trans("NewMember"), '', 'members');
|
||||||
@ -905,11 +933,12 @@ 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">';
|
||||||
|
print '<input type="hidden" name="socid" value="'.$socid.'">';
|
||||||
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
|
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
|
||||||
|
|
||||||
dol_fiche_head('');
|
dol_fiche_head('');
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
print '<tbody>';
|
print '<tbody>';
|
||||||
|
|
||||||
// Login
|
// Login
|
||||||
@ -970,7 +999,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" class="minwidth300" maxlength="255" value="'.(GETPOST('member_email', 'alpha')?GETPOST('member_email', 'alpha'):$object->email).'"></td></tr>';
|
print '<tr><td>'.img_picto('', 'object_email').' '.($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>';
|
||||||
@ -1007,37 +1036,20 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pro phone
|
// Pro phone
|
||||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(GETPOST('phone', 'alpha')?GETPOST('phone', 'alpha'):$object->phone).'"></td></tr>';
|
print '<tr><td>'.img_picto('', 'object_phoning').' '.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(GETPOST('phone', 'alpha')?GETPOST('phone', 'alpha'):$object->phone).'"></td></tr>';
|
||||||
|
|
||||||
// Personal phone
|
// Personal phone
|
||||||
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(GETPOST('phone_perso', 'alpha')?GETPOST('phone_perso', 'alpha'):$object->phone_perso).'"></td></tr>';
|
print '<tr><td>'.img_picto('', 'object_phoning').' '.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(GETPOST('phone_perso', 'alpha')?GETPOST('phone_perso', 'alpha'):$object->phone_perso).'"></td></tr>';
|
||||||
|
|
||||||
// Mobile phone
|
// Mobile phone
|
||||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(GETPOST('phone_mobile', 'alpha')?GETPOST('phone_mobile', 'alpha'):$object->phone_mobile).'"></td></tr>';
|
print '<tr><td>'.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(GETPOST('phone_mobile', 'alpha')?GETPOST('phone_mobile', 'alpha'):$object->phone_mobile).'"></td></tr>';
|
||||||
|
|
||||||
// Skype
|
if (! empty($conf->socialnetworks->enabled)) {
|
||||||
if (! empty($conf->socialnetworks->enabled))
|
foreach ($socialnetworks as $key => $value) {
|
||||||
{
|
if (!$value['active']) break;
|
||||||
print '<tr><td>'.$langs->trans("Skype").'</td><td><input type="text" name="member_skype" size="40" value="'.(GETPOST('member_skype', 'alpha')?GETPOST('member_skype', 'alpha'):$object->skype).'"></td></tr>';
|
print '<tr><td>'.$langs->trans($value['label']).'</td><td><input type="text" name="member_'.$key.'" size="40" value="'.(GETPOST('member_'.$key, 'alpha')?GETPOST('member_'.$key, 'alpha'):$object->socialnetworks[$key]).'"></td></tr>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Twitter
|
|
||||||
if (! empty($conf->socialnetworks->enabled))
|
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans("Twitter").'</td><td><input type="text" name="member_twitter" size="40" value="'.(GETPOST('member_twitter', 'alpha')?GETPOST('member_twitter', 'alpha'):$object->twitter).'"></td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Facebook
|
|
||||||
if (! empty($conf->socialnetworks->enabled))
|
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans("Facebook").'</td><td><input type="text" name="member_facebook" size="40" value="'.(GETPOST('member_facebook', 'alpha')?GETPOST('member_facebook', 'alpha'):$object->facebook).'"></td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// LinkedIn
|
|
||||||
if (! empty($conf->socialnetworks->enabled))
|
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans("LinkedIn").'</td><td><input type="text" name="member_linkedin" size="40" value="'.(GETPOST('member_linkedin', 'alpha')?GETPOST('member_linkedin', 'alpha'):$object->linkedin).'"></td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Birth Date
|
// Birth Date
|
||||||
print "<tr><td>".$langs->trans("DateToBirth")."</td><td>\n";
|
print "<tr><td>".$langs->trans("DateToBirth")."</td><td>\n";
|
||||||
@ -1170,7 +1182,7 @@ else
|
|||||||
|
|
||||||
dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
|
dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td class="valeur">'.$object->id.'</td></tr>';
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td class="valeur">'.$object->id.'</td></tr>';
|
||||||
@ -1246,7 +1258,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" class="minwidth300" maxlength="255" value="'.(isset($_POST["member_email"])?GETPOST("member_email", '', 2):$object->email).'"></td></tr>';
|
print '<tr><td>'.img_picto('', 'object_email').' '.($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>';
|
||||||
@ -1276,37 +1288,20 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pro phone
|
// Pro phone
|
||||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(isset($_POST["phone"])?GETPOST("phone"):$object->phone).'"></td></tr>';
|
print '<tr><td>'.img_picto('', 'object_phoning').' '.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(isset($_POST["phone"])?GETPOST("phone"):$object->phone).'"></td></tr>';
|
||||||
|
|
||||||
// Personal phone
|
// Personal phone
|
||||||
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(isset($_POST["phone_perso"])?GETPOST("phone_perso"):$object->phone_perso).'"></td></tr>';
|
print '<tr><td>'.img_picto('', 'object_phoning').' '.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(isset($_POST["phone_perso"])?GETPOST("phone_perso"):$object->phone_perso).'"></td></tr>';
|
||||||
|
|
||||||
// Mobile phone
|
// Mobile phone
|
||||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(isset($_POST["phone_mobile"])?GETPOST("phone_mobile"):$object->phone_mobile).'"></td></tr>';
|
print '<tr><td>'.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(isset($_POST["phone_mobile"])?GETPOST("phone_mobile"):$object->phone_mobile).'"></td></tr>';
|
||||||
|
|
||||||
// Skype
|
if (! empty($conf->socialnetworks->enabled)) {
|
||||||
if (! empty($conf->socialnetworks->enabled))
|
foreach ($socialnetworks as $key => $value) {
|
||||||
{
|
if (!$value['active']) break;
|
||||||
print '<tr><td>'.$langs->trans("Skype").'</td><td><input type="text" name="skype" class="minwidth100" value="'.(isset($_POST["skype"])?GETPOST("skype"):$object->skype).'"></td></tr>';
|
print '<tr><td>'.$langs->trans($value['label']).'</td><td><input type="text" name="'.$key.'" class="minwidth100" value="'.(isset($_POST[$key])?GETPOST($key):$object->socialnetworks[$key]).'"></td></tr>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Twitter
|
|
||||||
if (! empty($conf->socialnetworks->enabled))
|
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans("Twitter").'</td><td><input type="text" name="twitter" class="minwidth100" value="'.(isset($_POST["twitter"])?GETPOST("twitter"):$object->twitter).'"></td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Facebook
|
|
||||||
if (! empty($conf->socialnetworks->enabled))
|
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans("Facebook").'</td><td><input type="text" name="facebook" class="minwidth100" value="'.(isset($_POST["facebook"])?GETPOST("facebook"):$object->facebook).'"></td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// LinkedIn
|
|
||||||
if (! empty($conf->socialnetworks->enabled))
|
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans("LinkedIn").'</td><td><input type="text" name="linkedin" class="minwidth100" value="'.(isset($_POST["linkedin"])?GETPOST("linkedin"):$object->linkedin).'"></td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Birth Date
|
// Birth Date
|
||||||
print "<tr><td>".$langs->trans("DateToBirth")."</td><td>\n";
|
print "<tr><td>".$langs->trans("DateToBirth")."</td><td>\n";
|
||||||
@ -1666,14 +1661,14 @@ else
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($object->need_subscription == 0)
|
if ($object->need_subscription == 0)
|
||||||
{
|
{
|
||||||
print $langs->trans("SubscriptionNotNeeded");
|
print $langs->trans("SubscriptionNotNeeded");
|
||||||
}
|
}
|
||||||
elseif (! $adht->subscription)
|
elseif (! $adht->subscription)
|
||||||
{
|
{
|
||||||
print $langs->trans("SubscriptionNotRecorded");
|
print $langs->trans("SubscriptionNotRecorded");
|
||||||
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
|
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $langs->trans("SubscriptionNotReceived");
|
print $langs->trans("SubscriptionNotReceived");
|
||||||
@ -1872,7 +1867,7 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create user
|
// Create user
|
||||||
if (! $user->societe_id && ! $object->user_id)
|
if (! $user->socid && ! $object->user_id)
|
||||||
{
|
{
|
||||||
if ($user->rights->user->user->creer)
|
if ($user->rights->user->user->creer)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -259,6 +259,7 @@ print '<br>';
|
|||||||
|
|
||||||
print img_picto('', 'puce').' '.$langs->trans("DocForAllMembersCards", ($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' ';
|
print img_picto('', 'puce').' '.$langs->trans("DocForAllMembersCards", ($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' ';
|
||||||
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="foruserid" value="all">';
|
print '<input type="hidden" name="foruserid" value="all">';
|
||||||
print '<input type="hidden" name="mode" value="card">';
|
print '<input type="hidden" name="mode" value="card">';
|
||||||
print '<input type="hidden" name="action" value="builddoc">';
|
print '<input type="hidden" name="action" value="builddoc">';
|
||||||
@ -278,6 +279,7 @@ print '<br><br>';
|
|||||||
|
|
||||||
print img_picto('', 'puce').' '.$langs->trans("DocForOneMemberCards", ($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' ';
|
print img_picto('', 'puce').' '.$langs->trans("DocForOneMemberCards", ($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' ';
|
||||||
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="mode" value="cardlogin">';
|
print '<input type="hidden" name="mode" value="cardlogin">';
|
||||||
print '<input type="hidden" name="action" value="builddoc">';
|
print '<input type="hidden" name="action" value="builddoc">';
|
||||||
print $langs->trans("DescADHERENT_CARD_TYPE").' ';
|
print $langs->trans("DescADHERENT_CARD_TYPE").' ';
|
||||||
@ -297,6 +299,7 @@ print '<br><br>';
|
|||||||
|
|
||||||
print img_picto('', 'puce').' '.$langs->trans("DocForLabels", $conf->global->ADHERENT_ETIQUETTE_TYPE).' ';
|
print img_picto('', 'puce').' '.$langs->trans("DocForLabels", $conf->global->ADHERENT_ETIQUETTE_TYPE).' ';
|
||||||
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="mode" value="label">';
|
print '<input type="hidden" name="mode" value="label">';
|
||||||
print '<input type="hidden" name="action" value="builddoc">';
|
print '<input type="hidden" name="action" value="builddoc">';
|
||||||
print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").' ';
|
print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").' ';
|
||||||
|
|||||||
@ -124,23 +124,32 @@ class Adherent extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $email;
|
public $email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array array of socialnetworks
|
||||||
|
*/
|
||||||
|
public $socialnetworks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string skype account
|
* @var string skype account
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public $skype;
|
public $skype;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string twitter account
|
* @var string twitter account
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public $twitter;
|
public $twitter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string facebook account
|
* @var string facebook account
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public $facebook;
|
public $facebook;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string linkedin account
|
* @var string linkedin account
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public $linkedin;
|
public $linkedin;
|
||||||
|
|
||||||
@ -174,7 +183,7 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
// -1:brouillon, 0:resilie, >=1:valide,paye
|
// -1:brouillon, 0:resilie, >=1:valide,paye
|
||||||
// def in common object
|
// def in common object
|
||||||
//public $statut;
|
//public $status;
|
||||||
|
|
||||||
public $photo;
|
public $photo;
|
||||||
|
|
||||||
@ -566,10 +575,7 @@ class Adherent extends CommonObject
|
|||||||
$sql.= ", country = ".($this->country_id>0?$this->db->escape($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->db->escape($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.= ", socialnetworks = '".$this->db->escape(json_encode($this->socialnetworks))."'";
|
||||||
$sql.= ", twitter = '".$this->db->escape($this->twitter)."'";
|
|
||||||
$sql.= ", facebook = '".$this->db->escape($this->facebook)."'";
|
|
||||||
$sql.= ", linkedin = '".$this->db->escape($this->linkedin)."'";
|
|
||||||
$sql.= ", phone = ".($this->phone?"'".$this->db->escape($this->phone)."'":"null");
|
$sql.= ", phone = ".($this->phone?"'".$this->db->escape($this->phone)."'":"null");
|
||||||
$sql.= ", phone_perso = ".($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null");
|
$sql.= ", phone_perso = ".($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null");
|
||||||
$sql.= ", phone_mobile = ".($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null");
|
$sql.= ", phone_mobile = ".($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null");
|
||||||
@ -581,6 +587,7 @@ class Adherent extends CommonObject
|
|||||||
$sql.= ", fk_adherent_type = ".$this->db->escape($this->typeid);
|
$sql.= ", fk_adherent_type = ".$this->db->escape($this->typeid);
|
||||||
$sql.= ", morphy = '".$this->db->escape($this->morphy)."'";
|
$sql.= ", morphy = '".$this->db->escape($this->morphy)."'";
|
||||||
$sql.= ", birth = ".($this->birth?"'".$this->db->idate($this->birth)."'":"null");
|
$sql.= ", birth = ".($this->birth?"'".$this->db->idate($this->birth)."'":"null");
|
||||||
|
if ($this->socid) $sql.= ", fk_soc = '".$this->db->escape($this->socid)."'"; // Must be modified only when creating from a third-party
|
||||||
if ($this->datefin) $sql.= ", datefin = '".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription
|
if ($this->datefin) $sql.= ", datefin = '".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription
|
||||||
if ($this->datevalid) $sql.= ", datevalid = '".$this->db->idate($this->datevalid)."'"; // Must be modified only when validating a member
|
if ($this->datevalid) $sql.= ", datevalid = '".$this->db->idate($this->datevalid)."'"; // Must be modified only when validating a member
|
||||||
$sql.= ", fk_user_mod = ".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest
|
$sql.= ", fk_user_mod = ".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest
|
||||||
@ -693,10 +700,7 @@ class Adherent extends CommonObject
|
|||||||
$luser->state_id=$this->state_id;
|
$luser->state_id=$this->state_id;
|
||||||
|
|
||||||
$luser->email=$this->email;
|
$luser->email=$this->email;
|
||||||
$luser->skype=$this->skype;
|
$luser->socialnetworks=$this->socialnetworks;
|
||||||
$luser->twitter=$this->twitter;
|
|
||||||
$luser->facebook=$this->facebook;
|
|
||||||
$luser->linkedin=$this->linkedin;
|
|
||||||
$luser->office_phone=$this->phone;
|
$luser->office_phone=$this->phone;
|
||||||
$luser->user_mobile=$this->phone_mobile;
|
$luser->user_mobile=$this->phone_mobile;
|
||||||
|
|
||||||
@ -735,10 +739,7 @@ class Adherent extends CommonObject
|
|||||||
$lthirdparty->zip=$this->zip;
|
$lthirdparty->zip=$this->zip;
|
||||||
$lthirdparty->town=$this->town;
|
$lthirdparty->town=$this->town;
|
||||||
$lthirdparty->email=$this->email;
|
$lthirdparty->email=$this->email;
|
||||||
$lthirdparty->skype=$this->skype;
|
$lthirdparty->socialnetworks=$this->socialnetworks;
|
||||||
$lthirdparty->twitter=$this->twitter;
|
|
||||||
$lthirdparty->facebook=$this->facebook;
|
|
||||||
$lthirdparty->linkedin=$this->linkedin;
|
|
||||||
$lthirdparty->phone=$this->phone;
|
$lthirdparty->phone=$this->phone;
|
||||||
$lthirdparty->state_id=$this->state_id;
|
$lthirdparty->state_id=$this->state_id;
|
||||||
$lthirdparty->country_id=$this->country_id;
|
$lthirdparty->country_id=$this->country_id;
|
||||||
@ -1227,7 +1228,7 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_code, d.gender, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,";
|
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_code, d.gender, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,";
|
||||||
$sql.= " d.note_public,";
|
$sql.= " d.note_public,";
|
||||||
$sql.= " d.email, d.skype, d.twitter, d.facebook, d.linkedin, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,";
|
$sql.= " d.email, d.socialnetworks, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,";
|
||||||
$sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,";
|
$sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,";
|
||||||
$sql.= " d.datec as datec,";
|
$sql.= " d.datec as datec,";
|
||||||
$sql.= " d.tms as datem,";
|
$sql.= " d.tms as datem,";
|
||||||
@ -1281,7 +1282,7 @@ class Adherent extends CommonObject
|
|||||||
$this->societe = $obj->company;
|
$this->societe = $obj->company;
|
||||||
$this->company = $obj->company;
|
$this->company = $obj->company;
|
||||||
$this->socid = $obj->fk_soc;
|
$this->socid = $obj->fk_soc;
|
||||||
$this->fk_soc = $obj->fk_soc; // For backward comaptibility
|
$this->fk_soc = $obj->fk_soc; // For backward compatibility
|
||||||
$this->address = $obj->address;
|
$this->address = $obj->address;
|
||||||
$this->zip = $obj->zip;
|
$this->zip = $obj->zip;
|
||||||
$this->town = $obj->town;
|
$this->town = $obj->town;
|
||||||
@ -1306,10 +1307,7 @@ class Adherent extends CommonObject
|
|||||||
$this->phone_mobile = $obj->phone_mobile;
|
$this->phone_mobile = $obj->phone_mobile;
|
||||||
$this->email = $obj->email;
|
$this->email = $obj->email;
|
||||||
|
|
||||||
$this->skype = $obj->skype;
|
$this->socialnetworks = (array) json_decode($obj->socialnetworks, true);
|
||||||
$this->twitter = $obj->twitter;
|
|
||||||
$this->facebook = $obj->facebook;
|
|
||||||
$this->linkedin = $obj->linkedin;
|
|
||||||
|
|
||||||
$this->photo = $obj->photo;
|
$this->photo = $obj->photo;
|
||||||
$this->statut = $obj->statut;
|
$this->statut = $obj->statut;
|
||||||
@ -2131,7 +2129,11 @@ class Adherent extends CommonObject
|
|||||||
// Only picto
|
// Only picto
|
||||||
if ($withpictoimg > 0) $picto='<span class="nopadding'.($morecss?' userimg'.$morecss:'').'">'.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).'</span>';
|
if ($withpictoimg > 0) $picto='<span class="nopadding'.($morecss?' userimg'.$morecss:'').'">'.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).'</span>';
|
||||||
// Picto must be a photo
|
// Picto must be a photo
|
||||||
else $picto='<span class="nopadding'.($morecss?' userimg'.$morecss:'').'"'.($paddafterimage?' '.$paddafterimage:'').'>'.Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg==-3?'small':''), 'mini', 0, 1).'</span>';
|
else {
|
||||||
|
$picto='<span class="nopadding'.($morecss?' userimg'.$morecss:'').'"'.($paddafterimage?' '.$paddafterimage:'').'>';
|
||||||
|
$picto.=Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg==-3?'small':''), 'mini', 0, 1);
|
||||||
|
$picto.='</span>';
|
||||||
|
}
|
||||||
$result.=$picto;
|
$result.=$picto;
|
||||||
}
|
}
|
||||||
if ($withpictoimg > -2 && $withpictoimg != 2)
|
if ($withpictoimg > -2 && $withpictoimg != 2)
|
||||||
@ -2163,94 +2165,61 @@ class Adherent extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Renvoi le libelle d'un statut donne
|
* Renvoi le libelle d'un statut donne
|
||||||
*
|
*
|
||||||
* @param int $statut Id statut
|
* @param int $status Id status
|
||||||
* @param int $need_subscription 1 if member type need subscription, 0 otherwise
|
* @param int $need_subscription 1 if member type need subscription, 0 otherwise
|
||||||
* @param int $date_end_subscription Date fin adhesion
|
* @param int $date_end_subscription Date fin adhesion
|
||||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
||||||
* @return string Label
|
* @return string Label
|
||||||
*/
|
*/
|
||||||
public function LibStatut($statut, $need_subscription, $date_end_subscription, $mode = 0)
|
public function LibStatut($status, $need_subscription, $date_end_subscription, $mode = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("members");
|
$langs->load("members");
|
||||||
if ($mode == 0)
|
|
||||||
|
$statusType = '';
|
||||||
|
$labelStatus = '';
|
||||||
|
$labelStatusShort = '';
|
||||||
|
|
||||||
|
if ($status == -1)
|
||||||
{
|
{
|
||||||
if ($statut == -1) return $langs->trans("MemberStatusDraft");
|
$statusType = 'status0';
|
||||||
elseif ($statut >= 1) {
|
$labelStatus = $langs->trans("MemberStatusDraft");
|
||||||
if ($need_subscription == 0) return $langs->trans("MemberStatusNoSubscription");
|
$labelStatusShort = $langs->trans("MemberStatusDraftShort");
|
||||||
elseif (! $date_end_subscription) return $langs->trans("MemberStatusActive");
|
|
||||||
elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLate");
|
|
||||||
else return $langs->trans("MemberStatusPaid");
|
|
||||||
}
|
|
||||||
elseif ($statut == 0) return $langs->trans("MemberStatusResiliated");
|
|
||||||
}
|
}
|
||||||
elseif ($mode == 1)
|
elseif ($status >= 1) {
|
||||||
|
if ($need_subscription == 0)
|
||||||
|
{
|
||||||
|
$statusType = 'status4';
|
||||||
|
$labelStatus = $langs->trans("MemberStatusNoSubscription");
|
||||||
|
$labelStatusShort = $langs->trans("MemberStatusNoSubscriptionShort");
|
||||||
|
}
|
||||||
|
elseif (! $date_end_subscription)
|
||||||
|
{
|
||||||
|
$statusType = 'status1';
|
||||||
|
$labelStatus = $langs->trans("MemberStatusActive");
|
||||||
|
$labelStatusShort = $langs->trans("MemberStatusActiveShort");
|
||||||
|
}
|
||||||
|
elseif ($date_end_subscription < time())
|
||||||
|
{
|
||||||
|
$statusType = 'status3';
|
||||||
|
$labelStatus = $langs->trans("MemberStatusActiveLate");
|
||||||
|
$labelStatusShort = $langs->trans("MemberStatusActiveLateShort");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$statusType = 'status4';
|
||||||
|
$labelStatus = $langs->trans("MemberStatusPaid");
|
||||||
|
$labelStatusShort = $langs->trans("MemberStatusPaidShort");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($status == 0)
|
||||||
{
|
{
|
||||||
if ($statut == -1) return $langs->trans("MemberStatusDraftShort");
|
$statusType = 'status6';
|
||||||
elseif ($statut >= 1) {
|
$labelStatus = $langs->trans("MemberStatusResiliated");
|
||||||
if ($need_subscription == 0) return $langs->trans("MemberStatusNoSubscription");
|
$labelStatusShort = $langs->trans("MemberStatusResiliatedShort");
|
||||||
elseif (! $date_end_subscription) return $langs->trans("MemberStatusActiveShort");
|
|
||||||
elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLateShort");
|
|
||||||
else return $langs->trans("MemberStatusPaidShort");
|
|
||||||
}
|
|
||||||
elseif ($statut == 0) return $langs->trans("MemberStatusResiliatedShort");
|
|
||||||
}
|
|
||||||
elseif ($mode == 2)
|
|
||||||
{
|
|
||||||
if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'), 'statut0').' '.$langs->trans("MemberStatusDraftShort");
|
|
||||||
elseif ($statut >= 1) {
|
|
||||||
if ($need_subscription == 0) return img_picto($langs->trans('MemberStatusNoSubscription'), 'statut4').' '.$langs->trans("MemberStatusNoSubscriptionShort");
|
|
||||||
elseif (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'), 'statut1').' '.$langs->trans("MemberStatusActiveShort");
|
|
||||||
elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'), 'statut3').' '.$langs->trans("MemberStatusActiveLateShort");
|
|
||||||
else return img_picto($langs->trans('MemberStatusPaid'), 'statut4').' '.$langs->trans("MemberStatusPaidShort");
|
|
||||||
}
|
|
||||||
elseif ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'), 'statut5').' '.$langs->trans("MemberStatusResiliatedShort");
|
|
||||||
}
|
|
||||||
elseif ($mode == 3)
|
|
||||||
{
|
|
||||||
if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'), 'statut0');
|
|
||||||
elseif ($statut >= 1) {
|
|
||||||
if ($need_subscription == 0) return img_picto($langs->trans('MemberStatusNoSubscription'), 'statut4');
|
|
||||||
elseif (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'), 'statut1');
|
|
||||||
elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'), 'statut3');
|
|
||||||
else return img_picto($langs->trans('MemberStatusPaid'), 'statut4');
|
|
||||||
}
|
|
||||||
elseif ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'), 'statut5');
|
|
||||||
}
|
|
||||||
elseif ($mode == 4)
|
|
||||||
{
|
|
||||||
if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'), 'statut0').' '.$langs->trans("MemberStatusDraft");
|
|
||||||
elseif ($statut >= 1) {
|
|
||||||
if ($need_subscription == 0) return img_picto($langs->trans('MemberStatusNoSubscription'), 'statut4').' '.$langs->trans("MemberStatusNoSubscription");
|
|
||||||
elseif (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'), 'statut1').' '.$langs->trans("MemberStatusActive");
|
|
||||||
elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'), 'statut3').' '.$langs->trans("MemberStatusActiveLate");
|
|
||||||
else return img_picto($langs->trans('MemberStatusPaid'), 'statut4').' '.$langs->trans("MemberStatusPaid");
|
|
||||||
}
|
|
||||||
if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'), 'statut5').' '.$langs->trans("MemberStatusResiliated");
|
|
||||||
}
|
|
||||||
elseif ($mode == 5)
|
|
||||||
{
|
|
||||||
if ($statut == -1) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusDraftShort").'</span> '.img_picto($langs->trans('MemberStatusDraft'), 'statut0');
|
|
||||||
elseif ($statut >= 1) {
|
|
||||||
if ($need_subscription == 0) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusNoSubscriptionShort").' </span>'.img_picto($langs->trans('MemberStatusNoSubscription'), 'statut4');
|
|
||||||
elseif (! $date_end_subscription) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveShort").' </span>'.img_picto($langs->trans('MemberStatusActive'), 'statut1');
|
|
||||||
elseif ($date_end_subscription < time()) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveLateShort").' </span>'.img_picto($langs->trans('MemberStatusActiveLate'), 'statut3');
|
|
||||||
else return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusPaidShort").' </span>'.img_picto($langs->trans('MemberStatusPaid'), 'statut4');
|
|
||||||
}
|
|
||||||
if ($statut == 0) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusResiliated").' </span>'.img_picto($langs->trans('MemberStatusResiliated'), 'statut5');
|
|
||||||
}
|
|
||||||
elseif ($mode == 6)
|
|
||||||
{
|
|
||||||
if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'), 'statut0');
|
|
||||||
if ($statut >= 1) {
|
|
||||||
if ($need_subscription == 0) return $langs->trans("MemberStatusNoSubscription").' '.img_picto($langs->trans('MemberStatusNoSubscription'), 'statut4');
|
|
||||||
elseif (! $date_end_subscription) return $langs->trans("MemberStatusActive").' '.img_picto($langs->trans('MemberStatusActive'), 'statut1');
|
|
||||||
elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLate").' '.img_picto($langs->trans('MemberStatusActiveLate'), 'statut3');
|
|
||||||
else return $langs->trans("MemberStatusPaid").' '.img_picto($langs->trans('MemberStatusPaid'), 'statut4');
|
|
||||||
}
|
|
||||||
if ($statut == 0) return $langs->trans("MemberStatusResiliated").' '.img_picto($langs->trans('MemberStatusResiliated'), 'statut5');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2369,7 +2338,6 @@ class Adherent extends CommonObject
|
|||||||
$langs->load("orders");
|
$langs->load("orders");
|
||||||
|
|
||||||
if (! dol_strlen($modele)) {
|
if (! dol_strlen($modele)) {
|
||||||
|
|
||||||
$modele = 'standard';
|
$modele = 'standard';
|
||||||
|
|
||||||
if ($this->modelpdf) {
|
if ($this->modelpdf) {
|
||||||
@ -2414,10 +2382,12 @@ class Adherent extends CommonObject
|
|||||||
$this->country = 'France';
|
$this->country = 'France';
|
||||||
$this->morphy = 'mor';
|
$this->morphy = 'mor';
|
||||||
$this->email = 'specimen@specimen.com';
|
$this->email = 'specimen@specimen.com';
|
||||||
$this->skype = 'skypepseudo';
|
$this->socialnetworks = array(
|
||||||
$this->twitter = 'twitterpseudo';
|
'skype' => 'skypepseudo',
|
||||||
$this->facebook = 'facebookpseudo';
|
'twitter' => 'twitterpseudo',
|
||||||
$this->linkedin = 'linkedinpseudo';
|
'facebook' => 'facebookpseudo',
|
||||||
|
'linkedin' => 'linkedinpseudo',
|
||||||
|
);
|
||||||
$this->phone = '0999999999';
|
$this->phone = '0999999999';
|
||||||
$this->phone_perso = '0999999998';
|
$this->phone_perso = '0999999998';
|
||||||
$this->phone_mobile = '0999999997';
|
$this->phone_mobile = '0999999997';
|
||||||
@ -2471,7 +2441,7 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||||
/**
|
/**
|
||||||
* Initialise tableau info (tableau des attributs LDAP)
|
* Initialise tableau info (tableau des attributs LDAP)
|
||||||
*
|
*
|
||||||
* @return array Tableau info des attributs
|
* @return array Tableau info des attributs
|
||||||
|
|||||||
@ -71,6 +71,18 @@ class AdherentType extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $morphy;
|
public $morphy;
|
||||||
|
|
||||||
|
public $duration;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* type expiration
|
||||||
|
*/
|
||||||
|
public $duration_value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expiration unit
|
||||||
|
*/
|
||||||
|
public $duration_unit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int Subsription required (0 or 1)
|
* @var int Subsription required (0 or 1)
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
@ -88,8 +100,8 @@ class AdherentType extends CommonObject
|
|||||||
|
|
||||||
/** @var array Array of members */
|
/** @var array Array of members */
|
||||||
public $members=array();
|
public $members=array();
|
||||||
|
|
||||||
public $multilangs=array();
|
public $multilangs=array();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -129,9 +141,9 @@ class AdherentType extends CommonObject
|
|||||||
$this->description = $obj->description;
|
$this->description = $obj->description;
|
||||||
$this->email = $obj->email;
|
$this->email = $obj->email;
|
||||||
}
|
}
|
||||||
$this->multilangs["$obj->lang"]["label"] = $obj->label;
|
$this->multilangs["$obj->lang"]["label"] = $obj->label;
|
||||||
$this->multilangs["$obj->lang"]["description"] = $obj->description;
|
$this->multilangs["$obj->lang"]["description"] = $obj->description;
|
||||||
$this->multilangs["$obj->lang"]["email"] = $obj->email;
|
$this->multilangs["$obj->lang"]["email"] = $obj->email;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -141,7 +153,7 @@ class AdherentType extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update or add a translation for a product
|
* Update or add a translation for a product
|
||||||
*
|
*
|
||||||
@ -248,7 +260,7 @@ class AdherentType extends CommonObject
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a language for this product
|
* Delete a language for this product
|
||||||
*
|
*
|
||||||
@ -361,7 +373,7 @@ class AdherentType extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function update($user, $notrigger = 0)
|
public function update($user, $notrigger = 0)
|
||||||
{
|
{
|
||||||
global $langs, $conf, $hookmanager;
|
global $langs, $conf, $hookmanager;
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
@ -373,8 +385,9 @@ class AdherentType extends CommonObject
|
|||||||
$sql.= "SET ";
|
$sql.= "SET ";
|
||||||
$sql.= "statut = ".$this->statut.",";
|
$sql.= "statut = ".$this->statut.",";
|
||||||
$sql.= "libelle = '".$this->db->escape($this->label) ."',";
|
$sql.= "libelle = '".$this->db->escape($this->label) ."',";
|
||||||
$sql.= "morphy = '".$this->db->escape($this->morphy) ."',";
|
$sql.= "morphy = '".$this->db->escape($this->morphy) ."',";
|
||||||
$sql.= "subscription = '".$this->db->escape($this->subscription)."',";
|
$sql.= "subscription = '".$this->db->escape($this->subscription)."',";
|
||||||
|
$sql.= "duration = '" . $this->db->escape($this->duration_value . $this->duration_unit) ."',";
|
||||||
$sql.= "note = '".$this->db->escape($this->note)."',";
|
$sql.= "note = '".$this->db->escape($this->note)."',";
|
||||||
$sql.= "vote = ".(integer) $this->db->escape($this->vote).",";
|
$sql.= "vote = ".(integer) $this->db->escape($this->vote).",";
|
||||||
$sql.= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
|
$sql.= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
|
||||||
@ -383,17 +396,16 @@ class AdherentType extends CommonObject
|
|||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
|
$this->description = $this->db->escape($this->note);
|
||||||
$this->description = $this->db->escape($this->note);
|
|
||||||
|
|
||||||
// Multilangs
|
// Multilangs
|
||||||
if (! empty($conf->global->MAIN_MULTILANGS)) {
|
if (! empty($conf->global->MAIN_MULTILANGS)) {
|
||||||
if ($this->setMultiLangs($user) < 0) {
|
if ($this->setMultiLangs($user) < 0) {
|
||||||
$this->error=$langs->trans("Error")." : ".$this->db->error()." - ".$sql;
|
$this->error=$langs->trans("Error")." : ".$this->db->error()." - ".$sql;
|
||||||
return -2;
|
return -2;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$action='update';
|
$action='update';
|
||||||
|
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
@ -475,9 +487,9 @@ class AdherentType extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function fetch($rowid)
|
public function fetch($rowid)
|
||||||
{
|
{
|
||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
|
|
||||||
$sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut, d.subscription, d.mail_valid, d.note, d.vote";
|
$sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut, d.duration, d.subscription, d.mail_valid, d.note, d.vote";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
|
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
|
||||||
$sql .= " WHERE d.rowid = ".(int) $rowid;
|
$sql .= " WHERE d.rowid = ".(int) $rowid;
|
||||||
|
|
||||||
@ -495,15 +507,18 @@ class AdherentType extends CommonObject
|
|||||||
$this->label = $obj->label;
|
$this->label = $obj->label;
|
||||||
$this->morphy = $obj->morphy;
|
$this->morphy = $obj->morphy;
|
||||||
$this->statut = $obj->statut;
|
$this->statut = $obj->statut;
|
||||||
|
$this->duration = $obj->duration;
|
||||||
|
$this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration)-1);
|
||||||
|
$this->duration_unit = substr($obj->duration, -1);
|
||||||
$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;
|
||||||
|
|
||||||
// multilangs
|
// multilangs
|
||||||
if (! empty($conf->global->MAIN_MULTILANGS)) {
|
if (! empty($conf->global->MAIN_MULTILANGS)) {
|
||||||
$this->getMultiLangs();
|
$this->getMultiLangs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -70,7 +70,7 @@ class AdherentStats extends Stats
|
|||||||
|
|
||||||
$this->where.= " m.statut != 0";
|
$this->where.= " m.statut != 0";
|
||||||
$this->where.= " AND p.fk_adherent = m.rowid AND m.entity IN (".getEntity('adherent').")";
|
$this->where.= " AND p.fk_adherent = m.rowid AND m.entity IN (".getEntity('adherent').")";
|
||||||
//if (!$user->rights->societe->client->voir && !$user->societe_id) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
//if (!$user->rights->societe->client->voir && !$user->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
if($this->memberid)
|
if($this->memberid)
|
||||||
{
|
{
|
||||||
$this->where .= " AND m.rowid = ".$this->memberid;
|
$this->where .= " AND m.rowid = ".$this->memberid;
|
||||||
@ -92,7 +92,7 @@ class AdherentStats extends Stats
|
|||||||
|
|
||||||
$sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)";
|
$sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)";
|
||||||
$sql.= " FROM ".$this->from;
|
$sql.= " FROM ".$this->from;
|
||||||
//if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
|
$sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
|
||||||
$sql.= " AND ".$this->where;
|
$sql.= " AND ".$this->where;
|
||||||
$sql.= " GROUP BY dm";
|
$sql.= " GROUP BY dm";
|
||||||
@ -112,7 +112,7 @@ class AdherentStats extends Stats
|
|||||||
|
|
||||||
$sql = "SELECT date_format(p.dateadh,'%Y') as dm, count(*)";
|
$sql = "SELECT date_format(p.dateadh,'%Y') as dm, count(*)";
|
||||||
$sql.= " FROM ".$this->from;
|
$sql.= " FROM ".$this->from;
|
||||||
//if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= " WHERE ".$this->where;
|
$sql.= " WHERE ".$this->where;
|
||||||
$sql.= " GROUP BY dm";
|
$sql.= " GROUP BY dm";
|
||||||
$sql.= $this->db->order('dm', 'DESC');
|
$sql.= $this->db->order('dm', 'DESC');
|
||||||
@ -133,7 +133,7 @@ class AdherentStats extends Stats
|
|||||||
|
|
||||||
$sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")";
|
$sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")";
|
||||||
$sql.= " FROM ".$this->from;
|
$sql.= " FROM ".$this->from;
|
||||||
//if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
|
$sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
|
||||||
$sql.= " AND ".$this->where;
|
$sql.= " AND ".$this->where;
|
||||||
$sql.= " GROUP BY dm";
|
$sql.= " GROUP BY dm";
|
||||||
|
|||||||
@ -431,10 +431,10 @@ class Subscription extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Renvoi le libelle d'un statut donne
|
* Renvoi le libelle d'un statut donne
|
||||||
*
|
*
|
||||||
* @param int $statut Id statut
|
* @param int $status Id status
|
||||||
* @return string Label
|
* @return string Label
|
||||||
*/
|
*/
|
||||||
public function LibStatut($statut)
|
public function LibStatut($status)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|||||||
@ -90,7 +90,6 @@ if ($id > 0)
|
|||||||
$result=$membert->fetch($object->typeid);
|
$result=$membert->fetch($object->typeid);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Build file list
|
// Build file list
|
||||||
$filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
|
$filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
|
||||||
$totalsize=0;
|
$totalsize=0;
|
||||||
|
|||||||
@ -42,7 +42,7 @@ if (empty($sortorder)) { $sortorder="ASC"; }
|
|||||||
if (empty($sortfield)) { $sortfield="d.login"; }
|
if (empty($sortfield)) { $sortfield="d.login"; }
|
||||||
if (! isset($statut))
|
if (! isset($statut))
|
||||||
{
|
{
|
||||||
$statut = 1 ;
|
$statut = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! isset($cotis))
|
if (! isset($cotis))
|
||||||
@ -54,7 +54,7 @@ if (! isset($cotis))
|
|||||||
|
|
||||||
$sql = "SELECT d.login, d.pass, d.datefin";
|
$sql = "SELECT d.login, d.pass, d.datefin";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d ";
|
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d ";
|
||||||
$sql .= " WHERE d.statut = $statut ";
|
$sql .= " WHERE d.statut = ".$statut;
|
||||||
if ($cotis==1)
|
if ($cotis==1)
|
||||||
{
|
{
|
||||||
$sql .= " AND datefin > '".$db->idate($now)."'";
|
$sql .= " AND datefin > '".$db->idate($now)."'";
|
||||||
|
|||||||
@ -61,7 +61,7 @@ $AdherentsResilies=array();
|
|||||||
|
|
||||||
$AdherentType=array();
|
$AdherentType=array();
|
||||||
|
|
||||||
// Members list
|
// Type of membership
|
||||||
$sql = "SELECT t.rowid, t.libelle as label, 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";
|
||||||
@ -71,7 +71,7 @@ $sql.= " AND d.entity IN (".getEntity('adherent').")";
|
|||||||
$sql.= " WHERE t.entity IN (".getEntity('member_type').")";
|
$sql.= " WHERE t.entity IN (".getEntity('member_type').")";
|
||||||
$sql.= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
|
$sql.= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
|
||||||
|
|
||||||
dol_syslog("index.php::select nb of members by type", LOG_DEBUG);
|
dol_syslog("index.php::select nb of members per type", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
@ -140,6 +140,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
|
|||||||
{
|
{
|
||||||
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
|
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder nohover centpercent">';
|
print '<table class="noborder nohover centpercent">';
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach($listofsearchfields as $key => $value)
|
foreach($listofsearchfields as $key => $value)
|
||||||
@ -152,6 +153,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
@ -165,7 +167,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
|
|||||||
if ($conf->use_javascript_ajax)
|
if ($conf->use_javascript_ajax)
|
||||||
{
|
{
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder nohover" width="100%">';
|
print '<table class="noborder nohover centpercent">';
|
||||||
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
|
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
|
||||||
print '<tr><td class="center" colspan="2">';
|
print '<tr><td class="center" colspan="2">';
|
||||||
|
|
||||||
@ -227,10 +229,8 @@ $sql = "SELECT c.subscription, c.dateadh as dateh";
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
|
||||||
$sql.= " WHERE d.entity IN (".getEntity('adherent').")";
|
$sql.= " WHERE d.entity IN (".getEntity('adherent').")";
|
||||||
$sql.= " AND d.rowid = c.fk_adherent";
|
$sql.= " AND d.rowid = c.fk_adherent";
|
||||||
if(isset($date_select) && $date_select != '')
|
|
||||||
{
|
|
||||||
$sql .= " AND c.dateadh LIKE '".$date_select."%'";
|
|
||||||
}
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
@ -249,23 +249,35 @@ if ($result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<th>'.$langs->trans("Subscriptions").'</th>';
|
print '<th>'.$langs->trans("Year").'</th>';
|
||||||
print '<th class="right">'.$langs->trans("Number").'</th>';
|
print '<th class="right">'.$langs->trans("Subscriptions").'</th>';
|
||||||
print '<th class="right">'.$langs->trans("AmountTotal").'</th>';
|
print '<th class="right">'.$langs->trans("AmountTotal").'</th>';
|
||||||
print '<th class="right">'.$langs->trans("AmountAverage").'</th>';
|
print '<th class="right">'.$langs->trans("AmountAverage").'</th>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
krsort($Total);
|
krsort($Total);
|
||||||
|
$i = 0;
|
||||||
foreach ($Total as $key=>$value)
|
foreach ($Total as $key=>$value)
|
||||||
{
|
{
|
||||||
print '<tr class="oddeven">';
|
if ($i >= 8)
|
||||||
|
{
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print "<td>...</td>";
|
||||||
|
print "<td class=\"right\"></td>";
|
||||||
|
print "<td class=\"right\"></td>";
|
||||||
|
print "<td class=\"right\"></td>";
|
||||||
|
print "</tr>\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
print '<tr class="oddeven">';
|
||||||
print "<td><a href=\"./subscription/list.php?date_select=$key\">$key</a></td>";
|
print "<td><a href=\"./subscription/list.php?date_select=$key\">$key</a></td>";
|
||||||
print "<td class=\"right\">".$Number[$key]."</td>";
|
print "<td class=\"right\">".$Number[$key]."</td>";
|
||||||
print "<td class=\"right\">".price($value)."</td>";
|
print "<td class=\"right\">".price($value)."</td>";
|
||||||
print "<td class=\"right\">".price(price2num($value/$Number[$key], 'MT'))."</td>";
|
print "<td class=\"right\">".price(price2num($value/$Number[$key], 'MT'))."</td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Total
|
// Total
|
||||||
@ -282,7 +294,7 @@ print "<br>\n";
|
|||||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Last modified members
|
* Latest modified members
|
||||||
*/
|
*/
|
||||||
$max=5;
|
$max=5;
|
||||||
|
|
||||||
@ -299,7 +311,7 @@ $resql=$db->query($sql);
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<th colspan="4">'.$langs->trans("LastMembersModified", $max).'</th></tr>';
|
print '<th colspan="4">'.$langs->trans("LastMembersModified", $max).'</th></tr>';
|
||||||
|
|
||||||
@ -330,7 +342,7 @@ if ($resql)
|
|||||||
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>';
|
||||||
print '<td class="right">'.$staticmember->LibStatut($obj->statut, ($obj->subscription=='yes'?1:0), $db->jdate($obj->date_end_subscription), 5).'</td>';
|
print '<td class="right">'.$staticmember->LibStatut($obj->statut, ($obj->subscription=='yes'?1:0), $db->jdate($obj->date_end_subscription), 3).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -362,7 +374,7 @@ $resql=$db->query($sql);
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<th colspan="5">'.$langs->trans("LastSubscriptionsModified", $max).'</th></tr>';
|
print '<th colspan="5">'.$langs->trans("LastSubscriptionsModified", $max).'</th></tr>';
|
||||||
|
|
||||||
@ -408,7 +420,7 @@ else
|
|||||||
|
|
||||||
// Summary of members by type
|
// Summary of members by type
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<th>'.$langs->trans("MembersTypes").'</th>';
|
print '<th>'.$langs->trans("MembersTypes").'</th>';
|
||||||
print '<th class=right>'.$langs->trans("MembersStatusToValid").'</th>';
|
print '<th class=right>'.$langs->trans("MembersStatusToValid").'</th>';
|
||||||
|
|||||||
@ -37,9 +37,9 @@ $action = GETPOST('action', 'aZ09');
|
|||||||
|
|
||||||
// Protection
|
// Protection
|
||||||
$socid=0;
|
$socid=0;
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
{
|
{
|
||||||
$socid = $user->societe_id;
|
$socid = $user->socid;
|
||||||
}
|
}
|
||||||
|
|
||||||
$object = new Adherent($db);
|
$object = new Adherent($db);
|
||||||
|
|||||||
@ -232,8 +232,8 @@ if (empty($reshook))
|
|||||||
// Mass actions
|
// Mass actions
|
||||||
$objectclass='Adherent';
|
$objectclass='Adherent';
|
||||||
$objectlabel='Members';
|
$objectlabel='Members';
|
||||||
$permtoread = $user->rights->adherent->lire;
|
$permissiontoread = $user->rights->adherent->lire;
|
||||||
$permtodelete = $user->rights->adherent->supprimer;
|
$permissiontodelete = $user->rights->adherent->supprimer;
|
||||||
$uploaddir = $conf->adherent->dir_output;
|
$uploaddir = $conf->adherent->dir_output;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
}
|
}
|
||||||
@ -681,6 +681,7 @@ while ($i < min($num, $limit))
|
|||||||
$memberstatic->datefin= $datefin;
|
$memberstatic->datefin= $datefin;
|
||||||
$memberstatic->socid = $obj->fk_soc;
|
$memberstatic->socid = $obj->fk_soc;
|
||||||
$memberstatic->photo = $obj->photo;
|
$memberstatic->photo = $obj->photo;
|
||||||
|
$memberstatic->morphy = $obj->morphy;
|
||||||
|
|
||||||
if (! empty($obj->fk_soc)) {
|
if (! empty($obj->fk_soc)) {
|
||||||
$memberstatic->fetch_thirdparty();
|
$memberstatic->fetch_thirdparty();
|
||||||
@ -918,26 +919,8 @@ while ($i < min($num, $limit))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show total line
|
// Show total line
|
||||||
if (isset($totalarray['pos']))
|
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||||
{
|
|
||||||
print '<tr class="liste_total">';
|
|
||||||
$i=0;
|
|
||||||
while ($i < $totalarray['nbfield'])
|
|
||||||
{
|
|
||||||
$i++;
|
|
||||||
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($i == 1)
|
|
||||||
{
|
|
||||||
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
|
|
||||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
|
||||||
}
|
|
||||||
else print '<td></td>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// If no record found
|
// If no record found
|
||||||
if ($num == 0)
|
if ($num == 0)
|
||||||
|
|||||||
@ -33,10 +33,10 @@ $mode=GETPOST('mode')?GETPOST('mode'):'';
|
|||||||
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
$socid = $user->societe_id;
|
$socid = $user->socid;
|
||||||
}
|
}
|
||||||
$result=restrictedArea($user, 'adherent', '', '', 'cotisation');
|
$result=restrictedArea($user, 'adherent', '', '', 'cotisation');
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Print array
|
// Print array
|
||||||
print '<table class="liste" width="100%">';
|
print '<table class="liste centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Nature").'</td>';
|
print '<td>'.$langs->trans("Nature").'</td>';
|
||||||
print '<td class="right">'.$langs->trans("NbOfMembers").'</td>';
|
print '<td class="right">'.$langs->trans("NbOfMembers").'</td>';
|
||||||
|
|||||||
@ -34,10 +34,10 @@ $mode=GETPOST('mode')?GETPOST('mode'):'';
|
|||||||
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
$socid = $user->societe_id;
|
$socid = $user->socid;
|
||||||
}
|
}
|
||||||
$result=restrictedArea($user, 'adherent', '', '', 'cotisation');
|
$result=restrictedArea($user, 'adherent', '', '', 'cotisation');
|
||||||
|
|
||||||
@ -294,7 +294,7 @@ if (count($arrayjs) && $mode == 'memberbycountry')
|
|||||||
if ($mode)
|
if ($mode)
|
||||||
{
|
{
|
||||||
// Print array / Affiche le tableau
|
// Print array / Affiche le tableau
|
||||||
print '<table class="liste" width="100%">';
|
print '<table class="liste centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$label.'</td>';
|
print '<td>'.$label.'</td>';
|
||||||
if ($label2) print '<td class="center">'.$label2.'</td>';
|
if ($label2) print '<td class="center">'.$label2.'</td>';
|
||||||
|
|||||||
@ -35,10 +35,10 @@ $userid=GETPOST('userid', 'int'); if ($userid < 0) $userid=0;
|
|||||||
$socid=GETPOST('socid', 'int'); if ($socid < 0) $socid=0;
|
$socid=GETPOST('socid', 'int'); if ($socid < 0) $socid=0;
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->socid > 0)
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
$socid = $user->societe_id;
|
$socid = $user->socid;
|
||||||
}
|
}
|
||||||
$result=restrictedArea($user, 'adherent', '', '', 'cotisation');
|
$result=restrictedArea($user, 'adherent', '', '', 'cotisation');
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
|||||||
|
|
||||||
// Show filter box
|
// Show filter box
|
||||||
/*print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
/*print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("Member").'</td><td>';
|
print '<tr><td>'.$langs->trans("Member").'</td><td>';
|
||||||
print $form->select_company($id,'memberid','',1);
|
print $form->select_company($id,'memberid','',1);
|
||||||
@ -211,7 +211,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
|||||||
|
|
||||||
|
|
||||||
// Show graphs
|
// Show graphs
|
||||||
print '<table class="border" width="100%"><tr class="pair nohover"><td class="center">';
|
print '<table class="border centpercent"><tr class="pair nohover"><td class="center">';
|
||||||
if ($mesg) { print $mesg; }
|
if ($mesg) { print $mesg; }
|
||||||
else {
|
else {
|
||||||
print $px1->show();
|
print $px1->show();
|
||||||
|
|||||||
@ -689,7 +689,7 @@ if ($rowid > 0)
|
|||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">'."\n";
|
print '<table class="noborder centpercent">'."\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'c.rowid', '', $param, '', $sortfield, $sortorder);
|
print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'c.rowid', '', $param, '', $sortfield, $sortorder);
|
||||||
|
|||||||
@ -197,7 +197,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
|||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
print "\n";
|
print "\n";
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
||||||
@ -307,7 +307,7 @@ if ($rowid && $action != 'edit')
|
|||||||
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
// Member
|
// Member
|
||||||
$adh->ref=$adh->getFullName($langs);
|
$adh->ref=$adh->getFullName($langs);
|
||||||
|
|||||||
@ -588,26 +588,8 @@ while ($i < min($num, $limit))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show total line
|
// Show total line
|
||||||
if (isset($totalarray['pos']))
|
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||||
{
|
|
||||||
print '<tr class="liste_total">';
|
|
||||||
$i=0;
|
|
||||||
while ($i < $totalarray['nbfield'])
|
|
||||||
{
|
|
||||||
$i++;
|
|
||||||
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($i == 1)
|
|
||||||
{
|
|
||||||
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
|
|
||||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
|
||||||
}
|
|
||||||
else print '<td></td>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// If no record found
|
// If no record found
|
||||||
if ($num == 0)
|
if ($num == 0)
|
||||||
|
|||||||
@ -24,11 +24,7 @@ if (empty($conf) || ! is_object($conf))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
echo "<!-- BEGIN PHP TEMPLATE -->\n";
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE -->
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
@ -39,23 +35,20 @@ $langs->load("members");
|
|||||||
$total=0;
|
$total=0;
|
||||||
foreach($linkedObjectBlock as $key => $objectlink)
|
foreach($linkedObjectBlock as $key => $objectlink)
|
||||||
{
|
{
|
||||||
|
echo '<tr class="oddeven">';
|
||||||
?>
|
echo '<td>'.$langs->trans("Subscription").'</td>';
|
||||||
<tr class="oddeven" >
|
echo '<td>'.$objectlink->getNomUrl(1).'</td>';
|
||||||
<td><?php echo $langs->trans("Subscription"); ?></td>
|
echo '<td class="center"></td>';
|
||||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
echo '<td class="center">'.dol_print_date($objectlink->dateh, 'day').'</td>';
|
||||||
<td class="center"></td>
|
echo '<td class="right">';
|
||||||
<td class="center"><?php echo dol_print_date($objectlink->dateh, 'day'); ?></td>
|
|
||||||
<td class="right"><?php
|
|
||||||
if ($user->rights->adherent->lire) {
|
if ($user->rights->adherent->lire) {
|
||||||
$total = $total + $objectlink->amount;
|
$total = $total + $objectlink->amount;
|
||||||
echo price($objectlink->amount);
|
echo price($objectlink->amount);
|
||||||
} ?></td>
|
}
|
||||||
<td class="right"></td>
|
echo '</td>';
|
||||||
<td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
|
echo '<td class="right"></td>';
|
||||||
</tr>
|
echo '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
|
||||||
<?php
|
echo '</tr>';
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
||||||
<!-- END PHP TEMPLATE -->
|
echo "<!-- END PHP TEMPLATE -->\n";
|
||||||
|
|||||||
@ -32,6 +32,7 @@ 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.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||||
|
|
||||||
$langs->load("members");
|
$langs->load("members");
|
||||||
|
|
||||||
@ -61,6 +62,8 @@ $label=GETPOST("label", "alpha");
|
|||||||
$morphy=GETPOST("morphy", "alpha");
|
$morphy=GETPOST("morphy", "alpha");
|
||||||
$statut=GETPOST("statut", "int");
|
$statut=GETPOST("statut", "int");
|
||||||
$subscription=GETPOST("subscription", "int");
|
$subscription=GETPOST("subscription", "int");
|
||||||
|
$duration_value = GETPOST('duration_value', 'int');
|
||||||
|
$duration_unit = GETPOST('duration_unit', 'alpha');
|
||||||
$vote=GETPOST("vote", "int");
|
$vote=GETPOST("vote", "int");
|
||||||
$comment=GETPOST("comment", 'alphanohtml');
|
$comment=GETPOST("comment", 'alphanohtml');
|
||||||
$mail_valid=GETPOST("mail_valid", 'none');
|
$mail_valid=GETPOST("mail_valid", 'none');
|
||||||
@ -94,7 +97,6 @@ $hookmanager->initHooks(array('membertypecard','globalcard'));
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ($cancel) {
|
if ($cancel) {
|
||||||
|
|
||||||
$action='';
|
$action='';
|
||||||
|
|
||||||
if (! empty($backtopage)) {
|
if (! empty($backtopage)) {
|
||||||
@ -105,9 +107,11 @@ if ($cancel) {
|
|||||||
|
|
||||||
if ($action == 'add' && $user->rights->adherent->configurer) {
|
if ($action == 'add' && $user->rights->adherent->configurer) {
|
||||||
$object->label = trim($label);
|
$object->label = trim($label);
|
||||||
$object->morphy = trim($morphy);
|
$object->morphy = trim($morphy);
|
||||||
$object->statut = (int) $statut;
|
$object->statut = (int) $statut;
|
||||||
$object->subscription = (int) $subscription;
|
$object->subscription = (int) $subscription;
|
||||||
|
$object->duration_value = $duration_value;
|
||||||
|
$object->duration_unit = $duration_unit;
|
||||||
$object->note = trim($comment);
|
$object->note = trim($comment);
|
||||||
$object->mail_valid = trim($mail_valid);
|
$object->mail_valid = trim($mail_valid);
|
||||||
$object->vote = (int) $vote;
|
$object->vote = (int) $vote;
|
||||||
@ -160,9 +164,11 @@ if ($action == 'update' && $user->rights->adherent->configurer)
|
|||||||
$object->oldcopy = clone $object;
|
$object->oldcopy = clone $object;
|
||||||
|
|
||||||
$object->label = trim($label);
|
$object->label = trim($label);
|
||||||
$object->morphy = trim($morphy);
|
$object->morphy = trim($morphy);
|
||||||
$object->statut = (int) $statut;
|
$object->statut = (int) $statut;
|
||||||
$object->subscription = (int) $subscription;
|
$object->subscription = (int) $subscription;
|
||||||
|
$object->duration_value = $duration_value;
|
||||||
|
$object->duration_unit = $duration_unit;
|
||||||
$object->note = trim($comment);
|
$object->note = trim($comment);
|
||||||
$object->mail_valid = trim($mail_valid);
|
$object->mail_valid = trim($mail_valid);
|
||||||
$object->vote = (boolean) trim($vote);
|
$object->vote = (boolean) trim($vote);
|
||||||
@ -210,6 +216,7 @@ if ($action == 'confirm_delete' && $user->rights->adherent->configurer)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
$formproduct = new FormProduct($db);
|
||||||
|
|
||||||
llxHeader('', $langs->trans("MembersTypeSetup"), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
llxHeader('', $langs->trans("MembersTypeSetup"), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||||
|
|
||||||
@ -330,7 +337,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
dol_fiche_head('');
|
dol_fiche_head('');
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
print '<tbody>';
|
print '<tbody>';
|
||||||
|
|
||||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
|
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
|
||||||
@ -355,6 +362,11 @@ if ($action == 'create')
|
|||||||
print $form->selectyesno("vote", 0, 1);
|
print $form->selectyesno("vote", 0, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3">';
|
||||||
|
print '<input name="duration_value" size="5" value="'.$_POST["duration_value"].'"> ';
|
||||||
|
print $formproduct->selectMeasuringUnits("duration_unit", "time", $_POST["duration_unit"], 0, 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||||
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3"></textarea></td></tr>';
|
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3"></textarea></td></tr>';
|
||||||
|
|
||||||
@ -418,7 +430,7 @@ if ($rowid > 0)
|
|||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Status").'</td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans("Status").'</td><td>';
|
||||||
if ( !empty($object->statut) ) {
|
if ( !empty($object->statut) ) {
|
||||||
@ -440,6 +452,18 @@ if ($rowid > 0)
|
|||||||
print yn($object->vote);
|
print yn($object->vote);
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
print '<tr><td class="titlefield">'.$langs->trans("Duration").'</td><td colspan="2">'.$object->duration_value.' ';
|
||||||
|
if ($object->duration_value > 1)
|
||||||
|
{
|
||||||
|
$dur=array("i"=>$langs->trans("Minute"),"h"=>$langs->trans("Hours"),"d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years"));
|
||||||
|
}
|
||||||
|
elseif ($object->duration_value > 0)
|
||||||
|
{
|
||||||
|
$dur=array("i"=>$langs->trans("Minute"),"h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year"));
|
||||||
|
}
|
||||||
|
print (! empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')." ";
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||||
print nl2br($object->note)."</td></tr>";
|
print nl2br($object->note)."</td></tr>";
|
||||||
|
|
||||||
@ -524,14 +548,14 @@ if ($rowid > 0)
|
|||||||
{
|
{
|
||||||
$sql.= natural_search("d.email", $search_email);
|
$sql.= natural_search("d.email", $search_email);
|
||||||
}
|
}
|
||||||
if ($filter == 'uptodate')
|
if ($filter == 'uptodate')
|
||||||
{
|
{
|
||||||
$sql.=" AND (datefin >= '".$db->idate($now)."') OR t.subscription = 0)";
|
$sql.=" AND (datefin >= '".$db->idate($now)."') OR t.subscription = 0)";
|
||||||
}
|
}
|
||||||
if ($filter == 'outofdate')
|
if ($filter == 'outofdate')
|
||||||
{
|
{
|
||||||
$sql.=" AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)";
|
$sql.=" AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql.= " ".$db->order($sortfield, $sortorder);
|
$sql.= " ".$db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
@ -593,6 +617,7 @@ if ($rowid > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
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 class="flat" type="hidden" name="rowid" value="'.$object->id.'" size="12"></td>';
|
print '<input class="flat" type="hidden" name="rowid" value="'.$object->id.'" size="12"></td>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -762,7 +787,7 @@ if ($rowid > 0)
|
|||||||
|
|
||||||
dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
|
dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->id.'</td></tr>';
|
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->id.'</td></tr>';
|
||||||
|
|
||||||
@ -788,6 +813,11 @@ if ($rowid > 0)
|
|||||||
print $form->selectyesno("vote", $object->vote, 1);
|
print $form->selectyesno("vote", $object->vote, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3">';
|
||||||
|
print '<input name="duration_value" size="5" value="'.$object->duration_value.'"> ';
|
||||||
|
print $formproduct->selectMeasuringUnits("duration_unit", "time", $object->duration_unit, 0, 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||||
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3">'.$object->note.'</textarea></td></tr>';
|
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3">'.$object->note.'</textarea></td></tr>';
|
||||||
|
|
||||||
@ -797,9 +827,12 @@ if ($rowid > 0)
|
|||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
|
// Other attributes
|
||||||
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $act, $action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
@ -808,33 +841,6 @@ if ($rowid > 0)
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
// Extra field
|
|
||||||
if (empty($reshook))
|
|
||||||
{
|
|
||||||
print '<br><br><table class="border" width="100%">';
|
|
||||||
if (is_array($extrafields->attributes['adherent_type']['label']))
|
|
||||||
{
|
|
||||||
foreach($extrafields->attributes['adherent_type']['label'] as $key=>$label)
|
|
||||||
{
|
|
||||||
if (isset($_POST["options_" . $key])) {
|
|
||||||
if (is_array($_POST["options_" . $key])) {
|
|
||||||
// $_POST["options"] is an array but following code expects a comma separated string
|
|
||||||
$value = implode(",", $_POST["options_" . $key]);
|
|
||||||
} else {
|
|
||||||
$value = $_POST["options_" . $key];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$value = $object->array_options["options_" . $key];
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<tr><td width="30%">'.$label.'</td><td>';
|
|
||||||
print $extrafields->showInputField($key, $value);
|
|
||||||
print "</td></tr>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print '</table><br><br>';
|
|
||||||
}
|
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
|
|||||||
@ -99,7 +99,7 @@ dol_banner_tab($object, 'rowid', $linkback);
|
|||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
// LDAP DN
|
// LDAP DN
|
||||||
print '<tr><td>LDAP '.$langs->trans("LDAPMemberTypeDn").'</td><td class="valeur">'.$conf->global->LDAP_MEMBER_TYPE_DN."</td></tr>\n";
|
print '<tr><td>LDAP '.$langs->trans("LDAPMemberTypeDn").'</td><td class="valeur">'.$conf->global->LDAP_MEMBER_TYPE_DN."</td></tr>\n";
|
||||||
|
|||||||
@ -41,7 +41,7 @@ $cancel=GETPOST('cancel', 'alpha');
|
|||||||
// Security check
|
// Security check
|
||||||
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
|
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
|
||||||
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
|
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->socid) $socid=$user->socid;
|
||||||
// Security check
|
// Security check
|
||||||
$result=restrictedArea($user, 'adherent', $id, 'adherent_type');
|
$result=restrictedArea($user, 'adherent', $id, 'adherent_type');
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ if ($action == 'edit')
|
|||||||
print "<br>".($s?$s.' ':'')." <b>".$langs->trans('Language_'.$key).":</b> ".'<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=delete&langtodelete='.$key.'">'.img_delete('', 'class="valigntextbottom"')."</a><br>";
|
print "<br>".($s?$s.' ':'')." <b>".$langs->trans('Language_'.$key).":</b> ".'<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=delete&langtodelete='.$key.'">'.img_delete('', 'class="valigntextbottom"')."</a><br>";
|
||||||
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
print '<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.dol_escape_htmltag($object->multilangs[$key]["label"]).'"></td></tr>';
|
print '<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.dol_escape_htmltag($object->multilangs[$key]["label"]).'"></td></tr>';
|
||||||
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
|
||||||
$doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_3, '90%');
|
$doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_3, '90%');
|
||||||
@ -264,7 +264,7 @@ elseif ($action != 'add')
|
|||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
print '<tr><td class="titlefieldcreate">'.$langs->trans('Label').'</td><td>'.$object->multilangs[$key]["label"].'</td></tr>';
|
print '<tr><td class="titlefieldcreate">'.$langs->trans('Label').'</td><td>'.$object->multilangs[$key]["label"].'</td></tr>';
|
||||||
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>'.$object->multilangs[$key]["description"].'</td></tr>';
|
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>'.$object->multilangs[$key]["description"].'</td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -293,9 +293,9 @@ if ($action == 'add' && $user->rights->adherent->configurer)
|
|||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border centpercent">';
|
||||||
print '<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans('Language').'</td><td>';
|
print '<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans('Language').'</td><td>';
|
||||||
print $formadmin->select_language('', 'forcelangprod', 0, $object->multilangs, 1);
|
print $formadmin->select_language('', 'forcelangprod', 0, $object->multilangs, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" size="40"></td></tr>';
|
print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" size="40"></td></tr>';
|
||||||
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
|
||||||
|
|||||||