Merge remote-tracking branch 'refs/remotes/Dolibarr/5.0' into 5.0
This commit is contained in:
commit
d5b7b7ec52
@ -2,6 +2,7 @@
|
|||||||
# from Dolibarr GitHub repository.
|
# from Dolibarr GitHub repository.
|
||||||
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
|
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
|
||||||
|
|
||||||
|
dist: precise
|
||||||
sudo: required
|
sudo: required
|
||||||
|
|
||||||
language: php
|
language: php
|
||||||
@ -10,7 +11,7 @@ php:
|
|||||||
- '5.3'
|
- '5.3'
|
||||||
- '5.4'
|
- '5.4'
|
||||||
- '5.5'
|
- '5.5'
|
||||||
- '5.6'
|
- '5.6.29'
|
||||||
- '7.0'
|
- '7.0'
|
||||||
- '7.1'
|
- '7.1'
|
||||||
- nightly
|
- nightly
|
||||||
|
|||||||
202
ChangeLog
202
ChangeLog
@ -2,7 +2,147 @@
|
|||||||
English Dolibarr ChangeLog
|
English Dolibarr ChangeLog
|
||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
|
|
||||||
|
***** ChangeLog for 5.0.6 compared to 5.0.5 *****
|
||||||
|
FIX: Removed a bad symbolic link into custom directory.
|
||||||
|
FIX: Renaming a resouce 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: #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
|
||||||
|
FIX: CVE-2017-7886
|
||||||
|
FIX: default param
|
||||||
|
FIX: Line of invoices not inserted when using POS module and VAT NPR.
|
||||||
|
FIX: origin & originid on supplierproposal
|
||||||
|
FIX: Redirect to payment page from member subscription page failed if a unique security key was defined.
|
||||||
|
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 *****
|
||||||
|
FIX: #6677 Expired contracts dashboard box does not show the name of the thirdparty
|
||||||
|
FIX: #6813
|
||||||
|
FIX: 6863
|
||||||
|
FIX: #6877
|
||||||
|
FIX: #6881
|
||||||
|
FIX: Better sanitizing of search all parameter.
|
||||||
|
FIX: Correction with author and validator user on orders
|
||||||
|
FIX: dialog window with md theme must not be hidden by left menu part.
|
||||||
|
FIX: doactions hook missing in invoice model page
|
||||||
|
FIX: Fullname when member is a moral entity with no name.
|
||||||
|
FIX: Link to files on bank account tab broken with multicompany FIX: Link to preview on thirdparty broken with multicompany
|
||||||
|
FIX: New vat code not correctly implemented if "1 price per customer".
|
||||||
|
FIX: Pagination of invoices
|
||||||
|
FIX: pagination on resources
|
||||||
|
FIX: REST API not possible to add agendaevents
|
||||||
|
FIX: situation invoice broken due to the all percent application form inside addline form
|
||||||
|
FIX: SQL injection on user/index.php parameter search_statut.
|
||||||
|
FIX: XSS
|
||||||
|
|
||||||
|
***** ChangeLog for 5.0.2 compared to 5.0.1 *****
|
||||||
|
FIX: #6468 + Fix missing translation
|
||||||
|
FIX: #6517 #6525 Autocompletion of thirdparty after n chars not implemented
|
||||||
|
FIX: #6613 Default subject for Supplier proposal emails is filled with a non-existing key
|
||||||
|
FIX: #6614
|
||||||
|
FIX: #6619 Template invoices list do not respect restricted thirdparty user rights
|
||||||
|
FIX: #6621 Documents tab shows greyed out upload form even if the option to show actions not available is disabled
|
||||||
|
FIX: #6623 User card shows "Return to list" link even if the user has no rights to list users
|
||||||
|
FIX: #6636 Complete fix
|
||||||
|
FIX: #6669 User with no permission to edit customer invoices can see a edit button in project entry
|
||||||
|
FIX: #6671 Cannot remove thirdparty type with "#" in its name
|
||||||
|
FIX: #6673 Missing "nature" table header in thirdparty list
|
||||||
|
FIX: #6675 Restricted user with no agenda permissions can see a button to create appointment in thirdparty contact list
|
||||||
|
FIX: #6679 User with restricted supplier invoice permissions can edit project, payment conditions, payment mode
|
||||||
|
FIX: #6680 User with restricted supplier invoice permissions sees "reopen" button even if he has no permission to do it
|
||||||
|
FIX: #6718 Bug: Discount amount is not locally formatted in CommonObject View
|
||||||
|
FIX: #6767 serious critical error, no login possible with postgresql and ipv6.
|
||||||
|
FIX: #6795 #6796
|
||||||
|
FIX: Add option MAIN_MAIL_USE_MULTI_PART to include text content into HTML email and add option MAIN_MAIL_ADD_INLINE_IMAGES_IF_IN_MEDIAS to restore the inline images feature.
|
||||||
|
FIX: ajax autocomplete on clone
|
||||||
|
FIX: A non admin user can not download files attached to user.
|
||||||
|
FIX: Can't download delivery receipts (function dol_check_secure_access_document)
|
||||||
|
FIX: complete hourly rate when not defined into table of time spent
|
||||||
|
FIX: dont get empty "Incoterms : - " string if no incoterm
|
||||||
|
FIX: dont lose supplier ref if no supplier price in database
|
||||||
|
FIX: Enter a direct bank transaction
|
||||||
|
FIX: extrafield css for boolean type
|
||||||
|
FIX: forgotten parameter for right multicompany use
|
||||||
|
FIX: Found duplicate line when it is not.
|
||||||
|
FIX: global $dateSelector isn't the good one, then date selector on objectline_create tpl was hidden
|
||||||
|
FIX: Journal code of bank must be visible of accountaing module on.
|
||||||
|
FIX: length_accounta return variable name
|
||||||
|
FIX: limit+1 dosn't show Total line
|
||||||
|
FIX: No filter on company when showing the link to elements.
|
||||||
|
FIX: overwrapping of weight/volume on rouget template
|
||||||
|
FIX: Several bugs in accounting module.
|
||||||
|
FIX: shared bank account with multicompany not visible in invoice setup
|
||||||
|
FIX: spaces not allowed into vat code
|
||||||
|
FIX: supplier default condition not retrieved on create
|
||||||
|
FIX: supplier order line were always created with rang = 0
|
||||||
|
|
||||||
|
***** ChangeLog for 5.0.1 compared to 5.0.0 *****
|
||||||
|
FIX: #6503: SQL error in "Last pending payment invoices"
|
||||||
|
FIX: #6505 Project elements page shows greyed-out links even if the option to show actions not available is disabled
|
||||||
|
FIX: #6507: Statistics counter show wrong total Contract numbers when the user does not have full access
|
||||||
|
FIX: #6533 #6590
|
||||||
|
FIX: #6535
|
||||||
|
FIX: bank account not visible on payment card
|
||||||
|
FIX: colspan
|
||||||
|
FIX: Data lost during merge of thirdparties
|
||||||
|
FIX: Detection of color brightness
|
||||||
|
FIX: Filter on date lost after submit on time spent page
|
||||||
|
FIX: forgottent fk_unit field on llx_supplier_propaldet
|
||||||
|
FIX: list of projects
|
||||||
|
FIX: LOG_ERROR does not exists. Use LOG_ERR.
|
||||||
|
FIX: Missing total on project overview.
|
||||||
|
FIX: multicurrency management on supplier order/invoice
|
||||||
|
FIX: Notification sending was broken.
|
||||||
|
FIX: origin & origin id on supplier order line
|
||||||
|
FIX: param php doc
|
||||||
|
FIX: Picto of project on dol_banner and box
|
||||||
|
FIX: Some errors when downloading files.
|
||||||
|
|
||||||
***** ChangeLog for 5.0.0 compared to 4.0.* *****
|
***** ChangeLog for 5.0.0 compared to 4.0.* *****
|
||||||
For users:
|
For users:
|
||||||
@ -153,9 +293,67 @@ Dolibarr better:
|
|||||||
- Method commande->set_availability(user, availability_id) removed from commande class, use method commande->availability(availability_id, notrigger).
|
- Method commande->set_availability(user, availability_id) removed from commande class, use method commande->availability(availability_id, notrigger).
|
||||||
|
|
||||||
Dolibarr 5.0 was frozen before PHP 7.1 was released. Unit tests are successful on PHP 7.1 but we don't have enough
|
Dolibarr 5.0 was frozen before PHP 7.1 was released. Unit tests are successful on PHP 7.1 but we don't have enough
|
||||||
feedback to confirm all application is compatible. Current officiel supported PHP versions are PHP 5.3 to 7.0.
|
feedback to confirm whole application is compatible. Current officiel supported PHP versions are PHP 5.3 to 7.0.
|
||||||
|
|
||||||
|
|
||||||
|
***** ChangeLog for 4.0.6 to 4.0.5 *****
|
||||||
|
FIX: #6613 Default subject for Supplier proposal emails is filled with a non-existing key
|
||||||
|
FIX: #6623 User card shows "Return to list" link even if the user has no rights to list users
|
||||||
|
FIX: #6636 Complete fix
|
||||||
|
FIX: #6669 User with no permission to edit customer invoices can see a edit button in project entry
|
||||||
|
FIX: #6671 Cannot remove thirdparty type with "#" in its name
|
||||||
|
FIX: #6673 Missing "nature" table header in thirdparty list
|
||||||
|
FIX: #6675 Restricted user with no agenda permissions can see a button to create appointment in thirdparty contact list
|
||||||
|
FIX: #6677 Expired contracts dashboard box does not show the name of the thirdparty
|
||||||
|
FIX: #6679 User with restricted supplier invoice permissions can edit project, payment conditions, payment mode
|
||||||
|
FIX: #6680 User with restricted supplier invoice permissions sees "reopen" button even if he has no permission to do it
|
||||||
|
FIX: #6813
|
||||||
|
FIX: Correction with author and validator user on orders
|
||||||
|
FIX: doactions hook missing in invoice model page
|
||||||
|
FIX: dont get empty "Incoterms : - " string if no incoterm
|
||||||
|
FIX: dont lose supplier ref if no supplier price in database
|
||||||
|
FIX: forgotten parameter for right multicompany use
|
||||||
|
FIX: global $dateSelector isn't the good one, then date selector on objectline_create tpl was hidden
|
||||||
|
FIX: limit+1 dosn't show Total line
|
||||||
|
FIX: supplier order line were always created with rang = 0
|
||||||
|
|
||||||
|
|
||||||
|
***** ChangeLog for 4.0.5 to 4.0.4 *****
|
||||||
|
FIX: #6234
|
||||||
|
FIX: #6259
|
||||||
|
FIX: #6330
|
||||||
|
FIX: #6360
|
||||||
|
FIX: #6411
|
||||||
|
FIX: #6443
|
||||||
|
FIX: #6444
|
||||||
|
FIX: #6453
|
||||||
|
FIX: #6503: SQL error in "Last pending payment invoices"
|
||||||
|
FIX: #6505 Project elements page shows greyed-out links even if the option to show actions not available is disabled
|
||||||
|
FIX: #6507: Statistics counter show wrong total Contract numbers when the user does not have full access
|
||||||
|
FIX: #6533 #6590
|
||||||
|
FIX: #6619 Template invoices list do not respect restricted thirdparty user rights
|
||||||
|
FIX: #6621 Documents tab shows greyed out upload form even if the option to show actions not available is disabled
|
||||||
|
FIX: add entity param to document link
|
||||||
|
FIX: Can use quote into supplier ref on order line add
|
||||||
|
FIX: Change the customer code only if error on duplicate
|
||||||
|
FIX: Creation of credit note on invoice with deposit stole the discount.
|
||||||
|
FIX: delete bank class lines when we delete bank_categ
|
||||||
|
FIX: deletion of bank tag
|
||||||
|
FIX: detail of deposit and credit not was not visible into final invoice
|
||||||
|
FIX: Error management during bank account creation
|
||||||
|
FIX: error management in bank account deletion.
|
||||||
|
FIX: event status is not modified when assign an user
|
||||||
|
FIX: forgotten fk_facture_fourn attribute on supplierinvoice line object
|
||||||
|
FIX: If bank module on, field must be required to register payment of expense report.
|
||||||
|
FIX: load multicurrency informations on supplier order and bill lines fetch
|
||||||
|
FIX: Missing total on project overview.
|
||||||
|
FIX: multicurrency_subprice
|
||||||
|
FIX: param billed when we change page
|
||||||
|
FIX: protection against infinite loop on hierarchy
|
||||||
|
FIX: Supplier Order list filter by project
|
||||||
|
FIX: the dolCopyDir fails if target dir does not exists.
|
||||||
|
FIX: use param for http links
|
||||||
|
|
||||||
***** ChangeLog for 4.0.4 to 4.0.3 *****
|
***** ChangeLog for 4.0.4 to 4.0.3 *****
|
||||||
FIX: #6227 Document models table header "Unit" is shown in 2 lines in Spanish
|
FIX: #6227 Document models table header "Unit" is shown in 2 lines in Spanish
|
||||||
FIX: #6230
|
FIX: #6230
|
||||||
@ -343,7 +541,7 @@ NEW: Disabled users are striked.
|
|||||||
NEW: Enhance navigation of project module
|
NEW: Enhance navigation of project module
|
||||||
NEW: fichinter lines ordered by rang AND DATE
|
NEW: fichinter lines ordered by rang AND DATE
|
||||||
NEW: hidden conf to use input file multiple from mail form
|
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: 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: 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.
|
NEW: If error is reported during migration process, you can ignore it to avoid to be locked.
|
||||||
|
|||||||
@ -81,14 +81,15 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
|||||||
- Standing orders management (European SEPA)
|
- Standing orders management (European SEPA)
|
||||||
- Bank accounts management
|
- Bank accounts management
|
||||||
- Shared calendar/agenda (with ical and vcal export for third party tools integration)
|
- Shared calendar/agenda (with ical and vcal export for third party tools integration)
|
||||||
- Opportunities and/or project management (following project benefit including invoices, expense reports, time spent, ...)
|
- Opportunities and/or project management
|
||||||
- Projects management
|
- Projects management
|
||||||
- Contracts management
|
- Contracts management
|
||||||
- Stock management
|
- Stock management
|
||||||
- Shipping management
|
- Shipping management
|
||||||
- Interventions management
|
- Interventions management
|
||||||
- Employee's leave requests management
|
- Employee's leave requests management
|
||||||
- Expense report management
|
- Expense reports
|
||||||
|
- Timesheets
|
||||||
- Electronic Document Management (EDM)
|
- Electronic Document Management (EDM)
|
||||||
- Foundations members management
|
- Foundations members management
|
||||||
- Mass emailing
|
- Mass emailing
|
||||||
|
|||||||
@ -10,10 +10,11 @@ Build-Depends: debhelper (>= 9), po-debconf
|
|||||||
|
|
||||||
Package: dolibarr
|
Package: dolibarr
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5,
|
# For debian 7 or 8 or 9
|
||||||
php5-cli,
|
Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5 | libapache2-mod-php | libapache2-mod-phpfilter | php-cgi | php-fpm | php,
|
||||||
|
php5-cli | php-cli,
|
||||||
# Required PHP extensions
|
# Required PHP extensions
|
||||||
php5-mysql | php5-mysqli, php5-curl, php5-gd, php5-ldap,
|
php5-mysql | php5-mysqli | php-mysql | php-mysqli, php5-curl | php-curl, php5-gd | php-gd, php5-ldap | php-gd,
|
||||||
# Required PHP libraries
|
# Required PHP libraries
|
||||||
php-pear, php-mail-mime,
|
php-pear, php-mail-mime,
|
||||||
# php-tcpdf,
|
# php-tcpdf,
|
||||||
@ -30,7 +31,9 @@ Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm |
|
|||||||
${misc:Depends},
|
${misc:Depends},
|
||||||
${perl:Depends}
|
${perl:Depends}
|
||||||
Recommends: apache2 | lighttpd | httpd,
|
Recommends: apache2 | lighttpd | httpd,
|
||||||
mariadb-server | virtual-mysql-server
|
mariadb-server | virtual-mysql-server,
|
||||||
|
# Required PHP extensions for debian 9 but we can't add them into a Depends, it does not exists on debian 7 and 8
|
||||||
|
php-xml, php-mbstring
|
||||||
Suggests: www-browser, php5-geoip
|
Suggests: www-browser, php5-geoip
|
||||||
Description: Web based software to manage a company or foundation
|
Description: Web based software to manage a company or foundation
|
||||||
Dolibarr ERP & CRM is an easy to use open source/free software package for
|
Dolibarr ERP & CRM is an easy to use open source/free software package for
|
||||||
|
|||||||
@ -61,7 +61,7 @@ apache_install() {
|
|||||||
# Enable dolibarr conf
|
# Enable dolibarr conf
|
||||||
if which a2enconf >/dev/null 2>&1 ;then
|
if which a2enconf >/dev/null 2>&1 ;then
|
||||||
# a2enconf exists for ubuntu only
|
# a2enconf exists for ubuntu only
|
||||||
echo "Enable link for Apache config file with a3enconf"
|
echo "Enable link for Apache config file with a2enconf"
|
||||||
a2enconf dolibarr
|
a2enconf dolibarr
|
||||||
else
|
else
|
||||||
if [ -d /etc/$webserver/conf.d ] && [ ! -e /etc/$webserver/conf.d/dolibarr.conf ]; then
|
if [ -d /etc/$webserver/conf.d ] && [ ! -e /etc/$webserver/conf.d/dolibarr.conf ]; then
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
$force_install_packager='deb';
|
$force_install_packager='deb';
|
||||||
$force_install_noedit=2;
|
$force_install_noedit=1;
|
||||||
$force_install_message='KeepDefaultValuesDeb';
|
$force_install_message='KeepDefaultValuesDeb';
|
||||||
#$force_install_main_data_root='/usr/share/dolibarr/documents';
|
#$force_install_main_data_root='/usr/share/dolibarr/documents';
|
||||||
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
||||||
|
|||||||
@ -4,7 +4,12 @@ dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jsgantt/*
|
|||||||
dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jstz/*
|
dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jstz/*
|
||||||
# Those are false positives, the files are their own sources since
|
# Those are false positives, the files are their own sources since
|
||||||
# they are not minified
|
# they are not minified
|
||||||
source-is-missing htdocs/includes/jsgantt/jsgantt.js *
|
source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/a11yhelp/dialogs/lang/*.js
|
||||||
source-is-missing htdocs/includes/jquery/plugins/colorpicker/jquery.colorpicker.js *
|
source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/specialchar/dialogs/lang/*.js
|
||||||
source-is-missing htdocs/includes/jquery/plugins/select2/select2.js *
|
source-is-missing htdocs/includes/ckeditor/ckeditor/lang/*.js
|
||||||
source-is-missing htdocs/includes/jquery/plugins/select2/select2_locale_ar.js *
|
source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/*/dialogs/*.js
|
||||||
|
source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/*/filter/*.js
|
||||||
|
source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/templates/templates/default.js
|
||||||
|
source-is-missing htdocs/includes/mobiledetect/mobiledetectlib/Mobile_Detect.json
|
||||||
|
source-is-missing htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/*.js
|
||||||
|
|
||||||
|
|||||||
@ -353,8 +353,10 @@ begin
|
|||||||
begin
|
begin
|
||||||
// TODO Copy file or ask to install package ?
|
// TODO Copy file or ask to install package ?
|
||||||
//CustomMessage('YouWillInstallDoliWamp')+#13#13
|
//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;
|
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
|
// If we have a new database version, we should only copy old my.ini file into new directory
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
// during install process to be used.
|
// 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_message='KeepDefaultValuesWamp';
|
||||||
$force_install_main_data_root='WAMPROOT/dolibarr_documents';
|
$force_install_main_data_root='WAMPROOT/dolibarr_documents';
|
||||||
$force_install_type='mysqli';
|
$force_install_type='mysqli';
|
||||||
|
|||||||
@ -54,7 +54,7 @@ if ($release != DOL_VERSION)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml';
|
//$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml';
|
||||||
$outputdir=dirname(__FILE__).'/../htdocs/install';
|
$outputdir=dirname(dirname(__FILE__)).'/htdocs/install';
|
||||||
print 'Delete current files '.$outputdir.'/filelist*.xml'."\n";
|
print 'Delete current files '.$outputdir.'/filelist*.xml'."\n";
|
||||||
dol_delete_file($outputdir.'/filelist*.xml',0,1,1);
|
dol_delete_file($outputdir.'/filelist*.xml',0,1,1);
|
||||||
|
|
||||||
|
|||||||
@ -14,12 +14,12 @@
|
|||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
use Cwd;
|
use Cwd;
|
||||||
|
use Term::ANSIColor;
|
||||||
|
|
||||||
# Change this to defined target for option 98 and 99
|
# Change this to defined target for option 98 and 99
|
||||||
$PROJECT="dolibarr";
|
$PROJECT="dolibarr";
|
||||||
$PUBLISHSTABLE="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr";
|
$PUBLISHSTABLE="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr";
|
||||||
$PUBLISHBETARC="ldestailleur\@asso.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files";
|
$PUBLISHBETARC="ldestailleur\@vmprod.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files";
|
||||||
|
|
||||||
|
|
||||||
#@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages
|
#@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages
|
||||||
@ -313,20 +313,6 @@ foreach my $target (sort keys %CHOOSEDTARGET) {
|
|||||||
|
|
||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
# Build xml check file
|
|
||||||
#-----------------------
|
|
||||||
if ($CHOOSEDTARGET{'-CHKSUM'})
|
|
||||||
{
|
|
||||||
print 'Create xml check file with md5 checksum with command php '.$SOURCE.'/build/generate_filecheck_xml.php release='.$MAJOR.'.'.$MINOR.'.'.$BUILD."\n";
|
|
||||||
$ret=`php $SOURCE/build/generate_filelist_xml.php release=$MAJOR.$MINOR.$BUILD`;
|
|
||||||
print $ret."\n";
|
|
||||||
# Copy to final dir
|
|
||||||
$NEWDESTI=$DESTI;
|
|
||||||
print "Copy \"$SOURCE/htdocs/install/filelist-$MAJOR.$MINOR.$BUILD.xml\" to $NEWDESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml\n";
|
|
||||||
use File::Copy qw(copy);
|
|
||||||
copy "$SOURCE/htdocs/install/filelist-$MAJOR.$MINOR.$BUILD.xml", "$NEWDESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#print join(',',sort keys %CHOOSEDTARGET)."\n";
|
#print join(',',sort keys %CHOOSEDTARGET)."\n";
|
||||||
|
|
||||||
@ -335,7 +321,10 @@ if ($CHOOSEDTARGET{'-CHKSUM'})
|
|||||||
$nboftargetok=0;
|
$nboftargetok=0;
|
||||||
$nboftargetneedbuildroot=0;
|
$nboftargetneedbuildroot=0;
|
||||||
$nbofpublishneedtag=0;
|
$nbofpublishneedtag=0;
|
||||||
|
$nbofpublishneedchangelog=0;
|
||||||
|
|
||||||
foreach my $target (sort keys %CHOOSEDTARGET) {
|
foreach my $target (sort keys %CHOOSEDTARGET) {
|
||||||
|
if ($target eq '-CHKSUM') { $nbofpublishneedchangelog++; }
|
||||||
if ($CHOOSEDTARGET{$target} < 0) { next; }
|
if ($CHOOSEDTARGET{$target} < 0) { next; }
|
||||||
if ($target ne 'EXE' && $target ne 'EXEDOLIWAMP' && $target ne '-CHKSUM')
|
if ($target ne 'EXE' && $target ne 'EXEDOLIWAMP' && $target ne '-CHKSUM')
|
||||||
{
|
{
|
||||||
@ -345,34 +334,31 @@ foreach my $target (sort keys %CHOOSEDTARGET) {
|
|||||||
}
|
}
|
||||||
foreach my $target (sort keys %CHOOSEDPUBLISH) {
|
foreach my $target (sort keys %CHOOSEDPUBLISH) {
|
||||||
if ($CHOOSEDPUBLISH{$target} < 0) { next; }
|
if ($CHOOSEDPUBLISH{$target} < 0) { next; }
|
||||||
if ($target eq 'ASSO') { $nbofpublishneedtag++; }
|
if ($target eq 'ASSO') { $nbofpublishneedchangelog++; }
|
||||||
if ($target eq 'SF') { $nbofpublishneedtag++; }
|
if ($target eq 'SF') { $nbofpublishneedchangelog++; $nbofpublishneedtag++; }
|
||||||
$nboftargetok++;
|
$nboftargetok++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($nboftargetok) {
|
if ($nboftargetok) {
|
||||||
|
|
||||||
# Update GIT tag if required
|
# Check Changelog
|
||||||
#---------------------------
|
#----------------
|
||||||
if ($nbofpublishneedtag)
|
if ($nbofpublishneedchangelog)
|
||||||
{
|
{
|
||||||
print "Go to directory $SOURCE\n";
|
|
||||||
$olddir=getcwd();
|
|
||||||
chdir("$SOURCE");
|
|
||||||
|
|
||||||
# Test that the ChangeLog is ok
|
# Test that the ChangeLog is ok
|
||||||
$TMPBUILDTOCHECKCHANGELOG=$BUILD;
|
$TMPBUILDTOCHECKCHANGELOG=$BUILD;
|
||||||
$TMPBUILDTOCHECKCHANGELOG =~ s/\-rc\d*//;
|
$TMPBUILDTOCHECKCHANGELOG =~ s/\-rc\d*//;
|
||||||
$TMPBUILDTOCHECKCHANGELOG =~ s/\-beta\d*//;
|
$TMPBUILDTOCHECKCHANGELOG =~ s/\-beta\d*//;
|
||||||
print "Check if ChangeLog is ok for version $MAJOR.$MINOR\.$TMPBUILDTOCHECKCHANGELOG\n";
|
print "\nCheck if ChangeLog is ok for version $MAJOR.$MINOR\.$TMPBUILDTOCHECKCHANGELOG\n";
|
||||||
$ret=`grep "ChangeLog for $MAJOR.$MINOR\.$TMPBUILDTOCHECKCHANGELOG" "$SOURCE/ChangeLog" 2>&1`;
|
$ret=`grep "ChangeLog for $MAJOR.$MINOR\.$TMPBUILDTOCHECKCHANGELOG" "$SOURCE/ChangeLog" 2>&1`;
|
||||||
if (! $ret)
|
if (! $ret)
|
||||||
{
|
{
|
||||||
print "Error: The ChangeLogFile was not updated. Run the following command before building package for $MAJOR.$MINOR.$BUILD:\n";
|
print color("yellow"), "Error: The ChangeLogFile was not updated. Run the following command before building package for $MAJOR.$MINOR.$BUILD:\n", color('reset');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "ChangeLog for $MAJOR.$MINOR\.$BUILD was found into '$SOURCE/ChangeLog. But you can regenerate it with commande:'\n";
|
print "ChangeLog for $MAJOR.$MINOR\.$BUILD was found into '$SOURCE/ChangeLog. But you can regenerate it with command:'\n";
|
||||||
}
|
}
|
||||||
if (! $BUILD || $BUILD eq '0-rc') # For a major version
|
if (! $BUILD || $BUILD eq '0-rc') # For a major version
|
||||||
{
|
{
|
||||||
@ -385,8 +371,38 @@ if ($nboftargetok) {
|
|||||||
print "\n";
|
print "\n";
|
||||||
if (! $ret)
|
if (! $ret)
|
||||||
{
|
{
|
||||||
exit;
|
print "\nPress F to force and continue anyway (or other key to stop)... ";
|
||||||
|
my $WAITKEY=<STDIN>;
|
||||||
|
chomp($WAITKEY);
|
||||||
|
if ($WAITKEY ne 'F')
|
||||||
|
{
|
||||||
|
print "Canceled.\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Build xml check file
|
||||||
|
#-----------------------
|
||||||
|
if ($CHOOSEDTARGET{'-CHKSUM'})
|
||||||
|
{
|
||||||
|
print 'Create xml check file with md5 checksum with command php '.$SOURCE.'/build/generate_filecheck_xml.php release='.$MAJOR.'.'.$MINOR.'.'.$BUILD."\n";
|
||||||
|
$ret=`php $SOURCE/build/generate_filelist_xml.php release=$MAJOR.$MINOR.$BUILD`;
|
||||||
|
print $ret."\n";
|
||||||
|
# Copy to final dir
|
||||||
|
$NEWDESTI=$DESTI;
|
||||||
|
print "Copy \"$SOURCE/htdocs/install/filelist-$MAJOR.$MINOR.$BUILD.xml\" to $NEWDESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml\n";
|
||||||
|
use File::Copy qw(copy);
|
||||||
|
copy "$SOURCE/htdocs/install/filelist-$MAJOR.$MINOR.$BUILD.xml", "$NEWDESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Update GIT tag if required
|
||||||
|
#---------------------------
|
||||||
|
if ($nbofpublishneedtag)
|
||||||
|
{
|
||||||
|
print "Go to directory $SOURCE\n";
|
||||||
|
$olddir=getcwd();
|
||||||
|
chdir("$SOURCE");
|
||||||
|
|
||||||
print 'Run git tag -a -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n";
|
print 'Run git tag -a -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n";
|
||||||
$ret=`git tag -a -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD" 2>&1`;
|
$ret=`git tag -a -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD" 2>&1`;
|
||||||
@ -509,7 +525,6 @@ if ($nboftargetok) {
|
|||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`;
|
||||||
|
|
||||||
# Removed known external modules to avoid any error when packaging from env where external modules are tested
|
# Removed known external modules to avoid any error when packaging from env where external modules are tested
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom/*`; # For custom we want to keep dir
|
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/allscreens*`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/allscreens*`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ancotec*`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ancotec*`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/cabinetmed*`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/cabinetmed*`;
|
||||||
@ -518,6 +533,7 @@ if ($nboftargetok) {
|
|||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/dolimed*`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/dolimed*`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/dolimod*`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/dolimod*`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/factory*`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/factory*`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/forceproject*`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/lead*`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/lead*`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/management*`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/management*`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`;
|
||||||
@ -554,6 +570,7 @@ if ($nboftargetok) {
|
|||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/doc`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/doc`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/example`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/example`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/test`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/test`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mobiledetect/mobiledetectlib/.gitmodules`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`;
|
||||||
@ -574,6 +591,12 @@ if ($nboftargetok) {
|
|||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
|
||||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`;
|
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/savant`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/savant`;
|
||||||
|
|
||||||
|
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 keep files only
|
||||||
|
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 keep files only
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build package for each target
|
# Build package for each target
|
||||||
|
|||||||
@ -173,6 +173,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/contrat
|
%_datadir/dolibarr/htdocs/contrat
|
||||||
%_datadir/dolibarr/htdocs/core
|
%_datadir/dolibarr/htdocs/core
|
||||||
%_datadir/dolibarr/htdocs/cron
|
%_datadir/dolibarr/htdocs/cron
|
||||||
|
%_datadir/dolibarr/htdocs/custom
|
||||||
%_datadir/dolibarr/htdocs/don
|
%_datadir/dolibarr/htdocs/don
|
||||||
%_datadir/dolibarr/htdocs/ecm
|
%_datadir/dolibarr/htdocs/ecm
|
||||||
%_datadir/dolibarr/htdocs/expedition
|
%_datadir/dolibarr/htdocs/expedition
|
||||||
|
|||||||
@ -253,6 +253,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/contrat
|
%_datadir/dolibarr/htdocs/contrat
|
||||||
%_datadir/dolibarr/htdocs/core
|
%_datadir/dolibarr/htdocs/core
|
||||||
%_datadir/dolibarr/htdocs/cron
|
%_datadir/dolibarr/htdocs/cron
|
||||||
|
%_datadir/dolibarr/htdocs/custom
|
||||||
%_datadir/dolibarr/htdocs/don
|
%_datadir/dolibarr/htdocs/don
|
||||||
%_datadir/dolibarr/htdocs/ecm
|
%_datadir/dolibarr/htdocs/ecm
|
||||||
%_datadir/dolibarr/htdocs/expedition
|
%_datadir/dolibarr/htdocs/expedition
|
||||||
|
|||||||
@ -170,6 +170,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/contrat
|
%_datadir/dolibarr/htdocs/contrat
|
||||||
%_datadir/dolibarr/htdocs/core
|
%_datadir/dolibarr/htdocs/core
|
||||||
%_datadir/dolibarr/htdocs/cron
|
%_datadir/dolibarr/htdocs/cron
|
||||||
|
%_datadir/dolibarr/htdocs/custom
|
||||||
%_datadir/dolibarr/htdocs/don
|
%_datadir/dolibarr/htdocs/don
|
||||||
%_datadir/dolibarr/htdocs/ecm
|
%_datadir/dolibarr/htdocs/ecm
|
||||||
%_datadir/dolibarr/htdocs/expedition
|
%_datadir/dolibarr/htdocs/expedition
|
||||||
|
|||||||
@ -181,6 +181,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/contrat
|
%_datadir/dolibarr/htdocs/contrat
|
||||||
%_datadir/dolibarr/htdocs/core
|
%_datadir/dolibarr/htdocs/core
|
||||||
%_datadir/dolibarr/htdocs/cron
|
%_datadir/dolibarr/htdocs/cron
|
||||||
|
%_datadir/dolibarr/htdocs/custom
|
||||||
%_datadir/dolibarr/htdocs/don
|
%_datadir/dolibarr/htdocs/don
|
||||||
%_datadir/dolibarr/htdocs/ecm
|
%_datadir/dolibarr/htdocs/ecm
|
||||||
%_datadir/dolibarr/htdocs/expedition
|
%_datadir/dolibarr/htdocs/expedition
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$force_install_packager='rpmfedora';
|
$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_message='KeepDefaultValuesDeb';
|
||||||
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
||||||
$force_install_type='mysqli';
|
$force_install_type='mysqli';
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$force_install_packager='rpmgeneric';
|
$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_message='KeepDefaultValuesDeb';
|
||||||
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
||||||
$force_install_type='mysqli';
|
$force_install_type='mysqli';
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$force_install_packager='rpmmandriva';
|
$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_message='KeepDefaultValuesDeb';
|
||||||
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
||||||
$force_install_type='mysqli';
|
$force_install_type='mysqli';
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$force_install_packager='rpmopensuse';
|
$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_message='KeepDefaultValuesDeb';
|
||||||
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
||||||
$force_install_type='mysqli';
|
$force_install_type='mysqli';
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
File diff suppressed because one or more lines are too long
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env php
|
#!/usr/bin/env php
|
||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2017 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -251,7 +252,7 @@ $cleanparam='';
|
|||||||
$i=0;
|
$i=0;
|
||||||
foreach($property as $key => $prop)
|
foreach($property as $key => $prop)
|
||||||
{
|
{
|
||||||
$i++;
|
|
||||||
$addfield=1;
|
$addfield=1;
|
||||||
if ($prop['field'] == 'tms') $addfield=0; // This is a field of type timestamp edited automatically
|
if ($prop['field'] == 'tms') $addfield=0; // This is a field of type timestamp edited automatically
|
||||||
if ($prop['extra'] == 'auto_increment') $addfield=0;
|
if ($prop['extra'] == 'auto_increment') $addfield=0;
|
||||||
@ -263,6 +264,7 @@ foreach($property as $key => $prop)
|
|||||||
$varprop.="';";
|
$varprop.="';";
|
||||||
$varprop.="\n";
|
$varprop.="\n";
|
||||||
}
|
}
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
$targetcontent=preg_replace('/\$sql \.= \' field1,\';/', $varprop, $targetcontent);
|
$targetcontent=preg_replace('/\$sql \.= \' field1,\';/', $varprop, $targetcontent);
|
||||||
$targetcontent=preg_replace('/\$sql \.= \' field2\';/', '', $targetcontent);
|
$targetcontent=preg_replace('/\$sql \.= \' field2\';/', '', $targetcontent);
|
||||||
@ -648,7 +650,7 @@ foreach ($skeletonfiles as $skeletonfile => $outfile)
|
|||||||
{
|
{
|
||||||
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
|
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
|
||||||
{
|
{
|
||||||
$varprop.="print '<tr><td class=\"fieldrequired\">'.\$langs->trans(\"Field".$prop['field']."\").'</td><td>\$object->".$prop['field']."</td></tr>';\n";
|
$varprop.="print '<tr><td class=\"fieldrequired\">'.\$langs->trans(\"Field".$prop['field']."\").'</td><td>'.\$object->".$prop['field'].".'</td></tr>';\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$targetcontent=preg_replace('/LIST_OF_TD_LABEL_FIELDS_VIEW/', $varprop, $targetcontent);
|
$targetcontent=preg_replace('/LIST_OF_TD_LABEL_FIELDS_VIEW/', $varprop, $targetcontent);
|
||||||
|
|||||||
@ -297,8 +297,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
{
|
{
|
||||||
$res = $object->fetch_optionals($object->id, $extralabels);
|
$res = $object->fetch_optionals($object->id, $extralabels);
|
||||||
|
|
||||||
$head = commande_prepare_head($object);
|
|
||||||
dol_fiche_head($head, 'order', $langs->trans("CustomerOrder"), 0, 'order');
|
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("MyModule"));
|
print load_fiche_titre($langs->trans("MyModule"));
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
/* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2016 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2016 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
|
* Copyright (C) 2017 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -440,17 +441,14 @@ while ($i < min($num, $limit))
|
|||||||
// Show here line of result
|
// Show here line of result
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
// LIST_OF_TD_FIELDS_LIST
|
// LIST_OF_TD_FIELDS_LIST
|
||||||
/*
|
foreach ($arrayfields as $key => $value) {
|
||||||
if (! empty($arrayfields['t.field1']['checked']))
|
if (!empty($arrayfields[$key]['checked'])) {
|
||||||
{
|
$key2 = str_replace('t.', '', $key);
|
||||||
print '<td>'.$obj->field1.'</td>';
|
print '<td>' . $obj->$key2 . '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (!$i)
|
||||||
|
$totalarray['nbfield'] ++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['t.field2']['checked']))
|
|
||||||
{
|
|
||||||
print '<td>'.$obj->field2.'</td>';
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
|
||||||
}*/
|
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
@ -523,7 +521,7 @@ if (isset($totalarray['totalhtfield']))
|
|||||||
$i++;
|
$i++;
|
||||||
if ($i == 1)
|
if ($i == 1)
|
||||||
{
|
{
|
||||||
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
if ($num < $limit && empty($offset)) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||||
}
|
}
|
||||||
elseif ($totalarray['totalhtfield'] == $i) print '<td align="right">'.price($totalarray['totalht']).'</td>';
|
elseif ($totalarray['totalhtfield'] == $i) print '<td align="right">'.price($totalarray['totalht']).'</td>';
|
||||||
|
|||||||
@ -300,6 +300,8 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
|
|||||||
if (preg_match('/^BoxTitleLatest/', $value)) $qualifiedforclean=0;
|
if (preg_match('/^BoxTitleLatest/', $value)) $qualifiedforclean=0;
|
||||||
// install.lang
|
// install.lang
|
||||||
if (preg_match('/^KeepDefaultValues/', $value)) $qualifiedforclean=0;
|
if (preg_match('/^KeepDefaultValues/', $value)) $qualifiedforclean=0;
|
||||||
|
// mail.lang
|
||||||
|
if (preg_match('/MailingModuleDesc/i', $value)) $qualifiedforclean=0;
|
||||||
// main.lang
|
// main.lang
|
||||||
if (preg_match('/^Duration/', $value)) $qualifiedforclean=0;
|
if (preg_match('/^Duration/', $value)) $qualifiedforclean=0;
|
||||||
if (preg_match('/^FormatDate/', $value)) $qualifiedforclean=0;
|
if (preg_match('/^FormatDate/', $value)) $qualifiedforclean=0;
|
||||||
|
|||||||
1
htdocs/.gitignore
vendored
1
htdocs/.gitignore
vendored
@ -4,6 +4,7 @@
|
|||||||
/dolimed*
|
/dolimed*
|
||||||
/ecommerce*
|
/ecommerce*
|
||||||
/extensions*
|
/extensions*
|
||||||
|
/forceproject*
|
||||||
/google*
|
/google*
|
||||||
/lead
|
/lead
|
||||||
/multicompany*
|
/multicompany*
|
||||||
|
|||||||
@ -145,13 +145,13 @@ if ($action == 'delete') {
|
|||||||
|
|
||||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active, ";
|
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active, ";
|
||||||
$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
|
$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON aa.account_parent = a2.rowid";
|
// Dirty hack wainting that foreign key account_parent is an integer to be compared correctly with rowid
|
||||||
|
if ($db->type == 'pgsql') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = CAST(aa.account_parent AS INTEGER)";
|
||||||
|
else $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = CAST(aa.account_parent AS UNSIGNED)";
|
||||||
$sql .= " WHERE asy.rowid = " . $pcgver;
|
$sql .= " WHERE asy.rowid = " . $pcgver;
|
||||||
|
|
||||||
if (strlen(trim($search_account))) {
|
if (strlen(trim($search_account))) {
|
||||||
@ -196,10 +196,12 @@ if ($resql) {
|
|||||||
if ($search_pcgsubtype != "") $params.= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
|
if ($search_pcgsubtype != "") $params.= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
|
||||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||||
|
|
||||||
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy');
|
|
||||||
|
|
||||||
print '<form method="GET" action="' . $_SERVER["PHP_SELF"] . '">';
|
print '<form method="GET" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||||
|
|
||||||
|
$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);
|
||||||
|
|
||||||
// Box to select active chart of account
|
// Box to select active chart of account
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
print $langs->trans("Selectchartofaccounts") . " : ";
|
print $langs->trans("Selectchartofaccounts") . " : ";
|
||||||
@ -227,13 +229,7 @@ if ($resql) {
|
|||||||
print "</select>";
|
print "</select>";
|
||||||
print '<input type="submit" class="button" name="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
print '<input type="submit" class="button" name="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print "<br>\n";
|
print '<br>';
|
||||||
|
|
||||||
print '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
|
|
||||||
print '<a class="butAction" href="./categories.php">' . $langs->trans("ApplyMassCategories") . '</a>';
|
|
||||||
// print '<a class="butAction" href="./importaccounts.php">' . $langs->trans("ImportAccount") . '</a>';
|
|
||||||
// print '<a class="butAction" href="./productaccount.php">' . $langs->trans("CheckProductAccountancyCode") . '</a>';
|
|
||||||
print '<br><br>';
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -305,12 +301,12 @@ if ($resql) {
|
|||||||
|
|
||||||
// Action
|
// Action
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if ($user->admin) {
|
if ($user->rights->accounting->chartofaccount) {
|
||||||
print '<a href="./card.php?action=update&id=' . $obj->rowid . '">';
|
print '<a href="./card.php?action=update&id=' . $obj->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?chartofaccounts='.$object->id).'">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a href="./card.php?action=delete&id=' . $obj->rowid . '">';
|
print '<a href="./card.php?action=delete&id=' . $obj->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?chartofaccounts='.$object->id). '">';
|
||||||
print img_delete();
|
print img_delete();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancysystem.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
|
|
||||||
@ -159,13 +160,15 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
|
|||||||
$result = $object->update($user);
|
$result = $object->update($user);
|
||||||
|
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
$urltogo=$backtopage?$backtopage:($_SERVER["PHP_SELF"]."?id=".$id);
|
||||||
|
header("Location: " . $urltogo);
|
||||||
exit();
|
exit();
|
||||||
} else {
|
} else {
|
||||||
$mesg = $object->error;
|
$mesg = $object->error;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
$urltogo=$backtopage?$backtopage:($_SERVER["PHP_SELF"]."?id=".$id);
|
||||||
|
header("Location: " . $urltogo);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
} else if ($action == 'delete' && $user->rights->accounting->chartofaccount) {
|
} else if ($action == 'delete' && $user->rights->accounting->chartofaccount) {
|
||||||
@ -196,6 +199,9 @@ $form = new Form($db);
|
|||||||
$htmlacc = new FormVentilation($db);
|
$htmlacc = new FormVentilation($db);
|
||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
|
|
||||||
|
$accountsystem = new AccountancySystem($db);
|
||||||
|
$accountsystem->fetch($conf->global->CHARTOFACCOUNTS);
|
||||||
|
|
||||||
// Create mode
|
// Create mode
|
||||||
if ($action == 'create') {
|
if ($action == 'create') {
|
||||||
print load_fiche_titre($langs->trans('NewAccountingAccount'));
|
print load_fiche_titre($langs->trans('NewAccountingAccount'));
|
||||||
@ -208,36 +214,45 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
// Chart of account
|
||||||
|
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("Chartofaccounts") . '</span></td>';
|
||||||
|
print '<td>';
|
||||||
|
print $accountsystem->ref;
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
// Account number
|
// Account number
|
||||||
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
|
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
|
||||||
print '<td><input name="account_number" size="30" value="' . $object->account_number . '"</td></tr>';
|
print '<td><input name="account_number" size="30" value="' . $object->account_number . '"></td></tr>';
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>';
|
print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>';
|
||||||
print '<td><input name="label" size="70" value="' . $object->label . '"</td></tr>';
|
print '<td><input name="label" size="70" value="' . $object->label . '"></td></tr>';
|
||||||
|
|
||||||
// Account parent
|
// Account parent
|
||||||
print '<tr><td>' . $langs->trans("Accountparent") . '</td>';
|
print '<tr><td>' . $langs->trans("Accountparent") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $htmlacc->select_account($object->account_parent, 'account_parent', 1);
|
print $htmlacc->select_account($object->account_parent, 'account_parent', 1, null, 0, 0, 'minwidth200');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Category
|
// Category
|
||||||
print '<tr><td>' . $langs->trans("AccountingCategory") . '</td>';
|
print '<tr><td>' . $langs->trans("AccountingCategory") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
|
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Chart of accounts type
|
// Chart of accounts type
|
||||||
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
|
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type');
|
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(isset($_POST['pcg_type'])?GETPOST('pcg_type','alpha'):$object->pcg_type).'">';
|
||||||
|
//print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type', 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Chart of acounts subtype
|
// Chart of acounts subtype
|
||||||
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
|
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype');
|
print '<input type="text" name="pcg_subtype" value="'.dol_escape_htmltag(isset($_POST['pcg_subtype'])?GETPOST('pcg_subtype','alpha'):$object->pcg_subtype).'">';
|
||||||
|
//print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype', 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -268,6 +283,7 @@ if ($action == 'create') {
|
|||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="edit">';
|
print '<input type="hidden" name="action" value="edit">';
|
||||||
print '<input type="hidden" name="id" value="' . $id . '">';
|
print '<input type="hidden" name="id" value="' . $id . '">';
|
||||||
|
print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
@ -294,13 +310,15 @@ if ($action == 'create') {
|
|||||||
// Chart of accounts type
|
// Chart of accounts type
|
||||||
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
|
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type');
|
//print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type', 1);
|
||||||
|
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(isset($_POST['pcg_type'])?GETPOST('pcg_type','alpha'):$object->pcg_type).'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Chart of accounts subtype
|
// Chart of accounts subtype
|
||||||
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
|
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype');
|
print '<input type="text" name="pcg_subtype" value="'.dol_escape_htmltag(isset($_POST['pcg_subtype'])?GETPOST('pcg_subtype','alpha'):$object->pcg_subtype).'">';
|
||||||
|
//print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype', 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|||||||
@ -106,8 +106,9 @@ $formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0
|
|||||||
print '<input class="button" type="submit" value="' . $langs->trans("Select") . '">';
|
print '<input class="button" type="submit" value="' . $langs->trans("Select") . '">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
if (! empty($cat_id)) {
|
if (! empty($cat_id))
|
||||||
$return = $AccCat->getCptBK($cat_id);
|
{
|
||||||
|
$return = $AccCat->getAccountsWithNoCategory($cat_id);
|
||||||
if ($return < 0) {
|
if ($return < 0) {
|
||||||
setEventMessages(null, $AccCat->errors, 'errors');
|
setEventMessages(null, $AccCat->errors, 'errors');
|
||||||
}
|
}
|
||||||
@ -149,7 +150,10 @@ if ($action == 'display' || $action == 'delete') {
|
|||||||
print '<td>' . length_accountg($cpt->account_number) . '</td>';
|
print '<td>' . length_accountg($cpt->account_number) . '</td>';
|
||||||
print '<td>' . $cpt->label . '</td>';
|
print '<td>' . $cpt->label . '</td>';
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"] . "?account_category=$cat_id&cptid=" . $cpt->rowid, $langs->trans("DeleteCptCategory"), $langs->trans("ConfirmDeleteCptCategory"), "delete", '', 0, "action-delete" . $j);
|
print $form->formconfirm($_SERVER["PHP_SELF"] . "?account_category=$cat_id&cptid=" . $cpt->rowid, $langs->trans("DeleteCptCategory"), $langs->trans("ConfirmDeleteCptCategory"), "delete", '', 0, "action-delete" . $j);
|
||||||
print '<td><input class="button" type="button" id="action-delete' . $j . '" value="' . $langs->trans("Delete") . '"></td>';
|
print '<td>';
|
||||||
|
//print img_delete();
|
||||||
|
print '<input class="button" type="button" id="action-delete' . $j . '" value="' . $langs->trans("Delete") . '">';
|
||||||
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$j ++;
|
$j ++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -628,12 +628,6 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
|
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
|
||||||
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
|
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
|
||||||
|
|
||||||
if ($id == 2) // Special cas for state page
|
|
||||||
{
|
|
||||||
if ($fieldlist[$field]=='region_id') { $valuetoshow=' '; $showfield=1; }
|
|
||||||
if ($fieldlist[$field]=='region') { $valuetoshow=$langs->trans("Country").'/'.$langs->trans("Region"); $showfield=1; }
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($valuetoshow != '')
|
if ($valuetoshow != '')
|
||||||
{
|
{
|
||||||
print '<td align="'.$align.'">';
|
print '<td align="'.$align.'">';
|
||||||
@ -675,36 +669,15 @@ if ($id)
|
|||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates' && $action == 'edit')
|
fieldList($fieldlist,$obj,$tabname[$id],'add');
|
||||||
{
|
|
||||||
fieldList($fieldlist,$obj,$tabname[$id],'hide');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fieldList($fieldlist,$obj,$tabname[$id],'add');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td colspan="4" align="right">';
|
print '<td colspan="4" align="right">';
|
||||||
if ($tabname[$id] != MAIN_DB_PREFIX.'c_email_templates' || $action != 'edit')
|
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
|
||||||
{
|
|
||||||
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
|
|
||||||
}
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates')
|
|
||||||
{
|
|
||||||
print '<tr><td colspan="8">* '.$langs->trans("AvailableVariables").": ";
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
|
||||||
$formmail=new FormMail($db);
|
|
||||||
$tmp=$formmail->getAvailableSubstitKey('form');
|
|
||||||
print implode(', ', $tmp);
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$colspan=count($fieldlist)+3;
|
$colspan=count($fieldlist)+3;
|
||||||
if ($id == 4) $colspan++;
|
|
||||||
|
|
||||||
if (! empty($alabelisused)) // If there is one label among fields, we show legend of *
|
if (! empty($alabelisused)) // If there is one label among fields, we show legend of *
|
||||||
{
|
{
|
||||||
@ -1175,7 +1148,7 @@ $db->close();
|
|||||||
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||||
{
|
{
|
||||||
global $conf,$langs,$db;
|
global $conf,$langs,$db;
|
||||||
global $form;
|
global $form, $mysoc;
|
||||||
global $region_id;
|
global $region_id;
|
||||||
global $elementList,$sourceList,$localtax_typeList;
|
global $elementList,$sourceList,$localtax_typeList;
|
||||||
global $bc;
|
global $bc;
|
||||||
@ -1197,7 +1170,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
|||||||
} // For state page, we do not show the country input (we link to region, not country)
|
} // For state page, we do not show the country input (we link to region, not country)
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$fieldname='country';
|
$fieldname='country';
|
||||||
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:$mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
elseif ($fieldlist[$field] == 'country_id')
|
elseif ($fieldlist[$field] == 'country_id')
|
||||||
|
|||||||
@ -39,6 +39,7 @@ $langs->load("bills");
|
|||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
$langs->load("salaries");
|
$langs->load("salaries");
|
||||||
|
$langs->load("loan");
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (! empty($user->rights->accountancy->chartofaccount))
|
if (! empty($user->rights->accountancy->chartofaccount))
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
@ -87,7 +87,8 @@ if ($action == 'update') {
|
|||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($list as $constname) {
|
foreach ($list as $constname)
|
||||||
|
{
|
||||||
$constvalue = GETPOST($constname, 'alpha');
|
$constvalue = GETPOST($constname, 'alpha');
|
||||||
|
|
||||||
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||||
@ -278,13 +279,17 @@ foreach ($list as $key)
|
|||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
|
|
||||||
print '<tr ' . $bc[$var] . ' class="value">';
|
print '<tr ' . $bc[$var] . ' class="value">';
|
||||||
|
|
||||||
|
if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) continue;
|
||||||
|
|
||||||
// Param
|
// Param
|
||||||
$label = $langs->trans($key);
|
$label = $langs->trans($key);
|
||||||
print '<td>'.$label.'</td>';
|
print '<td>'.$label.'</td>';
|
||||||
// Value
|
// Value
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print '<input type="text" size="20" id="' . $key . '" name="' . $key . '" value="' . $conf->global->$key . '">';
|
print '<input type="text" class="maxwidth100" id="' . $key . '" name="' . $key . '" value="' . $conf->global->$key . '">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,7 +306,7 @@ print '<div class="center"><input type="submit" class="button" value="' . $langs
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print $langs->trans("AccountancySetupDoneFromAccountancyMenu", $langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy"));
|
print $langs->trans("AccountancySetupDoneFromAccountancyMenu", $langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy"));
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|||||||
@ -84,7 +84,7 @@ class AccountancyCategory
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to select accountiing category of an accounting account present in chart of accounts
|
* Function to select accounting category of an accounting account present in chart of accounts
|
||||||
*
|
*
|
||||||
* @param int $id Id category
|
* @param int $id Id category
|
||||||
*
|
*
|
||||||
@ -130,6 +130,47 @@ class AccountancyCategory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to select accounting category of an accounting account present in chart of accounts
|
||||||
|
*
|
||||||
|
* @param int $id Id category
|
||||||
|
*
|
||||||
|
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||||
|
*/
|
||||||
|
public function getAccountsWithNoCategory($id) {
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
$sql = "SELECT aa.account_number as numero_compte, aa.label as label_compte";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||||
|
$sql .= " WHERE (aa.fk_accounting_category != ".$id." OR aa.fk_accounting_category IS NULL)";
|
||||||
|
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||||
|
$sql .= " AND aa.active = 1";
|
||||||
|
$sql .= " GROUP BY aa.account_number, aa.label";
|
||||||
|
$sql .= " ORDER BY aa.account_number, aa.label";
|
||||||
|
|
||||||
|
$this->lines_CptBk = array ();
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
if ($num) {
|
||||||
|
while ( $obj = $this->db->fetch_object($resql) ) {
|
||||||
|
$this->lines_cptbk[] = $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $num;
|
||||||
|
} else {
|
||||||
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
|
$this->errors[] = $this->error;
|
||||||
|
dol_syslog(__METHOD__ . " " . implode(',' . $this->errors), LOG_ERR);
|
||||||
|
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to add an accounting account in an accounting category
|
* Function to add an accounting account in an accounting category
|
||||||
*
|
*
|
||||||
|
|||||||
@ -47,6 +47,55 @@ class AccountancySystem
|
|||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load record in memory
|
||||||
|
*
|
||||||
|
* @param int $rowid Id
|
||||||
|
* @param string $ref ref
|
||||||
|
* @return int <0 if KO, Id of record if OK and found
|
||||||
|
*/
|
||||||
|
function fetch($rowid = 0, $ref = '')
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
if ($rowid > 0 || $ref)
|
||||||
|
{
|
||||||
|
$sql = "SELECT a.pcg_version, a.label, a.active";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a";
|
||||||
|
$sql .= " WHERE";
|
||||||
|
if ($rowid) {
|
||||||
|
$sql .= " a.rowid = '" . $rowid . "'";
|
||||||
|
} 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;
|
||||||
|
$this->pcg_version = $obj->pcg_version;
|
||||||
|
$this->ref = $obj->pcg_version;
|
||||||
|
$this->label = $obj->label;
|
||||||
|
$this->active = $obj->active;
|
||||||
|
|
||||||
|
return $this->id;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
|
$this->errors[] = "Error " . $this->db->lasterror();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert accountancy system name into database
|
* Insert accountancy system name into database
|
||||||
*
|
*
|
||||||
|
|||||||
@ -150,12 +150,19 @@ class AccountingAccount extends CommonObject
|
|||||||
if (isset($this->active))
|
if (isset($this->active))
|
||||||
$this->active = trim($this->active);
|
$this->active = trim($this->active);
|
||||||
|
|
||||||
// Check parameters
|
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
||||||
// Put here code to add control on parameters values
|
{
|
||||||
|
$this->pcg_type = 'XXXXXX';
|
||||||
|
}
|
||||||
|
if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1')
|
||||||
|
{
|
||||||
|
$this->pcg_subtype = 'XXXXXX';
|
||||||
|
}
|
||||||
|
// Check parameters
|
||||||
|
// Put here code to add control on parameters values
|
||||||
|
|
||||||
// Insert request
|
// Insert request
|
||||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_account(";
|
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_account(";
|
||||||
|
|
||||||
$sql .= "datec";
|
$sql .= "datec";
|
||||||
$sql .= ", entity";
|
$sql .= ", entity";
|
||||||
$sql .= ", fk_pcg_version";
|
$sql .= ", fk_pcg_version";
|
||||||
@ -167,9 +174,7 @@ class AccountingAccount extends CommonObject
|
|||||||
$sql .= ", fk_accounting_category";
|
$sql .= ", fk_accounting_category";
|
||||||
$sql .= ", fk_user_author";
|
$sql .= ", fk_user_author";
|
||||||
$sql .= ", active";
|
$sql .= ", active";
|
||||||
|
|
||||||
$sql .= ") VALUES (";
|
$sql .= ") VALUES (";
|
||||||
|
|
||||||
$sql .= " '" . $this->db->idate($now) . "'";
|
$sql .= " '" . $this->db->idate($now) . "'";
|
||||||
$sql .= ", " . $conf->entity;
|
$sql .= ", " . $conf->entity;
|
||||||
$sql .= ", " . (empty($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'");
|
$sql .= ", " . (empty($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'");
|
||||||
@ -225,11 +230,22 @@ class AccountingAccount extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Update record
|
* Update record
|
||||||
*
|
*
|
||||||
* @param User $user Use making update
|
* @param User $user Use making update
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function update($user) {
|
function update($user)
|
||||||
$this->db->begin();
|
{
|
||||||
|
// Check parameters
|
||||||
|
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
||||||
|
{
|
||||||
|
$this->pcg_type = 'XXXXXX';
|
||||||
|
}
|
||||||
|
if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1')
|
||||||
|
{
|
||||||
|
$this->pcg_subtype = 'XXXXXX';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
|
$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 .= " SET fk_pcg_version = " . ($this->fk_pcg_version ? "'" . $this->db->escape($this->fk_pcg_version) . "'" : "null");
|
||||||
@ -241,7 +257,6 @@ class AccountingAccount extends CommonObject
|
|||||||
$sql .= " , fk_accounting_category = '" . $this->account_category . "'";
|
$sql .= " , fk_accounting_category = '" . $this->account_category . "'";
|
||||||
$sql .= " , fk_user_modif = " . $user->id;
|
$sql .= " , fk_user_modif = " . $user->id;
|
||||||
$sql .= " , active = '" . $this->active . "'";
|
$sql .= " , active = '" . $this->active . "'";
|
||||||
|
|
||||||
$sql .= " WHERE rowid = " . $this->id;
|
$sql .= " WHERE rowid = " . $this->id;
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
|
||||||
|
|||||||
@ -169,7 +169,15 @@ class BookKeeping extends CommonObject
|
|||||||
if (empty($this->numero_compte) || $this->numero_compte == '-1')
|
if (empty($this->numero_compte) || $this->numero_compte == '-1')
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForBankLine', $this->fk_docdet);
|
if (in_array($this->doc_type, array('bank', 'expense_report')))
|
||||||
|
{
|
||||||
|
$this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForBankLine', $this->fk_docdet, $this->doc_type);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForInvoiceLine', $this->fk_doc, $this->doc_type);
|
||||||
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,11 +186,12 @@ class BookKeeping extends CommonObject
|
|||||||
|
|
||||||
$this->piece_num = 0;
|
$this->piece_num = 0;
|
||||||
|
|
||||||
// first check if line not yet in bookkeeping
|
// First check if line not yet already in bookkeeping
|
||||||
$sql = "SELECT count(*) as nb";
|
$sql = "SELECT count(*) as nb";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sql .= " WHERE doc_type = '" . $this->doc_type . "'";
|
$sql .= " WHERE doc_type = '" . $this->doc_type . "'";
|
||||||
$sql .= " AND fk_docdet = " . $this->fk_docdet;
|
$sql .= " AND fk_doc = " . $this->fk_doc;
|
||||||
|
$sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 is record is for several lines
|
||||||
$sql .= " AND numero_compte = '" . $this->numero_compte . "'";
|
$sql .= " AND numero_compte = '" . $this->numero_compte . "'";
|
||||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||||
|
|
||||||
@ -1120,7 +1129,7 @@ class BookKeeping extends CommonObject
|
|||||||
|
|
||||||
global $user;
|
global $user;
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$object = new Accountingbookkeeping($this->db);
|
$object = new BookKeeping($this->db);
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
|
|||||||
@ -180,11 +180,15 @@ class FormVentilation extends Form
|
|||||||
$options = array();
|
$options = array();
|
||||||
$out = ajax_combobox($htmlname, $event);
|
$out = ajax_combobox($htmlname, $event);
|
||||||
|
|
||||||
while ($obj = $this->db->fetch_object($resql)) {
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
$options[$obj->pcg_type] = $obj->pcg_type;
|
{
|
||||||
|
if ($obj->pcg_type != '-1')
|
||||||
|
{
|
||||||
|
$options[$obj->pcg_type] = $obj->pcg_type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty);
|
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth200');
|
||||||
|
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
return $out;
|
return $out;
|
||||||
@ -200,7 +204,8 @@ class FormVentilation extends Form
|
|||||||
*
|
*
|
||||||
* @return string String with HTML select
|
* @return string String with HTML select
|
||||||
*/
|
*/
|
||||||
function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array()) {
|
function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array())
|
||||||
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT DISTINCT pcg_subtype ";
|
$sql = "SELECT DISTINCT pcg_subtype ";
|
||||||
@ -221,11 +226,15 @@ class FormVentilation extends Form
|
|||||||
$options = array();
|
$options = array();
|
||||||
$out = ajax_combobox($htmlname, $event);
|
$out = ajax_combobox($htmlname, $event);
|
||||||
|
|
||||||
while ($obj = $this->db->fetch_object($resql)) {
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
$options[$obj->pcg_subtype] = $obj->pcg_subtype;
|
{
|
||||||
|
if ($obj->pcg_type != '-1')
|
||||||
|
{
|
||||||
|
$options[$obj->pcg_subtype] = $obj->pcg_subtype;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty);
|
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth200');
|
||||||
|
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
return $out;
|
return $out;
|
||||||
|
|||||||
@ -73,7 +73,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader("", "", "FicheVentilation");
|
llxHeader("", $langs->trans('FicheVentilation'));
|
||||||
|
|
||||||
if ($cancel == $langs->trans("Cancel")) {
|
if ($cancel == $langs->trans("Cancel")) {
|
||||||
$action = '';
|
$action = '';
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
@ -76,7 +76,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
|||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
llxHeader("", "FicheVentilation");
|
llxHeader("", $langs->trans('FicheVentilation'));
|
||||||
|
|
||||||
if ($cancel == $langs->trans("Cancel")) {
|
if ($cancel == $langs->trans("Cancel")) {
|
||||||
$action = '';
|
$action = '';
|
||||||
@ -89,7 +89,7 @@ $formventilation = new FormVentilation($db);
|
|||||||
|
|
||||||
if (! empty($id)) {
|
if (! empty($id)) {
|
||||||
$sql = "SELECT er.ref, er.rowid as facid, erd.fk_c_type_fees, erd.comments, erd.rowid, erd.fk_code_ventilation,";
|
$sql = "SELECT er.ref, er.rowid as facid, erd.fk_c_type_fees, erd.comments, erd.rowid, erd.fk_code_ventilation,";
|
||||||
$sql .= " f.id as fees_id, f.label as fees_label,";
|
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label,";
|
||||||
$sql .= " aa.account_number, aa.label";
|
$sql .= " aa.account_number, aa.label";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
||||||
@ -132,7 +132,7 @@ if (! empty($id)) {
|
|||||||
print '<td>' . stripslashes(nl2br($objp->comments)) . '</td></tr>';
|
print '<td>' . stripslashes(nl2br($objp->comments)) . '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>' . $langs->trans("TypeFees") . '</td>';
|
print '<tr><td>' . $langs->trans("TypeFees") . '</td>';
|
||||||
print '<td>' . dol_trunc($objp->fees_label, 24) . '</td>';
|
print '<td>' . ($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))) . '</td>';
|
||||||
|
|
||||||
print '<tr><td>' . $langs->trans("Account") . '</td><td>';
|
print '<tr><td>' . $langs->trans("Account") . '</td><td>';
|
||||||
print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1);
|
print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
@ -148,7 +148,7 @@ print '<script type="text/javascript">
|
|||||||
$sql = "SELECT er.ref, er.rowid as erid,";
|
$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.date,";
|
||||||
$sql .= " aa.label, aa.account_number,";
|
$sql .= " aa.label, aa.account_number,";
|
||||||
$sql .= " f.id as fees_id, f.label as fees_label";
|
$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";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
||||||
$sql .= " , " . MAIN_DB_PREFIX . "accounting_account as aa";
|
$sql .= " , " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||||
$sql .= " , " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
$sql .= " , " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||||
@ -282,7 +282,7 @@ if ($result) {
|
|||||||
|
|
||||||
print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
|
print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
|
||||||
|
|
||||||
print '<td class="tdoverflow">' . $objp->fees_label . '</td>';
|
print '<td class="tdoverflow">' . ($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))) . '</td>';
|
||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
|
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
|
||||||
@ -175,7 +175,7 @@ llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
|||||||
// Expense report lines
|
// Expense report lines
|
||||||
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut,";
|
$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.date,";
|
||||||
$sql .= " f.id as fees_id, f.label as fees_label, f.accountancy_code as code_buy,";
|
$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 .= " aa.rowid as aarowid";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "expensereport_det as erd ON er.rowid = erd.fk_expensereport";
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "expensereport_det as erd ON er.rowid = erd.fk_expensereport";
|
||||||
@ -308,14 +308,14 @@ if ($result) {
|
|||||||
// Line id
|
// Line id
|
||||||
print '<td>' . $objp->rowid . '</td>';
|
print '<td>' . $objp->rowid . '</td>';
|
||||||
|
|
||||||
print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
|
|
||||||
|
|
||||||
// Ref Expense report
|
// Ref Expense report
|
||||||
print '<td>' . $expensereport_static->getNomUrl(1) . '</td>';
|
print '<td>' . $expensereport_static->getNomUrl(1) . '</td>';
|
||||||
|
|
||||||
|
print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
|
||||||
|
|
||||||
// Fees label
|
// Fees label
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $objp->fees_label;
|
print ($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code)));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Fees description -- Can be null
|
// Fees description -- Can be null
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
*
|
*
|
||||||
@ -48,6 +48,9 @@ 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 . '/fourn/class/fournisseur.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/paymentexpensereport.class.php';
|
||||||
|
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
@ -57,6 +60,8 @@ $langs->load("banks");
|
|||||||
$langs->load('bills');
|
$langs->load('bills');
|
||||||
$langs->load('donations');
|
$langs->load('donations');
|
||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
|
$langs->load("trips");
|
||||||
|
$langs->load("hrm");
|
||||||
|
|
||||||
$id_bank_account = GETPOST('id_account', 'int');
|
$id_bank_account = GETPOST('id_account', 'int');
|
||||||
|
|
||||||
@ -101,13 +106,16 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
|||||||
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
|
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
|
||||||
$idpays = $p[0];
|
$idpays = $p[0];
|
||||||
|
|
||||||
$sql = "SELECT b.rowid , b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,";
|
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,";
|
||||||
$sql .= " ba.courant, ba.ref as baref, ba.account_number,";
|
$sql .= " ba.courant, ba.ref as baref, ba.account_number,";
|
||||||
$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, bu1.type as typeop";
|
$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, bu1.type as typeop,";
|
||||||
|
$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as name, u.firstname as firstname, bu2.type as typeop";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
|
||||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid";
|
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
|
||||||
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='user'";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
|
||||||
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u on bu2.url_id=u.rowid";
|
||||||
$sql .= " WHERE ba.rowid=" . $id_bank_account;
|
$sql .= " WHERE ba.rowid=" . $id_bank_account;
|
||||||
$sql .= ' AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
|
$sql .= ' AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
|
||||||
if ($date_start && $date_end)
|
if ($date_start && $date_end)
|
||||||
@ -123,6 +131,7 @@ $chargestatic = new ChargeSociales($db);
|
|||||||
$paymentdonstatic = new PaymentDonation($db);
|
$paymentdonstatic = new PaymentDonation($db);
|
||||||
$paymentvatstatic = new TVA($db);
|
$paymentvatstatic = new TVA($db);
|
||||||
$paymentsalstatic = new PaymentSalary($db);
|
$paymentsalstatic = new PaymentSalary($db);
|
||||||
|
$paymentexpensereportstatic = new PaymentExpenseReport($db);
|
||||||
|
|
||||||
// Get code of finance journal
|
// Get code of finance journal
|
||||||
$bank_code_journal = new Account($db);
|
$bank_code_journal = new Account($db);
|
||||||
@ -143,6 +152,7 @@ if ($result) {
|
|||||||
$account_transfer = (! empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : $langs->trans("CodeNotDef"));
|
$account_transfer = (! empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : $langs->trans("CodeNotDef"));
|
||||||
|
|
||||||
$tabcompany = array();
|
$tabcompany = array();
|
||||||
|
$tabuser = array();
|
||||||
$tabpay = array ();
|
$tabpay = array ();
|
||||||
$tabbq = array ();
|
$tabbq = array ();
|
||||||
$tabtp = array ();
|
$tabtp = array ();
|
||||||
@ -159,9 +169,10 @@ if ($result) {
|
|||||||
|
|
||||||
// Set accountancy code (for bank and thirdparty)
|
// Set accountancy code (for bank and thirdparty)
|
||||||
$compta_bank = $obj->account_number;
|
$compta_bank = $obj->account_number;
|
||||||
if ($obj->label == '(SupplierInvoicePayment)')
|
$compta_soc = 'NotDefined';
|
||||||
|
if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)')
|
||||||
$compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $account_supplier);
|
$compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $account_supplier);
|
||||||
if ($obj->label == '(CustomerInvoicePayment)')
|
if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)')
|
||||||
$compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer);
|
$compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer);
|
||||||
|
|
||||||
$tabcompany[$obj->rowid] = array (
|
$tabcompany[$obj->rowid] = array (
|
||||||
@ -170,6 +181,15 @@ if ($result) {
|
|||||||
'code_compta' => $compta_soc,
|
'code_compta' => $compta_soc,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$compta_user = (! empty($obj->accountancy_code) ? $obj->accountancy_code : $account_employee);
|
||||||
|
|
||||||
|
$tabuser[$obj->rowid] = array (
|
||||||
|
'id' => $obj->userid,
|
||||||
|
'lastname' => $obj->lastname,
|
||||||
|
'firstname' => $obj->firstname,
|
||||||
|
'accountancy_code' => $compta_user,
|
||||||
|
);
|
||||||
|
|
||||||
// Variable bookkeeping
|
// Variable bookkeeping
|
||||||
$tabpay[$obj->rowid]["date"] = $obj->do;
|
$tabpay[$obj->rowid]["date"] = $obj->do;
|
||||||
$tabpay[$obj->rowid]["type_payment"] = $obj->fk_type;
|
$tabpay[$obj->rowid]["type_payment"] = $obj->fk_type;
|
||||||
@ -187,7 +207,7 @@ if ($result) {
|
|||||||
// Now loop on each link of record in bank.
|
// Now loop on each link of record in bank.
|
||||||
foreach ( $links as $key => $val ) {
|
foreach ( $links as $key => $val ) {
|
||||||
|
|
||||||
if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat'))) // So we excluded 'company' here
|
if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport'))) // So we excluded 'company' here
|
||||||
{
|
{
|
||||||
// We save tabtype for a future use, to remember what kind of payment it is
|
// We save tabtype for a future use, to remember what kind of payment it is
|
||||||
$tabtype[$obj->rowid] = $links[$key]['type'];
|
$tabtype[$obj->rowid] = $links[$key]['type'];
|
||||||
@ -206,12 +226,12 @@ if ($result) {
|
|||||||
$societestatic->id = $links[$key]['url_id'];
|
$societestatic->id = $links[$key]['url_id'];
|
||||||
$societestatic->name = $links[$key]['label'];
|
$societestatic->name = $links[$key]['label'];
|
||||||
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
|
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
|
||||||
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
if ($compta_soc) $tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
||||||
} else if ($links[$key]['type'] == 'user') {
|
} else if ($links[$key]['type'] == 'user') {
|
||||||
$userstatic->id = $links[$key]['url_id'];
|
$userstatic->id = $links[$key]['url_id'];
|
||||||
$userstatic->name = $links[$key]['label'];
|
$userstatic->name = $links[$key]['label'];
|
||||||
$tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30);
|
$tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30);
|
||||||
// $tabtp[$obj->rowid][$compta_user] += $obj->amount;
|
if ($compta_user) $tabtp[$obj->rowid][$compta_user] += $obj->amount;
|
||||||
} else if ($links[$key]['type'] == 'sc') {
|
} else if ($links[$key]['type'] == 'sc') {
|
||||||
$chargestatic->id = $links[$key]['url_id'];
|
$chargestatic->id = $links[$key]['url_id'];
|
||||||
$chargestatic->ref = $links[$key]['url_id'];
|
$chargestatic->ref = $links[$key]['url_id'];
|
||||||
@ -256,7 +276,12 @@ if ($result) {
|
|||||||
$paymentsalstatic->ref = $links[$key]['url_id'];
|
$paymentsalstatic->ref = $links[$key]['url_id'];
|
||||||
$paymentsalstatic->label = $links[$key]['label'];
|
$paymentsalstatic->label = $links[$key]['label'];
|
||||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2);
|
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2);
|
||||||
$tabtp[$obj->rowid][$account_employee] += $obj->amount;
|
// $tabtp[$obj->rowid][$account_employee] += $obj->amount;
|
||||||
|
} else if ($links[$key]['type'] == 'payment_expensereport') {
|
||||||
|
$paymentexpensereportstatic->id = $links[$key]['url_id'];
|
||||||
|
$paymentexpensereportstatic->fk_expensereport = $links[$key]['url_id'];
|
||||||
|
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentexpensereportstatic->getNomUrl(2);
|
||||||
|
$tabpay[$obj->rowid]["fk_expensereport"] = $paymentexpensereportstatic->id;
|
||||||
} else if ($links[$key]['type'] == 'banktransfert') {
|
} else if ($links[$key]['type'] == 'banktransfert') {
|
||||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("BankTransfer");
|
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("BankTransfer");
|
||||||
$tabtp[$obj->rowid][$account_transfer] += $obj->amount;
|
$tabtp[$obj->rowid][$account_transfer] += $obj->amount;
|
||||||
@ -317,66 +342,81 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
// Line into bank account
|
// Line into bank account
|
||||||
foreach ( $tabbq[$key] as $k => $mt )
|
foreach ( $tabbq[$key] as $k => $mt )
|
||||||
{
|
{
|
||||||
$bookkeeping = new BookKeeping($db);
|
if ($mt) {
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->doc_type = 'bank';
|
$bookkeeping->doc_ref = $val["ref"];
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->doc_type = 'bank';
|
||||||
$bookkeeping->fk_docdet = $val["fk_bank"];
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->fk_docdet = $val["fk_bank"];
|
||||||
$bookkeeping->label_compte = $compte->label;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt);
|
$bookkeeping->label_compte = $compte->label;
|
||||||
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt);
|
||||||
$bookkeeping->debit = ($mt >= 0 ? $mt : 0);
|
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
||||||
$bookkeeping->credit = ($mt < 0 ? - $mt : 0);
|
$bookkeeping->debit = ($mt >= 0 ? $mt : 0);
|
||||||
$bookkeeping->code_journal = $journal;
|
$bookkeeping->credit = ($mt < 0 ? - $mt : 0);
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->code_journal = $journal;
|
||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
$bookkeeping->date_create = $now;
|
||||||
|
|
||||||
if ($tabtype[$key] == 'payment') {
|
if ($tabtype[$key] == 'payment') {
|
||||||
$bookkeeping->code_tiers = $tabcompany[$key]['code_compta'];
|
$bookkeeping->code_tiers = $tabcompany[$key]['code_compta'];
|
||||||
|
|
||||||
$sqlmid = 'SELECT fac.facnumber';
|
$sqlmid = 'SELECT fac.facnumber';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac";
|
||||||
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
|
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
|
||||||
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid";
|
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid";
|
||||||
$sqlmid .= " WHERE pay.fk_bank=" . $key;
|
$sqlmid .= " WHERE pay.fk_bank=" . $key;
|
||||||
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
|
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||||
$resultmid = $db->query($sqlmid);
|
$resultmid = $db->query($sqlmid);
|
||||||
if ($resultmid) {
|
if ($resultmid) {
|
||||||
$objmid = $db->fetch_object($resultmid);
|
$objmid = $db->fetch_object($resultmid);
|
||||||
$bookkeeping->doc_ref = $objmid->facnumber; // Ref of invoice
|
$bookkeeping->doc_ref = $objmid->facnumber; // Ref of invoice
|
||||||
}
|
}
|
||||||
} else if ($tabtype[$key] == 'payment_supplier') {
|
} else if ($tabtype[$key] == 'payment_supplier') {
|
||||||
$bookkeeping->code_tiers = $tabcompany[$key]['code_compta'];
|
$bookkeeping->code_tiers = $tabcompany[$key]['code_compta'];
|
||||||
|
|
||||||
$sqlmid = 'SELECT facf.ref_supplier, facf.ref';
|
$sqlmid = 'SELECT facf.ref_supplier, facf.ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf";
|
||||||
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
|
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
|
||||||
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid";
|
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid";
|
||||||
$sqlmid .= " WHERE payf.fk_bank=" . $key;
|
$sqlmid .= " WHERE payf.fk_bank=" . $key;
|
||||||
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
|
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||||
$resultmid = $db->query($sqlmid);
|
$resultmid = $db->query($sqlmid);
|
||||||
if ($resultmid) {
|
if ($resultmid) {
|
||||||
$objmid = $db->fetch_object($resultmid);
|
$objmid = $db->fetch_object($resultmid);
|
||||||
$bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')'; // Ref on invoice
|
$bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')'; // Ref on invoice
|
||||||
}
|
}
|
||||||
}
|
} else if ($tabtype[$key] == 'payment_expensereport') {
|
||||||
|
$bookkeeping->code_tiers = $tabuser[$key]['accountancy_code'];
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$sqlmid = 'SELECT e.ref';
|
||||||
if ($result < 0) {
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "expensereport as e";
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "payment_expensereport as payer ON payer.fk_expensereport=e.rowid";
|
||||||
{
|
$sqlmid .= " WHERE payer.fk_expensereport=" . $val["fk_expensereport"];
|
||||||
$error++;
|
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||||
$errorforline++;
|
$resultmid = $db->query($sqlmid);
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
if ($resultmid) {
|
||||||
}
|
$objmid = $db->fetch_object($resultmid);
|
||||||
else
|
$bookkeeping->doc_ref = $objmid->ref; // Ref of expensereport
|
||||||
{
|
}
|
||||||
$error++;
|
}
|
||||||
$errorforline++;
|
|
||||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
$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');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -386,65 +426,76 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
// Line into thirdparty account
|
// Line into thirdparty account
|
||||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||||
$bookkeeping = new BookKeeping($db);
|
if ($mt) {
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->doc_type = 'bank';
|
$bookkeeping->doc_ref = $val["ref"];
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->doc_type = 'bank';
|
||||||
$bookkeeping->fk_docdet = $val["fk_bank"];
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->label_compte = $tabcompany[$key]['name'];
|
$bookkeeping->fk_docdet = $val["fk_bank"];
|
||||||
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt);
|
$bookkeeping->label_compte = $tabcompany[$key]['name'];
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt);
|
||||||
$bookkeeping->debit = ($mt < 0 ? - $mt : 0);
|
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||||
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt < 0 ? - $mt : 0);
|
||||||
$bookkeeping->code_journal = $journal;
|
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->code_journal = $journal;
|
||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
$bookkeeping->date_create = $now;
|
||||||
|
|
||||||
if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
|
if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
|
||||||
$bookkeeping->code_tiers = '';
|
$bookkeeping->code_tiers = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
} else if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
|
} else if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
|
||||||
$sqlmid = 'SELECT fac.facnumber';
|
$sqlmid = 'SELECT fac.facnumber';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
|
||||||
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
|
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
|
||||||
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid";
|
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid";
|
||||||
$sqlmid .= " WHERE pay.fk_bank=" . $key;
|
$sqlmid .= " WHERE pay.fk_bank=" . $key;
|
||||||
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
|
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||||
$resultmid = $db->query($sqlmid);
|
$resultmid = $db->query($sqlmid);
|
||||||
if ($resultmid) {
|
if ($resultmid) {
|
||||||
$objmid = $db->fetch_object($resultmid);
|
$objmid = $db->fetch_object($resultmid);
|
||||||
$bookkeeping->doc_ref = $objmid->facnumber;
|
$bookkeeping->doc_ref = $objmid->facnumber;
|
||||||
}
|
}
|
||||||
$bookkeeping->code_tiers = $tabcompany[$key]['code_compta'];
|
$bookkeeping->code_tiers = $tabcompany[$key]['code_compta'];
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
|
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
|
||||||
|
|
||||||
$sqlmid = 'SELECT facf.ref_supplier,facf.ref';
|
$sqlmid = 'SELECT facf.ref_supplier,facf.ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
|
||||||
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
|
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
|
||||||
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid";
|
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid";
|
||||||
$sqlmid .= " WHERE payf.fk_bank=" . $key;
|
$sqlmid .= " WHERE payf.fk_bank=" . $key;
|
||||||
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
|
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||||
$resultmid = $db->query($sqlmid);
|
$resultmid = $db->query($sqlmid);
|
||||||
if ($resultmid) {
|
if ($resultmid) {
|
||||||
$objmid = $db->fetch_object($resultmid);
|
$objmid = $db->fetch_object($resultmid);
|
||||||
$bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')';
|
$bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')';
|
||||||
}
|
}
|
||||||
$bookkeeping->code_tiers = $tabcompany[$key]['code_compta'];
|
$bookkeeping->code_tiers = $tabcompany[$key]['code_compta'];
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
} else {
|
} else {
|
||||||
// FIXME Should be a temporary account ???
|
// FIXME Should be a temporary account ???
|
||||||
$bookkeeping->doc_ref = $k;
|
$bookkeeping->doc_ref = $k;
|
||||||
//$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
//$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||||
$bookkeeping->numero_compte = 'CodeNotDef';
|
$bookkeeping->numero_compte = 'CodeNotDef';
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
$errorforline++;
|
{
|
||||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
$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');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -481,6 +532,7 @@ if ($action == 'export_csv') {
|
|||||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||||
|
|
||||||
$companystatic = new Client($db);
|
$companystatic = new Client($db);
|
||||||
|
$userstatic = new User($db);
|
||||||
|
|
||||||
// Model Cegid Expert Export
|
// Model Cegid Expert Export
|
||||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
|
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
|
||||||
@ -491,10 +543,10 @@ if ($action == 'export_csv') {
|
|||||||
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
|
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
|
||||||
|
|
||||||
$reflabel = $val["ref"];
|
$reflabel = $val["ref"];
|
||||||
if ($reflabel == '(SupplierInvoicePayment)') {
|
if ($reflabel == '(SupplierInvoicePayment)' || $reflabel == '(SupplierInvoicePaymentBack)') {
|
||||||
$reflabel = $langs->trans('Supplier');
|
$reflabel = $langs->trans('Supplier');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(CustomerInvoicePayment)') {
|
if ($reflabel == '(CustomerInvoicePayment)' || $reflabel == '(CustomerInvoicePaymentBack)') {
|
||||||
$reflabel = $langs->trans('Customer');
|
$reflabel = $langs->trans('Customer');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(SocialContributionPayment)') {
|
if ($reflabel == '(SocialContributionPayment)') {
|
||||||
@ -504,12 +556,19 @@ if ($action == 'export_csv') {
|
|||||||
$reflabel = $langs->trans('Donation');
|
$reflabel = $langs->trans('Donation');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(SubscriptionPayment)') {
|
if ($reflabel == '(SubscriptionPayment)') {
|
||||||
$reflabel = $langs->trans('Donation');
|
$reflabel = $langs->trans('Subscription');
|
||||||
|
}
|
||||||
|
if ($reflabel == '(ExpenseReportPayment)') {
|
||||||
|
$reflabel = $langs->trans('Employee');
|
||||||
}
|
}
|
||||||
|
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
|
|
||||||
|
$userstatic->id = $tabuser[$key]['id'];
|
||||||
|
$userstatic->lastname = $tabuser[$key]['lastname'];
|
||||||
|
$userstatic->firstname = $tabuser[$key]['firstname'];
|
||||||
|
|
||||||
// Bank
|
// Bank
|
||||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||||
print $date . $sep;
|
print $date . $sep;
|
||||||
@ -636,7 +695,6 @@ if ($action == 'export_csv') {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -646,6 +704,7 @@ $form = new Form($db);
|
|||||||
if (empty($action) || $action == 'view') {
|
if (empty($action) || $action == 'view') {
|
||||||
$invoicestatic = new Facture($db);
|
$invoicestatic = new Facture($db);
|
||||||
$invoicesupplierstatic = new FactureFournisseur($db);
|
$invoicesupplierstatic = new FactureFournisseur($db);
|
||||||
|
$expensereportstatic = new ExpenseReport($db);
|
||||||
|
|
||||||
llxHeader('', $langs->trans("FinanceJournal"));
|
llxHeader('', $langs->trans("FinanceJournal"));
|
||||||
|
|
||||||
@ -656,17 +715,18 @@ if (empty($action) || $action == 'view') {
|
|||||||
$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);
|
$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);
|
||||||
|
|
||||||
$varlink = 'id_account=' . $id_bank_account;
|
$varlink = 'id_account=' . $id_bank_account;
|
||||||
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array (
|
|
||||||
'action' => ''
|
|
||||||
), '', $varlink);
|
|
||||||
|
|
||||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
report_header($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') . '"/>';
|
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans('Export') . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
||||||
} else {
|
} else {
|
||||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
print '<div class="tabsAction">';
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
// TODO Avoid using js. We can use a direct link with $param
|
// TODO Avoid using js. We can use a direct link with $param
|
||||||
print '
|
print '
|
||||||
@ -688,7 +748,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
/*
|
/*
|
||||||
* Show result array
|
* Show result array
|
||||||
*/
|
*/
|
||||||
print '<br><br>';
|
print '<br>';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
@ -710,10 +770,10 @@ if (empty($action) || $action == 'view') {
|
|||||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||||
|
|
||||||
$reflabel = $val["ref"];
|
$reflabel = $val["ref"];
|
||||||
if ($reflabel == '(SupplierInvoicePayment)') {
|
if ($reflabel == '(SupplierInvoicePayment)' || $reflabel == '(SupplierInvoicePaymentBack)') {
|
||||||
$reflabel = $langs->trans('Supplier');
|
$reflabel = $langs->trans('Supplier');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(CustomerInvoicePayment)') {
|
if ($reflabel == '(CustomerInvoicePayment)' || $reflabel == '(CustomerInvoicePaymentBack)') {
|
||||||
$reflabel = $langs->trans('Customer');
|
$reflabel = $langs->trans('Customer');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(SocialContributionPayment)') {
|
if ($reflabel == '(SocialContributionPayment)') {
|
||||||
@ -723,7 +783,10 @@ if (empty($action) || $action == 'view') {
|
|||||||
$reflabel = $langs->trans('Donation');
|
$reflabel = $langs->trans('Donation');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(SubscriptionPayment)') {
|
if ($reflabel == '(SubscriptionPayment)') {
|
||||||
$reflabel = $langs->trans('SubscriptionPayment');
|
$reflabel = $langs->trans('Subscription');
|
||||||
|
}
|
||||||
|
if ($reflabel == '(ExpenseReportPayment)') {
|
||||||
|
$reflabel = $langs->trans('Employee');
|
||||||
}
|
}
|
||||||
|
|
||||||
$ref=$reflabel;
|
$ref=$reflabel;
|
||||||
@ -755,6 +818,20 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
else dol_print_error($db);
|
else dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
elseif ($tabtype[$key] == 'payment_expensereport')
|
||||||
|
{
|
||||||
|
$sqlmid = 'SELECT payer.fk_expensereport as id';
|
||||||
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_expensereport as payer";
|
||||||
|
$sqlmid .= " WHERE payer.fk_expensereport=" . $val["fk_expensereport"];
|
||||||
|
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||||
|
$resultmid = $db->query($sqlmid);
|
||||||
|
if ($resultmid) {
|
||||||
|
$objmid = $db->fetch_object($resultmid);
|
||||||
|
$expensereportstatic->fetch($objmid->id);
|
||||||
|
$ref=$langs->trans("ExpenseReport").' '.$expensereportstatic->getNomUrl(1);
|
||||||
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*$invoicestatic->id = $key;
|
/*$invoicestatic->id = $key;
|
||||||
|
|||||||
@ -157,99 +157,139 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
$errorforline = 0;
|
$errorforline = 0;
|
||||||
|
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
$db->begin();
|
||||||
// get compte id and label
|
|
||||||
|
|
||||||
$bookkeeping = new BookKeeping($db);
|
if (! $errorforline)
|
||||||
$bookkeeping->doc_date = $val["date"];
|
{
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
$bookkeeping->date_create = $now;
|
if ($mt) {
|
||||||
$bookkeeping->doc_type = 'expense_report';
|
// get compte id and label
|
||||||
$bookkeeping->fk_doc = $key;
|
|
||||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
|
||||||
$bookkeeping->code_tiers = $tabuser[$key]['user_accountancy_code'];
|
|
||||||
$bookkeeping->label_compte = $tabuser[$key]['name'];
|
|
||||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
|
||||||
$bookkeeping->montant = $mt;
|
|
||||||
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
|
||||||
$bookkeeping->debit = ($mt <= 0) ? $mt : 0;
|
|
||||||
$bookkeeping->credit = ($mt > 0) ? $mt : 0;
|
|
||||||
$bookkeeping->code_journal = $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL;
|
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$bookkeeping = new BookKeeping($db);
|
||||||
if ($result < 0) {
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$error++;
|
$bookkeeping->doc_ref = $val["ref"];
|
||||||
$errorforline++;
|
$bookkeeping->date_create = $now;
|
||||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
$bookkeeping->doc_type = 'expense_report';
|
||||||
}
|
$bookkeeping->fk_doc = $key;
|
||||||
}
|
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||||
|
$bookkeeping->code_tiers = $tabuser[$key]['user_accountancy_code'];
|
||||||
|
$bookkeeping->label_compte = $tabuser[$key]['name'];
|
||||||
|
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||||
|
$bookkeeping->montant = $mt;
|
||||||
|
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
||||||
|
$bookkeeping->debit = ($mt <= 0) ? $mt : 0;
|
||||||
|
$bookkeeping->credit = ($mt > 0) ? $mt : 0;
|
||||||
|
$bookkeeping->code_journal = $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL;
|
||||||
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
// Fees
|
$result = $bookkeeping->create($user);
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
if ($result < 0) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
$accountingaccount->fetch(null, $k, true);
|
{
|
||||||
if ($mt) {
|
$error++;
|
||||||
// get compte id and label
|
$errorforline++;
|
||||||
$accountingaccount = new AccountingAccount($db);
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
if ($accountingaccount->fetch(null, $k, true)) {
|
}
|
||||||
$bookkeeping = new BookKeeping($db);
|
else
|
||||||
$bookkeeping->doc_date = $val["date"];
|
{
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$error++;
|
||||||
$bookkeeping->date_create = $now;
|
$errorforline++;
|
||||||
$bookkeeping->doc_type = 'expense_report';
|
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||||
$bookkeeping->fk_doc = $key;
|
}
|
||||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
}
|
||||||
$bookkeeping->code_tiers = '';
|
}
|
||||||
$bookkeeping->label_compte = $accountingaccount->label;
|
}
|
||||||
$bookkeeping->numero_compte = $k;
|
}
|
||||||
$bookkeeping->montant = $mt;
|
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
|
||||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
|
||||||
$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
|
|
||||||
$bookkeeping->code_journal = $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL;
|
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
if (! $errorforline)
|
||||||
if ($result < 0) {
|
{
|
||||||
$error++;
|
// Fees
|
||||||
$errorforline++;
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
$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->doc_ref = $val["ref"];
|
||||||
|
$bookkeeping->date_create = $now;
|
||||||
|
$bookkeeping->doc_type = 'expense_report';
|
||||||
|
$bookkeeping->fk_doc = $key;
|
||||||
|
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||||
|
$bookkeeping->code_tiers = '';
|
||||||
|
$bookkeeping->label_compte = $accountingaccount->label;
|
||||||
|
$bookkeeping->numero_compte = $k;
|
||||||
|
$bookkeeping->montant = $mt;
|
||||||
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
|
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||||
|
$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
|
||||||
|
$bookkeeping->code_journal = $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL;
|
||||||
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
// VAT
|
$result = $bookkeeping->create($user);
|
||||||
// var_dump($tabtva);
|
if ($result < 0) {
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
if ($mt) {
|
{
|
||||||
// get compte id and label
|
$error++;
|
||||||
$bookkeeping = new BookKeeping($db);
|
$errorforline++;
|
||||||
$bookkeeping->doc_date = $val["date"];
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
}
|
||||||
$bookkeeping->date_create = $now;
|
else
|
||||||
$bookkeeping->doc_type = 'expense_report';
|
{
|
||||||
$bookkeeping->fk_doc = $key;
|
$error++;
|
||||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
$errorforline++;
|
||||||
$bookkeeping->code_tiers = '';
|
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||||
$bookkeeping->label_compte = $langs->trans("VAT"). ' '.$def_tva[$key];
|
}
|
||||||
$bookkeeping->numero_compte = $k;
|
}
|
||||||
$bookkeeping->montant = $mt;
|
}
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
}
|
||||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
}
|
||||||
$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
|
}
|
||||||
$bookkeeping->code_journal = $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL;
|
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
if (! $errorforline)
|
||||||
if ($result < 0) {
|
{
|
||||||
$error++;
|
// VAT
|
||||||
$errorforline++;
|
// var_dump($tabtva);
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
foreach ( $tabtva[$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"];
|
||||||
|
$bookkeeping->date_create = $now;
|
||||||
|
$bookkeeping->doc_type = 'expense_report';
|
||||||
|
$bookkeeping->fk_doc = $key;
|
||||||
|
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||||
|
$bookkeeping->code_tiers = '';
|
||||||
|
$bookkeeping->label_compte = $langs->trans("VAT"). ' '.$def_tva[$key];
|
||||||
|
$bookkeeping->numero_compte = $k;
|
||||||
|
$bookkeeping->montant = $mt;
|
||||||
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
|
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||||
|
$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
|
||||||
|
$bookkeeping->code_journal = $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL;
|
||||||
|
$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->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
@ -406,17 +446,18 @@ if (empty($action) || $action == 'view') {
|
|||||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
$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);
|
$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);
|
||||||
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array (
|
|
||||||
'action' => ''
|
|
||||||
));
|
|
||||||
|
|
||||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
|
||||||
|
|
||||||
|
/*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') . '"/>';
|
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
||||||
} else {
|
} else {
|
||||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
print '<div class="tabsAction">';
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '
|
print '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -435,7 +476,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
/*
|
/*
|
||||||
* Show result array
|
* Show result array
|
||||||
*/
|
*/
|
||||||
print '<br><br>';
|
print '<br>';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
@ -512,11 +553,11 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "</tr>";
|
print "</tr>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print "<tr " . $bc[$var] . ">";
|
|
||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
print "<td><!-- Thirdparty --></td>";
|
print "<tr " . $bc[$var] . ">";
|
||||||
|
print "<td><!-- Thirdparty --></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
||||||
$userstatic->id = $tabuser[$key]['id'];
|
$userstatic->id = $tabuser[$key]['id'];
|
||||||
@ -532,8 +573,8 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("Code_tiers") . "</td>";
|
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("Code_tiers") . "</td>";
|
||||||
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
|
print "</tr>";
|
||||||
}
|
}
|
||||||
print "</tr>";
|
|
||||||
|
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -109,6 +109,7 @@ dol_syslog('accountancy/journal/purchasesjournal.php:: $sql=' . $sql);
|
|||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
// les variables
|
// les variables
|
||||||
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef");
|
$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");
|
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
||||||
@ -123,8 +124,10 @@ if ($result) {
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
while ( $i < $num ) {
|
while ( $i < $num ) {
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
|
|
||||||
// contrôles
|
// contrôles
|
||||||
$compta_soc = (! empty($obj->code_compta_fournisseur)) ? $obj->code_compta_fournisseur : $cptfour;
|
$compta_soc = (! empty($obj->code_compta_fournisseur)) ? $obj->code_compta_fournisseur : $cptfour;
|
||||||
|
|
||||||
$compta_prod = $obj->compte;
|
$compta_prod = $obj->compte;
|
||||||
if (empty($compta_prod)) {
|
if (empty($compta_prod)) {
|
||||||
if ($obj->product_type == 0)
|
if ($obj->product_type == 0)
|
||||||
@ -144,14 +147,21 @@ if ($result) {
|
|||||||
|
|
||||||
$tabfac[$obj->rowid]["type"] = $obj->type;
|
$tabfac[$obj->rowid]["type"] = $obj->type;
|
||||||
$tabfac[$obj->rowid]["description"] = $obj->description;
|
$tabfac[$obj->rowid]["description"] = $obj->description;
|
||||||
$tabfac[$obj->rowid]["fk_facturefourndet"] = $obj->fdid;
|
//$tabfac[$obj->rowid]["fk_facturefourndet"] = $obj->fdid;
|
||||||
|
|
||||||
|
// Avoid warnings
|
||||||
|
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;
|
||||||
|
|
||||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
||||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
||||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||||
$tabcompany[$obj->rowid] = array (
|
$tabcompany[$obj->rowid] = array (
|
||||||
'id' => $obj->socid,
|
'id' => $obj->socid,
|
||||||
'name' => $obj->name,
|
'name' => $obj->name,
|
||||||
'code_fournisseur' => $obj->code_compta_fournisseur
|
'code_fournisseur' => $obj->code_fournisseur,
|
||||||
|
'code_compta_fournisseur' => $compta_soc
|
||||||
);
|
);
|
||||||
|
|
||||||
$i ++;
|
$i ++;
|
||||||
@ -165,7 +175,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
foreach ($tabfac as $key => $val)
|
foreach ($tabfac as $key => $val) // Loop on each invoice
|
||||||
{
|
{
|
||||||
$errorforline = 0;
|
$errorforline = 0;
|
||||||
|
|
||||||
@ -188,101 +198,136 @@ if ($action == 'writebookkeeping') {
|
|||||||
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
||||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||||
|
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
if (! $errorforline)
|
||||||
// get compte id and label
|
{
|
||||||
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
|
// get compte id and label
|
||||||
|
if ($mt) {
|
||||||
|
$bookkeeping = new BookKeeping($db);
|
||||||
|
$bookkeeping->doc_date = $val["date"];
|
||||||
|
$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->code_tiers = $tabcompany[$key]['code_fournisseur'];
|
||||||
|
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("Code_tiers");
|
||||||
|
$bookkeeping->numero_compte = $tabcompany[$key]['code_compta_fournisseur'];
|
||||||
|
$bookkeeping->montant = $mt;
|
||||||
|
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
||||||
|
$bookkeeping->debit = ($mt <= 0) ? $mt : 0;
|
||||||
|
$bookkeeping->credit = ($mt > 0) ? $mt : 0;
|
||||||
|
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
||||||
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
$bookkeeping = new BookKeeping($db);
|
$result = $bookkeeping->create($user);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
if ($result < 0) {
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
$bookkeeping->date_create = $now;
|
{
|
||||||
$bookkeeping->doc_type = 'supplier_invoice';
|
$error++;
|
||||||
$bookkeeping->fk_doc = $key;
|
$errorforline++;
|
||||||
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
$bookkeeping->code_tiers = $tabcompany[$key]['code_fournisseur'];
|
}
|
||||||
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("Code_tiers");
|
else
|
||||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
{
|
||||||
$bookkeeping->montant = $mt;
|
$error++;
|
||||||
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
$errorforline++;
|
||||||
$bookkeeping->debit = ($mt <= 0) ? $mt : 0;
|
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||||
$bookkeeping->credit = ($mt > 0) ? $mt : 0;
|
}
|
||||||
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
}
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
}
|
||||||
|
}
|
||||||
$result = $bookkeeping->create($user);
|
}
|
||||||
if ($result < 0) {
|
|
||||||
$error++;
|
|
||||||
$errorforline++;
|
|
||||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Product / Service
|
// Product / Service
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
if (! $errorforline)
|
||||||
$accountingaccount = new AccountingAccount($db);
|
{
|
||||||
$accountingaccount->fetch(null, $k, true);
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
if ($mt) {
|
$accountingaccount = new AccountingAccount($db);
|
||||||
// get compte id and label
|
$accountingaccount->fetch(null, $k, true);
|
||||||
$accountingaccount = new AccountingAccount($db);
|
if ($mt) {
|
||||||
if ($accountingaccount->fetch(null, $k, true)) {
|
// get compte id and label
|
||||||
$bookkeeping = new BookKeeping($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
if ($accountingaccount->fetch(null, $k, true)) {
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->doc_type = 'supplier_invoice';
|
$bookkeeping->doc_ref = $val["ref"];
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->date_create = $now;
|
||||||
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
|
$bookkeeping->doc_type = 'supplier_invoice';
|
||||||
$bookkeeping->code_tiers = '';
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label;
|
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->code_tiers = '';
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
|
||||||
|
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
||||||
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
$errorforline++;
|
{
|
||||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
$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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
// var_dump($tabtva);
|
// var_dump($tabtva);
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
if (! $errorforline)
|
||||||
if ($mt) {
|
{
|
||||||
// get compte id and label
|
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||||
$bookkeeping = new BookKeeping($db);
|
if ($mt) {
|
||||||
$bookkeeping->doc_date = $val["date"];
|
// get compte id and label
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->doc_type = 'supplier_invoice';
|
$bookkeeping->doc_ref = $val["ref"];
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->date_create = $now;
|
||||||
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
|
$bookkeeping->doc_type = 'supplier_invoice';
|
||||||
$bookkeeping->code_tiers = '';
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key];
|
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->code_tiers = '';
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key];
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
|
||||||
|
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
||||||
$result = $bookkeeping->create($user);
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
if ($result < 0) {
|
|
||||||
$error++;
|
|
||||||
$errorforline++;
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
$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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
@ -456,17 +501,18 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$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);
|
$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);
|
||||||
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array (
|
|
||||||
'action' => ''
|
|
||||||
));
|
|
||||||
|
|
||||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
|
||||||
|
|
||||||
|
/*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') . '"/>';
|
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
||||||
} else {
|
} else {
|
||||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
print '<div class="tabsAction">';
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '
|
print '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -485,7 +531,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
/*
|
/*
|
||||||
* Show result array
|
* Show result array
|
||||||
*/
|
*/
|
||||||
print '<br><br>';
|
print '<br>';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
@ -498,7 +544,6 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<t><td>" . $langs->trans("Type") . "</td><td align='right'>" . $langs->trans("Debit") . "</td><td align='right'>" . $langs->trans("Credit") . "</td>";
|
print "<t><td>" . $langs->trans("Type") . "</td><td align='right'>" . $langs->trans("Debit") . "</td><td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$var = true;
|
|
||||||
$r = '';
|
$r = '';
|
||||||
|
|
||||||
$invoicestatic = new FactureFournisseur($db);
|
$invoicestatic = new FactureFournisseur($db);
|
||||||
@ -563,11 +608,11 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "</tr>";
|
print "</tr>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print "<tr " . $bc[$var] . ">";
|
|
||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
print "<td><!-- Thirdparty --></td>";
|
print "<tr " . $bc[$var] . ">";
|
||||||
|
print "<td><!-- Thirdparty --></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
@ -586,8 +631,8 @@ if (empty($action) || $action == 'view') {
|
|||||||
// print "</td>";
|
// print "</td>";
|
||||||
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
|
print "</tr>";
|
||||||
}
|
}
|
||||||
print "</tr>";
|
|
||||||
|
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,7 +100,7 @@ $sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
|||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
|
||||||
$sql .= " WHERE fd.fk_code_ventilation > 0";
|
$sql .= " WHERE fd.fk_code_ventilation > 0";
|
||||||
$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
|
||||||
$sql .= " AND f.fk_statut > 0";
|
$sql .= " AND f.fk_statut > 0"; // TODO Facture annulée ?
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||||
} else {
|
} else {
|
||||||
@ -124,10 +124,12 @@ if ($result) {
|
|||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
|
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef");
|
||||||
|
|
||||||
while ( $i < $num ) {
|
while ( $i < $num ) {
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
|
|
||||||
// les variables
|
// les variables
|
||||||
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef");
|
|
||||||
$compta_soc = (! empty($obj->code_compta)) ? $obj->code_compta : $cptcli;
|
$compta_soc = (! empty($obj->code_compta)) ? $obj->code_compta : $cptcli;
|
||||||
|
|
||||||
$compta_prod = $obj->compte;
|
$compta_prod = $obj->compte;
|
||||||
@ -164,23 +166,24 @@ if ($result) {
|
|||||||
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
|
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
|
||||||
$tabfac[$obj->rowid]["type"] = $obj->type;
|
$tabfac[$obj->rowid]["type"] = $obj->type;
|
||||||
$tabfac[$obj->rowid]["description"] = $obj->label_compte;
|
$tabfac[$obj->rowid]["description"] = $obj->label_compte;
|
||||||
$tabfac[$obj->rowid]["fk_facturedet"] = $obj->fdid;
|
//$tabfac[$obj->rowid]["fk_facturedet"] = $obj->fdid;
|
||||||
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;
|
|
||||||
$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;
|
|
||||||
$tabcompany[$obj->rowid] = array (
|
|
||||||
'id' => $obj->socid,
|
|
||||||
'name' => $obj->name,
|
|
||||||
'code_client' => $obj->code_compta
|
|
||||||
);
|
|
||||||
|
|
||||||
$i ++;
|
// Avoid warnings
|
||||||
|
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;
|
||||||
|
|
||||||
|
$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;
|
||||||
|
$tabcompany[$obj->rowid] = array (
|
||||||
|
'id' => $obj->socid,
|
||||||
|
'name' => $obj->name,
|
||||||
|
'code_client' => $obj->code_client,
|
||||||
|
'code_compta' => $compta_soc
|
||||||
|
);
|
||||||
|
|
||||||
|
$i ++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
@ -191,7 +194,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
foreach ( $tabfac as $key => $val ) {
|
foreach ( $tabfac as $key => $val ) { // Loop on each invoice
|
||||||
|
|
||||||
$errorforline = 0;
|
$errorforline = 0;
|
||||||
|
|
||||||
@ -211,49 +214,109 @@ if ($action == 'writebookkeeping') {
|
|||||||
$invoicestatic->id = $key;
|
$invoicestatic->id = $key;
|
||||||
$invoicestatic->ref = (string) $val["ref"];
|
$invoicestatic->ref = (string) $val["ref"];
|
||||||
|
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
// Thirdparty
|
||||||
$bookkeeping = new BookKeeping($db);
|
if (! $errorforline)
|
||||||
$bookkeeping->doc_date = $val["date"];
|
{
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
$bookkeeping->date_create = $now;
|
if ($mt) {
|
||||||
$bookkeeping->doc_type = 'customer_invoice';
|
|
||||||
$bookkeeping->fk_doc = $key;
|
|
||||||
$bookkeeping->fk_docdet = $val["fk_facturedet"];
|
|
||||||
$bookkeeping->code_tiers = $tabcompany[$key]['code_client'];
|
|
||||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
|
||||||
// $bookkeeping->label_compte = $tabcompany[$key]['name'];
|
|
||||||
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers");
|
|
||||||
$bookkeeping->montant = $mt;
|
|
||||||
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
|
||||||
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
|
|
||||||
$bookkeeping->credit = ($mt < 0) ? $mt : 0;
|
|
||||||
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
|
||||||
if ($result < 0) {
|
|
||||||
$error++;
|
|
||||||
$errorforline++;
|
|
||||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Product / Service
|
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
|
||||||
if ($mt) {
|
|
||||||
// get compte id and label
|
|
||||||
$accountingaccount = new AccountingAccount($db);
|
|
||||||
if ($accountingaccount->fetch(null, $k, true)) {
|
|
||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping->doc_ref = $val["ref"];
|
||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->date_create = $now;
|
||||||
$bookkeeping->doc_type = 'customer_invoice';
|
$bookkeeping->doc_type = 'customer_invoice';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = $val["fk_facturedet"];
|
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||||
|
$bookkeeping->code_tiers = $tabcompany[$key]['code_client'];
|
||||||
|
$bookkeeping->numero_compte = $tabcompany[$key]['code_compta'];
|
||||||
|
// $bookkeeping->label_compte = $tabcompany[$key]['name'];
|
||||||
|
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers");
|
||||||
|
$bookkeeping->montant = $mt;
|
||||||
|
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
||||||
|
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
|
||||||
|
$bookkeeping->credit = ($mt < 0) ? $mt : 0;
|
||||||
|
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
||||||
|
$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->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Product / Service
|
||||||
|
if (! $errorforline)
|
||||||
|
{
|
||||||
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
|
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->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->code_tiers = '';
|
||||||
|
$bookkeeping->numero_compte = $k;
|
||||||
|
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label;
|
||||||
|
$bookkeeping->montant = $mt;
|
||||||
|
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||||
|
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
|
||||||
|
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
||||||
|
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
||||||
|
$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->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// VAT
|
||||||
|
// 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->code_tiers = '';
|
$bookkeeping->code_tiers = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label;
|
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.$def_tva[$key];
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||||
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
|
||||||
@ -263,45 +326,23 @@ if ($action == 'writebookkeeping') {
|
|||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
$errorforline++;
|
{
|
||||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
$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');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// VAT
|
|
||||||
// var_dump($tabtva);
|
|
||||||
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 = $val["fk_facturedet"];
|
|
||||||
$bookkeeping->code_tiers = '';
|
|
||||||
$bookkeeping->numero_compte = $k;
|
|
||||||
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.$def_tva[$key];
|
|
||||||
$bookkeeping->montant = $mt;
|
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
|
||||||
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
|
|
||||||
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
|
||||||
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
|
||||||
if ($result < 0) {
|
|
||||||
$error++;
|
|
||||||
$errorforline++;
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -458,6 +499,7 @@ if ($action == 'export_csv') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (empty($action) || $action == 'view') {
|
if (empty($action) || $action == 'view') {
|
||||||
|
|
||||||
llxHeader('', $langs->trans("SellsJournal"));
|
llxHeader('', $langs->trans("SellsJournal"));
|
||||||
@ -474,17 +516,17 @@ if (empty($action) || $action == 'view') {
|
|||||||
else
|
else
|
||||||
$description .= $langs->trans("DepositsAreIncluded");
|
$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);
|
$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);
|
||||||
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array (
|
|
||||||
'action' => ''
|
|
||||||
));
|
|
||||||
|
|
||||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
|
||||||
|
|
||||||
|
/*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') . '"/>';
|
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
||||||
} else {
|
} else {
|
||||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||||
}
|
}*/
|
||||||
|
print '<div class="tabsAction">';
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '
|
print '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -503,7 +545,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
/*
|
/*
|
||||||
* Show result array
|
* Show result array
|
||||||
*/
|
*/
|
||||||
print '<br><br>';
|
print '<br>';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
@ -553,8 +595,8 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . "</td>";
|
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . "</td>";
|
||||||
print "</td><td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print "</td><td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
|
print "</tr>";
|
||||||
}
|
}
|
||||||
print "</tr>";
|
|
||||||
|
|
||||||
// Product / Service
|
// Product / Service
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
|
|||||||
@ -76,7 +76,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
|||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
llxHeader("", "", "FicheVentilation");
|
llxHeader("", $langs->trans('FicheVentilation'));
|
||||||
|
|
||||||
if ($cancel == $langs->trans("Cancel")) {
|
if ($cancel == $langs->trans("Cancel")) {
|
||||||
$action = '';
|
$action = '';
|
||||||
|
|||||||
@ -30,6 +30,7 @@ require '../main.inc.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||||
|
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
@ -140,7 +141,7 @@ if ($object->id > 0)
|
|||||||
|
|
||||||
if (! empty($conf->agenda->enabled))
|
if (! empty($conf->agenda->enabled))
|
||||||
{
|
{
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1">'.$langs->trans("AddAction").'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id.'">'.$langs->trans("AddAction").'</a></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@ -166,10 +167,10 @@ if ($object->id > 0)
|
|||||||
print load_fiche_titre($langs->trans("ActionsOnMember"),$out,'');
|
print load_fiche_titre($langs->trans("ActionsOnMember"),$out,'');
|
||||||
|
|
||||||
// List of todo actions
|
// List of todo actions
|
||||||
show_actions_todo($conf,$langs,$db,$object);
|
//show_actions_todo($conf,$langs,$db,$object);
|
||||||
|
|
||||||
// List of done actions
|
// List of done actions
|
||||||
show_actions_done($conf,$langs,$db,$object);
|
show_actions_done($conf,$langs,$db,$object,null,0,'','');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||||
@ -198,6 +198,9 @@ class Adherent extends CommonObject
|
|||||||
$infos.= $langs->transnoentities("Town").": ".$this->town."\n";
|
$infos.= $langs->transnoentities("Town").": ".$this->town."\n";
|
||||||
$infos.= $langs->transnoentities("Country").": ".$this->country."\n";
|
$infos.= $langs->transnoentities("Country").": ".$this->country."\n";
|
||||||
$infos.= $langs->transnoentities("EMail").": ".$this->email."\n";
|
$infos.= $langs->transnoentities("EMail").": ".$this->email."\n";
|
||||||
|
$infos.= $langs->transnoentities("PhonePro").": ".$this->phone."\n";
|
||||||
|
$infos.= $langs->transnoentities("PhonePerso").": ".$this->phone_perso."\n";
|
||||||
|
$infos.= $langs->transnoentities("PhoneMobile").": ".$this->phone_mobile."\n";
|
||||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||||
{
|
{
|
||||||
$infos.= $langs->transnoentities("Login").": ".$this->login."\n";
|
$infos.= $langs->transnoentities("Login").": ".$this->login."\n";
|
||||||
@ -225,6 +228,10 @@ class Adherent extends CommonObject
|
|||||||
'%PHOTO%'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo,
|
'%PHOTO%'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo,
|
||||||
'%LOGIN%'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login,
|
'%LOGIN%'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login,
|
||||||
'%PASSWORD%'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass,
|
'%PASSWORD%'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass,
|
||||||
|
'%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
|
// For backward compatibility
|
||||||
'%INFOS%'=>$msgishtml?dol_htmlentitiesbr($infos):$infos,
|
'%INFOS%'=>$msgishtml?dol_htmlentitiesbr($infos):$infos,
|
||||||
'%SOCIETE%'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe,
|
'%SOCIETE%'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe,
|
||||||
@ -439,18 +446,18 @@ class Adherent extends CommonObject
|
|||||||
$sql.= ", town=" .($this->town?"'".$this->db->escape($this->town)."'":"null");
|
$sql.= ", town=" .($this->town?"'".$this->db->escape($this->town)."'":"null");
|
||||||
$sql.= ", country=".($this->country_id>0?"'".$this->country_id."'":"null");
|
$sql.= ", country=".($this->country_id>0?"'".$this->country_id."'":"null");
|
||||||
$sql.= ", state_id=".($this->state_id>0?"'".$this->state_id."'":"null");
|
$sql.= ", state_id=".($this->state_id>0?"'".$this->state_id."'":"null");
|
||||||
$sql.= ", email='".$this->email."'";
|
$sql.= ", email='".$this->db->escape($this->email)."'";
|
||||||
$sql.= ", skype='".$this->skype."'";
|
$sql.= ", skype='".$this->db->escape($this->skype)."'";
|
||||||
$sql.= ", phone=" .($this->phone?"'".$this->db->escape($this->phone)."'":"null");
|
$sql.= ", phone=" .($this->phone?"'".$this->db->escape($this->phone)."'":"null");
|
||||||
$sql.= ", phone_perso=" .($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null");
|
$sql.= ", phone_perso=" .($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null");
|
||||||
$sql.= ", phone_mobile=" .($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null");
|
$sql.= ", phone_mobile=" .($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null");
|
||||||
$sql.= ", note_private=" .($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
|
$sql.= ", note_private=" .($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
|
||||||
$sql.= ", note_public=" .($this->note_public?"'".$this->db->escape($this->note_public)."'":"null");
|
$sql.= ", note_public=" .($this->note_public?"'".$this->db->escape($this->note_public)."'":"null");
|
||||||
$sql.= ", photo=" .($this->photo?"'".$this->photo."'":"null");
|
$sql.= ", photo=" .($this->photo?"'".$this->photo."'":"null");
|
||||||
$sql.= ", public='".$this->public."'";
|
$sql.= ", public='".$this->db->escape($this->public)."'";
|
||||||
$sql.= ", statut=" .$this->statut;
|
$sql.= ", statut=" .$this->statut;
|
||||||
$sql.= ", fk_adherent_type=".$this->typeid;
|
$sql.= ", fk_adherent_type=".$this->typeid;
|
||||||
$sql.= ", morphy='".$this->morphy."'";
|
$sql.= ", morphy='".$this->db->escape($this->morphy)."'";
|
||||||
$sql.= ", birth=" .($this->birth?"'".$this->db->idate($this->birth)."'":"null");
|
$sql.= ", birth=" .($this->birth?"'".$this->db->idate($this->birth)."'":"null");
|
||||||
if ($this->datefin) $sql.= ", datefin='".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription
|
if ($this->datefin) $sql.= ", datefin='".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription
|
||||||
if ($this->datevalid) $sql.= ", datevalid='".$this->db->idate($this->datevalid)."'"; // Must be modified only when validating a member
|
if ($this->datevalid) $sql.= ", datevalid='".$this->db->idate($this->datevalid)."'"; // Must be modified only when validating a member
|
||||||
@ -649,7 +656,7 @@ class Adherent extends CommonObject
|
|||||||
// Search for last subscription id and end date
|
// Search for last subscription id and end date
|
||||||
$sql = "SELECT rowid, datec as dateop, dateadh as datedeb, datef as datefin";
|
$sql = "SELECT rowid, datec as dateop, dateadh as datedeb, datef as datefin";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."subscription";
|
$sql.= " FROM ".MAIN_DB_PREFIX."subscription";
|
||||||
$sql.= " WHERE fk_adherent='".$this->id."'";
|
$sql.= " WHERE fk_adherent=".$this->id;
|
||||||
$sql.= " ORDER by dateadh DESC"; // Sort by start subscription date
|
$sql.= " ORDER by dateadh DESC"; // Sort by start subscription date
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::update_end_date", LOG_DEBUG);
|
dol_syslog(get_class($this)."::update_end_date", LOG_DEBUG);
|
||||||
@ -1926,27 +1933,28 @@ class Adherent extends CommonObject
|
|||||||
$this->fullname=$this->getFullName($langs);
|
$this->fullname=$this->getFullName($langs);
|
||||||
|
|
||||||
// Member
|
// Member
|
||||||
if ($this->fullname && ! empty($conf->global->LDAP_MEMBER_FIELD_FULLNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FULLNAME] = $this->fullname;
|
if ($this->fullname && ! empty($conf->global->LDAP_MEMBER_FIELD_FULLNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FULLNAME] = $this->fullname;
|
||||||
if ($this->lastname && ! empty($conf->global->LDAP_MEMBER_FIELD_NAME)) $info[$conf->global->LDAP_MEMBER_FIELD_NAME] = $this->lastname;
|
if ($this->lastname && ! empty($conf->global->LDAP_MEMBER_FIELD_NAME)) $info[$conf->global->LDAP_MEMBER_FIELD_NAME] = $this->lastname;
|
||||||
if ($this->firstname && ! empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname;
|
if ($this->firstname && ! empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname;
|
||||||
if ($this->login && ! empty($conf->global->LDAP_MEMBER_FIELD_LOGIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LOGIN] = $this->login;
|
if ($this->login && ! empty($conf->global->LDAP_MEMBER_FIELD_LOGIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LOGIN] = $this->login;
|
||||||
if ($this->pass && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
|
if ($this->pass && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
|
||||||
if ($this->poste && ! empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste;
|
if ($this->pass && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // md5 for OpenLdap TODO add type of encryption
|
||||||
if ($this->address && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address;
|
if ($this->poste && ! empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste;
|
||||||
if ($this->zip && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip;
|
if ($this->address && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address;
|
||||||
if ($this->town && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town;
|
if ($this->zip && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip;
|
||||||
if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code;
|
if ($this->town && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town;
|
||||||
if ($this->email && ! empty($conf->global->LDAP_MEMBER_FIELD_MAIL)) $info[$conf->global->LDAP_MEMBER_FIELD_MAIL] = $this->email;
|
if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code;
|
||||||
if ($this->skype && ! empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype;
|
if ($this->email && ! empty($conf->global->LDAP_MEMBER_FIELD_MAIL)) $info[$conf->global->LDAP_MEMBER_FIELD_MAIL] = $this->email;
|
||||||
if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone;
|
if ($this->skype && ! empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype;
|
||||||
if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
|
if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone;
|
||||||
if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile;
|
if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
|
||||||
if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax;
|
if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile;
|
||||||
if ($this->note_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private;
|
if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax;
|
||||||
if ($this->note_public && ! empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = $this->note_public;
|
if ($this->note_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private;
|
||||||
if ($this->birth && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth,'dayhourldap');
|
if ($this->note_public && ! empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = $this->note_public;
|
||||||
if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut;
|
if ($this->birth && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth,'dayhourldap');
|
||||||
if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap');
|
if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut;
|
||||||
|
if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap');
|
||||||
|
|
||||||
// Subscriptions
|
// Subscriptions
|
||||||
if ($this->first_subscription_date && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE] = dol_print_date($this->first_subscription_date,'dayhourldap');
|
if ($this->first_subscription_date && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE] = dol_print_date($this->first_subscription_date,'dayhourldap');
|
||||||
|
|||||||
@ -127,7 +127,7 @@ class AdherentType extends CommonObject
|
|||||||
$sql.= "note = '".$this->db->escape($this->note)."',";
|
$sql.= "note = '".$this->db->escape($this->note)."',";
|
||||||
$sql.= "vote = '".$this->vote."',";
|
$sql.= "vote = '".$this->vote."',";
|
||||||
$sql.= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
|
$sql.= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
|
||||||
$sql .= " WHERE rowid =".$this->id;
|
$sql.= " WHERE rowid =".$this->id;
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -245,7 +245,7 @@ class AdherentType extends CommonObject
|
|||||||
|
|
||||||
$sql = "SELECT rowid, libelle";
|
$sql = "SELECT rowid, libelle";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
||||||
$sql.= " WHERE entity = ".$conf->entity;
|
$sql.= " WHERE entity IN (".getEntity('adherent').")";
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
|||||||
@ -57,7 +57,7 @@ $type=GETPOST("type");
|
|||||||
$search_email=GETPOST("search_email");
|
$search_email=GETPOST("search_email");
|
||||||
$search_categ = GETPOST("search_categ",'int');
|
$search_categ = GETPOST("search_categ",'int');
|
||||||
$catid = GETPOST("catid",'int');
|
$catid = GETPOST("catid",'int');
|
||||||
$sall=GETPOST("sall");
|
$sall=GETPOST('sall', 'alphanohtml');
|
||||||
$optioncss = GETPOST('optioncss','alpha');
|
$optioncss = GETPOST('optioncss','alpha');
|
||||||
|
|
||||||
if ($statut < -1) $statut = '';
|
if ($statut < -1) $statut = '';
|
||||||
@ -375,7 +375,7 @@ if (! empty($moreforfilter))
|
|||||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
||||||
|
|||||||
@ -113,7 +113,6 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
|
|||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$errmsg=$langs->trans($company->error);
|
|
||||||
setEventMessages($company->error, $company->errors, 'errors');
|
setEventMessages($company->error, $company->errors, 'errors');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -123,7 +122,7 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$errmsg=$object->error;
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +210,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
{
|
{
|
||||||
$paymentdate=dol_mktime(0, 0, 0, $_POST["paymentmonth"], $_POST["paymentday"], $_POST["paymentyear"]);
|
$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"];
|
$label=$_POST["label"];
|
||||||
|
|
||||||
// Payment informations
|
// Payment informations
|
||||||
@ -229,6 +228,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
$error++;
|
$error++;
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateSubscription"));
|
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateSubscription"));
|
||||||
|
setEventMessages($errmsg, null, 'errors');
|
||||||
$action='addsubscription';
|
$action='addsubscription';
|
||||||
}
|
}
|
||||||
if (GETPOST('end') && ! $datesubend)
|
if (GETPOST('end') && ! $datesubend)
|
||||||
@ -236,6 +236,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
$error++;
|
$error++;
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateEndSubscription"));
|
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateEndSubscription"));
|
||||||
|
setEventMessages($errmsg, null, 'errors');
|
||||||
$action='addsubscription';
|
$action='addsubscription';
|
||||||
}
|
}
|
||||||
if (! $datesubend)
|
if (! $datesubend)
|
||||||
@ -246,16 +247,20 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment"));
|
$errmsg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment"));
|
||||||
|
setEventMessages($errmsg, null, 'errors');
|
||||||
$action='addsubscription';
|
$action='addsubscription';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$amount = price2num(GETPOST("subscription",'alpha'));
|
||||||
|
|
||||||
// Check if a payment is mandatory or not
|
// Check if a payment is mandatory or not
|
||||||
if (! $error && $adht->subscription) // Member type need subscriptions
|
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
|
// If field is '' or not a numeric value
|
||||||
$errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
|
$errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
|
||||||
|
setEventMessages($errmsg, null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
$action='addsubscription';
|
$action='addsubscription';
|
||||||
}
|
}
|
||||||
@ -273,7 +278,11 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
{
|
{
|
||||||
if ($_POST["accountid"]) $errmsg=$langs->trans("ErrorDoNotProvideAccountsIfNullAmount");
|
if ($_POST["accountid"]) $errmsg=$langs->trans("ErrorDoNotProvideAccountsIfNullAmount");
|
||||||
}
|
}
|
||||||
if ($errmsg) $action='addsubscription';
|
if ($errmsg)
|
||||||
|
{
|
||||||
|
setEventMessages($errmsg, null, 'errors');
|
||||||
|
$action='addsubscription';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -319,6 +328,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg=$db->lasterror();
|
$errmsg=$db->lasterror();
|
||||||
|
setEventMessages($errmsg, null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -326,14 +336,16 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
$error++;
|
$error++;
|
||||||
$errmsg=$acct->error;
|
$errmsg=$acct->error;
|
||||||
$errmsgs=$acct->errors;
|
$errmsgs=$acct->errors;
|
||||||
}
|
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg=$acct->error;
|
$errmsg=$acct->error;
|
||||||
$errmsgs=$acct->errors;
|
$errmsgs=$acct->errors;
|
||||||
}
|
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If option choosed, we create invoice
|
// If option choosed, we create invoice
|
||||||
@ -351,6 +363,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$errmsg=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst");
|
$errmsg=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst");
|
||||||
|
setEventMessages($errmsg, null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -361,6 +374,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
{
|
{
|
||||||
$errmsg=$customer->error;
|
$errmsg=$customer->error;
|
||||||
$errmsgs=$acct->errors;
|
$errmsgs=$acct->errors;
|
||||||
|
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -378,6 +392,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg='ErrorNoPaymentTermRECEPFound';
|
$errmsg='ErrorNoPaymentTermRECEPFound';
|
||||||
|
setEventMessages($errmsg, null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$invoice->socid=$object->fk_soc;
|
$invoice->socid=$object->fk_soc;
|
||||||
@ -395,6 +410,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
{
|
{
|
||||||
$errmsg=$invoice->error;
|
$errmsg=$invoice->error;
|
||||||
$errmsgs=$invoice->errors;
|
$errmsgs=$invoice->errors;
|
||||||
|
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -415,6 +431,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
$errmsg=$invoice->error;
|
$errmsg=$invoice->error;
|
||||||
|
setEventMessages($errmsg, null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -427,6 +444,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
{
|
{
|
||||||
$errmsg=$invoice->error;
|
$errmsg=$invoice->error;
|
||||||
$errmsgs=$invoice->errors;
|
$errmsgs=$invoice->errors;
|
||||||
|
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -454,6 +472,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
{
|
{
|
||||||
$errmsg=$paiement->error;
|
$errmsg=$paiement->error;
|
||||||
$errmsgs=$paiement->errors;
|
$errmsgs=$paiement->errors;
|
||||||
|
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -535,6 +554,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$errmsg=$object->error;
|
$errmsg=$object->error;
|
||||||
|
setEventMessages($errmsg, null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -145,7 +145,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->adherent-
|
|||||||
$result=$object->delete($user);
|
$result=$object->delete($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
header("Location: card_subscriptions.php?rowid=".$object->fk_adherent);
|
header("Location: ".DOL_URL_ROOT."/adherents/card.php?rowid=".$object->fk_adherent);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -40,7 +40,7 @@ $action = GETPOST('action','alpha');
|
|||||||
$value = GETPOST('value','alpha');
|
$value = GETPOST('value','alpha');
|
||||||
$param = GETPOST('param','alpha');
|
$param = GETPOST('param','alpha');
|
||||||
$cancel = GETPOST('cancel','alpha');
|
$cancel = GETPOST('cancel','alpha');
|
||||||
$scandir = GETPOST('scandir','alpha');
|
$scandir = GETPOST('scan_dir','alpha');
|
||||||
$type = 'action';
|
$type = 'action';
|
||||||
|
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
|||||||
print '<td align="center">'."\n";
|
print '<td align="center">'."\n";
|
||||||
if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name")
|
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 img_picto($langs->trans("Enabled"),'switch_on');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
@ -299,7 +299,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td align="center">'."\n";
|
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>";
|
print "</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
|||||||
}
|
}
|
||||||
else
|
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>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -43,7 +43,7 @@ if (!$user->admin)
|
|||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$value = GETPOST('value','alpha');
|
$value = GETPOST('value','alpha');
|
||||||
$label = GETPOST('label','alpha');
|
$label = GETPOST('label','alpha');
|
||||||
$scandir = GETPOST('scandir','alpha');
|
$scandir = GETPOST('scan_dir','alpha');
|
||||||
$type = 'bankaccount';
|
$type = 'bankaccount';
|
||||||
|
|
||||||
|
|
||||||
@ -324,7 +324,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
} else {
|
} else {
|
||||||
print '<td align="center">' . "\n";
|
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>";
|
print "</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,7 +333,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
if ($conf->global->BANKADDON_PDF == $name) {
|
if ($conf->global->BANKADDON_PDF == $name) {
|
||||||
print img_picto($langs->trans("Default"), 'on');
|
print img_picto($langs->trans("Default"), 'on');
|
||||||
} else {
|
} 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 '<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>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -189,7 +189,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -45,7 +45,7 @@ if (! $user->admin) accessforbidden();
|
|||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$value = GETPOST('value','alpha');
|
$value = GETPOST('value','alpha');
|
||||||
$label = GETPOST('label','alpha');
|
$label = GETPOST('label','alpha');
|
||||||
$scandir = GETPOST('scandir','alpha');
|
$scandir = GETPOST('scan_dir','alpha');
|
||||||
$type = 'order';
|
$type = 'order';
|
||||||
|
|
||||||
|
|
||||||
@ -490,7 +490,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td align="center">'."\n";
|
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>";
|
print "</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -502,7 +502,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
else
|
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 '<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>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ if (!$user->admin) accessforbidden();
|
|||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$value = GETPOST('value','alpha');
|
$value = GETPOST('value','alpha');
|
||||||
$label = GETPOST('label','alpha');
|
$label = GETPOST('label','alpha');
|
||||||
$scandir = GETPOST('scandir','alpha');
|
$scandir = GETPOST('scan_dir','alpha');
|
||||||
$type='contract';
|
$type='contract';
|
||||||
|
|
||||||
if (empty($conf->global->CONTRACT_ADDON))
|
if (empty($conf->global->CONTRACT_ADDON))
|
||||||
@ -425,7 +425,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td align="center">'."\n";
|
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>";
|
print "</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -437,7 +437,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
else
|
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 '<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>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -680,6 +680,10 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null
|
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null
|
||||||
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null
|
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null
|
||||||
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
|
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
|
||||||
|
if ($id == 10 && isset($_POST["code"])) // Spaces are not allowed into code
|
||||||
|
{
|
||||||
|
$_POST["code"]=preg_replace('/\s/','',$_POST["code"]);
|
||||||
|
}
|
||||||
|
|
||||||
// Si verif ok et action add, on ajoute la ligne
|
// Si verif ok et action add, on ajoute la ligne
|
||||||
if ($ok && GETPOST('actionadd'))
|
if ($ok && GETPOST('actionadd'))
|
||||||
@ -937,7 +941,7 @@ print "<br>\n";
|
|||||||
// Confirmation de la suppression de la ligne
|
// Confirmation de la suppression de la ligne
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$_GET["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.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
||||||
}
|
}
|
||||||
//var_dump($elementList);
|
//var_dump($elementList);
|
||||||
|
|
||||||
@ -1034,13 +1038,13 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); }
|
if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); }
|
||||||
if ($fieldlist[$field]=='type_cdr') { $valuetoshow=$langs->trans("AtEndOfMonth"); $align="center"; }
|
if ($fieldlist[$field]=='type_cdr') { $valuetoshow=$langs->trans("AtEndOfMonth"); $align="center"; }
|
||||||
if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); }
|
if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); }
|
||||||
if ($fieldlist[$field]=='width' || $fieldlist[$field]=='nx') { $valuetoshow=$langs->trans("Width"); }
|
if ($fieldlist[$field]=='width' || $fieldlist[$field]=='nx') { $valuetoshow=$langs->trans("Width"); }
|
||||||
if ($fieldlist[$field]=='height' || $fieldlist[$field]=='ny') { $valuetoshow=$langs->trans("Height"); }
|
if ($fieldlist[$field]=='height' || $fieldlist[$field]=='ny') { $valuetoshow=$langs->trans("Height"); }
|
||||||
if ($fieldlist[$field]=='unit' || $fieldlist[$field]=='metric') { $valuetoshow=$langs->trans("MeasuringUnit"); }
|
if ($fieldlist[$field]=='unit' || $fieldlist[$field]=='metric') { $valuetoshow=$langs->trans("MeasuringUnit"); }
|
||||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $valuetoshow=''; }
|
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $valuetoshow=''; }
|
||||||
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
|
if ($fieldlist[$field]=='accountancy_code') { $valuetoshow=$langs->trans("AccountancyCode"); }
|
||||||
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); }
|
if ($fieldlist[$field]=='accountancy_code_sell') { $valuetoshow=$langs->trans("AccountancyCodeSell"); }
|
||||||
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); }
|
if ($fieldlist[$field]=='accountancy_code_buy') { $valuetoshow=$langs->trans("AccountancyCodeBuy"); }
|
||||||
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
|
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
|
||||||
if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountparent"); }
|
if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountparent"); }
|
||||||
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); }
|
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); }
|
||||||
@ -1063,7 +1067,7 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); }
|
if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); }
|
||||||
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); }
|
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); }
|
||||||
if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); }
|
if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); }
|
||||||
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); }
|
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("WithCounter"); }
|
||||||
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
|
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
|
||||||
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
|
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
|
||||||
|
|
||||||
@ -1254,7 +1258,7 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); }
|
if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); }
|
||||||
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); }
|
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); }
|
||||||
if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); }
|
if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); }
|
||||||
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); }
|
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("WithCounter"); }
|
||||||
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
|
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
|
||||||
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
|
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
|
||||||
|
|
||||||
@ -1833,6 +1837,8 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
$size=''; $class='';
|
$size=''; $class='';
|
||||||
if ($fieldlist[$field]=='code') $class='maxwidth100';
|
if ($fieldlist[$field]=='code') $class='maxwidth100';
|
||||||
|
if ($fieldlist[$field]=='affect') $class='maxwidth50';
|
||||||
|
if ($fieldlist[$field]=='delay') $class='maxwidth50';
|
||||||
if ($fieldlist[$field]=='position') $class='maxwidth50';
|
if ($fieldlist[$field]=='position') $class='maxwidth50';
|
||||||
if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent';
|
if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent';
|
||||||
if ($fieldlist[$field]=='tracking') $class='quatrevingtpercent';
|
if ($fieldlist[$field]=='tracking') $class='quatrevingtpercent';
|
||||||
|
|||||||
@ -44,7 +44,7 @@ if (! $user->admin)
|
|||||||
$action=GETPOST('action','alpha');
|
$action=GETPOST('action','alpha');
|
||||||
$value=GETPOST('value','alpha');
|
$value=GETPOST('value','alpha');
|
||||||
$label = GETPOST('label','alpha');
|
$label = GETPOST('label','alpha');
|
||||||
$scandir = GETPOST('scandir','alpha');
|
$scandir = GETPOST('scan_dir','alpha');
|
||||||
$type='shipping';
|
$type='shipping';
|
||||||
|
|
||||||
if (empty($conf->global->EXPEDITION_ADDON_NUMBER))
|
if (empty($conf->global->EXPEDITION_ADDON_NUMBER))
|
||||||
@ -291,7 +291,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&value='.$file.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&value='.$file.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
||||||
print img_picto($langs->trans("Disabled"),'switch_off');
|
print img_picto($langs->trans("Disabled"),'switch_off');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
@ -432,7 +432,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td align="center">'."\n";
|
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>";
|
print "</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,7 +444,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
else
|
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 '<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>';
|
print '</td>';
|
||||||
|
|
||||||
@ -470,7 +470,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if ($module->type == 'pdf')
|
if ($module->type == 'pdf')
|
||||||
{
|
{
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"),'sending').'</a>';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"),'sending').'</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -43,7 +43,7 @@ if (! $user->admin) accessforbidden();
|
|||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$value = GETPOST('value','alpha');
|
$value = GETPOST('value','alpha');
|
||||||
$label = GETPOST('label','alpha');
|
$label = GETPOST('label','alpha');
|
||||||
$scandir = GETPOST('scandir','alpha');
|
$scandir = GETPOST('scan_dir','alpha');
|
||||||
$type='expensereport';
|
$type='expensereport';
|
||||||
|
|
||||||
|
|
||||||
@ -423,7 +423,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
if (in_array($name, $def))
|
if (in_array($name, $def))
|
||||||
{
|
{
|
||||||
print "<td align=\"center\">\n";
|
print "<td align=\"center\">\n";
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
||||||
print img_picto($langs->trans("Enabled"),'switch_on');
|
print img_picto($langs->trans("Enabled"),'switch_on');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print "</td>";
|
print "</td>";
|
||||||
@ -431,7 +431,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<td align=\"center\">\n";
|
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>";
|
print "</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,7 +443,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
else
|
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 '<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>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -638,7 +638,7 @@ if (! empty($conf->banque->enabled))
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
|
||||||
$sql.= " WHERE clos = 0";
|
$sql.= " WHERE clos = 0";
|
||||||
$sql.= " AND courant = 1";
|
$sql.= " AND courant = 1";
|
||||||
$sql.= " AND entity IN (".getEntity('bank', 1).")";
|
$sql.= " AND entity IN (".getEntity('bank_account', 1).")";
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -683,7 +683,7 @@ $sql = "SELECT rowid, label";
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
|
||||||
$sql.= " WHERE clos = 0";
|
$sql.= " WHERE clos = 0";
|
||||||
$sql.= " AND courant = 1";
|
$sql.= " AND courant = 1";
|
||||||
$sql.= " AND entity IN (".getEntity('bank', 1).")";
|
$sql.= " AND entity IN (".getEntity('bank_account', 1).")";
|
||||||
$var=True;
|
$var=True;
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
|||||||
@ -43,7 +43,7 @@ if (! $user->admin) accessforbidden();
|
|||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$value = GETPOST('value','alpha');
|
$value = GETPOST('value','alpha');
|
||||||
$label = GETPOST('label','alpha');
|
$label = GETPOST('label','alpha');
|
||||||
$scandir = GETPOST('scandir','alpha');
|
$scandir = GETPOST('scan_dir','alpha');
|
||||||
$type='ficheinter';
|
$type='ficheinter';
|
||||||
|
|
||||||
|
|
||||||
@ -458,7 +458,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
if (in_array($name, $def))
|
if (in_array($name, $def))
|
||||||
{
|
{
|
||||||
print "<td align=\"center\">\n";
|
print "<td align=\"center\">\n";
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
||||||
print img_picto($langs->trans("Enabled"),'switch_on');
|
print img_picto($langs->trans("Enabled"),'switch_on');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print "</td>";
|
print "</td>";
|
||||||
@ -466,7 +466,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<td align=\"center\">\n";
|
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>";
|
print "</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,7 +478,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
else
|
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 '<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>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -43,7 +43,7 @@ if (!$user->admin) accessforbidden();
|
|||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$value = GETPOST('value','alpha');
|
$value = GETPOST('value','alpha');
|
||||||
$label = GETPOST('label','alpha');
|
$label = GETPOST('label','alpha');
|
||||||
$scandir = GETPOST('scandir','alpha');
|
$scandir = GETPOST('scan_dir','alpha');
|
||||||
$type='delivery';
|
$type='delivery';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -412,7 +412,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
if (in_array($name, $def))
|
if (in_array($name, $def))
|
||||||
{
|
{
|
||||||
print "<td align=\"center\">\n";
|
print "<td align=\"center\">\n";
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
||||||
print img_picto($langs->trans("Enabled"),'switch_on');
|
print img_picto($langs->trans("Enabled"),'switch_on');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print "</td>";
|
print "</td>";
|
||||||
@ -420,7 +420,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<td align=\"center\">\n";
|
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>";
|
print "</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,7 +432,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
else
|
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 '<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>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -390,6 +390,7 @@ if ($mode != 'marketplace')
|
|||||||
|
|
||||||
// Check filters
|
// Check filters
|
||||||
$modulename=$objMod->getName();
|
$modulename=$objMod->getName();
|
||||||
|
$moduletechnicalname=$objMod->name;
|
||||||
$moduledesc=$objMod->getDesc();
|
$moduledesc=$objMod->getDesc();
|
||||||
$moduledesclong=$objMod->getDescLong();
|
$moduledesclong=$objMod->getDescLong();
|
||||||
$moduleauthor=$objMod->getPublisher();
|
$moduleauthor=$objMod->getPublisher();
|
||||||
@ -399,6 +400,7 @@ if ($mode != 'marketplace')
|
|||||||
{
|
{
|
||||||
$qualified=0;
|
$qualified=0;
|
||||||
if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename)
|
if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename)
|
||||||
|
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduletechnicalname)
|
||||||
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduledesc)
|
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduledesc)
|
||||||
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduledesclong)
|
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduledesclong)
|
||||||
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduleauthor)
|
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduleauthor)
|
||||||
|
|||||||
@ -36,7 +36,7 @@ if (! $user->admin) accessforbidden();
|
|||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$value = GETPOST('value','alpha');
|
$value = GETPOST('value','alpha');
|
||||||
$label = GETPOST('label','alpha');
|
$label = GETPOST('label','alpha');
|
||||||
$scandir = GETPOST('scandir','alpha');
|
$scandir = GETPOST('scan_dir','alpha');
|
||||||
$type='invoice';
|
$type='invoice';
|
||||||
|
|
||||||
if (empty($conf->global->PAYMENT_ADDON)) $conf->global->PAYMENT_ADDON = 'mod_payment_cicada.php';
|
if (empty($conf->global->PAYMENT_ADDON)) $conf->global->PAYMENT_ADDON = 'mod_payment_cicada.php';
|
||||||
@ -201,7 +201,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -189,7 +189,7 @@ if ($result)
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '. $bc[$var].'>';
|
print '<tr '. $bc[$var].'>';
|
||||||
|
|
||||||
print '<td>'.img_object('',$picto).' '.$objMod->getName();
|
print '<td>'.img_object('',$picto,'class="pictoobjectwidth"').' '.$objMod->getName();
|
||||||
print '<a name="'.$objMod->getName().'"> </a>';
|
print '<a name="'.$objMod->getName().'"> </a>';
|
||||||
|
|
||||||
$perm_libelle=($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id)!=("PermissionAdvanced".$obj->id))?$langs->trans("PermissionAdvanced".$obj->id):(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$obj->libelle));
|
$perm_libelle=($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id)!=("PermissionAdvanced".$obj->id))?$langs->trans("PermissionAdvanced".$obj->id):(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$obj->libelle));
|
||||||
|
|||||||
@ -332,7 +332,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td align="center">'."\n";
|
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>";
|
print "</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,7 +344,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
else
|
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 '<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>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -42,7 +42,7 @@ if (! $user->admin) accessforbidden();
|
|||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$value = GETPOST('value','alpha');
|
$value = GETPOST('value','alpha');
|
||||||
$label = GETPOST('label','alpha');
|
$label = GETPOST('label','alpha');
|
||||||
$scandir = GETPOST('scandir','alpha');
|
$scandir = GETPOST('scan_dir','alpha');
|
||||||
$type='propal';
|
$type='propal';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -469,7 +469,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<td align=\"center\">\n";
|
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>";
|
print "</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,7 +481,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
else
|
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 '<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>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -43,7 +43,7 @@ accessforbidden();
|
|||||||
$type=GETPOST('type', 'alpha');
|
$type=GETPOST('type', 'alpha');
|
||||||
$value=GETPOST('value', 'alpha');
|
$value=GETPOST('value', 'alpha');
|
||||||
$action=GETPOST('action', 'alpha');
|
$action=GETPOST('action', 'alpha');
|
||||||
$scandir = GETPOST('scandir','alpha');
|
$scandir = GETPOST('scan_dir','alpha');
|
||||||
|
|
||||||
$specimenthirdparty=new Societe($db);
|
$specimenthirdparty=new Societe($db);
|
||||||
$specimenthirdparty->initAsSpecimen();
|
$specimenthirdparty->initAsSpecimen();
|
||||||
@ -398,7 +398,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
//if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name")
|
//if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name")
|
||||||
//{
|
//{
|
||||||
// Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all
|
// Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'&type=invoice_supplier">';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=invoice_supplier">';
|
||||||
print img_picto($langs->trans("Enabled"),'switch_on');
|
print img_picto($langs->trans("Enabled"),'switch_on');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
/*}
|
/*}
|
||||||
@ -411,7 +411,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td align="center">'."\n";
|
print '<td align="center">'."\n";
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'&type=invoice_supplier">'.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).'&type=invoice_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||||
print "</td>";
|
print "</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,11 +421,11 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
//print img_picto($langs->trans("Default"),'on');
|
//print img_picto($langs->trans("Default"),'on');
|
||||||
// Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all
|
// Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"),'on').'</a>';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"),'on').'</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" 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=invoice_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,7 @@ $type=GETPOST('type', 'alpha');
|
|||||||
$value=GETPOST('value', 'alpha');
|
$value=GETPOST('value', 'alpha');
|
||||||
$label = GETPOST('label','alpha');
|
$label = GETPOST('label','alpha');
|
||||||
$action=GETPOST('action', 'alpha');
|
$action=GETPOST('action', 'alpha');
|
||||||
$scandir = GETPOST('scandir','alpha');
|
$scandir = GETPOST('scan_dir','alpha');
|
||||||
|
|
||||||
$specimenthirdparty=new Societe($db);
|
$specimenthirdparty=new Societe($db);
|
||||||
$specimenthirdparty->initAsSpecimen();
|
$specimenthirdparty->initAsSpecimen();
|
||||||
@ -420,7 +420,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
print '<td align="center">'."\n";
|
print '<td align="center">'."\n";
|
||||||
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name")
|
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name")
|
||||||
{
|
{
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'&type=order_supplier">';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=order_supplier">';
|
||||||
print img_picto($langs->trans("Enabled"),'switch_on');
|
print img_picto($langs->trans("Enabled"),'switch_on');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
@ -433,7 +433,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td align="center">'."\n";
|
print '<td align="center">'."\n";
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'&type=order_supplier">'.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).'&type=order_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||||
print "</td>";
|
print "</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,7 +445,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'&type=order_supplier"" 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=order_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ if (! $user->admin) accessforbidden();
|
|||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$value = GETPOST('value','alpha');
|
$value = GETPOST('value','alpha');
|
||||||
$label = GETPOST('label','alpha');
|
$label = GETPOST('label','alpha');
|
||||||
$scandir = GETPOST('scandir','alpha');
|
$scandir = GETPOST('scan_dir','alpha');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -172,7 +172,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ if (! $user->admin) accessforbidden();
|
|||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$value = GETPOST('value','alpha');
|
$value = GETPOST('value','alpha');
|
||||||
$label = GETPOST('label','alpha');
|
$label = GETPOST('label','alpha');
|
||||||
$scandir = GETPOST('scandir','alpha');
|
$scandir = GETPOST('scan_dir','alpha');
|
||||||
$type='supplier_proposal';
|
$type='supplier_proposal';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -274,7 +274,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
|
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle))!==false)
|
||||||
{
|
{
|
||||||
if (substr($file, 0, 21) == 'mod_supplier_proposal_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
if (substr($file, 0, 22) == 'mod_supplier_proposal_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||||
{
|
{
|
||||||
$file = substr($file, 0, dol_strlen($file)-4);
|
$file = substr($file, 0, dol_strlen($file)-4);
|
||||||
|
|
||||||
@ -446,7 +446,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<td align=\"center\">\n";
|
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>";
|
print "</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,7 +458,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
else
|
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 '<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>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -88,6 +88,7 @@ if (!empty($ExecTimeLimit))
|
|||||||
@set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64
|
@set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64
|
||||||
error_reporting($err);
|
error_reporting($err);
|
||||||
}
|
}
|
||||||
|
$MemoryLimit=0;
|
||||||
if (!empty($MemoryLimit))
|
if (!empty($MemoryLimit))
|
||||||
{
|
{
|
||||||
@ini_set('memory_limit', $MemoryLimit);
|
@ini_set('memory_limit', $MemoryLimit);
|
||||||
|
|||||||
@ -38,7 +38,7 @@ if (! $user->admin)
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$title=$langs->trans("SystemToolsArea");
|
$title=$langs->trans("SystemToolsArea");
|
||||||
if (GETPOST('leftmenu') == 'admintools') $title=$langs->trans("ModulesSystemTools");
|
if (GETPOST('leftmenu',"aZ09") == 'admintools') $title=$langs->trans("ModulesSystemTools");
|
||||||
|
|
||||||
llxHeader('', $title);
|
llxHeader('', $title);
|
||||||
|
|
||||||
|
|||||||
@ -75,7 +75,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// 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") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$transkey='';
|
$transkey='';
|
||||||
$transvalue='';
|
$transvalue='';
|
||||||
@ -116,7 +116,11 @@ if ($action == 'add' || (GETPOST('add') && $action != 'update'))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("WarningAnEntryAlreadyExistForTransKey"), null, 'warnings');
|
||||||
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -422,9 +426,17 @@ if ($mode == 'searchkey')
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langcode.'</td><td>'.$key.'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langcode.'</td><td>'.$key.'</td><td>';
|
||||||
print dol_escape_htmltag($val);
|
print dol_escape_htmltag($val);
|
||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
if ($val != $newlangfileonly->tab_translate[$key])
|
if (! empty($newlangfileonly->tab_translate[$key]))
|
||||||
{
|
{
|
||||||
$htmltext = $langs->trans("OriginalValueWas", $newlangfileonly->tab_translate[$key]);
|
if ($val != $newlangfileonly->tab_translate[$key])
|
||||||
|
{
|
||||||
|
$htmltext = $langs->trans("OriginalValueWas", $newlangfileonly->tab_translate[$key]);
|
||||||
|
print $form->textwithpicto('', $htmltext, 1, 'info');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$htmltext = $langs->trans("TransKeyWithoutOriginalValue", $key);
|
||||||
print $form->textwithpicto('', $htmltext, 1, 'warning');
|
print $form->textwithpicto('', $htmltext, 1, 'warning');
|
||||||
}
|
}
|
||||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||||
|
|||||||
@ -43,12 +43,29 @@ if ($action == 'setproductionmode')
|
|||||||
|
|
||||||
if (dolibarr_set_const($db, 'API_PRODUCTION_MODE', $status, 'chaine', 0, '', $conf->entity) > 0)
|
if (dolibarr_set_const($db, 'API_PRODUCTION_MODE', $status, 'chaine', 0, '', $conf->entity) > 0)
|
||||||
{
|
{
|
||||||
$result = dol_mkdir($conf->api->dir_temp);
|
$error=0;
|
||||||
if ($result < 0)
|
|
||||||
{
|
if ($status == 1)
|
||||||
setEventMessages($langs->trans("ErrorFaildToCreateDir", $conf->api->dir_temp), null, 'errors');
|
{
|
||||||
}
|
$result = dol_mkdir($conf->api->dir_temp);
|
||||||
else
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("ErrorFailedToCreateDir", $conf->api->dir_temp), null, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Delete the cache file otherwise it does not update
|
||||||
|
$result = dol_delete_file($conf->api->dir_temp.'/routes.php');
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("ErrorFailedToDeleteFile", $conf->api->dir_temp.'/routes.php'), null, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error)
|
||||||
{
|
{
|
||||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
* Copyright (C) 2006-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -374,19 +374,25 @@ jQuery(document).ready(function() {
|
|||||||
print '<input id="fillmanually" type="radio" '.((! GETPOST("selectorforbarcode") || GETPOST("selectorforbarcode")=='fillmanually')?'checked ':'').'name="selectorforbarcode" value="fillmanually" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueManually").' ';
|
print '<input id="fillmanually" type="radio" '.((! GETPOST("selectorforbarcode") || GETPOST("selectorforbarcode")=='fillmanually')?'checked ':'').'name="selectorforbarcode" value="fillmanually" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueManually").' ';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print '<input id="fillfromproduct" type="radio" '.((GETPOST("selectorforbarcode")=='fillfromproduct')?'checked ':'').'name="selectorforbarcode" value="fillfromproduct" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromProduct").' ';
|
if (! empty($user->rights->produit->lire) || ! empty($user->rights->service->lire))
|
||||||
print '<br>';
|
{
|
||||||
print '<div class="showforproductselector">';
|
print '<input id="fillfromproduct" type="radio" '.((GETPOST("selectorforbarcode")=='fillfromproduct')?'checked ':'').'name="selectorforbarcode" value="fillfromproduct" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromProduct").' ';
|
||||||
$form->select_produits(GETPOST('productid'), 'productid', '');
|
print '<br>';
|
||||||
print ' <input type="submit" id="submitproduct" name="submitproduct" class="button" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
|
print '<div class="showforproductselector">';
|
||||||
print '</div>';
|
$form->select_produits(GETPOST('productid'), 'productid', '');
|
||||||
|
print ' <input type="submit" id="submitproduct" name="submitproduct" class="button" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
|
||||||
|
print '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
print '<input id="fillfromthirdparty" type="radio" '.((GETPOST("selectorforbarcode")=='fillfromthirdparty')?'checked ':'').'name="selectorforbarcode" value="fillfromthirdparty" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").' ';
|
if (! empty($user->rights->societe->lire))
|
||||||
print '<br>';
|
{
|
||||||
print '<div class="showforthirdpartyselector">';
|
print '<input id="fillfromthirdparty" type="radio" '.((GETPOST("selectorforbarcode")=='fillfromthirdparty')?'checked ':'').'name="selectorforbarcode" value="fillfromthirdparty" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").' ';
|
||||||
print $form->select_company(GETPOST('socid'), 'socid', '', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300');
|
print '<br>';
|
||||||
print ' <input type="submit" id="submitthirdparty" name="submitthirdparty" class="button showforthirdpartyselector" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
|
print '<div class="showforthirdpartyselector">';
|
||||||
print '</div>';
|
print $form->select_company(GETPOST('socid'), 'socid', '', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300');
|
||||||
|
print ' <input type="submit" id="submitthirdparty" name="submitthirdparty" class="button showforthirdpartyselector" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
|
||||||
|
print '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|||||||
@ -40,7 +40,7 @@ function printBookmarksList($aDb, $aLangs)
|
|||||||
|
|
||||||
$langs->load("bookmarks");
|
$langs->load("bookmarks");
|
||||||
|
|
||||||
$url= $_SERVER["PHP_SELF"].(! empty($_SERVER["QUERY_STRING"])?'?'.$_SERVER["QUERY_STRING"]:'');
|
$url= $_SERVER["PHP_SELF"].(dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):'');
|
||||||
|
|
||||||
$ret = '';
|
$ret = '';
|
||||||
// Menu bookmark
|
// Menu bookmark
|
||||||
|
|||||||
@ -34,8 +34,8 @@ if ( $_GET['id'] == 'NOUV' )
|
|||||||
// Recuperation, s'il existe, de l'objet contenant les infos de la vente en cours ...
|
// Recuperation, s'il existe, de l'objet contenant les infos de la vente en cours ...
|
||||||
if (isset($_SESSION['serObjFacturation']))
|
if (isset($_SESSION['serObjFacturation']))
|
||||||
{
|
{
|
||||||
$obj_facturation = unserialize($_SESSION['serObjFacturation']);
|
$obj_facturation = unserialize($_SESSION['serObjFacturation']);
|
||||||
unset($_SESSION['serObjFacturation']);
|
unset($_SESSION['serObjFacturation']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -43,7 +43,7 @@ else
|
|||||||
$obj_facturation = new Facturation();
|
$obj_facturation = new Facturation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// $obj_facturation contains data for all invoice total + selection of current product
|
||||||
|
|
||||||
$obj_facturation->calculTotaux(); // Redefine prix_total_ttc, prix_total_ht et montant_tva from $_SESSION['poscart']
|
$obj_facturation->calculTotaux(); // Redefine prix_total_ttc, prix_total_ht et montant_tva from $_SESSION['poscart']
|
||||||
|
|
||||||
|
|||||||
@ -103,13 +103,21 @@ class Facturation
|
|||||||
$vatrowid = $this->tva();
|
$vatrowid = $this->tva();
|
||||||
|
|
||||||
$tmp = getTaxesFromId($vatrowid);
|
$tmp = getTaxesFromId($vatrowid);
|
||||||
$vat_rate = $tmp['rate'];
|
$txtva = $tmp['rate'].(empty($tmp['code'])?'':' ('.$tmp['code'].')');
|
||||||
$vat_npr = $tmp['npr'];
|
$vat_npr = $tmp['npr'];
|
||||||
|
|
||||||
$localtaxarray = getLocalTaxesFromRate($vatrowid, 0, $societe, $mysoc, 1);
|
$localtaxarray = getLocalTaxesFromRate($vatrowid, 0, $societe, $mysoc, 1);
|
||||||
|
|
||||||
|
// Clean vat code
|
||||||
|
$vat_src_code='';
|
||||||
|
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||||
|
{
|
||||||
|
$vat_src_code = $reg[1];
|
||||||
|
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||||
|
}
|
||||||
|
|
||||||
// Define part of HT, VAT, TTC
|
// Define part of HT, VAT, TTC
|
||||||
$resultarray=calcul_price_total($this->qte, $this->prix(), $this->remisePercent(), $vat_rate, -1, -1, 0, 'HT', $use_npr, $product->type, $mysoc, $localtaxarray);
|
$resultarray=calcul_price_total($this->qte, $this->prix(), $this->remisePercent(), $txtva, -1, -1, 0, 'HT', $use_npr, $product->type, $mysoc, $localtaxarray);
|
||||||
|
|
||||||
// Calcul du total ht sans remise
|
// Calcul du total ht sans remise
|
||||||
$total_ht = $resultarray[0];
|
$total_ht = $resultarray[0];
|
||||||
@ -148,7 +156,7 @@ class Facturation
|
|||||||
|
|
||||||
$newcartarray[$i]['fk_article']=$this->id;
|
$newcartarray[$i]['fk_article']=$this->id;
|
||||||
$newcartarray[$i]['qte']=$this->qte();
|
$newcartarray[$i]['qte']=$this->qte();
|
||||||
$newcartarray[$i]['fk_tva']=$this->tva();
|
$newcartarray[$i]['fk_tva']=$this->tva(); // Vat rowid
|
||||||
$newcartarray[$i]['remise_percent']=$remise_percent;
|
$newcartarray[$i]['remise_percent']=$remise_percent;
|
||||||
$newcartarray[$i]['remise']=price2num($montant_remise_ht);
|
$newcartarray[$i]['remise']=price2num($montant_remise_ht);
|
||||||
$newcartarray[$i]['total_ht']=price2num($total_ht,'MT');
|
$newcartarray[$i]['total_ht']=price2num($total_ht,'MT');
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
|
||||||
// Get list of articles (in warehouse '$conf_fkentrepot' if defined and stock module enabled)
|
// Get list of articles (in warehouse '$conf_fkentrepot' if defined and stock module enabled)
|
||||||
if ( GETPOST('filtre') ) {
|
if ( GETPOST('filtre','alpha') ) {
|
||||||
|
|
||||||
// Avec filtre
|
// Avec filtre
|
||||||
$ret=array(); $i=0;
|
$ret=array(); $i=0;
|
||||||
@ -47,22 +47,23 @@ if ( GETPOST('filtre') ) {
|
|||||||
$sql.= " WHERE p.entity IN (".getEntity('product', 1).")";
|
$sql.= " WHERE p.entity IN (".getEntity('product', 1).")";
|
||||||
$sql.= " AND p.tosell = 1";
|
$sql.= " AND p.tosell = 1";
|
||||||
if(!$conf->global->CASHDESK_SERVICES) $sql.= " AND p.fk_product_type = 0";
|
if(!$conf->global->CASHDESK_SERVICES) $sql.= " AND p.fk_product_type = 0";
|
||||||
$sql.= " AND (p.ref LIKE '%".$db->escape(GETPOST('filtre'))."%' OR p.label LIKE '%".$db->escape(GETPOST('filtre'))."%'";
|
$sql.= " AND (";
|
||||||
if (! empty($conf->barcode->enabled)) {
|
$sql.= "p.ref LIKE '%".$db->escape(GETPOST('filtre'))."%' OR p.label LIKE '%".$db->escape(GETPOST('filtre'))."%'";
|
||||||
|
if (! empty($conf->barcode->enabled))
|
||||||
$filtre = GETPOST('filtre');
|
{
|
||||||
|
$filtre = GETPOST('filtre','alpha');
|
||||||
|
|
||||||
//If the barcode looks like an EAN13 format and the last digit is included in it,
|
//If the barcode looks like an EAN13 format and the last digit is included in it,
|
||||||
//then whe look for the 12-digit too
|
//then whe look for the 12-digit too
|
||||||
//As the twelve-digit string will also hit the 13-digit code, we only look for this one
|
//As the twelve-digit string will also hit the 13-digit code, we only look for this one
|
||||||
if (strlen($filtre) == 13) {
|
if (strlen($filtre) == 13) {
|
||||||
$crit_12digit = substr($filtre, 0, 12);
|
$crit_12digit = substr($filtre, 0, 12);
|
||||||
$sql .= " OR p.barcode LIKE '%".$db->escape($crit_12digit)."%')";
|
$sql .= " OR p.barcode LIKE '%".$db->escape($crit_12digit)."%'";
|
||||||
} else {
|
} else {
|
||||||
$sql.= " OR p.barcode LIKE '%".$db->escape($filtre)."%')";
|
$sql.= " OR p.barcode LIKE '%".$db->escape($filtre)."%'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else $sql.= ")";
|
$sql.= ")";
|
||||||
$sql.= " ORDER BY label";
|
$sql.= " ORDER BY label";
|
||||||
|
|
||||||
dol_syslog("facturation.php", LOG_DEBUG);
|
dol_syslog("facturation.php", LOG_DEBUG);
|
||||||
@ -154,34 +155,6 @@ global $mysoc;
|
|||||||
$ret=array();
|
$ret=array();
|
||||||
$i=0;
|
$i=0;
|
||||||
|
|
||||||
$sql = "SELECT t.rowid, t.taux";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t";
|
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."c_country as c";
|
|
||||||
$sql.= " WHERE t.fk_pays = c.rowid";
|
|
||||||
$sql.= " AND t.active = 1";
|
|
||||||
$sql.= " AND c.code = '".$mysoc->country_code."'";
|
|
||||||
//print $sql;
|
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
while ( $tab = $db->fetch_array($resql) )
|
|
||||||
{
|
|
||||||
foreach ( $tab as $cle => $valeur )
|
|
||||||
{
|
|
||||||
$ret[$i][$cle] = $valeur;
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
$db->free($resql);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
$tab_tva = $ret;
|
|
||||||
|
|
||||||
|
|
||||||
// Reinitialisation du mode de paiement, en cas de retour aux achats apres validation
|
// Reinitialisation du mode de paiement, en cas de retour aux achats apres validation
|
||||||
$obj_facturation->getSetPaymentMode('RESET');
|
$obj_facturation->getSetPaymentMode('RESET');
|
||||||
$obj_facturation->montantEncaisse('RESET');
|
$obj_facturation->montantEncaisse('RESET');
|
||||||
|
|||||||
@ -32,12 +32,12 @@ $obj_facturation = unserialize($_SESSION['serObjFacturation']);
|
|||||||
unset ($_SESSION['serObjFacturation']);
|
unset ($_SESSION['serObjFacturation']);
|
||||||
|
|
||||||
|
|
||||||
switch ( $_GET['action'] )
|
switch (GETPOST('action','alpha'))
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
if ( $_POST['hdnSource'] != 'NULL' )
|
if ( $_POST['hdnSource'] != 'NULL' )
|
||||||
{
|
{
|
||||||
$sql = "SELECT p.rowid, p.ref, p.price, p.tva_tx, p.recuperableonly";
|
$sql = "SELECT p.rowid, p.ref, p.price, p.tva_tx, p.default_vat_code, p.recuperableonly";
|
||||||
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= ", ps.reel";
|
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= ", ps.reel";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||||
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = ".$conf_fkentrepot;
|
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = ".$conf_fkentrepot;
|
||||||
@ -54,7 +54,6 @@ switch ( $_GET['action'] )
|
|||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
// ... et enregistrement dans l'objet
|
// ... et enregistrement dans l'objet
|
||||||
@ -71,58 +70,86 @@ switch ( $_GET['action'] )
|
|||||||
$productid = $ret['rowid'];
|
$productid = $ret['rowid'];
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
$product->fetch($productid);
|
$product->fetch($productid);
|
||||||
|
$prod = $product;
|
||||||
|
|
||||||
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
|
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
|
||||||
$societe = new Societe($db);
|
$societe = new Societe($db);
|
||||||
$societe->fetch($thirdpartyid);
|
$societe->fetch($thirdpartyid);
|
||||||
|
|
||||||
$tva_tx = get_default_tva($mysoc,$societe,$productid);
|
// Update if prices fields are defined
|
||||||
$tva_npr = get_default_npr($mysoc,$societe,$productid);
|
$tva_tx = get_default_tva($mysoc, $societe, $product->id);
|
||||||
|
$tva_npr = get_default_npr($mysoc, $societe, $product->id);
|
||||||
if (empty($tva_tx)) $tva_npr=0;
|
if (empty($tva_tx)) $tva_npr=0;
|
||||||
dol_syslog('tva_tx='.$tva_tx.'-tva_npr='.$tva_npr);
|
|
||||||
|
|
||||||
|
$pu_ht = $prod->price;
|
||||||
|
$pu_ttc = $prod->price_ttc;
|
||||||
|
$price_min = $prod->price_min;
|
||||||
|
$price_base_type = $prod->price_base_type;
|
||||||
|
|
||||||
|
// multiprix
|
||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($societe->price_level))
|
if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($societe->price_level))
|
||||||
{
|
{
|
||||||
if(isset($product->multiprices[$societe->price_level]))
|
$pu_ht = $prod->multiprices[$societe->price_level];
|
||||||
{
|
$pu_ttc = $prod->multiprices_ttc[$societe->price_level];
|
||||||
$ret['price'] = $product->multiprices[$societe->price_level];
|
$price_min = $prod->multiprices_min[$societe->price_level];
|
||||||
$ret['price_ttc'] = $product->multiprices_ttc[$societe->price_level];
|
$price_base_type = $prod->multiprices_base_type[$societe->price_level];
|
||||||
// $product->multiprices_min[$societe->price_level];
|
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||||
// $product->multiprices_min_ttc[$societe->price_level];
|
{
|
||||||
// $product->multiprices_base_type[$societe->price_level];
|
if (isset($prod->multiprices_tva_tx[$societe->price_level])) $tva_tx=$prod->multiprices_tva_tx[$societe->price_level];
|
||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
if (isset($prod->multiprices_recuperableonly[$societe->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$societe->price_level];
|
||||||
{
|
}
|
||||||
if (isset($prod->multiprices_tva_tx[$societe->price_level])) $tva_tx=$prod->multiprices_tva_tx[$societe->price_level];
|
}
|
||||||
if (isset($prod->multiprices_recuperableonly[$societe->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$societe->price_level];
|
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||||
if (empty($tva_tx)) $tva_npr=0;
|
{
|
||||||
}
|
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
|
||||||
}
|
|
||||||
|
$prodcustprice = new Productcustomerprice($db);
|
||||||
|
|
||||||
|
$filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $societe->id);
|
||||||
|
|
||||||
|
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
||||||
|
if ($result >= 0)
|
||||||
|
{
|
||||||
|
if (count($prodcustprice->lines) > 0)
|
||||||
|
{
|
||||||
|
$pu_ht = price($prodcustprice->lines [0]->price);
|
||||||
|
$pu_ttc = price($prodcustprice->lines [0]->price_ttc);
|
||||||
|
$price_base_type = $prodcustprice->lines [0]->price_base_type;
|
||||||
|
$tva_tx = $prodcustprice->lines [0]->tva_tx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret['tva_tx'] = $tva_tx;
|
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
|
||||||
$ret['tva_npr'] = $tva_npr;
|
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
|
||||||
//var_dump('tva_tx='.$ret['tva_tx'].'-tva_npr='.$ret['tva_npr'].'-'.$conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL);exit;
|
|
||||||
|
// if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ?
|
||||||
|
if (! empty($price_ht)) {
|
||||||
|
$pu_ht = price2num($price_ht, 'MU');
|
||||||
|
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||||
|
}
|
||||||
|
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||||
|
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||||
|
elseif ($tmpvat != $tmpprodvat) {
|
||||||
|
if ($price_base_type != 'HT') {
|
||||||
|
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
|
||||||
|
} else {
|
||||||
|
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$obj_facturation->id($ret['rowid']);
|
$obj_facturation->id($ret['rowid']);
|
||||||
$obj_facturation->ref($ret['ref']);
|
$obj_facturation->ref($ret['ref']);
|
||||||
$obj_facturation->stock($ret['reel']);
|
$obj_facturation->stock($ret['reel']);
|
||||||
$obj_facturation->prix($ret['price']);
|
$obj_facturation->prix($ret['price']);
|
||||||
|
|
||||||
// Use $ret['tva_tx'] / ret['tva_npr'] to find vat id
|
|
||||||
$vatrowid = null;
|
|
||||||
$sqlfindvatid = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'c_tva';
|
|
||||||
$sqlfindvatid.= ' WHERE taux = '.$ret['tva_tx'].' AND recuperableonly = '.(int) $ret['tva_npr'];
|
|
||||||
$sqlfindvatid.= ' AND fk_pays = '.$mysoc->country_id;
|
|
||||||
$resqlfindvatid=$db->query($sqlfindvatid);
|
|
||||||
if ($resqlfindvatid)
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($resqlfindvatid);
|
|
||||||
if ($obj) $vatrowid = $obj->rowid;
|
|
||||||
}
|
|
||||||
else dol_print_error($db);
|
|
||||||
|
|
||||||
dol_syslog("save vatrowid=".$vatrowid);
|
$vatrate = $tva_tx;
|
||||||
$obj_facturation->tva($vatrowid); // Save vat it for next use
|
$obj_facturation->vatrate = $vatrate; // Save vat rate (full text vat with code)
|
||||||
|
|
||||||
// Definition du filtre pour n'afficher que le produit concerne
|
// Definition du filtre pour n'afficher que le produit concerne
|
||||||
if ( $_POST['hdnSource'] == 'LISTE' )
|
if ( $_POST['hdnSource'] == 'LISTE' )
|
||||||
@ -168,7 +195,7 @@ switch ( $_GET['action'] )
|
|||||||
{
|
{
|
||||||
dol_syslog("facturation_verif save vat ".$_POST['selTva']);
|
dol_syslog("facturation_verif save vat ".$_POST['selTva']);
|
||||||
$obj_facturation->qte($_POST['txtQte']);
|
$obj_facturation->qte($_POST['txtQte']);
|
||||||
$obj_facturation->tva($_POST['selTva']); // Save VAT selected so we can use it for next product
|
$obj_facturation->tva($_POST['selTva']); // id of vat. Saved so we can use it for next product
|
||||||
$obj_facturation->remisePercent($_POST['txtRemise']);
|
$obj_facturation->remisePercent($_POST['txtRemise']);
|
||||||
$obj_facturation->ajoutArticle(); // This add an entry into $_SESSION['poscart']
|
$obj_facturation->ajoutArticle(); // This add an entry into $_SESSION['poscart']
|
||||||
// We update prixTotalTtc
|
// We update prixTotalTtc
|
||||||
|
|||||||
@ -125,12 +125,12 @@ $langs->load("cashdesk");
|
|||||||
<td><input class="texte1_off maxwidth50onsmartphone" type="text" name="txtTotal" value="" disabled /></td><td></td>
|
<td><input class="texte1_off maxwidth50onsmartphone" type="text" name="txtTotal" value="" disabled /></td><td></td>
|
||||||
<!-- Choix du taux de TVA -->
|
<!-- Choix du taux de TVA -->
|
||||||
<td class="select_tva">
|
<td class="select_tva">
|
||||||
<?php //var_dump($tab_tva);
|
<?php
|
||||||
$tva_tx = $obj_facturation->tva(); // Try to get a previously entered VAT rowid. First time, this will return empty.
|
$vatrate = $obj_facturation->vatrate; // To get vat rate we just have selected
|
||||||
|
|
||||||
$buyer = new Societe($db);
|
$buyer = new Societe($db);
|
||||||
if ($_SESSION["CASHDESK_ID_THIRDPARTY"] > 0) $buyer->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]);
|
if ($_SESSION["CASHDESK_ID_THIRDPARTY"] > 0) $buyer->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]);
|
||||||
|
echo $form->load_tva('selTva', (isset($_POST["selTva"])?GETPOST("selTva",'alpha',2):$vatrate), $mysoc, $buyer, 0, 0, '', false, -1);
|
||||||
echo $form->load_tva('selTva', (isset($_POST["selTva"])?GETPOST("selTva",'alpha',2):-1), $mysoc, $buyer, 0, 0, '', false, -1);
|
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -165,6 +165,7 @@ switch ($action)
|
|||||||
$tmp = getTaxesFromId($tab_liste[$i]['fk_tva']);
|
$tmp = getTaxesFromId($tab_liste[$i]['fk_tva']);
|
||||||
$vat_rate = $tmp['rate'];
|
$vat_rate = $tmp['rate'];
|
||||||
$vat_npr = $tmp['npr'];
|
$vat_npr = $tmp['npr'];
|
||||||
|
$vat_src_code = $tmp['code'];
|
||||||
|
|
||||||
$invoiceline=new FactureLigne($db);
|
$invoiceline=new FactureLigne($db);
|
||||||
$invoiceline->fk_product=$tab_liste[$i]['fk_article'];
|
$invoiceline->fk_product=$tab_liste[$i]['fk_article'];
|
||||||
@ -176,12 +177,14 @@ switch ($action)
|
|||||||
|
|
||||||
$invoiceline->tva_tx=empty($vat_rate)?0:$vat_rate; // works even if vat_rate is ''
|
$invoiceline->tva_tx=empty($vat_rate)?0:$vat_rate; // works even if vat_rate is ''
|
||||||
$invoiceline->info_bits=empty($vat_npr)?0:$vat_npr;
|
$invoiceline->info_bits=empty($vat_npr)?0:$vat_npr;
|
||||||
|
$invoiceline->vat_src_code=$vat_src_code;
|
||||||
|
|
||||||
$invoiceline->total_ht=$tab_liste[$i]['total_ht'];
|
$invoiceline->total_ht=$tab_liste[$i]['total_ht'];
|
||||||
$invoiceline->total_ttc=$tab_liste[$i]['total_ttc'];
|
$invoiceline->total_ttc=$tab_liste[$i]['total_ttc'];
|
||||||
$invoiceline->total_tva=$tab_liste[$i]['total_vat'];
|
$invoiceline->total_tva=$tab_liste[$i]['total_vat'];
|
||||||
$invoiceline->total_localtax1=$tab_liste[$i]['total_localtax1'];
|
$invoiceline->total_localtax1=$tab_liste[$i]['total_localtax1'];
|
||||||
$invoiceline->total_localtax2=$tab_liste[$i]['total_localtax2'];
|
$invoiceline->total_localtax2=$tab_liste[$i]['total_localtax2'];
|
||||||
|
|
||||||
$invoice->lines[]=$invoiceline;
|
$invoice->lines[]=$invoiceline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -248,6 +248,7 @@ class Categories extends DolibarrApi
|
|||||||
if( ! count($obj_ret)) {
|
if( ! count($obj_ret)) {
|
||||||
throw new RestException(404, 'No category found');
|
throw new RestException(404, 'No category found');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $obj_ret;
|
return $obj_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,8 +352,46 @@ class Categories extends DolibarrApi
|
|||||||
|
|
||||||
$object = parent::_cleanObjectDatas($object);
|
$object = parent::_cleanObjectDatas($object);
|
||||||
|
|
||||||
// Remove the subscriptions because they are handled as a subresource.
|
// Remove fields not relevent to categories
|
||||||
//unset($object->subscriptions);
|
unset($object->country);
|
||||||
|
unset($object->country_id);
|
||||||
|
unset($object->country_code);
|
||||||
|
unset($object->total_ht);
|
||||||
|
unset($object->total_ht);
|
||||||
|
unset($object->total_localtax1);
|
||||||
|
unset($object->total_localtax2);
|
||||||
|
unset($object->total_ttc);
|
||||||
|
unset($object->total_tva);
|
||||||
|
unset($object->lines);
|
||||||
|
unset($object->fk_incoterms);
|
||||||
|
unset($object->libelle_incoterms);
|
||||||
|
unset($object->location_incoterms);
|
||||||
|
unset($object->civility_id);
|
||||||
|
unset($object->name);
|
||||||
|
unset($object->lastname);
|
||||||
|
unset($object->firstname);
|
||||||
|
unset($object->shipping_method_id);
|
||||||
|
unset($object->fk_delivery_address);
|
||||||
|
unset($object->cond_reglement);
|
||||||
|
unset($object->cond_reglement_id);
|
||||||
|
unset($object->mode_reglement_id);
|
||||||
|
unset($object->barcode_type_coder);
|
||||||
|
unset($object->barcode_type_label);
|
||||||
|
unset($object->barcode_type_code);
|
||||||
|
unset($object->barcode_type);
|
||||||
|
unset($object->canvas);
|
||||||
|
unset($object->cats);
|
||||||
|
unset($object->motherof);
|
||||||
|
unset($object->context);
|
||||||
|
unset($object->socid);
|
||||||
|
unset($object->thirdparty);
|
||||||
|
unset($object->contact);
|
||||||
|
unset($object->contact_id);
|
||||||
|
unset($object->user);
|
||||||
|
unset($object->fk_account);
|
||||||
|
unset($object->fk_project);
|
||||||
|
unset($object->note);
|
||||||
|
unset($object->statut);
|
||||||
|
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -291,7 +291,7 @@ class CategoryApi extends DolibarrApi
|
|||||||
* @url GET /customer/{cusid}/categories
|
* @url GET /customer/{cusid}/categories
|
||||||
*/
|
*/
|
||||||
function getListCustomerCategories($cusid, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
|
function getListCustomerCategories($cusid, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
|
||||||
return $this->getListForItem('customer', $sortfield, $sortorder, $limit, $page, $cusid);
|
return $this->getListForItem($sortfield, $sortorder, $limit, $page, 'customer', $cusid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1163,11 +1163,11 @@ class Categorie extends CommonObject
|
|||||||
*/
|
*/
|
||||||
if($obj[0] > 0 && $obj[0] != $this->id)
|
if($obj[0] > 0 && $obj[0] != $this->id)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::already_exists category with name=".$this->label." exist rowid=".$obj[0]." current_id=".$this->id, LOG_DEBUG);
|
dol_syslog(get_class($this)."::already_exists category with name=".$this->label." and parent ".$this->fk_parent." exists: rowid=".$obj[0]." current_id=".$this->id, LOG_DEBUG);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dol_syslog(get_class($this)."::already_exists no category with same name=".$this->label." rowid=".$obj[0]." current_id=".$this->id, LOG_DEBUG);
|
dol_syslog(get_class($this)."::already_exists no category with same name=".$this->label." and same parent ".$this->fk_parent.": rowid=".$obj[0]." current_id=".$this->id, LOG_DEBUG);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1532,14 +1532,14 @@ class Categorie extends CommonObject
|
|||||||
{
|
{
|
||||||
while (($file = readdir($handle)) !== false)
|
while (($file = readdir($handle)) !== false)
|
||||||
{
|
{
|
||||||
if (dol_is_file($dir.$file) && preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$dir.$file))
|
if (dol_is_file($dir.$file) && preg_match('/(\.jpeg|\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$dir.$file))
|
||||||
{
|
{
|
||||||
$nbphoto++;
|
$nbphoto++;
|
||||||
$photo = $file;
|
$photo = $file;
|
||||||
|
|
||||||
// On determine nom du fichier vignette
|
// On determine nom du fichier vignette
|
||||||
$photo_vignette='';
|
$photo_vignette='';
|
||||||
if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$photo,$regs))
|
if (preg_match('/(\.jpeg|\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$photo,$regs))
|
||||||
{
|
{
|
||||||
$photo_vignette=preg_replace('/'.$regs[0].'/i','',$photo).'_small'.$regs[0];
|
$photo_vignette=preg_replace('/'.$regs[0].'/i','',$photo).'_small'.$regs[0];
|
||||||
}
|
}
|
||||||
@ -1582,7 +1582,7 @@ class Categorie extends CommonObject
|
|||||||
dol_delete_file($file,1);
|
dol_delete_file($file,1);
|
||||||
|
|
||||||
// Si elle existe, on efface la vignette
|
// Si elle existe, on efface la vignette
|
||||||
if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$filename,$regs))
|
if (preg_match('/(\.jpeg|\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$filename,$regs))
|
||||||
{
|
{
|
||||||
$photo_vignette=preg_replace('/'.$regs[0].'/i','',$filename).'_small'.$regs[0];
|
$photo_vignette=preg_replace('/'.$regs[0].'/i','',$filename).'_small'.$regs[0];
|
||||||
if (file_exists($dirthumb.$photo_vignette))
|
if (file_exists($dirthumb.$photo_vignette))
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -572,6 +572,11 @@ if ($action == 'mupdate')
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Actions to delete doc
|
||||||
|
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||||
|
$permissioncreate = ($user->rights->agenda->allactions->delete || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->delete));
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -1196,7 +1201,7 @@ if ($id > 0)
|
|||||||
$out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
$out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
||||||
$out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
$out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
||||||
$out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
$out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
||||||
$linkback.=$out;
|
$linkback.=$out;
|
||||||
@ -1208,20 +1213,12 @@ if ($id > 0)
|
|||||||
// Affichage fiche action en mode visu
|
// Affichage fiche action en mode visu
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
|
||||||
/*print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
|
||||||
print $form->showrefnav($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '');
|
|
||||||
print '</td></tr>';*/
|
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||||
{
|
{
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td colspan="3">'.$object->type.'</td></tr>';
|
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td colspan="3">'.$object->type.'</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Title
|
|
||||||
//print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.dol_htmlentities($object->label).'</td></tr>';
|
|
||||||
|
|
||||||
// Full day event
|
// Full day event
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($object->fulldayevent, 3).'</td></tr>';
|
print '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($object->fulldayevent, 3).'</td></tr>';
|
||||||
|
|
||||||
@ -1243,11 +1240,6 @@ if ($id > 0)
|
|||||||
if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late"));
|
if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late"));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Status
|
|
||||||
/*print '<tr><td class="nowrap">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="3">';
|
|
||||||
print $object->getLibStatut(4);
|
|
||||||
print '</td></tr>';*/
|
|
||||||
|
|
||||||
// Location
|
// Location
|
||||||
if (empty($conf->global->AGENDA_DISABLE_LOCATION))
|
if (empty($conf->global->AGENDA_DISABLE_LOCATION))
|
||||||
{
|
{
|
||||||
@ -1281,7 +1273,7 @@ if ($id > 0)
|
|||||||
print '<div class="assignedtouser">';
|
print '<div class="assignedtouser">';
|
||||||
print $form->select_dolusers_forevent('view', 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
print $form->select_dolusers_forevent('view', 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||||
print '</div>';
|
print '</div>';
|
||||||
if (in_array($user->id,array_keys($listofuserid)))
|
if ($object->datep != $object->datef && in_array($user->id,array_keys($listofuserid)))
|
||||||
{
|
{
|
||||||
print '<div class="myavailability">';
|
print '<div class="myavailability">';
|
||||||
print $langs->trans("MyAvailability").': '.(($object->userassigned[$user->id]['transparency'] > 0)?$langs->trans("Busy"):$langs->trans("Available")); // We show nothing if event is assigned to nobody
|
print $langs->trans("MyAvailability").': '.(($object->userassigned[$user->id]['transparency'] > 0)?$langs->trans("Busy"):$langs->trans("Available")); // We show nothing if event is assigned to nobody
|
||||||
@ -1462,7 +1454,7 @@ if ($id > 0)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$filedir=$conf->agenda->multidir_output[$conf->entity].'/'.$object->id;
|
$filedir=$conf->agenda->multidir_output[$conf->entity].'/'.$object->id;
|
||||||
$urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id;
|
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||||
|
|
||||||
$genallowed=$user->rights->agenda->myactions->create;
|
$genallowed=$user->rights->agenda->myactions->create;
|
||||||
$delallowed=$user->rights->agenda->myactions->delete;
|
$delallowed=$user->rights->agenda->myactions->delete;
|
||||||
|
|||||||
@ -289,7 +289,7 @@ class AgendaEvents extends DolibarrApi
|
|||||||
function _validate($data)
|
function _validate($data)
|
||||||
{
|
{
|
||||||
$event = array();
|
$event = array();
|
||||||
foreach (Events::$FIELDS as $field) {
|
foreach (AgendaEvents::$FIELDS as $field) {
|
||||||
if (!isset($data[$field]))
|
if (!isset($data[$field]))
|
||||||
throw new RestException(400, "$field field missing");
|
throw new RestException(400, "$field field missing");
|
||||||
$event[$field] = $data[$field];
|
$event[$field] = $data[$field];
|
||||||
|
|||||||
@ -957,7 +957,14 @@ if (count($listofextcals))
|
|||||||
// Complete $eventarray with events coming from external module
|
// Complete $eventarray with events coming from external module
|
||||||
$parameters=array(); $object=null;
|
$parameters=array(); $object=null;
|
||||||
$reshook=$hookmanager->executeHooks('getCalendarEvents',$parameters,$object,$action);
|
$reshook=$hookmanager->executeHooks('getCalendarEvents',$parameters,$object,$action);
|
||||||
if (! empty($hookmanager->resArray['eventarray'])) $eventarray=array_merge($eventarray, $hookmanager->resArray['eventarray']);
|
if (! empty($hookmanager->resArray['eventarray'])) {
|
||||||
|
foreach ($hookmanager->resArray['eventarray'] as $keyDate => $events) {
|
||||||
|
if (!isset($eventarray[$keyDate])) {
|
||||||
|
$eventarray[$keyDate]=array();
|
||||||
|
}
|
||||||
|
$eventarray[$keyDate]=array_merge($eventarray[$keyDate], $events);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1030,11 +1030,14 @@ if ($id > 0)
|
|||||||
|
|
||||||
if (! empty($conf->commande->enabled))
|
if (! empty($conf->commande->enabled))
|
||||||
{
|
{
|
||||||
if (! empty($orders2invoice) && $orders2invoice > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$object->id.'">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
if ($object->client != 0 && $object->client != 2)
|
||||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
{
|
||||||
|
if (! empty($orders2invoice) && $orders2invoice > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$object->id.'">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||||
|
else print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||||
|
}
|
||||||
|
else print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||||
}
|
}
|
||||||
|
if ($object->client != 0 && $object->client != 2) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a></div>';
|
||||||
if ($object->client != 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a></div>';
|
|
||||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
else print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -158,10 +158,10 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="3">'.$langs->trans("ProposalsDraft").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';
|
print '<td colspan="3">'.$langs->trans("ProposalsDraft").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';
|
||||||
|
|
||||||
|
$var=true;
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$var=true;
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
@ -239,10 +239,10 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="3">'.$langs->trans("SupplierProposalsDraft").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';
|
print '<td colspan="3">'.$langs->trans("SupplierProposalsDraft").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';
|
||||||
|
|
||||||
|
$var=true;
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$var=true;
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
@ -318,10 +318,10 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="3">'.$langs->trans("DraftOrders").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';
|
print '<td colspan="3">'.$langs->trans("DraftOrders").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';
|
||||||
|
|
||||||
if ($num)
|
$var = true;
|
||||||
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$var = true;
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
@ -399,10 +399,10 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="3">'.$langs->trans("DraftSuppliersOrders").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';
|
print '<td colspan="3">'.$langs->trans("DraftSuppliersOrders").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';
|
||||||
|
|
||||||
if ($num)
|
$var = true;
|
||||||
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$var = true;
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|||||||
@ -41,8 +41,8 @@ $pagenext = $page + 1;
|
|||||||
if (! $sortorder) $sortorder="DESC";
|
if (! $sortorder) $sortorder="DESC";
|
||||||
if (! $sortfield) $sortfield="m.date_creat";
|
if (! $sortfield) $sortfield="m.date_creat";
|
||||||
|
|
||||||
$sall=GETPOST("sall","alpha");
|
$sall=GETPOST('sall', 'alphanohtml');
|
||||||
$sref=GETPOST("sref","alpha");
|
$sref=GETPOST("sref", "alpha");
|
||||||
$filteremail=GETPOST('filteremail','alpha');
|
$filteremail=GETPOST('filteremail','alpha');
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||||
|
|||||||
@ -492,7 +492,10 @@ if (empty($reshook))
|
|||||||
$array_options = $lines[$i]->array_options;
|
$array_options = $lines[$i]->array_options;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit);
|
$tva_tx = $lines[$i]->tva_tx;
|
||||||
|
if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
|
||||||
|
|
||||||
|
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit);
|
||||||
|
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
$lineid = $result;
|
$lineid = $result;
|
||||||
@ -731,9 +734,11 @@ if (empty($reshook))
|
|||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
|
// $tva_tx can be 'x.x (XXX)'
|
||||||
|
|
||||||
// Ecrase $pu par celui du produit
|
// Ecrase $pu par celui du produit
|
||||||
// Ecrase $desc par celui du produit
|
// Ecrase $desc par celui du produit
|
||||||
// Ecrase $txtva par celui du produit
|
// Ecrase $tva_tx par celui du produit
|
||||||
// Replaces $fk_unit with the product unit
|
// Replaces $fk_unit with the product unit
|
||||||
if (! empty($idprod)) {
|
if (! empty($idprod)) {
|
||||||
$prod = new Product($db);
|
$prod = new Product($db);
|
||||||
@ -741,111 +746,114 @@ if (empty($reshook))
|
|||||||
|
|
||||||
$label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : '');
|
$label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : '');
|
||||||
|
|
||||||
// If prices fields are update
|
// Update if prices fields are defined
|
||||||
$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
|
$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
|
||||||
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
|
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
|
||||||
if (empty($tva_tx)) $tva_npr=0;
|
if (empty($tva_tx)) $tva_npr=0;
|
||||||
|
|
||||||
$pu_ht = $prod->price;
|
$pu_ht = $prod->price;
|
||||||
$pu_ttc = $prod->price_ttc;
|
$pu_ttc = $prod->price_ttc;
|
||||||
$price_min = $prod->price_min;
|
$price_min = $prod->price_min;
|
||||||
$price_base_type = $prod->price_base_type;
|
$price_base_type = $prod->price_base_type;
|
||||||
|
|
||||||
// On defini prix unitaire
|
// On defini prix unitaire
|
||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->thirdparty->price_level)
|
if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->thirdparty->price_level)
|
||||||
|
{
|
||||||
|
$pu_ht = $prod->multiprices[$object->thirdparty->price_level];
|
||||||
|
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
|
||||||
|
$price_min = $prod->multiprices_min[$object->thirdparty->price_level];
|
||||||
|
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
|
||||||
|
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||||
{
|
{
|
||||||
$pu_ht = $prod->multiprices[$object->thirdparty->price_level];
|
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
||||||
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
|
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||||
$price_min = $prod->multiprices_min[$object->thirdparty->price_level];
|
}
|
||||||
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
|
}
|
||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||||
{
|
{
|
||||||
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
|
||||||
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
|
||||||
|
$prodcustprice = new Productcustomerprice($db);
|
||||||
|
|
||||||
|
$filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $object->thirdparty->id);
|
||||||
|
|
||||||
|
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
||||||
|
if ($result) {
|
||||||
|
// If there is some prices specific to the customer
|
||||||
|
if (count($prodcustprice->lines) > 0) {
|
||||||
|
$pu_ht = price($prodcustprice->lines[0]->price);
|
||||||
|
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
|
||||||
|
$price_base_type = $prodcustprice->lines[0]->price_base_type;
|
||||||
|
$tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx . ' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
}
|
||||||
{
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
|
|
||||||
|
|
||||||
$prodcustprice = new Productcustomerprice($db);
|
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
|
||||||
|
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
|
||||||
|
|
||||||
$filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $object->thirdparty->id);
|
// if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ?
|
||||||
|
if (! empty($price_ht)) {
|
||||||
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
$pu_ht = price2num($price_ht, 'MU');
|
||||||
if ($result) {
|
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||||
if (count($prodcustprice->lines) > 0) {
|
}
|
||||||
$pu_ht = price($prodcustprice->lines [0]->price);
|
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||||
$pu_ttc = price($prodcustprice->lines [0]->price_ttc);
|
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||||
$price_base_type = $prodcustprice->lines [0]->price_base_type;
|
elseif ($tmpvat != $tmpprodvat) {
|
||||||
$tva_tx = $prodcustprice->lines [0]->tva_tx;
|
if ($price_base_type != 'HT') {
|
||||||
}
|
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if price ht is forced (ie: calculated by margin rate and cost price)
|
|
||||||
if (! empty($price_ht)) {
|
|
||||||
$pu_ht = price2num($price_ht, 'MU');
|
|
||||||
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU');
|
|
||||||
}
|
|
||||||
|
|
||||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
|
||||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
|
||||||
elseif ($tva_tx != $prod->tva_tx) {
|
|
||||||
if ($price_base_type != 'HT') {
|
|
||||||
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU');
|
|
||||||
} else {
|
|
||||||
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$desc = '';
|
|
||||||
|
|
||||||
// Define output language
|
|
||||||
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
|
|
||||||
$outputlangs = $langs;
|
|
||||||
$newlang = '';
|
|
||||||
if (empty($newlang) && GETPOST('lang_id'))
|
|
||||||
$newlang = GETPOST('lang_id');
|
|
||||||
if (empty($newlang))
|
|
||||||
$newlang = $object->thirdparty->default_lang;
|
|
||||||
if (! empty($newlang)) {
|
|
||||||
$outputlangs = new Translate("", $conf);
|
|
||||||
$outputlangs->setDefaultLang($newlang);
|
|
||||||
}
|
|
||||||
|
|
||||||
$desc = (! empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description;
|
|
||||||
} else {
|
} else {
|
||||||
$desc = $prod->description;
|
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$desc = '';
|
||||||
|
|
||||||
|
// Define output language
|
||||||
|
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
|
||||||
|
$outputlangs = $langs;
|
||||||
|
$newlang = '';
|
||||||
|
if (empty($newlang) && GETPOST('lang_id'))
|
||||||
|
$newlang = GETPOST('lang_id');
|
||||||
|
if (empty($newlang))
|
||||||
|
$newlang = $object->thirdparty->default_lang;
|
||||||
|
if (! empty($newlang)) {
|
||||||
|
$outputlangs = new Translate("", $conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
|
|
||||||
$desc = dol_concatdesc($desc, $product_desc);
|
$desc = (! empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description;
|
||||||
|
} else {
|
||||||
|
$desc = $prod->description;
|
||||||
|
}
|
||||||
|
|
||||||
// Add dimensions into product description
|
$desc = dol_concatdesc($desc, $product_desc);
|
||||||
/*if (empty($conf->global->MAIN_PRODUCT_DISABLE_AUTOADD_DIM))
|
|
||||||
{
|
|
||||||
$text='';
|
|
||||||
if ($prod->weight) $text.=($text?"\n":"").$outputlangs->trans("Weight").': '.$prod->weight.' '.$prod->weight_units;
|
|
||||||
if ($prod->length) $text.=($text?"\n":"").$outputlangs->trans("Length").': '.$prod->length.' '.$prod->length_units;
|
|
||||||
if ($prod->surface) $text.=($text?"\n":"").$outputlangs->trans("Surface").': '.$prod->surface.' '.$prod->surface_units;
|
|
||||||
if ($prod->volume) $text.=($text?"\n":"").$outputlangs->trans("Volume").': '.$prod->volume.' '.$prod->volume_units;
|
|
||||||
|
|
||||||
$desc = dol_concatdesc($desc, $text);
|
// Add dimensions into product description
|
||||||
}*/
|
/*if (empty($conf->global->MAIN_PRODUCT_DISABLE_AUTOADD_DIM))
|
||||||
|
{
|
||||||
|
$text='';
|
||||||
|
if ($prod->weight) $text.=($text?"\n":"").$outputlangs->trans("Weight").': '.$prod->weight.' '.$prod->weight_units;
|
||||||
|
if ($prod->length) $text.=($text?"\n":"").$outputlangs->trans("Length").': '.$prod->length.' '.$prod->length_units;
|
||||||
|
if ($prod->surface) $text.=($text?"\n":"").$outputlangs->trans("Surface").': '.$prod->surface.' '.$prod->surface_units;
|
||||||
|
if ($prod->volume) $text.=($text?"\n":"").$outputlangs->trans("Volume").': '.$prod->volume.' '.$prod->volume_units;
|
||||||
|
|
||||||
// Add custom code and origin country into description
|
$desc = dol_concatdesc($desc, $text);
|
||||||
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code)))
|
}*/
|
||||||
{
|
|
||||||
$tmptxt = '(';
|
// Add custom code and origin country into description
|
||||||
if (! empty($prod->customcode))
|
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code)))
|
||||||
$tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
|
{
|
||||||
if (! empty($prod->customcode) && ! empty($prod->country_code))
|
$tmptxt = '(';
|
||||||
$tmptxt .= ' - ';
|
if (! empty($prod->customcode))
|
||||||
if (! empty($prod->country_code))
|
$tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
|
||||||
$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
|
if (! empty($prod->customcode) && ! empty($prod->country_code))
|
||||||
$tmptxt .= ')';
|
$tmptxt .= ' - ';
|
||||||
$desc = dol_concatdesc($desc, $tmptxt);
|
if (! empty($prod->country_code))
|
||||||
}
|
$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
|
||||||
|
$tmptxt .= ')';
|
||||||
|
$desc = dol_concatdesc($desc, $tmptxt);
|
||||||
|
}
|
||||||
|
|
||||||
$type = $prod->type;
|
$type = $prod->type;
|
||||||
$fk_unit = $prod->fk_unit;
|
$fk_unit = $prod->fk_unit;
|
||||||
@ -1297,8 +1305,18 @@ if ($action == 'create')
|
|||||||
// Replicate extrafields
|
// Replicate extrafields
|
||||||
$objectsrc->fetch_optionals($originid);
|
$objectsrc->fetch_optionals($originid);
|
||||||
$object->array_options = $objectsrc->array_options;
|
$object->array_options = $objectsrc->array_options;
|
||||||
|
|
||||||
|
if (!empty($conf->multicurrency->enabled))
|
||||||
|
{
|
||||||
|
if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
|
||||||
|
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
|
||||||
|
}
|
||||||
|
|
||||||
$object = new Propal($db);
|
$object = new Propal($db);
|
||||||
|
|
||||||
@ -1476,7 +1494,6 @@ if ($action == 'create')
|
|||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
|
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
|
||||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||||
$currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency));
|
|
||||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0);
|
print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
@ -2014,7 +2031,7 @@ if ($action == 'create')
|
|||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print fieldLabel('CurrencyRate','multicurrency_tx');
|
print fieldLabel('CurrencyRate','multicurrency_tx');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon))
|
if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency)
|
||||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
@ -2025,7 +2042,7 @@ if ($action == 'create')
|
|||||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
|
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
|
||||||
} else {
|
} else {
|
||||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
|
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
|
||||||
if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code != $conf->currency) {
|
if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
|
||||||
print '<div class="inline-block"> ';
|
print '<div class="inline-block"> ';
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user