Merge branch '10.0' into 10.0_Differentiated_export

This commit is contained in:
Laurent Destailleur 2019-06-12 13:27:49 +02:00 committed by GitHub
commit f41606ba15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
316 changed files with 15001 additions and 27560 deletions

View File

@ -13,7 +13,6 @@ Component Version License GPL Compatible
------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------
PHP libraries: PHP libraries:
AdoDb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package) AdoDb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
ChromePHP 4.1.0 Apache Software License 2.0 Yes Return server log to chrome browser console
CKEditor 4.11.4 LGPL-2.1+ Yes Editor WYSIWYG CKEditor 4.11.4 LGPL-2.1+ Yes Editor WYSIWYG
PHPDebugBar 1.15.0 MIT License Yes Used only by the module "debugbar" for developers PHPDebugBar 1.15.0 MIT License Yes Used only by the module "debugbar" for developers
EvalMath 1.0 BSD Yes Safe math expressions evaluation EvalMath 1.0 BSD Yes Safe math expressions evaluation
@ -30,12 +29,13 @@ php-iban 1.4.7 LGPL-3+ Yes
PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
PSR/Logs 1.0 Library for logs (used by DebugBar) PSR/Logs 1.0 Library for logs (used by DebugBar)
PSR/simple-cache Library for cache (used by PHPSpreadSheet) PSR/simple-cache ? Library for cache (used by PHPSpreadSheet)
Restler 3.0.0RC6 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer) Restler 3.0.0RC6 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer)
Sabre 3.2.2 BSD Yes DAV support
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP
Stripe 6.35 MIT licence Yes Library for Stripe module
TCPDF 6.2.25 LGPL-3+ Yes PDF generation TCPDF 6.2.25 LGPL-3+ Yes PDF generation
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP
Stripe 6.34.5 MIT licence Yes Library for Stripe module
JS libraries: JS libraries:
jQuery 3.3.1 MIT License Yes JS library jQuery 3.3.1 MIT License Yes JS library

View File

@ -113,20 +113,22 @@ NEW: Widget birthdays of the month.
NEW: Option in workflow module to set a reception billed on validate supplier bill. NEW: Option in workflow module to set a reception billed on validate supplier bill.
NEW: Autocompletion on lists should be available on mobile applications. NEW: Autocompletion on lists should be available on mobile applications.
NEW: Add mass action to close several members. NEW: Add mass action to close several members.
NEW: Add hidden option ADD_UNSPLASH_LOGIN_BACKGROUND for random background
For Developers: For Developers:
NEW: Module "DebugBar" is available as a stable module. NEW: Module "DebugBar" is available as a stable module.
NEW: Add API REST for donations NEW: Add API REST for donations
NEW: Add a script 'purge-data.php' to purge data older than a defined creation date NEW: Add a script 'purge-data.php' to purge data older than a defined creation date
NEW: Add constant XFRAMEOPTIONS_ALLOWALL NEW: Add constant XFRAMEOPTIONS_ALLOWALL
NEW: Add function isValidVATID() NEW: Add function isValidVATID() to heck syntax of a VAT ID/number.
NEW: ADD document's product support in APIs NEW: Add document's product support in APIs
NEW: REST API: get the list of objects in a category. NEW: Add REST API: get the list of objects in a category.
NEW: Update Stripe library to 6.35 NEW: Update Stripe library to 6.35
NEW: Upgrade jquery lib to 3.3.1 NEW: Upgrade jquery lib to 3.3.1
NEW: Add hook 'addHtmlHeader()' NEW: Add hook 'addHtmlHeader()'
NEW: Add hook 'createRecurringInvoices()' NEW: Add hook 'createRecurringInvoices()'
NEW: Add hook 'afterSelectContactOptions' NEW: Add hook 'afterSelectContactOptions'
NEW: Add hook 'getAccessForbiddenMessage'
NEW: Add hook support in accountancy index NEW: Add hook support in accountancy index
NEW: Add hook support in list of template invoices NEW: Add hook support in list of template invoices
NEW: Add parameter 'replaceambiguouschars' on getRandomPassword function NEW: Add parameter 'replaceambiguouschars' on getRandomPassword function
@ -135,22 +137,21 @@ NEW: Add the current modulepart into the Conf class object
NEW: Add trigger FICHINTER_UNVALIDATE NEW: Add trigger FICHINTER_UNVALIDATE
NEW: Add visibility with value 4 in framework to define fields to show NEW: Add visibility with value 4 in framework to define fields to show
NEW: More option to tune initialization of a new module with modulebuilder. NEW: More option to tune initialization of a new module with modulebuilder.
NEW: API to list currencies NEW: Add REST API to list currencies
NEW: API Proposal, Orders, Invoices: Add contact details NEW: REST API Proposal, Orders, Invoices: Add contact details
NEW: hidden option to change concat desc order NEW: hidden option to change concat order of description/product label.
NEW: Enhance management of webhooks NEW: Enhance management of webhooks
NEW: Generation of doc by modulebuilder can include README and CHANGELOG NEW: Generation of doc by modulebuilder can include README and CHANGELOG
NEW: massfilesarea feature for external modules NEW: massfilesarea feature is possible for external modules
NEW: Show enabled modules in dol_print_error() NEW: Show list of enabled modules in dol_print_error().
NEW: Simplification of CSS styles of default themes. NEW: Simplification of CSS styles of default themes.
NEW: Clean code of a lot of deprecated code. NEW: Clean code of a lot of deprecated code.
NEW: Add hidden option to set a search entry to the top NEW: Add hidden option to set a search entry to the top
NEW: add hidden option DISPLAY_DISCOUNTED_SUPPLIER_PRICE NEW: add hidden option DISPLAY_DISCOUNTED_SUPPLIER_PRICE
NEW: add hidden option MAIN_DEFAULT_LANGUAGE_FILTER NEW: add hidden option MAIN_DEFAULT_LANGUAGE_FILTER
NEW: add hidden option NO_CONCAT_DESCRIPTION NEW: add hidden option NO_CONCAT_DESCRIPTION
NEW: Add hidden option for ACCOUNTANCY_COMBO_FOR_AUX NEW: Add hidden option ACCOUNTANCY_COMBO_FOR_AUX
NEW: Add hidden option 'ADD_UNSPLASH_LOGIN_BACKGROUND' NEW: Add Hidden option OVERRIDE_VAT_FOR_EXPENSE_REPORT
NEW: Add Hidden option 'OVERRIDE_VAT_FOR_EXPENSE_REPORT'
NEW: add hidden option MAIN_DOC_UPLOAD_NOT_RENAME_BY_DEFAULT NEW: add hidden option MAIN_DOC_UPLOAD_NOT_RENAME_BY_DEFAULT
NEW: Hidden conf to improve pdf desc item visibitity NEW: Hidden conf to improve pdf desc item visibitity
NEW: Look and feel v10 - Add CSS 'tabBarNoTop' NEW: Look and feel v10 - Add CSS 'tabBarNoTop'
@ -176,6 +177,9 @@ Following changes may create regressions for some external modules, but were nec
* Deprecated property ->fk_departement is now ->state_id everywhere. * Deprecated property ->fk_departement is now ->state_id everywhere.
* Removed the method 4 of GETPOST (to get $_COOKIE). It was not used and not recommanded to use in Dolibarr. * Removed the method 4 of GETPOST (to get $_COOKIE). It was not used and not recommanded to use in Dolibarr.
* Column llx_facture.facnumber change to llx_facture.ref * Column llx_facture.facnumber change to llx_facture.ref
* Variable $dolibarr_main_cookie_cryptkey is no more created at install (it was not used by Dolibarr). A new variable
called $dolibarr_main_instance_unique_id is now generated at each installation. It will be used by some future features.
***** ChangeLog for 9.0.3 compared to 9.0.2 ***** ***** ChangeLog for 9.0.3 compared to 9.0.2 *****

View File

@ -1002,7 +1002,7 @@ if ($nboftargetok) {
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/mymoduleindex.php`; $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/mymoduleindex.php`;
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/myobject_card.php`; $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/myobject_card.php`;
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/myobject_list.php`; $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/myobject_list.php`;
$ret=`chmod -R 755 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/scripts/myobject.php`; $ret=`chmod -R 755 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/scripts/mymodule.php`;
$cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.php' -type f -exec chmod 755 {} \\; "; $cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.php' -type f -exec chmod 755 {} \\; ";
$ret=`$cmd`; $ret=`$cmd`;
$cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.sh' -type f -exec chmod 755 {} \\; "; $cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.sh' -type f -exec chmod 755 {} \\; ";

View File

@ -165,6 +165,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/barcode %_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/blockedlog %_datadir/dolibarr/htdocs/blockedlog
%_datadir/dolibarr/htdocs/bookmarks %_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/bom
%_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/cashdesk
%_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/categories
%_datadir/dolibarr/htdocs/collab %_datadir/dolibarr/htdocs/collab
@ -179,6 +180,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/custom %_datadir/dolibarr/htdocs/custom
%_datadir/dolibarr/htdocs/datapolicy %_datadir/dolibarr/htdocs/datapolicy
%_datadir/dolibarr/htdocs/dav %_datadir/dolibarr/htdocs/dav
%_datadir/dolibarr/htdocs/debugbar
%_datadir/dolibarr/htdocs/don %_datadir/dolibarr/htdocs/don
%_datadir/dolibarr/htdocs/ecm %_datadir/dolibarr/htdocs/ecm
%_datadir/dolibarr/htdocs/emailcollector %_datadir/dolibarr/htdocs/emailcollector
@ -200,6 +202,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/mailmanspip
%_datadir/dolibarr/htdocs/margin %_datadir/dolibarr/htdocs/margin
%_datadir/dolibarr/htdocs/modulebuilder %_datadir/dolibarr/htdocs/modulebuilder
%_datadir/dolibarr/htdocs/mrp
%_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/multicurrency
%_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/opensurvey
%_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paybox
@ -208,6 +211,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/product %_datadir/dolibarr/htdocs/product
%_datadir/dolibarr/htdocs/projet %_datadir/dolibarr/htdocs/projet
%_datadir/dolibarr/htdocs/public %_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/reception
%_datadir/dolibarr/htdocs/resource %_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/societe %_datadir/dolibarr/htdocs/societe
%_datadir/dolibarr/htdocs/stripe %_datadir/dolibarr/htdocs/stripe

View File

@ -245,6 +245,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/barcode %_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/blockedlog %_datadir/dolibarr/htdocs/blockedlog
%_datadir/dolibarr/htdocs/bookmarks %_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/bom
%_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/cashdesk
%_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/categories
%_datadir/dolibarr/htdocs/collab %_datadir/dolibarr/htdocs/collab
@ -259,6 +260,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/custom %_datadir/dolibarr/htdocs/custom
%_datadir/dolibarr/htdocs/datapolicy %_datadir/dolibarr/htdocs/datapolicy
%_datadir/dolibarr/htdocs/dav %_datadir/dolibarr/htdocs/dav
%_datadir/dolibarr/htdocs/debugbar
%_datadir/dolibarr/htdocs/don %_datadir/dolibarr/htdocs/don
%_datadir/dolibarr/htdocs/ecm %_datadir/dolibarr/htdocs/ecm
%_datadir/dolibarr/htdocs/emailcollector %_datadir/dolibarr/htdocs/emailcollector
@ -280,6 +282,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/mailmanspip
%_datadir/dolibarr/htdocs/margin %_datadir/dolibarr/htdocs/margin
%_datadir/dolibarr/htdocs/modulebuilder %_datadir/dolibarr/htdocs/modulebuilder
%_datadir/dolibarr/htdocs/mrp
%_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/multicurrency
%_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/opensurvey
%_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paybox
@ -288,6 +291,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/product %_datadir/dolibarr/htdocs/product
%_datadir/dolibarr/htdocs/projet %_datadir/dolibarr/htdocs/projet
%_datadir/dolibarr/htdocs/public %_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/reception
%_datadir/dolibarr/htdocs/resource %_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/societe %_datadir/dolibarr/htdocs/societe
%_datadir/dolibarr/htdocs/stripe %_datadir/dolibarr/htdocs/stripe

View File

@ -162,6 +162,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/barcode %_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/blockedlog %_datadir/dolibarr/htdocs/blockedlog
%_datadir/dolibarr/htdocs/bookmarks %_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/bom
%_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/cashdesk
%_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/categories
%_datadir/dolibarr/htdocs/collab %_datadir/dolibarr/htdocs/collab
@ -176,6 +177,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/custom %_datadir/dolibarr/htdocs/custom
%_datadir/dolibarr/htdocs/datapolicy %_datadir/dolibarr/htdocs/datapolicy
%_datadir/dolibarr/htdocs/dav %_datadir/dolibarr/htdocs/dav
%_datadir/dolibarr/htdocs/debugbar
%_datadir/dolibarr/htdocs/don %_datadir/dolibarr/htdocs/don
%_datadir/dolibarr/htdocs/ecm %_datadir/dolibarr/htdocs/ecm
%_datadir/dolibarr/htdocs/emailcollector %_datadir/dolibarr/htdocs/emailcollector
@ -197,6 +199,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/mailmanspip
%_datadir/dolibarr/htdocs/margin %_datadir/dolibarr/htdocs/margin
%_datadir/dolibarr/htdocs/modulebuilder %_datadir/dolibarr/htdocs/modulebuilder
%_datadir/dolibarr/htdocs/mrp
%_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/multicurrency
%_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/opensurvey
%_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paybox
@ -205,6 +208,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/product %_datadir/dolibarr/htdocs/product
%_datadir/dolibarr/htdocs/projet %_datadir/dolibarr/htdocs/projet
%_datadir/dolibarr/htdocs/public %_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/reception
%_datadir/dolibarr/htdocs/resource %_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/societe %_datadir/dolibarr/htdocs/societe
%_datadir/dolibarr/htdocs/stripe %_datadir/dolibarr/htdocs/stripe

View File

@ -173,6 +173,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/barcode %_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/blockedlog %_datadir/dolibarr/htdocs/blockedlog
%_datadir/dolibarr/htdocs/bookmarks %_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/bom
%_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/cashdesk
%_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/categories
%_datadir/dolibarr/htdocs/collab %_datadir/dolibarr/htdocs/collab
@ -187,6 +188,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/custom %_datadir/dolibarr/htdocs/custom
%_datadir/dolibarr/htdocs/datapolicy %_datadir/dolibarr/htdocs/datapolicy
%_datadir/dolibarr/htdocs/dav %_datadir/dolibarr/htdocs/dav
%_datadir/dolibarr/htdocs/debugbar
%_datadir/dolibarr/htdocs/don %_datadir/dolibarr/htdocs/don
%_datadir/dolibarr/htdocs/ecm %_datadir/dolibarr/htdocs/ecm
%_datadir/dolibarr/htdocs/emailcollector %_datadir/dolibarr/htdocs/emailcollector
@ -208,6 +210,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/mailmanspip
%_datadir/dolibarr/htdocs/margin %_datadir/dolibarr/htdocs/margin
%_datadir/dolibarr/htdocs/modulebuilder %_datadir/dolibarr/htdocs/modulebuilder
%_datadir/dolibarr/htdocs/mrp
%_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/multicurrency
%_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/opensurvey
%_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paybox
@ -216,6 +219,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/product %_datadir/dolibarr/htdocs/product
%_datadir/dolibarr/htdocs/projet %_datadir/dolibarr/htdocs/projet
%_datadir/dolibarr/htdocs/public %_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/reception
%_datadir/dolibarr/htdocs/resource %_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/societe %_datadir/dolibarr/htdocs/societe
%_datadir/dolibarr/htdocs/stripe %_datadir/dolibarr/htdocs/stripe

File diff suppressed because one or more lines are too long

View File

@ -176,10 +176,61 @@ export list="
--ignore-table=$base.llx_advanced_extrafields --ignore-table=$base.llx_advanced_extrafields
--ignore-table=$base.llx_advanced_extrafields_options --ignore-table=$base.llx_advanced_extrafields_options
--ignore-table=$base.llx_advanced_extrafields_values --ignore-table=$base.llx_advanced_extrafields_values
--ignore-table=$base.llx_agefodd_calendrier
--ignore-table=$base.llx_agefodd_certif_state
--ignore-table=$base.llx_agefodd_certificate_type
--ignore-table=$base.llx_agefodd_contact
--ignore-table=$base.llx_agefodd_convention
--ignore-table=$base.llx_agefodd_convention_stagiaire
--ignore-table=$base.llx_agefodd_cursus
--ignore-table=$base.llx_agefodd_cursus_extrafields
--ignore-table=$base.llx_agefodd_formateur
--ignore-table=$base.llx_agefodd_formateur_category
--ignore-table=$base.llx_agefodd_formateur_category_dict
--ignore-table=$base.llx_agefodd_formateur_training
--ignore-table=$base.llx_agefodd_formateur_type
--ignore-table=$base.llx_agefodd_formation_catalogue
--ignore-table=$base.llx_agefodd_formation_catalogue_extrafields
--ignore-table=$base.llx_agefodd_formation_catalogue_modules
--ignore-table=$base.llx_agefodd_formation_catalogue_type
--ignore-table=$base.llx_agefodd_formation_catalogue_type_bpf
--ignore-table=$base.llx_agefodd_formation_cursus
--ignore-table=$base.llx_agefodd_formation_objectifs_peda
--ignore-table=$base.llx_agefodd_opca
--ignore-table=$base.llx_agefodd_place
--ignore-table=$base.llx_agefodd_reg_interieur
--ignore-table=$base.llx_agefodd_session
--ignore-table=$base.llx_agefodd_session_adminsitu
--ignore-table=$base.llx_agefodd_session_admlevel
--ignore-table=$base.llx_agefodd_session_calendrier
--ignore-table=$base.llx_agefodd_session_commercial
--ignore-table=$base.llx_agefodd_session_contact
--ignore-table=$base.llx_agefodd_session_element
--ignore-table=$base.llx_agefodd_session_extrafields
--ignore-table=$base.llx_agefodd_session_formateur
--ignore-table=$base.llx_agefodd_session_formateur_calendrier
--ignore-table=$base.llx_agefodd_session_stagiaire
--ignore-table=$base.llx_agefodd_session_stagiaire_heures
--ignore-table=$base.llx_agefodd_session_status_type
--ignore-table=$base.llx_agefodd_stagiaire
--ignore-table=$base.llx_agefodd_stagiaire_certif
--ignore-table=$base.llx_agefodd_stagiaire_cursus
--ignore-table=$base.llx_agefodd_stagiaire_extrafields
--ignore-table=$base.llx_agefodd_stagiaire_type
--ignore-table=$base.llx_agefodd_training_admlevel
--ignore-table=$base.llx_askpricesupplier --ignore-table=$base.llx_askpricesupplier
--ignore-table=$base.llx_askpricesupplier_extrafields --ignore-table=$base.llx_askpricesupplier_extrafields
--ignore-table=$base.llx_askpricesupplierdet --ignore-table=$base.llx_askpricesupplierdet
--ignore-table=$base.llx_askpricesupplierdet_extrafields --ignore-table=$base.llx_askpricesupplierdet_extrafields
--ignore-table=$base.llx_assetOf
--ignore-table=$base.llx_assetOf_line
--ignore-table=$base.llx_asset_workstation_of
--ignore-table=$base.llx_asset_workstation_product
--ignore-table=$base.llx_asset_workstation_task
--ignore-table=$base.llx_assetof_amounts
--ignore-table=$base.llx_asset_workstation_of
--ignore-table=$base.llx_asset_workstation_of
--ignore-table=$base.llx_asset_workstation_of
--ignore-table=$base.llx_bookkeeping --ignore-table=$base.llx_bookkeeping
--ignore-table=$base.llx_bootstrap --ignore-table=$base.llx_bootstrap
--ignore-table=$base.llx_bt_namemap --ignore-table=$base.llx_bt_namemap
@ -226,15 +277,28 @@ export list="
--ignore-table=$base.llx_ecommerce_site --ignore-table=$base.llx_ecommerce_site
--ignore-table=$base.llx_ecommerce_societe --ignore-table=$base.llx_ecommerce_societe
--ignore-table=$base.llx_ecommerce_socpeople --ignore-table=$base.llx_ecommerce_socpeople
--ignore-table=$base.llx_element_rang --ignore-table=$base.llx_element_rang
--ignore-table=$base.llx_element_tag
--ignore-table=$base.llx_eleves
--ignore-table=$base.llx_eleves_extrafields
--ignore-table=$base.llx_entity --ignore-table=$base.llx_entity
--ignore-table=$base.llx_entity_extrafields
--ignore-table=$base.llx_entity_thirdparty
--ignore-table=$base.llx_equipement_factory
--ignore-table=$base.llx_factory
--ignore-table=$base.llx_factory_extrafields
--ignore-table=$base.llx_factorydet
--ignore-table=$base.llx_filemanager_roots --ignore-table=$base.llx_filemanager_roots
--ignore-table=$base.llx_fournisseur_ca --ignore-table=$base.llx_fournisseur_ca
--ignore-table=$base.llx_google_maps --ignore-table=$base.llx_google_maps
--ignore-table=$base.llx_lead
--ignore-table=$base.llx_lead_extrafields
--ignore-table=$base.llx_milestone
--ignore-table=$base.llx_milestone --ignore-table=$base.llx_milestone
--ignore-table=$base.llx_monitoring_probes --ignore-table=$base.llx_monitoring_probes
--ignore-table=$base.llx_m --ignore-table=$base.llx_m
--ignore-table=$base.llx_m_extrafields --ignore-table=$base.llx_m_extrafields
--ignore-table=$base.llx_monmodule_abcdef
--ignore-table=$base.llx_notes --ignore-table=$base.llx_notes
--ignore-table=$base.llx_pos_cash --ignore-table=$base.llx_pos_cash
--ignore-table=$base.llx_pos_control_cash --ignore-table=$base.llx_pos_control_cash
@ -256,6 +320,9 @@ export list="
--ignore-table=$base.llx_ultimatepdf --ignore-table=$base.llx_ultimatepdf
--ignore-table=$base.llx_update_modules --ignore-table=$base.llx_update_modules
--ignore-table=$base.llx_ventilation_achat --ignore-table=$base.llx_ventilation_achat
--ignore-table=$base.tmp_llx_accouting_account
--ignore-table=$base.tmp_llx_product_batch
--ignore-table=$base.tmp_llx_product_batch2
" "
echo "mysqldump -P$port -u$admin -p***** $list $base > $mydir/$dumpfile" echo "mysqldump -P$port -u$admin -p***** $list $base > $mydir/$dumpfile"
mysqldump -P$port -u$admin $passwd $list $base > $mydir/$dumpfile mysqldump -P$port -u$admin $passwd $list $base > $mydir/$dumpfile

View File

@ -75,10 +75,13 @@
<!-- Warning if action on same line than if --> <!-- Warning if action on same line than if -->
<!-- <!--
<rule ref="Generic.ControlStructures.InlineControlStructure"> <rule ref="Generic.ControlStructures.InlineControlStructure">
<properties> <property name="error" value="false"/> </properties> <properties>
<property name="error" value="false"/>
</properties>
</rule> </rule>
--> -->
<!-- PHP code MUST use only UTF-8 without BOM. --> <!-- PHP code MUST use only UTF-8 without BOM. -->
<rule ref="Generic.Files.ByteOrderMark"/> <rule ref="Generic.Files.ByteOrderMark"/>
@ -97,8 +100,11 @@
</properties> </properties>
</rule> </rule>
<!-- To disallow several statements on same line --> <!-- Disallow several statements on same line -->
<!-- <rule ref="Generic.Formatting.DisallowMultipleStatements" /> --> <!-- We want to allow 'if () { ...small code... }' on same line for better code compacity and readability -->
<rule ref="Generic.Formatting.DisallowMultipleStatements">
<severity>0</severity>
</rule>
<!-- Have 2 chars padding maximum and always show as errors --> <!-- Have 2 chars padding maximum and always show as errors -->
<!-- <!--
@ -112,13 +118,17 @@
<rule ref="Generic.Functions.CallTimePassByReference" /> <rule ref="Generic.Functions.CallTimePassByReference" />
<rule ref="Generic.Functions.FunctionCallArgumentSpacing" /> <rule ref="Generic.Functions.FunctionCallArgumentSpacing" />
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceBeforeEquals"> <rule ref="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceBeforeEquals">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceBeforeEquals"> <rule ref="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceBeforeEquals">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma"> <!-- We don't want this rule, we want to be able to align params on several similare functions on different lines -->
<!-- Disallow several spaces after comma -->
<!-- We want to allow this because we want to be able to align params on several similare functions on different lines -->
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
@ -152,7 +162,10 @@
<rule ref="Generic.PHP.ForbiddenFunctions" /> <rule ref="Generic.PHP.ForbiddenFunctions" />
<!-- Warning when using @ before functions --> <!-- Warning when using @ before functions -->
<!-- <rule ref="Generic.PHP.NoSilencedErrors" /> --> <!-- We want this. Some features need this -->
<rule ref="Generic.PHP.NoSilencedErrors">
<severity>0</severity>
</rule>
<!-- Say if null, true, false must be uppercase (Rule 2.5 of PSR2 https://www.php-fig.org/psr/psr-2/) --> <!-- Say if null, true, false must be uppercase (Rule 2.5 of PSR2 https://www.php-fig.org/psr/psr-2/) -->
<rule ref="Generic.PHP.LowerCaseConstant" /> <rule ref="Generic.PHP.LowerCaseConstant" />
@ -169,7 +182,16 @@
<!-- Check indent are done with spaces and with correct number --> <!-- Check indent are done with spaces and with correct number -->
<!-- Disabled as this does not support tab --> <!-- Disabled as this does not support tab -->
<!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> --> <!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> -->
<!-- TODO Enable this
<arg name="tab-width" value="4"/>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4"/>
<property name="tabIndent" value="true"/>
</properties>
</rule>
-->
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace.Indent" /> <rule ref="Squiz.WhiteSpace.ScopeClosingBrace.Indent" />
<!-- There MUST NOT be trailing whitespace at the end of non-blank lines. --> <!-- There MUST NOT be trailing whitespace at the end of non-blank lines. -->
@ -310,22 +332,29 @@
<rule ref="PEAR.Commenting.InlineComment" /> <rule ref="PEAR.Commenting.InlineComment" />
<!-- <rule ref="PEAR.ControlStructures.ControlSignature" /> --> <!-- Check position of { after a control structure like if (), while (), etc... -->
<!--
<rule ref="PEAR.ControlStructures.ControlSignature" />
-->
<!-- <rule ref="PEAR.ControlStructures.MultiLineCondition" /> --> <!-- <rule ref="PEAR.ControlStructures.MultiLineCondition" /> -->
<!-- Test if () are removed for includes --> <!-- Test if () are removed for includes -->
<rule ref="PEAR.Files.IncludingFile" /> <rule ref="PEAR.Files.IncludingFile" />
<!-- Disable some error messages that we do not want. --> <!-- Disable some error messages that we do not want. -->
<rule ref="PEAR.Files.IncludingFile.UseInclude"> <rule ref="PEAR.Files.IncludingFile.UseInclude">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<!-- TODO Enable this test. We should use require for include in prior of include when out of if -->
<rule ref="PEAR.Files.IncludingFile.UseIncludeOnce"> <rule ref="PEAR.Files.IncludingFile.UseIncludeOnce">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<rule ref="PEAR.Files.IncludingFile.UseRequire"> <rule ref="PEAR.Files.IncludingFile.UseRequire">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<!-- TODO Enable this test. We should use require for include in prior of include when out of if -->
<rule ref="PEAR.Files.IncludingFile.UseRequireOnce"> <rule ref="PEAR.Files.IncludingFile.UseRequireOnce">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
@ -334,12 +363,15 @@
<rule ref="PEAR.Functions.FunctionCallSignature" /> <rule ref="PEAR.Functions.FunctionCallSignature" />
<!-- TODO Enable this test. -->
<rule ref="PEAR.Functions.FunctionCallSignature.CloseBracketLine"> <rule ref="PEAR.Functions.FunctionCallSignature.CloseBracketLine">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<!-- TODO Enable this test. -->
<rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket"> <rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<rule ref="PEAR.Functions.FunctionCallSignature.EmptyLine"> <rule ref="PEAR.Functions.FunctionCallSignature.EmptyLine">
<severity>0</severity> <severity>0</severity>
</rule> </rule>

View File

@ -506,17 +506,17 @@ else $buttonLabel = $langs->trans("ExportList");
// Button re-export // Button re-export
if (! empty($conf->global->ACCOUNTING_REEXPORT)) { if (! empty($conf->global->ACCOUNTING_REEXPORT)) {
print $newcardbutton ='<a href="'.$_SERVER['PHP_SELF'].'?action=setreexport&value=0'.($param?'&'.$param:'').'">'.img_picto($langs->trans("Activated"), 'switch_on').'</a> '; $newcardbutton ='<a href="'.$_SERVER['PHP_SELF'].'?action=setreexport&value=0'.($param?'&'.$param:'').'">'.img_picto($langs->trans("Activated"), 'switch_on').'</a> ';
} else { } else {
print $newcardbutton ='<a href="'.$_SERVER['PHP_SELF'].'?action=setreexport&value=1'.($param?'&'.$param:'').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> '; $newcardbutton ='<a href="'.$_SERVER['PHP_SELF'].'?action=setreexport&value=1'.($param?'&'.$param:'').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> ';
} }
$newcardbutton.= $langs->trans("IncludeDocsAlreadyExported"); $newcardbutton.= $langs->trans("IncludeDocsAlreadyExported");
$newcardbutton.= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')', 'fa fa-file-export', $_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:'')); $newcardbutton.= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:''));
$newcardbutton.= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-object-group', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param); $newcardbutton.= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param);
$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle', './card.php?action=create'); $newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create');
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit); print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit);

