Merge branch 'develop' into develop
This commit is contained in:
commit
5f0819d3b4
@ -1,16 +0,0 @@
|
||||
build
|
||||
build.xml
|
||||
ChangeLog
|
||||
composer.json
|
||||
CONTRIBUTING.md
|
||||
COPYING
|
||||
COPYRIGHT
|
||||
dev
|
||||
doc
|
||||
Dockerfile
|
||||
INSTALL
|
||||
README-FR.md
|
||||
README.md
|
||||
robots.txt
|
||||
scripts
|
||||
test
|
||||
48
.travis.yml
48
.travis.yml
@ -2,19 +2,15 @@
|
||||
# from Dolibarr GitHub repository.
|
||||
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
|
||||
|
||||
# We use dist: precise to have php 5.3 available
|
||||
dist: precise
|
||||
sudo: required
|
||||
|
||||
language: php
|
||||
|
||||
php:
|
||||
- '5.3'
|
||||
- '5.4'
|
||||
- '5.5'
|
||||
- '5.6.29'
|
||||
- '7.0'
|
||||
- '7.1'
|
||||
- nightly
|
||||
# Start on every boot
|
||||
services:
|
||||
- memcached
|
||||
|
||||
addons:
|
||||
mariadb: '10.0'
|
||||
@ -33,10 +29,16 @@ addons:
|
||||
- libapache2-mod-fastcgi
|
||||
# We need pgloader for import mysql database into pgsql
|
||||
- pgloader
|
||||
|
||||
# Start on every boot
|
||||
services:
|
||||
- memcached
|
||||
|
||||
php:
|
||||
- '5.3'
|
||||
- '5.4'
|
||||
- '5.5'
|
||||
- '5.6'
|
||||
- '7.0'
|
||||
- '7.1'
|
||||
#- hhvm only with dist: trusty
|
||||
- nightly
|
||||
|
||||
env:
|
||||
global:
|
||||
@ -57,11 +59,22 @@ env:
|
||||
matrix:
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
- php: 7.1
|
||||
- php: hhvm
|
||||
- php: nightly
|
||||
#- env: DB=postgresql
|
||||
# TODO
|
||||
#- env: DB=sqlite
|
||||
# We exclude some combinations not usefull to save Travis CPU
|
||||
exclude:
|
||||
- php: '5.4'
|
||||
env: DB=postgresql
|
||||
- php: '5.5'
|
||||
env: DB=postgresql
|
||||
- php: '5.6'
|
||||
env: DB=postgresql
|
||||
- php: '7.0'
|
||||
env: DB=postgresql
|
||||
- php: hhvm
|
||||
env: DB=postgresql
|
||||
- php: nightly
|
||||
env: DB=postgresql
|
||||
|
||||
notifications:
|
||||
email:
|
||||
@ -305,6 +318,9 @@ script:
|
||||
php upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.log
|
||||
php upgrade2.php 5.0.0 6.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade500600-2.log
|
||||
php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log
|
||||
php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log
|
||||
php upgrade2.php 6.0.0 7.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade600700-2.log
|
||||
php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log
|
||||
cd -
|
||||
set +e
|
||||
echo
|
||||
|
||||
@ -53,6 +53,7 @@ jQuery Tiptip 1.3 GPL and MIT License Yes
|
||||
jsGanttImproved 1.7.5.2 BSD License Yes JS library (to build Gantt reports)
|
||||
JsTimezoneDetect 1.0.6 MIT License Yes JS library to detect user timezone
|
||||
SwaggerUI 2.0.24 GPL-2+ Yes JS library to offer the REST API explorer
|
||||
Ace 1.2.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||
|
||||
For licenses compatibility informations:
|
||||
http://www.gnu.org/licenses/licenses.en.html
|
||||
|
||||
181
ChangeLog
181
ChangeLog
@ -2,12 +2,139 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
|
||||
***** ChangeLog for 7.0.0 compared to 6.0.* *****
|
||||
|
||||
WARNING:
|
||||
|
||||
Following changes may create regression for some external modules, but were necessary to make Dolibarr better:
|
||||
* The methode "cloture" on contact were renamed into "closeAll".
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 6.0.0 compared to 5.0.* *****
|
||||
|
||||
NEW: Add experimental BlockeLog module (to log business events in a non reversible log file).
|
||||
NEW: Add a payment module for Stripe.
|
||||
NEW: Add module "Product variant" (like red, blue for the product shoes)
|
||||
NEW: Accountancy - Activate multi-journal & Add journal_label to database (FEC)
|
||||
NEW: Add a tracking id into mass emailing.
|
||||
NEW: Tax system more compatible with the new tax rollout in India (IGST / CGST / SGST).
|
||||
NEW: Add calculation function for Loan schedule
|
||||
NEW: Add "depends on" and "required by" into module informations
|
||||
NEW: Add hidden option THIRDPARTY_INCLUDE_PARENT_IN_LINKTO
|
||||
NEW: Add key __USERID__ and __ENTITYID__ as key for dynamic filters.
|
||||
NEW: Add last activation author and ip of modules
|
||||
NEW: Add mass actions (pdf merge and delete) for interventions
|
||||
NEW: Add module resources import/export
|
||||
NEW: Add option PROJECT_THIRDPARTY_REQUIRED
|
||||
NEW: Add page statistics for project tasks
|
||||
NEW: add property to show warnings when activating modules
|
||||
NEW: add rapport file for supplier paiement
|
||||
NEW: Add statistics on supplier tab.
|
||||
NEW: Add tooltip help on shipment weight and volume calculation
|
||||
NEW: An external module can hook and add mass actions.
|
||||
NEW: Better reponsive design
|
||||
NEW: Bookmarks are into a combo list.
|
||||
NEW: Bulk actions available on supplier orders
|
||||
NEW: Can add a background image on login page
|
||||
NEW: Can change customer from POS
|
||||
NEW: Can clone expense report on another user
|
||||
NEW: Can control constants values into file integrity checker
|
||||
NEW: Can define default values for create forms.
|
||||
NEW: Can define default filters for list pages.
|
||||
NEW: Can define default sort order for list pages.
|
||||
NEW: Can deploy an external module from the module setup area.
|
||||
NEW: Can disable all overwrote translations in one click.
|
||||
NEW: Can edit background color for odd and even lines in tables
|
||||
NEW: Can filter on code in dictionnaries
|
||||
NEW: Can filter on year and product tags on the product statistic page
|
||||
NEW: Can import users
|
||||
NEW: Can read time spent of others (hierarchy only or all if granted)
|
||||
NEW: Can send an email to a user from its card.
|
||||
NEW: Can send email to multiple destinaries from the mailform combo list.
|
||||
NEW: Can set margins of PDFs
|
||||
NEW: Can set number of dump to keep with job "local database backup"
|
||||
NEW: Can sort customer balance summary on date.
|
||||
NEW: Can sort thumbs visible on product card.
|
||||
NEW: Can use a credit note into a "down payment/deposit".
|
||||
NEW: Can use dol_fiche_end without showing bottom border.
|
||||
NEW: Can use translations into all substitutions (watermark, freetext...)
|
||||
NEW: Change to allow a specific numbering rule for invoice with POS module.
|
||||
NEW: convert exceiss received to reduc
|
||||
NEW: custom dir is enabled dy default on first install.
|
||||
NEW: Description of feature of a module visible into a dedicated popup.
|
||||
NEW: Direct open of card after a search if one record only found.
|
||||
NEW: download button
|
||||
NEW: Enable bulk actions delete on supplier invoices.
|
||||
NEW: Extrafields support formulas to be computed using PHP expressions.
|
||||
NEW: Feature to crop/resize images available on user and expense reports.
|
||||
NEW: Filechecker can include custom dir and report added files.
|
||||
NEW: fix listview class and add a demo for product list
|
||||
NEW: [FP17] Accountancy - Add select field in list of accounts
|
||||
NEW: get amount base on hourly rate for ficheinter
|
||||
NEW: hidden Easter egg to display commitstrip strip on login page
|
||||
NEW: Include an hourglass icon when we click on online payment button
|
||||
NEW: Index upload files into database.
|
||||
NEW: Introduce mass action on product list ('delete' for the moment)
|
||||
NEW: Introduce mass actions on contacts
|
||||
NEW: Introduce option MAIN_HTTP_CONTENT_SECURITY_POLICY
|
||||
NEW: It's easier to switch between sandbox and live for paypal
|
||||
NEW: Mass action delete available on project and tasks
|
||||
NEW: Move login information on home page into a widget
|
||||
NEW: new demo entry page
|
||||
NEW: No external check of version without explicit click in about page.
|
||||
NEW: ODT docs for USER USERGROUP CONTRACT and PRODUCT class
|
||||
NEW: odt usergroup
|
||||
NEW: On invoices generated by template, we save if invoice come from a source template.
|
||||
NEW: option to copy into attachement files of events, files send by mail (with auto event creation)
|
||||
NEW: PDF with numbertoword
|
||||
NEW: Permit multiple file upload in linked documents
|
||||
NEW: PHP 7.1 compatibility
|
||||
NEW: Reduce memory usage by removing deprecated constant loading.
|
||||
NEW: Report page and menu for suppliers paiements
|
||||
NEW: Show by default README.md file found into root dir of ext module.
|
||||
NEW: Show company into combo list of projects
|
||||
NEW: show files in the bank statement + download
|
||||
NEW: Show local taxes in facture list
|
||||
NEW: Show local taxes in supplier facture list
|
||||
NEW: Small PDF template for products
|
||||
NEW: Option SUPPLIER_ORDER_EDIT_BUYINGPRICE_DURING_RECEIPT
|
||||
NEW: The substitution keys available for emailing edition are now visible into a popup.
|
||||
NEW: Uniformize behaviour: Action to make order is an action button.
|
||||
NEW: Use autocompletion on the "Add widget list".
|
||||
NEW: Use html5 type "number" on select field for year and duration.
|
||||
NEW: Can use pdktk to concat mass pdf because tcpdf generate avoid to split large file into multiple smaller file (all have same size) encounter issue with mailer provider virtual delivery service
|
||||
NEW: Default theme of v6 is cleaner.
|
||||
NEW: When down payment is entered, discount to reuse into final invoice is automatically created. This save one click into invoice workflow.
|
||||
NEW: Add UI to configure MEMBER_NEWFORM_FORCETYPE
|
||||
NEW: #2763 Go to document block after clicking in Generate document button
|
||||
NEW: #6280: Generate PDF after creating an invoice from a customer order
|
||||
NEW: #6915 Simplest change.
|
||||
NEW: Uniformize the look and feel with v6 new look.
|
||||
|
||||
For developers:
|
||||
NEW: Add a lot of API REST: dictionaryevents, memberstypes, ...
|
||||
NEW: Big refactorization of multicompany transverse mode.
|
||||
NEW: getEntity function use true $shared value by default.
|
||||
NEW: Add font-awesome css.
|
||||
NEW: Add function ajax_autoselect
|
||||
NEW: Add function dolMd2Html
|
||||
NEW: Add hook doUpgrade2
|
||||
NEW: Add hook "formatNotificationMessage"
|
||||
NEW: Add index and constraints keys on supplier proposal detail table
|
||||
NEW: Add phpunit to check the engine is defined into sql create files.
|
||||
NEW: Add project and Hook to Loan
|
||||
NEW: Add REST API to push a file.
|
||||
NEW: Allow extrafields list select to be dependands on other standard list and not only other extrafields list
|
||||
NEW: Architecture to manage search criteria persistance (using save_lastsearch_values=1 on exit links and restore_lastsearch_values=1 in entry links)
|
||||
NEW: data files are now also parsed by phpunit for sql syntax
|
||||
NEW: Hook to allow inserting custom product head #6001
|
||||
NEW: Introduce fields that can be computed during export in export profiles.
|
||||
NEW: Introduce function dol_compress_dir
|
||||
NEW: Removed commande_pdf_create, contract_pdf_create,expedition_pdf_create, facture_pdf_create, delivery_order_pdf_create, task_pdf_create, project_pdf_create, propale_pdf_create, supplier_invoice_pdf_create, supplier_order_pdf_create, supplier_proposal_pdf_create deprecated functions
|
||||
NEW: tooltip can be on hover or on click with textwithpicto function.
|
||||
NEW: Upgrade jquery to 3.3.1 and jquery-ui to 1.12
|
||||
|
||||
WARNING:
|
||||
|
||||
@ -25,16 +152,61 @@ Following changes may create regression for some external modules, but were nece
|
||||
* Removed Societe::set_commnucation_level (was deprecated in 4.0). Was not used.
|
||||
* Removed the trigger file of PAYPAL module that stored data that was not used by Dolibarr. The trigger event still
|
||||
exists, but if an external module need action on it, it must provides itself its trigger file.
|
||||
* Use $conf->global->MULTICOMPANY_TRANSVERSE_MODE instead $conf->multicompany->transverse_mode
|
||||
* Use $conf->global->MULTICOMPANY_TRANSVERSE_MODE instead $conf->multicompany->transverse_mode. So, if you set var
|
||||
$multicompany_transverse_mode to 1 into your conf file, you must remove this line and a new key into
|
||||
the Home - setup - other admin page.
|
||||
* Use getEntity('xxx') instead getEntity('xxx', 1) and use getEntity('xxx', 0) instead getEntity('xxx')
|
||||
* Some other change were done in the way we read permission of a user when module multicompany is enabled. You can
|
||||
retreive the old behavior by adding constant MULTICOMPANY_BACKWARD_COMPATIBILITY to 1.
|
||||
* The hook formObjectOptions was not implemented correctly in previous version. Sometimes, you had to return output
|
||||
content by doing a print into function, sometimes by returning content into "resprint". This has been fixed to follow
|
||||
hook specifications so you must return output into "resprint".
|
||||
|
||||
***** ChangeLog for 5.0.6 compared to 5.0.5 *****
|
||||
FIX: Removed a bad symbolic link into custom directory.
|
||||
FIX: Renaming a resource ref rename also the directory of attached files.
|
||||
|
||||
***** ChangeLog for 5.0.5 compared to 5.0.4 *****
|
||||
FIX: #7075 : bad path for document
|
||||
FIX: #7156
|
||||
FIX: #7173
|
||||
FIX: #7224
|
||||
FIX: #7226
|
||||
FIX: #7239
|
||||
FIX: add supplierproposaldet without price (new product)
|
||||
FIX: amount overlap other amount when a pagebreak is done due to an image at the bottom of page.
|
||||
FIX: Bad tax calculation with expense report
|
||||
FIX: Best buy price calculation
|
||||
FIX: Buying prices must always be in positive value.
|
||||
FIX: calculate correct remain to pay for planned bank transactions
|
||||
FIX: delete linked element on facture rec
|
||||
FIX: edit sociale was emptying label
|
||||
FIX: Error when updating thirdparty not returned
|
||||
FIX: holidays with postgresql like on rowid integer
|
||||
FIX: id of user not saved when making a payment of expense report
|
||||
FIX: invoice page list
|
||||
FIX: invoice situation VAT total rounding into PDF crabe
|
||||
FIX: PgSQL compatibility.
|
||||
FIX: remove order rights on invoice page
|
||||
FIX: status were wrong on product referent list
|
||||
FIX: supplier id was not passed to hooks
|
||||
FIX: Support of vat code when using price per customer
|
||||
FIX: User id correction on holiday request
|
||||
FIX: value of user id filled to 0 in llx_bank_url when recording an expense report.
|
||||
FIX: we have to check if contact doesn't already exist on add_contact() function
|
||||
FIX: We should be able to insert data with value '0' into const
|
||||
FIX: install process with DoliWamp
|
||||
|
||||
***** ChangeLog for 5.0.4 compared to 5.0.3 *****
|
||||
FIX: #6880
|
||||
FIX: #6925
|
||||
FIX: #5640 Prices of a predefined product/service were incorrect under certain circumstances
|
||||
FIX: #6541 since 4.0.4 to 5.0.0 autofill zip/town not working
|
||||
FIX: #6880 #6925
|
||||
FIX: #6885
|
||||
FIX: #6926
|
||||
FIX: #7003
|
||||
FIX: #7012
|
||||
FIX: #7040
|
||||
FIX: #7048 #6075
|
||||
FIX: Can set supplier invoice to billed.
|
||||
FIX: Can't create invoice if PO disapproved
|
||||
FIX: contratligne update
|
||||
@ -46,6 +218,7 @@ FIX: Redirect to payment page from member subscription page failed if a unique s
|
||||
FIX: REST api to get project when user has permission to read all.
|
||||
FIX: situation_progress param default value must be 100 and not 0
|
||||
FIX: SQL injection on user/index.php parameter search_statut.
|
||||
FIX: vat code not saved during product creation.
|
||||
FIX: Warnings
|
||||
|
||||
***** ChangeLog for 5.0.3 compared to 5.0.2 *****
|
||||
@ -528,7 +701,7 @@ NEW: Disabled users are striked.
|
||||
NEW: Enhance navigation of project module
|
||||
NEW: fichinter lines ordered by rang AND DATE
|
||||
NEW: hidden conf to use input file multiple from mail form
|
||||
NEW: hidden feature: SUPPLIERORDER_WITH_NOPRICEDEFINED allow supplier order even if no supplier price defined
|
||||
NEW: hidden feature: SUPPLIER_ORDER_WITH_NOPRICEDEFINED allow supplier order even if no supplier price defined
|
||||
NEW: Hidden option MAIN_LANDING_PAGE to choose the first page to show after login works as a "global" option (llx_const) and as a "per user" option (llx_user_param).
|
||||
NEW: Holiday is a now a RH module. All RH module provides by default visilibity on users of its hierarchy.
|
||||
NEW: If error is reported during migration process, you can ignore it to avoid to be locked.
|
||||
|
||||
31
README.md
31
README.md
@ -2,9 +2,9 @@
|
||||
|
||||
 
