Merge branch 'develop' into New_manage_loan_schedule

This commit is contained in:
Laurent Destailleur 2018-12-14 10:54:09 +01:00 committed by GitHub
commit fec64a78ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2619 changed files with 103025 additions and 56145 deletions

View File

@ -6,8 +6,8 @@ Laurent Destailleur <eldy@destailleur.fr> eldy <eldy@destailleur.fr>
Laurent Destailleur <eldy@destailleur.fr> Laurent Destailleur <ldestailleur@teclib.com> Laurent Destailleur <eldy@destailleur.fr> Laurent Destailleur <ldestailleur@teclib.com>
Laurent Destailleur <eldy@destailleur.fr> eldy10 <eldy10@master8.(none)> Laurent Destailleur <eldy@destailleur.fr> eldy10 <eldy10@master8.(none)>
Laurent Destailleur <eldy@destailleur.fr> Laurent Destailleur <ephpcsdy@destailleur.fr> Laurent Destailleur <eldy@destailleur.fr> Laurent Destailleur <ephpcsdy@destailleur.fr>
Regis Houssin <regis.houssin@capnetworks.com> Regis Houssin <regis@dolibarr.fr> Regis Houssin <regis.houssin@inodbox.com> Regis Houssin <regis@dolibarr.fr>
Regis Houssin <regis.houssin@capnetworks.com> Régis Houssin <regishoussin@device5.home> Regis Houssin <regis.houssin@inodbox.com> Régis Houssin <regishoussin@device5.home>
Juanjo Menent <jmenent@2byte.es> simnandez <jmenent@2byte.es> Juanjo Menent <jmenent@2byte.es> simnandez <jmenent@2byte.es>
Juanjo Menent <jmenent@2byte.es> Juanjo Menent <simnandez@gmail.com> Juanjo Menent <jmenent@2byte.es> Juanjo Menent <simnandez@gmail.com>
Juanjo Menent <jmenent@2byte.es> Simnandez <jmenent@2byte.es> Juanjo Menent <jmenent@2byte.es> Simnandez <jmenent@2byte.es>

View File

@ -2,7 +2,7 @@
# from Dolibarr GitHub repository. # from Dolibarr GitHub repository.
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/ # For syntax, see http://about.travis-ci.org/docs/user/languages/php/
# We use dist: trusty to have php 5.4+ available # We use dist: trusty to have php 5.4+ available
dist: trusty dist: trusty
sudo: required sudo: required
@ -288,7 +288,8 @@ script:
echo "Checking PHP syntax errors" echo "Checking PHP syntax errors"
# Ensure we catch errors # Ensure we catch errors
set -e set -e
parallel-lint --exclude htdocs/includes --blame . #parallel-lint --exclude htdocs/includes --blame .
parallel-lint --exclude htdocs/includes/sabre --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame .
set +e set +e
echo echo
@ -341,6 +342,9 @@ script:
php upgrade.php 8.0.0 9.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade800900.log php upgrade.php 8.0.0 9.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade800900.log
php upgrade2.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-2.log php upgrade2.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-2.log
php step5.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-3.log php step5.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-3.log
php upgrade.php 9.0.0 10.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log
php upgrade2.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log
php step5.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log
cd - cd -
set +e set +e
echo echo

189
ChangeLog
View File

@ -5,29 +5,204 @@ English Dolibarr ChangeLog
***** ChangeLog for 9.0.0 compared to 8.0.0 ***** ***** ChangeLog for 9.0.0 compared to 8.0.0 *****
For Users: For Users:
NEW: Stable module: DAV (WebDAV only for the moment)
NEW: Stable module "Skype" has been replaced with module "Social Networks" to support more services.
NEW: Stable module "Module Builder"
NEW: Stable module: Website NEW: Stable module: Website
NEW: Stable module: WebDAV
NEW: Stable module: Module Builder
NEW: Stable module "Skype" has been replaced with module "Social Networks" to support more tools.
NEW: Experimental module "TakePos" NEW: Experimental module "TakePos"
NEW: Experimental module "Ticket"
NEW: Experimental module "Data Privacy"
NEW: Experimental module "Email Collector"
NEW: Dolibarr can provide information in page title when multicompany is enabled of not, making NEW: Dolibarr can provide information in page title when multicompany is enabled of not, making
Android application like DoliDroid able to provide native features for multicompany module. Android application like DoliDroid able to provide native features for multicompany module.
NEW: Compatibility with PHP 7.3 NEW: Compatibility with PHP 7.3 =>
NEW: Add admin page for modulebuilder
NEW: Add civility in list of members. Close #9251
NEW: Add configuration to disable "customer/prospect" thirdparty type
NEW: Add CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY and CONTRACT_HIDE_UNSELECTABLES by SELECT_HIDE_UNSELECTABLES
NEW: Add __DAY_TEXT__ and __MONTH_TEXT__ substitutions vars
NEW: Add due date column in payment lists
NEW: Add email in event history, for reminder email of expired subsription
NEW: Add event tab on resource record
NEW: Add FEC Export in accountancy
NEW: Add filter on staff range in list of thirdparties
NEW: Add a first complete template of website
NEW: Add format code into exported filename of ledger
NEW: Add hidden option EXPENSEREPORT_DEFAULT_VALIDATOR_UNCHANGEABLE
NEW: Add hidden option MAIN_DOCUMENTS_DESCRIPTION_FIRST
NEW: Add link to inventory code
NEW: Add more common social networks fields for business
NEW: Add option PDF_DISABLE_MYCOMPANY_LOGO to disable logo on PDF
NEW: add option PROPOSAL_AUTO_ADD_AUTHOR_AS_CONTACT
NEW: Add option to display thirdparty adress in combolist
NEW: Add option to swap sender/recipient address on PDF
NEW: Add option to display thirdparty adress in combolist
NEW: Add project on pament of salaries
NEW: Add SHIPPING_PDF_HIDE_WEIGHT_AND_VOLUME and
NEW: Add somes hooks in bank planned entries
NEW: Add supplier ref in item reception page
NEW: Advanced permission to ignore price min
NEW: Allow to enter a timespent with a numeric value
NEW: Automatic position of scroll when creating an extrafield
NEW: Can add autorefresh=X in any URLs to refresh page after X seconds
NEW: can add project's task to agenda on create event form
NEW: Can delete a website in experimental website module
NEW: Can disable meteo on smartphone only
NEW: Can export/import a website template
NEW: Can filter on EEC, not EEC, etc... in binding step of accountancy
NEW: Can mix offset before and after with rules for due date of invoices
NEW: Can record the supplier product description
NEW: Can select several prospect level in thirdparty filter.
NEW: Can set 2 url in url field of thirdparty
NEW: Can set if a field is mandatory on form level.
NEW: Can set the default focus of each page.
NEW: Add category filter on user list
NEW: Change forgotten password link in general parameters
NEW: Child label of variants change if parent label changes
NEW: Compatibility with new Paybox HMAC requirement
NEW: Each user can set its prefered default calendar page
NEW: Enhancement in process to make manual bank conciliation
NEW: Enhancement in the generic file manager
NEW: Extrafield totalizable
NEW: Hidden conf INVOICE_USE_DEFAULT_DOCUMENT
NEW: hidden conf to search product by supplier ref
NEW: hidden constant to be able to use a thirdparty for donation
NEW: hidden option to define an invoice template for each invoice type
NEW: Highlight lines on lists when they are checked
NEW: Notification module support expense report+holiday validation and approval
NEW: On customer/supplier card, add simple tooltip to amount boxes
NEW: Page to check if the operations/items created between two dates have attached item(s) and possibility to download all attachements
NEW: possibility to add all rights of all modules in one time
NEW: redirect if only one result on global search on card
NEW: Permission to ignore price min
NEW: Can build an archive of full documents directory from backup page
NEW: tag odt line_product_ref_fourn for supplier doc lines
NEW: The binding step in accountancy has a country filter with autocompletion
NEW: Top menu is always on screen with MD theme.
NEW: Withdraw request massaction can include already partially paid invoices
For developers: For developers:
* Code changes to be more compatible with PSR2 NEW: Add lib for multiselect with checkboxes
* Removed trigger USER_LOGOUT, USER_LOGIN, USER_LOGIN_FAILED (Some hooks are already dedicated for that) NEW: Add function isValidMXRecord
NEW: Add hook changeRoundingMode in update_price
NEW: Add hook formconfirm to contractcard
NEW: Add hook for virtual stock
NEW: ADD url to see the last version of a external module
NEW: Can enable a module, even external module, from command line
NEW: Can set a tooltip help text on extrafields
NEW: Add product search from barcode via REST api
NEW: can add documents on agenda events using API REST
NEW: Can set the datestart and dateend of cron job into module descriptor
NEW: Close #9296 Add field ref_ext into llx_categorie
NEW: move ticket dictionary in API /setup
NEW: PHPUnitTest on Loan class #3163
NEW: Code changes to be more compatible with PSR2
NEW: Removed trigger USER_LOGOUT, USER_LOGIN, USER_LOGIN_FAILED (Some hooks are already dedicated for that)
NEW: Add agenda documents in API REST
NEW: Add "checked" field for new list engine compatibility
NEW: REST API improvements
NEW: Save external payment IDs into table of payment
NEW: triggers add commercial and del commercial
NEW: #9236 Allow to import shipment lines via API
NEW: ADD civility list in API
NEW: support selllist in the module builder
NEW: optional param to show a specific extrafield
NEW: hook formConfirm always called if hooked
NEW: hook on dispatch order fourn
WARNING: WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* If you use some links like viewimages.php?modulepart=mycompany&file=... in you external modules, you must * If you use some links like viewimages.php?modulepart=mycompany&file=... in your external modules, you must
replace them with links like viewimages.php?modulepart=mycompany&file=logos/... (note that link change only for replace them with links like viewimages.php?modulepart=mycompany&file=logos/... (note that link change only for
modulepart=mycompany that now works like others). modulepart=mycompany that now works like others).
* Hidden option MAIN_PDF_SHIPPING_DISPLAY_AMOUNT_HT has been renamed into SHIPPING_PDF_DISPLAY_AMOUNT_HT
* Remove the no more used and deprecated dol_print_graph function
***** ChangeLog for 8.0.3 compared to 8.0.2 *****
FIX: #9161
FIX: #9432
FIX: #9432 Assign yourself as a commercial when you don't have permission to see all thirds
FIX: #9510
FIX: #9567
FIX: According to french law, if seller is in France and buyer isn't in UE and isn't a company, TVA used = TVA product
FIX: Amount when using mutlicurrency on PDF
FIX: Backup of database without mysqladmin available from cron.
FIX: Bad label on delete button
FIX: bad link in notification
FIX: Bad position of hook formattachOptions call
FIX: Can't create shipping if have shipping line's extrafields
FIX: check !empty exclude select element
FIX: content lost when editing a label with "
FIX: correct migration of old postgresql unique key
FIX: credit note progression
FIX: default accounting accounts on loan creation #9643
FIX: Delete of draft invoice
FIX: deletion on draft is allowed if we are allwoed to create
FIX: Do not show check box if not applicable
FIX: exclude element of the select
FIX: extrafields of taks not visible in creation
FIX: filter on employee
FIX: invoice stats: situation invoices were not counted
FIX: keep external module element when adding resource
FIX: langs fr
FIX: Link template invoice to contract
FIX: Look and feel v8. Missing button "Create category"
FIX: Menu to show/edit Users categories was missing
FIX: missing name alias field in societe import/export #9091
FIX: missing symbol for indian rupies
FIX: Missing transaction around action
FIX: modify parenting before task deletion
FIX: nb of session in title
FIX: need to filter on current entity on replenish
FIX: number mailing for a contact with multicompany
FIX: Option for prof id mandatory not working with custom type of company
FIX: Option MAIN_DISABLE_NOTES_TAB #9611
FIX: Pagination stats
FIX: pdf typhon: order reference duplicate
FIX: position 0 for emails templates
FIX: previous situation invoice selection
FIX: Product marge tabs on product card
FIX: Product margin tab and credit note
FIX: propal pdf: missing parenthesis for customs code
FIX: properties on proposal must not be modified if error
FIX: qty not visible for a lot when making shipment on a dedicated stock
FIX: Quick hack to solve pb of bad definition of public holidays
FIX: remain to pay for credit note was wrong on invoice list
FIX: replenish wasn't caring about supplier price min quantity #9561
FIX: Required extrafield value numeric should accept '0'
FIX: ressource list with extrafields
FIX: restore last seach criteria
FIX: Selection of addmaindocfile is lost on error
FIX: Sending of reminder for expired subscriptions
FIX: shared link ko on proposals
FIX: showOptionals: column mismatches
FIX: situation invoice total with credit note
FIX: situation invoice prev percent
FIX: special code on create supplier invoice from supplier order
FIX: Symbol of currency in substitution variables
FIX: The max size for upload file was not corectly shown
FIX: the member e-mail on resign and validation.
FIX: thirdparty property of object not loaded when only one record
FIX: title
FIX: Title problem on admin RSS module
FIX: Tooltip on invoice widget
FIX: Total of timespent
FIX: trackid into email sent from member module.
FIX: translation in select unit form
FIX: use discount with multicurrency
FIX: Variable name
FIX: When we delete a product, llx_product_association rows are not deleted
FIX: when we're just admin and not super admin, if we create new user with transverse mode, we don't see it then we can't add him in usergroup
FIX: wrong function name
FIX: wrong occurence number of contract on contact card, we must only count externals
FIX: wrong value for module part and return access denied
FIX: Wrong variable name
FIX: XSS vulnerability reported by Mary Princy E
***** ChangeLog for 8.0.2 compared to 8.0.1 ***** ***** ChangeLog for 8.0.2 compared to 8.0.1 *****
FIX: #8452 FIX: #8452
FIX: #9043 FIX: #9043

View File