View File

@ -256,8 +256,8 @@ if ($action == 'delbookkeepingyear') {
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">'; print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
$newcardbutton.= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param); $newcardbutton.= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle', './card.php?action=create'); $newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create');
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);

View File

@ -9,7 +9,7 @@
* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com> * Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com>
* Copyright (C) 2017-2019 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2017-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2017 André Schild <a.schild@aarboard.ch>
* *
* 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
@ -51,6 +51,7 @@ class AccountancyExport
public static $EXPORT_TYPE_AGIRIS = 9; public static $EXPORT_TYPE_AGIRIS = 9;
public static $EXPORT_TYPE_FEC = 11; public static $EXPORT_TYPE_FEC = 11;
public static $EXPORT_TYPE_OPENCONCERTO = 12; public static $EXPORT_TYPE_OPENCONCERTO = 12;
public static $EXPORT_TYPE_SAGE50_SWISS = 13;
/** /**
@ -106,6 +107,7 @@ class AccountancyExport
self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'), self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'),
self::$EXPORT_TYPE_OPENCONCERTO => $langs->trans('Modelcsv_openconcerto'), self::$EXPORT_TYPE_OPENCONCERTO => $langs->trans('Modelcsv_openconcerto'),
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'), self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
self::$EXPORT_TYPE_SAGE50_SWISS => $langs->trans('Modelcsv_Sage50_Swiss'),
); );
} }
@ -130,6 +132,7 @@ class AccountancyExport
self::$EXPORT_TYPE_AGIRIS => 'agiris', self::$EXPORT_TYPE_AGIRIS => 'agiris',
self::$EXPORT_TYPE_OPENCONCERTO => 'openconcerto', self::$EXPORT_TYPE_OPENCONCERTO => 'openconcerto',
self::$EXPORT_TYPE_FEC => 'fec', self::$EXPORT_TYPE_FEC => 'fec',
self::$EXPORT_TYPE_SAGE50_SWISS => 'sage50ch',
); );
return $formatcode[$type]; return $formatcode[$type];
@ -194,6 +197,10 @@ class AccountancyExport
'label' => $langs->trans('Modelcsv_openconcerto'), 'label' => $langs->trans('Modelcsv_openconcerto'),
'ACCOUNTING_EXPORT_FORMAT' => 'csv', 'ACCOUNTING_EXPORT_FORMAT' => 'csv',
), ),
self::$EXPORT_TYPE_SAGE50_SWISS => array(
'label' => $langs->trans('Modelcsv_Sage50_Swiss'),
'ACCOUNTING_EXPORT_FORMAT' => 'csv',
),
), ),
'cr'=> array ( 'cr'=> array (
'1' => $langs->trans("Unix"), '1' => $langs->trans("Unix"),
@ -261,6 +268,9 @@ class AccountancyExport
case self::$EXPORT_TYPE_FEC : case self::$EXPORT_TYPE_FEC :
$this->exportFEC($TData); $this->exportFEC($TData);
break; break;
case self::$EXPORT_TYPE_SAGE50_SWISS :
$this->exportSAGE50SWISS($TData);
break;
default: default:
$this->errors[] = $langs->trans('accountancy_error_modelnotfound'); $this->errors[] = $langs->trans('accountancy_error_modelnotfound');
break; break;
@ -575,19 +585,19 @@ class AccountancyExport
$date = dol_print_date($line->doc_date, '%d%m%Y'); $date = dol_print_date($line->doc_date, '%d%m%Y');
print $line->piece_num . $separator; print $line->piece_num . $separator;
print $line->label_operation . $separator; print self::toAnsi($line->label_operation) . $separator;
print $date . $separator; print $date . $separator;
print $line->label_operation . $separator; print self::toAnsi($line->label_operation) . $separator;
if (empty($line->subledger_account)) { if (empty($line->subledger_account)) {
print length_accountg($line->numero_compte) . $separator; print length_accountg($line->numero_compte) . $separator;
print $line->label_compte . $separator; print self::toAnsi($line->label_compte) . $separator;
} else { } else {
print length_accounta($line->subledger_account) . $separator; print length_accounta($line->subledger_account) . $separator;
print $line->subledger_label . $separator; print self::toAnsi($line->subledger_label) . $separator;
} }
print $line->doc_ref . $separator; print self::toAnsi($line->doc_ref) . $separator;
print price($line->debit) . $separator; print price($line->debit) . $separator;
print price($line->credit) . $separator; print price($line->credit) . $separator;
print price($line->montant) . $separator; print price($line->montant) . $separator;
@ -757,6 +767,156 @@ class AccountancyExport
} }
} }
/**
* Export format : SAGE50SWISS
*
* https://onlinehelp.sageschweiz.ch/default.aspx?tabid=19984
* http://media.topal.ch/Public/Schnittstellen/TAF/Specification/Sage50-TAF-format.pdf
*
* @param array $objectLines data
*
* @return void
*/
public function exportSAGE50SWISS($objectLines)
{
// SAGE50SWISS
$this->separator = ',';
$this->end_line = "\r\n";
// Print header line
print "Blg,Datum,Kto,S/H,Grp,GKto,SId,SIdx,KIdx,BTyp,MTyp,Code,Netto,Steuer,FW-Betrag,Tx1,Tx2,PkKey,OpId,Flag";
print $this->end_line;
$thisPieceNum= "";
$thisPieceAccountNr= "";
$aSize= count($objectLines);
foreach ($objectLines as $aIndex=>$line)
{
$sammelBuchung= false;
if ($aIndex-2 >= 0 && $objectLines[$aIndex-2]->piece_num == $line->piece_num)
{
$sammelBuchung= true;
}
elseif ($aIndex+2 < $aSize && $objectLines[$aIndex+2]->piece_num == $line->piece_num)
{
$sammelBuchung= true;
}
elseif ($aIndex+1 < $aSize
&& $objectLines[$aIndex+1]->piece_num == $line->piece_num
&& $aIndex-1 < $aSize
&& $objectLines[$aIndex-1]->piece_num == $line->piece_num
)
{
$sammelBuchung= true;
}
//Blg
print $line->piece_num . $this->separator;
// Datum
$date = dol_print_date($line->doc_date, '%d.%m.%Y');
print $date . $this->separator;
// Kto
print length_accountg($line->numero_compte) . $this->separator;
// S/H
if ($line->sens == 'D')
{
print 'S' . $this->separator;
}
else
{
print 'H' . $this->separator;
}
//Grp
print self::trunc($line->code_journal, 1) . $this->separator;
// GKto
if (empty($line->code_tiers))
{
if ($line->piece_num == $thisPieceNum)
{
print length_accounta($thisPieceAccountNr) . $this->separator;
}
else
{
print "div" . $this->separator;
}
}
else
{
print length_accounta($line->code_tiers) . $this->separator;
}
//SId
print $this->separator;
//SIdx
print "0" . $this->separator;
//KIdx
print "0" . $this->separator;
//BTyp
print "0" . $this->separator;
//MTyp 1=Fibu Einzelbuchung 2=Sammebuchung
if ($sammelBuchung)
{
print "2" . $this->separator;
}
else
{
print "1" . $this->separator;
}
// Code
print '""' . $this->separator;
// Netto
if ($line->montant >= 0)
{
print $line->montant . $this->separator;
}
else
{
print $line->montant*-1 . $this->separator;
}
// Steuer
print "0.00" . $this->separator;
// FW-Betrag
print "0.00" . $this->separator;
// Tx1
$line1= self::toAnsi($line->label_compte, 29);
if ($line1 == "LIQ" || $line1 == "LIQ Beleg ok" || strlen($line1) <= 3)
{
$line1= "";
}
$line2= self::toAnsi($line->doc_ref, 29);
if (strlen($line1) == 0)
{
$line1= $line2;
$line2= "";
}
if (strlen($line1) > 0 && strlen($line2) > 0 && (strlen($line1) + strlen($line2)) < 27)
{
$line1= $line1 . ' / ' . $line2;
$line2= "";
}
print '"' . self::toAnsi($line1). '"' . $this->separator;
// Tx2
print '"' . self::toAnsi($line2). '"' . $this->separator;
//PkKey
print "0" . $this->separator;
//OpId
print $this->separator;
// Flag
print "0";
print $this->end_line;
if ($line->piece_num !== $thisPieceNum)
{
$thisPieceNum= $line->piece_num;
$thisPieceAccountNr= $line->numero_compte;
}
}
}
/** /**
* *
* @param string $str data * @param string $str data
@ -767,4 +927,20 @@ class AccountancyExport
{ {
return dol_trunc($str, $size, 'right', 'UTF-8', 1); return dol_trunc($str, $size, 'right', 'UTF-8', 1);
} }
/**
*
* @param unknown $str Original string to encode and optionaly truncate
* @param integer $size truncate string after $size characters
* @return string String encoded in Windows-1251 charset
*/
public static function toAnsi($str, $size = -1)
{
$retVal= dol_string_nohtmltag($str, 1, 'Windows-1251');
if ($retVal >= 0 && $size >= 0)
{
$retVal= mb_substr($retVal, 0, $size, 'Windows-1251');
}
return $retVal;
}
} }

View File