|
||||
|
||||
Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda, ...).
|
||||
Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…).
|
||||
|
||||
It's an Open Source software (wrote in PHP language) designed for small, medium or large companies, foundations and freelances.
|
||||
It's an Open Source Software (written in PHP language) designed for small, medium or large companies, foundations and freelances.
|
||||
|
||||
You can freely use, study, modify or distribute it according to its Free Software licence.
|
||||
|
||||
@ -29,18 +29,25 @@ Other licenses apply for some included dependencies. See [COPYRIGHT](https://git
|
||||
Releases can be downloaded from [official website](https://www.dolibarr.org/).
|
||||
|
||||
### Install from composer
|
||||
If you do not already have Composer installed, you may do so by following the instructions at getcomposer.org. On Linux and Mac OS X, you'll run the following commands:
|
||||
|
||||
If you do not already have Composer installed, you may do so by following the instructions at [getcomposer.org](https://getcomposer.org/). On Linux and macOS, you may run the following commands:
|
||||
|
||||
```bash
|
||||
curl -sS https://getcomposer.org/installer | php
|
||||
mv composer.phar /usr/local/bin/composer
|
||||
```
|
||||
|
||||
On Windows, you'll download and run https://getcomposer.org/Composer-Setup.exe
|
||||
On Windows, you can download and run https://getcomposer.org/Composer-Setup.exe
|
||||
|
||||
You can then create a new project
|
||||
|
||||
```bash
|
||||
composer create-project dolibarr/dolibarr erp
|
||||
```
|
||||
|
||||
### Simple setup
|
||||
|
||||
If you have low technical skills and you're looking to install Dolibarr ERP/CRM in few clicks, you can use one of the packaged versions:
|
||||
If you have low technical skills and you're looking to install Dolibarr ERP/CRM in just a few clicks, you can use one of the packaged versions:
|
||||
|
||||
- DoliWamp for Windows
|
||||
- DoliDeb for Debian or Ubuntu
|
||||
@ -48,11 +55,11 @@ If you have low technical skills and you're looking to install Dolibarr ERP/CRM
|
||||
|
||||
### Advanced setup
|
||||
|
||||
You can use a Web server and a supported database (MariaDb, MySql or Postgresql) to install the standard version.
|
||||
You can use a Web server and a supported database (MariaDB, MySQL or PostgreSQL) to install the standard version.
|
||||
|
||||
- Uncompress the downloaded archive
|
||||
- Copy directory "dolibarr" and all its files inside your web server root, or copy directory anywhere and set up your web server to use "dolibarr/htdocs" as root for a new web server virtual host (second choice need to be server administrator)
|
||||
- Create an empty file "htdocs/conf/conf.php" and set permissions for your web server user (write permissions will be removed once install is finished)
|
||||
- Copy the "dolibarr" directory and all its files inside your web server root or anywhere you'd like and set up your web server to use "*dolibarr/htdocs*" as root for a new web server virtual host (second choice need to be server administrator)
|
||||
- Create an empty `htdocs/conf/conf.php` file and set permissions for your web server user (*write* permissions will be removed once install is finished)
|
||||
- From your browser, go to the dolibarr "install/" page
|
||||
|
||||
The URL will depends on choices made in the first step:
|
||||
@ -73,10 +80,10 @@ You can use a Web server and a supported database (MariaDb, MySql or Postgresql)
|
||||
## UPGRADING
|
||||
|
||||
- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
|
||||
- At first next access, Dolibarr will redirect your to the "install/" page to make the upgrade process.
|
||||
If a file install.lock exists to lock any run of upgrade process, the application will ask you to remove the file manually (you should find the install.lock file into the directory used to store generated and uploaded documents, in most cases, it is the directory called "documents").
|
||||
- At first next access, Dolibarr will redirect your to the "install/" page to follow the upgrade process.
|
||||
If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file into the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*").
|
||||
|
||||
*Note: migration process can safely be done multiple times by calling the page /install/index.php*
|
||||
*Note: migration process can be safely done multiple times by calling the `/install/index.php` page*
|
||||
|
||||
|
||||
## WHAT'S NEW
|
||||
@ -172,7 +179,7 @@ Administrator, user, developer and translator's documentations are available alo
|
||||
|
||||
## CONTRIBUTING
|
||||
|
||||
See file [CONTRIBUTING](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)
|
||||
See [CONTRIBUTING](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md) file
|
||||
|
||||
|
||||
## CREDITS
|
||||
|
||||
3
build/docker/.dockerignore
Normal file
3
build/docker/.dockerignore
Normal file
@ -0,0 +1,3 @@
|
||||
Dockerfile
|
||||
README.md
|
||||
docker-compose.yml
|
||||
@ -1,4 +1,7 @@
|
||||
FROM php:5.6-apache
|
||||
FROM php:7.0-apache
|
||||
|
||||
ENV HOST_USER_ID 33
|
||||
ENV PHP_INI_DATE_TIMEZONE 'UTC'
|
||||
|
||||
RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev libldap2-dev \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
@ -9,11 +12,9 @@ RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev libldap2-dev \
|
||||
&& docker-php-ext-install mysqli \
|
||||
&& apt-get purge -y libpng12-dev libjpeg-dev libldap2-dev
|
||||
|
||||
COPY htdocs/ /var/www/html/
|
||||
|
||||
RUN chown -hR www-data:www-data /var/www/html
|
||||
|
||||
VOLUME /var/www/html/conf
|
||||
VOLUME /var/www/html/documents
|
||||
COPY docker-run.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/docker-run.sh
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
ENTRYPOINT ["docker-run.sh"]
|
||||
25
build/docker/README.md
Normal file
25
build/docker/README.md
Normal file
@ -0,0 +1,25 @@
|
||||
# How to use it ?
|
||||
|
||||
The docker-compose.yml file is used to build and run Dolibarr in the current workspace.
|
||||
|
||||
Before build/run, define the variable HOST_USER_ID as following:
|
||||
|
||||
export HOST_USER_ID=$(id -u)
|
||||
|
||||
Go in repository build/docker :
|
||||
|
||||
cd build/docker
|
||||
|
||||
And then, you can run :
|
||||
|
||||
docker-compose up
|
||||
|
||||
This will run 3 container Docker : Dolibarr, MariaDB and PhpMyAdmin.
|
||||
|
||||
The URL to go to the Dolibarr is :
|
||||
|
||||
http://0.0.0.0
|
||||
|
||||
The URL to go to PhpMyAdmin is (login/password is root/root) :
|
||||
|
||||
http://0.0.0.0:8080
|
||||
25
build/docker/docker-compose.yml
Normal file
25
build/docker/docker-compose.yml
Normal file
@ -0,0 +1,25 @@
|
||||
mariadb:
|
||||
image: mariadb:latest
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
MYSQL_DATABASE: dolibarr
|
||||
|
||||
phpmyadmin:
|
||||
image: phpmyadmin/phpmyadmin
|
||||
environment:
|
||||
PMA_HOST: mariadb
|
||||
links:
|
||||
- mariadb
|
||||
ports:
|
||||
- "8080:80"
|
||||
|
||||
web:
|
||||
build: .
|
||||
environment:
|
||||
HOST_USER_ID: $HOST_USER_ID
|
||||
volumes:
|
||||
- ../../htdocs:/var/www/html
|
||||
links:
|
||||
- mariadb
|
||||
ports:
|
||||
- "80:80"
|
||||
15
build/docker/docker-run.sh
Normal file
15
build/docker/docker-run.sh
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
usermod -u $HOST_USER_ID www-data
|
||||
groupmod -g $HOST_USER_ID www-data
|
||||
|
||||
chown -hR www-data:www-data /var/www
|
||||
|
||||
if [ ! -f /usr/local/etc/php/php.ini ]; then
|
||||
cat <<EOF > /usr/local/etc/php/php.ini
|
||||
date.timezone = $PHP_INI_DATE_TIMEZONE
|
||||
display_errors = On
|
||||
EOF
|
||||
fi
|
||||
|
||||
exec apache2-foreground
|
||||
@ -353,10 +353,12 @@ begin
|
||||
begin
|
||||
// TODO Copy file or ask to install package ?
|
||||
//CustomMessage('YouWillInstallDoliWamp')+#13#13
|
||||
MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from <a href="http://ccc">http://www.microsoft.com/en-us/download/details.aspx?id=30679</a> then restart DoliWamp installation/upgrade.',mbInformation,MB_OK);
|
||||
MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from <a href="http://www.microsoft.com/en-us/download/details.aspx?id=30679">http://www.microsoft.com/en-us/download/details.aspx?id=30679</a> then restart DoliWamp installation/upgrade.',mbInformation,MB_OK);
|
||||
end;
|
||||
|
||||
|
||||
// Pb seems similar with msvcp110.dll
|
||||
//vcredist_x64.exe
|
||||
|
||||
|
||||
// If we have a new database version, we should only copy old my.ini file into new directory
|
||||
// and change only all basedir= strings to use new version. Like this, data dir is still correct.
|
||||
// Install of service and stop/start scripts are already rebuild by installer.
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// during install process to be used.
|
||||
//
|
||||
//
|
||||
$force_install_noedit=2;
|
||||
$force_install_noedit=2; // 1=To block vars specific to distrib, 2 to block all technical parameters
|
||||
$force_install_message='KeepDefaultValuesWamp';
|
||||
$force_install_main_data_root='WAMPROOT/dolibarr_documents';
|
||||
$force_install_type='mysqli';
|
||||
|
||||
@ -49,6 +49,8 @@ if (empty($argv[1]))
|
||||
print "Example: ".$script_file." release=6.0.0 includecustom=1 includeconstant=FR:INVOICE_CAN_ALWAYS_BE_REMOVED:0 includeconstant=all:MAILING_NO_USING_PHPMAIL:1\n";
|
||||
exit -1;
|
||||
}
|
||||
parse_str($argv[1]);
|
||||
|
||||
$i=0;
|
||||
while ($i < $argc)
|
||||
{
|
||||
@ -98,9 +100,9 @@ foreach ($includeconstants as $countrycode => $tmp)
|
||||
print "\n";
|
||||
|
||||
//$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml';
|
||||
$outputdir=dirname(__FILE__).'/../htdocs/install';
|
||||
print 'Delete current files '.$outputdir.'/filelist-'.$release.'.xml'."\n";
|
||||
dol_delete_file($outputdir.'/filelist-'.$release.'.xml',0,1,1);
|
||||
$outputdir=dirname(dirname(__FILE__)).'/htdocs/install';
|
||||
print 'Delete current files '.$outputdir.'/filelist*.xml'."\n";
|
||||
dol_delete_file($outputdir.'/filelist*.xml',0,1,1);
|
||||
|
||||
$checksumconcat=array();
|
||||
|
||||
|
||||
@ -334,7 +334,7 @@ foreach my $target (sort keys %CHOOSEDTARGET) {
|
||||
}
|
||||
foreach my $target (sort keys %CHOOSEDPUBLISH) {
|
||||
if ($CHOOSEDPUBLISH{$target} < 0) { next; }
|
||||
if ($target eq 'ASSO') { $nbofpublishneedchangelog++; $nbofpublishneedtag++; }
|
||||
if ($target eq 'ASSO') { $nbofpublishneedchangelog++; }
|
||||
if ($target eq 'SF') { $nbofpublishneedchangelog++; $nbofpublishneedtag++; }
|
||||
$nboftargetok++;
|
||||
}
|
||||
@ -592,6 +592,8 @@ if ($nboftargetok) {
|
||||
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
|
||||
@ -972,9 +974,11 @@ if ($nboftargetok) {
|
||||
$ret=`$cmd`;
|
||||
$ret=`chmod 755 $BUILDROOT/$PROJECT.tmp/debian/rules`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/translation/autotranslator.class.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/actions_mymodule.class.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/api_myobject.class.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/myobject.class.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/myobject_api_class.class.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/core/modules/modMyModule.class.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/mymoduleindex.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/myobject_card.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/myobject_list.php`;
|
||||
$ret=`chmod -R 755 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/scripts/myobject.php`;
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
README (English)
|
||||
##################################################
|
||||
Install script for Virtualmin Pro
|
||||
Install script for Virtualmin Professional / GPL
|
||||
##################################################
|
||||
|
||||
This script will install automatically Dolibarr from Virtualmin Pro
|
||||
http://www.virtualmin.com
|
||||
This script will install automatically Dolibarr from Virtualmin.
|
||||
(Included in the professional version and can be added in the GPL version)
|
||||
|
||||
https://www.virtualmin.com
|
||||
http://www.webmin.com/virtualmin.html
|
||||
@ -1,7 +1,7 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# \file dolibarr.pl
|
||||
# \brief Dolibarr script install for Virtualmin Pro
|
||||
# \author (c)2009-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
# \author (c)2009-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -30,7 +30,12 @@ return "Regis Houssin";
|
||||
# script_dolibarr_versions()
|
||||
sub script_dolibarr_versions
|
||||
{
|
||||
return ( "3.8.1", "3.7.1", "3.6.4", "3.5.7" );
|
||||
return ( "5.0.4", "4.0.6", "3.9.4" );
|
||||
}
|
||||
|
||||
sub script_dolibarr_release
|
||||
{
|
||||
return 2; # for mysqli fix
|
||||
}
|
||||
|
||||
sub script_dolibarr_category
|
||||
@ -177,9 +182,9 @@ if ($opts->{'newdb'} && !$upgrade) {
|
||||
local ($dbtype, $dbname) = split(/_/, $opts->{'db'}, 2);
|
||||
local $dbuser = $dbtype eq "mysql" ? &mysql_user($d) : &postgres_user($d);
|
||||
local $dbpass = $dbtype eq "mysql" ? &mysql_pass($d) : &postgres_pass($d, 1);
|
||||
local $dbphptype = $dbtype eq "mysql" && $version >= 3.6 ? "mysql" :
|
||||
local $dbphptype = $dbtype eq "mysql" && $version < 3.6 ? "mysql" :
|
||||
$dbtype eq "mysql" ? "mysqli" : "pgsql";
|
||||
local $dbhost = &get_database_host($dbtype);
|
||||
local $dbhost = &get_database_host($dbtype, $d);
|
||||
local $dberr = &check_script_db_connection($dbtype, $dbname, $dbuser, $dbpass);
|
||||
return (0, "Database connection failed : $dberr") if ($dberr);
|
||||
|
||||
@ -206,9 +211,6 @@ $pgcharset = $tmpl->{'postgres_encoding'};
|
||||
$charset = $dbtype eq "mysql" ? $mycharset : $pgcharset;
|
||||
$collate = $dbtype eq "mysql" ? $mycollate : "C";
|
||||
|
||||
# Install filename
|
||||
local $step = $version >= 3.8 ? "step" : "etape";
|
||||
|
||||
$path = &script_path_url($d, $opts);
|
||||
if ($path =~ /^https:/ || $d->{'ssl'}) {
|
||||
$url = "https://$d->{'dom'}";
|
||||
@ -222,15 +224,11 @@ if ($opts->{'path'} =~ /\w/) {
|
||||
|
||||
if (!$upgrade) {
|
||||
local $cdef = "$opts->{'dir'}/conf/conf.php.example";
|
||||
&run_as_domain_user($d, "cp ".quotemeta($cdef)." ".quotemeta($cfile));
|
||||
©_source_dest_as_domain_user($d, $cdef, $cfile);
|
||||
&set_permissions_as_domain_user($d, 0777, $cfiledir);
|
||||
&set_permissions_as_domain_user($d, 0666, $cfile);
|
||||
©_source_dest_as_domain_user($d, $cfile);
|
||||
&run_as_domain_user($d, "mkdir ".quotemeta($docdir));
|
||||
&set_permissions_as_domain_user($d, 0777, $docdir);
|
||||
if (!$version >= 3.7.2) {
|
||||
&run_as_domain_user($d, "mkdir ".quotemeta($altdir));
|
||||
&set_permissions_as_domain_user($d, 0777, $altdir);
|
||||
}
|
||||
}
|
||||
else {
|
||||
# Preserve old config file, documents and custom directory
|
||||
@ -266,7 +264,8 @@ if ($upgrade) {
|
||||
[ "versionfrom", $upgrade->{'version'} ],
|
||||
[ "versionto", $ver ],
|
||||
);
|
||||
local $err = &call_dolibarr_wizard_page(\@params, $step."5", $d, $opts);
|
||||
local $p = $ver >= 3.8 ? "step5" : "etape5";
|
||||
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
|
||||
return (-1, "Dolibarr wizard failed : $err") if ($err);
|
||||
|
||||
# Remove the installation directory.
|
||||
@ -289,15 +288,17 @@ else {
|
||||
[ "main_force_https", $opts->{'forcehttps'} ],
|
||||
[ "dolibarr_main_db_character_set", $charset ],
|
||||
[ "dolibarr_main_db_collation", $collate ],
|
||||
[ "main_use_alt_dir", "1" ],
|
||||
[ "usealternaterootdir", "1" ],
|
||||
[ "main_alt_dir_name", "custom" ],
|
||||
);
|
||||
local $err = &call_dolibarr_wizard_page(\@params, $step."1", $d, $opts);
|
||||
local $p = $ver >= 3.8 ? "step1" : "etape1";
|
||||
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
|
||||
return (-1, "Dolibarr wizard failed : $err") if ($err);
|
||||
|
||||
# Second page (Populate database)
|
||||
local @params = ( [ "action", "set" ] );
|
||||
local $err = &call_dolibarr_wizard_page(\@params, $step."2", $d, $opts);
|
||||
local $p = $ver >= 3.8 ? "step2" : "etape2";
|
||||
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
|
||||
return (-1, "Dolibarr wizard failed : $err") if ($err);
|
||||
|
||||
# Third page (Add administrator account)
|
||||
@ -306,7 +307,8 @@ else {
|
||||
[ "pass", $dompass ],
|
||||
[ "pass_verif", $dompass ],
|
||||
);
|
||||
local $err = &call_dolibarr_wizard_page(\@params, $step."5", $d, $opts);
|
||||
local $p = $ver >= 3.8 ? "step5" : "etape5";
|
||||
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
|
||||
return (-1, "Dolibarr wizard failed : $err") if ($err);
|
||||
|
||||
# Remove the installation directory and protect config file.
|
||||
@ -384,7 +386,10 @@ sub script_dolibarr_check_latest
|
||||
{
|
||||
local ($ver) = @_;
|
||||
local @vers = &osdn_package_versions("dolibarr",
|
||||
$ver >= 3.8 ? "dolibarr\\-(3\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 5.0 ? "dolibarr\\-(5\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 4.0 ? "dolibarr\\-(4\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 3.9 ? "dolibarr\\-(3\\.9\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 3.8 ? "dolibarr\\-(3\\.8\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 3.7 ? "dolibarr\\-(3\\.7\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 3.6 ? "dolibarr\\-(3\\.6\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 3.5 ? "dolibarr\\-(3\\.5\\.[0-9\\.]+)\\.tgz" :
|
||||
|
||||
@ -162,6 +162,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/api
|
||||
%_datadir/dolibarr/htdocs/asterisk
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/blockedlog
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
%_datadir/dolibarr/htdocs/cashdesk
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
|
||||
@ -242,6 +242,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/api
|
||||
%_datadir/dolibarr/htdocs/asterisk
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/blockedlog
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
%_datadir/dolibarr/htdocs/cashdesk
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
|
||||
@ -159,9 +159,11 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/api
|
||||
%_datadir/dolibarr/htdocs/asterisk
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/blockedlog
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
%_datadir/dolibarr/htdocs/cashdesk
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
%_datadir/dolibarr/htdocs/collab
|
||||
%_datadir/dolibarr/htdocs/comm
|
||||
%_datadir/dolibarr/htdocs/commande
|
||||
%_datadir/dolibarr/htdocs/compta
|
||||
|
||||
@ -170,6 +170,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/api
|
||||
%_datadir/dolibarr/htdocs/asterisk
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/blockedlog
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
%_datadir/dolibarr/htdocs/cashdesk
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
$force_install_packager='rpmfedora';
|
||||
$force_install_noedit=1; # 1 to block var specific to distrib, 2 to block every technical parameters
|
||||
$force_install_noedit=1; // 1 to block var specific to distrib, 2 to block every technical parameters
|
||||
$force_install_message='KeepDefaultValuesDeb';
|
||||
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
||||
$force_install_type='mysqli';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
$force_install_packager='rpmgeneric';
|
||||
$force_install_noedit=1; # 1 to block var specific to distrib, 2 to block every technical parameters
|
||||
$force_install_noedit=1; // 1 to block var specific to distrib, 2 to block every technical parameters
|
||||
$force_install_message='KeepDefaultValuesDeb';
|
||||
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
||||
$force_install_type='mysqli';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
$force_install_packager='rpmmandriva';
|
||||
$force_install_noedit=1; # 1 to block var specific to distrib, 2 to block every technical parameters
|
||||
$force_install_noedit=1; // 1 to block var specific to distrib, 2 to block every technical parameters
|
||||
$force_install_message='KeepDefaultValuesDeb';
|
||||
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
||||
$force_install_type='mysqli';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
$force_install_packager='rpmopensuse';
|
||||
$force_install_noedit=1; # 1 to block var specific to distrib, 2 to block every technical parameters
|
||||
$force_install_noedit=1; // 1 to block var specific to distrib, 2 to block every technical parameters
|
||||
$force_install_message='KeepDefaultValuesDeb';
|
||||
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
||||
$force_install_type='mysqli';
|
||||
|
||||
@ -5,7 +5,7 @@ in Dolibarr root.
|
||||
|
||||
ALL:
|
||||
----
|
||||
Check "DOL_CHANGE"
|
||||
Check "@CHANGE"
|
||||
|
||||
|
||||
CKEDITOR (4.6.2):
|
||||
|
||||
9423
dev/initdemo/mysqldump_dolibarr_6.0.0.sql
Normal file
9423
dev/initdemo/mysqldump_dolibarr_6.0.0.sql
Normal file
File diff suppressed because one or more lines are too long
@ -192,6 +192,7 @@ export list="
|
||||
--ignore-table=$base.llx_cabinetmed_c_ccam
|
||||
--ignore-table=$base.llx_cabinetmed_c_examconclusion
|
||||
--ignore-table=$base.llx_cabinetmed_cons
|
||||
--ignore-table=$base.llx_cabinetmed_cons_extrafields
|
||||
--ignore-table=$base.llx_cabinetmed_diaglec
|
||||
--ignore-table=$base.llx_cabinetmed_examaut
|
||||
--ignore-table=$base.llx_cabinetmed_exambio
|
||||
@ -207,7 +208,18 @@ export list="
|
||||
--ignore-table=$base.llx_dolicloud_customers
|
||||
--ignore-table=$base.llx_dolicloud_stats
|
||||
--ignore-table=$base.llx_dolicloud_emailstemplates
|
||||
--ignore-table=$base.llx_dolireport_column
|
||||
--ignore-table=$base.llx_dolireport_criteria
|
||||
--ignore-table=$base.llx_dolireport_graph
|
||||
--ignore-table=$base.llx_dolireport_plot
|
||||
--ignore-table=$base.llx_dolireport_report
|
||||
--ignore-table=$base.llx_domain
|
||||
--ignore-table=$base.llx_ecommerce_commande
|
||||
--ignore-table=$base.llx_ecommerce_facture
|
||||
--ignore-table=$base.llx_ecommerce_product
|
||||
--ignore-table=$base.llx_ecommerce_site
|
||||
--ignore-table=$base.llx_ecommerce_societe
|
||||
--ignore-table=$base.llx_ecommerce_socpeople
|
||||
--ignore-table=$base.llx_element_rang
|
||||
--ignore-table=$base.llx_entity
|
||||
--ignore-table=$base.llx_filemanager_roots
|
||||
@ -215,6 +227,8 @@ export list="
|
||||
--ignore-table=$base.llx_google_maps
|
||||
--ignore-table=$base.llx_milestone
|
||||
--ignore-table=$base.llx_monitoring_probes
|
||||
--ignore-table=$base.llx_m
|
||||
--ignore-table=$base.llx_m_extrafields
|
||||
--ignore-table=$base.llx_notes
|
||||
--ignore-table=$base.llx_pos_cash
|
||||
--ignore-table=$base.llx_pos_control_cash
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
JOURNALCODE JOURNALLIB ECRITURENUM ECRITUREDATE COMPTENUM COMPTELIB COMPAUXNUM COMPAUXLIB PIECEREF PIECEDATE ECRITURELIB DEBIT CREDIT ECRITURELET DATELET VALIDDATE MONTANTDEVISE IDEVISE
|
||||
JOURNALCODE JOURNALLIB ECRITURENUM ECRITUREDATE COMPTENUM COMPTELIB COMPAUXNUM COMPAUXLIB PIECEREF PIECEDATE ECRITURELIB DEBIT CREDIT ECRITURELET DATELET VALIDDATE MONTANTDEVISE IDEVISE
|
||||
Banque Banque 17293 20170109 401PPRO PUBLI-PROV L08 20170109 PPRO domiciliation 1TR 187,20 0,00 20170109
|
||||
Banque Banque 17293 20170109 5121CRA CR AGRICOLE L08 20170109 PPRO domiciliation 1TR 0,00 187,20 20170109
|
||||
Banque Banque 17295 20170109 401ORPA ORANGE PARIS Report 20170109 ORPA adsl par 12 96,00 0,00 20170109
|
||||
|
||||
@ -1 +1,4 @@
|
||||
http://www.taxrates.cc/index.html
|
||||
http://www.taxrates.cc/index.html
|
||||
|
||||
For India: VAT=IGST/CGST=Localtax1/SGST=Localtax2: https://cleartax.in/s/what-is-sgst-cgst-igst
|
||||
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
# vim:ft=sh:ts=3:sts=3:sw=3:et:
|
||||
|
||||
###
|
||||
# Strips the closing php tag `?>` and any following blank lines from the
|
||||
# end of any PHP file in the current working directory and sub-directories. Files
|
||||
# with non-whitespace characters following the closing tag will not be affected.
|
||||
#
|
||||
# Author: Bryan C. Geraghty <bryan@ravensight.org>
|
||||
# Date: 2009-10-28
|
||||
# Source: http://bryan.ravensight.org/2010/07/remove-php-closing-tag/
|
||||
##
|
||||
|
||||
FILES=$(pcregrep -rnM --include='^.*\.php$' '^\?\>(?=([\s\n]+)?$(?!\n))' .);
|
||||
|
||||
for MATCH in $FILES;
|
||||
do
|
||||
FILE=`echo $MATCH | awk -F ':' '{print $1}'`;
|
||||
TARGET=`echo $MATCH | awk -F ':' '{print $2}'`;
|
||||
LINE_COUNT=`wc -l $FILE | awk -F " " '{print $1}'`;
|
||||
echo "Removing lines ${TARGET} through ${LINE_COUNT} from file $FILE...";
|
||||
sed -i "${TARGET},${LINE_COUNT}d" $FILE;
|
||||
done;
|
||||
@ -12,3 +12,6 @@ Balance ?? Net profit
|
||||
Subledger account Subledger account ??
|
||||
|
||||
|
||||
Proposal ?? Quotation Proposal is ok but proposition looks better (proposal is for a detailed proposition). We can say also "business proposition or business proposal".
|
||||
Indian are using "Quotation".
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ $path=dirname(__FILE__).'/';
|
||||
$web=0;
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi')
|
||||
if (substr($sapi_type, 0, 3) == 'cgi')
|
||||
{
|
||||
$web=1;
|
||||
}
|
||||
@ -35,9 +35,9 @@ if ($web)
|
||||
{
|
||||
echo "<html>";
|
||||
echo "<head>";
|
||||
|
||||
|
||||
echo "<STYLE type=\"text/css\">
|
||||
|
||||
|
||||
table {
|
||||
background: #f5f5f5;
|
||||
border-collapse: separate;
|
||||
@ -48,7 +48,7 @@ if ($web)
|
||||
text-align: left;
|
||||
width: 800px;
|
||||
}
|
||||
|
||||
|
||||
th {
|
||||
background-color: #777;
|
||||
border-left: 1px solid #555;
|
||||
@ -61,7 +61,7 @@ if ($web)
|
||||
position: relative;
|
||||
text-shadow: 0 1px 0 #000;
|
||||
}
|
||||
|
||||
|
||||
td {
|
||||
border-right: 1px solid #fff;
|
||||
border-left: 1px solid #e8e8e8;
|
||||
@ -70,19 +70,19 @@ if ($web)
|
||||
padding: 10px 15px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
tr {
|
||||
background-color: #f1f1f1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
tr:nth-child(odd) td {
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
|
||||
|
||||
</STYLE>";
|
||||
|
||||
|
||||
echo "<body>";
|
||||
}
|
||||
|
||||
@ -142,9 +142,9 @@ foreach ($files AS $file) {
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($langstrings_3d AS $filename => $file)
|
||||
foreach ($langstrings_3d AS $filename => $file)
|
||||
{
|
||||
foreach ($file AS $linenum => $value)
|
||||
foreach ($file AS $linenum => $value)
|
||||
{
|
||||
$keys = array_keys($langstrings_full, $value);
|
||||
if (count($keys)>1)
|
||||
@ -173,11 +173,11 @@ $sininstallandadmin='';
|
||||
$sother='';
|
||||
|
||||
$count = 0;
|
||||
foreach ($dups as $string => $pages)
|
||||
foreach ($dups as $string => $pages)
|
||||
{
|
||||
$count++;
|
||||
$s='';
|
||||
|
||||
|
||||
// Keyword $string
|
||||
if ($web) $s.="<tr>";
|
||||
if ($web) $s.="<td align=\"center\">";
|
||||
@ -188,32 +188,32 @@ foreach ($dups as $string => $pages)
|
||||
if ($web) $s.="</td>";
|
||||
if ($web) $s.="<td>";
|
||||
if (! $web) $s.= ' : ';
|
||||
|
||||
|
||||
// Loop on each files keyword was found
|
||||
$duplicateinsamefile=0;
|
||||
$inmain=0;
|
||||
$inadmin=0;
|
||||
foreach ($pages AS $file => $lines)
|
||||
foreach ($pages AS $file => $lines)
|
||||
{
|
||||
if ($file == 'main.lang') { $inmain=1; $inadmin=0; }
|
||||
if ($file == 'admin.lang' && ! $inmain) { $inadmin=1; }
|
||||
|
||||
|
||||
$s.=$file." ";
|
||||
|
||||
|
||||
// Loop on each line keword was found into file.
|
||||
$listoffilesforthisentry=array();
|
||||
foreach ($lines as $line => $translatedvalue)
|
||||
foreach ($lines as $line => $translatedvalue)
|
||||
{
|
||||
if (! empty($listoffilesforthisentry[$file])) $duplicateinsamefile=1;
|
||||
$listoffilesforthisentry[$file]=1;
|
||||
|
||||
|
||||
$s.= "(".$line." - ".htmlentities($translatedvalue).") ";
|
||||
}
|
||||
if ($web) $s.="<br>";
|
||||
}
|
||||
if ($web) $s.="</td></tr>";
|
||||
$s.="\n";
|
||||
|
||||
|
||||
if ($duplicateinsamefile) $sduplicateinsamefile .= $s;
|
||||
else if ($inmain) $sinmainandother .= $s;
|
||||
else if ($inadmin) $sininstallandadmin .= $s;
|
||||
@ -252,7 +252,7 @@ if ($web)
|
||||
if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($argv[1]) && $argv[1]=='unused=true'))
|
||||
{
|
||||
print "***** Strings in en_US that are never used:\n";
|
||||
|
||||
|
||||
$unused=array();
|
||||
foreach ($langstrings_dist AS $value => $line)
|
||||
{
|
||||
@ -288,7 +288,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
|
||||
if (preg_match('/^JuridicalStatus/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^CalcMode/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^newLT/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^LT\d/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^LT[0-9]/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^TypeContact_contrat_/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^ErrorPriceExpression/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^Language_/', $value)) $qualifiedforclean=0;
|
||||
@ -315,7 +315,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
|
||||
// orders
|
||||
if (preg_match('/^OrderSource/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^TypeContact_/', $value)) $qualifiedforclean=0;
|
||||
// other.lang
|
||||
// other.lang
|
||||
if (preg_match('/^Notify_/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^PredefinedMail/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^DemoCompany/', $value)) $qualifiedforclean=0;
|
||||
@ -336,17 +336,17 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
|
||||
if (preg_match('/OppStatus/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/AvailabilityType/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/CardProduct/', $value)) $qualifiedforclean=0;
|
||||
|
||||
|
||||
if (preg_match('/sms/i', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/TF_/i', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/WithBankUsing/i', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/descWORKFLOW_/i', $value)) $qualifiedforclean=0;
|
||||
|
||||
|
||||
if (! $qualifiedforclean)
|
||||
{
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//$search = '\'trans("'.$value.'")\'';
|
||||
$search = '-e "\''.$value.'\'" -e \'"'.$value.'"\' -e "('.$value.')" -e "('.$value.',"';
|
||||
$string = 'grep -R -m 1 -F --exclude=includes/* --include=*.php '.$search.' '.$htdocs.'* '.$scripts.'*';
|
||||
@ -356,7 +356,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
|
||||
$unused[$value] = $line;
|
||||
echo $line; // $trad contains the \n
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
unset($output);
|
||||
//print 'X'.$output.'Y';
|
||||
@ -364,7 +364,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
|
||||
}
|
||||
|
||||
if (empty($unused)) print "No string not used found.\n";
|
||||
else
|
||||
else
|
||||
{
|
||||
$filetosave='/tmp/'.($argv[2]?$argv[2]:"").'notused.lang';
|
||||
print "Strings in en_US that are never used are saved into file ".$filetosave.":\n";
|
||||
|
||||
@ -303,6 +303,8 @@ foreach($filesToProcess as $fileToProcess)
|
||||
|
||||
// ----- Process output now -----
|
||||
|
||||
//print "Found primary key = ".$key."\n";
|
||||
|
||||
// Key not in other file
|
||||
if (in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/',$key) || preg_match('/^FormatHour/',$key))
|
||||
{
|
||||
@ -321,7 +323,7 @@ foreach($filesToProcess as $fileToProcess)
|
||||
|| in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/',$key) || preg_match('/^FormatHour/',$key)
|
||||
)
|
||||
{
|
||||
//print "Key $key differs so we add it into new secondary language (line: $cnt).\n";
|
||||
//print "Key $key differs (aSecondary=".$aSecondary[$key].", aPrimary=".$aPrimary[$key].", aEnglish=".$aEnglish[$key].") so we add it into new secondary language (line: $cnt).\n";
|
||||
fwrite($oh, $key."=".(empty($aSecondary[$key])?$aPrimary[$key]:$aSecondary[$key])."\n");
|
||||
}
|
||||
}
|
||||
|
||||
BIN
doc/images/dolibarr_screenshot5_1920x1080_a.jpg
Normal file
BIN
doc/images/dolibarr_screenshot5_1920x1080_a.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 223 KiB |
BIN
doc/images/dolibarr_screenshot5_1920x1080_b.jpg
Normal file
BIN
doc/images/dolibarr_screenshot5_1920x1080_b.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 124 KiB |
@ -37,7 +37,7 @@ $langs->load("salaries");
|
||||
|
||||
$mesg = '';
|
||||
$action = GETPOST('action','aZ09');
|
||||
$cancel = GETPOST('cancel');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
|
||||
@ -69,8 +69,8 @@ $arrayfields=array(
|
||||
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
|
||||
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0),
|
||||
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>0),
|
||||
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0),
|
||||
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
|
||||
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
|
||||
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
|
||||
);
|
||||
|
||||
@ -84,8 +84,8 @@ $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'accounting
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction')) { $massaction=''; }
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha')) { $massaction=''; }
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -94,10 +94,10 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (! empty($cancel)) $action = '';
|
||||
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_account = "";
|
||||
$search_label = "";
|
||||
@ -106,13 +106,13 @@ if (empty($reshook))
|
||||
$search_pcgsubtype = "";
|
||||
$search_array_options=array();
|
||||
}
|
||||
|
||||
|
||||
if (GETPOST('change_chart'))
|
||||
{
|
||||
$chartofaccounts = GETPOST('chartofaccounts', 'int');
|
||||
|
||||
|
||||
if (! empty($chartofaccounts)) {
|
||||
|
||||
|
||||
if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
}
|
||||
@ -120,12 +120,12 @@ if (empty($reshook))
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'disable') {
|
||||
if ($accounting->fetch($id)) {
|
||||
$result = $accounting->account_desactivate($id);
|
||||
}
|
||||
|
||||
|
||||
$action = 'update';
|
||||
if ($result < 0) {
|
||||
setEventMessages($accounting->error, $accounting->errors, 'errors');
|
||||
@ -179,7 +179,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
}
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
@ -190,13 +190,14 @@ if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$params='';
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($search_account) $params.= '&search_account='.urlencode($search_account);
|
||||
if ($search_label) $params.= '&search_label='.urlencode($search_label);
|
||||
if ($search_accountparent) $params.= '&search_accountparent='.urlencode($search_accountparent);
|
||||
if ($search_pcgtype) $params.= '&search_pcgtype='.urlencode($search_pcgtype);
|
||||
if ($search_pcgsubtype) $params.= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($search_account) $param.= '&search_account='.urlencode($search_account);
|
||||
if ($search_label) $param.= '&search_label='.urlencode($search_label);
|
||||
if ($search_accountparent) $param.= '&search_accountparent='.urlencode($search_accountparent);
|
||||
if ($search_pcgtype) $param.= '&search_pcgtype='.urlencode($search_pcgtype);
|
||||
if ($search_pcgsubtype) $param.= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
|
||||
@ -209,11 +210,11 @@ if ($resql)
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
|
||||
$htmlbuttonadd = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
|
||||
|
||||
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $htmlbuttonadd);
|
||||
|
||||
|
||||
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $htmlbuttonadd, '', $limit);
|
||||
|
||||
// Box to select active chart of account
|
||||
print $langs->trans("Selectchartofaccounts") . " : ";
|
||||
print '<select class="flat" name="chartofaccounts" id="chartofaccounts">';
|
||||
@ -227,22 +228,22 @@ if ($resql)
|
||||
$i = 0;
|
||||
while ( $i < $numbis ) {
|
||||
$row = $db->fetch_row($resqlchart);
|
||||
|
||||
|
||||
print '<option value="' . $row[0] . '"';
|
||||
print $pcgver == $row[0] ? ' selected' : '';
|
||||
print '>' . $row[1] . ' - ' . $row[2] . '</option>';
|
||||
|
||||
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
print "</select>";
|
||||
print '<input type="submit" class="button" name="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
@ -259,13 +260,13 @@ if ($resql)
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"],"aa.account_number","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"],"aa.label","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"],"aa.account_parent", "", $param,'align="left"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'],$_SERVER["PHP_SELF"],'aa.pcg_type','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'],$_SERVER["PHP_SELF"],'aa.pcg_subtype','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'],$_SERVER["PHP_SELF"],'aa.pcg_type','',$param,'',$sortfield,$sortorder,'',$arrayfields['aa.pcg_type']['help']);
|
||||
if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'],$_SERVER["PHP_SELF"],'aa.pcg_subtype','',$param,'',$sortfield,$sortorder,'',$arrayfields['aa.pcg_subtype']['help']);
|
||||
if (! empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'],$_SERVER["PHP_SELF"],'aa.active','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
@ -274,14 +275,14 @@ if ($resql)
|
||||
$accountparent = new AccountingAccount($db);
|
||||
|
||||
$i=0;
|
||||
while ($i < min($num, $limit))
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$accountstatic->id = $obj->rowid;
|
||||
$accountstatic->label = $obj->label;
|
||||
$accountstatic->account_number = $obj->account_number;
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Account number
|
||||
@ -310,7 +311,7 @@ if ($resql)
|
||||
$accountparent->id = $obj->rowid2;
|
||||
$accountparent->label = $obj->label2;
|
||||
$accountparent->account_number = $obj->account_number2;
|
||||
|
||||
|
||||
print "<td>";
|
||||
print $accountparent->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
@ -371,11 +372,11 @@ if ($resql)
|
||||
}
|
||||
print '</td>' . "\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
print '</form>';
|
||||
|
||||
@ -68,7 +68,7 @@ $active = 1;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||
$offset = $listlimit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
@ -602,6 +602,7 @@ if ($id)
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Form to add a new line
|
||||
@ -1139,6 +1140,7 @@ if ($id)
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
@ -1148,7 +1150,6 @@ else
|
||||
* Show list of dictionary to show
|
||||
*/
|
||||
|
||||
$var=true;
|
||||
$lastlineisempty=false;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
@ -37,10 +37,10 @@ $langs->load("accountancy");
|
||||
|
||||
$mesg = '';
|
||||
$action = GETPOST('action','aZ09');
|
||||
$backtopage = GETPOST('backtopage');
|
||||
$backtopage = GETPOST('backtopage','alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$cancel = GETPOST('cancel');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
|
||||
// Security check
|
||||
|
||||
@ -52,7 +52,7 @@ $object = new AccountingAccount($db);
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel'))
|
||||
if (GETPOST('cancel','alpha'))
|
||||
{
|
||||
$urltogo=$backtopage?$backtopage:dol_buildpath('/accountancy/admin/account.php',1);
|
||||
header("Location: ".$urltogo);
|
||||
@ -63,7 +63,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
|
||||
{
|
||||
if (! $cancel) {
|
||||
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
|
||||
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
|
||||
$result = $db->query($sql);
|
||||
$obj = $db->fetch_object($result);
|
||||
@ -172,16 +172,16 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
|
||||
}
|
||||
} else if ($action == 'delete' && $user->rights->accounting->chartofaccount) {
|
||||
$result = $object->fetch($id);
|
||||
|
||||
|
||||
if (! empty($object->id)) {
|
||||
$result = $object->delete($user);
|
||||
|
||||
|
||||
if ($result > 0) {
|
||||
header("Location: account.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
@ -270,7 +270,7 @@ if ($action == 'create') {
|
||||
$head = accounting_prepare_head($object);
|
||||
|
||||
// Edit mode
|
||||
if ($action == 'update')
|
||||
if ($action == 'update')
|
||||
{
|
||||
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
|
||||
|
||||
@ -327,7 +327,7 @@ if ($action == 'create') {
|
||||
print '</form>';
|
||||
} else {
|
||||
// View mode
|
||||
$linkback = '<a href="../admin/account.php">' . $langs->trans("BackToChartofaccounts") . '</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ $langs->load("accountancy");
|
||||
$mesg = '';
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$cancel = GETPOST('cancel');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
$action = GETPOST('action','aZ09');
|
||||
$cat_id = GETPOST('account_category');
|
||||
$selectcpt = GETPOST('cpt_bk', 'array');
|
||||
@ -46,7 +46,7 @@ if ($cat_id == 0) {
|
||||
}
|
||||
|
||||
// Security check
|
||||
if (! empty($user->rights->accountancy->chartofaccount))
|
||||
if (empty($user->rights->accounting->chartofaccount))
|
||||
{
|
||||
accessforbidden();
|
||||
}
|
||||
@ -98,26 +98,38 @@ dol_fiche_head();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
// Category
|
||||
print '<tr><td>' . $langs->trans("AccountingCategory") . '</td>';
|
||||
print '<tr><td class="titlefield">' . $langs->trans("AccountingCategory") . '</td>';
|
||||
print '<td>';
|
||||
$formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 1);
|
||||
print '<input class="button" type="submit" value="' . $langs->trans("Select") . '">';
|
||||
print '</td></tr>';
|
||||
|
||||
if (! empty($cat_id))
|
||||
if (! empty($cat_id))
|
||||
{
|
||||
$return = $accountingcategory->getAccountsWithNoCategory($cat_id);
|
||||
if ($return < 0) {
|
||||
setEventMessages(null, $accountingcategory->errors, 'errors');
|
||||
}
|
||||
print '<tr><td>' . $langs->trans("AddAccountFromBookKeepingWithNoCategories") . '</td>';
|
||||
print '<tr><td class="tdtop">' . $langs->trans("AddAccountFromBookKeepingWithNoCategories") . '</td>';
|
||||
print '<td>';
|
||||
|
||||
$arraykeyvalue=array();
|
||||
foreach($accountingcategory->lines_cptbk as $key => $val)
|
||||
{
|
||||
$arraykeyvalue[length_accountg($val->numero_compte)] = length_accountg($val->numero_compte) . ' (' . $val->label_compte . ($val->doc_ref?' '.$val->doc_ref:'').')';
|
||||
}
|
||||
|
||||
if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) {
|
||||
print '<select class="flat minwidth200" size="' . count($obj) . '" name="cpt_bk[]" multiple>';
|
||||
|
||||
print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, null, null, "90%");
|
||||
print '<br>';
|
||||
/*print '<select class="flat minwidth200" size="8" name="cpt_bk[]" multiple>';
|
||||
foreach ( $accountingcategory->lines_cptbk as $cpt ) {
|
||||
print '<option value="' . length_accountg($cpt->numero_compte) . '">' . length_accountg($cpt->numero_compte) . ' (' . $cpt->label_compte . ' ' . $cpt->doc_ref . ')</option>';
|
||||
}
|
||||
print '</select><br>';
|
||||
print ajax_combobox('cpt_bk');
|
||||
*/
|
||||
print '<input class="button" type="submit" id="" class="action-delete" value="' . $langs->trans("Add") . '"> ';
|
||||
}
|
||||
print '</td></tr>';
|
||||
@ -164,4 +176,4 @@ if ($action == 'display' || $action == 'delete') {
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
$db->close();
|
||||
|
||||
@ -1,16 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
|
||||
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -52,12 +42,12 @@ $langs->load("hrm");
|
||||
|
||||
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$id=GETPOST('id','int');
|
||||
$id=32;
|
||||
$rowid=GETPOST('rowid','alpha');
|
||||
$code=GETPOST('code','alpha');
|
||||
|
||||
// Security access
|
||||
if (! empty($user->rights->accountancy->chartofaccount))
|
||||
if (empty($user->rights->accounting->chartofaccount))
|
||||
{
|
||||
accessforbidden();
|
||||
}
|
||||
@ -74,7 +64,7 @@ $active = 1;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||
$offset = $listlimit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
@ -100,7 +90,7 @@ $tablib[32]= "DictionaryAccountancyCategory";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql=array();
|
||||
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
||||
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
@ -108,15 +98,15 @@ $tabsqlsort[32]="position ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield=array();
|
||||
$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
|
||||
$tabfield[32]= "code,label,range_account,category_type,formula,position,country";
|
||||
|
||||
// Nom des champs d'edition pour modification d'un enregistrement
|
||||
$tabfieldvalue=array();
|
||||
$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country";
|
||||
$tabfieldvalue[32]= "code,label,range_account,category_type,formula,position,country_id";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$tabfieldinsert=array();
|
||||
$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
|
||||
$tabfieldinsert[32]= "code,label,range_account,category_type,formula,position,fk_country";
|
||||
|
||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||
// Example: "" if id field is "rowid" and has autoincrement on
|
||||
@ -167,24 +157,17 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$ok=1;
|
||||
foreach ($listfield as $f => $value)
|
||||
{
|
||||
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp','DictionaryAccountancysystem','DictionaryAccountancyCategory'))) continue; // For some pages, country is not mandatory
|
||||
if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
|
||||
if ($value == 'formula' && empty($_POST['formula'])) continue;
|
||||
if ((! isset($_POST[$value]) || $_POST[$value]=='')
|
||||
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy')) // Fields that are not mandatory
|
||||
&& (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10
|
||||
)
|
||||
)
|
||||
if ($value == 'range_account' && empty($_POST['range_account'])) continue;
|
||||
if ($value == 'country') continue; // country_id required but not country
|
||||
if (! isset($_POST[$value]) || $_POST[$value]=='')
|
||||
{
|
||||
$ok=0;
|
||||
$fieldnamekey=$listfield[$f];
|
||||
// We take translate key of field
|
||||
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
|
||||
if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
|
||||
if ($fieldnamekey == 'module') $fieldnamekey='Module';
|
||||
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
|
||||
if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
|
||||
if ($fieldnamekey == 'taux') $fieldnamekey = 'Rate';
|
||||
if ($fieldnamekey == 'type') $fieldnamekey = 'Type';
|
||||
if ($fieldnamekey == 'position') $fieldnamekey = 'Position';
|
||||
if ($fieldnamekey == 'category_type') $fieldnamekey = 'Calculated';
|
||||
@ -192,11 +175,6 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
}
|
||||
}
|
||||
// Other checks
|
||||
if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"],array('system','systemauto'))) {
|
||||
$ok=0;
|
||||
setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors');
|
||||
}
|
||||
if (isset($_POST["code"]))
|
||||
{
|
||||
if ($_POST["code"]=='0')
|
||||
@ -210,17 +188,10 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
|
||||
}*/
|
||||
}
|
||||
if (isset($_POST["country"]) && ($_POST["country"]=='0'))
|
||||
if (isset($_POST["country"]) && ($_POST["country"] <= 0))
|
||||
{
|
||||
if (in_array($tablib[$id],array('DictionaryCompanyType','DictionaryHolidayTypes'))) // Field country is no mandatory for such dictionaries
|
||||
{
|
||||
$_POST["country"]='';
|
||||
}
|
||||
else
|
||||
{
|
||||
$ok=0;
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")), null, 'errors');
|
||||
}
|
||||
$ok=0;
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")), null, 'errors');
|
||||
}
|
||||
|
||||
// Clean some parameters
|
||||
@ -262,14 +233,11 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$i=0;
|
||||
foreach ($listfieldinsert as $f => $value)
|
||||
{
|
||||
if ($value == 'price' || preg_match('/^amount/i',$value) || $value == 'taux') {
|
||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
||||
}
|
||||
else if ($value == 'entity') {
|
||||
if ($value == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql.=",";
|
||||
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
||||
if ($_POST[$listfieldvalue[$i]] == '' && ! $listfieldvalue[$i] == 'formula') $sql.="null"; // For vat, we want/accept code = ''
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
@ -310,15 +278,15 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$i = 0;
|
||||
foreach ($listfieldmodify as $field)
|
||||
{
|
||||
if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') {
|
||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
||||
if ($field == 'fk_country' && $_POST['country'] > 0) {
|
||||
$_POST[$listfieldvalue[$i]] = $_POST['country'];
|
||||
}
|
||||
else if ($field == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql.=",";
|
||||
$sql.= $field."=";
|
||||
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
||||
if ($_POST[$listfieldvalue[$i]] == '' && ! $listfieldvalue[$i] == 'range_account') $sql.="null"; // For range_account, we want/accept code = ''
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
@ -458,11 +426,15 @@ $titlepicto='title_setup';
|
||||
|
||||
print load_fiche_titre($titre,$linkback,$titlepicto);
|
||||
|
||||
if ($id == 32)
|
||||
{
|
||||
print $langs->trans("AccountingAccountGroupsDesc", $langs->transnoentitiesnoconv("ByPersonalizedAccountGroups")).'<br><br>';
|
||||
}
|
||||
|
||||
// Confirmation de la suppression de la ligne
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id.($search_country_id>0?'&search_country_id='.$search_country_id:''), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
||||
}
|
||||
//var_dump($elementList);
|
||||
|
||||
@ -508,6 +480,7 @@ if ($id)
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Form to add a new line
|
||||
@ -536,18 +509,15 @@ if ($id)
|
||||
{
|
||||
$valuetoshow=$langs->trans("Label");
|
||||
}
|
||||
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; }
|
||||
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments"); }
|
||||
if ($fieldlist[$field]=='country') {
|
||||
if (in_array('region_id',$fieldlist)) { print '<td> </td>'; continue; } // For region page, we do not show the country input
|
||||
$valuetoshow=$langs->trans("Country");
|
||||
}
|
||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $valuetoshow=''; }
|
||||
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
|
||||
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); }
|
||||
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); }
|
||||
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
|
||||
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
|
||||
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Direction"); }
|
||||
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Comment"); }
|
||||
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
||||
|
||||
if ($valuetoshow != '')
|
||||
@ -617,8 +587,7 @@ if ($id)
|
||||
$paramwithsearch = $param;
|
||||
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
||||
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
||||
if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
|
||||
|
||||
if (GETPOST('from','alpha')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
|
||||
// There is several pages
|
||||
if ($num > $listlimit)
|
||||
{
|
||||
@ -700,8 +669,7 @@ if ($id)
|
||||
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); }
|
||||
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
|
||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
|
||||
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Direction"); }
|
||||
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Comment"); }
|
||||
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
||||
// Affiche nom du champ
|
||||
if ($showfield)
|
||||
@ -742,6 +710,7 @@ if ($id)
|
||||
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
|
||||
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -759,17 +728,9 @@ if ($id)
|
||||
$showfield=1;
|
||||
$align="left";
|
||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||
if ($value == 'type_template')
|
||||
if ($value == 'category_type')
|
||||
{
|
||||
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
||||
}
|
||||
if ($value == 'element')
|
||||
{
|
||||
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
||||
}
|
||||
else if ($value == 'source')
|
||||
{
|
||||
$valuetoshow = isset($sourceList[$valuetoshow])?$sourceList[$valuetoshow]:$valuetoshow;
|
||||
$valuetoshow = yn($valuetoshow);
|
||||
}
|
||||
else if ($valuetoshow=='all') {
|
||||
$valuetoshow=$langs->trans('All');
|
||||
@ -785,12 +746,6 @@ if ($id)
|
||||
$valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country);
|
||||
}
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle_facture') {
|
||||
$langs->load("bills");
|
||||
$key=$langs->trans("PaymentCondition".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "PaymentCondition".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
$valuetoshow=nl2br($valuetoshow);
|
||||
}
|
||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') {
|
||||
$key=$langs->trans("Country".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
@ -804,83 +759,11 @@ if ($id)
|
||||
$key=$langs->trans("Action".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if (! empty($obj->code_iso) && $fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_currencies') {
|
||||
$key=$langs->trans("Currency".strtoupper($obj->code_iso));
|
||||
$valuetoshow=($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_typent') {
|
||||
$key=$langs->trans(strtoupper($obj->code));
|
||||
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_prospectlevel') {
|
||||
$key=$langs->trans(strtoupper($obj->code));
|
||||
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_civility') {
|
||||
$key=$langs->trans("Civility".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_type_contact') {
|
||||
$langs->load('agenda');
|
||||
$key=$langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_payment_term') {
|
||||
$langs->load("bills");
|
||||
$key=$langs->trans("PaymentConditionShort".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paiement') {
|
||||
$langs->load("bills");
|
||||
$key=$langs->trans("PaymentType".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_reason') {
|
||||
$key=$langs->trans("DemandReasonType".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_method') {
|
||||
$langs->load("orders");
|
||||
$key=$langs->trans($obj->code);
|
||||
$valuetoshow=($obj->code && $key != $obj->code)?$key:$obj->{$fieldlist[$field]};
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_shipment_mode') {
|
||||
$langs->load("sendings");
|
||||
$key=$langs->trans("SendingMethod".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "SendingMethod".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field] == 'libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paper_format')
|
||||
{
|
||||
$key = $langs->trans('PaperFormat'.strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees')
|
||||
{
|
||||
$langs->load('trips');
|
||||
$key = $langs->trans(strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') {
|
||||
$showfield=0;
|
||||
}
|
||||
else if ($fieldlist[$field]=='label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') {
|
||||
$langs->load("products");
|
||||
$valuetoshow=$langs->trans($obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if ($fieldlist[$field]=='short_label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') {
|
||||
$langs->load("products");
|
||||
$valuetoshow = $langs->trans($obj->{$fieldlist[$field]});
|
||||
}
|
||||
else if (in_array($fieldlist[$field],array('recuperableonly')))
|
||||
{
|
||||
$align="center";
|
||||
}
|
||||
else if ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') {
|
||||
$valuetoshow = length_accountg($valuetoshow);
|
||||
}
|
||||
|
||||
$class='tddict';
|
||||
if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto';
|
||||
// Show value for field
|
||||
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
||||
}
|
||||
@ -891,14 +774,9 @@ if ($id)
|
||||
if (isset($obj->code))
|
||||
{
|
||||
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $canbedisabled = 0; }
|
||||
else if ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; }
|
||||
else if ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; }
|
||||
}
|
||||
|
||||
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) { $iserasable=0; }
|
||||
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $canbedisabled=0; $canbedisabled = 0; }
|
||||
$canbemodified=$iserasable;
|
||||
if ($obj->code == 'RECEP') $canbemodified=1;
|
||||
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
|
||||
if ($param) $url .= '&'.$param;
|
||||
@ -909,10 +787,7 @@ if ($id)
|
||||
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
||||
else
|
||||
{
|
||||
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO'))) print $langs->trans("AlwaysActive");
|
||||
else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) print $langs->trans("Deprecated");
|
||||
else if (isset($obj->type) && in_array($obj->type, array('system')) && ! empty($obj->active) && $obj->code != 'AC_OTH') print $langs->trans("UsedOnlyWithTypeOption");
|
||||
else print $langs->trans("AlwaysActive");
|
||||
print $langs->trans("AlwaysActive");
|
||||
}
|
||||
print "</td>";
|
||||
|
||||
@ -937,8 +812,8 @@ if ($id)
|
||||
print '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories.php?action=display&account_category='.$obj->rowid.'">'.$langs->trans("Setup").'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@ -948,6 +823,7 @@ if ($id)
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
@ -984,16 +860,17 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex
|
||||
{
|
||||
if ($fieldlist[$field] == 'country')
|
||||
{
|
||||
if (in_array('region_id',$fieldlist))
|
||||
{
|
||||
print '<td>';
|
||||
//print join(',',$fieldlist);
|
||||
print '</td>';
|
||||
continue;
|
||||
} // For state page, we do not show the country input (we link to region, not country)
|
||||
print '<td>';
|
||||
$fieldname='country';
|
||||
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:$mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
if ($context == 'add')
|
||||
{
|
||||
$fieldname='country_id';
|
||||
print $form->select_country(GETPOST('country_id','int'), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
}
|
||||
else
|
||||
{
|
||||
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:$mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'country_id')
|
||||
@ -1006,130 +883,14 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'region')
|
||||
{
|
||||
print '<td>';
|
||||
$formcompany->select_region($region_id,'region');
|
||||
elseif ($fieldlist[$field] == 'category_type') {
|
||||
print '<td>';
|
||||
print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1);
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'region_id')
|
||||
{
|
||||
$region_id = (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:0);
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$region_id.'">';
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'lang')
|
||||
{
|
||||
print '<td>';
|
||||
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'lang');
|
||||
print '</td>';
|
||||
}
|
||||
// Le type de template
|
||||
elseif ($fieldlist[$field] == 'type_template')
|
||||
{
|
||||
print '<td>';
|
||||
print $form->selectarray('type_template', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
||||
print '</td>';
|
||||
}
|
||||
// Le type de l'element (pour les type de contact)
|
||||
elseif ($fieldlist[$field] == 'element')
|
||||
{
|
||||
print '<td>';
|
||||
print $form->selectarray('element', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
||||
print '</td>';
|
||||
}
|
||||
// La source de l'element (pour les type de contact)
|
||||
elseif ($fieldlist[$field] == 'source')
|
||||
{
|
||||
print '<td>';
|
||||
print $form->selectarray('source', $sourceList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm")
|
||||
{
|
||||
print '<td>';
|
||||
print 'user<input type="hidden" name="type" value="user">';
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
|
||||
if ($fieldlist[$field] == 'type_cdr') print '<td align="center">';
|
||||
else print '<td>';
|
||||
if ($fieldlist[$field] == 'type_cdr') {
|
||||
print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
||||
} else {
|
||||
print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1);
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
elseif (in_array($fieldlist[$field],array('nbjour','decalage','taux','localtax1','localtax2'))) {
|
||||
$align="left";
|
||||
if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) $align="center"; // Fields aligned on right
|
||||
print '<td align="'.$align.'">';
|
||||
print '<input type="text" class="flat" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" size="3" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
|
||||
print '<td><textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea></td>';
|
||||
}
|
||||
elseif (in_array($fieldlist[$field], array('content')))
|
||||
{
|
||||
if ($tabname == MAIN_DB_PREFIX.'c_email_templates')
|
||||
{
|
||||
print '<td colspan="4"></td></tr><tr class="pair nohover"><td colspan="5">'; // To create an artificial CR for the current tr we are on
|
||||
}
|
||||
else print '<td>';
|
||||
if ($context != 'hide')
|
||||
{
|
||||
//print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
|
||||
$okforextended=true;
|
||||
if ($tabname == MAIN_DB_PREFIX.'c_email_templates' && empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended=false;
|
||||
$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_5, '90%');
|
||||
print $doleditor->Create(1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) {
|
||||
print '<td><input type="text" class="flat minwidth75" value="'.price((! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')).'" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||
print '<td><input type="text" class="flat minwidth100" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
elseif ($fieldlist[$field]=='unit') {
|
||||
print '<td>';
|
||||
$units = array(
|
||||
'mm' => $langs->trans('SizeUnitmm'),
|
||||
'cm' => $langs->trans('SizeUnitcm'),
|
||||
'point' => $langs->trans('SizeUnitpoint'),
|
||||
'inch' => $langs->trans('SizeUnitinch')
|
||||
);
|
||||
print $form->selectarray('unit', $units, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 0, 0, 0);
|
||||
print '</td>';
|
||||
}
|
||||
// Le type de taxe locale
|
||||
elseif ($fieldlist[$field] == 'localtax1_type' || $fieldlist[$field] == 'localtax2_type')
|
||||
{
|
||||
print '<td align="center">';
|
||||
print $form->selectarray($fieldlist[$field], $localtax_typeList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'accountancy_code' || $fieldlist[$field] == 'accountancy_code_sell' || $fieldlist[$field] == 'accountancy_code_buy')
|
||||
{
|
||||
print '<td>';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$fieldname = $fieldlist[$field];
|
||||
$accountancy_account = (! empty($obj->$fieldname) ? $obj->$fieldname : 0);
|
||||
print $formaccounting->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone');
|
||||
}
|
||||
else
|
||||
{
|
||||
$fieldname = $fieldlist[$field];
|
||||
print '<input type="text" size="10" class="flat" value="'.(isset($obj->$fieldname)?$obj->$fieldname:'').'" name="'.$fieldlist[$field].'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
@ -1137,8 +898,7 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex
|
||||
if ($fieldlist[$field]=='code') $class='maxwidth100';
|
||||
if ($fieldlist[$field]=='position') $class='maxwidth50';
|
||||
if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent';
|
||||
if ($fieldlist[$field]=='tracking') $class='quatrevingtpercent';
|
||||
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
|
||||
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='category_type') $size='size="2" ';
|
||||
print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/index.php
|
||||
* \file htdocs/accountancy/admin/defaultaccounts.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Setup page to configure accounting expert module
|
||||
*/
|
||||
@ -42,7 +42,7 @@ $langs->load("salaries");
|
||||
$langs->load("loan");
|
||||
|
||||
// Security check
|
||||
if (! empty($user->rights->accountancy->chartofaccount))
|
||||
if (empty($user->rights->accounting->chartofaccount))
|
||||
{
|
||||
accessforbidden();
|
||||
}
|
||||
@ -53,10 +53,10 @@ $action = GETPOST('action', 'alpha');
|
||||
$list_account_main = array (
|
||||
'ACCOUNTING_ACCOUNT_CUSTOMER',
|
||||
'ACCOUNTING_ACCOUNT_SUPPLIER',
|
||||
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
|
||||
);
|
||||
|
||||
$list_account = array (
|
||||
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
|
||||
'ACCOUNTING_PRODUCT_BUY_ACCOUNT',
|
||||
'ACCOUNTING_PRODUCT_SOLD_ACCOUNT',
|
||||
'ACCOUNTING_SERVICE_BUY_ACCOUNT',
|
||||
|
||||
@ -38,7 +38,7 @@ $langs->load("admin");
|
||||
$langs->load("accountancy");
|
||||
|
||||
// Security check
|
||||
if (empty($user->admin) || ! empty($user->rights->accountancy->chartofaccount))
|
||||
if (empty($user->admin) && empty($user->rights->accounting->chartofaccount))
|
||||
{
|
||||
accessforbidden();
|
||||
}
|
||||
@ -47,7 +47,7 @@ $action = GETPOST('action', 'alpha');
|
||||
|
||||
// Parameters ACCOUNTING_EXPORT_*
|
||||
$main_option = array (
|
||||
'ACCOUNTING_EXPORT_PREFIX_SPEC'
|
||||
'ACCOUNTING_EXPORT_PREFIX_SPEC'
|
||||
);
|
||||
|
||||
$model_option = array (
|
||||
@ -67,10 +67,10 @@ $model_option = array (
|
||||
*/
|
||||
if ($action == 'update') {
|
||||
$error = 0;
|
||||
|
||||
|
||||
$format = GETPOST('format', 'alpha');
|
||||
$modelcsv = GETPOST('modelcsv', 'int');
|
||||
|
||||
|
||||
if (! empty($format)) {
|
||||
if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', $format, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
@ -78,7 +78,7 @@ if ($action == 'update') {
|
||||
} else {
|
||||
$error ++;
|
||||
}
|
||||
|
||||
|
||||
if (! empty($modelcsv)) {
|
||||
if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
@ -89,23 +89,23 @@ if ($action == 'update') {
|
||||
} else {
|
||||
$error ++;
|
||||
}
|
||||
|
||||
|
||||
foreach ( $main_option as $constname ) {
|
||||
$constvalue = GETPOST($constname, 'alpha');
|
||||
|
||||
|
||||
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ( $model_option as $constname ) {
|
||||
$constvalue = GETPOST($constname, 'alpha');
|
||||
|
||||
|
||||
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! $error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
@ -148,13 +148,13 @@ $var = ! $var;
|
||||
$num = count($main_option);
|
||||
if ($num) {
|
||||
foreach ( $main_option as $key ) {
|
||||
|
||||
|
||||
print '<tr class="oddeven value">';
|
||||
|
||||
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
print '<td width="50%">' . $label . '</td>';
|
||||
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
print '<input type="text" size="20" name="' . $key . '" value="' . $conf->global->$key . '">';
|
||||
@ -187,7 +187,7 @@ if (! $conf->use_javascript_ajax) {
|
||||
print '<td>';
|
||||
$listmodelcsv = AccountancyExport::getType();
|
||||
print $form->selectarray("modelcsv", $listmodelcsv, $conf->global->ACCOUNTING_EXPORT_MODELCSV, 0);
|
||||
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
print "</td></tr>";
|
||||
@ -205,12 +205,12 @@ if ($num2) {
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">' . $langs->trans('OtherOptions') . '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > 1)
|
||||
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > AccountancyExport::$EXPORT_TYPE_NORMAL)
|
||||
{
|
||||
print '<tr><td colspan="2" bgcolor="red"><b>' . $langs->trans('OptionsDeactivatedForThisExportModel') . '</b></td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="50%">' . $langs->trans("Selectformat") . '</td>';
|
||||
if (! $conf->use_javascript_ajax) {
|
||||
@ -224,24 +224,24 @@ if ($num2) {
|
||||
'txt' => $langs->trans("txt")
|
||||
);
|
||||
print $form->selectarray("format", $listformat, $conf->global->ACCOUNTING_EXPORT_FORMAT, 0);
|
||||
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
foreach ( $model_option as $key ) {
|
||||
|
||||
foreach ( $model_option as $key ) {
|
||||
print '<tr class="oddeven value">';
|
||||
|
||||
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
print '<td width="50%">' . $label . '</td>';
|
||||
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
print '<input type="text" size="20" name="' . $key . '" value="' . $conf->global->$key . '">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print "</table>\n";
|
||||
}
|
||||
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page to show a fiscal year
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/fiscalyear.lib.php';
|
||||
@ -43,10 +44,10 @@ $id = GETPOST('id', 'int');
|
||||
// List of statut
|
||||
static $tmpstatut2label = array (
|
||||
'0' => 'OpenFiscalYear',
|
||||
'1' => 'CloseFiscalYear'
|
||||
'1' => 'CloseFiscalYear'
|
||||
);
|
||||
$statut2label = array (
|
||||
''
|
||||
''
|
||||
);
|
||||
foreach ( $tmpstatut2label as $key => $val )
|
||||
$statut2label[$key] = $langs->trans($val);
|
||||
@ -69,7 +70,7 @@ if ($action == 'confirm_delete' && $confirm == "yes") {
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'add') {
|
||||
if (! GETPOST('cancel', 'alpha')) {
|
||||
@ -113,7 +114,7 @@ else if ($action == 'add') {
|
||||
header("Location: ./fiscalyear.php");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update record
|
||||
else if ($action == 'update') {
|
||||
@ -126,7 +127,7 @@ else if ($action == 'update') {
|
||||
$object->statut = GETPOST('statut', 'int');
|
||||
|
||||
$result = $object->update($user);
|
||||
|
||||
|
||||
if ($result > 0) {
|
||||
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||
exit();
|
||||
@ -145,13 +146,13 @@ else if ($action == 'update') {
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$title = $langs->trans("Fiscalyear") . " - " . $langs->trans("Card");
|
||||
$helpurl = "";
|
||||
llxHeader("",$title,$helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
if ($action == 'create')
|
||||
if ($action == 'create')
|
||||
{
|
||||
print load_fiche_titre($langs->trans("NewFiscalYear"));
|
||||
|
||||
@ -184,7 +185,7 @@ if ($action == 'create')
|
||||
print $form->selectarray('statut', $statut2label, GETPOST('statut'));
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
@ -306,9 +307,9 @@ if ($action == 'create')
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=edit&id=' . $id . '">' . $langs->trans('Modify') . '</a>';
|
||||
|
||||
|
||||
// print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $id . '">' . $langs->trans('Delete') . '</a>';
|
||||
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -266,7 +266,7 @@ if (! empty($user->admin))
|
||||
}
|
||||
|
||||
|
||||
// Param a user $user->rights->accountancy->chartofaccount can access
|
||||
// Param a user $user->rights->accounting->chartofaccount can access
|
||||
foreach ($list as $key)
|
||||
{
|
||||
print '<tr class="oddeven value">';
|
||||
|
||||
@ -41,7 +41,7 @@ $rowid=GETPOST('rowid','alpha');
|
||||
$code=GETPOST('code','alpha');
|
||||
|
||||
// Security access
|
||||
if (! empty($user->rights->accountancy->chartofaccount))
|
||||
if (empty($user->rights->accounting->chartofaccount))
|
||||
{
|
||||
accessforbidden();
|
||||
}
|
||||
@ -58,7 +58,7 @@ $active = 1;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||
$offset = $listlimit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
@ -134,6 +134,7 @@ $elementList = array();
|
||||
'2' => $langs->trans('AccountingJournalType2'),
|
||||
'3' => $langs->trans('AccountingJournalType3'),
|
||||
'4' => $langs->trans('AccountingJournalType4'),
|
||||
'5' => $langs->trans('AccountingJournalType5'),
|
||||
'9' => $langs->trans('AccountingJournalType9')
|
||||
);
|
||||
|
||||
@ -422,6 +423,7 @@ if ($id)
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Form to add a new line
|
||||
@ -488,7 +490,7 @@ if ($id)
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
fieldList($fieldlist,$obj,$tabname[$id],'add');
|
||||
fieldListJournal($fieldlist,$obj,$tabname[$id],'add');
|
||||
}
|
||||
|
||||
print '<td colspan="4" align="right">';
|
||||
@ -593,7 +595,7 @@ if ($id)
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
|
||||
// Show fields
|
||||
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit');
|
||||
if (empty($reshook)) fieldListJournal($fieldlist,$obj,$tabname[$id],'edit');
|
||||
|
||||
print '<td align="center" colspan="4">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
@ -690,6 +692,7 @@ if ($id)
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
@ -710,7 +713,7 @@ $db->close();
|
||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||
* @return void
|
||||
*/
|
||||
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
function fieldListJournal($fieldlist, $obj='', $tabname='', $context='')
|
||||
{
|
||||
global $conf,$langs,$db;
|
||||
global $form, $mysoc;
|
||||
@ -743,4 +746,4 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,15 +90,15 @@ $arrayfields=array();
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref = '';
|
||||
$search_label = '';
|
||||
@ -312,6 +312,7 @@ if ($result)
|
||||
$texte=$langs->trans("ListOfProductsServices");
|
||||
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
@ -336,17 +337,17 @@ if ($result)
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("OnSell"), $_SERVER["PHP_SELF"], "p.tosell", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("OnBuy"), $_SERVER["PHP_SELF"], "p.tobuy", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$fieldtosortaccount="p.accountancy_code_buy";
|
||||
}
|
||||
else $fieldtosortaccount="p.accountancy_code_sell";
|
||||
print_liste_field_titre($langs->trans("CurrentDedicatedAccountingAccount"), $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("AssignDedicatedAccountingAccount"));
|
||||
print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AssignDedicatedAccountingAccount");
|
||||
$clickpitco=$form->showCheckAddButtons('checkforselect', 1);
|
||||
print_liste_field_titre($clickpitco, '', '', '', '', 'align="center"');
|
||||
print '</tr>';
|
||||
@ -448,6 +449,7 @@ if ($result)
|
||||
$i ++;
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
// Example : Adding jquery code
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
|
||||
@ -28,7 +28,9 @@ require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
|
||||
@ -51,9 +53,8 @@ if ($search_accountancy_code_end == - 1) {
|
||||
$search_accountancy_code_end = '';
|
||||
}
|
||||
|
||||
if (GETPOST("button_export_csv_x") || GETPOST("button_export_csv")) {
|
||||
$action = 'export_csv';
|
||||
}
|
||||
if (GETPOST("exportcsv")) $action = 'export_csv';
|
||||
|
||||
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
|
||||
@ -66,8 +67,18 @@ $formother = new FormOther($db);
|
||||
$form = new Form($db);
|
||||
|
||||
if (empty($search_date_start)) {
|
||||
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
||||
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
||||
|
||||
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||
$year_start = dol_print_date(dol_now(), '%Y');
|
||||
$year_end = $year_start + 1;
|
||||
$month_end = $month_start - 1;
|
||||
if ($month_end < 1)
|
||||
{
|
||||
$month_end = 12;
|
||||
$year_end--;
|
||||
}
|
||||
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||
}
|
||||
if ($sortorder == "")
|
||||
$sortorder = "ASC";
|
||||
@ -98,7 +109,7 @@ if (! empty($search_accountancy_code_end)) {
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_accountancy_code_start = '';
|
||||
$search_accountancy_code_end = '';
|
||||
@ -112,7 +123,10 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
*/
|
||||
|
||||
if ($action == 'export_csv') {
|
||||
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == AccountancyExport::$EXPORT_TYPE_CEGID) $sep = ";"; // For CEGID, we force separator.
|
||||
|
||||
$journal = 'bookkepping';
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
@ -122,11 +136,7 @@ if ($action == 'export_csv') {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
foreach ( $object->lines as $line ) {
|
||||
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
|
||||
$sep = ";";
|
||||
}
|
||||
foreach ($object->lines as $line) {
|
||||
print length_accountg($line->numero_compte) . $sep;
|
||||
print $line->debit . $sep;
|
||||
print $line->credit . $sep;
|
||||
@ -137,7 +147,7 @@ if ($action == 'export_csv') {
|
||||
}
|
||||
|
||||
else {
|
||||
$title_page = $langs->trans("AccountBalance") . (($search_date_start || $search_date_end) ? ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end) : '');
|
||||
$title_page = $langs->trans("AccountBalance");
|
||||
|
||||
llxHeader('', $title_page);
|
||||
|
||||
@ -157,7 +167,7 @@ else {
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
||||
$button = '<input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" />';
|
||||
$button = '<input type="submit" name="exportcsv" class="butAction" value="' . $langs->trans("Export") . ' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $result, 'title_accountancy', 0, $button);
|
||||
|
||||
$moreforfilter = '';
|
||||
@ -196,11 +206,11 @@ else {
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Solde", $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -16,13 +17,14 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/bookkeeping/card.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page to show book-entry
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
@ -37,8 +39,8 @@ $id = GETPOST('id', 'int');
|
||||
if ($user->societe_id > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
$action = GETPOST('action');
|
||||
$mode = GETPOST('mode');
|
||||
$action = GETPOST('action','aZ09');
|
||||
$mode = GETPOST('mode','aZ09'); // '' or 'tmp'
|
||||
$piece_num = GETPOST("piece_num");
|
||||
|
||||
$mesg = '';
|
||||
@ -53,29 +55,41 @@ $label_operation= GETPOST('label_operation');
|
||||
$debit = price2num(GETPOST('debit'));
|
||||
$credit = price2num(GETPOST('credit'));
|
||||
|
||||
$save = GETPOST('save');
|
||||
if (! empty($save)) {
|
||||
$action = 'add';
|
||||
}
|
||||
$update = GETPOST('update');
|
||||
if (! empty($update)) {
|
||||
$action = 'confirm_update';
|
||||
}
|
||||
$save = GETPOST('save','alpha');
|
||||
if (! empty($save)) $action = 'add';
|
||||
$update = GETPOST('update','alpha');
|
||||
if (! empty($update)) $action = 'confirm_update';
|
||||
|
||||
$object = new BookKeeping($db);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == "confirm_update") {
|
||||
|
||||
$error = 0;
|
||||
|
||||
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
|
||||
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
||||
$action='update';
|
||||
}
|
||||
if (empty($account_number) || $account_number == '-1')
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
|
||||
$action='update';
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
if (! $error)
|
||||
{
|
||||
$book = new BookKeeping($db);
|
||||
|
||||
$result = $book->fetch($id, null, $mode);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
setEventMessages($book->error, $book->errors, 'errors');
|
||||
} else {
|
||||
$book->numero_compte = $account_number;
|
||||
@ -98,7 +112,14 @@ if ($action == "confirm_update") {
|
||||
if ($result < 0) {
|
||||
setEventMessages($book->error, $book->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
if ($mode != '_tmp')
|
||||
{
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
}
|
||||
|
||||
$debit = 0;
|
||||
$credit = 0;
|
||||
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
@ -108,12 +129,20 @@ if ($action == "confirm_update") {
|
||||
else if ($action == "add") {
|
||||
$error = 0;
|
||||
|
||||
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
|
||||
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
||||
$error ++;
|
||||
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
||||
$action='';
|
||||
}
|
||||
if (empty($account_number) || $account_number == '-1')
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
|
||||
$action='';
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
if (! $error) {
|
||||
$book = new BookKeeping($db);
|
||||
|
||||
$book->numero_compte = $account_number;
|
||||
@ -144,7 +173,14 @@ else if ($action == "add") {
|
||||
if ($result < 0) {
|
||||
setEventMessages($book->error, $book->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
if ($mode != '_tmp')
|
||||
{
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
}
|
||||
|
||||
$debit = 0;
|
||||
$credit = 0;
|
||||
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
@ -172,6 +208,11 @@ else if ($action == "confirm_create") {
|
||||
|
||||
$book = new BookKeeping($db);
|
||||
|
||||
if (! GETPOST('code_journal') || GETPOST('code_journal') == '-1') {
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors');
|
||||
$action='create';
|
||||
$error++;
|
||||
}
|
||||
if (! GETPOST('next_num_mvt'))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumPiece")), null, 'errors');
|
||||
@ -196,7 +237,10 @@ else if ($action == "confirm_create") {
|
||||
if ($result < 0) {
|
||||
setEventMessages($book->error, $book->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
if ($mode != '_tmp')
|
||||
{
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
}
|
||||
$action = 'update';
|
||||
$id=$book->id;
|
||||
$piece_num = $book->piece_num;
|
||||
@ -210,39 +254,43 @@ if ($action == 'setdate') {
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
if ($mode != '_tmp')
|
||||
{
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setjournal') {
|
||||
$journaldoc = trim(GETPOST('code_journal'));
|
||||
if (!empty($journaldoc)) {
|
||||
$journaldoc='\''.$journaldoc.'\'';
|
||||
}
|
||||
$result = $object->updateByMvt($piece_num,'code_journal',$journaldoc,$mode);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
if ($mode != '_tmp')
|
||||
{
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setdocref') {
|
||||
$refdoc = trim(GETPOST('doc_ref'));
|
||||
if (!empty($refdoc)) {
|
||||
$refdoc='\''.$refdoc.'\'';
|
||||
}
|
||||
$result = $object->updateByMvt(doc_ref,'code_journal',$refdoc,$mode);
|
||||
$result = $object->updateByMvt($piece_num,'doc_ref',$refdoc,$mode);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
if ($mode != '_tmp')
|
||||
{
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Validate transaction
|
||||
if ($action == 'valid') {
|
||||
$result = $object->transformTransaction(0,$piece_num);
|
||||
if ($result < 0) {
|
||||
@ -253,14 +301,17 @@ if ($action == 'valid') {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
llxHeader();
|
||||
|
||||
$html = new Form($db);
|
||||
$formaccounting = new FormAccounting($db);
|
||||
$accountjournal = new AccountingJournal($db);
|
||||
|
||||
llxHeader('', $langs->trans("CreateMvts"));
|
||||
|
||||
// Confirmation to delete the command
|
||||
if ($action == 'delete') {
|
||||
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id.'&mode='. $mode, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1);
|
||||
@ -300,7 +351,7 @@ if ($action == 'create') {
|
||||
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">' . $langs->trans("Codejournal") . '</td>';
|
||||
print '<td>' . $formaccounting->select_journal(GETPOST('code_journal'),'code_journal',0,0,array(),1,1) . '</td>';
|
||||
print '<td>' . $formaccounting->select_journal(GETPOST('code_journal'),'code_journal',0,1,array(),1,1) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
@ -328,29 +379,45 @@ if ($action == 'create') {
|
||||
if ($result < 0) {
|
||||
setEventMessages($book->error, $book->errors, 'errors');
|
||||
}
|
||||
|
||||
if (! empty($book->piece_num)) {
|
||||
|
||||
print load_fiche_titre($langs->trans("UpdateMvts"), '<a href="list.php">' . $langs->trans('BackToList') . '</a>');
|
||||
$backlink = '<a href="list.php">' . $langs->trans('BackToList') . '</a>';
|
||||
|
||||
dol_fiche_head();
|
||||
print load_fiche_titre($langs->trans("UpdateMvts"), $backlink);
|
||||
|
||||
$head=array();
|
||||
$h=0;
|
||||
$head[$h][0] = $_SERVER['PHP_SELF'].'?piece_num='.$book->piece_num.($mode?'&mode='.$mode:'');
|
||||
$head[$h][1] = $langs->trans("Transaction");
|
||||
$head[$h][2] = 'transaction';
|
||||
$h++;
|
||||
|
||||
dol_fiche_head($head, 'transaction', '', -1);
|
||||
|
||||
|
||||
//dol_banner_tab($book, '', $backlink);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
// account movement
|
||||
print '<tr class="pair">';
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">' . $langs->trans("NumMvts") . '</td>';
|
||||
print '<td>' . $book->piece_num . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// date
|
||||
print '<tr class="impair"><td>';
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Docdate');
|
||||
print '</td>';
|
||||
if ($action != 'editdate')
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=editdate&piece_num='. $book->piece_num .'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('SetDate'),1).'</a></td>';
|
||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=editdate&piece_num='. $book->piece_num .'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('SetDate'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editdate') {
|
||||
@ -361,18 +428,18 @@ if ($action == 'create') {
|
||||
$form->select_date($book->doc_date ? $book->doc_date : - 1, 'doc_date', '', '', '', "setdate");
|
||||
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
||||
print '</form>';
|
||||
} else {
|
||||
print $book->doc_date ? dol_print_date($book->doc_date, 'daytext') : ' ';
|
||||
} else {
|
||||
print $book->doc_date ? dol_print_date($book->doc_date, 'daytext') : ' ';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
//journal
|
||||
print '<tr class="pair"><td>';
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Codejournal');
|
||||
print '</td>';
|
||||
if ($action != 'editjournal')
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=editjournal&piece_num='.$book->piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</a></td>';
|
||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=editjournal&piece_num='.$book->piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editjournal') {
|
||||
@ -389,12 +456,12 @@ if ($action == 'create') {
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
//docref
|
||||
print '<tr class="impair"><td>';
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Docref');
|
||||
print '</td>';
|
||||
if ($action != 'editdocref')
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=editdocref&piece_num='.$book->piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</a></td>';
|
||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=editdocref&piece_num='.$book->piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editdocref') {
|
||||
@ -410,21 +477,25 @@ if ($action == 'create') {
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
//doctype
|
||||
print '<tr class="pair">';
|
||||
print '<td>' . $langs->trans("Doctype") . '</td>';
|
||||
print '<td>' . $book->doc_type . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
// Doc type
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans("Doctype") . '</td>';
|
||||
print '<td>' . $book->doc_type . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Validate
|
||||
print '<tr class="pair">';
|
||||
/*
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">' . $langs->trans("Status") . '</td>';
|
||||
print '<td>';
|
||||
if (empty($book->validated)) {
|
||||
@ -438,10 +509,12 @@ if ($action == 'create') {
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
// check data
|
||||
print '<tr class="impair">';
|
||||
print '<td class="titlefield">' . $langs->trans("Control") . '</td>';
|
||||
/*
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">' . $langs->trans("Control") . '</td>';
|
||||
if ($book->doc_type == 'customer_invoice')
|
||||
{
|
||||
$sqlmid = 'SELECT rowid as ref';
|
||||
@ -457,14 +530,19 @@ if ($action == 'create') {
|
||||
}
|
||||
else dol_print_error($db);
|
||||
}
|
||||
*/
|
||||
print '<td>' . $ref .'</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
print '</div></div>';
|
||||
print '</div>';
|
||||
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
$result = $book->fetchAllPerMvt($piece_num, $mode);
|
||||
if ($result < 0) {
|
||||
setEventMessages($book->error, $book->errors, 'errors');
|
||||
@ -489,33 +567,41 @@ if ($action == 'create') {
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print_liste_field_titre($langs->trans("AccountAccountingShort"));
|
||||
print_liste_field_titre($langs->trans("Subledger_account"));
|
||||
print_liste_field_titre($langs->trans("Labelcompte"));
|
||||
print_liste_field_titre($langs->trans("Labeloperation"));
|
||||
print_liste_field_titre($langs->trans("Debit"), "", "", "", "", 'align="center"');
|
||||
print_liste_field_titre($langs->trans("Credit"), "", "", "", "", 'align="center"');
|
||||
print_liste_field_titre($langs->trans("Action"), "", "", "", "", 'width="60" align="center"');
|
||||
print_liste_field_titre("AccountAccountingShort");
|
||||
print_liste_field_titre("SubledgerAccount");
|
||||
print_liste_field_titre("Labelcompte");
|
||||
print_liste_field_titre("Label");
|
||||
print_liste_field_titre("Debit", "", "", "", "", 'align="right"');
|
||||
print_liste_field_titre("Credit", "", "", "", "", 'align="right"');
|
||||
print_liste_field_titre("Action", "", "", "", "", 'width="60" align="center"');
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
foreach ( $book->linesmvt as $line ) {
|
||||
$var = ! $var;
|
||||
print '<tr' . $bc[$var] . '>';
|
||||
print '<tr class="oddeven">';
|
||||
$total_debit += $line->debit;
|
||||
$total_credit += $line->credit;
|
||||
|
||||
if ($action == 'update' && $line->id == $id) {
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($line->numero_compte, 'account_number', 0, array (), 1, 1, '');
|
||||
print $formaccounting->select_account($line->numero_compte, 'account_number', 1, array (), 1, 1, '');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_auxaccount($line->subledger_account, 'subledger_account', 1);
|
||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
{
|
||||
print $formaccounting->select_auxaccount($line->subledger_account, 'subledger_account', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" name="subledger_account" value="'.$line->subledger_account.'">';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
|
||||
print '<td><input type="text" size="15" name="label_operation" value="' . $line->label_operation. '"/></td>';
|
||||
print '<td align="right"><input type="text" size="6" name="debit" value="' . price($line->debit) . '"/></td>';
|
||||
print '<td align="right"><input type="text" size="6" name="credit" value="' . price($line->credit) . '"/></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>';
|
||||
print '<input type="hidden" name="id" value="' . $line->id . '">' . "\n";
|
||||
print '<input type="submit" class="button" name="update" value="' . $langs->trans("Update") . '">';
|
||||
@ -529,10 +615,14 @@ if ($action == 'create') {
|
||||
print '<td align="right">' . price($line->credit) . '</td>';
|
||||
|
||||
print '<td align="center">';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
|
||||
print img_edit();
|
||||
print '</a> ';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
|
||||
print '</a> ';
|
||||
|
||||
$actiontodelete='detele';
|
||||
if ($mode == '_tmp') $actiontodelete='confirm_delete';
|
||||
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action='.$actiontodelete.'&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
|
||||
print img_delete();
|
||||
|
||||
print '</a>';
|
||||
@ -549,22 +639,46 @@ if ($action == 'create') {
|
||||
if ($action == "" || $action == 'add') {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($account_number, 'account_number', 0, array (), 1, 1, '');
|
||||
print $formaccounting->select_account($account_number, 'account_number', 1, array (), 1, 1, '');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1);
|
||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
{
|
||||
print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" name="subledger_account" value="">';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
|
||||
print '<td><input type="text" size="15" name="label_operation" value="' . $line->label_operation. '"/></td>';
|
||||
print '<td align="right"><input type="text" size="6" name="debit" value="' . price($debit) . '"/></td>';
|
||||
print '<td align="right"><input type="text" size="6" name="credit" value="' . price($credit) . '"/></td>';
|
||||
print '<td align="right"><input type="text" size="6" class="right" name="debit" value="' . ($debit ? price($debit) : '') . '"/></td>';
|
||||
print '<td align="right"><input type="text" size="6" class="right" name="credit" value="' . ($credit ? price($credit) : '') . '"/></td>';
|
||||
print '<td><input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
if ($mode=='_tmp' && $total_debit == $total_credit && $action=='') {
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '&action=valid">'.$langs->trans("ValidTransaction").'</a>';
|
||||
|
||||
|
||||
if ($mode=='_tmp' && $action=='')
|
||||
{
|
||||
print '<br>';
|
||||
print '<div class="center">';
|
||||
if ($total_debit == $total_credit)
|
||||
{
|
||||
print '<a class="button" href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '&action=valid">'.$langs->trans("ValidTransaction").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="submit" class="button" disabled="disabled" href="#" title="'.dol_escape_htmltag($langs->trans("MvtNotCorrectlyBalanced", $credit, $debit)).'" value="'.dol_escape_htmltag($langs->trans("ValidTransaction")).'">';
|
||||
}
|
||||
|
||||
print ' ';
|
||||
print '<a class="button" href="' . DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">'.$langs->trans("Cancel").'</a>';
|
||||
|
||||
print "</div>";
|
||||
}
|
||||
print '</form>';
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -16,7 +16,6 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -25,8 +24,7 @@
|
||||
* \brief List operation of book keeping
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||
@ -47,11 +45,11 @@ $search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETP
|
||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
|
||||
|
||||
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt")) {
|
||||
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
|
||||
$action = 'delbookkeepingyear';
|
||||
}
|
||||
if (GETPOST("button_export_csv_x") || GETPOST("button_export_csv")) {
|
||||
$action = 'export_csv';
|
||||
if (GETPOST("button_export_file_x") || GETPOST("button_export_file.x") || GETPOST("button_export_file")) {
|
||||
$action = 'export_file';
|
||||
}
|
||||
|
||||
$search_accountancy_code = GETPOST("search_accountancy_code");
|
||||
@ -99,7 +97,7 @@ $formother = new FormOther($db);
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
if ($action != 'export_csv' && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && empty($page)) {
|
||||
if ($action != 'export_file' && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && empty($page)) {
|
||||
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
||||
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
||||
}
|
||||
@ -110,10 +108,10 @@ if ($action != 'export_csv' && ! isset($_POST['begin']) && ! isset($_GET['begin'
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_mvt_num = '';
|
||||
$search_doc_type = '';
|
||||
@ -261,9 +259,8 @@ if ($action == 'delmouvconfirm') {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'export_csv') {
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php';
|
||||
// Export into a file with format defined into setup
|
||||
if ($action == 'export_file') {
|
||||
|
||||
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
|
||||
|
||||
@ -356,9 +353,11 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
|
||||
$button = '<a class="butAction" name="button_export_csv" href="'.$_SERVER["PHP_SELF"].'?action=export_csv'.($param?'&'.$param:'').'">';
|
||||
$listofformat=AccountancyExport::getType();
|
||||
$button = '<a class="butAction" name="button_export_file" href="'.$_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:'').'">';
|
||||
if (count($filter)) $button.= $langs->trans("ExportFilteredList");
|
||||
else $button.= $langs->trans("ExportList");
|
||||
$button.=' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')';
|
||||
$button.= '</a>';
|
||||
|
||||
$groupby = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php"">' . $langs->trans("GroupByAccountAccounting") . '</a>';
|
||||
@ -371,39 +370,58 @@ print '<div class="inline-block divButAction"><a class="butActionDelete" name="b
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="' . dol_escape_htmltag($search_mvt_num) . '"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ': ';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ': ';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="' . dol_escape_htmltag($search_doc_ref) . '"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From');
|
||||
print $langs->trans('From').' ';
|
||||
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, 'maxwidth200');
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to');
|
||||
print $langs->trans('to').' ';
|
||||
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, 'maxwidth200');
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From');
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||
print $langs->trans('From').' ';
|
||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
{
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'">';
|
||||
}
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to');
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
||||
print $langs->trans('to').' ';
|
||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
{
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" name="search_accountancy_aux_code_end" value="'.$search_accountancy_aux_code_end.'">';
|
||||
}
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
@ -419,15 +437,15 @@ print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("TransactionNumShort"), $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("SubledgerAccount"), $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("SubledgerAccount", $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
$checkpicto='';
|
||||
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
|
||||
print_liste_field_titre($checkpicto, $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
@ -437,8 +455,10 @@ print "</tr>\n";
|
||||
$total_debit = 0;
|
||||
$total_credit = 0;
|
||||
|
||||
foreach ($object->lines as $line ) {
|
||||
$var = ! $var;
|
||||
$i=0;
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$line = $object->lines[$i];
|
||||
|
||||
$total_debit += $line->debit;
|
||||
$total_credit += $line->credit;
|
||||
@ -464,6 +484,8 @@ foreach ($object->lines as $line ) {
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . '">' . img_delete() . '</a>';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
@ -480,6 +502,7 @@ print '<td colspan="2"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ if (! empty($search_doc_date)) {
|
||||
}
|
||||
|
||||
|
||||
if (!GETPOST("button_removefilter_x") && !GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
if (! GETPOST('button_removefilter_x','alpha') && ! GETPOST('button_removefilter.x','alpha') && ! GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
if (! empty($search_accountancy_code_start)) {
|
||||
$filter['t.numero_compte'] = $search_accountancy_code_start;
|
||||
@ -121,7 +121,7 @@ if (!GETPOST("button_removefilter_x") && !GETPOST("button_removefilter")) // Bot
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_doc_date = '';
|
||||
$search_accountancy_code = '';
|
||||
@ -160,7 +160,6 @@ $title_page = $langs->trans("Bookkeeping") . ' ' . strtolower($langs->trans("By"
|
||||
llxHeader('', $title_page);
|
||||
|
||||
// List
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter);
|
||||
@ -173,7 +172,9 @@ $result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $f
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
$nbtotalofrecords = $result;
|
||||
|
||||
$num=count($object->lines);
|
||||
|
||||
|
||||
if ($action == 'delmouv') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1);
|
||||
@ -204,7 +205,7 @@ if ($action == 'delbookkeepingyear') {
|
||||
|
||||
|
||||
|
||||
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||
|
||||
$viewflat = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">' . $langs->trans("ViewFlatList") . '</a>';
|
||||
|
||||
@ -236,21 +237,21 @@ print '<td class="liste_titre"><input type="text" size="7" class="flat" name="se
|
||||
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_account" value="' . $search_label_account . '"/></td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
||||
print '<td class="liste_titre" align="right" colspan="2">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF']);
|
||||
print_liste_field_titre($langs->trans("TransactionNumShort"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"));
|
||||
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF']);
|
||||
print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Label");
|
||||
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
@ -263,7 +264,10 @@ $sous_total_debit = 0;
|
||||
$sous_total_credit = 0;
|
||||
$displayed_account_number = null; // Start with undefined to be able to distinguish with empty
|
||||
|
||||
foreach ( $object->lines as $line ) {
|
||||
$i=0;
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$line = $object->lines[$i];
|
||||
|
||||
$total_debit += $line->debit;
|
||||
$total_credit += $line->credit;
|
||||
@ -323,10 +327,11 @@ foreach ( $object->lines as $line ) {
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Comptabilise le sous-total
|
||||
$sous_total_debit += $line->debit;
|
||||
$sous_total_credit += $line->credit;
|
||||
// Comptabilise le sous-total
|
||||
$sous_total_debit += $line->debit;
|
||||
$sous_total_credit += $line->credit;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Affiche un Sous-Total du dernier compte comptable affiché
|
||||
|
||||
@ -86,7 +86,7 @@ $offset = $limit * $page;
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_doc_type = "";
|
||||
$search_doc_date = "";
|
||||
@ -201,19 +201,19 @@ print '</div>';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Doctype"), $_SERVER['PHP_SELF'], "t.doc_type", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("ThirdPartyAccount"), $_SERVER['PHP_SELF'], "t.subledger_account", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "t.montant", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "t.sens", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("NumPiece", $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Doctype", $_SERVER['PHP_SELF'], "t.doc_type", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Date", $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("ThirdPartyAccount", $_SERVER['PHP_SELF'], "t.subledger_account", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Amount", $_SERVER['PHP_SELF'], "t.montant", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Sens", $_SERVER['PHP_SELF'], "t.sens", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
331
htdocs/accountancy/bookkeeping/thirdparty_lettrage.php
Normal file
331
htdocs/accountancy/bookkeeping/thirdparty_lettrage.php
Normal file
@ -0,0 +1,331 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file accounting/bookkeeping/thirdparty_lettrage.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Onglet de gestion de parametrages des ventilations
|
||||
*/
|
||||
|
||||
require '../../main.inc.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/lettering.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||
|
||||
$action=GETPOST('action','aZ09');
|
||||
$massaction=GETPOST('massaction','alpha');
|
||||
$show_files=GETPOST('show_files','int');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if ($sortorder == "") $sortorder = "ASC";
|
||||
if ($sortfield == "") $sortfield = "bk.rowid";
|
||||
|
||||
$search_year = GETPOST ( "search_year" );
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid",'int');
|
||||
// if ($user->societe_id) $socid=$user->societe_id;
|
||||
|
||||
$object = new Societe($db);
|
||||
$object->id = $socid;
|
||||
$object->fetch($socid);
|
||||
|
||||
|
||||
$form = new Form($db);
|
||||
$BookKeeping = new lettering($db);
|
||||
$formaccounting = new FormAccounting($db);
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
if ($action == 'lettering') {
|
||||
|
||||
$result = $BookKeeping->updatelettrage($_POST['ids']);
|
||||
|
||||
// var_dump($result);
|
||||
if( $result < 0 ){
|
||||
setEventMessages('', $BookKeeping->errors, 'errors' );
|
||||
$error++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'autolettrage') {
|
||||
|
||||
$result = $BookKeeping->LettrageTiers($socid);
|
||||
|
||||
if( $result < 0 ){
|
||||
setEventMessages('', $BookKeeping->errors, 'errors' );
|
||||
$error++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
llxHeader ( '', 'Compta - Grand Livre' );
|
||||
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$head = societe_prepare_head($object);
|
||||
|
||||
dol_htmloutput_mesg(is_numeric($error)?'':$error, $errors, 'error');
|
||||
|
||||
dol_fiche_head($head, 'TabAccounting', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
|
||||
|
||||
|
||||
print '<table width="100%" class="border">';
|
||||
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
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print '<tr>';
|
||||
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>';
|
||||
|
||||
$langs->load('compta');
|
||||
print '<tr>';
|
||||
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, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE (bk.code_tiers = '" . $object->code_compta . "' AND bk.numero_compte = '" .$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER. "' )" ;
|
||||
|
||||
|
||||
|
||||
if (dol_strlen ( $search_year )) {
|
||||
$sql .= " AND ( bk.doc_date BETWEEN '" . $search_year . "-0-0' AND '" . ($search_year+1). "-0-0' )";
|
||||
}
|
||||
|
||||
|
||||
$sql .= " ORDER BY bk.lettering_code ASC, bk.doc_date ASC" ;//. $db->plimit ( $conf->liste_limit + 1, $offset );
|
||||
|
||||
// echo $sql;
|
||||
// dol_syslog ( "bookkeping:liste:create sql=" . $sql, LOG_DEBUG );
|
||||
$resql = $db->query ( $sql );
|
||||
if ($resql) {
|
||||
$num = $db->num_rows ( $resql );
|
||||
$i = 0;
|
||||
|
||||
|
||||
print '<form name="add" action="?socid='.$object->id.'" method="POST">';
|
||||
print '<input type="hidden" name="action" value="lettering">';
|
||||
print '<input type="hidden" name="socid" value="'.$object->id.'">';
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td></td>';
|
||||
print_liste_field_titre("Doctype", "liste.php", "bk.doc_type" );
|
||||
print_liste_field_titre("Docdate", "liste.php", "bk.doc_date" );
|
||||
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
|
||||
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
|
||||
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
|
||||
print_liste_field_titre("Labelcompte", "liste.php", "bk_label_compte" );
|
||||
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
|
||||
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
|
||||
// print_liste_field_titre("Amount", "liste.php", "bk.montant" );
|
||||
// print_liste_field_titre("Sens", "liste.php", "bk.sens" );
|
||||
print_liste_field_titre("Codejournal", "liste.php", "bk.code_journal" );
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<form action="" method="GET">';
|
||||
print '<input type="hidden" name="socid" value="' . $_GET ["socid"] . '">';
|
||||
print '<td><input type="text" name="search_doc_type" value="' . $_GET ["search_doc_type"] . '"></td>';
|
||||
print '<td><input type="text" name="search_year" value="' . $_GET ["search_year"] . '"></td>';
|
||||
print '<td><input type="text" name="search_doc_refe" value="' . $_GET ["search_doc_ref"] . '"></td>';
|
||||
// print '<td><input type="text" name="search_compte" value="' . $_GET ["search_compte"] . '"></td>';
|
||||
// print '<td><input type="text" name="search_tiers" value="' . $_GET ["search_tiers"] . '"></td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
// print '<td> </td>';
|
||||
// print '<td> </td>';
|
||||
print '<td align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" value="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '" title="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '">';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '</form>';
|
||||
print '</tr>';
|
||||
|
||||
$var = false;
|
||||
|
||||
$debit = 0;
|
||||
$credit = 0;
|
||||
$solde = 0;
|
||||
$tmp = '';
|
||||
while ( $i < $num ) {
|
||||
$obj = $db->fetch_object ( $resql );
|
||||
|
||||
if($tmp !=$obj->lettering_code || empty($tmp) )
|
||||
$tmp =$obj->lettering_code;
|
||||
|
||||
if($tmp !=$obj->lettering_code || empty($obj->lettering_code))
|
||||
$var = ! $var;
|
||||
|
||||
|
||||
$debit+= $obj->debit;
|
||||
$credit+= $obj->credit;
|
||||
|
||||
$solde+=($obj->credit-$obj->debit);
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td>' . $obj->rowid . '</td>';
|
||||
if(empty($obj->lettering_code)){
|
||||
print '<td><a href="'.dol_buildpath('/accountancy/bookkeeping/card.php', 1).'?piece_num=' . $obj->piece_num . '">';
|
||||
print img_edit ();
|
||||
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
||||
}
|
||||
else
|
||||
print '<td>'.$obj->doc_type . '</td>' . "\n";
|
||||
|
||||
|
||||
|
||||
print '<td>' . dol_print_date ( $db->jdate ( $obj->doc_date ), 'day' ) . '</td>';
|
||||
print '<td>' . $obj->doc_ref . '</td>';
|
||||
// print '<td>' . $obj->numero_compte . '</td>';
|
||||
// print '<td>' . $obj->code_tiers . '</td>';
|
||||
print '<td>' . $obj->label_compte . '</td>';
|
||||
print '<td>' . $obj->debit . '</td>';
|
||||
print '<td>' . $obj->credit . '</td>';
|
||||
// print '<td>' . $obj->montant . '</td>';
|
||||
// print '<td>' . $obj->sens . '</td>';
|
||||
print '<td>' . $obj->code_journal . '</td>';
|
||||
print '<td>' . round($solde, 2) . '</td>';
|
||||
|
||||
if(empty($obj->lettering_code)){
|
||||
print '<td><input type="checkbox" name="ids[]" value="' . $obj->rowid . '" /></td>';
|
||||
}
|
||||
else
|
||||
print '<td>' . $obj->lettering_code . '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$i ++;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print '<td colspan="4">Mouvement totaux</td>' . "\n";
|
||||
print '<td></td>';
|
||||
// print '<td></td>';
|
||||
// print '<td></td>';
|
||||
print '<td><strong>' . $debit . '</strong></td>';
|
||||
print '<td><strong>' . $credit . '</strong></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td colspan="5">Solde Comptable</td>' . "\n";
|
||||
// print '<td></td>';
|
||||
// print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td><strong>' . ($credit-$debit) . '</strong></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<input class="butAction" type="submit" value="lettering">';
|
||||
print '<a class="butAction" href="?socid='.$object->id.'&action=autolettrage">auto lettering</a>';
|
||||
print "</form>";
|
||||
$db->free($resql);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
335
htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php
Normal file
335
htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php
Normal file
@ -0,0 +1,335 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file accounting/bookkeeping/thirdparty_lettrage.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Tab to setup lettering
|
||||
*/
|
||||
|
||||
// Dolibarr environment
|
||||
require '../../main.inc.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/lettering.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||
|
||||
|
||||
$action=GETPOST('action','aZ09');
|
||||
$massaction=GETPOST('massaction','alpha');
|
||||
$show_files=GETPOST('show_files','int');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if ($sortorder == "") $sortorder = "ASC";
|
||||
if ($sortfield == "") $sortfield = "bk.rowid";
|
||||
|
||||
$search_year = GETPOST ( "search_year" );
|
||||
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid",'int');
|
||||
// if ($user->societe_id) $socid=$user->societe_id;
|
||||
|
||||
$object = new Societe($db);
|
||||
$object->id = $socid;
|
||||
$object->fetch($socid);
|
||||
|
||||
$form = new Form($db);
|
||||
$BookKeeping = new lettering($db);
|
||||
$formaccounting = new FormAccounting($db);
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
if ($action == 'lettering') {
|
||||
|
||||
$result = $BookKeeping->updatelettrage($_POST['ids']);
|
||||
|
||||
// var_dump($result);
|
||||
if( $result < 0 ){
|
||||
setEventMessages('', $BookKeeping->errors, 'errors' );
|
||||
$error++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'autolettrage') {
|
||||
|
||||
$result = $BookKeeping->LettrageTiers($socid);
|
||||
|
||||
if( $result < 0 ){
|
||||
setEventMessages('', $BookKeeping->errors, 'errors' );
|
||||
$error++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
llxHeader ( '', 'Compta - Grand Livre' );
|
||||
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$head = societe_prepare_head($object);
|
||||
|
||||
dol_htmloutput_mesg(is_numeric($error)?'':$error, $errors, 'error');
|
||||
|
||||
dol_fiche_head($head, 'TabAccounting', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
|
||||
|
||||
|
||||
print '<table width="100%" class="border">';
|
||||
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
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print '<tr>';
|
||||
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>';
|
||||
|
||||
$langs->load('compta');
|
||||
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>';
|
||||
|
||||
// print_r($soc);
|
||||
// exit;
|
||||
// [code_compta] => 411DOUA
|
||||
// [code_compta_fournisseur] => 401SUPPCODE
|
||||
|
||||
/*
|
||||
* Mode Liste
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE (bk.code_tiers = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" .$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER. "' )" ;
|
||||
|
||||
|
||||
|
||||
if (dol_strlen ( $search_year )) {
|
||||
$sql .= " AND ( bk.doc_date BETWEEN '" . $search_year . "-0-0' AND '" . ($search_year+1). "-0-0' )";
|
||||
}
|
||||
|
||||
|
||||
$sql .= " ORDER BY bk.lettering ASC, bk.doc_date ASC" ;//. $db->plimit ( $conf->liste_limit + 1, $offset );
|
||||
|
||||
// echo $sql;
|
||||
// dol_syslog ( "bookkeping:liste:create sql=" . $sql, LOG_DEBUG );
|
||||
$resql = $db->query ( $sql );
|
||||
if ($resql) {
|
||||
$num = $db->num_rows ( $resql );
|
||||
$i = 0;
|
||||
|
||||
|
||||
print '<form name="add" action="?socid='.$object->id.'" method="POST">';
|
||||
print '<input type="hidden" name="action" value="lettering">';
|
||||
print '<input type="hidden" name="socid" value="'.$object->id.'">';
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td></td>';
|
||||
print_liste_field_titre("Doctype", "liste.php", "bk.doc_type" );
|
||||
print_liste_field_titre("Docdate", "liste.php", "bk.doc_date" );
|
||||
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
|
||||
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
|
||||
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
|
||||
print_liste_field_titre("Labelcompte", "liste.php", "bk_label_compte" );
|
||||
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
|
||||
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
|
||||
print_liste_field_titre("Amount", "liste.php", "bk.montant" );
|
||||
print_liste_field_titre("Sens", "liste.php", "bk.sens" );
|
||||
print_liste_field_titre("Codejournal", "liste.php", "bk.code_journal" );
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<form action="" method="GET">';
|
||||
print '<input type="hidden" name="socid" value="' . $_GET ["socid"] . '">';
|
||||
print '<td><input type="text" name="search_doc_type" value="' . $_GET ["search_doc_type"] . '"></td>';
|
||||
print '<td><input type="text" name="search_year" value="' . $_GET ["search_year"] . '"></td>';
|
||||
print '<td><input type="text" name="search_doc_refe" value="' . $_GET ["search_doc_ref"] . '"></td>';
|
||||
// print '<td><input type="text" name="search_compte" value="' . $_GET ["search_compte"] . '"></td>';
|
||||
// print '<td><input type="text" name="search_tiers" value="' . $_GET ["search_tiers"] . '"></td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" value="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '" title="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '">';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '</form>';
|
||||
print '</tr>';
|
||||
|
||||
$var = false;
|
||||
|
||||
$debit = 0;
|
||||
$credit = 0;
|
||||
$solde = 0;
|
||||
$tmp = '';
|
||||
while ( $i < $num ) {
|
||||
$obj = $db->fetch_object ( $resql );
|
||||
|
||||
if($tmp !=$obj->lettering || empty($tmp) )
|
||||
$tmp =$obj->lettering;
|
||||
|
||||
if($tmp !=$obj->lettering || empty($obj->lettering))
|
||||
$var = ! $var;
|
||||
|
||||
|
||||
$debit+= $obj->debit;
|
||||
$credit+= $obj->credit;
|
||||
|
||||
$solde+=($obj->credit-$obj->debit);
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td>' . $obj->rowid . '</td>';
|
||||
if(empty($obj->lettering)){
|
||||
print '<td><a href="'.dol_buildpath('/accountancy/bookkeeping/card.php', 1).'?piece_num=' . $obj->piece_num . '">';
|
||||
print img_edit ();
|
||||
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
||||
}
|
||||
else
|
||||
print '<td>'.$obj->doc_type . '</td>' . "\n";
|
||||
|
||||
|
||||
|
||||
print '<td>' . dol_print_date ( $db->jdate ( $obj->doc_date ), 'day' ) . '</td>';
|
||||
print '<td>' . $obj->doc_ref . '</td>';
|
||||
// print '<td>' . $obj->numero_compte . '</td>';
|
||||
// print '<td>' . $obj->code_tiers . '</td>';
|
||||
print '<td>' . $obj->label_compte . '</td>';
|
||||
print '<td>' . $obj->debit . '</td>';
|
||||
print '<td>' . $obj->credit . '</td>';
|
||||
print '<td>' . $obj->montant . '</td>';
|
||||
print '<td>' . $obj->sens . '</td>';
|
||||
print '<td>' . $obj->code_journal . '</td>';
|
||||
print '<td>' . round($solde, 2) . '</td>';
|
||||
|
||||
if(empty($obj->lettering)){
|
||||
print '<td><input type="checkbox" name="ids[]" value="' . $obj->rowid . '" /></td>';
|
||||
}
|
||||
else
|
||||
print '<td>' . $obj->lettering . '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$i ++;
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print '<td colspan="4">Mouvement totaux</td>' . "\n";
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td><strong>' . $debit . '</strong></td>';
|
||||
print '<td><strong>' . $credit . '</strong></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td colspan="5">Solde Comptable</td>' . "\n";
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td><strong>' . ($credit-$debit) . '</strong></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<input class="butAction" type="submit" value="lettering">';
|
||||
print '<a class="butAction" href="?socid='.$object->id.'&action=autolettrage">auto lettering</a>';
|
||||
print "</form>";
|
||||
$db->free ( $resql );
|
||||
} else {
|
||||
dol_print_error ( $db );
|
||||
}
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -286,7 +286,7 @@ class AccountancyCategory
|
||||
}
|
||||
|
||||
if (! empty($mysoc->country_id)) {
|
||||
$sql = "SELECT t.rowid, t.account_number, t.label as name_cpt, cat.code, cat.position, cat.label as name_cat, cat.sens ";
|
||||
$sql = "SELECT t.rowid, t.account_number, t.label as account_label, cat.code, cat.position, cat.label as name_cat, cat.sens ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t, " . MAIN_DB_PREFIX . "c_accounting_category as cat";
|
||||
$sql .= " WHERE t.fk_accounting_category IN ( SELECT c.rowid ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
|
||||
@ -316,7 +316,7 @@ class AccountancyCategory
|
||||
'code' => $obj->code,
|
||||
'position' => $obj->position,
|
||||
'account_number' => $obj->account_number,
|
||||
'name_cpt' => $obj->name_cpt,
|
||||
'account_label' => $obj->account_label,
|
||||
'sens' => $obj->sens
|
||||
);
|
||||
$i ++;
|
||||
@ -334,22 +334,28 @@ class AccountancyCategory
|
||||
/**
|
||||
* Function to show result of an accounting account from the ledger with a direction and a period
|
||||
*
|
||||
* @param int $cpt Id accounting account
|
||||
* @param string $month Specifig month - Can be empty
|
||||
* @param string $year Specific year
|
||||
* @param int $sens Sens of the account 0: credit - debit 1: debit - credit
|
||||
*
|
||||
* @return integer Result in table
|
||||
* @param int $cpt Id accounting account
|
||||
* @param string $month Specifig month - Can be empty
|
||||
* @param string $date_start Date start
|
||||
* @param string $date_end Date end
|
||||
* @param int $sens Sens of the account: 0: credit - debit, 1: debit - credit
|
||||
* @param string $thirdparty_code Thirdparty code
|
||||
* @return integer Result in table
|
||||
*/
|
||||
public function getResult($cpt, $month, $year, $sens) {
|
||||
public function getResult($cpt, $month, $date_start, $date_end, $sens, $thirdparty_code='nofilter')
|
||||
{
|
||||
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
|
||||
$sql .= " WHERE t.numero_compte = '" . $cpt."'";
|
||||
$sql .= " AND YEAR(t.doc_date) = " . $year;
|
||||
|
||||
if (! empty($date_start) && ! empty($date_end))
|
||||
$sql.= " AND t.doc_date >= '".$this->db->idate($date_start)."' AND t.doc_date <= '".$this->db->idate($date_end)."'";
|
||||
if (! empty($month)) {
|
||||
$sql .= " AND MONTH(t.doc_date) = " . $month;
|
||||
}
|
||||
if ($thirdparty_code != 'nofilter')
|
||||
{
|
||||
$sql .= " AND thirdparty_code = '".$this->db->escape($thirdparty_code)."'";
|
||||
}
|
||||
|
||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -375,11 +381,13 @@ class AccountancyCategory
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to call category from a specific country
|
||||
* Return list of personalized groups
|
||||
*
|
||||
* @return array Result in table
|
||||
* @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups
|
||||
* @return array Array of groups
|
||||
*/
|
||||
public function getCatsCal() {
|
||||
public function getCats($categorytype=-1)
|
||||
{
|
||||
global $db, $langs, $user, $mysoc;
|
||||
|
||||
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
|
||||
@ -388,20 +396,21 @@ class AccountancyCategory
|
||||
}
|
||||
|
||||
if (! empty($mysoc->country_id)) {
|
||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
|
||||
$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 .= " WHERE c.active = 1 AND c.category_type = 1 ";
|
||||
$sql .= " WHERE c.active = 1 ";
|
||||
if ($categorytype >= 0) $sql.=" AND c.category_type = 1";
|
||||
$sql .= " AND c.fk_country = " . $mysoc->country_id;
|
||||
$sql .= " ORDER BY c.position ASC";
|
||||
} else {
|
||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
|
||||
} else { // Note: this should not happen
|
||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co";
|
||||
$sql .= " WHERE c.active = 1 AND c.category_type = 1 AND c.fk_country = co.rowid";
|
||||
$sql .= " WHERE c.active = 1 AND c.fk_country = co.rowid";
|
||||
if ($categorytype >= 0) $sql.=" AND c.category_type = 1";
|
||||
$sql .= " AND co.code = '" . $mysoc->country_code . "'";
|
||||
$sql .= " ORDER BY c.position ASC";
|
||||
}
|
||||
|
||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
@ -411,13 +420,16 @@ class AccountancyCategory
|
||||
if ($num) {
|
||||
while ( $i < $num ) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$position = $obj->position;
|
||||
$data[$position] = array (
|
||||
|
||||
$data[] = array (
|
||||
'rowid' => $obj->rowid,
|
||||
'code' => $obj->code,
|
||||
'label' => $obj->label,
|
||||
'formula' => $obj->formula
|
||||
'formula' => $obj->formula,
|
||||
'position' => $obj->position,
|
||||
'category_type' => $obj->category_type
|
||||
);
|
||||
$i ++;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
@ -429,4 +441,126 @@ class AccountancyCategory
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// calcule
|
||||
|
||||
/* I try to replace this with dol_eval()
|
||||
|
||||
const PATTERN = '/(?:\-?\d+(?:\.?\d+)?[\+\-\*\/])+\-?\d+(?:\.?\d+)?/';
|
||||
|
||||
const PARENTHESIS_DEPTH = 10;
|
||||
|
||||
public function calculate($input)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if(strpos($input, '+') != null || strpos($input, '-') != null || strpos($input, '/') != null || strpos($input, '*') != null){
|
||||
// Remove white spaces and invalid math chars
|
||||
$input = str_replace($langs->trans("ThousandSeparator"), '', $input);
|
||||
$input = str_replace(',', '.', $input);
|
||||
$input = preg_replace('[^0-9\.\+\-\*\/\(\)]', '', $input);
|
||||
|
||||
// Calculate each of the parenthesis from the top
|
||||
$i = 0;
|
||||
while(strpos($input, '(') || strpos($input, ')')){
|
||||
$input = preg_replace_callback('/\(([^\(\)]+)\)/', 'self::callback', $input);
|
||||
|
||||
$i++;
|
||||
if($i > self::PARENTHESIS_DEPTH){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate the result
|
||||
if(preg_match(self::PATTERN, $input, $match)){
|
||||
return $this->compute($match[0]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $input;
|
||||
}
|
||||
|
||||
private function compute($input){
|
||||
$compute = create_function('', 'return '.$input.';');
|
||||
|
||||
return 0 + $compute();
|
||||
}
|
||||
|
||||
private function callback($input){
|
||||
if(is_numeric($input[1])){
|
||||
return $input[1];
|
||||
}
|
||||
elseif(preg_match(self::PATTERN, $input[1], $match)){
|
||||
return $this->compute($match[0]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Get all accounting account of a group.
|
||||
* You must choose between first parameter (personalized group) or the second (free criteria filter)
|
||||
*
|
||||
* @param int $cat_id Id if personalized accounting group/category
|
||||
* @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts
|
||||
* @return array Array of accounting accounts
|
||||
*/
|
||||
public function getCptsCat($cat_id, $predefinedgroupwhere='')
|
||||
{
|
||||
global $mysoc;
|
||||
$sql = '';
|
||||
|
||||
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
|
||||
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
|
||||
exit();
|
||||
}
|
||||
|
||||
if (! empty($cat_id))
|
||||
{
|
||||
$sql = "SELECT t.rowid, t.account_number, t.label as account_label";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
||||
$sql .= " WHERE t.fk_accounting_category = ".$cat_id;
|
||||
$sql .= " ORDER BY t.account_number ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT t.rowid, t.account_number, t.label as account_label";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
||||
$sql .= " WHERE ".$predefinedgroupwhere;
|
||||
$sql .= " ORDER BY t.account_number ";
|
||||
}
|
||||
//echo $sql;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$obj = '';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$data = array();
|
||||
if ($num) {
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$name_cat = $obj->name_cat;
|
||||
$data[] = array (
|
||||
'id' => $obj->rowid,
|
||||
'account_number' => $obj->account_number,
|
||||
'account_label' => $obj->account_label,
|
||||
);
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -32,14 +32,15 @@
|
||||
*
|
||||
* Manage the different format accountancy export
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
|
||||
|
||||
class AccountancyExport
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var Type of export
|
||||
* @var Type of export. Defined by $conf->global->ACCOUNTING_EXPORT_MODELCSV
|
||||
*/
|
||||
public static $EXPORT_TYPE_NORMAL = 1;
|
||||
public static $EXPORT_TYPE_NORMAL = 1; // Classic CSV
|
||||
public static $EXPORT_TYPE_CEGID = 2;
|
||||
public static $EXPORT_TYPE_COALA = 3;
|
||||
public static $EXPORT_TYPE_BOB50 = 4;
|
||||
@ -81,7 +82,7 @@ class AccountancyExport
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all export type are available
|
||||
* Array wit all export type available (key + label)
|
||||
*
|
||||
* @return array of type
|
||||
*/
|
||||
|
||||
@ -37,7 +37,7 @@ class AccountancySystem
|
||||
var $label;
|
||||
var $account_number;
|
||||
var $account_parent;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -46,8 +46,8 @@ class AccountancySystem
|
||||
function __construct($db) {
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load record in memory
|
||||
*
|
||||
@ -55,11 +55,11 @@ class AccountancySystem
|
||||
* @param string $ref ref
|
||||
* @return int <0 if KO, Id of record if OK and found
|
||||
*/
|
||||
function fetch($rowid = 0, $ref = '')
|
||||
function fetch($rowid = 0, $ref = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if ($rowid > 0 || $ref)
|
||||
|
||||
if ($rowid > 0 || $ref)
|
||||
{
|
||||
$sql = "SELECT a.pcg_version, a.label, a.active";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a";
|
||||
@ -69,12 +69,12 @@ class AccountancySystem
|
||||
} elseif ($ref) {
|
||||
$sql .= " a.pcg_version = '" . $ref . "'";
|
||||
}
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
|
||||
if ($obj) {
|
||||
$this->id = $obj->rowid;
|
||||
$this->rowid = $obj->rowid;
|
||||
@ -82,7 +82,7 @@ class AccountancySystem
|
||||
$this->ref = $obj->pcg_version;
|
||||
$this->label = $obj->label;
|
||||
$this->active = $obj->active;
|
||||
|
||||
|
||||
return $this->id;
|
||||
} else {
|
||||
return 0;
|
||||
@ -94,8 +94,8 @@ class AccountancySystem
|
||||
}
|
||||
return - 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Insert accountancy system name into database
|
||||
*
|
||||
@ -104,16 +104,16 @@ class AccountancySystem
|
||||
*/
|
||||
function create($user) {
|
||||
$now = dol_now();
|
||||
|
||||
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_system";
|
||||
$sql .= " (date_creation, fk_user_author, numero, label)";
|
||||
$sql .= " VALUES (" . $this->db->idate($now) . "," . $user->id . ",'" . $this->numero . "','" . $this->label . "')";
|
||||
|
||||
$sql .= " VALUES ('" . $this->db->idate($now) . "'," . $user->id . ",'" . $this->db->escape($this->numero) . "','" . $this->db->escape($this->label) . "')";
|
||||
|
||||
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_system");
|
||||
|
||||
|
||||
if ($id > 0) {
|
||||
$this->rowid = $id;
|
||||
$result = $this->rowid;
|
||||
@ -127,7 +127,7 @@ class AccountancySystem
|
||||
$this->error = "AccountancySystem::Create Erreur $result";
|
||||
dol_syslog($this->error, LOG_ERR);
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@ -47,7 +47,7 @@ class AccountingAccount extends CommonObject
|
||||
var $fk_user_modif;
|
||||
var $active; // duplicate with status
|
||||
var $status;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -56,7 +56,7 @@ class AccountingAccount extends CommonObject
|
||||
function __construct($db) {
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load record in memory
|
||||
*
|
||||
@ -67,7 +67,7 @@ class AccountingAccount extends CommonObject
|
||||
*/
|
||||
function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0) {
|
||||
global $conf;
|
||||
|
||||
|
||||
if ($rowid || $account_number) {
|
||||
$sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.pcg_subtype, a.account_number, a.account_parent, a.label, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active";
|
||||
$sql .= ", ca.label as category_label";
|
||||
@ -87,7 +87,7 @@ class AccountingAccount extends CommonObject
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
|
||||
if ($obj) {
|
||||
$this->id = $obj->rowid;
|
||||
$this->rowid = $obj->rowid;
|
||||
@ -105,7 +105,7 @@ class AccountingAccount extends CommonObject
|
||||
$this->fk_user_modif = $obj->fk_user_modif;
|
||||
$this->active = $obj->active;
|
||||
$this->status = $obj->active;
|
||||
|
||||
|
||||
return $this->id;
|
||||
} else {
|
||||
return 0;
|
||||
@ -117,7 +117,7 @@ class AccountingAccount extends CommonObject
|
||||
}
|
||||
return - 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Insert new accounting account in chart of accounts
|
||||
*
|
||||
@ -129,7 +129,7 @@ class AccountingAccount extends CommonObject
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$now = dol_now();
|
||||
|
||||
|
||||
// Clean parameters
|
||||
if (isset($this->fk_pcg_version))
|
||||
$this->fk_pcg_version = trim($this->fk_pcg_version);
|
||||
@ -149,7 +149,7 @@ class AccountingAccount extends CommonObject
|
||||
$this->fk_user_author = trim($this->fk_user_author);
|
||||
if (isset($this->active))
|
||||
$this->active = trim($this->active);
|
||||
|
||||
|
||||
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
||||
{
|
||||
$this->pcg_type = 'XXXXXX';
|
||||
@ -160,7 +160,7 @@ class AccountingAccount extends CommonObject
|
||||
}
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_account(";
|
||||
$sql .= "datec";
|
||||
@ -179,31 +179,31 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= ", " . $conf->entity;
|
||||
$sql .= ", " . (empty($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'");
|
||||
$sql .= ", " . (empty($this->pcg_type) ? 'NULL' : "'" . $this->db->escape($this->pcg_type) . "'");
|
||||
$sql .= ", " . (empty($this->pcg_subtype) ? 'NULL' : "'" . $this->pcg_subtype . "'");
|
||||
$sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->account_number . "'");
|
||||
$sql .= ", " . (empty($this->pcg_subtype) ? 'NULL' : "'" . $this->db->escape($this->pcg_subtype) . "'");
|
||||
$sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->db->escape($this->account_number) . "'");
|
||||
$sql .= ", " . (empty($this->account_parent) ? 'NULL' : "'" . $this->db->escape($this->account_parent) . "'");
|
||||
$sql .= ", " . (empty($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'");
|
||||
$sql .= ", " . (empty($this->account_category) ? 'NULL' : "'" . $this->db->escape($this->account_category) . "'");
|
||||
$sql .= ", " . $user->id;
|
||||
$sql .= ", " . (! isset($this->active) ? 'NULL' : $this->db->escape($this->active));
|
||||
$sql .= ")";
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
}
|
||||
|
||||
|
||||
if (! $error) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_account");
|
||||
|
||||
|
||||
// if (! $notrigger) {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
|
||||
// // Call triggers
|
||||
// include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
// $interface=new Interfaces($this->db);
|
||||
@ -212,7 +212,7 @@ class AccountingAccount extends CommonObject
|
||||
// // End call triggers
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
foreach ( $this->errors as $errmsg ) {
|
||||
@ -226,14 +226,14 @@ class AccountingAccount extends CommonObject
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update record
|
||||
*
|
||||
* @param User $user Use making update
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user)
|
||||
function update($user)
|
||||
{
|
||||
// Check parameters
|
||||
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
||||
@ -244,9 +244,9 @@ class AccountingAccount extends CommonObject
|
||||
{
|
||||
$this->pcg_subtype = 'XXXXXX';
|
||||
}
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
|
||||
$sql .= " SET fk_pcg_version = " . ($this->fk_pcg_version ? "'" . $this->db->escape($this->fk_pcg_version) . "'" : "null");
|
||||
$sql .= " , pcg_type = " . ($this->pcg_type ? "'" . $this->db->escape($this->pcg_type) . "'" : "null");
|
||||
@ -258,7 +258,7 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= " , fk_user_modif = " . $user->id;
|
||||
$sql .= " , active = " . $this->active;
|
||||
$sql .= " WHERE rowid = " . $this->id;
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
@ -270,7 +270,7 @@ class AccountingAccount extends CommonObject
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check usage of accounting code
|
||||
*
|
||||
@ -278,16 +278,16 @@ class AccountingAccount extends CommonObject
|
||||
*/
|
||||
function checkUsage() {
|
||||
global $langs;
|
||||
|
||||
|
||||
$sql = "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facturedet";
|
||||
$sql .= " WHERE fk_code_ventilation=" . $this->id . ")";
|
||||
$sql .= "UNION";
|
||||
$sql .= "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facture_fourn_det";
|
||||
$sql .= " WHERE fk_code_ventilation=" . $this->id . ")";
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . "::checkUsage sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num > 0) {
|
||||
@ -301,7 +301,7 @@ class AccountingAccount extends CommonObject
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
@ -311,18 +311,18 @@ class AccountingAccount extends CommonObject
|
||||
*/
|
||||
function delete($user, $notrigger = 0) {
|
||||
$error = 0;
|
||||
|
||||
|
||||
$result = $this->checkUsage();
|
||||
|
||||
|
||||
if ($result > 0) {
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
// if (! $error) {
|
||||
// if (! $notrigger) {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
|
||||
// // Call triggers
|
||||
// include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
// $interface=new Interfaces($this->db);
|
||||
@ -331,11 +331,11 @@ class AccountingAccount extends CommonObject
|
||||
// // End call triggers
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
if (! $error) {
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "accounting_account";
|
||||
$sql .= " WHERE rowid=" . $this->id;
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . "::delete sql=" . $sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
@ -343,7 +343,7 @@ class AccountingAccount extends CommonObject
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
foreach ( $this->errors as $errmsg ) {
|
||||
@ -360,7 +360,7 @@ class AccountingAccount extends CommonObject
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
@ -375,7 +375,7 @@ class AccountingAccount extends CommonObject
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
|
||||
|
||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||
|
||||
$result = '';
|
||||
@ -412,7 +412,7 @@ class AccountingAccount extends CommonObject
|
||||
{
|
||||
$linkstart = '';
|
||||
$linkclose = '';
|
||||
$linkend = '';
|
||||
$linkend = '';
|
||||
}
|
||||
|
||||
$label_link = length_accountg($this->account_number);
|
||||
@ -423,7 +423,7 @@ class AccountingAccount extends CommonObject
|
||||
if ($withpicto != 2) $result.=$linkstart . $label_link . $linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Information on record
|
||||
*
|
||||
@ -434,10 +434,10 @@ class AccountingAccount extends CommonObject
|
||||
$sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms';
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as a';
|
||||
$sql .= ' WHERE a.rowid = ' . $id;
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . '::info sql=' . $sql);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
|
||||
if ($result) {
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
@ -460,7 +460,7 @@ class AccountingAccount extends CommonObject
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Account desactivate
|
||||
*
|
||||
@ -469,17 +469,17 @@ class AccountingAccount extends CommonObject
|
||||
*/
|
||||
function account_desactivate($id) {
|
||||
$result = $this->checkUsage();
|
||||
|
||||
|
||||
if ($result > 0) {
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
|
||||
$sql .= "SET active = '0'";
|
||||
$sql .= " WHERE rowid = " . $this->db->escape($id);
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . "::desactivate sql=" . $sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
|
||||
if ($result) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
@ -492,7 +492,7 @@ class AccountingAccount extends CommonObject
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Account activate
|
||||
*
|
||||
@ -501,11 +501,11 @@ class AccountingAccount extends CommonObject
|
||||
*/
|
||||
function account_activate($id) {
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
|
||||
$sql .= "SET active = '1'";
|
||||
$sql .= " WHERE rowid = " . $this->db->escape($id);
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . "::activate sql=" . $sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
@ -517,8 +517,8 @@ class AccountingAccount extends CommonObject
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retourne le libelle du statut d'un user (actif, inactif)
|
||||
*
|
||||
@ -529,7 +529,7 @@ class AccountingAccount extends CommonObject
|
||||
{
|
||||
return $this->LibStatut($this->status,$mode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
@ -541,7 +541,7 @@ class AccountingAccount extends CommonObject
|
||||
{
|
||||
global $langs;
|
||||
$langs->load('users');
|
||||
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
$prefix='';
|
||||
|
||||
@ -71,6 +71,7 @@ class BookKeeping extends CommonObject
|
||||
/**
|
||||
*/
|
||||
public $doc_date;
|
||||
public $date_lim_reglement;
|
||||
public $doc_type;
|
||||
public $doc_ref;
|
||||
public $fk_doc;
|
||||
@ -176,7 +177,7 @@ class BookKeeping extends CommonObject
|
||||
if (empty($this->credit)) $this->credit = 0;
|
||||
|
||||
// Check parameters
|
||||
if (empty($this->numero_compte) || $this->numero_compte == '-1')
|
||||
if (empty($this->numero_compte) || $this->numero_compte == '-1' || $this->numero_compte == 'NotDefined')
|
||||
{
|
||||
$langs->load("errors");
|
||||
if (in_array($this->doc_type, array('bank', 'expense_report')))
|
||||
@ -255,6 +256,7 @@ class BookKeeping extends CommonObject
|
||||
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . " (";
|
||||
$sql .= "doc_date";
|
||||
$sql .= ", date_lim_reglement";
|
||||
$sql .= ", doc_type";
|
||||
$sql .= ", doc_ref";
|
||||
$sql .= ", fk_doc";
|
||||
@ -270,13 +272,14 @@ class BookKeeping extends CommonObject
|
||||
$sql .= ", montant";
|
||||
$sql .= ", sens";
|
||||
$sql .= ", fk_user_author";
|
||||
$sql .= ", import_key";
|
||||
$sql .= ", date_creation";
|
||||
$sql .= ", code_journal";
|
||||
$sql .= ", journal_label";
|
||||
$sql .= ", piece_num";
|
||||
$sql .= ', entity';
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'" . $this->db->idate($this->doc_date) . "'";
|
||||
$sql .= ",'" . $this->db->idate($this->date_lim_reglement) . "'";
|
||||
$sql .= ",'" . $this->db->escape($this->doc_type) . "'";
|
||||
$sql .= ",'" . $this->db->escape($this->doc_ref) . "'";
|
||||
$sql .= "," . $this->fk_doc;
|
||||
@ -430,12 +433,21 @@ class BookKeeping extends CommonObject
|
||||
if (empty($this->debit)) $this->debit = 0;
|
||||
if (empty($this->credit)) $this->credit = 0;
|
||||
|
||||
$this->debit = price2num($this->debit, 'MT');
|
||||
$this->credit = price2num($this->credit, 'MT');
|
||||
|
||||
$now = dol_now();
|
||||
if (empty($this->date_create)) {
|
||||
$this->date_create = $now;
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . $mode.'(';
|
||||
$sql .= 'doc_date,';
|
||||
$sql .= 'date_lim_reglement,';
|
||||
$sql .= 'doc_type,';
|
||||
$sql .= 'doc_ref,';
|
||||
$sql .= 'fk_doc,';
|
||||
@ -451,13 +463,14 @@ class BookKeeping extends CommonObject
|
||||
$sql .= 'montant,';
|
||||
$sql .= 'sens,';
|
||||
$sql .= 'fk_user_author,';
|
||||
$sql .= 'import_key,';
|
||||
$sql .= 'date_creation,';
|
||||
$sql .= 'code_journal,';
|
||||
$sql .= 'journal_label,';
|
||||
$sql .= 'piece_num,';
|
||||
$sql .= 'entity';
|
||||
$sql .= ') VALUES (';
|
||||
$sql .= ' ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) == 0 ? 'NULL' : "'" . $this->db->idate($this->doc_date) . "'") . ',';
|
||||
$sql .= ' ' . (! isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'" . $this->db->idate($this->date_lim_reglement) . "'") . ',';
|
||||
$sql .= ' ' . (! isset($this->doc_type) ? 'NULL' : "'" . $this->db->escape($this->doc_type) . "'") . ',';
|
||||
$sql .= ' ' . (! isset($this->doc_ref) ? 'NULL' : "'" . $this->db->escape($this->doc_ref) . "'") . ',';
|
||||
$sql .= ' ' . (empty($this->fk_doc) ? '0' : $this->fk_doc) . ',';
|
||||
@ -473,7 +486,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= ' ' . (! isset($this->montant) ? 'NULL' : $this->montant ). ',';
|
||||
$sql .= ' ' . (! isset($this->sens) ? 'NULL' : "'" . $this->db->escape($this->sens) . "'") . ',';
|
||||
$sql .= ' ' . $user->id . ',';
|
||||
$sql .= ' ' . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . ',';
|
||||
$sql .= ' ' . "'" . $this->db->idate($this->date_create) . "',";
|
||||
$sql .= ' ' . (empty($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ',';
|
||||
$sql .= ' ' . (empty($this->journal_label) ? 'NULL' : "'" . $this->db->escape($this->journal_label) . "'") . ',';
|
||||
$sql .= ' ' . (empty($this->piece_num) ? 'NULL' : $this->db->escape($this->piece_num)).',';
|
||||
@ -532,6 +545,7 @@ class BookKeeping extends CommonObject
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
$sql .= " t.doc_date,";
|
||||
$sql .= " t.date_lim_reglement,";
|
||||
$sql .= " t.doc_type,";
|
||||
$sql .= " t.doc_ref,";
|
||||
$sql .= " t.fk_doc,";
|
||||
@ -569,6 +583,7 @@ class BookKeeping extends CommonObject
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
$this->doc_date = $this->db->jdate($obj->doc_date);
|
||||
$this->date_lim_reglement = $this->db->jdate($obj->date_lim_reglement);
|
||||
$this->doc_type = $obj->doc_type;
|
||||
$this->doc_ref = $obj->doc_ref;
|
||||
$this->fk_doc = $obj->fk_doc;
|
||||
@ -604,6 +619,7 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
@ -794,7 +810,7 @@ class BookKeeping extends CommonObject
|
||||
if (! empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||
}
|
||||
$this->lines = array ();
|
||||
$this->lines = array();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -993,6 +1009,9 @@ class BookKeeping extends CommonObject
|
||||
$this->piece_num = trim($this->piece_num);
|
||||
}
|
||||
|
||||
$this->debit = price2num($this->debit, 'MT');
|
||||
$this->credit = price2num($this->credit, 'MT');
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add a control on parameters values
|
||||
|
||||
@ -1063,9 +1082,10 @@ class BookKeeping extends CommonObject
|
||||
public function updateByMvt($piece_num='', $field='', $value='', $mode='') {
|
||||
$this->db->begin();
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . $mode . " as ab";
|
||||
$sql .= ' SET ab.' . $field . '=' . $value;
|
||||
$sql .= ' SET ab.' . $field . '=' . (is_numeric($value)?$value:"'".$value."'");
|
||||
$sql .= ' WHERE ab.piece_num=' . $piece_num ;
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
@ -1088,7 +1108,6 @@ class BookKeeping extends CommonObject
|
||||
* @param User $user User that deletes
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @param string $mode Mode
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete(User $user, $notrigger = false, $mode='') {
|
||||
@ -1205,18 +1224,17 @@ class BookKeeping extends CommonObject
|
||||
/**
|
||||
* Delete bookkepping by piece number
|
||||
*
|
||||
* @param int $piecenum peicenum to delete
|
||||
* @param string $mode Mode
|
||||
* @return int Result
|
||||
* @param int $piecenum Piecenum to delete
|
||||
* @return int Result
|
||||
*/
|
||||
function deleteMvtNum($piecenum, $mode) {
|
||||
function deleteMvtNum($piecenum) {
|
||||
global $conf;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// first check if line not yet in bookkeeping
|
||||
$sql = "DELETE";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element. $mode;
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
$sql .= " WHERE piece_num = " . $piecenum;
|
||||
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
||||
|
||||
@ -1248,7 +1266,7 @@ class BookKeeping extends CommonObject
|
||||
|
||||
global $user;
|
||||
$error = 0;
|
||||
$object = new Accountingbookkeeping($this->db);
|
||||
$object = new BookKeeping($this->db);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -1571,6 +1589,7 @@ class BookKeeping extends CommonObject
|
||||
$this->db->rollback();
|
||||
return - 1;
|
||||
}
|
||||
/*
|
||||
$sql = "DELETE FROM ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = ab.numero_compte";
|
||||
@ -1579,6 +1598,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " AND asy.rowid = " . $pcgver;
|
||||
$sql .= " AND ab.entity IN (" . getEntity('accountancy') . ")";
|
||||
$sql .= " ORDER BY account_number ASC";
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1756,4 +1776,4 @@ class BookKeepingLine
|
||||
public $code_journal;
|
||||
public $journal_label;
|
||||
public $piece_num;
|
||||
}
|
||||
}
|
||||
|
||||
330
htdocs/accountancy/class/lettering.class.php
Normal file
330
htdocs/accountancy/class/lettering.class.php
Normal file
@ -0,0 +1,330 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file accountancy/class/bookkeeping.class.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief File of class for lettering
|
||||
*/
|
||||
|
||||
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."/core/lib/date.lib.php";
|
||||
|
||||
|
||||
/**
|
||||
* Class lettering
|
||||
*/
|
||||
class lettering extends BookKeeping
|
||||
{
|
||||
/**
|
||||
* lettrageTiers
|
||||
*
|
||||
* @param int $socid Thirdparty id
|
||||
* @return void
|
||||
*/
|
||||
public function lettrageTiers($socid) {
|
||||
|
||||
$db = $this->db;
|
||||
|
||||
$object = new Societe($this->db);
|
||||
$object->id = $socid;
|
||||
$object->fetch($socid);
|
||||
|
||||
|
||||
if( $object->code_compta == '411CUSTCODE')
|
||||
$object->code_compta = '';
|
||||
|
||||
if( $object->code_compta_fournisseur == '401SUPPCODE')
|
||||
$object->code_compta_fournisseur = '';
|
||||
|
||||
|
||||
|
||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.lettering_code, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE code_journal = 'BQ' AND ( ";
|
||||
if(!empty($object->code_compta) )
|
||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
||||
$sql .= " OR ";
|
||||
if(!empty($object->code_compta_fournisseur) )
|
||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
||||
|
||||
$sql .= " ) AND ( bk.date_lettering ='' OR bk.date_lettering IS NULL ) AND bk.lettering_code !='' ";
|
||||
|
||||
$sql .= " GROUP BY bk.lettering_code ";
|
||||
|
||||
|
||||
$resql = $db->query ( $sql );
|
||||
if ($resql) {
|
||||
$num = $db->num_rows ( $resql );
|
||||
$i = 0;
|
||||
|
||||
while ( $i < $num ) {
|
||||
$obj = $db->fetch_object ( $resql );
|
||||
$i++;
|
||||
|
||||
$sql = "SELECT bk.rowid ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE bk.lettering_code = '".$obj->lettering_code."' ";
|
||||
$sql .= " AND ( ";
|
||||
if(!empty($object->code_compta) )
|
||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
||||
$sql .= " OR ";
|
||||
if(!empty($object->code_compta_fournisseur) )
|
||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
||||
$sql .= " ) ";
|
||||
// echo $sql;
|
||||
$resql2 = $db->query ( $sql );
|
||||
if ($resql2) {
|
||||
$num2 = $db->num_rows ( $resql2 );
|
||||
$i2 = 0;
|
||||
$ids = array();
|
||||
while ( $i2 < $num2 ) {
|
||||
$obj2 = $db->fetch_object ( $resql2 );
|
||||
$i2++;
|
||||
$ids[] = $obj2->rowid;
|
||||
}
|
||||
|
||||
|
||||
if(count($ids) > 1 ){
|
||||
$result = $this->updatelettrage($ids);
|
||||
|
||||
// var_dump($result);
|
||||
// if( $result < 0 ){
|
||||
// setEventMessages('', $BookKeeping->errors, 'errors' );
|
||||
// $error++;
|
||||
//
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Prise en charge des lettering complexe avec prelevment , virement
|
||||
*/
|
||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering, bu.url_id , bu.type ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu ON(bk.fk_doc = bu.fk_bank AND bu.type IN ('payment', 'payment_supplier') ) ";
|
||||
$sql .= " WHERE code_journal = 'BQ' AND ( ";
|
||||
if(!empty($object->code_compta) )
|
||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
||||
$sql .= " OR ";
|
||||
if(!empty($object->code_compta_fournisseur) )
|
||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
||||
|
||||
$sql .= " ) AND date_lettering ='' ";
|
||||
$sql .= " GROUP BY bk.lettering_code ";
|
||||
|
||||
// echo $sql;
|
||||
//
|
||||
$resql = $db->query ( $sql );
|
||||
if ($resql) {
|
||||
$num = $db->num_rows ( $resql );
|
||||
$i = 0;
|
||||
|
||||
while ( $i < $num ) {
|
||||
$obj = $db->fetch_object ( $resql );
|
||||
$ids = array();
|
||||
$i++;
|
||||
|
||||
// print_r($obj);
|
||||
|
||||
|
||||
|
||||
if($obj->type =='payment_supplier' ) {
|
||||
$ids[] = $obj->rowid;
|
||||
|
||||
$sql= 'SELECT bk.rowid, facf.ref, facf.ref_supplier, payf.fk_bank ';
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
|
||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
|
||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid";
|
||||
$sql.= " INNER JOIN " .MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = facf.ref) ";
|
||||
// $sqlmid.= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc ON soc.rowid=facf.fk_soc";
|
||||
// $sqlmid.= " INNER JOIN " . MAIN_DB_PREFIX . "c_paiement as payc ON payc.id=payf.fk_paiement";
|
||||
$sql .= " WHERE 1 ";
|
||||
$sql .= " AND fk_paiementfourn = '".$obj->url_id."' ";
|
||||
// $sql .= " AND (bk.numero_compte = '" . $object->code_compta . "' OR bk.numero_compte = '" . $object->code_compta_fournisseur . "') ";
|
||||
$sql .= " AND ( ";
|
||||
if(!empty($object->code_compta) )
|
||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
||||
$sql .= " OR ";
|
||||
if(!empty($object->code_compta_fournisseur) )
|
||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
||||
$sql .= " ) ";
|
||||
// echo $sql;
|
||||
// exit;
|
||||
}
|
||||
elseif($obj->type =='payment' ){
|
||||
$ids[] = $obj->rowid;
|
||||
|
||||
$sql= 'SELECT bk.rowid,fac.facnumber , pay.fk_bank ';
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facture fac ";
|
||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
|
||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid";
|
||||
$sql.= " INNER JOIN " .MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = fac.rowid) ";
|
||||
$sql .= " WHERE 1 ";
|
||||
$sql .= " AND payfac.fk_paiement = '".$obj->url_id."' ";
|
||||
$sql .= " AND ( ";
|
||||
if(!empty($object->code_compta) )
|
||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
||||
$sql .= " OR ";
|
||||
if(!empty($object->code_compta_fournisseur) )
|
||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
||||
$sql .= " ) ";
|
||||
|
||||
// echo $sql;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$resql2 = $db->query ( $sql );
|
||||
if ($resql2) {
|
||||
$num2 = $db->num_rows ( $resql2 );
|
||||
$i2 = 0;
|
||||
|
||||
while ( $i2 < $num2 ) {
|
||||
$obj2 = $db->fetch_object ( $resql2 );
|
||||
$i2++;
|
||||
$ids[] = $obj2->rowid;
|
||||
}
|
||||
|
||||
// print_r($ids);
|
||||
// exit;
|
||||
if(count($ids) > 1 ){
|
||||
$result = $this->updatelettrage($ids);
|
||||
|
||||
// var_dump($result);
|
||||
// if( $result < 0 ){
|
||||
// setEventMessages('', $BookKeeping->errors, 'errors' );
|
||||
// $error++;
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
// exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function updatelettrage($ids, $notrigger=false){
|
||||
$error = 0;
|
||||
|
||||
$sql = "SELECT lettering_code FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||
$sql .= " lettering_code != '' GROUP BY lettering_code ORDER BY lettering_code DESC limit 1; ";
|
||||
// echo $sql;
|
||||
$result = $this->db->query ( $sql );
|
||||
if ($result) {
|
||||
$obj = $this->db->fetch_object ( $result );
|
||||
$lettre = (empty($obj->lettering_code)? 'AAA' : $obj->lettering_code );
|
||||
if(!empty($obj->lettering_code))
|
||||
$lettre++;
|
||||
}
|
||||
else{
|
||||
$this->errors[] = 'Error'.$this->db->lasterror();;
|
||||
$error++;
|
||||
}
|
||||
// var_dump(__line__, $error);
|
||||
|
||||
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||
$sql .= " rowid IN (".implode(',', $ids).") ";
|
||||
$result = $this->db->query ( $sql );
|
||||
if ($result) {
|
||||
$obj = $this->db->fetch_object ( $result );
|
||||
// print_r($obj);
|
||||
if( !(round(abs($obj->deb),2) === round(abs($obj->cred),2)) ){
|
||||
// echo $sql;
|
||||
// print_r($obj);
|
||||
$this->errors[] = 'Total not exacts '.round(abs($obj->deb),2).' vs '. round(abs($obj->cred),2);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$this->errors[] = 'Erreur sql'.$this->db->lasterror();;
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
// Update request
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
|
||||
$sql.= " lettering_code='".$lettre."'";
|
||||
$sql.= " , date_lettering = " .$now ; // todo correct date it's false
|
||||
$sql.= " WHERE rowid IN (".implode(',', $ids).") ";
|
||||
// echo $sql ;
|
||||
//
|
||||
// var_dump(__line__, $error);
|
||||
// print_r($this->errors);
|
||||
// exit;
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
// var_dump(__line__, $error);
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
// foreach($this->errors as $errmsg)
|
||||
// {
|
||||
// dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||
// $this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
// }
|
||||
$this->db->rollback();
|
||||
// echo $this->error;
|
||||
// var_dump(__line__, $error);
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -18,9 +18,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/customer/card.php
|
||||
* \ingroup Accountancy
|
||||
* \brief Card customer ventilation
|
||||
* \file htdocs/accountancy/customer/card.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Card customer ventilation
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -47,11 +47,11 @@ if ($user->societe_id > 0)
|
||||
if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
if (! GETPOST('cancel', 'alpha')) {
|
||||
if ($codeventil < 0) $codeventil = 0;
|
||||
|
||||
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
||||
$sql .= " SET fk_code_ventilation = " . $codeventil;
|
||||
$sql .= " WHERE rowid = " . $id;
|
||||
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql) {
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -21,9 +21,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/customer/index.php
|
||||
* \file htdocs/accountancy/customer/index.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Home customer ventilation
|
||||
* \brief Home customer journalization page
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
@ -40,7 +40,7 @@ $langs->load("accountancy");
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
@ -58,7 +58,7 @@ if ($year == 0) {
|
||||
}
|
||||
|
||||
// Validate History
|
||||
$action = GETPOST('action','alpha');
|
||||
$action = GETPOST('action','aZ09');
|
||||
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ if ($action == 'validatehistory') {
|
||||
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
||||
}
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
|
||||
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
@ -108,29 +108,6 @@ if ($action == 'validatehistory') {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||
}
|
||||
} elseif ($action == 'fixaccountancycode') {
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql1 .= " SET fk_code_ventilation = 0";
|
||||
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||
$sql1 .= ' (SELECT accnt.rowid ';
|
||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
$db->rollback();
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans('Done'), 'mesgs');
|
||||
}
|
||||
} elseif ($action == 'cleanaccountancycode') {
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
@ -144,7 +121,7 @@ if ($action == 'validatehistory') {
|
||||
$sql1.= " AND f.entity IN (" . getEntity('accountancy') . ")";
|
||||
$sql1.=")";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
dol_syslog("htdocs/accountancy/customer/index.php cleanaccountancycode", LOG_DEBUG);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
@ -169,13 +146,29 @@ $textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
|
||||
|
||||
print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
|
||||
|
||||
// Clean database
|
||||
$db->begin();
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql1 .= " SET fk_code_ventilation = 0";
|
||||
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||
$sql1 .= ' (SELECT accnt.rowid ';
|
||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
$db->rollback();
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
} else {
|
||||
$db->commit();
|
||||
}
|
||||
// End clean database
|
||||
|
||||
print $langs->trans("DescVentilCustomer") . '<br>';
|
||||
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||
print '<br>';
|
||||
//print '<div class="inline-block divButAction">';
|
||||
// TODO Remove this. Should be done into the repair.php script
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
||||
//print '</div>';
|
||||
|
||||
$sql = "SELECT count(*) FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " , " . MAIN_DB_PREFIX . "facture as f";
|
||||
@ -187,9 +180,9 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
} else {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||
}
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
|
||||
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$row = $db->fetch_row($result);
|
||||
@ -203,12 +196,9 @@ $buttonbind = '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' .
|
||||
$buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
|
||||
|
||||
|
||||
|
||||
|
||||
$var = true;
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
@ -217,8 +207,8 @@ for($i = 1; $i <= 12; $i ++) {
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') . " AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
@ -237,15 +227,27 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
}
|
||||
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
|
||||
dol_syslog('htdocs/accountancy/customer/index.php sql=' . $sql, LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
print '<tr class="oddeven"><td>';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("Unknown");
|
||||
}
|
||||
else print length_accountg($row[0]);
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
}
|
||||
else print $row[1];
|
||||
print '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
@ -258,25 +260,26 @@ if ($resql) {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') . " AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM(fd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
@ -293,127 +296,143 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND aa.account_number IS NOT NULL";
|
||||
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
|
||||
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right">' . price($row[13]) . '</td>';
|
||||
print '<td align="right"><b>' . price($row[14]) . '</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
print '<tr class="oddeven"><td>';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("Unknown");
|
||||
}
|
||||
else print length_accountg($row[0]);
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
}
|
||||
else print $row[1];
|
||||
print '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right">' . price($row[13]) . '</td>';
|
||||
print '<td align="right"><b>' . price($row[14]) . '</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ?
|
||||
{
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||
|
||||
print "<br>\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
print "<br>\n";
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT '" . $langs->trans("TotalVente") . "' AS total,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM(fd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
} else {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||
}
|
||||
$sql = "SELECT '" . $langs->trans("TotalVente") . "' AS total,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM(fd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
} else {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||
}
|
||||
|
||||
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
print '<tr><td>' . $row[0] . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
|
||||
print '</tr>';
|
||||
$i ++;
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
print '<tr><td>' . $row[0] . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
print "<br>\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT '" . $langs->trans("Vide") . "' AS marge,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, '(fd.total_ht-(fd.qty * fd.buy_price_ht))', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
} else {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||
}
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
print "<br>\n";
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
dol_syslog('htdocs/accountancy/customer/index.php:: $sql=' . $sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$sql = "SELECT '" . $langs->trans("Vide") . "' AS marge,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, '(fd.total_ht-(fd.qty * fd.buy_price_ht))', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
} else {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||
}
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<tr><td>' . $row[0] . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price(price2num($row[$i])) . '</td>';
|
||||
}
|
||||
print '<td align="right"><b>' . price(price2num($row[13])) . '</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr><td>' . $row[0] . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price(price2num($row[$i])) . '</td>';
|
||||
}
|
||||
print '<td align="right"><b>' . price(price2num($row[13])) . '</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ $formaccounting = new FormAccounting($db);
|
||||
*/
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_lineid = '';
|
||||
$search_ref = '';
|
||||
@ -130,6 +130,8 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('', $langs->trans("CustomersVentilation") . ' - ' . $langs->trans("Dispatched"));
|
||||
|
||||
print '<script type="text/javascript">
|
||||
@ -153,7 +155,7 @@ print '<script type="text/javascript">
|
||||
* Customer Invoice lines
|
||||
*/
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,";
|
||||
$sql .= " fd.rowid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,";
|
||||
$sql .= " fd.rowid, fd.description, fd.product_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 .= " p.rowid as product_id, 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 .= " fd.situation_percent, co.label as country, s.tva_intra";
|
||||
@ -270,9 +272,9 @@ if ($result) {
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="right flat maxwidth50" placeholder="%" name="search_vat" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" placeholder="%" name="search_vat" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tavintra" value="' . dol_escape_htmltag($search_tavintra) . '"></td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
@ -280,17 +282,17 @@ if ($result) {
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.facnumber, fd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $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("Date", $_SERVER["PHP_SELF"], "f.datef, f.facnumber, fd.rowid", "", $param, 'align="center"', $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("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
||||
$clickpicto=$form->showCheckAddButtons();
|
||||
print_liste_field_titre($clickpicto, '', '', '', '', 'align="center"');
|
||||
print "</tr>\n";
|
||||
@ -332,14 +334,14 @@ if ($result) {
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||
print '<td align="center">' . price($objp->tva_tx) . '</td>';
|
||||
print '<td>';
|
||||
print '<td align="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||
print '<td align="center">';
|
||||
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
|
||||
print img_edit();
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
|
||||
print '<td>' . $objp->country .'</td>';
|
||||
print '<td align="center">' . $objp->country .'</td>';
|
||||
|
||||
print '<td>' . $objp->tva_intra . '</td>';
|
||||
|
||||
|
||||
@ -33,6 +33,8 @@ require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("compta");
|
||||
@ -60,6 +62,10 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
$search_vat = GETPOST('search_vat', 'alpha');
|
||||
$search_day=GETPOST("search_day","int");
|
||||
$search_month=GETPOST("search_month","int");
|
||||
$search_year=GETPOST("search_year","int");
|
||||
|
||||
$btn_ventil = GETPOST('ventil', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
@ -95,11 +101,11 @@ $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOU
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_lineid = '';
|
||||
$search_ref = '';
|
||||
@ -109,6 +115,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
$search_amount = '';
|
||||
$search_account = '';
|
||||
$search_vat = '';
|
||||
$search_month = '';
|
||||
$search_year = '';
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
@ -174,12 +182,13 @@ if ($massaction == 'ventil') {
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
llxHeader('', $langs->trans("Ventilation"));
|
||||
|
||||
// Customer Invoice lines
|
||||
$sql = "SELECT f.facnumber, f.rowid as facid, 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,";
|
||||
$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 .= " aa.rowid as aarowid";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
|
||||
@ -189,7 +198,8 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accounta
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||
$sql .= " AND product_type <= 2";
|
||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')";
|
||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='' OR p.accountancy_code_sell NOT IN
|
||||
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid ='" . $conf->global->CHARTOFACCOUNTS . "'))";
|
||||
// Add search filter like
|
||||
if ($search_lineid) {
|
||||
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
||||
@ -215,6 +225,19 @@ if (strlen(trim($search_account))) {
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= natural_search("l.tva_tx",$search_vat,1);
|
||||
}
|
||||
if ($search_month > 0)
|
||||
{
|
||||
if ($search_year > 0 && empty($search_day))
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
|
||||
else if ($search_year > 0 && ! empty($search_day))
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
|
||||
else
|
||||
$sql.= " AND date_format(f.datef, '%m') = '".$db->escape($search_month)."'";
|
||||
}
|
||||
else if ($search_year > 0)
|
||||
{
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||
}
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
} else {
|
||||
@ -245,6 +268,15 @@ if ($result) {
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
|
||||
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||
if ($search_year) $param.='&search_year='.urlencode($search_year);
|
||||
if ($search_invoice) $param.='&search_invoice='.urlencode($search_invoice);
|
||||
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
||||
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
||||
if ($search_amount) $param.='&search_amount='.urlencode($search_amount);
|
||||
if ($search_vat) $param.='&search_vat='.urlencode($search_vat);
|
||||
|
||||
$arrayofmassactions = array(
|
||||
'ventil'=>$langs->trans("Ventilate")
|
||||
@ -279,7 +311,11 @@ if ($result) {
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
@ -294,16 +330,16 @@ if ($result) {
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.facnumber, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
|
||||
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("Date", $_SERVER["PHP_SELF"], "f.datef, f.facnumber, l.rowid", "", $param, 'align="center"', $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("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"');
|
||||
$checkpicto='';
|
||||
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
|
||||
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
||||
@ -387,7 +423,7 @@ if ($result) {
|
||||
if ($objp->vat_tx_l != $objp->vat_tx_p)
|
||||
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
||||
print '<td style="' . $code_vat_differ . '" align="right">';
|
||||
print price($objp->tva_tx_line);
|
||||
print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''));
|
||||
print '</td>';
|
||||
|
||||
// Current account
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
*/
|
||||
/**
|
||||
* \file htdocs/accountancy/supplier/card.php
|
||||
* \ingroup Accountancy
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Card expense report ventilation
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
@ -56,7 +56,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "expensereport_det";
|
||||
$sql .= " SET fk_code_ventilation = " . $codeventil;
|
||||
$sql .= " WHERE rowid = " . $id;
|
||||
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql) {
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
|
||||
@ -69,7 +69,7 @@ if ($action == 'validatehistory') {
|
||||
|
||||
// First clean corrupted data
|
||||
$sqlclean = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||
$sqlclean .= " SET erd.fk_code_ventilation = 0";
|
||||
$sqlclean .= " SET fk_code_ventilation = 0";
|
||||
$sqlclean .= ' WHERE erd.fk_code_ventilation NOT IN ';
|
||||
$sqlclean .= ' (SELECT accnt.rowid ';
|
||||
$sqlclean .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||
@ -93,6 +93,8 @@ if ($action == 'validatehistory') {
|
||||
$sql1 .= " AND erd.fk_code_ventilation = 0";
|
||||
}
|
||||
|
||||
dol_syslog('htdocs/accountancy/expensereport/index.php');
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
@ -102,42 +104,20 @@ if ($action == 'validatehistory') {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||
}
|
||||
} elseif ($action == 'fixaccountancycode') {
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||
$sql1 .= " SET erd.fk_code_ventilation = 0";
|
||||
$sql1 .= ' WHERE erd.fk_code_ventilation NOT IN ';
|
||||
$sql1 .= ' (SELECT accnt.rowid ';
|
||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
$db->rollback();
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans('Done'), 'mesgs');
|
||||
}
|
||||
} elseif ($action == 'cleanaccountancycode') {
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
// Now clean
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||
$sql1.= " SET erd.fk_code_ventilation = 0";
|
||||
$sql1.= " SET fk_code_ventilation = 0";
|
||||
$sql1.= " WHERE erd.fk_expensereport IN ( SELECT er.rowid FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
||||
$sql1.= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
|
||||
$sql1.= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
|
||||
$sql1.= " AND er.entity IN (" . getEntity('accountancy') . ")";
|
||||
$sql1.=")";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php cleanaccountancycode", LOG_DEBUG);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
@ -165,41 +145,51 @@ print $langs->trans("DescVentilExpenseReport") . '<br>';
|
||||
print $langs->trans("DescVentilExpenseReportMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||
print '<br>';
|
||||
|
||||
//print '<div class="inline-block divButAction">';
|
||||
// TODO Remove this. Should be done always.
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
||||
//print '</div>';
|
||||
// Clean database
|
||||
$db->begin();
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||
$sql1 .= " SET fk_code_ventilation = 0";
|
||||
$sql1 .= ' WHERE erd.fk_code_ventilation NOT IN ';
|
||||
$sql1 .= ' (SELECT accnt.rowid ';
|
||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
$db->rollback();
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
} else {
|
||||
$db->commit();
|
||||
}
|
||||
// End clean database
|
||||
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
$buttonbind = '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
|
||||
$buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
|
||||
|
||||
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
$var = true;
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200" align="left">' . $langs->trans("Account") . '</td>';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " ROUND(SUM(erd.total_ht),2) as total";
|
||||
$sql .= " SUM(erd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
|
||||
@ -217,9 +207,21 @@ if ($resql) {
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("Unknown");
|
||||
}
|
||||
else print length_accountg($row[0]);
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
}
|
||||
else print $row[1];
|
||||
print '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right">' . price($row[13]) . '</td>';
|
||||
@ -231,7 +233,7 @@ if ($resql) {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
@ -239,16 +241,17 @@ print '<br>';
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
||||
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200" align="left">' . $langs->trans("Account") . '</td>';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
@ -263,16 +266,28 @@ $sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We d
|
||||
$sql .= " AND aa.account_number IS NOT NULL";
|
||||
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
|
||||
dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql);
|
||||
dol_syslog('htdocs/accountancy/expensereport/index.php');
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("Unknown");
|
||||
}
|
||||
else print length_accountg($row[0]);
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
}
|
||||
else print $row[1];
|
||||
print '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right">' . price($row[13]) . '</td>';
|
||||
@ -284,7 +299,7 @@ if ($resql) {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
||||
@ -292,37 +307,36 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
{
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||
|
||||
|
||||
print "<br>\n";
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
|
||||
$sql = "SELECT '" . $langs->trans("TotalExpenseReport") . "' AS label,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_create)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " ROUND(SUM(erd.total_ht),2) as total";
|
||||
$sql .= " SUM(erd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
|
||||
$sql .= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND er.fk_statut > 0 ";
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql);
|
||||
|
||||
dol_syslog('htdocs/accountancy/expensereport/index.php');
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
|
||||
print '<tr><td>' . $row[0] . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
@ -330,12 +344,13 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -82,7 +82,7 @@ $formaccounting = new FormAccounting($db);
|
||||
*/
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_expensereport = '';
|
||||
$search_label = '';
|
||||
@ -146,7 +146,7 @@ print '<script type="text/javascript">
|
||||
* Expense reports lines
|
||||
*/
|
||||
$sql = "SELECT er.ref, er.rowid as erid,";
|
||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht, erd.fk_code_ventilation, erd.tva_tx, erd.date,";
|
||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht, erd.fk_code_ventilation, erd.tva_tx, erd.vat_src_code, erd.date,";
|
||||
$sql .= " aa.label, aa.account_number,";
|
||||
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
||||
@ -241,8 +241,8 @@ if ($result) {
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="right flat maxwidth50" name="search_vat" size="1" placeholder="%" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="right flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_vat" size="1" placeholder="%" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"></td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
@ -251,14 +251,14 @@ if ($result) {
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("ExpenseReport"), $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("TypeFees"), $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("TypeFees", $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('');
|
||||
$checkpicto=$form->showCheckAddButtons();
|
||||
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
||||
@ -293,7 +293,7 @@ if ($result) {
|
||||
|
||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||
|
||||
print '<td align="center">' . price($objp->tva_tx) . '</td>';
|
||||
print '<td align="center">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||
|
||||
print '<td>' . $codeCompta . '</td>';
|
||||
|
||||
|
||||
@ -32,6 +32,8 @@ require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("compta");
|
||||
@ -58,6 +60,10 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
$search_vat = GETPOST('search_vat', 'alpha');
|
||||
$search_day=GETPOST("search_day","int");
|
||||
$search_month=GETPOST("search_month","int");
|
||||
$search_year=GETPOST("search_year","int");
|
||||
|
||||
$btn_ventil = GETPOST('ventil', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
@ -91,11 +97,11 @@ $accounting = new AccountingAccount($db);
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_expensereport = '';
|
||||
$search_label = '';
|
||||
@ -103,6 +109,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
$search_amount = '';
|
||||
$search_account = '';
|
||||
$search_vat = '';
|
||||
$search_month = '';
|
||||
$search_year = '';
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
@ -169,12 +177,13 @@ if ($massaction == 'ventil') {
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
||||
|
||||
// Expense report lines
|
||||
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut,";
|
||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.date,";
|
||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.vat_src_code, erd.date,";
|
||||
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,";
|
||||
$sql .= " aa.rowid as aarowid";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
||||
@ -203,6 +212,19 @@ if (strlen(trim($search_account))) {
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= natural_search("erd.tva_tx",$search_vat,1);
|
||||
}
|
||||
if ($search_month > 0)
|
||||
{
|
||||
if ($search_year > 0 && empty($search_day))
|
||||
$sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
|
||||
else if ($search_year > 0 && ! empty($search_day))
|
||||
$sql.= " AND erd.date BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
|
||||
else
|
||||
$sql.= " AND date_format(erd.date, '%m') = '".$db->escape($search_month)."'";
|
||||
}
|
||||
else if ($search_year > 0)
|
||||
{
|
||||
$sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||
}
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
@ -228,6 +250,15 @@ if ($result) {
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
|
||||
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||
if ($search_year) $param.='&search_year='.urlencode($search_year);
|
||||
if ($search_expensereport) $param.='&search_expensereport='.urlencode($search_expensereport);
|
||||
if ($search_label) $param.='&search_label='.urlencode($search_label);
|
||||
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
||||
if ($search_amount) $param.='&search_amount='.urlencode($search_amount);
|
||||
if ($search_vat) $param.='&search_vat='.urlencode($search_vat);
|
||||
|
||||
$arrayofmassactions = array(
|
||||
'ventil'=>$langs->trans("Ventilate")
|
||||
@ -263,7 +294,11 @@ if ($result) {
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_expensereport" value="' . dol_escape_htmltag($search_expensereport) . '"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||
@ -277,15 +312,15 @@ if ($result) {
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("ExpenseReport"), $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("TypeFees"), $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("TypeFees", $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"', $sortfield, $sortorder);
|
||||
$checkpicto='';
|
||||
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
|
||||
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
||||
@ -313,6 +348,7 @@ if ($result) {
|
||||
// Ref Expense report
|
||||
print '<td>' . $expensereport_static->getNomUrl(1) . '</td>';
|
||||
|
||||
// Date
|
||||
print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
|
||||
|
||||
// Fees label
|
||||
@ -333,7 +369,7 @@ if ($result) {
|
||||
|
||||
// Vat rate
|
||||
print '<td align="right">';
|
||||
print price($objp->tva_tx_line);
|
||||
print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''));
|
||||
print '</td>';
|
||||
|
||||
// Current account
|
||||
|
||||
@ -72,13 +72,13 @@ print "<br>\n";
|
||||
|
||||
// STEPS
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("AccountingJournals").'</strong>');
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("AccountingJournals").'</strong>');
|
||||
print "<br>\n";
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").'</strong>');
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").'</strong>');
|
||||
print "<br>\n";
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").'</strong>');
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").'</strong>');
|
||||
print "<br>\n";
|
||||
|
||||
print "<br>\n";
|
||||
@ -87,15 +87,20 @@ print "<br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>')."\n";
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>';
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong>')."\n";
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>';
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
|
||||
print "<br>\n";
|
||||
if (! empty($conf->tax->enabled))
|
||||
{
|
||||
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong>';
|
||||
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong>';
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
|
||||
print "<br>\n";
|
||||
@ -111,31 +116,29 @@ if (! empty($conf->tax->enabled))
|
||||
if (! empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
|
||||
{
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong>');
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong>');
|
||||
print "<br>\n";
|
||||
}
|
||||
/*
|
||||
if (! empty($conf->loan->enabled))
|
||||
{
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").'-'.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").'-'.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
print "<br>\n";
|
||||
}
|
||||
if (! empty($conf->don->enabled))
|
||||
{
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDonationAccounts").'</strong>');
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDonationAccounts").'</strong>');
|
||||
print "<br>\n";
|
||||
}*/
|
||||
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").'</strong>');
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").'</strong>');
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
$textlink='<strong>'.$langs->transnoentitiesnoconv("MenuBankCash").'</strong>';
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, $textlink);
|
||||
print "<br>\n";
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print "<br>\n";
|
||||
@ -147,15 +150,15 @@ $step = 0;
|
||||
$langs->loadLangs(array('bills', 'trips'));
|
||||
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>')."\n";
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>')."\n";
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>')."\n";
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>')."\n";
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>')."\n";
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>')."\n";
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
@ -36,12 +36,7 @@ require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
$langs->load("other");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
$langs->load("trips");
|
||||
$langs->loadLangs(array("commercial", "compta","bills","other","accountancy","trips","errors"));
|
||||
|
||||
$id_journal = GETPOST('id_journal', 'int');
|
||||
$action = GETPOST('action','aZ09');
|
||||
@ -52,6 +47,8 @@ $date_startyear = GETPOST('date_startyear');
|
||||
$date_endmonth = GETPOST('date_endmonth');
|
||||
$date_endday = GETPOST('date_endday');
|
||||
$date_endyear = GETPOST('date_endyear');
|
||||
$in_bookkeeping = GETPOST('in_bookkeeping');
|
||||
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
@ -89,7 +86,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
$idpays = $mysoc->country_id;
|
||||
|
||||
$sql = "SELECT er.rowid, er.ref, er.date_debut as de,";
|
||||
$sql .= " erd.rowid as erdid, erd.comments, erd.total_ttc, erd.tva_tx, erd.total_ht, erd.total_tva, erd.fk_code_ventilation, erd.vat_src_code, ";
|
||||
$sql .= " erd.rowid as erdid, erd.comments, erd.total_ht, erd.total_tva, erd.total_localtax1, erd.total_localtax2, erd.tva_tx, erd.total_ttc, erd.fk_code_ventilation, erd.vat_src_code, ";
|
||||
$sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_account,";
|
||||
$sql .= " f.accountancy_code, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||
//$sql .= " ct.accountancy_code_buy as account_tva";
|
||||
@ -104,24 +101,31 @@ $sql .= " AND erd.fk_code_ventilation > 0";
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||
if ($date_start && $date_end)
|
||||
$sql .= " AND er.date_debut >= '" . $db->idate($date_start) . "' AND er.date_debut <= '" . $db->idate($date_end) . "'";
|
||||
if ($in_bookkeeping == 'already')
|
||||
$sql .= " AND er.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
|
||||
if ($in_bookkeeping == 'notyet')
|
||||
$sql .= " AND er.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
|
||||
$sql .= " ORDER BY er.date_debut";
|
||||
|
||||
dol_syslog('accountancy/journal/expensereportsjournal.php:: $sql=' . $sql);
|
||||
dol_syslog('accountancy/journal/expensereportsjournal.php', LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
// Variables
|
||||
$account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT)) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef");
|
||||
$account_vat = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
|
||||
$taber = array ();
|
||||
$tabht = array ();
|
||||
$tabtva = array ();
|
||||
$def_tva = array ();
|
||||
$tabttc = array ();
|
||||
$tablocaltax1 = array ();
|
||||
$tablocaltax2 = array ();
|
||||
$tabuser = array ();
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
// Variables
|
||||
$account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT)) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined';
|
||||
$account_vat = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined';
|
||||
|
||||
$i = 0;
|
||||
while ( $i < $num ) {
|
||||
$obj = $db->fetch_object($result);
|
||||
@ -132,6 +136,8 @@ if ($result) {
|
||||
|
||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||
$compta_tva = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $account_vat);
|
||||
$compta_localtax1 = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
$compta_localtax2 = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
|
||||
// Define array to display all VAT rates that use this accounting account $compta_tva
|
||||
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
||||
@ -143,9 +149,19 @@ if ($result) {
|
||||
$taber[$obj->rowid]["ref"] = $obj->ref;
|
||||
$taber[$obj->rowid]["comments"] = $obj->comments;
|
||||
$taber[$obj->rowid]["fk_expensereportdet"] = $obj->erdid;
|
||||
|
||||
// Avoid warnings
|
||||
if (! isset($tabttc[$obj->rowid][$compta_user])) $tabttc[$obj->rowid][$compta_user] = 0;
|
||||
if (! isset($tabht[$obj->rowid][$compta_fees])) $tabht[$obj->rowid][$compta_fees] = 0;
|
||||
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
||||
if (! isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0;
|
||||
if (! isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
|
||||
|
||||
$tabttc[$obj->rowid][$compta_user] += $obj->total_ttc;
|
||||
$tabht[$obj->rowid][$compta_fees] += $obj->total_ht;
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
|
||||
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2;
|
||||
$tabuser[$obj->rowid] = array (
|
||||
'id' => $obj->uid,
|
||||
'name' => dolGetFirstLastname($obj->firstname, $obj->lastname),
|
||||
@ -163,7 +179,7 @@ if ($action == 'writebookkeeping') {
|
||||
$now = dol_now();
|
||||
$error = 0;
|
||||
|
||||
foreach ($taber as $key => $val)
|
||||
foreach ($taber as $key => $val) // Loop on each expense report
|
||||
{
|
||||
$errorforline = 0;
|
||||
|
||||
@ -174,7 +190,6 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
// get compte id and label
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
@ -184,11 +199,11 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||
$bookkeeping->subledger_account = $tabuser[$key]['user_accountancy_code'];
|
||||
$bookkeeping->subledger_label = $tabuser[$key]['user_accountancy_code'];
|
||||
$bookkeeping->label_operation = $tabuser[$key]['name'];
|
||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
$bookkeeping->label_operation = $tabuser[$key]['name'];
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt <= 0) ? $mt : 0;
|
||||
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
|
||||
$bookkeeping->credit = ($mt > 0) ? $mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $journal_label;
|
||||
@ -200,7 +215,7 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -217,8 +232,6 @@ if ($action == 'writebookkeeping') {
|
||||
if (! $errorforline)
|
||||
{
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
if ($mt) {
|
||||
// get compte id and label
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
@ -232,8 +245,8 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->label_operation = $accountingaccount->label;
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_operation = $accountingaccount->label;
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||
@ -248,7 +261,7 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -265,9 +278,15 @@ if ($action == 'writebookkeeping') {
|
||||
// VAT
|
||||
if (! $errorforline)
|
||||
{
|
||||
// var_dump($tabtva);
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
$listoftax=array(0, 1, 2);
|
||||
foreach($listoftax as $numtax)
|
||||
{
|
||||
$arrayofvat = $tabtva;
|
||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||
|
||||
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
// get compte id and label
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
@ -278,8 +297,8 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||
@ -294,7 +313,7 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -303,6 +322,7 @@ if ($action == 'writebookkeeping') {
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -323,7 +343,7 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($error) && count($tabpay)) {
|
||||
if (empty($error) && count($tabpay) > 0) {
|
||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||
}
|
||||
elseif (count($tabpay) == $error)
|
||||
@ -336,6 +356,21 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
|
||||
$action='';
|
||||
|
||||
// Must reload data, so we make a redirect
|
||||
if (count($tabpay) != $error)
|
||||
{
|
||||
$param='id_journal='.$id_journal;
|
||||
$param.='&date_startday='.$date_startday;
|
||||
$param.='&date_startmonth='.$date_startmonth;
|
||||
$param.='&date_startyear='.$date_startyear;
|
||||
$param.='&date_endday='.$date_endday;
|
||||
$param.='&date_endmonth='.$date_endmonth;
|
||||
$param.='&date_endyear='.$date_endyear;
|
||||
$param.='&in_bookeeping='.$in_bookeeping;
|
||||
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -347,7 +382,7 @@ $form = new Form($db);
|
||||
$userstatic = new User($db);
|
||||
|
||||
// Export
|
||||
/*if ($action == 'export_csv') {
|
||||
/*if ($action == 'exportcsv') {
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
@ -463,29 +498,36 @@ if (empty($action) || $action == 'view') {
|
||||
$nomlink = '';
|
||||
$periodlink = '';
|
||||
$exportlink = '';
|
||||
$builddate = time();
|
||||
$builddate=dol_now();
|
||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
|
||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
|
||||
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||
|
||||
$varlink = 'id_journal=' . $id_journal;
|
||||
|
||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
/*if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
||||
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
||||
} else {
|
||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
}*/
|
||||
|
||||
// Button to write into Ledger
|
||||
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
||||
print '<br>'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
}
|
||||
print '<div class="tabsAction tabsActionNoBottom">';
|
||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||
}
|
||||
else {
|
||||
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
}
|
||||
//print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
print '</div>';
|
||||
|
||||
// TODO Avoid using js. We can use a direct link with $param
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
function launch_export() {
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("exportcsv");
|
||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||
}
|
||||
@ -502,12 +544,14 @@ if (empty($action) || $action == 'view') {
|
||||
print '<br>';
|
||||
|
||||
$i = 0;
|
||||
print '<div class="div-table-responsive">';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print "<td></td>";
|
||||
print "<td>" . $langs->trans("Date") . "</td>";
|
||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ExpenseReportRef") . ")</td>";
|
||||
print "<td>" . $langs->trans("Account") . "</td>";
|
||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||
print "<td>" . $langs->trans("Label") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||
@ -537,6 +581,7 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
||||
$userstatic->id = $tabuser[$key]['id'];
|
||||
$userstatic->name = $tabuser[$key]['name'];
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
@ -544,7 +589,10 @@ if (empty($action) || $action == 'view') {
|
||||
print '<span class="error">'.$langs->trans("FeeAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
print '</td>';
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
$userstatic->id = $tabuser[$key]['id'];
|
||||
$userstatic->name = $tabuser[$key]['name'];
|
||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $accountingaccount->label . "</td>";
|
||||
@ -554,28 +602,6 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
}
|
||||
|
||||
// VAT
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<td><!-- VAT --></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("VatAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]). "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
|
||||
// Third party
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print '<tr class="oddeven">';
|
||||
@ -584,22 +610,67 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
||||
$userstatic->id = $tabuser[$key]['id'];
|
||||
$userstatic->name = $tabuser[$key]['name'];
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accounta($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("MainAccountForUsersNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
$accountoshow = length_accounta($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||
print '<span class="error">'.$langs->trans("UserAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("subledger_account") . "</td>";
|
||||
print '</td>';
|
||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
// VAT
|
||||
$listoftax = array(0, 1, 2);
|
||||
foreach ($listoftax as $numtax) {
|
||||
$arrayofvat = $tabtva;
|
||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||
|
||||
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<td><!-- VAT --></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).($numtax?' - Localtax '.$numtax:'');
|
||||
print "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
@ -36,11 +36,7 @@ require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
$langs->load("other");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
$langs->loadLangs(array("commercial", "compta","bills","other","accountancy","errors"));
|
||||
|
||||
$id_journal = GETPOST('id_journal', 'int');
|
||||
$action = GETPOST('action','aZ09');
|
||||
@ -51,6 +47,8 @@ $date_startyear = GETPOST('date_startyear');
|
||||
$date_endmonth = GETPOST('date_endmonth');
|
||||
$date_endday = GETPOST('date_endday');
|
||||
$date_endyear = GETPOST('date_endyear');
|
||||
$in_bookkeeping = GETPOST('in_bookkeeping');
|
||||
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
@ -87,8 +85,8 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
|
||||
$idpays = $mysoc->country_id;
|
||||
|
||||
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type, fd.vat_src_code,";
|
||||
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, ";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
||||
$sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||
//$sql .= " ct.accountancy_code_buy as account_tva";
|
||||
@ -108,24 +106,30 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
}
|
||||
if ($date_start && $date_end)
|
||||
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
||||
if ($in_bookkeeping == 'already')
|
||||
$sql .= " AND f.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
|
||||
if ($in_bookkeeping == 'notyet')
|
||||
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
|
||||
$sql .= " ORDER BY f.datef";
|
||||
|
||||
dol_syslog('accountancy/journal/purchasesjournal.php:: $sql=' . $sql);
|
||||
dol_syslog('accountancy/journal/purchasesjournal.php', LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
// Variables
|
||||
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef");
|
||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
|
||||
$tabfac = array ();
|
||||
$tabht = array ();
|
||||
$tabtva = array ();
|
||||
$def_tva = array ();
|
||||
$tabttc = array ();
|
||||
$tablocaltax1 = array ();
|
||||
$tablocaltax2 = array ();
|
||||
$tabcompany = array ();
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
// Variables
|
||||
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined';
|
||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined';
|
||||
|
||||
$i = 0;
|
||||
while ( $i < $num ) {
|
||||
$obj = $db->fetch_object($result);
|
||||
@ -136,9 +140,9 @@ if ($result) {
|
||||
$compta_prod = $obj->compte;
|
||||
if (empty($compta_prod)) {
|
||||
if ($obj->product_type == 0)
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : 'NotDefined';
|
||||
else
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : 'NotDefined';
|
||||
}
|
||||
|
||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||
@ -151,6 +155,7 @@ if ($result) {
|
||||
}
|
||||
|
||||
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
|
||||
$tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr);
|
||||
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')';
|
||||
$tabfac[$obj->rowid]["refsologest"] = $obj->ref;
|
||||
$tabfac[$obj->rowid]["refsuppliersologest"] = $obj->ref_supplier;
|
||||
@ -163,10 +168,14 @@ if ($result) {
|
||||
if (! isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc] = 0;
|
||||
if (! isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod] = 0;
|
||||
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
||||
if (! isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0;
|
||||
if (! isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
|
||||
|
||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
|
||||
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2;
|
||||
$tabcompany[$obj->rowid] = array (
|
||||
'id' => $obj->socid,
|
||||
'name' => $obj->name,
|
||||
@ -185,8 +194,7 @@ if ($action == 'writebookkeeping') {
|
||||
$now = dol_now();
|
||||
$error = 0;
|
||||
|
||||
foreach ($tabfac as $key => $val) // Loop on each invoice
|
||||
{
|
||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||
$errorforline = 0;
|
||||
|
||||
$db->begin();
|
||||
@ -194,12 +202,6 @@ if ($action == 'writebookkeeping') {
|
||||
$companystatic = new Societe($db);
|
||||
$invoicestatic = new FactureFournisseur($db);
|
||||
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = (string) $val["refsologest"];
|
||||
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
||||
$invoicestatic->type = $val["type"];
|
||||
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
||||
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
|
||||
@ -208,6 +210,12 @@ if ($action == 'writebookkeeping') {
|
||||
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = (string) $val["refsologest"];
|
||||
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
||||
$invoicestatic->type = $val["type"];
|
||||
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
||||
|
||||
// Thirdparty
|
||||
if (! $errorforline)
|
||||
{
|
||||
@ -215,6 +223,7 @@ if ($action == 'writebookkeeping') {
|
||||
if ($mt) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->date_create = $now;
|
||||
$bookkeeping->doc_type = 'supplier_invoice';
|
||||
@ -223,11 +232,11 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
|
||||
$bookkeeping->subledger_label = ''; // TODO To complete
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("subledger_account");
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("SubledgerAccount");
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt <= 0) ? $mt : 0;
|
||||
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
|
||||
$bookkeeping->credit = ($mt > 0) ? $mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $journal_label;
|
||||
@ -239,7 +248,7 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -256,28 +265,27 @@ if ($action == 'writebookkeeping') {
|
||||
if (! $errorforline)
|
||||
{
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
if ($mt) {
|
||||
// get compte id and label
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
if ($accountingaccount->fetch(null, $k, true)) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->date_create = $now;
|
||||
$bookkeeping->doc_type = 'supplier_invoice';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label;
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label;
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||
$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
|
||||
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $journal_label;
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
@ -288,7 +296,7 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -306,11 +314,18 @@ if ($action == 'writebookkeeping') {
|
||||
// var_dump($tabtva);
|
||||
if (! $errorforline)
|
||||
{
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
$listoftax=array(0, 1, 2);
|
||||
foreach($listoftax as $numtax)
|
||||
{
|
||||
$arrayofvat = $tabtva;
|
||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||
|
||||
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
// get compte id and label
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->date_create = $now;
|
||||
$bookkeeping->doc_type = 'supplier_invoice';
|
||||
@ -319,12 +334,12 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'');
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||
$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
|
||||
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $journal_label;
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
@ -335,7 +350,7 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -347,6 +362,7 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $errorforline)
|
||||
{
|
||||
@ -364,7 +380,7 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($error) && count($tabpay)) {
|
||||
if (empty($error) && count($tabpay) > 0) {
|
||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||
}
|
||||
elseif (count($tabpay) == $error)
|
||||
@ -375,7 +391,23 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
|
||||
}
|
||||
|
||||
$action='';
|
||||
|
||||
// Must reload data, so we make a redirect
|
||||
if (count($tabpay) != $error)
|
||||
{
|
||||
$param='id_journal='.$id_journal;
|
||||
$param.='&date_startday='.$date_startday;
|
||||
$param.='&date_startmonth='.$date_startmonth;
|
||||
$param.='&date_startyear='.$date_startyear;
|
||||
$param.='&date_endday='.$date_endday;
|
||||
$param.='&date_endmonth='.$date_endmonth;
|
||||
$param.='&date_endyear='.$date_endyear;
|
||||
$param.='&in_bookeeping='.$in_bookeeping;
|
||||
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -384,128 +416,95 @@ if ($action == 'writebookkeeping') {
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$companystatic = new Fournisseur($db);
|
||||
|
||||
// Export
|
||||
/*if ($action == 'export_csv') {
|
||||
if ($action == 'exportcsv') {
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
// Model Cegid Expert Export
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
|
||||
$sep = ";";
|
||||
$companystatic = new Fournisseur($db);
|
||||
$invoicestatic = new FactureFournisseur($db);
|
||||
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
$date = dol_print_date($val["date"], '%d%m%Y');
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
|
||||
if ($mt) {
|
||||
print $date . $sep;
|
||||
print $purchase_journal . $sep;
|
||||
print length_accountg(html_entity_decode($k)) . $sep;
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'C' : 'D') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print dol_trunc($val["description"], 32) . $sep;
|
||||
print $val["ref"];
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// VAT
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print $date . $sep;
|
||||
print $purchase_journal . $sep;
|
||||
print length_accountg(html_entity_decode($k)) . $sep;
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'C' : 'D') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print $langs->trans("VAT") . $sep;
|
||||
print $val["ref"];
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print $date . $sep;
|
||||
print $purchase_journal . $sep;
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
|
||||
print length_accounta(html_entity_decode($k)) . $sep;
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print $companystatic->name . $sep;
|
||||
print $val["ref"];
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
|
||||
// Model Classic Export
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
foreach ( $tabfac as $key => $val )
|
||||
{
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["ref"];
|
||||
$invoicestatic->ref = $val["refsologest"];
|
||||
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
||||
$invoicestatic->type = $val["type"];
|
||||
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
||||
$invoicestatic->description = dol_trunc($val["description"], 32);
|
||||
|
||||
$date = dol_print_date($val["date"], 'day');
|
||||
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
// Third party
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep;
|
||||
print '"' . $journal . '"' ;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
// print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($accountingaccount->label, 32) ) . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
||||
print '"' . $journal . '"' ;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
// VAT
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
$listoftax = array(0, 1, 2);
|
||||
foreach ($listoftax as $numtax) {
|
||||
$arrayofvat = $tabtva;
|
||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||
|
||||
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
// print '"' . $langs->trans("VAT") . '"' . $sep;
|
||||
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key] . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
||||
print '"' . $journal . '"' ;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Third party
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("subledger_account") . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (empty($action) || $action == 'view') {
|
||||
|
||||
@ -515,8 +514,7 @@ if (empty($action) || $action == 'view') {
|
||||
$nomlink = '';
|
||||
$periodlink = '';
|
||||
$exportlink = '';
|
||||
$builddate = time();
|
||||
//$description = $langs->trans("DescPurchasesJournal") . '<br>';
|
||||
$builddate=dol_now();
|
||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$description .= $langs->trans("DepositsAreNotIncluded");
|
||||
@ -524,43 +522,40 @@ if (empty($action) || $action == 'view') {
|
||||
$description .= $langs->trans("DepositsAreIncluded");
|
||||
}
|
||||
|
||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
|
||||
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||
|
||||
$varlink = 'id_journal=' . $id_journal;
|
||||
|
||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
/*if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
||||
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
||||
} else {
|
||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
}*/
|
||||
|
||||
// Button to write into Ledger
|
||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
||||
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
}
|
||||
print '<div class="tabsAction tabsActionNoBottom">';
|
||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||
}
|
||||
else {
|
||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
}
|
||||
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
print '</div>';
|
||||
|
||||
// TODO Avoid using js. We can use a direct link with $param
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
function launch_export() {
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
|
||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||
$("div.fiche form input[name=\"action\"]").val("exportcsv");
|
||||
$("div.fiche form input[type=\"submit\"]").click();
|
||||
$("div.fiche form input[name=\"action\"]").val("");
|
||||
}
|
||||
function writebookkeeping() {
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("writebookkeeping");
|
||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||
$("div.fiche form input[name=\"action\"]").val("writebookkeeping");
|
||||
$("div.fiche form input[type=\"submit\"]").click();
|
||||
$("div.fiche form input[name=\"action\"]").val("");
|
||||
}
|
||||
</script>';
|
||||
|
||||
@ -570,13 +565,15 @@ if (empty($action) || $action == 'view') {
|
||||
print '<br>';
|
||||
|
||||
$i = 0;
|
||||
print '<div class="div-table-responsive">';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print "<td></td>";
|
||||
print "<td>" . $langs->trans("Date") . "</td>";
|
||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||
print "<td>" . $langs->trans("Type") . "</td>";
|
||||
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||
print "<td>" . $langs->trans("Label") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||
print "</tr>\n";
|
||||
@ -584,19 +581,52 @@ if (empty($action) || $action == 'view') {
|
||||
$r = '';
|
||||
|
||||
$invoicestatic = new FactureFournisseur($db);
|
||||
$companystatic = new Fournisseur($db);
|
||||
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["ref"];
|
||||
$invoicestatic->type = $val["type"];
|
||||
|
||||
$invoicestatic->ref = $val["refsologest"];
|
||||
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
||||
|
||||
$invoicestatic->type = $val["type"];
|
||||
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
||||
|
||||
$date = dol_print_date($val["date"], 'day');
|
||||
|
||||
// Third party
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<td><!-- Thirdparty --></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->supplier_code = $tabcompany[$key]['code_supplier'];
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print '</td>';
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
$accountoshow = length_accounta($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print '</td>';
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
@ -607,6 +637,7 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td><!-- Product --></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
@ -615,10 +646,12 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label . "</td>";
|
||||
// print "<td>" . $accountingaccount->label . "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
@ -626,54 +659,42 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
|
||||
// VAT
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
$listoftax = array(0, 1, 2);
|
||||
foreach ($listoftax as $numtax) {
|
||||
$arrayofvat = $tabtva;
|
||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||
|
||||
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<td><!-- VAT --></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("VatAccountNotDefined").'</span>';
|
||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]). "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).($numtax?' - Localtax '.$numtax:'');
|
||||
print "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
|
||||
// Third party
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<td><!-- Thirdparty --></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
print "<td>";
|
||||
$accountoshow = length_accounta($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("subledger_account") . "</td>";
|
||||
// print "</td><td>" . $langs->trans("ThirdParty");
|
||||
// print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')';
|
||||
// print "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
@ -28,6 +28,7 @@
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page with sells journal
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
@ -38,12 +39,7 @@ require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
|
||||
$langs->load("commercial");
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
$langs->load("other");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
$langs->loadLangs(array("commercial", "compta","bills","other","accountancy","errors"));
|
||||
|
||||
$id_journal = GETPOST('id_journal', 'int');
|
||||
$action = GETPOST('action','aZ09');
|
||||
@ -54,6 +50,8 @@ $date_startyear = GETPOST('date_startyear');
|
||||
$date_endmonth = GETPOST('date_endmonth');
|
||||
$date_endday = GETPOST('date_endday');
|
||||
$date_endyear = GETPOST('date_endyear');
|
||||
$in_bookkeeping = GETPOST('in_bookkeeping');
|
||||
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
@ -91,8 +89,8 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
|
||||
$idpays = $mysoc->country_id;
|
||||
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr,";
|
||||
$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 .= " 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 .= " ct.accountancy_code_sell as account_tva";
|
||||
@ -113,6 +111,10 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND fd.product_type IN (0,1)";
|
||||
if ($date_start && $date_end)
|
||||
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
||||
if ($in_bookkeeping == 'already')
|
||||
$sql .= " AND f.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
|
||||
if ($in_bookkeeping == 'notyet')
|
||||
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
|
||||
$sql .= " ORDER BY f.datef";
|
||||
|
||||
dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG);
|
||||
@ -123,13 +125,15 @@ if ($result) {
|
||||
$tabtva = array ();
|
||||
$def_tva = array ();
|
||||
$tabttc = array ();
|
||||
$tablocaltax1 = array ();
|
||||
$tablocaltax2 = array ();
|
||||
$tabcompany = array ();
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
// Variables
|
||||
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef");
|
||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined';
|
||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : 'NotDefined';
|
||||
|
||||
$i = 0;
|
||||
while ( $i < $num ) {
|
||||
@ -141,13 +145,15 @@ if ($result) {
|
||||
$compta_prod = $obj->compte;
|
||||
if (empty($compta_prod)) {
|
||||
if ($obj->product_type == 0)
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : 'NotDefined';
|
||||
else
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : 'NotDefined';
|
||||
}
|
||||
|
||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||
$compta_tva = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
$compta_localtax1 = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
$compta_localtax2 = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
|
||||
// Define array to display all VAT rates that use this accounting account $compta_tva
|
||||
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
||||
@ -172,6 +178,7 @@ if ($result) {
|
||||
|
||||
// Invoice lines
|
||||
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
|
||||
$tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr);
|
||||
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
|
||||
$tabfac[$obj->rowid]["type"] = $obj->type;
|
||||
$tabfac[$obj->rowid]["description"] = $obj->label_compte;
|
||||
@ -181,10 +188,14 @@ if ($result) {
|
||||
if (! isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc] = 0;
|
||||
if (! isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod] = 0;
|
||||
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
||||
if (! isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0;
|
||||
if (! isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
|
||||
|
||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc * $situation_ratio;
|
||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio;
|
||||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1 * $situation_ratio;
|
||||
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2 * $situation_ratio;
|
||||
$tabcompany[$obj->rowid] = array (
|
||||
'id' => $obj->socid,
|
||||
'name' => $obj->name,
|
||||
@ -203,7 +214,7 @@ if ($action == 'writebookkeeping') {
|
||||
$now = dol_now();
|
||||
$error = 0;
|
||||
|
||||
foreach ( $tabfac as $key => $val ) { // Loop on each invoice
|
||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||
|
||||
$errorforline = 0;
|
||||
|
||||
@ -230,6 +241,7 @@ if ($action == 'writebookkeeping') {
|
||||
if ($mt) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->date_create = $now;
|
||||
$bookkeeping->doc_type = 'customer_invoice';
|
||||
@ -239,11 +251,11 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = ''; // TODO To complete
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account");
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount");
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
|
||||
$bookkeeping->credit = ($mt < 0) ? $mt : 0;
|
||||
$bookkeeping->credit = ($mt < 0) ? -$mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $journal_label;
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
@ -254,7 +266,7 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -277,11 +289,12 @@ if ($action == 'writebookkeeping') {
|
||||
if ($accountingaccount->fetch(null, $k, true)) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->date_create = $now;
|
||||
$bookkeeping->doc_type = 'customer_invoice';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
@ -289,7 +302,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label;
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
|
||||
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
|
||||
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $journal_label;
|
||||
@ -301,7 +314,7 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -319,41 +332,50 @@ if ($action == 'writebookkeeping') {
|
||||
// var_dump($tabtva);
|
||||
if (! $errorforline)
|
||||
{
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->date_create = $now;
|
||||
$bookkeeping->doc_type = 'customer_invoice';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]);
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
|
||||
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $journal_label;
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
$listoftax=array(0, 1, 2);
|
||||
foreach($listoftax as $numtax)
|
||||
{
|
||||
$arrayofvat = $tabtva;
|
||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->date_create = $now;
|
||||
$bookkeeping->doc_type = 'customer_invoice';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'');
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
|
||||
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $journal_label;
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -390,6 +412,21 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
|
||||
$action='';
|
||||
|
||||
// Must reload data, so we make a redirect
|
||||
if (count($tabpay) != $error)
|
||||
{
|
||||
$param='id_journal='.$id_journal;
|
||||
$param.='&date_startday='.$date_startday;
|
||||
$param.='&date_startmonth='.$date_startmonth;
|
||||
$param.='&date_startyear='.$date_startyear;
|
||||
$param.='&date_endday='.$date_endday;
|
||||
$param.='&date_endmonth='.$date_endmonth;
|
||||
$param.='&date_endyear='.$date_endyear;
|
||||
$param.='&in_bookeeping='.$in_bookeeping;
|
||||
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -401,7 +438,7 @@ if ($action == 'writebookkeeping') {
|
||||
$form = new Form($db);
|
||||
|
||||
// Export
|
||||
/*if ($action == 'export_csv') {
|
||||
if ($action == 'exportcsv') {
|
||||
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
||||
@ -409,119 +446,85 @@ $form = new Form($db);
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
$companystatic = new Client($db);
|
||||
$invoicestatic = new Facture($db);
|
||||
|
||||
// Model Cegid Expert Export
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
|
||||
$sep = ";";
|
||||
foreach ( $tabfac as $key => $val )
|
||||
{
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["ref"];
|
||||
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["ref"];
|
||||
$date = dol_print_date($val["date"], 'day');
|
||||
|
||||
$date = dol_print_date($val["date"], '%d%m%Y');
|
||||
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print $date . $sep;
|
||||
print $sell_journal . $sep;
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep;
|
||||
print length_accounta(html_entity_decode($k)) . $sep;
|
||||
print ($mt < 0 ? 'C' : 'D') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account") . $sep;
|
||||
print $val["ref"];
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount_static = new AccountingAccount($db);
|
||||
if ($accountingaccount_static->fetch(null, $k, true)) {
|
||||
print $date . $sep;
|
||||
print $sell_journal . $sep;
|
||||
print length_accountg(html_entity_decode($k)) . $sep;
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount_static->label . $sep;
|
||||
print $val["ref"];
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// TVA
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print $date . $sep;
|
||||
print $sell_journal . $sep;
|
||||
print length_accountg(html_entity_decode($k)) . $sep;
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . $sep;
|
||||
// print $langs->trans("VAT") . $sep;
|
||||
print $val["ref"];
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
// Third party
|
||||
foreach ($tabttc[$key] as $k => $mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . $sell_journal . '"';
|
||||
print "\n";
|
||||
}
|
||||
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
|
||||
// Model Classic Export
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["ref"];
|
||||
|
||||
$date = dol_print_date($val["date"], 'day');
|
||||
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
// Product / Service
|
||||
foreach ($tabht[$key] as $k => $mt) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account") . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||
print '"' . $sell_journal . '"';
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
// VAT
|
||||
$listoftax = array(0, 1, 2);
|
||||
foreach ($listoftax as $numtax) {
|
||||
$arrayofvat = $tabtva;
|
||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||
|
||||
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// VAT
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . '"' . $sep;
|
||||
print " " . $sep;
|
||||
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key] . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . $sell_journal . '"';
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
if (empty($action) || $action == 'view') {
|
||||
@ -532,50 +535,47 @@ if (empty($action) || $action == 'view') {
|
||||
$nomlink = '';
|
||||
$periodlink = '';
|
||||
$exportlink = '';
|
||||
$builddate = time();
|
||||
//$description = $langs->trans("DescSellsJournal") . '<br>';
|
||||
$builddate=dol_now();
|
||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
||||
$description .= $langs->trans("DepositsAreNotIncluded");
|
||||
else
|
||||
$description .= $langs->trans("DepositsAreIncluded");
|
||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
|
||||
|
||||
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||
|
||||
$varlink = 'id_journal=' . $id_journal;
|
||||
|
||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
/*if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
||||
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
||||
} else {
|
||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
}*/
|
||||
|
||||
// Button to write into Ledger
|
||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
}
|
||||
print '<div class="tabsAction tabsActionNoBottom">';
|
||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||
}
|
||||
else {
|
||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
}
|
||||
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
print '</div>';
|
||||
|
||||
// TODO Avoid using js. We can use a direct link with $param
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
function launch_export() {
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
|
||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||
$("div.fiche form input[name=\"action\"]").val("exportcsv");
|
||||
$("div.fiche form input[type=\"submit\"]").click();
|
||||
$("div.fiche form input[name=\"action\"]").val("");
|
||||
}
|
||||
function writebookkeeping() {
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("writebookkeeping");
|
||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||
$("div.fiche form input[name=\"action\"]").val("writebookkeeping");
|
||||
$("div.fiche form input[type=\"submit\"]").click();
|
||||
$("div.fiche form input[name=\"action\"]").val("");
|
||||
}
|
||||
</script>';
|
||||
|
||||
@ -585,12 +585,14 @@ if (empty($action) || $action == 'view') {
|
||||
print '<br>';
|
||||
|
||||
$i = 0;
|
||||
print '<div class="div-table-responsive">';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print "<td></td>";
|
||||
print "<td>" . $langs->trans("Date") . "</td>";
|
||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||
print "<td>" . $langs->trans("Label") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||
@ -616,7 +618,17 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
$companystatic->customer_code = $tabcompany[$key]['code_client'];
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print '</td>';
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
$accountoshow = length_accounta($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
@ -624,12 +636,10 @@ if (empty($action) || $action == 'view') {
|
||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
// print "</td><td>" . $langs->trans("ThirdParty");
|
||||
// print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')';
|
||||
print '</td>';
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account") . "</td>";
|
||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
@ -643,6 +653,7 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td><!-- Product --></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
@ -651,7 +662,11 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
// print "<td>" . $accountingaccount->label . "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . "</td>";
|
||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
@ -660,31 +675,42 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
|
||||
// VAT
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<td><!-- VAT --></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
||||
$listoftax = array(0, 1, 2);
|
||||
foreach ($listoftax as $numtax) {
|
||||
$arrayofvat = $tabtva;
|
||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||
|
||||
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<td><!-- VAT --></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).($numtax?' - Localtax '.$numtax:'');
|
||||
print "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
||||
print "</td>";
|
||||
// print "<td>" . $langs->trans("VAT") . "</td>";
|
||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -1,268 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
|
||||
* Copyright (C) 2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/report/result.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page for accounting result
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancycategory.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
|
||||
$error = 0;
|
||||
|
||||
// Langs
|
||||
$langs->load("accountancy");
|
||||
$langs->load("compta");
|
||||
|
||||
$mesg = '';
|
||||
$action = GETPOST('action','aZ09');
|
||||
$cat_id = GETPOST('account_category');
|
||||
$selectcpt = GETPOST('cpt_bk');
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$cancel = GETPOST('cancel');
|
||||
|
||||
// Filter
|
||||
$year = GETPOST('year','int');
|
||||
if ($year == 0) {
|
||||
$year_current = strftime("%Y", time());
|
||||
$year_start = $year_current;
|
||||
} else {
|
||||
$year_current = $year;
|
||||
$year_start = $year;
|
||||
}
|
||||
|
||||
if($cat_id == 0){
|
||||
$cat_id = null;
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
if (! $user->rights->accounting->comptarapport->lire)
|
||||
accessforbidden();
|
||||
|
||||
$AccCat = new AccountancyCategory($db);
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxheader('', $langs->trans('ReportInOut'));
|
||||
|
||||
$formaccounting = new FormAccounting($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
|
||||
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
|
||||
|
||||
print load_fiche_titre($langs->trans('ReportInOut'), $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, 'title_accountancy');
|
||||
|
||||
$moreforfilter='';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
$months = array( $langs->trans("JanuaryMin"),
|
||||
$langs->trans("FebruaryMin"),
|
||||
$langs->trans("MarchMin"),
|
||||
$langs->trans("AprilMin"),
|
||||
$langs->trans("MayMin"),
|
||||
$langs->trans("JuneMin"),
|
||||
$langs->trans("JulyMin"),
|
||||
$langs->trans("AugustMin"),
|
||||
$langs->trans("SeptemberMin"),
|
||||
$langs->trans("OctoberMin"),
|
||||
$langs->trans("NovemberMin"),
|
||||
$langs->trans("DecemberMin"),
|
||||
);
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th class="liste_titre">'.$langs->trans("Account").'</th>';
|
||||
print '<th class="liste_titre">'.$langs->trans("Description").'</th>';
|
||||
print '<th class="liste_titre" align="center">N-1</th>';
|
||||
print '<th class="liste_titre" align="center">'.$langs->trans("NReal").'</th>';
|
||||
foreach($months as $k => $v){
|
||||
print '<th class="liste_titre" align="center">'.$langs->trans($v).'</th>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
$cats = $AccCat->getCatsCpts();
|
||||
if ($cats < 0) dol_print_error($db, $AccCat->error, $AccCat->errors);
|
||||
|
||||
$catsCalcule = $AccCat->getCatsCal();
|
||||
if ($catsCalcule < 0) dol_print_error($db, $AccCat->error, $AccCat->errors);
|
||||
|
||||
$j=1;
|
||||
$sommes = array();
|
||||
|
||||
if (!empty($cats))
|
||||
{
|
||||
foreach ($cats as $name_cat => $cpts)
|
||||
{
|
||||
print "<tr class='liste_titre'>";
|
||||
print '<td colspan="17">' . $name_cat . '</td>';
|
||||
print "</tr>\n";
|
||||
$position = -1;
|
||||
$code = -1;
|
||||
foreach($cpts as $i => $cpt){
|
||||
|
||||
$position = $cpt['position'];
|
||||
$code = $cpt['code'];
|
||||
|
||||
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
|
||||
if ($return < 0) {
|
||||
setEventMessages(null, $AccCat->errors, 'errors');
|
||||
$resultNP=0;
|
||||
} else {
|
||||
$resultNP=$AccCat->sdc;
|
||||
}
|
||||
|
||||
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
|
||||
if ($return < 0) {
|
||||
setEventMessages(null, $AccCat->errors, 'errors');
|
||||
$resultN=0;
|
||||
} else {
|
||||
$resultN=$AccCat->sdc;
|
||||
}
|
||||
$sommes[$code]['NP'] += $resultNP;
|
||||
$sommes[$code]['N'] += $resultN;
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>' . $cpt['account_number'] . '</td>';
|
||||
print '<td>' . $cpt['name_cpt'] . '</td>';
|
||||
print '<td>' . price($resultNP) . '</td>';
|
||||
print '<td>' . price($resultN) . '</td>';
|
||||
|
||||
foreach($months as $k => $v){
|
||||
$return = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
|
||||
if ($return < 0) {
|
||||
setEventMessages(null, $AccCat->errors, 'errors');
|
||||
$resultM=0;
|
||||
} else {
|
||||
$resultM=$AccCat->sdc;
|
||||
}
|
||||
$sommes[$code]['M'][$k] += $resultM;
|
||||
print '<td align="right">' . price($resultM) . '</td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
// If it's a calculated catgory
|
||||
$p = $position + 1;
|
||||
if(array_key_exists($p, $catsCalcule)){
|
||||
$formula = $catsCalcule[$p]['formula'];
|
||||
|
||||
print "<tr class='liste_titre'>";
|
||||
print '<td colspan="2">' . $catsCalcule[$p]['label'] . '</td>';
|
||||
|
||||
$vars = array();
|
||||
|
||||
// Previous Fiscal year (N-1)
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['NP'];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$code = $catsCalcule[$p]['code']; // code categorie de calcule
|
||||
$sommes[$code]['NP'] += $result;
|
||||
|
||||
// Current fiscal year (N)
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['N'];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$sommes[$code]['N'] += $result;
|
||||
|
||||
// Detail by month
|
||||
foreach($months as $k => $v){
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['M'][$k];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$sommes[$code]['M'][$k] += $result;
|
||||
}
|
||||
|
||||
//print '<td colspan="15">' . $catsCalcule[$p]['formula'] . '</td>';
|
||||
print "</tr>\n";
|
||||
unset($catsCalcule[$p]); // j'élimine la catégorie calculée après affichage
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
|
||||
// Others calculed category
|
||||
foreach($catsCalcule as $p => $catc)
|
||||
{
|
||||
$formula = $catsCalcule[$p]['formula'];
|
||||
|
||||
print "<tr class='liste_titre'>";
|
||||
print '<td colspan="2">' . $catsCalcule[$p]['label'] . '</td>';
|
||||
|
||||
$vars = array();
|
||||
|
||||
// Previous Fiscal year (N-1)
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['NP'];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$code = $catsCalcule[$p]['code']; // code categorie de calcule
|
||||
$sommes[$code]['NP'] += $result;
|
||||
|
||||
// Current fiscal year (N)
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['N'];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$sommes[$code]['N'] += $result;
|
||||
|
||||
// Detail by month
|
||||
foreach($months as $k => $v){
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['M'][$k];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$sommes[$code]['M'][$k] += $result;
|
||||
}
|
||||
|
||||
//print '<td colspan="15">' . $catsCalcule[$p]['formula'] . '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -22,9 +22,9 @@
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* \file htdocs/accountancy/supplier/card.php
|
||||
* \ingroup Accountancy
|
||||
* \brief Card supplier ventilation
|
||||
* \file htdocs/accountancy/supplier/card.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Card supplier ventilation
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -44,7 +44,7 @@ $id = GETPOST('id');
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -97,14 +97,14 @@ if (! empty($id)) {
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = l.fk_facture_fourn ";
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.rowid = " . $id;
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
|
||||
dol_syslog("/accounting/supplier/card.php sql=" . $sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
|
||||
|
||||
if ($result) {
|
||||
$num_lines = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
|
||||
if ($num_lines) {
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
|
||||
@ -21,12 +21,13 @@
|
||||
/**
|
||||
* \file htdocs/accountancy/supplier/index.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Home supplier ventilation
|
||||
* \brief Home supplier journalization page
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("compta");
|
||||
@ -55,7 +56,7 @@ if ($year == 0) {
|
||||
}
|
||||
|
||||
// Validate History
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
|
||||
/*
|
||||
@ -93,6 +94,8 @@ if ($action == 'validatehistory') {
|
||||
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
||||
}
|
||||
|
||||
dol_syslog('htdocs/accountancy/supplier/index.php');
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
@ -102,29 +105,6 @@ if ($action == 'validatehistory') {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||
}
|
||||
} elseif ($action == 'fixaccountancycode') {
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
||||
$sql1 .= " SET fk_code_ventilation = 0";
|
||||
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||
$sql1 .= ' (SELECT accnt.rowid ';
|
||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
$db->rollback();
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans('Done'), 'mesgs');
|
||||
}
|
||||
} elseif ($action == 'cleanaccountancycode') {
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
@ -137,7 +117,7 @@ if ($action == 'validatehistory') {
|
||||
$sql1.= " AND f.entity IN (" . getEntity('accountancy') . ")";
|
||||
$sql1.= ")";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
dol_syslog("htdocs/accountancy/customer/index.php cleanaccountancycode", LOG_DEBUG);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
@ -159,45 +139,56 @@ llxHeader('', $langs->trans("SuppliersVentilation"));
|
||||
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
|
||||
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
|
||||
|
||||
print load_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
|
||||
print load_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
|
||||
|
||||
print $langs->trans("DescVentilSupplier") . '<br>';
|
||||
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||
print '<br>';
|
||||
|
||||
//print '<div class="inline-block divButAction">';
|
||||
// TODO Remove this. Should be done always.
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
||||
//print '</div>';
|
||||
// Clean database
|
||||
$db->begin();
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
||||
$sql1 .= " SET fk_code_ventilation = 0";
|
||||
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||
$sql1 .= ' (SELECT accnt.rowid ';
|
||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
$db->rollback();
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
} else {
|
||||
$db->commit();
|
||||
}
|
||||
// End clean database
|
||||
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
$buttonbind = '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
|
||||
$buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
|
||||
|
||||
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
$var = true;
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200" align="left">' . $langs->trans("Account") . '</td>';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " ROUND(SUM(ffd.total_ht),2) as total";
|
||||
$sql .= " SUM(ffd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
|
||||
@ -208,15 +199,27 @@ $sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We d
|
||||
$sql .= " AND aa.account_number IS NULL";
|
||||
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
|
||||
dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql);
|
||||
dol_syslog('htdocs/accountancy/supplier/index.php');
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
print '<tr class="oddeven"><td>';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("Unknown");
|
||||
}
|
||||
else print length_accountg($row[0]);
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
}
|
||||
else print $row[1];
|
||||
print '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
@ -229,8 +232,7 @@ if ($resql) {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
@ -238,20 +240,21 @@ print '<br>';
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200" align="left">' . $langs->trans("Account") . '</td>';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " ROUND(SUM(ffd.total_ht),2) as total";
|
||||
$sql .= " SUM(ffd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
|
||||
@ -262,16 +265,28 @@ $sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We d
|
||||
$sql .= " AND aa.account_number IS NOT NULL";
|
||||
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
|
||||
dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql);
|
||||
dol_syslog('htdocs/accountancy/supplier/index.php');
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("Unknown");
|
||||
}
|
||||
else print length_accountg($row[0]);
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
}
|
||||
else print $row[1];
|
||||
print '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right">' . price($row[13]) . '</td>';
|
||||
@ -283,7 +298,7 @@ if ($resql) {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
||||
@ -295,6 +310,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||
|
||||
print "<br>\n";
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
@ -306,7 +322,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " ROUND(SUM(ffd.total_ht),2) as total";
|
||||
$sql .= " SUM(ffd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
||||
$sql .= " WHERE ff.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
@ -314,7 +330,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
$sql .= " AND ff.fk_statut > 0 ";
|
||||
$sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql);
|
||||
dol_syslog('htdocs/accountancy/supplier/index.php');
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
@ -335,6 +351,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -52,6 +52,8 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
$search_vat = GETPOST('search_vat', 'alpha');
|
||||
$search_country = GETPOST('search_country', 'alpha');
|
||||
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||
|
||||
// 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);
|
||||
@ -84,7 +86,7 @@ $formaccounting = new FormAccounting($db);
|
||||
*/
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_lineid = '';
|
||||
$search_ref = '';
|
||||
@ -94,6 +96,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
$search_amount = '';
|
||||
$search_account = '';
|
||||
$search_vat = '';
|
||||
$search_country = '';
|
||||
$search_tvaintra = '';
|
||||
}
|
||||
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
@ -149,13 +153,16 @@ print '<script type="text/javascript">
|
||||
/*
|
||||
* Supplier Invoice lines
|
||||
*/
|
||||
$sql = "SELECT f.rowid as facid, f.ref as facnumber, f.ref_supplier, f.libelle as invoice_label, f.datef,";
|
||||
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht , l.qty, l.tva_tx, aa.label, aa.account_number, ";
|
||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||
$sql.= " , " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql.= " , " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||
$sql = "SELECT f.rowid as facid, f.ref as facnumber, f.ref_supplier, f.libelle as invoice_label, f.datef, f.fk_soc,";
|
||||
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht , l.qty, l.tva_tx, l.vat_src_code,";
|
||||
$sql.= " aa.label, aa.account_number, ";
|
||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, co.label as country, s.tva_intra";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = l.fk_code_ventilation";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = l.fk_facture_fourn";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
||||
$sql.= " WHERE f.rowid = l.fk_facture_fourn and f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 ";
|
||||
$sql.= " AND aa.rowid = l.fk_code_ventilation";
|
||||
if ($search_lineid) {
|
||||
@ -182,6 +189,12 @@ if (strlen(trim($search_account))) {
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= natural_search("l.tva_tx", $search_vat, 1);
|
||||
}
|
||||
if (strlen(trim($search_country))) {
|
||||
$sql .= " AND (co.label like'" . $search_country . "%')";
|
||||
}
|
||||
if (strlen(trim($search_tvaintra))) {
|
||||
$sql .= " AND (s.tva_intra like'" . $search_tvaintra . "%')";
|
||||
}
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
@ -254,8 +267,10 @@ if ($result) {
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tavintra" value="' . dol_escape_htmltag($search_tavintra) . '"></td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
@ -263,16 +278,18 @@ if ($result) {
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("InvoiceLabel"), $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $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.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $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("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("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
||||
$checkpicto=$form->showCheckAddButtons();
|
||||
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
||||
print "</tr>\n";
|
||||
@ -320,12 +337,13 @@ if ($result) {
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||
print '<td align="center">' . price($objp->tva_tx) . '</td>';
|
||||
print '<td align="center">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||
print '<td align="left">';
|
||||
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
|
||||
print '<td align="right">' . $objp->country .'</td>';
|
||||
print '<td align="center">' . $objp->tva_intra . '</td>';
|
||||
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="' . $objp->rowid . '"/></td>';
|
||||
|
||||
print "</tr>";
|
||||
|
||||
@ -33,6 +33,8 @@ require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("compta");
|
||||
@ -60,6 +62,10 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
$search_vat = GETPOST('search_vat', 'alpha');
|
||||
$search_day=GETPOST("search_day","int");
|
||||
$search_month=GETPOST("search_month","int");
|
||||
$search_year=GETPOST("search_year","int");
|
||||
|
||||
$btn_ventil = GETPOST('ventil', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
@ -96,11 +102,11 @@ $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUN
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_lineid = '';
|
||||
$search_ref = '';
|
||||
@ -110,6 +116,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
$search_amount = '';
|
||||
$search_account = '';
|
||||
$search_vat = '';
|
||||
$search_month = '';
|
||||
$search_year = '';
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
@ -176,12 +184,13 @@ if ($massaction == 'ventil') {
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
llxHeader('', $langs->trans("SuppliersVentilation"));
|
||||
|
||||
// Supplier Invoice Lines
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef,";
|
||||
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht as price, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, ";
|
||||
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht as price, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
|
||||
$sql.= " aa.rowid as aarowid";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||
@ -191,7 +200,8 @@ $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountan
|
||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
||||
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||
$sql.= " AND product_type <= 2";
|
||||
$sql.= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_buy IS NULL OR p.accountancy_code_buy ='')";
|
||||
$sql.= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_buy IS NULL OR p.accountancy_code_buy =''OR p.accountancy_code_buy NOT IN
|
||||
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid ='" . $conf->global->CHARTOFACCOUNTS . "'))";
|
||||
// Add search filter like
|
||||
if ($search_lineid) {
|
||||
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
||||
@ -217,6 +227,19 @@ if (strlen(trim($search_account))) {
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= natural_search("l.tva_tx",$search_vat,1);
|
||||
}
|
||||
if ($search_month > 0)
|
||||
{
|
||||
if ($search_year > 0 && empty($search_day))
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
|
||||
else if ($search_year > 0 && ! empty($search_day))
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
|
||||
else
|
||||
$sql.= " AND date_format(f.datef, '%m') = '".$db->escape($search_month)."'";
|
||||
}
|
||||
else if ($search_year > 0)
|
||||
{
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||
}
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
@ -242,6 +265,15 @@ if ($result) {
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
|
||||
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||
if ($search_year) $param.='&search_year='.urlencode($search_year);
|
||||
if ($search_invoice) $param.='&search_invoice='.urlencode($search_invoice);
|
||||
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
||||
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
||||
if ($search_amount) $param.='&search_amount='.urlencode($search_amount);
|
||||
if ($search_vat) $param.='&search_vat='.urlencode($search_vat);
|
||||
|
||||
$arrayofmassactions = array(
|
||||
'ventil'=>$langs->trans("Ventilate")
|
||||
@ -278,7 +310,11 @@ if ($result) {
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
@ -293,17 +329,17 @@ if ($result) {
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("InvoiceLabel"), $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $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("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("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"');
|
||||
$checkpicto='';
|
||||
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
|
||||
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
||||
@ -393,7 +429,7 @@ if ($result) {
|
||||
if ($objp->vat_tx_l != $objp->vat_tx_p)
|
||||
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
||||
print '<td style="' . $code_vat_differ . '" align="right">';
|
||||
print price($objp->tva_tx_line);
|
||||
print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''));
|
||||
print '</td>';
|
||||
|
||||
// Current account
|
||||
|
||||
@ -203,7 +203,7 @@ if ($conf->facture->enabled)
|
||||
print '</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
|
||||
{
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").'</td>';
|
||||
@ -263,40 +263,6 @@ $helptext.='%YEAR%, %MONTH%, %DAY%';
|
||||
|
||||
form_constantes($constantes, 0, $helptext);
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
/*
|
||||
* Editing global variables not related to a specific theme
|
||||
*/
|
||||
$constantes=array(
|
||||
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT',
|
||||
'ADHERENT_AUTOREGISTER_NOTIF_MAIL',
|
||||
'ADHERENT_AUTOREGISTER_MAIL_SUBJECT',
|
||||
'ADHERENT_AUTOREGISTER_MAIL',
|
||||
'ADHERENT_MAIL_VALID_SUBJECT',
|
||||
'ADHERENT_MAIL_VALID',
|
||||
'ADHERENT_MAIL_COTIS_SUBJECT',
|
||||
'ADHERENT_MAIL_COTIS',
|
||||
'ADHERENT_MAIL_RESIL_SUBJECT',
|
||||
'ADHERENT_MAIL_RESIL',
|
||||
'ADHERENT_MAIL_FROM',
|
||||
);
|
||||
|
||||
print load_fiche_titre($langs->trans("Other"),'','');
|
||||
|
||||
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
|
||||
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
|
||||
$helptext.='%YEAR%, %MONTH%, %DAY%';
|
||||
|
||||
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
|
||||
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
|
||||
//$helptext.='%YEAR%, %MONTH%, %DAY%'; // Not supported
|
||||
|
||||
form_constantes($constantes, 0, $helptext);
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
190
htdocs/adherents/admin/adherent_emails.php
Normal file
190
htdocs/adherents/admin/adherent_emails.php
Normal file
@ -0,0 +1,190 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/adherents/admin/adherent.php
|
||||
* \ingroup member
|
||||
* \brief Page to setup the module Foundation
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("members");
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
|
||||
$type=array('yesno','texte','chaine');
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
//
|
||||
if ($action == 'updateall')
|
||||
{
|
||||
$db->begin();
|
||||
$res1=$res2=$res3=$res4=$res5=$res6=0;
|
||||
$res1=dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res2=dolibarr_set_const($db, 'ADHERENT_MAIL_REQUIRED', GETPOST('ADHERENT_MAIL_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res3=dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res4=dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
// Use vat for invoice creation
|
||||
if ($conf->facture->enabled)
|
||||
{
|
||||
$res4=dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res5=dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
|
||||
{
|
||||
$res6=dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
}
|
||||
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0)
|
||||
{
|
||||
setEventMessages('ErrorFailedToSaveDate', null, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
|
||||
$db->commit();
|
||||
}
|
||||
}
|
||||
|
||||
// Action mise a jour ou ajout d'une constante
|
||||
if ($action == 'update' || $action == 'add')
|
||||
{
|
||||
$constname=GETPOST('constname','alpha');
|
||||
$constvalue=(GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue'));
|
||||
|
||||
if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE' || $constname=='ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) $constvalue='';
|
||||
if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
|
||||
{
|
||||
if ($constvalue) $constvalue=0;
|
||||
else $constvalue=1;
|
||||
}
|
||||
|
||||
$consttype=GETPOST('consttype','alpha');
|
||||
$constnote=GETPOST('constnote');
|
||||
$res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Action activation d'un sous module du module adherent
|
||||
if ($action == 'set')
|
||||
{
|
||||
$result=dolibarr_set_const($db, GETPOST('name','alpha'),GETPOST('value'),'',0,'',$conf->entity);
|
||||
if ($result < 0)
|
||||
{
|
||||
print $db->error();
|
||||
}
|
||||
}
|
||||
|
||||
// Action desactivation d'un sous module du module adherent
|
||||
if ($action == 'unset')
|
||||
{
|
||||
$result=dolibarr_del_const($db,GETPOST('name','alpha'),$conf->entity);
|
||||
if ($result < 0)
|
||||
{
|
||||
print $db->error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$help_url='EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
|
||||
|
||||
llxHeader('',$langs->trans("MembersSetup"),$help_url);
|
||||
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("MembersSetup"),$linkback,'title_setup');
|
||||
|
||||
|
||||
$head = member_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'emails', $langs->trans("Members"), -1, 'user');
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="updateall">';
|
||||
|
||||
/*
|
||||
* Editing global variables not related to a specific theme
|
||||
*/
|
||||
$constantes=array(
|
||||
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT',
|
||||
'ADHERENT_AUTOREGISTER_NOTIF_MAIL',
|
||||
'ADHERENT_AUTOREGISTER_MAIL_SUBJECT',
|
||||
'ADHERENT_AUTOREGISTER_MAIL',
|
||||
'ADHERENT_MAIL_VALID_SUBJECT',
|
||||
'ADHERENT_MAIL_VALID',
|
||||
'ADHERENT_MAIL_COTIS_SUBJECT',
|
||||
'ADHERENT_MAIL_COTIS',
|
||||
'ADHERENT_MAIL_RESIL_SUBJECT',
|
||||
'ADHERENT_MAIL_RESIL',
|
||||
'ADHERENT_MAIL_FROM',
|
||||
);
|
||||
|
||||
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
|
||||
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
|
||||
$helptext.='%YEAR%, %MONTH%, %DAY%';
|
||||
|
||||
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
|
||||
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
|
||||
//$helptext.='%YEAR%, %MONTH%, %DAY%'; // Not supported
|
||||
|
||||
form_constantes($constantes, 0, $helptext);
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -43,6 +43,12 @@ if (! $user->admin) accessforbidden();
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'setMEMBER_ENABLE_PUBLIC')
|
||||
{
|
||||
if (GETPOST('value')) dolibarr_set_const($db, 'MEMBER_ENABLE_PUBLIC', 1, 'chaine', 0, '', $conf->entity);
|
||||
else dolibarr_set_const($db, 'MEMBER_ENABLE_PUBLIC', 0, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
if ($action == 'update')
|
||||
{
|
||||
$public=GETPOST('MEMBER_ENABLE_PUBLIC');
|
||||
@ -94,7 +100,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
dol_fiche_head($head, 'public', $langs->trans("Members"), -1, 'user');
|
||||
dol_fiche_head($head, 'website', $langs->trans("Members"), -1, 'user');
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
@ -135,99 +141,109 @@ if ($conf->use_javascript_ajax)
|
||||
print $langs->trans("BlankSubscriptionFormDesc").'<br><br>';
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Allow public form
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("EnablePublicSubscriptionForm");
|
||||
print '</td><td align="right">';
|
||||
print $form->selectyesno("MEMBER_ENABLE_PUBLIC",(! empty($conf->global->MEMBER_ENABLE_PUBLIC)?$conf->global->MEMBER_ENABLE_PUBLIC:0),1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Force Type
|
||||
$adht = new AdherentType($db);
|
||||
print '<tr class="oddeven drag" id="trforcetype"><td>';
|
||||
print $langs->trans("ForceMemberType");
|
||||
print '</td><td width="60" align="right">';
|
||||
$listofval = array(-1 => $langs->trans("Undefined"));
|
||||
$listofval += $adht->liste_array();
|
||||
$forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1;
|
||||
print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listetype)>1?1:0);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Amount
|
||||
print '<tr class="oddeven" id="tramount"><td>';
|
||||
print $langs->trans("DefaultAmount");
|
||||
print '</td><td align="right">';
|
||||
print '<input type="text" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" size="5" value="'.(! empty($conf->global->MEMBER_NEWFORM_AMOUNT)?$conf->global->MEMBER_NEWFORM_AMOUNT:'').'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Can edit
|
||||
print '<tr class="oddeven" id="tredit"><td>';
|
||||
print $langs->trans("CanEditAmount");
|
||||
print '</td><td align="right">';
|
||||
print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT",(! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)?$conf->global->MEMBER_NEWFORM_EDITAMOUNT:0),1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled))
|
||||
$enabledisablehtml = $langs->trans("EnablePublicSubscriptionForm").' ';
|
||||
if (empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
||||
{
|
||||
// Button off, click to enable
|
||||
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=1'.$param.'">';
|
||||
$enabledisablehtml.=img_picto($langs->trans("Disabled"),'switch_off');
|
||||
$enabledisablehtml.='</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Button on, click to disable
|
||||
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=0'.$param.'">';
|
||||
$enabledisablehtml.=img_picto($langs->trans("Activated"),'switch_on');
|
||||
$enabledisablehtml.='</a>';
|
||||
}
|
||||
print $enabledisablehtml;
|
||||
print '<input type="hidden" id="MEMBER_ENABLE_PUBLIC" name="MEMBER_ENABLE_PUBLIC" value="'.(empty($conf->global->MEMBER_ENABLE_PUBLIC)?0:1).'">';
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
if (! empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Force Type
|
||||
$adht = new AdherentType($db);
|
||||
print '<tr class="oddeven drag" id="trforcetype"><td>';
|
||||
print $langs->trans("ForceMemberType");
|
||||
print '</td><td width="60" align="right">';
|
||||
$listofval = array(-1 => $langs->trans("Undefined"));
|
||||
$listofval += $adht->liste_array();
|
||||
$forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1;
|
||||
print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listetype)>1?1:0);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Amount
|
||||
print '<tr class="oddeven" id="tramount"><td>';
|
||||
print $langs->trans("DefaultAmount");
|
||||
print '</td><td align="right">';
|
||||
print '<input type="text" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" size="5" value="'.(! empty($conf->global->MEMBER_NEWFORM_AMOUNT)?$conf->global->MEMBER_NEWFORM_AMOUNT:'').'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Can edit
|
||||
print '<tr class="oddeven" id="tredit"><td>';
|
||||
print $langs->trans("CanEditAmount");
|
||||
print '</td><td align="right">';
|
||||
print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT",(! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)?$conf->global->MEMBER_NEWFORM_EDITAMOUNT:0),1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Jump to an online payment page
|
||||
print '<tr class="oddeven" id="trpayment"><td>';
|
||||
print $langs->trans("MEMBER_NEWFORM_PAYONLINE");
|
||||
print '</td><td align="right">';
|
||||
$listofval=array();
|
||||
$listofval['-1']=$langs->trans('No');
|
||||
$listofval['all']=$langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')';
|
||||
if (! empty($conf->paybox->enabled)) $listofval['paybox']='Paybox';
|
||||
if (! empty($conf->paypal->enabled)) $listofval['paypal']='PayPal';
|
||||
if (! empty($conf->stripe->enabled)) $listofval['stripe']='Stripe';
|
||||
print $form->selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,(! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''),1);
|
||||
print $form->selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,(! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''),0);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Jump to an online payment page
|
||||
print '<tr class="oddeven" id="tremail"><td>';
|
||||
print $langs->trans("MEMBER_PAYONLINE_SENDEMAIL");
|
||||
print '</td><td align="right">';
|
||||
print '<input type="text" id="MEMBER_PAYONLINE_SENDEMAIL" name="MEMBER_PAYONLINE_SENDEMAIL" size="24" value="'.(! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL)?$conf->global->MEMBER_PAYONLINE_SENDEMAIL:'').'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<center>';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</center>';
|
||||
}
|
||||
|
||||
if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled))
|
||||
{
|
||||
// Jump to an online payment page
|
||||
print '<tr class="oddeven" id="tremail"><td>';
|
||||
print $langs->trans("MEMBER_PAYONLINE_SENDEMAIL");
|
||||
print '</td><td align="right">';
|
||||
print '<input type="text" id="MEMBER_PAYONLINE_SENDEMAIL" name="MEMBER_PAYONLINE_SENDEMAIL" size="24" value="'.(! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL)?$conf->global->MEMBER_PAYONLINE_SENDEMAIL:'').'">';
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<center>';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</center>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
|
||||
print '<br>';
|
||||
//print $langs->trans('FollowingLinksArePublic').'<br>';
|
||||
print img_picto('','object_globe.png').' '.$langs->trans('BlankSubscriptionForm').':<br>';
|
||||
if ($conf->multicompany->enabled) {
|
||||
$entity_qr='?entity='.$conf->entity;
|
||||
} else {
|
||||
$entity_qr='';
|
||||
if (! empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
||||
{
|
||||
print '<br>';
|
||||
//print $langs->trans('FollowingLinksArePublic').'<br>';
|
||||
print img_picto('','object_globe.png').' '.$langs->trans('BlankSubscriptionForm').':<br>';
|
||||
if ($conf->multicompany->enabled) {
|
||||
$entity_qr='?entity='.$conf->entity;
|
||||
} else {
|
||||
$entity_qr='';
|
||||
}
|
||||
print '<a target="_blank" href="'.DOL_URL_ROOT.'/public/members/new.php'.$entity_qr.'">'.DOL_MAIN_URL_ROOT.'/public/members/new.php'.$entity_qr.'</a>';
|
||||
}
|
||||
print '<a target="_blank" href="'.DOL_URL_ROOT.'/public/members/new.php'.$entity_qr.'">'.DOL_MAIN_URL_ROOT.'/public/members/new.php'.$entity_qr.'</a>';
|
||||
|
||||
/*
|
||||
print '<table class="border" cellspacing="0" cellpadding="3">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Description").'</td><td>'.$langs->trans("URL").'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("BlankSubscriptionForm").'</td><td>'..'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PublicMemberList").'</td><td>'.img_picto('','object_globe.png').' '.'<a target="_blank" href="'.DOL_URL_ROOT.'/public/members/public_list.php'.'">'.DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.'</a></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PublicMemberCard").'</td><td>'.img_picto('','object_globe.png').' '.DOL_MAIN_URL_ROOT.'/public/members/public_card.php?id=xxx'.'</td></tr>';
|
||||
print '</table>';
|
||||
*/
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -76,6 +76,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
|
||||
*/
|
||||
function assign_values(&$action, $id)
|
||||
{
|
||||
global $limit, $offset, $sortfield, $sortorder;
|
||||
global $conf, $db, $langs, $user;
|
||||
global $form;
|
||||
|
||||
@ -114,14 +115,14 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
|
||||
|
||||
if ($action == 'list')
|
||||
{
|
||||
$this->LoadListDatas($GLOBALS['limit'], $GLOBALS['offset'], $GLOBALS['sortfield'], $GLOBALS['sortorder']);
|
||||
$this->LoadListDatas($limit, $offset, $sortfield, $sortorder);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch datas list
|
||||
* Fetch datas list and save into ->list_datas
|
||||
*
|
||||
* @param int $limit Limit number of responses
|
||||
* @param int $offset Offset for first response
|
||||
|
||||
@ -1743,21 +1743,26 @@ else
|
||||
// Show links to link elements
|
||||
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
|
||||
// Link for paypal payment
|
||||
/*
|
||||
if (! empty($conf->paypal->enabled) && $object->statut != 0) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';
|
||||
print showPaypalPaymentUrl('invoice', $object->ref);
|
||||
}
|
||||
*/
|
||||
|
||||
// Shon online payment link
|
||||
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
|
||||
|
||||
if ($useonlinepayment)
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
print showOnlinePaymentUrl('membersubscription', $object->ref);
|
||||
}
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
// List of actions on element
|
||||
/* Already in tab Agenda/Events
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'member', $socid);
|
||||
$somethingshown = $formactions->showactions($object, 'member', $socid, 1);
|
||||
*/
|
||||
print '</div></div></div>';
|
||||
|
||||
|
||||
@ -158,6 +158,7 @@ class Adherent extends CommonObject
|
||||
$from=$conf->email_from;
|
||||
if (! empty($conf->global->ADHERENT_MAIL_FROM)) $from=$conf->global->ADHERENT_MAIL_FROM;
|
||||
|
||||
// Send email (substitutionarray must be done just before this)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$mailfile = new CMailFile($subjecttosend, $this->email, $from, $texttosend, $filename_list, $mimetype_list, $mimefilename_list, $addr_cc, $addr_bcc, $deliveryreceipt, $msgishtml);
|
||||
if ($mailfile->sendfile())
|
||||
@ -198,6 +199,9 @@ class Adherent extends CommonObject
|
||||
$infos.= $langs->transnoentities("Town").": ".$this->town."\n";
|
||||
$infos.= $langs->transnoentities("Country").": ".$this->country."\n";
|
||||
$infos.= $langs->transnoentities("EMail").": ".$this->email."\n";
|
||||
$infos.= $langs->transnoentities("PhonePro").": ".$this->phone."\n";
|
||||
$infos.= $langs->transnoentities("PhonePerso").": ".$this->phone_perso."\n";
|
||||
$infos.= $langs->transnoentities("PhoneMobile").": ".$this->phone_mobile."\n";
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
$infos.= $langs->transnoentities("Login").": ".$this->login."\n";
|
||||
@ -242,6 +246,11 @@ class Adherent extends CommonObject
|
||||
'%PHOTO%'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo,
|
||||
'%LOGIN%'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login,
|
||||
'%PASSWORD%'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass,
|
||||
'%TYPE%'=>$msgishtml?dol_htmlentitiesbr($this->type):$this->type,
|
||||
'%PHONE_PRO%'=>$msgishtml?dol_htmlentitiesbr($this->phone):$this->phone,
|
||||
'%PHONE_PERSO%'=>$msgishtml?dol_htmlentitiesbr($this->phone_perso):$this->phone_perso,
|
||||
'%PHONE_MOBILE%'=>$msgishtml?dol_htmlentitiesbr($this->phone_mobile):$this->phone_mobile,
|
||||
// For backward compatibility
|
||||
'%INFOS%'=>$msgishtml?dol_htmlentitiesbr($infos):$infos,
|
||||
'%SOCIETE%'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe,
|
||||
'%PRENOM%'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname,
|
||||
@ -316,10 +325,10 @@ class Adherent extends CommonObject
|
||||
$sql.= " '".$this->db->idate($this->datec)."'";
|
||||
$sql.= ", ".($this->login?"'".$this->db->escape($this->login)."'":"null");
|
||||
$sql.= ", ".($user->id>0?$user->id:"null"); // Can be null because member can be created by a guest or a script
|
||||
$sql.= ", null, null, '".$this->morphy."'";
|
||||
$sql.= ", '".$this->typeid."'";
|
||||
$sql.= ", null, null, '".$this->db->escape($this->morphy)."'";
|
||||
$sql.= ", ".$this->typeid;
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", ".(! empty($this->import_key) ? "'".$this->import_key."'":"null");
|
||||
$sql.= ", ".(! empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'":"null");
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
@ -438,17 +447,17 @@ class Adherent extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||
$sql.= " civility = ".(!is_null($this->civility_id)?"'".$this->civility_id."'":"null");
|
||||
$sql.= " civility = ".(!is_null($this->civility_id)?$this->db->escape($this->civility_id):"null");
|
||||
$sql.= ", firstname = ".($this->firstname?"'".$this->db->escape($this->firstname)."'":"null");
|
||||
$sql.= ", lastname=" .($this->lastname?"'".$this->db->escape($this->lastname)."'":"null");
|
||||
$sql.= ", login=" .($this->login?"'".$this->db->escape($this->login)."'":"null");
|
||||
$sql.= ", societe=" .($this->societe?"'".$this->db->escape($this->societe)."'":"null");
|
||||
$sql.= ", fk_soc=" .($this->fk_soc > 0?"'".$this->fk_soc."'":"null");
|
||||
$sql.= ", fk_soc=" .($this->fk_soc > 0?$this->db->escape($this->fk_soc):"null");
|
||||
$sql.= ", address=" .($this->address?"'".$this->db->escape($this->address)."'":"null");
|
||||
$sql.= ", zip=" .($this->zip?"'".$this->db->escape($this->zip)."'":"null");
|
||||
$sql.= ", town=" .($this->town?"'".$this->db->escape($this->town)."'":"null");
|
||||
$sql.= ", country=".($this->country_id>0?"'".$this->country_id."'":"null");
|
||||
$sql.= ", state_id=".($this->state_id>0?"'".$this->state_id."'":"null");
|
||||
$sql.= ", country=".($this->country_id>0?$this->db->escape($this->country_id):"null");
|
||||
$sql.= ", state_id=".($this->state_id>0?$this->db->escape($this->state_id):"null");
|
||||
$sql.= ", email='".$this->db->escape($this->email)."'";
|
||||
$sql.= ", skype='".$this->db->escape($this->skype)."'";
|
||||
$sql.= ", phone=" .($this->phone?"'".$this->db->escape($this->phone)."'":"null");
|
||||
@ -456,7 +465,7 @@ class Adherent extends CommonObject
|
||||
$sql.= ", phone_mobile=" .($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null");
|
||||
$sql.= ", note_private=" .($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
|
||||
$sql.= ", note_public=" .($this->note_public?"'".$this->db->escape($this->note_public)."'":"null");
|
||||
$sql.= ", photo=" .($this->photo?"'".$this->photo."'":"null");
|
||||
$sql.= ", photo=" .($this->photo?"'".$this->db->escape($this->photo)."'":"null");
|
||||
$sql.= ", public='".$this->db->escape($this->public)."'";
|
||||
$sql.= ", statut=" .$this->statut;
|
||||
$sql.= ", fk_adherent_type=".$this->typeid;
|
||||
|
||||
@ -134,7 +134,7 @@ class AdherentType extends CommonObject
|
||||
$sql.= "note = '".$this->db->escape($this->note)."',";
|
||||
$sql.= "vote = '".$this->db->escape($this->vote)."',";
|
||||
$sql.= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
|
||||
$sql .= " WHERE rowid =".$this->id;
|
||||
$sql.= " WHERE rowid =".$this->id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
@ -252,7 +252,7 @@ class AdherentType extends CommonObject
|
||||
|
||||
$sql = "SELECT rowid, libelle";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
$sql.= " WHERE entity IN (".getEntity('adherent').")";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -52,7 +52,7 @@ $result=restrictedArea($user,'adherent',$id);
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||
$offset = $conf->liste_limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
@ -138,8 +138,8 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
||||
|
||||
$parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -151,7 +151,7 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search="";
|
||||
$search_ref="";
|
||||
@ -249,8 +249,9 @@ foreach ($search_array_options as $key => $val)
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
}
|
||||
@ -594,8 +595,8 @@ if (! empty($arrayfields['t.libelle']['checked'])) print_liste_field_titr
|
||||
if (! empty($arrayfields['d.address']['checked'])) print_liste_field_titre($arrayfields['d.address']['label'],$_SERVER["PHP_SELF"],'d.address','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.zip']['checked'])) print_liste_field_titre($arrayfields['d.zip']['label'],$_SERVER["PHP_SELF"],'d.zip','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.town']['checked'])) print_liste_field_titre($arrayfields['d.town']['label'],$_SERVER["PHP_SELF"],'d.town','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.town']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.phone']['checked'])) print_liste_field_titre($arrayfields['d.phone']['label'],$_SERVER["PHP_SELF"],'d.phone','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.phone_perso']['checked'])) print_liste_field_titre($arrayfields['d.phone_perso']['label'],$_SERVER["PHP_SELF"],'d.phone_perso','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['d.phone_mobile']['label'],$_SERVER["PHP_SELF"],'d.phone_mobile','',$param,'',$sortfield,$sortorder);
|
||||
@ -611,7 +612,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
$sortonfield = "ef.".$key;
|
||||
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
|
||||
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
||||
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ else
|
||||
|
||||
$head = member_stats_prepare_head($adh);
|
||||
|
||||
dol_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), 0, 'user');
|
||||
dol_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), -1, 'user');
|
||||
|
||||
|
||||
// Print title
|
||||
|
||||
@ -198,7 +198,7 @@ if ($mode)
|
||||
|
||||
$head = member_stats_prepare_head($adh);
|
||||
|
||||
dol_fiche_head($head, $tab, $langs->trans("Statistics"), 0, 'user');
|
||||
dol_fiche_head($head, $tab, $langs->trans("Statistics"), -1, 'user');
|
||||
|
||||
|
||||
// Print title
|
||||
|
||||
@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("bills");
|
||||
@ -113,7 +114,6 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
|
||||
if ($result < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$errmsg=$langs->trans($company->error);
|
||||
setEventMessages($company->error, $company->errors, 'errors');
|
||||
}
|
||||
else
|
||||
@ -123,7 +123,7 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
|
||||
}
|
||||
else
|
||||
{
|
||||
$errmsg=$object->error;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
{
|
||||
$paymentdate=dol_mktime(0, 0, 0, $_POST["paymentmonth"], $_POST["paymentday"], $_POST["paymentyear"]);
|
||||
}
|
||||
$subscription=$_POST["subscription"]; // Amount of subscription
|
||||
$subscription=price2num(GETPOST("subscription",'alpha')); // Amount of subscription
|
||||
$label=$_POST["label"];
|
||||
|
||||
// Payment informations
|
||||
@ -229,6 +229,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateSubscription"));
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
$action='addsubscription';
|
||||
}
|
||||
if (GETPOST('end') && ! $datesubend)
|
||||
@ -236,6 +237,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateEndSubscription"));
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
$action='addsubscription';
|
||||
}
|
||||
if (! $datesubend)
|
||||
@ -246,16 +248,20 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
{
|
||||
$error++;
|
||||
$errmsg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment"));
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
$action='addsubscription';
|
||||
}
|
||||
|
||||
$amount = price2num(GETPOST("subscription",'alpha'));
|
||||
|
||||
// Check if a payment is mandatory or not
|
||||
if (! $error && $adht->subscription) // Member type need subscriptions
|
||||
{
|
||||
if (! is_numeric($_POST["subscription"]))
|
||||
if (! is_numeric($amount))
|
||||
{
|
||||
// If field is '' or not a numeric value
|
||||
$errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
$error++;
|
||||
$action='addsubscription';
|
||||
}
|
||||
@ -273,7 +279,11 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
{
|
||||
if ($_POST["accountid"]) $errmsg=$langs->trans("ErrorDoNotProvideAccountsIfNullAmount");
|
||||
}
|
||||
if ($errmsg) $action='addsubscription';
|
||||
if ($errmsg)
|
||||
{
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
$action='addsubscription';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -319,6 +329,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
{
|
||||
$error++;
|
||||
$errmsg=$db->lasterror();
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -326,14 +337,16 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
$error++;
|
||||
$errmsg=$acct->error;
|
||||
$errmsgs=$acct->errors;
|
||||
}
|
||||
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$errmsg=$acct->error;
|
||||
$errmsgs=$acct->errors;
|
||||
}
|
||||
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// If option choosed, we create invoice
|
||||
@ -351,6 +364,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
{
|
||||
$langs->load("errors");
|
||||
$errmsg=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst");
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -361,6 +375,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
{
|
||||
$errmsg=$customer->error;
|
||||
$errmsgs=$acct->errors;
|
||||
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -378,6 +393,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
{
|
||||
$error++;
|
||||
$errmsg='ErrorNoPaymentTermRECEPFound';
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
}
|
||||
}
|
||||
$invoice->socid=$object->fk_soc;
|
||||
@ -395,6 +411,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
{
|
||||
$errmsg=$invoice->error;
|
||||
$errmsgs=$invoice->errors;
|
||||
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -415,6 +432,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
if ($result <= 0)
|
||||
{
|
||||
$errmsg=$invoice->error;
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -427,6 +445,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
{
|
||||
$errmsg=$invoice->error;
|
||||
$errmsgs=$invoice->errors;
|
||||
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -454,6 +473,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
{
|
||||
$errmsg=$paiement->error;
|
||||
$errmsgs=$paiement->errors;
|
||||
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -535,6 +555,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
if ($result < 0)
|
||||
{
|
||||
$errmsg=$object->error;
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -768,14 +789,10 @@ if ($rowid > 0)
|
||||
if ($object->statut > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'&action=addsubscription">'.$langs->trans("AddSubscription")."</a></div>";
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("AddSubscription").'</a></div>';
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* List of subscriptions
|
||||
*/
|
||||
@ -788,7 +805,7 @@ if ($rowid > 0)
|
||||
$sql.= " c.datef,";
|
||||
$sql.= " c.fk_bank,";
|
||||
$sql.= " b.rowid as bid,";
|
||||
$sql.= " ba.rowid as baid, ba.label, ba.bank, ba.ref, ba.account_number, ba.accountancy_journal, ba.number";
|
||||
$sql.= " ba.rowid as baid, ba.label, ba.bank, ba.ref, ba.account_number, ba.fk_accountancy_journal, ba.number";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||
@ -837,7 +854,12 @@ if ($rowid > 0)
|
||||
$accountstatic->id=$objp->baid;
|
||||
$accountstatic->number=$objp->number;
|
||||
$accountstatic->account_number=$objp->account_number;
|
||||
$accountstatic->accountancy_journal=$objp->accountancy_journal;
|
||||
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$accountingjournal->fetch($objp->fk_accountancy_journal);
|
||||
|
||||
$accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1);
|
||||
|
||||
$accountstatic->ref=$objp->ref;
|
||||
print $accountstatic->getNomUrl(1);
|
||||
}
|
||||
@ -856,24 +878,21 @@ if ($rowid > 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
// Link for paypal payment
|
||||
if (! empty($conf->paypal->enabled))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
|
||||
print showPaypalPaymentUrl('membersubscription',$object->ref);
|
||||
}
|
||||
|
||||
// Link for stripe payment
|
||||
if (! empty($conf->stripe->enabled))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/stripe/lib/stripe.lib.php';
|
||||
print showStripePaymentUrl('membersubscription',$object->ref);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Shon online payment link
|
||||
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
|
||||
|
||||
if ($useonlinepayment)
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
print showOnlinePaymentUrl('membersubscription', $object->ref);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Add new subscription form
|
||||
*/
|
||||
|
||||
@ -39,7 +39,7 @@ $errmsg='';
|
||||
$action=GETPOST("action",'alpha');
|
||||
$rowid=GETPOST("rowid","int")?GETPOST("rowid","int"):GETPOST("id","int");
|
||||
$typeid=GETPOST("typeid","int");
|
||||
$cancel=GETPOST('cancel');
|
||||
$cancel=GETPOST('cancel','alpha');
|
||||
$confirm=GETPOST('confirm');
|
||||
|
||||
if (! $user->rights->adherent->cotisation->lire)
|
||||
@ -187,7 +187,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
|
||||
print "<input type=\"hidden\" name=\"rowid\" value=\"$rowid\">";
|
||||
print "<input type=\"hidden\" name=\"fk_bank\" value=\"".$object->fk_bank."\">";
|
||||
|
||||
|
||||
dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
@ -199,7 +199,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
||||
print '<td class="valeur" colspan="3">';
|
||||
print $form->showrefnav($object, 'rowid', $linkback, 1);
|
||||
print '</td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Member
|
||||
$adh->ref=$adh->getFullName($langs);
|
||||
@ -248,15 +248,15 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '</form>';
|
||||
print "\n";
|
||||
}
|
||||
@ -274,7 +274,7 @@ if ($rowid && $action != 'edit')
|
||||
|
||||
$head = subscription_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'general', $langs->trans("Subscription"), '', 'payment');
|
||||
dol_fiche_head($head, 'general', $langs->trans("Subscription"), -1, 'payment');
|
||||
|
||||
// Confirmation to delete subscription
|
||||
if ($action == 'delete')
|
||||
@ -292,13 +292,13 @@ if ($rowid && $action != 'edit')
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'rowid', $linkback, 1);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
// Member
|
||||
$adh->ref=$adh->getFullName($langs);
|
||||
print '<tr>';
|
||||
@ -349,7 +349,7 @@ if ($rowid && $action != 'edit')
|
||||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '</form>';
|
||||
|
||||
dol_fiche_end();
|
||||
@ -379,11 +379,11 @@ if ($rowid && $action != 'edit')
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
||||
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
|
||||
// Documents generes
|
||||
/*
|
||||
$filename = dol_sanitizeFileName($object->ref);
|
||||
@ -391,35 +391,29 @@ if ($rowid && $action != 'edit')
|
||||
$urlsource = $_SERVER['PHP_SELF'] . '?facid=' . $object->id;
|
||||
$genallowed = $user->rights->facture->creer;
|
||||
$delallowed = $user->rights->facture->supprimer;
|
||||
|
||||
|
||||
print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
|
||||
$somethingshown = $formfile->numoffiles;
|
||||
*/
|
||||
// Show links to link elements
|
||||
//$linktoelem = $form->showLinkToObjectBlock($object, null, array('subscription'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, '');
|
||||
|
||||
|
||||
// Show links to link elements
|
||||
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
|
||||
// Link for paypal payment
|
||||
/*
|
||||
if (! empty($conf->paypal->enabled) && $object->statut != 0) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';
|
||||
print showPaypalPaymentUrl('invoice', $object->ref);
|
||||
}
|
||||
*/
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
// List of actions on element
|
||||
/*
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'invoice', $socid);
|
||||
$somethingshown = $formactions->showactions($object, 'invoice', $socid, 1);
|
||||
*/
|
||||
|
||||
print '</div></div></div>';
|
||||
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -53,7 +53,17 @@ $result = $object->fetch($rowid);
|
||||
|
||||
$head = subscription_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'info', $langs->trans("Subscription"), '', 'payment');
|
||||
dol_fiche_head($head, 'info', $langs->trans("Subscription"), -1, 'payment');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'rowid', $linkback, 1);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
$object->info($rowid);
|
||||
|
||||
@ -64,5 +74,7 @@ print '</td></tr></table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -46,7 +46,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||
$offset = $limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
@ -75,8 +75,8 @@ $result=restrictedArea($user,'adherent','','','cotisation');
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
||||
|
||||
$parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -88,7 +88,7 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search="";
|
||||
$search_ref="";
|
||||
@ -155,7 +155,7 @@ if ($result)
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
|
||||
$i = 0;
|
||||
|
||||
$title=$langs->trans("ListOfSubscriptions");
|
||||
@ -171,7 +171,7 @@ if ($result)
|
||||
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
|
||||
$arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
@ -181,7 +181,7 @@ if ($result)
|
||||
if ($user->rights->adherent->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
//if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -191,7 +191,7 @@ if ($result)
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
|
||||
|
||||
if ($sall)
|
||||
@ -200,11 +200,11 @@ if ($result)
|
||||
}
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
|
||||
$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";
|
||||
|
||||
@ -237,33 +237,33 @@ if ($result)
|
||||
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 '</td>';
|
||||
|
||||
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"c.rowid",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"c.note",$param,"",'align="left"',$sortfield,$sortorder);
|
||||
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($langs->trans("Account"),$_SERVER["PHP_SELF"],"b.fk_account",$pram,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"b.fk_account",$pram,"","",$sortfield,$sortorder);
|
||||
}
|
||||
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"c.subscription",$param,"",'align="right"',$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);
|
||||
@ -286,7 +286,7 @@ if ($result)
|
||||
$adherent->login=$obj->login;
|
||||
$adherent->photo=$obj->photo;
|
||||
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -329,7 +329,7 @@ if ($result)
|
||||
|
||||
// Price
|
||||
print '<td align="right">'.price($obj->subscription).'</td>';
|
||||
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
print "</tr>";
|
||||
@ -338,7 +338,7 @@ if ($result)
|
||||
}
|
||||
|
||||
// Total
|
||||
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print "<td>".$langs->trans("Total")."</td>\n";
|
||||
print "<td align=\"right\"> </td>\n";
|
||||
|
||||
@ -69,7 +69,7 @@ $extrafields = new ExtraFields($db);
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('adherent_type');
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_lastname="";
|
||||
$search_login="";
|
||||
@ -347,8 +347,9 @@ if ($rowid > 0)
|
||||
|
||||
|
||||
/*
|
||||
* Hotbar
|
||||
* Buttons
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
// Edit
|
||||
@ -389,13 +390,13 @@ if ($rowid > 0)
|
||||
}
|
||||
if ($status != '')
|
||||
{
|
||||
$sql.= " AND d.statut IN (".$status.")"; // Peut valoir un nombre ou liste de nombre separes par virgules
|
||||
$sql.= " AND d.statut IN (".$db->escape($status).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
|
||||
}
|
||||
if ($action == 'search')
|
||||
{
|
||||
if (GETPOST('search'))
|
||||
{
|
||||
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search'));
|
||||
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search','alpha'));
|
||||
}
|
||||
}
|
||||
if (! empty($search_lastname))
|
||||
@ -482,18 +483,8 @@ if ($rowid > 0)
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Nature"),$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("EndSubscription"),$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<tr class="liste_titre">';
|
||||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
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>';
|
||||
@ -516,6 +507,16 @@ if ($rowid > 0)
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre( $langs->trans("Name")." / ".$langs->trans("Company"),$_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("Nature",$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("EMail",$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("EndSubscription",$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Action",$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
@ -645,9 +646,9 @@ if ($rowid > 0)
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="15%">'.$langs->trans("Ref").'</td><td>'.$object->id.'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->id.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="label" size="40" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" size="40" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
print $form->selectyesno("subscription",$object->subscription,1);
|
||||
|
||||
@ -131,12 +131,11 @@ if (preg_match('/del_(.*)/',$action,$reg))
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
llxHeader('', $langs->trans("AgendaSetup"), $wikihelp);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
@ -67,11 +67,11 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||
|
||||
$textobject=$langs->transnoentitiesnoconv("Agenda");
|
||||
|
||||
llxHeader('',$langs->trans("AgendaSetup"));
|
||||
$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
llxHeader('', $langs->trans("AgendaSetup"), $wikihelp);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
|
||||
print "<br>\n";
|
||||
|
||||
$head=agenda_prepare_head();
|
||||
|
||||
|
||||
@ -125,11 +125,11 @@ $formother=new FormOther($db);
|
||||
$arrayofjs=array();
|
||||
$arrayofcss=array();
|
||||
|
||||
llxHeader('',$langs->trans("AgendaSetup"),'','',0,0,$arrayofjs,$arrayofcss);
|
||||
$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
llxHeader('',$langs->trans("AgendaSetup"),$wikihelp,'',0,0,$arrayofjs,$arrayofcss);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
|
||||
print '<br>';
|
||||
|
||||
print '<form name="extsitesconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -210,7 +210,7 @@ while ($i <= $MAXAGENDA)
|
||||
$color='AGENDA_EXT_COLOR'.$key;
|
||||
$enabled='AGENDA_EXT_ENABLED'.$key;
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
// Nb
|
||||
print '<td width="180" class="nowrap">'.$langs->trans("AgendaExtNb",$key)."</td>";
|
||||
|
||||
@ -42,7 +42,7 @@ $action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$param = GETPOST('param','alpha');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$scandir = GETPOST('scan_dir','alpha');
|
||||
$type = 'action';
|
||||
|
||||
|
||||
@ -174,12 +174,12 @@ else if ($action == 'setdoc')
|
||||
|
||||
$formactions=new FormActions($db);
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
llxHeader();
|
||||
|
||||
$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
llxHeader('', $langs->trans("AgendaSetup"),$wikihelp);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
|
||||
|
||||
@ -273,7 +273,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print '<td align="center">'."\n";
|
||||
if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name")
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'&type=action">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=action">';
|
||||
print img_picto($langs->trans("Enabled"),'switch_on');
|
||||
print '</a>';
|
||||
}
|
||||
@ -286,7 +286,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
else
|
||||
{
|
||||
print '<td align="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'&type=action">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=action">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -298,7 +298,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'&type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -385,41 +385,10 @@ print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
$tmplist=array('show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_list'=>$langs->trans("ViewList"), 'show_peruser'=>$langs->trans("ViewPerUser"));
|
||||
$tmplist=array('show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
|
||||
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// AGENDA NOTIFICATION
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0)
|
||||
{
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans('AGENDA_NOTIFICATION').'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
|
||||
if (empty($conf->global->AGENDA_NOTIFICATION)) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_NOTIFICATION">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
|
||||
print '</td></tr>'."\n";
|
||||
} else {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_NOTIFICATION">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans('AGENDA_NOTIFICATION_SOUND').'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
|
||||
if (empty($conf->global->AGENDA_NOTIFICATION_SOUND)) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_NOTIFICATION_SOUND">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
|
||||
} else {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_NOTIFICATION_SOUND">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
|
||||
}
|
||||
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
255
htdocs/admin/agenda_reminder.php
Normal file
255
htdocs/admin/agenda_reminder.php
Normal file
@ -0,0 +1,255 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/agenda_reminder.php
|
||||
* \ingroup agenda
|
||||
* \brief Page to setup agenda reminder options
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("other");
|
||||
$langs->load("agenda");
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$param = GETPOST('param','alpha');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$type = 'action';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if (preg_match('/set_(.*)/',$action,$reg))
|
||||
{
|
||||
$code=$reg[1];
|
||||
$value=(GETPOST($code) ? GETPOST($code) : 1);
|
||||
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('/del_(.*)/',$action,$reg))
|
||||
{
|
||||
$code=$reg[1];
|
||||
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
if ($action == 'set')
|
||||
{
|
||||
dolibarr_set_const($db, 'AGENDA_USE_EVENT_TYPE_DEFAULT', GETPOST('AGENDA_USE_EVENT_TYPE_DEFAULT'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', GETPOST('AGENDA_DEFAULT_FILTER_TYPE'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
else if ($action == 'specimen') // For orders
|
||||
{
|
||||
$modele=GETPOST('module','alpha');
|
||||
|
||||
$commande = new CommandeFournisseur($db);
|
||||
$commande->initAsSpecimen();
|
||||
$commande->thirdparty=$specimenthirdparty;
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php",0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound)
|
||||
{
|
||||
require_once $file;
|
||||
|
||||
$module = new $classname($db,$commande);
|
||||
|
||||
if ($module->write_file($commande,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($module->error, $module->errors, 'errors');
|
||||
dol_syslog($module->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
|
||||
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
// Activate a model
|
||||
else if ($action == 'setmodel')
|
||||
{
|
||||
//print "sssd".$value;
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
|
||||
else if ($action == 'del')
|
||||
{
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($conf->global->ACTION_EVENT_ADDON_PDF == "$value") dolibarr_del_const($db, 'ACTION_EVENT_ADDON_PDF',$conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
// Set default model
|
||||
else if ($action == 'setdoc')
|
||||
{
|
||||
if (dolibarr_set_const($db, "ACTION_EVENT_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
||||
{
|
||||
// La constante qui a ete lue en avant du nouveau set
|
||||
// on passe donc par une variable pour avoir un affichage coherent
|
||||
$conf->global->ACTION_EVENT_ADDON_PDF = $value;
|
||||
}
|
||||
|
||||
// On active le modele
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* View
|
||||
*/
|
||||
|
||||
$formactions=new FormActions($db);
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
llxHeader();
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
|
||||
|
||||
$head=agenda_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'reminders', $langs->trans("Agenda"), -1, 'action');
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">';
|
||||
print '<input type="hidden" name="action" value="set">';
|
||||
|
||||
print '<table class="noborder allwidth">'."\n";
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
// AGENDA REMINDER EMAIL
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0)
|
||||
{
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans('AGENDA_REMINDER_EMAIL', $langs->transnoentities("Module2300Name")).'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
|
||||
if (empty($conf->global->AGENDA_REMINDER_EMAIL)) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_REMINDER_EMAIL">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
|
||||
print '</td></tr>'."\n";
|
||||
} else {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_REMINDER_EMAIL">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// AGENDA REMINDER BROWSER
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0)
|
||||
{
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans('AGENDA_REMINDER_BROWSER').'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
|
||||
if (empty($conf->global->AGENDA_REMINDER_BROWSER)) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_REMINDER_BROWSER">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
|
||||
print '</td></tr>'."\n";
|
||||
} else {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_REMINDER_BROWSER">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans('AGENDA_REMINDER_BROWSER_SOUND').'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
|
||||
if (empty($conf->global->AGENDA_REMINDER_BROWSER_SOUND)) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_REMINDER_BROWSER_SOUND">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
|
||||
} else {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_REMINDER_BROWSER_SOUND">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
|
||||
}
|
||||
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center"><input class="button" type="submit" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print "<br>";
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -71,11 +71,11 @@ if ($actionsave)
|
||||
|
||||
if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100;
|
||||
|
||||
llxHeader();
|
||||
$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
llxHeader('', $langs->trans("AgendaSetup"), $wikihelp);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<form name="agendasetupform" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
@ -174,8 +174,8 @@ $message.='<br>';
|
||||
print $message;
|
||||
|
||||
$message=$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'<br>';
|
||||
//$message.=$langs->trans("AgendaUrlOptions2",$user->login,$user->login).'<br>';
|
||||
$message.=$langs->trans("AgendaUrlOptions3",$user->login,$user->login).'<br>';
|
||||
$message.=$langs->trans("AgendaUrlOptionsNotAdmin",$user->login,$user->login).'<br>';
|
||||
$message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>';
|
||||
$message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login);
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013-2014 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
@ -21,15 +22,14 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/bank.php
|
||||
* \ingroup bank
|
||||
* \brief Page to setup the bank module
|
||||
* \ingroup bank
|
||||
* \brief Page to setup the bank module
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("companies");
|
||||
@ -38,12 +38,12 @@ $langs->load("other");
|
||||
$langs->load("banks");
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type = 'bankaccount';
|
||||
|
||||
|
||||
@ -52,100 +52,109 @@ $type = 'bankaccount';
|
||||
*/
|
||||
|
||||
//Order display of bank account
|
||||
if ($action == 'setbankorder')
|
||||
{
|
||||
if (dolibarr_set_const($db, "BANK_SHOW_ORDER_OPTION",GETPOST('value','alpha'),'chaine',0,'',$conf->entity) > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
if ($action == 'setbankorder') {
|
||||
if (dolibarr_set_const($db, "BANK_SHOW_ORDER_OPTION",
|
||||
GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity) > 0) {
|
||||
header("Location: " . $_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
//Auto report last num releve on conciliate
|
||||
if ($action == 'setreportlastnumreleve') {
|
||||
if (dolibarr_set_const($db, "BANK_REPORT_LAST_NUM_RELEVE", 1, 'chaine', 0,
|
||||
'', $conf->entity) > 0) {
|
||||
header("Location: " . $_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
elseif ($action == 'unsetreportlastnumreleve') {
|
||||
if (dolibarr_set_const($db, "BANK_REPORT_LAST_NUM_RELEVE", 0, 'chaine', 0,
|
||||
'', $conf->entity) > 0) {
|
||||
header("Location: " . $_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'specimen')
|
||||
{
|
||||
$modele=GETPOST('module','alpha');
|
||||
|
||||
if ($modele == 'sepamandate')
|
||||
{
|
||||
if ($action == 'specimen') {
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
|
||||
if ($modele == 'sepamandate') {
|
||||
$object = new CompanyBankAccount($db);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
$object = new Account($db);
|
||||
}
|
||||
$object->initAsSpecimen();
|
||||
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/bank/doc/pdf_".$modele.".modules.php",0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname = "pdf_".$modele;
|
||||
$file = '';
|
||||
$classname = '';
|
||||
$filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$file = dol_buildpath($reldir . "core/modules/bank/doc/pdf_" . $modele . ".modules.php",
|
||||
0);
|
||||
if (file_exists($file)) {
|
||||
$filefound = 1;
|
||||
$classname = "pdf_" . $modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound)
|
||||
{
|
||||
|
||||
if ($filefound) {
|
||||
require_once $file;
|
||||
|
||||
|
||||
$module = new $classname($db);
|
||||
|
||||
if ($module->write_file($object,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bank&file=SPECIMEN.pdf");
|
||||
|
||||
if ($module->write_file($object, $langs) > 0) {
|
||||
header("Location: " . DOL_URL_ROOT . "/document.php?modulepart=bank&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
setEventMessages($module->error, null, 'errors');
|
||||
dol_syslog($module->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
|
||||
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
// Activate a model
|
||||
if ($action == 'set')
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
if ($action == 'set') {
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
|
||||
else if ($action == 'del')
|
||||
{
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($conf->global->BANKADDON_PDF == "$value") dolibarr_del_const($db, 'BANKADDON_PDF',$conf->entity);
|
||||
}
|
||||
else if ($action == 'del') {
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0) {
|
||||
if ($conf->global->BANKADDON_PDF == "$value")
|
||||
dolibarr_del_const($db, 'BANKADDON_PDF', $conf->entity);
|
||||
}
|
||||
}
|
||||
// Set default model
|
||||
else if ($action == 'setdoc')
|
||||
{
|
||||
if (dolibarr_set_const($db, "BANKADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
||||
{
|
||||
else if ($action == 'setdoc') {
|
||||
if (dolibarr_set_const($db, "BANKADDON_PDF", $value, 'chaine', 0, '',
|
||||
$conf->entity)) {
|
||||
// The constant that was read before the new set
|
||||
// We therefore requires a variable to have a coherent view
|
||||
$conf->global->BANKADDON_PDF = $value;
|
||||
}
|
||||
|
||||
|
||||
// On active le modele
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($ret > 0) {
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
}
|
||||
@ -156,80 +165,78 @@ else if ($action == 'setdoc')
|
||||
* view
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
llxHeader("",$langs->trans("BankSetupModule"));
|
||||
llxHeader("", $langs->trans("BankSetupModule"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("BankSetupModule"),$linkback,'title_setup');
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
print load_fiche_titre($langs->trans("BankSetupModule"), $linkback,
|
||||
'title_setup');
|
||||
|
||||
$head = bank_admin_prepare_head(null);
|
||||
dol_fiche_head($head, 'general', $langs->trans("BankSetupModule"), -1, 'account');
|
||||
|
||||
$var=true;
|
||||
$var = true;
|
||||
|
||||
$var=! $var;
|
||||
$var = !$var;
|
||||
|
||||
//Show bank account order
|
||||
print load_fiche_titre($langs->trans("BankOrderShow"), '', '');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="140">'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$langs->trans("Example").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Status").'</td>';
|
||||
print '<td width="140">' . $langs->trans("Name") . '</td>';
|
||||
print '<td>' . $langs->trans("Description") . '</td>';
|
||||
print '<td>' . $langs->trans("Example") . '</td>';
|
||||
print '<td align="center">' . $langs->trans("Status") . '</td>';
|
||||
print '<td align="center" width="60"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$bankorder[0][0]=$langs->trans("BankOrderGlobal");
|
||||
$bankorder[0][1]=$langs->trans("BankOrderGlobalDesc");
|
||||
$bankorder[0][2]='BankCode DeskCode BankAccountNumber BankAccountNumberKey';
|
||||
$bankorder[1][0]=$langs->trans("BankOrderES");
|
||||
$bankorder[1][1]=$langs->trans("BankOrderESDesc");
|
||||
$bankorder[1][2]='BankCode DeskCode BankAccountNumberKey BankAccountNumber';
|
||||
$bankorder[0][0] = $langs->trans("BankOrderGlobal");
|
||||
$bankorder[0][1] = $langs->trans("BankOrderGlobalDesc");
|
||||
$bankorder[0][2] = 'BankCode DeskCode BankAccountNumber BankAccountNumberKey';
|
||||
$bankorder[1][0] = $langs->trans("BankOrderES");
|
||||
$bankorder[1][1] = $langs->trans("BankOrderESDesc");
|
||||
$bankorder[1][2] = 'BankCode DeskCode BankAccountNumberKey BankAccountNumber';
|
||||
|
||||
$var = true;
|
||||
$i=0;
|
||||
$i = 0;
|
||||
|
||||
$nbofbank=count($bankorder);
|
||||
while ($i < $nbofbank)
|
||||
{
|
||||
$var = !$var;
|
||||
$nbofbank = count($bankorder);
|
||||
while ($i < $nbofbank) {
|
||||
$var = !$var;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$bankorder[$i][0]."</td><td>\n";
|
||||
print $bankorder[$i][1];
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
$tmparray=explode(' ',$bankorder[$i][2]);
|
||||
foreach($tmparray as $key => $val)
|
||||
{
|
||||
if ($key > 0) print ', ';
|
||||
print $langs->trans($val);
|
||||
}
|
||||
print "</td>\n";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>' . $bankorder[$i][0] . "</td><td>\n";
|
||||
print $bankorder[$i][1];
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
$tmparray = explode(' ', $bankorder[$i][2]);
|
||||
foreach ($tmparray as $key => $val) {
|
||||
if ($key > 0)
|
||||
print ', ';
|
||||
print $langs->trans($val);
|
||||
}
|
||||
print "</td>\n";
|
||||
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == $i)
|
||||
{
|
||||
print '<td align="center">';
|
||||
print img_picto($langs->trans("Activated"),'on');
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbankorder&value='.$i.'">';
|
||||
print img_picto($langs->trans("Disabled"),'off');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '<td> </td>';
|
||||
print '</tr>'."\n";
|
||||
$i++;
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == $i) {
|
||||
print '<td align="center">';
|
||||
print img_picto($langs->trans("Activated"), 'on');
|
||||
print '</td>';
|
||||
}
|
||||
else {
|
||||
print '<td align="center"><a href="' . $_SERVER['PHP_SELF'] . '?action=setbankorder&value=' . $i . '">';
|
||||
print img_picto($langs->trans("Disabled"), 'off');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '<td> </td>';
|
||||
print '</tr>' . "\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</table>' . "\n";
|
||||
|
||||
|
||||
print '<br><br>';
|
||||
@ -257,7 +264,8 @@ if ($resql) {
|
||||
array_push($def, $array[0]);
|
||||
$i ++;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
@ -273,11 +281,10 @@ print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach ($dirmodels as $reldir) {
|
||||
foreach (array('', '/doc') as $valdir) {
|
||||
$dir = dol_buildpath($reldir . "core/modules/bank" . $valdir);
|
||||
|
||||
|
||||
if (is_dir($dir)) {
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle)) {
|
||||
@ -286,23 +293,26 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
|
||||
foreach ($filelist as $file) {
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
|
||||
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/',
|
||||
$file)) {
|
||||
|
||||
if (file_exists($dir . '/' . $file)) {
|
||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||
|
||||
|
||||
require_once $dir . '/' . $file;
|
||||
$module = new $classname($db);
|
||||
|
||||
|
||||
$modulequalified = 1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2)
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL
|
||||
< 2)
|
||||
$modulequalified = 0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1)
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL
|
||||
< 1)
|
||||
$modulequalified = 0;
|
||||
|
||||
|
||||
if ($modulequalified) {
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print(empty($module->name) ? $name : $module->name);
|
||||
@ -312,29 +322,35 @@ foreach ($dirmodels as $reldir)
|
||||
else
|
||||
print $module->description;
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Active
|
||||
if (in_array($name, $def)) {
|
||||
print '<td align="center">' . "\n";
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=del&value=' . $name . '">';
|
||||
print img_picto($langs->trans("Enabled"), 'switch_on');
|
||||
print img_picto($langs->trans("Enabled"),
|
||||
'switch_on');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
print '<td align="center">' . "\n";
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=set&value=' . $name . '&scandir=' . $module->scandir . '&label=' . urlencode($module->name) . '">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</a>';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=set&value=' . $name . '&scan_dir=' . $module->scandir . '&label=' . urlencode($module->name) . '">' . img_picto($langs->trans("Disabled"),
|
||||
'switch_off') . '</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
|
||||
// Default
|
||||
print '<td align="center">';
|
||||
if ($conf->global->BANKADDON_PDF == $name) {
|
||||
print img_picto($langs->trans("Default"), 'on');
|
||||
} else {
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setdoc&value=' . $name . '&scandir=' . $module->scandir . '&label=' . urlencode($module->name) . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"), 'off') . '</a>';
|
||||
print img_picto($langs->trans("Default"),
|
||||
'on');
|
||||
}
|
||||
else {
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setdoc&value=' . $name . '&scan_dir=' . $module->scandir . '&label=' . urlencode($module->name) . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"),
|
||||
'off') . '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Info
|
||||
$htmltooltip = '' . $langs->trans("Name") . ': ' . $module->name;
|
||||
$htmltooltip .= '<br>' . $langs->trans("Type") . ': ' . ($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
@ -342,27 +358,33 @@ foreach ($dirmodels as $reldir)
|
||||
$htmltooltip .= '<br>' . $langs->trans("Width") . '/' . $langs->trans("Height") . ': ' . $module->page_largeur . '/' . $module->page_hauteur;
|
||||
}
|
||||
$htmltooltip .= '<br><br><u>' . $langs->trans("FeaturesSupported") . ':</u>';
|
||||
$htmltooltip .= '<br>' . $langs->trans("Logo") . ': ' . yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>' . $langs->trans("Logo") . ': ' . yn($module->option_logo,
|
||||
1, 1);
|
||||
//$htmltooltip .= '<br>' . $langs->trans("PaymentMode") . ': ' . yn($module->option_modereg, 1, 1);
|
||||
//$htmltooltip .= '<br>' . $langs->trans("PaymentConditions") . ': ' . yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip .= '<br>' . $langs->trans("MultiLanguage") . ': ' . yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip .= '<br>' . $langs->trans("MultiLanguage") . ': ' . yn($module->option_multilang,
|
||||
1, 1);
|
||||
// $htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
|
||||
// $htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
|
||||
//$htmltooltip .= '<br>' . $langs->trans("WatermarkOnDraftOrders") . ': ' . yn($module->option_draft_watermark, 1, 1);
|
||||
|
||||
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
||||
print $form->textwithpicto('', $htmltooltip, 1,
|
||||
0);
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Preview
|
||||
print '<td align="center">';
|
||||
if ($module->type == 'pdf') {
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=specimen&module=' . $name . '">' . img_object($langs->trans("Preview"), 'bill') . '</a>';
|
||||
} else {
|
||||
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=specimen&module=' . $name . '">' . img_object($langs->trans("Preview"),
|
||||
'bill') . '</a>';
|
||||
}
|
||||
else {
|
||||
print img_object($langs->trans("PreviewNotAvailable"),
|
||||
'generic');
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
@ -372,9 +394,51 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
//}
|
||||
|
||||
|
||||
|
||||
print '<br /><br />';
|
||||
|
||||
|
||||
/*
|
||||
* Document templates generators
|
||||
*/
|
||||
//if (! empty($conf->global->MAIN_FEATURES_LEVEL))
|
||||
//{
|
||||
print load_fiche_titre($langs->trans("BankAccountReleveModule"), '', '');
|
||||
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||
print "<tr class=\"liste_titre\">\n";
|
||||
print '<td>' . $langs->trans("Name") . '</td>';
|
||||
print '<td>' . $langs->trans("Description") . '</td>';
|
||||
print '<td align="center" width="60">' . $langs->trans("Status") . "</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print $langs->trans('AccountStatement');
|
||||
print "</td><td>\n";
|
||||
print $langs->trans('AutoReportLastAccountStatement');
|
||||
print '</td>';
|
||||
// Active
|
||||
if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE) {
|
||||
print '<td align="center">' . "\n";
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=unsetreportlastnumreleve">';
|
||||
print img_picto($langs->trans("Enabled"), 'switch_on');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
}
|
||||
else {
|
||||
print '<td align="center">' . "\n";
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setreportlastnumreleve">' . img_picto($langs->trans("Disabled"),
|
||||
'switch_off') . '</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
print '</table>';
|
||||
dol_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user