@ -1,6 +1,7 @@
# DOLIBARR ERP & CRM # DOLIBARR ERP & CRM
![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg) ![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg)
[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
|6|7|8|develop| |6|7|8|develop|
|----------|----------|----------|----------| |----------|----------|----------|----------|

View File

@ -8,7 +8,7 @@ Copyright: 2002-2009, Rodolphe Quiedeville <rodolphe@quiedeville.org>
2003-2006, Jean-Louis Bergamo <jlb@j1b.org> 2003-2006, Jean-Louis Bergamo <jlb@j1b.org>
2003-2013, Laurent Destailleur <eldy@users.sourceforge.net> 2003-2013, Laurent Destailleur <eldy@users.sourceforge.net>
2003, Xavier Dutoit <doli@sydesy.com> 2003, Xavier Dutoit <doli@sydesy.com>
2004-2013, Regis Houssin <regis.houssin@capnetworks.com> 2004-2013, Regis Houssin <regis.houssin@inodbox.com>
2004, Sebastien Di Cintio <sdicintio@ressource-toi.org> 2004, Sebastien Di Cintio <sdicintio@ressource-toi.org>
2004, Benoit Mortier <benoit.mortier@opensides.be> 2004, Benoit Mortier <benoit.mortier@opensides.be>
2004, Christophe Combelles <ccomb@free.fr> 2004, Christophe Combelles <ccomb@free.fr>

View File

@ -0,0 +1 @@
htdocs/install/doctemplates/websites/website_template-corporate.zip

View File

@ -3,18 +3,30 @@ FROM php:7.0-apache
ENV HOST_USER_ID 33 ENV HOST_USER_ID 33
ENV PHP_INI_DATE_TIMEZONE 'UTC' ENV PHP_INI_DATE_TIMEZONE 'UTC'
RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev libldap2-dev \ RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \ && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-install gd \ && docker-php-ext-install gd \
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
&& docker-php-ext-install ldap \ && docker-php-ext-install ldap \
&& docker-php-ext-install mysqli \ && docker-php-ext-install mysqli \
&& apt-get purge -y libpng12-dev libjpeg-dev libldap2-dev && apt-get purge -y libjpeg-dev libldap2-dev
COPY docker-run.sh /usr/local/bin/ COPY docker-run.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-run.sh RUN chmod +x /usr/local/bin/docker-run.sh
RUN pecl install xdebug-2.5.5 && docker-php-ext-enable xdebug
RUN echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so"' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_autostart=0' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_enable=1' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.default_enable=0' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_host=docker.for.mac.host.internal' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_port=9000' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_connect_back=0' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.profiler_enable=0' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_log="/tmp/xdebug.log"' >> /usr/local/etc/php/php.ini
EXPOSE 80 EXPOSE 80
ENTRYPOINT ["docker-run.sh"] ENTRYPOINT ["docker-run.sh"]

View File

@ -3,42 +3,27 @@ File added into doxygen generated documentation
--> -->
<!-- Google analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-9049390-16', 'auto');
ga('send', 'pageview');
</script>
<!-- End google analytics -->
<hr class="footer" /> <hr class="footer" />
<address class="footer"><small>Generated on $datetime <address class="footer"><small>Generated on $datetime for <a href="https://www.dolibarr.org">$projectname</a> by Doxygen $doxygenversion </small></address>
for <a href="https://www.dolibarr.org">$projectname</a> by Doxygen $doxygenversion </small></address>
<!-- Google AdSense -->
<div class="center">
<script type="text/javascript"><!--
google_ad_client = "pub-1071905880519467";
/* PUBBANDEAUDOLIBARR */
google_ad_slot = "1421205532";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript" src="https://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>
<!-- End google adsense -->
<br> <br>
</div> </div>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-9049390-16"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-9049390-16');
</script>
<!-- Twitter ad collector --> <!-- Twitter ad collector -->
<script src="//platform.twitter.com/oct.js" type="text/javascript"></script> <script src="//platform.twitter.com/oct.js" type="text/javascript"></script>
<script type="text/javascript">twttr.conversion.trackPid('ntm4n', { tw_sale_amount: 0, tw_order_quantity: 0 });</script> <script type="text/javascript">twttr.conversion.trackPid('ntm4n', { tw_sale_amount: 0, tw_order_quantity: 0 });</script>

View File

@ -522,12 +522,21 @@ if ($nboftargetok) {
$ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot12.png`; $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot12.png`;
# Security to avoid to package data files # Security to avoid to package data files
print "Remove documents dir\n";
$ret=`rm -fr $BUILDROOT/$PROJECT/document`; $ret=`rm -fr $BUILDROOT/$PROJECT/document`;
$ret=`rm -fr $BUILDROOT/$PROJECT/documents`; $ret=`rm -fr $BUILDROOT/$PROJECT/documents`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/document`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/document`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`;
print "Remove subdir of custom dir\n";
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\;\n";
$ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs but not files
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\;\n";
$ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs, even symbolic links, but not files
# Removed known external modules to avoid any error when packaging from env where external modules are tested # Removed known external modules to avoid any error when packaging from env where external modules are tested
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/abricot*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/accountingexport*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/allscreens*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/allscreens*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ancotec*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ancotec*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/cabinetmed*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/cabinetmed*`;
@ -542,12 +551,14 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ndf*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ndf*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nomenclature*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/of/`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/oscim*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/oscim*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/timesheet*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/timesheet*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/webmail*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/webmail*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/accountingexport*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/workstation*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/allscreen*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/allscreen*`;
# Removed other test files # Removed other test files
@ -591,13 +602,6 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`;
print "Remove subdir of custom dir\n";
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\;\n";
$ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs but not files
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\;\n";
$ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs, even symbolic links, but not files
} }
# Build package for each target # Build package for each target

View File

@ -30,7 +30,7 @@ return "Regis Houssin";
# script_dolibarr_versions() # script_dolibarr_versions()
sub script_dolibarr_versions sub script_dolibarr_versions
{ {
return ( "7.0.0", "6.0.5", "5.0.7" ); return ( "9.0.0", "8.0.3", "7.0.4", "6.0.8", "5.0.7" );
} }
sub script_dolibarr_release sub script_dolibarr_release
@ -263,15 +263,16 @@ if ($upgrade) {
local @params = ( [ "action", "upgrade" ], local @params = ( [ "action", "upgrade" ],
[ "versionfrom", $upgrade->{'version'} ], [ "versionfrom", $upgrade->{'version'} ],
[ "versionto", $ver ], [ "versionto", $ver ],
[ "installlock", "444" ],
); );
local $p = $ver >= 3.8 ? "step5" : "etape5"; local $p = $ver >= 3.8 ? "step5" : "etape5";
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts); local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err); return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory. # Remove the installation directory. (deprecated)
local $dinstall = "$opts->{'dir'}/install"; # local $dinstall = "$opts->{'dir'}/install";
$dinstall =~ s/\/$//; # $dinstall =~ s/\/$//;
$out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall)); # $out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall));
} }
else { else {
@ -306,15 +307,18 @@ else {
[ "login", "admin" ], [ "login", "admin" ],
[ "pass", $dompass ], [ "pass", $dompass ],
[ "pass_verif", $dompass ], [ "pass_verif", $dompass ],
[ "installlock", "444" ],
); );
local $p = $ver >= 3.8 ? "step5" : "etape5"; local $p = $ver >= 3.8 ? "step5" : "etape5";
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts); local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err); return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory and protect config file. # Remove the installation directory (deprecated)
local $dinstall = "$opts->{'dir'}/install"; # local $dinstall = "$opts->{'dir'}/install";
$dinstall =~ s/\/$//; # $dinstall =~ s/\/$//;
$out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall)); # $out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall));
# Protect config file
&set_permissions_as_domain_user($d, 0644, $cfile); &set_permissions_as_domain_user($d, 0644, $cfile);
&set_permissions_as_domain_user($d, 0755, $cfiledir); &set_permissions_as_domain_user($d, 0755, $cfiledir);
} }
@ -386,6 +390,8 @@ sub script_dolibarr_check_latest
{ {
local ($ver) = @_; local ($ver) = @_;
local @vers = &osdn_package_versions("dolibarr", local @vers = &osdn_package_versions("dolibarr",
$ver >= 9.0 ? "dolibarr\\-(9\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 8.0 ? "dolibarr\\-(8\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 7.0 ? "dolibarr\\-(7\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 7.0 ? "dolibarr\\-(7\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 6.0 ? "dolibarr\\-(6\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 6.0 ? "dolibarr\\-(6\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 5.0 ? "dolibarr\\-(5\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 5.0 ? "dolibarr\\-(5\\.0\\.[0-9\\.]+)\\.tgz" :

View File

@ -181,6 +181,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/dav %_datadir/dolibarr/htdocs/dav
%_datadir/dolibarr/htdocs/don %_datadir/dolibarr/htdocs/don
%_datadir/dolibarr/htdocs/ecm %_datadir/dolibarr/htdocs/ecm
%_datadir/dolibarr/htdocs/emailcollector
%_datadir/dolibarr/htdocs/expedition %_datadir/dolibarr/htdocs/expedition
%_datadir/dolibarr/htdocs/expensereport %_datadir/dolibarr/htdocs/expensereport
%_datadir/dolibarr/htdocs/exports %_datadir/dolibarr/htdocs/exports

View File

@ -261,6 +261,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/dav %_datadir/dolibarr/htdocs/dav
%_datadir/dolibarr/htdocs/don %_datadir/dolibarr/htdocs/don
%_datadir/dolibarr/htdocs/ecm %_datadir/dolibarr/htdocs/ecm
%_datadir/dolibarr/htdocs/emailcollector
%_datadir/dolibarr/htdocs/expedition %_datadir/dolibarr/htdocs/expedition
%_datadir/dolibarr/htdocs/expensereport %_datadir/dolibarr/htdocs/expensereport
%_datadir/dolibarr/htdocs/exports %_datadir/dolibarr/htdocs/exports

View File

@ -178,6 +178,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/dav %_datadir/dolibarr/htdocs/dav
%_datadir/dolibarr/htdocs/don %_datadir/dolibarr/htdocs/don
%_datadir/dolibarr/htdocs/ecm %_datadir/dolibarr/htdocs/ecm
%_datadir/dolibarr/htdocs/emailcollector
%_datadir/dolibarr/htdocs/expedition %_datadir/dolibarr/htdocs/expedition
%_datadir/dolibarr/htdocs/expensereport %_datadir/dolibarr/htdocs/expensereport
%_datadir/dolibarr/htdocs/exports %_datadir/dolibarr/htdocs/exports

View File

@ -189,6 +189,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/dav %_datadir/dolibarr/htdocs/dav
%_datadir/dolibarr/htdocs/don %_datadir/dolibarr/htdocs/don
%_datadir/dolibarr/htdocs/ecm %_datadir/dolibarr/htdocs/ecm
%_datadir/dolibarr/htdocs/emailcollector
%_datadir/dolibarr/htdocs/expedition %_datadir/dolibarr/htdocs/expedition
%_datadir/dolibarr/htdocs/expensereport %_datadir/dolibarr/htdocs/expensereport
%_datadir/dolibarr/htdocs/exports %_datadir/dolibarr/htdocs/exports

View File

@ -78,17 +78,24 @@ In htdocs/includes/tcpdf/tcpdf.php
+ protected $default_monospaced_font = 'freemono'; + protected $default_monospaced_font = 'freemono';
TCPDI: TCPDI:
------ ------
Add fpdf_tpl.php 1.2 Add fpdf_tpl.php 1.2
Add tcpdi.php Add tcpdi.php
Add tcpdi_parser.php and replace: Add tcpdi_parser.php and replace:
require_once(dirname(__FILE__).'/include/tcpdf_filters.php'); require_once(dirname(__FILE__).'/include/tcpdf_filters.php');
with: with:
require_once(dirname(__FILE__).'/../tecnickcom/tcpdf/include/tcpdf_filters.php'); require_once(dirname(__FILE__).'/../tecnickcom/tcpdf/include/tcpdf_filters.php');
* Fix by replacing
} elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1] >= 2))) {
with
} elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1]) >= 2)) {
JSGANTT: JSGANTT:

View File

@ -185,7 +185,4 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0)
{ {
dol_print_error($db,$object->error); dol_print_error($db,$object->error);
} }
} }

View File

@ -218,6 +218,4 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0)
{ {
dol_print_error($db,$object->error); dol_print_error($db,$object->error);
} }
} }

View File

@ -6,7 +6,7 @@
# WARNING: This script erase all data of database # WARNING: This script erase all data of database
# with data into dump file # with data into dump file
# #
# Regis Houssin - regis.houssin@capnetworks.com # Regis Houssin - regis.houssin@inodbox.com
# Laurent Destailleur - eldy@users.sourceforge.net # Laurent Destailleur - eldy@users.sourceforge.net
#------------------------------------------------------ #------------------------------------------------------
# Usage: initdemo.sh # Usage: initdemo.sh

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,7 @@
# Script to remove setup of a Dolibarr installation. # Script to remove setup of a Dolibarr installation.
# Note: "dialog" tool need to be available. # Note: "dialog" tool need to be available.
# #
# Regis Houssin - regis.houssin@capnetworks.com # Regis Houssin - regis.houssin@inodbox.com
# Laurent Destailleur - eldy@users.sourceforge.net # Laurent Destailleur - eldy@users.sourceforge.net
#------------------------------------------------------ #------------------------------------------------------
# WARNING: This script erase setup of instance, # WARNING: This script erase setup of instance,

View File

@ -3,7 +3,7 @@
# Script to extrac a database with demo values. # Script to extrac a database with demo values.
# Note: "dialog" tool need to be available if no parameter provided. # Note: "dialog" tool need to be available if no parameter provided.
# #
# Regis Houssin - regis.houssin@capnetworks.com # Regis Houssin - regis.houssin@inodbox.com
# Laurent Destailleur - eldy@users.sourceforge.net # Laurent Destailleur - eldy@users.sourceforge.net
#------------------------------------------------------ #------------------------------------------------------
# Usage: savedemo.sh # Usage: savedemo.sh
@ -171,6 +171,8 @@ export list="
--ignore-table=$base.llx_abonne_extrafields --ignore-table=$base.llx_abonne_extrafields
--ignore-table=$base.llx_abonne_type --ignore-table=$base.llx_abonne_type
--ignore-table=$base.llx_abonnement --ignore-table=$base.llx_abonnement
--ignore-table=$base.llx_accountingaccount
--ignore-table=$base.llx_accountingsystem
--ignore-table=$base.llx_advanced_extrafields --ignore-table=$base.llx_advanced_extrafields
--ignore-table=$base.llx_advanced_extrafields_options --ignore-table=$base.llx_advanced_extrafields_options
--ignore-table=$base.llx_advanced_extrafields_values --ignore-table=$base.llx_advanced_extrafields_values

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<uml:Model xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML" xmi:id="_qb8akM37EdqwVrslYOdUDA">
<packagedElement xmi:type="uml:Package" xmi:id="_w8IxIM37EdqwVrslYOdUDA" name="dolibarr">
<packagedElement xmi:type="uml:Package" xmi:id="_T5aZ4FK9Ed60vaZbVikprw" name="OrdersModule"/>
<packagedElement xmi:type="uml:Package" xmi:id="_ZhuGMlK9Ed60vaZbVikprw" name="InvoiceModule"/>
<packagedElement xmi:type="uml:Package" xmi:id="_cf3SUlK9Ed60vaZbVikprw" name="UserModule"/>
<packagedElement xmi:type="uml:Package" xmi:id="_maM0glK9Ed60vaZbVikprw" name="FoundationModule"/>
<packagedElement xmi:type="uml:Package" xmi:id="_oqTO4lK9Ed60vaZbVikprw" name="ContractsModule"/>
<packagedElement xmi:type="uml:Package" xmi:id="_rEq_klK9Ed60vaZbVikprw" name="ProposalsModule"/>
<packagedElement xmi:type="uml:Package" xmi:id="_vxYmUlK9Ed60vaZbVikprw" name="EMailingManagement"/>
</packagedElement>
</uml:Model>

View File

@ -1,53 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<diagrams:Diagrams xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.topcased.org/DI/1.0" xmlns:diagrams="http://www.topcased.org/Diagrams/1.0" xmi:id="_SI6FkFK9Ed60vaZbVikprw" activeDiagram="_SI6FkVK9Ed60vaZbVikprw">
<model href="dolibarr.uml#_w8IxIM37EdqwVrslYOdUDA"/>
<diagrams xmi:id="_SI6FkVK9Ed60vaZbVikprw" position="0,0" size="100,100" name="dolibarr" viewport="0,0">
<property xmi:id="_SJ9OcFK9Ed60vaZbVikprw" key="pageFormatName" value="A4"/>
<property xmi:id="_SJ9OcVK9Ed60vaZbVikprw" key="diagramWidth" value="840"/>
<property xmi:id="_SJ9OclK9Ed60vaZbVikprw" key="diagramHeight" value="1188"/>
<property xmi:id="_SJ9Oc1K9Ed60vaZbVikprw" key="pageMarginName" value="Small Margin"/>
<property xmi:id="_SJ9OdFK9Ed60vaZbVikprw" key="diagramTopMargin" value="20"/>
<property xmi:id="_SJ9OdVK9Ed60vaZbVikprw" key="diagramBottomMargin" value="20"/>
<property xmi:id="_SJ9OdlK9Ed60vaZbVikprw" key="diagramLeftMargin" value="20"/>
<property xmi:id="_SJ9Od1K9Ed60vaZbVikprw" key="diagramRightMargin" value="20"/>
<property xmi:id="_SJ9OeFK9Ed60vaZbVikprw" key="orientation" value="portrait"/>
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_SI6FklK9Ed60vaZbVikprw" presentation="org.topcased.modeler.uml.classdiagram">
<element href="dolibarr.uml#_w8IxIM37EdqwVrslYOdUDA"/>
</semanticModel>
<contained xsi:type="di:GraphNode" xmi:id="_T2b-YFK9Ed60vaZbVikprw" position="15,190" size="176,81">
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_T2b-YVK9Ed60vaZbVikprw" presentation="default">
<element href="dolibarr.uml#_T5aZ4FK9Ed60vaZbVikprw"/>
</semanticModel>
</contained>
<contained xsi:type="di:GraphNode" xmi:id="_ZhuGMFK9Ed60vaZbVikprw" position="15,118" size="177,68">
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_ZhuGMVK9Ed60vaZbVikprw" presentation="default">
<element href="dolibarr.uml#_ZhuGMlK9Ed60vaZbVikprw"/>
</semanticModel>
</contained>
<contained xsi:type="di:GraphNode" xmi:id="_cf3SUFK9Ed60vaZbVikprw" position="15,10" size="174,81">
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_cf3SUVK9Ed60vaZbVikprw" presentation="default">
<element href="dolibarr.uml#_cf3SUlK9Ed60vaZbVikprw"/>
</semanticModel>
</contained>
<contained xsi:type="di:GraphNode" xmi:id="_maM0gFK9Ed60vaZbVikprw" position="291,118" size="145,73">
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_maM0gVK9Ed60vaZbVikprw" presentation="default">
<element href="dolibarr.uml#_maM0glK9Ed60vaZbVikprw"/>
</semanticModel>
</contained>
<contained xsi:type="di:GraphNode" xmi:id="_oqTO4FK9Ed60vaZbVikprw" position="15,274" size="179,80">
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_oqTO4VK9Ed60vaZbVikprw" presentation="default">
<element href="dolibarr.uml#_oqTO4lK9Ed60vaZbVikprw"/>
</semanticModel>
</contained>
<contained xsi:type="di:GraphNode" xmi:id="_rEq_kFK9Ed60vaZbVikprw" position="15,358" size="181,73">
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_rEq_kVK9Ed60vaZbVikprw" presentation="default">
<element href="dolibarr.uml#_rEq_klK9Ed60vaZbVikprw"/>
</semanticModel>
</contained>
<contained xsi:type="di:GraphNode" xmi:id="_vxYmUFK9Ed60vaZbVikprw" position="15,490" size="181,80">
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_vxYmUVK9Ed60vaZbVikprw" presentation="default">
<element href="dolibarr.uml#_vxYmUlK9Ed60vaZbVikprw"/>
</semanticModel>
</contained>
</diagrams>
</diagrams:Diagrams>

View File

@ -173,6 +173,7 @@
<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.SpacingBeforeClose" />
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration" /> <rule ref="Squiz.Functions.MultiLineFunctionDeclaration" />

View File

@ -7,12 +7,12 @@ Download
-------------------------------- --------------------------------
* Dolibarr ERP/CRM can be downloaded at sourceforge: * Dolibarr ERP/CRM can be downloaded at sourceforge:
http://sourceforge.net/projects/dolibarr/files https://sourceforge.net/projects/dolibarr/files
or from Dolibarr official web site: or from Dolibarr official web site:
http://www.dolibarr.org https://www.dolibarr.org
* Most external modules are only available on DoliStore: * Most external modules are only available on DoliStore:
http://www.dolistore.org https://www.dolistore.com
-------------------------------- --------------------------------
@ -22,4 +22,4 @@ Install
* For a Quick guide, take a look at README file into root directory. * For a Quick guide, take a look at README file into root directory.
* More complete documentations are also available on line on the Dolibarr Wiki: * More complete documentations are also available on line on the Dolibarr Wiki:
http://wiki.dolibarr.org https://wiki.dolibarr.org

33
doc/install/README-DE Normal file
View File

@ -0,0 +1,33 @@
README (deutsch / german / allemand)
--------------------------------
--------------------------------
Download / Herunterladen
--------------------------------
* Dolibarr ERP/CRM kann man über die offizielle Dolibarr Website
https://www.dolibarr.org/downloads
oder direkt von Sourceforge
https://sourceforge.net/projects/dolibarr/files/
herunterladen.
* Die meisten externen Module/Themens sind über den DoliStore verfügbar:
https://www.dolistore.com/de/
--------------------------------
Installation
--------------------------------
* Für eine kurze Einleitung, schau auf die README Datei im Hauptverzeichnis.
* Umfangreiche Dokumentationen sind im Dolibarr Wiki zu finden:
https://wiki.dolibarr.org/index.php/Hauptseite
* eine Deutsche Community bietet der Dolibarr e.V. unter
https://www.dolibarr.de/

6
htdocs/.gitignore vendored
View File

@ -23,4 +23,8 @@
/cabinetmed* /cabinetmed*
/webmail* /webmail*
/conf/conf.php /conf/conf.php
/subtotal/ /subtotal*
/abricot*
/nomenclature*
/of/
/workstation/

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com> * Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
@ -44,7 +44,7 @@ if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("errors","admin","companies","resource","holiday","compta","accountancy","hrm")); $langs->loadLangs(array("errors","admin","companies","resource","holiday","compta","accountancy","hrm"));
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view'; $action=GETPOST('action','aZ09')?GETPOST('action','aZ09'):'view';
$confirm=GETPOST('confirm','alpha'); $confirm=GETPOST('confirm','alpha');
$id=31; $id=31;
$rowid=GETPOST('rowid','alpha'); $rowid=GETPOST('rowid','alpha');
@ -247,7 +247,6 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$newid=($obj->newid + 1); $newid=($obj->newid + 1);
} else { } else {
dol_print_error($db); dol_print_error($db);
} }

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com> * Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -41,6 +41,7 @@ $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
$rowid = GETPOST('rowid', 'int'); $rowid = GETPOST('rowid', 'int');
$cancel = GETPOST('cancel','alpha'); $cancel = GETPOST('cancel','alpha');
$accountingaccount = GETPOST('accountingaccount','alpha');
// Security check // Security check
@ -229,7 +230,7 @@ if ($action == 'create') {
// 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>';
print '<td><input name="account_number" size="30" value="' . $object->account_number . '"></td></tr>'; print '<td><input name="account_number" size="30" value="' . $accountingaccount . '"></td></tr>';
// Label // Label
print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>'; print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>';

View File

@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("errors","admin","companies","resource","holiday","accountancy","hrm")); $langs->loadLangs(array("errors","admin","companies","resource","holiday","accountancy","hrm"));
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view'; $action=GETPOST('action','aZ09')?GETPOST('action','aZ09'):'view';
$confirm=GETPOST('confirm','alpha'); $confirm=GETPOST('confirm','alpha');
$id=32; $id=32;
$rowid=GETPOST('rowid','alpha'); $rowid=GETPOST('rowid','alpha');
@ -202,7 +202,6 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$newid=($obj->newid + 1); $newid=($obj->newid + 1);
} else { } else {
dol_print_error($db); dol_print_error($db);
} }

View File

@ -43,7 +43,7 @@ if (empty($user->rights->accounting->chartofaccount))
accessforbidden(); accessforbidden();
} }
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'aZ09');
$list_account_main = array ( $list_account_main = array (

View File

@ -41,10 +41,10 @@ if (empty($user->rights->accounting->chartofaccount))
accessforbidden(); accessforbidden();
} }
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'aZ09');
// Parameters ACCOUNTING_EXPORT_* // Parameters ACCOUNTING_EXPORT_*
$main_option = array ( $main_option = array(
'ACCOUNTING_EXPORT_PREFIX_SPEC', 'ACCOUNTING_EXPORT_PREFIX_SPEC',
); );

View File

@ -38,7 +38,7 @@ if (empty($user->rights->accounting->fiscalyear))
$error = 0; $error = 0;
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com> * Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -71,10 +72,10 @@ if ($_POST["action"] == 'import') {
$accounting = new AccountingAccount($db); $accounting = new AccountingAccount($db);
$monLabel = GETPOST('label' . $maLigneCochee); $monLabel = (string) GETPOST('label' . $maLigneCochee);
$monParentAccount = GETPOST('AccountParent' . $maLigneCochee); $monParentAccount = (string) GETPOST('AccountParent' . $maLigneCochee);
$monType = GETPOST('pcgType' . $maLigneCochee); $monType = (string) GETPOST('pcgType' . $maLigneCochee);
$monSubType = GETPOST('pcgSubType' . $maLigneCochee); $monSubType = (string) GETPOST('pcgSubType' . $maLigneCochee);
$accounting->fk_pcg_version = $obj->pcg_version; $accounting->fk_pcg_version = $obj->pcg_version;
$accounting->account_number = $maLigneCochee; $accounting->account_number = $maLigneCochee;

View File

@ -41,7 +41,7 @@ if (empty($user->rights->accounting->chartofaccount))
accessforbidden(); accessforbidden();
} }
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'aZ09');
// Parameters ACCOUNTING_* and others // Parameters ACCOUNTING_* and others
$list = array ( $list = array (

View File

@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin","compta","accountancy")); $langs->loadLangs(array("admin","compta","accountancy"));
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view'; $action=GETPOST('action','aZ09')?GETPOST('action','aZ09'):'view';
$confirm=GETPOST('confirm','alpha'); $confirm=GETPOST('confirm','alpha');
$id=35; $id=35;
$rowid=GETPOST('rowid','alpha'); $rowid=GETPOST('rowid','alpha');
@ -202,7 +202,6 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$newid=($obj->newid + 1); $newid=($obj->newid + 1);
} else { } else {
dol_print_error($db); dol_print_error($db);
} }

View File

@ -45,7 +45,7 @@ if (! $user->rights->accounting->bind->write)
accessforbidden(); accessforbidden();
// search & action GETPOST // search & action GETPOST
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'aZ09');
$codeventil_buy = GETPOST('codeventil_buy', 'array'); $codeventil_buy = GETPOST('codeventil_buy', 'array');
$codeventil_sell = GETPOST('codeventil_sell', 'array'); $codeventil_sell = GETPOST('codeventil_sell', 'array');
$chk_prod = GETPOST('chk_prod', 'array'); $chk_prod = GETPOST('chk_prod', 'array');
@ -173,7 +173,6 @@ if ($action == 'update') {
$cpt++; $cpt++;
} }
} }
if ($ko) setEventMessages($langs->trans("XLineFailedToBeBinded", $ko), null, 'errors'); if ($ko) setEventMessages($langs->trans("XLineFailedToBeBinded", $ko), null, 'errors');

View File

@ -41,7 +41,7 @@ $langs->loadLangs(array("accountancy"));
$page = GETPOST("page"); $page = GETPOST("page");
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha');
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'aZ09');
if (GETPOST("exportcsv",'alpha')) $action = 'export_csv'; if (GETPOST("exportcsv",'alpha')) $action = 'export_csv';
// Load variable for pagination // Load variable for pagination
@ -58,7 +58,7 @@ $pagenext = $page + 1;
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); $search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); $search_date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha'); $search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
if ($search_accountancy_code_start == - 1) { if ($search_accountancy_code_start == - 1) {
@ -127,7 +127,6 @@ if (! empty($search_accountancy_code_end)) {
$param .= '&amp;search_accountancy_code_end=' . $search_accountancy_code_end; $param .= '&amp;search_accountancy_code_end=' . $search_accountancy_code_end;
} }
/* /*
* Action * Action
*/ */
@ -151,9 +150,10 @@ if ($action == 'export_csv')
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$filename = 'balance'; $filename = 'balance';
$type_export = 'balance';
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
$result = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter); $result = $object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter);
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
@ -265,7 +265,7 @@ if ($action != 'export_csv')
$description = $object->get_compte_desc($line->numero_compte); // Search description of the account $description = $object->get_compte_desc($line->numero_compte); // Search description of the account
$root_account_description = $object->get_compte_racine($line->numero_compte); $root_account_description = $object->get_compte_racine($line->numero_compte);
if (empty($description)) { if (empty($description)) {
$link = '<a href="../admin/card.php?action=create&compte=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>'; $link = '<a href="../admin/card.php?action=create&accountingaccount=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>';
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -315,7 +315,6 @@ if ($action != 'export_csv')
print "</table>"; print "</table>";
print '</form>'; print '</form>';
} }
// End of page // End of page

View File

@ -1,8 +1,8 @@
<?php <?php
/* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com> * Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("accountancy", "bills", "compta")); $langs->loadLangs(array("accountancy", "bills", "compta"));
@ -49,12 +50,21 @@ if ($user->societe_id > 0) {
$mesg = ''; $mesg = '';
$account_number = GETPOST('account_number','alphanohtml'); $accountingaccount = new AccountingAccount($db);
$accountingjournal = new AccountingJournal($db);
$accountingaccount_number = GETPOST('accountingaccount_number','alphanohtml');
$accountingaccount->fetch(null, $accountingaccount_number, true);
$accountingaccount_label = $accountingaccount->label;
$journal_code = GETPOST('code_journal','alpha');
$accountingjournal->fetch(null, $journal_code);
$journal_label = $accountingjournal->label;
$subledger_account = GETPOST('subledger_account','alphanohtml'); $subledger_account = GETPOST('subledger_account','alphanohtml');
if ($subledger_account == - 1) { if ($subledger_account == - 1) {
$subledger_account = null; $subledger_account = null;
} }
$label_compte = GETPOST('label_compte','alphanohtml');
$label_operation= GETPOST('label_operation','alphanohtml'); $label_operation= GETPOST('label_operation','alphanohtml');
$debit = price2num(GETPOST('debit','alpha')); $debit = price2num(GETPOST('debit','alpha'));
$credit = price2num(GETPOST('credit','alpha')); $credit = price2num(GETPOST('credit','alpha'));
@ -80,7 +90,7 @@ if ($action == "confirm_update") {
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
$action='update'; $action='update';
} }
if (empty($account_number) || $account_number == '-1') if (empty($accountingaccount_number) || $accountingaccount_number == '-1')
{ {
$error++; $error++;
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
@ -96,9 +106,9 @@ if ($action == "confirm_update") {
$error++; $error++;
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} else { } else {
$object->numero_compte = $account_number; $object->numero_compte = $accountingaccount_number;
$object->subledger_account = $subledger_account; $object->subledger_account = $subledger_account;
$object->label_compte = $label_compte; $object->label_compte = $accountingaccount_label;
$object->label_operation= $label_operation; $object->label_operation= $label_operation;
$object->debit = $debit; $object->debit = $debit;
$object->credit = $credit; $object->credit = $credit;
@ -139,7 +149,7 @@ else if ($action == "add") {
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
$action=''; $action='';
} }
if (empty($account_number) || $account_number == '-1') if (empty($accountingaccount_number) || $accountingaccount_number == '-1')
{ {
$error++; $error++;
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
@ -149,9 +159,9 @@ else if ($action == "add") {
if (! $error) { if (! $error) {
$object = new BookKeeping($db); $object = new BookKeeping($db);
$object->numero_compte = $account_number; $object->numero_compte = $accountingaccount_number;
$object->subledger_account = $subledger_account; $object->subledger_account = $subledger_account;
$object->label_compte = $label_compte; $object->label_compte = $accountingaccount_label;
$object->label_operation= $label_operation; $object->label_operation= $label_operation;
$object->debit = $debit; $object->debit = $debit;
$object->credit = $credit; $object->credit = $credit;
@ -159,7 +169,8 @@ else if ($action == "add") {
$object->doc_type = GETPOST('doc_type','alpha'); $object->doc_type = GETPOST('doc_type','alpha');
$object->piece_num = $piece_num; $object->piece_num = $piece_num;
$object->doc_ref = GETPOST('doc_ref','alpha'); $object->doc_ref = GETPOST('doc_ref','alpha');
$object->code_journal = GETPOST('code_journal','alpha'); $object->code_journal = $journal_code;
$object->journal_label = $journal_label;
$object->fk_doc = GETPOST('fk_doc','alpha'); $object->fk_doc = GETPOST('fk_doc','alpha');
$object->fk_docdet = GETPOST('fk_docdet','alpha'); $object->fk_docdet = GETPOST('fk_docdet','alpha');
@ -212,7 +223,7 @@ else if ($action == "confirm_create") {
$object = new BookKeeping($db); $object = new BookKeeping($db);
if (! GETPOST('code_journal','alpha') || GETPOST('code_journal','alpha') == '-1') { if (! $journal_code || $journal_code == '-1') {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors');
$action='create'; $action='create';
$error++; $error++;
@ -232,7 +243,8 @@ else if ($action == "confirm_create") {
$object->doc_type = GETPOST('doc_type','alpha'); $object->doc_type = GETPOST('doc_type','alpha');
$object->piece_num = GETPOST('next_num_mvt','alpha'); $object->piece_num = GETPOST('next_num_mvt','alpha');
$object->doc_ref = GETPOST('doc_ref','alpha'); $object->doc_ref = GETPOST('doc_ref','alpha');
$object->code_journal = GETPOST('code_journal','alpha'); $object->code_journal = $journal_code;
$object->journal_label = $journal_label;
$object->fk_doc = 0; $object->fk_doc = 0;
$object->fk_docdet = 0; $object->fk_docdet = 0;
$object->montant = 0; $object->montant = 0;
@ -267,8 +279,8 @@ if ($action == 'setdate') {
} }
if ($action == 'setjournal') { if ($action == 'setjournal') {
$journaldoc = trim(GETPOST('code_journal','alpha')); $result = $object->updateByMvt($piece_num, 'code_journal', $journal_code, $mode);
$result = $object->updateByMvt($piece_num, 'code_journal', $journaldoc, $mode); $result = $object->updateByMvt($piece_num, 'journal_label', $journal_label, $mode);
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} else { } else {
@ -312,7 +324,6 @@ if ($action == 'valid') {
$html = new Form($db); $html = new Form($db);
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
$accountjournal = new AccountingJournal($db);
llxHeader('', $langs->trans("CreateMvts")); llxHeader('', $langs->trans("CreateMvts"));
@ -357,7 +368,7 @@ if ($action == 'create')
print '<tr>'; print '<tr>';
print '<td class="fieldrequired">' . $langs->trans("Codejournal") . '</td>'; print '<td class="fieldrequired">' . $langs->trans("Codejournal") . '</td>';
print '<td>' . $formaccounting->select_journal(GETPOST('code_journal', 'alpha'),'code_journal',0,1,array(),1,1) . '</td>'; print '<td>' . $formaccounting->select_journal($journal_code,'code_journal',0,0,1,1) . '</td>';
print '</tr>'; print '</tr>';
print '<tr>'; print '<tr>';
@ -460,7 +471,7 @@ if ($action == 'create')
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">'; print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
print '</form>'; print '</form>';
} else { } else {
print $object->code_journal ; print $object->code_journal ;
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -590,7 +601,6 @@ if ($action == 'create')
print_liste_field_titre("AccountAccountingShort"); print_liste_field_titre("AccountAccountingShort");
print_liste_field_titre("SubledgerAccount"); print_liste_field_titre("SubledgerAccount");
print_liste_field_titre("LabelAccount");
print_liste_field_titre("LabelOperation"); print_liste_field_titre("LabelOperation");
print_liste_field_titre("Debit", "", "", "", "", 'align="right"'); print_liste_field_titre("Debit", "", "", "", "", 'align="right"');
print_liste_field_titre("Credit", "", "", "", "", 'align="right"'); print_liste_field_titre("Credit", "", "", "", "", 'align="right"');
@ -605,7 +615,7 @@ if ($action == 'create')
if ($action == 'update' && $line->id == $id) { if ($action == 'update' && $line->id == $id) {
print '<td>'; print '<td>';
print $formaccounting->select_account($line->numero_compte, 'account_number', 1, array (), 1, 1, ''); print $formaccounting->select_account($line->numero_compte, 'accountingaccount_number', 1, array (), 1, 1, '');
print '</td>'; print '</td>';
print '<td>'; print '<td>';
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
@ -619,7 +629,6 @@ if ($action == 'create')
print '<input type="text" name="subledger_account" value="'.$line->subledger_account.'">'; print '<input type="text" name="subledger_account" value="'.$line->subledger_account.'">';
} }
print '</td>'; print '</td>';
print '<td><input type="text" class="minwidth100" name="label_compte" value="' . $line->label_compte . '"/></td>';
print '<td><input type="text" class="minwidth200" name="label_operation" value="' . $line->label_operation. '"/></td>'; print '<td><input type="text" class="minwidth200" name="label_operation" value="' . $line->label_operation. '"/></td>';
print '<td align="right"><input type="text" size="6" class="right" name="debit" value="' . price($line->debit) . '"/></td>'; print '<td align="right"><input type="text" size="6" class="right" name="debit" value="' . price($line->debit) . '"/></td>';
print '<td align="right"><input type="text" size="6" class="right" name="credit" value="' . price($line->credit) . '"/></td>'; print '<td align="right"><input type="text" size="6" class="right" name="credit" value="' . price($line->credit) . '"/></td>';
@ -628,9 +637,9 @@ if ($action == 'create')
print '<input type="submit" class="button" name="update" value="' . $langs->trans("Update") . '">'; print '<input type="submit" class="button" name="update" value="' . $langs->trans("Update") . '">';
print '</td>'; print '</td>';
} else { } else {
print '<td>' . length_accountg($line->numero_compte) . '</td>'; $accountingaccount->fetch(null, $line->numero_compte, true);
print '<td>' . $accountingaccount->getNomUrl(0,1,1,'',0) . '</td>';
print '<td>' . length_accounta($line->subledger_account) . '</td>'; print '<td>' . length_accounta($line->subledger_account) . '</td>';
print '<td>' . $line->label_compte . '</td>';
print '<td>' . $line->label_operation. '</td>'; print '<td>' . $line->label_operation. '</td>';
print '<td align="right">' . price($line->debit) . '</td>'; print '<td align="right">' . price($line->debit) . '</td>';
print '<td align="right">' . price($line->credit) . '</td>'; print '<td align="right">' . price($line->credit) . '</td>';
@ -663,7 +672,7 @@ if ($action == 'create')
if ($action == "" || $action == 'add') { if ($action == "" || $action == 'add') {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
print $formaccounting->select_account($account_number, 'account_number', 1, array (), 1, 1, ''); print $formaccounting->select_account($accountingaccount_number, 'accountingaccount_number', 1, array (), 1, 1, '');
print '</td>'; print '</td>';
print '<td>'; print '<td>';
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not // TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
@ -677,7 +686,6 @@ if ($action == 'create')
print '<input type="text" name="subledger_account" value="">'; print '<input type="text" name="subledger_account" value="">';
} }
print '</td>'; print '</td>';
print '<td><input type="text" class="minwidth100" name="label_compte" value=""/></td>';
print '<td><input type="text" class="minwidth200" name="label_operation" value=""/></td>'; print '<td><input type="text" class="minwidth200" name="label_operation" value=""/></td>';
print '<td align="right"><input type="text" size="6" class="right" name="debit" value=""/></td>'; print '<td align="right"><input type="text" size="6" class="right" name="debit" value=""/></td>';
print '<td align="right"><input type="text" size="6" class="right" name="credit" value=""/></td>'; print '<td align="right"><input type="text" size="6" class="right" name="credit" value=""/></td>';

View File

@ -1,8 +1,8 @@
<?php <?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com> * Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -36,10 +36,10 @@ 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"));
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'aZ09');
$search_mvt_num = GETPOST('search_mvt_num', 'int'); $search_mvt_num = GETPOST('search_mvt_num', 'int');
$search_doc_type = GETPOST("search_doc_type"); $search_doc_type = GETPOST("search_doc_type", 'alpha');
$search_doc_ref = GETPOST("search_doc_ref"); $search_doc_ref = GETPOST("search_doc_ref", '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'));
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int')); $search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
@ -79,6 +79,7 @@ $search_direction = GETPOST('search_direction', 'alpha');
$search_debit = GETPOST('search_debit', 'alpha'); $search_debit = GETPOST('search_debit', 'alpha');
$search_credit = GETPOST('search_credit', 'alpha'); $search_credit = GETPOST('search_credit', 'alpha');
$search_ledger_code = GETPOST('search_ledger_code', 'alpha'); $search_ledger_code = GETPOST('search_ledger_code', 'alpha');
$search_lettering_code = GETPOST('search_lettering_code', 'alpha');
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
@ -138,11 +139,14 @@ $arrayfields=array(
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1), 't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1), 't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1), 't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1), 't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0), 't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0), 't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
); );
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']);
/* /*
* Actions * Actions
@ -176,6 +180,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$search_date_modification_end = ''; $search_date_modification_end = '';
$search_debit = ''; $search_debit = '';
$search_credit = ''; $search_credit = '';
$search_lettering_code = '';
} }
// Must be after the remove filter action, before the export. // Must be after the remove filter action, before the export.
@ -272,6 +277,10 @@ if (! empty($search_credit)) {
$filter['t.credit'] = $search_credit; $filter['t.credit'] = $search_credit;
$param .= '&search_credit=' . urlencode($search_credit); $param .= '&search_credit=' . urlencode($search_credit);
} }
if (! empty($search_lettering_code)) {
$filter['t.lettering_code'] = $search_lettering_code;
$param .= '&search_lettering_code=' . urlencode($search_lettering_code);
}
if ($action == 'delbookkeeping') { if ($action == 'delbookkeeping') {
@ -337,7 +346,7 @@ if ($action == 'delmouvconfirm') {
} }
} }
// Export into a file with format defined into setup // Export into a file with format defined into setup (FEC, CSV, ...)
if ($action == 'export_file') { if ($action == 'export_file') {
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter); $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
@ -350,7 +359,9 @@ if ($action == 'export_file') {
{ {
$accountancyexport = new AccountancyExport($db); $accountancyexport = new AccountancyExport($db);
$accountancyexport->export($object->lines); $accountancyexport->export($object->lines);
if (!empty($accountancyexport->errors)) {
if (!empty($accountancyexport->errors))
{
setEventMessages('', $accountancyexport->errors, 'errors'); setEventMessages('', $accountancyexport->errors, 'errors');
} }
exit; exit;
@ -546,6 +557,13 @@ if (! empty($arrayfields['t.credit']['checked']))
print '<input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'">'; print '<input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'">';
print '</td>'; print '</td>';
} }
// Lettering code
if (! empty($arrayfields['t.lettering_code']['checked']))
{
print '<td class="liste_titre center">';
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="' . $search_lettering_code . '"/>';
print '</td>';
}
// Code journal // Code journal
if (! empty($arrayfields['t.code_journal']['checked'])) if (! empty($arrayfields['t.code_journal']['checked']))
{ {
@ -595,6 +613,7 @@ if (! empty($arrayfields['t.subledger_account']['checked'])) print_liste_field_t
if (! empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder); if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder); if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
if (! empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre($arrayfields['t.date_creation']['label'], $_SERVER['PHP_SELF'], "t.date_creation", "", $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre($arrayfields['t.date_creation']['label'], $_SERVER['PHP_SELF'], "t.date_creation", "", $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, 'align="center"', $sortfield, $sortorder);
@ -680,6 +699,13 @@ if ($num > 0)
$totalarray['totalcredit'] += $line->credit; $totalarray['totalcredit'] += $line->credit;
} }
// Lettering code
if (! empty($arrayfields['t.lettering_code']['checked']))
{
print '<td align="center">' . $line->lettering_code . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Journal code // Journal code
if (! empty($arrayfields['t.code_journal']['checked'])) if (! empty($arrayfields['t.code_journal']['checked']))
{ {
@ -734,7 +760,6 @@ if ($num > 0)
else print '<td></td>'; else print '<td></td>';
} }
print '</tr>'; print '</tr>';
} }
} }

View File

@ -3,7 +3,8 @@
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -21,12 +22,11 @@
*/ */
/** /**
* \file accountancy/bookkeeping/thirdparty_lettrage.php * \file htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php
* \ingroup Advanced accountancy * \ingroup accountancy
* \brief Onglet de gestion de parametrages des ventilations * \brief Tab to manage customer lettering
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("compta")); $langs->loadLangs(array("compta","accountancy"));
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
@ -61,11 +61,10 @@ $search_year = GETPOST("search_year", 'int');
$search_doc_type = GETPOST("search_doc_type", 'alpha'); $search_doc_type = GETPOST("search_doc_type", 'alpha');
$search_doc_ref = GETPOST("search_doc_ref", 'alpha'); $search_doc_ref = GETPOST("search_doc_ref", 'alpha');
$lettering = GETPOST('lettering'); $lettering = GETPOST('lettering', 'alpha');
if (! empty($lettering)) { if (! empty($lettering)) {
$action = $lettering; $action = $lettering;
} }
$toselect = GETPOST('toselect', 'array');
// Did we click on purge search criteria ? // Did we click on purge search criteria ?
// All tests are required to be compatible with all browsers // All tests are required to be compatible with all browsers
@ -79,6 +78,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$socid = GETPOST("socid", 'int'); $socid = GETPOST("socid", 'int');
// if ($user->societe_id) $socid=$user->societe_id; // if ($user->societe_id) $socid=$user->societe_id;
$lettering = new Lettering($db);
$object = new Societe($db); $object = new Societe($db);
$object->id = $socid; $object->id = $socid;
$result = $object->fetch($socid); $result = $object->fetch($socid);
@ -87,9 +87,6 @@ if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
$form = new Form($db);
$BookKeeping = new lettering($db);
$formaccounting = new FormAccounting($db);
/* /*
* Action * Action
@ -97,82 +94,49 @@ $formaccounting = new FormAccounting($db);
if ($action == 'lettering') { if ($action == 'lettering') {
$result = $BookKeeping->updateLettrage($toselect); $result = $lettering->updateLettering($toselect);
if ($result < 0) { if ($result < 0) {
setEventMessages('', $BookKeeping->errors, 'errors'); setEventMessages('', $lettering->errors, 'errors');
$error ++; $error++;
} }
} }
if ($action == 'autolettrage') { if ($action == 'autolettrage') {
$result = $BookKeeping->lettrageTiers($socid); $result = $lettering->letteringThirdparty($socid);
if ($result < 0) { if ($result < 0) {
setEventMessages('', $BookKeeping->errors, 'errors'); setEventMessages('', $lettering->errors, 'errors');
$error ++; $error++;
} }
} }
llxHeader('', 'Compta - Grand Livre');
/* /*
* Affichage onglets * View
*/ */
$form = new Form($db);
$formaccounting = new FormAccounting($db);
$title=$object->name." - ".$langs->trans('TabLetteringCustomer');
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$title,$help_url);
$head = societe_prepare_head($object); $head = societe_prepare_head($object);
dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error'); dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error');
dol_fiche_head($head, 'accounting', $langs->trans("ThirdParty"), 0, 'company'); dol_fiche_head($head, 'lettering_customer', $langs->trans("ThirdParty"), 0, 'company');
print '<table width="100%" class="border">'; $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
print '<tr><td width="30%">' . $langs->trans("ThirdPartyName") . '</td><td width="70%" colspan="3">';
$object->next_prev_filter = "te.fournisseur = 1";
print $form->showrefnav($object, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom', '', '');
print '</td></tr>';
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
{
print '<tr><td>' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>';
}
print '<tr>'; dol_fiche_end();
print '<td class="nowrap">' . $langs->trans("CustomerCode") . '</td><td colspan="3">';
print $object->code_client;
if ($object->check_codeclient() != 0)
print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>';
print '</td>';
print '</tr>';
print '<tr>'; print '<br>';
print '<td>';
print $form->editfieldkey("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta, $object, $user->rights->societe->creer);
print '</td><td colspan="3">';
print $form->editfieldval("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta, $object, $user->rights->societe->creer);
print '</td>';
print '</tr>';
// Address
print '<tr><td valign="top">' . $langs->trans("Address") . '</td><td colspan="3">';
dol_print_address($object->address, 'gmap', 'thirdparty', $object->id);
print '</td></tr>';
// Zip / Town
print '<tr><td class="nowrap">' . $langs->trans("Zip") . ' / ' . $langs->trans("Town") . '</td><td colspan="3">' . $object->zip . (($object->zip && $object->town) ? ' / ' : '') . $object->town . '</td>';
print '</tr>';
// Country
print '<tr><td>' . $langs->trans("Country") . '</td><td colspan="3">';
// $img=picto_from_langcode($object->country_code);
$img = '';
if ($object->isInEEC())
print $form->textwithpicto(($img ? $img . ' ' : '') . $object->country, $langs->trans("CountryIsInEEC"), 1, 0);
else
print ($img ? $img . ' ' : '') . $object->country;
print '</td></tr>';
print '</table>';
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, "; $sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, "; $sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
@ -209,7 +173,7 @@ while ( $obj = $db->fetch_object($resql) ) {
$sql .= $db->plimit($limit + 1, $offset); $sql .= $db->plimit($limit + 1, $offset);
dol_syslog("/accountancy/bookkeeping/thirdparty_lettrage.php", LOG_DEBUG); dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_customer.php", LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if (! $resql) { if (! $resql) {
dol_print_error($db); dol_print_error($db);
@ -218,7 +182,7 @@ if (! $resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
dol_syslog("/accountancy/bookkeeping/thirdparty_lettrage.php", LOG_DEBUG); dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_customer.php", LOG_DEBUG);
if ($resql) { if ($resql) {
$i = 0; $i = 0;
@ -232,21 +196,19 @@ if ($resql) {
print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Docref", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Docref", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Labelcompte", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "bk.montant", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Sens", $_SERVER["PHP_SELF"], "bk.sens", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Solde", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder);
print '<td></td>';
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>'; print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
print '<td><input type="text" name="search_year" value="' . $search_year . '"></td>'; print '<td><input type="text" name="search_year" value="' . $search_year . '"></td>';
print '<td><input type="text" name="search_doc_refe" value="' . $search_doc_ref . '"></td>'; print '<td><input type="text" name="search_doc_refe" value="' . $search_doc_ref . '"></td>';
print '<td colspan="7">&nbsp;</td>'; print '<td colspan="5">&nbsp;</td>';
print '<td align="right">'; print '<td align="right">';
$searchpicto = $form->showFilterButtons(); $searchpicto = $form->showFilterButtons();
print $searchpicto; print $searchpicto;
@ -257,12 +219,8 @@ if ($resql) {
$tmp = ''; $tmp = '';
while ( $obj = $db->fetch_object($resql) ) { while ( $obj = $db->fetch_object($resql) ) {
if ($tmp != $obj->lettering_code || empty($tmp)) if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
$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);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -270,44 +228,44 @@ if ($resql) {
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">'; print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
print img_edit(); print img_edit();
print '</a>&nbsp;' . $obj->doc_type . '</td>' . "\n"; print '</a>&nbsp;' . $obj->doc_type . '</td>' . "\n";
} else } else {
print '<td>' . $obj->doc_type . '</td>' . "\n"; print '<td>' . $obj->doc_type . '</td>' . "\n";
}
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>'; print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
print '<td>' . $obj->doc_ref . '</td>'; print '<td>' . $obj->doc_ref . '</td>';
print '<td>' . $obj->label_compte . '</td>'; print '<td>' . $obj->label_compte . '</td>';
print '<td>' . price($obj->debit) . '</td>'; print '<td align="right">' . price($obj->debit) . '</td>';
print '<td>' . price($obj->credit) . '</td>'; print '<td align="right">' . price($obj->credit) . '</td>';
print '<td>' . price($obj->montant) . '</td>'; print '<td align="right">' . price(round($solde, 2)) . '</td>';
print '<td>' . $obj->sens . '</td>'; print '<td align="center">' . $obj->code_journal . '</td>';
print '<td>' . $obj->code_journal . '</td>';
print '<td>' . round($solde, 2) . '</td>';
if (empty($obj->lettering_code)) { if (empty($obj->lettering_code)) {
print '<td class="nowrap" align="center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>'; print '<td class="nowrap" align="center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
} else } else
print '<td>' . $obj->lettering_code . '</td>'; print '<td align="center">' . $obj->lettering_code . '</td>';
print "</tr>\n"; print "</tr>\n";
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td colspan="4">Mouvement totaux</td>' . "\n"; print '<td align="right" colspan="4">'.$langs->trans("Total").':</td>' . "\n";
print '<td><strong>' . price($debit) . '</strong></td>'; print '<td align="right"><strong>' . price($debit) . '</strong></td>';
print '<td><strong>' . price($credit) . '</strong></td>'; print '<td align="right"><strong>' . price($credit) . '</strong></td>';
print '<td colspan="5"></td>'; print '<td colspan="5"></td>';
print "</tr>\n"; print "</tr>\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td colspan="9">Solde Comptable</td>' . "\n"; print '<td align="right" colspan="4">'.$langs->trans("Balancing").':</td>' . "\n";
print '<td><strong>' . price($credit - $debit) . '</strong></td>'; print '<td colspan="2">&nbsp;</td>';
print '<td colspan="5"></td>'; print '<td align="right"><strong>' . price($credit - $debit) . '</strong></td>';
print '<td colspan="3"></td>';
print "</tr>\n"; print "</tr>\n";
print "</table>"; print "</table>";
print '<input class="butAction" type="submit" value="lettering" name="lettering" id="lettering">'; print '<input class="butAction" type="submit" value="lettering" name="lettering" id="lettering">';
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '&action=autolettrage">' . $langs->trans('AccountancyAutoLettering') . '</a>'; //print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '&action=autolettering">' . $langs->trans('AccountancyAutoLettering') . '</a>';
print "</form>"; print "</form>";
$db->free($resql); $db->free($resql);
} else { } else {
@ -317,4 +275,3 @@ if ($resql) {
// End of page // End of page
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -3,7 +3,8 @@
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -21,14 +22,11 @@
*/ */
/** /**
* \file accountancy/bookkeeping/thirdparty_lettrage_supplier.php * \file htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php
* \ingroup Advanced accountancy * \ingroup Advanced accountancy
* \brief Tab to setup lettering * \brief Tab to setup lettering
*/ */
// Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
@ -36,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("compta")); $langs->loadLangs(array("compta","accountancy"));
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
@ -63,11 +61,10 @@ $search_year = GETPOST("search_year",'int');
$search_doc_type = GETPOST("search_doc_type",'alpha'); $search_doc_type = GETPOST("search_doc_type",'alpha');
$search_doc_ref = GETPOST("search_doc_ref",'alpha'); $search_doc_ref = GETPOST("search_doc_ref",'alpha');
$lettering = GETPOST('lettering'); $lettering = GETPOST('lettering', 'alpha');
if (!empty($lettering)) { if (!empty($lettering)) {
$action=$lettering; $action=$lettering;
} }
$toselect = GETPOST('toselect','array');
// Did we click on purge search criteria ? // Did we click on purge search criteria ?
// All tests are required to be compatible with all browsers // All tests are required to be compatible with all browsers
@ -83,6 +80,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$socid = GETPOST("socid", 'int'); $socid = GETPOST("socid", 'int');
// if ($user->societe_id) $socid=$user->societe_id; // if ($user->societe_id) $socid=$user->societe_id;
$lettering = new Lettering($db);
$object = new Societe($db); $object = new Societe($db);
$object->id = $socid; $object->id = $socid;
$result = $object->fetch($socid); $result = $object->fetch($socid);
@ -91,104 +89,53 @@ if ($result<0)
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
$form = new Form($db);
$BookKeeping = new lettering($db);
$formaccounting = new FormAccounting($db);
/* /*
* Action * Action
*/ */
if ($action == 'lettering') { if ($action == 'lettering') {
$result = $BookKeeping->updateLettrage($toselect); $result = $lettering->updateLettering($toselect);
// var_dump($result);
if ($result < 0) { if ($result < 0) {
setEventMessages('', $BookKeeping->errors, 'errors'); setEventMessages('', $lettering->errors, 'errors');
$error ++; $error++;
} }
} }
if ($action == 'autolettrage') { if ($action == 'autolettrage') {
$result = $BookKeeping->lettrageTiers($socid); $result = $lettering->letteringThirdparty($socid);
if ($result < 0) { if ($result < 0) {
setEventMessages('', $BookKeeping->errors, 'errors'); setEventMessages('', $lettering->errors, 'errors');
$error ++; $error++;
} }
} }
$title = 'AccountancyLettrage';
llxHeader('', $title);
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if (!empty($search_year)) $param.='&search_year='.$search_year;
if (!empty($socid)) $param.='&socid='.$socid;
if (!empty($search_doc_type)) $param.='&search_doc_type='.$search_doc_type;
if (!empty($search_doc_ref)) $param.='&search_doc_ref='.$search_doc_ref;
/* /*
* Display tabs * View
*/ */
$form = new Form($db);
$formaccounting = new FormAccounting($db);
$title=$object->name." - ".$langs->trans('TabLetteringSupplier');
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$title,$help_url);
$head = societe_prepare_head($object); $head = societe_prepare_head($object);
dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error'); dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error');
dol_fiche_head($head, 'accounting_supplier', $langs->trans("ThirdParty"), 0, 'company'); dol_fiche_head($head, 'lettering_supplier', $langs->trans("ThirdParty"), 0, 'company');
print '<table width="100%" class="border">'; $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
print '<tr><td width="30%">' . $langs->trans("ThirdPartyName") . '</td><td width="70%" colspan="3">';
$object->next_prev_filter = "te.fournisseur = 1";
print $form->showrefnav($object, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom', '', '');
print '</td></tr>';
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
{
print '<tr><td>' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>';
}
print '<tr>'; dol_fiche_end();
print '<td class="nowrap">' . $langs->trans("SupplierCode") . '</td><td colspan="3">';
print $object->code_fournisseur;
if ($object->check_codefournisseur() != 0)
print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>';
print '</td>';
print '</tr>';
print '<tr>';
print '<td>';
print $form->editfieldkey("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->rights->societe->creer);
print '</td><td colspan="3">';
print $form->editfieldval("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->rights->societe->creer);
print '</td>';
print '</tr>';
// Address
print '<tr><td valign="top">' . $langs->trans("Address") . '</td><td colspan="3">';
dol_print_address($object->address, 'gmap', 'thirdparty', $object->id);
print '</td></tr>';
// Zip / Town
print '<tr><td class="nowrap">' . $langs->trans("Zip") . ' / ' . $langs->trans("Town") . '</td><td colspan="3">' . $object->zip . (($object->zip && $object->town) ? ' / ' : '') . $object->town . '</td>';
print '</tr>';
// Country
print '<tr><td>' . $langs->trans("Country") . '</td><td colspan="3">';
// $img=picto_from_langcode($object->country_code);
$img = '';
if ($object->isInEEC())
print $form->textwithpicto(($img ? $img . ' ' : '') . $object->country, $langs->trans("CountryIsInEEC"), 1, 0);
else
print ($img ? $img . ' ' : '') . $object->country;
print '</td></tr>';
print '</table>';
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, "; $sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, "; $sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
@ -252,21 +199,19 @@ if ($resql) {
print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type","",$param,"",$sortfield,$sortorder); print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date","",$param,"",$sortfield,$sortorder); print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Docref", $_SERVER["PHP_SELF"], "bk.doc_ref","",$param,"",$sortfield,$sortorder); print_liste_field_titre("Docref", $_SERVER["PHP_SELF"], "bk.doc_ref","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Labelcompte", $_SERVER["PHP_SELF"], "bk.label_compte","",$param,"",$sortfield,$sortorder); print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit","",$param,"",$sortfield,$sortorder); print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit","",$param,"",$sortfield,$sortorder); print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "bk.montant","",$param,"",$sortfield,$sortorder); print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Sens", $_SERVER["PHP_SELF"], "bk.sens","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal","",$param,"",$sortfield,$sortorder); print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Solde", $_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder);
print '<td></td>';
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>'; print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
print '<td><input type="text" name="search_year" value="' . $search_year . '"></td>'; print '<td><input type="text" name="search_year" value="' . $search_year . '"></td>';
print '<td><input type="text" name="search_doc_refe" value="' . $search_doc_ref . '"></td>'; print '<td><input type="text" name="search_doc_refe" value="' . $search_doc_ref . '"></td>';
print '<td colspan="7">&nbsp;</td>'; print '<td colspan="6">&nbsp;</td>';
print '<td align="right">'; print '<td align="right">';
$searchpicto=$form->showFilterButtons(); $searchpicto=$form->showFilterButtons();
print $searchpicto; print $searchpicto;
@ -277,12 +222,8 @@ if ($resql) {
$tmp = ''; $tmp = '';
while ($obj = $db->fetch_object($resql)) { while ($obj = $db->fetch_object($resql)) {
if ($tmp != $obj->lettering_code || empty($tmp)) if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
$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);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -290,45 +231,44 @@ if ($resql) {
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">'; print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
print img_edit(); print img_edit();
print '</a>&nbsp;' . $obj->doc_type . '</td>' . "\n"; print '</a>&nbsp;' . $obj->doc_type . '</td>' . "\n";
} else } else {
print '<td>' . $obj->doc_type . '</td>' . "\n"; print '<td>' . $obj->doc_type . '</td>' . "\n";
}
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>'; print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
print '<td>' . $obj->doc_ref . '</td>'; print '<td>' . $obj->doc_ref . '</td>';
print '<td>' . $obj->label_compte . '</td>'; print '<td>' . $obj->label_compte . '</td>';
print '<td>' . price($obj->debit) . '</td>'; print '<td align="right">' . price($obj->debit) . '</td>';
print '<td>' . price($obj->credit) . '</td>'; print '<td align="right">' . price($obj->credit) . '</td>';
print '<td>' . price($obj->montant) . '</td>'; print '<td align="right">' . price(round($solde, 2)) . '</td>';
print '<td>' . $obj->sens . '</td>'; print '<td align="center">' . $obj->code_journal . '</td>';
print '<td>' . $obj->code_journal . '</td>';
print '<td>' . round($solde, 2) . '</td>';
if (empty($obj->lettering_code)) { if (empty($obj->lettering_code)) {
print '<td class="nowrap" align="center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>'; print '<td class="nowrap" align="center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
} else } else
print '<td>' . $obj->lettering_code . '</td>'; print '<td align="center">' . $obj->lettering_code . '</td>';
print "</tr>\n"; print "</tr>\n";
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td align="right" colspan="4">'.$langs->trans("Total").':</td>' . "\n";
print '<td colspan="4">Mouvement totaux</td>' . "\n"; print '<td align="right"><strong>' . price($debit) . '</strong></td>';
print '<td><strong>' . price($debit) . '</strong></td>'; print '<td align="right"><strong>' . price($credit) . '</strong></td>';
print '<td><strong>' . price($credit) . '</strong></td>';
print '<td colspan="5"></td>'; print '<td colspan="5"></td>';
print "</tr>\n"; print "</tr>\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td colspan="9">Solde Comptable</td>' . "\n"; print '<td align="right" colspan="4">'.$langs->trans("Balancing").':</td>' . "\n";
print '<td><strong>' . price($credit - $debit) . '</strong></td>'; print '<td colspan="2">&nbsp;</td>';
print '<td colspan="5"></td>'; print '<td align="right"><strong>' . price($credit - $debit) . '</strong></td>';
print '<td colspan="3"></td>';
print "</tr>\n"; print "</tr>\n";
print "</table>"; print "</table>";
print '<input class="butAction" type="submit" value="lettering" name="lettering" id="lettering">'; print '<input class="butAction" type="submit" value="' . $langs->trans('AccountancyLettering') . '" name="lettering" id="lettering">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid=' . $object->id . '&action=autolettrage">'.$langs->trans('AccountancyAutoLettering').'</a>'; //print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid=' . $object->id . '&action=autolettrage">'.$langs->trans('AccountancyAutoLettering').'</a>';
print "</form>"; print "</form>";
$db->free($resql); $db->free($resql);
} else { } else {

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro> /* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@zendsi.com> * Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -77,7 +78,7 @@ class AccountancyCategory // extends CommonObject
public $range_account; public $range_account;
/** /**
* @var mixed Sample property 1 * @var int Sens of the account: 0: credit - debit, 1: debit - credit
*/ */
public $sens; public $sens;
@ -162,16 +163,17 @@ class AccountancyCategory // extends CommonObject
// Insert request // Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_accounting_category("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_accounting_category(";
if ($this->rowid > 0) $sql.= "rowid,"; if ($this->rowid > 0) $sql.= "rowid, ";
$sql.= "code,"; $sql.= "code, ";
$sql.= "label,"; $sql.= "label, ";
$sql.= "range_account,"; $sql.= "range_account, ";
$sql.= "sens,"; $sql.= "sens, ";
$sql.= "category_type,"; $sql.= "category_type, ";
$sql.= "formula,"; $sql.= "formula, ";
$sql.= "position,"; $sql.= "position, ";
$sql.= "fk_country,"; $sql.= "fk_country, ";
$sql.= "active"; $sql.= "active, ";
$sql.= "entity";
$sql.= ") VALUES ("; $sql.= ") VALUES (";
if ($this->rowid > 0) $sql.= " ".$this->rowid.","; if ($this->rowid > 0) $sql.= " ".$this->rowid.",";
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").","; $sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
@ -183,6 +185,7 @@ class AccountancyCategory // extends CommonObject
$sql.= " ".(! isset($this->position)?'NULL':$this->db->escape($this->position)).","; $sql.= " ".(! isset($this->position)?'NULL':$this->db->escape($this->position)).",";
$sql.= " ".(! isset($this->fk_country)?'NULL':$this->db->escape($this->fk_country)).","; $sql.= " ".(! isset($this->fk_country)?'NULL':$this->db->escape($this->fk_country)).",";
$sql.= " ".(! isset($this->active)?'NULL':$this->db->escape($this->active)); $sql.= " ".(! isset($this->active)?'NULL':$this->db->escape($this->active));
$sql.= ", ".$conf->entity;
$sql.= ")"; $sql.= ")";
$this->db->begin(); $this->db->begin();
@ -236,9 +239,8 @@ class AccountancyCategory // extends CommonObject
* @param string $label Label * @param string $label Label
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($id,$code='',$label='') function fetch($id, $code='', $label='')
{ {
global $langs;
$sql = "SELECT"; $sql = "SELECT";
$sql.= " t.rowid,"; $sql.= " t.rowid,";
$sql.= " t.code,"; $sql.= " t.code,";
@ -252,8 +254,12 @@ class AccountancyCategory // extends CommonObject
$sql.= " t.active"; $sql.= " t.active";
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as t"; $sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as t";
if ($id) $sql.= " WHERE t.rowid = ".$id; if ($id) $sql.= " WHERE t.rowid = ".$id;
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'"; else
elseif ($label) $sql.= " WHERE t.label = '".$this->db->escape($label)."'"; {
$sql.= " WHERE t.entity IN (".getEntity('c_accounting_category').")"; // Dont't use entity if you use rowid
if ($code) $sql.= " AND t.code = '".$this->db->escape($code)."'";
elseif ($label) $sql.= " AND t.label = '".$this->db->escape($label)."'";
}
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@ -479,7 +485,7 @@ class AccountancyCategory // extends CommonObject
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; $sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1"; $sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = = " . $conf->entity . ")"; $sql .= " AND aa.entity = " . $conf->entity . ")";
$sql .= " GROUP BY t.numero_compte, t.label_operation, t.doc_ref"; $sql .= " GROUP BY t.numero_compte, t.label_operation, t.doc_ref";
$sql .= " ORDER BY t.numero_compte"; $sql .= " ORDER BY t.numero_compte";
@ -711,49 +717,76 @@ class AccountancyCategory // extends CommonObject
/** /**
* Function to show result of an accounting account from the ledger with a direction and a period * Function to show result of an accounting account from the ledger with a direction and a period
* *
* @param int $cpt Id accounting account * @param int|array $cpt Accounting account or array of accounting account
* @param string $month Specifig month - Can be empty
* @param string $date_start Date start * @param string $date_start Date start
* @param string $date_end Date end * @param string $date_end Date end
* @param int $sens Sens of the account: 0: credit - debit, 1: debit - credit * @param int $sens Sens of the account: 0: credit - debit, 1: debit - credit
* @param string $thirdparty_code Thirdparty code * @param string $thirdparty_code Thirdparty code
* @return integer Result in table * @param int $month Specifig month - Can be empty
* @param int $year Specifig year - Can be empty
* @return integer <0 if KO, >= 0 if OK
*/ */
public function getResult($cpt, $month, $date_start, $date_end, $sens, $thirdparty_code='nofilter') public function getSumDebitCredit($cpt, $date_start, $date_end, $sens, $thirdparty_code='nofilter', $month=0, $year=0)
{ {
global $conf;
$this->sdc = 0;
$this->sdcpermonth = array();
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit"; $sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
if (is_array($cpt)) $sql.=", t.numero_compte as accountancy_account";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
$sql .= " WHERE t.numero_compte = '" . $cpt."'"; //if (in_array($this->db->type, array('mysql', 'mysqli'))) $sql.=' USE INDEX idx_accounting_bookkeeping_doc_date';
if (! empty($date_start) && ! empty($date_end)) $sql .= " WHERE t.entity = ".$conf->entity;
$sql.= " AND t.doc_date >= '".$this->db->idate($date_start)."' AND t.doc_date <= '".$this->db->idate($date_end)."'"; if (is_array($cpt))
if (! empty($month)) { {
$sql .= " AND MONTH(t.doc_date) = " . $month; $listofaccount='';
foreach($cpt as $cptcursor)
{
if ($listofaccount) $listofaccount.=",";
$listofaccount.="'".$cptcursor."'";
}
$sql .= " AND t.numero_compte IN (" .$listofaccount. ")";
}
else
{
$sql .= " AND t.numero_compte = '" . $this->db->escape($cpt) . "'";
}
if (! empty($date_start) && ! empty($date_end) && (empty($month) || empty($year))) // If month/year provided, it is stronger than filter date_start/date_end
$sql .= " AND (t.doc_date BETWEEN '".$this->db->idate($date_start)."' AND '".$this->db->idate($date_end)."')";
if (! empty($month) && ! empty($year)) {
$sql .= " AND (t.doc_date BETWEEN '".$this->db->idate(dol_get_first_day($year, $month))."' AND '".$this->db->idate(dol_get_last_day($year, $month))."')";
} }
if ($thirdparty_code != 'nofilter') if ($thirdparty_code != 'nofilter')
{ {
$sql .= " AND thirdparty_code = '".$this->db->escape($thirdparty_code)."'"; $sql .= " AND t.thirdparty_code = '".$this->db->escape($thirdparty_code)."'";
} }
if (is_array($cpt)) $sql.=" GROUP BY t.numero_compte";
//print $sql;
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql)
if ($resql) { {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$this->sdc = 0; if ($num)
if ($num) { {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
if ($sens == 1) { if ($sens == 1) {
$this->sdc = $obj->debit - $obj->credit; $this->sdc = $obj->debit - $obj->credit;
} else { } else {
$this->sdc = $obj->credit - $obj->debit; $this->sdc = $obj->credit - $obj->debit;
} }
if (is_array($cpt))
{
$this->sdcperaccount[$obj->accountancy_account] = $this->sdc;
}
} }
return $num; return $num;
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error " . $this->db->lasterror();
$this->errors[] = $this->error;
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
return -1;
return - 1;
} }
} }
@ -765,7 +798,7 @@ class AccountancyCategory // extends CommonObject
*/ */
public function getCats($categorytype=-1) public function getCats($categorytype=-1)
{ {
global $db, $langs, $user, $mysoc, $conf; global $conf, $mysoc;
if (empty($mysoc->country_id)) { if (empty($mysoc->country_id)) {
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined'); dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
@ -774,7 +807,7 @@ class AccountancyCategory // extends CommonObject
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type"; $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c"; $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
$sql .= " WHERE c.active = 1 "; $sql .= " WHERE c.active = 1";
$sql .= " AND c.entity = " . $conf->entity; $sql .= " AND c.entity = " . $conf->entity;
if ($categorytype >= 0) $sql.=" AND c.category_type = 1"; if ($categorytype >= 0) $sql.=" AND c.category_type = 1";
$sql .= " AND (c.fk_country = ".$mysoc->country_id." OR c.fk_country = 0)"; $sql .= " AND (c.fk_country = ".$mysoc->country_id." OR c.fk_country = 0)";
@ -816,13 +849,13 @@ class AccountancyCategory // extends CommonObject
* Get all accounting account of a group. * Get all accounting account of a group.
* You must choose between first parameter (personalized group) or the second (free criteria filter) * You must choose between first parameter (personalized group) or the second (free criteria filter)
* *
* @param int $cat_id Id if personalized accounting group/category * @param int $cat_id Id if personalized accounting group/category
* @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts * @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts
* @return array|int Array of accounting accounts or -1 if error * @return array|int Array of accounting accounts or -1 if error
*/ */
public function getCptsCat($cat_id, $predefinedgroupwhere='') public function getCptsCat($cat_id, $predefinedgroupwhere='')
{ {
global $mysoc; global $conf, $mysoc;
$sql = ''; $sql = '';
if (empty($mysoc->country_id) && empty($mysoc->country_code)) { if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
@ -835,6 +868,7 @@ class AccountancyCategory // extends CommonObject
$sql = "SELECT t.rowid, t.account_number, t.label as account_label"; $sql = "SELECT t.rowid, t.account_number, t.label as account_label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = ".$cat_id; $sql .= " WHERE t.fk_accounting_category = ".$cat_id;
$sql .= " AND t.entity = " . $conf->entity;
$sql .= " ORDER BY t.account_number"; $sql .= " ORDER BY t.account_number";
} }
else else
@ -842,6 +876,7 @@ class AccountancyCategory // extends CommonObject
$sql = "SELECT t.rowid, t.account_number, t.label as account_label"; $sql = "SELECT t.rowid, t.account_number, t.label as account_label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql .= " WHERE ".$predefinedgroupwhere; $sql .= " WHERE ".$predefinedgroupwhere;
$sql .= " AND t.entity = " . $conf->entity;
$sql .= " ORDER BY t.account_number"; $sql .= " ORDER BY t.account_number";
} }
//echo $sql; //echo $sql;
@ -855,13 +890,12 @@ class AccountancyCategory // extends CommonObject
if ($num) { if ($num) {
while ($obj = $this->db->fetch_object($resql)) while ($obj = $this->db->fetch_object($resql))
{ {
$name_cat = $obj->name_cat;
$data[] = array ( $data[] = array (
'id' => $obj->rowid, 'id' => $obj->rowid,
'account_number' => $obj->account_number, 'account_number' => $obj->account_number,
'account_label' => $obj->account_label, 'account_label' => $obj->account_label,
); );
$i ++; $i++;
} }
} }
return $data; return $data;

View File

@ -206,7 +206,7 @@ class AccountancyExport
/** /**
* Function who chose which export to use with the default config * 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 data
* @return void * @return void
@ -214,16 +214,17 @@ class AccountancyExport
public function export(&$TData) public function export(&$TData)
{ {
global $conf, $langs; global $conf, $langs;
global $search_date_end; // Used into /accountancy/tpl/export_journal.tpl.php
// Define name of file to save
$filename = 'general_ledger-'.$this->getFormatCode($conf->global->ACCOUNTING_EXPORT_MODELCSV); $filename = 'general_ledger-'.$this->getFormatCode($conf->global->ACCOUNTING_EXPORT_MODELCSV);
$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 ($conf->global->ACCOUNTING_EXPORT_MODELCSV) {
case self::$EXPORT_TYPE_NORMAL : case self::$EXPORT_TYPE_NORMAL :
/*$this->exportNormal($TData);
break;*/
case self::$EXPORT_TYPE_CONFIGURABLE : case self::$EXPORT_TYPE_CONFIGURABLE :
$this->exportConfigurable($TData); $this->exportConfigurable($TData);
break; break;
@ -261,32 +262,6 @@ class AccountancyExport
} }
} }
/**
* Export format : Normal
*
* @param array $objectLines data
*
* @return void
*/
/* Use $EXPORT_TYPE_CONFIGURABLE instead
public function exportNormal($objectLines)
{
global $conf;
foreach ( $objectLines as $line ) {
// Std export
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
print $date . $this->separator;
print $line->doc_ref . $this->separator;
print length_accountg($line->numero_compte) . $this->separator;
print length_accounta($line->subledger_account) . $this->separator;
print price($line->debit) . $this->separator;
print price($line->credit) . $this->separator;
print $line->code_journal . $this->separator;
print $this->end_line;
}
}
*/
/** /**
* Export format : CEGID * Export format : CEGID

View File

@ -4,6 +4,7 @@
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com> * Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -30,6 +31,9 @@
*/ */
class AccountingAccount extends CommonObject class AccountingAccount extends CommonObject
{ {
/**
* @var string Name of element
*/
public $element='accounting_account'; public $element='accounting_account';
/** /**
@ -59,16 +63,6 @@ class AccountingAccount extends CommonObject
*/ */
public $db; public $db;
/**
* @var string Error code (or message)
*/
public $error='';
/**
* @var string[] Error codes (or messages)
*/
public $errors = array();
/** /**
* @var int ID * @var int ID
*/ */
@ -79,17 +73,39 @@ class AccountingAccount extends CommonObject
*/ */
public $rowid; public $rowid;
public $datec; // Creation date /**
* @var string Creation date
*/
public $datec;
/** /**
* @var int ID * @var string pcg version
*/ */
public $fk_pcg_version; public $fk_pcg_version;
/**
* @var string pcg type
*/
public $pcg_type; public $pcg_type;
/**
* @var string pcg subtype
*/
public $pcg_subtype; public $pcg_subtype;
/**
* @var string account number
*/
public $account_number; public $account_number;
/**
* @var int ID parent account
*/
public $account_parent; public $account_parent;
/**
* @var int ID category account
*/
public $account_category; public $account_category;
/** /**
@ -112,8 +128,10 @@ class AccountingAccount extends CommonObject
*/ */
public $fk_user_modif; public $fk_user_modif;
public $active; // duplicate with status /**
* @var int active (duplicate with status)
*/
public $active;
/** /**
* Constructor * Constructor

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2014-2017 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2014-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@zendsi.com> * Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2015-2017 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2015-2017 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -19,9 +19,9 @@
*/ */
/** /**
* \file htdocs/accountancy/class/bookkeeping.class.php * \file htdocs/accountancy/class/bookkeeping.class.php
* \ingroup Advanced accountancy * \ingroup Advanced accountancy
* \brief File of class to manage Ledger (General Ledger and Subledger) * \brief File of class to manage Ledger (General Ledger and Subledger)
*/ */
// Class // Class
@ -69,7 +69,15 @@ class BookKeeping extends CommonObject
public $doc_date; public $doc_date;
public $date_lim_reglement; public $date_lim_reglement;
public $doc_type;
/**
* @var string doc_type
*/
public $doc_type;
/**
* @var string doc_ref
*/
public $doc_ref; public $doc_ref;
/** /**
@ -82,12 +90,35 @@ class BookKeeping extends CommonObject
*/ */
public $fk_docdet; public $fk_docdet;
public $thirdparty_code; /**
* @var string thirdparty code
*/
public $thirdparty_code;
/**
* @var string subledger account
*/
public $subledger_account; public $subledger_account;
/**
* @var string subledger label
*/
public $subledger_label; public $subledger_label;
/**
* @var string doc_type
*/
public $numero_compte; public $numero_compte;
public $label_compte;
public $label_operation; /**
* @var string label compte
*/
public $label_compte;
/**
* @var string label operation
*/
public $label_operation;
public $debit; public $debit;
public $credit; public $credit;
public $montant; public $montant;
@ -785,7 +816,8 @@ class BookKeeping extends CommonObject
if ($resql) { if ($resql) {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
while ( $obj = $this->db->fetch_object($resql) ) { $i = 0;
while (($obj = $this->db->fetch_object($resql)) && (empty($limit) || $i < min($limit, $num))) {
$line = new BookKeepingLine(); $line = new BookKeepingLine();
$line->id = $obj->rowid; $line->id = $obj->rowid;
@ -817,6 +849,8 @@ class BookKeeping extends CommonObject
$line->date_creation = $obj->date_creation; $line->date_creation = $obj->date_creation;
$this->lines[] = $line; $this->lines[] = $line;
$i++;
} }
$this->db->free($resql); $this->db->free($resql);
@ -832,14 +866,13 @@ class BookKeeping extends CommonObject
/** /**
* Load object in memory from the database * Load object in memory from the database
* *
* @param string $sortorder Sort Order * @param string $sortorder Sort Order
* @param string $sortfield Sort field * @param string $sortfield Sort field
* @param int $limit offset limit * @param int $limit Offset limit
* @param int $offset offset limit * @param int $offset Offset limit
* @param array $filter filter array * @param array $filter Filter array
* @param string $filtermode filter mode (AND or OR) * @param string $filtermode Filter mode (AND or OR)
* * @return int <0 if KO, >0 if OK
* @return int <0 if KO, >0 if OK
*/ */
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
{ {
@ -862,6 +895,7 @@ class BookKeeping extends CommonObject
$sql .= " t.label_operation,"; $sql .= " t.label_operation,";
$sql .= " t.debit,"; $sql .= " t.debit,";
$sql .= " t.credit,"; $sql .= " t.credit,";
$sql .= " t.lettering_code,";
$sql .= " t.montant,"; $sql .= " t.montant,";
$sql .= " t.sens,"; $sql .= " t.sens,";
$sql .= " t.fk_user_author,"; $sql .= " t.fk_user_author,";
@ -897,7 +931,7 @@ class BookKeeping extends CommonObject
} }
} }
} }
$sql.= ' WHERE entity IN (' . getEntity('accountancy') . ')'; $sql.= ' WHERE t.entity IN (' . getEntity('accountancy') . ')';
if (count($sqlwhere) > 0) { if (count($sqlwhere) > 0) {
$sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere); $sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere);
} }
@ -914,7 +948,9 @@ class BookKeeping extends CommonObject
if ($resql) { if ($resql) {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
while ( $obj = $this->db->fetch_object($resql) ) { $i = 0;
while (($obj = $this->db->fetch_object($resql)) && (empty($limit) || $i < min($limit, $num)))
{
$line = new BookKeepingLine(); $line = new BookKeepingLine();
$line->id = $obj->rowid; $line->id = $obj->rowid;
@ -934,6 +970,7 @@ class BookKeeping extends CommonObject
$line->credit = $obj->credit; $line->credit = $obj->credit;
$line->montant = $obj->montant; $line->montant = $obj->montant;
$line->sens = $obj->sens; $line->sens = $obj->sens;
$line->lettering_code = $obj->lettering_code;
$line->fk_user_author = $obj->fk_user_author; $line->fk_user_author = $obj->fk_user_author;
$line->import_key = $obj->import_key; $line->import_key = $obj->import_key;
$line->code_journal = $obj->code_journal; $line->code_journal = $obj->code_journal;
@ -943,6 +980,8 @@ class BookKeeping extends CommonObject
$line->date_modification = $this->db->jdate($obj->date_modification); $line->date_modification = $this->db->jdate($obj->date_modification);
$this->lines[] = $line; $this->lines[] = $line;
$i++;
} }
$this->db->free($resql); $this->db->free($resql);
@ -950,8 +989,7 @@ class BookKeeping extends CommonObject
} else { } else {
$this->errors[] = 'Error ' . $this->db->lasterror(); $this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
return -1;
return - 1;
} }
} }
@ -1001,8 +1039,7 @@ class BookKeeping extends CommonObject
} }
} }
} }
$sql.= ' WHERE 1 = 1'; $sql.= ' WHERE entity IN (' . getEntity('accountancy') . ')';
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
if (count($sqlwhere) > 0) { if (count($sqlwhere) > 0) {
$sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere); $sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere);
} }
@ -1022,13 +1059,14 @@ class BookKeeping extends CommonObject
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
while (($obj = $this->db->fetch_object($resql)) && ($i < min($limit, $num))) while (($obj = $this->db->fetch_object($resql)) && (empty($limit) || $i < min($limit, $num)))
{ {
$line = new BookKeepingLine(); $line = new BookKeepingLine();
$line->numero_compte = $obj->numero_compte; $line->numero_compte = $obj->numero_compte;
$line->debit = $obj->debit; $line->debit = $obj->debit;
$line->credit = $obj->credit; $line->credit = $obj->credit;
$this->lines[] = $line; $this->lines[] = $line;
$i++; $i++;
@ -1539,7 +1577,7 @@ class BookKeeping extends CommonObject
$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();
@ -1603,7 +1641,7 @@ class BookKeeping extends CommonObject
$this->linesexport = array (); $this->linesexport = array ();
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
while ( $obj = $this->db->fetch_object($resql) ) { while ($obj = $this->db->fetch_object($resql)) {
$line = new BookKeepingLine(); $line = new BookKeepingLine();
$line->id = $obj->rowid; $line->id = $obj->rowid;
@ -1834,7 +1872,6 @@ class BookKeeping extends CommonObject
} }
return $obj->label; return $obj->label;
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error " . $this->db->lasterror();
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);

View File

@ -1,7 +1,8 @@
<?php <?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -18,26 +19,27 @@
*/ */
/** /**
* \file accountancy/class/bookkeeping.class.php * \file htdocs/accountancy/class/lettering.class.php
* \ingroup Advanced accountancy * \ingroup Advanced accountancy
* \brief File of class for lettering * \brief File of class for lettering
*/ */
include_once DOL_DOCUMENT_ROOT . "/accountancy/class/bookkeeping.class.php"; include_once DOL_DOCUMENT_ROOT . "/accountancy/class/bookkeeping.class.php";
include_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php"; include_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php";
include_once DOL_DOCUMENT_ROOT . "/core/lib/date.lib.php"; include_once DOL_DOCUMENT_ROOT . "/core/lib/date.lib.php";
/** /**
* Class lettering * Class Lettering
*/ */
class lettering extends BookKeeping class Lettering extends BookKeeping
{ {
/** /**
* lettrageTiers * letteringThirdparty
* *
* @param int $socid Thirdparty id * @param int $socid Thirdparty id
* @return int 1 OK, <0 error * @return int 1 OK, <0 error
*/ */
public function lettrageTiers($socid) public function letteringThirdparty($socid)
{ {
global $conf; global $conf;
@ -47,6 +49,7 @@ class lettering extends BookKeeping
$object->id = $socid; $object->id = $socid;
$object->fetch($socid); $object->fetch($socid);
if ($object->code_compta == '411CUSTCODE') { if ($object->code_compta == '411CUSTCODE') {
$object->code_compta = ''; $object->code_compta = '';
} }
@ -208,7 +211,7 @@ class lettering extends BookKeeping
} }
if (count($ids) > 1) { if (count($ids) > 1) {
$result = $this->updatelettrage($ids); $result = $this->updateLettering($ids);
} }
} }
} }
@ -229,7 +232,7 @@ class lettering extends BookKeeping
* @param boolean $notrigger no trigger * @param boolean $notrigger no trigger
* @return number * @return number
*/ */
public function updateLettrage($ids = array(), $notrigger = false) public function updateLettering($ids = array(), $notrigger = false)
{ {
$error = 0; $error = 0;
$lettre = 'AAA'; $lettre = 'AAA';

View File

@ -94,7 +94,7 @@ $facture_static = new Facture($db);
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
if (! empty($id)) { if (! empty($id)) {
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price,"; $sql = "SELECT f.ref, f.rowid as facid, l.fk_product, l.description, l.price,";
$sql .= " l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice, p.accountancy_code_sell as code_sell,"; $sql .= " l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice, p.accountancy_code_sell as code_sell,";
$sql .= " l.fk_code_ventilation, aa.account_number, aa.label"; $sql .= " l.fk_code_ventilation, aa.account_number, aa.label";
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as l"; $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as l";
@ -128,7 +128,7 @@ if (! empty($id)) {
// Ref facture // Ref facture
print '<tr><td>' . $langs->trans("Invoice") . '</td>'; print '<tr><td>' . $langs->trans("Invoice") . '</td>';
$facture_static->ref = $objp->facnumber; $facture_static->ref = $objp->ref;
$facture_static->id = $objp->facid; $facture_static->id = $objp->facid;
print '<td>' . $facture_static->getNomUrl(1) . '</td>'; print '<td>' . $facture_static->getNomUrl(1) . '</td>';
print '</tr>'; print '</tr>';

View File

@ -64,7 +64,7 @@ $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
$offset = $limit * $page; $offset = $limit * $page;
if (! $sortfield) if (! $sortfield)
$sortfield = "f.datef, f.facnumber, fd.rowid"; $sortfield = "f.datef, f.ref, fd.rowid";
if (! $sortorder) { if (! $sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
$sortorder = "DESC"; $sortorder = "DESC";
@ -135,7 +135,6 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
$account_parent = ''; // Protection to avoid to mass apply it a second time $account_parent = ''; // Protection to avoid to mass apply it a second time
} }
} }
@ -168,7 +167,7 @@ print '<script type="text/javascript">
/* /*
* Customer Invoice lines * Customer Invoice lines
*/ */
$sql = "SELECT f.rowid as facid, f.facnumber as ref, f.type, f.datef, f.ref_client,"; $sql = "SELECT f.rowid as facid, f.ref as ref, f.type, f.datef, f.ref_client,";
$sql.= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,"; $sql.= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,"; $sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
$sql.= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number, aa.label as label_compte,"; $sql.= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number, aa.label as label_compte,";
@ -196,7 +195,7 @@ if ($search_lineid) {
$sql .= natural_search("fd.rowid", $search_lineid, 1); $sql .= natural_search("fd.rowid", $search_lineid, 1);
} }
if (strlen(trim($search_invoice))) { if (strlen(trim($search_invoice))) {
$sql .= natural_search("f.facnumber", $search_invoice); $sql .= natural_search("f.ref", $search_invoice);
} }
if (strlen(trim($search_ref))) { if (strlen(trim($search_ref))) {
$sql .= natural_search("p.ref", $search_ref); $sql .= natural_search("p.ref", $search_ref);
@ -332,8 +331,8 @@ if ($result) {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.facnumber, fd.rowid", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, fd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);

View File

@ -75,7 +75,7 @@ $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (! $sortfield) if (! $sortfield)
$sortfield = "f.datef, f.facnumber, l.rowid"; $sortfield = "f.datef, f.ref, l.rowid";
if (! $sortorder) { if (! $sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
$sortorder = "DESC"; $sortorder = "DESC";
@ -209,7 +209,7 @@ if (empty($chartaccountcode))
} }
// Customer Invoice lines // Customer Invoice lines
$sql = "SELECT f.rowid as facid, f.facnumber as ref, f.datef, f.type as ftype,"; $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.= " 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.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.= " aa.rowid as aarowid,"; $sql.= " aa.rowid as aarowid,";
@ -233,7 +233,7 @@ if ($search_lineid) {
$sql .= natural_search("l.rowid", $search_lineid, 1); $sql .= natural_search("l.rowid", $search_lineid, 1);
} }
if (strlen(trim($search_invoice))) { if (strlen(trim($search_invoice))) {
$sql .= natural_search("f.facnumber", $search_invoice); $sql .= natural_search("f.ref", $search_invoice);
} }
if (strlen(trim($search_ref))) { if (strlen(trim($search_ref))) {
$sql .= natural_search("p.ref", $search_ref); $sql .= natural_search("p.ref", $search_ref);
@ -399,8 +399,8 @@ if ($result) {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.facnumber, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info> * Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.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@zendsi.com> * Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
@ -750,6 +750,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$filename = 'journal'; $filename = 'journal';
$type_export = 'journal';
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
// CSV header line // CSV header line
@ -1141,7 +1142,7 @@ $db->close();
* *
* @param string $val Array of val * @param string $val Array of val
* @param string $typerecord Type of record ('payment', 'payment_supplier', 'payment_expensereport', 'payment_vat', ...) * @param string $typerecord Type of record ('payment', 'payment_supplier', 'payment_expensereport', 'payment_vat', ...)
* @return string|unknown * @return string A string label to describe a record into llx_bank_url
*/ */
function getSourceDocRef($val, $typerecord) function getSourceDocRef($val, $typerecord)
{ {
@ -1178,7 +1179,7 @@ function getSourceDocRef($val, $typerecord)
$sqlmid = ''; $sqlmid = '';
if ($typerecord == 'payment') if ($typerecord == 'payment')
{ {
$sqlmid = 'SELECT payfac.fk_facture as id, f.facnumber as ref'; $sqlmid = 'SELECT payfac.fk_facture as id, f.ref as ref';
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f"; $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f";
$sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=" . $val["paymentid"]; $sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=" . $val["paymentid"];
$ref = $langs->trans("Invoice"); $ref = $langs->trans("Invoice");
@ -1249,7 +1250,8 @@ function getSourceDocRef($val, $typerecord)
{ {
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG); dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid); $resultmid = $db->query($sqlmid);
if ($resultmid) { if ($resultmid)
{
while ($objmid = $db->fetch_object($resultmid)) while ($objmid = $db->fetch_object($resultmid))
{ {
$ref.=' '.$objmid->ref; $ref.=' '.$objmid->ref;
@ -1258,6 +1260,6 @@ function getSourceDocRef($val, $typerecord)
else dol_print_error($db); else dol_print_error($db);
} }
$ref = dol_trunc($langs->trans("BankId").' '.$val['fk_bank'].' - '.$ref, 295); // 295 + 3 ... i< < than max size of 300 $ref = dol_trunc($langs->trans("BankId").' '.$val['fk_bank'].' - '.$ref, 295); // 295 + 3 dots (...) is < than max size of 300
return $ref; return $ref;
} }

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info> * Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com> * Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
@ -429,6 +429,7 @@ $userstatic = new User($db);
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$filename = 'journal'; $filename = 'journal';
$type_export = 'journal';
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
// Model Cegid Expert Export // Model Cegid Expert Export

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info> * Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com> * Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
@ -586,6 +586,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$filename = 'journal'; $filename = 'journal';
$type_export = 'journal';
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
$companystatic = new Fournisseur($db); $companystatic = new Fournisseur($db);

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info> * Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.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@zendsi.com> * Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
@ -97,7 +97,7 @@ if (! GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end)
$idpays = $mysoc->country_id; $idpays = $mysoc->country_id;
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code,"; $sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code,";
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,"; $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; $sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte"; $sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
@ -195,7 +195,7 @@ if ($result) {
// Invoice lines // Invoice lines
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df); $tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
$tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr); $tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr);
$tabfac[$obj->rowid]["ref"] = $obj->facnumber; $tabfac[$obj->rowid]["ref"] = $obj->ref;
$tabfac[$obj->rowid]["type"] = $obj->type; $tabfac[$obj->rowid]["type"] = $obj->type;
$tabfac[$obj->rowid]["description"] = $obj->label_compte; $tabfac[$obj->rowid]["description"] = $obj->label_compte;
$tabfac[$obj->rowid]["close_code"] = $obj->close_code; // close_code = 'replaced' for replacement invoices (not used in most european countries) $tabfac[$obj->rowid]["close_code"] = $obj->close_code; // close_code = 'replaced' for replacement invoices (not used in most european countries)
@ -500,7 +500,6 @@ if ($action == 'writebookkeeping') {
break; // Break in the foreach break; // Break in the foreach
} }
} }
} }
$tabpay = $tabfac; $tabpay = $tabfac;
@ -548,6 +547,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$filename = 'journal'; $filename = 'journal';
$type_export = 'journal';
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
$companystatic = new Client($db); $companystatic = new Client($db);

View File

@ -96,7 +96,7 @@ $facturefournisseur_static = new FactureFournisseur($db);
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
if (! empty($id)) { if (! empty($id)) {
$sql = "SELECT f.ref as facnumber, f.rowid as facid, l.fk_product, l.description, l.rowid, l.fk_code_ventilation, "; $sql = "SELECT f.ref as ref, f.rowid as facid, l.fk_product, l.description, l.rowid, l.fk_code_ventilation, ";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label"; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label";
$sql .= ", aa.account_number, aa.label"; $sql .= ", aa.account_number, aa.label";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as l"; $sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as l";
@ -129,7 +129,7 @@ if (! empty($id)) {
// ref invoice // ref invoice
print '<tr><td>' . $langs->trans("BillsSuppliers") . '</td>'; print '<tr><td>' . $langs->trans("BillsSuppliers") . '</td>';
$facturefournisseur_static->ref = $objp->facnumber; $facturefournisseur_static->ref = $objp->ref;
$facturefournisseur_static->id = $objp->facid; $facturefournisseur_static->id = $objp->facid;
print '<td>' . $facturefournisseur_static->getNomUrl(1) . '</td>'; print '<td>' . $facturefournisseur_static->getNomUrl(1) . '</td>';
print '</tr>'; print '</tr>';

View File

@ -35,9 +35,27 @@ $endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d');
header('Content-Type: text/csv'); header('Content-Type: text/csv');
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == "11") // Specific filename for FEC model export if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == "11" && $type_export == "general_ledger") // Specific filename for FEC model export into the general ledger
{ {
$completefilename = $siren . "FEC" . $search_date_end . $endaccountingperiod . "." . $format; // FEC format is defined here: https://www.legifrance.gouv.fr/affichCodeArticle.do?idArticle=LEGIARTI000027804775&cidTexte=LEGITEXT000006069583&dateTexte=20130802&oldAction=rechCodeArticle
if (empty($search_date_end))
{
// TODO Get the max date into bookeeping table
$search_date_end = dol_now();
}
$datetouseforfilename = $search_date_end;
$tmparray=dol_getdate($datetouseforfilename);
$fiscalmonth=empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START;
// Define end of month to use
if ($tmparray['mon'] <= $fiscalmonth) $tmparray['mon']=$fiscalmonth;
else {
$tmparray['mon'] = $fiscalmonth;
$tmparray['year']++;
}
$endaccountingperiod = dol_print_date(dol_get_last_day($tmparray['year'], $tmparray['mon']), 'dayxcard');
$completefilename = $siren . "FEC" . $endaccountingperiod . "." . $format;
} }
else else
{ {

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org> * Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org> * Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
@ -147,8 +147,9 @@ $constantes=array(
'ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER' =>'emailtemplate:member', /* old was ADHERENT_AUTOREGISTER_MAIL */ 'ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER' =>'emailtemplate:member', /* old was ADHERENT_AUTOREGISTER_MAIL */
'ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_VALID */ 'ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_VALID */
'ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_COTIS */ 'ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_COTIS */
'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' =>'emailtemplate:member',
'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_RESIL */ 'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_RESIL */
'MEMBER_REMINDER_EMAIL'=>array('type'=>'yesno', 'label'=>$langs->trans('MEMBER_REMINDER_EMAIL', $langs->transnoentities("Module2300Name"))),
'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' =>'emailtemplate:member',
); );
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>'; $helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* *

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2006-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com> * Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com> /* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2012 Philippe Grand <philippe.grand@atoo-net.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com> /* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2018 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2012-2018 Philippe Grand <philippe.grand@atoo-net.com>
* *

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com> /* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2012 Philippe Grand <philippe.grand@atoo-net.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com> /* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2012 Philippe Grand <philippe.grand@atoo-net.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com> /* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2012 Philippe Grand <philippe.grand@atoo-net.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2018 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2018 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2018 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2012-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
@ -644,18 +644,25 @@ if (empty($reshook))
$msg = $arraydefaultmessage->content; $msg = $arraydefaultmessage->content;
} }
$substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object); if (empty($labeltouse) || (int) $labeltouse === -1) {
complete_substitutions_array($substitutionarray, $outputlangs, $object); //fallback on the old configuration.
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); setEventMessages('WarningMandatorySetupNotComplete', [], 'errors');
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
$moreinheader='X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n";
$result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
if ($result < 0)
{
$error++; $error++;
setEventMessages($object->error, $object->errors, 'errors'); }
else {
$substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
$moreinheader='X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n";
$result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
if ($result < 0)
{
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
} }
} }
} }
@ -718,19 +725,26 @@ if (empty($reshook))
$msg = $arraydefaultmessage->content; $msg = $arraydefaultmessage->content;
} }
$substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object); if (empty($labeltouse) || (int) $labeltouse === -1) {
complete_substitutions_array($substitutionarray, $outputlangs, $object); //fallback on the old configuration.
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); setEventMessages('WarningMandatorySetupNotComplete', [], 'errors');
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs); $error++;
}
else {
$substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs);
$moreinheader='X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; $moreinheader='X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n";
$result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); $result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
} if ($result < 0)
if ($result < 0) {
{ $error++;
$error++; setEventMessages($object->error, $object->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors'); }
}
} }
} }
else else
@ -789,7 +803,6 @@ if (empty($reshook))
$mode='emailfrommember'; $mode='emailfrommember';
$trackid='mem'.$object->id; $trackid='mem'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
} }
@ -894,7 +907,7 @@ else
// Login // Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{ {
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="member_login" class="minwidth300" maxlength="50" value="'.(isset($_POST["member_login"])?GETPOST("member_login", 'alpha', 2):$object->login).'"></td></tr>'; print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="member_login" class="minwidth300" maxlength="50" value="'.(isset($_POST["member_login"])?GETPOST("member_login", 'alpha', 2):$object->login).'" autofocus="autofocus"></td></tr>';
} }
// Password // Password
@ -1273,8 +1286,11 @@ else
$cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1);
$c = new Categorie($db); $c = new Categorie($db);
$cats = $c->containing($object->id, Categorie::TYPE_MEMBER); $cats = $c->containing($object->id, Categorie::TYPE_MEMBER);
foreach ($cats as $cat) { $arrayselected = array();
$arrayselected[] = $cat->id; if (is_array($cats)) {
foreach ($cats as $cat) {
$arrayselected[] = $cat->id;
}
} }
print $form->multiselectarray('memcats', $cate_arbo, $arrayselected, '', 0, '', 0, '100%'); print $form->multiselectarray('memcats', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
print "</td></tr>"; print "</td></tr>";
@ -1320,7 +1336,6 @@ else
print '</div>'; print '</div>';
print '</form>'; print '</form>';
} }
if ($id > 0 && $action != 'edit') if ($id > 0 && $action != 'edit')
@ -1858,7 +1873,6 @@ else
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$object->id.'&action=add_spip">'.$langs->trans("AddIntoSpip")."</a></div>\n"; print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$object->id.'&action=add_spip">'.$langs->trans("AddIntoSpip")."</a></div>\n";
} }
} }
} }
} }
print '</div>'; print '</div>';

View File

@ -208,7 +208,6 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DescADHERENT_CARD_TYPE")); $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DescADHERENT_CARD_TYPE"));
} }
if (! $mesg) $result=members_card_pdf_create($db, $arrayofmembers, $model, $outputlangs); if (! $mesg) $result=members_card_pdf_create($db, $arrayofmembers, $model, $outputlangs);
} }
elseif ($mode == 'label') elseif ($mode == 'label')
{ {

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015-2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2015-2018 Frédéric France <frederic.france@netlogic.fr>
@ -59,6 +59,9 @@ class Adherent extends CommonObject
public $mesgs; public $mesgs;
/**
* @var string login of member
*/
public $login; public $login;
//! Clear password in memory //! Clear password in memory
@ -68,29 +71,70 @@ class Adherent extends CommonObject
//! Encrypted password in database (always defined) //! Encrypted password in database (always defined)
public $pass_indatabase_crypted; public $pass_indatabase_crypted;
/**
* @var string company name
* @deprecated
*/
public $societe; public $societe;
/** /**
* @var Societe $company {@type Societe} * @var string company name
*/ */
public $company; public $company;
/**
* @var int Thirdparty ID
*/
public $fk_soc;
/** /**
* @var string Address * @var string Address
*/ */
public $address; public $address;
public $zip; /**
* @var string zipcode
*/
public $zip;
/**
* @var string town
*/
public $town; public $town;
public $state_id; // Id of department /**
public $state_code; // Code of department * @var int Id of state
public $state; // Label of department */
public $state_id;
/**
* @var string Code of state
*/
public $state_code;
/**
* @var string Label of state
*/
public $state;
/**
* @var string email
*/
public $email; public $email;
public $skype; /**
public $twitter; * @var string skype account
*/
public $skype;
/**
* @var string twitter account
*/
public $twitter;
/**
* @var string facebook account
*/
public $facebook; public $facebook;
/** /**
@ -120,8 +164,12 @@ class Adherent extends CommonObject
public $morphy; public $morphy;
public $public; public $public;
public $statut; // -1:brouillon, 0:resilie, >=1:valide,paye
public $photo; // -1:brouillon, 0:resilie, >=1:valide,paye
// def in common object
//public $statut;
public $photo;
public $datec; public $datec;
public $datem; public $datem;
@ -129,21 +177,20 @@ class Adherent extends CommonObject
public $birth; public $birth;
public $note_public; /**
public $note_private; * @var int id type member
*/
public $typeid;
public $typeid; // Id type adherent /**
public $type; // Libelle type adherent * @var string label type member
*/
public $type;
public $need_subscription; public $need_subscription;
public $user_id; public $user_id;
public $user_login; public $user_login;
/**
* @var int Thirdparty ID
*/
public $fk_soc;
public $datefin; // From member table public $datefin; // From member table
// Fields loaded by fetch_subscriptions() // Fields loaded by fetch_subscriptions()
@ -155,7 +202,10 @@ class Adherent extends CommonObject
public $last_subscription_amount; public $last_subscription_amount;
public $subscriptions=array(); public $subscriptions=array();
public $oldcopy; // To contains a clone of this when we need to save old properties of object /**
* @var Adherent To contains a clone of this when we need to save old properties of object
*/
public $oldcopy;
/** /**
* @var int Entity * @var int Entity
@ -593,11 +643,11 @@ class Adherent extends CommonObject
$luser->societe_id=$this->societe; $luser->societe_id=$this->societe;
$luser->birth=$this->birth; $luser->birth=$this->birth;
$luser->address=$this->address; $luser->address=$this->address;
$luser->zip=$this->zip; $luser->zip=$this->zip;
$luser->town=$this->town; $luser->town=$this->town;
$luser->country_id=$this->country_id; $luser->country_id=$this->country_id;
$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->skype=$this->skype;
@ -2509,7 +2559,6 @@ class Adherent extends CommonObject
} }
$this->db->free($result); $this->db->free($result);
} }
else else
{ {
@ -2645,12 +2694,18 @@ class Adherent extends CommonObject
$blockingerrormsg = ''; $blockingerrormsg = '';
/*if (empty($conf->global->MEMBER_REMINDER_EMAIL)) if (empty($conf->adherent->enabled)) // Should not happen. If module disabled, cron job should not be visible.
{
$langs->load("agenda");
$this->output = $langs->trans('ModuleNotEnabled', $langs->transnoentitiesnoconv("Adherent"));
return 0;
}
if (empty($conf->global->MEMBER_REMINDER_EMAIL))
{ {
$langs->load("agenda"); $langs->load("agenda");
$this->output = $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Adherent")); $this->output = $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Adherent"));
return 0; return 0;
}*/ }
$now = dol_now(); $now = dol_now();
$nbok = 0; $nbok = 0;
@ -2737,8 +2792,58 @@ class Adherent extends CommonObject
{ {
$nbok++; $nbok++;
// TODO Add event email sent for member $message = $msg;
$sendto = $to;
$sendtocc = '';
$sendtobcc = '';
$actioncode='EMAIL';
$extraparams='';
$actionmsg='';
$actionmsg2=$langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from,4,0,1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto,4,0,1);
if ($message)
{
$actionmsg=$langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from);
$actionmsg=dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto));
if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . dol_escape_htmltag($sendtocc));
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
$actionmsg = dol_concatdesc($actionmsg, $message);
}
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
// Insert record of emails sent
$actioncomm = new ActionComm($this->db);
$actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
$actioncomm->code = 'AC_'.$actioncode;
$actioncomm->label = $actionmsg2;
$actioncomm->note = $actionmsg;
$actioncomm->fk_project = 0;
$actioncomm->datep = $now;
$actioncomm->datef = $now;
$actioncomm->percentage = -1; // Not applicable
$actioncomm->socid = $adherent->thirdparty->id;
$actioncomm->contactid = 0;
$actioncomm->authorid = $user->id; // User saving action
$actioncomm->userownerid = $user->id; // Owner of action
// Fields when action is en email (content should be added into note)
$actioncomm->email_msgid = $cmail->msgid;
$actioncomm->email_from = $from;
$actioncomm->email_sender= '';
$actioncomm->email_to = $to;
$actioncomm->email_tocc = $sendtocc;
$actioncomm->email_tobcc = $sendtobcc;
$actioncomm->email_subject = $subject;
$actioncomm->errors_to = '';
$actioncomm->fk_element = $adherent->id;
$actioncomm->elementtype = $adherent->element;
$actioncomm->extraparams = $extraparams;
$actioncomm->create($user);
} }
} }
else else

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com> * Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (c) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (c) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr> /* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr>
* Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com> /* Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@ -337,11 +337,14 @@ class Subscription extends CommonObject
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @return string Chaine avec URL * @param string $option Page for link ('', 'nolink', ...)
* @param string $morecss Add more css on link
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0, $notooltip=0) function getNomUrl($withpicto=0, $notooltip=0, $option='', $morecss='', $save_lastsearch_value=-1)
{ {
global $langs; global $langs;
@ -350,8 +353,18 @@ class Subscription extends CommonObject
$langs->load("members"); $langs->load("members");
$label=$langs->trans("ShowSubscription").': '.$this->ref; $label=$langs->trans("ShowSubscription").': '.$this->ref;
$linkstart = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $url = DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id;
$linkend='</a>';
if ($option != 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
}
$linkstart = '<a href="'.$url.'" class="classfortooltip" title="'.dol_escape_htmltag($label, 1).'">';
$linkend = '</a>';
$picto='payment'; $picto='payment';
@ -416,7 +429,6 @@ class Subscription extends CommonObject
} }
$this->db->free($result); $this->db->free($result);
} }
else else
{ {

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* *

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -55,7 +55,7 @@ $AdherentsResilies=array();
$AdherentType=array(); $AdherentType=array();
// Liste les adherents // Members list
$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";
@ -92,7 +92,7 @@ if ($result)
$now=dol_now(); $now=dol_now();
// List members up to date // Members up to date list
// current rule: uptodate = the end date is in future whatever is type // current rule: uptodate = the end date is in future whatever is type
// old rule: uptodate = if type does not need payment, that end date is null, if type need payment that end date is in future) // old rule: uptodate = if type does not need payment, that end date is null, if type need payment that end date is in future)
$sql = "SELECT count(*) as somme , d.fk_adherent_type"; $sql = "SELECT count(*) as somme , d.fk_adherent_type";
@ -140,7 +140,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
foreach($listofsearchfields as $key => $value) foreach($listofsearchfields as $key => $value)
{ {
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>'; if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
print '<tr '.$bc[false].'>'; print '<tr class="oddeven">';
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>'; print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>'; if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
print '</tr>'; print '</tr>';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2017 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2006-2017 Regis Houssin <regis.houssin@inodbox.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@ -79,14 +79,15 @@ $pagenext = $page + 1;
if (! $sortorder) { $sortorder=($filter=='outofdate'?"DESC":"ASC"); } if (! $sortorder) { $sortorder=($filter=='outofdate'?"DESC":"ASC"); }
if (! $sortfield) { $sortfield=($filter=='outofdate'?"d.datefin":"d.lastname"); } if (! $sortfield) { $sortfield=($filter=='outofdate'?"d.datefin":"d.lastname"); }
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new Adherent($db); $object = new Adherent($db);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('memberlist')); $hookmanager->initHooks(array('memberlist'));
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('adherent'); $extralabels = $extrafields->fetch_name_optionals_label('adherent');
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); $search_array_options=$extrafields->getOptionalsFromPost($object->table_element,'','search_');
// List of fields to search into when doing a "search in all" // List of fields to search into when doing a "search in all"
$fieldstosearchall = array( $fieldstosearchall = array(
@ -348,8 +349,8 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// List of mass actions available // List of mass actions available
$arrayofmassactions = array( $arrayofmassactions = array(
// 'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
// 'builddoc'=>$langs->trans("PDFMerge"), //'builddoc'=>$langs->trans("PDFMerge"),
); );
if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
@ -603,6 +604,7 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="c
print "</tr>\n"; print "</tr>\n";
$i = 0; $i = 0;
$totalarray=array();
while ($i < min($num, $limit)) while ($i < min($num, $limit))
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@ -631,6 +633,7 @@ while ($i < min($num, $limit))
if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID))
{ {
print '<td align="center">'.$obj->rowid.'</td>'; print '<td align="center">'.$obj->rowid.'</td>';
if (! $i) $totalarray['nbfield']++;
} }
// Ref // Ref
@ -639,6 +642,7 @@ while ($i < min($num, $limit))
print "<td>"; print "<td>";
print $memberstatic->getNomUrl(-1, 0, 'card', 'ref'); print $memberstatic->getNomUrl(-1, 0, 'card', 'ref');
print "</td>\n"; print "</td>\n";
if (! $i) $totalarray['nbfield']++;
} }
// Civility // Civility
if (! empty($arrayfields['d.civility']['checked'])) if (! empty($arrayfields['d.civility']['checked']))
@ -646,6 +650,7 @@ while ($i < min($num, $limit))
print "<td>"; print "<td>";
print $obj->civility; print $obj->civility;
print "</td>\n"; print "</td>\n";
if (! $i) $totalarray['nbfield']++;
} }
// Firstname // Firstname
if (! empty($arrayfields['d.firstname']['checked'])) if (! empty($arrayfields['d.firstname']['checked']))
@ -653,6 +658,7 @@ while ($i < min($num, $limit))
print "<td>"; print "<td>";
print $obj->firstname; print $obj->firstname;
print "</td>\n"; print "</td>\n";
if (! $i) $totalarray['nbfield']++;
} }
// Lastname // Lastname
if (! empty($arrayfields['d.lastname']['checked'])) if (! empty($arrayfields['d.lastname']['checked']))
@ -660,6 +666,7 @@ while ($i < min($num, $limit))
print "<td>"; print "<td>";
print $obj->lastname; print $obj->lastname;
print "</td>\n"; print "</td>\n";
if (! $i) $totalarray['nbfield']++;
} }
// Company // Company
if (! empty($arrayfields['d.company']['checked'])) if (! empty($arrayfields['d.company']['checked']))
@ -672,11 +679,13 @@ while ($i < min($num, $limit))
if (! empty($arrayfields['d.login']['checked'])) if (! empty($arrayfields['d.login']['checked']))
{ {
print "<td>".$obj->login."</td>\n"; print "<td>".$obj->login."</td>\n";
if (! $i) $totalarray['nbfield']++;
} }
// Moral/Physique // Moral/Physique
if (! empty($arrayfields['d.morphy']['checked'])) if (! empty($arrayfields['d.morphy']['checked']))
{ {
print "<td>".$memberstatic->getmorphylib($obj->morphy)."</td>\n"; print "<td>".$memberstatic->getmorphylib($obj->morphy)."</td>\n";
if (! $i) $totalarray['nbfield']++;
} }
// Type label // Type label
if (! empty($arrayfields['t.libelle']['checked'])) if (! empty($arrayfields['t.libelle']['checked']))
@ -686,6 +695,7 @@ while ($i < min($num, $limit))
print '<td class="nowrap">'; print '<td class="nowrap">';
print $membertypestatic->getNomUrl(1,32); print $membertypestatic->getNomUrl(1,32);
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++;
} }
// Address // Address
if (! empty($arrayfields['d.address']['checked'])) if (! empty($arrayfields['d.address']['checked']))
@ -693,6 +703,7 @@ while ($i < min($num, $limit))
print '<td class="nocellnopadd">'; print '<td class="nocellnopadd">';
print $obj->address; print $obj->address;
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++;
} }
// Zip // Zip
if (! empty($arrayfields['d.zip']['checked'])) if (! empty($arrayfields['d.zip']['checked']))
@ -828,6 +839,36 @@ while ($i < min($num, $limit))
$i++; $i++;
} }
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
// If no record found
if ($num == 0)
{
$colspan=1;
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}
$db->free($resql); $db->free($resql);
$parameters=array('sql' => $sql); $parameters=array('sql' => $sql);

View File

@ -116,7 +116,6 @@ if ($id)
dol_fiche_end(); dol_fiche_end();
} }
// End of page // End of page

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -167,6 +167,7 @@ print '<br><br>';
$data = $stats->getAllByYear(); $data = $stats->getAllByYear();
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">'; print '<table class="noborder">';
print '<tr class="liste_titre" height="24">'; print '<tr class="liste_titre" height="24">';
print '<td align="center">'.$langs->trans("Year").'</td>'; print '<td align="center">'.$langs->trans("Year").'</td>';
@ -207,6 +208,7 @@ foreach ($data as $val)
} }
print '</table>'; print '</table>';
print '</div>';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2017 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2012-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *

View File

@ -191,7 +191,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment'); dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php">'.$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" width="100%">';
@ -290,7 +290,7 @@ if ($rowid && $action != 'edit')
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback, 1); dol_banner_tab($object, 'rowid', $linkback, 1);

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2006 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2006 Regis Houssin <regis.houssin@inodbox.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@ -28,19 +28,25 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("members"); $langs->load(array("members","companies"));
$filter=$_GET["filter"]; $action=GETPOST('action','aZ09');
$statut=isset($_GET["statut"])?$_GET["statut"]:1; $massaction=GETPOST('massaction','alpha');
$confirm=GETPOST('confirm','alpha');
$toselect = GETPOST('toselect', 'array');
$filter=GETPOST("filter","alpha");
$statut=(GETPOSTISSET("statut")?GETPOST("statut","alpha"):1);
$search_ref=GETPOST('search_ref','alpha'); $search_ref=GETPOST('search_ref','alpha');
$search_lastname=GETPOST('search_lastname','alpha'); $search_lastname=GETPOST('search_lastname','alpha');
$search_firstname=GETPOST('search_firstname','alpha');
$search_login=GETPOST('search_login','alpha'); $search_login=GETPOST('search_login','alpha');
$search_note=GETPOST('search_note','alpha'); $search_note=GETPOST('search_note','alpha');
$search_account=GETPOST('search_account','int'); $search_account=GETPOST('search_account','int');
$search_amount=GETPOST('search_amount','alpha'); $search_amount=GETPOST('search_amount','alpha');
$optioncss = GETPOST('optioncss','alpha'); $optioncss = GETPOST('optioncss','alpha');
$date_select=isset($_GET["date_select"])?$_GET["date_select"]:$_POST["date_select"]; $date_select=GETPOST("date_select",'alpha');
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
@ -53,18 +59,34 @@ $pagenext = $page + 1;
if (! $sortorder) { $sortorder="DESC"; } if (! $sortorder) { $sortorder="DESC"; }
if (! $sortfield) { $sortfield="c.dateadh"; } if (! $sortfield) { $sortfield="c.dateadh"; }
$object = new Subscription($db);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('subscriptionlist')); $hookmanager->initHooks(array('subscriptionlist'));
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('subscription'); $extralabels = $extrafields->fetch_name_optionals_label('subscription');
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); $search_array_options=$extrafields->getOptionalsFromPost($object->table_element,'','search_');
// List of fields to search into when doing a "search in all" // List of fields to search into when doing a "search in all"
$fieldstosearchall = array( $fieldstosearchall = array(
); );
$arrayfields=array( $arrayfields=array(
'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
'd.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
'd.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1),
't.libelle'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
'd.bank'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>1, 'enabled'=>(! empty($conf->banque->enabled))),
/*'d.note_public'=>array('label'=>$langs->trans("NotePublic"), 'checked'=>0),
'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/
'd.datedebut'=>array('label'=>$langs->trans("DateSubscription"), 'checked'=>1, 'position'=>100),
'd.datefin'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>101),
'd.amount'=>array('label'=>$langs->trans("Amount"), 'checked'=>1, 'position'=>102),
'd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
// 'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000)
); );
// Security check // Security check
@ -72,7 +94,7 @@ $result=restrictedArea($user,'adherent','','','cotisation');
/* /*
* Actions * Actions
*/ */
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; } if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
@ -109,15 +131,16 @@ if (empty($reshook))
*/ */
$form=new Form($db); $form=new Form($db);
$subscription=new Subscription($db);
$adherent=new Adherent($db);
$accountstatic=new Account($db);
llxHeader('',$langs->trans("ListOfSubscriptions"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros'); $now=dol_now();
// List of subscriptions // List of subscriptions
$sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe, d.photo,"; $sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe, d.photo,";
$sql.= " c.rowid as crowid, c.subscription,"; $sql.= " c.rowid as crowid, c.subscription,";
$sql.= " c.dateadh,"; $sql.= " c.dateadh, c.datef, c.datec as date_creation, c.tms as date_update,";
$sql.= " c.datef,";
$sql.= " c.fk_bank as bank, c.note,"; $sql.= " c.fk_bank as bank, c.note,";
$sql.= " b.fk_account"; $sql.= " b.fk_account";
$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";
@ -126,260 +149,452 @@ $sql.= " WHERE d.rowid = c.fk_adherent";
$sql.= " AND d.entity IN (".getEntity('adherent').")"; $sql.= " AND d.entity IN (".getEntity('adherent').")";
if (isset($date_select) && $date_select != '') if (isset($date_select) && $date_select != '')
{ {
$sql.= " AND c.dateadh LIKE '".$date_select."%'"; $sql.= " AND c.dateadh >= '".$date_select."-01-01 00:00:00'";
$sql.= " AND c.dateadh < '".($date_select+1)."-01-01 00:00:00'";
} }
if ($search_ref) if ($search_ref)
{ {
if (is_numeric($search_ref)) $sql.= " AND (c.rowid = ".$db->escape($search_ref).")"; if (is_numeric($search_ref)) $sql.= " AND (c.rowid = ".$db->escape($search_ref).")";
else $sql.=" AND 1 = 2"; // Always wrong else $sql.=" AND 1 = 2"; // Always wrong
} }
if ($search_lastname) $sql.= natural_search(array('d.firstname','d.lastname','d.societe'), $search_lastname); if ($search_lastname) $sql.= natural_search(array('d.lastname','d.societe'), $search_lastname);
if ($search_login) $sql.= natural_search('c.subscription', $search_login); if ($search_firstname) $sql.= natural_search(array('d.firstname'), $search_firstname);
if ($search_login) $sql.= natural_search('d.login', $search_login);
if ($search_note) $sql.= natural_search('c.note', $search_note); if ($search_note) $sql.= natural_search('c.note', $search_note);
if ($search_account > 0) $sql.= " AND b.fk_account = ".$search_account; if ($search_account > 0) $sql.= " AND b.fk_account = ".urldecode($search_account);
if ($search_amount) $sql.= natural_search('c.subscription', $search_amount, 1); if ($search_amount) $sql.= natural_search('c.subscription', $search_amount, 1);
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
// Count total nb of records with no order and no limits
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{ {
$result = $db->query($sql); $resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result); if ($resql) $nbtotalofrecords = $db->num_rows($resql);
else dol_print_error($db);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{ {
$page = 0; $page = 0;
$offset = 0; $offset = 0;
} }
} }
// Add limit
$sql.= $db->plimit($limit+1, $offset); $sql.= $db->plimit($limit+1, $offset);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if (! $result)
{ {
$num = $db->num_rows($result); dol_print_error($db);
exit;
}
$arrayofselected=is_array($toselect)?$toselect:array(); $num = $db->num_rows($result);
$i = 0; $arrayofselected=is_array($toselect)?$toselect:array();
$title=$langs->trans("ListOfSubscriptions"); if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
if (! empty($date_select)) $title.=' ('.$langs->trans("Year").' '.$date_select.')'; {
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
header("Location: ".DOL_URL_ROOT.'/adherents/subscription/card.php?id='.$id);
exit;
}
$param=''; llxHeader('',$langs->trans("ListOfSubscriptions"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($statut != '') $param.="&statut=".$statut;
if ($date_select) $param.="&date_select=".$date_select;
if ($search_lastname) $param.="&search_lastname=".$search_lastname;
if ($search_login) $param.="&search_login=".$search_login;
if ($search_acount) $param.="&search_account=".$search_account;
if ($search_amount) $param.="&search_amount=".$search_amount;
if ($optioncss != '') $param.='&optioncss='.$optioncss;
// List of mass actions available $i = 0;
$arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"),
);
if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton=''; $title=$langs->trans("ListOfSubscriptions");
if ($user->rights->adherent->cotisation->creer) if (! empty($date_select)) $title.=' ('.$langs->trans("Year").' '.$date_select.')';
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/adherents/list.php?status=-1,1"><span class="valignmiddle">'.$langs->trans('NewSubscription').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; $param='';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; if ($statut != '') $param.="&statut=".urlencode($statut);
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">'; if ($date_select) $param.="&date_select=".urlencode($date_select);
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname);
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; if ($search_login) $param.="&search_login=".urlencode($search_login);
print '<input type="hidden" name="page" value="'.$page.'">'; if ($search_acount) $param.="&search_account=".urlencode($search_account);
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; if ($search_amount) $param.="&search_amount=".urlencode($search_amount);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit); // List of mass actions available
$arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"),
);
//if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$topicmail="Information"; $newcardbutton='';
$modelmail="subscription"; if ($user->rights->adherent->cotisation->creer)
$objecttmp=new Subscription($db); {
$trackid='sub'.$object->id; $newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/adherents/list.php?status=-1,1"><span class="valignmiddle">'.$langs->trans('NewSubscription').'</span>';
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
if ($sall) print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
{ if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
} print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$moreforfilter = ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit);
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $topicmail="Information";
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $modelmail="subscription";
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); $objecttmp=new Subscription($db);
$trackid='sub'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
print '<div class="div-table-responsive">'; if ($sall)
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; {
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
}
// Line for filters fields $moreforfilter = '';
print '<tr class="liste_titre_filter">';
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
// Line for filters fields
print '<tr class="liste_titre_filter">';
// Line numbering
if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID))
{
print '<td class="liste_titre">&nbsp;</td>';
}
// Ref
if (! empty($arrayfields['d.ref']['checked']))
{
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'" size="4"></td>'; print '<input class="flat" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'" size="4"></td>';
}
if (! empty($arrayfields['d.lastname']['checked']))
{
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'" size="12"></td>'; print '<input class="flat" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'" size="7"></td>';
}
if (! empty($arrayfields['d.firstname']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'" size="12"></td>';
}
if (! empty($arrayfields['d.login']['checked']))
{
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'" size="7"></td>'; print '<input class="flat" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'" size="7"></td>';
}
print '<td class="liste_titre" align="left">'; if (! empty($arrayfields['t.libelle']['checked']))
print '<input class="flat" type="text" name="search_note" value="'.dol_escape_htmltag($search_note).'" size="7"></td>'; {
print '<td class="liste_titre">';
print '';
print '</td>';
}
if (! empty($conf->banque->enabled)) if (! empty($arrayfields['d.bank']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print $form->select_comptes($search_account, 'search_account', 0, '', 1); print $form->select_comptes($search_account, 'search_account', 0, '', 1);
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['d.date_debut']['checked']))
{
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
}
if (! empty($arrayfields['d.date_fin']['checked']))
{
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
}
if (! empty($arrayfields['d.amount']['checked']))
{
print '<td align="right" class="liste_titre">'; print '<td align="right" class="liste_titre">';
print '<input class="flat" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).'" size="4">'; print '<input class="flat" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).'" size="4">';
print '</td>'; print '</td>';
// Action column
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"c.rowid",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Login",$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"c.note",$param,"",'align="left"',$sortfield,$sortorder);
if (! empty($conf->banque->enabled))
{
print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"b.fk_account",$pram,"","",$sortfield,$sortorder);
}
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("DateEnd",$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"c.subscription",$param,"",'align="right"',$sortfield,$sortorder);
//print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
// Static objects
$subscription=new Subscription($db);
$adherent=new Adherent($db);
$accountstatic=new Account($db);
$total=0;
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
$total+=$obj->subscription;
$subscription->ref=$obj->crowid;
$subscription->id=$obj->crowid;
$adherent->lastname=$obj->lastname;
$adherent->firstname=$obj->firstname;
$adherent->ref=$obj->rowid;
$adherent->id=$obj->rowid;
$adherent->statut=$obj->statut;
$adherent->login=$obj->login;
$adherent->photo=$obj->photo;
print '<tr class="oddeven">';
// Ref
print '<td>'.$subscription->getNomUrl(1).'</td>';
// Lastname
print '<td>'.$adherent->getNomUrl(-1).'</td>';
// Login
print '<td>'.$adherent->login.'</td>';
// Libelle
print '<td>';
print dol_trunc($obj->note,32);
print '</td>';
// Banque
if (! empty($conf->banque->enabled))
{
if ($obj->fk_account > 0)
{
$accountstatic->id=$obj->fk_account;
$accountstatic->fetch($obj->fk_account);
//$accountstatic->label=$obj->label;
print '<td>'.$accountstatic->getNomUrl(1).'</td>';
}
else
{
print "<td>";
print "</td>\n";
}
}
// Date start
print '<td align="center">'.dol_print_date($db->jdate($obj->dateadh),'day')."</td>\n";
// Date end
print '<td align="center">'.dol_print_date($db->jdate($obj->datef),'day')."</td>\n";
// Price
print '<td align="right">'.price($obj->subscription).'</td>';
print '<td></td>';
print "</tr>";
$i++;
}
// Total
print '<tr class="liste_total">';
print "<td>".$langs->trans("Total")."</td>\n";
print "<td align=\"right\">&nbsp;</td>\n";
print "<td align=\"right\">&nbsp;</td>\n";
print "<td align=\"right\">&nbsp;</td>\n";
if (! empty($conf->banque->enabled))
{
print '<td>&nbsp;</td>';
}
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td align="right">'.price($total)."</td>\n";
print '<td></td>';
print "</tr>\n";
print "</table>";
print '</div>';
print '</form>';
} }
else // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['d.datec']['checked']))
{ {
dol_print_error($db); print '<td class="liste_titre">';
print '</td>';
} }
// Date modification
if (! empty($arrayfields['d.tms']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// Action column
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
if (! empty($arrayfields['d.ref']['checked']))
{
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"c.rowid",$param,"","",$sortfield,$sortorder);
}
if (! empty($arrayfields['d.lastname']['checked']))
{
print_liste_field_titre("LastName",$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
}
if (! empty($arrayfields['d.firstname']['checked']))
{
print_liste_field_titre("FirstName",$_SERVER["PHP_SELF"],"d.firstname",$param,"","",$sortfield,$sortorder);
}
if (! empty($arrayfields['d.login']['checked']))
{
print_liste_field_titre("Login",$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
}
if (! empty($arrayfields['t.libelle']['checked']))
{
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"c.note",$param,"",'align="left"',$sortfield,$sortorder);
}
if (! empty($arrayfields['d.bank']['checked']))
{
print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"b.fk_account",$pram,"","",$sortfield,$sortorder);
}
if (! empty($arrayfields['d.date_debut']['checked']))
{
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder);
}
if (! empty($arrayfields['d.date_fin']['checked']))
{
print_liste_field_titre("DateEnd",$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder);
}
if (! empty($arrayfields['d.amount']['checked']))
{
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"c.subscription",$param,"",'align="right"',$sortfield,$sortorder);
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['d.datec']['checked'])) print_liste_field_titre($arrayfields['d.datec']['label'],$_SERVER["PHP_SELF"],"d.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['d.tms']['checked'])) print_liste_field_titre($arrayfields['d.tms']['label'],$_SERVER["PHP_SELF"],"d.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
$total=0;
$totalarray=array();
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
$total+=$obj->subscription;
$subscription->ref=$obj->crowid;
$subscription->id=$obj->crowid;
$adherent->lastname=$obj->lastname;
$adherent->firstname=$obj->firstname;
$adherent->ref=$obj->rowid;
$adherent->id=$obj->rowid;
$adherent->statut=$obj->statut;
$adherent->login=$obj->login;
$adherent->photo=$obj->photo;
print '<tr class="oddeven">';
// Ref
if (! empty($arrayfields['d.ref']['checked']))
{
print '<td>'.$subscription->getNomUrl(1).'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Lastname
if (! empty($arrayfields['d.lastname']['checked']))
{
$adherent->firstname = '';
print '<td>'.$adherent->getNomUrl(-1).'</td>';
$adherent->firstname = $obj->firstname;
if (! $i) $totalarray['nbfield']++;
}
// Firstname
if (! empty($arrayfields['d.firstname']['checked']))
{
print '<td>'.$adherent->firstname.'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Login
if (! empty($arrayfields['d.login']['checked']))
{
print '<td>'.$adherent->login.'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Label
if (! empty($arrayfields['t.libelle']['checked']))
{
print '<td>';
print dol_trunc($obj->note,128);
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Banque
if (! empty($arrayfields['d.bank']['checked']))
{
print "<td>";
if ($obj->fk_account > 0)
{
$accountstatic->id=$obj->fk_account;
$accountstatic->fetch($obj->fk_account);
//$accountstatic->label=$obj->label;
print $accountstatic->getNomUrl(1);
}
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Date start
if (! empty($arrayfields['d.date_start']['checked']))
{
print '<td align="center">'.dol_print_date($db->jdate($obj->dateadh),'day')."</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Date end
if (! empty($arrayfields['d.date_end']['checked']))
{
print '<td align="center">'.dol_print_date($db->jdate($obj->datef),'day')."</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Price
if (! empty($arrayfields['d.amount']['checked']))
{
print '<td align="right">'.price($obj->subscription).'</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='d.amount';
$totalarray['val']['d.amount'] += $obj->subscription;
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// 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;
// Date creation
if (! empty($arrayfields['d.datec']['checked']))
{
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date modification
if (! empty($arrayfields['d.tms']['checked']))
{
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Action column
print '<td align="center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected=0;
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
print "</tr>\n";
$i++;
}
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
// If no record found
if ($num == 0)
{
$colspan=1;
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}
$db->free($resql);
$parameters=array('sql' => $sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>";
print '</div>';
print '</form>';
// End of page // End of page
llxFooter(); llxFooter();

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com> /* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* *

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* *
@ -317,7 +317,7 @@ if ($action == 'create')
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tbody>'; print '<tbody>';
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" size="40"></td></tr>'; 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>'.$langs->trans("SubscriptionRequired").'</td><td>'; print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print $form->selectyesno("subscription",1,1); print $form->selectyesno("subscription",1,1);
@ -694,7 +694,6 @@ if ($rowid > 0)
{ {
dol_print_error($db); dol_print_error($db);
} }
} }
/* ************************************************************************** */ /* ************************************************************************** */

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2017 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2006-2017 Regis Houssin <regis.houssin@inodbox.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2008-2015 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* *

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* *

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2008-2016 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com> * Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2008-2015 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify

View File

@ -397,7 +397,7 @@ print '<br><br>';
*/ */
//if (! empty($conf->global->MAIN_FEATURES_LEVEL)) //if (! empty($conf->global->MAIN_FEATURES_LEVEL))
//{ //{
print load_fiche_titre($langs->trans("BankAccountReleveModule"), '', ''); print load_fiche_titre($langs->trans("Other"), '', '');
print "<table class=\"noborder\" width=\"100%\">\n"; print "<table class=\"noborder\" width=\"100%\">\n";

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* *

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -63,7 +63,7 @@ if ($action == 'setcoder')
$resql=$db->query($sqlp); $resql=$db->query($sqlp);
if (! $resql) dol_print_error($db); if (! $resql) dol_print_error($db);
} }
else if ($action == 'update') elseif ($action == 'update')
{ {
$location = GETPOST('GENBARCODE_LOCATION','alpha'); $location = GETPOST('GENBARCODE_LOCATION','alpha');
$res = dolibarr_set_const($db, "GENBARCODE_LOCATION",$location,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "GENBARCODE_LOCATION",$location,'chaine',0,'',$conf->entity);
@ -71,18 +71,8 @@ else if ($action == 'update')
$res = dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $coder_id,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $coder_id,'chaine',0,'',$conf->entity);
$coder_id = GETPOST('GENBARCODE_BARCODETYPE_THIRDPARTY','alpha'); $coder_id = GETPOST('GENBARCODE_BARCODETYPE_THIRDPARTY','alpha');
$res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id,'chaine',0,'',$conf->entity);
}
else if ($action == 'updateengine')
{
// TODO Update engines.
} if ($res > 0)
if ($action && $action != 'setcoder' && $action != 'setModuleOptions')
{
if (! $res > 0) $error++;
if (! $error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
@ -91,6 +81,42 @@ if ($action && $action != 'setcoder' && $action != 'setModuleOptions')
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
elseif ($action == 'updateengine')
{
$sql = "SELECT rowid, coder";
$sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
$sql.= " WHERE entity = ".$conf->entity;
$sql.= " ORDER BY code";
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
if (GETPOST('coder'.$obj->rowid, 'alpha'))
{
$coder = GETPOST('coder'.$obj->rowid,'alpha');
$code_id = $obj->rowid;
$sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type";
$sqlp.= " SET coder = '" . $coder."'";
$sqlp.= " WHERE rowid = ". $code_id;
$sqlp.= " AND entity = ".$conf->entity;
$upsql=$db->query($sqlp);
if (! $upsql) dol_print_error($db);
}
$i++;
}
}
}
/* /*
* View * View
@ -162,9 +188,12 @@ foreach($dirbarcode as $reldir)
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("BarcodeEncodeModule"),'',''); print load_fiche_titre($langs->trans("BarcodeEncodeModule"),'','');
//print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">"; if (empty($conf->use_javascript_ajax))
//print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; {
//print "<input type=\"hidden\" name=\"action\" value=\"updateengine\">"; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" id="form_engine">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="updateengine">';
}
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -259,10 +288,9 @@ print "</table>\n";
if (empty($conf->use_javascript_ajax)) if (empty($conf->use_javascript_ajax))
{ {
// TODO Implement code behind action updateengine print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"></div>';
//print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"></div>'; print '</form>';
} }
//print '</form>';
print "<br>"; print "<br>";

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify

View File

@ -217,7 +217,6 @@ foreach ($dirmodels as $reldir)
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
} }
} }
} }

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2004 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2016 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2016 Philippe Grand <philippe.grand@atoo-net.com>

Some files were not shown because too many files have changed in this diff Show More