@ -83,13 +83,13 @@ class AccountancySystem
if ($rowid > 0 || $ref) if ($rowid > 0 || $ref)
{ {
$sql = "SELECT a.pcg_version, a.label, a.active"; $sql = "SELECT a.rowid, a.pcg_version, a.label, a.active";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a";
$sql .= " WHERE"; $sql .= " WHERE";
if ($rowid) { if ($rowid) {
$sql .= " a.rowid = '" . $rowid . "'"; $sql .= " a.rowid = '" . $rowid . "'";
} elseif ($ref) { } elseif ($ref) {
$sql .= " a.pcg_version = '" . $ref . "'"; $sql .= " a.pcg_version = '" . $this->db->escape($ref) . "'";
} }
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);

View File

@ -151,12 +151,13 @@ class AccountingAccount extends CommonObject
/** /**
* Load record in memory * Load record in memory
* *
* @param int $rowid Id * @param int $rowid Id
* @param string $account_number Account number * @param string $account_number Account number
* @param int $limittocurrentchart 1=Do not load record if it is into another accounting system * @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active char of account
* @return int <0 if KO, 0 if not found, Id of record if OK and found * @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC'.
* @return int <0 if KO, 0 if not found, Id of record if OK and found
*/ */
public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0) public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0, $limittoachartaccount = '')
{ {
global $conf; global $conf;
@ -174,6 +175,9 @@ class AccountingAccount extends CommonObject
if (! empty($limittocurrentchart)) { if (! empty($limittocurrentchart)) {
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $this->db->escape($conf->global->CHARTOFACCOUNTS) . ')'; $sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $this->db->escape($conf->global->CHARTOFACCOUNTS) . ')';
} }
if (! empty($limittoachartaccount)) {
$sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'";
}
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);

View File

@ -202,9 +202,6 @@ class BookKeeping extends CommonObject
if (isset($this->sens)) { if (isset($this->sens)) {
$this->sens = trim($this->sens); $this->sens = trim($this->sens);
} }
if (isset($this->fk_user_author)) {
$this->fk_user_author = trim($this->fk_user_author);
}
if (isset($this->import_key)) { if (isset($this->import_key)) {
$this->import_key = trim($this->import_key); $this->import_key = trim($this->import_key);
} }
@ -522,9 +519,6 @@ class BookKeeping extends CommonObject
if (isset($this->sens)) { if (isset($this->sens)) {
$this->sens = trim($this->sens); $this->sens = trim($this->sens);
} }
if (isset($this->fk_user_author)) {
$this->fk_user_author = trim($this->fk_user_author);
}
if (isset($this->import_key)) { if (isset($this->import_key)) {
$this->import_key = trim($this->import_key); $this->import_key = trim($this->import_key);
} }
@ -1146,9 +1140,6 @@ class BookKeeping extends CommonObject
if (isset($this->sens)) { if (isset($this->sens)) {
$this->sens = trim($this->sens); $this->sens = trim($this->sens);
} }
if (isset($this->fk_user_author)) {
$this->fk_user_author = trim($this->fk_user_author);
}
if (isset($this->import_key)) { if (isset($this->import_key)) {
$this->import_key = trim($this->import_key); $this->import_key = trim($this->import_key);
} }

View File

@ -143,9 +143,9 @@ $textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy'); print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
print $langs->trans("DescVentilCustomer") . '<br>'; print '<span class="opacitymedium">'.$langs->trans("DescVentilCustomer") . '<br>';
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>'; print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
print '<br>'; print '</span><br>';
$y = $year_current; $y = $year_current;

View File

@ -294,7 +294,7 @@ if ($result) {
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
print $langs->trans("DescVentilDoneCustomer") . '<br>'; print '<span class="opacitymedium">'.$langs->trans("DescVentilDoneCustomer") . '</span><br>';
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>'; print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle'); print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle');

View File

@ -356,7 +356,7 @@ if ($result) {
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
print $langs->trans("DescVentilTodoCustomer") . '</br><br>'; print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer") . '</span></br><br>';
/*$topicmail="Information"; /*$topicmail="Information";
$modelmail="project"; $modelmail="project";

View File

@ -139,9 +139,9 @@ $textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
print load_fiche_titre($langs->trans("ExpenseReportsVentilation") . "&nbsp;" . $textprevyear . "&nbsp;" . $langs->trans("Year") . "&nbsp;" . $year_start . "&nbsp;" . $textnextyear, '', 'title_accountancy'); print load_fiche_titre($langs->trans("ExpenseReportsVentilation") . "&nbsp;" . $textprevyear . "&nbsp;" . $langs->trans("Year") . "&nbsp;" . $year_start . "&nbsp;" . $textnextyear, '', 'title_accountancy');
print $langs->trans("DescVentilExpenseReport") . '<br>'; print '<span class="opacitymedium">'.$langs->trans("DescVentilExpenseReport") . '<br>';
print $langs->trans("DescVentilExpenseReportMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>'; print $langs->trans("DescVentilExpenseReportMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
print '<br>'; print '</span><br>';
$y = $year_current; $y = $year_current;

View File

@ -248,7 +248,7 @@ if ($result) {
print_barre_liste($langs->trans("ExpenseReportLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); print_barre_liste($langs->trans("ExpenseReportLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
print $langs->trans("DescVentilDoneExpenseReport") . '<br>'; print '<span class="opacitymedium">'.$langs->trans("DescVentilDoneExpenseReport") . '</span><br>';
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>'; print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle'); print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle');

View File

@ -289,7 +289,7 @@ if ($result) {
print_barre_liste($langs->trans("ExpenseReportLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); print_barre_liste($langs->trans("ExpenseReportLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
print $langs->trans("DescVentilTodoExpenseReport") . '</br><br>'; print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoExpenseReport") . '</span></br><br>';
/*$topicmail="Information"; /*$topicmail="Information";
$modelmail="project"; $modelmail="project";

View File

@ -743,6 +743,7 @@ if (empty($action) || $action == 'view') {
// Button to write into Ledger // Button to write into Ledger
if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
print '<br>';
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
} }

View File

@ -680,6 +680,7 @@ if (empty($action) || $action == 'view') {
// Button to write into Ledger // Button to write into Ledger
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
print '<br>';
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
} }

View File

@ -140,9 +140,9 @@ $textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
print load_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . "&nbsp;" . $langs->trans("Year") . "&nbsp;" . $year_start . "&nbsp;" . $textnextyear, '', 'title_accountancy'); print load_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . "&nbsp;" . $langs->trans("Year") . "&nbsp;" . $year_start . "&nbsp;" . $textnextyear, '', 'title_accountancy');
print $langs->trans("DescVentilSupplier") . '<br>'; print '<span class="opacitymedium">'.$langs->trans("DescVentilSupplier") . '<br>';
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>'; print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
print '<br>'; print '</span><br>';
$y = $year_current; $y = $year_current;

View File

@ -297,7 +297,7 @@ if ($result) {
print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
print $langs->trans("DescVentilDoneSupplier") . '<br>'; print '<span class="opacitymedium">'.$langs->trans("DescVentilDoneSupplier") . '</span><br>';
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>'; print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle'); print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle');

View File

@ -355,7 +355,7 @@ if ($result) {
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
print $langs->trans("DescVentilTodoCustomer") . '</br><br>'; print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer") . '</span></br><br>';
/*$topicmail="Information"; /*$topicmail="Information";
$modelmail="project"; $modelmail="project";

View File

@ -273,7 +273,7 @@ if (empty($reshook))
{ {
if (empty($login)) { if (empty($login)) {
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Login")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")), null, 'errors');
} }
} }
// Create new object // Create new object
@ -509,7 +509,7 @@ if (empty($reshook))
{ {
if (empty($login)) { if (empty($login)) {
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Login")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")), null, 'errors');
} }
else { else {
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape($login)."'"; $sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape($login)."'";

View File

@ -596,7 +596,7 @@ class Adherent extends CommonObject
{ {
while ($obj=$this->db->fetch_object($resql2)) while ($obj=$this->db->fetch_object($resql2))
{ {
$this->type=$obj->label; $this->type=$obj->label;
} }
} }
} }

View File

@ -411,7 +411,7 @@ class AdherentType extends CommonObject
} }
} }
/** /**
* Return translated label by the nature of a adherent (physical or moral) * Return translated label by the nature of a adherent (physical or moral)
* *
* @param string $morphy Nature of the adherent (physical or moral) * @param string $morphy Nature of the adherent (physical or moral)

View File

@ -43,13 +43,13 @@ if (empty($sortorder)) { $sortorder="ASC"; }
if (empty($sortfield)) { $sortfield="d.login"; } if (empty($sortfield)) { $sortfield="d.login"; }
if (! isset($statut)) if (! isset($statut))
{ {
$statut = 1 ; $statut = 1 ;
} }
if (! isset($cotis)) if (! isset($cotis))
{ {
// by default, members must be up to date of subscription // by default, members must be up to date of subscription
$cotis=1; $cotis=1;
} }

View File

@ -130,6 +130,7 @@ $arrayfields=array(
'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/ 'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/
'd.datefin'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>500), 'd.datefin'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>500),
'd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'd.birth'=>array('label'=>$langs->trans("Birthday"), 'checked'=>0, 'position'=>500),
'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000) 'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000)
); );
@ -591,6 +592,12 @@ if (! empty($arrayfields['d.datec']['checked']))
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '</td>'; print '</td>';
} }
//Birthday
if (! empty($arrayfields['d.birth']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// Date modification // Date modification
if (! empty($arrayfields['d.tms']['checked'])) if (! empty($arrayfields['d.tms']['checked']))
{ {
@ -646,6 +653,7 @@ $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sort
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (! empty($arrayfields['d.datec']['checked'])) print_liste_field_titre($arrayfields['d.datec']['label'], $_SERVER["PHP_SELF"], "d.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); if (! empty($arrayfields['d.datec']['checked'])) print_liste_field_titre($arrayfields['d.datec']['label'], $_SERVER["PHP_SELF"], "d.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
if (! empty($arrayfields['d.birth']['checked'])) print_liste_field_titre($arrayfields['d.birth']['label'], $_SERVER["PHP_SELF"], "d.birth", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
if (! empty($arrayfields['d.tms']['checked'])) print_liste_field_titre($arrayfields['d.tms']['label'], $_SERVER["PHP_SELF"], "d.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); if (! empty($arrayfields['d.tms']['checked'])) print_liste_field_titre($arrayfields['d.tms']['label'], $_SERVER["PHP_SELF"], "d.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
if (! empty($arrayfields['d.statut']['checked'])) print_liste_field_titre($arrayfields['d.statut']['label'], $_SERVER["PHP_SELF"], "d.statut", "", $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['d.statut']['checked'])) print_liste_field_titre($arrayfields['d.statut']['label'], $_SERVER["PHP_SELF"], "d.statut", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
@ -865,6 +873,14 @@ while ($i < min($num, $limit))
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Birth
if (! empty($arrayfields['d.birth']['checked']))
{
print '<td class="nowrap center">';
print dol_print_date($db->jdate($obj->birth), 'day', 'tzuser');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date modification // Date modification
if (! empty($arrayfields['d.tms']['checked'])) if (! empty($arrayfields['d.tms']['checked']))
{ {

View File

@ -235,7 +235,7 @@ else
print '<br>'; print '<br>';
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbytown">'.$langs->trans("MembersStatisticsByTown").'</a><br>'; print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbytown">'.$langs->trans("MembersStatisticsByTown").'</a><br>';
print '<br>';//+ print '<br>';//+
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbyregion">'.$langs->trans("MembersStatisticsByRegion").'</a><br>';//+ print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbyregion">'.$langs->trans("MembersStatisticsByRegion").'</a><br>';//+
} }
print '<br>'; print '<br>';
} }

View File

@ -306,7 +306,7 @@ if (! empty($arrayfields['d.fk_type']['checked']))
{ {
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat" type="text" name="search_type" value="'.dol_escape_htmltag($search_type).'" size="7">'; print '<input class="flat" type="text" name="search_type" value="'.dol_escape_htmltag($search_type).'" size="7">';
print'</td>'; print'</td>';
} }
if (! empty($arrayfields['d.lastname']['checked'])) if (! empty($arrayfields['d.lastname']['checked']))
@ -417,7 +417,7 @@ if (! empty($arrayfields['d.bank']['checked']))
} }
if (! empty($arrayfields['c.dateadh']['checked'])) if (! empty($arrayfields['c.dateadh']['checked']))
{ {
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "c.dateadh", $param, "", 'align="center"', $sortfield, $sortorder); print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "c.dateadh", $param, "", 'align="center"', $sortfield, $sortorder);
} }
if (! empty($arrayfields['c.datef']['checked'])) if (! empty($arrayfields['c.datef']['checked']))
{ {

View File

@ -47,10 +47,10 @@ foreach($linkedObjectBlock as $key => $objectlink)
<td class="center"></td> <td class="center"></td>
<td class="center"><?php echo dol_print_date($objectlink->dateh, 'day'); ?></td> <td class="center"><?php echo dol_print_date($objectlink->dateh, 'day'); ?></td>
<td class="right"><?php <td class="right"><?php
if ($user->rights->adherent->lire) { if ($user->rights->adherent->lire) {
$total = $total + $objectlink->amount; $total = $total + $objectlink->amount;
echo price($objectlink->amount); echo price($objectlink->amount);
} ?></td> } ?></td>
<td class="right"></td> <td class="right"></td>
<td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td> <td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr> </tr>

View File

@ -281,9 +281,9 @@ if (! $rowid && $action != 'create' && $action != 'edit')
print '</td>'; print '</td>';
print '<td>'.dol_escape_htmltag($objp->label).'</td>'; print '<td>'.dol_escape_htmltag($objp->label).'</td>';
print '<td class="center">'; print '<td class="center">';
if ($objp->morphy == 'phy') { print $langs->trans("Physical"); } if ($objp->morphy == 'phy') { print $langs->trans("Physical"); }
elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); } elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); }
else print $langs->trans("Physical & Morale"); else print $langs->trans("Physical & Morale");
print '</td>'; print '</td>';
print '<td class="center">'.yn($objp->subscription).'</td>'; print '<td class="center">'.yn($objp->subscription).'</td>';
print '<td class="center">'.yn($objp->vote).'</td>'; print '<td class="center">'.yn($objp->vote).'</td>';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com>
@ -588,9 +588,8 @@ if ($action == 'edit' || $action == 'updateedit')
print '<td class="titlefield">'.$langs->trans("FiscalYearInformation").'</td><td>'.$langs->trans("Value").'</td>'; print '<td class="titlefield">'.$langs->trans("FiscalYearInformation").'</td><td>'.$langs->trans("Value").'</td>';
print "</tr>\n"; print "</tr>\n";
print '<tr class="oddeven"><td><label for="SOCIETE_FISCAL_MONTH_START">'.$langs->trans("FiscalMonthStart").'</label></td><td>'; print '<tr class="oddeven"><td><label for="SOCIETE_FISCAL_MONTH_START">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START, 'SOCIETE_FISCAL_MONTH_START', 0, 1) . '</td></tr>'; print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START, 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100') . '</td></tr>';
print "</table>"; print "</table>";
@ -987,7 +986,7 @@ else
print '</script>'; print '</script>';
print "\n"; print "\n";
$s.='<a href="#" onClick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>'; $s.='<a href="#" onClick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
$s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1);
} }
else else
{ {

View File

@ -268,8 +268,8 @@ print $langs->trans("DescWeather").'<br>';
if($action == 'edit') { if($action == 'edit') {
$str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->trans('MeteoPercentageMod')); $str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoPercentageMod'));
$str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->trans('MeteoStdMod')); $str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoStdMod'));
if(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std; if(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std;
else $str_mode_enabled = $str_mode_percentage; else $str_mode_enabled = $str_mode_percentage;
print '<a href="#" onclick="return false;" id="change_mode">'.$str_mode_enabled.'</a>'; print '<a href="#" onclick="return false;" id="change_mode">'.$str_mode_enabled.'</a>';

View File

@ -439,7 +439,7 @@ while ($i < min($num, $limit))
$object->id = $obj->rowid; $object->id = $obj->rowid;
foreach($object->fields as $key => $val) foreach($object->fields as $key => $val)
{ {
if (isset($obj->$key)) $object->$key = $obj->$key; if (property_exists($obj, $key)) $object->$key = $obj->$key;
} }
// Show here line of result // Show here line of result

View File

@ -406,7 +406,7 @@ while ($i < min($num, $limit))
$object->id = $obj->rowid; $object->id = $obj->rowid;
foreach($object->fields as $key => $val) foreach($object->fields as $key => $val)
{ {
if (isset($obj->$key)) $object->$key = $obj->$key; if (property_exists($obj, $key)) $object->$key = $obj->$key;
} }
// Show here line of result // Show here line of result

View File

@ -177,13 +177,13 @@ if ($action == 'add')
} }
if (! $error && ! $_POST['url']) if (! $error && ! $_POST['url'])
{ {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("URL")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("URL")), null, 'errors');
$action = 'create'; $action = 'create';
$error++; $error++;
} }
if (! $error && ! $_POST['titre']) if (! $error && ! $_POST['titre'])
{ {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Title")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Title")), null, 'errors');
$action = 'create'; $action = 'create';
$error++; $error++;
} }

View File

@ -45,6 +45,34 @@ $action = GETPOST('action', 'alpha');
* Actions * Actions
*/ */
if (preg_match('/set_([a-z0-9_\-]+)/i',$action,$reg))
{
$code=$reg[1];
$value=GETPOST($code, 'alpha');
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
if (preg_match('/del_([a-z0-9_\-]+)/i',$action,$reg))
{
$code=$reg[1];
if (dolibarr_del_const($db, $code, 0) > 0)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
if ($action == 'add_currency') if ($action == 'add_currency')
{ {
$error=0; $error=0;
@ -91,7 +119,10 @@ elseif ($action == 'update_currency')
{ {
if ($currency->fetch($fk_multicurrency) > 0) if ($currency->fetch($fk_multicurrency) > 0)
{ {
$currency->updateRate($rate); $result=$currency->updateRate($rate);
if ($result<0) {
setEventMessages(null, $currency->errors, 'errors');
}
} }
} }
} }

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr> /* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.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
@ -17,16 +17,13 @@
/** /**
* \file htdocs/admin/openinghours.php * \file htdocs/admin/openinghours.php
* \ingroup accountant * \ingroup core
* \brief Setup page to configure accountant / auditor * \brief Setup page to configure opening hours
*/ */
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$action=GETPOST('action', 'aZ09'); $action=GETPOST('action', 'aZ09');
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'adminaccoutant'; // To manage different context of search $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'adminaccoutant'; // To manage different context of search
@ -50,19 +47,13 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if ( ($action == 'update' && ! GETPOST("cancel", 'alpha')) if ( ($action == 'update' && ! GETPOST("cancel", 'alpha'))
|| ($action == 'updateedit') ) || ($action == 'updateedit') )
{ {
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NAME", GETPOST("nom", 'nohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_OPENINGHOURS_MONDAY", GETPOST("monday", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ADDRESS", GETPOST("address", 'nohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_OPENINGHOURS_TUESDAY", GETPOST("tuesday", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_TOWN", GETPOST("town", 'nohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_OPENINGHOURS_WEDNESDAY", GETPOST("wednesday", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ZIP", GETPOST("zipcode", 'alpha'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_OPENINGHOURS_THURSDAY", GETPOST("thursday", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_STATE", GETPOST("state_id", 'alpha'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_OPENINGHOURS_FRIDAY", GETPOST("friday", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_REGION", GETPOST("region_code", 'alpha'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_OPENINGHOURS_SATURDAY", GETPOST("saturday", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_COUNTRY", GETPOST('country_id', 'int'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_OPENINGHOURS_SUNDAY", GETPOST('sunday', 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_PHONE", GETPOST("tel", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_FAX", GETPOST("fax", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_MAIL", GETPOST("mail", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_WEB", GETPOST("web", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_CODE", GETPOST("code", 'nohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NOTE", GETPOST("note", 'none'), 'chaine', 0, '', $conf->entity);
if ($action != 'updateedit' && ! $error) if ($action != 'updateedit' && ! $error)
{ {
@ -85,10 +76,6 @@ $head = company_admin_prepare_head();
dol_fiche_head($head, 'openinghours', $langs->trans("Company"), -1, 'company'); dol_fiche_head($head, 'openinghours', $langs->trans("Company"), -1, 'company');
$form=new Form($db); $form=new Form($db);
$formother=new FormOther($db);
$formcompany=new FormCompany($db);
$countrynotdefined='<font class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</font>';
print '<span class="opacitymedium">'.$langs->trans("OpeningHoursDesc")."</span><br>\n"; print '<span class="opacitymedium">'.$langs->trans("OpeningHoursDesc")."</span><br>\n";
print "<br>\n"; print "<br>\n";
@ -98,15 +85,6 @@ if ($action == 'edit' || $action == 'updateedit')
/** /**
* Edit parameters * Edit parameters
*/ */
print "\n".'<script type="text/javascript" language="javascript">';
print '$(document).ready(function () {
$("#selectcountry_id").change(function() {
document.form_index.action.value="updateedit";
document.form_index.submit();
});
});';
print '</script>'."\n";
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'" name="form_index">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'" name="form_index">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
@ -114,58 +92,28 @@ if ($action == 'edit' || $action == 'updateedit')
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("Day").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n"; print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("Day").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
// Name print '<tr class="oddeven"><td><label for="monday">'.$langs->trans("Monday").'</label></td><td>';
print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>'; print '<input name="monday" id="monday" class="minwidth100" value="'. ($conf->global->MAIN_INFO_OPENINGHOURS_MONDAY?$conf->global->MAIN_INFO_OPENINGHOURS_MONDAY: GETPOST("monday", 'alpha')) . '" autofocus="autofocus"></td></tr>'."\n";
print '<input name="nom" id="name" class="minwidth200" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_NAME?$conf->global->MAIN_INFO_ACCOUNTANT_NAME: GETPOST("nom", 'nohtml')) . '" autofocus="autofocus"></td></tr>'."\n";
// Address print '<tr class="oddeven"><td><label for="tuesday">'.$langs->trans("Tuesday").'</label></td><td>';
print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>'; print '<input name="tuesday" id="tuesday" class="minwidth100" value="'. ($conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY?$conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY: GETPOST("tuesday", 'alpha')) . '"></td></tr>'."\n";
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS?$conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS: GETPOST("address", 'nohtml')) . '</textarea></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>'; print '<tr class="oddeven"><td><label for="wednesday">'.$langs->trans("Wednesday").'</label></td><td>';
print '<input class="minwidth100" name="zipcode" id="zipcode" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_ZIP?$conf->global->MAIN_INFO_ACCOUNTANT_ZIP: GETPOST("zipcode", 'alpha')) . '"></td></tr>'."\n"; print '<input name="wednesday" id="wednesday" class="minwidth100" value="'. ($conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY?$conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY: GETPOST("wednesday", 'alpha')) . '"></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>'; print '<tr class="oddeven"><td><label for="thursday">'.$langs->trans("Thursday").'</label></td><td>';
print '<input name="town" class="minwidth100" id="town" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_TOWN?$conf->global->MAIN_INFO_ACCOUNTANT_TOWN: GETPOST("town", 'nohtml')) . '"></td></tr>'."\n"; print '<input name="thursday" id="thursday" class="minwidth100" value="'. ($conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY?$conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY: GETPOST("thursday", 'alpha')) . '"></td></tr>'."\n";
// Country print '<tr class="oddeven"><td><label for="friday">'.$langs->trans("Friday").'</label></td><td>';
print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">'; print '<input name="friday" id="friday" class="minwidth100" value="'. ($conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY?$conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY: GETPOST("friday", 'alpha')) . '"></td></tr>'."\n";
//if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization
print $form->select_country($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">'; print '<tr class="oddeven"><td><label for="saturday">'.$langs->trans("Saturday").'</label></td><td>';
$formcompany->select_departement($conf->global->MAIN_INFO_ACCOUNTANT_STATE, $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'state_id'); print '<input name="saturday" id="saturday" class="minwidth100" value="'. ($conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY?$conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY: GETPOST("saturday", 'alpha')) . '"></td></tr>'."\n";
print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>'; print '<tr class="oddeven"><td><label for="sunday">'.$langs->trans("Sunday").'</label></td><td>';
print '<input name="tel" id="phone" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_PHONE . '"></td></tr>'; print '<input name="sunday" id="sunday" class="minwidth100" value="'. ($conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY?$conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY: GETPOST("sunday", 'alpha')) . '"></td></tr>'."\n";
print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>'; print '</table>';
print '<input name="fax" id="fax" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_FAX . '"></td></tr>';
print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
print '<input name="mail" id="email" class="minwidth200" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_MAIL . '"></td></tr>';
print '</td></tr>'."\n";
// Web
print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
print '<input name="web" id="web" class="minwidth300" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_WEB . '"></td></tr>';
print '</td></tr>'."\n";
// Code
print '<tr class="oddeven"><td><label for="code">'.$langs->trans("AccountantFileNumber").'</label></td><td>';
print '<input name="code" id="code" class="minwidth100" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_CODE?$conf->global->MAIN_INFO_ACCOUNTANT_CODE: GETPOST("code", 'nohtml')) . '" autofocus="autofocus"></td></tr>'."\n";
// Note
print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';
print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOST('note', 'none') ? GETPOST('note', 'none') : $conf->global->MAIN_INFO_ACCOUNTANT_NOTE).'</textarea></td></tr>';
print '</td></tr>';
print '</table>';
print '<br><div class="center">'; print '<br><div class="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">'; print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
@ -182,39 +130,17 @@ else
* Show parameters * Show parameters
*/ */
// Actions buttons
//print '<div class="tabsAction">';
//print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
//print '</div><br>';
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Day").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Day").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Monday").'</td><td>' . nl2br(empty($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS)?'':$conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS) . '</td></tr>'; print '<tr class="oddeven"><td>'.$langs->trans("Monday").'</td><td>' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_MONDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_MONDAY) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Tuesday").'</td><td>' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Wednesday").'</td><td>' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Tuesday").'</td><td>' . (empty($conf->global->MAIN_INFO_ACCOUNTANT_ZIP)?'':$conf->global->MAIN_INFO_ACCOUNTANT_ZIP) . '</td></tr>'; print '<tr class="oddeven"><td>'.$langs->trans("Thursday").'</td><td>' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Friday").'</td><td>' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Saturday").'</td><td>' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Wednesday").'</td><td>' . (empty($conf->global->MAIN_INFO_ACCOUNTANT_TOWN)?'':$conf->global->MAIN_INFO_ACCOUNTANT_TOWN) . '</td></tr>'; print '<tr class="oddeven"><td>'.$langs->trans("Sunday").'</td><td>' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Thursday").'</td><td>';
if (! empty($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY))
{
$code = getCountry($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 2);
$img=picto_from_langcode($code);
print $img?$img.' ':'';
print getCountry($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 1);
}
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Friday").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_ACCOUNTANT_PHONE, $mysoc->country_code) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Saturday").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_ACCOUNTANT_FAX, $mysoc->country_code) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Sunday").'</td><td>' . dol_print_email($conf->global->MAIN_INFO_ACCOUNTANT_MAIL, 0, 0, 0, 80) . '</td></tr>';
print '</table>'; print '</table>';
print "</div>"; print "</div>";

View File

@ -48,6 +48,17 @@ if (! empty($conf->syslog->enabled))
*/ */
if ($action=='purge' && ! preg_match('/^confirm/i', $choice) && ($choice != 'allfiles' || $confirm == 'yes') ) if ($action=='purge' && ! preg_match('/^confirm/i', $choice) && ($choice != 'allfiles' || $confirm == 'yes') )
{ {
// Increase limit of time. Works only if we are not in safe mode
$ExecTimeLimit=600;
if (!empty($ExecTimeLimit))
{
$err=error_reporting();
error_reporting(0); // Disable all errors
//error_reporting(E_ALL);
@set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64
error_reporting($err);
}
require_once DOL_DOCUMENT_ROOT.'/core/class/utils.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/utils.class.php';
$utils = new Utils($db); $utils = new Utils($db);
$result = $utils->purgeFiles($choice); $result = $utils->purgeFiles($choice);

View File

@ -145,7 +145,7 @@ if ($object->id)
} }
else else
{ {
accessforbidden('', 0, 0); accessforbidden('', 0, 1);
} }
// End of page // End of page

View File

@ -421,7 +421,7 @@ while ($i < min($num, $limit))
$object->id = $obj->rowid; $object->id = $obj->rowid;
foreach($object->fields as $key => $val) foreach($object->fields as $key => $val)
{ {
if (isset($obj->$key)) $object->$key = $obj->$key; if (property_exists($obj, $key)) $object->$key = $obj->$key;
} }
// Show here line of result // Show here line of result

View File

@ -449,7 +449,7 @@ class BlockedLog
{ {
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if (! in_array($key, array( if (! in_array($key, array(
'ref','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public','lines' 'ref','ref_client','ref_supplier','date','datef','datev','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public','lines'
))) continue; // Discard if not into a dedicated list ))) continue; // Discard if not into a dedicated list
if ($key == 'lines') if ($key == 'lines')
{ {
@ -459,8 +459,8 @@ class BlockedLog
$lineid++; $lineid++;
foreach($tmpline as $keyline => $valueline) foreach($tmpline as $keyline => $valueline)
{ {
if (! in_array($keyline, array( if (! in_array($keyline, array(
'ref','multicurrency_code','multicurrency_total_ht','multicurrency_total_tva','multicurrency_total_ttc','qty','product_type','vat_src_code','tva_tx','info_bits','localtax1_tx','localtax2_tx','total_ht','total_tva','total_ttc','total_localtax1','total_localtax2' 'ref','multicurrency_code','multicurrency_total_ht','multicurrency_total_tva','multicurrency_total_ttc','qty','product_type','vat_src_code','tva_tx','info_bits','localtax1_tx','localtax2_tx','total_ht','total_tva','total_ttc','total_localtax1','total_localtax2'
))) continue; // Discard if not into a dedicated list ))) continue; // Discard if not into a dedicated list
if (! is_object($this->object_data->invoiceline[$lineid])) $this->object_data->invoiceline[$lineid] = new stdClass(); if (! is_object($this->object_data->invoiceline[$lineid])) $this->object_data->invoiceline[$lineid] = new stdClass();

View File

@ -40,6 +40,7 @@ $confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09');
$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bomcard'; // To manage different context of search $contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bomcard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$lineid = GETPOST('lineid', 'int');
// Initialize technical objects // Initialize technical objects
$object=new BOM($db); $object=new BOM($db);
@ -110,20 +111,51 @@ if (empty($reshook))
$autocopy='MAIN_MAIL_AUTOCOPY_BOM_TO'; $autocopy='MAIN_MAIL_AUTOCOPY_BOM_TO';
$trackid='bom'.$object->id; $trackid='bom'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
}
// Add line
if ($action == 'addline' && $user->rights->bom->write)
{
$langs->load('errors');
$error = 0;
// Set if we used free entry or predefined product
$idprod=GETPOST('idprod', 'int');
$qty=GETPOST('qty', 'int');
$efficiency=GETPOST('efficiency', 'int');
if ($qty == '') {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error++;
}
if (! ($idprod > 0)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Product')), null, 'errors');
$error++;
}
$bomline = new BOMLine($db);
$bomline->fk_bom = $id;
$bomline->fk_product = $idprod;
$bomline->qty = $qty;
$bomline->efficiency = $efficiency;
$result = $bomline->create($user);
if ($result <= 0)
{
setEventMessages($bomline->error, $bomline->errors, 'errors');
$action = '';
}
}
}
/* /*
* View * View
*
* Put here all code to build page
*/ */
$form=new Form($db); $form=new Form($db);
$formfile=new FormFile($db); $formfile=new FormFile($db);
llxHeader('', 'NewBOM', ''); llxHeader('', $langs->trans("BOM"), '');
// Example : Adding jquery code // Example : Adding jquery code
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript" language="javascript">
@ -221,7 +253,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
{ {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteBillOfMaterials'), $langs->trans('ConfirmDeleteBillOfMaterials'), 'confirm_delete', '', 0, 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteBillOfMaterials'), $langs->trans('ConfirmDeleteBillOfMaterials'), 'confirm_delete', '', 0, 1);
} }
// Confirmation to delete line
if ($action == 'deleteline')
{
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
}
// Clone confirmation // Clone confirmation
if ($action == 'clone') { if ($action == 'clone') {
// Create an array for form // Create an array for form
@ -320,7 +356,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '<div class="clearboth"></div><br>'; print '<div class="clearboth"></div>';
dol_fiche_end(); dol_fiche_end();
@ -347,14 +383,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline') if (! empty($object->lines) || ($object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
{ {
print '<table id="tablelines" class="noborder noshadow" width="100%">'; print '<table id="tablelines" class="noborder noshadow" width="100%">';
} }
if (! empty($object->lines)) if (! empty($object->lines))
{ {
// $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1); $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/bom/tpl');
} }
// Form to add new line // Form to add new line
@ -363,14 +399,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($action != 'editline') if ($action != 'editline')
{ {
// Add products/services form // Add products/services form
// $object->formAddObjectLine(1, $mysoc, $soc); $object->formAddObjectLine(1, $mysoc, null, '/bom/tpl');
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
} }
} }
if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline') if (! empty($object->lines) || ($object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
{ {
print '</table>'; print '</table>';
} }
@ -465,7 +501,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$MAXEVENT = 10; $MAXEVENT = 10;
$morehtmlright = '<a href="'.dol_buildpath('/bom/bom_info.php', 1).'?id='.$object->id.'">'; $morehtmlright = '<a href="'.dol_buildpath('/bom/bom_agenda.php', 1).'?id='.$object->id.'">';
$morehtmlright.= $langs->trans("SeeAll"); $morehtmlright.= $langs->trans("SeeAll");
$morehtmlright.= '</a>'; $morehtmlright.= '</a>';

View File

@ -143,7 +143,7 @@ if ($object->id)
} }
else else
{ {
accessforbidden('', 0, 0); accessforbidden('', 0, 1);
} }
// End of page // End of page

View File

@ -372,12 +372,18 @@ print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"")
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
foreach($object->fields as $key => $val) foreach($object->fields as $key => $val)
{ {
$cssforfield=''; $cssforfield=(empty($val['css'])?'':$val['css']);
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; if ($key == 'status') $cssforfield='center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right';
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($cssforfield?' '.$cssforfield:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>'; if (! empty($arrayfields['t.'.$key]['checked']))
{
print '<td class="liste_titre'.($cssforfield?' '.$cssforfield:'').'">';
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 0, 0, 0, '', 'maxwidth75');
else print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
print '</td>';
}
} }
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
@ -399,11 +405,11 @@ print '</tr>'."\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
foreach($object->fields as $key => $val) foreach($object->fields as $key => $val)
{ {
$cssforfield=''; $cssforfield=(empty($val['css'])?'':$val['css']);
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right';
if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right';
if (! empty($arrayfields['t.'.$key]['checked'])) if (! empty($arrayfields['t.'.$key]['checked']))
{ {
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n"; print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n";
@ -444,31 +450,23 @@ while ($i < min($num, $limit))
$object->id = $obj->rowid; $object->id = $obj->rowid;
foreach($object->fields as $key => $val) foreach($object->fields as $key => $val)
{ {
if (isset($obj->$key)) $object->$key = $obj->$key; if (property_exists($obj, $key)) $object->$key = $obj->$key;
} }
// Show here line of result // Show here line of result
print '<tr class="oddeven">'; print '<tr class="oddeven">';
foreach($object->fields as $key => $val) foreach($object->fields as $key => $val)
{ {
$cssforfield=''; $cssforfield=(empty($val['css'])?'':$val['css']);
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap'; elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap';
elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right';
if (! empty($arrayfields['t.'.$key]['checked'])) if (! empty($arrayfields['t.'.$key]['checked']))
{ {
print '<td'; print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
if ($cssforfield || $val['css']) print ' class="';
print $cssforfield;
if ($cssforfield && $val['css']) print ' ';
print $val['css'];
if ($cssforfield || $val['css']) print '"';
print '>';
if ($key == 'status') print $object->getLibStatut(5); if ($key == 'status') print $object->getLibStatut(5);
elseif (in_array($val['type'], array('date','datetime','timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), ''); elseif (in_array($val['type'], array('date','datetime','timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), '');
else print $object->showOutputField($val, $key, $obj->$key, ''); else print $object->showOutputField($val, $key, $obj->$key, '');

View File

@ -41,6 +41,12 @@ class BOM extends CommonObject
*/ */
public $table_element = 'bom_bom'; public $table_element = 'bom_bom';
/**
* @var string Name of subtable if this object has sub lines
*/
public $table_element_line = 'bom_bomline';
public $fk_element = 'fk_bom';
/** /**
* @var int Does bom support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe * @var int Does bom support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
*/ */
@ -57,12 +63,9 @@ class BOM extends CommonObject
public $picto = 'bom'; public $picto = 'bom';
public $table_element_line = 'bom_bomline';
const STATUS_DRAFT = 0; const STATUS_DRAFT = 0;
const STATUS_VALIDATED = 1; const STATUS_VALIDATED = 1;
const STATUS_DISABLED = -1; const STATUS_CANCELED = 9;
/** /**
@ -94,18 +97,19 @@ class BOM extends CommonObject
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1',), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1',),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>61, 'notnull'=>-1,), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>62, 'notnull'=>-1,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,),
'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502, 'notnull'=>0,),
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',),
'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,),
'fk_user_valid' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>512, 'notnull'=>0,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>50, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'),
'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'), 'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Enabled', '-1'=>'Disabled')), 'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>161, 'notnull'=>-1,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>162, 'notnull'=>-1,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>300, 'notnull'=>1,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,),
'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502, 'notnull'=>0,),
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',),
'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,),
'fk_user_valid' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>512, 'notnull'=>0,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900, 'notnull'=>-1,),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Enabled', 9=>'Disabled')),
); );
public $rowid; public $rowid;
public $ref; public $ref;
@ -121,6 +125,7 @@ class BOM extends CommonObject
public $status; public $status;
public $fk_product; public $fk_product;
public $qty; public $qty;
public $efficiency;
// END MODULEBUILDER PROPERTIES // END MODULEBUILDER PROPERTIES
@ -220,7 +225,13 @@ class BOM extends CommonObject
$this->db->begin(); $this->db->begin();
// Load source object // Load source object
$object->fetchCommon($fromid); $result = $object->fetchCommon($fromid);
if ($result > 0 && ! empty($object->table_element_line)) $object->fetchLines();
// Get lines so they will be clone
//foreach($object->lines as $line)
// $line->fetch_optionals();
// Reset some properties // Reset some properties
unset($object->id); unset($object->id);
unset($object->fk_user_creat); unset($object->fk_user_creat);
@ -229,7 +240,7 @@ class BOM extends CommonObject
// Clear fields // Clear fields
$object->ref = "copy_of_".$object->ref; $object->ref = "copy_of_".$object->ref;
$object->title = $langs->trans("CopyOf")." ".$object->title; $object->title = $langs->trans("CopyOf")." ".$object->title;
// ...
// Clear extrafields that are unique // Clear extrafields that are unique
if (is_array($object->array_options) && count($object->array_options) > 0) if (is_array($object->array_options) && count($object->array_options) > 0)
{ {
@ -254,6 +265,29 @@ class BOM extends CommonObject
$this->errors = $object->errors; $this->errors = $object->errors;
} }
if (! $error)
{
// copy internal contacts
if ($this->copy_linked_contact($object, 'internal') < 0)
{
$error++;
}
}
if (! $error)
{
// copy external contacts if same company
if (property_exists($this, 'socid') && $this->socid == $object->socid)
{
if ($this->copy_linked_contact($object, 'external') < 0)
$error++;
}
}
// If there is lines, create lines too
unset($object->context['createfromclone']); unset($object->context['createfromclone']);
// End // End
@ -289,27 +323,8 @@ class BOM extends CommonObject
{ {
$this->lines=array(); $this->lines=array();
// Load lines with object BOMLine $result = $this->fetchLinesCommon();
$sql = 'SELECT rowid, fk_product, description, qty, rank WHERE fk_bom = '.$this->id; return $result;
$resql=$this->db->query($sql);
if ($resql)
{
$obj = $this->db->fetch_object($resql);
if ($obj)
{
$newline = new BOMLine($this->db);
$newline->id = $obj->rowid;
$newline->fk_product = $obj->fk_product;
$newline->description = $obj->description;
$newline->qty = $obj->qty;
$newline->rank = $obj->rank;
$this->lines[] = $newline;
}
}
return count($this->lines)?1:0;
} }
/** /**
@ -331,11 +346,11 @@ class BOM extends CommonObject
$records=array(); $records=array();
$sql = 'SELECT'; $sql = 'SELECT ';
$sql .= ' t.rowid'; $sql .= $this->getFieldList();
// TODO Get all fields
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
$sql .= ' WHERE t.entity = '.$conf->entity; if ($this->ismultientitymanaged) $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')';
else $sql .= ' WHERE 1 = 1';
// Manage filter // Manage filter
$sqlwhere = array(); $sqlwhere = array();
if (count($filter) > 0) { if (count($filter) > 0) {
@ -372,11 +387,8 @@ class BOM extends CommonObject
while ($obj = $this->db->fetch_object($resql)) while ($obj = $this->db->fetch_object($resql))
{ {
$record = new self($this->db); $record = new self($this->db);
$record->setVarsFromFetchObj($obj);
$record->id = $obj->rowid;
// TODO Get other fields
//var_dump($record->id);
$records[$record->id] = $record; $records[$record->id] = $record;
} }
$this->db->free($resql); $this->db->free($resql);
@ -415,6 +427,24 @@ class BOM extends CommonObject
//return $this->deleteCommon($user, $notrigger, 1); //return $this->deleteCommon($user, $notrigger, 1);
} }
/**
* Delete a line of object in database
*
* @param User $user User that delete
* @param int $idline Id of line to delete
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int >0 if OK, <0 if KO
*/
public function deleteLine(User $user, $idline, $notrigger = false)
{
if ($this->status < 0)
{
$this->error = 'ErrorDeleteLineNotAllowedByObjectStatus';
return -2;
}
return $this->deleteLineCommon($user, $idline, $notrigger);
}
/** /**
* Returns the reference to the following non used BOM depending on the active numbering module * Returns the reference to the following non used BOM depending on the active numbering module
@ -758,8 +788,9 @@ class BOM extends CommonObject
{ {
global $langs; global $langs;
//$langs->load("mrp"); //$langs->load("mrp");
$this->labelstatus[1] = $langs->trans('Enabled'); $this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Draft');
$this->labelstatus[0] = $langs->trans('Disabled'); $this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
$this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Disabled');
} }
if ($mode == 0) if ($mode == 0)
@ -772,28 +803,23 @@ class BOM extends CommonObject
} }
elseif ($mode == 2) elseif ($mode == 2)
{ {
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; return img_picto($this->labelstatus[$status], 'statut'.($status == self::STATUS_VALIDATED ? 4 : $status), '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
} }
elseif ($mode == 3) elseif ($mode == 3)
{ {
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); return img_picto($this->labelstatus[$status], 'statut'.($status == self::STATUS_VALIDATED ? 4 : $status), '', false, 0, 0, '', 'valignmiddle');
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
} }
elseif ($mode == 4) elseif ($mode == 4)
{ {
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; return img_picto($this->labelstatus[$status], 'statut'.($status == self::STATUS_VALIDATED ? 4 : $status), '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
} }
elseif ($mode == 5) elseif ($mode == 5)
{ {
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.($status == self::STATUS_VALIDATED ? 4 : $status), '', false, 0, 0, '', 'valignmiddle');
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
} }
elseif ($mode == 6) elseif ($mode == 6)
{ {
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.($status == self::STATUS_VALIDATED ? 4 : $status), '', false, 0, 0, '', 'valignmiddle');
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
} }
} }
@ -860,7 +886,7 @@ class BOM extends CommonObject
$this->lines=array(); $this->lines=array();
$objectline = new BOMLine($this->db); $objectline = new BOMLine($this->db);
$result = $objectline->fetchAll('', '', 0, 0, array('fk_bom'=>$this->id)); $result = $objectline->fetchAll('ASC', 'rank', 0, 0, array('customsql'=>'fk_bom = '.$this->id));
if (is_numeric($result)) if (is_numeric($result))
{ {
@ -871,10 +897,44 @@ class BOM extends CommonObject
else else
{ {
$this->lines = $result; $this->lines = $result;
return $this->lines(); return $this->lines;
} }
} }
/**
* Create a document onto disk according to template module.
*
* @param string $modele Force template to use ('' to not force)
* @param Translate $outputlangs objet lang a utiliser pour traduction
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hideref Hide ref
* @param null|array $moreparams Array to provide more information
* @return int 0 if KO, 1 if OK
*/
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
{
global $conf,$langs;
$langs->load("mrp");
if (! dol_strlen($modele)) {
$modele = 'standard';
if ($this->modelpdf) {
$modele = $this->modelpdf;
} elseif (! empty($conf->global->BOM_ADDON_PDF)) {
$modele = $conf->global->BOM_ADDON_PDF;
}
}
$modelpath = "core/modules/bom/doc/";
//return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
return 1;
}
/** /**
* Initialise object with example values * Initialise object with example values
* Id must be 0 if object instance is a specimen * Id must be 0 if object instance is a specimen
@ -948,7 +1008,7 @@ class BOMLine extends CommonObject
/** /**
* @var string String with name of icon for bomline. Must be the part after the 'object_' into object_bomline.png * @var string String with name of icon for bomline. Must be the part after the 'object_' into object_bomline.png
*/ */
public $picto = 'bomline@bom'; public $picto = 'bomline';
/** /**
@ -976,20 +1036,22 @@ class BOMLine extends CommonObject
*/ */
public $fields=array( public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
'fk_bom' => array('type'=>'integer:BillOfMaterials:societe/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1,),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>1, 'isameasure'=>'1',),
'efficiency' => array('type'=>'double(8,4)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
'rank' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>200, 'notnull'=>1,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>-1, 'isameasure'=>'1',),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>-1, 'index'=>1,),
'fk_bom' => array('type'=>'integer:BillOfMaterials:societe/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>-1, 'index'=>1,),
'rank' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>40, 'notnull'=>1,),
); );
public $rowid; public $rowid;
public $description;
public $import_key;
public $qty;
public $fk_product;
public $fk_bom; public $fk_bom;
public $fk_product;
public $description;
public $qty;
public $efficiency;
public $rank; public $rank;
public $import_key;
// END MODULEBUILDER PROPERTIES // END MODULEBUILDER PROPERTIES
@ -1041,71 +1103,6 @@ class BOMLine extends CommonObject
return $this->createCommon($user, $notrigger); return $this->createCommon($user, $notrigger);
} }
/**
* Clone an object into another one
*
* @param User $user User that creates
* @param int $fromid Id of object to clone
* @return mixed New object created, <0 if KO
*/
public function createFromClone(User $user, $fromid)
{
global $langs, $hookmanager, $extrafields;
$error = 0;
dol_syslog(__METHOD__, LOG_DEBUG);
$object = new self($this->db);
$this->db->begin();
// Load source object
$object->fetchCommon($fromid);
// Reset some properties
unset($object->id);
unset($object->fk_user_creat);
unset($object->import_key);
// Clear fields
$object->ref = "copy_of_".$object->ref;
$object->title = $langs->trans("CopyOf")." ".$object->title;
// ...
// Clear extrafields that are unique
if (is_array($object->array_options) && count($object->array_options) > 0)
{
$extrafields->fetch_name_optionals_label($this->element);
foreach($object->array_options as $key => $option)
{
$shortkey = preg_replace('/options_/', '', $key);
if (! empty($extrafields->attributes[$this->element]['unique'][$shortkey]))
{
//var_dump($key); var_dump($clonedObj->array_options[$key]); exit;
unset($object->array_options[$key]);
}
}
}
// Create clone
$object->context['createfromclone'] = 'createfromclone';
$result = $object->createCommon($user);
if ($result < 0) {
$error++;
$this->error = $object->error;
$this->errors = $object->errors;
}
unset($object->context['createfromclone']);
// End
if (!$error) {
$this->db->commit();
return $object;
} else {
$this->db->rollback();
return -1;
}
}
/** /**
* Load object in memory from the database * Load object in memory from the database
* *
@ -1139,11 +1136,11 @@ class BOMLine extends CommonObject
$records=array(); $records=array();
$sql = 'SELECT'; $sql = 'SELECT ';
$sql .= ' t.rowid'; $sql .= $this->getFieldList();
// TODO Get all fields
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
$sql .= ' WHERE t.entity = '.$conf->entity; if ($this->ismultientitymanaged) $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')';
else $sql .= ' WHERE 1 = 1';
// Manage filter // Manage filter
$sqlwhere = array(); $sqlwhere = array();
if (count($filter) > 0) { if (count($filter) > 0) {
@ -1180,11 +1177,8 @@ class BOMLine extends CommonObject
while ($obj = $this->db->fetch_object($resql)) while ($obj = $this->db->fetch_object($resql))
{ {
$record = new self($this->db); $record = new self($this->db);
$record->setVarsFromFetchObj($obj);
$record->id = $obj->rowid;
// TODO Get other fields
//var_dump($record->id);
$records[$record->id] = $record; $records[$record->id] = $record;
} }
$this->db->free($resql); $this->db->free($resql);

View File

@ -0,0 +1,188 @@
<?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Need to have following variables defined:
* $object (invoice, order, ...)
* $conf
* $langs
* $dateSelector
* $forceall (0 by default, 1 for supplier invoices/orders)
* $senderissupplier (0 by default, 1 or 2 for supplier invoices/orders)
* $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
*/
// Protection to avoid direct call of template
if (empty($object) || ! is_object($object)) {
print "Error: this template page cannot be called directly as an URL";
exit;
}
if (! isset($dateSelector)) global $dateSelector; // Take global var only if not already defined into function calling (for example formAddObjectLine)
global $forceall, $forcetoshowtitlelines, $senderissupplier, $inputalsopricewithtax;
if (! isset($dateSelector)) $dateSelector=1; // For backward compatibility
elseif (empty($dateSelector)) $dateSelector=0;
if (empty($forceall)) $forceall=0;
if (empty($senderissupplier)) $senderissupplier=0;
if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
// Define colspan for the button 'Add'
$colspan = 3; // Columns: total ht + col edit + col delete
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan++;//Add column for Total (currency) if required
if (in_array($object->element, array('propal','commande','order','facture','facturerec','invoice','supplier_proposal','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button
//print $object->element;
// Lines for extrafield
$objectline = new BOMLine($this->db);
?>
<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->
<?php
$nolinesbefore=(count($this->lines) == 0 || $forcetoshowtitlelines);
if ($nolinesbefore) {
?>
<tr class="liste_titre<?php echo ($nolinesbefore?'':' liste_titre_add_') ?> nodrag nodrop">
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
<td class="linecolnum center"></td>
<?php } ?>
<td class="linecoldescription minwidth500imp">
<div id="add"></div><span class="hideonsmartphone"><?php echo $langs->trans('AddNewLine'); ?></span><?php // echo $langs->trans("FreeZone"); ?>
</td>
<td class="linecolqty right"><?php echo $langs->trans('Qty'); ?></td>
<?php
if ($conf->global->PRODUCT_USE_UNITS)
{
print '<td class="linecoluseunit left">';
print '<span id="title_units">';
print $langs->trans('Unit');
print '</span></td>';
}
?>
<td class="linecollost right"><?php echo $form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')); ?></td>
<td class="linecoledit" colspan="<?php echo $colspan; ?>">&nbsp;</td>
</tr>
<?php
}
?>
<tr class="pair nodrag nodrop nohoverpair<?php echo ($nolinesbefore || $object->element=='contrat')?'':' liste_titre_create'; ?>">
<?php
$coldisplay=0;
// Adds a line numbering column
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
$coldisplay++;
echo '<td class="nobottom linecolnum center"></td>';
}
$coldisplay++;
?>
<td class="nobottom linecoldescription minwidth500imp">
<?php
// Predefined product/service
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
{
if ($forceall >= 0 && $freelines) echo '<br>';
echo '<span class="prod_entry_mode_predef">';
$filtertype='';
if (! empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype='1';
if (! empty($conf->global->ENTREPOT_EXTRA_STATUS))
{
// hide products in closed warehouse, but show products for internal transfer
$form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array'));
}
else
{
$form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array'));
}
echo '</span>';
}
$coldisplay++;
?>
<td class="nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="<?php echo (isset($_POST["qty"])?GETPOST("qty", 'alpha', 2):1); ?>">
</td>
<?php
if($conf->global->PRODUCT_USE_UNITS)
{
$coldisplay++;
print '<td class="nobottom linecoluseunit left">';
print $form->selectUnits($line->fk_unit, "units");
print '</td>';
}
$remise_percent = $buyer->remise_percent;
if($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier')
{
$remise_percent = $seller->remise_supplier_percent;
}
$coldisplay++;
?>
<td class="nobottom nowrap linecollost right"><input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="<?php echo (GETPOSTISSET("efficiency")?GETPOST("efficiency", 'alpha'):1); ?>"></td>
<?php
$coldisplay+=$colspan;
?>
<td class="nobottom linecoledit center valignmiddle" colspan="<?php echo $colspan; ?>">
<input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline" id="addline">
</td>
</tr>
<?php
if (is_object($objectline)) {
print $objectline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
}
?>
<script>
/* JQuery for product free or predefined select */
jQuery(document).ready(function() {
/* When changing predefined product, we reload list of supplier prices required for margin combo */
$("#idprod").change(function()
{
console.log("#idprod change triggered");
/* To set focus */
if (jQuery('#idprod').val() > 0)
{
/* focus work on a standard textarea but not if field was replaced with CKEDITOR */
jQuery('#dp_desc').focus();
/* focus if CKEDITOR */
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined")
{
var editor = CKEDITOR.instances['dp_desc'];
if (editor) { editor.focus(); }
}
}
});
});
</script>
<!-- END PHP TEMPLATE objectline_create.tpl.php -->

View File

@ -0,0 +1,325 @@
<?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Need to have following variables defined:
* $object (invoice, order, ...)
* $conf
* $langs
* $seller, $buyer
* $dateSelector
* $forceall (0 by default, 1 for supplier invoices/orders)
* $senderissupplier (0 by default, 1 for supplier invoices/orders)
* $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
*/
// Protection to avoid direct call of template
if (empty($object) || ! is_object($object))
{
print "Error, template page can't be called as URL";
exit;
}
global $forceall, $senderissupplier, $inputalsopricewithtax;
if (empty($dateSelector)) $dateSelector=0;
if (empty($forceall)) $forceall=0;
if (empty($senderissupplier)) $senderissupplier=0;
if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
// Define colspan for the button 'Add'
$colspan = 3; // Col total ht + col edit + col delete
if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc
if (in_array($object->element, array('propal','supplier_proposal','facture','facturerec','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan+=2;
?>
<!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php -->
<?php
$coldisplay=0;
?>
<tr class="oddeven tredited">
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
<td class="linecolnum center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td>
<?php }
$coldisplay++;
?>
<td>
<div id="line_<?php echo $line->id; ?>"></div>
<input type="hidden" name="lineid" value="<?php echo $line->id; ?>">
<input type="hidden" id="product_type" name="type" value="<?php echo $line->product_type; ?>">
<input type="hidden" id="product_id" name="productid" value="<?php echo (! empty($line->fk_product)?$line->fk_product:0); ?>" />
<input type="hidden" id="special_code" name="special_code" value="<?php echo $line->special_code; ?>">
<input type="hidden" id="fk_parent_line" name="fk_parent_line" value="<?php echo $line->fk_parent_line; ?>">
<?php if ($line->fk_product > 0) { ?>
<?php
if ($line->fk_parent_line > 0) echo img_picto('', 'rightarrow');
?>
<a href="<?php echo DOL_URL_ROOT.'/product/card.php?id='.$line->fk_product; ?>">
<?php
if ($line->product_type==1) echo img_object($langs->trans('ShowService'), 'service');
else print img_object($langs->trans('ShowProduct'), 'product');
echo ' '.$line->ref;
?>
</a>
<?php
echo ' - '.nl2br($line->product_label);
?>
<br><br>
<?php } ?>
<?php
if (is_object($hookmanager))
{
$fk_parent_line = (GETPOST('fk_parent_line') ? GETPOST('fk_parent_line') : $line->fk_parent_line);
$parameters=array('line'=>$line,'fk_parent_line'=>$fk_parent_line,'var'=>$var,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer);
$reshook=$hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action);
}
?>
</td>
<?php
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
{
$coldisplay++;
?>
<td class="right"><input id="fourn_ref" name="fourn_ref" class="flat minwidth75" value="<?php echo ($line->ref_supplier ? $line->ref_supplier : $line->ref_fourn); ?>"></td>
<?php
}
$coldisplay++;
if ($line->fk_prev_id == null) {
print '<td class="right">' . $form->load_tva('tva_tx', $line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1) . '</td>';
} else {
print '<td class="right"><input size="1" type="text" class="flat right" name="tva_tx" value="' . price($line->tva_tx) . '" readonly />%</td>';
}
$coldisplay++;
print '<td class="right"><input type="text" class="flat right" size="5" id="price_ht" name="price_ht" value="' . (isset($line->pu_ht)?price($line->pu_ht, 0, '', 0):price($line->subprice, 0, '', 0)) . '"';
if ($line->fk_prev_id != null) print ' readonly';
print '></td>';
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) {
$coldisplay++;
print '<td class="right"><input rel="'.$object->multicurrency_tx.'" type="text" class="flat right" size="5" id="multicurrency_subprice" name="multicurrency_subprice" value="'.price($line->multicurrency_subprice).'" /></td>';
}
if ($inputalsopricewithtax)
{
$coldisplay++;
print '<td class="right"><input type="text" class="flat right" size="5" id="price_ttc" name="price_ttc" value="'.(isset($line->pu_ttc)?price($line->pu_ttc, 0, '', 0):'').'"';
if ($line->fk_prev_id != null) print ' readonly';
print '></td>';
}
?>
<td class="right"><?php $coldisplay++; ?>
<?php if (($line->info_bits & 2) != 2) {
// I comment this because it shows info even when not required
// for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated
// must also not be output for most entities (proposal, intervention, ...)
//if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
print '<input size="3" type="text" class="flat right" name="qty" id="qty" value="' . $line->qty . '"';
if ($line->fk_prev_id != null ) print ' readonly';
print '>';
} else { ?>
&nbsp;
<?php } ?>
</td>
<?php
if($conf->global->PRODUCT_USE_UNITS)
{
$coldisplay++;
print '<td class="left">';
print $form->selectUnits($line->fk_unit, "units");
print '</td>';
}
?>
<td class="nowrap right"><?php $coldisplay++; ?>
<?php if (($line->info_bits & 2) != 2) {
print '<input size="1" type="text" class="flat right" name="remise_percent" id="remise_percent" value="' . $line->remise_percent . '"';
if ($line->fk_prev_id != null ) print ' readonly';
print '>%';
} else { ?>
&nbsp;
<?php } ?>
</td>
<!-- colspan for this td because it replace total_ht+3 td for buttons+... -->
<td class="center valignmiddle" colspan="<?php echo $colspan; ?>"><?php $coldisplay+=$colspan; ?>
<input type="submit" class="button" id="savelinebutton" name="save" value="<?php echo $langs->trans("Save"); ?>"><br>
<input type="submit" class="button" id="cancellinebutton" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>">
</td>
</tr>
<?php
//Line extrafield
if (!empty($extrafieldsline))
{
print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var],'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
}
?>
<?php if (! empty($conf->service->enabled) && $line->product_type == 1 && $dateSelector) { ?>
<tr id="service_duration_area" class="treditedlinefordate">
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
<td class="linecolnum center"></td>
<?php } ?>
<td colspan="<?php echo $coldisplay-(empty($conf->global->MAIN_VIEW_LINE_NUMBER)?0:1) ?>"><?php echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?>
<?php
$hourmin=(isset($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:'');
print $form->selectDate($line->date_start, 'date_start', $hourmin, $hourmin, $line->date_start?0:1, "updateline", 1, 0);
print ' '.$langs->trans('to').' ';
print $form->selectDate($line->date_end, 'date_end', $hourmin, $hourmin, $line->date_end?0:1, "updateline", 1, 0);
print '<script type="text/javascript">';
if (!$line->date_start) {
if (isset($conf->global->MAIN_DEFAULT_DATE_START_HOUR)) {
print 'jQuery("#date_starthour").val("'.$conf->global->MAIN_DEFAULT_DATE_START_HOUR.'");';
}
if (isset($conf->global->MAIN_DEFAULT_DATE_START_MIN)) {
print 'jQuery("#date_startmin").val("'.$conf->global->MAIN_DEFAULT_DATE_START_MIN.'");';
}
}
if (!$line->date_end) {
if (isset($conf->global->MAIN_DEFAULT_DATE_END_HOUR)) {
print 'jQuery("#date_endhour").val("'.$conf->global->MAIN_DEFAULT_DATE_END_HOUR.'");';
}
if (isset($conf->global->MAIN_DEFAULT_DATE_END_MIN)) {
print 'jQuery("#date_endmin").val("'.$conf->global->MAIN_DEFAULT_DATE_END_MIN.'");';
}
}
print '</script>'
?>
</td>
</tr>
<?php }
?>
<script type="text/javascript">
jQuery(document).ready(function()
{
jQuery("#price_ht").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') {
jQuery("#price_ttc").val('');
jQuery("#multicurrency_subprice").val('');
}
});
jQuery("#price_ttc").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
jQuery("#price_ht").val('');
jQuery("#multicurrency_subprice").val('');
}
});
jQuery("#multicurrency_subprice").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
jQuery("#price_ht").val('');
jQuery("#price_ttc").val('');
}
});
<?php
if (! empty($conf->margin->enabled))
{
?>
/* Add rule to clear margin when we change some data, so when we change sell or buy price, margin will be recalculated after submitting form */
jQuery("#tva_tx").click(function() { /* somtimes field is a text, sometimes a combo */
jQuery("input[name='np_marginRate']:first").val('');
jQuery("input[name='np_markRate']:first").val('');
});
jQuery("#tva_tx").keyup(function() { /* somtimes field is a text, sometimes a combo */
jQuery("input[name='np_marginRate']:first").val('');
jQuery("input[name='np_markRate']:first").val('');
});
jQuery("#price_ht").keyup(function() {
jQuery("input[name='np_marginRate']:first").val('');
jQuery("input[name='np_markRate']:first").val('');
});
jQuery("#qty").keyup(function() {
jQuery("input[name='np_marginRate']:first").val('');
jQuery("input[name='np_markRate']:first").val('');
});
jQuery("#remise_percent").keyup(function() {
jQuery("input[name='np_marginRate']:first").val('');
jQuery("input[name='np_markRate']:first").val('');
});
jQuery("#buying_price").keyup(function() {
jQuery("input[name='np_marginRate']:first").val('');
jQuery("input[name='np_markRate']:first").val('');
});
/* Init field buying_price and fournprice */
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': <?php echo $line->fk_product?$line->fk_product:0; ?>}, function(data) {
if (data && data.length > 0) {
var options = '';
var trouve=false;
$(data).each(function() {
options += '<option value="'+this.id+'" price="'+this.price+'"';
<?php if ($line->fk_fournprice > 0) { ?>
if (this.id == <?php echo $line->fk_fournprice; ?>) {
options += ' selected';
$("#buying_price").val(this.price);
trouve = true;
}
<?php } ?>
options += '>'+this.label+'</option>';
});
options += '<option value=null'+(trouve?'':' selected')+'><?php echo $langs->trans("InputPrice"); ?></option>';
$("#fournprice").html(options);
if (trouve) {
$("#buying_price").hide();
$("#fournprice").show();
} else {
$("#buying_price").show();
}
$("#fournprice").change(function() {
var selval = $(this).find('option:selected').attr("price");
if (selval)
$("#buying_price").val(selval).hide();
else
$('#buying_price').show();
});
} else {
$("#fournprice").hide();
$('#buying_price').show();
}
}, 'json');
<?php
}
?>
});
</script>
<!-- END PHP TEMPLATE objectline_edit.tpl.php -->

View File

@ -0,0 +1,84 @@
<?php
/* Copyright (C) 2010-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Need to have following variables defined:
* $object (invoice, order, ...)
* $conf
* $langs
* $element (used to test $user->rights->$element->creer)
* $permtoedit (used to replace test $user->rights->$element->creer)
* $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
* $outputalsopricetotalwithtax
* $usemargins (0 to disable all margins columns, 1 to show according to margin setup)
*
* $type, $text, $description, $line
*/
// Protection to avoid direct call of template
if (empty($object) || ! is_object($object))
{
print "Error, template page can't be called as URL";
exit;
}
?>
<!-- BEGIN PHP TEMPLATE objectline_title.tpl.php -->
<?php
// Title line
print "<thead>\n";
print '<tr class="liste_titre nodrag nodrop">';
// Adds a line numbering column
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print '<td class="linecolnum center">&nbsp;</td>';
// Description
print '<td class="linecoldescription">'.$langs->trans('Description').'</td>';
// Qty
print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
if ($conf->global->PRODUCT_USE_UNITS)
{
print '<td class="linecoluseunit left">'.$langs->trans('Unit').'</td>';
}
print '<td class="linecollost right">'.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')).'</td>';
print '<td class="linecoledit"></td>'; // No width to allow autodim
print '<td class="linecoldelete" style="width: 10px"></td>';
print '<td class="linecolmove" style="width: 10px"></td>';
if ($action == 'selectlines')
{
print '<td class="linecolcheckall center">';
print '<input type="checkbox" class="linecheckboxtoggle" />';
print '<script>$(document).ready(function() {$(".linecheckboxtoggle").click(function() {var checkBoxes = $(".linecheckbox");checkBoxes.prop("checked", this.checked);})});</script>';
print '</td>';
}
print "</tr>\n";
print "</thead>\n";
?>
<!-- END PHP TEMPLATE objectline_title.tpl.php -->

View File

@ -0,0 +1,158 @@
<?php
/* Copyright (C) 2010-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Need to have following variables defined:
* $object (invoice, order, ...)
* $conf
* $langs
* $forceall (0 by default, 1 for supplier invoices/orders)
* $element (used to test $user->rights->$element->creer)
* $permtoedit (used to replace test $user->rights->$element->creer)
* $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
* $object_rights->creer initialized from = $object->getRights()
* $disableedit, $disablemove, $disableremove
*
* $type, $text, $description, $line
*/
// Protection to avoid direct call of template
if (empty($object) || ! is_object($object))
{
print "Error, template page can't be called as URL";
exit;
}
global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax;
if (empty($dateSelector)) $dateSelector=0;
if (empty($forceall)) $forceall=0;
if (empty($senderissupplier)) $senderissupplier=0;
if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
// add html5 elements
$domData = ' data-element="'.$line->element.'"';
$domData .= ' data-id="'.$line->id.'"';
$domData .= ' data-qty="'.$line->qty.'"';
$domData .= ' data-product_type="'.$line->product_type.'"';
// Lines for extrafield
$objectline = new BOMLine($object->db);
?>
<?php $coldisplay=0; ?>
<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->
<tr id="row-<?php echo $line->id?>" class="drag drop oddeven" <?php echo $domData; ?> >
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
<td class="linecolnum center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td>
<?php } ?>
<td class="linecoldescription minwidth300imp"><?php $coldisplay++; ?><div id="line_<?php echo $line->id; ?>"></div>
<?php
$tmpproduct = new Product($object->db);
$tmpproduct->fetch($line->fk_product);
print $tmpproduct->getNomUrl(1);
?>
</td>
<td class="linecolqty nowrap right"><?php $coldisplay++; ?>
<?php
echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
?>
</td>
<?php
if($conf->global->PRODUCT_USE_UNITS)
{
print '<td class="linecoluseunit nowrap left">';
$label = $line->getLabelOfUnit('short');
if ($label !== '') {
print $langs->trans($label);
}
print '</td>';
}
?>
<td class="linecolqty nowrap right"><?php $coldisplay++; ?>
<?php
echo $line->efficiency;
?>
</td>
<?php
if ($this->statut == 0 && ($object_rights->write) && $action != 'selectlines' ) { ?>
<td class="linecoledit center"><?php $coldisplay++; ?>
<?php if (($line->info_bits & 2) == 2 || ! empty($disableedit)) { ?>
<?php } else { ?>
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'#line_'.$line->id; ?>">
<?php echo img_edit(); ?>
</a>
<?php } ?>
</td>
<td class="linecoldelete center"><?php $coldisplay++; ?>
<?php
if (($line->fk_prev_id == null ) && empty($disableremove)) { //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $this->id . '&amp;action=deleteline&amp;lineid=' . $line->id . '">';
print img_delete();
print '</a>';
}
?>
</td>
<?php
if ($num > 1 && $conf->browser->layout != 'phone' && empty($disablemove)) { ?>
<td class="linecolmove tdlineupdown center"><?php $coldisplay++; ?>
<?php if ($i > 0) { ?>
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=up&amp;rowid='.$line->id; ?>">
<?php echo img_up('default', 0, 'imgupforline'); ?>
</a>
<?php } ?>
<?php if ($i < $num-1) { ?>
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=down&amp;rowid='.$line->id; ?>">
<?php echo img_down('default', 0, 'imgdownforline'); ?>
</a>
<?php } ?>
</td>
<?php } else { ?>
<td <?php echo (($conf->browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown center"':' class="linecolmove center"'); ?>><?php $coldisplay++; ?></td>
<?php } ?>
<?php
} else {
?>
<td colspan="3"><?php $coldisplay=$coldisplay+3; ?></td>
<?php
}
if($action == 'selectlines'){ ?>
<td class="linecolcheck center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td>
<?php } ?>
</tr>
<?php
//Line extrafield
if (!empty($extrafieldsline))
{
print $line->showOptionals($extrafieldsline, 'view', array('style'=>'class="drag drop oddeven"','colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
}
?>
<!-- END PHP TEMPLATE objectline_view.tpl.php -->

View File

@ -65,7 +65,11 @@ $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css')
llxHeader('', $title, '', '', 0, 0, $arrayofjs, $arrayofcss); llxHeader('', $title, '', '', 0, 0, $arrayofjs, $arrayofcss);
$newcardbutton.= dolGetButtonTitle($langs->trans('NewCategory'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type));
$newcardbutton='';
if (! empty($user->rights->categorie->creer)) {
$newcardbutton.= dolGetButtonTitle($langs->trans('NewCategory'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type));
}
print load_fiche_titre($title, $newcardbutton); print load_fiche_titre($title, $newcardbutton);

View File

@ -7,7 +7,7 @@
* 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@open-dsi.fr> * Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -272,7 +272,7 @@ if ($action == 'add')
$object->datep = $datep; $object->datep = $datep;
$object->datef = $datef; $object->datef = $datef;
$object->percentage = $percentage; $object->percentage = $percentage;
$object->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * 60; $object->duree=(((int) GETPOST('dureehour') * 60) + (int) GETPOST('dureemin')) * 60;
$transparency=(GETPOST("transparency")=='on'?1:0); $transparency=(GETPOST("transparency")=='on'?1:0);

View File

@ -267,7 +267,7 @@ if ($action == 'savefilter' || $action == 'createfilter') {
$error = 0; $error = 0;
if ($action == 'createfilter' && empty($template_name)) { if ($action == 'createfilter' && empty($template_name)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->trans('AdvTgtOrCreateNewFilter')), null, 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('AdvTgtOrCreateNewFilter')), null, 'errors');
$error ++; $error ++;
} }

View File

@ -424,7 +424,7 @@ if (empty($reshook))
$object->sendto = $_POST["sendto"]; $object->sendto = $_POST["sendto"];
if (! $object->sendto) if (! $object->sendto)
{ {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("MailTo")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MailTo")), null, 'errors');
$error++; $error++;
} }
@ -870,7 +870,7 @@ else
} }
$text.=$langs->trans('ConfirmSendingEmailing').'<br>'; $text.=$langs->trans('ConfirmSendingEmailing').'<br>';
$text.=$langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB); $text.=$langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB);
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', $formquestion, '', 1, 300); print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', $formquestion, '', 1, 330, 600);
} }
} }

View File

@ -321,7 +321,7 @@ if (empty($reshook))
$datep = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $datep = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$date_delivery = dol_mktime(12, 0, 0, GETPOST('date_livraisonmonth'), GETPOST('date_livraisonday'), GETPOST('date_livraisonyear')); $date_delivery = dol_mktime(12, 0, 0, GETPOST('date_livraisonmonth'), GETPOST('date_livraisonday'), GETPOST('date_livraisonyear'));
$duration = GETPOST('duree_validite'); $duration = GETPOST('duree_validite', 'int');
if (empty($datep)) { if (empty($datep)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
@ -1622,7 +1622,7 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
// Validaty duration // Validaty duration
print '<tr><td class="fieldrequired">' . $langs->trans("ValidityDuration") . '</td><td><input name="duree_validite" size="5" value="' . $conf->global->PROPALE_VALIDITY_DURATION . '"> ' . $langs->trans("days") . '</td></tr>'; print '<tr><td class="fieldrequired">' . $langs->trans("ValidityDuration") . '</td><td><input name="duree_validite" class="width50" value="' . (GETPOST('duree_validite', 'int') ? GETPOST('duree_validite', 'int') : $conf->global->PROPALE_VALIDITY_DURATION) . '"> ' . $langs->trans("days") . '</td></tr>';
// Terms of payment // Terms of payment
print '<tr><td class="nowrap">' . $langs->trans('PaymentConditionsShort') . '</td><td>'; print '<tr><td class="nowrap">' . $langs->trans('PaymentConditionsShort') . '</td><td>';

View File

@ -63,7 +63,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
</td> </td>
<td class="linkedcol-name" ><?php echo $objectlink->getNomUrl(1); ?></td> <td class="linkedcol-name" ><?php echo $objectlink->getNomUrl(1); ?></td>
<td class="linkedcol-ref" ><?php echo $objectlink->ref_client; ?></td> <td class="linkedcol-ref" ><?php echo $objectlink->ref_client; ?></td>
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td> <td class="linkedcol-date center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td>
<td class="linkedcol-amount right"><?php <td class="linkedcol-amount right"><?php
if ($user->rights->propale->lire) { if ($user->rights->propale->lire) {
$total = $total + $objectlink->total_ht; $total = $total + $objectlink->total_ht;
@ -80,8 +80,8 @@ if (count($linkedObjectBlock) > 1)
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':''); ?>"> <tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':''); ?>">
<td><?php echo $langs->trans("Total"); ?></td> <td><?php echo $langs->trans("Total"); ?></td>
<td></td> <td></td>
<td align="center"></td> <td class="center"></td>
<td align="center"></td> <td class="center"></td>
<td class="right"><?php echo price($total); ?></td> <td class="right"><?php echo price($total); ?></td>
<td class="right"></td> <td class="right"></td>
<td class="right"></td> <td class="right"></td>

View File

@ -161,7 +161,7 @@ if ($action == 'setremise' && $user->rights->societe->creer)
$error=0; $error=0;
if (empty($desc)) if (empty($desc))
{ {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("ReasonDiscount")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReasonDiscount")), null, 'errors');
$error++; $error++;
} }
@ -193,7 +193,7 @@ if ($action == 'setremise' && $user->rights->societe->creer)
} }
else else
{ {
setEventMessages($langs->trans("ErrorFieldFormat", $langs->trans("NewGlobalDiscount")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldFormat", $langs->transnoentitiesnoconv("NewGlobalDiscount")), null, 'errors');
} }
} }

View File

@ -815,7 +815,7 @@ class Commande extends CommonOrder
} }
if (! empty($conf->global->COMMANDE_REQUIRE_SOURCE) && $this->source < 0) if (! empty($conf->global->COMMANDE_REQUIRE_SOURCE) && $this->source < 0)
{ {
$this->error=$langs->trans("ErrorFieldRequired", $langs->trans("Source")); $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Source"));
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
return -1; return -1;
} }
@ -4051,6 +4051,33 @@ class OrderLine extends CommonOrderLine
$error=0; $error=0;
// check if order line is not in a shipment line before deleting
$sqlCheckShipmentLine = "SELECT";
$sqlCheckShipmentLine .= " ed.rowid";
$sqlCheckShipmentLine .= " FROM " . MAIN_DB_PREFIX . "expeditiondet ed";
$sqlCheckShipmentLine .= " WHERE ed.fk_origin_line = " . $this->rowid;
$resqlCheckShipmentLine = $this->db->query($sqlCheckShipmentLine);
if (!$resqlCheckShipmentLine) {
$error++;
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
} else {
$langs->load('errors');
$num = $this->db->num_rows($resqlCheckShipmentLine);
if ($num > 0) {
$error++;
$objCheckShipmentLine = $this->db->fetch_object($resqlCheckShipmentLine);
$this->error = $langs->trans('ErrorRecordAlreadyExists') . ' : ' . $langs->trans('ShipmentLine') . ' ' . $objCheckShipmentLine->rowid;
$this->errors[] = $this->error;
}
$this->db->free($resqlCheckShipmentLine);
}
if ($error) {
dol_syslog(__METHOD__ . 'Error ; ' . $this->error, LOG_ERR);
return -1;
}
$this->db->begin(); $this->db->begin();
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid=".$this->rowid; $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid=".$this->rowid;

View File

@ -877,12 +877,12 @@ if ($resql)
} }
if (! empty($arrayfields['bu.label']['checked'])) if (! empty($arrayfields['bu.label']['checked']))
{ {
print '<td class="liste_titre"><input type="text" class="flat" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'" size="10"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'"></td>';
} }
if (! empty($arrayfields['ba.ref']['checked'])) if (! empty($arrayfields['ba.ref']['checked']))
{ {
print '<td class="liste_titre right">'; print '<td class="liste_titre">';
$form->select_comptes($search_account, 'search_account', 0, '', 1, ($id > 0 || ! empty($ref)?' disabled="disabled"':'')); $form->select_comptes($search_account, 'search_account', 0, '', 1, ($id > 0 || ! empty($ref)?' disabled="disabled"':''), 0, 'maxwidth100');
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['b.debit']['checked'])) if (! empty($arrayfields['b.debit']['checked']))
@ -940,7 +940,7 @@ if ($resql)
if (! empty($arrayfields['type']['checked'])) print_liste_field_titre($arrayfields['type']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['type']['checked'])) print_liste_field_titre($arrayfields['type']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['b.num_chq']['checked'])) print_liste_field_titre($arrayfields['b.num_chq']['label'], $_SERVER['PHP_SELF'], 'b.num_chq', '', $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['b.num_chq']['checked'])) print_liste_field_titre($arrayfields['b.num_chq']['label'], $_SERVER['PHP_SELF'], 'b.num_chq', '', $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['bu.label']['checked'])) print_liste_field_titre($arrayfields['bu.label']['label'], $_SERVER['PHP_SELF'], 'bu.label', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['bu.label']['checked'])) print_liste_field_titre($arrayfields['bu.label']['label'], $_SERVER['PHP_SELF'], 'bu.label', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['b.debit']['checked'])) print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['b.debit']['checked'])) print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder);
if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder);
if (! empty($arrayfields['balancebefore']['checked'])) print_liste_field_titre($arrayfields['balancebefore']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['balancebefore']['checked'])) print_liste_field_titre($arrayfields['balancebefore']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
@ -961,6 +961,7 @@ if ($resql)
$balancebefore = 0; // For balance $balancebefore = 0; // For balance
$balancecalculated = false; $balancecalculated = false;
$posconciliatecol = 0; $posconciliatecol = 0;
$cachebankaccount = array();
// Loop on each record // Loop on each record
$sign = 1; $sign = 1;
@ -1337,7 +1338,7 @@ if ($resql)
// Bank account // Bank account
if (! empty($arrayfields['ba.ref']['checked'])) if (! empty($arrayfields['ba.ref']['checked']))
{ {
print '<td class="nowrap right">'; print '<td class="nowrap">';
print $bankaccount->getNomUrl(1); print $bankaccount->getNomUrl(1);
print "</td>\n"; print "</td>\n";
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;

View File

@ -44,7 +44,7 @@ class PaymentVarious extends CommonObject
/** /**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/ */
public $picto = 'bill'; public $picto = 'payment';
/** /**
* @var int ID * @var int ID
@ -63,6 +63,7 @@ class PaymentVarious extends CommonObject
public $amount; public $amount;
public $type_payment; public $type_payment;
public $num_payment; public $num_payment;
public $category_transaction;
/** /**
* @var string various payments label * @var string various payments label
@ -414,13 +415,13 @@ class PaymentVarious extends CommonObject
$sign=1; $sign=1;
if ($this->sens == '0') $sign=-1; if ($this->sens == '0') $sign=-1;
$bank_line_id = $acc->addline( $bank_line_id = $acc->addline(
$this->datep, $this->datep,
$this->type_payment, $this->type_payment,
$this->label, $this->label,
$sign * abs($this->amount), $sign * abs($this->amount),
$this->num_payment, $this->num_payment,
'', ($this->category_transaction > 0 ? $this->category_transaction : 0),
$user $user
); );

View File

@ -37,7 +37,7 @@ if (! empty($conf->projet->enabled))
} }
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy")); $langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy", "categories"));
// Get parameters // Get parameters
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
@ -45,14 +45,15 @@ $action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$accountid=GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0; $accountid = GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0;
$label=GETPOST("label", "alpha"); $label = GETPOST("label", "alpha");
$sens=GETPOST("sens", "int"); $sens = GETPOST("sens", "int");
$amount=GETPOST("amount", "alpha"); $amount = GETPOST("amount", "alpha");
$paymenttype=GETPOST("paymenttype", "int"); $paymenttype = GETPOST("paymenttype", "int");
$accountancy_code=GETPOST("accountancy_code", "alpha"); $accountancy_code = GETPOST("accountancy_code", "alpha");
$subledger_account=GETPOST("subledger_account", "alpha"); $subledger_account = GETPOST("subledger_account", "alpha");
$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int')); $projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int'));
$category_transaction = GETPOST("category_transaction", 'alpha');
// Security check // Security check
$socid = GETPOST("socid", "int"); $socid = GETPOST("socid", "int");
@ -64,8 +65,6 @@ $object = new PaymentVarious($db);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('variouscard','globalcard')); $hookmanager->initHooks(array('variouscard','globalcard'));
/** /**
* Actions * Actions
*/ */
@ -113,6 +112,7 @@ if (empty($reshook))
$object->type_payment=GETPOST("paymenttype", 'int') > 0 ? GETPOST("paymenttype", "int") : 0; $object->type_payment=GETPOST("paymenttype", 'int') > 0 ? GETPOST("paymenttype", "int") : 0;
$object->num_payment=GETPOST("num_payment", 'alpha'); $object->num_payment=GETPOST("num_payment", 'alpha');
$object->fk_user_author=$user->id; $object->fk_user_author=$user->id;
$object->category_transaction=GETPOST("category_transaction", 'alpha');
$object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "alpha") : ""; $object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "alpha") : "";
$object->subledger_account=GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : ""; $object->subledger_account=GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : "";
@ -144,6 +144,7 @@ if (empty($reshook))
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors');
$error++; $error++;
} }
// TODO Remove this and allow instead to edit a various payment to enter accounting code
if (! empty($conf->accounting->enabled) && ! $object->accountancy_code) if (! empty($conf->accounting->enabled) && ! $object->accountancy_code)
{ {
$langs->load('errors'); $langs->load('errors');
@ -240,6 +241,16 @@ if ($id)
} }
} }
$options = array();
// Load bank groups
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
$bankcateg = new BankCateg($db);
foreach ($bankcateg->fetchAll() as $bankcategory) {
$options[$bankcategory->id] = $bankcategory->label;
}
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* Create mode */ /* Create mode */
@ -259,7 +270,7 @@ if ($action == 'create')
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Date payment // Date payment
print '<tr><td>'; print '<tr><td class="titlefieldcreate">';
print $form->editfieldkey('DatePayment', 'datep', '', $object, 0, 'string', '', 1).'</td><td>'; print $form->editfieldkey('DatePayment', 'datep', '', $object, 0, 'string', '', 1).'</td><td>';
print $form->selectDate((empty($datep)?-1:$datep), "datep", '', '', '', 'add', 1, 1); print $form->selectDate((empty($datep)?-1:$datep), "datep", '', '', '', 'add', 1, 1);
print '</td></tr>'; print '</td></tr>';
@ -314,17 +325,48 @@ if ($action == 'create')
print '<td><input name="num_payment" id="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n"; print '<td><input name="num_payment" id="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
} }
// Project
if (! empty($conf->projet->enabled))
{
$formproject=new FormProjets($db);
// Associated project
$langs->load("projects");
print '<tr><td>'.$langs->trans("Project").'</td><td>';
$numproject=$formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1);
print '</td></tr>';
}
// Other attributes
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</td></tr>';
// Category
if (is_array($options) && count($options) && $conf->categorie->enabled)
{
print '<tr><td>'.$langs->trans("RubriquesTransactions").'</td><td>';
print Form::selectarray('category_transaction', $options, GETPOST('category_transaction'), 1);
print '</td></tr>';
}
// Accountancy account // Accountancy account
if (! empty($conf->accounting->enabled)) if (! empty($conf->accounting->enabled))
{ {
print '<tr><td class="fieldrequired">'.$langs->trans("AccountAccounting").'</td>'; // TODO Remove the fieldrequired and allow instead to edit a various payment to enter accounting code
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("AccountAccounting").'</td>';
print '<td>'; print '<td>';
print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, ''); print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, '');
print '</td></tr>'; print '</td></tr>';
} }
else // For external software else // For external software
{ {
print '<tr><td>'.$langs->trans("AccountAccounting").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("AccountAccounting").'</td>';
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code" value="'.$accountancy_code.'">'; print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code" value="'.$accountancy_code.'">';
print '</td></tr>'; print '</td></tr>';
} }
@ -351,26 +393,6 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
} }
// Project
if (! empty($conf->projet->enabled))
{
$formproject=new FormProjets($db);
// Associated project
$langs->load("projects");
print '<tr><td>'.$langs->trans("Project").'</td><td>';
$numproject=$formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1);
print '</td></tr>';
}
// Other attributes
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</table>'; print '</table>';
dol_fiche_end(); dol_fiche_end();
@ -395,7 +417,7 @@ if ($id)
{ {
$head=various_payment_prepare_head($object); $head=various_payment_prepare_head($object);
dol_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, 'payment'); dol_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto);
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Project // Project
@ -479,7 +501,7 @@ if ($id)
print '</td><td>'; print '</td><td>';
print $object->subledger_account; print $object->subledger_account;
print '</td></tr>'; print '</td></tr>';
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
if ($object->fk_account > 0) if ($object->fk_account > 0)
@ -502,7 +524,6 @@ if ($id)
print '</table>'; print '</table>';
print '</div>';
print '</div>'; print '</div>';
print '<div class="clearboth"></div>'; print '<div class="clearboth"></div>';
@ -514,7 +535,12 @@ if ($id)
* Action buttons * Action buttons
*/ */
print '<div class="tabsAction">'."\n"; print '<div class="tabsAction">'."\n";
if ($object->rappro == 0)
// TODO
// Add button modify
// Delete
if (empty($object->rappro))
{ {
if (! empty($user->rights->banque->modifier)) if (! empty($user->rights->banque->modifier))
{ {
@ -529,6 +555,7 @@ if ($id)
{ {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("LinkedToAConciliatedTransaction").'">'.$langs->trans("Delete").'</a>'; print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("LinkedToAConciliatedTransaction").'">'.$langs->trans("Delete").'</a>';
} }
print "</div>"; print "</div>";
} }

View File

@ -82,7 +82,7 @@ if ($object->id)
{ {
$head=various_payment_prepare_head($object); $head=various_payment_prepare_head($object);
dol_fiche_head($head, 'documents', $langs->trans("VariousPayment"), -1, 'payment'); dol_fiche_head($head, 'documents', $langs->trans("VariousPayment"), -1, $object->picto);
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Project // Project

View File

@ -50,7 +50,7 @@ $object->info($id);
$head = various_payment_prepare_head($object); $head = various_payment_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("VariousPayment"), -1, 'payment'); dol_fiche_head($head, 'info', $langs->trans("VariousPayment"), -1, $object->picto);
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';

View File

@ -57,7 +57,7 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or
$offset = $conf->liste_limit * $page; $offset = $conf->liste_limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (! $sortfield) $sortfield="v.datep"; if (! $sortfield) $sortfield="v.datep,v.rowid";
if (! $sortorder) $sortorder="DESC"; if (! $sortorder) $sortorder="DESC";
$filtre=GETPOST("filtre", 'alpha'); $filtre=GETPOST("filtre", 'alpha');
@ -110,13 +110,13 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.row
$sql.= " WHERE v.entity IN (".getEntity('payment_various').")"; $sql.= " WHERE v.entity IN (".getEntity('payment_various').")";
// Search criteria // Search criteria
if ($search_ref) $sql.=" AND v.rowid=".$search_ref; if ($search_ref) $sql.=" AND v.rowid=".$db->escape($search_ref);
if ($search_label) $sql.=natural_search(array('v.label'), $search_label); if ($search_label) $sql.=natural_search(array('v.label'), $search_label);
if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1); if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1);
if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1); if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1);
if ($search_account > 0) $sql.=" AND b.fk_account=".$search_account; if ($search_account > 0) $sql.=" AND b.fk_account=".$db->escape($search_account);
if ($search_date) $sql.=" AND v.datep=".$search_date; if ($search_date) $sql.=" AND v.datep = '".$db->idate($search_date)."'";
if ($search_accountancy_code > 0) $sql.=" AND v.accountancy_code=".$search_accountancy_code; if ($search_accountancy_code > 0) $sql.=" AND v.accountancy_code=".$db->escape($search_accountancy_code);
if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid; if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid;
if ($filtre) { if ($filtre) {
$filtre=str_replace(":", "=", $filtre); $filtre=str_replace(":", "=", $filtre);
@ -234,7 +234,7 @@ if ($result)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "v.rowid", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "v.rowid", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "v.label", "", $param, '', $sortfield, $sortorder, 'left '); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "v.label", "", $param, '', $sortfield, $sortorder, 'left ');
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep,v.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'left '); print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'left ');
if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left '); if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left ');

View File

@ -458,7 +458,7 @@ while ($i < min($num, $limit))
$object->id = $obj->rowid; $object->id = $obj->rowid;
foreach($object->fields as $key => $val) foreach($object->fields as $key => $val)
{ {
if (isset($obj->$key)) $object->$key = $obj->$key; if (property_exists($obj, $key)) $object->$key = $obj->$key;
} }
// Show here line of result // Show here line of result

View File

@ -939,7 +939,7 @@ if (empty($reshook))
if (empty($dateinvoice)) if (empty($dateinvoice))
{ {
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
} }
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
@ -1408,8 +1408,9 @@ if (empty($reshook))
{ {
// Don't add lines with qty 0 when coming from a shipment including all order lines // Don't add lines with qty 0 when coming from a shipment including all order lines
if($srcobject->element == 'shipping' && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS && $lines[$i]->qty == 0) continue; if($srcobject->element == 'shipping' && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS && $lines[$i]->qty == 0) continue;
// Don't add closed lines when coming from a contract // Don't add closed lines when coming from a contract (Set constant to '0,5' to exclude also inactive lines)
if($srcobject->element == 'contrat' && $lines[$i]->statut == 5) continue; if (! isset($conf->global->CONTRACT_EXCLUDE_SERVICES_STATUS_FOR_INVOICE)) $conf->global->CONTRACT_EXCLUDE_SERVICES_STATUS_FOR_INVOICE = '5';
if ($srcobject->element == 'contrat' && in_array($lines[$i]->statut, explode(',', $conf->global->CONTRACT_EXCLUDE_SERVICES_STATUS_FOR_INVOICE))) continue;
$label=(! empty($lines[$i]->label)?$lines[$i]->label:''); $label=(! empty($lines[$i]->label)?$lines[$i]->label:'');
$desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle); $desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle);
@ -1566,7 +1567,7 @@ if (empty($reshook))
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($datefacture)) { if (empty($datefacture)) {
$error++; $error++;
$mesg = $langs->trans("ErrorFieldRequired", $langs->trans("Date")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date"));
setEventMessages($mesg, null, 'errors'); setEventMessages($mesg, null, 'errors');
} }
@ -1574,7 +1575,7 @@ if (empty($reshook))
if (!($_POST['situations'] > 0)) { if (!($_POST['situations'] > 0)) {
$error++; $error++;
$mesg = $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation"));
setEventMessages($mesg, null, 'errors'); setEventMessages($mesg, null, 'errors');
} }
@ -3382,7 +3383,9 @@ elseif ($id > 0 || ! empty($ref))
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
if ($user->societe_id > 0 && $user->societe_id != $object->socid) if ($user->societe_id > 0 && $user->societe_id != $object->socid)
accessforbidden('', 0); {
accessforbidden('', 0, 1);
}
$result = $object->fetch_thirdparty(); $result = $object->fetch_thirdparty();
@ -3803,6 +3806,13 @@ elseif ($id > 0 || ! empty($ref))
print '. '.$langs->trans("CreditNoteConvertedIntoDiscount", $object->getLibType(1), $discount->getNomUrl(1, 'discount')).'<br>'; print '. '.$langs->trans("CreditNoteConvertedIntoDiscount", $object->getLibType(1), $discount->getNomUrl(1, 'discount')).'<br>';
} }
} }
if ($object->fk_fac_rec_source > 0)
{
$tmptemplate = new FactureRec($db);
$result = $tmptemplate->fetch($object->fk_fac_rec_source);
if ($result > 0) print '. '.$langs->trans("GeneratedFromTemplate", $tmptemplate->ref);
}
print '</td></tr>'; print '</td></tr>';
// Relative and absolute discounts // Relative and absolute discounts
@ -4015,9 +4025,8 @@ elseif ($id > 0 || ! empty($ref))
print '</div>'; print '</div>';
print '<div class="fichehalfright">'; print '<div class="fichehalfright">';
print '<div class="ficheaddleft">'; print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield centpercent">'; print '<table class="border bordertop tableforfield centpercent">';
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
{ {

View File

@ -349,7 +349,7 @@ class Facture extends CommonInvoice
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
$_facrec = new FactureRec($this->db); $_facrec = new FactureRec($this->db);
$result=$_facrec->fetch($this->fac_rec); $result=$_facrec->fetch($this->fac_rec);
$result=$_facrec->fetchObjectLinked(); // This load $_facrec->linkedObjectsIds $result=$_facrec->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0); // This load $_facrec->linkedObjectsIds
// Define some dates // Define some dates
$originaldatewhen = $_facrec->date_when; $originaldatewhen = $_facrec->date_when;
@ -392,6 +392,8 @@ class Facture extends CommonInvoice
$this->brouillon = 1; $this->brouillon = 1;
$this->linked_objects = $_facrec->linkedObjectsIds; $this->linked_objects = $_facrec->linkedObjectsIds;
// We do not add link to template invoice or next invoice will be linked to all generated invoices
//$this->linked_objects['facturerec'][0] = $this->fac_rec;
$forceduedate = $this->calculate_date_lim_reglement(); $forceduedate = $this->calculate_date_lim_reglement();
@ -436,7 +438,6 @@ class Facture extends CommonInvoice
//var_dump($substitutionarray);exit; //var_dump($substitutionarray);exit;
$substitutionisok=true;
complete_substitutions_array($substitutionarray, $outputlangs); complete_substitutions_array($substitutionarray, $outputlangs);
$this->note_public=make_substitutions($this->note_public, $substitutionarray); $this->note_public=make_substitutions($this->note_public, $substitutionarray);
@ -564,7 +565,7 @@ class Facture extends CommonInvoice
require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
$exp = new Expedition($this->db); $exp = new Expedition($this->db);
$exp->fetch($this->origin_id); $exp->fetch($this->origin_id);
$exp->fetchObjectLinked(); $exp->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0);
if (count($exp->linkedObjectsIds['commande']) > 0) if (count($exp->linkedObjectsIds['commande']) > 0)
{ {
foreach ($exp->linkedObjectsIds['commande'] as $key => $value) foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
@ -1202,7 +1203,7 @@ class Facture extends CommonInvoice
*/ */
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $addlinktonotes = 0, $save_lastsearch_value = -1, $target = '') public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $addlinktonotes = 0, $save_lastsearch_value = -1, $target = '')
{ {
global $langs, $conf, $user, $form; global $langs, $conf, $user;
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
@ -1224,7 +1225,7 @@ class Facture extends CommonInvoice
if ($short) return $url; if ($short) return $url;
$picto='bill'; $picto=$this->picto;
if ($this->type == self::TYPE_REPLACEMENT) $picto.='r'; // Replacement invoice if ($this->type == self::TYPE_REPLACEMENT) $picto.='r'; // Replacement invoice
if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note
if ($this->type == self::TYPE_DEPOSIT) $picto.='d'; // Deposit invoice if ($this->type == self::TYPE_DEPOSIT) $picto.='d'; // Deposit invoice
@ -1240,6 +1241,8 @@ class Facture extends CommonInvoice
$label .= '<br><b>'.$langs->trans('Ref') . ':</b> ' . $this->ref; $label .= '<br><b>'.$langs->trans('Ref') . ':</b> ' . $this->ref;
if (! empty($this->ref_client)) if (! empty($this->ref_client))
$label .= '<br><b>' . $langs->trans('RefCustomer') . ':</b> ' . $this->ref_client; $label .= '<br><b>' . $langs->trans('RefCustomer') . ':</b> ' . $this->ref_client;
if (! empty($this->date))
$label .= '<br><b>' . $langs->trans('Date') . ':</b> ' . dol_print_date($this->date, 'day');
if (! empty($this->total_ht)) if (! empty($this->total_ht))
$label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); $label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_tva)) if (! empty($this->total_tva))
@ -1323,7 +1326,7 @@ class Facture extends CommonInvoice
$sql.= ', f.date_valid as datev'; $sql.= ', f.date_valid as datev';
$sql.= ', f.tms as datem'; $sql.= ', f.tms as datem';
$sql.= ', f.note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf, f.last_main_doc'; $sql.= ', f.note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf, f.last_main_doc';
$sql.= ', f.fk_facture_source'; $sql.= ', f.fk_facture_source, f.fk_fac_rec_source';
$sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet as fk_project, f.extraparams'; $sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet as fk_project, f.extraparams';
$sql.= ', f.situation_cycle_ref, f.situation_counter, f.situation_final'; $sql.= ', f.situation_cycle_ref, f.situation_counter, f.situation_final';
$sql.= ', f.fk_account'; $sql.= ', f.fk_account';
@ -1391,6 +1394,7 @@ class Facture extends CommonInvoice
$this->fk_account = ($obj->fk_account>0)?$obj->fk_account:null; $this->fk_account = ($obj->fk_account>0)?$obj->fk_account:null;
$this->fk_project = $obj->fk_project; $this->fk_project = $obj->fk_project;
$this->fk_facture_source = $obj->fk_facture_source; $this->fk_facture_source = $obj->fk_facture_source;
$this->fk_fac_rec_source = $obj->fk_fac_rec_source;
$this->note = $obj->note_private; // deprecated $this->note = $obj->note_private; // deprecated
$this->note_private = $obj->note_private; $this->note_private = $obj->note_private;
$this->note_public = $obj->note_public; $this->note_public = $obj->note_public;
@ -2284,7 +2288,7 @@ class Facture extends CommonInvoice
// Controle que facture source connue // Controle que facture source connue
if ($this->fk_facture_source <= 0) if ($this->fk_facture_source <= 0)
{ {
$this->error=$langs->trans("ErrorFieldRequired", $langs->trans("InvoiceReplacement")); $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceReplacement"));
$this->db->rollback(); $this->db->rollback();
return -10; return -10;
} }
@ -3133,7 +3137,13 @@ class Facture extends CommonInvoice
// phpcs:enable // phpcs:enable
global $mysoc,$user; global $mysoc,$user;
include_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php'; // Progress should never be changed for discount lines
if (($line->info_bits & 2) == 2)
{
return;
}
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Cap percentages to 100 // Cap percentages to 100
if ($percent > 100) $percent = 100; if ($percent > 100) $percent = 100;
@ -3149,7 +3159,6 @@ class Facture extends CommonInvoice
$line->multicurrency_total_ttc = $tabprice[18]; $line->multicurrency_total_ttc = $tabprice[18];
$line->update($user); $line->update($user);
$this->update_price(1); $this->update_price(1);
$this->db->commit();
} }
/** /**
@ -4597,6 +4606,7 @@ class FactureLigne extends CommonInvoiceLine
if ($result <= 0) if ($result <= 0)
{ {
$this->error='ErrorProductIdDoesNotExists'; $this->error='ErrorProductIdDoesNotExists';
dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }

View File

@ -47,10 +47,31 @@ foreach($linkedObjectBlock as $key => $objectlink)
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
?> ?>
<tr class="<?php echo $trclass; ?>" data-element="<?php echo $objectlink->element; ?>" data-id="<?php echo $objectlink->id; ?>" > <tr class="<?php echo $trclass; ?>" data-element="<?php echo $objectlink->element; ?>" data-id="<?php echo $objectlink->id; ?>" >
<td class="linkedcol-element"><?php echo $langs->trans("CustomerInvoice"); ?></td> <td class="linkedcol-element"><?php
switch ($objectlink->type) {
case Facture::TYPE_REPLACEMENT:
echo $langs->trans("InvoiceReplacement");
break;
case Facture::TYPE_CREDIT_NOTE:
echo $langs->trans("InvoiceAvoir");
break;
case Facture::TYPE_DEPOSIT:
echo $langs->trans("InvoiceDeposit");
break;
case Facture::TYPE_PROFORMA:
echo $langs->trans("InvoiceProForma");
break;
case Facture::TYPE_SITUATION:
echo $langs->trans("InvoiceSituation");
break;
default:
echo $langs->trans("CustomerInvoice");
break;
}
?></td>
<td class="linkedcol-name"><?php echo $objectlink->getNomUrl(1); ?></td> <td class="linkedcol-name"><?php echo $objectlink->getNomUrl(1); ?></td>
<td class="linkedcol-ref" align="center"><?php echo $objectlink->ref_client; ?></td> <td class="linkedcol-ref left"><?php echo $objectlink->ref_client; ?></td>
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td> <td class="linkedcol-date center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td>
<td class="linkedcol-amount right"><?php <td class="linkedcol-amount right"><?php
if ($user->rights->facture->lire) { if ($user->rights->facture->lire) {
$sign = 1; $sign = 1;
@ -76,8 +97,8 @@ if (count($linkedObjectBlock) > 1)
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':''); ?>"> <tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':''); ?>">
<td><?php echo $langs->trans("Total"); ?></td> <td><?php echo $langs->trans("Total"); ?></td>
<td></td> <td></td>
<td align="center"></td> <td class="center"></td>
<td align="center"></td> <td class="center"></td>
<td class="right"><?php echo price($total); ?></td> <td class="right"><?php echo price($total); ?></td>
<td class="right"></td> <td class="right"></td>
<td class="right"></td> <td class="right"></td>

View File

@ -351,6 +351,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("BoxTitleLastCustomerBills", $max).'</th>'; print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("BoxTitleLastCustomerBills", $max).'</th>';
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<th class="right">'.$langs->trans("AmountHT").'</th>'; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<th class="right">'.$langs->trans("AmountHT").'</th>';
@ -428,7 +429,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++;
print '<tr class="oddeven"><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>'; print '<tr class="oddeven"><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
} }
print '</table><br>'; print '</table></div><br>';
$db->free($resql); $db->free($resql);
} }
else else
@ -472,6 +473,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("BoxTitleLastSupplierBills", $max).'</th>'; print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("BoxTitleLastSupplierBills", $max).'</th>';
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<th class="right">'.$langs->trans("AmountHT").'</th>'; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<th class="right">'.$langs->trans("AmountHT").'</th>';
@ -524,7 +526,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++;
print '<tr class="oddeven"><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>'; print '<tr class="oddeven"><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
} }
print '</table><br>'; print '</table></div><br>';
} }
else else
{ {
@ -561,6 +563,7 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire)
$i = 0; $i = 0;
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<th>'.$langs->trans("BoxTitleLastModifiedDonations", $max).'</th>'; print '<th>'.$langs->trans("BoxTitleLastModifiedDonations", $max).'</th>';
@ -600,7 +603,7 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire)
{ {
print '<tr class="oddeven"><td colspan="4" class="opacitymedium">'.$langs->trans("None").'</td></tr>'; print '<tr class="oddeven"><td colspan="4" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
} }
print '</table><br>'; print '</table></div><br>';
} }
else dol_print_error($db); else dol_print_error($db);
} }
@ -634,6 +637,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<th>'.$langs->trans("ContributionsToPay").($num?' <a href="'.DOL_URL_ROOT.'/compta/sociales/list.php?status=0"><span class="badge">'.$num.'</span></a>':'').'</th>'; print '<th>'.$langs->trans("ContributionsToPay").($num?' <a href="'.DOL_URL_ROOT.'/compta/sociales/list.php?status=0"><span class="badge">'.$num.'</span></a>':'').'</th>';
@ -676,7 +680,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
{ {
print '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>'; print '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
} }
print "</table><br>"; print "</table></div><br>";
$db->free($resql); $db->free($resql);
} }
else else
@ -726,6 +730,8 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
if ($num) if ($num)
{ {
$i = 0; $i = 0;
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print '<th colspan="2">'.$langs->trans("OrdersDeliveredToBill").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut=3&amp;billed=0"><span class="badge">'.$num.'</span></a></th>'; print '<th colspan="2">'.$langs->trans("OrdersDeliveredToBill").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut=3&amp;billed=0"><span class="badge">'.$num.'</span></a></th>';
@ -795,7 +801,7 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
print '<td class="right">'.price($tot_tobill).'</td>'; print '<td class="right">'.price($tot_tobill).'</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '</tr>'; print '</tr>';
print '</table><br>'; print '</table></div><br>';
} }
$db->free($resql); $db->free($resql);
} }
@ -1053,6 +1059,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
$resql = 0; $resql = 0;
if ($resql) if ($resql)
{ {
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><thcolspan="2">'.$langs->trans("TasksToDo").'</th>'; print '<tr class="liste_titre"><thcolspan="2">'.$langs->trans("TasksToDo").'</th>';
print "</tr>\n"; print "</tr>\n";
@ -1067,7 +1074,7 @@ if ($resql)
$i++; $i++;
} }
$db->free($resql); $db->free($resql);
print "</table><br>"; print "</table></div><br>";
} }

View File

@ -848,7 +848,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
*/ */
if (! GETPOST('action', 'aZ09')) if (! GETPOST('action', 'aZ09'))
{ {
if ($page == -1) $page = 0 ; if (empty($page) || $page == -1) $page = 0;
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$offset = $limit * $page ; $offset = $limit * $page ;

View File

@ -59,7 +59,7 @@ if ($action == 'confirm_rejet')
if (empty($daterej)) if (empty($daterej))
{ {
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
} }
elseif ($daterej > dol_now()) elseif ($daterej > dol_now())

View File

@ -602,6 +602,8 @@ if ($id > 0)
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $total = 0; $i = 0; $total = 0;
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder paymenttable">'; print '<table class="noborder paymenttable">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("RefPayment").'</td>'; print '<td>'.$langs->trans("RefPayment").'</td>';
@ -668,6 +670,8 @@ if ($id > 0)
print '<td class="right'.($resteapayer?' amountremaintopay':(' '.$cssforamountpaymentcomplete)).'">'.price($resteapayer)."</td></tr>\n"; print '<td class="right'.($resteapayer?' amountremaintopay':(' '.$cssforamountpaymentcomplete)).'">'.price($resteapayer)."</td></tr>\n";
print "</table>"; print "</table>";
print '</div>';
$db->free($resql); $db->free($resql);
} }
else else

View File

@ -55,7 +55,7 @@ $result = restrictedArea($user, 'tax', $id, 'chargesociales', 'charges');
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int'); $page = GETPOST("page", 'int');
if ($page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;
} }
$offset = $conf->liste_limit * $page; $offset = $conf->liste_limit * $page;

View File

@ -318,7 +318,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
$case = dol_print_date(dol_mktime(1, 1, 1, $mois_modulo, 1, $annee_decalage), "%Y-%m"); $case = dol_print_date(dol_mktime(1, 1, 1, $mois_modulo, 1, $annee_decalage), "%Y-%m");
$caseprev = dol_print_date(dol_mktime(1, 1, 1, $mois_modulo, 1, $annee_decalage-1), "%Y-%m"); $caseprev = dol_print_date(dol_mktime(1, 1, 1, $mois_modulo, 1, $annee_decalage-1), "%Y-%m");
if ($annee >= $year_start) if ($annee >= $year_start) // We ignore $annee < $year_start, we loop on it to be able to make delta, nothing is output.
{ {
if ($modecompta == 'CREANCES-DETTES') { if ($modecompta == 'CREANCES-DETTES') {
// Valeur CA du mois w/o VAT // Valeur CA du mois w/o VAT
@ -386,11 +386,12 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
else { print '&nbsp;'; } else { print '&nbsp;'; }
print '</td>'; print '</td>';
} }
if ($annee_decalage != $year_end) print '<td width="15">&nbsp;</td>';
if ($annee_decalage < $year_end || ($annee_decalage == $year_end && $mois > 12 && $annee < $year_end)) print '<td width="15">&nbsp;</td>';
} }
$total_ht[$annee]+=!empty($cum_ht[$case]) ? $cum_ht[$case] : 0; $total_ht[$annee] += ((! empty($cum_ht[$case])) ? $cum_ht[$case] : 0);
$total[$annee]+=$cum[$case]; $total[$annee] += $cum[$case];
} }
print '</tr>'; print '</tr>';

View File

@ -56,9 +56,10 @@ $result = restrictedArea($user, 'tax', $id, 'vat', 'charges');
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int'); $page = GETPOST("page", 'int');
if ($page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;
} }
$offset = $conf->liste_limit * $page; $offset = $conf->liste_limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;

View File

@ -146,11 +146,20 @@ $dolibarr_main_db_character_set='utf8';
// Database character set used to sort data (forced during database creation. value of database is then used). // Database character set used to sort data (forced during database creation. value of database is then used).
// Default value: depends on database driver // Default value: depends on database driver
// Examples: // Examples:
// dolibarr_main_db_collation='utf8_unicode_ci'; // $dolibarr_main_db_collation='utf8_unicode_ci';
// //
$dolibarr_main_db_collation='utf8_unicode_ci'; $dolibarr_main_db_collation='utf8_unicode_ci';
// dolibarr_main_instance_unique_id
// An ID that is unique for each installation.
// Default value: randomly defined during installation
// Examples:
// $dolibarr_main_instance_unique_id='84b5bc91f83b56e458db71e0adac2b62';
//
$dolibarr_main_instance_unique_id='84b5bc91f83b56e458db71e0adac2b62';
//################## //##################
// Login // Login
@ -159,18 +168,18 @@ $dolibarr_main_db_collation='utf8_unicode_ci';
// dolibarr_main_authentication // dolibarr_main_authentication
// This parameter contains the way authentication is done. // This parameter contains the way authentication is done.
// If value "ldap" is used, you must also set parameters dolibarr_main_auth_ldap_* // If value "ldap" is used, you must also set parameters dolibarr_main_auth_ldap_*
// Default value: dolibarr // Default value: 'dolibarr'
// Possible values: Any values found in files in htdocs/core/login directory after // Possible values: Any values found in files in htdocs/core/login directory after
// the "function_" string and before the ".php" string. You can also separate several // the "function_" string and before the ".php" string. You can also separate several
// values using a ",". In this case, Dolibarr will check login/pass for each value in // values using a ",". In this case, Dolibarr will check login/pass for each value in
// order defined into value. However, note that this can't work with all values. // order defined into value. However, note that this can't work with all values.
// Examples: // Examples:
// $dolibarr_main_authentication='http'; // $dolibarr_main_authentication='dolibarr'; // Use the password defined into application on user record.
// $dolibarr_main_authentication='dolibarr'; // $dolibarr_main_authentication='http'; // Use the HTTP Basic authentication
// $dolibarr_main_authentication='ldap'; // $dolibarr_main_authentication='ldap'; // Check the password into a LDAP server
// $dolibarr_main_authentication='openid,dolibarr'; // $dolibarr_main_authentication='ldap,dolibarr'; // You can set several mode using a comma as a separator.
// $dolibarr_main_authentication='forceuser'; // Add also $dolibarr_auto_user='loginforuser'; // $dolibarr_main_authentication='forceuser'; // This need to add also $dolibarr_auto_user='loginforuser';
// $dolibarr_main_authentication='twofactor'; // To use Google Authenticator. This need the non official external module "Two Factor" available on www.dolistore.com
// //
$dolibarr_main_authentication='dolibarr'; $dolibarr_main_authentication='dolibarr';

View File

@ -376,21 +376,24 @@ if (empty($reshook))
$ret = $extrafields->setOptionalsFromPost($extralabels, $object); $ret = $extrafields->setOptionalsFromPost($extralabels, $object);
if ($ret < 0) $error++; if ($ret < 0) $error++;
$result = $object->update($contactid, $user); if (! $error)
if ($result > 0) {
// Categories association
$categories = GETPOST('contcats', 'array');
$object->setCategories($categories);
$object->old_lastname='';
$object->old_firstname='';
$action = 'view';
}
else
{ {
setEventMessages($object->error, $object->errors, 'errors'); $result = $object->update($contactid, $user);
$action = 'edit';
if ($result > 0) {
// Categories association
$categories = GETPOST('contcats', 'array');
$object->setCategories($categories);
$object->old_lastname='';
$object->old_firstname='';
$action = 'view';
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
$action = 'edit';
}
} }
} }
@ -505,7 +508,7 @@ else
$linkback=''; $linkback='';
print load_fiche_titre($title, $linkback, 'title_companies.png'); print load_fiche_titre($title, $linkback, 'title_companies.png');
// Affiche les erreurs // Show errors
dol_htmloutput_errors(is_numeric($error)?'':$error, $errors); dol_htmloutput_errors(is_numeric($error)?'':$error, $errors);
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
@ -800,8 +803,8 @@ else
$objsoc = new Societe($db); $objsoc = new Societe($db);
$objsoc->fetch($object->socid); $objsoc->fetch($object->socid);
// Affiche les erreurs // Show errors
dol_htmloutput_errors($error, $errors); dol_htmloutput_errors(is_numeric($error)?'':$error, $errors);
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
@ -1122,11 +1125,10 @@ else
{ {
$objsoc = new Societe($db); $objsoc = new Societe($db);
/* // View mode
* Fiche en mode visualisation
*/
dol_htmloutput_errors($error, $errors); // Show errors
dol_htmloutput_errors(is_numeric($error)?'':$error, $errors);
dol_fiche_head($head, 'card', $title, -1, 'contact'); dol_fiche_head($head, 'card', $title, -1, 'contact');

View File

@ -2139,22 +2139,22 @@ else
{ {
if ($user->rights->contrat->activer) if ($user->rights->contrat->activer)
{ {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=activate">'.$langs->trans("ActivateAllContracts").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" id="btnactivateall" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=activate">'.$langs->trans("ActivateAllContracts").'</a></div>';
} }
else else
{ {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("ActivateAllContracts").'</a></div>'; print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" id="btnactivateall" href="#">'.$langs->trans("ActivateAllContracts").'</a></div>';
} }
} }
if ($object->nbofservicesclosed < $nbofservices) if ($object->nbofservicesclosed < $nbofservices)
{ {
if ($user->rights->contrat->desactiver) if ($user->rights->contrat->desactiver)
{ {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=close">'.$langs->trans("CloseAllContracts").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" id="btncloseall" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=close">'.$langs->trans("CloseAllContracts").'</a></div>';
} }
else else
{ {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CloseAllContracts").'</a></div>'; print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" id="btncloseall" href="#">'.$langs->trans("CloseAllContracts").'</a></div>';
} }
//if (! $numactive) //if (! $numactive)

View File

@ -878,14 +878,14 @@ class Contrat extends CommonObject
if ($this->commercial_signature_id <= 0) if ($this->commercial_signature_id <= 0)
{ {
$langs->load("commercial"); $langs->load("commercial");
$this->error.=$langs->trans("ErrorFieldRequired", $langs->trans("SalesRepresentativeSignature")); $this->error.=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("SalesRepresentativeSignature"));
$paramsok=0; $paramsok=0;
} }
if ($this->commercial_suivi_id <= 0) if ($this->commercial_suivi_id <= 0)
{ {
$langs->load("commercial"); $langs->load("commercial");
$this->error.=($this->error?"<br>":''); $this->error.=($this->error?"<br>":'');
$this->error.=$langs->trans("ErrorFieldRequired", $langs->trans("SalesRepresentativeFollowUp")); $this->error.=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("SalesRepresentativeFollowUp"));
$paramsok=0; $paramsok=0;
} }
if (! $paramsok) return -1; if (! $paramsok) return -1;
@ -1752,7 +1752,6 @@ class Contrat extends CommonObject
if ($this->statut >= 0) if ($this->statut >= 0)
{ {
// Call trigger // Call trigger
$result=$this->call_trigger('LINECONTRACT_DELETE', $user); $result=$this->call_trigger('LINECONTRACT_DELETE', $user);
if ($result < 0) return -1; if ($result < 0) return -1;
@ -1760,10 +1759,10 @@ class Contrat extends CommonObject
$this->db->begin(); $this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."contratdet"; $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element_line;
$sql.= " WHERE rowid=".$idline; $sql.= " WHERE rowid=".$idline;
dol_syslog(get_class($this)."::delete", LOG_DEBUG); dol_syslog(get_class($this)."::deleteline", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) if (! $resql)
{ {
@ -1781,7 +1780,7 @@ class Contrat extends CommonObject
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
$this->error="Error ".get_class($this)."::delete deleteExtraFields error -4 ".$contractline->error; $this->error="Error ".get_class($this)."::deleteline deleteExtraFields error -4 ".$contractline->error;
} }
} }
} }
@ -1790,7 +1789,7 @@ class Contrat extends CommonObject
$this->db->commit(); $this->db->commit();
return 1; return 1;
} else { } else {
dol_syslog(get_class($this)."::delete ERROR:".$this->error, LOG_ERR); dol_syslog(get_class($this)."::deleteline ERROR:".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }

View File

@ -195,8 +195,45 @@ if ($action == 'confirm_delete' && ! empty($permissiontodelete))
} }
} }
// Remove a line
if ($action == 'confirm_deleteline' && $confirm == 'yes' && ! empty($permissiontoadd))
{
$result = $object->deleteline($user, $lineid);
if ($result > 0)
{
// Define output language
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09'))
{
$newlang = GETPOST('lang_id', 'aZ09');
}
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && is_object($object->thirdparty))
{
$newlang = $object->thirdparty->default_lang;
}
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$ret = $object->fetch($object->id); // Reload to get new records
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
setEventMessages($langs->trans('RecordDeleted'), null, 'mesgs');
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
// Action clone object // Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd) if ($action == 'confirm_clone' && $confirm == 'yes' && ! empty($permissiontoadd))
{ {
if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
{ {
@ -207,7 +244,6 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd)
$objectutil = dol_clone($object, 1); // To avoid to denaturate loaded object when setting some properties for clone or if createFromClone modifies the object. We use native clone to keep this->db valid. $objectutil = dol_clone($object, 1); // To avoid to denaturate loaded object when setting some properties for clone or if createFromClone modifies the object. We use native clone to keep this->db valid.
//$objectutil->date = dol_mktime(12, 0, 0, GETPOST('newdatemonth', 'int'), GETPOST('newdateday', 'int'), GETPOST('newdateyear', 'int')); //$objectutil->date = dol_mktime(12, 0, 0, GETPOST('newdatemonth', 'int'), GETPOST('newdateday', 'int'), GETPOST('newdateyear', 'int'));
// ... // ...
$result=$objectutil->createFromClone($user, (($object->id > 0) ? $object->id : $id)); $result=$objectutil->createFromClone($user, (($object->id > 0) ? $object->id : $id));
if (is_object($result) || $result > 0) if (is_object($result) || $result > 0)
{ {

View File

@ -32,8 +32,8 @@ if (($id > 0 || (! empty($ref) && ! in_array($action, array('create', 'createtas
{ {
if (($id > 0 && is_numeric($id)) || ! empty($ref)) // To discard case when id is list of ids like '1,2,3...' if (($id > 0 && is_numeric($id)) || ! empty($ref)) // To discard case when id is list of ids like '1,2,3...'
{ {
$ret = $object->fetch($id, $ref); $ret = $object->fetch($id, $ref);
if ($ret > 0) if ($ret > 0)
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$id = $object->id; $id = $object->id;

View File

@ -33,6 +33,7 @@
// $permtoread, $permtocreate and $permtodelete may be defined // $permtoread, $permtocreate and $permtodelete may be defined
// $uploaddir may be defined (example to $conf->projet->dir_output."/";) // $uploaddir may be defined (example to $conf->projet->dir_output."/";)
// $toselect may be defined // $toselect may be defined
// $diroutputmassaction may be defined
// Protection // Protection
@ -45,7 +46,7 @@ if (empty($objectclass) || empty($uploaddir))
// Mass actions. Controls on number of lines checked. // Mass actions. Controls on number of lines checked.
$maxformassaction=(empty($conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS)?1000:$conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS); $maxformassaction=(empty($conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS)?1000:$conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS);
if (! empty($massaction) && count($toselect) < 1) if (! empty($massaction) && is_array($toselect) && count($toselect) < 1)
{ {
$error++; $error++;
setEventMessages($langs->trans("NoRecordSelected"), null, "warnings"); setEventMessages($langs->trans("NoRecordSelected"), null, "warnings");
@ -563,14 +564,16 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
$objecttmp->socid = $cmd->socid; $objecttmp->socid = $cmd->socid;
$objecttmp->type = Facture::TYPE_STANDARD; $objecttmp->type = Facture::TYPE_STANDARD;
$objecttmp->cond_reglement_id = $cmd->cond_reglement_id; $objecttmp->cond_reglement_id = $cmd->cond_reglement_id;
$objecttmp->mode_reglement_id = $cmd->mode_reglement_id; $objecttmp->mode_reglement_id = $cmd->mode_reglement_id;
$objecttmp->fk_project = $cmd->fk_project; $objecttmp->fk_project = $cmd->fk_project;
$objecttmp->multicurrency_code = $cmd->multicurrency_code;
if (empty($createbills_onebythird)) $objecttmp->ref_client = $cmd->ref_client;
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($datefacture)) if (empty($datefacture))
{ {
$datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y")); $datefacture = dol_now();
} }
$objecttmp->date = $datefacture; $objecttmp->date = $datefacture;
@ -1266,6 +1269,8 @@ if (! $error && $massaction == 'generate_doc' && $permtoread)
$parameters['toselect']=$toselect; $parameters['toselect']=$toselect;
$parameters['uploaddir']=$uploaddir; $parameters['uploaddir']=$uploaddir;
$parameters['massaction']=$massaction;
$parameters['diroutputmassaction']=$diroutputmassaction;
$reshook=$hookmanager->executeHooks('doMassActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('doMassActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');

View File

@ -20,6 +20,11 @@
* \file htdocs/core/ajax/row.php * \file htdocs/core/ajax/row.php
* \brief File to return Ajax response on Row move. * \brief File to return Ajax response on Row move.
* This ajax page is called when doing an up or down drag and drop. * This ajax page is called when doing an up or down drag and drop.
* Parameters:
* roworder (Example: '1,3,2,4'),
* table_element_line (Example: 'commandedet')
* fk_element (Example: 'fk_order')
* element_id (Example: 1)
*/ */
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disable token renewal if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disable token renewal

View File

@ -506,7 +506,7 @@ class CMailFile
} }
$sendingmode = $this->sendmode; $sendingmode = $this->sendmode;
if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') if ($this->context == 'emailing' && ! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail')
{ {
// List of sending methods // List of sending methods
$listofmethods=array(); $listofmethods=array();

View File

@ -2443,8 +2443,9 @@ abstract class CommonObject
*/ */
public function updateRangOfLine($rowid, $rang) public function updateRangOfLine($rowid, $rang)
{ {
$fieldposition = 'rang'; $fieldposition = 'rang'; // @TODO Rename 'rang' and 'position' into 'rank'
if (in_array($this->table_element_line, array('ecm_files', 'emailcollector_emailcollectoraction'))) $fieldposition = 'position'; if (in_array($this->table_element_line, array('ecm_files', 'emailcollector_emailcollectoraction'))) $fieldposition = 'position';
if (in_array($this->table_element_line, array('bom_bomline'))) $fieldposition = 'rank';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET '.$fieldposition.' = '.$rang; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET '.$fieldposition.' = '.$rang;
$sql.= ' WHERE rowid = '.$rowid; $sql.= ' WHERE rowid = '.$rowid;
@ -3860,9 +3861,10 @@ abstract class CommonObject
* @param int $dateSelector 1=Show also date range input fields * @param int $dateSelector 1=Show also date range input fields
* @param Societe $seller Object thirdparty who sell * @param Societe $seller Object thirdparty who sell
* @param Societe $buyer Object thirdparty who buy * @param Societe $buyer Object thirdparty who buy
* @param string $defaulttpldir Directory where to find the template
* @return void * @return void
*/ */
public function formAddObjectLine($dateSelector, $seller, $buyer) public function formAddObjectLine($dateSelector, $seller, $buyer, $defaulttpldir = '/core/tpl')
{ {
global $conf,$user,$langs,$object,$hookmanager; global $conf,$user,$langs,$object,$hookmanager;
global $form,$bcnd,$var; global $form,$bcnd,$var;
@ -3874,10 +3876,18 @@ abstract class CommonObject
// Output template part (modules that overwrite templates must declare this into descriptor) // Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer // Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); $dirtpls=array_merge($conf->modules_parts['tpl'], array($defaulttpldir));
foreach($dirtpls as $reldir) foreach($dirtpls as $module => $reldir)
{ {
$tpl = dol_buildpath($reldir.'/objectline_create.tpl.php'); if (!empty($module))
{
$tpl = dol_buildpath($reldir.'/objectline_create.tpl.php');
}
else
{
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_create.tpl.php';
}
if (empty($conf->file->strict_mode)) { if (empty($conf->file->strict_mode)) {
$res=@include $tpl; $res=@include $tpl;
} else { } else {
@ -3903,12 +3913,13 @@ abstract class CommonObject
* @param string $buyer Object of buyer third party * @param string $buyer Object of buyer third party
* @param int $selected Object line selected * @param int $selected Object line selected
* @param int $dateSelector 1=Show also date range input fields * @param int $dateSelector 1=Show also date range input fields
* @param string $defaulttpldir Directory where to find the template
* @return void * @return void
*/ */
public function printObjectLines($action, $seller, $buyer, $selected = 0, $dateSelector = 0) public function printObjectLines($action, $seller, $buyer, $selected = 0, $dateSelector = 0, $defaulttpldir = '/core/tpl')
{ {
global $conf, $hookmanager, $langs, $user; global $conf, $hookmanager, $langs, $user, $object, $form;
// TODO We should not use global var for this ! // TODO We should not use global var for this
global $inputalsopricewithtax, $usemargins, $disableedit, $disablemove, $disableremove, $outputalsopricetotalwithtax; global $inputalsopricewithtax, $usemargins, $disableedit, $disablemove, $disableremove, $outputalsopricetotalwithtax;
// Define usemargins // Define usemargins
@ -3926,90 +3937,26 @@ abstract class CommonObject
$reshook = $hookmanager->executeHooks('printObjectLineTitle', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('printObjectLineTitle', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) if (empty($reshook))
{ {
// Title line // Output template part (modules that overwrite templates must declare this into descriptor)
print "<thead>\n"; // Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'], array($defaulttpldir));
print '<tr class="liste_titre nodrag nodrop">'; foreach($dirtpls as $module => $reldir)
// Adds a line numbering column
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print '<td class="linecolnum center">&nbsp;</td>';
// Description
print '<td class="linecoldescription">'.$langs->trans('Description').'</td>';
if ($this->element == 'supplier_proposal' || $this->element == 'order_supplier' || $this->element == 'invoice_supplier')
{ {
print '<td class="linerefsupplier"><span id="title_fourn_ref">'.$langs->trans("SupplierRef").'</span></td>'; if (!empty($module))
}
// VAT
print '<td class="linecolvat right" style="width: 80px">'.$langs->trans('VAT').'</td>';
// Price HT
print '<td class="linecoluht right" style="width: 80px">'.$langs->trans('PriceUHT').'</td>';
// Multicurrency
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) print '<td class="linecoluht_currency right" style="width: 80px">'.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).'</td>';
if ($inputalsopricewithtax) print '<td class="right" style="width: 80px">'.$langs->trans('PriceUTTC').'</td>';
// Qty
print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
if($conf->global->PRODUCT_USE_UNITS)
{
print '<td class="linecoluseunit left">'.$langs->trans('Unit').'</td>';
}
// Reduction short
print '<td class="linecoldiscount right">'.$langs->trans('ReductionShort').'</td>';
// Fields for situation invoice
if ($this->situation_cycle_ref) {
print '<td class="linecolcycleref right">' . $langs->trans('Progress') . '</td>';
print '<td class="linecolcycleref2 right">' . $langs->trans('TotalHT100Short') . '</td>';
}
if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id))
{
if (!empty($user->rights->margins->creer))
{ {
if ($conf->global->MARGIN_TYPE == "1") $tpl = dol_buildpath($reldir.'/objectline_title.tpl.php');
print '<td class="linecolmargin1 margininfos right" style="width: 80px">'.$langs->trans('BuyingPrice').'</td>';
else
print '<td class="linecolmargin1 margininfos right" style="width: 80px">'.$langs->trans('CostPrice').'</td>';
} }
else
if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) {
print '<td class="linecolmargin2 margininfos right" style="width: 50px">'.$langs->trans('MarginRate').'</td>'; $tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_title.tpl.php';
if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) }
print '<td class="linecolmargin2 margininfos right" style="width: 50px">'.$langs->trans('MarkRate').'</td>'; if (empty($conf->file->strict_mode)) {
$res=@include $tpl;
} else {
$res=include $tpl; // for debug
}
if ($res) break;
} }
// Total HT
print '<td class="linecolht right">'.$langs->trans('TotalHTShort').'</td>';
// Multicurrency
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) print '<td class="linecoltotalht_currency right">'.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).'</td>';
if ($outputalsopricetotalwithtax) print '<td class="right" style="width: 80px">'.$langs->trans('TotalTTCShort').'</td>';
print '<td class="linecoledit"></td>'; // No width to allow autodim
print '<td class="linecoldelete" style="width: 10px"></td>';
print '<td class="linecolmove" style="width: 10px"></td>';
if($action == 'selectlines')
{
print '<td class="linecolcheckall center">';
print '<input type="checkbox" class="linecheckboxtoggle" />';
print '<script>$(document).ready(function() {$(".linecheckboxtoggle").click(function() {var checkBoxes = $(".linecheckbox");checkBoxes.prop("checked", this.checked);})});</script>';
print '</td>';
}
print "</tr>\n";
print "</thead>\n";
} }
$var = true; $var = true;
@ -4037,7 +3984,7 @@ abstract class CommonObject
} }
if (empty($reshook)) if (empty($reshook))
{ {
$this->printObjectLine($action, $line, $var, $num, $i, $dateSelector, $seller, $buyer, $selected, $extrafieldsline); $this->printObjectLine($action, $line, $var, $num, $i, $dateSelector, $seller, $buyer, $selected, $extrafieldsline, $defaulttpldir);
} }
$i++; $i++;
@ -4059,9 +4006,10 @@ abstract class CommonObject
* @param string $buyer Object of buyer third party * @param string $buyer Object of buyer third party
* @param int $selected Object line selected * @param int $selected Object line selected
* @param int $extrafieldsline Object of extrafield line attribute * @param int $extrafieldsline Object of extrafield line attribute
* @param string $defaulttpldir Directory where to find the template
* @return void * @return void
*/ */
public function printObjectLine($action, $line, $var, $num, $i, $dateSelector, $seller, $buyer, $selected = 0, $extrafieldsline = 0) public function printObjectLine($action, $line, $var, $num, $i, $dateSelector, $seller, $buyer, $selected = 0, $extrafieldsline = 0, $defaulttpldir = '/core/tpl')
{ {
global $conf,$langs,$user,$object,$hookmanager; global $conf,$langs,$user,$object,$hookmanager;
global $form,$bc,$bcdd; global $form,$bc,$bcdd;
@ -4095,7 +4043,7 @@ abstract class CommonObject
// Define output language and label // Define output language and label
if (! empty($conf->global->MAIN_MULTILANGS)) if (! empty($conf->global->MAIN_MULTILANGS))
{ {
if (! is_object($this->thirdparty)) if (property_exists($this, 'socid') && ! is_object($this->thirdparty))
{ {
dol_print_error('', 'Error: Method printObjectLine was called on an object and object->fetch_thirdparty was not done before'); dol_print_error('', 'Error: Method printObjectLine was called on an object and object->fetch_thirdparty was not done before');
return; return;
@ -4107,7 +4055,7 @@ abstract class CommonObject
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang='';
if (empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang=GETPOST('lang_id', 'aZ09'); if (empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang=GETPOST('lang_id', 'aZ09');
if (! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE) && empty($newlang)) $newlang=$this->thirdparty->default_lang; // For language to language of customer if (! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE) && empty($newlang) && is_object($this->thirdparty)) $newlang=$this->thirdparty->default_lang; // To use language of customer
if (! empty($newlang)) if (! empty($newlang))
{ {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
@ -4129,10 +4077,18 @@ abstract class CommonObject
// Output template part (modules that overwrite templates must declare this into descriptor) // Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer // Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); $dirtpls=array_merge($conf->modules_parts['tpl'], array($defaulttpldir));
foreach($dirtpls as $reldir) foreach($dirtpls as $module => $reldir)
{ {
$tpl = dol_buildpath($reldir.'/objectline_view.tpl.php'); if (!empty($module))
{
$tpl = dol_buildpath($reldir.'/objectline_view.tpl.php');
}
else
{
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_view.tpl.php';
}
if (empty($conf->file->strict_mode)) { if (empty($conf->file->strict_mode)) {
$res=@include $tpl; $res=@include $tpl;
} else { } else {
@ -4142,7 +4098,7 @@ abstract class CommonObject
} }
} }
// Ligne en mode update // Line in update mode
if ($this->statut == 0 && $action == 'editline' && $selected == $line->id) if ($this->statut == 0 && $action == 'editline' && $selected == $line->id)
{ {
$label = (! empty($line->label) ? $line->label : (($line->fk_product > 0) ? $line->product_label : '')); $label = (! empty($line->label) ? $line->label : (($line->fk_product > 0) ? $line->product_label : ''));
@ -4152,10 +4108,18 @@ abstract class CommonObject
// Output template part (modules that overwrite templates must declare this into descriptor) // Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer // Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); $dirtpls=array_merge($conf->modules_parts['tpl'], array($defaulttpldir));
foreach($dirtpls as $reldir) foreach($dirtpls as $module => $reldir)
{ {
$tpl = dol_buildpath($reldir.'/objectline_edit.tpl.php'); if (!empty($module))
{
$tpl = dol_buildpath($reldir.'/objectline_edit.tpl.php');
}
else
{
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_edit.tpl.php';
}
if (empty($conf->file->strict_mode)) { if (empty($conf->file->strict_mode)) {
$res=@include $tpl; $res=@include $tpl;
} else { } else {
@ -4231,9 +4195,10 @@ abstract class CommonObject
* @param CommonObjectLine $line Line * @param CommonObjectLine $line Line
* @param string $var Var * @param string $var Var
* @param string $restrictlist ''=All lines, 'services'=Restrict to services only (strike line if not) * @param string $restrictlist ''=All lines, 'services'=Restrict to services only (strike line if not)
* @param string $defaulttpldir Directory where to find the template
* @return void * @return void
*/ */
public function printOriginLine($line, $var, $restrictlist = '') public function printOriginLine($line, $var, $restrictlist = '', $defaulttpldir = '/core/tpl')
{ {
global $langs, $conf; global $langs, $conf;
@ -4354,10 +4319,18 @@ abstract class CommonObject
// Output template part (modules that overwrite templates must declare this into descriptor) // Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer // Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); $dirtpls=array_merge($conf->modules_parts['tpl'], array($defaulttpldir));
foreach($dirtpls as $reldir) foreach($dirtpls as $module => $reldir)
{ {
$tpl = dol_buildpath($reldir.'/originproductline.tpl.php'); if (!empty($module))
{
$tpl = dol_buildpath($reldir.'/originproductline.tpl.php');
}
else
{
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/originproductline.tpl.php';
}
if (empty($conf->file->strict_mode)) { if (empty($conf->file->strict_mode)) {
$res=@include $tpl; $res=@include $tpl;
} else { } else {
@ -6254,6 +6227,7 @@ abstract class CommonObject
$value=''; $value='';
if (is_array($value_arr) && count($value_arr)>0) if (is_array($value_arr) && count($value_arr)>0)
{ {
$toprint=array();
foreach ($value_arr as $keyval=>$valueval) { foreach ($value_arr as $keyval=>$valueval) {
$toprint[]='<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">'.$param['options'][$valueval].'</li>'; $toprint[]='<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">'.$param['options'][$valueval].'</li>';
} }
@ -7278,6 +7252,31 @@ abstract class CommonObject
if ($result < 0) $error++; if ($result < 0) $error++;
} }
// Create lines
if (! empty($this->table_element_line) && ! empty($this->fk_element))
{
$num=(is_array($this->lines) ? count($this->lines) : 0);
for ($i = 0; $i < $num; $i++)
{
$line = $this->lines[$i];
$keyforparent = $this->fk_element;
$line->$keyforparent = $this->id;
// Test and convert into object this->lines[$i]. When coming from REST API, we may still have an array
//if (! is_object($line)) $line=json_decode(json_encode($line), false); // convert recursively array into object.
if (! is_object($line)) $line = (object) $line;
$result = $line->create($user, 1);
if ($result < 0)
{
$this->error=$this->db->lasterror();
$this->db->rollback();
return -1;
}
}
}
// Triggers // Triggers
if (! $error && ! $notrigger) if (! $error && ! $notrigger)
{ {
@ -7341,6 +7340,56 @@ abstract class CommonObject
} }
} }
/**
* Load object in memory from the database
*
* @param string $morewhere More SQL filters (' AND ...')
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function fetchLinesCommon($morewhere = '')
{
$objectlineclassname = get_class($this).'Line';
if (! class_exists($objectlineclassname))
{
$this->error = 'Error, class '.$objectlineclassname.' not found during call of fetchLinesCommon';
return -1;
}
$objectline = new $objectlineclassname($this->db);
$sql = 'SELECT '.$objectline->getFieldList();
$sql.= ' FROM '.MAIN_DB_PREFIX.$objectline->table_element;
$sql.=' WHERE fk_'.$this->element.' = '.$this->id;
if ($morewhere) $sql.= $morewhere;
$resql = $this->db->query($sql);
if ($resql)
{
$num_rows = $this->db->num_rows($resql);
$i = 0;
while ($i < $num_rows)
{
$obj = $this->db->fetch_object($resql);
if ($obj)
{
$newline = new $objectlineclassname($this->db);
$newline->setVarsFromFetchObj($obj);
$this->lines[] = $newline;
}
$i++;
}
return 1;
}
else
{
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
return -1;
}
}
/** /**
* Update object into database * Update object into database
* *
@ -7512,6 +7561,66 @@ abstract class CommonObject
} }
} }
/**
* Delete a line of object in database
*
* @param User $user User that delete
* @param int $idline Id of line to delete
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int >0 if OK, <0 if KO
*/
public function deleteLineCommon(User $user, $idline, $notrigger = false)
{
global $conf;
$error=0;
$tmpforobjectclass = get_class($this);
$tmpforobjectlineclass = ucfirst($tmpforobjectclass).'Line';
// Call trigger
$result=$this->call_trigger('LINE'.strtoupper($tmpforobjectclass).'_DELETE', $user);
if ($result < 0) return -1;
// End call triggers
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element_line;
$sql.= " WHERE rowid=".$idline;
dol_syslog(get_class($this)."::deleteLineCommon", LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql)
{
$this->error="Error ".$this->db->lasterror();
$error++;
}
if (empty($error)) {
// Remove extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$tmpobjectline = new $tmpforobjectlineclass($this->db);
$tmpobjectline->id= $idline;
$result=$tmpobjectline->deleteExtraFields();
if ($result < 0)
{
$error++;
$this->error="Error ".get_class($this)."::deleteLineCommon deleteExtraFields error -4 ".$tmpobjectline->error;
}
}
}
if (empty($error)) {
$this->db->commit();
return 1;
} else {
dol_syslog(get_class($this)."::deleteLineCommon ERROR:".$this->error, LOG_ERR);
$this->db->rollback();
return -1;
}
}
/** /**
* Initialise object with example values * Initialise object with example values
* Id must be 0 if object instance is a specimen * Id must be 0 if object instance is a specimen

View File

@ -247,25 +247,20 @@ class Cstate // extends CommonObject
// } // }
//} //}
// Commit or rollback // Commit or rollback
if ($error) if ($error) {
{ foreach ($this->errors as $errmsg) {
foreach($this->errors as $errmsg) dol_syslog(get_class($this) . "::update " . $errmsg, LOG_ERR);
{ $this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); }
$this->error.=($this->error?', '.$errmsg:$errmsg); $this->db->rollback();
} return -1 * $error;
$this->db->rollback(); } else {
return -1*$error; $this->db->commit();
} return 1;
else }
{
$this->db->commit();
return 1;
}
} }
/** /**
* Delete object in database * Delete object in database
* *

View File

@ -1970,7 +1970,7 @@ class ExtraFields
public function setOptionalsFromPost($extralabels, &$object, $onlykey = '') public function setOptionalsFromPost($extralabels, &$object, $onlykey = '')
{ {
global $_POST, $langs; global $_POST, $langs;
$nofillrequired='';// For error when required field left blank $nofillrequired=0;// For error when required field left blank
$error_field_required = array(); $error_field_required = array();
if (is_array($this->attributes[$object->table_element]['label'])) $extralabels=$this->attributes[$object->table_element]['label']; if (is_array($this->attributes[$object->table_element]['label'])) $extralabels=$this->attributes[$object->table_element]['label'];
@ -2001,7 +2001,8 @@ class ExtraFields
if ($this->attributes[$object->table_element]['required'][$key]) // Value is required if ($this->attributes[$object->table_element]['required'][$key]) // Value is required
{ {
// Check if empty without using GETPOST, value can be alpha, int, array, etc... // Check if empty without using GETPOST, value can be alpha, int, array, etc...
if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $_POST["options_".$key] != '0') if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] != 'select' && $_POST["options_".$key] != '0')
|| (! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'select')
|| (is_array($_POST["options_".$key]) && empty($_POST["options_".$key]))) || (is_array($_POST["options_".$key]) && empty($_POST["options_".$key])))
{ {
//print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key]; //print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key];

View File

@ -165,11 +165,12 @@ class HookManager
'formattachOptions', 'formattachOptions',
'formBuilddocLineOptions', 'formBuilddocLineOptions',
'formatNotificationMessage', 'formatNotificationMessage',
'getFormMail', 'getAccessForbiddenMessage',
'getIdProfUrl',
'getDirList', 'getDirList',
'getFormatedCustomerRef', 'getFormMail',
'getFormatedCustomerRef',
'getFormatedSupplierRef', 'getFormatedSupplierRef',
'getIdProfUrl',
'moveUploadedFile', 'moveUploadedFile',
'moreHtmlStatus', 'moreHtmlStatus',
'pdf_build_address', 'pdf_build_address',

View File

@ -1914,6 +1914,16 @@ class Form
$selected_input_value=$producttmpselect->ref; $selected_input_value=$producttmpselect->ref;
unset($producttmpselect); unset($producttmpselect);
} }
// handle case where product or service module is disabled + no filter specified
if ($filtertype == '')
{
if (empty($conf->product->enabled)) { // when product module is disabled, show services only
$filtertype = 1;
}
elseif (empty($conf->service->enabled)) { // when service module is disabled, show products only
$filtertype = 0;
}
}
// mode=1 means customers products // mode=1 means customers products
$urloption='htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus; $urloption='htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus;
//Price by customer //Price by customer
@ -2165,7 +2175,14 @@ class Form
{ {
$sql.= " AND p.tosell = ".$status; $sql.= " AND p.tosell = ".$status;
} }
if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$filtertype; // Filter by product type
if (strval($filtertype) != '') $sql.= " AND p.fk_product_type = ".$filtertype;
elseif (empty($conf->product->enabled)) { // when product module is disabled, show services only
$sql.= " AND p.fk_product_type = 1";
}
elseif (empty($conf->service->enabled)) { // when service module is disabled, show products only
$sql.= " AND p.fk_product_type = 0";
}
// Add criteria on ref/label // Add criteria on ref/label
if ($filterkey != '') if ($filterkey != '')
{ {
@ -3649,9 +3666,10 @@ class Form
* @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. * @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
* @param string $moreattrib To add more attribute on select * @param string $moreattrib To add more attribute on select
* @param int $showcurrency Show currency in label * @param int $showcurrency Show currency in label
* @param string $morecss More CSS
* @return int <0 if error, Num of bank account found if OK (0, 1, 2, ...) * @return int <0 if error, Num of bank account found if OK (0, 1, 2, ...)
*/ */
public function select_comptes($selected = '', $htmlname = 'accountid', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0) public function select_comptes($selected = '', $htmlname = 'accountid', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0, $morecss = '')
{ {
// phpcs:enable // phpcs:enable
global $langs, $conf; global $langs, $conf;
@ -3674,7 +3692,7 @@ class Form
$i = 0; $i = 0;
if ($num) if ($num)
{ {
print '<select id="select'.$htmlname.'" class="flat selectbankaccount" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>'; print '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';
if ($useempty == 1 || ($useempty == 2 && $num > 1)) if ($useempty == 1 || ($useempty == 2 && $num > 1))
{ {
print '<option value="-1">&nbsp;</option>'; print '<option value="-1">&nbsp;</option>';

View File

@ -688,7 +688,9 @@ class FormFile
$out.= '<tr class="liste_titre">'; $out.= '<tr class="liste_titre">';
$addcolumforpicto=($delallowed || $printer || $morepicto); $addcolumforpicto=($delallowed || $printer || $morepicto);
$out.= '<th colspan="'.(3+($addcolumforpicto?1:0)).'" class="formdoc liste_titre maxwidthonsmartphone center">'; $colspan = (3+($addcolumforpicto?1:0)); $colspanmore = 0;
$out.= '<th colspan="'.$colspan.'" class="formdoc liste_titre maxwidthonsmartphone center">';
// Model // Model
if (! empty($modellist)) if (! empty($modellist))
@ -745,13 +747,17 @@ class FormFile
{ {
foreach($hookmanager->hooks['formfile'] as $module) foreach($hookmanager->hooks['formfile'] as $module)
{ {
if (method_exists($module, 'formBuilddocLineOptions')) $out .= '<th></th>'; if (method_exists($module, 'formBuilddocLineOptions'))
{
$colspanmore++;
$out .= '<th></th>';
}
} }
} }
$out.= '</tr>'; $out.= '</tr>';
// Execute hooks // Execute hooks
$parameters=array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''),'modulepart'=>$modulepart); $parameters=array('colspan'=>($colspan+$colspanmore), 'socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''), 'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''), 'modulepart'=>$modulepart);
if (is_object($hookmanager)) if (is_object($hookmanager))
{ {
$reshook = $hookmanager->executeHooks('formBuilddocOptions', $parameters, $GLOBALS['object']); $reshook = $hookmanager->executeHooks('formBuilddocOptions', $parameters, $GLOBALS['object']);
@ -801,9 +807,10 @@ class FormFile
// Show file name with link to download // Show file name with link to download
$out.= '<td class="minwidth200">'; $out.= '<td class="minwidth200">';
$out.= '<a class="documentdownload paddingright" href="'.$documenturl.'?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).($param?'&'.$param:'').'"'; $out.= '<a class="documentdownload paddingright" href="'.$documenturl.'?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).($param?'&'.$param:'').'"';
$mime=dol_mimetype($relativepath, '', 0); $mime=dol_mimetype($relativepath, '', 0);
if (preg_match('/text/', $mime)) $out.= ' target="_blank"'; if (preg_match('/text/', $mime)) $out.= ' target="_blank"';
$out.= ' target="_blank">'; $out.= '>';
$out.= img_mime($file["name"], $langs->trans("File").': '.$file["name"]); $out.= img_mime($file["name"], $langs->trans("File").': '.$file["name"]);
$out.= dol_trunc($file["name"], 150); $out.= dol_trunc($file["name"], 150);
$out.= '</a>'."\n"; $out.= '</a>'."\n";
@ -847,14 +854,17 @@ class FormFile
if (is_object($hookmanager)) if (is_object($hookmanager))
{ {
$parameters=array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''),'modulepart'=>$modulepart,'relativepath'=>$relativepath); $parameters=array('colspan'=>($colspan+$colspanmore), 'socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''),'modulepart'=>$modulepart,'relativepath'=>$relativepath);
$res = $hookmanager->executeHooks('formBuilddocLineOptions', $parameters, $file); $res = $hookmanager->executeHooks('formBuilddocLineOptions', $parameters, $file);
if (empty($res)) if (empty($res))
{ {
$out.= $hookmanager->resPrint; // Complete line $out.= $hookmanager->resPrint; // Complete line
$out.= '</tr>'; $out.= '</tr>';
} }
else $out = $hookmanager->resPrint; // Replace line else
{
$out = $hookmanager->resPrint; // Replace all $out
}
} }
} }

View File

@ -196,6 +196,7 @@ class Translate
$modulename = ''; $modulename = '';
// Search if a module directory name is provided into lang file name // Search if a module directory name is provided into lang file name
$regs=array();
if (preg_match('/^([^@]+)@([^@]+)$/i', $domain, $regs)) if (preg_match('/^([^@]+)@([^@]+)$/i', $domain, $regs))
{ {
$newdomain = $regs[1]; $newdomain = $regs[1];
@ -223,7 +224,7 @@ class Translate
return -1; return -1;
} }
foreach($this->dir as $keydir => $searchdir) foreach($this->dir as $searchdir)
{ {
// Directory of translation files // Directory of translation files
$file_lang = $searchdir.($modulename?'/'.$modulename:'')."/langs/".$langofdir."/".$newdomain.".lang"; $file_lang = $searchdir.($modulename?'/'.$modulename:'')."/langs/".$langofdir."/".$newdomain.".lang";

View File

@ -284,7 +284,7 @@ abstract class DoliDB implements Database
if ($string==0 || $string=="0000-00-00 00:00:00") return ''; if ($string==0 || $string=="0000-00-00 00:00:00") return '';
$string=preg_replace('/([^0-9])/i', '', $string); $string=preg_replace('/([^0-9])/i', '', $string);
$tmp=$string.'000000'; $tmp=$string.'000000';
$date=dol_mktime(substr($tmp, 8, 2), substr($tmp, 10, 2), substr($tmp, 12, 2), substr($tmp, 4, 2), substr($tmp, 6, 2), substr($tmp, 0, 4), $gm); $date=dol_mktime((int) substr($tmp, 8, 2), (int) substr($tmp, 10, 2), (int) substr($tmp, 12, 2), (int) substr($tmp, 4, 2), (int) substr($tmp, 6, 2), (int) substr($tmp, 0, 4), $gm);
return $date; return $date;
} }

View File

@ -684,6 +684,7 @@ class DoliDBMysqli extends DoliDB
// ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); // ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment');
$sql = "CREATE TABLE ".$table."("; $sql = "CREATE TABLE ".$table."(";
$i=0; $i=0;
$sqlfields=array();
foreach($fields as $field_name => $field_desc) foreach($fields as $field_name => $field_desc)
{ {
$sqlfields[$i] = $field_name." "; $sqlfields[$i] = $field_name." ";
@ -930,11 +931,17 @@ class DoliDBMysqli extends DoliDB
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING); dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING);
} }
} }
// Redo with localhost forced (sometimes user is created on %)
$sql = "CREATE USER '".$this->escape($dolibarr_main_db_user)."'@'localhost'";
$resql=$this->query($sql);
$sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'"; $sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'";
dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log
$resql=$this->query($sql); $resql=$this->query($sql);
if (! $resql) if (! $resql)
{ {
$this->error = "Connected user not allowed to GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '*****'";
return -1; return -1;
} }

View File

@ -841,10 +841,11 @@ function copyToClipboard(text,text2)
* @return boolean False * @return boolean False
* @see document_preview * @see document_preview
*/ */
function newpopup(url,title) { function newpopup(url, title) {
var argv = newpopup.arguments; var argv = newpopup.arguments;
var argc = newpopup.arguments.length; var argc = newpopup.arguments.length;
tmp=url; tmp=url;
console.log("newpopup "+argv[2]+" "+argv[3]);
var l = (argc > 2) ? argv[2] : 600; var l = (argc > 2) ? argv[2] : 600;
var h = (argc > 3) ? argv[3] : 400; var h = (argc > 3) ? argv[3] : 400;
var left = (screen.width - l)/2; var left = (screen.width - l)/2;

View File

@ -469,7 +469,7 @@ function actions_prepare_head($object)
$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=action&element_id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=action&element_id='.$object->id;
$listofresourcelinked = $resource->getElementResources($object->element, $object->id); $listofresourcelinked = $resource->getElementResources($object->element, $object->id);
$nbResources=count($listofresourcelinked); $nbResources=(is_array($listofresourcelinked)?count($listofresourcelinked):0);
$head[$h][1] = $langs->trans("Resources"); $head[$h][1] = $langs->trans("Resources");
if ($nbResources > 0) $head[$h][1].= ' <span class="badge">'.($nbResources).'</span>'; if ($nbResources > 0) $head[$h][1].= ' <span class="badge">'.($nbResources).'</span>';
$head[$h][2] = 'resources'; $head[$h][2] = 'resources';

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