diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000000..143f0739505 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,21 @@ +# EditorConfig is awesome: http://EditorConfig.org + +# top-most EditorConfig file +root = true +# Unix-style newlines with a newline ending every file +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +[*.php] +indent_style = space +indent_size = 4 +[*.js] +indent_style = space +indent_size = 2 +[*.css] +indent_style = space +indent_size = 2 +[*.xml] +indent_style = space +indent_size = 4 diff --git a/.gitignore b/.gitignore index 9b639ce64a6..20c87aa1e42 100755 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ htdocs/conf/conf.php htdocs/conf/conf.php.old documents/ -custom/ custom2/ test/report/ nbproject diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 73b43e95f4b..0ca95ace51d 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -5,12 +5,13 @@ imports: filter: excluded_paths: - - 'build/*' - - 'dev/*' - - 'doc/*' - - 'test/*' - - 'htdocs/includes/*' - paths: { } + - build/* + - dev/* + - doc/* + - test/* + paths: + - htdocs/* + - scripts/* tools: # php_analyzer. Doc on https://scrutinizer-ci.com/docs/tools/php/php-analyzer/ @@ -18,15 +19,18 @@ tools: enabled: true extensions: - php - dependency_paths: { } + dependency_paths: + - htdocs/includes/ filter: excluded_paths: - - 'build/*' - - 'dev/*' - - 'doc/*' - - 'test/*' - - 'htdocs/includes/*' - paths: { } + - build/* + - dev/* + - doc/* + - test/* + - htdocs/includes/* + paths: + - htdocs/ + - scripts/ config: parameter_reference_check: enabled: true @@ -180,8 +184,38 @@ tools: - 'htdocs/includes/*' paths: { } + php_changetracking: + enabled: false + bug_patterns: + - '\bfix(?:es|ed)?\b' + feature_patterns: + - '\badd(?:s|ed)?\b' + - '\bimplement(?:s|ed)?\b' + filter: + excluded_paths: + - 'build/*' + - 'dev/*' + - 'doc/*' + - 'test/*' + - 'htdocs/includes/*' + paths: { } + # Coding-Style / Bug Detection - js_hint: false + js_hint: + enabled: false + use_native_config: true + extensions: + - js + filter: + excluded_paths: + - 'build/*' + - 'dev/*' + - 'doc/*' + - 'test/*' + - 'htdocs/includes/*' + paths: { } + config: { } + path_configs: { } before_commands: { } diff --git a/.travis.yml b/.travis.yml index 548a8c53380..98ebd9ceea3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,10 +32,13 @@ before_script: # - echo Update composer # - ~/.phpenv/versions/$(phpenv version-name)/bin/composer.phar self-update - echo PHPUnit version + - which phpunit - phpunit --version - echo Install phpcs then show installed rules - pyrus install pear/PHP_CodeSniffer - phpenv rehash + - which phpcs + - phpcs --version - phpcs -i - echo Create dir $(pwd)/htdocs/documents - sudo mkdir -p $(pwd)/htdocs/documents/admin/temp; @@ -53,12 +56,14 @@ before_script: - sh -c "if [ '$PHPV' = '5.3' ]; then echo 'zend_extension_ts = xdebug.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi" - sh -c "if [ '$PHPV' = '5.4' ]; then echo 'zend_extension_ts = xdebug.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi" - cat ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini + - echo Mysql version + - mysql --version - echo Init database - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS myapp_test;' -U postgres; fi" - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE myapp_test;' -U postgres; fi" - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'DROP DATABASE IF EXISTS myapp_test;'; fi" - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE IF NOT EXISTS myapp_test;'; fi" - - sh -c "if [ '$DB' = 'mysql' ]; then mysql -D myapp_test < $(pwd)/dev/initdata/mysqldump_dolibarr_3.4.0.sql; fi" + - sh -c "if [ '$DB' = 'mysql' ]; then mysql -D myapp_test < $(pwd)/dev/initdata/mysqldump_dolibarr_3.5.0.sql; fi" - echo Create config file htdocs/conf/conf.php - echo ' htdocs/conf/conf.php - sh -c "if [ '$DB' = 'pgsql' ]; then echo '$'dolibarr_main_db_type=\'pgsql\'';' >> htdocs/conf/conf.php; fi" @@ -81,6 +86,8 @@ before_script: - sudo cat /etc/apache2/sites-available/default - sudo /etc/init.d/apache2 restart - wget http://localhost/ + - sudo cat /etc/apache2/envvars + - sudo cat /var/log/apache2/error.log - cat index.html @@ -88,20 +95,22 @@ before_script: script: - cd htdocs/install - date - - php upgrade.php 3.4.0 3.5.0 > upgrade.log - - php upgrade2.php 3.4.0 3.5.0 > upgrade2.log +# - php upgrade.php 3.4.0 3.5.0 > upgrade.log +# - php upgrade2.php 3.4.0 3.5.0 > upgrade2.log - php upgrade.php 3.5.0 3.6.0 >> upgrade.log - php upgrade2.php 3.5.0 3.6.0 >> upgrade2.log - php upgrade.php 3.6.0 3.7.0 >> upgrade.log -# - cat upgrade.log +# - cat upgrade360370.log - php upgrade2.php 3.6.0 3.7.0 >> upgrade2.log + - php upgrade.php 3.7.0 3.8.0 >> upgrade.log + - php upgrade2.php 3.7.0 3.8.0 >> upgrade2.log # - cat upgrade2.log - cd ../.. - date - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php - date # - phpcs -p --warning-severity=0 -s --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/dev/vagrant/,/documents/,/includes/,/test/report/ htdocs/core/class/dolgraph.class.php 2>&1 - - phpcs -p --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/dev/vagrant/,/documents/,/includes/,/test/report/ . 2>&1 + - phpcs -p --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/htdocs/conf/conf.php,/build/html/,/dev/vagrant/,/documents/,/includes/,/test/report/ . 2>&1 - date after_script: diff --git a/.tx/config b/.tx/config index fcd276390ee..e4d1fc65732 100644 --- a/.tx/config +++ b/.tx/config @@ -2,6 +2,12 @@ host = https://www.transifex.com lang_map = uz: uz_UZ +[dolibarr.accountancy] +file_filter = htdocs/langs//accountancy.lang +source_file = htdocs/langs/en_US/accountancy.lang +source_lang = en_US +type = MOZILLAPROPERTIES + [dolibarr.admin] file_filter = htdocs/langs//admin.lang source_file = htdocs/langs/en_US/admin.lang @@ -212,12 +218,6 @@ source_file = htdocs/langs/en_US/orders.lang source_lang = en_US type = MOZILLAPROPERTIES -[dolibarr.oscommerce] -file_filter = htdocs/langs//oscommerce.lang -source_file = htdocs/langs/en_US/oscommerce.lang -source_lang = en_US -type = MOZILLAPROPERTIES - [dolibarr.other] file_filter = htdocs/langs//other.lang source_file = htdocs/langs/en_US/other.lang @@ -236,6 +236,18 @@ source_file = htdocs/langs/en_US/paypal.lang source_lang = en_US type = MOZILLAPROPERTIES +[dolibarr.printipp] +file_filter = htdocs/langs//printipp.lang +source_file = htdocs/langs/en_US/printipp.lang +source_lang = en_US +type = MOZILLAPROPERTIES + +[dolibarr.productbatch] +file_filter = htdocs/langs//productbatch.lang +source_file = htdocs/langs/en_US/productbatch.lang +source_lang = en_US +type = MOZILLAPROPERTIES + [dolibarr.products] file_filter = htdocs/langs//products.lang source_file = htdocs/langs/en_US/products.lang @@ -254,6 +266,12 @@ source_file = htdocs/langs/en_US/propal.lang source_lang = en_US type = MOZILLAPROPERTIES +[dolibarr.resource] +file_filter = htdocs/langs//resource.lang +source_file = htdocs/langs/en_US/resource.lang +source_lang = en_US +type = MOZILLAPROPERTIES + [dolibarr.salaries] file_filter = htdocs/langs//salaries.lang source_file = htdocs/langs/en_US/salaries.lang @@ -266,12 +284,6 @@ source_file = htdocs/langs/en_US/sendings.lang source_lang = en_US type = MOZILLAPROPERTIES -[dolibarr.shop] -file_filter = htdocs/langs//shop.lang -source_file = htdocs/langs/en_US/shop.lang -source_lang = en_US -type = MOZILLAPROPERTIES - [dolibarr.sms] file_filter = htdocs/langs//sms.lang source_file = htdocs/langs/en_US/sms.lang @@ -313,4 +325,3 @@ file_filter = htdocs/langs//workflow.lang source_file = htdocs/langs/en_US/workflow.lang source_lang = en_US type = MOZILLAPROPERTIES - diff --git a/COPYRIGHT b/COPYRIGHT index c0d8389369c..2e1c6e921b9 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -9,41 +9,41 @@ More information: http://www.gnu.org/licenses/gpl-3.0.txt Dolibarr uses some external libraries released under different licenses. This is compatibility summary: -Component Version License GPL Compatible Usage +Component Version License GPL Compatible Usage ------------------------------------------------------------------------------------- PHP libraries: -AdoDb-Date 0.32 Modified BSD License Yes Date convertion (not into rpm package) -CKEditor 4.3.3 LGPL-2.1+ Yes Editor WYSIWYG -FPDI 1.4.2 Apache Software License 2.0 Yes PDF templates management -FPDF_TPL 1.2 Apache Software License 2.0 Yes PDF templates management -GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package) -NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package) -odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files -PHPExcel 1.7.8 LGPL-2.1+ Yes Read/Write XLS files, read ODS files -PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests -TCPDF 6.0.093 LGPL-3+ Yes PDF generation +AdoDb-Date 0.32 Modified BSD License Yes Date convertion (not into rpm package) +CKEditor 4.3.3 LGPL-2.1+ Yes Editor WYSIWYG +FPDI 1.4.2 Apache Software License 2.0 Yes PDF templates management +FPDF_TPL 1.2 Apache Software License 2.0 Yes PDF templates management +GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package) +NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package) +odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files +PHPExcel 1.7.8 LGPL-2.1+ Yes Read/Write XLS files, read ODS files +PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests +TCPDF 6.0.093 LGPL-3+ Yes PDF generation JS libraries: -jQuery 1.8.2 MIT License Yes JS library -jQuery UI 1.9.1 GPL and MIT License Yes JS library plugin UI -jQuery UI Multiselect ? GPL and MIT License Yes JS library plugin for sexier multiselect -jQuery blockUI 2.43 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups) -jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors -jQuery DataTables 1.9.4 BSD Yes JS library for tables output -jQuery FileUpload 5.0.3 GPL and MIT License Yes JS library to upload files -jQuery Flot 0.7 MIT License Yes JS library to build graph -jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images) -jQuery Jeditable 1.7.1 GPL and MIT License Yes JS library plugin jeditable (to edit in place) -jQuery jNotify 1.1.00 Apache Software License 2.0 Yes JS library plugin jNotify (to use ajax popups) -jQuery jPicker 1.1.6 GPL and MIT License Yes JS library for color picker with not defined list of colors -jQuery jqueryFileTree 1.0.1 GPL and MIT License Yes JS library for color picker with not defined list of colors -jQuery jquerytreeview 1.4.1 MIT License Yes JS library for color picker with not defined list of colors -jQuery Layout 1.3.0rc30.74 GPL and MIT License Yes JS library plugin Layout (RC-29.15) -jQuery Mobile 1.3.0 GPL and MIT License Yes JS library for smartphone (not used) -jQuery TableDnD 0.6 GPL and MIT License Yes JS library plugin TableDnD (to reorder table rows) -jQuery Timepicker 1.1.0 GPL and MIT License Yes JS library Timepicker addon for Datepicker -jQuery Tiptip 1.3 GPL and MIT License Yes JS library for tooltips -jsGantt 1.2 BSD License Yes JS library (to build Gantt reports) +jQuery 1.8.2 MIT License Yes JS library +jQuery UI 1.9.1 GPL and MIT License Yes JS library plugin UI +jQuery select2 3.5.2 GPL and Apache License Yes JS library plugin for sexier multiselect +jQuery blockUI 2.43 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups) +jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors +jQuery DataTables 1.9.4 BSD Yes JS library for tables output +jQuery FileUpload 5.0.3 GPL and MIT License Yes JS library to upload files +jQuery Flot 0.7 MIT License Yes JS library to build graph +jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images) +jQuery Jeditable 1.7.1 GPL and MIT License Yes JS library plugin jeditable (to edit in place) +jQuery jNotify 1.1.00 Apache Software License 2.0 Yes JS library plugin jNotify (to use ajax popups) +jQuery jPicker 1.1.6 GPL and MIT License Yes JS library for color picker with not defined list of colors +jQuery jqueryFileTree 1.0.1 GPL and MIT License Yes JS library for color picker with not defined list of colors +jQuery jquerytreeview 1.4.1 MIT License Yes JS library for color picker with not defined list of colors +jQuery Layout 1.3.0rc30.74 GPL and MIT License Yes JS library plugin Layout (RC-29.15) +jQuery Mobile 1.3.0 GPL and MIT License Yes JS library for smartphone (not used) +jQuery TableDnD 0.6 GPL and MIT License Yes JS library plugin TableDnD (to reorder table rows) +jQuery Timepicker 1.1.0 GPL and MIT License Yes JS library Timepicker addon for Datepicker +jQuery Tiptip 1.3 GPL and MIT License Yes JS library for tooltips +jsGantt 1.2 BSD License Yes JS library (to build Gantt reports) For licenses compatibility informations: http://www.fsf.org/licensing/licenses/index_html diff --git a/ChangeLog b/ChangeLog index 24e22202555..6691ddb2007 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,15 +3,49 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 3.8 compared to 3.7.* ***** +For users: +- New: Use new combobox. +- New: Add hidden option MAXTABS_IN_CARD. +- Fix / Improve : [ bug #1747 ] Remove creation of batch 'Undefined' +- Add Weighted average price as default price for buying price for margin calculation. Add option + MARGIN_PMP_AS_DEFAULT_BUY_PRICE to replace with first supplier price. +- Introduce option MAIN_HTML_TITLE to start to control format of html title content. +- Add extrafields on bank account cards. + +For translators: +- Update language files. +- New: When a translation is not available we always jump to en_US and only en_US. + +For developers: +- New: Function yn can show a visual checkbox. +- New: Introduced select2 jquery plugin. + + ***** ChangeLog for 3.7 compared to 3.6.* ***** For users: +- New: Match other auth system: Login can be done entering login or user + email (this open the road for SSO). +- New: Agenda export by project #1967. +- New: Increase length of thirdparty to 128 chars. +- New: "Is Order shippable" icon #1975. +- New: statistics on supplier orders and invoices on home page. +- New: Add permissions to read all trips and expenses. +- New: Can filter on date into tab "Referring object" of a project. +- New: Module notification has been enhanced: + EMail use now language of target contact. + Can also define a fixed email for notifications. +- New: Feature to link manually an order to an invoice does not disappear once + link has been done. +- New: Can set a color on user card (visible into agenda view). +- New: extrafields for projects and tasks are exported to ODT documents. +- New: Add number of active notification into tab title (like we do for notes and documents) +- New: Can add product into category from category card. - New: PDF event report show project and status of event. -- New: Onto event summary of elements, end date and status are visible. - New: Can filter on status on interventions. - New: Add help info of field type into dictionary of payment types. - New: Add proposals into referer page of thirdparty. - New: On contact list can set filter on both active and not active (no more exclusive select). -- New: Each user can include its own external ics calendar into dolibarr agenda view. - New: Intervention documents are now available in ECM module. - New: Can attach supplier order to a customer order. - New: Supervisor is now visible into user list. @@ -22,16 +56,21 @@ For users: - New: No more dependency between contract and service module. - New: [ task #867 ] Remove ESAEB external module code from core. - New: Can create proposal from an intervention. +- New: An event can be assigned to several users. - New: Can filter events on a group of users. - New: Can filter events of a thirdparty. +- New: Onto event summary of elements, end date and status are visible. - New: Split Agenda view (month, week, day) into different tabs. +- New: Add a view "per user" of agenda events (with different colors according to type of event). +- New: Each user can include its own external ics calendar into dolibarr agenda view. +- New: Add event FICHINTER_CLASSIFY_BILLED into list of possible events to + create an automatic event into agenda. +- New: Add new type of event (when type of events are used, not by default). +- New: Can disable predefined type of events. - New: Form to add a photo is immediatly available on photo page if permissions are ok (save one click per photo to add). - New: Add option PRODUCT_MAX_VISIBLE_PHOTO to limit number of photos shown on main product card. -- New: Add event FICHINTER_CLASSIFY_BILLED into list of possible events to - create an automatic event into agenda. -- New: Add new type of event (when type of events are used, not by default). - New: Add country into table of thirdparties type. This will allow to provide a list of thirdparty types specific to a country (like argentina that need type A or B). @@ -48,7 +87,7 @@ For users: - New: [ task #1204 ] add Numering contrat module free (like leopard in product module). - New: [ task #712 ] Add warning when creating invoice from proposal or order, when there is already one invoice. - New: Enable supplier price log table. -- New: [ task #1204 ] add a External reference to contract. +- New: [ task #1204 ] add a supplier reference to contract. - New: [ task #1218 ] Can drag and drop an event from calendar to change its day. - New: Optimize size of image static resources. - New: Add hourly and daily amount on user card. Add weekly working hours and salary on user card. @@ -56,7 +95,15 @@ For users: - New: Add option MAIN_GENERATE_INVOICES_WITH_PICTURE to show picture onto PDF like MAIN_GENERATE_PROPOSALS_WITH_PICTURE dir for proposals. - New: Add more search field in list of cheque deposits. +- New: Add feature to order to invoice on supplier part. +- New : Use of MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR to use disk cache for big excel export. +- New: Direct invoice creation from predefined invoice. +- New: Add dunning into accountancy report. +- New: Add favorite button into country dictionary to put value on top select list - Upgrade phpexcel lib to 1.7.8 +- New : Use of MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR to use disk cache for big excel export. +- New : Option on extrafields to have them always editable regardless of the document status. +- New : New module PrintIPP to print without opening document is available as stable. - Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action - Fix: [ bug #1470, #1472, #1473] User trigger problem - Fix: [ bug #1489, #1491 ] Intervention trigger problem @@ -73,10 +120,13 @@ For users: - Fix: [ bug #1501 ] DEPLACEMENT_CREATE trigger do not intercept trigger action - Fix: [ bug #1506, #1507 ] ECM trigger error problem - Fix: [ bug #1469 ] Triggers CONTACT_MODIFY and CONTACT_DELETE duplicates error message +- Fix: [ bug #1533 ] Links triggers do not show trigger error message - Fix: [ bug #1537 ] Difference between societe.nom and adherent.societe. -- New: Add dunning into accountancy report +- Fix: [ bug #1535 ] Supplier invoice Extrafields are not shown +- Fix: datepicker first day of week can be monday by setting into display setup +- Fix: [ bug #575 ] GED doesn't works if there is "/" in a mask -New experimental module: +For users, new experimental module (need to set feature level of instance to experimental to see them): - New: Module Accounting Expert to manage accountancy Special Thanks to developpers : Olivier Geffroy @@ -90,6 +140,7 @@ New experimental module: Hydroflex 120 euros Asysteo 120 euros Fournisseur médical 120 euros +- Removed: unmaintained OScommerce module For translators: - Update language files. @@ -109,24 +160,63 @@ For developers: - New: Added hook "formConfirm" and "doActions" for supplier invoice card. - New: [ task #1511, #1426 ] Added hook "doActions" for supplier card and supplier order card. - New: renamed table llx_c_pays to llx_c_country & libelle field to label. +- New: Added hook "formConfirm" and "doActions" for fichinter card +- New: Can search list of thirdparties from web service on part of name. +- New: Function getCurrencyAmount is marked as deprecated. Use function price to output a price + including currency symbol. - Qual: Renamed table llx_c_civilite into llx_c_civility, field civilite into label in the same table, - and field civilite into civility in other table + and field civilite into civility in other table. +- Qual: Renamed all files & links "liste.php" into "list.php". +- Qual: Renamed all files & links "fiche.php" into "card.php". +- Qual: Replace all constants COMPTA_* by ACCOUNTING_*. +- Qual: Replace all constants ACCOUNTINGEX_* by ACCOUNTING_* to simplify migration of the module +- Fix: [ bug #1724 ] Can't add a submenu to projects WARNING: Following changes may create regression for some external modules, but was necessary to make Dolibarr better: +- If you can't see trips and expenses records, check that you have the new permission "read all + trips and expenses". +- Deprecated module "oscommerce" were removed. - Changed the way parameters are provided to scripts sync_xxx_ldap2dolibarr.php - Some field into database were renamed from "libelle" to "label". - Table llx_c_pays were renamed into llx_c_country. - Triggers *_BUILDDOC are removed. Building a doc is not a business event. For action after creation of a pdf or odt, hook "afterPDFCreation" or "afterODTCreation" must be used instead. +- A lot of pages called fiche.php were renamed into card.php +- A lot of pages called liste.php were renamed into list.php +- If you used warehouse/stock module, recheck setup of stock increase/decrease rules of the + warehouse module and your Point Of Sale module if you use one. + +***** ChangeLog for 3.6.3 compared to 3.6.2 ***** +- Fix: ref_ext was not saved when recording a customer order from web service +- Fix: amarok is a bugged theme making dolidroid failed. We swith to eldy automatically with dolidroid. +- Fix: withdrawal create error if in the same month are deleted previus withdrawals. + +***** ChangeLog for 3.6.2 compared to 3.6.1 ***** +- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. +- Fix: bug 1588 : relative discount. +- Fix: label of input method not tranlated. +- Fix: box of customer and propsects were not correctly disabled. +- Fix: [ bug #1618 ] PHP Error thrown when saving a barcode +- Fix: Civility & birthdate wasn't save into adherent module. +- Fix: webservice Thirdparty parameter lastname for invidual creation is now lastname and not ref +- Fix: Chars - is no more allowed into value for code for extra fields. +- Fix: [ bug #1622 ] Requesting holiday than spans across two years cause high CPU usage by Apache +- Fix: [ bug #1595 ] Selected boolean extrafield in intervention creation page, does not save state +- Fix: Show sender Country on PDF docs when sender Country <> receiver Country +- Fix: [ bug #1624 ] Use lowest buying price for margin when selling with POS +- Fix: [ bug #1749 ] Undefined $mailchimp +- Fix: [ bug #1736 ] Failing supplier Elephant numeration module with some masks +- Fix: [ bug #1649 ] Cancel button of several thirdparty actions, does the same thing as modify +- Fix: [ bug #1736 ] Failing supplier Elephant numeration module with some masks +- Fix: [ bug #1731 ] Can't use quick navigation on project tasks secondary tabs - ***** ChangeLog for 3.6.1 compared to 3.6.* ***** For users: - Fix: Can upload files on services. -- Fix: sql errors on updat fichinter. +- Fix: sql errors on update fichinter. - Fix: debian script syntax error. - Fix: error "menu param is not inside list" into pos module. - Fix: Salary payments are not reflected on the reporting sheets. @@ -141,6 +231,13 @@ For users: - Fix: Extrafield feature select from table should try to translate multiple column when not needed - Fix: cents for indian ruppes are calle paisa and paise. - Fix: Invoices payments may be older than invoices. +- Fix: Withdrawal total amount is double +- Fix: [ bug #1593 ] Spanish Localtax IRPF not being calculated since 3.6.0 in supplier invoices when adding a line +- Fix: Web service categorie WDSL declaration is correct +- Fix: ErrorBadValueForParamNotAString was displayed in virtual product if no base price defined +- Fix: Category creation failed and no message output +- Fix: Lanf for Payment Type +- Fix: PHPCheckstyle 1.5.5 ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: @@ -255,6 +352,23 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f - Remove add_photo_web() that is ot used anymore by core code. +***** ChangeLog for 3.5.7 compared to 3.5.6 ***** +Fix: Paypal link were broken dur to SSL v3 closed. +Fix: [ bug #1769 ] Error when installing to a PostgreSQL DB that contains numbers +Fix: [ bug #1752 ] Date filter of margins module, filters since 12H instead of 00H +Fix: [ bug #1757 ] Sorting breaks product/service statistics + +***** ChangeLog for 3.5.6 compared to 3.5.5 ***** +Fix: Avoid missing class error for fetch_thirdparty method #1973 +Fix: Can't update phone_pro from web service +Fix: Some security holes. +Fix: copy extrafields when creating order from proposal. +Fix: report on action was not filtering by environment. +Fix: Avoid missing class error. +Fix: Add function dolEscapeXML. +Fix: Bad days and month reported by function. +Fix: Bad margin calculation. + ***** ChangeLog for 3.5.5 compared to 3.5.4 ***** Fix: Holiday module was broken. Initializaion of amount of holidays failed. Fix: [ bug #1523 ] suite bug #1334 : filtre et ordre de tri conjoints ne s'appliquent pas. diff --git a/build.xml b/build.xml index fc267bf196e..570821a7c7b 100644 --- a/build.xml +++ b/build.xml @@ -1,6 +1,6 @@ - +fdfds diff --git a/build/debian/README.howto b/build/debian/README.howto index f9bb31c6fcf..6d5280e56c1 100644 --- a/build/debian/README.howto +++ b/build/debian/README.howto @@ -101,14 +101,38 @@ http://packages.qa.debian.org/package.html http://bugs.debian.org/package +##### Modify severity of a bug ticket + +- Send this email to control@bugs.debian.org and wait 10 minutes + +severity 123 xxx + + +##### Update but tracker system + +To set status of a bug to "pending" +> bts tag 999999 +pending + +or replay to email 999999@bugs.debian.org + submitter of bug +With a message starting with: + +Control: tag -1 +pending +Thanks. Fixed into git. + +or replay to email control@bugs.debian.org +With only message +tag 729538 +pending + + ##### Testing a package into unstable env -Check you have a mysql server available from another interface than localhost +Check you have a mysql server available from another interface than "localhost". Comment line in /etc/mysql/my.cnf if required and restart mysql #bind-address = 127.0.0.1 -Create a chroot called "unstable-amd64-sbuild" +Create a chroot called "unstable-amd64-sbuild". +Chroot env is stored into /srv/chroot directory. > sudo sbuild-createchroot --keyring= unstable /srv/chroot/unstable http://ftp.uk.debian.org/debian Pour lister les env chroot @@ -116,6 +140,7 @@ Pour lister les env chroot Puis pour se connecter et préparer l'environnement > schroot -c name_of_chroot +> cat /etc/debian_chroot to check which debian branch we are into > vi /usr/sbin/policy-rc.d and replace return code 101 (not allowed) into 0 (ok) > apt-get install links mysql-client @@ -129,7 +154,10 @@ Pour tester un package > dpkg -i dolibarr*.deb ou pour avoir des traces: dpkg -D77777 -i dolibarr*.deb > apt-get install -f -Puis http://localhost/dolibarr/ (cela peut etre appeler depuis le hote). +If there is a problem launching apache, because port is already used, change it into your chroot install with +> vi /etc/apache2/ports.conf +Then restart. +Then you can call/test dolibarr with http://localhost:port/dolibarr/ (It can be also called from host). @@ -196,23 +224,6 @@ http://packages.qa.debian.org/t/tcpdf.html * Package will be into release when test will be moved as stable. - -##### Update but tracker system -To set status of a bug to pending -> bts tag 999999 +pending - -or replay to email 999999@bugs.debian.org + submitter of bug -With a message starting with: -Control: tag -1 +pending -and then a text like: -Thanks. Fixed into git. - -or replay to email control@bugs.debian.org -With only message -tag 729538 +pending - - - ##### Create/Maintain dolibarr package To update dolibarr debian package @@ -251,7 +262,7 @@ x.y.z+dfsgw Note: If there was errors solved manually after get-orig-sources.sh, you may need to make a git commit * Add an entry into debian/changelog -> dch -v x.y.z+dfsg-w "My comment" will add entry. +> dch -v x.y.z+dfsgw-v "My comment" will add entry. For example: dch -v x.y.z+dfsgw-1 "New upstream release." for a new version (x.y.z = version, w start from 1 and increaed for each new import) Then modify changelog to replace "version" or "unstable" with "UNRELEASED". Then check/modify also the user/date signature: diff --git a/build/debian/apache/.htaccess b/build/debian/apache/.htaccess index 8ab3fb95cd1..a59829d970b 100644 --- a/build/debian/apache/.htaccess +++ b/build/debian/apache/.htaccess @@ -1,7 +1,8 @@ +# File used to disable access into directory documents = 2.3> Require all denied -Order deny,allow -Deny from all - +Order deny, allow +Denied from all + \ No newline at end of file diff --git a/build/debian/apache/dolibarr.conf b/build/debian/apache/dolibarr.conf index ae1d7b46d8e..95eaae21190 100644 --- a/build/debian/apache/dolibarr.conf +++ b/build/debian/apache/dolibarr.conf @@ -10,12 +10,26 @@ Alias /dolibarr /usr/share/dolibarr/htdocs # DocumentRoot /usr/share/dolibarr/ # ErrorLog logs/ldap.example.com-error.log # CustomLog logs/ldap.example.com-access.log common +# +# = 2.3> +# Require all granted +# +# +# Order allow, deny +# Allow from all +# +# # # Directory for web pages - Order deny,allow - Allow from all + = 2.3> + Require all granted + + + Order allow, deny + Allow from all + DirectoryIndex index.php Options +FollowSymLinks +Indexes diff --git a/build/debian/changelog b/build/debian/changelog index 06d0d2212d5..db3f1dc887b 100644 --- a/build/debian/changelog +++ b/build/debian/changelog @@ -1,69 +1,6 @@ -dolibarr (3.6.0-3) unstable; urgency=low +dolibarr (3.7.0-3) UNRELEASED; urgency=low [ Laurent Destailleur (eldy) ] * New upstream release. - -- Laurent Destailleur (eldy) Tue, 15 July 2014 12:00:00 +0100 - -dolibarr (3.5.5-3) unstable; urgency=low - - [ Laurent Destailleur (eldy) ] - * New upstream release. - - -- Laurent Destailleur (eldy) Tue, 8 July 2014 12:00:00 +0100 - -dolibarr (3.5.4-3) unstable; urgency=low - - [ Laurent Destailleur (eldy) ] - * New upstream release. - - -- Laurent Destailleur (eldy) Tue, 1 July 2014 12:00:00 +0100 - -dolibarr (3.5.3-3) unstable; urgency=low - - [ Laurent Destailleur (eldy) ] - * New upstream release. - - -- Laurent Destailleur (eldy) Fri, 2 May 2014 12:00:00 +0100 - -dolibarr (3.5.2-3) unstable; urgency=low - - [ Laurent Destailleur (eldy) ] - * New upstream release. - - -- Laurent Destailleur (eldy) Fri, 14 March 2014 12:00:00 +0100 - -dolibarr (3.5.1-3) unstable; urgency=low - - [ Laurent Destailleur (eldy) ] - * New upstream release. - - -- Laurent Destailleur (eldy) Fri, 7 Feb 2014 12:00:00 +0100 - -dolibarr (3.5.0-3) unstable; urgency=low - - [ Laurent Destailleur (eldy) ] - * New upstream release. - - -- Laurent Destailleur (eldy) Fri, 31 Jan 2014 12:00:00 +0100 - -dolibarr (3.4.2-3) unstable; urgency=low - - [ Laurent Destailleur (eldy) ] - * Maintenance release. - - -- Laurent Destailleur (eldy) Mon, 30 Dec 2013 12:00:00 +0100 - -dolibarr (3.4.1-3) unstable; urgency=low - - [ Laurent Destailleur (eldy) ] - * Maintenance release. - - -- Laurent Destailleur (eldy) Mon, 27 Apr 2013 12:00:00 +0100 - -dolibarr (3.4.0-3) unstable; urgency=low - - [ Laurent Destailleur (eldy) ] - * Maintenance release. - - -- Laurent Destailleur (eldy) Mon, 22 Apr 2013 12:00:00 +0100 + -- Laurent Destailleur (eldy) Tue, 21 Oct 2014 12:00:00 +0100 diff --git a/build/debian/control b/build/debian/control index f4f9e12aa58..164b919e066 100755 --- a/build/debian/control +++ b/build/debian/control @@ -3,7 +3,7 @@ Section: web Priority: optional Maintainer: Laurent Destailleur (eldy) # Uploaders: Laurent Destailleur (eldy) # Only if differs from Maintainer -Standards-Version: 3.9.4 +Standards-Version: 3.9.6 Homepage: http://www.dolibarr.org Build-Depends: debhelper (>= 9), po-debconf # This package need at least debian 7 or ubuntu 13.04 or any distribution based on this version @@ -16,7 +16,8 @@ Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5-mysql | php5-mysqli, php5-curl, php5-gd, php5-ldap, php5-geoip, # Required PHP libraries php-pear, php-mail-mime, -# php-tcpdf, libfpdi-php, libfpdf-tpl-php, php-fpdf, +# php-tcpdf, libfpdi-php, +# libfpdf-tpl-php, php-fpdf, # libphp-adodb, # libnusoap-php, # libphp-pclzip, @@ -26,9 +27,10 @@ Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | # fonts-dejavu-core | ttf-dejavu-core, xdg-utils, mysql-server, + mysql-client, ${misc:Depends}, ${perl:Depends} -Recommends: mysql-client, apache2 | lighttpd | httpd +Recommends: apache2 | lighttpd | httpd Suggests: www-browser Description: Web based software to manage a company or foundation Dolibarr ERP & CRM is an easy to use open source/free software for small @@ -68,4 +70,4 @@ Description: Web based software to manage a company or foundation PDF exports, And a lot more modules... . - You can also add third parties external modules or develop yours. + You can also add external modules from third parties or develop yours. diff --git a/build/debian/copyright b/build/debian/copyright index 73109152034..080965c31a3 100644 --- a/build/debian/copyright +++ b/build/debian/copyright @@ -1,7 +1,7 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Dolibarr Upstream-Contact: Laurent Destailleur -Source: http://sourceforge.net/projects/dolibarr/files/ +Source: http://www.dolibarr.org/files/stable/standard/ Files: * Copyright: 2002-2009, Rodolphe Quiedeville diff --git a/build/doxygen/doxygen_footer.html b/build/doxygen/doxygen_footer.html index 1f4cbd00215..e11df270ddc 100755 --- a/build/doxygen/doxygen_footer.html +++ b/build/doxygen/doxygen_footer.html @@ -26,7 +26,7 @@ for $projectname by Doxygen $doxygenversio -
+
-
+
diff --git a/build/doxygen/doxygen_header.html b/build/doxygen/doxygen_header.html index 363d408d43c..0c2e189136b 100755 --- a/build/doxygen/doxygen_header.html +++ b/build/doxygen/doxygen_header.html @@ -24,7 +24,7 @@ File added into doxygen generated documentation
-
+
@@ -54,7 +54,7 @@ File added into doxygen generated documentation
$projectname
- $projectnumber
-
+
diff --git a/build/exe/doliwamp/.gitignore b/build/exe/doliwamp/.gitignore new file mode 100644 index 00000000000..ce74d54f78e --- /dev/null +++ b/build/exe/doliwamp/.gitignore @@ -0,0 +1 @@ +/doliwamp.tmp.iss diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index da727786896..6183bcac85c 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -16,10 +16,10 @@ [Setup] ; ----- Change this ----- AppName=DoliWamp -; DoliWamp-x.x.x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x -AppVerName=DoliWamp-3.6.0 -; DoliWamp-x.x x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x -OutputBaseFilename=DoliWamp-3.6.0 +; Replace key with DoliWamp-x.x.x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x +AppVerName=__FILENAMEEXEDOLIWAMP__ +; Replace key with DoliWamp-x.x x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x +OutputBaseFilename=__FILENAMEEXEDOLIWAMP__ ; ----- End of change ;OutputManifestFile=build\doliwampbuild.log ; Define full path from which all relative path are defined diff --git a/build/launchpad/README b/build/launchpad/README index 973509aa6d1..03ddc7fd4e6 100644 --- a/build/launchpad/README +++ b/build/launchpad/README @@ -61,13 +61,17 @@ If you want to build/test package locally: - List of series are visible here: https://launchpad.net/dolibarr/+series -# To update Dolibarr into launchpad (when repository for sources already exists) +# To update Dolibarr into launchpad (when remote repository for sources already exists) #---------------------------------- + # create local repository cd bzr - bzr branch lp:~yourlogin/dolibarr/[dev|beta|stable] + bzr branch lp:~yourlogin/dolibarr/[develop|beta|stable] dolibarr-[dev|beta|stable] cd dolibarr-[dev|beta|stable] + # Update + bzr update + -- Update files here. Remove all and overwrite -- bzr status - -- Update files here -- + bzr add * bzr commit -m "Description of change" bzr push diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index b0ee55e399b..45e3bb621ce 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -2,7 +2,7 @@ #---------------------------------------------------------------------------- # \file build/makepack-dolibarr.pl # \brief Dolibarr package builder (tgz, zip, rpm, deb, exe, aps) -# \author (c)2004-2013 Laurent Destailleur +# \author (c)2004-2014 Laurent Destailleur # # This is list of constant you can set to have generated packages moved into a specific dir: #DESTIBETARC='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/lastbuild' @@ -63,19 +63,19 @@ $PUBLISHSTABLE="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr"; $PUBLISHBETARC="ldestailleur\@asso.dolibarr.org:/home/dolibarr/dolibarr.org/files"; if (! $ENV{"DESTIBETARC"} || ! $ENV{"DESTISTABLE"}) { - print "Error: Missing environment variables.\n"; + print "Error: Missing environment variables.\n"; print "You must define the environment variable DESTIBETARC and DESTISTABLE to point to the\ndirectories where you want to save the generated packages.\n"; print "Example: DESTIBETARC='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/lastbuild'\n"; print "Example: DESTISTABLE='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/stable'\n"; print "$PROG.$Extension aborted.\n"; - sleep 2; + sleep 2; exit 1; } if (! -d $ENV{"DESTIBETARC"} || ! -d $ENV{"DESTISTABLE"}) { - print "Error: Directory of environment variable DESTIBETARC or DESTISTABLE does not exist.\n"; + print "Error: Directory of environment variable DESTIBETARC or DESTISTABLE does not exist.\n"; print "$PROG.$Extension aborted.\n"; - sleep 2; + sleep 2; exit 1; } @@ -85,31 +85,31 @@ if ("$^O" =~ /linux/i || (-d "/etc" && -d "/var" && "$^O" !~ /cygwin/i)) { $OS=' elsif (-d "/etc" && -d "/Users") { $OS='macosx'; $CR=''; } elsif ("$^O" =~ /cygwin/i || "$^O" =~ /win32/i) { $OS='windows'; $CR="\r"; } if (! $OS) { - print "Error: Can't detect your OS.\n"; + print "Error: Can't detect your OS.\n"; print "Can't continue.\n"; print "$PROG.$Extension aborted.\n"; - sleep 2; + sleep 2; exit 1; } # Define buildroot # ---------------- if ($OS =~ /linux/) { - $TEMP=$ENV{"TEMP"}||$ENV{"TMP"}||"/tmp"; + $TEMP=$ENV{"TEMP"}||$ENV{"TMP"}||"/tmp"; } if ($OS =~ /macos/) { - $TEMP=$ENV{"TEMP"}||$ENV{"TMP"}||"/tmp"; + $TEMP=$ENV{"TEMP"}||$ENV{"TMP"}||"/tmp"; } if ($OS =~ /windows/) { - $TEMP=$ENV{"TEMP"}||$ENV{"TMP"}||"c:/temp"; - $PROGPATH=$ENV{"ProgramFiles"}; + $TEMP=$ENV{"TEMP"}||$ENV{"TMP"}||"c:/temp"; + $PROGPATH=$ENV{"ProgramFiles"}; } if (! $TEMP || ! -d $TEMP) { - print "Error: A temporary directory can not be find.\n"; - print "Check that TEMP or TMP environment variable is set correctly.\n"; + print "Error: A temporary directory can not be find.\n"; + print "Check that TEMP or TMP environment variable is set correctly.\n"; print "$PROG.$Extension aborted.\n"; - sleep 2; - exit 2; + sleep 2; + exit 2; } $BUILDROOT="$TEMP/buildroot"; @@ -169,10 +169,10 @@ my $batch=0; for (0..@ARGV-1) { if ($ARGV[$_] =~ /^-*target=(\w+)/i) { $target=$1; $batch=1; } if ($ARGV[$_] =~ /^-*desti=(.+)/i) { $DESTI=$1; } - if ($ARGV[$_] =~ /^-*prefix=(.+)/i) { - $PREFIX=$1; - $FILENAMESNAPSHOT.="-".$PREFIX; - } + if ($ARGV[$_] =~ /^-*prefix=(.+)/i) { + $PREFIX=$1; + $FILENAMESNAPSHOT.="-".$PREFIX; + } } if ($ENV{"DESTIBETARC"} && $BUILD =~ /[a-z]/i) { $DESTI = $ENV{"DESTIBETARC"}; } # Force output dir if env DESTIBETARC is defined if ($ENV{"DESTISTABLE"} && $BUILD =~ /^[0-9]+$/) { $DESTI = $ENV{"DESTISTABLE"}; } # Force output dir if env DESTISTABLE is defined @@ -192,7 +192,7 @@ print "Target directory (DESTI) : $DESTI\n"; if ($target) { if ($target eq "ALL") { foreach my $key (@LISTETARGET) { - if ($key ne 'SNAPSHOT' && $key ne 'SF' && $key ne 'ASSO') { $CHOOSEDTARGET{$key}=1; } + if ($key ne 'SNAPSHOT' && $key ne 'SF' && $key ne 'ASSO') { $CHOOSEDTARGET{$key}=1; } } } if ($target ne "ALL" && $target ne "SF" && $target ne "ASSO") { $CHOOSEDTARGET{uc($target)}=1; } @@ -200,56 +200,56 @@ if ($target) { if ($target eq "ASSO") { $CHOOSEDPUBLISH{"ASSO"}=1; } } else { - my $found=0; - my $NUM_SCRIPT; - my $cpt=0; - while (! $found) { - printf(" %2d - %-14s (%s)\n",$cpt,"ALL (1..9)","Need ".join(",",values %REQUIREMENTTARGET)); - foreach my $target (@LISTETARGET) { - $cpt++; - printf(" %2d - %-14s (%s)\n",$cpt,$target,"Need ".$REQUIREMENTTARGET{$target}); - } - $cpt=98; - printf(" %2d - %-14s (%s)\n",$cpt,"ASSO (publish)","Need ".join(",",values %REQUIREMENTPUBLISH)); - $cpt=99; - printf(" %2d - %-14s (%s)\n",$cpt,"SF (publish)","Need ".join(",",values %REQUIREMENTPUBLISH)); - - # Ask which target to build - print "Choose one package number or several separated with space (0 - ".$cpt."): "; - $NUM_SCRIPT=; - chomp($NUM_SCRIPT); - if ($NUM_SCRIPT !~ /^[0-9\s]+$/) - { - print "This is not a valid package number list.\n"; - $found = 0; - } - else - { - $found = 1; - } - } - print "\n"; - if ($NUM_SCRIPT eq "98") { - $CHOOSEDPUBLISH{"ASSO"}=1; - } - else - { - if ($NUM_SCRIPT eq "99") { - $CHOOSEDPUBLISH{"SF"}=1; - } - else { - if ($NUM_SCRIPT eq "0") { - foreach my $key (@LISTETARGET) { - if ($key ne 'SNAPSHOT' && $key ne 'ASSO' && $key ne 'SF') { $CHOOSEDTARGET{$key}=1; } - } - } - else { - foreach my $num (split(/\s+/,$NUM_SCRIPT)) { - $CHOOSEDTARGET{$LISTETARGET[$num-1]}=1; - } - } - } - } + my $found=0; + my $NUM_SCRIPT; + my $cpt=0; + while (! $found) { + printf(" %2d - %-14s (%s)\n",$cpt,"ALL (1..9)","Need ".join(",",values %REQUIREMENTTARGET)); + foreach my $target (@LISTETARGET) { + $cpt++; + printf(" %2d - %-14s (%s)\n",$cpt,$target,"Need ".$REQUIREMENTTARGET{$target}); + } + $cpt=98; + printf(" %2d - %-14s (%s)\n",$cpt,"ASSO (publish)","Need ".join(",",values %REQUIREMENTPUBLISH)); + $cpt=99; + printf(" %2d - %-14s (%s)\n",$cpt,"SF (publish)","Need ".join(",",values %REQUIREMENTPUBLISH)); + + # Ask which target to build + print "Choose one package number or several separated with space (0 - ".$cpt."): "; + $NUM_SCRIPT=; + chomp($NUM_SCRIPT); + if ($NUM_SCRIPT !~ /^[0-9\s]+$/) + { + print "This is not a valid package number list.\n"; + $found = 0; + } + else + { + $found = 1; + } + } + print "\n"; + if ($NUM_SCRIPT eq "98") { + $CHOOSEDPUBLISH{"ASSO"}=1; + } + else + { + if ($NUM_SCRIPT eq "99") { + $CHOOSEDPUBLISH{"SF"}=1; + } + else { + if ($NUM_SCRIPT eq "0") { + foreach my $key (@LISTETARGET) { + if ($key ne 'SNAPSHOT' && $key ne 'ASSO' && $key ne 'SF') { $CHOOSEDTARGET{$key}=1; } + } + } + else { + foreach my $num (split(/\s+/,$NUM_SCRIPT)) { + $CHOOSEDTARGET{$LISTETARGET[$num-1]}=1; + } + } + } + } } # Test if requirement is ok @@ -265,34 +265,34 @@ foreach my $target (keys %CHOOSEDTARGET) { } $atleastonerpm=1; } - foreach my $req (split(/[,\s]/,$REQUIREMENTTARGET{$target})) - { - # Test - print "Test requirement for target $target: Search '$req'... "; - $newreq=$req; $newparam=''; - if ($newreq eq 'zip') { $newparam.='-h'; } - if ($newreq eq 'xz') { $newparam.='-h'; } - $cmd="\"$newreq\" $newparam 2>&1"; - print "Test command ".$cmd."... "; - $ret=`$cmd`; - $coderetour=$?; $coderetour2=$coderetour>>8; - if ($coderetour != 0 && (($coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i) || ($coderetour2 == 127 && $OS !~ /windows/)) && $PROGPATH) { - # Not found error, we try in PROGPATH - $ret=`"$PROGPATH/$ALTERNATEPATH{$req}/$req\" 2>&1`; - $coderetour=$?; $coderetour2=$coderetour>>8; - $REQUIREMENTTARGET{$target}="$PROGPATH/$ALTERNATEPATH{$req}/$req"; - } + foreach my $req (split(/[,\s]/,$REQUIREMENTTARGET{$target})) + { + # Test + print "Test requirement for target $target: Search '$req'... "; + $newreq=$req; $newparam=''; + if ($newreq eq 'zip') { $newparam.='-h'; } + if ($newreq eq 'xz') { $newparam.='-h'; } + $cmd="\"$newreq\" $newparam 2>&1"; + print "Test command ".$cmd."... "; + $ret=`$cmd`; + $coderetour=$?; $coderetour2=$coderetour>>8; + if ($coderetour != 0 && (($coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i) || ($coderetour2 == 127 && $OS !~ /windows/)) && $PROGPATH) { + # Not found error, we try in PROGPATH + $ret=`"$PROGPATH/$ALTERNATEPATH{$req}/$req\" 2>&1`; + $coderetour=$?; $coderetour2=$coderetour>>8; + $REQUIREMENTTARGET{$target}="$PROGPATH/$ALTERNATEPATH{$req}/$req"; + } - if ($coderetour != 0 && (($coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i) || ($coderetour2 == 127 && $OS !~ /windows/))) { - # Not found error - print "Not found\nCan't build target $target. Requirement '$req' not found in PATH\n"; - $CHOOSEDTARGET{$target}=-1; - last; - } else { - # Pas erreur ou erreur autre que programme absent - print " Found ".$req."\n"; - } - } + if ($coderetour != 0 && (($coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i) || ($coderetour2 == 127 && $OS !~ /windows/))) { + # Not found error + print "Not found\nCan't build target $target. Requirement '$req' not found in PATH\n"; + $CHOOSEDTARGET{$target}=-1; + last; + } else { + # Pas erreur ou erreur autre que programme absent + print " Found ".$req."\n"; + } + } } print "\n"; @@ -303,7 +303,7 @@ $nboftargetok=0; $nboftargetneedbuildroot=0; $nbofpublishneedtag=0; foreach my $target (keys %CHOOSEDTARGET) { - if ($CHOOSEDTARGET{$target} < 0) { next; } + if ($CHOOSEDTARGET{$target} < 0) { next; } if ($target ne 'EXE' && $target ne 'EXEDOLIWAMP') { $nboftargetneedbuildroot++; @@ -311,7 +311,7 @@ foreach my $target (keys %CHOOSEDTARGET) { $nboftargetok++; } foreach my $target (keys %CHOOSEDPUBLISH) { - if ($CHOOSEDPUBLISH{$target} < 0) { next; } + if ($CHOOSEDPUBLISH{$target} < 0) { next; } if ($target eq 'ASSO') { $nbofpublishneedtag++; } if ($target eq 'SF') { $nbofpublishneedtag++; } $nboftargetok++; @@ -319,573 +319,583 @@ foreach my $target (keys %CHOOSEDPUBLISH) { if ($nboftargetok) { - # Update CVS if required - #----------------------- - if ($nbofpublishneedtag) + # Update CVS if required + #----------------------- + if ($nbofpublishneedtag) { - print "Go to directory $SOURCE\n"; - $olddir=getcwd(); - chdir("$SOURCE"); - print 'Run git tag -a -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n"; - $ret=`git tag -a -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD" 2>&1`; - if ($ret =~ /already exists/) - { - print "WARNING: Tag ".$MAJOR.'.'.$MINOR.'.'.$BUILD." already exists. Overwrite (y/N) ? "; - $QUESTIONOVERWRITETAG=; - chomp($QUESTIONOVERWRITETAG); - if ($QUESTIONOVERWRITETAG =~ /(o|y)/) - { - print 'Run git tag -a -f -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n"; - $ret=`git tag -a -f -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD"`; - } - } - print 'Run git push --tags'."\n"; - $ret=`git push --tags`; - chdir("$olddir"); + print "Go to directory $SOURCE\n"; + $olddir=getcwd(); + chdir("$SOURCE"); + print 'Run git tag -a -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n"; + $ret=`git tag -a -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD" 2>&1`; + if ($ret =~ /already exists/) + { + print "WARNING: Tag ".$MAJOR.'.'.$MINOR.'.'.$BUILD." already exists. Overwrite (y/N) ? "; + $QUESTIONOVERWRITETAG=; + chomp($QUESTIONOVERWRITETAG); + if ($QUESTIONOVERWRITETAG =~ /(o|y)/) + { + print 'Run git tag -a -f -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n"; + $ret=`git tag -a -f -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD"`; + } + } + print 'Run git push --tags'."\n"; + $ret=`git push --tags`; + chdir("$olddir"); } - # Update buildroot if required - #----------------------------- - if ($nboftargetneedbuildroot) + # Update buildroot if required + #----------------------------- + if ($nboftargetneedbuildroot) { - if (! $copyalreadydone) { - print "Creation of a buildroot used for all packages\n"; + if (! $copyalreadydone) { + print "Creation of a buildroot used for all packages\n"; - print "Delete directory $BUILDROOT\n"; - $ret=`rm -fr "$BUILDROOT"`; - - mkdir "$BUILDROOT"; - mkdir "$BUILDROOT/$PROJECT"; - print "Copy $SOURCE into $BUILDROOT/$PROJECT\n"; - $ret=`cp -pr "$SOURCE" "$BUILDROOT/$PROJECT"`; + print "Delete directory $BUILDROOT\n"; + $ret=`rm -fr "$BUILDROOT"`; + + mkdir "$BUILDROOT"; + mkdir "$BUILDROOT/$PROJECT"; + print "Copy $SOURCE into $BUILDROOT/$PROJECT\n"; + $ret=`cp -pr "$SOURCE" "$BUILDROOT/$PROJECT"`; - #print "Copy $SOURCE/build/debian/apache/.htaccess into $BUILDROOT/$PROJECT/build/debian/apache/.htaccess\n"; - #$ret=`cp -pr "$SOURCE/build/debian/apache/.htaccess" "$BUILDROOT/$PROJECT/build/debian/apache/.htaccess"`; - } - print "Clean $BUILDROOT\n"; - $ret=`rm -f $BUILDROOT/$PROJECT/.buildpath`; - $ret=`rm -fr $BUILDROOT/$PROJECT/.cache`; - $ret=`rm -fr $BUILDROOT/$PROJECT/.externalToolBuilders`; - $ret=`rm -fr $BUILDROOT/$PROJECT/.git*`; - $ret=`rm -fr $BUILDROOT/$PROJECT/.project`; - $ret=`rm -fr $BUILDROOT/$PROJECT/.settings`; - $ret=`rm -fr $BUILDROOT/$PROJECT/.scrutinizer.yml`; - $ret=`rm -fr $BUILDROOT/$PROJECT/.travis.yml`; - $ret=`rm -fr $BUILDROOT/$PROJECT/.tx`; - $ret=`rm -f $BUILDROOT/$PROJECT/build.xml`; - $ret=`rm -f $BUILDROOT/$PROJECT/quickbuild.xml`; - $ret=`rm -f $BUILDROOT/$PROJECT/pom.xml`; - - $ret=`rm -fr $BUILDROOT/$PROJECT/build/html`; - $ret=`rm -f $BUILDROOT/$PROJECT/build/Doli*-*`; - $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.deb`; - $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.dsc`; - $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.tar.gz`; - $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.deb`; - $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.rpm`; - $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar`; - $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar.gz`; - $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tgz`; - $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.xz`; - $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.zip`; - $ret=`rm -f $BUILDROOT/$PROJECT/build/doxygen/doxygen_warnings.log`; - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/cache.manifest`; - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php`; - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php.mysql`; - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php.old`; - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php.postgres`; - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf*sav*`; + #print "Copy $SOURCE/build/debian/apache/.htaccess into $BUILDROOT/$PROJECT/build/debian/apache/.htaccess\n"; + #$ret=`cp -pr "$SOURCE/build/debian/apache/.htaccess" "$BUILDROOT/$PROJECT/build/debian/apache/.htaccess"`; + } + print "Clean $BUILDROOT\n"; + $ret=`rm -f $BUILDROOT/$PROJECT/.buildpath`; + $ret=`rm -fr $BUILDROOT/$PROJECT/.cache`; + $ret=`rm -fr $BUILDROOT/$PROJECT/.editorconfig`; + $ret=`rm -fr $BUILDROOT/$PROJECT/.externalToolBuilders`; + $ret=`rm -fr $BUILDROOT/$PROJECT/.git*`; + $ret=`rm -fr $BUILDROOT/$PROJECT/.project`; + $ret=`rm -fr $BUILDROOT/$PROJECT/.settings`; + $ret=`rm -fr $BUILDROOT/$PROJECT/.scrutinizer.yml`; + $ret=`rm -fr $BUILDROOT/$PROJECT/.travis.yml`; + $ret=`rm -fr $BUILDROOT/$PROJECT/.tx`; + $ret=`rm -f $BUILDROOT/$PROJECT/build.xml`; + $ret=`rm -f $BUILDROOT/$PROJECT/pom.xml`; + + $ret=`rm -fr $BUILDROOT/$PROJECT/build/html`; + $ret=`rm -f $BUILDROOT/$PROJECT/build/Doli*-*`; + $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.deb`; + $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.dsc`; + $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.tar.gz`; + $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.deb`; + $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.rpm`; + $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar`; + $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar.gz`; + $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tgz`; + $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.xz`; + $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.zip`; + $ret=`rm -f $BUILDROOT/$PROJECT/build/doxygen/doxygen_warnings.log`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/cache.manifest`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php.mysql`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php.old`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php.postgres`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf*sav*`; - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/mssql/README`; - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/mysql/README`; - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/pgsql/README`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/mssql/README`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/mysql/README`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/pgsql/README`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/install/mssql`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/install/mssql`; - $ret=`rm -fr $BUILDROOT/$PROJECT/dev/codesniffer`; - $ret=`rm -fr $BUILDROOT/$PROJECT/dev/codetemplates`; - $ret=`rm -fr $BUILDROOT/$PROJECT/dev/dbmodel`; - $ret=`rm -fr $BUILDROOT/$PROJECT/dev/initdata`; - $ret=`rm -fr $BUILDROOT/$PROJECT/dev/iso-normes`; - $ret=`rm -fr $BUILDROOT/$PROJECT/dev/ldap`; - $ret=`rm -fr $BUILDROOT/$PROJECT/dev/licence`; - $ret=`rm -fr $BUILDROOT/$PROJECT/dev/mail`; - $ret=`rm -fr $BUILDROOT/$PROJECT/dev/phpcheckstyle`; - $ret=`rm -fr $BUILDROOT/$PROJECT/dev/phpunit`; - $ret=`rm -fr $BUILDROOT/$PROJECT/dev/security`; - $ret=`rm -fr $BUILDROOT/$PROJECT/dev/spec`; - $ret=`rm -fr $BUILDROOT/$PROJECT/dev/test`; - $ret=`rm -fr $BUILDROOT/$PROJECT/dev/uml`; - $ret=`rm -fr $BUILDROOT/$PROJECT/dev/vagrant`; - $ret=`rm -fr $BUILDROOT/$PROJECT/dev/xdebug`; - $ret=`rm -f $BUILDROOT/$PROJECT/dev/dolibarr_changes.txt`; - $ret=`rm -f $BUILDROOT/$PROJECT/dev/README`; - $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot2.png`; - $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot3.png`; - $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot4.png`; - $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot5.png`; - $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot6.png`; - $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot7.png`; - $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot8.png`; - $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot9.png`; - $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot10.png`; - $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot11.png`; - $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot12.png`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/codesniffer`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/codetemplates`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/dbmodel`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/initdata`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/iso-normes`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/ldap`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/licence`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/mail`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/phpcheckstyle`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/phpunit`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/security`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/spec`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/test`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/uml`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/vagrant`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/xdebug`; + $ret=`rm -f $BUILDROOT/$PROJECT/dev/dolibarr_changes.txt`; + $ret=`rm -f $BUILDROOT/$PROJECT/dev/README`; + $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot2.png`; + $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot3.png`; + $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot4.png`; + $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot5.png`; + $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot6.png`; + $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot7.png`; + $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot8.png`; + $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot9.png`; + $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot10.png`; + $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot11.png`; + $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot12.png`; - $ret=`rm -fr $BUILDROOT/$PROJECT/document`; - $ret=`rm -fr $BUILDROOT/$PROJECT/documents`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/document`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/bootstrap*`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom*`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`; - $ret=`rm -fr $BUILDROOT/$PROJECT/test`; - $ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`; - $ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`; - $ret=`rm -f $BUILDROOT/$PROJECT/.gitignore $BUILDROOT/$PROJECT/*/.gitignore $BUILDROOT/$PROJECT/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.gitignore`; - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/geoip/sample*.*`; - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/jqueryFileTree/connectors/jqueryFileTree.pl`; # Avoid errors into rpmlint - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/template`; # Package not valid for most linux distributions (errors reported into compile.js). Package should be embed by modules to avoid problems. - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpmailer`; # Package not valid for most linux distributions (errors reported into file LICENSE). Package should be embed by modules to avoid problems. - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/adapters`; # Keep this removal in case we embed libraries - #$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/_source`; # _source must be kept into tarball - - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/datatables/extras/TableTools/swf`; # Source of this flash is not available - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/license.txt`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-2.33`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-20100919`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/utils`; - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/LICENSE.TXT`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/savant`; + $ret=`rm -fr $BUILDROOT/$PROJECT/document`; + $ret=`rm -fr $BUILDROOT/$PROJECT/documents`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/document`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ancotec*`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/bootstrap*`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom*`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/factory*`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/eldy/*.new`; + $ret=`rm -fr $BUILDROOT/$PROJECT/test`; + $ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`; + $ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`; + $ret=`rm -f $BUILDROOT/$PROJECT/.gitignore $BUILDROOT/$PROJECT/*/.gitignore $BUILDROOT/$PROJECT/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.gitignore`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/geoip/sample*.*`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/jqueryFileTree/connectors/jqueryFileTree.pl`; # Avoid errors into rpmlint + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/template`; # Package not valid for most linux distributions (errors reported into compile.js). Package should be embed by modules to avoid problems. + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpmailer`; # Package not valid for most linux distributions (errors reported into file LICENSE). Package should be embed by modules to avoid problems. + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/adapters`; # Keep this removal in case we embed libraries + #$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/_source`; # _source must be kept into tarball due to debian policies + + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/datatables/extras/TableTools/swf`; # Source of this flash is not available + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/license.txt`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-*`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-*`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/utils`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/LICENSE.TXT`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/savant`; } - # Build package for each target - #------------------------------ - foreach my $target (keys %CHOOSEDTARGET) - { - if ($CHOOSEDTARGET{$target} < 0) { next; } - - print "\nBuild package for target $target\n"; + # Build package for each target + #------------------------------ + foreach my $target (keys %CHOOSEDTARGET) + { + if ($CHOOSEDTARGET{$target} < 0) { next; } + + print "\nBuild package for target $target\n"; - if ($target eq 'SNAPSHOT') - { - $NEWDESTI=$DESTI; + if ($target eq 'SNAPSHOT') + { + $NEWDESTI=$DESTI; - print "Remove target $FILENAMESNAPSHOT.tgz...\n"; - unlink("$NEWDESTI/$FILENAMESNAPSHOT.tgz"); + print "Remove target $FILENAMESNAPSHOT.tgz...\n"; + unlink("$NEWDESTI/$FILENAMESNAPSHOT.tgz"); - #rmdir "$BUILDROOT/$FILENAMESNAPSHOT"; - $ret=`rm -fr $BUILDROOT/$FILENAMESNAPSHOT`; - print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMESNAPSHOT\n"; - $cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$FILENAMESNAPSHOT\""; - $ret=`$cmd`; + #rmdir "$BUILDROOT/$FILENAMESNAPSHOT"; + $ret=`rm -fr $BUILDROOT/$FILENAMESNAPSHOT`; + print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMESNAPSHOT\n"; + $cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$FILENAMESNAPSHOT\""; + $ret=`$cmd`; - print "Compress $BUILDROOT into $FILENAMESNAPSHOT.tgz...\n"; - $cmd="tar --exclude doli*.tgz --exclude doli*.deb --exclude doli*.exe --exclude doli*.xz --exclude doli*.zip --exclude doli*.rpm --exclude .cache --exclude .settings --exclude conf.php --exclude conf.php.mysql --exclude conf.php.old --exclude conf.php.postgres --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$FILENAMESNAPSHOT.tgz\" $FILENAMESNAPSHOT"; + print "Compress $BUILDROOT into $FILENAMESNAPSHOT.tgz...\n"; + $cmd="tar --exclude doli*.tgz --exclude doli*.deb --exclude doli*.exe --exclude doli*.xz --exclude doli*.zip --exclude doli*.rpm --exclude .cache --exclude .settings --exclude conf.php --exclude conf.php.mysql --exclude conf.php.old --exclude conf.php.postgres --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$FILENAMESNAPSHOT.tgz\" $FILENAMESNAPSHOT"; print $cmd."\n"; $ret=`$cmd`; - # Move to final dir - print "Move $FILENAMESNAPSHOT.tgz to $NEWDESTI/$FILENAMESNAPSHOT.tgz\n"; - $ret=`mv "$FILENAMESNAPSHOT.tgz" "$NEWDESTI/$FILENAMESNAPSHOT.tgz"`; - next; - } + # Move to final dir + print "Move $FILENAMESNAPSHOT.tgz to $NEWDESTI/$FILENAMESNAPSHOT.tgz\n"; + $ret=`mv "$FILENAMESNAPSHOT.tgz" "$NEWDESTI/$FILENAMESNAPSHOT.tgz"`; + next; + } - if ($target eq 'TGZ') - { - $NEWDESTI=$DESTI; - mkdir($DESTI.'/standard'); + if ($target eq 'TGZ') + { + $NEWDESTI=$DESTI; + mkdir($DESTI.'/standard'); if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; } - print "Remove target $FILENAMETGZ.tgz...\n"; - unlink("$NEWDESTI/$FILENAMETGZ.tgz"); + print "Remove target $FILENAMETGZ.tgz...\n"; + unlink("$NEWDESTI/$FILENAMETGZ.tgz"); - #rmdir "$BUILDROOT/$FILENAMETGZ"; - $ret=`rm -fr $BUILDROOT/$FILENAMETGZ`; - print "Copy $BUILDROOT/$PROJECT/ to $BUILDROOT/$FILENAMETGZ\n"; - $cmd="cp -pr \"$BUILDROOT/$PROJECT/\" \"$BUILDROOT/$FILENAMETGZ\""; - $ret=`$cmd`; + #rmdir "$BUILDROOT/$FILENAMETGZ"; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ`; + print "Copy $BUILDROOT/$PROJECT/ to $BUILDROOT/$FILENAMETGZ\n"; + $cmd="cp -pr \"$BUILDROOT/$PROJECT/\" \"$BUILDROOT/$FILENAMETGZ\""; + $ret=`$cmd`; - $ret=`rm -fr $BUILDROOT/$FILENAMETGZ/build/exe`; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ/build/exe`; $ret=`rm -fr $BUILDROOT/$FILENAMETGZ/htdocs/includes/ckeditor/_source`; # We can't remove it with exclude file, we need it for some tarball packages - print "Compress $FILENAMETGZ into $FILENAMETGZ.tgz...\n"; - $cmd="tar --exclude-vcs --exclude-from \"$BUILDROOT/$PROJECT/build/tgz/tar_exclude.txt\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$BUILDROOT/$FILENAMETGZ.tgz\" $FILENAMETGZ"; - print "$cmd\n"; - $ret=`$cmd`; + print "Compress $FILENAMETGZ into $FILENAMETGZ.tgz...\n"; + $cmd="tar --exclude-vcs --exclude-from \"$BUILDROOT/$PROJECT/build/tgz/tar_exclude.txt\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$BUILDROOT/$FILENAMETGZ.tgz\" $FILENAMETGZ"; + print "$cmd\n"; + $ret=`$cmd`; - # Move to final dir - print "Move $BUILDROOT/$FILENAMETGZ.tgz to $NEWDESTI/$FILENAMETGZ.tgz\n"; - $ret=`mv "$BUILDROOT/$FILENAMETGZ.tgz" "$NEWDESTI/$FILENAMETGZ.tgz"`; - next; - } + # Move to final dir + print "Move $BUILDROOT/$FILENAMETGZ.tgz to $NEWDESTI/$FILENAMETGZ.tgz\n"; + $ret=`mv "$BUILDROOT/$FILENAMETGZ.tgz" "$NEWDESTI/$FILENAMETGZ.tgz"`; + next; + } - if ($target eq 'XZ') - { - $NEWDESTI=$DESTI; - mkdir($DESTI.'/standard'); + if ($target eq 'XZ') + { + $NEWDESTI=$DESTI; + mkdir($DESTI.'/standard'); if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; } - print "Remove target $FILENAMEXZ.xz...\n"; - unlink("$NEWDESTI/$FILENAMEXZ.xz"); + print "Remove target $FILENAMEXZ.xz...\n"; + unlink("$NEWDESTI/$FILENAMEXZ.xz"); - #rmdir "$BUILDROOT/$FILENAMEXZ"; - $ret=`rm -fr $BUILDROOT/$FILENAMEXZ`; - print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMEXZ\n"; - $cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$FILENAMEXZ\""; - $ret=`$cmd`; + #rmdir "$BUILDROOT/$FILENAMEXZ"; + $ret=`rm -fr $BUILDROOT/$FILENAMEXZ`; + print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMEXZ\n"; + $cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$FILENAMEXZ\""; + $ret=`$cmd`; - $ret=`rm -fr $BUILDROOT/$FILENAMEXZ/build/exe`; + $ret=`rm -fr $BUILDROOT/$FILENAMEXZ/build/exe`; $ret=`rm -fr $BUILDROOT/$FILENAMEXZ/htdocs/includes/ckeditor/_source`; # We can't remove it with exclude file, we need it for some tarball packages - print "Compress $FILENAMEXZ into $FILENAMEXZ.xz...\n"; - - print "Go to directory $BUILDROOT\n"; - $olddir=getcwd(); - chdir("$BUILDROOT"); - $cmd= "xz -9 -r $BUILDROOT/$FILENAMEAPS.xz \*"; + print "Compress $FILENAMEXZ into $FILENAMEXZ.xz...\n"; + + print "Go to directory $BUILDROOT\n"; + $olddir=getcwd(); + chdir("$BUILDROOT"); + $cmd= "xz -9 -r $BUILDROOT/$FILENAMEAPS.xz \*"; print $cmd."\n"; $ret= `$cmd`; - chdir("$olddir"); + chdir("$olddir"); - # Move to final dir - print "Move $FILENAMEXZ.xz to $NEWDESTI/$FILENAMEXZ.xz\n"; - $ret=`mv "$BUILDROOT/$FILENAMEXZ.xz" "$NEWDESTI/$FILENAMEXZ.xz"`; - next; - } - - if ($target eq 'ZIP') - { - $NEWDESTI=$DESTI; - mkdir($DESTI.'/standard'); + # Move to final dir + print "Move $FILENAMEXZ.xz to $NEWDESTI/$FILENAMEXZ.xz\n"; + $ret=`mv "$BUILDROOT/$FILENAMEXZ.xz" "$NEWDESTI/$FILENAMEXZ.xz"`; + next; + } + + if ($target eq 'ZIP') + { + $NEWDESTI=$DESTI; + mkdir($DESTI.'/standard'); if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; } - print "Remove target $FILENAMEZIP.zip...\n"; - unlink("$NEWDESTI/$FILENAMEZIP.zip"); + print "Remove target $FILENAMEZIP.zip...\n"; + unlink("$NEWDESTI/$FILENAMEZIP.zip"); - #rmdir "$BUILDROOT/$FILENAMEZIP"; - $ret=`rm -fr $BUILDROOT/$FILENAMEZIP`; - print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMEZIP\n"; - $cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$FILENAMEZIP\""; - $ret=`$cmd`; + #rmdir "$BUILDROOT/$FILENAMEZIP"; + $ret=`rm -fr $BUILDROOT/$FILENAMEZIP`; + print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMEZIP\n"; + $cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$FILENAMEZIP\""; + $ret=`$cmd`; - $ret=`rm -fr $BUILDROOT/$FILENAMEZIP/build/exe`; + $ret=`rm -fr $BUILDROOT/$FILENAMEZIP/build/exe`; $ret=`rm -fr $BUILDROOT/$FILENAMEZIP/htdocs/includes/ckeditor/_source`; # We can't remove it with exclude file, we need it for some tarball packages - print "Compress $FILENAMEZIP into $FILENAMEZIP.zip...\n"; - - print "Go to directory $BUILDROOT\n"; - $olddir=getcwd(); - chdir("$BUILDROOT"); - $cmd= "7z a -r -tzip -xr\@\"$BUILDROOT\/$FILENAMEZIP\/build\/zip\/zip_exclude.txt\" -mx $BUILDROOT/$FILENAMEZIP.zip $FILENAMEZIP\/*"; + print "Compress $FILENAMEZIP into $FILENAMEZIP.zip...\n"; + + print "Go to directory $BUILDROOT\n"; + $olddir=getcwd(); + chdir("$BUILDROOT"); + $cmd= "7z a -r -tzip -xr\@\"$BUILDROOT\/$FILENAMEZIP\/build\/zip\/zip_exclude.txt\" -mx $BUILDROOT/$FILENAMEZIP.zip $FILENAMEZIP\/*"; print $cmd."\n"; $ret= `$cmd`; - chdir("$olddir"); - - # Move to final dir - print "Move $FILENAMEZIP.zip to $NEWDESTI/$FILENAMEZIP.zip\n"; - $ret=`mv "$BUILDROOT/$FILENAMEZIP.zip" "$NEWDESTI/$FILENAMEZIP.zip"`; - next; - } - - if ($target =~ /RPM/) # Linux only - { - $NEWDESTI=$DESTI; - $subdir="package_rpm_generic"; - if ($target =~ /FEDO/i) { $subdir="package_rpm_redhat-fedora"; } - if ($target =~ /MAND/i) { $subdir="package_rpm_mandriva"; } - if ($target =~ /OPEN/i) { $subdir="package_rpm_opensuse"; } - mkdir($DESTI.'/'.$subdir); + chdir("$olddir"); + + # Move to final dir + print "Move $FILENAMEZIP.zip to $NEWDESTI/$FILENAMEZIP.zip\n"; + $ret=`mv "$BUILDROOT/$FILENAMEZIP.zip" "$NEWDESTI/$FILENAMEZIP.zip"`; + next; + } + + if ($target =~ /RPM/) # Linux only + { + $NEWDESTI=$DESTI; + $subdir="package_rpm_generic"; + if ($target =~ /FEDO/i) { $subdir="package_rpm_redhat-fedora"; } + if ($target =~ /MAND/i) { $subdir="package_rpm_mandriva"; } + if ($target =~ /OPEN/i) { $subdir="package_rpm_opensuse"; } + mkdir($DESTI.'/'.$subdir); if (-d $DESTI.'/'.$subdir) { $NEWDESTI=$DESTI.'/'.$subdir; } if ($RPMDIR eq "") { $RPMDIR=$ENV{'HOME'}."/rpmbuild"; } - print "Version is $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n"; + print "Version is $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n"; - #print "Create directory $RPMDIR\n"; - #$ret=`mkdir -p "$RPMDIR"`; + print "Remove target ".$FILENAMERPM."...\n"; + unlink("$NEWDESTI/".$FILENAMERPM); + print "Remove target ".$FILENAMETGZ2."-".$RPMSUBVERSION.".src.rpm...\n"; + unlink("$NEWDESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION.".src.rpm"); - print "Remove target ".$FILENAMERPM."...\n"; - unlink("$NEWDESTI/".$FILENAMERPM); - print "Remove target ".$FILENAMETGZ2."-".$RPMSUBVERSION.".src.rpm...\n"; - unlink("$NEWDESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION.".src.rpm"); + print "Create directory $BUILDROOT/$FILENAMETGZ2\n"; + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2`; + + print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMETGZ2\n"; + $cmd="cp -pr '$BUILDROOT/$PROJECT' '$BUILDROOT/$FILENAMETGZ2'"; + $ret=`$cmd`; - print "Create directory $BUILDROOT/$FILENAMETGZ2\n"; - $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2`; - print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMETGZ2\n"; - $cmd="cp -pr '$BUILDROOT/$PROJECT' '$BUILDROOT/$FILENAMETGZ2'"; - $ret=`$cmd`; + # Removed files we don't need + $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/htdocs/includes/ckeditor/_source`; - # Set owners - #print "Set owners on files/dir\n"; - #$ret=`chown -R root.root $BUILDROOT/$FILENAMETGZ2`; - - print "Set permissions on files/dir\n"; - $ret=`chmod -R 755 $BUILDROOT/$FILENAMETGZ2`; - $cmd="find $BUILDROOT/$FILENAMETGZ2 -type f -exec chmod 644 {} \\; "; - $ret=`$cmd`; + print "Set permissions on files/dir\n"; + $ret=`chmod -R 755 $BUILDROOT/$FILENAMETGZ2`; + $cmd="find $BUILDROOT/$FILENAMETGZ2 -type f -exec chmod 644 {} \\; "; + $ret=`$cmd`; # Build tgz - print "Compress $FILENAMETGZ2 into $FILENAMETGZ2.tgz...\n"; - $ret=`tar --exclude-from "$SOURCE/build/tgz/tar_exclude.txt" --directory "$BUILDROOT" -czvf "$BUILDROOT/$FILENAMETGZ2.tgz" $FILENAMETGZ2`; + print "Compress $FILENAMETGZ2 into $FILENAMETGZ2.tgz...\n"; + $ret=`tar --exclude-from "$SOURCE/build/tgz/tar_exclude.txt" --directory "$BUILDROOT" -czvf "$BUILDROOT/$FILENAMETGZ2.tgz" $FILENAMETGZ2`; - print "Move $BUILDROOT/$FILENAMETGZ2.tgz to $RPMDIR/SOURCES/$FILENAMETGZ2.tgz\n"; - $cmd="mv $BUILDROOT/$FILENAMETGZ2.tgz $RPMDIR/SOURCES/$FILENAMETGZ2.tgz"; - $ret=`$cmd`; + print "Move $BUILDROOT/$FILENAMETGZ2.tgz to $RPMDIR/SOURCES/$FILENAMETGZ2.tgz\n"; + $cmd="mv $BUILDROOT/$FILENAMETGZ2.tgz $RPMDIR/SOURCES/$FILENAMETGZ2.tgz"; + $ret=`$cmd`; - $BUILDFIC="${FILENAME}.spec"; - $BUILDFICSRC="${FILENAME}_generic.spec"; - if ($target =~ /FEDO/i) { $BUILDFICSRC="${FILENAME}_fedora.spec"; } - if ($target =~ /MAND/i) { $BUILDFICSRC="${FILENAME}_mandriva.spec"; } - if ($target =~ /OPEN/i) { $BUILDFICSRC="${FILENAME}_opensuse.spec"; } - - print "Generate file $BUILDROOT/$BUILDFIC from $SOURCE/build/rpm/${BUILDFICSRC}\n"; - open (SPECFROM,"<$SOURCE/build/rpm/${BUILDFICSRC}") || die "Error"; - open (SPECTO,">$BUILDROOT/$BUILDFIC") || die "Error"; - while () { - $_ =~ s/__FILENAMETGZ__/$FILENAMETGZ/; - $_ =~ s/__VERSION__/$MAJOR.$MINOR.$REL1/; - $_ =~ s/__RELEASE__/$RPMSUBVERSION/; - print SPECTO $_; - } - close SPECFROM; - close SPECTO; - - print "Copy patch file to $RPMDIR/SOURCES\n"; - $ret=`cp "$SOURCE/build/rpm/dolibarr-forrpm.patch" "$RPMDIR/SOURCES"`; - $ret=`chmod 644 $RPMDIR/SOURCES/dolibarr-forrpm.patch`; + $BUILDFIC="${FILENAME}.spec"; + $BUILDFICSRC="${FILENAME}_generic.spec"; + if ($target =~ /FEDO/i) { $BUILDFICSRC="${FILENAME}_fedora.spec"; } + if ($target =~ /MAND/i) { $BUILDFICSRC="${FILENAME}_mandriva.spec"; } + if ($target =~ /OPEN/i) { $BUILDFICSRC="${FILENAME}_opensuse.spec"; } + + print "Generate file $BUILDROOT/$BUILDFIC from $SOURCE/build/rpm/${BUILDFICSRC}\n"; + open (SPECFROM,"<$SOURCE/build/rpm/${BUILDFICSRC}") || die "Error"; + open (SPECTO,">$BUILDROOT/$BUILDFIC") || die "Error"; + while () { + $_ =~ s/__FILENAMETGZ__/$FILENAMETGZ/; + $_ =~ s/__VERSION__/$MAJOR.$MINOR.$REL1/; + $_ =~ s/__RELEASE__/$RPMSUBVERSION/; + print SPECTO $_; + } + close SPECFROM; + close SPECTO; + + print "Copy patch file to $RPMDIR/SOURCES\n"; + $ret=`cp "$SOURCE/build/rpm/dolibarr-forrpm.patch" "$RPMDIR/SOURCES"`; + $ret=`chmod 644 $RPMDIR/SOURCES/dolibarr-forrpm.patch`; - print "Launch RPM build (rpmbuild --clean -ba $BUILDROOT/${BUILDFIC})\n"; - #$ret=`rpmbuild -vvvv --clean -ba $BUILDROOT/${BUILDFIC}`; - $ret=`rpmbuild --clean -ba $BUILDROOT/${BUILDFIC}`; + print "Launch RPM build (rpmbuild --clean -ba $BUILDROOT/${BUILDFIC})\n"; + #$ret=`rpmbuild -vvvv --clean -ba $BUILDROOT/${BUILDFIC}`; + $ret=`rpmbuild --clean -ba $BUILDROOT/${BUILDFIC}`; - # Move to final dir - print "Move $RPMDIR/RPMS/".$ARCH."/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.".$ARCH.".rpm into $NEWDESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.".$ARCH.".rpm\n"; - $cmd="mv $RPMDIR/RPMS/".$ARCH."/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.".$ARCH.".rpm \"$NEWDESTI/\""; - $ret=`$cmd`; - print "Move $RPMDIR/SRPMS/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.src.rpm into $NEWDESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.src.rpm\n"; - $cmd="mv $RPMDIR/SRPMS/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.src.rpm \"$NEWDESTI/\""; - $ret=`$cmd`; - print "Move $RPMDIR/SOURCES/".$FILENAMETGZ2.".tgz into $NEWDESTI/".$FILENAMETGZ2.".tgz\n"; - $cmd="mv \"$RPMDIR/SOURCES/".$FILENAMETGZ2.".tgz\" \"$NEWDESTI/".$FILENAMETGZ2.".tgz\""; - $ret=`$cmd`; - next; - } + # Move to final dir + print "Move $RPMDIR/RPMS/".$ARCH."/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.".$ARCH.".rpm into $NEWDESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.".$ARCH.".rpm\n"; + $cmd="mv $RPMDIR/RPMS/".$ARCH."/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.".$ARCH.".rpm \"$NEWDESTI/\""; + $ret=`$cmd`; + print "Move $RPMDIR/SRPMS/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.src.rpm into $NEWDESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.src.rpm\n"; + $cmd="mv $RPMDIR/SRPMS/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.src.rpm \"$NEWDESTI/\""; + $ret=`$cmd`; + print "Move $RPMDIR/SOURCES/".$FILENAMETGZ2.".tgz into $NEWDESTI/".$FILENAMETGZ2.".tgz\n"; + $cmd="mv \"$RPMDIR/SOURCES/".$FILENAMETGZ2.".tgz\" \"$NEWDESTI/".$FILENAMETGZ2.".tgz\""; + $ret=`$cmd`; + next; + } - if ($target eq 'DEB') - { - $NEWDESTI=$DESTI; - mkdir($DESTI.'/package_debian-ubuntu'); + if ($target eq 'DEB') + { + $NEWDESTI=$DESTI; + mkdir($DESTI.'/package_debian-ubuntu'); if (-d $DESTI.'/package_debian-ubuntu') { $NEWDESTI=$DESTI.'/package_debian-ubuntu'; } - $olddir=getcwd(); + $olddir=getcwd(); - print "Remove target ${FILENAMEDEB}_all.deb...\n"; - unlink("$NEWDESTI/${FILENAMEDEB}_all.deb"); - print "Remove target ${FILENAMEDEB}.dsc...\n"; - unlink("$NEWDESTI/${FILENAMEDEB}.dsc"); - print "Remove target ${FILENAMEDEB}.tar.gz...\n"; - unlink("$NEWDESTI/${FILENAMEDEB}.tar.gz"); - print "Remove target ${FILENAMEDEB}.changes...\n"; - unlink("$NEWDESTI/${FILENAMEDEB}.changes"); - print "Remove target ${FILENAMEDEB}.debian.tar.gz...\n"; - unlink("$NEWDESTI/${FILENAMEDEB}.debian.tar.gz"); - print "Remove target ${FILENAMEDEBNATIVE}.orig.tar.gz...\n"; - unlink("$NEWDESTI/${FILENAMEDEBNATIVE}.orig.tar.gz"); + print "Remove target ${FILENAMEDEB}_all.deb...\n"; + unlink("$NEWDESTI/${FILENAMEDEB}_all.deb"); + print "Remove target ${FILENAMEDEB}.dsc...\n"; + unlink("$NEWDESTI/${FILENAMEDEB}.dsc"); + print "Remove target ${FILENAMEDEB}.tar.gz...\n"; + unlink("$NEWDESTI/${FILENAMEDEB}.tar.gz"); + print "Remove target ${FILENAMEDEB}.changes...\n"; + unlink("$NEWDESTI/${FILENAMEDEB}.changes"); + print "Remove target ${FILENAMEDEB}.debian.tar.gz...\n"; + unlink("$NEWDESTI/${FILENAMEDEB}.debian.tar.gz"); + print "Remove target ${FILENAMEDEBNATIVE}.orig.tar.gz...\n"; + unlink("$NEWDESTI/${FILENAMEDEBNATIVE}.orig.tar.gz"); - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp`; - $ret=`rm -fr $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build`; - + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp`; + $ret=`rm -fr $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build`; + print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$PROJECT.tmp\n"; $cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$PROJECT.tmp\""; $ret=`$cmd`; $cmd="cp -pr \"$BUILDROOT/$PROJECT/build/debian/apache/.htaccess\" \"$BUILDROOT/$PROJECT.tmp/build/debian/apache/.htaccess\""; $ret=`$cmd`; - print "Remove other files\n"; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/README-FR`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README-FR`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/aps`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/dmg`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/pad/README`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/tgz/README`; - #$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/debian`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/debian/po`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/debian/source`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/changelog`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/compat`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/control*`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/copyright`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.config`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.desktop`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.docs`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.install`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.lintian-overrides`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.postrm`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.postinst`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.templates`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.templates.futur`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/rules`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/README.Debian`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/README.howto`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/watch`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/doap`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/exe`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/launchpad`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/live`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/patch`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/perl`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/rpm`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/zip`; - # Removed duplicate license files - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/LICENSE.md`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/plugins/scayt/LICENSE.md`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/plugins/wsc/LICENSE.md`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/jquery/plugins/flot/LICENSE.txt`; - # Rename upstream changelog to match debian rules + print "Remove other files\n"; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/README-FR`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README-FR`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/aps`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/dmg`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/pad/README`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/tgz/README`; + #$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/debian`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/debian/po`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/debian/source`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/changelog`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/compat`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/control*`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/copyright`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.config`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.desktop`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.docs`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.install`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.lintian-overrides`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.postrm`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.postinst`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.templates`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.templates.futur`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/rules`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/README.Debian`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/README.howto`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/watch`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/doap`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/exe`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/launchpad`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/live`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/patch`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/perl`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/rpm`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/zip`; + # Removed duplicate license files + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/_source/LICENSE.md`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/_source/plugins/scayt/LICENSE.md`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/_source/plugins/wsc/LICENSE.md`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/LICENSE.md`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/plugins/scayt/LICENSE.md`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/plugins/wsc/LICENSE.md`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/jquery/plugins/flot/LICENSE.txt`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-2.34/LICENSE`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/tcpdf/fonts/freefont-20120503/COPYING`; + # Removed files we don't need + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/_source`; + + # Rename upstream changelog to match debian rules $ret=`mv $BUILDROOT/$PROJECT.tmp/ChangeLog $BUILDROOT/$PROJECT.tmp/changelog`; - # Prepare source package (init debian dir) - print "Create directory $BUILDROOT/$PROJECT.tmp/debian\n"; - $ret=`mkdir "$BUILDROOT/$PROJECT.tmp/debian"`; - print "Copy $SOURCE/build/debian/xxx to $BUILDROOT/$PROJECT.tmp/debian\n"; - # Add files for dpkg-source - $ret=`cp -f "$SOURCE/build/debian/changelog" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/compat" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/control" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/copyright" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/dolibarr.desktop" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/dolibarr.docs" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/dolibarr.install" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/dolibarr.lintian-overrides" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/dolibarr.xpm" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/rules" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/watch" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -fr "$SOURCE/build/debian/patches" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -fr "$SOURCE/build/debian/po" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -fr "$SOURCE/build/debian/source" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -fr "$SOURCE/build/debian/apache" "$BUILDROOT/$PROJECT.tmp/debian/apache"`; - $ret=`cp -f "$SOURCE/build/debian/apache/.htaccess" "$BUILDROOT/$PROJECT.tmp/debian/apache"`; - $ret=`cp -fr "$SOURCE/build/debian/lighttpd" "$BUILDROOT/$PROJECT.tmp/debian/lighttpd"`; - # Add files also required to build binary package - $ret=`cp -f "$SOURCE/build/debian/dolibarr.config" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/dolibarr.postinst" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/dolibarr.postrm" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/dolibarr.templates" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/install.forced.php.install" "$BUILDROOT/$PROJECT.tmp/debian"`; - + # Prepare source package (init debian dir) + print "Create directory $BUILDROOT/$PROJECT.tmp/debian\n"; + $ret=`mkdir "$BUILDROOT/$PROJECT.tmp/debian"`; + print "Copy $SOURCE/build/debian/xxx to $BUILDROOT/$PROJECT.tmp/debian\n"; + # Add files for dpkg-source + $ret=`cp -f "$SOURCE/build/debian/changelog" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/compat" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/control" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/copyright" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.desktop" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.docs" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.install" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.lintian-overrides" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.xpm" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/rules" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/watch" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -fr "$SOURCE/build/debian/patches" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -fr "$SOURCE/build/debian/po" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -fr "$SOURCE/build/debian/source" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -fr "$SOURCE/build/debian/apache" "$BUILDROOT/$PROJECT.tmp/debian/apache"`; + $ret=`cp -f "$SOURCE/build/debian/apache/.htaccess" "$BUILDROOT/$PROJECT.tmp/debian/apache"`; + $ret=`cp -fr "$SOURCE/build/debian/lighttpd" "$BUILDROOT/$PROJECT.tmp/debian/lighttpd"`; + # Add files also required to build binary package + $ret=`cp -f "$SOURCE/build/debian/dolibarr.config" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.postinst" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.postrm" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.templates" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/install.forced.php.install" "$BUILDROOT/$PROJECT.tmp/debian"`; + # Set owners and permissions - #print "Set owners on files/dir\n"; - #$ret=`chown -R root.root $BUILDROOT/$PROJECT.tmp`; + #print "Set owners on files/dir\n"; + #$ret=`chown -R root.root $BUILDROOT/$PROJECT.tmp`; - print "Set permissions on files/dir\n"; - $ret=`chmod -R 755 $BUILDROOT/$PROJECT.tmp`; - $cmd="find $BUILDROOT/$PROJECT.tmp -type f -exec chmod 644 {} \\; "; - $ret=`$cmd`; - $cmd="find $BUILDROOT/$PROJECT.tmp/build -name '*.php' -type f -exec chmod 755 {} \\; "; - $ret=`$cmd`; - $cmd="find $BUILDROOT/$PROJECT.tmp/build -name '*.dpatch' -type f -exec chmod 755 {} \\; "; - $ret=`$cmd`; - $cmd="find $BUILDROOT/$PROJECT.tmp/build -name '*.pl' -type f -exec chmod 755 {} \\; "; - $ret=`$cmd`; - $cmd="find $BUILDROOT/$PROJECT.tmp/dev -name '*.php' -type f -exec chmod 755 {} \\; "; - $ret=`$cmd`; - $ret=`chmod 755 $BUILDROOT/$PROJECT.tmp/debian/rules`; - $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/translation/autotranslator.class.php`; - $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/modMyModule.class.php`; - $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_class.class.php`; - $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_page.php`; - $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_webservice_server.php`; - $cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.php' -type f -exec chmod 755 {} \\; "; - $ret=`$cmd`; - $cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.sh' -type f -exec chmod 755 {} \\; "; - $ret=`$cmd`; - - - print "Rename directory $BUILDROOT/$PROJECT.tmp into $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n"; - $cmd="mv $BUILDROOT/$PROJECT.tmp $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build"; - $ret=`$cmd`; + print "Set permissions on files/dir\n"; + $ret=`chmod -R 755 $BUILDROOT/$PROJECT.tmp`; + $cmd="find $BUILDROOT/$PROJECT.tmp -type f -exec chmod 644 {} \\; "; + $ret=`$cmd`; + $cmd="find $BUILDROOT/$PROJECT.tmp/build -name '*.php' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + $cmd="find $BUILDROOT/$PROJECT.tmp/build -name '*.dpatch' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + $cmd="find $BUILDROOT/$PROJECT.tmp/build -name '*.pl' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + $cmd="find $BUILDROOT/$PROJECT.tmp/dev -name '*.php' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + $ret=`chmod 755 $BUILDROOT/$PROJECT.tmp/debian/rules`; + $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/translation/autotranslator.class.php`; + $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/modMyModule.class.php`; + $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_class.class.php`; + $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_page.php`; + $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_webservice_server.php`; + $cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.php' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + $cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.sh' -type f -exec chmod 755 {} \\; "; + $ret=`$cmd`; + + + print "Rename directory $BUILDROOT/$PROJECT.tmp into $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n"; + $cmd="mv $BUILDROOT/$PROJECT.tmp $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build"; + $ret=`$cmd`; - print "Go into directory $BUILDROOT\n"; - chdir("$BUILDROOT"); + print "Go into directory $BUILDROOT\n"; + chdir("$BUILDROOT"); # We need a tarball to be able to build "quilt" debian package (not required for native but we need patch so it is not a native) - print "Compress $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build into $BUILDROOT/$FILENAMEDEBNATIVE.orig.tar.gz...\n"; - $cmd="tar --exclude-vcs --exclude-from \"$BUILDROOT/$PROJECT/build/tgz/tar_exclude.txt\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$BUILDROOT/$FILENAMEDEBNATIVE.orig.tar.gz\" $PROJECT-$MAJOR.$MINOR.$build"; - print $cmd."\n"; - $ret=`$cmd`; + print "Compress $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build into $BUILDROOT/$FILENAMEDEBNATIVE.orig.tar.gz...\n"; + $cmd="tar --exclude-vcs --exclude-from \"$BUILDROOT/$PROJECT/build/tgz/tar_exclude.txt\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$BUILDROOT/$FILENAMEDEBNATIVE.orig.tar.gz\" $PROJECT-$MAJOR.$MINOR.$build"; + print $cmd."\n"; + $ret=`$cmd`; # Creation of source package - print "Go into directory $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n"; - chdir("$BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build"); - #$cmd="dpkg-source -b $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build"; - $cmd="dpkg-buildpackage -us -uc"; - print "Launch DEB build ($cmd)\n"; - $ret=`$cmd 2>&1 3>&1`; - print $ret."\n"; + print "Go into directory $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n"; + chdir("$BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build"); + #$cmd="dpkg-source -b $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build"; + $cmd="dpkg-buildpackage -us -uc"; + print "Launch DEB build ($cmd)\n"; + $ret=`$cmd 2>&1 3>&1`; + print $ret."\n"; - chdir("$olddir"); - - print "You can check bin package with lintian --pedantic -E -I \"$NEWDESTI/${FILENAMEDEB}_all.deb\"\n"; - print "You can check src package with lintian --pedantic -E -I \"$NEWDESTI/${FILENAMEDEB}.dsc\"\n"; - - # Move to final dir - print "Move *_all.deb *.dsc *.orig.tar.gz *.changes to $NEWDESTI\n"; - $ret=`mv $BUILDROOT/*_all.deb "$NEWDESTI/"`; - $ret=`mv $BUILDROOT/*.dsc "$NEWDESTI/"`; - $ret=`mv $BUILDROOT/*.orig.tar.gz "$NEWDESTI/"`; - $ret=`mv $BUILDROOT/*.debian.tar.gz "$NEWDESTI/"`; - $ret=`mv $BUILDROOT/*.changes "$NEWDESTI/"`; - next; - } - - if ($target eq 'APS') - { + chdir("$olddir"); + + print "You can check bin package with lintian --pedantic -E -I \"$NEWDESTI/${FILENAMEDEB}_all.deb\"\n"; + print "You can check src package with lintian --pedantic -E -I \"$NEWDESTI/${FILENAMEDEB}.dsc\"\n"; + + # Move to final dir + print "Move *_all.deb *.dsc *.orig.tar.gz *.changes to $NEWDESTI\n"; + $ret=`mv $BUILDROOT/*_all.deb "$NEWDESTI/"`; + $ret=`mv $BUILDROOT/*.dsc "$NEWDESTI/"`; + $ret=`mv $BUILDROOT/*.orig.tar.gz "$NEWDESTI/"`; + $ret=`mv $BUILDROOT/*.debian.tar.gz "$NEWDESTI/"`; + $ret=`mv $BUILDROOT/*.changes "$NEWDESTI/"`; + next; + } + + if ($target eq 'APS') + { $NEWDESTI=$DESTI; - mkdir($DESTI.'/package_aps'); + mkdir($DESTI.'/package_aps'); if (-d $DESTI.'/package_aps') { $NEWDESTI=$DESTI.'/package_aps'; } - $newbuild = $BUILD; - $newbuild =~ s/(dev|alpha)/0/gi; # dev - $newbuild =~ s/beta/1/gi; # beta - $newbuild =~ s/rc./2/gi; # rc - if ($newbuild !~ /-/) { $newbuild.='-3'; } # finale - # now newbuild is 0-0 or 0-3 for example - $REL1 = $newbuild; $REL1 =~ s/-.*$//gi; - if ($RPMSUBVERSION eq 'auto') { $RPMSUBVERSION = $newbuild; $RPMSUBVERSION =~ s/^.*-//gi; } - print "Version is $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n"; - - print "Remove target $FILENAMEAPS.zip...\n"; - unlink "$NEWDESTI/$FILENAMEAPS.zip"; - - #rmdir "$BUILDROOT/$PROJECT.tmp"; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp`; - print "Create directory $BUILDROOT/$PROJECT.tmp\n"; - $ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp"`; - print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$PROJECT.tmp\n"; - $cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$PROJECT.tmp\""; - $ret=`$cmd`; + $newbuild = $BUILD; + $newbuild =~ s/(dev|alpha)/0/gi; # dev + $newbuild =~ s/beta/1/gi; # beta + $newbuild =~ s/rc./2/gi; # rc + if ($newbuild !~ /-/) { $newbuild.='-3'; } # finale + # now newbuild is 0-0 or 0-3 for example + $REL1 = $newbuild; $REL1 =~ s/-.*$//gi; + if ($RPMSUBVERSION eq 'auto') { $RPMSUBVERSION = $newbuild; $RPMSUBVERSION =~ s/^.*-//gi; } + print "Version is $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n"; + + print "Remove target $FILENAMEAPS.zip...\n"; + unlink "$NEWDESTI/$FILENAMEAPS.zip"; - print "Remove other files\n"; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/deb`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/dmg`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/doap`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/exe`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/live`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/patch`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/rpm`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/zip`; - $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/perl`; + #rmdir "$BUILDROOT/$PROJECT.tmp"; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp`; + print "Create directory $BUILDROOT/$PROJECT.tmp\n"; + $ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp"`; + print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$PROJECT.tmp\n"; + $cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$PROJECT.tmp\""; + $ret=`$cmd`; + + print "Remove other files\n"; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/deb`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/dmg`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/doap`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/exe`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/live`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/patch`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/rpm`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/zip`; + $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/perl`; $APSVERSION="1.2"; print "Create APS files $BUILDROOT/$PROJECT.tmp/$PROJECT/APP-META.xml\n"; @@ -905,8 +915,6 @@ if ($nboftargetok) { close SPECFROM; close SPECTO; print "Version set to $MAJOR.$MINOR.$newbuild\n"; - #$cmd="cp -pr \"$BUILDROOT/$PROJECT/build/aps/configure\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/scripts/configure\""; - #$ret=`$cmd`; $cmd="cp -pr \"$BUILDROOT/$PROJECT/build/aps/configure.php\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/scripts/configure.php\""; $ret=`$cmd`; $cmd="cp -pr \"$BUILDROOT/$PROJECT/doc/images\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/images\""; @@ -934,93 +942,100 @@ if ($nboftargetok) { next; } - if ($target eq 'EXEDOLIWAMP') - { - $NEWDESTI=$DESTI; - mkdir($DESTI.'/package_windows'); + if ($target eq 'EXEDOLIWAMP') + { + $NEWDESTI=$DESTI; + mkdir($DESTI.'/package_windows'); if (-d $DESTI.'/package_windows') { $NEWDESTI=$DESTI.'/package_windows'; } - + print "Remove target $FILENAMEEXEDOLIWAMP.exe...\n"; unlink "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"; $SOURCEBACK=$SOURCE; $SOURCEBACK =~ s/\//\\/g; - print "Compil exe $FILENAMEEXEDOLIWAMP.exe file from iss file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.iss\"\n"; - $cmd= "ISCC.exe \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.iss\""; + + print "Prepare file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss from \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.iss\"\n"; + $ret=`cat "$SOURCE/build/exe/doliwamp/doliwamp.iss" | sed -e 's/__FILENAMEEXEDOLIWAMP__/$FILENAMEEXEDOLIWAMP/g' > "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`; + + print "Compil exe $FILENAMEEXEDOLIWAMP.exe file from iss file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\"\n"; + $cmd= "ISCC.exe \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\""; print "$cmd\n"; $ret= `$cmd`; #print "$ret\n"; - # Move to final dir + # Move to final dir print "Move \"$SOURCE\\build\\$FILENAMEEXEDOLIWAMP.exe\" to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n"; rename("$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe","$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"); print "Move $SOURCE/build/$FILENAMEEXEDOLIWAMP.exe to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n"; $ret=`mv "$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe" "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"`; + + $ret=`rm "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`; + next; } } - # Publish package for each target - #-------------------------------- - foreach my $target (keys %CHOOSEDPUBLISH) - { - if ($CHOOSEDPUBLISH{$target} < 0) { next; } - + # Publish package for each target + #-------------------------------- + foreach my $target (keys %CHOOSEDPUBLISH) + { + if ($CHOOSEDPUBLISH{$target} < 0) { next; } + print "\nList of files to publish\n"; - %filestoscansf=( - "$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)', - "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)', - "$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)', - "$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM', - "$DESTI/standard/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM' - ); - use POSIX qw/strftime/; - foreach my $file (sort keys %filestoscansf) - { - $found=0; - my $filesize = -s $file; - my $filedate = (stat $file)[9]; - print $file." ".($filesize?"(found)":"(not found)"); - print ($filesize?" - ".$filesize:""); - print ($filedate?" - ".strftime("%Y-%m-%d %H:%M:%S",localtime($filedate)):""); - print "\n"; - } + %filestoscansf=( + "$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)', + "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)', + "$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)', + "$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM', + "$DESTI/standard/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM' + ); + use POSIX qw/strftime/; + foreach my $file (sort keys %filestoscansf) + { + $found=0; + my $filesize = -s $file; + my $filedate = (stat $file)[9]; + print $file." ".($filesize?"(found)":"(not found)"); + print ($filesize?" - ".$filesize:""); + print ($filedate?" - ".strftime("%Y-%m-%d %H:%M:%S",localtime($filedate)):""); + print "\n"; + } - if ($target eq 'SF' || $target eq 'ASSO') - { - print "\n"; - - if ($target eq 'SF') { $PUBLISH = $PUBLISHSTABLE; } + if ($target eq 'SF' || $target eq 'ASSO') + { + print "\n"; + + if ($target eq 'SF') { $PUBLISH = $PUBLISHSTABLE; } if ($target eq 'ASSO' && $BUILD =~ /[a-z]/i) { $PUBLISH = $PUBLISHBETARC.'/lastbuild'; } if ($target eq 'ASSO' && $BUILD =~ /^[0-9]+$/) { $PUBLISH = $PUBLISHBETARC.'/stable'; } - $NEWPUBLISH=$PUBLISH; - print "Publish to target $NEWPUBLISH. Click enter or CTRL+C...\n"; + $NEWPUBLISH=$PUBLISH; + print "Publish to target $NEWPUBLISH. Click enter or CTRL+C...\n"; - # Ask which target to build - $NUM_SCRIPT=; - chomp($NUM_SCRIPT); + # Ask which target to build + $NUM_SCRIPT=; + chomp($NUM_SCRIPT); print "Create empty dir /tmp/emptydir. We need it to create target dir using rsync.\n"; - $ret=`mkdir -p "/tmp/emptydir/"`; - - %filestoscan=%filestoscansf; - - foreach my $file (sort keys %filestoscan) - { - $found=0; - my $filesize = -s $file; - if (! $filesize) { next; } + $ret=`mkdir -p "/tmp/emptydir/"`; + + %filestoscan=%filestoscansf; + + foreach my $file (sort keys %filestoscan) + { + $found=0; + my $filesize = -s $file; + if (! $filesize) { next; } print "\n"; - print "Publish file ".$file." to ".$filestoscan{$file}."\n"; - - $destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD; + print "Publish file ".$file." to ".$filestoscan{$file}."\n"; + + $destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD; # mkdir #my $ssh = Net::SSH::Perl->new("frs.sourceforge.net"); #$ssh->login("$user","$pass"); - #use String::ShellQuote qw( shell_quote ); + #use String::ShellQuote qw( shell_quote ); #$ssh->cmd('mkdir '.shell_quote($destFolder).' && exit'); #use Net::SFTP::Foreign; @@ -1039,23 +1054,23 @@ if ($nboftargetok) { print "$command\n"; my $ret=`$command 2>&1`; print "$ret\n"; - } - } - } + } + } + } } print "\n----- Summary -----\n"; foreach my $target (keys %CHOOSEDTARGET) { - if ($CHOOSEDTARGET{$target} < 0) { - print "Package $target not built (bad requirement).\n"; - } else { - print "Package $target built successfully in $DESTI\n"; - } + if ($CHOOSEDTARGET{$target} < 0) { + print "Package $target not built (bad requirement).\n"; + } else { + print "Package $target built successfully in $DESTI\n"; + } } if (! $batch) { - print "\nPress key to finish..."; - my $WAITKEY=; + print "\nPress key to finish..."; + my $WAITKEY=; } 0; diff --git a/build/makepack-howto.txt b/build/makepack-howto.txt index 24e5f809185..40b0e5180bc 100644 --- a/build/makepack-howto.txt +++ b/build/makepack-howto.txt @@ -36,14 +36,13 @@ complete release of Dolibarr, step by step. - Update version number with x.y.z in build/exe/doliwamp/doliwamp.iss - Update version number with x.y.z in build/rpm/*.spec - Commit all changes. -- Add a Tag (x.y.z) - Build Dolibarr and DoliWamp packages with makepack-dolibarr.pl - Check content of built packages. - Move build files into www.dolibarr.org web site (/home/dolibarr/wwwroot/files/stable). - Run makepack-dolibarr.pl again with option to publish files on - sourceforge. + sourceforge. This will also add official tag. - Edit symbolic links in directory "/home/dolibarr/wwwroot/files/stable/xxx" on server to point to new files (used by some web sites). diff --git a/build/obs/README b/build/obs/README index 8fc4c27d9b2..cf312fc0e68 100644 --- a/build/obs/README +++ b/build/obs/README @@ -14,7 +14,7 @@ https://build.opensuse.org Packaging rules: http://en.opensuse.org/Portal:Packaging Add attributes: -OBS:Screenshots URL of screenshot +OBS:Screenshots URL of screenshot http://www.dolibarr.org/images/dolibarr_screenshot1.png OBS:QualityCategory Development|Testing|Stable|Private OBS:Maintained 1 @@ -29,12 +29,18 @@ To submit a snapshot for building, we should have a service file with content How to have such a service file created automatically ? -Click on "Add file", then select mode "Upload From: Remote URL" -Enter the Remote URL that should looks like this: http://www.dolibarr.org/files/stable/package_rpm_generic/dolibarr-x.y.v-3.src.rpm -Then add into advanded - attributes +Go into project you want to update. It mught be: +- openSUSE Build Service > Projects > Application:ERP:Dolibarr > dolibarr +- or your private project + +Once logged, click on "Add file" in section "Source Files", then select mode "Upload From: Remote URL" +Keep empty for "Filename", choose "Remote URL" and enter into last field, URL that should looks like this: +http://www.dolibarr.org/files/stable/package_rpm_generic/dolibarr-x.y.v-0.3.src.rpm + +Then add into Advanded - Attributes OBS:Screenshots http://www.dolibarr.org/images/dolibarr_screenshot1.png -OBS:QualityCategory Testing +OBS:QualityCategory Stable|Testing|Development|Private # Move project into official directory diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index d676e59255e..05de30b3d6d 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -162,7 +162,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/asterisk %_datadir/dolibarr/htdocs/barcode %_datadir/dolibarr/htdocs/bookmarks -%_datadir/dolibarr/htdocs/boutique %_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/comm @@ -333,23 +332,5 @@ fi # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release %changelog -* Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3 +* Wed Oct 29 2014 Laurent Destailleur 3.7.0-0.3 - Upstream release - -* Tue Jul 8 2014 Laurent Destailleur 3.5.5-0.3 -- Upstream release - -* Tue Jul 1 2014 Laurent Destailleur 3.5.4-0.3 -- Upstream release - -* Fri May 2 2014 Laurent Destailleur 3.5.3-0.3 -- Upstream release - -* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3 -- Upstream release - -* Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3 -- Upstream release - -* Mon Dec 30 2013 Laurent Destailleur 3.5.0-0.3 -- Initial version (#723326) diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index ef94435a62a..9ba38083e46 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -242,7 +242,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/asterisk %_datadir/dolibarr/htdocs/barcode %_datadir/dolibarr/htdocs/bookmarks -%_datadir/dolibarr/htdocs/boutique %_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/comm @@ -569,23 +568,7 @@ fi # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release %changelog -* Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3 +* Wed Oct 29 2014 Laurent Destailleur 3.7.0-0.3 - Upstream release -* Tue Jul 8 2014 Laurent Destailleur 3.5.5-0.3 -- Upstream release -* Tue Jul 1 2014 Laurent Destailleur 3.5.4-0.3 -- Upstream release - -* Fri May 2 2014 Laurent Destailleur 3.5.3-0.3 -- Upstream release - -* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3 -- Upstream release - -* Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3 -- Upstream release - -* Mon Dec 30 2013 Laurent Destailleur 3.5.0-0.3 -- Initial version (#723326) diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index dfa148570f0..ec5dbc3b4a8 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -159,7 +159,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/asterisk %_datadir/dolibarr/htdocs/barcode %_datadir/dolibarr/htdocs/bookmarks -%_datadir/dolibarr/htdocs/boutique %_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/comm @@ -338,23 +337,7 @@ fi # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release %changelog -* Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3 +* Wed Oct 29 2014 Laurent Destailleur 3.7.0-0.3 - Upstream release -* Tue Jul 8 2014 Laurent Destailleur 3.5.5-0.3 -- Upstream release -* Tue Jul 1 2014 Laurent Destailleur 3.5.4-0.3 -- Upstream release - -* Fri May 2 2014 Laurent Destailleur 3.5.3-0.3 -- Upstream release - -* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3 -- Upstream release - -* Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3 -- Upstream release - -* Mon Dec 30 2013 Laurent Destailleur 3.5.0-0.3 -- Initial version (#723326) diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index b3b304312f5..c770c25e2e6 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -170,7 +170,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/asterisk %_datadir/dolibarr/htdocs/barcode %_datadir/dolibarr/htdocs/bookmarks -%_datadir/dolibarr/htdocs/boutique %_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/comm @@ -349,23 +348,7 @@ fi # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release %changelog -* Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3 +* Wed Oct 29 2014 Laurent Destailleur 3.7.0-0.3 - Upstream release -* Tue Jul 8 2014 Laurent Destailleur 3.5.5-0.3 -- Upstream release -* Tue Jul 1 2014 Laurent Destailleur 3.5.4-0.3 -- Upstream release - -* Fri May 2 2014 Laurent Destailleur 3.5.3-0.3 -- Upstream release - -* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3 -- Upstream release - -* Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3 -- Upstream release - -* Mon Dec 30 2013 Laurent Destailleur 3.5.0-0.3 -- Initial version (#723326) diff --git a/composer.json b/composer.json index 4463efcfc74..f0de86ce7ea 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,8 @@ "ext-mcrypt": "*", "ext-openssl": "*", "ext-mbstring": "*", - "ext-soap": "*" + "ext-soap": "*", + "ext-zip": "*", + "ext-xml": "*" } } diff --git a/dev/codesniffer/README b/dev/codesniffer/README index b06a2b1e5f6..8a68d8a1140 100755 --- a/dev/codesniffer/README +++ b/dev/codesniffer/README @@ -1,9 +1,12 @@ README (English) -------------------------------- -This directory contains ruleset files to use to -develop Dolibarr EPR & CRM with Eclipse. +This directory contains ruleset files to use to develop Dolibarr EPR & CRM. -Note: You must setup the PTI plugin of Eclipse into PHPCodeSniffer menu with: +To install/upgrade phpcs: +> sudo pear upgrade PHP_CodeSniffer + +Note with Eclipse: You must setup the PTI plugin of Eclipse into PHPCodeSniffer menu with: * tab value to 4 -* path of code sniffer standard to dev/codesniffer \ No newline at end of file +* path of code sniffer standard to dev/codesniffer + diff --git a/dev/codesniffer/ruleset.xml b/dev/codesniffer/ruleset.xml index 72590c15741..49af678ccff 100755 --- a/dev/codesniffer/ruleset.xml +++ b/dev/codesniffer/ruleset.xml @@ -6,10 +6,11 @@ */conf.php */includes/* */documents/* + */dev/vagrant/* */custom/* */nltechno* - - + + @@ -22,7 +23,23 @@ - + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + 0 @@ -108,7 +125,7 @@ - + @@ -158,18 +175,92 @@ - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 - + + 0 + + + + 0 + + + 0 + + + 0 + + + + 0 + + + 0 + + + + + + + + + \r\nYou can adit it with the WYSIWYG editor.
\r\nIt is\r\n
    \r\n
  • \r\n Fast
  • \r\n
  • \r\n Easy to use
  • \r\n
  • \r\n Pretty
  • \r\n
','','',NULL,NULL,'dolibarr@domain.com','','',NULL,'2011-07-18 20:44:33',NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +/*!40000 ALTER TABLE `llx_mailing` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_mailing_cibles` +-- + +DROP TABLE IF EXISTS `llx_mailing_cibles`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_mailing_cibles` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_mailing` int(11) NOT NULL, + `fk_contact` int(11) NOT NULL, + `lastname` varchar(50) DEFAULT NULL, + `firstname` varchar(50) DEFAULT NULL, + `email` varchar(160) NOT NULL, + `other` varchar(255) DEFAULT NULL, + `tag` varchar(128) DEFAULT NULL, + `statut` smallint(6) NOT NULL DEFAULT '0', + `source_url` varchar(160) DEFAULT NULL, + `source_id` int(11) DEFAULT NULL, + `source_type` varchar(16) DEFAULT NULL, + `date_envoi` datetime DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_mailing_cibles` (`fk_mailing`,`email`), + KEY `idx_mailing_cibles_email` (`email`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_mailing_cibles` +-- + +LOCK TABLES `llx_mailing_cibles` WRITE; +/*!40000 ALTER TABLE `llx_mailing_cibles` DISABLE KEYS */; +INSERT INTO `llx_mailing_cibles` VALUES (1,1,0,'Dupont','Alain','toto@aa.com','Date fin=10/07/2011',NULL,0,'0',NULL,NULL,NULL),(2,2,0,'Swiss customer supplier','','abademail@aa.com','',NULL,0,'0',NULL,NULL,NULL),(3,2,0,'Smith Vick','','vsmith@email.com','',NULL,0,'0',NULL,NULL,NULL),(4,3,0,'Swiss customer supplier','','abademail@aa.com','',NULL,0,'0',NULL,NULL,NULL),(5,3,0,'Smith Vick','','vsmith@email.com','',NULL,0,'0',NULL,NULL,NULL); +/*!40000 ALTER TABLE `llx_mailing_cibles` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_menu` +-- + +DROP TABLE IF EXISTS `llx_menu`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_menu` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `menu_handler` varchar(16) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `module` varchar(64) DEFAULT NULL, + `type` varchar(4) NOT NULL, + `mainmenu` varchar(100) NOT NULL, + `fk_menu` int(11) NOT NULL, + `fk_leftmenu` varchar(24) DEFAULT NULL, + `fk_mainmenu` varchar(24) DEFAULT NULL, + `position` int(11) NOT NULL, + `url` varchar(255) NOT NULL, + `target` varchar(100) DEFAULT NULL, + `titre` varchar(255) NOT NULL, + `langs` varchar(100) DEFAULT NULL, + `level` smallint(6) DEFAULT NULL, + `leftmenu` varchar(100) DEFAULT NULL, + `perms` varchar(255) DEFAULT NULL, + `enabled` varchar(255) DEFAULT '1', + `usertype` int(11) NOT NULL DEFAULT '0', + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`rowid`), + UNIQUE KEY `idx_menu_uk_menu` (`menu_handler`,`fk_menu`,`position`,`url`,`entity`), + KEY `idx_menu_menuhandler_type` (`menu_handler`,`type`) +) ENGINE=InnoDB AUTO_INCREMENT=108480 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_menu` +-- + +LOCK TABLES `llx_menu` WRITE; +/*!40000 ALTER TABLE `llx_menu` DISABLE KEYS */; +INSERT INTO `llx_menu` VALUES (19289,'all',1,'cashdesk','top','cashdesk',0,NULL,NULL,100,'/cashdesk/index.php?user=__LOGIN__','pointofsale','CashDeskMenu','cashdesk',NULL,NULL,'1','$conf->cashdesk->enabled',0,'2012-12-08 13:11:09'),(87422,'smartphone',1,NULL,'top','home',0,NULL,NULL,1,'/index.php?mainmenu=home&leftmenu=','','Home','',-1,'','','1',2,'2013-02-24 18:29:15'),(87423,'smartphone',1,NULL,'top','companies',0,NULL,NULL,2,'/societe/index.php?mainmenu=companies&leftmenu=','','ThirdParties','companies',-1,'','$user->rights->societe->lire || $user->rights->societe->contact->lire','$conf->societe->enabled || $conf->fournisseur->enabled',2,'2013-02-24 18:29:15'),(87424,'smartphone',1,NULL,'top','products',0,NULL,NULL,3,'/product/index.php?mainmenu=products&leftmenu=','','Products/Services','products',-1,'','$user->rights->produit->lire||$user->rights->service->lire','$conf->product->enabled || $conf->service->enabled',0,'2013-02-24 18:29:15'),(87426,'smartphone',1,NULL,'top','commercial',0,NULL,NULL,5,'/comm/index.php?mainmenu=commercial&leftmenu=','','Commercial','commercial',-1,'','$user->rights->societe->lire || $user->rights->societe->contact->lire','$conf->societe->enabled',2,'2013-02-24 18:29:15'),(87427,'smartphone',1,NULL,'top','accountancy',0,NULL,NULL,6,'/compta/index.php?mainmenu=accountancy&leftmenu=','','MenuFinancial','compta',-1,'','$user->rights->compta->resultat->lire || $user->rights->accounting->plancompte->lire || $user->rights->commande->lire || $user->rights->facture->lire','$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->deplacement->enabled || $conf->don->enabled',2,'2013-02-24 18:29:15'),(87428,'smartphone',1,NULL,'top','project',0,NULL,NULL,7,'/projet/index.php?mainmenu=project&leftmenu=','','Projects','projects',-1,'','$user->rights->projet->lire','$conf->projet->enabled',0,'2013-02-24 18:29:15'),(87429,'smartphone',1,NULL,'top','tools',0,NULL,NULL,8,'/core/tools.php?mainmenu=tools&leftmenu=','','Tools','other',-1,'','$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run','$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled',2,'2013-02-24 18:29:15'),(87432,'smartphone',1,NULL,'top','shop',0,NULL,NULL,11,'/boutique/index.php?mainmenu=shop&leftmenu=','','OSCommerce','shop',-1,'','','! empty($conf->boutique->enabled)',0,'2013-02-24 18:29:15'),(87434,'smartphone',1,NULL,'top','members',0,NULL,NULL,15,'/adherents/index.php?mainmenu=members&leftmenu=','','Members','members',-1,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2013-02-24 18:29:15'),(87435,'smartphone',1,NULL,'top','bank',0,NULL,NULL,6,'/compta/bank/index.php?mainmenu=bank&leftmenu=bank','','MenuBankCash','banks',-1,'','$user->rights->banque->lire || $user->rights->prelevement->bons->lire','$conf->banque->enabled || $conf->prelevement->enabled',2,'2013-02-24 18:29:15'),(87521,'smartphone',1,NULL,'left','home',87422,NULL,NULL,0,'/admin/index.php?leftmenu=setup','','Setup','admin',0,'','','$user->admin',2,'2013-02-24 18:29:15'),(87522,'smartphone',1,NULL,'left','home',87521,NULL,NULL,1,'/admin/company.php?leftmenu=setup','','MenuCompanySetup','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87523,'smartphone',1,NULL,'left','home',87521,NULL,NULL,4,'/admin/ihm.php?leftmenu=setup','','GUISetup','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87524,'smartphone',1,NULL,'left','home',87521,NULL,NULL,2,'/admin/modules.php?leftmenu=setup','','Modules','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87525,'smartphone',1,NULL,'left','home',87521,NULL,NULL,5,'/admin/boxes.php?leftmenu=setup','','Boxes','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87526,'smartphone',1,NULL,'left','home',87521,NULL,NULL,3,'/admin/menus.php?leftmenu=setup','','Menus','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87527,'smartphone',1,NULL,'left','home',87521,NULL,NULL,6,'/admin/delais.php?leftmenu=setup','','Alerts','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87529,'smartphone',1,NULL,'left','home',87521,NULL,NULL,7,'/admin/perms.php?leftmenu=setup','','Security','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87530,'smartphone',1,NULL,'left','home',87521,NULL,NULL,9,'/admin/mails.php?leftmenu=setup','','Emails','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87531,'smartphone',1,NULL,'left','home',87521,NULL,NULL,8,'/admin/limits.php?leftmenu=setup','','MenuLimits','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87532,'smartphone',1,NULL,'left','home',87521,NULL,NULL,10,'/admin/dict.php?leftmenu=setup','','DictionarySetup','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87533,'smartphone',1,NULL,'left','home',87521,NULL,NULL,11,'/admin/const.php?leftmenu=setup','','OtherSetup','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87621,'smartphone',1,NULL,'left','home',87422,NULL,NULL,1,'/admin/system/index.php?leftmenu=system','','SystemInfo','admin',0,'','','$user->admin',2,'2013-02-24 18:29:15'),(87622,'smartphone',1,NULL,'left','home',87621,NULL,NULL,0,'/admin/system/dolibarr.php?leftmenu=system','','Dolibarr','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87623,'smartphone',1,NULL,'left','home',87622,NULL,NULL,1,'/admin/system/constall.php?leftmenu=system','','AllParameters','admin',2,'','','1',2,'2013-02-24 18:29:15'),(87624,'smartphone',1,NULL,'left','home',87622,NULL,NULL,4,'/admin/system/about.php?leftmenu=system','','About','admin',2,'','','1',2,'2013-02-24 18:29:15'),(87625,'smartphone',1,NULL,'left','home',87621,NULL,NULL,1,'/admin/system/os.php?leftmenu=system','','OS','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87626,'smartphone',1,NULL,'left','home',87621,NULL,NULL,2,'/admin/system/web.php?leftmenu=system','','WebServer','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87627,'smartphone',1,NULL,'left','home',87621,NULL,NULL,3,'/admin/system/phpinfo.php?leftmenu=system','','Php','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87628,'smartphone',1,NULL,'left','home',87622,NULL,NULL,3,'/admin/triggers.php?leftmenu=system','','Triggers','admin',2,'','','1',2,'2013-02-24 18:29:15'),(87629,'smartphone',1,NULL,'left','home',87622,NULL,NULL,2,'/admin/system/modules.php?leftmenu=system','','Modules','admin',2,'','','1',2,'2013-02-24 18:29:15'),(87631,'smartphone',1,NULL,'left','home',87621,NULL,NULL,4,'/admin/system/database.php?leftmenu=system','','Database','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87632,'smartphone',1,NULL,'left','home',87631,NULL,NULL,0,'/admin/system/database-tables.php?leftmenu=system','','Tables','admin',2,'','','1',2,'2013-02-24 18:29:15'),(87721,'smartphone',1,NULL,'left','home',87422,NULL,NULL,2,'/admin/tools/index.php?leftmenu=admintools','','SystemTools','admin',0,'','','$user->admin',2,'2013-02-24 18:29:15'),(87722,'smartphone',1,NULL,'left','home',87721,NULL,NULL,0,'/admin/tools/dolibarr_export.php?leftmenu=admintools','','Backup','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87723,'smartphone',1,NULL,'left','home',87721,NULL,NULL,1,'/admin/tools/dolibarr_import.php?leftmenu=admintools','','Restore','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87724,'smartphone',1,NULL,'left','home',87721,NULL,NULL,6,'/admin/tools/purge.php?leftmenu=admintools','','Purge','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87725,'smartphone',1,NULL,'left','home',87721,NULL,NULL,3,'/admin/tools/eaccelerator.php?leftmenu=admintools','','EAccelerator','admin',1,'','','1 && function_exists(\'eaccelerator_info\')',2,'2013-02-24 18:29:15'),(87726,'smartphone',1,NULL,'left','home',87721,NULL,NULL,2,'/admin/tools/update.php?leftmenu=admintools','','MenuUpgrade','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87727,'smartphone',1,NULL,'left','home',87721,NULL,NULL,4,'/admin/tools/listevents.php?leftmenu=admintools','','Audit','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87728,'smartphone',1,NULL,'left','home',87721,NULL,NULL,7,'/support/index.php?leftmenu=admintools','_blank','HelpCenter','help',1,'','','1',2,'2013-02-24 18:29:15'),(87729,'smartphone',1,NULL,'left','home',87721,NULL,NULL,5,'/admin/tools/listsessions.php?leftmenu=admintools','','Sessions','admin',1,'','','1',2,'2013-02-24 18:29:15'),(87821,'smartphone',1,NULL,'left','home',87422,NULL,NULL,3,'/user/home.php?leftmenu=users','','MenuUsersAndGroups','users',0,'','','1',2,'2013-02-24 18:29:15'),(87822,'smartphone',1,NULL,'left','home',87821,NULL,NULL,0,'/user/index.php?leftmenu=users','','Users','users',1,'','$user->rights->user->user->lire || $user->admin','1',2,'2013-02-24 18:29:15'),(87823,'smartphone',1,NULL,'left','home',87822,NULL,NULL,0,'/user/fiche.php?leftmenu=users&action=create','','NewUser','users',2,'','$user->rights->user->user->creer || $user->admin','1',2,'2013-02-24 18:29:15'),(87824,'smartphone',1,NULL,'left','home',87821,NULL,NULL,1,'/user/group/index.php?leftmenu=users','','Groups','users',1,'','($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin','1',2,'2013-02-24 18:29:15'),(87825,'smartphone',1,NULL,'left','home',87824,NULL,NULL,0,'/user/group/fiche.php?leftmenu=users&action=create','','NewGroup','users',2,'','($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin','1',2,'2013-02-24 18:29:15'),(87921,'smartphone',1,NULL,'left','companies',87423,NULL,NULL,0,'/societe/societe.php','','ThirdParty','companies',0,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2013-02-24 18:29:15'),(87922,'smartphone',1,NULL,'left','companies',87921,NULL,NULL,0,'/societe/soc.php?action=create','','MenuNewThirdParty','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2013-02-24 18:29:15'),(87924,'smartphone',1,NULL,'left','companies',87921,NULL,NULL,5,'/fourn/liste.php?leftmenu=suppliers','','ListSuppliersShort','suppliers',1,'','$user->rights->societe->lire && $user->rights->fournisseur->lire','$conf->societe->enabled && $conf->fournisseur->enabled',2,'2013-02-24 18:29:15'),(87925,'smartphone',1,NULL,'left','companies',87924,NULL,NULL,0,'/societe/soc.php?leftmenu=supplier&action=create&type=f','','NewSupplier','suppliers',2,'','$user->rights->societe->creer','$conf->societe->enabled && $conf->fournisseur->enabled',2,'2013-02-24 18:29:15'),(87927,'smartphone',1,NULL,'left','companies',87921,NULL,NULL,3,'/comm/prospect/list.php?leftmenu=prospects','','ListProspectsShort','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2013-02-24 18:29:15'),(87928,'smartphone',1,NULL,'left','companies',87927,NULL,NULL,0,'/societe/soc.php?leftmenu=prospects&action=create&type=p','','MenuNewProspect','companies',2,'','$user->rights->societe->creer','$conf->societe->enabled',2,'2013-02-24 18:29:15'),(87930,'smartphone',1,NULL,'left','companies',87921,NULL,NULL,4,'/comm/list.php?leftmenu=customers','','ListCustomersShort','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2013-02-24 18:29:15'),(87931,'smartphone',1,NULL,'left','companies',87930,NULL,NULL,0,'/societe/soc.php?leftmenu=customers&action=create&type=c','','MenuNewCustomer','companies',2,'','$user->rights->societe->creer','$conf->societe->enabled',2,'2013-02-24 18:29:15'),(88021,'smartphone',1,NULL,'left','companies',87423,NULL,NULL,1,'/contact/list.php?leftmenu=contacts','','ContactsAddresses||Contacts@$conf->global->SOCIETE_ADDRESSES_MANAGEMENT','companies',0,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2013-02-24 18:29:15'),(88022,'smartphone',1,NULL,'left','companies',88021,NULL,NULL,0,'/contact/fiche.php?leftmenu=contacts&action=create','','NewContactAddress||NewContact@$conf->global->SOCIETE_ADDRESSES_MANAGEMENT','companies',1,'','$user->rights->societe->creer','$conf->societe->enabled',2,'2013-02-24 18:29:15'),(88023,'smartphone',1,NULL,'left','companies',88021,NULL,NULL,1,'/contact/list.php?leftmenu=contacts','','List','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2013-02-24 18:29:15'),(88025,'smartphone',1,NULL,'left','companies',88023,NULL,NULL,1,'/contact/list.php?leftmenu=contacts&type=p','','Prospects','companies',2,'','$user->rights->societe->contact->lire','$conf->societe->enabled',2,'2013-02-24 18:29:15'),(88026,'smartphone',1,NULL,'left','companies',88023,NULL,NULL,2,'/contact/list.php?leftmenu=contacts&type=c','','Customers','companies',2,'','$user->rights->societe->contact->lire','$conf->societe->enabled',2,'2013-02-24 18:29:15'),(88027,'smartphone',1,NULL,'left','companies',88023,NULL,NULL,3,'/contact/list.php?leftmenu=contacts&type=f','','Suppliers','companies',2,'','$user->rights->societe->contact->lire','$conf->societe->enabled && $conf->fournisseur->enabled',2,'2013-02-24 18:29:15'),(88028,'smartphone',1,NULL,'left','companies',88023,NULL,NULL,4,'/contact/list.php?leftmenu=contacts&type=o','','Others','companies',2,'','$user->rights->societe->contact->lire','$conf->societe->enabled',2,'2013-02-24 18:29:15'),(88071,'smartphone',1,NULL,'left','companies',87423,NULL,NULL,3,'/categories/index.php?leftmenu=cat&type=1','','SuppliersCategoriesShort','categories',0,'','$user->rights->categorie->lire','$conf->societe->enabled && $conf->categorie->enabled',2,'2013-02-24 18:29:15'),(88072,'smartphone',1,NULL,'left','companies',88071,NULL,NULL,0,'/categories/fiche.php?action=create&type=1','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->societe->enabled && $conf->categorie->enabled',2,'2013-02-24 18:29:15'),(88081,'smartphone',1,NULL,'left','companies',87423,NULL,NULL,4,'/categories/index.php?leftmenu=cat&type=2','','CustomersProspectsCategoriesShort','categories',0,'','$user->rights->categorie->lire','$conf->fournisseur->enabled && $conf->categorie->enabled',2,'2013-02-24 18:29:15'),(88082,'smartphone',1,NULL,'left','companies',88081,NULL,NULL,0,'/categories/fiche.php?action=create&type=2','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->fournisseur->enabled && $conf->categorie->enabled',2,'2013-02-24 18:29:15'),(88121,'smartphone',1,NULL,'left','commercial',87426,NULL,NULL,1,'/comm/prospect/index.php?leftmenu=prospects','','Prospects','companies',0,'','$user->rights->societe->lire','$conf->societe->enabled',0,'2013-02-24 18:29:15'),(88122,'smartphone',1,NULL,'left','commercial',88121,NULL,NULL,0,'/societe/soc.php?leftmenu=prospects&action=create&type=p','','MenuNewProspect','companies',1,'','$user->rights->societe->creer','$conf->societe->enabled',0,'2013-02-24 18:29:15'),(88123,'smartphone',1,NULL,'left','commercial',88121,NULL,NULL,1,'/comm/prospect/list.php?leftmenu=prospects','','List','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',0,'2013-02-24 18:29:15'),(88124,'smartphone',1,NULL,'left','commercial',88123,NULL,NULL,0,'/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=-1','','LastProspectDoNotContact','companies',2,'','$user->rights->societe->lire','$conf->societe->enabled && $leftmenu==\"prospects\"',0,'2013-02-24 18:29:15'),(88125,'smartphone',1,NULL,'left','commercial',88123,NULL,NULL,1,'/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=0','','LastProspectNeverContacted','companies',2,'','$user->rights->societe->lire','$conf->societe->enabled && $leftmenu==\"prospects\"',0,'2013-02-24 18:29:15'),(88126,'smartphone',1,NULL,'left','commercial',88123,NULL,NULL,2,'/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=1','','LastProspectToContact','companies',2,'','$user->rights->societe->lire','$conf->societe->enabled && $leftmenu==\"prospects\"',0,'2013-02-24 18:29:15'),(88127,'smartphone',1,NULL,'left','commercial',88123,NULL,NULL,3,'/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=2','','LastProspectContactInProcess','companies',2,'','$user->rights->societe->lire','$conf->societe->enabled && $leftmenu==\"prospects\"',0,'2013-02-24 18:29:15'),(88128,'smartphone',1,NULL,'left','commercial',88123,NULL,NULL,4,'/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=3','','LastProspectContactDone','companies',2,'','$user->rights->societe->lire','$conf->societe->enabled && $leftmenu==\"prospects\"',0,'2013-02-24 18:29:15'),(88129,'smartphone',1,NULL,'left','commercial',88121,NULL,NULL,2,'/contact/list.php?leftmenu=prospects&type=p','','Contacts','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',0,'2013-02-24 18:29:15'),(88221,'smartphone',1,NULL,'left','commercial',87426,NULL,NULL,2,'/comm/index.php?leftmenu=customers','','Customers','companies',0,'','$user->rights->societe->lire','$conf->societe->enabled',0,'2013-02-24 18:29:15'),(88222,'smartphone',1,NULL,'left','commercial',88221,NULL,NULL,0,'/societe/soc.php?leftmenu=customers&action=create&type=c','','MenuNewCustomer','companies',1,'','$user->rights->societe->creer','$conf->societe->enabled',0,'2013-02-24 18:29:15'),(88223,'smartphone',1,NULL,'left','commercial',88221,NULL,NULL,1,'/comm/list.php?leftmenu=customers','','List','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',0,'2013-02-24 18:29:15'),(88224,'smartphone',1,NULL,'left','commercial',88221,NULL,NULL,2,'/contact/list.php?leftmenu=customers&type=c','','Contacts','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',0,'2013-02-24 18:29:15'),(88321,'smartphone',1,NULL,'left','commercial',87426,NULL,NULL,3,'/contact/list.php?leftmenu=contacts','','Contacts','companies',0,'','$user->rights->societe->lire','$conf->societe->enabled',0,'2013-02-24 18:29:15'),(88322,'smartphone',1,NULL,'left','commercial',88321,NULL,NULL,0,'/contact/fiche.php?leftmenu=contacts&action=create','','NewContactAddress||NewContact@$conf->global->SOCIETE_ADDRESSES_MANAGEMENT','companies',1,'','$user->rights->societe->creer','$conf->societe->enabled',0,'2013-02-24 18:29:15'),(88323,'smartphone',1,NULL,'left','commercial',88321,NULL,NULL,1,'/contact/list.php?leftmenu=contacts&action=create','','List','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',0,'2013-02-24 18:29:15'),(88331,'smartphone',1,NULL,'left','commercial',88323,NULL,NULL,1,'/contact/list.php?leftmenu=contacts&type=p','','Prospects','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled && $leftmenu==\"prospects\"',0,'2013-02-24 18:29:15'),(88332,'smartphone',1,NULL,'left','commercial',88323,NULL,NULL,1,'/contact/list.php?leftmenu=contacts&type=c','','Customers','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled && $leftmenu==\"prospects\"',0,'2013-02-24 18:29:15'),(88333,'smartphone',1,NULL,'left','commercial',88323,NULL,NULL,1,'/contact/list.php?leftmenu=contacts&type=f','','Suppliers','companies',1,'','$user->rights->societe->lire && $user->rights->fournisseur->lire','$conf->societe->enabled && $conf->fournisseur->enabled && $leftmenu==\"prospects\"',0,'2013-02-24 18:29:15'),(88334,'smartphone',1,NULL,'left','commercial',88323,NULL,NULL,1,'/contact/list.php?leftmenu=contacts&type=o','','Other','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled && $leftmenu==\"prospects\"',0,'2013-02-24 18:29:15'),(88521,'smartphone',1,NULL,'left','commercial',87426,NULL,NULL,4,'/comm/propal.php?leftmenu=propals','','Prop','propal',0,'','$user->rights->propale->lire','$conf->propal->enabled',2,'2013-02-24 18:29:15'),(88522,'smartphone',1,NULL,'left','commercial',88521,NULL,NULL,0,'/societe/societe.php?leftmenu=propals','','NewPropal','propal',1,'','$user->rights->propale->creer','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2013-02-24 18:29:15'),(88523,'smartphone',1,NULL,'left','commercial',88521,NULL,NULL,1,'/comm/propal.php?viewstatut=0','','PropalsDraft','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2013-02-24 18:29:15'),(88524,'smartphone',1,NULL,'left','commercial',88521,NULL,NULL,2,'/comm/propal.php?viewstatut=1','','PropalsOpened','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2013-02-24 18:29:15'),(88525,'smartphone',1,NULL,'left','commercial',88521,NULL,NULL,3,'/comm/propal.php?viewstatut=2,3,4','','PropalStatusClosedShort','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2013-02-24 18:29:15'),(88526,'smartphone',1,NULL,'left','commercial',88521,NULL,NULL,4,'/comm/propal/stats/index.php?leftmenu=propals','','Statistics','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2013-02-24 18:29:15'),(88621,'smartphone',1,NULL,'left','commercial',87426,NULL,NULL,5,'/commande/index.php?leftmenu=orders','','CustomersOrders','orders',0,'','$user->rights->commande->lire','$conf->commande->enabled',2,'2013-02-24 18:29:15'),(88622,'smartphone',1,NULL,'left','commercial',88621,NULL,NULL,0,'/societe/societe.php?leftmenu=orders','','NewOrder','orders',1,'','$user->rights->commande->creer','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2013-02-24 18:29:15'),(88623,'smartphone',1,NULL,'left','commercial',88621,NULL,NULL,1,'/commande/liste.php?leftmenu=orders','','List','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2013-02-24 18:29:15'),(88624,'smartphone',1,NULL,'left','commercial',88623,NULL,NULL,2,'/commande/liste.php?leftmenu=orders&viewstatut=0','','StatusOrderDraftShort','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2013-02-24 18:29:15'),(88625,'smartphone',1,NULL,'left','commercial',88623,NULL,NULL,3,'/commande/liste.php?leftmenu=orders&viewstatut=1','','StatusOrderValidated','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2013-02-24 18:29:15'),(88626,'smartphone',1,NULL,'left','commercial',88623,NULL,NULL,4,'/commande/liste.php?leftmenu=orders&viewstatut=2','','StatusOrderOnProcessShort','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2013-02-24 18:29:15'),(88627,'smartphone',1,NULL,'left','commercial',88623,NULL,NULL,5,'/commande/liste.php?leftmenu=orders&viewstatut=3','','StatusOrderToBill','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2013-02-24 18:29:15'),(88628,'smartphone',1,NULL,'left','commercial',88623,NULL,NULL,6,'/commande/liste.php?leftmenu=orders&viewstatut=4','','StatusOrderProcessed','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2013-02-24 18:29:15'),(88629,'smartphone',1,NULL,'left','commercial',88623,NULL,NULL,7,'/commande/liste.php?leftmenu=orders&viewstatut=-1','','StatusOrderCanceledShort','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2013-02-24 18:29:15'),(88630,'smartphone',1,NULL,'left','commercial',88621,NULL,NULL,4,'/commande/stats/index.php?leftmenu=orders','','Statistics','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2013-02-24 18:29:15'),(88721,'smartphone',1,NULL,'left','commercial',87424,NULL,NULL,6,'/expedition/index.php?leftmenu=sendings','','Shipments','orders',0,'','$user->rights->expedition->lire','$conf->expedition->enabled',2,'2013-02-24 18:29:15'),(88722,'smartphone',1,NULL,'left','commercial',88721,NULL,NULL,0,'/expedition/liste.php?leftmenu=sendings','','List','orders',1,'','$user->rights->expedition->lire','$conf->expedition->enabled && $leftmenu==\"sendings\"',2,'2013-02-24 18:29:15'),(88723,'smartphone',1,NULL,'left','commercial',88721,NULL,NULL,1,'/expedition/stats/index.php?leftmenu=sendings','','Statistics','orders',1,'','$user->rights->expedition->lire','$conf->expedition->enabled && $leftmenu==\"sendings\"',2,'2013-02-24 18:29:15'),(88821,'smartphone',1,NULL,'left','commercial',87426,NULL,NULL,7,'/contrat/index.php?leftmenu=contracts','','Contracts','contracts',0,'','$user->rights->contrat->lire','$conf->contrat->enabled',2,'2013-02-24 18:29:15'),(88822,'smartphone',1,NULL,'left','commercial',88821,NULL,NULL,0,'/societe/societe.php?leftmenu=contracts','','NewContract','contracts',1,'','$user->rights->contrat->creer','$conf->contrat->enabled',2,'2013-02-24 18:29:15'),(88823,'smartphone',1,NULL,'left','commercial',88821,NULL,NULL,1,'/contrat/liste.php?leftmenu=contracts','','List','contracts',1,'','$user->rights->contrat->lire','$conf->contrat->enabled',2,'2013-02-24 18:29:15'),(88824,'smartphone',1,NULL,'left','commercial',88821,NULL,NULL,2,'/contrat/services.php?leftmenu=contracts','','MenuServices','contracts',1,'','$user->rights->contrat->lire','$conf->contrat->enabled',2,'2013-02-24 18:29:15'),(88825,'smartphone',1,NULL,'left','commercial',88824,NULL,NULL,0,'/contrat/services.php?leftmenu=contracts&mode=0','','MenuInactiveServices','contracts',2,'','$user->rights->contrat->lire','$conf->contrat->enabled&&$leftmenu==\"contracts\"',2,'2013-02-24 18:29:15'),(88826,'smartphone',1,NULL,'left','commercial',88824,NULL,NULL,1,'/contrat/services.php?leftmenu=contracts&mode=4','','MenuRunningServices','contracts',2,'','$user->rights->contrat->lire','$conf->contrat->enabled&&$leftmenu==\"contracts\"',2,'2013-02-24 18:29:15'),(88827,'smartphone',1,NULL,'left','commercial',88824,NULL,NULL,2,'/contrat/services.php?leftmenu=contracts&mode=4&filter=expired','','MenuExpiredServices','contracts',2,'','$user->rights->contrat->lire','$conf->contrat->enabled&&$leftmenu==\"contracts\"',2,'2013-02-24 18:29:15'),(88828,'smartphone',1,NULL,'left','commercial',88824,NULL,NULL,3,'/contrat/services.php?leftmenu=contracts&mode=5','','MenuClosedServices','contracts',2,'','$user->rights->contrat->lire','$conf->contrat->enabled&&$leftmenu==\"contracts\"',2,'2013-02-24 18:29:15'),(88921,'smartphone',1,NULL,'left','commercial',87426,NULL,NULL,8,'/fichinter/list.php?leftmenu=ficheinter','','Interventions','interventions',0,'','$user->rights->ficheinter->lire','$conf->ficheinter->enabled',2,'2013-02-24 18:29:15'),(88922,'smartphone',1,NULL,'left','commercial',88921,NULL,NULL,0,'/fichinter/fiche.php?action=create&leftmenu=ficheinter','','NewIntervention','interventions',1,'','$user->rights->ficheinter->creer','$conf->ficheinter->enabled && $leftmenu==\"ficheinter\"',2,'2013-02-24 18:29:15'),(88923,'smartphone',1,NULL,'left','commercial',88921,NULL,NULL,1,'/fichinter/list.php?leftmenu=ficheinter','','List','interventions',1,'','$user->rights->ficheinter->lire','$conf->ficheinter->enabled && $leftmenu==\"ficheinter\"',2,'2013-02-24 18:29:15'),(89021,'smartphone',1,NULL,'left','accountancy',87427,NULL,NULL,3,'/fourn/facture/index.php?leftmenu=suppliers_bills','','BillsSuppliers','bills',0,'','$user->rights->fournisseur->facture->lire','$conf->fournisseur->enabled',2,'2013-02-24 18:29:15'),(89022,'smartphone',1,NULL,'left','accountancy',89021,NULL,NULL,0,'/fourn/facture/fiche.php?action=create&leftmenu=suppliers_bills','','NewBill','bills',1,'','$user->rights->fournisseur->facture->creer','$conf->fournisseur->enabled',2,'2013-02-24 18:29:15'),(89023,'smartphone',1,NULL,'left','accountancy',89021,NULL,NULL,1,'/fourn/facture/impayees.php?leftmenu=suppliers_bills','','Unpaid','bills',1,'','$user->rights->fournisseur->facture->lire','$conf->fournisseur->enabled',2,'2013-02-24 18:29:15'),(89024,'smartphone',1,NULL,'left','accountancy',89021,NULL,NULL,2,'/fourn/facture/paiement.php?leftmenu=suppliers_bills','','Payments','bills',1,'','$user->rights->fournisseur->facture->lire','$conf->fournisseur->enabled',2,'2013-02-24 18:29:15'),(89121,'smartphone',1,NULL,'left','accountancy',87427,NULL,NULL,3,'/compta/facture/list.php?leftmenu=customers_bills','','BillsCustomers','bills',0,'','$user->rights->facture->lire','$conf->societe->enabled',2,'2013-02-24 18:29:15'),(89122,'smartphone',1,NULL,'left','accountancy',89121,NULL,NULL,3,'/compta/clients.php?action=facturer&leftmenu=customers_bills','','NewBill','bills',1,'','$user->rights->facture->creer','$conf->societe->enabled',2,'2013-02-24 18:29:15'),(89123,'smartphone',1,NULL,'left','accountancy',89121,NULL,NULL,4,'/compta/facture/fiche-rec.php?leftmenu=customers_bills','','Repeatable','bills',1,'','$user->rights->facture->lire','$conf->societe->enabled',2,'2013-02-24 18:29:15'),(89124,'smartphone',1,NULL,'left','accountancy',89121,NULL,NULL,5,'/compta/facture/impayees.php?action=facturer&leftmenu=customers_bills','','Unpaid','bills',1,'','$user->rights->facture->lire','$conf->societe->enabled',2,'2013-02-24 18:29:15'),(89125,'smartphone',1,NULL,'left','accountancy',89121,NULL,NULL,6,'/compta/paiement/liste.php?leftmenu=customers_bills','','Payments','bills',1,'','$user->rights->facture->lire','$conf->societe->enabled',2,'2013-02-24 18:29:15'),(89131,'smartphone',1,NULL,'left','accountancy',89125,NULL,NULL,1,'/compta/paiement/rapport.php?leftmenu=customers_bills','','Reportings','bills',2,'','$user->rights->facture->lire','$conf->societe->enabled',2,'2013-02-24 18:29:15'),(89132,'smartphone',1,NULL,'left','accountancy',87435,NULL,NULL,9,'/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank','','MenuChequeDeposits','bills',0,'','$user->rights->facture->lire','$conf->facture->enabled && $conf->banque->enabled',2,'2013-02-24 18:29:15'),(89133,'smartphone',1,NULL,'left','accountancy',89132,NULL,NULL,0,'/compta/paiement/cheque/fiche.php?leftmenu=checks&action=new','','NewCheckDeposit','bills',1,'','$user->rights->facture->lire','$conf->facture->enabled && $conf->banque->enabled',2,'2013-02-24 18:29:15'),(89134,'smartphone',1,NULL,'left','accountancy',89132,NULL,NULL,1,'/compta/paiement/cheque/liste.php?leftmenu=checks','','List','bills',1,'','$user->rights->facture->lire','$conf->facture->enabled && $conf->banque->enabled',2,'2013-02-24 18:29:15'),(89135,'smartphone',1,NULL,'left','accountancy',89121,NULL,NULL,8,'/compta/facture/stats/index.php?leftmenu=customers_bills','','Statistics','bills',1,'','$user->rights->facture->lire','$conf->facture->enabled && $conf->banque->enabled',2,'2013-02-24 18:29:15'),(89321,'smartphone',1,NULL,'left','accountancy',87427,NULL,NULL,3,'/commande/liste.php?leftmenu=orders&viewstatut=3','','MenuOrdersToBill','orders',0,'','$user->rights->commande->lire','$conf->commande->enabled',0,'2013-02-24 18:29:15'),(89421,'smartphone',1,NULL,'left','accountancy',87427,NULL,NULL,4,'/compta/dons/index.php?leftmenu=donations&mainmenu=accountancy','','Donations','donations',0,'','$user->rights->don->lire','$conf->don->enabled',2,'2013-02-24 18:29:15'),(89422,'smartphone',1,NULL,'left','accountancy',89421,NULL,NULL,0,'/compta/dons/fiche.php?leftmenu=donations&mainmenu=accountancy&action=create','','NewDonation','donations',1,'','$user->rights->don->creer','$conf->don->enabled && $leftmenu==\"donations\"',2,'2013-02-24 18:29:15'),(89423,'smartphone',1,NULL,'left','accountancy',89421,NULL,NULL,1,'/compta/dons/liste.php?leftmenu=donations&mainmenu=accountancy','','List','donations',1,'','$user->rights->don->lire','$conf->don->enabled && $leftmenu==\"donations\"',2,'2013-02-24 18:29:15'),(89521,'smartphone',1,NULL,'left','accountancy',87427,NULL,NULL,5,'/compta/deplacement/index.php?leftmenu=tripsandexpenses','','TripsAndExpenses','trips',0,'','$user->rights->deplacement->lire','$conf->deplacement->enabled',0,'2013-02-24 18:29:15'),(89522,'smartphone',1,NULL,'left','accountancy',89521,NULL,NULL,1,'/compta/deplacement/fiche.php?action=create&leftmenu=tripsandexpenses','','New','trips',1,'','$user->rights->deplacement->creer','$conf->deplacement->enabled && $leftmenu==\"tripsandexpenses\"',0,'2013-02-24 18:29:15'),(89523,'smartphone',1,NULL,'left','accountancy',89521,NULL,NULL,2,'/compta/deplacement/index.php?leftmenu=tripsandexpenses','','List','trips',1,'','$user->rights->deplacement->lire','$conf->deplacement->enabled && $leftmenu==\"tripsandexpenses\"',0,'2013-02-24 18:29:15'),(89524,'smartphone',1,NULL,'left','accountancy',89521,NULL,NULL,2,'/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses','','Statistics','trips',1,'','$user->rights->deplacement->lire','$conf->deplacement->enabled && $leftmenu==\"tripsandexpenses\"',0,'2013-02-24 18:29:15'),(89621,'smartphone',1,NULL,'left','accountancy',87427,NULL,NULL,6,'/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy','','MenuTaxAndDividends','compta',0,'','$user->rights->tax->charges->lire','$conf->tax->enabled',0,'2013-02-24 18:29:15'),(89622,'smartphone',1,NULL,'left','accountancy',89621,NULL,NULL,1,'/compta/sociales/index.php?leftmenu=tax_social','','SocialContributions','',1,'','$user->rights->tax->charges->lire','$conf->tax->enabled',0,'2013-02-24 18:29:15'),(89623,'smartphone',1,NULL,'left','accountancy',89622,NULL,NULL,2,'/compta/sociales/charges.php?leftmenu=tax_social&action=create','','MenuNewSocialContribution','',2,'','$user->rights->tax->charges->creer','$conf->tax->enabled && $leftmenu==\"tax_social\"',0,'2013-02-24 18:29:15'),(89624,'smartphone',1,NULL,'left','accountancy',89622,NULL,NULL,3,'/compta/charges/index.php?leftmenu=tax_social&mainmenu=accountancy&mode=sconly','','Payments','',2,'','$user->rights->tax->charges->lire','$conf->tax->enabled && $leftmenu==\"tax_social\"',0,'2013-02-24 18:29:15'),(89721,'smartphone',1,NULL,'left','accountancy',89621,NULL,NULL,7,'/compta/tva/index.php?leftmenu=tax_vat&mainmenu=accountancy','','VAT','companies',1,'','$user->rights->tax->charges->lire','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS)',0,'2013-02-24 18:29:15'),(89722,'smartphone',1,NULL,'left','accountancy',89721,NULL,NULL,0,'/compta/tva/fiche.php?leftmenu=tax_vat&action=create','','NewPayment','companies',2,'','$user->rights->tax->charges->creer','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu==\"tax_vat\"',0,'2013-02-24 18:29:15'),(89723,'smartphone',1,NULL,'left','accountancy',89721,NULL,NULL,1,'/compta/tva/reglement.php?leftmenu=tax_vat','','Payments','companies',2,'','$user->rights->tax->charges->lire','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu==\"tax_vat\"',0,'2013-02-24 18:29:15'),(89724,'smartphone',1,NULL,'left','accountancy',89721,NULL,NULL,2,'/compta/tva/clients.php?leftmenu=tax_vat','','ReportByCustomers','companies',2,'','$user->rights->tax->charges->lire','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu==\"tax_vat\"',0,'2013-02-24 18:29:15'),(89725,'smartphone',1,NULL,'left','accountancy',89721,NULL,NULL,3,'/compta/tva/quadri_detail.php?leftmenu=tax_vat','','ReportByQuarter','companies',2,'','$user->rights->tax->charges->lire','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu==\"tax_vat\"',0,'2013-02-24 18:29:15'),(89821,'smartphone',1,NULL,'left','accountancy',87427,NULL,NULL,8,'/compta/ventilation/index.php?leftmenu=ventil','','Ventilation','companies',0,'','$user->rights->compta->ventilation->lire','$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION',0,'2013-02-24 18:29:15'),(89822,'smartphone',1,NULL,'left','accountancy',89821,NULL,NULL,0,'/compta/ventilation/liste.php','','ToDispatch','companies',1,'','$user->rights->compta->ventilation->lire','$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION',0,'2013-02-24 18:29:15'),(89823,'smartphone',1,NULL,'left','accountancy',89821,NULL,NULL,1,'/compta/ventilation/lignes.php','','Dispatched','companies',1,'','$user->rights->compta->ventilation->lire','$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION',0,'2013-02-24 18:29:15'),(89824,'smartphone',1,NULL,'left','accountancy',89821,NULL,NULL,2,'/compta/param/','','Setup','companies',1,'','$user->rights->compta->ventilation->parametrer','$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION',0,'2013-02-24 18:29:15'),(89825,'smartphone',1,NULL,'left','accountancy',89824,NULL,NULL,0,'/compta/param/comptes/liste.php','','List','companies',2,'','$user->rights->compta->ventilation->parametrer','$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION',0,'2013-02-24 18:29:15'),(89826,'smartphone',1,NULL,'left','accountancy',89824,NULL,NULL,1,'/compta/param/comptes/fiche.php?action=create','','New','companies',2,'','$user->rights->compta->ventilation->parametrer','$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION',0,'2013-02-24 18:29:15'),(89827,'smartphone',1,NULL,'left','accountancy',89821,NULL,NULL,3,'/compta/export/','','Export','companies',1,'','$user->rights->compta->ventilation->lire','$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION',0,'2013-02-24 18:29:15'),(89828,'smartphone',1,NULL,'left','accountancy',89827,NULL,NULL,0,'/compta/export/index.php','','New','companies',2,'','$user->rights->compta->ventilation->lire','$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION',0,'2013-02-24 18:29:15'),(89829,'smartphone',1,NULL,'left','accountancy',89827,NULL,NULL,1,'/compta/export/liste.php','','List','companies',2,'','$user->rights->compta->ventilation->lire','$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION',0,'2013-02-24 18:29:15'),(89921,'smartphone',1,NULL,'left','accountancy',87435,NULL,NULL,9,'/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank','','StandingOrders','withdrawals',0,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled',2,'2013-02-24 18:29:15'),(89922,'smartphone',1,NULL,'left','accountancy',89921,NULL,NULL,1,'/compta/prelevement/demandes.php?status=0&leftmenu=withdraw','','StandingOrderToProcess','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2013-02-24 18:29:15'),(89923,'smartphone',1,NULL,'left','accountancy',89921,NULL,NULL,0,'/compta/prelevement/create.php?leftmenu=withdraw','','NewStandingOrder','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2013-02-24 18:29:15'),(89924,'smartphone',1,NULL,'left','accountancy',89921,NULL,NULL,2,'/compta/prelevement/bons.php?leftmenu=withdraw','','WithdrawalsReceipts','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2013-02-24 18:29:15'),(89925,'smartphone',1,NULL,'left','accountancy',89921,NULL,NULL,3,'/compta/prelevement/liste.php?leftmenu=withdraw','','WithdrawalsLines','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2013-02-24 18:29:15'),(89927,'smartphone',1,NULL,'left','accountancy',89921,NULL,NULL,5,'/compta/prelevement/rejets.php?leftmenu=withdraw','','Rejects','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2013-02-24 18:29:15'),(89928,'smartphone',1,NULL,'left','accountancy',89921,NULL,NULL,6,'/compta/prelevement/stats.php?leftmenu=withdraw','','Statistics','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2013-02-24 18:29:15'),(90021,'smartphone',1,NULL,'left','accountancy',87435,NULL,NULL,1,'/compta/bank/index.php?leftmenu=bank&mainmenu=bank','','MenuBankCash','banks',0,'','$user->rights->banque->lire','$conf->banque->enabled',0,'2013-02-24 18:29:15'),(90022,'smartphone',1,NULL,'left','accountancy',90021,NULL,NULL,0,'/compta/bank/fiche.php?action=create&leftmenu=bank','','MenuNewFinancialAccount','banks',1,'','$user->rights->banque->configurer','$conf->banque->enabled && $leftmenu==bank',0,'2013-02-24 18:29:15'),(90023,'smartphone',1,NULL,'left','accountancy',90021,NULL,NULL,1,'/compta/bank/categ.php?leftmenu=bank','','Rubriques','categories',1,'','$user->rights->banque->configurer','$conf->banque->enabled && $leftmenu==bank',0,'2013-02-24 18:29:15'),(90024,'smartphone',1,NULL,'left','accountancy',90021,NULL,NULL,2,'/compta/bank/search.php?leftmenu=bank','','ListTransactions','banks',1,'','$user->rights->banque->lire','$conf->banque->enabled && $leftmenu==bank',0,'2013-02-24 18:29:15'),(90025,'smartphone',1,NULL,'left','accountancy',90021,NULL,NULL,3,'/compta/bank/budget.php?leftmenu=bank','','ListTransactionsByCategory','banks',1,'','$user->rights->banque->lire','$conf->banque->enabled && $leftmenu==bank',0,'2013-02-24 18:29:15'),(90027,'smartphone',1,NULL,'left','accountancy',90021,NULL,NULL,5,'/compta/bank/virement.php?leftmenu=bank','','BankTransfers','banks',1,'','$user->rights->banque->transfer','$conf->banque->enabled && $leftmenu==bank',0,'2013-02-24 18:29:15'),(90121,'smartphone',1,NULL,'left','accountancy',87427,NULL,NULL,11,'/compta/resultat/index.php?leftmenu=ca&mainmenu=accountancy','','Reportings','main',0,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled || $conf->accounting->enabled',0,'2013-02-24 18:29:15'),(90122,'smartphone',1,NULL,'left','accountancy',90121,NULL,NULL,0,'/compta/resultat/index.php?leftmenu=ca','','ReportInOut','main',1,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled || $conf->accounting->enabled',0,'2013-02-24 18:29:15'),(90123,'smartphone',1,NULL,'left','accountancy',90122,NULL,NULL,0,'/compta/resultat/clientfourn.php?leftmenu=ca','','ByCompanies','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled || $conf->accounting->enabled',0,'2013-02-24 18:29:15'),(90124,'smartphone',1,NULL,'left','accountancy',90121,NULL,NULL,1,'/compta/stats/index.php?leftmenu=ca','','ReportTurnover','main',1,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled || $conf->accounting->enabled',0,'2013-02-24 18:29:15'),(90125,'smartphone',1,NULL,'left','accountancy',90124,NULL,NULL,0,'/compta/stats/casoc.php?leftmenu=ca','','ByCompanies','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled || $conf->accounting->enabled',0,'2013-02-24 18:29:15'),(90126,'smartphone',1,NULL,'left','accountancy',90124,NULL,NULL,1,'/compta/stats/cabyuser.php?leftmenu=ca','','ByUsers','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled || $conf->accounting->enabled',0,'2013-02-24 18:29:15'),(90221,'smartphone',1,NULL,'left','products',87424,NULL,NULL,0,'/product/index.php?leftmenu=product&type=0','','Products','products',0,'','$user->rights->produit->lire','$conf->product->enabled',2,'2013-02-24 18:29:15'),(90222,'smartphone',1,NULL,'left','products',90221,NULL,NULL,0,'/product/fiche.php?leftmenu=product&action=create&type=0','','NewProduct','products',1,'','$user->rights->produit->creer','$conf->product->enabled',2,'2013-02-24 18:29:15'),(90223,'smartphone',1,NULL,'left','products',90221,NULL,NULL,1,'/product/liste.php?leftmenu=product&type=0','','List','products',1,'','$user->rights->produit->lire','$conf->product->enabled',2,'2013-02-24 18:29:15'),(90224,'smartphone',1,NULL,'left','products',90221,NULL,NULL,4,'/product/reassort.php?type=0','','Stocks','products',1,'','$user->rights->produit->lire && $user->rights->stock->lire','$conf->product->enabled',2,'2013-02-24 18:29:15'),(90321,'smartphone',1,NULL,'left','products',87424,NULL,NULL,1,'/product/index.php?leftmenu=service&type=1','','Services','products',0,'','$user->rights->service->lire','$conf->service->enabled',2,'2013-02-24 18:29:15'),(90322,'smartphone',1,NULL,'left','products',90321,NULL,NULL,0,'/product/fiche.php?leftmenu=service&action=create&type=1','','NewService','products',1,'','$user->rights->service->creer','$conf->service->enabled',2,'2013-02-24 18:29:15'),(90323,'smartphone',1,NULL,'left','products',90321,NULL,NULL,1,'/product/liste.php?leftmenu=service&type=1','','List','products',1,'','$user->rights->service->lire','$conf->service->enabled',2,'2013-02-24 18:29:15'),(90421,'smartphone',1,NULL,'left','products',87424,NULL,NULL,2,'/product/stats/index.php?leftmenu=stats','','Statistics','main',0,'','$user->rights->service->lire','$conf->product->enabled || $conf->service->enabled',2,'2013-02-24 18:29:15'),(90422,'smartphone',1,NULL,'left','products',90421,NULL,NULL,0,'/product/popuprop.php?leftmenu=stats','','Popularity','main',1,'','$user->rights->produit->lire && $user->rights->produit>lire','$conf->propal->enabled',2,'2013-02-24 18:29:15'),(90521,'smartphone',1,NULL,'left','products',87424,NULL,NULL,3,'/product/stock/index.php?leftmenu=stock','','Stock','stocks',0,'','$user->rights->stock->lire','$conf->stock->enabled',2,'2013-02-24 18:29:15'),(90522,'smartphone',1,NULL,'left','products',90521,NULL,NULL,0,'/product/stock/fiche.php?action=create','','MenuNewWarehouse','stocks',1,'','$user->rights->stock->creer','$conf->stock->enabled',2,'2013-02-24 18:29:15'),(90523,'smartphone',1,NULL,'left','products',90521,NULL,NULL,1,'/product/stock/liste.php','','List','stocks',1,'','$user->rights->stock->lire','$conf->stock->enabled',2,'2013-02-24 18:29:15'),(90524,'smartphone',1,NULL,'left','products',90521,NULL,NULL,2,'/product/stock/valo.php','','EnhancedValue','stocks',1,'','$user->rights->stock->lire','$conf->stock->enabled',2,'2013-02-24 18:29:15'),(90525,'smartphone',1,NULL,'left','products',90521,NULL,NULL,3,'/product/stock/mouvement.php','','Movements','stocks',1,'','$user->rights->stock->mouvement->lire','$conf->stock->enabled',2,'2013-02-24 18:29:15'),(90621,'smartphone',1,NULL,'left','products',87424,NULL,NULL,4,'/categories/index.php?leftmenu=cat&type=0','','Categories','categories',0,'','$user->rights->categorie->lire','$conf->categorie->enabled',2,'2013-02-24 18:29:15'),(90622,'smartphone',1,NULL,'left','products',90621,NULL,NULL,0,'/categories/fiche.php?action=create&type=0','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->categorie->enabled',2,'2013-02-24 18:29:15'),(91021,'smartphone',1,NULL,'left','project',87428,NULL,NULL,0,'/projet/index.php?leftmenu=projects','','Projects','projects',0,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2013-02-24 18:29:15'),(91022,'smartphone',1,NULL,'left','project',91021,NULL,NULL,1,'/projet/fiche.php?leftmenu=projects&action=create','','NewProject','projects',1,'','$user->rights->projet->creer','$conf->projet->enabled',2,'2013-02-24 18:29:15'),(91023,'smartphone',1,NULL,'left','project',91021,NULL,NULL,2,'/projet/liste.php?leftmenu=projects','','List','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2013-02-24 18:29:15'),(91031,'smartphone',1,NULL,'left','project',87428,NULL,NULL,0,'/projet/index.php?leftmenu=projects&mode=mine','','MyProjects','projects',0,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2013-02-24 18:29:15'),(91032,'smartphone',1,NULL,'left','project',91031,NULL,NULL,1,'/projet/fiche.php?leftmenu=projects&action=create&mode=mine','','NewProject','projects',1,'','$user->rights->projet->creer','$conf->projet->enabled',2,'2013-02-24 18:29:15'),(91033,'smartphone',1,NULL,'left','project',91031,NULL,NULL,2,'/projet/liste.php?leftmenu=projects&mode=mine','','List','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2013-02-24 18:29:15'),(91121,'smartphone',1,NULL,'left','project',87428,NULL,NULL,0,'/projet/activity/index.php?leftmenu=projects','','Activities','projects',0,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2013-02-24 18:29:15'),(91122,'smartphone',1,NULL,'left','project',91121,NULL,NULL,1,'/projet/tasks.php?leftmenu=projects&action=create','','NewTask','projects',1,'','$user->rights->projet->creer','$conf->projet->enabled',2,'2013-02-24 18:29:15'),(91123,'smartphone',1,NULL,'left','project',91121,NULL,NULL,2,'/projet/tasks/index.php?leftmenu=projects','','List','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2013-02-24 18:29:15'),(91124,'smartphone',1,NULL,'left','project',91121,NULL,NULL,3,'/projet/activity/list.php?leftmenu=projects','','NewTimeSpent','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2013-02-24 18:29:15'),(91221,'smartphone',1,NULL,'left','project',87428,NULL,NULL,0,'/projet/activity/index.php?leftmenu=projects&mode=mine','','MyActivities','projects',0,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2013-02-24 18:29:15'),(91222,'smartphone',1,NULL,'left','project',91221,NULL,NULL,1,'/projet/tasks.php?leftmenu=projects&action=create&mode=mine','','NewTask','projects',1,'','$user->rights->projet->creer','$conf->projet->enabled',2,'2013-02-24 18:29:15'),(91223,'smartphone',1,NULL,'left','project',91221,NULL,NULL,2,'/projet/tasks/index.php?leftmenu=projects&mode=mine','','List','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2013-02-24 18:29:15'),(91224,'smartphone',1,NULL,'left','project',91221,NULL,NULL,3,'/projet/activity/list.php?leftmenu=projects&mode=mine','','NewTimeSpent','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2013-02-24 18:29:15'),(91321,'smartphone',1,NULL,'left','tools',87429,NULL,NULL,0,'/comm/mailing/index.php?leftmenu=mailing','','EMailings','mails',0,'','$user->rights->mailing->lire','$conf->mailing->enabled',0,'2013-02-24 18:29:15'),(91322,'smartphone',1,NULL,'left','tools',91321,NULL,NULL,0,'/comm/mailing/fiche.php?leftmenu=mailing&action=create','','NewMailing','mails',1,'','$user->rights->mailing->creer','$conf->mailing->enabled',0,'2013-02-24 18:29:15'),(91323,'smartphone',1,NULL,'left','tools',91321,NULL,NULL,1,'/comm/mailing/liste.php?leftmenu=mailing','','List','mails',1,'','$user->rights->mailing->lire','$conf->mailing->enabled',0,'2013-02-24 18:29:15'),(91521,'smartphone',1,NULL,'left','tools',87429,NULL,NULL,2,'/exports/index.php?leftmenu=export','','FormatedExport','exports',0,'','$user->rights->export->lire','$conf->export->enabled',2,'2013-02-24 18:29:15'),(91522,'smartphone',1,NULL,'left','tools',91521,NULL,NULL,0,'/exports/export.php?leftmenu=export','','NewExport','exports',1,'','$user->rights->export->creer','$conf->export->enabled',2,'2013-02-24 18:29:15'),(91551,'smartphone',1,NULL,'left','tools',87429,NULL,NULL,2,'/imports/index.php?leftmenu=import','','FormatedImport','exports',0,'','$user->rights->import->run','$conf->import->enabled',2,'2013-02-24 18:29:15'),(91552,'smartphone',1,NULL,'left','tools',91551,NULL,NULL,0,'/imports/import.php?leftmenu=import','','NewImport','exports',1,'','$user->rights->import->run','$conf->import->enabled',2,'2013-02-24 18:29:15'),(91621,'smartphone',1,NULL,'left','members',87434,NULL,NULL,0,'/adherents/index.php?leftmenu=members&mainmenu=members','','Members','members',0,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2013-02-24 18:29:15'),(91622,'smartphone',1,NULL,'left','members',91621,NULL,NULL,0,'/adherents/fiche.php?action=create','','NewMember','members',1,'','$user->rights->adherent->creer','$conf->adherent->enabled',2,'2013-02-24 18:29:15'),(91623,'smartphone',1,NULL,'left','members',91621,NULL,NULL,1,'/adherents/liste.php','','List','members',1,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2013-02-24 18:29:15'),(91624,'smartphone',1,NULL,'left','members',91623,NULL,NULL,2,'/adherents/liste.php?statut=-1','','MenuMembersToValidate','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2013-02-24 18:29:15'),(91625,'smartphone',1,NULL,'left','members',91623,NULL,NULL,3,'/adherents/liste.php?statut=1','','MenuMembersValidated','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2013-02-24 18:29:15'),(91626,'smartphone',1,NULL,'left','members',91623,NULL,NULL,4,'/adherents/liste.php?statut=1&filter=outofdate','','MenuMembersNotUpToDate','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2013-02-24 18:29:15'),(91627,'smartphone',1,NULL,'left','members',91623,NULL,NULL,5,'/adherents/liste.php?statut=1&filter=uptodate','','MenuMembersUpToDate','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2013-02-24 18:29:15'),(91628,'smartphone',1,NULL,'left','members',91623,NULL,NULL,6,'/adherents/liste.php?statut=0','','MenuMembersResiliated','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2013-02-24 18:29:15'),(91721,'smartphone',1,NULL,'left','members',87434,NULL,NULL,1,'/adherents/index.php?leftmenu=accountancy&mainmenu=members','','Subscriptions','compta',0,'','$user->rights->adherent->cotisation->lire','$conf->adherent->enabled',2,'2013-02-24 18:29:15'),(91722,'smartphone',1,NULL,'left','members',91721,NULL,NULL,0,'/adherents/liste.php?statut=-1&leftmenu=accountancy&mainmenu=members','','NewSubscription','compta',1,'','$user->rights->adherent->cotisation->creer','$conf->adherent->enabled',2,'2013-02-24 18:29:15'),(91723,'smartphone',1,NULL,'left','members',91721,NULL,NULL,1,'/adherents/cotisations.php?leftmenu=accountancy','','List','compta',1,'','$user->rights->adherent->cotisation->lire','$conf->adherent->enabled',2,'2013-02-24 18:29:15'),(91921,'smartphone',1,NULL,'left','members',87434,NULL,NULL,3,'/adherents/index.php?leftmenu=export&mainmenu=members','','Exports','members',0,'','$user->rights->adherent->export','$conf->adherent->enabled',2,'2013-02-24 18:29:15'),(91922,'smartphone',1,NULL,'left','members',91921,NULL,NULL,0,'/exports/index.php?leftmenu=export','','Datas','members',1,'','$user->rights->adherent->export','$conf->adherent->enabled && $conf->export->enabled',2,'2013-02-24 18:29:15'),(91923,'smartphone',1,NULL,'left','members',91921,NULL,NULL,1,'/adherents/htpasswd.php?leftmenu=export','','Filehtpasswd','members',1,'','$user->rights->adherent->export','$conf->adherent->enabled',2,'2013-02-24 18:29:15'),(91924,'smartphone',1,NULL,'left','members',91921,NULL,NULL,2,'/adherents/cartes/carte.php?leftmenu=export','','MembersCards','members',1,'','$user->rights->adherent->export','$conf->adherent->enabled',2,'2013-02-24 18:29:15'),(92121,'smartphone',1,NULL,'left','members',87434,NULL,NULL,5,'/adherents/index.php?leftmenu=setup&mainmenu=members','','Setup','members',0,'','$user->rights->adherent->configurer','$conf->adherent->enabled',2,'2013-02-24 18:29:15'),(92122,'smartphone',1,NULL,'left','members',92121,NULL,NULL,0,'/adherents/type.php?leftmenu=setup','','MembersTypes','members',1,'','$user->rights->adherent->configurer','$conf->adherent->enabled',2,'2013-02-24 18:29:15'),(92123,'smartphone',1,NULL,'left','members',92121,NULL,NULL,1,'/adherents/options.php?leftmenu=setup','','MembersAttributes','members',1,'','$user->rights->adherent->configurer','$conf->adherent->enabled',2,'2013-02-24 18:29:15'),(92421,'smartphone',1,NULL,'left','commercial',87426,NULL,NULL,0,'/compta/index.php?leftmenu=suppliers','','Suppliers','companies',0,'','$user->rights->societe->lire && $user->rights->fournisseur->lire','$conf->fournisseur->enabled',2,'2013-02-24 18:29:15'),(92422,'smartphone',1,NULL,'left','commercial',92421,NULL,NULL,0,'/societe/soc.php?leftmenu=suppliers&action=create&type=f','','NewSupplier','companies',1,'','$user->rights->societe->creer && $user->rights->fournisseur->lire','$conf->fournisseur->enabled',2,'2013-02-24 18:29:15'),(92423,'smartphone',1,NULL,'left','commercial',92421,NULL,NULL,1,'/fourn/liste.php?leftmenu=suppliers','','List','companies',1,'','$user->rights->societe->lire && $user->rights->fournisseur->lire','$conf->fournisseur->enabled',2,'2013-02-24 18:29:15'),(92424,'smartphone',1,NULL,'left','commercial',92421,NULL,NULL,2,'/contact/list.php?leftmenu=suppliers&type=f','','Contacts','companies',1,'','$user->rights->societe->lire && $user->rights->fournisseur->lire','$conf->fournisseur->enabled',2,'2013-02-24 18:29:15'),(92521,'smartphone',1,NULL,'left','commercial',87426,NULL,NULL,6,'/fourn/commande/index.php?leftmenu=orders_suppliers','','SuppliersOrders','orders',0,'','$user->rights->fournisseur->commande->lire','$conf->commande->enabled',2,'2013-02-24 18:29:15'),(92522,'smartphone',1,NULL,'left','commercial',92521,NULL,NULL,0,'/societe/societe.php?leftmenu=orders_suppliers','','NewOrder','orders',1,'','$user->rights->fournisseur->commande->creer','$conf->commande->enabled && $leftmenu==\"orders_suppliers\"',2,'2013-02-24 18:29:15'),(92523,'smartphone',1,NULL,'left','commercial',92521,NULL,NULL,1,'/fourn/commande/liste.php?leftmenu=orders_suppliers&viewstatut=0','','List','orders',1,'','$user->rights->fournisseur->commande->lire','$conf->commande->enabled && $leftmenu==\"orders_suppliers\"',2,'2013-02-24 18:29:15'),(92529,'smartphone',1,NULL,'left','commercial',92521,NULL,NULL,7,'/commande/stats/index.php?leftmenu=orders_suppliers&mode=supplier','','Statistics','orders',1,'','$user->rights->fournisseur->commande->lire','$conf->commande->enabled && $leftmenu==\"orders_suppliers\"',2,'2013-02-24 18:29:15'),(92621,'smartphone',1,NULL,'left','members',87434,NULL,NULL,3,'/categories/index.php?leftmenu=cat&type=3','','MembersCategoriesShort','categories',0,'','$user->rights->categorie->lire','$conf->adherent->enabled && $conf->categorie->enabled',2,'2013-02-24 18:29:15'),(92622,'smartphone',1,NULL,'left','members',92621,NULL,NULL,0,'/categories/fiche.php?action=create&type=3','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->adherent->enabled && $conf->categorie->enabled',2,'2013-02-24 18:29:15'),(103094,'all',2,'agenda','top','agenda',0,NULL,NULL,100,'/comm/action/index.php','','Agenda','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2013-03-13 15:29:19'),(103095,'all',2,'agenda','left','agenda',103094,NULL,NULL,100,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda','','Actions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2013-03-13 15:29:19'),(103096,'all',2,'agenda','left','agenda',103095,NULL,NULL,101,'/comm/action/fiche.php?mainmenu=agenda&leftmenu=agenda&action=create','','NewAction','commercial',NULL,NULL,'($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create)','$conf->agenda->enabled',2,'2013-03-13 15:29:19'),(103097,'all',2,'agenda','left','agenda',103095,NULL,NULL,102,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda','','Calendar','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2013-03-13 15:29:19'),(103098,'all',2,'agenda','left','agenda',103097,NULL,NULL,103,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine','','MenuToDoMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2013-03-13 15:29:19'),(103099,'all',2,'agenda','left','agenda',103097,NULL,NULL,104,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine','','MenuDoneMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2013-03-13 15:29:19'),(103100,'all',2,'agenda','left','agenda',103097,NULL,NULL,105,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=todo','','MenuToDoActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2013-03-13 15:29:19'),(103101,'all',2,'agenda','left','agenda',103097,NULL,NULL,106,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=done','','MenuDoneActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2013-03-13 15:29:19'),(103102,'all',2,'agenda','left','agenda',103095,NULL,NULL,112,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda','','List','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2013-03-13 15:29:19'),(103103,'all',2,'agenda','left','agenda',103102,NULL,NULL,113,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine','','MenuToDoMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2013-03-13 15:29:19'),(103104,'all',2,'agenda','left','agenda',103102,NULL,NULL,114,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine','','MenuDoneMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2013-03-13 15:29:19'),(103105,'all',2,'agenda','left','agenda',103102,NULL,NULL,115,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=todo','','MenuToDoActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2013-03-13 15:29:19'),(103106,'all',2,'agenda','left','agenda',103102,NULL,NULL,116,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=done','','MenuDoneActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2013-03-13 15:29:19'),(103107,'all',2,'agenda','left','agenda',103095,NULL,NULL,120,'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda','','Reportings','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$conf->agenda->enabled',2,'2013-03-13 15:29:19'),(103108,'all',2,'pos','top','pos',0,NULL,NULL,100,'/pos/backend/listefac.php','','POS','pos@pos',NULL,'1','1','1',2,'2013-03-13 20:33:09'),(103109,'all',2,'pos','left','pos',103108,NULL,NULL,100,'/pos/backend/liste.php','','Tickets','pos@pos',NULL,NULL,'$user->rights->pos->backend','$conf->global->POS_USE_TICKETS',0,'2013-03-13 20:33:09'),(103110,'all',2,'pos','left','pos',103109,NULL,NULL,100,'/pos/backend/liste.php','','List','main',NULL,NULL,'$user->rights->pos->backend','$conf->global->POS_USE_TICKETS',0,'2013-03-13 20:33:09'),(103111,'all',2,'pos','left','pos',103110,NULL,NULL,100,'/pos/backend/liste.php?viewstatut=0','','StatusTicketDraft','pos@pos',NULL,NULL,'$user->rights->pos->backend','$conf->global->POS_USE_TICKETS',0,'2013-03-13 20:33:09'),(103112,'all',2,'pos','left','@pos',103110,NULL,NULL,100,'/pos/backend/liste.php?viewstatut=1','','StatusTicketClosed','main',NULL,NULL,'$user->rights->pos->backend','$conf->global->POS_USE_TICKETS',0,'2013-03-13 20:33:09'),(103113,'all',2,'pos','left','@pos',103110,NULL,NULL,100,'/pos/backend/liste.php?viewstatut=2','','StatusTicketProcessed','main',NULL,NULL,'$user->rights->pos->backend','$conf->global->POS_USE_TICKETS',0,'2013-03-13 20:33:09'),(103114,'all',2,'pos','left','@pos',103110,NULL,NULL,100,'/pos/backend/liste.php?viewtype=1','','StatusTicketReturned','main',NULL,NULL,'$user->rights->pos->backend','$conf->global->POS_USE_TICKETS',0,'2013-03-13 20:33:09'),(103115,'all',2,'pos','left','pos',103108,NULL,NULL,100,'/pos/backend/listefac.php','','Factures','pos@pos',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103116,'all',2,'pos','left','pos',103115,NULL,NULL,100,'/pos/backend/listefac.php','','List','main',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103117,'all',2,'pos','left','pos',103116,NULL,NULL,100,'/pos/backend/listefac.php?viewstatut=0','','BillStatusDraft','bills',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103118,'all',2,'pos','left','@pos',103116,NULL,NULL,100,'/pos/backend/listefac.php?viewstatut=1','','BillStatusValidated','bills',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103119,'all',2,'pos','left','@pos',103116,NULL,NULL,100,'/pos/backend/listefac.php?viewstatut=2&viewtype=0','','BillStatusPaid','bills',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103120,'all',2,'pos','left','@pos',103116,NULL,NULL,100,'/pos/backend/listefac.php?viewtype=2','','BillStatusReturned','main',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103121,'all',2,'pos','left','@pos',103108,NULL,NULL,100,'/pos/frontend/index.php','','POS','main',NULL,NULL,'$user->rights->pos->frontend','1',0,'2013-03-13 20:33:09'),(103122,'all',2,'pos','left','@pos',103121,NULL,NULL,100,'/pos/frontend/index.php','','NewTicket','main',NULL,NULL,'$user->rights->pos->frontend','1',0,'2013-03-13 20:33:09'),(103123,'all',2,'pos','left','@pos',103121,NULL,NULL,101,'/pos/backend/closes.php','','CloseandArching','main',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103124,'all',2,'pos','left','@pos',103108,NULL,NULL,100,'/pos/backend/terminal/cash.php','','Terminal','main',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103125,'all',2,'pos','left','@pos',103124,NULL,NULL,100,'/pos/backend/terminal/fiche.php?action=create','','NewCash','main',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103126,'all',2,'pos','left','@pos',103124,NULL,NULL,101,'/pos/backend/terminal/cash.php','','List','main',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103127,'all',2,'pos','left','@pos',103123,NULL,NULL,101,'/pos/backend/closes.php?viewstatut=0','','Arqueo','main',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103128,'all',2,'pos','left','@pos',103123,NULL,NULL,102,'/pos/backend/closes.php?viewstatut=1','','Closes','main',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103129,'all',2,'pos','left','@pos',103108,NULL,NULL,102,'/pos/backend/transfers.php','','Transfer','main',NULL,NULL,'$user->rights->pos->transfer','1',0,'2013-03-13 20:33:09'),(103130,'all',2,'pos','left','@pos',103108,NULL,NULL,102,'/pos/backend/resultat/index.php','','Rapport','main',NULL,NULL,'$user->rights->pos->stats','1',0,'2013-03-13 20:33:09'),(103131,'all',2,'pos','left','@pos',103130,NULL,NULL,102,'/pos/backend/resultat/casoc.php','','ReportsCustomer','main',NULL,NULL,'$user->rights->pos->stats','1',0,'2013-03-13 20:33:09'),(103132,'all',2,'pos','left','@pos',103130,NULL,NULL,102,'/pos/backend/resultat/causer.php','','ReportsUser','main',NULL,NULL,'$user->rights->pos->stats','1',0,'2013-03-13 20:33:09'),(103133,'all',2,'pos','left','@pos',103130,NULL,NULL,102,'/pos/backend/resultat/sellsjournal.php','','ReportsSells','main',NULL,NULL,'$user->rights->pos->stats','1',0,'2013-03-13 20:33:09'),(103134,'all',2,'opensurvey','top','opensurvey',0,NULL,NULL,200,'/opensurvey/index.php','','Surveys','opensurvey',NULL,NULL,'$user->rights->opensurvey->survey->read','$conf->opensurvey->enabled',0,'2013-03-13 20:33:42'),(103135,'all',2,'opensurvey','left','opensurvey',-1,NULL,'opensurvey',200,'/opensurvey/index.php?mainmenu=opensurvey&leftmenu=opensurvey','','Survey','opensurvey@opensurvey',NULL,'opensurvey','','$conf->opensurvey->enabled',0,'2013-03-13 20:33:42'),(103136,'all',2,'opensurvey','left','opensurvey',-1,'opensurvey','opensurvey',210,'/opensurvey/public/index.php','_blank','NewSurvey','opensurvey@opensurvey',NULL,'opensurvey_new','','$conf->opensurvey->enabled',0,'2013-03-13 20:33:42'),(103137,'all',2,'opensurvey','left','opensurvey',-1,'opensurvey','opensurvey',220,'/opensurvey/list.php','','List','opensurvey@opensurvey',NULL,'opensurvey_list','','$conf->opensurvey->enabled',0,'2013-03-13 20:33:42'),(103160,'all',1,'cron','left','home',-1,'modulesadmintools','home',200,'/cron/list.php?status=1','','CronListActive','cron',NULL,NULL,'$user->rights->cron->read','$leftmenu==\'modulesadmintools\'',2,'2013-03-23 17:24:25'),(103161,'all',1,'cron','left','home',-1,'modulesadmintools','home',201,'/cron/list.php?status=0','','CronListInactive','cron',NULL,NULL,'$user->rights->cron->read','$leftmenu==\'modulesadmintools\'',2,'2013-03-23 17:24:25'),(103162,'auguria',1,'','top','home',0,NULL,NULL,1,'/index.php?mainmenu=home&leftmenu=','','Home','',-1,'','','1',2,'2013-03-24 02:31:47'),(103163,'auguria',1,'societe|fournisseur','top','companies',0,NULL,NULL,2,'/societe/index.php?mainmenu=companies&leftmenu=','','ThirdParties','companies',-1,'','$user->rights->societe->lire || $user->rights->societe->contact->lire','$conf->societe->enabled || $conf->fournisseur->enabled',2,'2013-03-24 02:31:47'),(103164,'auguria',1,'product|service','top','products',0,NULL,NULL,3,'/product/index.php?mainmenu=products&leftmenu=','','Products/Services','products',-1,'','$user->rights->produit->lire||$user->rights->service->lire','$conf->product->enabled || $conf->service->enabled',0,'2013-03-24 02:31:47'),(103166,'auguria',1,'propal|commande|fournisseur|contrat|ficheinter','top','commercial',0,NULL,NULL,5,'/comm/index.php?mainmenu=commercial&leftmenu=','','Commercial','commercial',-1,'','$user->rights->societe->lire || $user->rights->societe->contact->lire','$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->deplacement->enabled || $conf->don->enabled || $conf->tax->enabled',2,'2013-03-24 02:31:47'),(103167,'auguria',1,'comptabilite|accounting|facture|deplacement|don|tax','top','accountancy',0,NULL,NULL,6,'/compta/index.php?mainmenu=accountancy&leftmenu=','','MenuFinancial','compta',-1,'','$user->rights->compta->resultat->lire || $user->rights->accounting->plancompte->lire || $user->rights->facture->lire|| $user->rights->deplacement->lire || $user->rights->don->lire || $user->rights->tax->charges->lire','$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->deplacement->enabled || $conf->don->enabled || $conf->tax->enabled',2,'2013-03-24 02:31:47'),(103168,'auguria',1,'projet','top','project',0,NULL,NULL,7,'/projet/index.php?mainmenu=project&leftmenu=','','Projects','projects',-1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2013-03-24 02:31:47'),(103169,'auguria',1,'mailing|export|import','top','tools',0,NULL,NULL,8,'/core/tools.php?mainmenu=tools&leftmenu=','','Tools','other',-1,'','$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run','$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled',2,'2013-03-24 02:31:47'),(103174,'auguria',1,'adherent','top','members',0,NULL,NULL,15,'/adherents/index.php?mainmenu=members&leftmenu=','','Members','members',-1,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2013-03-24 02:31:47'),(103175,'auguria',1,'banque|prelevement','top','bank',0,NULL,NULL,6,'/compta/bank/index.php?mainmenu=bank&leftmenu=bank','','MenuBankCash','banks',-1,'','$user->rights->banque->lire || $user->rights->prelevement->bons->lire','$conf->banque->enabled || $conf->prelevement->enabled',0,'2013-03-24 02:31:47'),(103261,'auguria',1,'','left','home',103162,NULL,NULL,0,'/admin/index.php?leftmenu=setup','','Setup','admin',0,'setup','','$user->admin',2,'2013-03-24 02:31:47'),(103262,'auguria',1,'','left','home',103261,NULL,NULL,1,'/admin/company.php?leftmenu=setup','','MenuCompanySetup','admin',1,'','','$leftmenu==\'setup\'',2,'2013-03-24 02:31:47'),(103263,'auguria',1,'','left','home',103261,NULL,NULL,4,'/admin/ihm.php?leftmenu=setup','','GUISetup','admin',1,'','','$leftmenu==\'setup\'',2,'2013-03-24 02:31:47'),(103264,'auguria',1,'','left','home',103261,NULL,NULL,2,'/admin/modules.php?leftmenu=setup','','Modules','admin',1,'','','$leftmenu==\'setup\'',2,'2013-03-24 02:31:47'),(103265,'auguria',1,'','left','home',103261,NULL,NULL,5,'/admin/boxes.php?leftmenu=setup','','Boxes','admin',1,'','','$leftmenu==\'setup\'',2,'2013-03-24 02:31:47'),(103266,'auguria',1,'','left','home',103261,NULL,NULL,3,'/admin/menus.php?leftmenu=setup','','Menus','admin',1,'','','$leftmenu==\'setup\'',2,'2013-03-24 02:31:47'),(103267,'auguria',1,'','left','home',103261,NULL,NULL,6,'/admin/delais.php?leftmenu=setup','','Alerts','admin',1,'','','$leftmenu==\'setup\'',2,'2013-03-24 02:31:47'),(103268,'auguria',1,'','left','home',103261,NULL,NULL,9,'/admin/pdf.php?leftmenu=setup','','PDF','admin',1,'','','$leftmenu==\'setup\'',2,'2013-03-24 02:31:47'),(103269,'auguria',1,'','left','home',103261,NULL,NULL,7,'/admin/proxy.php?leftmenu=setup','','Security','admin',1,'','','$leftmenu==\'setup\'',2,'2013-03-24 02:31:47'),(103270,'auguria',1,'','left','home',103261,NULL,NULL,10,'/admin/mails.php?leftmenu=setup','','Emails','admin',1,'','','$leftmenu==\'setup\'',2,'2013-03-24 02:31:47'),(103271,'auguria',1,'','left','home',103261,NULL,NULL,8,'/admin/limits.php?leftmenu=setup','','MenuLimits','admin',1,'','','$leftmenu==\'setup\'',2,'2013-03-24 02:31:47'),(103272,'auguria',1,'','left','home',103261,NULL,NULL,12,'/admin/dict.php?leftmenu=setup','','DictionnarySetup','admin',1,'','','$leftmenu==\'setup\'',2,'2013-03-24 02:31:47'),(103273,'auguria',1,'','left','home',103261,NULL,NULL,13,'/admin/const.php?leftmenu=setup','','OtherSetup','admin',1,'','','$leftmenu==\'setup\'',2,'2013-03-24 02:31:47'),(103274,'auguria',1,'','left','home',103261,NULL,NULL,11,'/admin/sms.php?leftmenu=setup','','Sms','admin',1,'','','$leftmenu==\'setup\'',2,'2013-03-24 02:31:47'),(103362,'auguria',1,'','left','home',103461,NULL,NULL,0,'/admin/system/dolibarr.php?leftmenu=admintools','','InfoDolibarr','admin',1,'','','$leftmenu==\'admintools\'',2,'2013-03-24 02:31:47'),(103364,'auguria',1,'','left','home',103461,NULL,NULL,13,'/admin/system/about.php?leftmenu=admintools','','About','admin',1,'','','$leftmenu==\'admintools\'',2,'2013-03-24 02:31:47'),(103365,'auguria',1,'','left','home',103461,NULL,NULL,1,'/admin/system/os.php?leftmenu=admintools','','InfoOS','admin',1,'','','$leftmenu==\'admintools\'',2,'2013-03-24 02:31:47'),(103366,'auguria',1,'','left','home',103461,NULL,NULL,2,'/admin/system/web.php?leftmenu=admintools','','InfoWebServer','admin',1,'','','$leftmenu==\'admintools\'',2,'2013-03-24 02:31:47'),(103367,'auguria',1,'','left','home',103461,NULL,NULL,3,'/admin/system/phpinfo.php?leftmenu=admintools','','InfoPHP','admin',1,'','','$leftmenu==\'admintools\'',2,'2013-03-24 02:31:47'),(103368,'auguria',1,'','left','home',103362,NULL,NULL,3,'/admin/triggers.php?leftmenu=admintools','','Triggers','admin',2,'','','$leftmenu==\'admintools\'',2,'2013-03-24 02:31:47'),(103369,'auguria',1,'','left','home',103362,NULL,NULL,2,'/admin/system/modules.php?leftmenu=admintools','','Modules','admin',2,'','','$leftmenu==\'admintools\'',2,'2013-03-24 02:31:47'),(103371,'auguria',1,'','left','home',103461,NULL,NULL,4,'/admin/system/database.php?leftmenu=admintools','','InfoDatabase','admin',1,'','','$leftmenu==\'admintools\'',2,'2013-03-24 02:31:47'),(103461,'auguria',1,'','left','home',103162,NULL,NULL,2,'/admin/tools/index.php?leftmenu=admintools','','SystemTools','admin',0,'admintools','','$user->admin',2,'2013-03-24 02:31:47'),(103462,'auguria',1,'','left','home',103461,NULL,NULL,5,'/admin/tools/dolibarr_export.php?leftmenu=admintools','','Backup','admin',1,'','','$leftmenu==\'admintools\'',2,'2013-03-24 02:31:47'),(103463,'auguria',1,'','left','home',103461,NULL,NULL,6,'/admin/tools/dolibarr_import.php?leftmenu=admintools','','Restore','admin',1,'','','$leftmenu==\'admintools\'',2,'2013-03-24 02:31:47'),(103464,'auguria',1,'','left','home',103461,NULL,NULL,11,'/admin/tools/purge.php?leftmenu=admintools','','Purge','admin',1,'','','$leftmenu==\'admintools\'',2,'2013-03-24 02:31:47'),(103465,'auguria',1,'','left','home',103461,NULL,NULL,8,'/admin/tools/eaccelerator.php?leftmenu=admintools','','EAccelerator','admin',1,'','','$leftmenu==\'admintools\' && function_exists(\'eaccelerator_info\')',2,'2013-03-24 02:31:47'),(103466,'auguria',1,'','left','home',103461,NULL,NULL,7,'/admin/tools/update.php?leftmenu=admintools','','MenuUpgrade','admin',1,'','','$leftmenu==\'admintools\'',2,'2013-03-24 02:31:47'),(103467,'auguria',1,'','left','home',103461,NULL,NULL,9,'/admin/tools/listevents.php?leftmenu=admintools','','Audit','admin',1,'','','$leftmenu==\'admintools\'',2,'2013-03-24 02:31:47'),(103468,'auguria',1,'','left','home',103461,NULL,NULL,12,'/support/index.php?leftmenu=admintools','_blank','HelpCenter','help',1,'','','$leftmenu==\'admintools\'',2,'2013-03-24 02:31:47'),(103469,'auguria',1,'','left','home',103461,NULL,NULL,10,'/admin/tools/listsessions.php?leftmenu=admintools','','Sessions','admin',1,'','','$leftmenu==\'admintools\'',2,'2013-03-24 02:31:47'),(103561,'auguria',1,'','left','home',103162,NULL,NULL,3,'/user/home.php?leftmenu=users','','MenuUsersAndGroups','users',0,'users','','1',2,'2013-03-24 02:31:47'),(103562,'auguria',1,'','left','home',103561,NULL,NULL,0,'/user/index.php?leftmenu=users','','Users','users',1,'','$user->rights->user->user->lire || $user->admin','$leftmenu==\'users\'',2,'2013-03-24 02:31:47'),(103563,'auguria',1,'','left','home',103562,NULL,NULL,0,'/user/fiche.php?leftmenu=users&action=create','','NewUser','users',2,'','$user->rights->user->user->creer || $user->admin','$leftmenu==\'users\'',2,'2013-03-24 02:31:47'),(103564,'auguria',1,'','left','home',103561,NULL,NULL,1,'/user/group/index.php?leftmenu=users','','Groups','users',1,'','($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin','$leftmenu==\'users\'',2,'2013-03-24 02:31:47'),(103565,'auguria',1,'','left','home',103564,NULL,NULL,0,'/user/group/fiche.php?leftmenu=users&action=create','','NewGroup','users',2,'','($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin','$leftmenu==\'users\'',2,'2013-03-24 02:31:47'),(103661,'auguria',1,'','left','companies',103163,NULL,NULL,0,'/societe/index.php?leftmenu=thirdparties','','ThirdParty','companies',0,'thirdparties','$user->rights->societe->lire','$conf->societe->enabled',2,'2013-03-24 02:31:47'),(103662,'auguria',1,'','left','companies',103661,NULL,NULL,0,'/societe/soc.php?action=create','','MenuNewThirdParty','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2013-03-24 02:31:47'),(103664,'auguria',1,'','left','companies',103661,NULL,NULL,5,'/fourn/liste.php?leftmenu=suppliers','','ListSuppliersShort','suppliers',1,'','$user->rights->societe->lire && $user->rights->fournisseur->lire','$conf->societe->enabled && $conf->fournisseur->enabled',2,'2013-03-24 02:31:47'),(103665,'auguria',1,'','left','companies',103664,NULL,NULL,0,'/societe/soc.php?leftmenu=supplier&action=create&type=f','','NewSupplier','suppliers',2,'','$user->rights->societe->creer','$conf->societe->enabled && $conf->fournisseur->enabled',2,'2013-03-24 02:31:47'),(103667,'auguria',1,'','left','companies',103661,NULL,NULL,3,'/comm/prospect/list.php?leftmenu=prospects','','ListProspectsShort','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2013-03-24 02:31:47'),(103668,'auguria',1,'','left','companies',103667,NULL,NULL,0,'/societe/soc.php?leftmenu=prospects&action=create&type=p','','MenuNewProspect','companies',2,'','$user->rights->societe->creer','$conf->societe->enabled',2,'2013-03-24 02:31:47'),(103670,'auguria',1,'','left','companies',103661,NULL,NULL,4,'/comm/list.php?leftmenu=customers','','ListCustomersShort','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2013-03-24 02:31:47'),(103671,'auguria',1,'','left','companies',103670,NULL,NULL,0,'/societe/soc.php?leftmenu=customers&action=create&type=c','','MenuNewCustomer','companies',2,'','$user->rights->societe->creer','$conf->societe->enabled',2,'2013-03-24 02:31:47'),(103761,'auguria',1,'','left','companies',103163,NULL,NULL,1,'/contact/list.php?leftmenu=contacts','','ContactsAddresses','companies',0,'contacts','$user->rights->societe->lire','$conf->societe->enabled',2,'2013-03-24 02:31:47'),(103762,'auguria',1,'','left','companies',103761,NULL,NULL,0,'/contact/fiche.php?leftmenu=contacts&action=create','','NewContactAddress','companies',1,'','$user->rights->societe->creer','$conf->societe->enabled',2,'2013-03-24 02:31:47'),(103763,'auguria',1,'','left','companies',103761,NULL,NULL,1,'/contact/list.php?leftmenu=contacts','','List','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2013-03-24 02:31:47'),(103765,'auguria',1,'','left','companies',103763,NULL,NULL,1,'/contact/list.php?leftmenu=contacts&type=p','','Prospects','companies',2,'','$user->rights->societe->contact->lire','$conf->societe->enabled',2,'2013-03-24 02:31:47'),(103766,'auguria',1,'','left','companies',103763,NULL,NULL,2,'/contact/list.php?leftmenu=contacts&type=c','','Customers','companies',2,'','$user->rights->societe->contact->lire','$conf->societe->enabled',2,'2013-03-24 02:31:47'),(103767,'auguria',1,'','left','companies',103763,NULL,NULL,3,'/contact/list.php?leftmenu=contacts&type=f','','Suppliers','companies',2,'','$user->rights->societe->contact->lire','$conf->societe->enabled && $conf->fournisseur->enabled',2,'2013-03-24 02:31:47'),(103768,'auguria',1,'','left','companies',103763,NULL,NULL,4,'/contact/list.php?leftmenu=contacts&type=o','','Others','companies',2,'','$user->rights->societe->contact->lire','$conf->societe->enabled',2,'2013-03-24 02:31:47'),(103811,'auguria',1,'','left','companies',103163,NULL,NULL,3,'/categories/index.php?leftmenu=cat&type=1','','SuppliersCategoriesShort','categories',0,'cat','$user->rights->categorie->lire','$conf->societe->enabled && $conf->categorie->enabled',2,'2013-03-24 02:31:47'),(103812,'auguria',1,'','left','companies',103811,NULL,NULL,0,'/categories/fiche.php?action=create&type=1','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->societe->enabled && $conf->categorie->enabled',2,'2013-03-24 02:31:47'),(103821,'auguria',1,'','left','companies',103163,NULL,NULL,4,'/categories/index.php?leftmenu=cat&type=2','','CustomersProspectsCategoriesShort','categories',0,'cat','$user->rights->categorie->lire','$conf->fournisseur->enabled && $conf->categorie->enabled',2,'2013-03-24 02:31:47'),(103822,'auguria',1,'','left','companies',103821,NULL,NULL,0,'/categories/fiche.php?action=create&type=2','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->fournisseur->enabled && $conf->categorie->enabled',2,'2013-03-24 02:31:47'),(104261,'auguria',1,'','left','commercial',103166,NULL,NULL,4,'/comm/propal/index.php?leftmenu=propals','','Prop','propal',0,'propals','$user->rights->propale->lire','$conf->propal->enabled',2,'2013-03-24 02:31:47'),(104262,'auguria',1,'','left','commercial',104261,NULL,NULL,0,'/societe/societe.php?leftmenu=propals','','NewPropal','propal',1,'','$user->rights->propale->creer','$conf->propal->enabled',2,'2013-03-24 02:31:47'),(104263,'auguria',1,'','left','commercial',104261,NULL,NULL,1,'/comm/propal/list.php?leftmenu=propals','','List','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled',2,'2013-03-24 02:31:47'),(104264,'auguria',1,'','left','commercial',104263,NULL,NULL,2,'/comm/propal/list.php?leftmenu=propals&viewstatut=0','','PropalsDraft','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2013-03-24 02:31:47'),(104265,'auguria',1,'','left','commercial',104263,NULL,NULL,3,'/comm/propal/list.php?leftmenu=propals&viewstatut=1','','PropalsOpened','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2013-03-24 02:31:47'),(104266,'auguria',1,'','left','commercial',104263,NULL,NULL,4,'/comm/propal/list.php?leftmenu=propals&viewstatut=2','','PropalStatusSigned','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2013-03-24 02:31:47'),(104267,'auguria',1,'','left','commercial',104263,NULL,NULL,5,'/comm/propal/list.php?leftmenu=propals&viewstatut=3','','PropalStatusNotSigned','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2013-03-24 02:31:47'),(104268,'auguria',1,'','left','commercial',104263,NULL,NULL,6,'/comm/propal/list.php?leftmenu=propals&viewstatut=4','','PropalStatusBilled','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2013-03-24 02:31:47'),(104271,'auguria',1,'','left','commercial',104261,NULL,NULL,4,'/comm/propal/stats/index.php?leftmenu=propals','','Statistics','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled',2,'2013-03-24 02:31:47'),(104361,'auguria',1,'','left','commercial',103166,NULL,NULL,5,'/commande/index.php?leftmenu=orders','','CustomersOrders','orders',0,'orders','$user->rights->commande->lire','$conf->commande->enabled',2,'2013-03-24 02:31:47'),(104362,'auguria',1,'','left','commercial',104361,NULL,NULL,0,'/societe/societe.php?leftmenu=orders','','NewOrder','orders',1,'','$user->rights->commande->creer','$conf->commande->enabled',2,'2013-03-24 02:31:47'),(104363,'auguria',1,'','left','commercial',104361,NULL,NULL,1,'/commande/liste.php?leftmenu=orders','','List','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled',2,'2013-03-24 02:31:47'),(104364,'auguria',1,'','left','commercial',104363,NULL,NULL,2,'/commande/liste.php?leftmenu=orders&viewstatut=0','','StatusOrderDraftShort','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2013-03-24 02:31:47'),(104365,'auguria',1,'','left','commercial',104363,NULL,NULL,3,'/commande/liste.php?leftmenu=orders&viewstatut=1','','StatusOrderValidated','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2013-03-24 02:31:47'),(104366,'auguria',1,'','left','commercial',104363,NULL,NULL,4,'/commande/liste.php?leftmenu=orders&viewstatut=2','','StatusOrderOnProcessShort','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2013-03-24 02:31:47'),(104367,'auguria',1,'','left','commercial',104363,NULL,NULL,5,'/commande/liste.php?leftmenu=orders&viewstatut=3','','StatusOrderToBill','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2013-03-24 02:31:47'),(104368,'auguria',1,'','left','commercial',104363,NULL,NULL,6,'/commande/liste.php?leftmenu=orders&viewstatut=4','','StatusOrderProcessed','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2013-03-24 02:31:47'),(104369,'auguria',1,'','left','commercial',104363,NULL,NULL,7,'/commande/liste.php?leftmenu=orders&viewstatut=-1','','StatusOrderCanceledShort','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2013-03-24 02:31:47'),(104370,'auguria',1,'','left','commercial',104361,NULL,NULL,4,'/commande/stats/index.php?leftmenu=orders','','Statistics','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled',2,'2013-03-24 02:31:47'),(104461,'auguria',1,'','left','commercial',103164,NULL,NULL,6,'/expedition/index.php?leftmenu=sendings','','Shipments','sendings',0,'sendings','$user->rights->expedition->lire','$conf->expedition->enabled',2,'2013-03-24 02:31:47'),(104462,'auguria',1,'','left','commercial',104461,NULL,NULL,0,'/expedition/fiche.php?action=create2&leftmenu=sendings','','NewSending','sendings',1,'','$user->rights->expedition->creer','$conf->expedition->enabled && $leftmenu==\"sendings\"',2,'2013-03-24 02:31:47'),(104463,'auguria',1,'','left','commercial',104461,NULL,NULL,1,'/expedition/liste.php?leftmenu=sendings','','List','sendings',1,'','$user->rights->expedition->lire','$conf->expedition->enabled && $leftmenu==\"sendings\"',2,'2013-03-24 02:31:47'),(104464,'auguria',1,'','left','commercial',104461,NULL,NULL,2,'/expedition/stats/index.php?leftmenu=sendings','','Statistics','sendings',1,'','$user->rights->expedition->lire','$conf->expedition->enabled && $leftmenu==\"sendings\"',2,'2013-03-24 02:31:47'),(104561,'auguria',1,'','left','commercial',103166,NULL,NULL,7,'/contrat/index.php?leftmenu=contracts','','Contracts','contracts',0,'contracts','$user->rights->contrat->lire','$conf->contrat->enabled',2,'2013-03-24 02:31:47'),(104562,'auguria',1,'','left','commercial',104561,NULL,NULL,0,'/societe/societe.php?leftmenu=contracts','','NewContract','contracts',1,'','$user->rights->contrat->creer','$conf->contrat->enabled',2,'2013-03-24 02:31:47'),(104563,'auguria',1,'','left','commercial',104561,NULL,NULL,1,'/contrat/liste.php?leftmenu=contracts','','List','contracts',1,'','$user->rights->contrat->lire','$conf->contrat->enabled',2,'2013-03-24 02:31:47'),(104564,'auguria',1,'','left','commercial',104561,NULL,NULL,2,'/contrat/services.php?leftmenu=contracts','','MenuServices','contracts',1,'','$user->rights->contrat->lire','$conf->contrat->enabled',2,'2013-03-24 02:31:47'),(104565,'auguria',1,'','left','commercial',104564,NULL,NULL,0,'/contrat/services.php?leftmenu=contracts&mode=0','','MenuInactiveServices','contracts',2,'','$user->rights->contrat->lire','$conf->contrat->enabled&&$leftmenu==\"contracts\"',2,'2013-03-24 02:31:47'),(104566,'auguria',1,'','left','commercial',104564,NULL,NULL,1,'/contrat/services.php?leftmenu=contracts&mode=4','','MenuRunningServices','contracts',2,'','$user->rights->contrat->lire','$conf->contrat->enabled&&$leftmenu==\"contracts\"',2,'2013-03-24 02:31:47'),(104567,'auguria',1,'','left','commercial',104564,NULL,NULL,2,'/contrat/services.php?leftmenu=contracts&mode=4&filter=expired','','MenuExpiredServices','contracts',2,'','$user->rights->contrat->lire','$conf->contrat->enabled&&$leftmenu==\"contracts\"',2,'2013-03-24 02:31:47'),(104568,'auguria',1,'','left','commercial',104564,NULL,NULL,3,'/contrat/services.php?leftmenu=contracts&mode=5','','MenuClosedServices','contracts',2,'','$user->rights->contrat->lire','$conf->contrat->enabled&&$leftmenu==\"contracts\"',2,'2013-03-24 02:31:47'),(104661,'auguria',1,'','left','commercial',103166,NULL,NULL,8,'/fichinter/list.php?leftmenu=ficheinter','','Interventions','interventions',0,'ficheinter','$user->rights->ficheinter->lire','$conf->ficheinter->enabled',2,'2013-03-24 02:31:47'),(104662,'auguria',1,'','left','commercial',104661,NULL,NULL,0,'/fichinter/fiche.php?action=create&leftmenu=ficheinter','','NewIntervention','interventions',1,'','$user->rights->ficheinter->creer','$conf->ficheinter->enabled',2,'2013-03-24 02:31:47'),(104663,'auguria',1,'','left','commercial',104661,NULL,NULL,1,'/fichinter/list.php?leftmenu=ficheinter','','List','interventions',1,'','$user->rights->ficheinter->lire','$conf->ficheinter->enabled',2,'2013-03-24 02:31:47'),(104761,'auguria',1,'','left','accountancy',103167,NULL,NULL,3,'/fourn/facture/index.php?leftmenu=suppliers_bills','','BillsSuppliers','bills',0,'supplier_bills','$user->rights->fournisseur->facture->lire','$conf->fournisseur->enabled',2,'2013-03-24 02:31:47'),(104762,'auguria',1,'','left','accountancy',104761,NULL,NULL,0,'/fourn/facture/fiche.php?action=create&leftmenu=suppliers_bills','','NewBill','bills',1,'','$user->rights->fournisseur->facture->creer','$conf->fournisseur->enabled',2,'2013-03-24 02:31:47'),(104763,'auguria',1,'','left','accountancy',104761,NULL,NULL,1,'/fourn/facture/impayees.php?leftmenu=suppliers_bills','','Unpaid','bills',1,'','$user->rights->fournisseur->facture->lire','$conf->fournisseur->enabled',2,'2013-03-24 02:31:47'),(104764,'auguria',1,'','left','accountancy',104761,NULL,NULL,2,'/fourn/facture/paiement.php?leftmenu=suppliers_bills','','Payments','bills',1,'','$user->rights->fournisseur->facture->lire','$conf->fournisseur->enabled',2,'2013-03-24 02:31:47'),(104765,'auguria',1,'','left','accountancy',104761,NULL,NULL,8,'/compta/facture/stats/index.php?leftmenu=customers_bills&mode=supplier','','Statistics','bills',1,'','$user->rights->fournisseur->facture->lire','$conf->fournisseur->enabled',2,'2013-03-24 02:31:47'),(104861,'auguria',1,'','left','accountancy',103167,NULL,NULL,3,'/compta/facture/list.php?leftmenu=customers_bills','','BillsCustomers','bills',0,'customer_bills','$user->rights->facture->lire','$conf->facture->enabled',2,'2013-03-24 02:31:47'),(104862,'auguria',1,'','left','accountancy',104861,NULL,NULL,3,'/compta/clients.php?action=facturer&leftmenu=customers_bills','','NewBill','bills',1,'','$user->rights->facture->creer','$conf->facture->enabled',2,'2013-03-24 02:31:47'),(104863,'auguria',1,'','left','accountancy',104861,NULL,NULL,4,'/compta/facture/fiche-rec.php?leftmenu=customers_bills','','Repeatable','bills',1,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2013-03-24 02:31:47'),(104864,'auguria',1,'','left','accountancy',104861,NULL,NULL,5,'/compta/facture/impayees.php?action=facturer&leftmenu=customers_bills','','Unpaid','bills',1,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2013-03-24 02:31:47'),(104865,'auguria',1,'','left','accountancy',104861,NULL,NULL,6,'/compta/paiement/liste.php?leftmenu=customers_bills','','Payments','bills',1,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2013-03-24 02:31:47'),(104871,'auguria',1,'','left','accountancy',104865,NULL,NULL,1,'/compta/paiement/rapport.php?leftmenu=customers_bills','','Reportings','bills',2,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2013-03-24 02:31:47'),(104872,'auguria',1,'','left','accountancy',103175,NULL,NULL,9,'/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank','','MenuChequeDeposits','bills',0,'checks','$user->rights->facture->lire','$conf->facture->enabled && $conf->banque->enabled',2,'2013-03-24 02:31:47'),(104873,'auguria',1,'','left','accountancy',104872,NULL,NULL,0,'/compta/paiement/cheque/fiche.php?leftmenu=checks&action=new','','NewCheckDeposit','compta',1,'','$user->rights->facture->lire','$conf->facture->enabled && $conf->banque->enabled',2,'2013-03-24 02:31:47'),(104874,'auguria',1,'','left','accountancy',104872,NULL,NULL,1,'/compta/paiement/cheque/liste.php?leftmenu=checks','','List','bills',1,'','$user->rights->facture->lire','$conf->facture->enabled && $conf->banque->enabled',2,'2013-03-24 02:31:47'),(104875,'auguria',1,'','left','accountancy',104861,NULL,NULL,8,'/compta/facture/stats/index.php?leftmenu=customers_bills','','Statistics','bills',1,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2013-03-24 02:31:47'),(105061,'auguria',1,'','left','accountancy',103167,NULL,NULL,3,'/commande/liste.php?leftmenu=orders&viewstatut=3','','MenuOrdersToBill','orders',0,'orders','$user->rights->commande->lire','$conf->commande->enabled',0,'2013-03-24 02:31:47'),(105161,'auguria',1,'','left','accountancy',103167,NULL,NULL,4,'/compta/dons/index.php?leftmenu=donations&mainmenu=accountancy','','Donations','donations',0,'donations','$user->rights->don->lire','$conf->don->enabled',2,'2013-03-24 02:31:47'),(105162,'auguria',1,'','left','accountancy',105161,NULL,NULL,0,'/compta/dons/fiche.php?leftmenu=donations&mainmenu=accountancy&action=create','','NewDonation','donations',1,'','$user->rights->don->creer','$conf->don->enabled && $leftmenu==\"donations\"',2,'2013-03-24 02:31:47'),(105163,'auguria',1,'','left','accountancy',105161,NULL,NULL,1,'/compta/dons/liste.php?leftmenu=donations&mainmenu=accountancy','','List','donations',1,'','$user->rights->don->lire','$conf->don->enabled && $leftmenu==\"donations\"',2,'2013-03-24 02:31:47'),(105261,'auguria',1,'','left','accountancy',103167,NULL,NULL,5,'/compta/deplacement/index.php?leftmenu=tripsandexpenses','','TripsAndExpenses','trips',0,'tripsandexpenses','$user->rights->deplacement->lire','$conf->deplacement->enabled',0,'2013-03-24 02:31:47'),(105262,'auguria',1,'','left','accountancy',105261,NULL,NULL,1,'/compta/deplacement/fiche.php?action=create&leftmenu=tripsandexpenses','','New','trips',1,'','$user->rights->deplacement->creer','$conf->deplacement->enabled && $leftmenu==\"tripsandexpenses\"',0,'2013-03-24 02:31:47'),(105263,'auguria',1,'','left','accountancy',105261,NULL,NULL,2,'/compta/deplacement/list.php?leftmenu=tripsandexpenses','','List','trips',1,'','$user->rights->deplacement->lire','$conf->deplacement->enabled && $leftmenu==\"tripsandexpenses\"',0,'2013-03-24 02:31:47'),(105264,'auguria',1,'','left','accountancy',105261,NULL,NULL,2,'/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses','','Statistics','trips',1,'','$user->rights->deplacement->lire','$conf->deplacement->enabled && $leftmenu==\"tripsandexpenses\"',0,'2013-03-24 02:31:47'),(105361,'auguria',1,'','left','accountancy',103167,NULL,NULL,6,'/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy','','MenuTaxAndDividends','compta',0,'tax','$user->rights->tax->charges->lire','$conf->tax->enabled',0,'2013-03-24 02:31:47'),(105362,'auguria',1,'','left','accountancy',105361,NULL,NULL,1,'/compta/sociales/index.php?leftmenu=tax_social','','SocialContributions','',1,'tax_social','$user->rights->tax->charges->lire','$conf->tax->enabled',0,'2013-03-24 02:31:47'),(105363,'auguria',1,'','left','accountancy',105362,NULL,NULL,2,'/compta/sociales/charges.php?leftmenu=tax_social&action=create','','MenuNewSocialContribution','',2,'','$user->rights->tax->charges->creer','$conf->tax->enabled && $leftmenu==\"tax_social\"',0,'2013-03-24 02:31:47'),(105364,'auguria',1,'','left','accountancy',105362,NULL,NULL,3,'/compta/charges/index.php?leftmenu=tax_social&mainmenu=accountancy&mode=sconly','','Payments','',2,'','$user->rights->tax->charges->lire','$conf->tax->enabled && $leftmenu==\"tax_social\"',0,'2013-03-24 02:31:47'),(105461,'auguria',1,'','left','accountancy',105361,NULL,NULL,7,'/compta/tva/index.php?leftmenu=tax_vat&mainmenu=accountancy','','VAT','companies',1,'tax_vat','$user->rights->tax->charges->lire','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS)',0,'2013-03-24 02:31:47'),(105462,'auguria',1,'','left','accountancy',105461,NULL,NULL,0,'/compta/tva/fiche.php?leftmenu=tax_vat&action=create','','NewPayment','companies',2,'','$user->rights->tax->charges->creer','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu==\"tax_vat\"',0,'2013-03-24 02:31:47'),(105463,'auguria',1,'','left','accountancy',105461,NULL,NULL,1,'/compta/tva/reglement.php?leftmenu=tax_vat','','Payments','companies',2,'','$user->rights->tax->charges->lire','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu==\"tax_vat\"',0,'2013-03-24 02:31:47'),(105464,'auguria',1,'','left','accountancy',105461,NULL,NULL,2,'/compta/tva/clients.php?leftmenu=tax_vat','','ReportByCustomers','companies',2,'','$user->rights->tax->charges->lire','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu==\"tax_vat\"',0,'2013-03-24 02:31:47'),(105465,'auguria',1,'','left','accountancy',105461,NULL,NULL,3,'/compta/tva/quadri_detail.php?leftmenu=tax_vat','','ReportByQuarter','companies',2,'','$user->rights->tax->charges->lire','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu==\"tax_vat\"',0,'2013-03-24 02:31:47'),(105561,'auguria',1,'','left','accountancy',103167,NULL,NULL,8,'/compta/ventilation/index.php?leftmenu=ventil','','Ventilation','companies',0,'ventil','$user->rights->compta->ventilation->lire','$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION',0,'2013-03-24 02:31:47'),(105562,'auguria',1,'','left','accountancy',105561,NULL,NULL,0,'/compta/ventilation/liste.php','','ToDispatch','companies',1,'','$user->rights->compta->ventilation->lire','$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION',0,'2013-03-24 02:31:47'),(105563,'auguria',1,'','left','accountancy',105561,NULL,NULL,1,'/compta/ventilation/lignes.php','','Dispatched','companies',1,'','$user->rights->compta->ventilation->lire','$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION',0,'2013-03-24 02:31:47'),(105564,'auguria',1,'','left','accountancy',105561,NULL,NULL,2,'/compta/param/','','Setup','companies',1,'','$user->rights->compta->ventilation->parametrer','$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION',0,'2013-03-24 02:31:47'),(105565,'auguria',1,'','left','accountancy',105564,NULL,NULL,0,'/compta/param/comptes/liste.php','','List','companies',2,'','$user->rights->compta->ventilation->parametrer','$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION',0,'2013-03-24 02:31:47'),(105566,'auguria',1,'','left','accountancy',105564,NULL,NULL,1,'/compta/param/comptes/fiche.php?action=create','','New','companies',2,'','$user->rights->compta->ventilation->parametrer','$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION',0,'2013-03-24 02:31:47'),(105567,'auguria',1,'','left','accountancy',105561,NULL,NULL,3,'/compta/export/','','Export','companies',1,'','$user->rights->compta->ventilation->lire','$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION',0,'2013-03-24 02:31:47'),(105568,'auguria',1,'','left','accountancy',105567,NULL,NULL,0,'/compta/export/index.php','','New','companies',2,'','$user->rights->compta->ventilation->lire','$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION',0,'2013-03-24 02:31:47'),(105569,'auguria',1,'','left','accountancy',105567,NULL,NULL,1,'/compta/export/liste.php','','List','companies',2,'','$user->rights->compta->ventilation->lire','$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION',0,'2013-03-24 02:31:47'),(105661,'auguria',1,'','left','accountancy',103175,NULL,NULL,9,'/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank','','StandingOrders','withdrawals',0,'withdraw','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled',2,'2013-03-24 02:31:47'),(105663,'auguria',1,'','left','accountancy',105661,NULL,NULL,0,'/compta/prelevement/create.php?leftmenu=withdraw','','NewStandingOrder','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2013-03-24 02:31:47'),(105664,'auguria',1,'','left','accountancy',105661,NULL,NULL,2,'/compta/prelevement/bons.php?leftmenu=withdraw','','WithdrawalsReceipts','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2013-03-24 02:31:47'),(105665,'auguria',1,'','left','accountancy',105661,NULL,NULL,3,'/compta/prelevement/liste.php?leftmenu=withdraw','','WithdrawalsLines','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2013-03-24 02:31:47'),(105667,'auguria',1,'','left','accountancy',105661,NULL,NULL,5,'/compta/prelevement/rejets.php?leftmenu=withdraw','','Rejects','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2013-03-24 02:31:47'),(105668,'auguria',1,'','left','accountancy',105661,NULL,NULL,6,'/compta/prelevement/stats.php?leftmenu=withdraw','','Statistics','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2013-03-24 02:31:47'),(105761,'auguria',1,'','left','accountancy',103175,NULL,NULL,1,'/compta/bank/index.php?leftmenu=bank&mainmenu=bank','','MenuBankCash','banks',0,'bank','$user->rights->banque->lire','$conf->banque->enabled',0,'2013-03-24 02:31:47'),(105762,'auguria',1,'','left','accountancy',105761,NULL,NULL,0,'/compta/bank/fiche.php?action=create&leftmenu=bank','','MenuNewFinancialAccount','banks',1,'','$user->rights->banque->configurer','$conf->banque->enabled && ($leftmenu==\"bank\" || $leftmenu==\"checks\" || $leftmenu==\"withdraw\")',0,'2013-03-24 02:31:47'),(105763,'auguria',1,'','left','accountancy',105761,NULL,NULL,1,'/compta/bank/categ.php?leftmenu=bank','','Rubriques','categories',1,'','$user->rights->banque->configurer','$conf->banque->enabled && ($leftmenu==\"bank\" || $leftmenu==\"checks\" || $leftmenu==\"withdraw\")',0,'2013-03-24 02:31:47'),(105764,'auguria',1,'','left','accountancy',105761,NULL,NULL,2,'/compta/bank/search.php?leftmenu=bank','','ListTransactions','banks',1,'','$user->rights->banque->lire','$conf->banque->enabled && ($leftmenu==\"bank\" || $leftmenu==\"checks\" || $leftmenu==\"withdraw\")',0,'2013-03-24 02:31:47'),(105765,'auguria',1,'','left','accountancy',105761,NULL,NULL,3,'/compta/bank/budget.php?leftmenu=bank','','ListTransactionsByCategory','banks',1,'','$user->rights->banque->lire','$conf->banque->enabled && ($leftmenu==\"bank\" || $leftmenu==\"checks\" || $leftmenu==\"withdraw\")',0,'2013-03-24 02:31:47'),(105767,'auguria',1,'','left','accountancy',105761,NULL,NULL,5,'/compta/bank/virement.php?leftmenu=bank','','BankTransfers','banks',1,'','$user->rights->banque->transfer','$conf->banque->enabled && ($leftmenu==\"bank\" || $leftmenu==\"checks\" || $leftmenu==\"withdraw\")',0,'2013-03-24 02:31:47'),(105861,'auguria',1,'','left','accountancy',103167,NULL,NULL,11,'/compta/resultat/index.php?leftmenu=ca&mainmenu=accountancy','','Reportings','main',0,'ca','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled || $conf->accounting->enabled',0,'2013-03-24 02:31:47'),(105862,'auguria',1,'','left','accountancy',105861,NULL,NULL,0,'/compta/resultat/index.php?leftmenu=ca','','ReportInOut','main',1,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled || $conf->accounting->enabled',0,'2013-03-24 02:31:47'),(105863,'auguria',1,'','left','accountancy',105862,NULL,NULL,0,'/compta/resultat/clientfourn.php?leftmenu=ca','','ByCompanies','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled || $conf->accounting->enabled',0,'2013-03-24 02:31:47'),(105864,'auguria',1,'','left','accountancy',105861,NULL,NULL,1,'/compta/stats/index.php?leftmenu=ca','','ReportTurnover','main',1,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled || $conf->accounting->enabled',0,'2013-03-24 02:31:47'),(105865,'auguria',1,'','left','accountancy',105864,NULL,NULL,0,'/compta/stats/casoc.php?leftmenu=ca','','ByCompanies','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled || $conf->accounting->enabled',0,'2013-03-24 02:31:47'),(105866,'auguria',1,'','left','accountancy',105864,NULL,NULL,1,'/compta/stats/cabyuser.php?leftmenu=ca','','ByUsers','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled || $conf->accounting->enabled',0,'2013-03-24 02:31:47'),(105867,'auguria',1,'','left','accountancy',105861,NULL,NULL,1,'/compta/journal/sellsjournal.php?leftmenu=ca','','SellsJournal','main',1,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled || $conf->accounting->enabled',0,'2013-03-24 02:31:47'),(105868,'auguria',1,'','left','accountancy',105861,NULL,NULL,1,'/compta/journal/purchasesjournal.php?leftmenu=ca','','PurchasesJournal','main',1,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled || $conf->accounting->enabled',0,'2013-03-24 02:31:47'),(105961,'auguria',1,'','left','products',103164,NULL,NULL,0,'/product/index.php?leftmenu=product&type=0','','Products','products',0,'product','$user->rights->produit->lire','$conf->product->enabled',2,'2013-03-24 02:31:47'),(105962,'auguria',1,'','left','products',105961,NULL,NULL,0,'/product/fiche.php?leftmenu=product&action=create&type=0','','NewProduct','products',1,'','$user->rights->produit->creer','$conf->product->enabled',2,'2013-03-24 02:31:47'),(105963,'auguria',1,'','left','products',105961,NULL,NULL,1,'/product/liste.php?leftmenu=product&type=0','','List','products',1,'','$user->rights->produit->lire','$conf->product->enabled',2,'2013-03-24 02:31:47'),(105964,'auguria',1,'','left','products',105961,NULL,NULL,4,'/product/reassort.php?type=0','','Stocks','products',1,'','$user->rights->produit->lire && $user->rights->stock->lire','$conf->product->enabled',2,'2013-03-24 02:31:47'),(105965,'auguria',1,'','left','products',105961,NULL,NULL,5,'/product/popuprop.php?leftmenu=stats&type=0','','Statistics','main',1,'','$user->rights->produit->lire','$conf->propal->enabled',2,'2013-03-24 02:31:47'),(106061,'auguria',1,'','left','products',103164,NULL,NULL,1,'/product/index.php?leftmenu=service&type=1','','Services','products',0,'service','$user->rights->service->lire','$conf->service->enabled',2,'2013-03-24 02:31:47'),(106062,'auguria',1,'','left','products',106061,NULL,NULL,0,'/product/fiche.php?leftmenu=service&action=create&type=1','','NewService','products',1,'','$user->rights->service->creer','$conf->service->enabled',2,'2013-03-24 02:31:47'),(106063,'auguria',1,'','left','products',106061,NULL,NULL,1,'/product/liste.php?leftmenu=service&type=1','','List','products',1,'','$user->rights->service->lire','$conf->service->enabled',2,'2013-03-24 02:31:47'),(106064,'auguria',1,'','left','products',106061,NULL,NULL,5,'/product/popuprop.php?leftmenu=stats&type=1','','Statistics','main',1,'','$user->rights->service->lire','$conf->propal->enabled',2,'2013-03-24 02:31:47'),(106261,'auguria',1,'','left','products',103164,NULL,NULL,3,'/product/stock/index.php?leftmenu=stock','','Stock','stocks',0,'stock','$user->rights->stock->lire','$conf->stock->enabled',2,'2013-03-24 02:31:47'),(106262,'auguria',1,'','left','products',106261,NULL,NULL,0,'/product/stock/fiche.php?action=create','','MenuNewWarehouse','stocks',1,'','$user->rights->stock->creer','$conf->stock->enabled',2,'2013-03-24 02:31:47'),(106263,'auguria',1,'','left','products',106261,NULL,NULL,1,'/product/stock/liste.php','','List','stocks',1,'','$user->rights->stock->lire','$conf->stock->enabled',2,'2013-03-24 02:31:47'),(106264,'auguria',1,'','left','products',106261,NULL,NULL,2,'/product/stock/valo.php','','EnhancedValue','stocks',1,'','$user->rights->stock->lire','$conf->stock->enabled',2,'2013-03-24 02:31:47'),(106265,'auguria',1,'','left','products',106261,NULL,NULL,3,'/product/stock/mouvement.php','','Movements','stocks',1,'','$user->rights->stock->mouvement->lire','$conf->stock->enabled',2,'2013-03-24 02:31:47'),(106361,'auguria',1,'','left','products',103164,NULL,NULL,4,'/categories/index.php?leftmenu=cat&type=0','','Categories','categories',0,'cat','$user->rights->categorie->lire','$conf->categorie->enabled',2,'2013-03-24 02:31:47'),(106362,'auguria',1,'','left','products',106361,NULL,NULL,0,'/categories/fiche.php?action=create&type=0','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->categorie->enabled',2,'2013-03-24 02:31:47'),(106761,'auguria',1,'','left','project',103168,NULL,NULL,0,'/projet/index.php?leftmenu=projects','','Projects','projects',0,'projects','$user->rights->projet->lire','$conf->projet->enabled',2,'2013-03-24 02:31:47'),(106762,'auguria',1,'','left','project',106761,NULL,NULL,1,'/projet/fiche.php?leftmenu=projects&action=create','','NewProject','projects',1,'','$user->rights->projet->creer','$conf->projet->enabled',2,'2013-03-24 02:31:47'),(106763,'auguria',1,'','left','project',106761,NULL,NULL,2,'/projet/liste.php?leftmenu=projects','','List','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2013-03-24 02:31:47'),(106771,'auguria',1,'','left','project',103168,NULL,NULL,0,'/projet/index.php?leftmenu=projects&mode=mine','','MyProjects','projects',0,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2013-03-24 02:31:47'),(106772,'auguria',1,'','left','project',106771,NULL,NULL,1,'/projet/fiche.php?leftmenu=projects&action=create&mode=mine','','NewProject','projects',1,'','$user->rights->projet->creer','$conf->projet->enabled',2,'2013-03-24 02:31:47'),(106773,'auguria',1,'','left','project',106771,NULL,NULL,2,'/projet/liste.php?leftmenu=projects&mode=mine','','List','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2013-03-24 02:31:47'),(106861,'auguria',1,'','left','project',103168,NULL,NULL,0,'/projet/activity/index.php?leftmenu=projects','','Activities','projects',0,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2013-03-24 02:31:47'),(106862,'auguria',1,'','left','project',106861,NULL,NULL,1,'/projet/tasks.php?leftmenu=projects&action=create','','NewTask','projects',1,'','$user->rights->projet->creer','$conf->projet->enabled',2,'2013-03-24 02:31:47'),(106863,'auguria',1,'','left','project',106861,NULL,NULL,2,'/projet/tasks/index.php?leftmenu=projects','','List','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2013-03-24 02:31:47'),(106864,'auguria',1,'','left','project',106861,NULL,NULL,3,'/projet/activity/list.php?leftmenu=projects','','NewTimeSpent','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2013-03-24 02:31:47'),(106961,'auguria',1,'','left','project',103168,NULL,NULL,0,'/projet/activity/index.php?leftmenu=projects&mode=mine','','MyActivities','projects',0,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2013-03-24 02:31:47'),(106962,'auguria',1,'','left','project',106961,NULL,NULL,1,'/projet/tasks.php?leftmenu=projects&action=create&mode=mine','','NewTask','projects',1,'','$user->rights->projet->creer','$conf->projet->enabled',2,'2013-03-24 02:31:47'),(106963,'auguria',1,'','left','project',106961,NULL,NULL,2,'/projet/tasks/index.php?leftmenu=projects&mode=mine','','List','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2013-03-24 02:31:47'),(106964,'auguria',1,'','left','project',106961,NULL,NULL,3,'/projet/activity/list.php?leftmenu=projects&mode=mine','','NewTimeSpent','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2013-03-24 02:31:47'),(107061,'auguria',1,'','left','tools',103169,NULL,NULL,0,'/comm/mailing/index.php?leftmenu=mailing','','EMailings','mails',0,'mailing','$user->rights->mailing->lire','$conf->mailing->enabled',0,'2013-03-24 02:31:47'),(107062,'auguria',1,'','left','tools',107061,NULL,NULL,0,'/comm/mailing/fiche.php?leftmenu=mailing&action=create','','NewMailing','mails',1,'','$user->rights->mailing->creer','$conf->mailing->enabled',0,'2013-03-24 02:31:47'),(107063,'auguria',1,'','left','tools',107061,NULL,NULL,1,'/comm/mailing/liste.php?leftmenu=mailing','','List','mails',1,'','$user->rights->mailing->lire','$conf->mailing->enabled',0,'2013-03-24 02:31:47'),(107261,'auguria',1,'','left','tools',103169,NULL,NULL,2,'/exports/index.php?leftmenu=export','','FormatedExport','exports',0,'export','$user->rights->export->lire','$conf->export->enabled',2,'2013-03-24 02:31:47'),(107262,'auguria',1,'','left','tools',107261,NULL,NULL,0,'/exports/export.php?leftmenu=export','','NewExport','exports',1,'','$user->rights->export->creer','$conf->export->enabled',2,'2013-03-24 02:31:47'),(107291,'auguria',1,'','left','tools',103169,NULL,NULL,2,'/imports/index.php?leftmenu=import','','FormatedImport','exports',0,'import','$user->rights->import->run','$conf->import->enabled',2,'2013-03-24 02:31:47'),(107292,'auguria',1,'','left','tools',107291,NULL,NULL,0,'/imports/import.php?leftmenu=import','','NewImport','exports',1,'','$user->rights->import->run','$conf->import->enabled',2,'2013-03-24 02:31:47'),(107361,'auguria',1,'','left','members',103174,NULL,NULL,0,'/adherents/index.php?leftmenu=members&mainmenu=members','','Members','members',0,'members','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2013-03-24 02:31:48'),(107362,'auguria',1,'','left','members',107361,NULL,NULL,0,'/adherents/fiche.php?leftmenu=members&action=create','','NewMember','members',1,'','$user->rights->adherent->creer','$conf->adherent->enabled',2,'2013-03-24 02:31:48'),(107363,'auguria',1,'','left','members',107361,NULL,NULL,1,'/adherents/liste.php','','List','members',1,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2013-03-24 02:31:48'),(107364,'auguria',1,'','left','members',107363,NULL,NULL,2,'/adherents/liste.php?leftmenu=members&statut=-1','','MenuMembersToValidate','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2013-03-24 02:31:48'),(107365,'auguria',1,'','left','members',107363,NULL,NULL,3,'/adherents/liste.php?leftmenu=members&statut=1','','MenuMembersValidated','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2013-03-24 02:31:48'),(107366,'auguria',1,'','left','members',107363,NULL,NULL,4,'/adherents/liste.php?leftmenu=members&statut=1&filter=outofdate','','MenuMembersNotUpToDate','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2013-03-24 02:31:48'),(107367,'auguria',1,'','left','members',107363,NULL,NULL,5,'/adherents/liste.php?leftmenu=members&statut=1&filter=uptodate','','MenuMembersUpToDate','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2013-03-24 02:31:48'),(107368,'auguria',1,'','left','members',107363,NULL,NULL,6,'/adherents/liste.php?leftmenu=members&statut=0','','MenuMembersResiliated','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2013-03-24 02:31:48'),(107369,'auguria',1,'','left','members',107361,NULL,NULL,7,'/adherents/stats/geo.php?leftmenu=members&mode=memberbycountry','','MenuMembersStats','members',1,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2013-03-24 02:31:48'),(107461,'auguria',1,'','left','members',103174,NULL,NULL,1,'/adherents/index.php?leftmenu=members&mainmenu=members','','Subscriptions','compta',0,'','$user->rights->adherent->cotisation->lire','$conf->adherent->enabled',2,'2013-03-24 02:31:48'),(107462,'auguria',1,'','left','members',107461,NULL,NULL,0,'/adherents/liste.php?statut=-1&leftmenu=accountancy&mainmenu=members','','NewSubscription','compta',1,'','$user->rights->adherent->cotisation->creer','$conf->adherent->enabled',2,'2013-03-24 02:31:48'),(107463,'auguria',1,'','left','members',107461,NULL,NULL,1,'/adherents/cotisations.php?leftmenu=members','','List','compta',1,'','$user->rights->adherent->cotisation->lire','$conf->adherent->enabled',2,'2013-03-24 02:31:48'),(107464,'auguria',1,'','left','members',107461,NULL,NULL,7,'/adherents/stats/index.php?leftmenu=members','','MenuMembersStats','members',1,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2013-03-24 02:31:48'),(107661,'auguria',1,'','left','members',103174,NULL,NULL,3,'/adherents/index.php?leftmenu=export&mainmenu=members','','Exports','members',0,'export','$user->rights->adherent->export','$conf->adherent->enabled',2,'2013-03-24 02:31:48'),(107662,'auguria',1,'','left','members',107661,NULL,NULL,0,'/exports/index.php?leftmenu=export','','Datas','members',1,'','$user->rights->adherent->export','$conf->adherent->enabled && $conf->export->enabled',2,'2013-03-24 02:31:48'),(107663,'auguria',1,'','left','members',107661,NULL,NULL,1,'/adherents/htpasswd.php?leftmenu=export','','Filehtpasswd','members',1,'','$user->rights->adherent->export','$conf->adherent->enabled',2,'2013-03-24 02:31:48'),(107664,'auguria',1,'','left','members',107661,NULL,NULL,2,'/adherents/cartes/carte.php?leftmenu=export','','MembersCards','members',1,'','$user->rights->adherent->export','$conf->adherent->enabled',2,'2013-03-24 02:31:48'),(107861,'auguria',1,'','left','members',103174,NULL,NULL,5,'/adherents/type.php?leftmenu=setup&mainmenu=members','','MembersTypes','members',0,'setup','$user->rights->adherent->configurer','$conf->adherent->enabled',2,'2013-03-24 02:31:48'),(107862,'auguria',1,'','left','members',107861,NULL,NULL,0,'/adherents/type.php?leftmenu=setup&mainmenu=members&action=create','','New','members',1,'','$user->rights->adherent->configurer','$conf->adherent->enabled',2,'2013-03-24 02:31:48'),(107863,'auguria',1,'','left','members',107861,NULL,NULL,1,'/adherents/type.php?leftmenu=setup&mainmenu=members','','List','members',1,'','$user->rights->adherent->configurer','$conf->adherent->enabled',2,'2013-03-24 02:31:48'),(108261,'auguria',1,'','left','commercial',103166,NULL,NULL,6,'/fourn/commande/index.php?leftmenu=orders_suppliers','','SuppliersOrders','orders',0,'orders_suppliers','$user->rights->fournisseur->commande->lire','$conf->fournisseur->enabled',2,'2013-03-24 02:31:47'),(108262,'auguria',1,'','left','commercial',108261,NULL,NULL,0,'/societe/societe.php?leftmenu=orders_suppliers','','NewOrder','orders',1,'','$user->rights->fournisseur->commande->creer','$conf->fournisseur->enabled',2,'2013-03-24 02:31:47'),(108263,'auguria',1,'','left','commercial',108261,NULL,NULL,1,'/fourn/commande/liste.php?leftmenu=orders_suppliers&viewstatut=0','','List','orders',1,'','$user->rights->fournisseur->commande->lire','$conf->fournisseur->enabled',2,'2013-03-24 02:31:47'),(108269,'auguria',1,'','left','commercial',108261,NULL,NULL,7,'/commande/stats/index.php?leftmenu=orders_suppliers&mode=supplier','','Statistics','orders',1,'','$user->rights->fournisseur->commande->lire','$conf->fournisseur->enabled',2,'2013-03-24 02:31:47'),(108361,'auguria',1,'','left','members',103174,NULL,NULL,3,'/categories/index.php?leftmenu=cat&type=3','','MembersCategoriesShort','categories',0,'cat','$user->rights->categorie->lire','$conf->adherent->enabled && $conf->categorie->enabled',2,'2013-03-24 02:31:48'),(108362,'auguria',1,'','left','members',108361,NULL,NULL,0,'/categories/fiche.php?action=create&type=3','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->adherent->enabled && $conf->categorie->enabled',2,'2013-03-24 02:31:48'),(108457,'all',1,'barcode','left','tools',-1,NULL,'tools',200,'/barcode/printsheet.php?mainmenu=home&leftmenu=modulesadmintools','','BarCodePrintsheet','products',NULL,'barcodeprint','1','$conf->barcode->enabled',2,'2014-03-02 15:37:26'),(108458,'all',1,'barcode','left','home',-1,'modulesadmintools','home',300,'/barcode/codeinit.php?mainmenu=home&leftmenu=modulesadmintools','','MassBarcodeInit','products',NULL,NULL,'1','$conf->barcode->enabled && $leftmenu==\"modulesadmintools\"',0,'2014-03-02 15:37:26'),(108459,'all',1,'agenda','top','agenda',0,NULL,NULL,100,'/comm/action/index.php','','Agenda','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2014-12-21 12:51:26'),(108460,'all',1,'agenda','left','agenda',108459,NULL,NULL,100,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda','','Actions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2014-12-21 12:51:26'),(108461,'all',1,'agenda','left','agenda',108460,NULL,NULL,101,'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create','','NewAction','commercial',NULL,NULL,'($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create)','$conf->agenda->enabled',2,'2014-12-21 12:51:26'),(108462,'all',1,'agenda','left','agenda',108460,NULL,NULL,102,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda','','Calendar','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2014-12-21 12:51:26'),(108463,'all',1,'agenda','left','agenda',108462,NULL,NULL,103,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine','','MenuToDoMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2014-12-21 12:51:26'),(108464,'all',1,'agenda','left','agenda',108462,NULL,NULL,104,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine','','MenuDoneMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2014-12-21 12:51:26'),(108465,'all',1,'agenda','left','agenda',108462,NULL,NULL,105,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=todo','','MenuToDoActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2014-12-21 12:51:26'),(108466,'all',1,'agenda','left','agenda',108462,NULL,NULL,106,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=done','','MenuDoneActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2014-12-21 12:51:26'),(108467,'all',1,'agenda','left','agenda',108460,NULL,NULL,112,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda','','List','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2014-12-21 12:51:26'),(108468,'all',1,'agenda','left','agenda',108467,NULL,NULL,113,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine','','MenuToDoMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2014-12-21 12:51:26'),(108469,'all',1,'agenda','left','agenda',108467,NULL,NULL,114,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine','','MenuDoneMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2014-12-21 12:51:26'),(108470,'all',1,'agenda','left','agenda',108467,NULL,NULL,115,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=todo','','MenuToDoActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2014-12-21 12:51:26'),(108471,'all',1,'agenda','left','agenda',108467,NULL,NULL,116,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=done','','MenuDoneActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2014-12-21 12:51:26'),(108472,'all',1,'agenda','left','agenda',108460,NULL,NULL,120,'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda','','Reportings','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$conf->agenda->enabled',2,'2014-12-21 12:51:26'),(108473,'all',1,'ecm','top','ecm',0,NULL,NULL,100,'/ecm/index.php','','MenuECM','ecm',NULL,NULL,'$user->rights->ecm->read || $user->rights->ecm->upload || $user->rights->ecm->setup','$conf->ecm->enabled',2,'2014-12-21 12:51:28'),(108474,'all',1,'ecm','left','ecm',-1,NULL,'ecm',101,'/ecm/index.php?mainmenu=ecm&leftmenu=ecm','','ECMArea','ecm',NULL,'ecm','$user->rights->ecm->read || $user->rights->ecm->upload','$user->rights->ecm->read || $user->rights->ecm->upload',2,'2014-12-21 12:51:28'),(108475,'all',1,'ecm','left','ecm',-1,'ecm','ecm',102,'/ecm/index.php?action=file_manager&mainmenu=ecm&leftmenu=ecm','','ECMSectionsManual','ecm',NULL,'ecm_manual','$user->rights->ecm->read || $user->rights->ecm->upload','$user->rights->ecm->read || $user->rights->ecm->upload',2,'2014-12-21 12:51:28'),(108476,'all',1,'ecm','left','ecm',-1,'ecm','ecm',103,'/ecm/index_auto.php?action=file_manager&mainmenu=ecm&leftmenu=ecm','','ECMSectionsAuto','ecm',NULL,NULL,'$user->rights->ecm->read || $user->rights->ecm->upload','$user->rights->ecm->read || $user->rights->ecm->upload',2,'2014-12-21 12:51:28'),(108477,'all',1,'opensurvey','left','tools',-1,NULL,'tools',200,'/opensurvey/index.php?mainmenu=tools&leftmenu=opensurvey','','Survey','opensurvey',NULL,'opensurvey','','$conf->opensurvey->enabled',0,'2014-12-21 19:52:31'),(108478,'all',1,'opensurvey','left','tools',-1,'opensurvey','tools',210,'/opensurvey/wizard/index.php','','NewSurvey','opensurvey',NULL,'opensurvey_new','$user->rights->opensurvey->write','$conf->opensurvey->enabled',0,'2014-12-21 19:52:31'),(108479,'all',1,'opensurvey','left','tools',-1,'opensurvey','tools',220,'/opensurvey/list.php','','List','opensurvey',NULL,'opensurvey_list','','$conf->opensurvey->enabled',0,'2014-12-21 19:52:31'); +/*!40000 ALTER TABLE `llx_menu` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_milestone` +-- + +DROP TABLE IF EXISTS `llx_milestone`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_milestone` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_element` int(11) NOT NULL, + `elementtype` varchar(16) NOT NULL, + `label` varchar(255) NOT NULL, + `options` varchar(255) DEFAULT NULL, + `priority` int(11) DEFAULT '0', + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_user_modif` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_milestone_fk_element` (`fk_element`,`elementtype`), + KEY `idx_milestone_fk_user_modif` (`fk_user_modif`), + CONSTRAINT `fk_milestone_fk_user_modif` FOREIGN KEY (`fk_user_modif`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_milestone` +-- + +LOCK TABLES `llx_milestone` WRITE; +/*!40000 ALTER TABLE `llx_milestone` DISABLE KEYS */; +INSERT INTO `llx_milestone` VALUES (2,779,'facture','azerty',NULL,0,'2013-03-09 12:19:30',NULL),(3,780,'facture','fsdf',NULL,0,'2013-03-09 13:01:08',NULL),(4,781,'facture','hhh',NULL,0,'2013-03-09 14:06:37',NULL); +/*!40000 ALTER TABLE `llx_milestone` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_monitoring_probes` +-- + +DROP TABLE IF EXISTS `llx_monitoring_probes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_monitoring_probes` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(64) NOT NULL, + `groupname` varchar(64) DEFAULT NULL, + `url` varchar(250) NOT NULL, + `useproxy` int(11) DEFAULT '0', + `checkkey` varchar(250) DEFAULT NULL, + `maxval` int(11) DEFAULT NULL, + `frequency` int(11) DEFAULT '60', + `active` int(11) DEFAULT '1', + `status` int(11) DEFAULT '0', + `lastreset` datetime DEFAULT NULL, + `oldesterrortext` text, + `oldesterrordate` datetime DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_monitoring_probes` (`title`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_monitoring_probes` +-- + +LOCK TABLES `llx_monitoring_probes` WRITE; +/*!40000 ALTER TABLE `llx_monitoring_probes` DISABLE KEYS */; +INSERT INTO `llx_monitoring_probes` VALUES (1,'aaa',NULL,'http://www.chiensderace.com',0,'chiens',1000,10,1,1,'2011-04-20 23:46:41',NULL,NULL),(2,'ChatsDeRace',NULL,'http://www.chatsderace.com',0,'chats',1000,5,1,1,'2011-04-20 23:46:41',NULL,NULL); +/*!40000 ALTER TABLE `llx_monitoring_probes` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_notify` +-- + +DROP TABLE IF EXISTS `llx_notify`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_notify` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `daten` datetime DEFAULT NULL, + `fk_action` int(11) NOT NULL, + `fk_soc` int(11) DEFAULT NULL, + `fk_contact` int(11) DEFAULT NULL, + `fk_user` int(11) DEFAULT NULL, + `objet_type` varchar(24) NOT NULL, + `objet_id` int(11) NOT NULL, + `email` varchar(255) DEFAULT NULL, + `type` varchar(16) DEFAULT 'email', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_notify` +-- + +LOCK TABLES `llx_notify` WRITE; +/*!40000 ALTER TABLE `llx_notify` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_notify` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_notify_def` +-- + +DROP TABLE IF EXISTS `llx_notify_def`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_notify_def` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datec` date DEFAULT NULL, + `fk_action` int(11) NOT NULL, + `fk_soc` int(11) NOT NULL, + `fk_contact` int(11) DEFAULT NULL, + `fk_user` int(11) DEFAULT NULL, + `type` varchar(16) DEFAULT 'email', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_notify_def` +-- + +LOCK TABLES `llx_notify_def` WRITE; +/*!40000 ALTER TABLE `llx_notify_def` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_notify_def` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_opensurvey_comments` +-- + +DROP TABLE IF EXISTS `llx_opensurvey_comments`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_opensurvey_comments` ( + `id_comment` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id_sondage` char(16) NOT NULL, + `comment` text NOT NULL, + `usercomment` text, + PRIMARY KEY (`id_comment`), + KEY `idx_id_comment` (`id_comment`), + KEY `idx_id_sondage` (`id_sondage`) +) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_opensurvey_comments` +-- + +LOCK TABLES `llx_opensurvey_comments` WRITE; +/*!40000 ALTER TABLE `llx_opensurvey_comments` DISABLE KEYS */; +INSERT INTO `llx_opensurvey_comments` VALUES (2,'434dio8rxfljs3p1','aaa','aaa'),(5,'434dio8rxfljs3p1','aaa','aaa'),(6,'434dio8rxfljs3p1','gfh','jj'),(11,'434dio8rxfljs3p1','fsdf','fdsf'),(12,'3imby4hf7joiilsu','fsdf','aa'),(16,'3imby4hf7joiilsu','gdfg','gfdg'),(17,'3imby4hf7joiilsu','gfdgd','gdfgd'),(18,'om4e7azfiurnjtqe','fds','fdsf'),(26,'qgsfrgb922rqzocy','gfdg','gfdg'),(27,'qgsfrgb922rqzocy','gfdg','gfd'),(28,'m4467s2mtk6khmxc','hgf','hgfh'),(29,'m4467s2mtk6khmxc','fgh','hgf'),(30,'ckanvbe7kt3rdb3h','hfgh','fdfds'),(31,'m4467s2mtk6khmxc','hgfh','hgf'); +/*!40000 ALTER TABLE `llx_opensurvey_comments` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_opensurvey_sondage` +-- + +DROP TABLE IF EXISTS `llx_opensurvey_sondage`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_opensurvey_sondage` ( + `id_sondage` varchar(16) NOT NULL, + `id_sondage_admin` char(24) DEFAULT NULL, + `commentaires` text, + `mail_admin` varchar(128) DEFAULT NULL, + `nom_admin` varchar(64) DEFAULT NULL, + `fk_user_creat` int(11) NOT NULL, + `titre` text NOT NULL, + `date_fin` datetime NOT NULL, + `format` varchar(2) NOT NULL, + `mailsonde` tinyint(4) NOT NULL DEFAULT '0', + `survey_link_visible` int(11) DEFAULT '1', + `origin` varchar(64) DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `entity` int(11) NOT NULL DEFAULT '1', + `allow_comments` tinyint(4) NOT NULL DEFAULT '1', + `allow_spy` tinyint(4) NOT NULL DEFAULT '1', + `sujet` text, + PRIMARY KEY (`id_sondage`), + KEY `idx_id_sondage_admin` (`id_sondage_admin`), + KEY `idx_date_fin` (`date_fin`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_opensurvey_sondage` +-- + +LOCK TABLES `llx_opensurvey_sondage` WRITE; +/*!40000 ALTER TABLE `llx_opensurvey_sondage` DISABLE KEYS */; +INSERT INTO `llx_opensurvey_sondage` VALUES ('m4467s2mtk6khmxc','m4467s2mtk6khmxci2ysw682','fdffdshfghfj jhgjgh','aaa@aaa.com','fdfds',0,'fdffds','2013-03-07 00:00:00','D+',1,1,'dolibarr','0000-00-00 00:00:00',1,1,1,NULL); +/*!40000 ALTER TABLE `llx_opensurvey_sondage` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_opensurvey_sujet_studs` +-- + +DROP TABLE IF EXISTS `llx_opensurvey_sujet_studs`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_opensurvey_sujet_studs` ( + `id_sondage` char(16) NOT NULL, + `sujet` text +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_opensurvey_sujet_studs` +-- + +LOCK TABLES `llx_opensurvey_sujet_studs` WRITE; +/*!40000 ALTER TABLE `llx_opensurvey_sujet_studs` DISABLE KEYS */; +INSERT INTO `llx_opensurvey_sujet_studs` VALUES ('434dio8rxfljs3p1','1362697200,1363734000'),('3eyn2drokozf3j4s','1362438000@10h,1363129200@10h'),('z2qcqjh5pm1q4p99','résolution 1,résolution 2,aaa,fdsfsdfsd@checkbox'),('xfwtrseu3ok1c4m6','gdfgfd@yesno,gfdgd@pourcontre,llll@pourcontre'),('om4e7azfiurnjtqe','g dfgdfdfg dfg dg dfg g fdg dfgd fg fg d@pourcontre,mmlml@checkbox'),('fubmr7n293akha5j','check@checkbox,yesno@yesno,pc@pourcontre'),('icaanayi59qto4fl','check@checkbox,yesno@yesno,pc@pourcontre'),('ipbkufzz4lr2vbpx','pc@pourcontre,fdsffd@checkbox'),('3imby4hf7joiilsu','fsdf@yesno,fsdfsd@checkbox,fsdf@pourcontre'),('q41jpgfd4ii3g9vx','fdfsd@pourcontre,fdsfs@pourcontre,fdsfsdf@checkbox'),('xm6hysvkspo7gbx6','fdfsd@pourcontre,fdsfs@pourcontre,fdsfsdf@checkbox'),('99sbps3ba3s8pq7b','fdfsd@pourcontre,fdsfs@pourcontre,fdsfsdf@checkbox'),('6wstlvu2z9kxqweh','fdfsd@pourcontre,fdsfs@pourcontre,fdsfsdf@checkbox'),('783p7f377offci4v','fdfsd@pourcontre,fdsfs@pourcontre,fdsfsdf@checkbox'),('u4umbl5yb6lpydci','fdfsd@pourcontre,fdsfs@pourcontre,fdsfsdf@checkbox'),('dn2euwlf2d4wyy6m','fdfsd@pourcontre,fdsfs@pourcontre,fdsfsdf@checkbox'),('t896ed7af3ujdprx','fdfsd@pourcontre,fdsfs@pourcontre,fdsfsdf@checkbox'),('q5c4kucbbkuxjz8g','fdsfsd@pourcontre,fdsfs@pourcontre,fdsfsd@pourcontre'),('8mcdnf2hgcntfibe','fdsfsd@pourcontre,fdsfs@pourcontre,fdsfsd@pourcontre'),('7shynoad2x4zl8sw','fdsfsd@pourcontre,fdsfs@pourcontre,fdsfsd@pourcontre'),('x82rfs19p8fa21et','fdsfsd@pourcontre,fdsfs@pourcontre,fdsfsd@pourcontre'),('qgsfrgb922rqzocy','1364338800@20H-21H,1364338800@21H-22H,1364425200@20H-21H,1364425200@21H-22H,1364511600@20H-21H,1364511600@21H-22H'),('ah9xvaqu1ajjrqse','1391295600@2h-5h,1391295600@2h-5h,1364338800@20H-21H,1364338800@21H-22H,1364425200@20H-21H,1391295600@2h-5h'),('ckanvbe7kt3rdb3h','1363734000,1363820400'),('6v9xq6f9lemjiuba','1363734000,1363820400,1363906800,1363993200'),('m4467s2mtk6khmxc','1398981600,1357081200,1363734000,1363820400,1363993200,1398981600'); +/*!40000 ALTER TABLE `llx_opensurvey_sujet_studs` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_opensurvey_user_studs` +-- + +DROP TABLE IF EXISTS `llx_opensurvey_user_studs`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_opensurvey_user_studs` ( + `id_users` int(11) NOT NULL AUTO_INCREMENT, + `nom` varchar(64) NOT NULL, + `id_sondage` varchar(16) NOT NULL, + `reponses` varchar(100) NOT NULL, + PRIMARY KEY (`id_users`), + KEY `idx_id_users` (`id_users`), + KEY `idx_nom` (`nom`), + KEY `idx_id_sondage` (`id_sondage`), + KEY `idx_opensurvey_user_studs_id_users` (`id_users`), + KEY `idx_opensurvey_user_studs_nom` (`nom`), + KEY `idx_opensurvey_user_studs_id_sondage` (`id_sondage`) +) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_opensurvey_user_studs` +-- + +LOCK TABLES `llx_opensurvey_user_studs` WRITE; +/*!40000 ALTER TABLE `llx_opensurvey_user_studs` DISABLE KEYS */; +INSERT INTO `llx_opensurvey_user_studs` VALUES (1,'gfdgdf','om4e7azfiurnjtqe','01'),(2,'aa','3imby4hf7joiilsu','210'),(3,'fsdf','z2qcqjh5pm1q4p99','0110'),(5,'hfghf','z2qcqjh5pm1q4p99','1110'),(6,'qqqq','ah9xvaqu1ajjrqse','000111'),(7,'hjgh','ah9xvaqu1ajjrqse','000010'),(8,'bcvb','qgsfrgb922rqzocy','011000'),(9,'gdfg','ah9xvaqu1ajjrqse','001000'),(10,'ggg','ah9xvaqu1ajjrqse','000100'),(11,'gfdgd','ah9xvaqu1ajjrqse','001000'),(12,'hhhh','ah9xvaqu1ajjrqse','010000'),(13,'iii','ah9xvaqu1ajjrqse','000100'),(14,'kkk','ah9xvaqu1ajjrqse','001000'),(15,'lllll','ah9xvaqu1ajjrqse','000001'),(16,'kk','ah9xvaqu1ajjrqse','000001'),(17,'gggg','ah9xvaqu1ajjrqse','001000'),(18,'mmmm','ah9xvaqu1ajjrqse','000000'),(19,'jkjkj','ah9xvaqu1ajjrqse','000001'),(20,'azerty','8mcdnf2hgcntfibe','012'),(21,'hfghfg','8mcdnf2hgcntfibe','012'),(22,'fd','ckanvbe7kt3rdb3h','10'),(23,'gfdgdf','m4467s2mtk6khmxc','00011'),(24,'hgfh','m4467s2mtk6khmxc','000111'); +/*!40000 ALTER TABLE `llx_opensurvey_user_studs` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_paiement` +-- + +DROP TABLE IF EXISTS `llx_paiement`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_paiement` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datep` datetime DEFAULT NULL, + `amount` double(24,8) DEFAULT NULL, + `fk_paiement` int(11) NOT NULL, + `num_paiement` varchar(50) DEFAULT NULL, + `note` text, + `fk_bank` int(11) NOT NULL DEFAULT '0', + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `statut` smallint(6) NOT NULL DEFAULT '0', + `fk_export_compta` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_paiement` +-- + +LOCK TABLES `llx_paiement` WRITE; +/*!40000 ALTER TABLE `llx_paiement` DISABLE KEYS */; +INSERT INTO `llx_paiement` VALUES (1,1,'2010-07-10 14:59:41','2010-07-10 12:59:41','2010-07-10 12:00:00',0.02000000,4,'','',4,1,NULL,0,0),(2,1,'2011-07-18 20:50:24','2011-07-18 18:50:24','2011-07-08 12:00:00',20.00000000,6,'','',5,1,NULL,0,0),(3,1,'2011-07-18 20:50:47','2011-07-18 18:50:47','2011-07-08 12:00:00',10.00000000,4,'','',6,1,NULL,0,0),(5,1,'2011-08-01 03:34:11','2011-08-01 01:34:11','2011-08-01 03:34:11',5.63000000,6,'','Payment Invoice FA1108-0003',8,1,NULL,0,0),(6,1,'2011-08-06 20:33:54','2011-08-06 18:33:54','2011-08-06 20:33:53',5.98000000,4,'','Payment Invoice FA1108-0004',13,1,NULL,0,0),(8,1,'2011-08-08 02:53:40','2011-08-08 00:53:40','2011-08-08 12:00:00',26.10000000,4,'','',14,1,NULL,0,0),(9,1,'2011-08-08 02:55:58','2011-08-08 00:55:58','2011-08-08 12:00:00',26.96000000,1,'','',15,1,NULL,0,0),(17,1,'2012-12-09 15:28:44','2012-12-09 14:28:44','2012-12-09 12:00:00',2.00000000,4,'','',16,1,NULL,0,0),(18,1,'2012-12-09 15:28:53','2012-12-09 14:28:53','2012-12-09 12:00:00',-2.00000000,4,'','',17,1,NULL,0,0),(19,1,'2012-12-09 17:35:55','2012-12-09 16:35:55','2012-12-09 12:00:00',-2.00000000,4,'','',18,1,NULL,0,0),(20,1,'2012-12-09 17:37:02','2012-12-09 16:37:02','2012-12-09 12:00:00',2.00000000,4,'','',19,1,NULL,0,0),(21,1,'2012-12-09 18:35:07','2012-12-09 17:35:07','2012-12-09 12:00:00',-2.00000000,4,'','',20,1,NULL,0,0),(23,1,'2012-12-12 18:54:33','2012-12-12 17:54:33','2012-12-12 12:00:00',1.00000000,1,'','',21,1,NULL,0,0),(24,1,'2013-03-06 16:48:16','2013-03-06 15:48:16','2013-03-06 00:00:00',20.00000000,4,'','Adhésion/cotisation 2016',22,1,NULL,0,0),(25,1,'2013-03-20 14:30:11','2013-03-20 13:30:11','2013-03-20 00:00:00',10.00000000,2,'','Adhésion/cotisation 2011',23,1,NULL,0,0),(26,1,'2014-03-02 19:57:58','2014-03-02 18:57:58','2013-07-09 12:00:00',605.00000000,2,'','',24,1,NULL,0,0),(27,1,'2014-03-02 19:59:48','2014-03-02 18:59:48','2013-03-22 12:00:00',30.00000000,4,'','',25,1,NULL,0,0),(29,1,'2014-03-02 20:01:39','2014-03-02 19:01:39','2013-03-19 12:00:00',500.00000000,4,'','',26,1,NULL,0,0),(30,1,'2014-03-02 20:02:06','2014-03-02 19:02:06','2013-03-21 12:00:00',400.00000000,2,'','',27,1,NULL,0,0),(32,1,'2014-03-03 19:22:32','2014-03-03 18:22:32','2013-10-03 12:00:00',-400.00000000,4,'','',28,1,NULL,0,0),(33,1,'2014-03-03 19:23:16','2014-03-03 18:23:16','2013-03-10 12:00:00',-300.00000000,4,'','',29,1,NULL,0,0); +/*!40000 ALTER TABLE `llx_paiement` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_paiement_facture` +-- + +DROP TABLE IF EXISTS `llx_paiement_facture`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_paiement_facture` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_paiement` int(11) DEFAULT NULL, + `fk_facture` int(11) DEFAULT NULL, + `amount` double(24,8) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_paiement_facture` (`fk_paiement`,`fk_facture`), + KEY `idx_paiement_facture_fk_facture` (`fk_facture`), + KEY `idx_paiement_facture_fk_paiement` (`fk_paiement`), + CONSTRAINT `fk_paiement_facture_fk_facture` FOREIGN KEY (`fk_facture`) REFERENCES `llx_facture` (`rowid`), + CONSTRAINT `fk_paiement_facture_fk_paiement` FOREIGN KEY (`fk_paiement`) REFERENCES `llx_paiement` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_paiement_facture` +-- + +LOCK TABLES `llx_paiement_facture` WRITE; +/*!40000 ALTER TABLE `llx_paiement_facture` DISABLE KEYS */; +INSERT INTO `llx_paiement_facture` VALUES (1,1,1,0.02000000),(2,2,2,20.00000000),(3,3,2,10.00000000),(5,5,5,5.63000000),(6,6,6,5.98000000),(9,8,2,16.10000000),(10,8,8,10.00000000),(11,9,3,15.00000000),(12,9,9,11.96000000),(20,17,11,2.00000000),(21,18,12,-2.00000000),(22,19,10,-1.00000000),(23,19,12,-1.00000000),(24,20,9,1.00000000),(25,20,11,1.00000000),(26,21,12,-2.00000000),(28,23,55,1.00000000),(29,24,161,20.00000000),(30,25,210,10.00000000),(31,26,32,600.00000000),(32,26,148,5.00000000),(33,27,152,10.00000000),(34,27,157,20.00000000),(36,29,32,500.00000000),(37,30,32,400.00000000),(39,32,213,-400.00000000),(40,33,213,-300.00000000); +/*!40000 ALTER TABLE `llx_paiement_facture` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_paiementcharge` +-- + +DROP TABLE IF EXISTS `llx_paiementcharge`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_paiementcharge` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_charge` int(11) DEFAULT NULL, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datep` datetime DEFAULT NULL, + `amount` double DEFAULT '0', + `fk_typepaiement` int(11) NOT NULL, + `num_paiement` varchar(50) DEFAULT NULL, + `note` text, + `fk_bank` int(11) NOT NULL, + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_paiementcharge` +-- + +LOCK TABLES `llx_paiementcharge` WRITE; +/*!40000 ALTER TABLE `llx_paiementcharge` DISABLE KEYS */; +INSERT INTO `llx_paiementcharge` VALUES (4,4,'2011-08-05 23:11:37','2011-08-05 21:11:37','2011-08-05 12:00:00',10,2,'','',12,1,NULL); +/*!40000 ALTER TABLE `llx_paiementcharge` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_paiementfourn` +-- + +DROP TABLE IF EXISTS `llx_paiementfourn`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_paiementfourn` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datec` datetime DEFAULT NULL, + `datep` datetime DEFAULT NULL, + `amount` double DEFAULT '0', + `fk_user_author` int(11) DEFAULT NULL, + `fk_paiement` int(11) NOT NULL, + `num_paiement` varchar(50) DEFAULT NULL, + `note` text, + `fk_bank` int(11) NOT NULL, + `statut` smallint(6) NOT NULL DEFAULT '0', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_paiementfourn` +-- + +LOCK TABLES `llx_paiementfourn` WRITE; +/*!40000 ALTER TABLE `llx_paiementfourn` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_paiementfourn` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_paiementfourn_facturefourn` +-- + +DROP TABLE IF EXISTS `llx_paiementfourn_facturefourn`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_paiementfourn_facturefourn` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_paiementfourn` int(11) DEFAULT NULL, + `fk_facturefourn` int(11) DEFAULT NULL, + `amount` double DEFAULT '0', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_paiementfourn_facturefourn` (`fk_paiementfourn`,`fk_facturefourn`), + KEY `idx_paiementfourn_facturefourn_fk_facture` (`fk_facturefourn`), + KEY `idx_paiementfourn_facturefourn_fk_paiement` (`fk_paiementfourn`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_paiementfourn_facturefourn` +-- + +LOCK TABLES `llx_paiementfourn_facturefourn` WRITE; +/*!40000 ALTER TABLE `llx_paiementfourn_facturefourn` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_paiementfourn_facturefourn` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_payment_salary` +-- + +DROP TABLE IF EXISTS `llx_payment_salary`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_payment_salary` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_user` int(11) NOT NULL, + `datep` date DEFAULT NULL, + `datev` date DEFAULT NULL, + `amount` double NOT NULL DEFAULT '0', + `fk_typepayment` int(11) NOT NULL, + `num_payment` varchar(50) DEFAULT NULL, + `label` varchar(255) DEFAULT NULL, + `datesp` date DEFAULT NULL, + `dateep` date DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `note` text, + `fk_bank` int(11) DEFAULT NULL, + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_payment_salary` +-- + +LOCK TABLES `llx_payment_salary` WRITE; +/*!40000 ALTER TABLE `llx_payment_salary` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_payment_salary` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_pos_cash` +-- + +DROP TABLE IF EXISTS `llx_pos_cash`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_pos_cash` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `code` varchar(3) DEFAULT NULL, + `name` varchar(30) DEFAULT NULL, + `tactil` tinyint(4) NOT NULL DEFAULT '0', + `fk_paycash` int(11) DEFAULT NULL, + `fk_modepaycash` int(11) DEFAULT NULL, + `fk_paybank` int(11) DEFAULT NULL, + `fk_modepaybank` int(11) DEFAULT NULL, + `fk_warehouse` int(11) DEFAULT NULL, + `fk_device` int(11) DEFAULT NULL, + `fk_soc` int(11) DEFAULT NULL, + `is_used` tinyint(4) DEFAULT '0', + `fk_user_u` int(11) DEFAULT NULL, + `fk_user_c` int(11) DEFAULT NULL, + `fk_user_m` int(11) DEFAULT NULL, + `datec` datetime DEFAULT NULL, + `datea` datetime DEFAULT NULL, + `is_closed` tinyint(4) DEFAULT '0', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_pos_cash` +-- + +LOCK TABLES `llx_pos_cash` WRITE; +/*!40000 ALTER TABLE `llx_pos_cash` DISABLE KEYS */; +INSERT INTO `llx_pos_cash` VALUES (1,1,'aaa','aaa',0,3,1,1,1,1,NULL,1,0,0,1,NULL,'2013-01-19 18:18:39','2013-01-19 18:18:39',0); +/*!40000 ALTER TABLE `llx_pos_cash` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_pos_control_cash` +-- + +DROP TABLE IF EXISTS `llx_pos_control_cash`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_pos_control_cash` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `fk_cash` int(11) DEFAULT NULL, + `fk_user` int(11) DEFAULT NULL, + `date_c` datetime DEFAULT NULL, + `type_control` tinyint(4) DEFAULT '0', + `amount_teor` double(24,8) DEFAULT NULL, + `amount_real` double(24,8) DEFAULT NULL, + `amount_diff` double(24,8) DEFAULT NULL, + `amount_mov_out` double(24,8) DEFAULT NULL, + `amount_mov_int` double(24,8) DEFAULT NULL, + `amount_next_day` double(24,8) DEFAULT NULL, + `comment` text, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_pos_control_cash` +-- + +LOCK TABLES `llx_pos_control_cash` WRITE; +/*!40000 ALTER TABLE `llx_pos_control_cash` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_pos_control_cash` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_pos_facture` +-- + +DROP TABLE IF EXISTS `llx_pos_facture`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_pos_facture` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_cash` int(11) NOT NULL, + `fk_facture` int(11) NOT NULL, + `fk_control_cash` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_pos_facture` +-- + +LOCK TABLES `llx_pos_facture` WRITE; +/*!40000 ALTER TABLE `llx_pos_facture` DISABLE KEYS */; +INSERT INTO `llx_pos_facture` VALUES (1,1,148,NULL),(2,1,149,NULL),(3,1,150,NULL),(4,1,151,NULL); +/*!40000 ALTER TABLE `llx_pos_facture` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_pos_moviments` +-- + +DROP TABLE IF EXISTS `llx_pos_moviments`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_pos_moviments` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `fk_cash` int(11) DEFAULT NULL, + `fk_user` int(11) DEFAULT NULL, + `date_m` datetime DEFAULT NULL, + `amount` double(24,8) DEFAULT NULL, + `type` tinyint(4) DEFAULT NULL, + `comment` text, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_pos_moviments` +-- + +LOCK TABLES `llx_pos_moviments` WRITE; +/*!40000 ALTER TABLE `llx_pos_moviments` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_pos_moviments` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_pos_ticketdet` +-- + +DROP TABLE IF EXISTS `llx_pos_ticketdet`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_pos_ticketdet` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_ticket` int(11) NOT NULL, + `fk_parent_line` int(11) DEFAULT NULL, + `fk_product` int(11) DEFAULT NULL, + `description` text, + `tva_tx` double(6,3) DEFAULT NULL, + `localtax1_tx` double(6,3) DEFAULT '0.000', + `localtax2_tx` double(6,3) DEFAULT '0.000', + `qty` double DEFAULT NULL, + `remise_percent` double DEFAULT '0', + `remise` double DEFAULT '0', + `fk_remise_except` int(11) DEFAULT NULL, + `subprice` double(24,8) DEFAULT NULL, + `price` double(24,8) DEFAULT NULL, + `total_ht` double(24,8) DEFAULT NULL, + `total_tva` double(24,8) DEFAULT NULL, + `total_localtax1` double(24,8) DEFAULT '0.00000000', + `total_localtax2` double(24,8) DEFAULT '0.00000000', + `total_ttc` double(24,8) DEFAULT NULL, + `product_type` int(11) DEFAULT '0', + `date_start` datetime DEFAULT NULL, + `date_end` datetime DEFAULT NULL, + `info_bits` int(11) DEFAULT '0', + `fk_code_ventilation` int(11) NOT NULL DEFAULT '0', + `fk_export_compta` int(11) NOT NULL DEFAULT '0', + `rang` int(11) DEFAULT '0', + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_fk_remise_except` (`fk_remise_except`,`fk_ticket`), + KEY `idx_ticketdet_fk_ticket` (`fk_ticket`), + KEY `idx_ticketdet_fk_product` (`fk_product`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_pos_ticketdet` +-- + +LOCK TABLES `llx_pos_ticketdet` WRITE; +/*!40000 ALTER TABLE `llx_pos_ticketdet` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_pos_ticketdet` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_prelevement_bons` +-- + +DROP TABLE IF EXISTS `llx_prelevement_bons`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_prelevement_bons` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `ref` varchar(12) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `datec` datetime DEFAULT NULL, + `amount` double DEFAULT '0', + `statut` smallint(6) DEFAULT '0', + `credite` smallint(6) DEFAULT '0', + `note` text, + `date_trans` datetime DEFAULT NULL, + `method_trans` smallint(6) DEFAULT NULL, + `fk_user_trans` int(11) DEFAULT NULL, + `date_credit` datetime DEFAULT NULL, + `fk_user_credit` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_prelevement_bons_ref` (`ref`,`entity`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_prelevement_bons` +-- + +LOCK TABLES `llx_prelevement_bons` WRITE; +/*!40000 ALTER TABLE `llx_prelevement_bons` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_prelevement_bons` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_prelevement_facture` +-- + +DROP TABLE IF EXISTS `llx_prelevement_facture`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_prelevement_facture` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_facture` int(11) NOT NULL, + `fk_prelevement_lignes` int(11) NOT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_prelevement_facture_fk_prelevement_lignes` (`fk_prelevement_lignes`), + CONSTRAINT `fk_prelevement_facture_fk_prelevement_lignes` FOREIGN KEY (`fk_prelevement_lignes`) REFERENCES `llx_prelevement_lignes` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_prelevement_facture` +-- + +LOCK TABLES `llx_prelevement_facture` WRITE; +/*!40000 ALTER TABLE `llx_prelevement_facture` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_prelevement_facture` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_prelevement_facture_demande` +-- + +DROP TABLE IF EXISTS `llx_prelevement_facture_demande`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_prelevement_facture_demande` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_facture` int(11) NOT NULL, + `amount` double NOT NULL, + `date_demande` datetime NOT NULL, + `traite` smallint(6) DEFAULT '0', + `date_traite` datetime DEFAULT NULL, + `fk_prelevement_bons` int(11) DEFAULT NULL, + `fk_user_demande` int(11) NOT NULL, + `code_banque` varchar(7) DEFAULT NULL, + `code_guichet` varchar(6) DEFAULT NULL, + `number` varchar(255) DEFAULT NULL, + `cle_rib` varchar(5) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_prelevement_facture_demande` +-- + +LOCK TABLES `llx_prelevement_facture_demande` WRITE; +/*!40000 ALTER TABLE `llx_prelevement_facture_demande` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_prelevement_facture_demande` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_prelevement_lignes` +-- + +DROP TABLE IF EXISTS `llx_prelevement_lignes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_prelevement_lignes` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_prelevement_bons` int(11) DEFAULT NULL, + `fk_soc` int(11) NOT NULL, + `statut` smallint(6) DEFAULT '0', + `client_nom` varchar(255) DEFAULT NULL, + `amount` double DEFAULT '0', + `code_banque` varchar(7) DEFAULT NULL, + `code_guichet` varchar(6) DEFAULT NULL, + `number` varchar(255) DEFAULT NULL, + `cle_rib` varchar(5) DEFAULT NULL, + `note` text, + PRIMARY KEY (`rowid`), + KEY `idx_prelevement_lignes_fk_prelevement_bons` (`fk_prelevement_bons`), + CONSTRAINT `fk_prelevement_lignes_fk_prelevement_bons` FOREIGN KEY (`fk_prelevement_bons`) REFERENCES `llx_prelevement_bons` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_prelevement_lignes` +-- + +LOCK TABLES `llx_prelevement_lignes` WRITE; +/*!40000 ALTER TABLE `llx_prelevement_lignes` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_prelevement_lignes` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_prelevement_rejet` +-- + +DROP TABLE IF EXISTS `llx_prelevement_rejet`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_prelevement_rejet` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_prelevement_lignes` int(11) DEFAULT NULL, + `date_rejet` datetime DEFAULT NULL, + `motif` int(11) DEFAULT NULL, + `date_creation` datetime DEFAULT NULL, + `fk_user_creation` int(11) DEFAULT NULL, + `note` text, + `afacturer` tinyint(4) DEFAULT '0', + `fk_facture` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_prelevement_rejet` +-- + +LOCK TABLES `llx_prelevement_rejet` WRITE; +/*!40000 ALTER TABLE `llx_prelevement_rejet` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_prelevement_rejet` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_printer_ipp` +-- + +DROP TABLE IF EXISTS `llx_printer_ipp`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_printer_ipp` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datec` datetime DEFAULT NULL, + `printer_name` text NOT NULL, + `printer_location` text NOT NULL, + `printer_uri` varchar(256) NOT NULL, + `copy` int(11) NOT NULL DEFAULT '1', + `module` varchar(16) NOT NULL, + `login` varchar(32) NOT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_printer_ipp` +-- + +LOCK TABLES `llx_printer_ipp` WRITE; +/*!40000 ALTER TABLE `llx_printer_ipp` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_printer_ipp` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product` +-- + +DROP TABLE IF EXISTS `llx_product`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `virtual` tinyint(4) NOT NULL DEFAULT '0', + `fk_parent` int(11) DEFAULT '0', + `ref` varchar(128) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `ref_ext` varchar(128) DEFAULT NULL, + `label` varchar(255) NOT NULL, + `description` text, + `note` text, + `customcode` varchar(32) DEFAULT NULL, + `fk_country` int(11) DEFAULT NULL, + `price` double(24,8) DEFAULT '0.00000000', + `price_ttc` double(24,8) DEFAULT '0.00000000', + `price_min` double(24,8) DEFAULT '0.00000000', + `price_min_ttc` double(24,8) DEFAULT '0.00000000', + `price_base_type` varchar(3) DEFAULT 'HT', + `tva_tx` double(6,3) DEFAULT NULL, + `recuperableonly` int(11) NOT NULL DEFAULT '0', + `localtax1_tx` double(6,3) DEFAULT '0.000', + `localtax2_tx` double(6,3) DEFAULT '0.000', + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `tosell` tinyint(4) DEFAULT '1', + `tobuy` tinyint(4) DEFAULT '1', + `tobatch` tinyint(4) NOT NULL DEFAULT '0', + `fk_product_type` int(11) DEFAULT '0', + `duration` varchar(6) DEFAULT NULL, + `seuil_stock_alerte` int(11) DEFAULT '0', + `url` varchar(255) DEFAULT NULL, + `barcode` varchar(255) DEFAULT NULL, + `fk_barcode_type` int(11) DEFAULT NULL, + `accountancy_code_sell` varchar(32) DEFAULT NULL, + `accountancy_code_buy` varchar(32) DEFAULT NULL, + `partnumber` varchar(32) DEFAULT NULL, + `weight` float DEFAULT NULL, + `weight_units` tinyint(4) DEFAULT NULL, + `length` float DEFAULT NULL, + `length_units` tinyint(4) DEFAULT NULL, + `surface` float DEFAULT NULL, + `surface_units` tinyint(4) DEFAULT NULL, + `volume` float DEFAULT NULL, + `volume_units` tinyint(4) DEFAULT NULL, + `stock` int(11) DEFAULT NULL, + `pmp` double(24,8) NOT NULL DEFAULT '0.00000000', + `canvas` varchar(32) DEFAULT 'default@product', + `finished` tinyint(4) DEFAULT NULL, + `hidden` tinyint(4) DEFAULT '0', + `import_key` varchar(14) DEFAULT NULL, + `desiredstock` int(11) DEFAULT '0', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_product_ref` (`ref`,`entity`), + UNIQUE KEY `uk_product_barcode` (`barcode`,`fk_barcode_type`,`entity`), + KEY `idx_product_label` (`label`), + KEY `idx_product_barcode` (`barcode`), + KEY `idx_product_import_key` (`import_key`), + KEY `idx_product_fk_country` (`fk_country`), + KEY `idx_product_fk_user_author` (`fk_user_author`), + KEY `idx_product_fk_barcode_type` (`fk_barcode_type`), + CONSTRAINT `fk_product_fk_country` FOREIGN KEY (`fk_country`) REFERENCES `llx_c_country` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product` +-- + +LOCK TABLES `llx_product` WRITE; +/*!40000 ALTER TABLE `llx_product` DISABLE KEYS */; +INSERT INTO `llx_product` VALUES (1,'2010-07-08 14:33:17','2014-12-21 12:51:04',0,0,'PIDRESS',1,NULL,'Pink dress','A beatifull pink dress','',NULL,NULL,100.00000000,112.50000000,90.00000000,101.25000000,'HT',12.500,0,0.000,0.000,1,NULL,1,1,0,0,'',20,NULL,NULL,NULL,'','',NULL,100,0,NULL,0,NULL,0,NULL,0,2,0.00000000,NULL,1,0,NULL,0),(2,'2010-07-09 00:30:01','2014-12-21 12:51:04',0,0,'Product_P1',1,NULL,'Product P1','','','',32,0.00000000,0.00000000,0.00000000,0.00000000,'HT',12.500,0,0.000,0.000,1,NULL,1,1,0,0,'',NULL,NULL,NULL,NULL,'','',NULL,NULL,0,NULL,0,NULL,0,NULL,0,998,0.00000000,NULL,0,0,NULL,0),(3,'2010-07-09 00:30:25','2014-12-21 12:51:04',0,0,'Service_S1',1,NULL,'Service S1','','',NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000,'HT',12.500,0,0.000,0.000,1,NULL,1,1,0,1,'1m',NULL,NULL,NULL,NULL,'','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,NULL,0,0,NULL,0),(4,'2010-07-10 14:44:06','2014-12-21 12:51:04',0,0,'DECAP',1,NULL,'Decapsuleur','','',NULL,NULL,5.00000000,5.62500000,0.00000000,0.00000000,'HT',12.500,0,0.000,0.000,1,NULL,1,1,0,0,'',NULL,NULL,NULL,NULL,'','',NULL,2,-3,NULL,0,NULL,0,NULL,0,1001,10.00000000,NULL,1,0,NULL,0),(5,'2011-07-20 23:11:38','2014-12-21 12:51:04',0,0,'aaaa',1,NULL,'aaaa','cccc','bbbb','',NULL,10.00000000,11.96000000,0.00000000,0.00000000,'HT',19.600,0,0.000,0.000,1,NULL,1,1,0,0,'',NULL,NULL,NULL,NULL,'','',NULL,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0.00000000,'',1,0,NULL,0),(6,'2011-07-29 22:16:44','2014-12-21 12:51:04',0,0,'Copy_of_aaaa',1,NULL,'aaaa','cccc','bbbb','',NULL,10.00000000,11.96000000,0.00000000,0.00000000,'HT',19.600,0,0.000,0.000,1,NULL,0,1,0,0,'',NULL,NULL,NULL,NULL,'','',NULL,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0.00000000,'',1,0,NULL,0),(7,'2011-07-29 22:31:21','2014-12-21 12:51:04',0,0,'Copy_of_Copy_of_aaaa',1,NULL,'aaaa','cccc','bbbb','',NULL,10.00000000,11.96000000,0.00000000,0.00000000,'HT',19.600,0,0.000,0.000,1,NULL,0,0,0,0,'',NULL,NULL,NULL,NULL,'','',NULL,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0.00000000,'',1,0,NULL,0),(8,'2011-07-29 22:46:54','2014-12-21 12:51:04',0,0,'Copy_of_Copy_of_Copy_of_aaaa',1,NULL,'aaaa','cccc','bbbb','',NULL,10.00000000,11.96000000,0.00000000,0.00000000,'HT',19.600,0,0.000,0.000,1,NULL,0,0,0,0,'',NULL,NULL,NULL,NULL,'','',NULL,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0.00000000,'',1,0,NULL,0),(10,'2008-12-31 00:00:00','2014-12-21 12:51:04',0,0,'PR123456',1,NULL,'My product','This is a description example for record','Some note',NULL,NULL,100.00000000,110.00000000,0.00000000,0.00000000,'HT',10.000,0,0.000,0.000,NULL,NULL,0,0,0,0,'1y',0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,NULL,NULL,0,'20110729232310',0),(11,'2013-01-13 20:24:42','2014-12-21 12:51:04',0,0,'gh',1,NULL,'hfghf','','','',NULL,0.00000000,0.00000000,0.00000000,0.00000000,'HT',0.000,0,0.000,0.000,1,NULL,1,1,0,0,'',NULL,NULL,NULL,NULL,'','',NULL,NULL,0,NULL,0,NULL,0,NULL,0,-1,0.00000000,'',1,0,NULL,0); +/*!40000 ALTER TABLE `llx_product` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_association` +-- + +DROP TABLE IF EXISTS `llx_product_association`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_association` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_product_pere` int(11) NOT NULL DEFAULT '0', + `fk_product_fils` int(11) NOT NULL DEFAULT '0', + `qty` double DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_product_association` (`fk_product_pere`,`fk_product_fils`), + KEY `idx_product_association` (`fk_product_fils`), + KEY `idx_product_association_fils` (`fk_product_fils`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_association` +-- + +LOCK TABLES `llx_product_association` WRITE; +/*!40000 ALTER TABLE `llx_product_association` DISABLE KEYS */; +INSERT INTO `llx_product_association` VALUES (1,4,1,2),(2,5,1,1); +/*!40000 ALTER TABLE `llx_product_association` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_batch` +-- + +DROP TABLE IF EXISTS `llx_product_batch`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_batch` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_product_stock` int(11) NOT NULL, + `eatby` datetime DEFAULT NULL, + `sellby` datetime DEFAULT NULL, + `batch` varchar(30) DEFAULT NULL, + `qty` double NOT NULL DEFAULT '0', + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_fk_product_stock` (`fk_product_stock`), + KEY `ix_fk_product_stock` (`fk_product_stock`), + CONSTRAINT `fk_product_batch_fk_product_stock` FOREIGN KEY (`fk_product_stock`) REFERENCES `llx_product_stock` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_batch` +-- + +LOCK TABLES `llx_product_batch` WRITE; +/*!40000 ALTER TABLE `llx_product_batch` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_product_batch` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_customer_price` +-- + +DROP TABLE IF EXISTS `llx_product_customer_price`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_customer_price` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_product` int(11) NOT NULL, + `fk_soc` int(11) NOT NULL, + `price` double(24,8) DEFAULT '0.00000000', + `price_ttc` double(24,8) DEFAULT '0.00000000', + `price_min` double(24,8) DEFAULT '0.00000000', + `price_min_ttc` double(24,8) DEFAULT '0.00000000', + `price_base_type` varchar(3) DEFAULT 'HT', + `tva_tx` double(6,3) DEFAULT NULL, + `recuperableonly` int(11) NOT NULL DEFAULT '0', + `localtax1_tx` double(6,3) DEFAULT '0.000', + `localtax2_tx` double(6,3) DEFAULT '0.000', + `fk_user` int(11) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_customer_price_fk_product_fk_soc` (`fk_product`,`fk_soc`), + KEY `idx_product_customer_price_fk_user` (`fk_user`), + KEY `fk_customer_price_fk_soc` (`fk_soc`), + KEY `idx_product_customer_price_fk_soc` (`fk_soc`), + CONSTRAINT `fk_customer_price_fk_product` FOREIGN KEY (`fk_product`) REFERENCES `llx_product` (`rowid`) ON DELETE CASCADE, + CONSTRAINT `fk_customer_price_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`) ON DELETE CASCADE, + CONSTRAINT `fk_product_customer_price_fk_user` FOREIGN KEY (`fk_user`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_customer_price` +-- + +LOCK TABLES `llx_product_customer_price` WRITE; +/*!40000 ALTER TABLE `llx_product_customer_price` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_product_customer_price` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_customer_price_log` +-- + +DROP TABLE IF EXISTS `llx_product_customer_price_log`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_customer_price_log` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `datec` datetime DEFAULT NULL, + `fk_product` int(11) NOT NULL, + `fk_soc` int(11) NOT NULL, + `price` double(24,8) DEFAULT '0.00000000', + `price_ttc` double(24,8) DEFAULT '0.00000000', + `price_min` double(24,8) DEFAULT '0.00000000', + `price_min_ttc` double(24,8) DEFAULT '0.00000000', + `price_base_type` varchar(3) DEFAULT 'HT', + `tva_tx` double(6,3) DEFAULT NULL, + `recuperableonly` int(11) NOT NULL DEFAULT '0', + `localtax1_tx` double(6,3) DEFAULT '0.000', + `localtax2_tx` double(6,3) DEFAULT '0.000', + `fk_user` int(11) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_customer_price_log` +-- + +LOCK TABLES `llx_product_customer_price_log` WRITE; +/*!40000 ALTER TABLE `llx_product_customer_price_log` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_product_customer_price_log` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_extrafields` +-- + +DROP TABLE IF EXISTS `llx_product_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_product_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_extrafields` +-- + +LOCK TABLES `llx_product_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_product_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_product_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_fournisseur_price` +-- + +DROP TABLE IF EXISTS `llx_product_fournisseur_price`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_fournisseur_price` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_product` int(11) DEFAULT NULL, + `fk_soc` int(11) DEFAULT NULL, + `ref_fourn` varchar(30) DEFAULT NULL, + `fk_availability` int(11) DEFAULT NULL, + `price` double(24,8) DEFAULT '0.00000000', + `quantity` double DEFAULT NULL, + `remise_percent` double NOT NULL DEFAULT '0', + `remise` double NOT NULL DEFAULT '0', + `unitprice` double(24,8) DEFAULT '0.00000000', + `charges` double(24,8) DEFAULT '0.00000000', + `unitcharges` double(24,8) DEFAULT '0.00000000', + `tva_tx` double(6,3) NOT NULL DEFAULT '0.000', + `info_bits` int(11) NOT NULL DEFAULT '0', + `fk_user` int(11) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_product_fournisseur_price_ref` (`ref_fourn`,`fk_soc`,`quantity`,`entity`), + KEY `idx_product_fournisseur_price_fk_user` (`fk_user`), + KEY `idx_product_fourn_price_fk_product` (`fk_product`,`entity`), + KEY `idx_product_fourn_price_fk_soc` (`fk_soc`,`entity`), + CONSTRAINT `fk_product_fournisseur_price_fk_product` FOREIGN KEY (`fk_product`) REFERENCES `llx_product` (`rowid`), + CONSTRAINT `fk_product_fournisseur_price_fk_user` FOREIGN KEY (`fk_user`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_fournisseur_price` +-- + +LOCK TABLES `llx_product_fournisseur_price` WRITE; +/*!40000 ALTER TABLE `llx_product_fournisseur_price` DISABLE KEYS */; +INSERT INTO `llx_product_fournisseur_price` VALUES (1,'2010-07-11 18:45:42','2012-12-08 13:11:08',4,1,'ABCD',NULL,10.00000000,1,0,0,10.00000000,0.00000000,0.00000000,0.000,0,1,NULL,1); +/*!40000 ALTER TABLE `llx_product_fournisseur_price` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_fournisseur_price_log` +-- + +DROP TABLE IF EXISTS `llx_product_fournisseur_price_log`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_fournisseur_price_log` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `datec` datetime DEFAULT NULL, + `fk_product_fournisseur` int(11) NOT NULL, + `price` double(24,8) DEFAULT '0.00000000', + `quantity` double DEFAULT NULL, + `fk_user` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_fournisseur_price_log` +-- + +LOCK TABLES `llx_product_fournisseur_price_log` WRITE; +/*!40000 ALTER TABLE `llx_product_fournisseur_price_log` DISABLE KEYS */; +INSERT INTO `llx_product_fournisseur_price_log` VALUES (1,'2010-07-11 18:45:42',1,10.00000000,1,1); +/*!40000 ALTER TABLE `llx_product_fournisseur_price_log` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_lang` +-- + +DROP TABLE IF EXISTS `llx_product_lang`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_lang` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_product` int(11) NOT NULL DEFAULT '0', + `lang` varchar(5) NOT NULL DEFAULT '0', + `label` varchar(255) NOT NULL, + `description` text, + `note` text, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_product_lang` (`fk_product`,`lang`), + CONSTRAINT `fk_product_lang_fk_product` FOREIGN KEY (`fk_product`) REFERENCES `llx_product` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_lang` +-- + +LOCK TABLES `llx_product_lang` WRITE; +/*!40000 ALTER TABLE `llx_product_lang` DISABLE KEYS */; +INSERT INTO `llx_product_lang` VALUES (1,1,'en_US','Pink dress','A beatifull pink dress',''),(2,2,'en_US','Product P1','',''),(3,3,'en_US','Service S1','',''),(4,4,'fr_FR','Decapsuleur','',''),(5,5,'en_US','aaaa','cccc','bbbb'),(6,6,'en_US','aaaa','cccc','bbbb'),(7,7,'en_US','aaaa','cccc','bbbb'),(8,8,'en_US','aaaa','cccc','bbbb'),(9,11,'fr_FR','hfghf','',''),(10,2,'fr_FR','Product P1','',''); +/*!40000 ALTER TABLE `llx_product_lang` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_price` +-- + +DROP TABLE IF EXISTS `llx_product_price`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_price` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_product` int(11) NOT NULL, + `date_price` datetime NOT NULL, + `price_level` smallint(6) DEFAULT '1', + `price` double(24,8) DEFAULT NULL, + `price_ttc` double(24,8) DEFAULT NULL, + `price_min` double(24,8) DEFAULT NULL, + `price_min_ttc` double(24,8) DEFAULT NULL, + `price_base_type` varchar(3) DEFAULT 'HT', + `tva_tx` double(6,3) NOT NULL, + `recuperableonly` int(11) NOT NULL DEFAULT '0', + `localtax1_tx` double(6,3) DEFAULT '0.000', + `localtax2_tx` double(6,3) DEFAULT '0.000', + `fk_user_author` int(11) DEFAULT NULL, + `tosell` tinyint(4) DEFAULT '1', + `price_by_qty` int(11) NOT NULL DEFAULT '0', + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_product_price_fk_user_author` (`fk_user_author`), + KEY `idx_product_price_fk_product` (`fk_product`), + CONSTRAINT `fk_product_price_product` FOREIGN KEY (`fk_product`) REFERENCES `llx_product` (`rowid`), + CONSTRAINT `fk_product_price_user_author` FOREIGN KEY (`fk_user_author`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_price` +-- + +LOCK TABLES `llx_product_price` WRITE; +/*!40000 ALTER TABLE `llx_product_price` DISABLE KEYS */; +INSERT INTO `llx_product_price` VALUES (1,1,'2010-07-08 12:33:17',1,'2010-07-08 14:33:17',1,0.00000000,0.00000000,0.00000000,0.00000000,'HT',12.500,0,0.000,0.000,1,1,0,NULL),(2,1,'2010-07-08 22:30:01',2,'2010-07-09 00:30:01',1,0.00000000,0.00000000,0.00000000,0.00000000,'HT',12.500,0,0.000,0.000,1,1,0,NULL),(3,1,'2010-07-08 22:30:25',3,'2010-07-09 00:30:25',1,0.00000000,0.00000000,0.00000000,0.00000000,'HT',12.500,0,0.000,0.000,1,1,0,NULL),(4,1,'2010-07-10 12:44:06',4,'2010-07-10 14:44:06',1,0.00000000,0.00000000,0.00000000,0.00000000,'HT',12.500,0,0.000,0.000,1,1,0,NULL),(5,1,'2011-07-20 21:11:38',5,'2011-07-20 23:11:38',1,0.00000000,0.00000000,0.00000000,0.00000000,'HT',19.600,0,0.000,0.000,1,1,0,NULL),(6,1,'2011-07-27 17:02:59',5,'2011-07-27 19:02:59',1,10.00000000,11.96000000,0.00000000,0.00000000,'HT',19.600,0,0.000,0.000,1,1,0,NULL),(7,1,'2011-07-29 20:16:44',6,'2011-07-29 22:16:44',1,10.00000000,11.96000000,0.00000000,0.00000000,'HT',19.600,0,0.000,0.000,1,0,0,NULL),(8,1,'2011-07-29 20:31:21',7,'2011-07-29 22:31:21',1,10.00000000,11.96000000,0.00000000,0.00000000,'HT',19.600,0,0.000,0.000,1,0,0,NULL),(9,1,'2011-07-29 20:46:54',8,'2011-07-29 22:46:54',1,10.00000000,11.96000000,0.00000000,0.00000000,'HT',19.600,0,0.000,0.000,1,0,0,NULL),(10,1,'2011-07-31 22:34:27',4,'2011-08-01 00:34:27',1,5.00000000,5.62500000,0.00000000,0.00000000,'HT',12.500,0,0.000,0.000,1,1,0,NULL),(12,1,'2013-01-13 19:24:59',11,'2013-01-13 20:24:59',1,0.00000000,0.00000000,0.00000000,0.00000000,'HT',0.000,0,0.000,0.000,1,1,0,NULL),(13,1,'2013-03-12 09:30:24',1,'2013-03-12 10:30:24',1,100.00000000,112.50000000,90.00000000,101.25000000,'HT',12.500,0,0.000,0.000,1,1,0,NULL); +/*!40000 ALTER TABLE `llx_product_price` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_price_by_qty` +-- + +DROP TABLE IF EXISTS `llx_product_price_by_qty`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_price_by_qty` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_product_price` int(11) NOT NULL, + `date_price` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `price` double(24,8) DEFAULT '0.00000000', + `price_ttc` double(24,8) DEFAULT '0.00000000', + `remise_percent` double NOT NULL DEFAULT '0', + `remise` double NOT NULL DEFAULT '0', + `qty_min` double DEFAULT '0', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_product_price_by_qty_level` (`fk_product_price`,`qty_min`), + KEY `idx_product_price_by_qty_fk_product_price` (`fk_product_price`), + CONSTRAINT `fk_product_price_by_qty_fk_product_price` FOREIGN KEY (`fk_product_price`) REFERENCES `llx_product_price` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_price_by_qty` +-- + +LOCK TABLES `llx_product_price_by_qty` WRITE; +/*!40000 ALTER TABLE `llx_product_price_by_qty` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_product_price_by_qty` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_stock` +-- + +DROP TABLE IF EXISTS `llx_product_stock`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_stock` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_product` int(11) NOT NULL, + `fk_entrepot` int(11) NOT NULL, + `reel` double DEFAULT NULL, + `pmp` double(24,8) NOT NULL DEFAULT '0.00000000', + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_product_stock` (`fk_product`,`fk_entrepot`), + KEY `idx_product_stock_fk_product` (`fk_product`), + KEY `idx_product_stock_fk_entrepot` (`fk_entrepot`) +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_stock` +-- + +LOCK TABLES `llx_product_stock` WRITE; +/*!40000 ALTER TABLE `llx_product_stock` DISABLE KEYS */; +INSERT INTO `llx_product_stock` VALUES (1,'2010-07-08 22:43:51',2,2,1000,0.00000000,NULL),(3,'2010-07-10 23:02:20',4,2,1000,0.00000000,NULL),(4,'2013-01-19 17:22:48',4,1,1,10.00000000,NULL),(5,'2013-01-19 17:22:48',1,1,2,0.00000000,NULL),(6,'2013-01-19 17:22:48',11,1,-1,0.00000000,NULL),(7,'2013-01-19 17:31:58',2,1,-2,0.00000000,NULL); +/*!40000 ALTER TABLE `llx_product_stock` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_subproduct` +-- + +DROP TABLE IF EXISTS `llx_product_subproduct`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_subproduct` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_product` int(11) NOT NULL, + `fk_product_subproduct` int(11) NOT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `fk_product` (`fk_product`,`fk_product_subproduct`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_subproduct` +-- + +LOCK TABLES `llx_product_subproduct` WRITE; +/*!40000 ALTER TABLE `llx_product_subproduct` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_product_subproduct` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_projet` +-- + +DROP TABLE IF EXISTS `llx_projet`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_projet` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_soc` int(11) DEFAULT NULL, + `datec` date DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dateo` date DEFAULT NULL, + `datee` date DEFAULT NULL, + `ref` varchar(50) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `title` varchar(255) NOT NULL, + `description` text, + `fk_user_creat` int(11) NOT NULL, + `public` int(11) DEFAULT NULL, + `fk_statut` smallint(6) NOT NULL DEFAULT '0', + `note_private` text, + `note_public` text, + `model_pdf` varchar(255) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_projet_ref` (`ref`,`entity`), + KEY `idx_projet_fk_soc` (`fk_soc`), + CONSTRAINT `fk_projet_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_projet` +-- + +LOCK TABLES `llx_projet` WRITE; +/*!40000 ALTER TABLE `llx_projet` DISABLE KEYS */; +INSERT INTO `llx_projet` VALUES (1,NULL,'2010-07-09','2014-12-21 13:17:58','2010-07-09',NULL,'PROJ1',1,'Project One','',1,0,1,NULL,'gdfgdfg','baleine'),(2,NULL,'2010-07-09','2010-07-08 22:49:56','2010-07-09',NULL,'PROJ2',1,'Project Two','',1,0,0,NULL,NULL,NULL),(3,1,'2010-07-09','2010-07-08 22:50:19','2010-07-09',NULL,'PROJABC',1,'Project to create ABC company','',1,0,0,NULL,NULL,NULL),(4,NULL,'2010-07-09','2010-07-08 22:50:49','2010-07-09',NULL,'PROJSHARED',1,'The Global project','',1,1,1,NULL,NULL,NULL),(5,NULL,'2010-07-11','2010-07-11 14:22:49','2010-07-11','2011-07-14','RMLL',1,'Projet gestion RMLL 2011','',1,1,1,NULL,NULL,NULL); +/*!40000 ALTER TABLE `llx_projet` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_projet_extrafields` +-- + +DROP TABLE IF EXISTS `llx_projet_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_projet_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_projet_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_projet_extrafields` +-- + +LOCK TABLES `llx_projet_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_projet_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_projet_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_projet_task` +-- + +DROP TABLE IF EXISTS `llx_projet_task`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_projet_task` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `ref` varchar(50) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `fk_projet` int(11) NOT NULL, + `fk_task_parent` int(11) NOT NULL DEFAULT '0', + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dateo` datetime DEFAULT NULL, + `datee` datetime DEFAULT NULL, + `datev` datetime DEFAULT NULL, + `label` varchar(255) NOT NULL, + `description` text, + `duration_effective` double NOT NULL DEFAULT '0', + `planned_workload` double NOT NULL DEFAULT '0', + `progress` int(11) DEFAULT '0', + `priority` int(11) DEFAULT '0', + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_valid` int(11) DEFAULT NULL, + `fk_statut` smallint(6) NOT NULL DEFAULT '0', + `note_private` text, + `note_public` text, + `rang` int(11) DEFAULT '0', + `model_pdf` varchar(255) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_projet_task_fk_projet` (`fk_projet`), + KEY `idx_projet_task_fk_user_creat` (`fk_user_creat`), + KEY `idx_projet_task_fk_user_valid` (`fk_user_valid`), + CONSTRAINT `fk_projet_task_fk_projet` FOREIGN KEY (`fk_projet`) REFERENCES `llx_projet` (`rowid`), + CONSTRAINT `fk_projet_task_fk_user_creat` FOREIGN KEY (`fk_user_creat`) REFERENCES `llx_user` (`rowid`), + CONSTRAINT `fk_projet_task_fk_user_valid` FOREIGN KEY (`fk_user_valid`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_projet_task` +-- + +LOCK TABLES `llx_projet_task` WRITE; +/*!40000 ALTER TABLE `llx_projet_task` DISABLE KEYS */; +INSERT INTO `llx_projet_task` VALUES (1,'1',1,1,0,'2010-07-11 15:15:55','2013-09-08 23:06:14','2010-07-11 12:00:00',NULL,NULL,'Work on module','',25920000,0,0,0,1,NULL,0,NULL,NULL,0,NULL),(2,'2',1,5,0,'2010-07-11 16:23:53','2013-09-08 23:06:14','2010-07-11 12:00:00','2011-07-14 12:00:00',NULL,'Heberger site RMLL','',0,0,0,0,1,NULL,0,NULL,NULL,0,NULL),(3,'TK1007-0001',1,1,0,'2014-12-21 13:52:41','2014-12-21 13:55:08','2014-12-21 13:52:00',NULL,NULL,'azerty','',9000,36000,0,0,1,NULL,0,NULL,'gdfgdfgdf',0,NULL),(4,'TK1007-0002',1,1,0,'2014-12-21 13:55:39','2014-12-21 13:22:35','2014-12-21 13:55:00',NULL,NULL,'gdfgdfgfd','',7200,18000,25,0,1,NULL,0,NULL,NULL,0,NULL),(5,'TK1007-0003',1,1,0,'2014-12-21 14:16:58','2014-12-21 13:16:58','2014-12-21 14:16:00',NULL,NULL,'mmmm','',0,0,0,0,1,NULL,0,NULL,NULL,0,NULL); +/*!40000 ALTER TABLE `llx_projet_task` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_projet_task_extrafields` +-- + +DROP TABLE IF EXISTS `llx_projet_task_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_projet_task_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_projet_task_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_projet_task_extrafields` +-- + +LOCK TABLES `llx_projet_task_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_projet_task_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_projet_task_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_projet_task_time` +-- + +DROP TABLE IF EXISTS `llx_projet_task_time`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_projet_task_time` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_task` int(11) NOT NULL, + `task_date` date DEFAULT NULL, + `task_datehour` datetime DEFAULT NULL, + `task_duration` double DEFAULT NULL, + `fk_user` int(11) DEFAULT NULL, + `thm` double(24,8) DEFAULT NULL, + `note` text, + PRIMARY KEY (`rowid`), + KEY `idx_projet_task_time_task` (`fk_task`), + KEY `idx_projet_task_time_date` (`task_date`), + KEY `idx_projet_task_time_datehour` (`task_datehour`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_projet_task_time` +-- + +LOCK TABLES `llx_projet_task_time` WRITE; +/*!40000 ALTER TABLE `llx_projet_task_time` DISABLE KEYS */; +INSERT INTO `llx_projet_task_time` VALUES (1,1,'2010-07-11',NULL,25920000,1,NULL,''),(2,4,'2014-12-21','2014-12-21 12:00:00',3600,1,NULL,''),(3,4,'2014-12-18','2014-12-18 12:00:00',3600,1,NULL,NULL),(4,3,'2014-12-21','2014-12-21 12:00:00',3600,1,NULL,NULL),(5,3,'2014-12-21','2014-12-21 12:00:00',1800,1,NULL,NULL),(6,3,'2014-12-21','2014-12-21 12:00:00',3600,1,NULL,NULL); +/*!40000 ALTER TABLE `llx_projet_task_time` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_propal` +-- + +DROP TABLE IF EXISTS `llx_propal`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_propal` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_soc` int(11) DEFAULT NULL, + `fk_projet` int(11) DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `ref` varchar(30) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `ref_ext` varchar(255) DEFAULT NULL, + `ref_int` varchar(255) DEFAULT NULL, + `ref_client` varchar(255) DEFAULT NULL, + `datec` datetime DEFAULT NULL, + `datep` date DEFAULT NULL, + `fin_validite` datetime DEFAULT NULL, + `date_valid` datetime DEFAULT NULL, + `date_cloture` datetime DEFAULT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `fk_user_valid` int(11) DEFAULT NULL, + `fk_user_cloture` int(11) DEFAULT NULL, + `fk_statut` smallint(6) NOT NULL DEFAULT '0', + `price` double DEFAULT '0', + `remise_percent` double DEFAULT '0', + `remise_absolue` double DEFAULT '0', + `remise` double DEFAULT '0', + `total_ht` double(24,8) DEFAULT '0.00000000', + `tva` double(24,8) DEFAULT '0.00000000', + `localtax1` double(24,8) DEFAULT '0.00000000', + `localtax2` double(24,8) DEFAULT '0.00000000', + `total` double(24,8) DEFAULT '0.00000000', + `fk_account` int(11) DEFAULT NULL, + `fk_currency` varchar(3) DEFAULT NULL, + `fk_cond_reglement` int(11) DEFAULT NULL, + `fk_mode_reglement` int(11) DEFAULT NULL, + `note_private` text, + `note_public` text, + `model_pdf` varchar(255) DEFAULT NULL, + `date_livraison` date DEFAULT NULL, + `fk_shipping_method` int(11) DEFAULT NULL, + `fk_availability` int(11) DEFAULT NULL, + `fk_delivery_address` int(11) DEFAULT NULL, + `fk_input_reason` int(11) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + `extraparams` varchar(255) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_propal_ref` (`ref`,`entity`), + KEY `idx_propal_fk_soc` (`fk_soc`), + KEY `idx_propal_fk_user_author` (`fk_user_author`), + KEY `idx_propal_fk_user_valid` (`fk_user_valid`), + KEY `idx_propal_fk_user_cloture` (`fk_user_cloture`), + KEY `idx_propal_fk_projet` (`fk_projet`), + KEY `idx_propal_fk_account` (`fk_account`), + KEY `idx_propal_fk_currency` (`fk_currency`), + CONSTRAINT `fk_propal_fk_projet` FOREIGN KEY (`fk_projet`) REFERENCES `llx_projet` (`rowid`), + CONSTRAINT `fk_propal_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`), + CONSTRAINT `fk_propal_fk_user_author` FOREIGN KEY (`fk_user_author`) REFERENCES `llx_user` (`rowid`), + CONSTRAINT `fk_propal_fk_user_cloture` FOREIGN KEY (`fk_user_cloture`) REFERENCES `llx_user` (`rowid`), + CONSTRAINT `fk_propal_fk_user_valid` FOREIGN KEY (`fk_user_valid`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_propal` +-- + +LOCK TABLES `llx_propal` WRITE; +/*!40000 ALTER TABLE `llx_propal` DISABLE KEYS */; +INSERT INTO `llx_propal` VALUES (1,2,NULL,'2012-12-08 13:11:07','PR1007-0001',1,NULL,NULL,'','2010-07-09 01:33:49','2010-07-09','2010-07-24 12:00:00','2011-08-08 14:24:18',NULL,1,NULL,1,NULL,1,0,NULL,NULL,0,30.00000000,3.84000000,0.00000000,0.00000000,33.84000000,NULL,NULL,1,0,'','','azur',NULL,NULL,NULL,NULL,0,NULL,NULL),(2,1,NULL,'2012-12-08 13:11:07','PR1007-0002',1,NULL,NULL,'','2010-07-10 02:11:44','2010-07-10','2010-07-25 12:00:00','2010-07-10 02:12:55','2011-07-20 15:23:12',1,NULL,1,1,2,0,NULL,NULL,0,10.00000000,0.00000000,0.00000000,0.00000000,10.00000000,NULL,NULL,1,1,'','','azur',NULL,NULL,NULL,NULL,0,NULL,NULL),(3,4,NULL,'2012-12-08 13:11:07','PR1007-0003',1,NULL,NULL,'','2010-07-18 11:35:11','2010-07-18','2010-08-02 12:00:00','2010-07-18 11:36:18','2011-07-20 15:21:15',1,NULL,1,1,2,0,NULL,NULL,0,10.00000000,0.00000000,0.00000000,0.00000000,10.00000000,NULL,NULL,1,0,'','','azur',NULL,NULL,NULL,NULL,0,NULL,NULL),(4,17,NULL,'2012-12-08 13:11:07','PR1108-0004',1,NULL,NULL,'','2011-08-04 23:36:23','2011-08-05','2011-08-20 12:00:00','2011-08-08 14:24:24',NULL,1,NULL,1,NULL,1,0,NULL,NULL,0,30.00000000,5.88000000,0.00000000,0.00000000,35.88000000,NULL,NULL,1,0,'','','azur',NULL,NULL,0,NULL,0,NULL,NULL),(5,19,NULL,'2013-02-17 14:39:56','PR1302-0005',1,NULL,NULL,'','2013-02-17 15:39:56','2013-02-17','2013-03-04 12:00:00',NULL,NULL,1,NULL,NULL,NULL,0,0,NULL,NULL,0,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,NULL,NULL,1,0,'','','azur',NULL,NULL,0,NULL,0,NULL,NULL),(6,19,NULL,'2013-02-17 14:40:12','PR1302-0006',1,NULL,NULL,'','2013-02-17 15:40:12','2013-02-17','2013-03-04 12:00:00',NULL,NULL,1,NULL,NULL,NULL,0,0,NULL,NULL,0,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,NULL,NULL,1,0,'','','azur',NULL,NULL,0,NULL,0,NULL,NULL),(7,19,NULL,'2013-02-17 14:41:15','PR1302-0007',1,NULL,NULL,'','2013-02-17 15:41:15','2013-02-17','2013-03-04 12:00:00',NULL,NULL,1,NULL,NULL,NULL,0,0,NULL,NULL,0,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,NULL,NULL,1,0,'','','azur',NULL,NULL,0,NULL,0,NULL,NULL),(8,19,NULL,'2013-02-17 14:43:39','PR1302-0008',1,NULL,NULL,'','2013-02-17 15:43:39','2013-02-17','2013-03-04 12:00:00',NULL,NULL,1,NULL,NULL,NULL,0,0,NULL,NULL,0,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,NULL,NULL,1,0,'','','azur',NULL,NULL,0,NULL,0,NULL,NULL),(9,19,NULL,'2013-02-17 15:22:14','PR1302-0009',1,NULL,NULL,'','2013-02-17 15:53:01','2013-02-17','2013-03-04 12:00:00','2013-02-17 16:22:10','2013-02-17 16:22:14',1,NULL,1,1,2,0,NULL,NULL,0,60.00000000,11.76000000,0.00000000,0.00000000,71.76000000,NULL,NULL,1,0,'','','azur',NULL,NULL,0,NULL,0,NULL,NULL),(11,18,NULL,'2013-02-17 15:28:22','PR1302-0010',1,NULL,NULL,'gfdf','2013-02-17 16:27:18','2013-02-17','2013-03-04 12:00:00','2013-02-17 16:27:29','2013-02-17 16:28:22',1,NULL,1,1,2,0,NULL,NULL,0,10.00000000,1.96000000,0.00000000,0.00000000,11.96000000,NULL,NULL,1,0,'','','azur',NULL,NULL,0,NULL,0,NULL,NULL),(12,23,NULL,'2013-03-08 09:02:31','PR1303-0011',1,NULL,NULL,'fdfs','2013-03-08 10:00:23','2013-03-08','2013-03-23 12:00:00','2013-03-08 10:02:21','2013-03-08 10:02:31',1,NULL,1,1,2,0,NULL,NULL,0,5.00000000,0.00000000,0.00000000,0.00000000,5.00000000,NULL,NULL,1,0,'','','azur',NULL,NULL,0,NULL,0,NULL,NULL); +/*!40000 ALTER TABLE `llx_propal` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_propal_extrafields` +-- + +DROP TABLE IF EXISTS `llx_propal_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_propal_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_propal_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_propal_extrafields` +-- + +LOCK TABLES `llx_propal_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_propal_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_propal_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_propaldet` +-- + +DROP TABLE IF EXISTS `llx_propaldet`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_propaldet` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_propal` int(11) DEFAULT NULL, + `fk_parent_line` int(11) DEFAULT NULL, + `fk_product` int(11) DEFAULT NULL, + `label` varchar(255) DEFAULT NULL, + `description` text, + `fk_remise_except` int(11) DEFAULT NULL, + `tva_tx` double(6,3) DEFAULT '0.000', + `localtax1_tx` double(6,3) DEFAULT '0.000', + `localtax1_type` varchar(10) NOT NULL DEFAULT '0', + `localtax2_tx` double(6,3) DEFAULT '0.000', + `localtax2_type` varchar(10) NOT NULL DEFAULT '0', + `qty` double DEFAULT NULL, + `remise_percent` double DEFAULT '0', + `remise` double DEFAULT '0', + `price` double DEFAULT NULL, + `subprice` double(24,8) DEFAULT '0.00000000', + `total_ht` double(24,8) DEFAULT '0.00000000', + `total_tva` double(24,8) DEFAULT '0.00000000', + `total_localtax1` double(24,8) DEFAULT '0.00000000', + `total_localtax2` double(24,8) DEFAULT '0.00000000', + `total_ttc` double(24,8) DEFAULT '0.00000000', + `product_type` int(11) DEFAULT '0', + `date_start` datetime DEFAULT NULL, + `date_end` datetime DEFAULT NULL, + `info_bits` int(11) DEFAULT '0', + `fk_product_fournisseur_price` int(11) DEFAULT NULL, + `buy_price_ht` double(24,8) DEFAULT '0.00000000', + `special_code` int(10) unsigned DEFAULT '0', + `rang` int(11) DEFAULT '0', + PRIMARY KEY (`rowid`), + KEY `idx_propaldet_fk_propal` (`fk_propal`), + KEY `idx_propaldet_fk_product` (`fk_product`), + CONSTRAINT `fk_propaldet_fk_propal` FOREIGN KEY (`fk_propal`) REFERENCES `llx_propal` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_propaldet` +-- + +LOCK TABLES `llx_propaldet` WRITE; +/*!40000 ALTER TABLE `llx_propaldet` DISABLE KEYS */; +INSERT INTO `llx_propaldet` VALUES (1,1,NULL,NULL,NULL,'Une machine à café',NULL,12.500,0.000,'',0.000,'',1,0,0,NULL,10.00000000,10.00000000,1.25000000,0.00000000,0.00000000,11.25000000,0,NULL,NULL,0,NULL,0.00000000,0,1),(2,2,NULL,NULL,NULL,'Product 1',NULL,0.000,0.000,'',0.000,'',1,0,0,NULL,10.00000000,10.00000000,0.00000000,0.00000000,0.00000000,10.00000000,0,NULL,NULL,0,NULL,0.00000000,0,1),(3,2,NULL,2,NULL,'',NULL,0.000,0.000,'',0.000,'',1,0,0,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,0,NULL,NULL,0,NULL,0.00000000,0,2),(4,3,NULL,NULL,NULL,'A new marvelous product',NULL,0.000,0.000,'',0.000,'',1,0,0,NULL,10.00000000,10.00000000,0.00000000,0.00000000,0.00000000,10.00000000,0,NULL,NULL,0,NULL,0.00000000,0,1),(5,1,NULL,5,NULL,'cccc',NULL,19.600,0.000,'',0.000,'',1,0,0,NULL,10.00000000,10.00000000,1.96000000,0.00000000,0.00000000,11.96000000,0,NULL,NULL,0,NULL,0.00000000,0,2),(11,1,NULL,4,NULL,'',NULL,0.000,0.000,'',0.000,'',1,0,0,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,0,NULL,NULL,0,NULL,0.00000000,0,3),(12,1,NULL,4,NULL,'',NULL,0.000,0.000,'',0.000,'',1,0,0,NULL,5.00000000,5.00000000,0.00000000,0.00000000,0.00000000,5.00000000,0,NULL,NULL,0,NULL,0.00000000,0,4),(13,1,NULL,4,NULL,'',NULL,12.500,0.000,'',0.000,'',1,0,0,NULL,5.00000000,5.00000000,0.63000000,0.00000000,0.00000000,5.63000000,0,NULL,NULL,0,NULL,0.00000000,0,5),(19,4,NULL,NULL,NULL,'bvbcvbcvbcbcbcb',NULL,19.600,0.000,'',0.000,'',1,0,0,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,0,NULL,NULL,0,NULL,0.00000000,0,1),(20,4,NULL,NULL,NULL,'ghjhgjghjgh',NULL,19.600,0.000,'',0.000,'',1,0,0,NULL,10.00000000,10.00000000,1.96000000,0.00000000,0.00000000,11.96000000,0,NULL,NULL,0,NULL,0.00000000,0,2),(21,4,NULL,NULL,NULL,'ghjghjhgjg',NULL,19.600,0.000,'',0.000,'',2,0,0,10,10.00000000,20.00000000,3.92000000,0.00000000,0.00000000,23.92000000,1,NULL,NULL,0,NULL,0.00000000,0,3),(22,9,NULL,NULL,NULL,'gdfg',NULL,19.600,0.000,'',0.000,'',1,0,0,NULL,10.00000000,10.00000000,1.96000000,0.00000000,0.00000000,11.96000000,0,NULL,NULL,0,0,0.00000000,0,1),(23,9,NULL,NULL,NULL,'gfdgd',NULL,19.600,0.000,'',0.000,'',1,0,0,NULL,50.00000000,50.00000000,9.80000000,0.00000000,0.00000000,59.80000000,1,NULL,NULL,0,0,0.00000000,0,2),(24,11,NULL,NULL,NULL,'gfdg',NULL,19.600,0.000,'',0.000,'',1,0,0,NULL,10.00000000,10.00000000,1.96000000,0.00000000,0.00000000,11.96000000,0,NULL,NULL,0,0,0.00000000,0,1),(25,12,NULL,NULL,NULL,'fdsfs',NULL,0.000,0.000,'',0.000,'',1,0,0,NULL,10.00000000,10.00000000,0.00000000,0.00000000,0.00000000,10.00000000,0,NULL,NULL,0,0,0.00000000,0,1),(26,12,NULL,NULL,NULL,'fsdfsf',NULL,0.000,0.000,'',0.000,'',1,0,0,NULL,-5.00000000,-5.00000000,0.00000000,0.00000000,0.00000000,-5.00000000,0,NULL,NULL,0,0,0.00000000,0,2); +/*!40000 ALTER TABLE `llx_propaldet` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_propaldet_extrafields` +-- + +DROP TABLE IF EXISTS `llx_propaldet_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_propaldet_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_propaldet_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_propaldet_extrafields` +-- + +LOCK TABLES `llx_propaldet_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_propaldet_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_propaldet_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_residence` +-- + +DROP TABLE IF EXISTS `llx_residence`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_residence` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) DEFAULT '1', + `ref` varchar(12) NOT NULL, + `label` varchar(30) NOT NULL, + `address` varchar(254) DEFAULT NULL, + `zip` varchar(12) DEFAULT NULL, + `town` varchar(36) DEFAULT NULL, + `fk_country_id` int(11) DEFAULT NULL, + `name_concierge` varchar(64) DEFAULT NULL, + `tel_concierge` varchar(32) DEFAULT NULL, + `hours_concierge` varchar(64) DEFAULT NULL, + `antenne` varchar(64) DEFAULT NULL, + `attestation` int(11) DEFAULT NULL, + `latitude` float DEFAULT NULL, + `longitude` float DEFAULT NULL, + `date_creation` datetime DEFAULT NULL, + `fk_user_creation` int(11) DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_user_modification` int(11) DEFAULT NULL, + `note_private` text, + `note_public` text, + `fk_thirdparty` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `idx_residence_ref` (`ref`), + KEY `idx_residence_label` (`label`), + KEY `idx_residence_zip` (`zip`), + KEY `idx_residence_town` (`town`), + KEY `fk_residence_thirdparty` (`fk_thirdparty`), + KEY `fk_country_id` (`fk_country_id`), + CONSTRAINT `fk_country_id` FOREIGN KEY (`fk_country_id`) REFERENCES `llx_c_country` (`rowid`), + CONSTRAINT `fk_residence_thirdparty` FOREIGN KEY (`fk_thirdparty`) REFERENCES `llx_societe` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_residence` +-- + +LOCK TABLES `llx_residence` WRITE; +/*!40000 ALTER TABLE `llx_residence` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_residence` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_residence_building` +-- + +DROP TABLE IF EXISTS `llx_residence_building`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_residence_building` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `ref` varchar(20) NOT NULL, + `label` varchar(30) NOT NULL, + `access_code` varchar(16) DEFAULT NULL, + `date_creation` datetime DEFAULT NULL, + `fk_user_creation` int(11) DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_user_modification` int(11) DEFAULT NULL, + `note_private` text, + `note_public` text, + `fk_residence` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_residence_building_fk_residence` (`fk_residence`), + CONSTRAINT `fk_residence_building_residence` FOREIGN KEY (`fk_residence`) REFERENCES `llx_residence` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_residence_building` +-- + +LOCK TABLES `llx_residence_building` WRITE; +/*!40000 ALTER TABLE `llx_residence_building` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_residence_building` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_residence_building_links` +-- + +DROP TABLE IF EXISTS `llx_residence_building_links`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_residence_building_links` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `residenceid` int(11) DEFAULT NULL, + `buildingid` int(11) DEFAULT NULL, + `parentid` int(11) DEFAULT NULL, + `parenttype` varchar(16) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_residence_building_1` (`parentid`,`parenttype`,`residenceid`), + UNIQUE KEY `uk_residence_building_2` (`parentid`,`parenttype`,`buildingid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_residence_building_links` +-- + +LOCK TABLES `llx_residence_building_links` WRITE; +/*!40000 ALTER TABLE `llx_residence_building_links` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_residence_building_links` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_resource` +-- + +DROP TABLE IF EXISTS `llx_resource`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_resource` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `ref` varchar(255) DEFAULT NULL, + `description` text, + `fk_code_type_resource` varchar(32) DEFAULT NULL, + `note_public` text, + `note_private` text, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`rowid`), + KEY `fk_code_type_resource_idx` (`fk_code_type_resource`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_resource` +-- + +LOCK TABLES `llx_resource` WRITE; +/*!40000 ALTER TABLE `llx_resource` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_resource` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_rights_def` +-- + +DROP TABLE IF EXISTS `llx_rights_def`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_rights_def` ( + `id` int(11) NOT NULL DEFAULT '0', + `libelle` varchar(255) DEFAULT NULL, + `module` varchar(64) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `perms` varchar(50) DEFAULT NULL, + `subperms` varchar(50) DEFAULT NULL, + `type` varchar(1) DEFAULT NULL, + `bydefault` tinyint(4) DEFAULT '0', + PRIMARY KEY (`id`,`entity`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_rights_def` +-- + +LOCK TABLES `llx_rights_def` WRITE; +/*!40000 ALTER TABLE `llx_rights_def` DISABLE KEYS */; +INSERT INTO `llx_rights_def` VALUES (11,'Lire les factures','facture',1,'lire',NULL,'a',1),(11,'Lire les factures','facture',2,'lire',NULL,'a',1),(12,'Creer/modifier les factures','facture',1,'creer',NULL,'a',0),(12,'Creer/modifier les factures','facture',2,'creer',NULL,'a',0),(13,'Dévalider les factures','facture',1,'invoice_advance','unvalidate','a',0),(13,'Dévalider les factures','facture',2,'invoice_advance','unvalidate','a',0),(14,'Valider les factures','facture',1,'valider',NULL,'a',0),(14,'Valider les factures','facture',2,'valider',NULL,'a',0),(15,'Envoyer les factures par mail','facture',1,'invoice_advance','send','a',0),(15,'Envoyer les factures par mail','facture',2,'invoice_advance','send','a',0),(16,'Emettre des paiements sur les factures','facture',1,'paiement',NULL,'a',0),(16,'Emettre des paiements sur les factures','facture',2,'paiement',NULL,'a',0),(19,'Supprimer les factures','facture',1,'supprimer',NULL,'a',0),(19,'Supprimer les factures','facture',2,'supprimer',NULL,'a',0),(21,'Lire les propositions commerciales','propale',1,'lire',NULL,'r',1),(21,'Lire les propositions commerciales','propale',2,'lire',NULL,'r',1),(22,'Creer/modifier les propositions commerciales','propale',1,'creer',NULL,'w',0),(22,'Creer/modifier les propositions commerciales','propale',2,'creer',NULL,'w',0),(24,'Valider les propositions commerciales','propale',1,'valider',NULL,'d',0),(24,'Valider les propositions commerciales','propale',2,'valider',NULL,'d',0),(25,'Envoyer les propositions commerciales aux clients','propale',1,'propal_advance','send','d',0),(25,'Envoyer les propositions commerciales aux clients','propale',2,'propal_advance','send','d',0),(26,'Cloturer les propositions commerciales','propale',1,'cloturer',NULL,'d',0),(26,'Cloturer les propositions commerciales','propale',2,'cloturer',NULL,'d',0),(27,'Supprimer les propositions commerciales','propale',1,'supprimer',NULL,'d',0),(27,'Supprimer les propositions commerciales','propale',2,'supprimer',NULL,'d',0),(28,'Exporter les propositions commerciales et attributs','propale',1,'export',NULL,'r',0),(28,'Exporter les propositions commerciales et attributs','propale',2,'export',NULL,'r',0),(31,'Lire les produits','produit',1,'lire',NULL,'r',1),(31,'Lire les produits','produit',2,'lire',NULL,'r',1),(32,'Creer/modifier les produits','produit',1,'creer',NULL,'w',0),(32,'Creer/modifier les produits','produit',2,'creer',NULL,'w',0),(34,'Supprimer les produits','produit',1,'supprimer',NULL,'d',0),(34,'Supprimer les produits','produit',2,'supprimer',NULL,'d',0),(38,'Exporter les produits','produit',1,'export',NULL,'r',0),(38,'Exporter les produits','produit',2,'export',NULL,'r',0),(41,'Lire les projets et taches (partagés ou dont je suis contact)','projet',1,'lire',NULL,'r',1),(42,'Creer/modifier les projets et taches (partagés ou dont je suis contact)','projet',1,'creer',NULL,'w',0),(44,'Supprimer les projets et taches (partagés ou dont je suis contact)','projet',1,'supprimer',NULL,'d',0),(45,'Exporter les projets','projet',1,'export',NULL,'d',0),(61,'Lire les fiches d\'intervention','ficheinter',1,'lire',NULL,'r',1),(62,'Creer/modifier les fiches d\'intervention','ficheinter',1,'creer',NULL,'w',0),(64,'Supprimer les fiches d\'intervention','ficheinter',1,'supprimer',NULL,'d',0),(67,'Exporter les fiches interventions','ficheinter',1,'export',NULL,'r',0),(68,'Envoyer les fiches d\'intervention par courriel','ficheinter',1,'ficheinter_advance','send','r',0),(71,'Read members\' card','adherent',1,'lire',NULL,'r',1),(72,'Create/modify members (need also user module permissions if member linked to a user)','adherent',1,'creer',NULL,'w',1),(74,'Remove members','adherent',1,'supprimer',NULL,'d',1),(75,'Setup types and attributes of members','adherent',1,'configurer',NULL,'w',1),(76,'Export members','adherent',1,'export',NULL,'r',0),(78,'Read subscriptions','adherent',1,'cotisation','lire','r',1),(79,'Create/modify/remove subscriptions','adherent',1,'cotisation','creer','w',1),(81,'Lire les commandes clients','commande',1,'lire',NULL,'r',1),(82,'Creer/modifier les commandes clients','commande',1,'creer',NULL,'w',0),(84,'Valider les commandes clients','commande',1,'valider',NULL,'d',0),(86,'Envoyer les commandes clients','commande',1,'order_advance','send','d',0),(87,'Cloturer les commandes clients','commande',1,'cloturer',NULL,'d',0),(88,'Annuler les commandes clients','commande',1,'annuler',NULL,'d',0),(89,'Supprimer les commandes clients','commande',1,'supprimer',NULL,'d',0),(91,'Lire les charges','tax',1,'charges','lire','r',1),(91,'Lire les charges','tax',2,'charges','lire','r',1),(92,'Creer/modifier les charges','tax',1,'charges','creer','w',0),(92,'Creer/modifier les charges','tax',2,'charges','creer','w',0),(93,'Supprimer les charges','tax',1,'charges','supprimer','d',0),(93,'Supprimer les charges','tax',2,'charges','supprimer','d',0),(94,'Exporter les charges','tax',1,'charges','export','r',0),(94,'Exporter les charges','tax',2,'charges','export','r',0),(95,'Lire CA, bilans, resultats','compta',1,'resultat','lire','r',1),(96,'Parametrer la ventilation','compta',1,'ventilation','parametrer','r',0),(97,'Lire les ventilations de factures','compta',1,'ventilation','lire','r',1),(98,'Ventiler les lignes de factures','compta',1,'ventilation','creer','r',0),(101,'Lire les expeditions','expedition',1,'lire',NULL,'r',1),(102,'Creer modifier les expeditions','expedition',1,'creer',NULL,'w',0),(104,'Valider les expeditions','expedition',1,'valider',NULL,'d',0),(105,'Envoyer les expeditions aux clients','expedition',1,'shipping_advance','send','d',0),(106,'Exporter les expeditions','expedition',1,'shipment','export','r',0),(109,'Supprimer les expeditions','expedition',1,'supprimer',NULL,'d',0),(111,'Lire les comptes bancaires','banque',1,'lire',NULL,'r',1),(111,'Lire les comptes bancaires','banque',2,'lire',NULL,'r',1),(112,'Creer/modifier montant/supprimer ecriture bancaire','banque',1,'modifier',NULL,'w',0),(112,'Creer/modifier montant/supprimer ecriture bancaire','banque',2,'modifier',NULL,'w',0),(113,'Configurer les comptes bancaires (creer, gerer categories)','banque',1,'configurer',NULL,'a',0),(113,'Configurer les comptes bancaires (creer, gerer categories)','banque',2,'configurer',NULL,'a',0),(114,'Rapprocher les ecritures bancaires','banque',1,'consolidate',NULL,'w',0),(114,'Rapprocher les ecritures bancaires','banque',2,'consolidate',NULL,'w',0),(115,'Exporter transactions et releves','banque',1,'export',NULL,'r',0),(115,'Exporter transactions et releves','banque',2,'export',NULL,'r',0),(116,'Virements entre comptes','banque',1,'transfer',NULL,'w',0),(116,'Virements entre comptes','banque',2,'transfer',NULL,'w',0),(117,'Gerer les envois de cheques','banque',1,'cheque',NULL,'w',0),(117,'Gerer les envois de cheques','banque',2,'cheque',NULL,'w',0),(121,'Lire les societes','societe',1,'lire',NULL,'r',1),(121,'Lire les societes','societe',2,'lire',NULL,'r',1),(122,'Creer modifier les societes','societe',1,'creer',NULL,'w',0),(122,'Creer modifier les societes','societe',2,'creer',NULL,'w',0),(125,'Supprimer les societes','societe',1,'supprimer',NULL,'d',0),(125,'Supprimer les societes','societe',2,'supprimer',NULL,'d',0),(126,'Exporter les societes','societe',1,'export',NULL,'r',0),(126,'Exporter les societes','societe',2,'export',NULL,'r',0),(141,'Lire tous les projets et taches (y compris prives qui ne me sont pas affectes)','projet',1,'all','lire','r',0),(142,'Creer/modifier tous les projets et taches (y compris prives qui ne me sont pas affectes)','projet',1,'all','creer','w',0),(144,'Supprimer tous les projets et taches (y compris prives qui ne me sont pas affectes)','projet',1,'all','supprimer','d',0),(151,'Read withdrawals','prelevement',1,'bons','lire','r',1),(152,'Create/modify a withdrawals','prelevement',1,'bons','creer','w',0),(153,'Send withdrawals to bank','prelevement',1,'bons','send','a',0),(154,'credit/refuse withdrawals','prelevement',1,'bons','credit','a',0),(161,'Lire les contrats','contrat',1,'lire',NULL,'r',1),(162,'Creer / modifier les contrats','contrat',1,'creer',NULL,'w',0),(163,'Activer un service d\'un contrat','contrat',1,'activer',NULL,'w',0),(164,'Desactiver un service d\'un contrat','contrat',1,'desactiver',NULL,'w',0),(165,'Supprimer un contrat','contrat',1,'supprimer',NULL,'d',0),(171,'Lire ses notes de frais et deplacements et celles de sa hierarchy','deplacement',1,'lire',NULL,'r',1),(172,'Creer/modifier une note de frais et deplacements','deplacement',1,'creer',NULL,'w',0),(174,'Lire toutes les notes de frais','deplacement',1,'readall',NULL,'d',0),(178,'Exporter les notes de frais et deplacements','deplacement',1,'export',NULL,'d',0),(221,'Consulter les mailings','mailing',1,'lire',NULL,'r',1),(221,'Consulter les mailings','mailing',2,'lire',NULL,'r',1),(222,'Creer/modifier les mailings (sujet, destinataires...)','mailing',1,'creer',NULL,'w',1),(222,'Creer/modifier les mailings (sujet, destinataires...)','mailing',2,'creer',NULL,'w',0),(223,'Valider les mailings (permet leur envoi)','mailing',1,'valider',NULL,'w',0),(223,'Valider les mailings (permet leur envoi)','mailing',2,'valider',NULL,'w',0),(229,'Supprimer les mailings)','mailing',1,'supprimer',NULL,'d',1),(229,'Supprimer les mailings','mailing',2,'supprimer',NULL,'d',0),(237,'View recipients and info','mailing',1,'mailing_advance','recipient','r',0),(237,'View recipients and info','mailing',2,'mailing_advance','recipient','r',0),(238,'Manually send mailings','mailing',1,'mailing_advance','send','w',0),(238,'Manually send mailings','mailing',2,'mailing_advance','send','w',0),(239,'Delete mailings after validation and/or sent','mailing',1,'mailing_advance','delete','d',0),(239,'Delete mailings after validation and/or sent','mailing',2,'mailing_advance','delete','d',0),(241,'Lire les categories','categorie',1,'lire',NULL,'r',1),(242,'Creer/modifier les categories','categorie',1,'creer',NULL,'w',1),(243,'Supprimer les categories','categorie',1,'supprimer',NULL,'d',1),(251,'Consulter les autres utilisateurs','user',1,'user','lire','r',0),(252,'Consulter les permissions des autres utilisateurs','user',1,'user_advance','readperms','r',0),(253,'Creer/modifier utilisateurs internes et externes','user',1,'user','creer','w',0),(254,'Creer/modifier utilisateurs externes seulement','user',1,'user_advance','write','w',0),(255,'Modifier le mot de passe des autres utilisateurs','user',1,'user','password','w',0),(256,'Supprimer ou desactiver les autres utilisateurs','user',1,'user','supprimer','d',0),(262,'Consulter tous les tiers par utilisateurs internes (sinon uniquement si contact commercial). Non effectif pour utilisateurs externes (tjs limités à eux-meme).','societe',1,'client','voir','r',1),(262,'Consulter tous les tiers par utilisateurs internes (sinon uniquement si contact commercial). Non effectif pour utilisateurs externes (tjs limités à eux-meme).','societe',2,'client','voir','r',1),(281,'Lire les contacts','societe',1,'contact','lire','r',1),(281,'Lire les contacts','societe',2,'contact','lire','r',1),(282,'Creer modifier les contacts','societe',1,'contact','creer','w',0),(282,'Creer modifier les contacts','societe',2,'contact','creer','w',0),(283,'Supprimer les contacts','societe',1,'contact','supprimer','d',0),(283,'Supprimer les contacts','societe',2,'contact','supprimer','d',0),(286,'Exporter les contacts','societe',1,'contact','export','d',0),(286,'Exporter les contacts','societe',2,'contact','export','d',0),(300,'Lire les codes barres','barcode',1,'lire',NULL,'r',1),(301,'Creer/modifier les codes barres','barcode',1,'creer',NULL,'w',0),(302,'Supprimer les codes barres','barcode',1,'supprimer',NULL,'d',0),(331,'Lire les bookmarks','bookmark',1,'lire',NULL,'r',1),(332,'Creer/modifier les bookmarks','bookmark',1,'creer',NULL,'r',0),(333,'Supprimer les bookmarks','bookmark',1,'supprimer',NULL,'r',0),(341,'Consulter ses propres permissions','user',1,'self_advance','readperms','r',1),(342,'Creer/modifier ses propres infos utilisateur','user',1,'self','creer','w',1),(343,'Modifier son propre mot de passe','user',1,'self','password','w',1),(344,'Modifier ses propres permissions','user',1,'self_advance','writeperms','w',1),(351,'Consulter les groupes','user',1,'group_advance','read','r',0),(352,'Consulter les permissions des groupes','user',1,'group_advance','readperms','r',0),(353,'Creer/modifier les groupes et leurs permissions','user',1,'group_advance','write','w',0),(354,'Supprimer ou desactiver les groupes','user',1,'group_advance','delete','d',0),(358,'Exporter les utilisateurs','user',1,'user','export','r',0),(531,'Lire les services','service',1,'lire',NULL,'r',1),(532,'Creer/modifier les services','service',1,'creer',NULL,'w',0),(534,'Supprimer les services','service',1,'supprimer',NULL,'d',0),(538,'Exporter les services','service',1,'export',NULL,'r',0),(700,'Lire les dons','don',1,'lire',NULL,'r',1),(701,'Creer/modifier les dons','don',1,'creer',NULL,'w',0),(701,'Lire les dons','don',2,'lire',NULL,'r',1),(702,'Supprimer les dons','don',1,'supprimer',NULL,'d',0),(702,'Creer/modifier les dons','don',2,'creer',NULL,'w',0),(703,'Supprimer les dons','don',1,'supprimer',NULL,'d',0),(703,'Supprimer les dons','don',2,'supprimer',NULL,'d',0),(1001,'Lire les stocks','stock',1,'lire',NULL,'r',1),(1002,'Creer/Modifier les stocks','stock',1,'creer',NULL,'w',1),(1003,'Supprimer les stocks','stock',1,'supprimer',NULL,'d',1),(1004,'Lire mouvements de stocks','stock',1,'mouvement','lire','r',1),(1005,'Creer/modifier mouvements de stocks','stock',1,'mouvement','creer','w',1),(1101,'Lire les bons de livraison','expedition',1,'livraison','lire','r',1),(1102,'Creer modifier les bons de livraison','expedition',1,'livraison','creer','w',0),(1104,'Valider les bons de livraison','expedition',1,'livraison','valider','d',0),(1109,'Supprimer les bons de livraison','expedition',1,'livraison','supprimer','d',0),(1181,'Consulter les fournisseurs','fournisseur',1,'lire',NULL,'r',1),(1182,'Consulter les commandes fournisseur','fournisseur',1,'commande','lire','r',1),(1183,'Creer une commande fournisseur','fournisseur',1,'commande','creer','w',0),(1184,'Valider une commande fournisseur','fournisseur',1,'commande','valider','w',0),(1185,'Approuver une commande fournisseur','fournisseur',1,'commande','approuver','w',0),(1186,'Commander une commande fournisseur','fournisseur',1,'commande','commander','w',0),(1187,'Receptionner une commande fournisseur','fournisseur',1,'commande','receptionner','d',0),(1188,'Supprimer une commande fournisseur','fournisseur',1,'commande','supprimer','d',0),(1201,'Lire les exports','export',1,'lire',NULL,'r',1),(1202,'Creer/modifier un export','export',1,'creer',NULL,'w',1),(1231,'Consulter les factures fournisseur','fournisseur',1,'facture','lire','r',1),(1232,'Creer une facture fournisseur','fournisseur',1,'facture','creer','w',0),(1233,'Valider une facture fournisseur','fournisseur',1,'facture','valider','w',0),(1234,'Supprimer une facture fournisseur','fournisseur',1,'facture','supprimer','d',0),(1235,'Envoyer les factures par mail','fournisseur',1,'supplier_invoice_advance','send','a',0),(1236,'Exporter les factures fournisseurs, attributs et reglements','fournisseur',1,'facture','export','r',0),(1237,'Exporter les commande fournisseurs, attributs','fournisseur',1,'commande','export','r',0),(1251,'Run mass imports of external data (data load)','import',1,'run',NULL,'r',0),(1321,'Exporter les factures clients, attributs et reglements','facture',1,'facture','export','r',0),(1321,'Exporter les factures clients, attributs et reglements','facture',2,'facture','export','r',0),(1421,'Exporter les commandes clients et attributs','commande',1,'commande','export','r',0),(2401,'Read actions/tasks linked to his account','agenda',1,'myactions','read','r',1),(2401,'Read actions/tasks linked to his account','agenda',2,'myactions','read','r',1),(2402,'Create/modify actions/tasks linked to his account','agenda',1,'myactions','create','w',0),(2402,'Create/modify actions/tasks linked to his account','agenda',2,'myactions','create','w',0),(2403,'Delete actions/tasks linked to his account','agenda',1,'myactions','delete','w',0),(2403,'Delete actions/tasks linked to his account','agenda',2,'myactions','delete','w',0),(2411,'Read actions/tasks of others','agenda',1,'allactions','read','r',0),(2411,'Read actions/tasks of others','agenda',2,'allactions','read','r',0),(2412,'Create/modify actions/tasks of others','agenda',1,'allactions','create','w',0),(2412,'Create/modify actions/tasks of others','agenda',2,'allactions','create','w',0),(2413,'Delete actions/tasks of others','agenda',1,'allactions','delete','w',0),(2413,'Delete actions/tasks of others','agenda',2,'allactions','delete','w',0),(2414,'Export actions/tasks of others','agenda',1,'export',NULL,'w',0),(2501,'Consulter/Télécharger les documents','ecm',1,'read',NULL,'r',1),(2503,'Soumettre ou supprimer des documents','ecm',1,'upload',NULL,'w',1),(2515,'Administrer les rubriques de documents','ecm',1,'setup',NULL,'w',1),(20001,'Créer / Modifier / Lire ses demandes de congés payés','holiday',1,'write',NULL,'w',1),(20001,'Créer / Modifier / Lire ses demandes de congés payés','holiday',2,'write',NULL,'w',1),(20002,'Lire / Modifier toutes les demandes de congés payés','holiday',1,'lire_tous',NULL,'w',0),(20002,'Lire / Modifier toutes les demandes de congés payés','holiday',2,'lire_tous',NULL,'w',0),(20003,'Supprimer des demandes de congés payés','holiday',1,'delete',NULL,'w',0),(20003,'Supprimer des demandes de congés payés','holiday',2,'delete',NULL,'w',0),(20004,'Définir les congés payés des utilisateurs','holiday',1,'define_holiday',NULL,'w',0),(20004,'Définir les congés payés des utilisateurs','holiday',2,'define_holiday',NULL,'w',0),(20005,'Voir les logs de modification des congés payés','holiday',1,'view_log',NULL,'w',0),(20005,'Voir les logs de modification des congés payés','holiday',2,'view_log',NULL,'w',0),(20006,'Accéder au rapport mensuel des congés payés','holiday',1,'month_report',NULL,'w',0),(20006,'Accéder au rapport mensuel des congés payés','holiday',2,'month_report',NULL,'w',0),(23001,'Read cron jobs','cron',1,'read',NULL,'w',1),(23002,'Create cron Jobs','cron',1,'create',NULL,'w',0),(23003,'Delete cron Jobs','cron',1,'delete',NULL,'w',0),(23004,'Execute cron Jobs','cron',1,'execute',NULL,'w',0),(50101,'Use point of sale','cashdesk',1,'use',NULL,'a',1),(55001,'Read surveys','opensurvey',1,'read',NULL,'r',0),(55002,'Create/modify surveys','opensurvey',1,'write',NULL,'w',0),(101250,'Read surveys','opensurvey',2,'survey','read','r',0),(101251,'Create/modify surveys','opensurvey',2,'survey','write','w',0),(400051,'Use POS','pos',2,'frontend',NULL,'a',1),(400052,'Use Backend','pos',2,'backend',NULL,'a',1),(400053,'Make Transfers','pos',2,'transfer',NULL,'a',1),(400055,'Stats','pos',2,'stats',NULL,'a',1); +/*!40000 ALTER TABLE `llx_rights_def` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_societe` +-- + +DROP TABLE IF EXISTS `llx_societe`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_societe` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `statut` tinyint(4) DEFAULT '0', + `parent` int(11) DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datec` datetime DEFAULT NULL, + `nom` varchar(128) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `ref_ext` varchar(128) DEFAULT NULL, + `ref_int` varchar(60) DEFAULT NULL, + `code_client` varchar(24) DEFAULT NULL, + `code_fournisseur` varchar(24) DEFAULT NULL, + `code_compta` varchar(24) DEFAULT NULL, + `code_compta_fournisseur` varchar(24) DEFAULT NULL, + `address` varchar(255) DEFAULT NULL, + `zip` varchar(25) DEFAULT NULL, + `town` varchar(50) DEFAULT NULL, + `fk_departement` int(11) DEFAULT '0', + `fk_pays` int(11) DEFAULT '0', + `phone` varchar(20) DEFAULT NULL, + `fax` varchar(20) DEFAULT NULL, + `url` varchar(255) DEFAULT NULL, + `email` varchar(128) DEFAULT NULL, + `skype` varchar(255) DEFAULT NULL, + `fk_effectif` int(11) DEFAULT '0', + `fk_typent` int(11) DEFAULT '0', + `fk_forme_juridique` int(11) DEFAULT '0', + `fk_currency` varchar(3) DEFAULT NULL, + `siren` varchar(128) DEFAULT NULL, + `siret` varchar(128) DEFAULT NULL, + `ape` varchar(128) DEFAULT NULL, + `idprof4` varchar(128) DEFAULT NULL, + `tva_intra` varchar(20) DEFAULT NULL, + `capital` double DEFAULT NULL, + `fk_stcomm` int(11) NOT NULL, + `note_private` text, + `note_public` text, + `prefix_comm` varchar(5) DEFAULT NULL, + `client` tinyint(4) DEFAULT '0', + `fournisseur` tinyint(4) DEFAULT '0', + `supplier_account` varchar(32) DEFAULT NULL, + `fk_prospectlevel` varchar(12) DEFAULT NULL, + `customer_bad` tinyint(4) DEFAULT '0', + `customer_rate` double DEFAULT '0', + `supplier_rate` double DEFAULT '0', + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `remise_client` double DEFAULT '0', + `mode_reglement` tinyint(4) DEFAULT NULL, + `cond_reglement` tinyint(4) DEFAULT NULL, + `mode_reglement_supplier` int(11) DEFAULT NULL, + `outstanding_limit` double(24,8) DEFAULT NULL, + `cond_reglement_supplier` int(11) DEFAULT NULL, + `tva_assuj` tinyint(4) DEFAULT '1', + `localtax1_assuj` tinyint(4) DEFAULT '0', + `localtax1_value` double(6,3) DEFAULT NULL, + `localtax2_assuj` tinyint(4) DEFAULT '0', + `localtax2_value` double(6,3) DEFAULT NULL, + `barcode` varchar(255) DEFAULT NULL, + `price_level` int(11) DEFAULT NULL, + `default_lang` varchar(6) DEFAULT NULL, + `canvas` varchar(32) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + `status` tinyint(4) DEFAULT '1', + `logo` varchar(255) DEFAULT NULL, + `idprof5` varchar(128) DEFAULT NULL, + `idprof6` varchar(128) DEFAULT NULL, + `fk_barcode_type` int(11) DEFAULT '0', + `webservices_url` varchar(255) DEFAULT NULL, + `webservices_key` varchar(128) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_societe_prefix_comm` (`prefix_comm`,`entity`), + UNIQUE KEY `uk_societe_code_client` (`code_client`,`entity`), + UNIQUE KEY `uk_societe_barcode` (`barcode`,`fk_barcode_type`,`entity`), + KEY `idx_societe_user_creat` (`fk_user_creat`), + KEY `idx_societe_user_modif` (`fk_user_modif`), + KEY `idx_societe_barcode` (`barcode`) +) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_societe` +-- + +LOCK TABLES `llx_societe` WRITE; +/*!40000 ALTER TABLE `llx_societe` DISABLE KEYS */; +INSERT INTO `llx_societe` VALUES (1,0,NULL,'2012-12-19 14:47:50','2010-07-08 14:21:44','ABC and Co',1,NULL,NULL,'CU1212-0007','SU1212-0005','7050','6050','1 alalah road',NULL,'Delhi',0,4,NULL,NULL,NULL,NULL,NULL,NULL,4,NULL,'0','','','','','',5000,1,NULL,NULL,NULL,1,1,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,1,1,NULL,0,NULL,NULL,NULL,'en_IN',NULL,NULL,1,NULL,'','',0,NULL,NULL),(2,0,NULL,'2011-07-31 22:35:08','2010-07-08 14:23:48','Belin SARL',1,NULL,NULL,'CU1108-0001','SU1108-0001',NULL,NULL,'11 rue de la paix.','75000','Paris',0,117,NULL,NULL,'dolibarr.fr',NULL,NULL,NULL,3,NULL,'0','123456789','','ACE14','','',10000,0,NULL,NULL,NULL,3,1,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,'fr_FR',NULL,NULL,1,NULL,NULL,NULL,0,NULL,NULL),(3,0,NULL,'2010-07-08 20:42:12','2010-07-08 22:42:12','Spanish Comp',1,NULL,NULL,'SPANISHCOMP',NULL,NULL,NULL,'1 via mallere',NULL,'Madrid',123,4,NULL,NULL,NULL,NULL,NULL,3,4,408,'0','','','','','',10000,0,NULL,NULL,NULL,3,1,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,'es_AR',NULL,NULL,1,NULL,NULL,NULL,0,NULL,NULL),(4,0,NULL,'2013-03-03 23:09:48','2010-07-08 22:48:18','Prospector Vaalen',1,NULL,NULL,'CU1303-0014',NULL,NULL,NULL,'',NULL,'Bruxelles',103,2,NULL,NULL,NULL,NULL,NULL,3,4,201,'0','12345678','','','','',0,0,NULL,NULL,NULL,3,0,NULL,'PL_LOW',0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,1,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,'','',0,NULL,NULL),(5,0,NULL,'2010-07-08 21:37:56','2010-07-08 23:22:57','NoCountry Co',1,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL,0,193,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,'0','','','','','',0,0,NULL,NULL,NULL,0,0,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,0,NULL,NULL),(6,0,NULL,'2010-07-08 22:25:06','2010-07-09 00:15:09','Swiss customer supplier',1,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,'Genevia',0,6,NULL,NULL,NULL,'abademail@aa.com',NULL,2,2,601,'0','','','','','',56000,0,NULL,NULL,NULL,3,1,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,0,NULL,NULL),(7,0,NULL,'2013-02-12 16:06:20','2010-07-09 01:24:26','Generic customer',1,NULL,NULL,'CU1302-0011',NULL,NULL,NULL,'',NULL,NULL,0,7,NULL,NULL,NULL,'ttt@ttt.com',NULL,NULL,8,NULL,'0','','','','','',0,0,'Generic customer to use for Point Of Sale module.
',NULL,NULL,1,0,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,'','',0,NULL,NULL),(8,0,NULL,'2010-07-10 12:54:27','2010-07-10 14:54:27','Client salon',1,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL,0,1,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,'0','','','','','',0,0,NULL,NULL,NULL,0,0,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,0,NULL,NULL),(9,0,NULL,'2010-07-10 12:55:11','2010-07-10 14:54:44','Client salon invidivdu',1,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL,0,1,NULL,NULL,NULL,NULL,NULL,NULL,8,NULL,'0','','','','','',0,0,NULL,NULL,NULL,3,1,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,0,NULL,NULL),(10,0,NULL,'2012-12-08 16:38:30','2010-07-10 15:13:08','Smith Vick',1,NULL,NULL,'CU1212-0005',NULL,NULL,NULL,'',NULL,NULL,0,102,NULL,NULL,NULL,'vsmith@email.com',NULL,NULL,0,NULL,'0','','','','','',0,0,NULL,NULL,NULL,1,0,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,'','',0,NULL,NULL),(11,0,NULL,'2010-07-11 12:35:22','2010-07-10 18:35:57','Mon client',1,NULL,NULL,NULL,NULL,'7051',NULL,'',NULL,NULL,0,1,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,'0','','','','','',0,0,NULL,NULL,NULL,3,0,NULL,'PL_LOW',0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,0,NULL,NULL),(12,0,NULL,'2013-02-20 19:07:21','2010-07-11 16:18:08','Dupont Alain',1,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL,0,1,NULL,NULL,NULL,'toto@aa.com',NULL,NULL,0,NULL,'0','','','','','',0,0,NULL,NULL,NULL,1,0,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,'','',0,NULL,NULL),(13,0,NULL,'2010-07-11 15:13:20','2010-07-11 17:13:20','Vendeur de chips',1,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL,0,1,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,'0','','','','','',0,0,NULL,NULL,NULL,0,1,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,0,NULL,NULL),(15,0,NULL,'2011-08-01 00:31:24','2011-08-01 02:31:24','mmm',1,NULL,NULL,'CU1108-0002','SU1108-0002',NULL,NULL,'','78180','mmm',0,31,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,'0','','','','','',0,0,NULL,NULL,NULL,3,1,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,0,NULL,NULL),(16,0,NULL,'2011-08-01 00:42:21','2011-08-01 02:31:43','ppp',1,NULL,NULL,'CU1108-0003','SU1108-0003',NULL,NULL,'','78180','mmm',103,2,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,'0','','','','','',0,0,NULL,NULL,NULL,3,1,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,0,NULL,NULL),(17,0,NULL,'2011-08-04 21:24:24','2011-08-01 02:41:26','FFF SARL',1,NULL,NULL,'CU1108-0004','SU1108-0004',NULL,NULL,'The French Company',NULL,NULL,0,1,NULL,NULL,NULL,NULL,NULL,1,3,NULL,'0','','','','','',0,0,NULL,NULL,NULL,3,1,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,0,NULL,NULL),(18,0,NULL,'2013-01-12 13:38:32','2012-12-09 20:14:42','doe john',1,NULL,NULL,'CU1212-0006',NULL,NULL,NULL,'',NULL,NULL,0,1,'111','2222',NULL,'johndoe@email.com',NULL,NULL,101,NULL,'0','','','','','',0,0,NULL,NULL,NULL,1,0,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,1,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,'','',0,NULL,NULL),(19,0,NULL,'2014-03-02 19:09:52','2013-01-12 12:23:05','Magic Food Store',1,NULL,NULL,'CU1301-0008',NULL,NULL,NULL,'65 holdywood boulevard','123456','BigTown',0,4,NULL,'0101',NULL,'myemail@domain.com',NULL,NULL,0,NULL,'0','','','10/10/2010','','',0,0,NULL,NULL,NULL,1,0,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'en_US','patient@cabinetmed',NULL,1,NULL,'','',0,NULL,NULL),(20,0,NULL,'2013-01-12 11:52:20','2013-01-12 12:52:20','pppoo',1,NULL,NULL,'CU1301-0009',NULL,NULL,NULL,'pppoo',NULL,NULL,0,4,NULL,NULL,NULL,NULL,NULL,NULL,101,NULL,'0','','','','','',0,0,NULL,NULL,NULL,1,0,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'en_US','patient@cabinetmed',NULL,1,NULL,'','',0,NULL,NULL),(21,0,NULL,'2013-01-23 15:56:58','2013-01-23 16:56:58','pa',1,NULL,NULL,'CU1301-0010',NULL,NULL,NULL,'',NULL,NULL,0,81,NULL,NULL,NULL,NULL,NULL,NULL,101,NULL,'0','','','','','',0,0,NULL,NULL,NULL,1,0,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'en_US','patient@cabinetmed',NULL,1,NULL,'','',0,NULL,NULL),(22,0,NULL,'2013-02-26 21:57:58','2013-02-26 22:57:50','pppp',1,NULL,NULL,'CU1302-0012',NULL,NULL,NULL,'',NULL,NULL,0,1,NULL,NULL,NULL,NULL,NULL,NULL,101,NULL,'0','','','','','',0,0,NULL,NULL,NULL,1,0,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'fr_FR','patient@cabinetmed',NULL,1,NULL,'','',0,NULL,NULL),(23,0,NULL,'2013-02-26 21:58:13','2013-02-26 22:58:13','ttttt',1,NULL,NULL,'CU1302-0013','SU1302-0006',NULL,NULL,'',NULL,NULL,0,1,NULL,NULL,NULL,NULL,NULL,NULL,101,NULL,'0','','','','','',0,0,NULL,NULL,NULL,1,1,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,'fr_FR',NULL,NULL,1,NULL,'','',0,NULL,NULL),(24,0,NULL,'2013-03-09 15:33:39','2013-03-06 17:13:59','smith smith',1,NULL,NULL,'CU1303-0015',NULL,'411E123',NULL,'',NULL,NULL,0,11,NULL,NULL,NULL,'smith@email.com',NULL,NULL,0,NULL,'0','','','','','',0,0,NULL,NULL,NULL,1,0,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,'','',0,NULL,NULL),(25,0,NULL,'2013-03-10 14:47:37','2013-03-10 15:47:37','jlmkjlkj',1,NULL,NULL,'CU1303-0016','SU1303-0007',NULL,NULL,'',NULL,NULL,0,117,NULL,NULL,NULL,NULL,NULL,NULL,101,NULL,'0','','','','','',0,0,NULL,NULL,NULL,1,1,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,'en_US',NULL,NULL,1,NULL,'','',0,NULL,NULL),(26,0,NULL,'2013-03-10 14:57:32','2013-03-10 15:57:32','iiii',1,NULL,NULL,'CU1303-0017','SU1303-0008',NULL,NULL,'',NULL,NULL,290,117,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,'0','','','','','',0,0,NULL,NULL,NULL,1,1,NULL,NULL,0,0,0,1,1,0,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,'en_US',NULL,NULL,1,NULL,'','',0,NULL,NULL); +/*!40000 ALTER TABLE `llx_societe` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_societe_address` +-- + +DROP TABLE IF EXISTS `llx_societe_address`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_societe_address` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `label` varchar(30) DEFAULT NULL, + `fk_soc` int(11) DEFAULT '0', + `name` varchar(60) DEFAULT NULL, + `address` varchar(255) DEFAULT NULL, + `zip` varchar(10) DEFAULT NULL, + `town` varchar(50) DEFAULT NULL, + `fk_pays` int(11) DEFAULT '0', + `phone` varchar(20) DEFAULT NULL, + `fax` varchar(20) DEFAULT NULL, + `note` text, + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_societe_address` +-- + +LOCK TABLES `llx_societe_address` WRITE; +/*!40000 ALTER TABLE `llx_societe_address` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_societe_address` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_societe_commerciaux` +-- + +DROP TABLE IF EXISTS `llx_societe_commerciaux`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_societe_commerciaux` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_soc` int(11) DEFAULT NULL, + `fk_user` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_societe_commerciaux` (`fk_soc`,`fk_user`) +) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_societe_commerciaux` +-- + +LOCK TABLES `llx_societe_commerciaux` WRITE; +/*!40000 ALTER TABLE `llx_societe_commerciaux` DISABLE KEYS */; +INSERT INTO `llx_societe_commerciaux` VALUES (1,2,2),(2,3,2),(3,15,1),(4,16,1),(5,17,1),(6,19,1),(8,19,3),(7,20,1),(9,21,1),(10,23,1),(11,25,1),(12,26,1); +/*!40000 ALTER TABLE `llx_societe_commerciaux` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_societe_extrafields` +-- + +DROP TABLE IF EXISTS `llx_societe_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_societe_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `jjjj` varchar(255) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_societe_extrafields` (`fk_object`) +) ENGINE=InnoDB AUTO_INCREMENT=50 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_societe_extrafields` +-- + +LOCK TABLES `llx_societe_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_societe_extrafields` DISABLE KEYS */; +INSERT INTO `llx_societe_extrafields` VALUES (1,'2011-06-22 16:23:01',40,'kkkk',NULL),(2,'2011-06-22 16:23:16',41,'jjj',NULL),(4,'2011-06-23 07:40:40',39,'lll',NULL),(12,'2011-06-29 13:03:12',42,NULL,NULL),(14,'2011-07-02 01:24:03',57,NULL,NULL),(16,'2011-07-02 14:11:29',60,NULL,NULL),(17,'2011-07-18 10:26:55',35,NULL,NULL),(18,'2011-07-31 22:35:08',2,NULL,NULL),(19,'2011-08-01 00:31:24',15,NULL,NULL),(22,'2011-08-01 00:42:21',16,NULL,NULL),(27,'2011-08-04 21:24:24',17,NULL,NULL),(28,'2012-12-08 16:38:30',10,NULL,NULL),(30,'2012-12-19 14:47:50',1,NULL,NULL),(31,'2013-01-12 13:38:32',18,NULL,NULL),(33,'2013-02-12 16:06:20',7,NULL,NULL),(34,'2013-02-20 19:07:21',12,'jjj',NULL),(36,'2013-02-26 21:57:58',22,'jjj',NULL),(37,'2013-02-26 21:58:13',23,NULL,NULL),(44,'2013-03-03 23:08:04',4,'jjj',NULL),(45,'2013-03-09 15:33:39',24,'jjj',NULL),(46,'2013-03-10 14:47:37',25,NULL,NULL),(47,'2013-03-10 14:57:32',26,NULL,NULL),(49,'2014-03-02 19:09:52',19,'jjj',NULL); +/*!40000 ALTER TABLE `llx_societe_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_societe_log` +-- + +DROP TABLE IF EXISTS `llx_societe_log`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_societe_log` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `datel` datetime DEFAULT NULL, + `fk_soc` int(11) DEFAULT NULL, + `fk_statut` int(11) DEFAULT NULL, + `fk_user` int(11) DEFAULT NULL, + `author` varchar(30) DEFAULT NULL, + `label` varchar(128) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_societe_log` +-- + +LOCK TABLES `llx_societe_log` WRITE; +/*!40000 ALTER TABLE `llx_societe_log` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_societe_log` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_societe_prices` +-- + +DROP TABLE IF EXISTS `llx_societe_prices`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_societe_prices` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_soc` int(11) DEFAULT '0', + `tms` timestamp NULL DEFAULT NULL, + `datec` datetime DEFAULT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `price_level` tinyint(4) DEFAULT '1', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_societe_prices` +-- + +LOCK TABLES `llx_societe_prices` WRITE; +/*!40000 ALTER TABLE `llx_societe_prices` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_societe_prices` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_societe_remise` +-- + +DROP TABLE IF EXISTS `llx_societe_remise`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_societe_remise` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_soc` int(11) NOT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datec` datetime DEFAULT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `remise_client` double(6,3) NOT NULL DEFAULT '0.000', + `note` text, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_societe_remise` +-- + +LOCK TABLES `llx_societe_remise` WRITE; +/*!40000 ALTER TABLE `llx_societe_remise` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_societe_remise` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_societe_remise_except` +-- + +DROP TABLE IF EXISTS `llx_societe_remise_except`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_societe_remise_except` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_soc` int(11) NOT NULL, + `datec` datetime DEFAULT NULL, + `amount_ht` double(24,8) NOT NULL, + `amount_tva` double(24,8) NOT NULL DEFAULT '0.00000000', + `amount_ttc` double(24,8) NOT NULL DEFAULT '0.00000000', + `tva_tx` double(6,3) NOT NULL DEFAULT '0.000', + `fk_user` int(11) NOT NULL, + `fk_facture_line` int(11) DEFAULT NULL, + `fk_facture` int(11) DEFAULT NULL, + `fk_facture_source` int(11) DEFAULT NULL, + `description` varchar(255) NOT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_societe_remise_except_fk_user` (`fk_user`), + KEY `idx_societe_remise_except_fk_soc` (`fk_soc`), + KEY `idx_societe_remise_except_fk_facture_line` (`fk_facture_line`), + KEY `idx_societe_remise_except_fk_facture` (`fk_facture`), + KEY `idx_societe_remise_except_fk_facture_source` (`fk_facture_source`), + CONSTRAINT `fk_societe_remise_fk_facture` FOREIGN KEY (`fk_facture`) REFERENCES `llx_facture` (`rowid`), + CONSTRAINT `fk_societe_remise_fk_facture_line` FOREIGN KEY (`fk_facture_line`) REFERENCES `llx_facturedet` (`rowid`), + CONSTRAINT `fk_societe_remise_fk_facture_source` FOREIGN KEY (`fk_facture_source`) REFERENCES `llx_facture` (`rowid`), + CONSTRAINT `fk_societe_remise_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`), + CONSTRAINT `fk_societe_remise_fk_user` FOREIGN KEY (`fk_user`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_societe_remise_except` +-- + +LOCK TABLES `llx_societe_remise_except` WRITE; +/*!40000 ALTER TABLE `llx_societe_remise_except` DISABLE KEYS */; +INSERT INTO `llx_societe_remise_except` VALUES (1,23,'2013-03-08 10:02:54',5.00000000,0.00000000,5.00000000,0.000,1,775,NULL,NULL,'fsdfsf'),(2,19,'2013-03-19 09:36:15',10.00000000,1.25000000,11.25000000,12.500,1,1019,NULL,NULL,'hfghgf'); +/*!40000 ALTER TABLE `llx_societe_remise_except` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_societe_rib` +-- + +DROP TABLE IF EXISTS `llx_societe_rib`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_societe_rib` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_soc` int(11) NOT NULL, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `label` varchar(30) DEFAULT NULL, + `bank` varchar(255) DEFAULT NULL, + `code_banque` varchar(7) DEFAULT NULL, + `code_guichet` varchar(6) DEFAULT NULL, + `number` varchar(255) DEFAULT NULL, + `cle_rib` varchar(5) DEFAULT NULL, + `bic` varchar(20) DEFAULT NULL, + `iban_prefix` varchar(34) DEFAULT NULL, + `domiciliation` varchar(255) DEFAULT NULL, + `proprio` varchar(60) DEFAULT NULL, + `owner_address` text, + `default_rib` tinyint(4) NOT NULL DEFAULT '0', + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_societe_rib` +-- + +LOCK TABLES `llx_societe_rib` WRITE; +/*!40000 ALTER TABLE `llx_societe_rib` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_societe_rib` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_socpeople` +-- + +DROP TABLE IF EXISTS `llx_socpeople`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_socpeople` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_soc` int(11) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `ref_ext` varchar(128) DEFAULT NULL, + `civility` varchar(6) DEFAULT NULL, + `lastname` varchar(50) DEFAULT NULL, + `firstname` varchar(50) DEFAULT NULL, + `address` varchar(255) DEFAULT NULL, + `zip` varchar(10) DEFAULT NULL, + `town` text, + `fk_departement` int(11) DEFAULT NULL, + `fk_pays` int(11) DEFAULT '0', + `birthday` date DEFAULT NULL, + `poste` varchar(80) DEFAULT NULL, + `phone` varchar(30) DEFAULT NULL, + `phone_perso` varchar(30) DEFAULT NULL, + `phone_mobile` varchar(30) DEFAULT NULL, + `fax` varchar(30) DEFAULT NULL, + `email` varchar(255) DEFAULT NULL, + `jabberid` varchar(255) DEFAULT NULL, + `skype` varchar(255) DEFAULT NULL, + `priv` smallint(6) NOT NULL DEFAULT '0', + `no_email` smallint(6) NOT NULL DEFAULT '0', + `fk_user_creat` int(11) DEFAULT '0', + `fk_user_modif` int(11) DEFAULT NULL, + `note_private` text, + `note_public` text, + `default_lang` varchar(6) DEFAULT NULL, + `canvas` varchar(32) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + `statut` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`), + KEY `idx_socpeople_fk_soc` (`fk_soc`), + KEY `idx_socpeople_fk_user_creat` (`fk_user_creat`), + CONSTRAINT `fk_socpeople_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`), + CONSTRAINT `fk_socpeople_user_creat_user_rowid` FOREIGN KEY (`fk_user_creat`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_socpeople` +-- + +LOCK TABLES `llx_socpeople` WRITE; +/*!40000 ALTER TABLE `llx_socpeople` DISABLE KEYS */; +INSERT INTO `llx_socpeople` VALUES (1,'2010-07-08 14:26:14','2010-07-08 20:45:28',1,1,NULL,'MR','Samira','Aljoun','','','',297,117,'2010-07-08','Project leader','','','','','','',NULL,0,0,1,1,'Met during a congress at Dubai',NULL,NULL,NULL,NULL,1),(2,'2010-07-08 22:44:50','2010-07-08 20:59:57',NULL,1,NULL,'MR','Freeman','Public','','','',200,11,NULL,'','','','','','','',NULL,0,0,1,1,'A friend that is a free contact not linked to any company',NULL,NULL,NULL,NULL,1),(3,'2010-07-08 22:59:02','2010-07-08 20:59:35',NULL,1,NULL,'MR','Freeman','Private','','','',NULL,11,NULL,'','','','','','','',NULL,1,0,1,1,'This is a private contact',NULL,NULL,NULL,NULL,1),(4,'2010-07-09 00:16:58','2010-07-08 22:16:58',6,1,NULL,'MR','Rotchield','Evan','','','',NULL,6,NULL,'Bank director','','','','','','',NULL,0,0,1,1,'The bank director',NULL,NULL,NULL,NULL,1),(5,'2010-07-10 14:54:44','2010-07-10 12:54:44',9,1,NULL,'','Client salon invidivdu','','','','',NULL,NULL,NULL,'','','','','','','',NULL,0,0,1,1,'',NULL,NULL,NULL,NULL,1),(6,'2011-08-01 02:41:26','2011-08-01 00:41:26',17,1,NULL,'','aaa','','aaa','','',289,117,NULL,'','','','','','','',NULL,0,0,1,1,'',NULL,NULL,NULL,NULL,1),(7,'2013-02-12 17:05:57','2013-03-08 01:45:08',7,1,NULL,'','aaa','','','','',289,117,NULL,'','','','','','aaa@aaa.com','',NULL,0,0,1,1,'',NULL,NULL,NULL,NULL,1),(8,'2013-03-08 02:45:31','2013-03-08 01:45:31',7,1,NULL,'','kkkk','','','','',290,117,NULL,'','','','','','ttt@ttt.com','',NULL,0,0,1,1,'',NULL,NULL,NULL,NULL,1),(10,'2013-03-08 02:48:23','2013-03-08 01:48:23',7,1,NULL,'','fff','','','','',290,117,NULL,'','','','','','ttt@ttt.com','',NULL,0,0,1,1,'',NULL,NULL,NULL,NULL,1),(11,'2013-03-08 02:48:54','2013-03-08 01:48:54',7,1,NULL,'','iii','','','','',294,117,NULL,'','','','','','ttt@ttt.com','',NULL,0,0,1,1,'',NULL,NULL,NULL,NULL,1); +/*!40000 ALTER TABLE `llx_socpeople` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_socpeople_extrafields` +-- + +DROP TABLE IF EXISTS `llx_socpeople_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_socpeople_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_socpeople_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_socpeople_extrafields` +-- + +LOCK TABLES `llx_socpeople_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_socpeople_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_socpeople_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_stock_mouvement` +-- + +DROP TABLE IF EXISTS `llx_stock_mouvement`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_stock_mouvement` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datem` datetime DEFAULT NULL, + `fk_product` int(11) NOT NULL, + `fk_entrepot` int(11) NOT NULL, + `value` double DEFAULT NULL, + `price` float(13,4) DEFAULT '0.0000', + `type_mouvement` smallint(6) DEFAULT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `label` varchar(128) DEFAULT NULL, + `fk_origin` int(11) DEFAULT NULL, + `origintype` varchar(32) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_stock_mouvement_fk_product` (`fk_product`), + KEY `idx_stock_mouvement_fk_entrepot` (`fk_entrepot`) +) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_stock_mouvement` +-- + +LOCK TABLES `llx_stock_mouvement` WRITE; +/*!40000 ALTER TABLE `llx_stock_mouvement` DISABLE KEYS */; +INSERT INTO `llx_stock_mouvement` VALUES (1,'2010-07-08 22:43:51','2010-07-09 00:43:51',2,2,1000,0.0000,0,1,'Correct stock',NULL,NULL),(3,'2010-07-10 22:56:18','2010-07-11 00:56:18',4,2,500,0.0000,0,1,'Init',NULL,NULL),(4,'2010-07-10 23:02:20','2010-07-11 01:02:20',4,2,500,0.0000,0,1,'',NULL,NULL),(5,'2010-07-11 16:49:44','2010-07-11 18:49:44',4,1,2,10.0000,3,1,'',NULL,NULL),(6,'2010-07-11 16:49:44','2010-07-11 18:49:44',1,1,4,0.0000,3,1,'',NULL,NULL),(7,'2013-01-19 17:22:48','2013-01-19 18:22:48',11,1,-1,0.0000,2,1,'Facture créée dans DoliPOS',NULL,NULL),(8,'2013-01-19 17:22:48','2013-01-19 18:22:48',4,1,-1,5.0000,2,1,'Facture créée dans DoliPOS',NULL,NULL),(9,'2013-01-19 17:22:48','2013-01-19 18:22:48',1,1,-2,0.0000,2,1,'Facture créée dans DoliPOS',NULL,NULL),(10,'2013-01-19 17:31:10','2013-01-19 18:31:10',2,1,-1,0.0000,2,1,'Facture créée dans DoliPOS',NULL,NULL),(11,'2013-01-19 17:31:58','2013-01-19 18:31:58',2,1,-1,0.0000,2,1,'Facture créée dans DoliPOS',NULL,NULL); +/*!40000 ALTER TABLE `llx_stock_mouvement` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_tva` +-- + +DROP TABLE IF EXISTS `llx_tva`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_tva` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datep` date DEFAULT NULL, + `datev` date DEFAULT NULL, + `amount` double NOT NULL DEFAULT '0', + `label` varchar(255) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `note` text, + `fk_bank` int(11) DEFAULT NULL, + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `fk_typepayment` int(11) DEFAULT NULL, + `num_payment` varchar(50) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_tva` +-- + +LOCK TABLES `llx_tva` WRITE; +/*!40000 ALTER TABLE `llx_tva` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_tva` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_update_modules` +-- + +DROP TABLE IF EXISTS `llx_update_modules`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_update_modules` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `modulekey` varchar(24) DEFAULT NULL, + `datekey` date DEFAULT NULL, + `versionkey` double DEFAULT NULL, + `lastrequestdate` datetime DEFAULT NULL, + `email` varchar(128) DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_update_modules` +-- + +LOCK TABLES `llx_update_modules` WRITE; +/*!40000 ALTER TABLE `llx_update_modules` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_update_modules` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_user` +-- + +DROP TABLE IF EXISTS `llx_user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_user` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `login` varchar(24) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `civility` varchar(6) DEFAULT NULL, + `ref_ext` varchar(50) DEFAULT NULL, + `ref_int` varchar(50) DEFAULT NULL, + `pass` varchar(32) DEFAULT NULL, + `pass_crypted` varchar(128) DEFAULT NULL, + `pass_temp` varchar(32) DEFAULT NULL, + `lastname` varchar(50) DEFAULT NULL, + `firstname` varchar(50) DEFAULT NULL, + `job` varchar(128) DEFAULT NULL, + `skype` varchar(255) DEFAULT NULL, + `office_phone` varchar(20) DEFAULT NULL, + `office_fax` varchar(20) DEFAULT NULL, + `user_mobile` varchar(20) DEFAULT NULL, + `email` varchar(255) DEFAULT NULL, + `signature` text, + `admin` smallint(6) DEFAULT '0', + `webcal_login` varchar(25) DEFAULT NULL, + `phenix_login` varchar(25) DEFAULT NULL, + `phenix_pass` varchar(128) DEFAULT NULL, + `module_comm` smallint(6) DEFAULT '1', + `module_compta` smallint(6) DEFAULT '1', + `fk_societe` int(11) DEFAULT NULL, + `fk_socpeople` int(11) DEFAULT NULL, + `fk_member` int(11) DEFAULT NULL, + `note` text, + `datelastlogin` datetime DEFAULT NULL, + `datepreviouslogin` datetime DEFAULT NULL, + `egroupware_id` int(11) DEFAULT NULL, + `ldap_sid` varchar(255) DEFAULT NULL, + `statut` tinyint(4) DEFAULT '1', + `photo` varchar(255) DEFAULT NULL, + `lang` varchar(6) DEFAULT NULL, + `openid` varchar(255) DEFAULT NULL, + `fk_user` int(11) DEFAULT NULL, + `thm` double(24,8) DEFAULT NULL, + `address` varchar(255) DEFAULT NULL, + `zip` varchar(25) DEFAULT NULL, + `town` varchar(50) DEFAULT NULL, + `fk_state` int(11) DEFAULT '0', + `fk_country` int(11) DEFAULT '0', + `color` varchar(6) DEFAULT NULL, + `accountancy_code` varchar(32) DEFAULT NULL, + `barcode` varchar(255) DEFAULT NULL, + `fk_barcode_type` int(11) DEFAULT '0', + `nb_holiday` int(11) DEFAULT '0', + `salary` double(24,8) DEFAULT NULL, + `tjm` double(24,8) DEFAULT NULL, + `salaryextra` double(24,8) DEFAULT NULL, + `weeklyhours` double(16,8) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_user_login` (`login`,`entity`), + UNIQUE KEY `uk_user_fk_socpeople` (`fk_socpeople`), + UNIQUE KEY `uk_user_fk_member` (`fk_member`), + KEY `uk_user_fk_societe` (`fk_societe`) +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_user` +-- + +LOCK TABLES `llx_user` WRITE; +/*!40000 ALTER TABLE `llx_user` DISABLE KEYS */; +INSERT INTO `llx_user` VALUES (1,'2010-07-08 13:20:11','2012-12-12 16:54:10',NULL,NULL,'admin',0,NULL,NULL,NULL,'admin','21232f297a57a5a743894a0e4a801fc3',NULL,'SuperAdminName','Firstname','',NULL,'','','','bidon@destailleur.fr','',1,'','','',1,1,NULL,NULL,NULL,'','2014-12-21 20:52:09','2014-12-21 13:51:38',NULL,'',1,'01.jpg',NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(2,'2010-07-08 13:54:48','2010-07-08 09:54:48',NULL,NULL,'demo',1,NULL,NULL,NULL,'demo','fe01ce2a7fbac8fafaed7c982a04e229',NULL,'John','Doe',NULL,NULL,'09123123','','','johndoe@mycompany.com',NULL,0,'','','',1,1,NULL,NULL,NULL,'','2013-03-24 16:30:29','2010-07-08 14:12:02',NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(3,'2010-07-11 16:18:59','2013-02-20 18:07:21',NULL,NULL,'adupont',1,NULL,NULL,NULL,'adupont','00856ab2bbb748aa29aa335a6e3a2407',NULL,'Dupont','Alain','',NULL,'','','','toto@aa.com','',0,'','','',1,1,NULL,NULL,2,'','2012-12-21 17:38:55',NULL,NULL,'',1,NULL,NULL,NULL,2,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(4,'2013-01-23 17:52:27','2013-02-20 18:48:01',NULL,NULL,'aaa',1,NULL,NULL,NULL,'aaa','47bce5c74f589f4867dbd57e9ca9f808',NULL,'aaa','','',NULL,'','','','','',0,'','','',1,1,17,6,NULL,'','2013-02-25 10:18:41','2013-01-23 17:53:20',NULL,'',1,NULL,NULL,NULL,5,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(5,'2013-01-23 17:52:37','2013-01-23 15:52:37',NULL,NULL,'bbb',0,NULL,NULL,NULL,'bbb','08f8e0260c64418510cefb2b06eee5cd',NULL,'bbb','','',NULL,'','','','','',1,'','','',1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(6,'2013-02-16 20:22:40','2013-02-16 18:22:40',NULL,NULL,'aaab',2,NULL,NULL,NULL,'aaab','4c189b020ceb022e0ecc42482802e2b8',NULL,'aaab','','',NULL,'','','','','',0,'','','',1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(7,'2013-02-16 20:48:15','2013-02-16 18:48:15',NULL,NULL,'zzz',2,NULL,NULL,NULL,'zzz','f3abb86bd34cf4d52698f14c0da1dc60',NULL,'zzz','','',NULL,'','','','','',0,'','','',1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL),(9,'2013-02-16 20:50:07','2013-03-24 15:10:14',NULL,NULL,'zzzg',2,NULL,NULL,NULL,'jc28fg4h','93d789524fd223cf05eecea3f59cbe86',NULL,'zzzg','','',NULL,'','','','','fsdkkfsdf
\r\nfsdfsd
\r\nfsdfs',0,'','','',1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,5,NULL,'','','',NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL); +/*!40000 ALTER TABLE `llx_user` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_user_alert` +-- + +DROP TABLE IF EXISTS `llx_user_alert`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_user_alert` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `type` int(11) DEFAULT NULL, + `fk_contact` int(11) DEFAULT NULL, + `fk_user` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_user_alert` +-- + +LOCK TABLES `llx_user_alert` WRITE; +/*!40000 ALTER TABLE `llx_user_alert` DISABLE KEYS */; +INSERT INTO `llx_user_alert` VALUES (1,1,1,1); +/*!40000 ALTER TABLE `llx_user_alert` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_user_clicktodial` +-- + +DROP TABLE IF EXISTS `llx_user_clicktodial`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_user_clicktodial` ( + `fk_user` int(11) NOT NULL, + `url` varchar(255) DEFAULT NULL, + `login` varchar(32) DEFAULT NULL, + `pass` varchar(64) DEFAULT NULL, + `poste` varchar(20) DEFAULT NULL, + PRIMARY KEY (`fk_user`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_user_clicktodial` +-- + +LOCK TABLES `llx_user_clicktodial` WRITE; +/*!40000 ALTER TABLE `llx_user_clicktodial` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_user_clicktodial` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_user_extrafields` +-- + +DROP TABLE IF EXISTS `llx_user_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_user_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_user_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_user_extrafields` +-- + +LOCK TABLES `llx_user_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_user_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_user_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_user_param` +-- + +DROP TABLE IF EXISTS `llx_user_param`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_user_param` ( + `fk_user` int(11) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `param` varchar(64) NOT NULL, + `value` varchar(255) NOT NULL, + UNIQUE KEY `uk_user_param` (`fk_user`,`param`,`entity`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_user_param` +-- + +LOCK TABLES `llx_user_param` WRITE; +/*!40000 ALTER TABLE `llx_user_param` DISABLE KEYS */; +INSERT INTO `llx_user_param` VALUES (1,1,'MAIN_BOXES_0','1'),(1,1,'MAIN_THEME','eldy'),(1,3,'THEME_ELDY_ENABLE_PERSONALIZED','1'),(1,1,'THEME_ELDY_RGB','ded0ed'),(1,3,'THEME_ELDY_RGB','d0ddc3'); +/*!40000 ALTER TABLE `llx_user_param` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_user_rights` +-- + +DROP TABLE IF EXISTS `llx_user_rights`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_user_rights` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_user` int(11) NOT NULL, + `fk_id` int(11) NOT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_user_rights` (`fk_user`,`fk_id`), + CONSTRAINT `fk_user_rights_fk_user_user` FOREIGN KEY (`fk_user`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=11900 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_user_rights` +-- + +LOCK TABLES `llx_user_rights` WRITE; +/*!40000 ALTER TABLE `llx_user_rights` DISABLE KEYS */; +INSERT INTO `llx_user_rights` VALUES (11746,1,11),(11722,1,12),(11727,1,13),(11732,1,14),(11737,1,15),(11742,1,16),(11748,1,19),(9726,1,21),(9700,1,22),(9706,1,24),(9711,1,25),(9716,1,26),(9722,1,27),(9728,1,28),(9978,1,31),(9968,1,32),(9974,1,34),(1910,1,36),(9980,1,38),(11573,1,41),(11574,1,42),(11575,1,44),(11576,1,45),(7184,1,61),(7181,1,62),(7183,1,64),(7185,1,67),(7186,1,68),(1678,1,71),(1673,1,72),(1675,1,74),(1679,1,75),(1677,1,76),(1681,1,78),(1682,1,79),(11710,1,81),(11693,1,82),(11697,1,84),(11700,1,86),(11703,1,87),(11707,1,88),(11711,1,89),(11580,1,91),(11581,1,92),(11582,1,93),(11583,1,94),(10097,1,95),(10099,1,96),(10103,1,97),(10104,1,98),(7139,1,101),(7134,1,102),(7136,1,104),(7137,1,105),(7138,1,106),(7140,1,109),(10229,1,111),(10201,1,112),(10207,1,113),(10213,1,114),(10219,1,115),(10225,1,116),(10231,1,117),(11644,1,121),(11634,1,122),(11640,1,125),(11646,1,126),(11577,1,141),(11578,1,142),(11579,1,144),(2307,1,151),(2304,1,152),(2306,1,153),(2308,1,154),(10092,1,161),(10093,1,162),(10094,1,163),(10095,1,164),(10096,1,165),(1585,1,170),(11862,1,171),(11855,1,172),(11538,1,173),(11859,1,174),(11863,1,178),(10000,1,221),(9990,1,222),(9996,1,223),(10002,1,229),(10007,1,237),(10011,1,238),(10015,1,239),(1686,1,241),(1685,1,242),(1687,1,243),(11848,1,251),(11810,1,252),(11813,1,253),(11816,1,254),(11819,1,255),(11823,1,256),(1617,1,258),(11651,1,262),(11670,1,281),(11660,1,282),(11666,1,283),(11672,1,286),(11590,1,300),(11587,1,301),(11591,1,302),(1763,1,331),(1762,1,332),(1764,1,333),(11826,1,341),(11828,1,342),(11830,1,343),(11832,1,344),(11844,1,351),(11837,1,352),(11841,1,353),(11845,1,354),(11849,1,358),(11686,1,531),(11679,1,532),(11683,1,534),(1625,1,536),(11687,1,538),(11878,1,700),(11868,1,701),(11874,1,702),(11880,1,703),(1755,1,1001),(1754,1,1002),(1756,1,1003),(1758,1,1004),(1759,1,1005),(7146,1,1101),(7143,1,1102),(7145,1,1104),(7147,1,1109),(11756,1,1181),(11804,1,1182),(11761,1,1183),(11765,1,1184),(11769,1,1185),(11773,1,1186),(11777,1,1187),(11781,1,1188),(1578,1,1201),(1579,1,1202),(11800,1,1231),(11787,1,1232),(11791,1,1233),(11795,1,1234),(11798,1,1235),(11801,1,1236),(11805,1,1237),(1736,1,1251),(11753,1,1321),(11714,1,1421),(8190,1,1791),(8187,1,1792),(8191,1,1793),(11604,1,2401),(11600,1,2402),(11606,1,2403),(11620,1,2411),(11616,1,2412),(11622,1,2413),(11626,1,2414),(1618,1,2500),(11890,1,2501),(11887,1,2503),(11891,1,2515),(9610,1,5001),(9611,1,5002),(8155,1,20001),(8159,1,20002),(8163,1,20003),(8167,1,20004),(8171,1,20005),(8175,1,20006),(10345,1,23001),(10338,1,23002),(10342,1,23003),(10346,1,23004),(7701,1,50101),(4984,1,50401),(4983,1,50402),(4985,1,50403),(4987,1,50411),(4988,1,50412),(4989,1,50415),(11896,1,55001),(11897,1,55002),(3564,1,100700),(3565,1,100701),(9596,1,101051),(9598,1,101052),(9600,1,101053),(9604,1,101060),(9605,1,101061),(7177,1,101201),(7178,1,101202),(10353,1,101250),(10355,1,101251),(8980,1,101261),(8981,1,101262),(7616,1,101331),(10030,1,101701),(10031,1,101702),(3582,1,102000),(3583,1,102001),(9819,1,400051),(9823,1,400052),(9827,1,400053),(9831,1,400055),(132,2,11),(133,2,12),(134,2,13),(135,2,14),(136,2,16),(137,2,19),(138,2,21),(139,2,22),(140,2,24),(141,2,25),(142,2,26),(143,2,27),(10359,2,31),(145,2,32),(10361,2,34),(146,2,36),(147,2,41),(148,2,42),(149,2,44),(150,2,61),(151,2,62),(152,2,64),(153,2,71),(154,2,72),(155,2,74),(156,2,75),(157,2,78),(158,2,79),(159,2,81),(160,2,82),(161,2,84),(162,2,86),(163,2,87),(164,2,88),(165,2,89),(166,2,91),(167,2,92),(168,2,93),(2475,2,95),(2476,2,96),(2477,2,97),(2478,2,98),(169,2,101),(170,2,102),(171,2,104),(172,2,109),(173,2,111),(174,2,112),(175,2,113),(176,2,114),(177,2,116),(178,2,117),(179,2,121),(180,2,122),(181,2,125),(182,2,141),(183,2,142),(184,2,144),(2479,2,151),(2480,2,152),(2481,2,153),(2482,2,154),(185,2,161),(186,2,162),(187,2,163),(188,2,164),(189,2,165),(190,2,170),(2471,2,171),(192,2,172),(2472,2,173),(193,2,221),(194,2,222),(195,2,229),(196,2,241),(197,2,242),(198,2,243),(199,2,251),(201,2,262),(202,2,281),(203,2,282),(204,2,283),(205,2,331),(2483,2,531),(207,2,532),(2484,2,534),(208,2,536),(2473,2,700),(210,2,701),(211,2,702),(2474,2,703),(212,2,1001),(213,2,1002),(214,2,1003),(215,2,1004),(216,2,1005),(217,2,1101),(218,2,1102),(219,2,1104),(220,2,1109),(221,2,1181),(222,2,1182),(223,2,1183),(224,2,1184),(225,2,1185),(226,2,1186),(227,2,1187),(228,2,1188),(229,2,1201),(230,2,1202),(231,2,1231),(232,2,1232),(233,2,1233),(234,2,1234),(235,2,1421),(236,2,2401),(237,2,2402),(238,2,2403),(239,2,2411),(240,2,2412),(241,2,2413),(242,2,2500),(2470,2,2501),(243,2,2515),(10363,2,20001),(10364,2,20002),(10365,2,20003),(10366,2,20004),(10367,2,20005),(10368,2,20006),(10362,2,50101),(10372,2,101250),(1807,3,11),(1808,3,31),(1809,3,36),(1810,3,41),(1811,3,61),(1812,3,71),(1813,3,72),(1814,3,74),(1815,3,75),(1816,3,78),(1817,3,79),(1818,3,91),(1819,3,95),(1820,3,97),(1821,3,111),(1822,3,121),(1823,3,122),(1824,3,125),(1825,3,161),(1826,3,170),(1827,3,171),(1828,3,172),(1829,3,221),(1830,3,222),(1831,3,229),(1832,3,241),(1833,3,242),(1834,3,243),(1835,3,251),(1836,3,255),(1837,3,256),(1838,3,262),(1839,3,281),(1840,3,282),(1841,3,283),(1842,3,331),(1843,3,531),(1844,3,536),(1845,3,700),(1846,3,1001),(1847,3,1002),(1848,3,1003),(1849,3,1004),(1850,3,1005),(1851,3,1181),(1852,3,1182),(1853,3,1201),(1854,3,1202),(1855,3,1231),(1856,3,2401),(1857,3,2402),(1858,3,2403),(1859,3,2411),(1860,3,2412),(1861,3,2413),(1862,3,2500),(1863,3,2515),(8026,4,11),(8027,4,21),(8028,4,31),(8029,4,41),(8030,4,61),(8031,4,71),(8032,4,72),(8033,4,74),(8034,4,75),(8035,4,78),(8036,4,79),(8037,4,81),(8038,4,91),(8039,4,95),(8040,4,97),(8041,4,101),(8042,4,111),(8043,4,121),(8044,4,151),(8045,4,161),(8046,4,171),(8047,4,221),(8048,4,222),(8049,4,229),(8050,4,241),(8051,4,242),(8052,4,243),(8146,4,251),(8147,4,253),(8053,4,262),(8054,4,281),(8055,4,331),(8056,4,341),(8057,4,342),(8058,4,343),(8059,4,344),(8060,4,531),(8061,4,700),(8062,4,1001),(8063,4,1002),(8064,4,1003),(8065,4,1004),(8066,4,1005),(8067,4,1101),(8068,4,1181),(8069,4,1182),(8070,4,1201),(8071,4,1202),(8072,4,1231),(8073,4,2401),(8074,4,2501),(8075,4,2503),(8076,4,2515),(8077,4,20001),(8078,4,50101),(8079,4,101201),(8080,4,101261),(8081,4,102000),(8082,4,400051),(8083,4,400052),(8084,4,400053),(8085,4,400055),(11749,5,11),(11725,5,12),(11729,5,13),(11735,5,14),(11739,5,15),(11745,5,16),(11751,5,19),(9729,5,21),(9703,5,22),(9709,5,24),(9713,5,25),(9719,5,26),(9725,5,27),(9731,5,28),(9981,5,31),(9971,5,32),(9977,5,34),(9983,5,38),(8089,5,41),(8090,5,61),(8091,5,71),(8092,5,72),(8093,5,74),(8094,5,75),(8095,5,78),(8096,5,79),(11712,5,81),(11695,5,82),(11699,5,84),(11701,5,86),(11705,5,87),(11709,5,88),(11713,5,89),(9799,5,91),(9789,5,92),(9795,5,93),(9801,5,94),(10098,5,95),(10100,5,96),(10105,5,97),(10106,5,98),(8101,5,101),(10232,5,111),(10204,5,112),(10210,5,113),(10216,5,114),(10222,5,115),(10228,5,116),(10234,5,117),(11647,5,121),(11637,5,122),(11643,5,125),(11649,5,126),(8104,5,151),(8105,5,161),(11864,5,171),(11857,5,172),(11540,5,173),(11861,5,174),(11865,5,178),(10003,5,221),(9993,5,222),(9999,5,223),(10005,5,229),(10009,5,237),(10013,5,238),(10017,5,239),(8110,5,241),(8111,5,242),(8112,5,243),(11850,5,251),(11811,5,252),(11815,5,253),(11817,5,254),(11821,5,255),(11825,5,256),(11653,5,262),(11673,5,281),(11663,5,282),(11669,5,283),(11675,5,286),(11592,5,300),(11589,5,301),(11593,5,302),(8115,5,331),(11827,5,341),(11829,5,342),(11831,5,343),(11833,5,344),(11846,5,351),(11839,5,352),(11843,5,353),(11847,5,354),(11851,5,358),(11688,5,531),(11681,5,532),(11685,5,534),(11689,5,538),(11881,5,700),(11871,5,701),(11877,5,702),(11883,5,703),(8122,5,1001),(8123,5,1002),(8124,5,1003),(8125,5,1004),(8126,5,1005),(8127,5,1101),(11757,5,1181),(11806,5,1182),(11763,5,1183),(11767,5,1184),(11771,5,1185),(11775,5,1186),(11779,5,1187),(11783,5,1188),(8130,5,1201),(8131,5,1202),(11802,5,1231),(11789,5,1232),(11793,5,1233),(11797,5,1234),(11799,5,1235),(11803,5,1236),(11807,5,1237),(11755,5,1321),(11715,5,1421),(8192,5,1791),(8189,5,1792),(8193,5,1793),(11607,5,2401),(11603,5,2402),(11609,5,2403),(11623,5,2411),(11619,5,2412),(11625,5,2413),(11627,5,2414),(11892,5,2501),(11889,5,2503),(11893,5,2515),(9612,5,5001),(9613,5,5002),(8157,5,20001),(8161,5,20002),(8165,5,20003),(8169,5,20004),(8173,5,20005),(8177,5,20006),(10347,5,23001),(10340,5,23002),(10344,5,23003),(10348,5,23004),(8138,5,50101),(11898,5,55001),(11899,5,55002),(9597,5,101051),(9599,5,101052),(9601,5,101053),(9606,5,101060),(9607,5,101061),(8139,5,101201),(10356,5,101250),(10358,5,101251),(8982,5,101261),(8983,5,101262),(10032,5,101701),(10033,5,101702),(8141,5,102000),(9821,5,400051),(9825,5,400052),(9829,5,400053),(9833,5,400055),(8194,6,11),(8195,6,21),(8196,6,31),(8197,6,41),(8198,6,61),(8199,6,71),(8200,6,72),(8201,6,74),(8202,6,75),(8203,6,78),(8204,6,79),(8205,6,81),(8206,6,91),(8207,6,95),(8208,6,97),(8209,6,101),(8210,6,111),(8211,6,121),(8212,6,151),(8213,6,161),(8214,6,171),(8215,6,221),(8216,6,222),(8217,6,229),(8218,6,241),(8219,6,242),(8220,6,243),(8221,6,262),(8222,6,281),(8223,6,331),(8224,6,341),(8225,6,342),(8226,6,343),(8227,6,344),(8228,6,531),(8229,6,700),(8230,6,1001),(8231,6,1002),(8232,6,1003),(8233,6,1004),(8234,6,1005),(8235,6,1101),(8236,6,1181),(8237,6,1182),(8238,6,1201),(8239,6,1202),(8240,6,1231),(8241,6,1791),(8242,6,2401),(8243,6,2501),(8244,6,2503),(8245,6,2515),(8246,6,5001),(8247,6,20001),(8248,6,50101),(8249,6,101201),(8250,6,101261),(8251,6,102000),(8252,6,400051),(8253,6,400052),(8254,6,400053),(8255,6,400055),(8256,7,11),(8257,7,21),(8258,7,31),(8259,7,41),(8260,7,61),(8261,7,71),(8262,7,72),(8263,7,74),(8264,7,75),(8265,7,78),(8266,7,79),(8267,7,81),(8268,7,91),(8269,7,95),(8270,7,97),(8271,7,101),(8272,7,111),(8273,7,121),(8274,7,151),(8275,7,161),(8276,7,171),(8277,7,221),(8278,7,222),(8279,7,229),(8280,7,241),(8281,7,242),(8282,7,243),(8283,7,262),(8284,7,281),(8285,7,331),(8286,7,341),(8287,7,342),(8288,7,343),(8289,7,344),(8290,7,531),(8291,7,700),(8292,7,1001),(8293,7,1002),(8294,7,1003),(8295,7,1004),(8296,7,1005),(8297,7,1101),(8298,7,1181),(8299,7,1182),(8300,7,1201),(8301,7,1202),(8302,7,1231),(8303,7,1791),(8304,7,2401),(8305,7,2501),(8306,7,2503),(8307,7,2515),(8308,7,5001),(8309,7,20001),(8310,7,50101),(8311,7,101201),(8312,7,101261),(8313,7,102000),(8314,7,400051),(8315,7,400052),(8316,7,400053),(8317,7,400055),(8318,9,11),(8319,9,21),(8320,9,31),(8321,9,41),(8322,9,61),(8323,9,71),(8324,9,72),(8325,9,74),(8326,9,75),(8327,9,78),(8328,9,79),(8329,9,81),(8330,9,91),(8331,9,95),(8332,9,97),(8333,9,101),(8334,9,111),(8335,9,121),(8336,9,151),(8337,9,161),(8338,9,171),(8339,9,221),(8340,9,222),(8341,9,229),(8342,9,241),(8343,9,242),(8344,9,243),(8345,9,262),(8346,9,281),(8347,9,331),(8348,9,341),(8349,9,342),(8350,9,343),(8351,9,344),(8352,9,531),(8353,9,700),(8354,9,1001),(8355,9,1002),(8356,9,1003),(8357,9,1004),(8358,9,1005),(8359,9,1101),(8360,9,1181),(8361,9,1182),(8362,9,1201),(8363,9,1202),(8364,9,1231),(8365,9,1791),(8366,9,2401),(8367,9,2501),(8368,9,2503),(8369,9,2515),(8370,9,5001),(8371,9,20001),(8372,9,50101),(8373,9,101201),(8374,9,101261),(8375,9,102000),(8376,9,400051),(8377,9,400052),(8378,9,400053),(8379,9,400055); +/*!40000 ALTER TABLE `llx_user_rights` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_usergroup` +-- + +DROP TABLE IF EXISTS `llx_usergroup`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_usergroup` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `nom` varchar(255) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `note` text, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_usergroup_name` (`nom`,`entity`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_usergroup` +-- + +LOCK TABLES `llx_usergroup` WRITE; +/*!40000 ALTER TABLE `llx_usergroup` DISABLE KEYS */; +INSERT INTO `llx_usergroup` VALUES (1,'ggg',1,'2013-01-16 20:48:08','2013-01-16 19:48:08','ggg'); +/*!40000 ALTER TABLE `llx_usergroup` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_usergroup_extrafields` +-- + +DROP TABLE IF EXISTS `llx_usergroup_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_usergroup_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_usergroup_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_usergroup_extrafields` +-- + +LOCK TABLES `llx_usergroup_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_usergroup_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_usergroup_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_usergroup_rights` +-- + +DROP TABLE IF EXISTS `llx_usergroup_rights`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_usergroup_rights` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_usergroup` int(11) NOT NULL, + `fk_id` int(11) NOT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `fk_usergroup` (`fk_usergroup`,`fk_id`), + CONSTRAINT `fk_usergroup_rights_fk_usergroup` FOREIGN KEY (`fk_usergroup`) REFERENCES `llx_usergroup` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_usergroup_rights` +-- + +LOCK TABLES `llx_usergroup_rights` WRITE; +/*!40000 ALTER TABLE `llx_usergroup_rights` DISABLE KEYS */; +INSERT INTO `llx_usergroup_rights` VALUES (1,1,2401),(2,1,2402),(3,1,2403),(4,1,2411),(5,1,2412),(6,1,2413); +/*!40000 ALTER TABLE `llx_usergroup_rights` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_usergroup_user` +-- + +DROP TABLE IF EXISTS `llx_usergroup_user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_usergroup_user` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `fk_user` int(11) NOT NULL, + `fk_usergroup` int(11) NOT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_usergroup_user` (`entity`,`fk_user`,`fk_usergroup`), + KEY `fk_usergroup_user_fk_user` (`fk_user`), + KEY `fk_usergroup_user_fk_usergroup` (`fk_usergroup`), + CONSTRAINT `fk_usergroup_user_fk_user` FOREIGN KEY (`fk_user`) REFERENCES `llx_user` (`rowid`), + CONSTRAINT `fk_usergroup_user_fk_usergroup` FOREIGN KEY (`fk_usergroup`) REFERENCES `llx_usergroup` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_usergroup_user` +-- + +LOCK TABLES `llx_usergroup_user` WRITE; +/*!40000 ALTER TABLE `llx_usergroup_user` DISABLE KEYS */; +INSERT INTO `llx_usergroup_user` VALUES (1,1,1,1); +/*!40000 ALTER TABLE `llx_usergroup_user` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2014-12-21 21:06:14 diff --git a/dev/initdata/savedemo.sh b/dev/initdata/savedemo.sh index 5426a6e6391..c4de22c5e2f 100755 --- a/dev/initdata/savedemo.sh +++ b/dev/initdata/savedemo.sh @@ -193,13 +193,15 @@ export list=" --ignore-table=$base.llx_cabinetmed_societe --ignore-table=$base.llx_fournisseur_ca --ignore-table=$base.llx_google_maps + --ignore-table=$base.llx_notes --ignore-table=$base.llx_pos_paiement_ticket --ignore-table=$base.llx_pos_places --ignore-table=$base.llx_pos_ticket --ignore-table=$base.llx_publi_c_contact_list --ignore-table=$base.llx_publi_c_dnd_list --ignore-table=$base.llx_publi_c_method_list - --ignore-table=$base.llx_ultimatepdf + --ignore-table=$base.llx_ultimatepdf + --ignore-table=$base.llx_ventilation_achat " echo "mysqldump -P$port -u$admin -p***** $list $base > $mydir/$dumpfile" mysqldump -P$port -u$admin $passwd $list $base > $mydir/$dumpfile diff --git a/dev/initdata/sftpget_and_loaddump.php b/dev/initdata/sftpget_and_loaddump.php new file mode 100755 index 00000000000..c91ddcc3e17 --- /dev/null +++ b/dev/initdata/sftpget_and_loaddump.php @@ -0,0 +1,138 @@ +#!/usr/bin/php + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ + +$sapi_type = php_sapi_name(); +$script_file = basename(__FILE__); +$path=dirname(__FILE__).'/'; + +// Test if batch mode +if (substr($sapi_type, 0, 3) == 'cgi') { + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; + exit; +} + +// Global variables +$error=0; + +$sourceserver=isset($argv[1])?$argv[1]:''; // user@server:/src/file +$password=isset($argv[2])?$argv[2]:''; +$database=isset($argv[3])?$argv[3]:''; +$loginbase=isset($argv[4])?$argv[4]:''; +$passwordbase=isset($argv[5])?$argv[5]:''; + +// Include Dolibarr environment +$res=0; +if (! $res && file_exists($path."../../master.inc.php")) $res=@include($path."../../master.inc.php"); +if (! $res && file_exists($path."../../htdocs/master.inc.php")) $res=@include($path."../../htdocs/master.inc.php"); +if (! $res && file_exists("../master.inc.php")) $res=@include("../master.inc.php"); +if (! $res && file_exists("../../master.inc.php")) $res=@include("../../master.inc.php"); +if (! $res && file_exists("../../../master.inc.php")) $res=@include("../../../master.inc.php"); +if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) $res=@include($path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"); // Used on dev env only +if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) $res=@include("../../../dolibarr".$reg[1]."/htdocs/master.inc.php"); // Used on dev env only +if (! $res) die ("Failed to include master.inc.php file\n"); +include_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'); + + +/* + * Main + */ + +$login=''; +$server=''; +if (preg_match('/^(.*)@(.*):(.*)$/',$sourceserver,$reg)) +{ + $login=$reg[1]; + $server=$reg[2]; + $sourcefile=$reg[3]; + $targetfile=basename($sourcefile); +} +if (empty($sourceserver) || empty($server) || empty($login) || empty($sourcefile) || empty($password) || empty($database) || empty($loginbase) || empty($passwordbase)) +{ + print "Usage: $script_file login@server:/src/file.(sql|gz|bz2) passssh database loginbase passbase\n"; + print "Return code: 0 if success, <>0 if error\n"; + print "Warning, this script may take a long time.\n"; + exit(-1); +} + + +$targetdir='/tmp'; +print "Get dump file from server ".$server.", path ".$sourcefile.", connect with login ".$login." loaded into localhost\n"; + +$sftpconnectstring=$sourceserver; +print 'SFTP connect string : '.$sftpconnectstring."\n"; +//print 'SFTP password '.$password."\n"; + + +// SFTP connect +if (! function_exists("ssh2_connect")) { + dol_print_error('','ssh2_connect function does not exists'); exit(1); +} + +$connection = ssh2_connect($server, 22); +if ($connection) +{ + if (! @ssh2_auth_password($connection, $login, $password)) + { + dol_syslog("Could not authenticate with username ".$login." . and password ".$password,LOG_ERR); + exit(-5); + } + else + { + //$stream = ssh2_exec($connection, '/usr/bin/php -i'); + /* + print "Generate dump ".$filesys1.'.bz2'."\n"; + $stream = ssh2_exec($connection, "mysqldump -u debian-sys-maint -p4k9Blxl2snq4FHXY -h 127.0.0.1 --single-transaction -K --tables -c -e --hex-blob --default-character-set=utf8 saasplex | bzip2 -1 > ".$filesys1.'.bz2'); + stream_set_blocking($stream, true); + // The command may not finish properly if the stream is not read to end + $output = stream_get_contents($stream); + */ + + $sftp = ssh2_sftp($connection); + + print 'Get file '.$sourcefile.' into '.$targetdir.$targetfile."\n"; + ssh2_scp_recv($connection, $sourcefile, $targetdir.$targetfile); + + $fullcommand="cat ".$targetdir.$targetfile." | mysql -u".$loginbase." -p".$passwordbase." -D ".$database; + if (preg_match('/\.bz2$/',$targetfile)) + { + $fullcommand="bzip2 -c -d ".$targetdir.$targetfile." | mysql -u".$loginbase." -p".$passwordbase." -D ".$database; + } + if (preg_match('/\.gz$/',$targetfile)) + { + $fullcommand="gzip -d ".$targetdir.$targetfile." | mysql -u".$loginbase." -p".$passwordbase." -D ".$database; + } + print "Load dump with ".$fullcommand."\n"; + $output=array(); + $return_var=0; + print strftime("%Y%m%d-%H%M%S").' '.$fullcommand."\n"; + exec($fullcommand, $output, $return_var); + foreach($output as $line) print $line."\n"; + + //ssh2_sftp_unlink($sftp, $fileinstalllock); + //print $output; + } +} +else +{ + print 'Failed to connect to ssh2 to '.$server; + exit(-6); +} + + +exit(0); diff --git a/dev/optimize_images.sh b/dev/optimize_images.sh index 616eec75757..0d532d054ad 100755 --- a/dev/optimize_images.sh +++ b/dev/optimize_images.sh @@ -10,6 +10,7 @@ INPLACE='0' max_input_size=0 max_output_size=0 + usage() { cat </dev/null rm -fr $2.firstpass fi @@ -67,6 +69,25 @@ get_max_file_length() main() { + test=`type pngcrush >/dev/null 2>&1` + result=$? + if [ "x$result" == "x1" ]; then + echo "Tool pngcrush not found" && exit + fi + + test=`type optipng >/dev/null 2>&1` + result=$? + if [ "x$result" == "x1" ]; then + echo "Tool optipng not found" && exit + fi + + test=`type jpegtran >/dev/null 2>&1` + result=$? + if [ "x$result" == "x1" ]; then + echo "Tool jpegtran not found" && exit + fi + + # If $INPUT is empty, then we use current directory if [[ "$INPUT" == "" ]]; then INPUT=$(pwd) @@ -81,6 +102,8 @@ main() OUTPUT='/tmp/optimize' fi + echo "Mode is $INPLACE (1=Images are replaced, 0=New images are stored into $OUTPUT)" + # We create the output directory mkdir -p $OUTPUT @@ -96,6 +119,7 @@ main() # Search of all jpg/jpeg/png in $INPUT # We remove images from $OUTPUT if $OUTPUT is a subdirectory of $INPUT + echo "Scan $INPUT to find images" IMAGES=$(find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v $OUTPUT) if [ "$QUIET" == "0" ]; then @@ -103,6 +127,7 @@ main() echo fi for CURRENT_IMAGE in $IMAGES; do + echo "Process $CURRENT_IMAGE" filename=$(basename $CURRENT_IMAGE) if [ "$QUIET" == "0" ]; then printf '%s ' "$filename" @@ -155,6 +180,13 @@ SHORTOPTS="h,i:,o:,q,s,p" LONGOPTS="help,input:,output:,quiet,no-stats,inplace" ARGS=$(getopt -s bash --options $SHORTOPTS --longoptions $LONGOPTS --name $PROGNAME -- "$@") +# Syntax +if [ "x$1" != "xlist" -a "x$1" != "xfix" ] +then + echo "Usage: optimize_images.sh (list|fix) -i dirtoscan" + exit +fi + eval set -- "$ARGS" while true; do case $1 in @@ -191,5 +223,11 @@ while true; do shift done +# To convert +if [ "x$1" = "xlist" ] +then + INPLACE=0 +fi + main diff --git a/dev/skeletons/skeleton_class.class.php b/dev/skeletons/skeleton_class.class.php index 781bbc1f77c..4dddc5a8c80 100644 --- a/dev/skeletons/skeleton_class.class.php +++ b/dev/skeletons/skeleton_class.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2014 Juanjo Menent * Copyright (C) ---Put here your own copyright and developer email--- * * This program is free software; you can redistribute it and/or modify @@ -79,7 +80,7 @@ class Skeleton_Class extends CommonObject // Put here code to add control on parameters values // Insert request - $sql = "INSERT INTO ".MAIN_DB_PREFIX."mytable("; + $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."("; $sql.= " field1,"; $sql.= " field2"; //... @@ -91,13 +92,13 @@ class Skeleton_Class extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::create", LOG_DEBUG); + dol_syslog(__METHOD__, LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } if (! $error) { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."mytable"); + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); if (! $notrigger) { @@ -116,7 +117,7 @@ class Skeleton_Class extends CommonObject { foreach($this->errors as $errmsg) { - dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); + dol_syslog(__METHOD__." ".$errmsg, LOG_ERR); $this->error.=($this->error?', '.$errmsg:$errmsg); } $this->db->rollback(); @@ -145,7 +146,7 @@ class Skeleton_Class extends CommonObject $sql.= " t.field1,"; $sql.= " t.field2"; //... - $sql.= " FROM ".MAIN_DB_PREFIX."mytable as t"; + $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; if ($ref) $sql.= " WHERE t.ref = '".$ref."'"; else $sql.= " WHERE t.rowid = ".$id; @@ -181,7 +182,7 @@ class Skeleton_Class extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user, $notrigger=0) { global $conf, $langs; $error=0; @@ -195,7 +196,7 @@ class Skeleton_Class extends CommonObject // Put here code to add a control on parameters values // Update request - $sql = "UPDATE ".MAIN_DB_PREFIX."mytable SET"; + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; $sql.= " field1=".(isset($this->field1)?"'".$this->db->escape($this->field1)."'":"null").","; $sql.= " field2=".(isset($this->field2)?"'".$this->db->escape($this->field2)."'":"null").""; //... @@ -203,7 +204,7 @@ class Skeleton_Class extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update"); + dol_syslog(__METHOD__); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -226,7 +227,7 @@ class Skeleton_Class extends CommonObject { foreach($this->errors as $errmsg) { - dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); + dol_syslog(__METHOD__." ".$errmsg, LOG_ERR); $this->error.=($this->error?', '.$errmsg:$errmsg); } $this->db->rollback(); @@ -270,10 +271,10 @@ class Skeleton_Class extends CommonObject if (! $error) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."mytable"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete"); + dol_syslog(__METHOD__); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } } @@ -283,7 +284,7 @@ class Skeleton_Class extends CommonObject { foreach($this->errors as $errmsg) { - dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); + dol_syslog(__METHOD__." ".$errmsg, LOG_ERR); $this->error.=($this->error?', '.$errmsg:$errmsg); } $this->db->rollback(); diff --git a/dev/skeletons/skeleton_page.php b/dev/skeletons/skeleton_page.php index 67d6298863a..ac329318ae5 100644 --- a/dev/skeletons/skeleton_page.php +++ b/dev/skeletons/skeleton_page.php @@ -114,8 +114,8 @@ if ($action == 'add') } { // Creation KO - if (! empty($object->errors)) setEventMessage($object->errors, 'errors'); - else setEventMessage($object->error, 'errors'); + if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); + else setEventMessages($object->error, null, 'errors'); $action='create'; } } @@ -139,7 +139,7 @@ if ($action == 'update' && ! GETPOST('cancel')) if (empty($object->ref)) { $error++; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),'errors'); + setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),null,'errors'); } if (! $error) @@ -152,8 +152,8 @@ if ($action == 'update' && ! GETPOST('cancel')) else { // Creation KO - if (! empty($object->errors)) setEventMessage($object->errors, 'errors'); - else setEventMessage($object->error, 'errors'); + if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); + else setEventMessages($object->error, null, 'errors'); $action='edit'; } } @@ -170,14 +170,14 @@ if ($action == 'confirm_delete') if ($result > 0) { // Delete OK - setEventMessage($langs->trans("RecordDeleted")); + setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); header("Location: ".dol_buildpath('/buildingmanagement/list.php',1)); exit; } else { - if (! empty($object->errors)) setEventMessage($object->errors,'errors'); - else setEventMessage($object->error,'errors'); + if (! empty($object->errors)) setEventMessages(null,$object->errors,'errors'); + else setEventMessages($object->error,null,'errors'); } } @@ -282,7 +282,7 @@ if ($action == 'create') print '
'; - print '
 
'; + print '
 
'; print ''; @@ -304,7 +304,7 @@ if (($id || $ref) && $action == 'edit') print '
'; - print '
'; + print '
'; print ''; @@ -327,6 +327,8 @@ if ($id && (empty($action) || $action == 'view')) print '
'."\n"; $parameters=array(); $reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) { if ($user->rights->mymodule->write) diff --git a/dev/skeletons/skeleton_webservice_server.php b/dev/skeletons/skeleton_webservice_server.php index 52bb46455cb..54a050ff9da 100644 --- a/dev/skeletons/skeleton_webservice_server.php +++ b/dev/skeletons/skeleton_webservice_server.php @@ -141,7 +141,7 @@ $server->register( * @param array $authentication Array of authentication information * @param int $id Id of object * @param string $ref Ref of object - * @param ref_ext $ref_ext Ref external of object + * @param string $ref_ext Ref external of object * @return mixed */ function getSkeleton($authentication,$id,$ref='',$ref_ext='') diff --git a/dev/test/testdiv.php b/dev/test/testdiv.php index 8700be5b2ab..2f1bd9182ae 100644 --- a/dev/test/testdiv.php +++ b/dev/test/testdiv.php @@ -19,14 +19,14 @@ -
+
'; print ''; diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index c8b8c8a7d97..d35e6e8ddf6 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -3,6 +3,7 @@ * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * Copyright (C) 2014 Marcos García + * Copyright (C) 2014 Juanjo Menent * * 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 @@ -25,7 +26,7 @@ */ require '../../main.inc.php'; - + // Class require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; @@ -43,7 +44,7 @@ $action = GETPOST('action', 'alpha'); // Other parameters ACCOUNTING_* $list = array ( - 'ACCOUNTING_SEPARATORCSV' + 'ACCOUNTING_SEPARATORCSV' ); /* @@ -51,26 +52,26 @@ $list = array ( */ if ($action == 'update') { $error = 0; - + $modelcsv = GETPOST('modelcsv', 'int'); - + if (! empty($modelcsv)) { - + if (! dolibarr_set_const($db, 'ACCOUNTING_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) { $error ++; } } else { $error ++; } - + foreach ( $list as $constname ) { $constvalue = GETPOST($constname, 'alpha'); - + if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { $error ++; } } - + if (! $error) { setEventMessage($langs->trans("SetupSaved")); } else { @@ -89,7 +90,7 @@ $form = new Form($db); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans('ConfigAccountingExpert'),$linkback,'setup'); -$head = admin_accounting_prepare_head(null); +$head = admin_accounting_prepare_head(); dol_fiche_head($head, 'export', $langs->trans("Configuration"), 0, 'cron'); @@ -98,7 +99,7 @@ print '' print ''; print ''; -$var = True; +$var = true; print ''; print ''; @@ -130,9 +131,6 @@ print "
\n"; * Params * */ -$list = array ( - 'ACCOUNTING_SEPARATORCSV' -); $num = count($list); if ($num) { @@ -144,23 +142,23 @@ if ($num) { foreach ( $list as $key ) { $var = ! $var; - + print ''; - + // Param $label = $langs->trans($key); print ''; - + // Value print ''; } -print ''; print "
' . $langs->trans("Modelcsv") . '
' . $label . ''; print ''; print '
\n"; print '
'; +print ''; llxFooter(); $db->close(); \ No newline at end of file diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 5907c754644..4dd005fca85 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -59,10 +59,10 @@ $max=100; $form = new Form($db); -llxHeader('',$title); - $title = $langs->trans('FiscalYears'); +llxHeader('',$title,LOG_ERR); + print_fiche_titre($langs->trans('FiscalYears')); $sql = "SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut, f.entity"; diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index 423ac88b490..4958749f0a5 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -200,8 +200,11 @@ if ($action == 'create') print ''; - print '
    '; - print '
'; + print ''; + print '     '; + print ''; + print '
'; print ''; } @@ -251,9 +254,11 @@ else if ($id) print ''; - print '
  '; + print '
'; + print ''; + print '     '; print ''; - print '
'; + print '
'; print ''; diff --git a/htdocs/accountancy/admin/importaccounts.php b/htdocs/accountancy/admin/importaccounts.php index b350aa8e590..6358bf353f3 100644 --- a/htdocs/accountancy/admin/importaccounts.php +++ b/htdocs/accountancy/admin/importaccounts.php @@ -120,6 +120,9 @@ if ($result) { $i = 0; print_barre_liste($langs->trans("ImportAccount"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines); + print '
' . "\n"; + print ''; + print ''; print ''; print ''; @@ -132,10 +135,7 @@ if ($result) { $form = new Form($db); $htmlacc = new FormVentilation($db); - print '' . "\n"; - print ''; - - $var = True; + $var = true; while ( $i < min($num_lines, $limit) ) { $objp = $db->fetch_object($result); $var = ! $var; diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 66f5efef04d..85e49028298 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -3,7 +3,8 @@ * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2014 Ari Elbaz (elarifr) - * Copyright (C) 2014 Marcos García + * Copyright (C) 2014 Marcos García + * Copyright (C) 2014 Juanjo Menent * * 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 @@ -43,17 +44,17 @@ if (!$user->admin) $action = GETPOST('action', 'alpha'); -// Other parameters COMPTA_* & ACCOUNTING_* +// Other parameters ACCOUNTING_* $list = array ( 'ACCOUNTING_LIMIT_LIST_VENTILATION', 'ACCOUNTING_LENGTH_GACCOUNT', 'ACCOUNTING_LENGTH_AACCOUNT', - 'COMPTA_ACCOUNT_CUSTOMER', - 'COMPTA_ACCOUNT_SUPPLIER', - 'COMPTA_PRODUCT_BUY_ACCOUNT', - 'COMPTA_PRODUCT_SOLD_ACCOUNT', - 'COMPTA_SERVICE_BUY_ACCOUNT', - 'COMPTA_SERVICE_SOLD_ACCOUNT', + 'ACCOUNTING_ACCOUNT_CUSTOMER', + 'ACCOUNTING_ACCOUNT_SUPPLIER', + 'ACCOUNTING_PRODUCT_BUY_ACCOUNT', + 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT', + 'ACCOUNTING_SERVICE_BUY_ACCOUNT', + 'ACCOUNTING_SERVICE_SOLD_ACCOUNT', 'ACCOUNTING_ACCOUNT_SUSPENSE', 'ACCOUNTING_ACCOUNT_TRANSFER_CASH' ); @@ -62,22 +63,22 @@ $list = array ( * Actions */ -$compta_mode = defined('COMPTA_MODE')?COMPTA_MODE:'RECETTES-DEPENSES'; +$accounting_mode = defined('ACCOUNTING_MODE')?ACCOUNTING_MODE:'RECETTES-DEPENSES'; if ($action == 'update') { $error = 0; - $compta_modes = array( + $accounting_modes = array( 'RECETTES-DEPENSES', 'CREANCES-DETTES' ); - $compta_mode = GETPOST('compta_mode','alpha'); + $accounting_mode = GETPOST('accounting_mode','alpha'); - if (in_array($compta_mode,$compta_modes)) { + if (in_array($accounting_mode,$accounting_modes)) { - if (!dolibarr_set_const($db, 'COMPTA_MODE', $compta_mode, 'chaine', 0, '', $conf->entity)) { + if (!dolibarr_set_const($db, 'ACCOUNTING_MODE', $accounting_mode, 'chaine', 0, '', $conf->entity)) { $error++; } } else { @@ -159,12 +160,12 @@ print ''; print '
' . $langs->trans("accountingaccount") . '' . $langs->trans("label") . '
'; -// Cas du parametre COMPTA_MODE +// Cas du parametre ACCOUNTING_MODE print ''; print ''; print "\n"; -print ''; +print ''; print '\n"; -print ''; +print ''; print '\n"; -print ''; print "
'.$langs->trans('OptionMode').''.$langs->trans('Description').'
'.$langs->trans('OptionModeTrue').'
'.$langs->trans('OptionModeTrue').''.nl2br($langs->trans('OptionModeTrueDesc')); // Write info on way to count VAT //if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) @@ -178,9 +179,8 @@ print ''.nl2br($langs->trans('OptionModeTrueDesc')); // // print nl2br($langs->trans('OptionModeTrueInfoExpert')); //} print "
'.$langs->trans('OptionModeVirtual').'
'.$langs->trans('OptionModeVirtual').''.nl2br($langs->trans('OptionModeVirtualDesc'))."
\n"; @@ -190,7 +190,7 @@ print "
\n"; * Define Chart of accounts */ print ''; -$var = True; +$var = true; print ''; print ''; -print ''; + print "
'; @@ -210,7 +210,7 @@ $sql .= " AND fk_pays = " . $mysoc->country_id; dol_syslog('accountancy/admin/index.php:: $sql=' . $sql); $resql = $db->query($sql); -$var = True; +$var = true; if ($resql) { $num = $db->num_rows($resql); @@ -284,10 +284,10 @@ if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) { } print '
\n"; print '

'; - +print ''; llxFooter(); $db->close(); \ No newline at end of file diff --git a/htdocs/accountancy/admin/journaux.php b/htdocs/accountancy/admin/journaux.php index 77b7d15e1c3..bec3fee45e9 100644 --- a/htdocs/accountancy/admin/journaux.php +++ b/htdocs/accountancy/admin/journaux.php @@ -3,6 +3,7 @@ * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * Copyright (C) 2014 Marcos García + * Copyright (C) 2014 Juanjo Menent * * 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 @@ -111,10 +112,10 @@ foreach ( $list as $key ) { print ''; } -print ''; print "\n"; print '
'; +print ''; print '
'; @@ -162,7 +163,6 @@ $db->free($resql); print "\n"; -print ''; print '
'; print '
'; diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 0b06a3d0daa..402ff72ed84 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -89,7 +89,7 @@ if ($resql) { print '' . $langs->trans("Accountancy_code_sell") . ''; print '' . $langs->trans("Accountancy_code_sell_suggest") . ''; - $var = True; + $var = true; while ( $i < min($num, 250) ) { $obj = $db->fetch_object($resql); @@ -98,17 +98,17 @@ if ($resql) { $compta_prodsell = $obj->accountancy_code_sell; if (empty($compta_prodsell)) { if ($obj->product_type == 0) - $compta_prodsell = (! empty($conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT) ? $conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); + $compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); else - $compta_prodsell = (! empty($conf->global->COMPTA_SERVICE_SOLD_ACCOUNT) ? $conf->global->COMPTA_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); + $compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); } $compta_prodbuy = $obj->accountancy_code_buy; if (empty($compta_prodbuy)) { if ($obj->product_type == 0) - $compta_prodbuy = (! empty($conf->global->COMPTA_PRODUCT_BUY_ACCOUNT) ? $conf->global->COMPTA_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef")); + $compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef")); else - $compta_prodbuy = (! empty($conf->global->COMPTA_SERVICE_BUY_ACCOUNT) ? $conf->global->COMPTA_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef")); + $compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef")); } $product_static = new Product($db); diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 9e109c7feeb..a24ed34e052 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -35,8 +35,6 @@ $langs->load("accounting"); $id = GETPOST('id', 'int'); if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) - accessforbidden(); $action = GETPOST('action'); $piece_num = GETPOST("piece_num"); @@ -238,7 +236,9 @@ if ($action == 'create') { print ''; print ''; -} else { +} +else +{ $book = new BookKeeping($db); $result = $book->fetch_per_mvt($piece_num); if ($result < 0) { @@ -309,14 +309,12 @@ if ($action == 'create') { print ''; print '' . $line->montant . ''; print '' . $line->sens . ''; - print ''; - if ($user->rights->accounting->access) { - print ''; - } + print ''; print ''; print ''; - } else { + } + else { print '' . $line->numero_compte . ''; print '' . $line->code_tiers . ''; print '' . $line->label_compte . ''; @@ -324,16 +322,15 @@ if ($action == 'create') { print '' . $line->credit . ''; print '' . $line->montant . ''; print '' . $line->sens . ''; - + print ''; - if ($user->rights->accouting->access) { - print ''; - print img_edit(); - print ' '; - print ''; - print img_delete(); - print ''; - } + print ''; + print img_edit(); + print ' '; + print ''; + print img_delete(); + print ''; + print ''; } print "\n"; @@ -342,7 +339,7 @@ if ($action == 'create') { if ($action == "" || $action == 'add') { $var = ! $var; print ""; - + print '
'; print '' . "\n"; print '' . "\n"; @@ -359,14 +356,14 @@ if ($action == 'create') { print ''; print ''; print ''; - print ''; } - - print ""; + print ''; + print '
'; } } - } else { + } + else { print_fiche_titre($langs->trans("NoRecords")); } } diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index b0e5096699b..b2acc60fb6a 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -36,6 +36,11 @@ $page = GETPOST("page"); $sortorder = GETPOST("sortorder"); $sortfield = GETPOST("sortfield"); $action = GETPOST('action', 'alpha'); +$search_doc_type = GETPOST("search_doc_type"); +$search_doc_ref = GETPOST("search_doc_ref"); +$search_account = GETPOST("search_account"); +$search_thirdparty = GETPOST("search_thirdparty"); +$search_journal = GETPOST("search_journal"); if ($sortorder == "") $sortorder = "ASC"; @@ -46,6 +51,15 @@ $offset = $conf->liste_limit * $page; $formventilation = new FormVentilation($db); +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_doc_type=""; + $search_doc_ref=""; + $search_account=""; + $search_thirdparty=""; + $search_journal=""; +} + /* * Action */ @@ -100,25 +114,25 @@ else { $sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num "; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk"; - if (dol_strlen(trim(GETPOST("search_doc_type")))) { + if (dol_strlen(trim($search_doc_type))) { - $sql .= " WHERE bk.doc_type LIKE '%" . GETPOST("search_doc_type") . "%'"; + $sql .= " WHERE bk.doc_type LIKE '%" . $search_doc_type . "%'"; - if (dol_strlen(trim(GETPOST("search_doc_ref")))) { - $sql .= " AND bk.doc_ref LIKE '%" . GETPOST("search_doc_ref") . "%'"; + if (dol_strlen(trim($search_doc_ref))) { + $sql .= " AND bk.doc_ref LIKE '%" . $search_doc_ref . "%'"; } } - if (dol_strlen(trim(GETPOST("search_doc_ref")))) { - $sql .= " WHERE bk.doc_ref LIKE '%" . GETPOST("search_doc_ref") . "%'"; + if (dol_strlen(trim($search_doc_ref))) { + $sql .= " WHERE bk.doc_ref LIKE '%" . $search_doc_ref . "%'"; } - if (dol_strlen(trim(GETPOST("search_compte")))) { - $sql .= " WHERE bk.numero_compte LIKE '%" . GETPOST("search_compte") . "%'"; + if (dol_strlen(trim($search_account))) { + $sql .= " WHERE bk.numero_compte LIKE '%" . $search_account . "%'"; } - if (dol_strlen(trim(GETPOST("search_tiers")))) { - $sql .= " WHERE bk.code_tiers LIKE '%" . GETPOST("search_tiers") . "%'"; + if (dol_strlen(trim($search_thirdparty))) { + $sql .= " WHERE bk.code_tiers LIKE '%" . $search_thirdparty . "%'"; } - if (dol_strlen(trim(GETPOST("search_journal")))) { - $sql .= " WHERE bk.code_journal LIKE '%" . GETPOST("search_journal") . "%'"; + if (dol_strlen(trim($search_journal))) { + $sql .= " WHERE bk.code_journal LIKE '%" . $search_journal . "%'"; } $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit + 1, $offset); @@ -149,7 +163,7 @@ else { print ''; print ''; - print ""; + print '
'; print ''; print_liste_field_titre($langs->trans("Doctype"), $_SERVER['PHP_SELF'], "bk.doc_type", "", "", "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "bk.doc_date", "", "", "", $sortfield, $sortorder); @@ -157,29 +171,31 @@ else { print_liste_field_titre($langs->trans("Numerocompte"), $_SERVER['PHP_SELF'], "bk.numero_compte", "", "", "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "bk.code_tiers", "", "", "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "bk_label_compte", "", "", "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "bk.debit", "", "", "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "bk.credit", "", "", "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "bk.montant", "", "", "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "bk.sens", "", "", "", $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "bk.debit", "", "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "bk.credit", "", "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "bk.montant", "", "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "bk.sens", "", "", 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "bk.code_journal", "", "", "", $sortfield, $sortorder); - print_liste_field_titre(" "); + print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder); print "\n"; print ''; print ''; - print ''; + print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; print ''; print ''; print ''; print ''; - print ''; - print ''; + print ''; print ''; print ''; @@ -201,9 +217,9 @@ else { print ''; print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print "\n"; $i ++; } @@ -215,4 +231,4 @@ else { } llxFooter(); -$db->close(); \ No newline at end of file +$db->close(); diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 4ecd0b3c8e1..659bff072cf 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2013-2014 Florian Henry + * Copyright (C) 2014 Juanjo Menent * * 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 @@ -18,19 +19,23 @@ */ /** - * \file htdocs/accountancy/class/Accountingaccount.class.php + * \file htdocs/accountancy/class/accountingaccount.class.php * \ingroup Accounting Expert * \brief Fichier de la classe des comptes comptable */ /** - * Classe permettant la gestion des comptes generaux de compta + * Class to manage accounting accounts */ class AccountingAccount extends CommonObject { var $db; + var $error; + var $errors; + var $id; var $rowid; + var $datec; // Creation date var $fk_pcg_version; var $pcg_type; @@ -62,8 +67,10 @@ class AccountingAccount extends CommonObject */ function fetch($rowid = null, $account_number = null) { - if ($rowid || $account_number) { - $sql = "SELECT * FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE "; + if ($rowid || $account_number) + { + $sql = "SELECT rowid, datec, tms, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, fk_user_author, fk_user_modif, active"; + $sql.= " FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE"; if ($rowid) { $sql .= " rowid = '" . $rowid . "'"; } elseif ($account_number) { @@ -72,28 +79,40 @@ class AccountingAccount extends CommonObject dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG); $result = $this->db->query($sql); - if ($result) { + if ($result) + { $obj = $this->db->fetch_object($result); - } else { - return null; + + if ($obj) + { + $this->id = $obj->rowid; + $this->rowid = $obj->rowid; + $this->datec = $obj->datec; + $this->tms = $obj->tms; + $this->fk_pcg_version = $obj->fk_pcg_version; + $this->pcg_type = $obj->pcg_type; + $this->pcg_subtype = $obj->pcg_subtype; + $this->account_number = $obj->account_number; + $this->account_parent = $obj->account_parent; + $this->label = $obj->label; + $this->fk_user_author = $obj->fk_user_author; + $this->fk_user_modif = $obj->fk_user_modif; + $this->active = $obj->active; + + return $this->id; + } + else + { + return 0; + } + } + else + { + dol_print_error($this->db); } } - $this->id = $obj->rowid; - $this->rowid = $obj->rowid; - $this->datec = $obj->datec; - $this->tms = $obj->tms; - $this->fk_pcg_version = $obj->fk_pcg_version; - $this->pcg_type = $obj->pcg_type; - $this->pcg_subtype = $obj->pcg_subtype; - $this->account_number = $obj->account_number; - $this->account_parent = $obj->account_parent; - $this->label = $obj->label; - $this->fk_user_author = $obj->fk_user_author; - $this->fk_user_modif = $obj->fk_user_modif; - $this->active = $obj->active; - - return $obj->rowid; + return -1; } /** @@ -109,6 +128,8 @@ class AccountingAccount extends CommonObject $error = 0; $now = dol_now(); + $now=dol_now(); + // Clean parameters if (isset($this->fk_pcg_version)) $this->fk_pcg_version = trim($this->fk_pcg_version); diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index e9bbc7d5958..b8ffb365d50 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -30,6 +30,9 @@ class BookKeeping extends CommonObject { var $db; + var $error; + var $errors; + var $id; var $doc_date; var $doc_type; diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index 91a0eb5df8b..4249688fabe 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -40,14 +40,12 @@ $id = GETPOST('id'); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) - accessforbidden(); /* * Actions */ -if ($action == 'ventil' && $user->rights->accounting->access) +if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) { if (! GETPOST('cancel', 'alpha')) { @@ -109,7 +107,7 @@ if (! empty($id)) { print ''; $linkback=''.$langs->trans("Back").''; - print_fiche_titre($langs->trans('AccountingVentilationCustomer'),$linkback,'setup'); + print_fiche_titre($langs->trans('CustomersVentilation'),$linkback,'setup'); print '
      '; - print ''; + print ''; + print ''; + print ' '; + print ''; print '
' . price($obj->debit) . '' . price($obj->credit) . '' . price($obj->montant) . '' . $obj->sens . '' . $obj->sens . '' . $obj->code_journal . '' . img_edit() . '' . img_edit() . '
'; @@ -129,8 +127,11 @@ if (! empty($id)) { print ''; print '
'; - print '
    '; - print '
'; + print ''; + print '     '; + print ''; + print '
'; print ''; } else { diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 2df4d675b20..663e763a9d3 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -1,7 +1,8 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2014 Juanjo Menent * * 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 @@ -25,7 +26,7 @@ */ require '../../main.inc.php'; - + // Class require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; @@ -40,9 +41,9 @@ $langs->load("accountancy"); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) +if (! $user->rights->accounting->ventilation->read) accessforbidden(); - + // Filter $year = $_GET["year"]; if ($year == 0) { @@ -56,10 +57,10 @@ if ($year == 0) { // Validate History $action = GETPOST('action'); if ($action == 'validatehistory') { - + $error = 0; $db->begin(); - + if ($db->type == 'pgsql') { $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd"; $sql1 .= " SET fd.fk_code_ventilation = accnt.rowid"; @@ -74,8 +75,7 @@ if ($action == 'validatehistory') { $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number"; $sql1 .= " AND fd.fk_code_ventilation = 0"; } - - dol_syslog("/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG); + $resql1 = $db->query($sql1); if (! $resql1) { $error ++; @@ -92,8 +92,8 @@ if ($action == 'validatehistory') { */ llxHeader('', $langs->trans("CustomersVentilation")); -$textprevyear = "" . img_previous() . ""; -$textnextyear = " " . img_next() . ""; +$textprevyear = '' . img_previous() . ''; +$textnextyear = ' ' . img_next() . ''; print_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear); @@ -105,7 +105,6 @@ $sql .= " , " . MAIN_DB_PREFIX . "facture as f"; $sql .= " WHERE fd.fk_code_ventilation = 0"; $sql .= " AND f.rowid = fd.fk_facture AND f.fk_statut = 1;"; -dol_syslog("/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG); $result = $db->query($sql); if ($result) { $row = $db->fetch_row($result); @@ -161,15 +160,14 @@ if (! empty($conf->multicompany->enabled)) { $sql .= " GROUP BY fd.fk_code_ventilation"; -dol_syslog("/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG); $resql = $db->query($sql); if ($resql) { $i = 0; $num = $db->num_rows($resql); - + while ( $i < $num ) { $row = $db->fetch_row($resql); - + print '' . length_accountg($row[0]) . ''; print '' . $row[1] . ''; print '' . price($row[2]) . ''; @@ -196,7 +194,7 @@ print "\n"; print "
\n"; print ''; -print ''; +print ''; print ''; print ''; print ''; @@ -211,7 +209,7 @@ print ''; print ''; print ''; -$sql = "SELECT '" . $langs->trans("Vide") . "' AS 'Total',"; +$sql = "SELECT '" . $langs->trans("TotalVente") . "' AS 'Total',"; $sql .= " ROUND(SUM(IF(MONTH(f.datef)=1,fd.total_ht,0)),2) AS 'Janvier',"; $sql .= " ROUND(SUM(IF(MONTH(f.datef)=2,fd.total_ht,0)),2) AS 'Fevrier',"; $sql .= " ROUND(SUM(IF(MONTH(f.datef)=3,fd.total_ht,0)),2) AS 'Mars',"; @@ -234,15 +232,14 @@ if (! empty($conf->multicompany->enabled)) { $sql .= " AND f.entity = '" . $conf->entity . "'"; } -dol_syslog('accountancy/customer/index.php:: $sql=' . $sql); $resql = $db->query($sql); if ($resql) { $i = 0; $num = $db->num_rows($resql); - + while ( $i < $num ) { $row = $db->fetch_row($resql); - + print ''; print ''; print ''; @@ -283,7 +280,7 @@ if (! empty($conf->margin->enabled)) { print ''; print ''; print ''; - + $sql = "SELECT '" . $langs->trans("Vide") . "' AS 'Marge',"; $sql .= " ROUND(SUM(IF(MONTH(f.datef)=1,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Janvier',"; $sql .= " ROUND(SUM(IF(MONTH(f.datef)=2,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Fevrier',"; @@ -302,20 +299,19 @@ if (! empty($conf->margin->enabled)) { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; $sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'"; $sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'"; - + if (! empty($conf->multicompany->enabled)) { $sql .= " AND f.entity = '" . $conf->entity . "'"; } - - dol_syslog('accountancy/customer/index.php:: $sql=' . $sql); + $resql = $db->query($sql); if ($resql) { $i = 0; $num = $db->num_rows($resql); - + while ( $i < $num ) { $row = $db->fetch_row($resql); - + print ''; print ''; print ''; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index aff9f7aa3a7..9215d5a9d98 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -2,7 +2,8 @@ /* Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2014 Ari Elbaz (elarifr) - * Copyright (C) 2014 Florian Henry + * Copyright (C) 2014 Florian Henry + * Copyright (C) 2014 Juanjo Menent * * 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 @@ -43,7 +44,7 @@ $account_parent = GETPOST('account_parent'); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) +if (! $user->rights->accounting->ventilation->dispatch) accessforbidden(); $formventilation = new FormVentilation($db); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 03e31d44a96..85ccdd3e619 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -3,6 +3,7 @@ * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2014 Ari Elbaz (elarifr) * Copyright (C) 2013-2014 Florian Henry + * Copyright (C) 2014 Juanjo Menent * * 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 @@ -25,7 +26,7 @@ */ require '../../main.inc.php'; - + // Class require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; @@ -44,7 +45,7 @@ $mesCasesCochees = GETPOST('mesCasesCochees', 'array'); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) +if (! $user->rights->accounting->ventilation->dispatch) accessforbidden(); $formventilation = new FormVentilation($db); @@ -67,18 +68,18 @@ if ($action == 'ventil') { $monId = $maLigneCourante[0]; $monNumLigne = $maLigneCourante[1]; $monCompte = $mesCodesVentilChoisis[$monNumLigne]; - + $sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet"; $sql .= " SET fk_code_ventilation = " . $monCompte; $sql .= " WHERE rowid = " . $monId; - + dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG); if ($db->query($sql)) { print '
' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '
'; } else { print '
' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '
' . $sql . '
'; } - + $cpt ++; } } else { @@ -111,8 +112,9 @@ $sql .= " FROM " . MAIN_DB_PREFIX . "facture as f"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON p.accountancy_code_sell = aa.account_number"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version"; $sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation = 0"; - +$sql .= " AND (accsys.rowid='".$conf->global->CHARTOFACCOUNTS."' OR p.accountancy_code_sell IS NULL)"; if (! empty($conf->multicompany->enabled)) { $sql .= " AND f.entity = '" . $conf->entity . "'"; } @@ -128,15 +130,15 @@ $result = $db->query($sql); if ($result) { $num_lines = $db->num_rows($result); $i = 0; - + // TODO : print_barre_liste always use $conf->liste_limit and do not care about custom limit in list... print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines); - + print '
' . $langs->trans("DescVentilTodoCustomer") . '
'; - + print '
' . "\n"; print ''; - + print '
' . $langs->trans("TotalVente") . '
' . $langs->trans("Total") . '' . $langs->trans("JanuaryMin") . '' . $langs->trans("FebruaryMin") . '' . $langs->trans("MarchMin") . '' . $langs->trans("NovemberMin") . '' . $langs->trans("DecemberMin") . '' . $langs->trans("Total") . '
' . $row[0] . '' . price($row[1]) . '' . price($row[2]) . '' . $langs->trans("NovemberMin") . '' . $langs->trans("DecemberMin") . '' . $langs->trans("Total") . '
' . $row[0] . '' . price($row[1]) . '' . price($row[2]) . '
'; print ''; print ''; @@ -147,48 +149,48 @@ if ($result) { print ''; print ''; print ''; - + $facture_static = new Facture($db); $product_static = new Product($db); $form = new Form($db); - + $var = True; while ( $i < min($num_lines, $limit) ) { $objp = $db->fetch_object($result); $var = ! $var; - + // product_type: 0 = service ? 1 = product // if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service // issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB ! $code_sell_notset = ''; - + if (empty($objp->code_sell)) { $code_sell_notset = 'color:red'; - + if (! empty($objp->type)) { if ($objp->type == 1) { - $objp->code_sell = (! empty($conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT) ? $conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); + $objp->code_sell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); } else { - $objp->code_sell = (! empty($conf->global->COMPTA_SERVICE_SOLD_ACCOUNT) ? $conf->global->COMPTA_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); + $objp->code_sell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); } } else { $code_sell_notset = 'color:blue'; - + if ($objp->type == 1) { - $objp->code_sell = (! empty($conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT) ? $conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); + $objp->code_sell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); } else { - $objp->code_sell = (! empty($conf->global->COMPTA_SERVICE_SOLD_ACCOUNT) ? $conf->global->COMPTA_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); + $objp->code_sell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); } } } - + print ""; - + // Ref facture $facture_static->ref = $objp->facnumber; $facture_static->id = $objp->facid; print ''; - + // Ref produit $product_static->ref = $objp->product_ref; $product_static->id = $objp->product_id; @@ -199,35 +201,34 @@ if ($result) { else print ' '; print ''; - + print ''; print ''; - + print ''; - + print ''; - + // Colonne choix du compte print ''; - + // Colonne choix ligne a ventiler print ''; - + print ''; $i ++; } - - print ''; - + print '
' . $langs->trans("Invoice") . '' . $langs->trans("Ref") . '' . $langs->trans("IntoAccount") . '' . $langs->trans("Ventilate") . '
' . $facture_static->getNomUrl(1) . '' . dol_trunc($objp->product_label, 24) . '' . nl2br(dol_trunc($objp->description, 32)) . ''; print price($objp->total_ht); print ''; print $objp->code_sell; print ''; print $formventilation->select_account($objp->aarowid, 'codeventil[]', 1); print ''; - print 'code_sell ? "checked" : "") . '/>'; + print 'aarowid ? "checked" : "") . '/>'; print '
 
'; + print '
'; print ''; } else { print $db->error(); diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 218c4dd46df..754b4408b16 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -68,8 +68,6 @@ $action = GETPOST('action'); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) - accessforbidden(); /* * View @@ -129,8 +127,8 @@ if ($result) { $num = $db->num_rows($result); // Variables - $cptfour = (! empty($conf->global->COMPTA_ACCOUNT_SUPPLIER) ? $conf->global->COMPTA_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef")); - $cptcli = (! empty($conf->global->COMPTA_ACCOUNT_CUSTOMER) ? $conf->global->COMPTA_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef")); + $cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef")); + $cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef")); $cpttva = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) ? $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE : $langs->trans("CodeNotDef")); $accountancy_account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef")); @@ -140,10 +138,11 @@ if ($result) { $tabtype = array (); $i = 0; - while ( $i < $num ) { + while ( $i < $num ) + { $obj = $db->fetch_object($result); - $tabcompany[$obj->rowid] = array ( + $tabcompany[$obj->rowid] = array( 'id' => $obj->socid, 'name' => $obj->name, 'code_client' => $obj->code_compta @@ -171,17 +170,17 @@ if ($result) { $links = $object->get_url($obj->rowid); // get_url may return -1 which is not traversable - if (is_array($links)) { - - foreach ( $links as $key => $val ) { - + if (is_array($links)) + { + foreach ($links as $key => $val) + { $tabtype[$obj->rowid] = $links[$key]['type']; if ($links[$key]['type'] == 'payment') { $paymentstatic->id = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2); - } + } else if ($links[$key]['type'] == 'payment_supplier') { $paymentsupplierstatic->id = $links[$key]['url_id']; @@ -206,27 +205,68 @@ if ($result) { $reg[1] = 'SocialContribution'; $chargestatic->lib = $langs->trans($reg[1]); } - else + else if ($links[$key]['type'] == 'company') { - $chargestatic->lib = $links[$key]['label']; + $societestatic->id = $links[$key]['url_id']; + $societestatic->name = $links[$key]['label']; + $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); + $tabtp[$obj->rowid][$compta_soc] += $obj->amount; } - $chargestatic->ref = $chargestatic->lib; - $tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30); - - $sqlmid = 'SELECT cchgsoc.accountancy_code'; - $sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc "; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid"; - $sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid; - - dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); - $resultmid = $db->query($sqlmid); - if ($resultmid) + else if ($links[$key]['type'] == 'sc') { - $objmid = $db->fetch_object($resultmid); - $tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount; + $chargestatic->id = $links[$key]['url_id']; + $chargestatic->ref = $links[$key]['url_id']; + + $tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2); + if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) { + if ($reg[1] == 'socialcontribution') + $reg[1] = 'SocialContribution'; + $chargestatic->lib = $langs->trans($reg[1]); + } + else + { + $chargestatic->lib = $links[$key]['label']; + } + $chargestatic->ref = $chargestatic->lib; + $tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30); + + $sqlmid = 'SELECT cchgsoc.accountancy_code'; + $sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc "; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id"; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid"; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid"; + $sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid; + + dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); + $resultmid = $db->query($sqlmid); + if ($resultmid) + { + $objmid = $db->fetch_object($resultmid); + $tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount; + } } + else if ($links[$key]['type'] == 'payment_vat') + { + $paymentvatstatic->id = $links[$key]['url_id']; + $paymentvatstatic->ref = $links[$key]['url_id']; + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); + $tabtp[$obj->rowid][$cpttva] += $obj->amount; + } + else if ($links[$key]['type'] == 'payment_salary') + { + $paymentsalstatic->id = $links[$key]['url_id']; + $paymentsalstatic->ref = $links[$key]['url_id']; + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2); + $tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount; + } + else if ($links[$key]['type'] == 'banktransfert') + { + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); + $tabtp[$obj->rowid][$cpttva] += $obj->amount; + } + /*else { + $tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount; + }*/ } else if ($links[$key]['type'] == 'payment_vat') { @@ -236,7 +276,7 @@ if ($result) { $tabtp[$obj->rowid][$cpttva] += $obj->amount; } else if ($links[$key]['type'] == 'payment_salary') - { + { $paymentsalstatic->id = $links[$key]['url_id']; $paymentsalstatic->ref = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2); @@ -252,6 +292,7 @@ if ($result) { }*/ } } + $tabbq[$obj->rowid][$compta_bank] += $obj->amount; // if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount; @@ -264,14 +305,17 @@ if ($result) { /* * Actions -*/ + */ // Write bookkeeping -if ($action == 'writeBookKeeping') { +if ($action == 'writeBookKeeping') +{ $error = 0; - foreach ( $tabpay as $key => $val ) { + foreach ($tabpay as $key => $val) + { // Bank - foreach ( $tabbq[$key] as $k => $mt ) { + foreach ($tabbq[$key] as $k => $mt) + { $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_ref = $val["ref"]; @@ -322,8 +366,8 @@ if ($action == 'writeBookKeeping') { } } // Third party - foreach ( $tabtp[$key] as $k => $mt ) { - + foreach ($tabtp[$key] as $k => $mt) + { $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_ref = $val["ref"]; @@ -354,7 +398,7 @@ if ($action == 'writeBookKeeping') { $bookkeeping->doc_ref = $objmid->facnumber; } $bookkeeping->code_tiers = $k; - $bookkeeping->numero_compte = $conf->global->COMPTA_ACCOUNT_CUSTOMER; + $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; } else if ($tabtype[$key] == 'payment_supplier') { $sqlmid = 'SELECT facf.facnumber'; @@ -369,7 +413,7 @@ if ($action == 'writeBookKeeping') { $bookkeeping->doc_ref = $objmid->facnumber; } $bookkeeping->code_tiers = $k; - $bookkeeping->numero_compte = $conf->global->COMPTA_ACCOUNT_SUPPLIER; + $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; } else if ($tabtype[$key] == 'company') { $sqlmid = 'SELECT fac.facnumber'; @@ -384,11 +428,11 @@ if ($action == 'writeBookKeeping') { $bookkeeping->doc_ref = $objmid->facnumber; } $bookkeeping->code_tiers = $k; - $bookkeeping->numero_compte = $conf->global->COMPTA_ACCOUNT_CUSTOMER; + $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; } else { $bookkeeping->doc_ref = $k; - $bookkeeping->numero_compte = $conf->global->COMPTA_ACCOUNT_CUSTOMER; + $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; } $result = $bookkeeping->create(); @@ -404,7 +448,8 @@ if ($action == 'writeBookKeeping') { } } // export csv -if ($action == 'export_csv') { +if ($action == 'export_csv') +{ $sep = $conf->global->ACCOUNTING_SEPARATORCSV; header('Content-Type: text/csv'); @@ -439,9 +484,9 @@ if ($action == 'export_csv') { print $date . $sep; print $conf->global->ACCOUNTING_BANK_JOURNAL . $sep; if ($val["lib"] == '(SupplierInvoicePayment)') { - print length_accountg($conf->global->COMPTA_ACCOUNT_SUPPLIER) . $sep; + print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep; } else { - print length_accountg($conf->global->COMPTA_ACCOUNT_CUSTOMER) . $sep; + print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep; } print length_accounta(html_entity_decode($k)) . $sep; print ($mt < 0 ? 'D' : 'C') . $sep; @@ -487,7 +532,9 @@ if ($action == 'export_csv') { } } } -} else { +} +else +{ $form = new Form($db); @@ -585,4 +632,5 @@ if ($action == 'export_csv') { // End of page llxFooter(); } + $db->close(); diff --git a/htdocs/accountancy/journal/cashjournal.php b/htdocs/accountancy/journal/cashjournal.php index ac7cbeb2f77..261cdd036c3 100644 --- a/htdocs/accountancy/journal/cashjournal.php +++ b/htdocs/accountancy/journal/cashjournal.php @@ -62,8 +62,6 @@ $date_endyear = GETPOST('date_endyear'); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) - accessforbidden(); $action = GETPOST('action'); @@ -121,8 +119,8 @@ if ($result) { $num = $db->num_rows($result); // les variables - $cptfour = (! empty($conf->global->COMPTA_ACCOUNT_SUPPLIER) ? $conf->global->COMPTA_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef")); - $cptcli = (! empty($conf->global->COMPTA_ACCOUNT_CUSTOMER) ? $conf->global->COMPTA_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef")); + $cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef")); + $cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef")); $cpttva = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) ? $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE : $langs->trans("CodeNotDef")); $cptsociale = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) ? $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE : $langs->trans("CodeNotDef")); @@ -133,7 +131,8 @@ if ($result) { $tabtype = array (); $i = 0; - while ( $i < $num ) { + while ($i < $num) + { $obj = $db->fetch_object($result); // controls @@ -158,9 +157,10 @@ if ($result) { $links = $object->get_url($obj->rowid); // get_url may return -1 which is not traversable - if (is_array($links)) { - foreach ($links as $key => $val) { - + if (is_array($links)) + { + foreach ( $links as $key => $val ) + { $tabtype[$obj->rowid] = $links[$key]['type']; if ($links[$key]['type'] == 'payment') { @@ -204,21 +204,13 @@ if ($result) { $objmid = $db->fetch_object($resultmid); $tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount; } - } else if ($links[$key]['type'] == 'payment_vat') { - - $paymentvatstatic->id = $links[$key]['url_id']; - $paymentvatstatic->ref = $links[$key]['url_id']; - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); - $tabtp[$obj->rowid][$cpttva] += $obj->amount; - } else if ($links[$key]['type'] == 'banktransfert') { - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); - $tabtp[$obj->rowid][$cpttva] += $obj->amount; + /*else { + $tabtp [$obj->rowid] [$cptsociale] += $obj->amount; + }*/ } - /*else { - $tabtp [$obj->rowid] [$cptsociale] += $obj->amount; - }*/ } } + $tabbq[$obj->rowid][$compta_bank] += $obj->amount; // if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount; @@ -234,11 +226,14 @@ if ($result) { */ // write bookkeeping -if ($action == 'writeBookKeeping') { +if ($action == 'writeBookKeeping') +{ $error = 0; - foreach ( $tabpay as $key => $val ) { + foreach ( $tabpay as $key => $val ) + { // cash - foreach ( $tabbq[$key] as $k => $mt ) { + foreach ( $tabbq[$key] as $k => $mt ) + { $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_ref = $val["ref"]; @@ -254,8 +249,8 @@ if ($action == 'writeBookKeeping') { $bookkeeping->credit = ($mt < 0 ? - $mt : 0); $bookkeeping->code_journal = $conf->global->ACCOUNTING_CASH_JOURNAL; - if ($tabtype[$key] == 'payment') { - + if ($tabtype[$key] == 'payment') + { $sqlmid = 'SELECT fac.facnumber'; $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac "; $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid"; @@ -321,7 +316,7 @@ if ($action == 'writeBookKeeping') { $bookkeeping->doc_ref = $objmid->facnumber; } $bookkeeping->code_tiers = $k; - $bookkeeping->numero_compte = $conf->global->COMPTA_ACCOUNT_CUSTOMER; + $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; } else if ($tabtype[$key] == 'payment_supplier') { $sqlmid = 'SELECT facf.facnumber'; @@ -336,7 +331,7 @@ if ($action == 'writeBookKeeping') { $bookkeeping->doc_ref = $objmid->facnumber; } $bookkeeping->code_tiers = $k; - $bookkeeping->numero_compte = $conf->global->COMPTA_ACCOUNT_SUPPLIER; + $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; } else if ($tabtype[$key] == 'company') { $sqlmid = 'SELECT fac.facnumber'; @@ -351,11 +346,11 @@ if ($action == 'writeBookKeeping') { $bookkeeping->doc_ref = $objmid->facnumber; } $bookkeeping->code_tiers = $k; - $bookkeeping->numero_compte = $conf->global->COMPTA_ACCOUNT_CUSTOMER; + $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; } else { $bookkeeping->doc_ref = $k; - $bookkeeping->numero_compte = $conf->global->COMPTA_ACCOUNT_CUSTOMER; + $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; } $result = $bookkeeping->create(); @@ -402,9 +397,9 @@ if ($action == 'export_csv') { print $date . $sep; print $conf->global->ACCOUNTING_CASH_JOURNAL . $sep; if ($obj->label == '(SupplierInvoicePayment)') { - print length_accountg($conf->global->COMPTA_ACCOUNT_SUPPLIER) . $sep; + print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep; } else { - print length_accountg($conf->global->COMPTA_ACCOUNT_CUSTOMER) . $sep; + print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep; } print length_accounta(html_entity_decode($k)) . $sep; print ($mt < 0 ? 'D' : 'C') . $sep; @@ -451,14 +446,14 @@ if ($action == 'export_csv') { llxHeader('', $langs->trans("CashJournal"), ''); - $nom = $langs->trans("CashJournal"); + $name = $langs->trans("CashJournal"); $nomlink = ''; $periodlink = ''; $exportlink = ''; $builddate = time(); $description = $langs->trans("DescCashJournal") . '
'; $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); - report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); + report_header($name, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); print ''; diff --git a/htdocs/accountancy/journal/index.php b/htdocs/accountancy/journal/index.php index 272d76fa20f..36286ce265e 100644 --- a/htdocs/accountancy/journal/index.php +++ b/htdocs/accountancy/journal/index.php @@ -36,8 +36,6 @@ $langs->load("accountancy"); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) - accessforbidden(); llxHeader('', 'Journaux', ''); diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 09d93d5cd50..0e0b7c4281f 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -28,7 +28,7 @@ */ require '../../main.inc.php'; - + // Class require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -55,13 +55,13 @@ $date_endyear = GETPOST('date_endyear'); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) - accessforbidden(); $action = GETPOST('action'); + + /* - * View + * Actions */ $year_current = strftime("%Y", dol_now()); @@ -88,12 +88,12 @@ $sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,"; $sql .= " fd.rowid as fdid, fd.description, fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type,"; $sql .= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur, s.fournisseur,"; $sql .= " s.code_compta_fournisseur, p.accountancy_code_buy , ct.accountancy_code_buy as account_tva, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte"; -$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det fd"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product p ON p.rowid = fd.fk_product"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount aa ON aa.rowid = fd.fk_code_ventilation"; -$sql .= " JOIN " . MAIN_DB_PREFIX . "facture_fourn f ON f.rowid = fd.fk_facture_fourn"; -$sql .= " JOIN " . MAIN_DB_PREFIX . "societe s ON s.rowid = f.fk_soc"; +$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as fd"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON aa.rowid = fd.fk_code_ventilation"; +$sql .= " JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = fd.fk_facture_fourn"; +$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc"; $sql .= " WHERE f.fk_statut > 0 "; if (! empty($conf->multicompany->enabled)) { $sql .= " AND f.entity = " . $conf->entity; @@ -111,15 +111,15 @@ $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); // les variables - $cptfour = (! empty($conf->global->COMPTA_ACCOUNT_SUPPLIER)) ? $conf->global->COMPTA_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef"); - $cpttva = (! empty($conf->global->COMPTA_VAT_ACCOUNT)) ? $conf->global->COMPTA_VAT_ACCOUNT : $langs->trans("CodeNotDef"); - + $cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef"); + $cpttva = (! empty($conf->global->ACCOUNTING_VAT_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_ACCOUNT : $langs->trans("CodeNotDef"); + $tabfac = array (); $tabht = array (); $tabtva = array (); $tabttc = array (); $tabcompany = array (); - + $i = 0; while ( $i < $num ) { $obj = $db->fetch_object($result); @@ -128,12 +128,12 @@ if ($result) { $compta_prod = $obj->compte; if (empty($compta_prod)) { if ($obj->product_type == 0) - $compta_prod = (! empty($conf->global->COMPTA_PRODUCT_BUY_ACCOUNT)) ? $conf->global->COMPTA_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"); + $compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"); else - $compta_prod = (! empty($conf->global->COMPTA_SERVICE_BUY_ACCOUNT)) ? $conf->global->COMPTA_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"); + $compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"); } $compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva); - + $tabfac[$obj->rowid]["date"] = $obj->df; $tabfac[$obj->rowid]["ref"] = $obj->ref; $tabfac[$obj->rowid]["type"] = $obj->type; @@ -145,26 +145,23 @@ if ($result) { $tabcompany[$obj->rowid] = array ( 'id' => $obj->socid, 'name' => $obj->name, - 'code_fournisseur' => $obj->code_compta_fournisseur + 'code_fournisseur' => $obj->code_compta_fournisseur ); - + $i ++; } } else { dol_print_error($db); } -/* - * Actions -*/ // Bookkeeping Write if ($action == 'writebookkeeping') { $now = dol_now(); - + foreach ( $tabfac as $key => $val ) { foreach ( $tabttc[$key] as $k => $mt ) { // get compte id and label - + $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_ref = $val["ref"]; @@ -174,16 +171,16 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = $val["fk_facturefourndet"]; $bookkeeping->code_tiers = $tabcompany[$key]['code_fournisseur']; $bookkeeping->label_compte = $tabcompany[$key]['name']; - $bookkeeping->numero_compte = $conf->global->COMPTA_ACCOUNT_SUPPLIER; + $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt >= 0) ? 'C' : 'D'; $bookkeeping->debit = ($mt <= 0) ? $mt : 0; $bookkeeping->credit = ($mt > 0) ? $mt : 0; $bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL; - + $bookkeeping->create(); } - + // Product / Service foreach ( $tabht[$key] as $k => $mt ) { if ($mt) { @@ -205,18 +202,18 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? $mt : 0; $bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL; - + $bookkeeping->create(); } } } - + // VAT // var_dump($tabtva); foreach ( $tabtva[$key] as $k => $mt ) { if ($mt) { // get compte id and label - + $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_ref = $val["ref"]; @@ -232,34 +229,39 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? $mt : 0; $bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL; - + $bookkeeping->create(); } } } } -// export csv -if ($action == 'export_csv') { +/* + * View + */ + +$companystatic = new Fournisseur($db); + +// export csv +if ($action == 'export_csv') +{ $sep = $conf->global->ACCOUNTING_SEPARATORCSV; - + header('Content-Type: text/csv'); header('Content-Disposition: attachment;filename=journal_achats.csv'); - $companystatic = new Fournisseur($db); - if ($conf->global->ACCOUNTING_MODELCSV == 1) // Modèle Export Cegid Expert { foreach ( $tabfac as $key => $val ) { $date = dol_print_date($db->jdate($val["date"]), '%d%m%Y'); - + // Product / Service foreach ( $tabht[$key] as $k => $mt ) { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; $companystatic->client = $tabcompany[$key]['code_client']; - + if ($mt) { print $date . $sep; print $conf->global->ACCOUNTING_PURCHASE_JOURNAL . $sep; @@ -272,7 +274,7 @@ if ($action == 'export_csv') { print "\n"; } } - + // VAT // var_dump($tabtva); foreach ( $tabtva[$key] as $k => $mt ) { @@ -290,8 +292,8 @@ if ($action == 'export_csv') { } print $date . $sep; print $conf->global->ACCOUNTING_PURCHASE_JOURNAL . $sep; - print length_accountg($conf->global->COMPTA_ACCOUNT_SUPPLIER) . $sep; - + print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep; + foreach ( $tabttc[$key] as $k => $mt ) { print length_accounta(html_entity_decode($k)) . $sep; print ($mt < 0 ? 'D' : 'C') . $sep; @@ -305,11 +307,11 @@ if ($action == 'export_csv') { { foreach ( $tabfac as $key => $val ) { $date = dol_print_date($db->jdate($val["date"]), 'day'); - + $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; $companystatic->client = $tabcompany[$key]['code_client']; - + // Product / Service foreach ( $tabht[$key] as $k => $mt ) { if ($mt) { @@ -335,7 +337,7 @@ if ($action == 'export_csv') { print "\n"; } } - + // Third party print '"' . $date . '"' . $sep; print '"' . $val["ref"] . '"' . $sep; @@ -349,11 +351,11 @@ if ($action == 'export_csv') { } } } else { - + llxHeader('', '', ''); - + $form = new Form($db); - + $nom = $langs->trans("PurchasesJournal"); $nomlink = ''; $periodlink = ''; @@ -366,11 +368,11 @@ if ($action == 'export_csv') { $description .= $langs->trans("DepositsAreIncluded"); $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); - + print ''; - + print ''; - + print ' '; - + /* * Show result array */ print '

'; - + $i = 0; print ""; print ""; @@ -399,26 +401,24 @@ if ($action == 'export_csv') { print ""; print ""; print "\n"; - + $var = true; $r = ''; - + $invoicestatic = new FactureFournisseur($db); - $companystatic = new Fournisseur($db); - + foreach ( $tabfac as $key => $val ) { $invoicestatic->id = $key; $invoicestatic->ref = $val["ref"]; $invoicestatic->type = $val["type"]; $invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32)); - + $date = dol_print_date($db->jdate($val["date"]), 'day'); - + // Product / Service foreach ( $tabht[$key] as $k => $mt ) { if ($mt) { print ""; - // print ""; print ""; print ""; print ""; @@ -433,7 +433,6 @@ if ($action == 'export_csv') { foreach ( $tabtva[$key] as $k => $mt ) { if ($mt) { print ""; - // print ""; print ""; print ""; print ""; @@ -443,16 +442,15 @@ if ($action == 'export_csv') { } } print ""; - + // Third party - // print ""; print ""; print ""; - + foreach ( $tabttc[$key] as $k => $mt ) { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; - + print ""; } print ""; - + $var = ! $var; } - + print "
" . $langs->trans("Account") . "" . $langs->trans("Type") . "" . $langs->trans("Debit") . "" . $langs->trans("Credit") . "
".$conf->global->COMPTA_JOURNAL_BUY."" . $date . "" . $invoicestatic->getNomUrl(1) . "" . length_accountg($k) . "
".$conf->global->COMPTA_JOURNAL_BUY."" . $date . "" . $invoicestatic->getNomUrl(1) . "" . length_accountg($k) . "" . $langs->trans("VAT") . "
".$conf->global->COMPTA_JOURNAL_BUY."" . $date . "" . $invoicestatic->getNomUrl(1) . "" . length_accounta($k); print "" . $langs->trans("ThirdParty"); print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')'; @@ -461,12 +459,12 @@ if ($action == 'export_csv') { print '' . ($mt >= 0 ? price($mt) : '') . "
"; - + // End of page llxFooter(); } diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 587a0d387a4..5bb1f989a92 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -56,8 +56,6 @@ $date_endyear = GETPOST('date_endyear'); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) - accessforbidden(); $action = GETPOST('action'); @@ -90,11 +88,11 @@ $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tot $sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,"; $sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte, "; $sql .= " ct.accountancy_code_sell as account_tva"; -$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet fd"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product p ON p.rowid = fd.fk_product"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount aa ON aa.rowid = fd.fk_code_ventilation"; -$sql .= " JOIN " . MAIN_DB_PREFIX . "facture f ON f.rowid = fd.fk_facture"; -$sql .= " JOIN " . MAIN_DB_PREFIX . "societe s ON s.rowid = f.fk_soc"; +$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON aa.rowid = fd.fk_code_ventilation"; +$sql .= " JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; +$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'"; $sql .= " WHERE fd.fk_code_ventilation > 0 "; if (! empty($conf->multicompany->enabled)) { @@ -125,17 +123,17 @@ if ($result) { while ( $i < $num ) { $obj = $db->fetch_object($result); // les variables - $cptcli = (! empty($conf->global->COMPTA_ACCOUNT_CUSTOMER)) ? $conf->global->COMPTA_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef"); + $cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef"); $compta_soc = (! empty($obj->code_compta)) ? $obj->code_compta : $cptcli; $compta_prod = $obj->compte; if (empty($compta_prod)) { if ($obj->product_type == 0) - $compta_prod = (! empty($conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"); + $compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"); else - $compta_prod = (! empty($conf->global->COMPTA_SERVICE_SOLD_ACCOUNT)) ? $conf->global->COMPTA_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"); + $compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"); } - $cpttva = (! empty($conf->global->COMPTA_VAT_ACCOUNT)) ? $conf->global->COMPTA_VAT_ACCOUNT : $langs->trans("CodeNotDef"); + $cpttva = (! empty($conf->global->ACCOUNTING_VAT_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_ACCOUNT : $langs->trans("CodeNotDef"); $compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva); // Invoice lines @@ -183,7 +181,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_facturedet"]; $bookkeeping->code_tiers = $tabcompany[$key]['code_client']; - $bookkeeping->numero_compte = $conf->global->COMPTA_ACCOUNT_CUSTOMER; + $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; $bookkeeping->label_compte = $tabcompany[$key]['name']; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; @@ -267,7 +265,7 @@ if ($action == 'export_csv') { print $date . $sep; print $conf->global->ACCOUNTING_SELL_JOURNAL . $sep; - print length_accountg($conf->global->COMPTA_ACCOUNT_CUSTOMER) . $sep; + print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep; foreach ( $tabttc[$key] as $k => $mt ) { print length_accounta(html_entity_decode($k)) . $sep; print ($mt < 0 ? 'C' : 'D') . $sep; @@ -422,7 +420,6 @@ if ($action == 'export_csv') { print ""; // Third party - // print "".$conf->global->COMPTA_JOURNAL_SELL.""; print "" . $date . ""; print "" . $invoicestatic->getNomUrl(1) . ""; foreach ( $tabttc[$key] as $k => $mt ) { @@ -441,7 +438,6 @@ if ($action == 'export_csv') { foreach ( $tabht[$key] as $k => $mt ) { if ($mt) { print ""; - // print "".$conf->global->COMPTA_JOURNAL_SELL.""; print "" . $date . ""; print "" . $invoicestatic->getNomUrl(1) . ""; print "" . length_accountg($k) . ""; @@ -457,7 +453,6 @@ if ($action == 'export_csv') { foreach ( $tabtva[$key] as $k => $mt ) { if ($mt) { print ""; - // print "".$conf->global->COMPTA_JOURNAL_SELL.""; print "" . $date . ""; print "" . $invoicestatic->getNomUrl(1) . ""; print "" . length_accountg($k) . ""; diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php index 3ff70b4e670..45c8de9b165 100644 --- a/htdocs/accountancy/supplier/card.php +++ b/htdocs/accountancy/supplier/card.php @@ -4,6 +4,7 @@ * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2013-2014 Florian Henry + * Copyright (C) 2014 Juanjo Menent s * * 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 @@ -45,10 +46,9 @@ $codeventil = GETPOST('codeventil'); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) - accessforbidden(); -if ($action == 'ventil' && $user->rights->accounting->access) { +if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) +{ $sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; $sql .= " SET fk_code_ventilation = " . $codeventil; $sql .= " WHERE rowid = " . $id; @@ -102,7 +102,7 @@ if ($_GET["id"]) { print ''; print ''; - print_fiche_titre($langs->trans("Ventilation")); + print_fiche_titre($langs->trans("SuppliersVentilation")); print ''; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index cd6ef6bcb53..edebcfd9d46 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2014 Juanjo Menent * * 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 @@ -39,7 +40,7 @@ $langs->load("accountancy"); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) +if (! $user->rights->accounting->ventilation->read) accessforbidden(); // Filter @@ -91,10 +92,10 @@ if ($action == 'validatehistory') { llxHeader('', $langs->trans("SuppliersVentilation")); -$textprevyear = "" . img_previous() . ""; -$textnextyear = " " . img_next() . ""; +$textprevyear = '' . img_previous() . ''; +$textnextyear = ' ' . img_next() . ''; -print_fiche_titre($langs->trans("AccountingVentilationSupplier") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear); +print_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear); print '' . $langs->trans("DescVentilSupplier") . ''; print ''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 41ab92aa765..8b2a870220d 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -4,7 +4,8 @@ * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2014 Ari Elbaz (elarifr) - * Copyright (C) 2013-2014 Florian Henry a + * Copyright (C) 2013-2014 Florian Henry + * Copyright (C) 2014 Juanjo Menent * * 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 @@ -44,7 +45,7 @@ $langs->load("accountancy"); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) +if (! $user->rights->accounting->ventilation->dispatch) accessforbidden(); $formventilation = new FormVentilation($db); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 817b07c178e..f932fbfc8af 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -1,8 +1,9 @@ * Copyright (C) 2013-2014 Alexandre Spangaro - * Copyright (C) 2014 Ari Elbaz (elarifr) + * Copyright (C) 2014 Ari Elbaz (elarifr) * Copyright (C) 2013-2014 Florian Henry + * Copyright (C) 2014 Juanjo Menent s * * 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 @@ -25,7 +26,7 @@ */ require '../../main.inc.php'; - + // Class require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; @@ -45,7 +46,7 @@ $mesCasesCochees = GETPOST('mesCasesCochees', 'array'); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) +if (! $user->rights->accounting->ventilation->dispatch) accessforbidden(); $formventilation = new FormVentilation($db); @@ -62,25 +63,25 @@ if ($action == 'ventil') { print '
' . count($_POST["mesCasesCochees"]) . ' ' . $langs->trans("SelectedLines") . '
'; $mesCodesVentilChoisis = $codeventil; $cpt = 0; - + foreach ( $mesCasesCochees as $maLigneCochee ) { // print '
id selectionnee : '.$monChoix."
"; $maLigneCourante = explode("_", $maLigneCochee); $monId = $maLigneCourante[0]; $monNumLigne = $maLigneCourante[1]; $monCompte = $mesCodesVentilChoisis[$monNumLigne]; - + $sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; $sql .= " SET fk_code_ventilation = " . $monCompte; $sql .= " WHERE rowid = " . $monId; - + dol_syslog('accountancy/supplier/list.php:: sql=' . $sql); if ($db->query($sql)) { print '
' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '
'; } else { print '
' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '
' . $sql . '
'; } - + $cpt ++; } } else { @@ -113,7 +114,9 @@ $sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON p.accountancy_code_buy = aa.account_number"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version"; $sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation = 0"; +$sql .= " AND (accsys.rowid='".$conf->global->CHARTOFACCOUNTS."' OR p.accountancy_code_sell IS NULL)"; if (! empty($conf->multicompany->enabled)) { $sql .= " AND f.entity = '" . $conf->entity . "'"; @@ -130,15 +133,15 @@ $result = $db->query($sql); if ($result) { $num_lines = $db->num_rows($result); $i = 0; - + // TODO : print_barre_liste always use $conf->liste_limit and do not care about custom limit in list... print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines); - + print '
'; - + print '' . "\n"; print ''; - + print '

' . $langs->trans("DescVentilTodoSupplier") . '
'; print ''; print ''; @@ -149,22 +152,22 @@ if ($result) { print ''; print ''; print "\n"; - + $facturefourn_static = new FactureFournisseur($db); $productfourn_static = new ProductFournisseur($db); $form = new Form($db); - + $var = True; while ( $i < min($num_lines, $limit) ) { $objp = $db->fetch_object($result); $var = ! $var; print ""; - + // Ref facture $facturefourn_static->ref = $objp->ref; $facturefourn_static->id = $objp->facid; print ''; - + // Ref facture supplier $productfourn_static->ref = $objp->product_ref; $productfourn_static->id = $objp->product_id; @@ -175,40 +178,38 @@ if ($result) { else print ' '; print ''; - - // print ''; - - // print ''; - + + // print ''; + + // print ''; + print ''; - + print ''; - + print ''; - + print ''; - + // Colonne choix du compte print ''; // Colonne choix ligne a ventiler print ''; - + print ""; $i ++; } - - print ''; - - print "
Facture' . $langs->trans("Ref") . '' . $langs->trans("IntoAccount") . '' . $langs->trans("Ventilate") . '
' . $facturefourn_static->getNomUrl(1) . ''.$objp->ref.''.$objp->ref_supplier.''.$objp->ref.''.$objp->ref_supplier.'' . dol_trunc($objp->product_label, 24) . '' . stripslashes(nl2br($objp->description)) . ''; print price($objp->price); print ''; print $objp->code_buy; print ''; print $formventilation->select_account($objp->aarowid, 'codeventil[]', 1); print ''; - print 'code_buy ? "checked" : "") . '/>'; + print 'aarowid ? "checked" : "") . '/>'; print '
 
"; - + + print ''; + print '
'; print ''; } else { print $db->error(); diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 670260f1287..f86e19050e4 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -53,7 +53,7 @@ if ($action == 'update' || $action == 'add') $constname=GETPOST('constname','alpha'); $constvalue=(GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue')); - if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE') && $constvalue == -1) $constvalue=''; + if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE' || $constname=='ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) $constvalue=''; if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice { if ($constvalue) $constvalue=0; @@ -209,6 +209,23 @@ if ($conf->facture->enabled) } print "\n"; print ''; + + if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) + { + $var=!$var; + print '
'; + print ''; + print ''; + print ''; + print ''.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").''; + print ''; + print $form->select_produits($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS, 'constvalue_ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS'); + print ''; + print ''; + print ''; + } + print "\n"; + print '
'; } print ''; diff --git a/htdocs/adherents/admin/adherent_type_extrafields.php b/htdocs/adherents/admin/adherent_type_extrafields.php index b2f839e3c3c..627d96acf17 100644 --- a/htdocs/adherents/admin/adherent_type_extrafields.php +++ b/htdocs/adherents/admin/adherent_type_extrafields.php @@ -7,7 +7,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * 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, @@ -17,6 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . + * or see http://www.gnu.org/ */ /** diff --git a/htdocs/adherents/admin/public.php b/htdocs/adherents/admin/public.php index 740a5c97879..0f92e017437 100644 --- a/htdocs/adherents/admin/public.php +++ b/htdocs/adherents/admin/public.php @@ -203,9 +203,9 @@ if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled)) print ''; -print '
'; -print '
'; -print '
'; +print '
'; +print ''; +print '
'; print ''; diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index f1a18c5e4bf..343c8c4a628 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -44,6 +44,8 @@ $object = new Adherent($db); $result=$object->fetch($id); if ($result > 0) { + $object->fetch_thirdparty(); + $adht = new AdherentType($db); $result=$adht->fetch($object->typeid); } @@ -84,7 +86,7 @@ if ($object->id > 0) print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Reference print ''; @@ -139,14 +141,30 @@ if ($object->id > 0) if (! empty($conf->agenda->enabled)) { - print ''; + print ''; } print ''; print '
'; - print load_fiche_titre($langs->trans("ActionsOnMember"),'',''); + $out=''; + + /*$objthirdparty=$object->thirdparty; + $objcon=new stdClass(); + + $permok=$user->rights->agenda->myactions->create; + if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok) + { + $out.=''; + $out.=$langs->trans("AddAnAction").' '; + $out.=img_picto($langs->trans("AddAnAction"),'filenew'); + $out.=""; + }*/ + + print load_fiche_titre($langs->trans("ActionsOnMember"),$out,''); // List of todo actions show_actions_todo($conf,$langs,$db,$object); diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php index 9bd164a9b32..cf89e1f526c 100644 --- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php +++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php @@ -94,7 +94,7 @@ abstract class ActionsAdherentCardCommon /** * Load data control * - * @param string &$action Type of action + * @param string $action Type of action * @param int $id Id of object * @return void */ @@ -130,7 +130,7 @@ abstract class ActionsAdherentCardCommon } else { - $this->errors=$nuser->error; + $this->errors[]=$nuser->error; $this->db->rollback(); } @@ -228,7 +228,7 @@ abstract class ActionsAdherentCardCommon /** * Set content of ->tpl array, to use into template * - * @param string &$action Type of action + * @param string $action Type of action * @param int $id Id * @return string HTML output */ diff --git a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php index b88e4b2134f..5c40cb22954 100644 --- a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php +++ b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php @@ -76,7 +76,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon /** * Assign custom values for canvas * - * @param string &$action Type of action + * @param string $action Type of action * @param int $id Id * @return void */ diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/card.php similarity index 95% rename from htdocs/adherents/fiche.php rename to htdocs/adherents/card.php index 777cead2469..a4463766278 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/card.php @@ -21,7 +21,7 @@ */ /** - * \file htdocs/adherents/fiche.php + * \file htdocs/adherents/card.php * \ingroup member * \brief Page of member */ @@ -70,7 +70,7 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); // Get object canvas (By default, this is not defined, so standard usage of dolibarr) $object->getCanvas($rowid); $canvas = $object->canvas?$object->canvas:GETPOST("canvas"); -$objcanvas=''; +$objcanvas=null; if (! empty($canvas)) { require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; @@ -79,7 +79,7 @@ if (! empty($canvas)) } // Security check -$result=restrictedArea($user,'adherent',$rowid,'','','fk_soc', 'rowid', $objcanvas); +$result=restrictedArea($user, 'adherent', $rowid, '', '', 'fk_soc', 'rowid', $objcanvas); if ($rowid > 0) { @@ -108,7 +108,7 @@ if ($rowid) } // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('membercard')); +$hookmanager->initHooks(array('membercard','globalcard')); /* @@ -117,6 +117,7 @@ $hookmanager->initHooks(array('membercard')); $parameters=array('rowid'=>$rowid, 'objcanvas'=>$objcanvas); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer)) { @@ -290,8 +291,6 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer) //$object->note = trim($_POST["comment"]); $object->morphy = $_POST["morphy"]; - $object->amount = $_POST["amount"]; - if (GETPOST('deletephoto')) $object->photo=''; elseif (! empty($_FILES['photo']['name'])) $object->photo = dol_sanitizeFileName($_FILES['photo']['name']); @@ -459,7 +458,7 @@ if ($action == 'add' && $user->rights->adherent->creer) $object->email = $email; $object->login = $login; $object->pass = $pass; - $object->naiss = $birthdate; + $object->birth = $birthdate; $object->photo = $photo; $object->typeid = $typeid; //$object->note = $comment; @@ -564,7 +563,7 @@ if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confir } else { - header("Location: liste.php"); + header("Location: list.php"); exit; } } @@ -722,7 +721,7 @@ else { /* ************************************************************************** */ /* */ - /* Fiche creation */ + /* Creation card */ /* */ /* ************************************************************************** */ $object->canvas=$canvas; @@ -882,7 +881,7 @@ else // Birthday print "\n"; // Profil public @@ -916,7 +915,7 @@ else print "
'.$langs->trans('Ref').'
".$langs->trans("Birthday")."\n"; - $form->select_date(($object->naiss ? $object->naiss : -1),'naiss','','',1,'formsoc'); + $form->select_date(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc'); print "
\n"; print '
'; - print '
'; + print '
'; print "\n"; @@ -1165,11 +1164,11 @@ else print ''; - print '
'; + print '
'; print ''; - print '       '; + print '     '; print ''; - print ''; print ''; @@ -1284,13 +1283,13 @@ else if (! empty($conf->mailman->enabled) && ! empty($conf->global->ADHERENT_USE_SPIP)) { $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"),'value'=>''); } - print $form->formconfirm("fiche.php?rowid=".$rowid,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1); + print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1); } // Confirm send card by mail if ($action == 'sendinfo') { - print $form->formconfirm("fiche.php?rowid=".$rowid,$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail",$object->email),"confirm_sendinfo",'',0,1); + print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail",$object->email),"confirm_sendinfo",'',0,1); } // Confirm resiliate @@ -1321,7 +1320,7 @@ else $formquestion=array(); if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?'true':'false')); if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])); - print $form->formconfirm("fiche.php?rowid=".$rowid,$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion); + print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion); } // Confirm remove member @@ -1329,7 +1328,7 @@ else { $formquestion=array(); if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])); - print $form->formconfirm("fiche.php?rowid=".$rowid,$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete",$formquestion,0,1); + print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete",$formquestion,0,1); } /* @@ -1337,7 +1336,7 @@ else */ if ($action == 'add_spip') { - print $form->formconfirm("fiche.php?rowid=".$rowid, $langs->trans('AddIntoSpip'), $langs->trans('AddIntoSpipConfirmation'), 'confirm_add_spip'); + print $form->formconfirm("card.php?rowid=".$rowid, $langs->trans('AddIntoSpip'), $langs->trans('AddIntoSpipConfirmation'), 'confirm_add_spip'); } /* @@ -1345,7 +1344,7 @@ else */ if ($action == 'del_spip') { - print $form->formconfirm("fiche.php?rowid=$rowid", $langs->trans('DeleteIntoSpip'), $langs->trans('DeleteIntoSpipConfirmation'), 'confirm_del_spip'); + print $form->formconfirm("card.php?rowid=$rowid", $langs->trans('DeleteIntoSpip'), $langs->trans('DeleteIntoSpipConfirmation'), 'confirm_del_spip'); } $rowspan=17; @@ -1355,7 +1354,7 @@ else print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print ''; @@ -1543,7 +1542,7 @@ else // Modify if ($user->rights->adherent->creer) { - print '"; + print '"; } else { @@ -1555,7 +1554,7 @@ else { if ($user->rights->adherent->creer) { - print '\n"; + print '\n"; } else { @@ -1568,7 +1567,7 @@ else { if ($user->rights->adherent->creer) { - print '\n"; + print '\n"; } else { @@ -1581,7 +1580,7 @@ else { if ($object->statut >= 1) { - if ($object->email) print '\n"; + if ($object->email) print '\n"; else print '\n"; } else @@ -1599,7 +1598,7 @@ else { if ($user->rights->adherent->supprimer) { - print '\n"; + print '\n"; } else { @@ -1638,7 +1637,7 @@ else // Delete if ($user->rights->adherent->supprimer) { - print '\n"; + print '\n"; } else { @@ -1652,11 +1651,11 @@ else if ($isinspip == 1) { - print '\n"; + print '\n"; } if ($isinspip == 0) { - print '\n"; + print '\n"; } } diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index c3fdd1176a1..c01d3b5bc6b 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; @@ -276,7 +277,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ $db->begin(); // Create subscription - $crowid=$object->cotisation($datecotisation, $cotisation, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend, $option); + $crowid=$object->cotisation($datecotisation, $cotisation, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend); if ($crowid <= 0) { $error++; @@ -299,7 +300,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ $insertid=$acct->addline($dateop, $operation, $label, $cotisation, $num_chq, '', $user, $emetteur_nom, $emetteur_banque); if ($insertid > 0) { - $inserturlid=$acct->add_url_line($insertid, $object->id, DOL_URL_ROOT.'/adherents/fiche.php?rowid=', $object->getFullname($langs), 'member'); + $inserturlid=$acct->add_url_line($insertid, $object->id, DOL_URL_ROOT.'/adherents/card.php?rowid=', $object->getFullname($langs), 'member'); if ($inserturlid > 0) { // Met a jour la table cotisation @@ -315,13 +316,13 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ } } else - { + { $error++; $errmsg=$acct->error; } } else - { + { $error++; $errmsg=$acct->error; } @@ -385,6 +386,8 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ { // Add line to draft invoice $idprodsubscription=0; + if (! empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) $idprodsubscription = $conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS; + $vattouse=0; if (isset($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) && $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS == 'defaultforfoundationcountry') { @@ -482,7 +485,8 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ } // Generate PDF (whatever is option MAIN_DISABLE_PDF_AUTOUPDATE) so we can include it into email //if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - facture_pdf_create($db, $invoice, $invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + + $invoice->generateDocument($invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } @@ -554,7 +558,7 @@ if ($rowid) print ''; print '
'.$langs->trans("Ref").'
'; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print ''; @@ -946,9 +950,10 @@ if ($rowid) print ''; // Label - print ''; - print ''; + print ''; + print ''; // Complementary action if (! empty($conf->banque->enabled) || ! empty($conf->facture->enabled)) @@ -989,7 +994,13 @@ if ($rowid) print $langs->trans("CreateDolibarrThirdParty"); print ')'; } - if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription",0).'.'; + if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription",0); + if (! empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) + { + $prodtmp=new Product($db); + $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS); + print '. '.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(0)); + } print '
'; } // Add invoice with payments @@ -1008,7 +1019,13 @@ if ($rowid) print $langs->trans("CreateDolibarrThirdParty"); print ')'; } - if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription",0).'.'; + if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription",0); + if (! empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) + { + $prodtmp=new Product($db); + $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS); + print '. '.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(0)); + } print '
'; } print ''; @@ -1077,11 +1094,11 @@ if ($rowid) print '
'.$langs->trans("Ref").'
'.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency).'
'.$langs->trans("Label").'
'.$langs->trans("Label").'
'; print '
'; - print '
'; + print '
'; print ''; - print '     '; + print '     '; print ''; - print '
'; + print '
'; print ''; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 2de6a6e159e..b7c65c3bbeb 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2009-2012 Regis Houssin + * Copyright (C) 2014 Alexandre Spangaro * * 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 @@ -124,7 +125,7 @@ class Adherent extends CommonObject /** - * Fonction envoyant un email a l'adherent avec le texte fourni en parametre. + * Function sending an email has the adherent with the text supplied in parameter. * * @param string $text Content of message (not html entities encoded) * @param string $subject Subject of message @@ -247,9 +248,9 @@ class Adherent extends CommonObject /** - * Renvoie le libelle traduit de la nature d'un adherent (physique ou morale) + * Return translated label by the nature of a adherent (physical or moral) * - * @param string $morphy Nature physique ou morale de l'adherent + * @param string $morphy Nature of the adherent (physical or moral) * @return string Label */ function getmorphylib($morphy='') @@ -464,8 +465,11 @@ class Adherent extends CommonObject $nbrowsaffected+=$this->db->affected_rows($resql); + $action='update'; + // Actions on extra fields (by external module) - $hookmanager->initHooks(array('memberdao')); + // FIXME le hook fait double emploi avec le trigger !! + $hookmanager->initHooks(array('memberdao')); $parameters=array('id'=>$this->id); $action=''; $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks @@ -1041,7 +1045,7 @@ class Adherent extends CommonObject * @param int $rowid Id of object to load * @param string $ref To load member from its ref * @param int $fk_soc To load member from its link to third party - * @param int $ref_ext External reference + * @param string $ref_ext External reference * @return int >0 if OK, 0 if not found, <0 if KO */ function fetch($rowid,$ref='',$fk_soc='',$ref_ext='') @@ -1090,7 +1094,7 @@ class Adherent extends CommonObject $this->ref = $obj->rowid; $this->id = $obj->rowid; $this->ref_ext = $obj->ref_ext; - $this->civility_id = $obj->civility; + $this->civility_id = $obj->civility_id; $this->firstname = $obj->firstname; $this->lastname = $obj->lastname; $this->login = $obj->login; @@ -1302,7 +1306,7 @@ class Adherent extends CommonObject return $rowid; } else - { + { $this->db->rollback(); return -2; } @@ -1558,7 +1562,7 @@ class Adherent extends CommonObject if ($option == 'card') { - $lien = ''; + $lien = ''; $lienfin=''; } if ($option == 'subscription') @@ -1568,14 +1572,14 @@ class Adherent extends CommonObject } if ($option == 'category') { - $lien = ''; - $lienfin=''; + $lien = ''; + $lienfin=''; } $picto='user'; $label=$langs->trans("ShowMember"); - if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); + if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; $result.=$lien.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$lienfin; return $result; diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 43a272cf574..17f61bb27ba 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -119,7 +119,7 @@ class AdherentType extends CommonObject if ($result) { $action='update'; - + // Actions on extra fields (by external module or standard code) $hookmanager->initHooks(array('membertypedao')); $parameters=array('membertype'=>$this->id); @@ -151,21 +151,23 @@ class AdherentType extends CommonObject * Fonction qui permet de supprimer le status de l'adherent * * @param int $rowid Id of member type to delete - * @return int >0 if OK, < 0 if KO + * @return int >0 if OK, 0 if not found, < 0 if KO */ - function delete($rowid) + function delete($rowid='') { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type WHERE rowid = $rowid"; + if (empty($rowid)) $rowid=$this->id; + + $sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type WHERE rowid = ".$rowid; $resql=$this->db->query($sql); if ($resql) { - if ( $this->db->affected_rows($resql) ) + if ($this->db->affected_rows($resql)) { return 1; } else - { + { return 0; } } @@ -275,7 +277,7 @@ class AdherentType extends CommonObject $picto='group'; $label=$langs->trans("ShowTypeCard",$this->libelle); - if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); + if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; $result.=$lien.($maxlen?dol_trunc($this->libelle,$maxlen):$this->libelle).$lienfin; return $result; diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index 24a56d5e7c7..e64a67d445d 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -48,7 +48,6 @@ class AdherentStats extends Stats * @param DoliDB $db Database handler * @param int $socid Id third party * @param int $userid Id user for filter - * @return AdherentStats */ function __construct($db, $socid=0, $userid=0) { diff --git a/htdocs/adherents/class/cotisation.class.php b/htdocs/adherents/class/cotisation.class.php index 5193a729970..660be1f397a 100644 --- a/htdocs/adherents/class/cotisation.class.php +++ b/htdocs/adherents/class/cotisation.class.php @@ -271,7 +271,7 @@ class Cotisation extends CommonObject $picto='payment'; $label=$langs->trans("ShowSubscription"); - if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); + if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; $result.=$lien.$this->ref.$lienfin; return $result; diff --git a/htdocs/adherents/cotisations.php b/htdocs/adherents/cotisations.php index 2bb7a438f3e..160f47365fa 100644 --- a/htdocs/adherents/cotisations.php +++ b/htdocs/adherents/cotisations.php @@ -97,17 +97,17 @@ if ($result) print ''; print ''; - print_liste_field_titre($langs->trans("Ref"),"cotisations.php","c.rowid",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Name"),"cotisations.php","d.lastname",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Login"),"cotisations.php","d.login",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),"cotisations.php","c.note",$param,"",'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"c.rowid",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"c.note",$param,"",'align="left"',$sortfield,$sortorder); if (! empty($conf->banque->enabled)) { - print_liste_field_titre($langs->trans("Account"),"cotisations.php","b.fk_account",$pram,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"b.fk_account",$pram,"","",$sortfield,$sortorder); } - print_liste_field_titre($langs->trans("Date"),"cotisations.php","c.dateadh",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateEnd"),"cotisations.php","c.datef",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Amount"),"cotisations.php","c.cotisation",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"c.cotisation",$param,"",'align="right"',$sortfield,$sortorder); print "\n"; // Static objects diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index a3d7fe1cb40..1d780eb21a5 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -113,7 +113,7 @@ if ($id > 0) print '
'; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print ''; diff --git a/htdocs/adherents/fiche_subscription.php b/htdocs/adherents/fiche_subscription.php index 01a3ccc83fc..6f0177d4b6f 100644 --- a/htdocs/adherents/fiche_subscription.php +++ b/htdocs/adherents/fiche_subscription.php @@ -180,7 +180,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') $head[$h][2] = 'info'; $h++; - dol_fiche_head($head, 'general', $langs->trans("Subscription")); + dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment'); print "\n"; print ''; diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index eff3f85fdf6..62e54c17948 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -127,7 +127,7 @@ print '
'; // Formulaire recherche adherent -print ''; +print ''; print ''; print ''; print '
'.$langs->trans("Ref").'
'; @@ -159,7 +159,7 @@ if ($conf->use_javascript_ajax) print '
'; print '
'; print ''; - print ''; - print "\n"; - print ''; + print "\n"; $var=True; while ($i < $num && $i < $conf->liste_limit) @@ -294,7 +293,7 @@ if ($resql) print "\n"; // Lastname - print ""; @@ -366,6 +365,7 @@ if ($resql) } print "
'.$langs->trans("Statistics").'
'; + print '
'; $SommeA=0; $SommeB=0; diff --git a/htdocs/adherents/liste.php b/htdocs/adherents/list.php similarity index 95% rename from htdocs/adherents/liste.php rename to htdocs/adherents/list.php index e5715bff99b..b88a39c76af 100644 --- a/htdocs/adherents/liste.php +++ b/htdocs/adherents/list.php @@ -19,7 +19,7 @@ */ /** - * \file htdocs/adherents/liste.php + * \file htdocs/adherents/list.php * \ingroup member * \brief Page to list all members of foundation */ @@ -59,7 +59,7 @@ $pagenext = $page + 1; if (! $sortorder) { $sortorder=($filter=='outofdate'?"ASC":"DESC"); } if (! $sortfield) { $sortfield=($filter=='outofdate'?"d.datefin":"d.lastname"); } -if (GETPOST("button_removefilter")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search=""; $search_ref=""; @@ -263,8 +263,7 @@ if ($resql) print ''; print '
rowid\">"; + print "rowid\">"; print ((! empty($objp->lastname) || ! empty($objp->firstname)) ? dol_trunc($memberstatic->getFullName($langs)) : ''); print (((! empty($objp->lastname) || ! empty($objp->firstname)) && ! empty($companyname)) ? ' / ' : ''); print (! empty($companyname) ? dol_trunc($companyname, 32) : ''); @@ -348,16 +347,16 @@ if ($resql) print ''; if ($user->rights->adherent->creer) { - print "rowid."&action=edit&backtopage=1\">".img_edit().""; + print "rowid."&action=edit&backtopage=1\">".img_edit().""; } print ' '; if ($user->rights->adherent->supprimer && $objp->statut == -1) { - print "rowid."&action=delete&backtopage=1\">".img_picto($langs->trans("Delete"),'disable.png').""; + print "rowid."&action=delete&backtopage=1\">".img_picto($langs->trans("Delete"),'disable.png').""; } if ($user->rights->adherent->supprimer && $objp->statut == 1) { - print "rowid."&action=resign&backtopage=1\">".img_picto($langs->trans("Resiliate"),'disable.png').""; + print "rowid."&action=resign&backtopage=1\">".img_picto($langs->trans("Resiliate"),'disable.png').""; } print "
\n"; + print ''; if ($num > $conf->liste_limit) { diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index 96ccd19b928..727b3a9bcdc 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -87,7 +87,7 @@ if ($id) print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Reference print ''; diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 736f6ef0140..938e3e172b2 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -23,6 +23,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $graphwidth=DolGraph::getDefaultGraphSizeForStats('width',700); @@ -69,7 +70,7 @@ dol_mkdir($dir); if ($mode) { - // Define sql + // Define sql if ($mode == 'memberbycountry') { $label=$langs->trans("Country"); diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 7dc0a43ac26..a17350a379d 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -70,7 +70,7 @@ if (GETPOST('button_removefilter')) // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('membertypecard')); +$hookmanager->initHooks(array('membertypecard','globalcard')); /* * Actions @@ -271,9 +271,11 @@ if ($action == 'create') } print "
'.$langs->trans('Ref').'
\n"; - print '
'; - print '
    '; - print '
'; + print '
'; + print ''; + print '     '; + print ''; + print '
'; print "\n"; } @@ -353,7 +355,7 @@ if ($rowid > 0) } // Add - print ''; + print ''; // Delete if ($user->rights->adherent->configurer) @@ -364,7 +366,7 @@ if ($rowid > 0) print ""; - // Show list of members (nearly same code than in page liste.php) + // Show list of members (nearly same code than in page list.php) $membertypestatic=new AdherentType($db); @@ -526,11 +528,11 @@ if ($rowid > 0) print ''; if ($objp->societe != '') { - print ''.img_object($langs->trans("ShowMember"),"user").' '.$adh->getFullName($langs,0,-1,20).' / '.dol_trunc($objp->societe,12).''."\n"; + print ''.img_object($langs->trans("ShowMember"),"user").' '.$adh->getFullName($langs,0,-1,20).' / '.dol_trunc($objp->societe,12).''."\n"; } else { - print ''.img_object($langs->trans("ShowMember"),"user").' '.$adh->getFullName($langs,0,-1,32).''."\n"; + print ''.img_object($langs->trans("ShowMember"),"user").' '.$adh->getFullName($langs,0,-1,32).''."\n"; } // Login @@ -588,12 +590,12 @@ if ($rowid > 0) print ''; if ($user->rights->adherent->creer) { - print ''.img_edit().''; + print ''.img_edit().''; } print ' '; if ($user->rights->adherent->supprimer) { - print ''.img_picto($langs->trans("Resiliate"),'disable.png').''; + print ''.img_picto($langs->trans("Resiliate"),'disable.png').''; } print ""; @@ -678,8 +680,11 @@ if ($rowid > 0) print '

'; } - print '
   '; - print '
'; + print '
'; + print ''; + print '     '; + print ''; + print '
'; print ""; } diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index c7cb4258935..5d10f4614cc 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -154,7 +154,7 @@ print ''; print ''.$langs->trans("ActionsEvents").''; print ''.$langs->trans("All").'/'.$langs->trans("None").''; print ''."\n"; -// Show each trigger +// Show each trigger (list is in c_action_trigger) if (! empty($triggers)) { foreach ($triggers as $trigger) @@ -184,9 +184,9 @@ if (! empty($triggers)) } print ''; -print '
'; +print '
'; print ''; -print "
"; +print ""; print "\n"; diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 6b683c8b52b..d6ddf70528b 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -220,9 +220,9 @@ while ($i <= $MAXAGENDA) print ''; print '
'; -print '
'; -print "trans("Save")."\">"; -print "
"; +print '
'; +print ''; +print '
'; print "\n"; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index a069a0718c9..033c5d35c18 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -157,7 +157,7 @@ print ''."\n"; print ''; -print '
'; +print '
'; print ''; diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index dc7c4cb3d79..ecf49c01201 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -136,13 +136,13 @@ print ""; print ''; -print '
'; +print '
'; print "trans("Save")."\">"; -print "
"; +print ""; print "\n"; -print ''; +dol_fiche_end(); clearstatcache(); @@ -171,9 +171,11 @@ $message.='
'; print $message; $message=$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'
'; -$message.=$langs->trans("AgendaUrlOptions2",$user->login,$user->login).'
'; +//$message.=$langs->trans("AgendaUrlOptions2",$user->login,$user->login).'
'; $message.=$langs->trans("AgendaUrlOptions3",$user->login,$user->login).'
'; $message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'
'; +$message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login); + print info_admin($message); if (! empty($conf->use_javascript_ajax)) diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index de1f7662373..a63e310a9b3 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -1,7 +1,7 @@ * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2013 Philippe Grand + * Copyright (C) 2013-2014 Philippe Grand * * 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 @@ -26,6 +26,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $langs->load("admin"); @@ -86,9 +87,15 @@ $form=new Form($db); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("BankSetupModule"),$linkback,'setup'); -print '
'; +print '
'; +print ''; +print ''; + +$head = bank_admin_prepare_head(null); +dol_fiche_head($head, 'general', $langs->trans("BankSetupModule"), 0, 'account'); + print ''; print ''; print ''; @@ -98,9 +105,7 @@ print "\n"; $var=true; $var=! $var; -print ''; -print ''; -print ''; + print '
'.$langs->trans("Parameters").'
'; print $langs->trans("FreeLegalTextOnChequeReceipts").' ('.$langs->trans("AddCRIfTooLong").')
'; print ''; @@ -184,6 +189,10 @@ while ($i < $nbofbank) print '
'."\n"; -$db->close(); +dol_fiche_end(); + +print '
'; llxFooter(); + +$db->close(); diff --git a/htdocs/admin/bank_extrafields.php b/htdocs/admin/bank_extrafields.php new file mode 100644 index 00000000000..c896ecc5c48 --- /dev/null +++ b/htdocs/admin/bank_extrafields.php @@ -0,0 +1,154 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2014 Florian Henry + * + * 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 . + */ + +/** + * \file htdocs/admin/bank_extrafields.php + * \ingroup bank + * \brief Page to setup extra fields of bank + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + +$langs->load("banks"); +$langs->load("admin"); + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label=ExtraFields::$type2label; +$type2label=array(''); +foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); + +$action=GETPOST('action', 'alpha'); +$attrname=GETPOST('attrname', 'alpha'); +$elementtype='bank_account'; //Must be the $element of the class that manage extrafield + +if (!$user->admin) accessforbidden(); + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + +llxHeader('',$langs->trans("BankSetupModule"),$help_url); + + +$linkback=''.$langs->trans("BackToModuleList").''; +print_fiche_titre($langs->trans("BankSetupModule"),$linkback,'setup'); + + +$head = bank_admin_prepare_head(null); + +dol_fiche_head($head, 'attributes', $langs->trans("BankSetupModule"), 0, 'account'); + + +print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; +print '
'; + +// Load attribute_label +$extrafields->fetch_name_optionals_label($elementtype); + +print ""; + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; + +$var=True; +foreach($extrafields->attribute_type as $key => $value) +{ + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print '\n"; + print '\n"; + print '\n"; + print '\n"; + print ""; + // $i++; +} + +print "
'.$langs->trans("Position").''.$langs->trans("Label").''.$langs->trans("AttributeCode").''.$langs->trans("Type").''.$langs->trans("Size").''.$langs->trans("Unique").''.$langs->trans("Required").' 
".$extrafields->attribute_pos[$key]."".$extrafields->attribute_label[$key]."".$key."".$type2label[$extrafields->attribute_type[$key]]."'.$extrafields->attribute_size[$key]."'.yn($extrafields->attribute_unique[$key])."'.yn($extrafields->attribute_required[$key])."'.img_edit().''; + print "  ".img_delete()."
"; + +dol_fiche_end(); + + +// Buttons +if ($action != 'create' && $action != 'edit') +{ + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; +} + + +/* ************************************************************************** */ +/* */ +/* Creation d'un champ optionnel + /* */ +/* ************************************************************************** */ + +if ($action == 'create') +{ + print "
"; + print_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +/* ************************************************************************** */ +/* */ +/* Edition d'un champ optionnel */ +/* */ +/* ************************************************************************** */ +if ($action == 'edit' && ! empty($attrname)) +{ + print "
"; + print_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +llxFooter(); + +$db->close(); diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 78c99916910..00a84fc5cbc 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -318,7 +318,6 @@ if (! isset($_SERVER['WINDIR'])) print ''; print ''; print ''; - print ''; } // Module products @@ -350,6 +349,7 @@ if (! empty($conf->societe->enabled)) } print "\n"; +print ''; print '
'; @@ -396,7 +396,7 @@ if ($conf->produit->enabled) $var = !$var; print ''; - print ''.$modBarCode->nom."\n"; + print ''.(isset($modBarCode->name)?$modBarCode->name:$modBarCode->nom)."\n"; print $modBarCode->info($langs); print ''; print ''.$modBarCode->getExample($langs)."\n"; diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index c88d7717084..8b6d833778e 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -46,92 +46,97 @@ $boxes = array(); */ if ($action == 'addconst') - { dolibarr_set_const($db, "MAIN_BOXES_MAXLINES",$_POST["MAIN_BOXES_MAXLINES"],'',0,'',$conf->entity); } -if ($action == 'add') -{ +if ($action == 'add') { $error=0; - $db->begin(); + if (isset($_POST['boxid']) && is_array($_POST['boxid'])) + { + foreach($_POST['boxid'] as $boxid) + { + if (is_numeric($boxid['pos']) && $boxid['pos'] >= 0) // 0=Home, 1=... + { + $pos = $boxid['pos']; - // Initialize distinct fkuser with all already existing values of fk_user (user that use a personalized view of boxes for page "pos") - $distinctfkuser=array(); - if (! $error) - { - $sql = "SELECT fk_user"; - $sql.= " FROM ".MAIN_DB_PREFIX."user_param"; - $sql.= " WHERE param = 'MAIN_BOXES_".$db->escape(GETPOST("pos","alpha"))."' AND value = '1'"; - $sql.= " AND entity = ".$conf->entity; - $resql = $db->query($sql); - dol_syslog("boxes.php search fk_user to activate box for", LOG_DEBUG); - if ($resql) - { - $num = $db->num_rows($resql); - $i=0; - while ($i < $num) - { - $obj=$db->fetch_object($resql); - $distinctfkuser[$obj->fk_user]=$obj->fk_user; - $i++; - } - } - else - { - setEventMessage($db->lasterror(), 'errors'); - $error++; - } - } + // Initialize distinct fkuser with all already existing values of fk_user (user that use a personalized view of boxes for page "pos") + $distinctfkuser=array(); + if (! $error) + { + $sql = "SELECT fk_user"; + $sql.= " FROM ".MAIN_DB_PREFIX."user_param"; + $sql.= " WHERE param = 'MAIN_BOXES_".$db->escape($pos)."' AND value = '1'"; + $sql.= " AND entity = ".$conf->entity; + dol_syslog("boxes.php search fk_user to activate box for", LOG_DEBUG); + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i=0; + while ($i < $num) + { + $obj=$db->fetch_object($resql); + $distinctfkuser[$obj->fk_user]=$obj->fk_user; + $i++; + } + } + else + { + setEventMessage($db->lasterror(), 'errors'); + $error++; + } + } - $distinctfkuser['0']='0'; // Add entry for fk_user = 0. We must use string as key and val + $distinctfkuser['0']='0'; // Add entry for fk_user = 0. We must use string as key and val - foreach($distinctfkuser as $fk_user) - { - if (! $error && $fk_user != '') - { - $nbboxonleft=$nbboxonright=0; - $sql = "SELECT box_order FROM ".MAIN_DB_PREFIX."boxes WHERE position = ".GETPOST("pos","alpha")." AND fk_user = ".$fk_user." AND entity = ".$conf->entity; - dol_syslog("boxes.php activate box", LOG_DEBUG); - $resql = $db->query($sql); - if ($resql) - { - while($obj = $db->fetch_object($resql)) - { - $boxorder=$obj->box_order; - if (preg_match('/A/',$boxorder)) $nbboxonleft++; - if (preg_match('/B/',$boxorder)) $nbboxonright++; - } - } - else dol_print_error($db); + foreach($distinctfkuser as $fk_user) + { + if (! $error && $fk_user != '') + { + $nbboxonleft=$nbboxonright=0; + $sql = "SELECT box_order FROM ".MAIN_DB_PREFIX."boxes WHERE position = ".$pos." AND fk_user = ".$fk_user." AND entity = ".$conf->entity; + dol_syslog("boxes.php activate box", LOG_DEBUG); + $resql = $db->query($sql); + if ($resql) + { + while($obj = $db->fetch_object($resql)) + { + $boxorder=$obj->box_order; + if (preg_match('/A/',$boxorder)) $nbboxonleft++; + if (preg_match('/B/',$boxorder)) $nbboxonright++; + } + } + else dol_print_error($db); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes ("; - $sql.= "box_id, position, box_order, fk_user, entity"; - $sql.= ") values ("; - $sql.= GETPOST("boxid","int").", ".GETPOST("pos","alpha").", '".(($nbboxonleft > $nbboxonright) ? 'B01' : 'A01')."', ".$fk_user.", ".$conf->entity; - $sql.= ")"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes ("; + $sql.= "box_id, position, box_order, fk_user, entity"; + $sql.= ") values ("; + $sql.= $boxid['value'].", ".$pos.", '".(($nbboxonleft > $nbboxonright) ? 'B01' : 'A01')."', ".$fk_user.", ".$conf->entity; + $sql.= ")"; - dol_syslog("boxes.php activate box", LOG_DEBUG); - $resql = $db->query($sql); - if (! $resql) - { - setEventMessage($db->lasterror(), 'errors'); - $error++; - } - } - } - - if (! $error) - { - header("Location: boxes.php"); - $db->commit(); - exit; - } - else - { - $db->rollback(); - } + dol_syslog("boxes.php activate box", LOG_DEBUG); + $resql = $db->query($sql); + if (! $resql) + { + setEventMessage($db->lasterror(), 'errors'); + $error++; + } + } + } + } + } + } + if (! $error) + { + $db->commit(); + $action=''; + } + else + { + $db->rollback(); + } } if ($action == 'delete') @@ -227,8 +232,8 @@ $actives = array(); $sql = "SELECT b.rowid, b.box_id, b.position, b.box_order,"; $sql.= " bd.rowid as boxid"; $sql.= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as bd"; -$sql.= " WHERE b.entity = ".$conf->entity; -$sql.= " AND b.box_id = bd.rowid"; +$sql.= " WHERE b.box_id = bd.rowid"; +$sql.= " AND b.entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")"; $sql.= " AND b.fk_user=0"; $sql.= " ORDER by b.position, b.box_order"; @@ -237,6 +242,8 @@ $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); + + // Check record to know if we must recalculate sort order $i = 0; $decalage=0; $var=false; @@ -310,19 +317,22 @@ if ($resql) $db->free($resql); } - // Available boxes to activate $boxtoadd=InfoBox::listBoxes($db,'available',-1,null,$actives); print "
\n"; +print "\n\n".''."\n"; print_titre($langs->trans("BoxesAvailable")); -print ''; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print '
'."\n"; print ''; print ''; print ''; print ''; -print ''; +print ''; print "\n"; $var=true; foreach($boxtoadd as $box) @@ -339,12 +349,10 @@ foreach($boxtoadd as $box) } print "\n".''."\n"; - print ''; - print ''; - print ''; + print ''."\n"; print ''; + print ''."\n"; print ''; - print ''; + print ''."\n"; + print ''."\n"; // Pour chaque position possible, on affiche un lien d'activation si boite non deja active pour cette position - print ''; - print ''; - print ''; + print ''."\n"; } -print '
'.$langs->trans("Box").''.$langs->trans("Note").'/'.$langs->trans("Parameters").''.$langs->trans("SourceFile").''.$langs->trans("ActivateOn").''.$langs->trans("ActivateOn").'
'.img_object("",$logo).' '.$langs->transnoentitiesnoconv($box->boxlabel); if (! empty($box->class) && preg_match('/graph_/',$box->class)) print ' ('.$langs->trans("Graph").')'; - print ''; if ($box->note == '(WarningUsingThisBoxSlowDown)') { @@ -352,27 +360,29 @@ foreach($boxtoadd as $box) print $langs->trans("WarningUsingThisBoxSlowDown"); } else print ($box->note?$box->note:' '); - print '' . $box->sourcefile . '' . $box->sourcefile . ''; - print $form->selectarray("pos",$pos_name,0,0,0,0,'',1); - print ''; - print ''; - print ' '; + print ''; + print $form->selectarray("boxid[".$box->box_id."][pos]", $pos_name, 0, 1, 0, 0, '', 1)."\n"; + print ''."\n"; print '
'; +print ''."\n"; +print '
'; +print ''; +print '
'."\n"; +print ''; +print "\n".''."\n"; // Activated boxes $boxactivated=InfoBox::listBoxes($db,'activated',-1,null); - +//var_dump($boxactivated); print "
\n\n"; print_titre($langs->trans("BoxesActivated")); @@ -419,8 +429,8 @@ foreach($boxactivated as $key => $box) $hasprevious=($key != 0); print ''.($key+1).''; print ''; - print ($hasnext?''.img_down().' ':''); - print ($hasprevious?''.img_up().'':''); + print ($hasnext?''.img_down().' ':''); + print ($hasprevious?''.img_up().'':''); print ''; print ''; print ''.img_delete().''; @@ -434,13 +444,14 @@ print '
'; // Other parameters +print "\n\n".''."\n"; print_titre($langs->trans("Other")); -print ''; - -$var=false; print ''; print ''; print ''; +print '
'; + +$var=false; print ''; print ''; print ''; @@ -457,9 +468,10 @@ print ''."\n"; print ''; -print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").''; print ''; print '
'; +print ''; +print "\n".''."\n"; llxFooter(); diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 3e85d377055..414e0ed1e99 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -94,7 +94,7 @@ print ''; print ''; -print '

'; +print '

'; print '

'; diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 1d05efa8e99..7c0d7fdbf9c 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Andre Cianfarani - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2011-2013 Philippe Grand @@ -117,8 +117,37 @@ else if ($action == 'specimen') } } +// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) +if ($action == 'setModuleOptions') +{ + $post_size=count($_POST); + + $db->begin(); + + for($i=0;$i < $post_size;$i++) + { + if (array_key_exists('param'.$i,$_POST)) + { + $param=GETPOST("param".$i,'alpha'); + $value=GETPOST("value".$i,'alpha'); + if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + } + if (! $error) + { + $db->commit(); + setEventMessage($langs->trans("SetupSaved")); + } + else + { + $db->rollback(); + setEventMessage($langs->trans("Error"),'errors'); + } +} + // Activate a model -if ($action == 'set') +else if ($action == 'set') { $ret = addDocumentModel($value, $type, $label, $scandir); } @@ -192,13 +221,34 @@ else if ($action == 'set_COMMANDE_FREE_TEXT') setEventMessage($langs->trans("Error"),'errors'); } } -else if ($action=='setModuleOptions') { - if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF_ODT_PATH",GETPOST('value1'),'chaine',0,'',$conf->entity)) - { - // La constante qui a ete lue en avant du nouveau set - // on passe donc par une variable pour avoir un affichage coherent - $conf->global->COMMANDE_ADDON_PDF_ODT_PATH = GETPOST('value1'); - } + +// Activate Set Shippable Icon In List +else if ($action=="setshippableiconinlist") { + $setshippableiconinlist = GETPOST('value','int'); + $res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist,'yesno',0,'',$conf->entity); + if (! $res > 0) $error++; + if (! $error) { + setEventMessage($langs->trans("SetupSaved")); + } else { + setEventMessage($langs->trans("Error"), 'errors'); + } +} + +// Activate ask for payment bank +else if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER') +{ + $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_ORDER",$value,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + setEventMessage($langs->trans("SetupSaved")); + } + else + { + setEventMessage($langs->trans("Error"),'errors'); + } } @@ -216,7 +266,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("OrdersSetup"),$linkback,'setup'); print '
'; -$head = order_admin_prepare_head(null); +$head = order_admin_prepare_head(); dol_fiche_head($head, 'general', $langs->trans("Orders"), 0, 'order'); @@ -298,18 +348,16 @@ foreach ($dirmodels as $reldir) $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; $commande->type=0; $nextval=$module->getNextValue($mysoc,$commande); - if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval - { - $htmltooltip.=''.$langs->trans("NextValue").': '; - if ($nextval) - { - $htmltooltip.=$nextval.'
'; - } - else - { - $htmltooltip.=$langs->trans($module->error).'
'; - } - } + if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval + $htmltooltip.=''.$langs->trans("NextValue").': '; + if ($nextval) { + if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured') + $nextval = $langs->trans($nextval); + $htmltooltip.=$nextval.'
'; + } else { + $htmltooltip.=$langs->trans($module->error).'
'; + } + } print ''; print $form->textwithpicto('',$htmltooltip,1,0); @@ -527,6 +575,52 @@ print '' print "\n"; print ''; +// Shippable Icon in List +$var=!$var; +print ""; +print ''.$langs->trans("ShippableOrderIconInList").''; +print ' '; +print ''; +if (!empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) { + print '
'; + print img_picto($langs->trans("Activated"),'switch_on'); +} else { + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); +} +print ''; +print ''; + +// Ask for payment bank during order +if ($conf->banque->enabled) +{ + $var=!$var; + print ''; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").' '; + if (! empty($conf->use_javascript_ajax)) + { + print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_ORDER'); + } + else + { + if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER)) + { + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + } + else + { + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + } + } + print ''; +} +else +{ + $var=!$var; + print ''; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").' '.$langs->trans('NotAvailable').''; +} + print ''; print '
'; diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index c774faf5caa..a349973b3dc 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -117,7 +117,7 @@ if ( ($action == 'update' && empty($_POST["cancel"])) } else dol_syslog($imgThumbMini); } - else dol_syslog($langs->trans("ErrorImageFormatNotSupported"),LOG_WARNING); + else dol_syslog("ErrorImageFormatNotSupported",LOG_WARNING); } else if (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result)) { @@ -133,9 +133,10 @@ if ( ($action == 'update' && empty($_POST["cancel"])) } } else - { + { $error++; - setEventMessage($langs->trans("ErrorOnlyPngJpgSupported"),'errors'); + $langs->load("errors"); + setEventMessage($langs->trans("ErrorBadImageFormat"),'errors'); } } } @@ -158,7 +159,7 @@ if ( ($action == 'update' && empty($_POST["cancel"])) // Local taxes dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION",$_POST["optionlocaltax1"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION",$_POST["optionlocaltax2"],'chaine',0,'',$conf->entity); - + if($_POST["optionlocaltax1"]=="localtax1on") { if(!isset($_REQUEST['lt1'])) @@ -226,13 +227,15 @@ if ($action == 'addthumb') else { $error++; - setEventMessage($langs->trans("ErrorImageFormatNotSupported"),'errors'); - dol_syslog($langs->transnoentities("ErrorImageFormatNotSupported"),LOG_WARNING); + $langs->load("errors"); + setEventMessage($langs->trans("ErrorBadImageFormat"),'errors'); + dol_syslog($langs->transnoentities("ErrorBadImageFormat"),LOG_WARNING); } } else { $error++; + $langs->load("errors"); setEventMessage($langs->trans("ErrorFileDoesNotExists",$_GET["file"]),'errors'); dol_syslog($langs->transnoentities("ErrorFileDoesNotExists",$_GET["file"]),LOG_WARNING); } @@ -601,7 +604,7 @@ if ($action == 'edit' || $action == 'updateedit') $formcompany->select_localtax(1,$conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1"); } print ''; - + print ''.$langs->trans("CalcLocaltax").': '; $opcions=array($langs->transcountry("CalcLocaltax1",$mysoc->country_code),$langs->transcountry("CalcLocaltax2",$mysoc->country_code),$langs->transcountry("CalcLocaltax3",$mysoc->country_code)); print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1); @@ -665,11 +668,11 @@ if ($action == 'edit' || $action == 'updateedit') } - print '
'; + print '
'; print ''; - print '     '; + print '     '; print ''; - print '
'; + print ''; print '
'; print ''; @@ -1003,7 +1006,7 @@ else if($conf->global->MAIN_INFO_VALUE_LOCALTAX1!=0) { print ''.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX1 .''; - } + } print ''.$langs->trans("CalcLocaltax").': '; if($conf->global->MAIN_INFO_LOCALTAX_CALC1==0) { @@ -1016,7 +1019,7 @@ else else if($conf->global->MAIN_INFO_LOCALTAX_CALC1==2){ print $langs->transcountry("CalcLocaltax3",$mysoc->country_code); } - + print ''; print ""; print "\n"; @@ -1054,7 +1057,7 @@ else if($conf->global->MAIN_INFO_VALUE_LOCALTAX2!=0) { print ''.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX2 .''; - } + } print ''.$langs->trans("CalcLocaltax").': '; if($conf->global->MAIN_INFO_LOCALTAX_CALC2==0) { @@ -1068,7 +1071,7 @@ else { print $langs->transcountry("CalcLocaltax3",$mysoc->country_code); } - + print ''; print ""; print "\n"; diff --git a/htdocs/admin/compta.php b/htdocs/admin/compta.php index 5c77149c0f0..7b041fa3991 100644 --- a/htdocs/admin/compta.php +++ b/htdocs/admin/compta.php @@ -31,45 +31,46 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; $langs->load('admin'); $langs->load('compta'); +$langs->load('accountancy'); if (!$user->admin) accessforbidden(); $action = GETPOST('action','alpha'); -// Other parameters COMPTA_* +// Other parameters ACCOUNTING_* $list = array( - 'COMPTA_PRODUCT_BUY_ACCOUNT', - 'COMPTA_PRODUCT_SOLD_ACCOUNT', - 'COMPTA_SERVICE_BUY_ACCOUNT', - 'COMPTA_SERVICE_SOLD_ACCOUNT', - 'COMPTA_VAT_ACCOUNT', - 'COMPTA_VAT_BUY_ACCOUNT', - 'COMPTA_ACCOUNT_CUSTOMER', - 'COMPTA_ACCOUNT_SUPPLIER' + 'ACCOUNTING_PRODUCT_BUY_ACCOUNT', + 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT', + 'ACCOUNTING_SERVICE_BUY_ACCOUNT', + 'ACCOUNTING_SERVICE_SOLD_ACCOUNT', + 'ACCOUNTING_VAT_ACCOUNT', + 'ACCOUNTING_VAT_BUY_ACCOUNT', + 'ACCOUNTING_ACCOUNT_CUSTOMER', + 'ACCOUNTING_ACCOUNT_SUPPLIER' ); /* * Actions */ -$compta_mode = defined('COMPTA_MODE')?COMPTA_MODE:'RECETTES-DEPENSES'; +$accounting_mode = defined('ACCOUNTING_MODE')?ACCOUNTING_MODE:'RECETTES-DEPENSES'; if ($action == 'update') { $error = 0; - $compta_modes = array( + $accounting_modes = array( 'RECETTES-DEPENSES', 'CREANCES-DETTES' ); - $compta_mode = GETPOST('compta_mode','alpha'); + $accounting_mode = GETPOST('accounting_mode','alpha'); - if (in_array($compta_mode,$compta_modes)) { + if (in_array($accounting_mode,$accounting_modes)) { - if (!dolibarr_set_const($db, 'COMPTA_MODE', $compta_mode, 'chaine', 0, '', $conf->entity)) { + if (!dolibarr_set_const($db, 'ACCOUNTING_MODE', $accounting_mode, 'chaine', 0, '', $conf->entity)) { $error++; } } else { @@ -113,12 +114,12 @@ print ''; print ''; -// Cas du parametre COMPTA_MODE +// Cas du parametre ACCOUNTING_MODE print ''; print ''; print "\n"; -print ''; +print ''; print '\n"; -print ''; +print ''; print '\n"; -print ''; print "
'.$langs->trans('OptionMode').''.$langs->trans('Description').'
'.$langs->trans('OptionModeTrue').'
'.$langs->trans('OptionModeTrue').''.nl2br($langs->trans('OptionModeTrueDesc')); // Write info on way to count VAT //if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) @@ -132,9 +133,8 @@ print ''.nl2br($langs->trans('OptionModeTrueDesc')); // // print nl2br($langs->trans('OptionModeTrueInfoExpert')); //} print "
'.$langs->trans('OptionModeVirtual').'
'.$langs->trans('OptionModeVirtual').''.nl2br($langs->trans('OptionModeVirtualDesc'))."
\n"; @@ -153,7 +153,7 @@ foreach ($list as $key) print ''; // Param - $libelle = $langs->trans($key); + $libelle = $langs->trans($key); print ''; // Value @@ -162,11 +162,10 @@ foreach ($list as $key) print ''; } -print ''; print "\n"; print '

'; - +print ''; $db->close(); llxFooter(); diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 48e637fb8a3..a64e3856dbc 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -260,7 +260,7 @@ if ($result) // Note print ''; - print ''; + print ''; print ''; // Entity limit to superadmin diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 4c3ee7207df..45d79f01ae5 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -1,6 +1,6 @@ - * Copyright (C) 2011-2013 Philippe Grand + * Copyright (C) 2011-2014 Philippe Grand * * 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 @@ -35,8 +35,9 @@ if (!$user->admin) accessforbidden(); $action = GETPOST('action','alpha'); $value = GETPOST('value','alpha'); +$label = GETPOST('label','alpha'); $scandir = GETPOST('scandir','alpha'); -$type='contrat'; +$type='contract'; if (empty($conf->global->CONTRACT_ADDON)) { @@ -111,6 +112,35 @@ else if ($action == 'specimen') // For contract } } +// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) +if ($action == 'setModuleOptions') +{ + $post_size=count($_POST); + + $db->begin(); + + for($i=0;$i < $post_size;$i++) + { + if (array_key_exists('param'.$i,$_POST)) + { + $param=GETPOST("param".$i,'alpha'); + $value=GETPOST("value".$i,'alpha'); + if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + } + if (! $error) + { + $db->commit(); + setEventMessage($langs->trans("SetupSaved")); + } + else + { + $db->rollback(); + setEventMessage($langs->trans("Error"),'errors'); + } +} + // Activate a model else if ($action == 'set') { @@ -152,30 +182,15 @@ else if ($action == 'setmod') dolibarr_set_const($db, "CONTRACT_ADDON",$value,'chaine',0,'',$conf->entity); } -else if ($action == 'set_CONTRACT_FREE_TEXT') +else if ($action == 'set_other') { $freetext= GETPOST('CONTRACT_FREE_TEXT','alpha'); - $res = dolibarr_set_const($db, "CONTRACT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); + $res1 = dolibarr_set_const($db, "CONTRACT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; - - if (! $error) - { - setEventMessage($langs->trans("SetupSaved")); - } - else - { - setEventMessage($langs->trans("Error"),'errors'); - } -} - -else if ($action == 'set_CONTRACT_DRAFT_WATERMARK') -{ $draft= GETPOST('CONTRACT_DRAFT_WATERMARK','alpha'); + $res2 = dolibarr_set_const($db, "CONTRACT_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); - $res = dolibarr_set_const($db, "CONTRACT_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); - - if (! $res > 0) $error++; + if (! $res1 > 0 || ! $res2 > 0) $error++; if (! $error) { @@ -187,12 +202,13 @@ else if ($action == 'set_CONTRACT_DRAFT_WATERMARK') } } + /* * View */ $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); - + llxHeader(); $form=new Form($db); @@ -283,18 +299,16 @@ foreach ($dirmodels as $reldir) $htmltooltip=''; $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; $nextval=$module->getNextValue($mysoc,$contract); - if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval - { - $htmltooltip.=''.$langs->trans("NextValue").': '; - if ($nextval) - { - $htmltooltip.=$nextval.'
'; - } - else - { - $htmltooltip.=$langs->trans($module->error).'
'; - } - } + if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval + $htmltooltip.=''.$langs->trans("NextValue").': '; + if ($nextval) { + if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured') + $nextval = $langs->trans($nextval); + $htmltooltip.=$nextval.'
'; + } else { + $htmltooltip.=$langs->trans($module->error).'
'; + } + } print ''; print $form->textwithpicto('',$htmltooltip,1,0); @@ -318,7 +332,6 @@ print '
'; print_titre($langs->trans("TemplatePDFContracts")); // Defini tableau def des modeles -$type='contrat'; $def = array(); $sql = "SELECT nom"; $sql.= " FROM ".MAIN_DB_PREFIX."document_model"; @@ -477,44 +490,42 @@ print "
"; * */ +print '
'; +print ''; +print ''; + print_titre($langs->trans("OtherOptions")); print ''; print ''; print ''; print ''; -print "\n"; print "\n"; $var=true; $var=! $var; -print ''; -print ''; -print ''; print '\n"; -print ''; +print ''."\n"; //Use draft Watermark $var=!$var; -print ""; -print ''; -print ""; print '\n"; -print ''; +print ''."\n"; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; print $langs->trans("FreeLegalTextOnContracts").' ('.$langs->trans("AddCRIfTooLong").')
'; print ''; -print '
'; -print ''; -print "
'; print $langs->trans("WatermarkOnDraftContractCards").'
'; print ''; -print '
'; -print ''; -print "
'; -print '
'; +print '
'; +print ''; +print '
'; + +print ''; + +dol_fiche_end(); -$db->close(); llxFooter(); + +$db->close(); diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 274d1adc34e..b795f121234 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -177,7 +177,7 @@ if ($action == 'edit') print '
'; - print '
'; + print '
'; print '
'; print ''; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index d9ebddf2b22..05402898ee6 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2013 Juanjo Menent @@ -70,7 +70,7 @@ $hookmanager->initHooks(array('admin')); // Put here declaration of dictionaries properties // Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this. -$taborder=array(9,0,4,3,2,0,1,8,19,16,0,5,11,0,6,0,10,23,12,13,0,14,0,7,17,0,22,20,18,21,0,15,0,24); +$taborder=array(9,0,4,3,2,0,1,8,19,16,0,5,11,0,6,0,10,23,12,13,0,14,0,7,17,0,22,20,18,21,0,15,0,24,0,25); // Name of SQL tables of dictionaries $tabname=array(); @@ -98,6 +98,7 @@ $tabname[21]= MAIN_DB_PREFIX."c_availability"; $tabname[22]= MAIN_DB_PREFIX."c_input_reason"; $tabname[23]= MAIN_DB_PREFIX."c_revenuestamp"; $tabname[24]= MAIN_DB_PREFIX."c_type_resource"; +$tabname[25]= MAIN_DB_PREFIX."c_email_templates"; // Dictionary labels $tablib=array(); @@ -125,15 +126,16 @@ $tablib[21]= "DictionaryAvailability"; $tablib[22]= "DictionarySource"; $tablib[23]= "DictionaryRevenueStamp"; $tablib[24]= "DictionaryResourceType"; +$tablib[25]= "DictionaryEMailTemplates"; // Requests to extract data $tabsql=array(); $tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_country as c WHERE f.fk_pays=c.rowid"; $tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1"; $tabsql[3] = "SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1"; -$tabsql[4] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_country"; +$tabsql[4] = "SELECT rowid as rowid, code, label, active, favorite FROM ".MAIN_DB_PREFIX."c_country"; $tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c"; -$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a"; +$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a"; $tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, a.deductible, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1"; $tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.active FROM ".MAIN_DB_PREFIX."c_typent as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON t.fk_country=c.rowid"; $tabsql[9] = "SELECT code_iso as code, label, unicode, active FROM ".MAIN_DB_PREFIX."c_currencies"; @@ -152,6 +154,7 @@ $tabsql[21]= "SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX $tabsql[22]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason"; $tabsql[23]= "SELECT t.rowid, t.taux, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid"; $tabsql[24]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource"; +$tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content, active FROM ".MAIN_DB_PREFIX."c_email_templates"; // Criteria to sort dictionaries $tabsqlsort=array(); @@ -179,6 +182,7 @@ $tabsqlsort[21]="code ASC, label ASC"; $tabsqlsort[22]="code ASC, label ASC"; $tabsqlsort[23]="country ASC, taux ASC"; $tabsqlsort[24]="code ASC,label ASC"; +$tabsqlsort[25]="label ASC"; // Nom des champs en resultat de select pour affichage du dictionnaire $tabfield=array(); @@ -187,8 +191,8 @@ $tabfield[2] = "code,libelle,region_id,region,country"; // "code,libelle,regio $tabfield[3] = "code,libelle,country_id,country"; $tabfield[4] = "code,label"; $tabfield[5] = "code,label"; -$tabfield[6] = "code,libelle,type,position"; -$tabfield[7] = "code,libelle,country_id,country,accountancy_code,deductible"; +$tabfield[6] = "code,libelle,type,color,position"; +$tabfield[7] = "code,libelle,country,accountancy_code,deductible"; $tabfield[8] = "code,libelle,country_id,country"; $tabfield[9] = "code,label,unicode"; $tabfield[10]= "country_id,country,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note"; @@ -206,6 +210,7 @@ $tabfield[21]= "code,label"; $tabfield[22]= "code,label"; $tabfield[23]= "country_id,country,taux,accountancy_code_sell,accountancy_code_buy,note"; $tabfield[24]= "code,label"; +$tabfield[25]= "label,type_template,private,position,topic,content"; // Nom des champs d'edition pour modification d'un enregistrement $tabfieldvalue=array(); @@ -214,7 +219,7 @@ $tabfieldvalue[2] = "code,libelle,region"; // "code,libelle,region" $tabfieldvalue[3] = "code,libelle,country"; $tabfieldvalue[4] = "code,label"; $tabfieldvalue[5] = "code,label"; -$tabfieldvalue[6] = "code,libelle,type,position"; +$tabfieldvalue[6] = "code,libelle,type,color,position"; $tabfieldvalue[7] = "code,libelle,country,accountancy_code,deductible"; $tabfieldvalue[8] = "code,libelle,country"; $tabfieldvalue[9] = "code,label,unicode"; @@ -233,6 +238,7 @@ $tabfieldvalue[21]= "code,label"; $tabfieldvalue[22]= "code,label"; $tabfieldvalue[23]= "country,taux,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldvalue[24]= "code,label"; +$tabfieldvalue[25]= "label,type_template,private,position,topic,content"; // Nom des champs dans la table pour insertion d'un enregistrement $tabfieldinsert=array(); @@ -241,7 +247,7 @@ $tabfieldinsert[2] = "code_departement,nom,fk_region"; $tabfieldinsert[3] = "code_region,nom,fk_pays"; $tabfieldinsert[4] = "code,label"; $tabfieldinsert[5] = "code,label"; -$tabfieldinsert[6] = "code,libelle,type,position"; +$tabfieldinsert[6] = "code,libelle,type,color,position"; $tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code,deductible"; $tabfieldinsert[8] = "code,libelle,fk_country"; $tabfieldinsert[9] = "code_iso,label,unicode"; @@ -260,6 +266,7 @@ $tabfieldinsert[21]= "code,label"; $tabfieldinsert[22]= "code,label"; $tabfieldinsert[23]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldinsert[24]= "code,label"; +$tabfieldinsert[25]= "label,type_template,private,position,topic,content"; // Nom du rowid si le champ n'est pas de type autoincrement // Example: "" if id field is "rowid" and has autoincrement on @@ -288,7 +295,8 @@ $tabrowid[20]= ""; $tabrowid[21]= "rowid"; $tabrowid[22]= "rowid"; $tabrowid[23]= ""; -$tabrowid[23]= ""; +$tabrowid[24]= ""; +$tabrowid[25]= ""; // Condition to show dictionary in setup page $tabcond=array(); @@ -316,6 +324,7 @@ $tabcond[21]= ! empty($conf->propal->enabled); $tabcond[22]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled)); $tabcond[23]= true; $tabcond[24]= ! empty($conf->resource->enabled); +$tabcond[25]= true; // && ! empty($conf->global->MAIN_EMAIL_EDIT_TEMPLATE_FROM_DIC); // List of help for fields $tabhelp=array(); @@ -343,6 +352,7 @@ $tabhelp[21] = array(); $tabhelp[22] = array(); $tabhelp[23] = array(); $tabhelp[24] = array(); +$tabhelp[25] = array(); // List of check for fields (NOT USED YET) $tabfieldcheck=array(); @@ -370,12 +380,13 @@ $tabfieldcheck[21] = array(); $tabfieldcheck[22] = array(); $tabfieldcheck[23] = array(); $tabfieldcheck[24] = array(); +$tabfieldcheck[25] = array(); // Complete all arrays with entries found into modules complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck); -// Define elementList and sourceList (used for dictionary "type of contacts") +// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact") $elementList = array(); $sourceList=array(); if ($id == 11) @@ -387,13 +398,14 @@ if ($id == 11) $langs->load("bills"); $langs->load("interventions"); $elementList = array( - 'proposal' => $langs->trans('Proposal'), - 'order' => $langs->trans('Order'), - 'invoice' => $langs->trans('Bill'), + '' => '', +// 'proposal' => $langs->trans('Proposal'), +// 'order' => $langs->trans('Order'), +// 'invoice' => $langs->trans('Bill'), 'invoice_supplier' => $langs->trans('SupplierBill'), 'order_supplier' => $langs->trans('SupplierOrder'), - 'intervention' => $langs->trans('InterventionCard'), - 'contract' => $langs->trans('Contract'), +// 'intervention' => $langs->trans('InterventionCard'), +// 'contract' => $langs->trans('Contract'), 'project' => $langs->trans('Project'), 'project_task' => $langs->trans('Task'), 'agenda' => $langs->trans('Agenda'), @@ -402,17 +414,18 @@ if ($id == 11) 'propal' => $langs->trans('Proposal'), 'commande' => $langs->trans('Order'), 'facture' => $langs->trans('Bill'), - 'facture_fourn' => $langs->trans('SupplierBill'), +// 'facture_fourn' => $langs->trans('SupplierBill'), 'fichinter' => $langs->trans('InterventionCard') ); if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty'); + asort($elementList); $sourceList = array( 'internal' => $langs->trans('Internal'), 'external' => $langs->trans('External') ); } -// Define localtax_typeList (used for dictionary "c_tva") +// Define localtax_typeList (used for dictionary "llx_c_tva") $localtax_typeList = array(); if ($id == 10) { @@ -425,7 +438,6 @@ if ($id == 10) "5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"), "6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)" //$langs->trans("%ageOnServiceBeforeVAT"), ); - if (! empty($conf->global->MAIN_USE_LOCALTAX_TYPE_7)) $localtax_typeList["7"]= $langs->trans("Yes").' ('.$langs->trans("Type")." 7)"; //$langs->trans("AmountOnOrder") // We will enable this later. For the moment, work only of invoice localtype } @@ -441,10 +453,11 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $ok=1; foreach ($listfield as $f => $value) { - if ($value == 'country' && in_array($tablib[$id],array('DictionaryRegion','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory - if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryRegion','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory + if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory + if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue; if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue; + if ($value == 'color' && empty($_POST['color'])) continue; if ((! isset($_POST[$value]) || $_POST[$value]=='') && (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy'))) // Fields that are not mandatory ) @@ -487,7 +500,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'
'; }*/ } - if (isset($_POST["country"]) && $_POST["country"]=='0') + if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2)) { if (in_array($tablib[$id],array('DictionaryCompanyType'))) { @@ -531,6 +544,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $sql.= $tabfieldinsert[$id]; $sql.=",active)"; $sql.= " VALUES("; + // List of values if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert)) $sql.= $newid.","; @@ -677,6 +691,46 @@ if ($action == $acts[1]) } } +// favorite +if ($action == 'activate_favorite') +{ + if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } + else { $rowidcol="rowid"; } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'"; + } + elseif ($_GET["code"]) { + $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".$_GET["code"]."'"; + } + + $result = $db->query($sql); + if (!$result) + { + dol_print_error($db); + } +} + +// disable favorite +if ($action == 'disable_favorite') +{ + if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } + else { $rowidcol="rowid"; } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'"; + } + elseif ($_GET["code"]) { + $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".$_GET["code"]."'"; + } + + $result = $db->query($sql); + if (!$result) + { + dol_print_error($db); + } +} + /* * View @@ -709,6 +763,7 @@ if ($action == 'delete') { print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$_GET["code"].'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1); } +//var_dump($elementList); /* * Show a dictionary @@ -803,6 +858,13 @@ if ($id) if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); } if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); } if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); } + + if ($id == 2) // Special cas for state page + { + if ($fieldlist[$field]=='region_id') { $valuetoshow=' '; $showfield=1; } + if ($fieldlist[$field]=='region') { $valuetoshow=$langs->trans("Country").'/'.$langs->trans("Region"); $showfield=1; } + } + if ($valuetoshow != '') { print ''; @@ -813,12 +875,14 @@ if ($id) } if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; } - print ''; + + if ($id == 4) print ''; + print ''; print ''; print ' '; print ''; - // Line to type new values + // Line to enter new values print ""; $obj = new stdClass(); @@ -837,16 +901,25 @@ if ($id) $reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error=$hookmanager->error; $errors=$hookmanager->errors; + if ($id == 3) + { + unset($fieldlist[2]); + } + if (empty($reshook)) fieldList($fieldlist,$obj); + if ($id == 4) print ''; print ''; print ""; + $colspan=count($fieldlist)+2; + if ($id == 4) $colspan++;; + if (! empty($alabelisused)) // Si un des champs est un libelle { - print '* '.$langs->trans("LabelUsedByDefault").'.'; + print '* '.$langs->trans("LabelUsedByDefault").'.'; } - print ' '; + print ' '; } print ''; @@ -922,14 +995,18 @@ if ($id) if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); } if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); } if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); } + // Affiche nom du champ if ($showfield) { print getTitleFieldOfList($valuetoshow,0,$_SERVER["PHP_SELF"],($sortable?$fieldlist[$field]:''),($page?'page='.$page.'&':'').'&id='.$id,"","align=".$align,$sortfield,$sortorder); } } - print getTitleFieldOfList($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"active",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder); - print ' '; + // Favorite - Only activated on country dictionary + if ($id == 4) print getTitleFieldOfList($langs->trans("Favorite"),0,$_SERVER["PHP_SELF"],"favorite",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder); + + print getTitleFieldOfList($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"active",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder); + print ' '; print ''; // Lines with values @@ -1127,27 +1204,39 @@ if ($id) } } - // Est-ce une entree du dictionnaire qui peut etre desactivee ? - // True by default - $iserasable=1; + // Can an entry be erased or disabled ? + $iserasable=1;$isdisable=1; // true by default if (isset($obj->code)) { - if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) $iserasable = 0; - else if ($obj->code == 'RECEP') $iserasable = 0; - else if ($obj->code == 'EF0') $iserasable = 0; + if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $isdisable = 0; } + else if ($obj->code == 'RECEP') { $iserasable = 0; $isdisable = 0; } + else if ($obj->code == 'EF0') { $iserasable = 0; $isdisable = 0; } } - if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) $iserasable=0; + if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) { $iserasable=0; } + if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $isdisable=0; $isdisable = 0; } $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?$obj->code:'').'&id='.$id.'&'; + // Favorite + // Only activated on country dictionary + if ($id == 4) + { + print ''; + if ($iserasable) print ''.$actl[$obj->favorite].''; + else print $langs->trans("AlwaysActive"); + print ''; + } + // Active print ''; - if ($iserasable) print ''.$actl[$obj->active].''; + if ($isdisable) print ''.$actl[$obj->active].''; else { - if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto')) && empty($obj->active)) print $langs->trans("Deprecated"); + if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO'))) print $langs->trans("AlwaysActive"); + else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) print $langs->trans("Deprecated"); + else if (isset($obj->type) && in_array($obj->type, array('system')) && ! empty($obj->active) && $obj->code != 'AC_OTH') print $langs->trans("UsedOnlyWithTypeOption"); else print $langs->trans("AlwaysActive"); } print ""; @@ -1244,7 +1333,7 @@ $db->close(); /** - * Show field + * Show fields in insert/edit mode * * @param array $fieldlist Array of fields * @param Object $obj If we show a particular record, obj is filled with record fields @@ -1264,14 +1353,26 @@ function fieldList($fieldlist,$obj='',$tabname='') foreach ($fieldlist as $field => $value) { if ($fieldlist[$field] == 'country') { - if (in_array('region_id',$fieldlist)) { print ''.join(',',$fieldlist).' '; continue; } // For state page, we do not show the country input (we link to region, not country) + if (in_array('region_id',$fieldlist)) + { + print ''; + //print join(',',$fieldlist); + print ''; + continue; + } // For state page, we do not show the country input (we link to region, not country) print ''; - print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), 'country', '', 28); + $fieldname='country'; + print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28); print ''; } elseif ($fieldlist[$field] == 'country_id') { - $country_id = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0); - print ''; + if (! in_array('country',$fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate) + { + $country_id = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0); + print ''; + print ''; + print ''; + } } elseif ($fieldlist[$field] == 'region') { print ''; @@ -1280,7 +1381,9 @@ function fieldList($fieldlist,$obj='',$tabname='') } elseif ($fieldlist[$field] == 'region_id') { $region_id = (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:0); + print ''; print ''; + print ''; } elseif ($fieldlist[$field] == 'lang') { print ''; @@ -1319,7 +1422,7 @@ function fieldList($fieldlist,$obj='',$tabname='') print ''; print ''; } - elseif ($fieldlist[$field] == 'libelle_facture') { + elseif (in_array($fieldlist[$field], array('libelle_facture','content'))) { print ''; } elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) { diff --git a/htdocs/admin/dons.php b/htdocs/admin/dons.php index c81366bc5e9..dcac1079422 100644 --- a/htdocs/admin/dons.php +++ b/htdocs/admin/dons.php @@ -2,7 +2,7 @@ /* Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2012-2013 Juanjo Menent * Copyright (C) 2013 Philippe Grand - * Copyright (C) 2014 Alexandre Spangaro + * Copyright (C) 2014 Alexandre Spangaro * * 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 @@ -37,6 +37,8 @@ $typeconst=array('yesno','texte','chaine'); $action = GETPOST('action','alpha'); +$type='donation'; + /* * Action @@ -135,7 +137,7 @@ else if ($action == 'setart200') { $res = dolibarr_set_const($db, "DONATION_ART200", $setart200, 'yesno', 0, '', $conf->entity); if (! $res > 0) $error ++; - + if (! $error) { setEventMessage($langs->trans("SetupSaved"), 'mesgs'); } else { @@ -147,7 +149,7 @@ else if ($action == 'setart238') { $res = dolibarr_set_const($db, "DONATION_ART238", $setart238, 'yesno', 0, '', $conf->entity); if (! $res > 0) $error ++; - + if (! $error) { setEventMessage($langs->trans("SetupSaved"), 'mesgs'); } else { @@ -159,7 +161,7 @@ else if ($action == 'setart885') { $res = dolibarr_set_const($db, "DONATION_ART885", $setart885, 'yesno', 0, '', $conf->entity); if (! $res > 0) $error ++; - + if (! $error) { setEventMessage($langs->trans("SetupSaved"), 'mesgs'); } else { @@ -183,7 +185,10 @@ print_fiche_titre($langs->trans("DonationsSetup"),$linkback,'setup'); * Params */ print_titre($langs->trans("Options")); - + +print '
'; +print ''; +print ''; print ''; print ''; print ''; @@ -192,9 +197,7 @@ print "\n"; $var=true; $var=! $var; -print ''; -print ''; -print ''; + print ''; @@ -372,78 +407,99 @@ foreach ($dirmodels as $reldir) $handle=opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) - { - if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_') + while (($file = readdir($handle))!==false) + { + $filelist[]=$file; + } + closedir($handle); + arsort($filelist); + + foreach($filelist as $file) + { + if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) { - $var=!$var; - - $name = substr($file, 4, dol_strlen($file) -16); - $classname = substr($file, 0, dol_strlen($file) -12); - - require_once $dir.'/'.$file; - $module = new $classname($db); - - print ''; - - // Active - if (in_array($name, $def)) + if (file_exists($dir.'/'.$file)) { - print ""; - } - else - { - print ""; - } + $var=!$var; - // Default - print "'; + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); - // Info - $htmltooltip = ''.$langs->trans("Name").': '.$module->name; - $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); - $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; - $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; - $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); - $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1); - $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1); - $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); - $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1); - print ''; - - // Preview - $link=''.img_object($langs->trans("Preview"),'intervention').''; - print ''; + require_once $dir.'/'.$file; + $module = new $classname($db); - print ''; + $modulequalified=1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; + + if ($modulequalified) + { + print ''; + + // Active + if (in_array($name, $def)) + { + print ""; + } + else + { + print ""; + } + + // Default + print "'; + + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; + $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); + $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1); + $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1); + $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); + $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1); + print ''; + + // Preview + print ''; + + print ''; + } + } } } - closedir($handle); } } } diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 5cdb41cbe23..6ebf107ffbe 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -53,29 +53,30 @@ $searchformmodule=array('Module1Name','Module1Name','Module50Name','Module50Name if ($action == 'update') { - dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["main_lang_default"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["main_multilangs"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", $_POST["main_disable_javascript"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", $_POST["MAIN_BUTTON_HIDE_UNAUTHORIZED"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_START_WEEK", $_POST["MAIN_START_WEEK"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", $_POST["MAIN_DEFAULT_WORKING_DAYS"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", $_POST["MAIN_DEFAULT_WORKING_HOURS"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_SHOW_LOGO", $_POST["MAIN_SHOW_LOGO"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", $_POST["MAIN_FIRSTNAME_NAME_POSITION"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["main_lang_default"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["main_multilangs"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", $_POST["main_disable_javascript"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", $_POST["MAIN_BUTTON_HIDE_UNAUTHORIZED"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_START_WEEK", $_POST["MAIN_START_WEEK"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", $_POST["MAIN_DEFAULT_WORKING_DAYS"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", $_POST["MAIN_DEFAULT_WORKING_HOURS"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_SHOW_LOGO", $_POST["MAIN_SHOW_LOGO"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_ACTIVATE_HTML5", $_POST["MAIN_ACTIVATE_HTML5"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", $_POST["MAIN_FIRSTNAME_NAME_POSITION"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_SEARCHFORM_CONTACT", $_POST["MAIN_SEARCHFORM_CONTACT"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_SEARCHFORM_SOCIETE", $_POST["MAIN_SEARCHFORM_SOCIETE"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE",$_POST["MAIN_SEARCHFORM_PRODUITSERVICE"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_SEARCHFORM_CONTACT", $_POST["MAIN_SEARCHFORM_CONTACT"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_SEARCHFORM_SOCIETE", $_POST["MAIN_SEARCHFORM_SOCIETE"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE", $_POST["MAIN_SEARCHFORM_PRODUITSERVICE"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER",$_POST["MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_SEARCHFORM_ADHERENT",$_POST["MAIN_SEARCHFORM_ADHERENT"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_SEARCHFORM_ADHERENT", $_POST["MAIN_SEARCHFORM_ADHERENT"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", $_POST["MAIN_HELPCENTER_DISABLELINK"],'chaine',0,'',0); // Param for all entities - dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr($_POST["main_home"]),'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", $_POST["MAIN_HELP_DISABLELINK"],'chaine',0,'',0); // Param for all entities + dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", $_POST["MAIN_HELPCENTER_DISABLELINK"],'chaine',0,'',0); // Param for all entities + dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr($_POST["main_home"]),'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", $_POST["MAIN_HELP_DISABLELINK"],'chaine',0,'',0); // Param for all entities // This one is not always defined if (isset($_POST["MAIN_USE_PREVIEW_TABS"])) dolibarr_set_const($db, "MAIN_USE_PREVIEW_TABS", $_POST["MAIN_USE_PREVIEW_TABS"],'chaine',0,'',$conf->entity); @@ -119,7 +120,7 @@ if ($action == 'edit') // Edit print_fiche_titre($langs->trans("Language"),'','').'
'; print '
'.$langs->trans("Parameter").'
'; print $langs->trans("FreeTextOnDonations").'
'; print ''; @@ -207,11 +210,11 @@ print ''; /* * French params */ -if ($conf->global->MAIN_LANG_DEFAULT == "fr_FR") +if ($conf->global->MAIN_LANG_DEFAULT == "fr_FR") { print '
'; print_titre($langs->trans("FrenchOptions")); - + print ''; print ''; print ''; @@ -377,7 +380,7 @@ if (is_resource($handle)) print ''; - + // Preview print ''; print '
' . $langs->trans('Parameters') . ''; print $form->textwithpicto('',$htmltooltip,-1,0); print ''; print ''.img_object($langs->trans("Preview"),'generic').''; diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php index 59205dcdbab..d5562248c55 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -78,15 +78,16 @@ print_fiche_titre($langs->trans("SecuritySetup"),'','setup'); print $langs->trans("LogEventDesc")."
\n"; print "
\n"; -$head=security_prepare_head(); - -dol_fiche_head($head, 'audit', $langs->trans("Security")); - print '
'; print ''; print ''; +$head=security_prepare_head(); + +dol_fiche_head($head, 'audit', $langs->trans("Security")); + + $var=true; print ""; print ""; @@ -109,14 +110,14 @@ foreach ($eventstolog as $key => $arr) } print '
'; -print '
'; +dol_fiche_end(); + +print '
'; print "trans("Save")."\">"; -print "
"; +print ""; print "
\n"; -print ''; - -$db->close(); llxFooter(); +$db->close(); diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index d89b406280b..933f9a87d18 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -138,6 +138,35 @@ else if ($action == 'specimen') } } +// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) +else if ($action == 'setModuleOptions') +{ + $post_size=count($_POST); + + $db->begin(); + + for($i=0;$i < $post_size;$i++) + { + if (array_key_exists('param'.$i,$_POST)) + { + $param=GETPOST("param".$i,'alpha'); + $value=GETPOST("value".$i,'alpha'); + if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + } + if (! $error) + { + $db->commit(); + setEventMessage($langs->trans("SetupSaved")); + } + else + { + $db->rollback(); + setEventMessage($langs->trans("Error"),'errors'); + } +} + // Activate a model else if ($action == 'set') { @@ -175,14 +204,6 @@ else if ($action == 'setmodel') { dolibarr_set_const($db, "EXPEDITION_ADDON_NUMBER",$value,'chaine',0,'',$conf->entity); } -else if ($action=='setModuleOptions') { - if (dolibarr_set_const($db, "EXPEDITION_ADDON_PDF_ODT_PATH",GETPOST('value1'),'chaine',0,'',$conf->entity)) - { - // La constante qui a ete lue en avant du nouveau set - // on passe donc par une variable pour avoir un affichage coherent - $conf->global->EXPEDITION_ADDON_PDF_ODT_PATH = GETPOST('value1'); - } -} /* @@ -303,18 +324,16 @@ foreach ($dirmodels as $reldir) $htmltooltip=''; $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; $nextval=$module->getNextValue($mysoc,$expedition); - if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval - { - $htmltooltip.=''.$langs->trans("NextValue").': '; - if ($nextval) - { - $htmltooltip.=$nextval.'
'; - } - else - { - $htmltooltip.=$langs->trans($module->error).'
'; - } - } + if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval + $htmltooltip.=''.$langs->trans("NextValue").': '; + if ($nextval) { + if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured') + $nextval = $langs->trans($nextval); + $htmltooltip.=$nextval.'
'; + } else { + $htmltooltip.=$langs->trans($module->error).'
'; + } + } print '
'; print $form->textwithpicto('',$htmltooltip,1,0); diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index f23e80f78ff..520193a81c3 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -214,11 +214,11 @@ print 'http://news.google.com/news?ned=us&topic=h&output=rss
http://www.d print '
'; -print '

'; +print '
'; print ''; print ''; print ''; -print '

'; +print '


'; print ''; diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 3c251cf6c3b..298c0beddf5 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -296,7 +296,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("BillsSetup"),$linkback,'setup'); print '
'; -$head = invoice_admin_prepare_head(null); +$head = invoice_admin_prepare_head(); dol_fiche_head($head, 'general', $langs->trans("Invoices"), 0, 'invoice'); /* @@ -393,61 +393,53 @@ foreach ($dirmodels as $reldir) $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; $facture->type=0; $nextval=$module->getNextValue($mysoc,$facture); - if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval - { + if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval $htmltooltip.=$langs->trans("NextValueForInvoices").': '; - if ($nextval) - { + if ($nextval) { + if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured') + $nextval = $langs->trans($nextval); $htmltooltip.=$nextval.'
'; - } - else - { + } else { $htmltooltip.=$langs->trans($module->error).'
'; } } // Example for remplacement $facture->type=1; $nextval=$module->getNextValue($mysoc,$facture); - if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval - { - $htmltooltip.=$langs->trans("NextValueForReplacements").': '; - if ($nextval) - { - $htmltooltip.=$nextval.'
'; - } - else - { - $htmltooltip.=$langs->trans($module->error).'
'; - } + if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval + $htmltooltip.=$langs->trans("NextValueForReplacements").': '; + if ($nextval) { + if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured') + $nextval = $langs->trans($nextval); + $htmltooltip.=$nextval.'
'; + } else { + $htmltooltip.=$langs->trans($module->error).'
'; + } } // Example for credit invoice $facture->type=2; $nextval=$module->getNextValue($mysoc,$facture); - if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval - { + if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval $htmltooltip.=$langs->trans("NextValueForCreditNotes").': '; - if ($nextval) - { + if ($nextval) { + if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured') + $nextval = $langs->trans($nextval); $htmltooltip.=$nextval.'
'; - } - else - { + } else { $htmltooltip.=$langs->trans($module->error).'
'; } } // Example for deposit invoice $facture->type=3; $nextval=$module->getNextValue($mysoc,$facture); - if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval - { + if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval $htmltooltip.=$langs->trans("NextValueForDeposit").': '; - if ($nextval) - { + if ($nextval) { + if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured') + $nextval = $langs->trans($nextval); $htmltooltip.=$nextval; - } - else - { + } else { $htmltooltip.=$langs->trans($module->error); } } diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 2541a6265e7..a66c417923b 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -165,7 +165,7 @@ else $readonly=($mode=='dolibarr_readonly'?1:0); $editor=new DolEditor('formtestfield',isset($conf->global->FCKEDITOR_TEST)?$conf->global->FCKEDITOR_TEST:'Test','',200,$mode,'In', true, $uselocalbrowser, 1, 120, 8, $readonly); $editor->Create(); - print '

'."\n"; + print '
'."\n"; print '
'; print ''."\n"; diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 37a3b2a5a5c..8965b225cfb 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -3,8 +3,8 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2008 Raphael Bertrand (Resultic) + * Copyright (C) 2005-2014 Regis Houssin + * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2011-2013 Philippe Grand * @@ -113,6 +113,35 @@ else if ($action == 'specimen') // For fiche inter } } +// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) +if ($action == 'setModuleOptions') +{ + $post_size=count($_POST); + + $db->begin(); + + for($i=0;$i < $post_size;$i++) + { + if (array_key_exists('param'.$i,$_POST)) + { + $param=GETPOST("param".$i,'alpha'); + $value=GETPOST("value".$i,'alpha'); + if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + } + if (! $error) + { + $db->commit(); + setEventMessage($langs->trans("SetupSaved")); + } + else + { + $db->rollback(); + setEventMessage($langs->trans("Error"),'errors'); + } +} + // Activate a model else if ($action == 'set') { @@ -261,13 +290,13 @@ foreach ($dirmodels as $reldir) require_once $dir.$file.'.php'; $module = new $file; - + if ($module->isEnabled()) { // Show modules according to features level if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; - + $var=!$var; print '
'.$module->nom."\n"; print $module->info(); @@ -299,10 +328,16 @@ foreach ($dirmodels as $reldir) $htmltooltip=''; $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; $nextval=$module->getNextValue($mysoc,$ficheinter); - if ($nextval != $langs->trans("NotAvailable")) - { - $htmltooltip.=''.$langs->trans("NextValue").': '.$nextval; - } + if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval + $htmltooltip.=''.$langs->trans("NextValue").': '; + if ($nextval) { + if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured') + $nextval = $langs->trans($nextval); + $htmltooltip.=$nextval.'
'; + } else { + $htmltooltip.=$langs->trans($module->error).'
'; + } + } print '
'; print $form->textwithpicto('',$htmltooltip,1,0); print '
'; - print (empty($module->name)?$name:$module->name); - print "\n"; - require_once $dir.$file; - $module = new $classname($db); - print $module->description; - print '\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; - print img_picto($langs->trans("Enabled"),'switch_on'); - print ''; - print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; - print ""; - if ($conf->global->FICHEINTER_ADDON_PDF == "$name") - { - print img_picto($langs->trans("Default"),'on'); - } - else - { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; - } - print ''; - print $form->textwithpicto('',$htmltooltip,-1,0); - print ''; - print $link; - print '
'; + print (empty($module->name)?$name:$module->name); + print "\n"; + if (method_exists($module,'info')) print $module->info($langs); + else print $module->description; + print '\n"; + print 'scandir.'&label='.urlencode($module->name).'">'; + print img_picto($langs->trans("Enabled"),'switch_on'); + print ''; + print "\n"; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print ""; + if ($conf->global->FICHEINTER_ADDON_PDF == "$name") + { + print img_picto($langs->trans("Default"),'on'); + } + else + { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + } + print ''; + print $form->textwithpicto('',$htmltooltip,-1,0); + print ''; + if ($module->type == 'pdf') + { + print ''.img_object($langs->trans("Preview"),'intervention').''; + } + else + { + print img_object($langs->trans("PreviewNotAvailable"),'generic'); + } + print '
'; - print ''; + print ''; print ''; print ''; @@ -142,7 +143,7 @@ if ($action == 'edit') // Edit print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameters").''.$langs->trans("Value").' 

'."\n"; // Themes - show_theme('',1); + show_theme(null,1); print '
'; // Liste des zone de recherche permanantes supportees @@ -161,7 +162,7 @@ if ($action == 'edit') // Edit // Other print ''; - print ''; + print ''; print ''; print ''; @@ -172,6 +173,17 @@ if ($action == 'edit') // Edit print ''; print ''; print ''; + + // Activate Html5 - Developement - Only available on Eldy template + if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_HTML5)) + { + $var=!$var; + print ''; + print ''; + print ''; + } // Max size of lists $var=!$var; @@ -287,9 +299,9 @@ if ($action == 'edit') // Edit print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
 
'.$langs->trans("EnableHtml5").''; + print $form->selectyesno('MAIN_ACTIVATE_HTML5',$conf->global->MAIN_ACTIVATE_HTML5,1); + print ' 
'."\n"; - print '
'; + print '
'; print ''; - print '
'; + print ''; print ''; print '
'; @@ -301,7 +313,7 @@ else // Show // Language print_fiche_titre($langs->trans("Language"),'','').'
'; print ''; - print ''; + print ''; $var=!$var; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
'.$langs->trans("DefaultLanguage").''; @@ -323,7 +335,7 @@ else // Show // Themes - show_theme('',0); + show_theme(null,0); print '
'; @@ -345,12 +357,21 @@ else // Show // Other $var=true; print ''; - print ''; + print ''; $var=!$var; print ''; print ''; print ""; + + // Activate Html5 - Developement - Only available on Eldy template + if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_HTML5)) + { + $var=!$var; + print ''; + print ''; + print ""; + } $var=!$var; print ''; diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index bbedab346d1..6ec184d68ec 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -109,7 +109,7 @@ if (empty($reshook)) print "
"; // Show logo - print '
'; + print '
'; } diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index ef893031db1..e84a3abfffa 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -239,7 +239,7 @@ print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("EnableShowLogo").'' . yn($conf->global->MAIN_SHOW_LOGO) . ' 
'.$langs->trans("EnableHtml5").'' . yn($conf->global->MAIN_ACTIVATE_HTML5) . ' 
'.$langs->trans("DefaultMaxSizeList").'' . $conf->global->MAIN_SIZE_LISTE_LIMIT . 'secret
'; -print '
'; +print '
'; print ''; diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index e043bff88aa..a0bb5c4b605 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -219,6 +219,10 @@ if (function_exists("ldap_connect")) $info=$object->_load_ldap_info(); $dn=$object->_load_ldap_dn($info); + // Get a gid number for objectclass PosixGroup + if(in_array('posixGroup',$info['objectclass'])) + $info['gidNumber'] = $ldap->getNextGroupGid(); + $result1=$ldap->delete($dn); // To be sure to delete existing records $result2=$ldap->add($dn,$info,$user); // Now the test $result3=$ldap->delete($dn); // Clean what we did diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index 5896ffc5416..2281f83bdd1 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -126,9 +126,9 @@ if ($action == 'edit') print '
'; - print '
'; + print '
'; print ''; - print '
'; + print ''; print ''; print '
'; diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index 415bff261de..69f5d30b09a 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2011-2013 Philippe Grand * @@ -95,7 +95,7 @@ if ($action == 'specimen') $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); foreach($dirmodels as $reldir) { - $file=dol_buildpath($reldir."core/modules/livraison/pdf/pdf_".$modele.".modules.php",0); + $file=dol_buildpath($reldir."core/modules/livraison/doc/pdf_".$modele.".modules.php",0); if (file_exists($file)) { $filefound=1; @@ -128,6 +128,35 @@ if ($action == 'specimen') } } +// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) +if ($action == 'setModuleOptions') +{ + $post_size=count($_POST); + + $db->begin(); + + for($i=0;$i < $post_size;$i++) + { + if (array_key_exists('param'.$i,$_POST)) + { + $param=GETPOST("param".$i,'alpha'); + $value=GETPOST("value".$i,'alpha'); + if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + } + if (! $error) + { + $db->commit(); + setEventMessage($langs->trans("SetupSaved")); + } + else + { + $db->rollback(); + setEventMessage($langs->trans("Error"),'errors'); + } +} + if ($action == 'set') { $ret = addDocumentModel($value, $type, $label, $scandir); @@ -280,15 +309,13 @@ foreach ($dirmodels as $reldir) $htmltooltip=''; $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; $nextval=$module->getNextValue($mysoc,$livraison); - if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval - { + if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval $htmltooltip.=''.$langs->trans("NextValue").': '; - if ($nextval) - { + if ($nextval) { + if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured') + $nextval = $langs->trans($nextval); $htmltooltip.=$nextval.'
'; - } - else - { + } else { $htmltooltip.=$langs->trans($module->error).'
'; } } @@ -356,75 +383,101 @@ clearstatcache(); $var=true; foreach ($dirmodels as $reldir) { - $dir = dol_buildpath($reldir."core/modules/livraison/pdf/"); + $dir = dol_buildpath($reldir."core/modules/livraison/doc/"); if (is_dir($dir)) { $handle = opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) - { - if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_') + while (($file = readdir($handle))!==false) + { + $filelist[]=$file; + } + closedir($handle); + arsort($filelist); + + foreach($filelist as $file) + { + if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) { - $name = substr($file, 4, dol_strlen($file) - 16); - $classname = substr($file, 0, dol_strlen($file) - 12); + if (file_exists($dir.'/'.$file)) + { + $var=!$var; - $var=!$var; + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); - print ''; - print $name; - print "\n"; - require_once $dir.$file; - $module = new $classname($db); + require_once $dir.'/'.$file; + $module = new $classname($db); - print $module->description; - print ''; + $modulequalified=1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; - // Activ - if (in_array($name, $def)) - { - print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; - print img_picto($langs->trans("Enabled"),'switch_on'); - print ''; - print ""; - } - else - { - print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; - print ""; - } + if ($modulequalified) + { + print ''; + print (empty($module->name)?$name:$module->name); + print "\n"; + if (method_exists($module,'info')) print $module->info($langs); + else print $module->description; + print ''; - // Default - print ""; - if ($conf->global->LIVRAISON_ADDON_PDF == "$name") - { - print img_picto($langs->trans("Default"),'on'); - } - else - { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; - } - print ''; + // Active + if (in_array($name, $def)) + { + print "\n"; + print 'scandir.'&label='.urlencode($module->name).'">'; + print img_picto($langs->trans("Enabled"),'switch_on'); + print ''; + print ""; + } + else + { + print "\n"; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print ""; + } - // Info - $htmltooltip = ''.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); - $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; - $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; - $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); - print ''; - print $form->textwithpicto('',$htmltooltip,1,0); - print ''; - print ''; - print ''.img_object($langs->trans("Preview"),'sending').''; - print ''; + // Default + print ""; + if ($conf->global->LIVRAISON_ADDON_PDF == "$name") + { + print img_picto($langs->trans("Default"),'on'); + } + else + { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + } + print ''; - print ''; + // Info + $htmltooltip = ''.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; + $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); + print ''; + print $form->textwithpicto('',$htmltooltip,1,0); + print ''; + + // Preview + print ''; + if ($module->type == 'pdf') + { + print ''.img_object($langs->trans("Preview"),'sending').''; + } + else + { + print img_object($langs->trans("PreviewNotAvailable"),'generic'); + } + print ''; + + print ''; + } + } } } - closedir($handle); } } } diff --git a/htdocs/admin/mailman.php b/htdocs/admin/mailman.php index f4d2010ca74..3e4a2c14a98 100644 --- a/htdocs/admin/mailman.php +++ b/htdocs/admin/mailman.php @@ -158,7 +158,8 @@ $head = mailmanspip_admin_prepare_head(); dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user'); -$var=!$var; +$var=true; + if (! empty($conf->global->ADHERENT_USE_MAILMAN)) { //$lien=img_picto($langs->trans("Active"),'tick').' '; diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 61914d1a09c..b39760c6907 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -477,11 +477,11 @@ if ($action == 'edit') print '">'; print ''; - print '
'; + print '
'; print ''; - print '     '; + print '     '; print ''; - print '
'; + print ''; print ''; print '
'; diff --git a/htdocs/admin/menus.php b/htdocs/admin/menus.php index 2e050a4bbe8..c5fb55cbce5 100644 --- a/htdocs/admin/menus.php +++ b/htdocs/admin/menus.php @@ -26,7 +26,6 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; $action=GETPOST('action'); @@ -204,11 +203,11 @@ if ($action == 'edit') print ''; - print '
'; + print '
'; print ''; - print '     '; + print '     '; print ''; - print '
'; + print ''; print ''; } diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index ff015884bbc..c8964d7bbaa 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -369,9 +369,11 @@ if ($action == 'create') print ''; // Boutons - print '

'; - print '     '; - print '
'; + print '
'; + print ''; + print '     '; + print ''; + print '
'; print ''; } @@ -453,9 +455,11 @@ elseif ($action == 'edit') print ''; // Bouton - print '

'; - print '     '; - print '
'; + print '
'; + print ''; + print '     '; + print ''; + print '
'; print ''; diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index a866ecd9a70..d7fce1c937d 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -324,8 +324,9 @@ if ($conf->use_javascript_ajax) '   '.$titre.''. ''. ''.img_edit('default',0,'class="menuEdit" id="edit'.$menu['rowid'].'"').' '. - ''.img_edit_add('default',0,'class="menuNew" id="new'.$menu['rowid'].'"').' '. - ''.img_delete('default',0,'class="menuDel" id="del'.$menu['rowid'].'"').' '. + ''.img_edit_add('default').' '. + ''.img_delete('default').' '. + '     '. ''.img_picto("Monter","1uparrow").''.img_picto("Descendre","1downarrow").''. '' ); diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index fd3f74c06c2..e3524425c6c 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -520,11 +520,18 @@ else $var=!$var; print "\n"; $url='http://www.dolistore.com'; - print ''; + print ''; print ''.$langs->trans("DoliStoreDesc").''; - print ''.$url.''; + print ''.$url.''; print ''; + $var=!$var; + print "\n"; + $url='http://partners.dolibarr.org'; + print ''; + print ''.$langs->trans("DoliPartnersDesc").''; + print ''.$url.''; + print ''; print "\n"; } @@ -534,7 +541,7 @@ dol_fiche_end(); // Show warning about external users -if ($mode != 'marketplace') print '
'.showModulesExludedForExternal($modules).'

'."\n"; +if ($mode != 'marketplace') print info_admin(showModulesExludedForExternal($modules))."\n"; llxFooter(); diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index ca68c54c805..ce3c8d10f73 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -32,6 +32,7 @@ $langs->load("other"); $langs->load("orders"); $langs->load("propal"); $langs->load("bills"); +$langs->load("errors"); // Security check if (!$user->admin) @@ -39,19 +40,32 @@ if (!$user->admin) $action = GETPOST("action"); + /* * Actions */ if ($action == 'setvalue' && $user->admin) { - $result=dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM",$_POST["email_from"],'chaine',0,'',$conf->entity); - if ($result >= 0) + $result=dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM", $_POST["email_from"], 'chaine', 0, '', $conf->entity); + if ($result < 0) $error++; + + if (! $error) + { + foreach($_POST as $key => $val) + { + if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_/',$key)) continue; + //print $key.' - '.$val.'
'; + $result=dolibarr_set_const($db, $key, $val, 'chaine', 0, '', $conf->entity); + } + } + + if (! $error) { setEventMessage($langs->trans("SetupSaved")); } else - { + { setEventMessage($langs->trans("Error"),'errors'); } } @@ -67,7 +81,7 @@ llxHeader(); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("NotificationSetup"),$linkback,'setup'); -print $langs->trans("NotificationsDesc").'

'; +print $langs->trans("NotificationsDesc").'

'; print '
'; print ''; @@ -83,19 +97,13 @@ print "\n"; $var=!$var; print ''; print $langs->trans("NotificationEMailFrom").''; -print ''; -if (! empty($conf->global->NOTIFICATION_EMAIL_FROM) && ! isValidEmail($conf->global->NOTIFICATION_EMAIL_FROM)) print ' '.img_warning($langs->trans("BadEMail")); +print ''; +if (! empty($conf->global->NOTIFICATION_EMAIL_FROM) && ! isValidEmail($conf->global->NOTIFICATION_EMAIL_FROM)) print ' '.img_warning($langs->trans("ErrorBadEMail")); print ''; print ''; print '
'; -print '
'; - -print '
'; -print '
'; - - print_fiche_titre($langs->trans("ListOfAvailableNotifications"),'',''); print ''; @@ -103,6 +111,7 @@ print ''; print ''; print ''; print ''; +print ''; print "\n"; // Load array of available notifications @@ -123,10 +132,21 @@ foreach($listofnotifiedevents as $notifiedevent) print ''; print ''; print ''; + $param='NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code']; + print ''; print ''; } print '
'.$langs->trans("Module").''.$langs->trans("Code").''.$langs->trans("Label").''.$langs->trans("FixedEmailTarget").'
'.$elementLabel.''.$notifiedevent['code'].''.$label.''; + if (! empty($conf->global->$param) && ! isValidEmail($conf->global->$param)) print ' '.img_warning($langs->trans("ErrorBadEMail")); + print '
'; -$db->close(); +print '
'; + +print '
'; + +print ''; + llxFooter(); + +$db->close(); diff --git a/htdocs/admin/order_extrafields.php b/htdocs/admin/order_extrafields.php index 90ceed434c2..81b7e74a479 100644 --- a/htdocs/admin/order_extrafields.php +++ b/htdocs/admin/order_extrafields.php @@ -73,7 +73,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("OrdersSetup"),$linkback,'setup'); print "
\n"; -$head = order_admin_prepare_head(null); +$head = order_admin_prepare_head(); dol_fiche_head($head, 'attributes', $langs->trans("Orders"), 0, 'order'); diff --git a/htdocs/admin/orderdet_extrafields.php b/htdocs/admin/orderdet_extrafields.php index 8f1dfb80538..515714a51e4 100644 --- a/htdocs/admin/orderdet_extrafields.php +++ b/htdocs/admin/orderdet_extrafields.php @@ -74,7 +74,7 @@ $linkback='
'.$langs->trans("BackToM print_fiche_titre($langs->trans("OrdersSetup"),$linkback,'setup'); print "
\n"; -$head = order_admin_prepare_head(null); +$head = order_admin_prepare_head(); dol_fiche_head($head, 'attributeslines', $langs->trans("Orders"), 0, 'order'); diff --git a/htdocs/admin/osc-languages.php b/htdocs/admin/osc-languages.php deleted file mode 100644 index 804c72f2850..00000000000 --- a/htdocs/admin/osc-languages.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * 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 . - */ - -/** - * \file htdocs/admin/osc-languages.php - * \ingroup boutique - * \brief Page d'administration/configuration du module Boutique - */ - -require '../main.inc.php'; - -$langs->load("admin"); - -if (!$user->admin) -accessforbidden(); - - -llxHeader(); - - -if (! dol_strlen(OSC_DB_NAME)) -{ - print "Non dispo"; - llxFooter(); -} - -if ($sortfield == "") { - $sortfield="lower(p.label),p.price"; -} -if ($sortorder == "") { - $sortorder="ASC"; -} - -if ($page == -1) { $page = 0 ; } -$limit = $conf->liste_limit; -$offset = $limit * $page ; - - -print_barre_liste("Liste des langues oscommerce", $page, "osc-languages.php"); - -$sql = "SELECT l.languages_id, l.name, l.code FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."languages as l"; -$sql.= $db->plimit($limit, $offset); - -print "

"; -print ""; -print ""; -print ""; -print ""; -print "\n"; - -$resql=$db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - $var=True; - while ($i < $num) { - $objp = $db->fetch_object($resql); - $var=!$var; - print ""; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - $db->free(); -} - -print "
idNameCode
$objp->languages_id$objp->name$objp->code
"; - - -$db->close(); - -llxFooter(); diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index f21687eecf7..64a213467d4 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -250,9 +250,9 @@ if ($action == 'edit') // Edit print ''; - print '

'; + print '
'; print ''; - print '
'; + print ''; print ''; print '
'; diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index 74a9b8c8434..907ed389b38 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -116,7 +116,7 @@ foreach ($modulesdir as $dir) $db->commit(); // Show warning about external users -print showModulesExludedForExternal($modules).'
'."\n"; +print info_admin(showModulesExludedForExternal($modules)).'
'."\n"; print "
\n"; diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 2247df9493e..6592bf281e1 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2010 Laurent Destailleur + * Copyright (C) 2005-2014 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2010-2013 Juanjo Menent * @@ -55,7 +55,7 @@ if ($action == "set") if (! $res > 0) $error++; $id=GETPOST('PRELEVEMENT_ID_BANKACCOUNT','int'); - $account = new Account($db, $id); + $account = new Account($db); if($account->fetch($id)>0) { @@ -153,7 +153,7 @@ print $form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT,'PRELEVEME print ''; // ICS -print ''.$langs->trans("ICS").''; +print ''.$langs->trans("ICS").''; print ''; print ''; print ''; @@ -161,7 +161,7 @@ print ''; print ''; print '
'; -print '
'; +print '
'; print ''; diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 5503a906af2..30ae7e71ab3 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -163,6 +163,22 @@ if ($action == 'setdefaultduration') } } +if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL') +{ + $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL",$value,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + setEventMessage($langs->trans("SetupSaved")); + } + else + { + setEventMessage($langs->trans("Error"),'errors'); + } +} + // Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) if ($action == 'setModuleOptions') { @@ -171,28 +187,27 @@ if ($action == 'setModuleOptions') $db->begin(); for($i=0;$i < $post_size;$i++) - { - if (array_key_exists('param'.$i,$_POST)) - { - $param=GETPOST("param".$i,'alpha'); - $value=GETPOST("value".$i,'alpha'); - if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; - } - } + { + if (array_key_exists('param'.$i,$_POST)) + { + $param=GETPOST("param".$i,'alpha'); + $value=GETPOST("value".$i,'alpha'); + if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + } if (! $error) - { - $db->commit(); - setEventMessage($langs->trans("SetupSaved")); - } - else - { - $db->rollback(); - setEventMessage($langs->trans("Error"),'errors'); + { + $db->commit(); + setEventMessage($langs->trans("SetupSaved")); + } + else + { + $db->rollback(); + setEventMessage($langs->trans("Error"),'errors'); } } - // Activate a model if ($action == 'set') { @@ -248,7 +263,7 @@ $form=new Form($db); $linkback='
'.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("PropalSetup"),$linkback,'setup'); -$head = propal_admin_prepare_head(null); +$head = propal_admin_prepare_head(); dol_fiche_head($head, 'general', $langs->trans("Proposals"), 0, 'propal'); @@ -329,18 +344,16 @@ foreach ($dirmodels as $reldir) $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; $propal->type=0; $nextval=$module->getNextValue($mysoc,$propal); - if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval - { - $htmltooltip.=''.$langs->trans("NextValue").': '; - if ($nextval) - { - $htmltooltip.=$nextval.'
'; - } - else - { - $htmltooltip.=$langs->trans($module->error).'
'; - } - } + if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval + $htmltooltip.=''.$langs->trans("NextValue").': '; + if ($nextval) { + if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured') + $nextval = $langs->trans($nextval); + $htmltooltip.=$nextval.'
'; + } else { + $htmltooltip.=$langs->trans($module->error).'
'; + } + } print ''; print $form->textwithpicto('',$htmltooltip,1,0); @@ -583,6 +596,35 @@ print '' print "\n"; print ''; +if ($conf->banque->enabled) +{ + $var=!$var; + print ''; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").' '; + if (! empty($conf->use_javascript_ajax)) + { + print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL'); + } + else + { + if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL)) + { + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + } + else + { + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + } + } + print ''; +} +else +{ + $var=!$var; + print ''; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").' '.$langs->trans('NotAvailable').''; +} + print ''; diff --git a/htdocs/admin/proxy.php b/htdocs/admin/proxy.php index 050c92fd188..2e9d1f49169 100644 --- a/htdocs/admin/proxy.php +++ b/htdocs/admin/proxy.php @@ -86,6 +86,13 @@ print_fiche_titre($langs->trans("SecuritySetup"),'','setup'); print $langs->trans("ProxyDesc")."
\n"; print "
\n"; + + +print '
'; +print ''; +print ''; + + $head=security_prepare_head(); dol_fiche_head($head, 'proxy', $langs->trans("Security")); @@ -118,10 +125,6 @@ if ($conf->use_javascript_ajax) // Timeout $var=true; -print ''; -print ''; -print ''; - print ''; print ''; @@ -196,14 +199,13 @@ print ''; print '
'; -print '
'; -print ''; -print '
'; - -print '
'; - dol_fiche_end(); +print '
'; +print ''; +print '
'; + +print ''; $db->close(); diff --git a/htdocs/admin/salaries.php b/htdocs/admin/salaries.php index 453db8e4203..99651a4f4f3 100644 --- a/htdocs/admin/salaries.php +++ b/htdocs/admin/salaries.php @@ -23,7 +23,7 @@ */ require '../main.inc.php'; - + // Class require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; @@ -36,7 +36,7 @@ if (!$user->admin) $action = GETPOST('action', 'alpha'); -// Other parameters COMPTA_* & ACCOUNTING_* +// Other parameters SALARIES_* $list = array ( 'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT', 'SALARIES_ACCOUNTING_ACCOUNT_CHARGE' @@ -45,7 +45,7 @@ $list = array ( /* * Actions */ - + if ($action == 'update') { $error = 0; @@ -72,12 +72,12 @@ if ($action == 'update') * View */ -llxHeader(); +llxHeader('',$langs->trans('SalariesSetup')); $form = new Form($db); $linkback=''.$langs->trans("BackToModuleList").''; -print_fiche_titre($langs->trans('ConfigSalaries'),$linkback,'setup'); +print_fiche_titre($langs->trans('SalariesSetup'),$linkback,'setup'); print '
'; print ''; @@ -98,7 +98,7 @@ foreach ($list as $key) print ''; // Param - $label = $langs->trans($key); + $label = $langs->trans($key); print ''; // Value diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 43ccef1e954..adb590ffcd2 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -165,6 +165,16 @@ else if ($action == 'disable_MAIN_SECURITY_DISABLEFORGETPASSLINK') exit; } +if ($action == 'maj_pattern') +{ + dolibarr_set_const($db, "USER_PASSWORD_PATTERN", GETPOST("pattern"),'chaine',0,'',$conf->entity); + header("Location: security.php"); + exit; +} + + + + @@ -265,6 +275,113 @@ foreach ($arrayhandler as $key => $module) print ''; print '
'; +//if($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK == 1) +// Patter for Password Perso +if ($conf->global->USER_PASSWORD_GENERATED == "Perso"){ +$var=!$var; + + $tabConf = explode(";",$conf->global->USER_PASSWORD_PATTERN); + /*$this->length2 = $tabConf[0]; + $this->NbMaj = $tabConf[1]; + $this->NbNum = $tabConf[2]; + $this->NbSpe = $tabConf[3]; + $this->NbRepeat = $tabConf[4]; + $this->WithoutAmbi = $tabConf[5]; + */ + print ''; + print ''; + print ''; + print ''; + + $var=!$var; + print ""; + print '"; + print ''; + print ''; + + $var=!$var; + print ""; + print '"; + print ''; + print ''; + + $var=!$var; + print ""; + print '"; + print ''; + print ''; + + $var=!$var; + print ""; + print '"; + print ''; + print ''; + + $var=!$var; + print ""; + print '"; + print ''; + print ''; + + $var=!$var; + print ""; + print '"; + print ''; + print ''; + + $var=!$var; + print ""; + print ''; + print ''; + print '
'.$langs->trans("PasswordPatternDesc").'
' . $langs->trans("MinLength")."
' . $langs->trans("NbMajMin")."
' . $langs->trans("NbNumMin")."
' . $langs->trans("NbSpeMin")."
' . $langs->trans("NbIteConsecutive")."
' . $langs->trans("NoAmbiCaracAutoGeneration")." '.($tabConf[5] ? $langs->trans("Activated") : $langs->trans("Disabled")).'
'.$langs->trans("Save").'
'; + + print ''; +} + + // Cryptage mot de passe print '
'; $var=true; diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php new file mode 100644 index 00000000000..4c0dd435634 --- /dev/null +++ b/htdocs/admin/security_file.php @@ -0,0 +1,214 @@ + + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2013 Juanjo Menent + * + * 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 . + */ + +/** + * \file htdocs/admin/security_file.php + * \ingroup core + * \brief Security options setup + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + +$langs->load("users"); +$langs->load("admin"); +$langs->load("other"); + +if (! $user->admin) + accessforbidden(); + +$action=GETPOST('action','alpha'); + +$upload_dir=$conf->admin->dir_temp; + + +/* + * Actions + */ + +if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) +{ + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + dol_add_file_process($upload_dir, 0, 0, 'userfile'); +} + +if (preg_match('/set_(.*)/',$action,$reg)) +{ + $code=$reg[1]; + $value=(GETPOST($code) ? GETPOST($code) : 1); + if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0) + { + Header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } +} + +else if (preg_match('/del_(.*)/',$action,$reg)) +{ + $code=$reg[1]; + if (dolibarr_del_const($db, $code, $conf->entity) > 0) + { + Header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } +} + +else if ($action == 'updateform') +{ + $res3=dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',$_POST["MAIN_UPLOAD_DOC"],'chaine',0,'',$conf->entity); + $res4=dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity); + $res5=dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity); + $res6=dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity); + if ($res3 && $res4 && $res5 && $res6) setEventMessage($langs->trans("RecordModifiedSuccessfully")); +} + + + +// Delete file +else if ($action == 'delete') +{ + $langs->load("other"); + $file = $conf->admin->dir_temp . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). + $ret=dol_delete_file($file); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); + Header('Location: '.$_SERVER["PHP_SELF"]); + exit; +} + +/* + * View + */ + +$form = new Form($db); + +llxHeader('',$langs->trans("Files")); + +print_fiche_titre($langs->trans("SecuritySetup"),'','setup'); + +//print $langs->trans("FilesDesc")."
\n"; +//print "
\n"; + + + +print '
'; +print ''; +print ''; + +$head=security_prepare_head(); + +dol_fiche_head($head, 'file', $langs->trans("Security")); + + +// Upload options +$var=false; + +print ''; +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; + +$var=!$var; +print ''; +print ''; +print ''; +print ''; + +// Use anti virus +$var=!$var; +print ""; +print ''; +print '"; +print ''; + +// Use anti virus +$var=!$var; +print ""; +print ''; +print '"; +print ''; + +print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("MaxSizeForUploadedFiles").'.'; +$max=@ini_get('upload_max_filesize'); +if ($max) print ' '.$langs->trans("MustBeLowerThanPHPLimit",$max*1024,$langs->trans("Kb")).'.'; +else print ' '.$langs->trans("NoMaxSizeByPHPLimit").'.'; +print ''; +print ' '.$langs->trans("Kb"); +print '
'.$langs->trans("UMask").''; +print $form->textwithpicto('',$langs->trans("UMaskExplanation")); +print ''; +print ''; +print '
'.$langs->trans("AntiVirusCommand").'
'; +print $langs->trans("AntiVirusCommandExample"); +// Check command in inside safe_mode +print '
'; +if (ini_get('safe_mode') && ! empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) +{ + $langs->load("errors"); + $basedir=preg_replace('/"/','',dirname($conf->global->MAIN_ANTIVIRUS_COMMAND)); + $listdir=explode(';',ini_get('safe_mode_exec_dir')); + if (! in_array($basedir,$listdir)) + { + print img_warning($langs->trans('WarningSafeModeOnCheckExecDir')); + dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING); + } +} +print ''; +print "
'.$langs->trans("AntiVirusParam").'
'; +print $langs->trans("AntiVirusParamExample"); +print '
'; +print ''; +print "
'; + +dol_fiche_end(); + +print '
'; + +print '
'; + + + +// Form to test upload +print '
'; +$formfile=new FormFile($db); +$formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestFileUploadForm"), 0, 0, 1, 50, '', '', 1, '', 0); + +// List of document +$filearray=dol_dir_list($upload_dir, "files", 0, '', '', 'name', SORT_ASC, 1); +$formfile->list_of_documents($filearray, '', 'admin_temp', ''); + +llxFooter(); +$db->close(); diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 8c65d1f3359..4dc0c0e06a3 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -37,20 +37,12 @@ if (! $user->admin) $action=GETPOST('action','alpha'); -$upload_dir=$conf->admin->dir_temp; /* * Actions */ -if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) -{ - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - dol_add_file_process($upload_dir, 0, 0, 'userfile'); -} - if (preg_match('/set_(.*)/',$action,$reg)) { $code=$reg[1]; @@ -80,51 +72,15 @@ else if (preg_match('/del_(.*)/',$action,$reg)) } } -else if ($action == 'MAIN_SESSION_TIMEOUT') +else if ($action == 'updateform') { - if (! dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else setEventMessage($langs->trans("RecordModifiedSuccessfully")); -} -else if ($action == 'MAIN_UPLOAD_DOC') -{ - if (! dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',$_POST["MAIN_UPLOAD_DOC"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else setEventMessage($langs->trans("RecordModifiedSuccessfully")); -} -else if ($action == 'MAIN_UMASK') -{ - if (! dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else setEventMessage($langs->trans("RecordModifiedSuccessfully")); -} -else if ($action == 'MAIN_ANTIVIRUS_COMMAND') -{ - if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else setEventMessage($langs->trans("RecordModifiedSuccessfully")); -} -else if ($action == 'MAIN_ANTIVIRUS_PARAM') -{ - if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else setEventMessage($langs->trans("RecordModifiedSuccessfully")); -} -else if ($action == 'MAIN_APPLICATION_TITLE') -{ - if (! dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else setEventMessage($langs->trans("RecordModifiedSuccessfully")); + $res1=dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", $_POST["MAIN_APPLICATION_TITLE"],'chaine',0,'',$conf->entity); + $res2=dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity); + if ($res1 && $res2) setEventMessage($langs->trans("RecordModifiedSuccessfully")); } -// Delete file -else if ($action == 'delete') -{ - $langs->load("other"); - $file = $conf->admin->dir_temp . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - $ret=dol_delete_file($file); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); - else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); - Header('Location: '.$_SERVER["PHP_SELF"]); - exit; -} - /* * View */ @@ -138,59 +94,17 @@ print_fiche_titre($langs->trans("SecuritySetup"),'','setup'); print $langs->trans("MiscellaneousDesc")."
\n"; print "
\n"; + + +print '
'; +print ''; +print ''; + $head=security_prepare_head(); dol_fiche_head($head, 'misc', $langs->trans("Security")); -// Timeout -$var=true; - -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; - -$var=!$var; -$sessiontimeout=ini_get("session.gc_maxlifetime"); -if (empty($conf->global->MAIN_SESSION_TIMEOUT)) $conf->global->MAIN_SESSION_TIMEOUT=$sessiontimeout; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - -$var=!$var; -$sessiontimeout=ini_get("session.gc_maxlifetime"); -if (empty($conf->global->MAIN_APPLICATION_TITLE)) $conf->global->MAIN_APPLICATION_TITLE=""; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - -print '
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
'.$langs->trans("SessionTimeOut").''; -print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor"))); -print ''; -print ' '.strtolower($langs->trans("Seconds")); -print ''; -print ''; -print '
'.$langs->trans("HiddeNumVersion").''; -print $form->textwithpicto('',$langs->trans("HiddeNumVersionExample",ini_get("session.gc_probability"),ini_get("session.gc_divisor"))); -print ''; -print ' '; -print ''; -print ''; -print '
'; -print '
'; - - // Other Options $var=true; @@ -254,107 +168,50 @@ print ""; print ''; + print '
'; -// Upload options -$var=false; -print ''; +// Timeout +$var=true; + +print '
'; print ''; print ''; print ''; -print ''; -print ''; +print "\n"; -print ''; -print ''; +$var=!$var; +$sessiontimeout=ini_get("session.gc_maxlifetime"); +if (empty($conf->global->MAIN_SESSION_TIMEOUT)) $conf->global->MAIN_SESSION_TIMEOUT=$sessiontimeout; print ''; -print ''; print ''; -print ''; -print ''; +print ''; $var=!$var; -print ''; -print ''; +$sessiontimeout=ini_get("session.gc_maxlifetime"); +if (empty($conf->global->MAIN_APPLICATION_TITLE)) $conf->global->MAIN_APPLICATION_TITLE=""; print ''; -print ''; print ''; -print ''; -print ''; - -// Use anti virus -$var=!$var; -print ''; -print ''; -print ""; -print ''; -print '"; -print ''; print ''; -print ''; - -// Use anti virus -$var=!$var; -print ''; -print ''; -print ""; -print ''; -print '"; -print ''; -print ''; -print ''; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
'.$langs->trans("MaxSizeForUploadedFiles").'.'; -$max=@ini_get('upload_max_filesize'); -if ($max) print ' '.$langs->trans("MustBeLowerThanPHPLimit",$max*1024,$langs->trans("Kb")).'.'; -else print ' '.$langs->trans("NoMaxSizeByPHPLimit").'.'; +print ''.$langs->trans("SessionTimeOut").''; +print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor"))); print ''; -print ' '.$langs->trans("Kb"); +print ' '.strtolower($langs->trans("Seconds")); print ''; -print ''; -print '
'.$langs->trans("UMask").''; -print $form->textwithpicto('',$langs->trans("UMaskExplanation")); +print ''.$langs->trans("MAIN_APPLICATION_TITLE").''; print ''; -print ''; -print ''; -print ''; -print '
'.$langs->trans("AntiVirusCommand").'
'; -print $langs->trans("AntiVirusCommandExample"); -// Check command in inside safe_mode -print '
'; -if (ini_get('safe_mode') && ! empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) -{ - $langs->load("errors"); - $basedir=preg_replace('/"/','',dirname($conf->global->MAIN_ANTIVIRUS_COMMAND)); - $listdir=explode(';',ini_get('safe_mode_exec_dir')); - if (! in_array($basedir,$listdir)) - { - print img_warning($langs->trans('WarningSafeModeOnCheckExecDir')); - dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING); - } -} -print ''; -print "'; -print ''; +print ' '; print '
'.$langs->trans("AntiVirusParam").'
'; -print $langs->trans("AntiVirusParamExample"); -print '
'; -print ''; -print "'; -print ''; -print '
'; dol_fiche_end(); -// Form to test upload -print '
'; -$formfile=new FormFile($db); -$formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestFileUploadForm"), 0, 0, 1, 50, '', '', 1, '', 0); +print '
'; + +print ''; -// List of document -$filearray=dol_dir_list($upload_dir, "files", 0, '', '', 'name', SORT_ASC, 1); -$formfile->list_of_documents($filearray, '', 'admin_temp', ''); llxFooter(); $db->close(); diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index 0ba8427cca5..6213acec5b7 100644 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -203,11 +203,11 @@ if ($action == 'edit') */ print ''; - print '
'; + print '
'; print ''; - print '     '; + print '     '; print ''; - print '
'; + print ''; print ''; print '
'; diff --git a/htdocs/admin/spip.php b/htdocs/admin/spip.php index af46c074bb9..9c81338562e 100644 --- a/htdocs/admin/spip.php +++ b/htdocs/admin/spip.php @@ -117,10 +117,11 @@ $head = mailmanspip_admin_prepare_head(); dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user'); +$var=true; + /* * Spip */ -$var=!$var; if (! empty($conf->global->ADHERENT_USE_SPIP)) { //$lien=img_picto($langs->trans("Active"),'tick').' '; diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index d0582a91630..6b2c626da39 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -113,35 +113,20 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("StockSetup"),$linkback,'setup'); $form=new Form($db); -$var=true; -print ''; -print ''; -print " \n"; -print " \n"; -print ''."\n"; -/* - * Formulaire parametres divers - */ +$disabled=''; +if (! empty($conf->productbatch->enabled)) +{ + $langs->load("productbatch"); + $disabled=' disabled="disabled"'; + print info_admin($langs->trans("WhenProductBatchModuleOnOptionAreForced")); +} -$var=!$var; - -print ""; -print ''; - -print '\n"; -print "\n"; -print '
'; -print '
".$langs->trans("Parameters")." 
'.$langs->trans("UserWarehouseAutoCreate").''; -print "
"; -print ''; -print ""; -print $form->selectyesno("STOCK_USERSTOCK_AUTOCREATE",$conf->global->STOCK_USERSTOCK_AUTOCREATE,1); -print ''; -print '
'; -print "
'; -print '
'; +//if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) || ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) +//{ +print info_admin($langs->trans("IfYouUsePointOfSaleCheckModule")); +//} // Title rule for stock decrease print ''; @@ -160,8 +145,8 @@ if (! empty($conf->facture->enabled)) print ""; print ''; print ""; - print $form->selectyesno("STOCK_CALCULATE_ON_BILL",$conf->global->STOCK_CALCULATE_ON_BILL,1); - print ''; + print $form->selectyesno("STOCK_CALCULATE_ON_BILL",$conf->global->STOCK_CALCULATE_ON_BILL,1,$disabled); + print ''; print "\n\n\n"; } @@ -174,8 +159,8 @@ if (! empty($conf->commande->enabled)) print ""; print ''; print ""; - print $form->selectyesno("STOCK_CALCULATE_ON_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER,1); - print ''; + print $form->selectyesno("STOCK_CALCULATE_ON_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER,1,$disabled); + print ''; print "\n\n\n"; } @@ -188,11 +173,12 @@ if (! empty($conf->expedition->enabled)) print ""; print ''; print ""; - print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT",$conf->global->STOCK_CALCULATE_ON_SHIPMENT,1); - print ''; + print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT",$conf->global->STOCK_CALCULATE_ON_SHIPMENT,1,$disabled); + print ''; print "\n\n\n"; } print '
'; + print '
'; // Title rule for stock increase @@ -212,8 +198,8 @@ if (! empty($conf->fournisseur->enabled)) print "
"; print ''; print ""; - print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_BILL",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL,1); - print ''; + print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_BILL",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL,1,$disabled); + print ''; print "
\n\n\n"; } @@ -226,8 +212,8 @@ if (! empty($conf->fournisseur->enabled)) print "
"; print ''; print ""; - print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER,1); - print ''; + print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER,1,$disabled); + print ''; print "
\n\n\n"; } if (! empty($conf->fournisseur->enabled)) @@ -239,8 +225,8 @@ if (! empty($conf->fournisseur->enabled)) print "
"; print ''; print ""; - print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER,1); - print ''; + print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER,1,$disabled); + print ''; print "
\n\n\n"; } @@ -329,6 +315,34 @@ if ($virtualdiffersfromphysical) print ''; } + +$var=true; +print ''; + +print ''; +print " \n"; +print " \n"; +print ''."\n"; + +$var=!$var; + +print ""; +print ''; + +print '\n"; +print "\n"; +print '
'; +print '
".$langs->trans("Other")." 
'.$langs->trans("UserWarehouseAutoCreate").''; +print "
"; +print ''; +print ""; +print $form->selectyesno("STOCK_USERSTOCK_AUTOCREATE",$conf->global->STOCK_USERSTOCK_AUTOCREATE,1); +print ''; +print '
'; +print "
'; +print '
'; + + llxFooter(); $db->close(); diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 5745c5f82ba..19b5e89b0dd 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -198,7 +198,7 @@ print_fiche_titre($langs->trans("SuppliersSetup"),$linkback,'setup'); print "
"; -$head = supplierorder_admin_prepare_head(null); +$head = supplierorder_admin_prepare_head(); dol_fiche_head($head, 'invoice', $langs->trans("Suppliers"), 0, 'company'); @@ -278,15 +278,13 @@ foreach ($dirmodels as $reldir) $htmltooltip=''; $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; $nextval=$module->getNextValue($mysoc,$invoice); - if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval - { + if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval $htmltooltip.=''.$langs->trans("NextValue").': '; - if ($nextval) - { + if ($nextval) { + if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured') + $nextval = $langs->trans($nextval); $htmltooltip.=$nextval.'
'; - } - else - { + } else { $htmltooltip.=$langs->trans($module->error).'
'; } } diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index ac2ab824233..24e1682eb18 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -199,7 +199,7 @@ print_fiche_titre($langs->trans("SuppliersSetup"),$linkback,'setup'); print "
"; -$head = supplierorder_admin_prepare_head(null); +$head = supplierorder_admin_prepare_head(); dol_fiche_head($head, 'order', $langs->trans("Suppliers"), 0, 'company'); @@ -279,15 +279,13 @@ foreach ($dirmodels as $reldir) $htmltooltip=''; $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; $nextval=$module->getNextValue($mysoc,$commande); - if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval - { + if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval $htmltooltip.=''.$langs->trans("NextValue").': '; - if ($nextval) - { + if ($nextval) { + if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured') + $nextval = $langs->trans($nextval); $htmltooltip.=$nextval.'
'; - } - else - { + } else { $htmltooltip.=$langs->trans($module->error).'
'; } } diff --git a/htdocs/admin/supplierinvoice_extrafields.php b/htdocs/admin/supplierinvoice_extrafields.php index ba584bdae8c..e47c8738041 100644 --- a/htdocs/admin/supplierinvoice_extrafields.php +++ b/htdocs/admin/supplierinvoice_extrafields.php @@ -38,6 +38,7 @@ if (!$user->admin) $langs->load("admin"); $langs->load("other"); $langs->load("bills"); +$langs->load("orders"); $langs->load("suppliers"); $extrafields = new ExtraFields($db); @@ -75,7 +76,7 @@ $linkback='
'.$langs->trans("BackToM print_fiche_titre($langs->trans("SuppliersSetup"),$linkback,'setup'); print "
\n"; -$head = supplierorder_admin_prepare_head(null); +$head = supplierorder_admin_prepare_head(); dol_fiche_head($head, 'supplierinvoice', $langs->trans("Suppliers"), 0, 'company'); diff --git a/htdocs/admin/supplierorder_extrafields.php b/htdocs/admin/supplierorder_extrafields.php index 4a2671942fa..96e20b92f17 100644 --- a/htdocs/admin/supplierorder_extrafields.php +++ b/htdocs/admin/supplierorder_extrafields.php @@ -73,7 +73,7 @@ $linkback='
'.$langs->trans("BackToM print_fiche_titre($langs->trans("SuppliersSetup"),$linkback,'setup'); print "
\n"; -$head = supplierorder_admin_prepare_head(null); +$head = supplierorder_admin_prepare_head(); dol_fiche_head($head, 'supplierorder', $langs->trans("Suppliers"), 0, 'company'); diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index b69e8a4cacf..18de8bf6bfc 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -183,8 +183,9 @@ foreach ($syslogModules as $moduleName) { $module = new $moduleName; - $moduleactive=$module->isActive(); - if ($moduleactive == -1 && empty($conf->global->MAIN_FEATURES_LEVEL)) continue; // Some modules are hidden if not activable and not into debug mode (end user must not see them) + $moduleactive=(int) $module->isActive(); + //print $moduleName." = ".$moduleactive." - ".$module->getName()." ".($moduleactive == -1)."
\n"; + if (($moduleactive == -1) && empty($conf->global->MAIN_FEATURES_LEVEL)) continue; // Some modules are hidden if not activable and not into debug mode (end user must not see them) $var=!$var; print ''; @@ -199,7 +200,7 @@ foreach ($syslogModules as $moduleName) { foreach ($setuparray as $option) { - if (isset($_POST[$option['constant']])) $value=$_POST[$option['constant']]; + if (isset($_POST[$option['constant']])) $value=$_POST[$option['constant']]; else if (defined($option['constant'])) $value = constant($option['constant']); else $value = (isset($option['default']) ? $option['default'] : ''); @@ -220,7 +221,7 @@ foreach ($syslogModules as $moduleName) print "\n"; print "\n"; -print '
'; +print '
'."\n\n"; print_titre($langs->trans("SyslogLevel")); diff --git a/htdocs/admin/system/about.php b/htdocs/admin/system/about.php index e7490225107..532293cdad2 100644 --- a/htdocs/admin/system/about.php +++ b/htdocs/admin/system/about.php @@ -51,8 +51,8 @@ print ''; print $langs->trans("Developpers").':'; print '
'; //print "
\n"; @@ -61,31 +61,31 @@ print $langs->trans("OtherInformations").':'; print ''; print $langs->trans("Demo").':'; print ''; print $langs->trans("ModulesMarketPlaces").':'; print ''; @@ -94,7 +94,7 @@ print $langs->trans("HelpCenter").':'; print ''; @@ -104,11 +104,11 @@ print ''; @@ -120,11 +120,11 @@ $url='http://saas.dolibarr.org'; $title=$langs->trans("OfficialWebHostingService if (preg_match('/^fr_/i',$langs->getDefaultLang())) $url='http://wiki.dolibarr.org/index.php/Solutions_de_Cloud'; if (preg_match('/^es_/i',$langs->getDefaultLang())) $url='http://wiki.dolibarr.org/index.php/Soluciones_en_la_Nube'; print '
  • '; -print ''.$title.''; +print ''.$title.''; print '
  • '; $url='http://partners.dolibarr.org'; $title=$langs->trans("ReferencedPreferredPartners"); print '
  • '; -print ''.$title.''; +print ''.$title.''; print '
  • '; print ''; diff --git a/htdocs/admin/system/index.php b/htdocs/admin/system/index.php index 30bd3f80d4a..64df9432e82 100644 --- a/htdocs/admin/system/index.php +++ b/htdocs/admin/system/index.php @@ -117,4 +117,3 @@ print info_admin($langs->trans("SystemInfoDesc")).'
    '; llxFooter(); $db->close(); - diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index 27c447e7c15..0e49564ece7 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -24,6 +24,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $langs->load("admin"); $langs->load("install"); @@ -51,6 +52,13 @@ print_fiche_titre($langs->trans("PerfDolibarr"),'','setup'); print $langs->trans("YouMayFindPerfAdviceHere",'http://wiki.dolibarr.org/index.php/FAQ_Increase_Performance').' ('.$langs->trans("Reload").')
    '; +// Recupere la version de PHP +$phpversion=version_php(); +print "
    PHP - ".$langs->trans("Version").": ".$phpversion."
    \n"; + +// Recupere la version du serveur web +print "
    Web server - ".$langs->trans("Version").": ".$_SERVER["SERVER_SOFTWARE"]."
    \n"; + // XDebug print '
    '; print ''.$langs->trans("XDebug").': '; diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 22fecdfd524..681c5d43cf3 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -54,7 +54,7 @@ print "\n"; $var=false; -// Recupere la version de l'OS +// Recupere la version de PHP $phpversion=version_php(); print "'.$langs->trans("Version")."".$phpversion."\n"; diff --git a/htdocs/admin/tools/eaccelerator.php b/htdocs/admin/tools/eaccelerator.php index 8f82f33d039..a968b47050a 100644 --- a/htdocs/admin/tools/eaccelerator.php +++ b/htdocs/admin/tools/eaccelerator.php @@ -34,189 +34,195 @@ if (!$user->admin) accessforbidden(); llxHeader(); -if (!function_exists('eaccelerator_info')) -{ - print 'eAccelerator is not installed.'; - llxFooter(); - exit; +if (!function_exists('eaccelerator_info')) { + print 'eAccelerator is not installed.'; + llxFooter(); + exit; } $info = eaccelerator_info(); if (isset($_POST['caching'])) { - if ($info['cache']) { - eaccelerator_caching(false); - } else { - eaccelerator_caching(true); - } + if ($info['cache']) { + eaccelerator_caching(false); + } else { + eaccelerator_caching(true); + } } else if (isset($_POST['optimizer']) && function_exists('eaccelerator_optimizer')) { - if ($info['optimizer']) { - eaccelerator_optimizer(false); - } else { - eaccelerator_optimizer(true); - } + if ($info['optimizer']) { + eaccelerator_optimizer(false); + } else { + eaccelerator_optimizer(true); + } } else if (isset($_POST['clear'])) { - eaccelerator_clear(); + eaccelerator_clear(); } else if (isset($_POST['clean'])) { - eaccelerator_clean(); + eaccelerator_clean(); } else if (isset($_POST['purge'])) { - eaccelerator_purge(); + eaccelerator_purge(); } $info = eaccelerator_info(); if (!is_array($info)) { - dol_print_error('','An error occured getting eAccelerator information, this is caused if eAccelerator isn\'t initalised properly'); - exit; + dol_print_error('','An error occured getting eAccelerator information, this is caused if eAccelerator isn\'t initalised properly'); + exit; } - +/** + * Compare revisions + * + * @param array $x Parts of version 1 + * @param array $y Parts of version 2 + * @return int -1 if 1<2, 0 if 1=2, 1 if 1>2 + */ function compare($x, $y) { - global $sortby; + global $sortby; - if ( $x[$sortby] == $y[$sortby] ) - return 0; - else if ( $x[$sortby] < $y[$sortby] ) - return -1; - else - return 1; + if ( $x[$sortby] == $y[$sortby] ) { + return 0; + } else if ($x[$sortby] < $y[$sortby]) { + return -1; + } else { + return 1; + } } /** * Compare revisions * - * @param array $x Parts of version 1 - * @param array $y Parts of version 2 - * @return int 1 if 1<2, 0 if 1=2, -1 if 1>2 + * @param array $x Parts of version 1 + * @param array $y Parts of version 2 + * @return int 1 if 1<2, 0 if 1=2, -1 if 1>2 */ function revcompare($x, $y) { - global $sortby, $langs; + global $sortby, $langs; - if ( $x[$sortby] == $y[$sortby] ) - return 0; - else if ( $x[$sortby] < $y[$sortby] ) - return 1; - else - return -1; + if ($x[$sortby] == $y[$sortby]) { + return 0; + } else if ($x[$sortby] < $y[$sortby]) { + return 1; + } else { + return -1; + } } /** * Output table * - * @param array $list Array of records - * @return void + * @param array $list Array of records + * @return void */ function create_script_table($list) { - global $sortby,$bc,$langs; - $var=true; + global $sortby,$bc,$langs; + $var=true; - if (isset($_GET['order']) && ($_GET['order'] == "asc" || $_GET['order'] =="desc")) { - $order = $_GET['order']; - } else { - $order = "asc"; - } + if (isset($_GET['order']) && ($_GET['order'] == "asc" || $_GET['order'] =="desc")) { + $order = $_GET['order']; + } else { + $order = "asc"; + } - if (isset($_GET['sort'])) { - switch ($_GET['sort']) { - case "mtime": - case "size": - case "reloads": - case "hits": - $sortby = $_GET['sort']; - ($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare')); - break; - default: - $sortby = "file"; - ($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare')); - } - } + if (isset($_GET['sort'])) { + switch ($_GET['sort']) { + case "mtime": + case "size": + case "reloads": + case "hits": + $sortby = $_GET['sort']; + ($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare')); + break; + default: + $sortby = "file"; + ($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare')); + } + } - ?> - - - - - - - - - '; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + switch ($sortby) { + case "mtime": + case "size": + case "reloads": + case "hits": + ($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare')); + break; + case "file": + default: + $sortby = "file"; + ($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare')); - } + } + + foreach($list as $script) { + $var = ! $var; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + print '
    ">trans("Filename"); ?> ">trans("Date"); ?> ">trans("Size"); ?> ">trans("Reloads"); ?> ">trans("Hits"); ?> 
    '.$langs->trans("Filename").' '; + if($sortby == "file") + print ($order == "asc" ? "↓" : "↑").''.$langs->trans("Date").' '; + if($sortby == "mtime") + print ($order == "asc" ? "↓" : "↑").''.$langs->trans("Size").' '; + if($sortby == "size") + print ($order == "asc" ? "↓" : "↑").''.$langs->trans("Reloads").' '; + if($sortby == "reloads") + print ($order == "asc" ? "↓" : "↑").''.$langs->trans("Hits").' '; + if($sortby == "hits") + print ($order == "asc" ? "↓" : "↑").'
    '.dol_trunc($script['file'],80,'left').''.dol_print_date($script['mtime'],'dayhour').''.number_format($script['size'] / 1024, 2).'KB'.$script['reloads'].' ('.$script['usecount'].')'.$script['hits'].'
    '; - foreach($list as $script) { ?> - > - - - - KB - () - - - - - - - - - - - - - - > - - - - - - -
    NameCreatedtrans("Size"); ?>ttl
    - KB
    - '; + print ''; + print 'Name'; + print 'Created'; + print ''.$langs->trans("Size").''; + print 'ttl'; + print ''; + + foreach($list as $key) { + $var = !$var; + print ''; + print ''.dol_trunc($key['name'],80,'left').''; + print ''.dol_print_date($key['created'],'dayhour').''; + print ''.number_format($key['size']/1024, 3).'KB'; + print ''; + if ($key['ttl'] == -1) { + print 'expired'; + } elseif ($key['ttl'] == 0) { + print 'none'; + } else { + print dol_print_date($key['ttl'],'dayhour'); + } + print ''; + print ''; + } + print ''; } @@ -225,123 +231,117 @@ print_fiche_titre('Dolibarr eAccelerator '.$info['version'].' control panel','', $var=true; -?> -
    +print '
    '; - - - - - > - - - - > - - - - > - - - - > - - - - > - - - - > - - - - > - - - -
    Information
    Caching enabled
    Optimizer enabled
    Memory usage% - ( - MB / - MB)
    Free memory in reserved cacheMB
    Cached scripts
    Removed scripts
    Cached keys
    -'; +print ''; +print 'Information'; +print ''; +$var = !$var; +print ''; +print 'Caching enabled'; +print ''.($info['cache']?'yes':'no').''; +print ''; +$var = !$var; +print ''; +print 'Optimizer enabled'; +print ''.$info['optimizer']?'yes':'no'.''; +print ''; +$var = !$var; +print ''; +print 'Memory usage'; +print ''.number_format(100 * $info['memoryAllocated']/$info['memorySize'], 2).'%('.number_format($info['memoryAllocated'] / (1024*1024), 2).'MB / '.number_format($info['memorySize']/(1024*1024), 2).'MB)'; +print ''; +$var = ! $var; +print ''; +print 'Free memory in reserved cache'; +print ''.number_format($info['memoryAvailable']/(1024*1024), 2).'MB'; +print ''; +$var = ! $var; +print ''; +print 'Cached scripts'; +print ''.$info['cachedScripts'].''; +print ''; +$var = ! $var; +print ''; +print 'Removed scripts'; +print ''.$info['removedScripts'].''; +print ''; +$var = ! $var; +print ''; +print 'Cached keys'; +print ''.(isset($info['cachedKeys'])?$info['cachedKeys']:'').''; +print ''; +print ''; $var=true; -$resCached = @eaccelerator_cached_scripts(); // If success return an array +$resCached = @eaccelerator_cached_scripts(); // If success return an array $resRemoved = @eaccelerator_removed_scripts(); -if (is_array($resCached) || is_array($resRemoved)) -{ - print "
    "; - print '
    '; - print ''; - print ''; - print ''; +if (is_array($resCached) || is_array($resRemoved)) { + print "
    "; + print ''; + print ''; + print '
    Actions
    '; + print ''; - if (is_array($resCached)) - { - $var = ! $var; - print ""; - print ""; - print ''; - print ""; - $var = ! $var; - print ""; - print ""; - print ''; - print ""; - } + if (is_array($resCached)) { + $var = ! $var; + print ""; + print ""; + print ''; + print ""; + $var = ! $var; + print ""; + print ""; + print ''; + print ""; + } - if (is_array($resRemoved)) - { - $var = ! $var; - print ""; - print ""; - print ''; - print ""; - $var = ! $var; - print ""; - print ""; - print ''; - print ""; - $var = ! $var; - print ""; - print ""; - print ''; - print "
    Actions
    Caching
    Optimizer
    Caching
    Optimizer
    Clear cache
    Clean cache
    Purge cache
    "; - } + if (is_array($resRemoved)) { + $var = ! $var; + print ""; + print "Clear cache"; + print ''; + print ""; + $var = ! $var; + print ""; + print "Clean cache"; + print ''; + print ""; + $var = ! $var; + print ""; + print "Purge cache"; + print ''; + print ""; + } - if (is_array($resCached)) - { - print "

    "; - print "Cached scripts
    "; - create_script_table($resCached); - } + if (is_array($resCached)) { + print "

    "; + print "Cached scripts
    "; + create_script_table($resCached); + } - if (is_array($resRemoved)) - { - print "

    "; - print "Removed scripts
    "; - create_script_table($resRemoved); - } -} -else -{ - print "

    "; - print "Check in your php.ini that eaccelerator.allowed_admin_path parameter is : "; - print "

    "; - print "".$_SERVER["SCRIPT_FILENAME"].""; - print "

    "; + if (is_array($resRemoved)) { + print "

    "; + print "Removed scripts
    "; + create_script_table($resRemoved); + } +} else { + print "

    "; + print "Check in your php.ini that eaccelerator.allowed_admin_path parameter is : "; + print "

    "; + print "".$_SERVER["SCRIPT_FILENAME"].""; + print "

    "; } -if (function_exists('eaccelerator_get')) -{ - print '

    '; - print 'Cached keys
    '; - $res=eaccelerator_list_keys(); - create_key_table($res); +if (function_exists('eaccelerator_get')) { + print '

    '; + print 'Cached keys
    '; + $res=eaccelerator_list_keys(); + create_key_table($res); } print "

    "; diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 203776bc7f9..0831571ace1 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -485,7 +485,7 @@ function backup_tables($outputfile, $tables='*') $row[$j] = "''"; } elseif(is_numeric($row[$j]) and !strcmp($row[$j], $row[$j]+0) ) { // test if it's a numeric type and the numeric version ($nb+0) == string version (eg: if we have 01, it's probably not a number but rather a string, else it would not have any leading 0) // if it's a number, we return it as-is - $row[$j] = $row[$j]; +// $row[$j] = $row[$j]; } else { // else for all other cases we escape the value and put quotes around $row[$j] = addslashes($row[$j]); $row[$j] = preg_replace("#\n#", "\\n", $row[$j]); diff --git a/htdocs/admin/tools/index.php b/htdocs/admin/tools/index.php index ec72b30864f..abb9710cc03 100644 --- a/htdocs/admin/tools/index.php +++ b/htdocs/admin/tools/index.php @@ -53,7 +53,7 @@ print '

    '; // Show logo -print '
    '; +print '
    '; llxFooter(); $db->close(); diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index c2671f698a4..fe577419eaf 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -229,10 +229,11 @@ if ($result) // Description print ''; $text=$langs->trans($obj->description); - if (preg_match('/\((.*)\)/i',$obj->description,$reg)) + if (preg_match('/\((.*)\)(.*)/i',$obj->description,$reg)) { $val=explode(',',$reg[1]); $text=$langs->trans($val[0], isset($val[1])?$val[1]:'', isset($val[2])?$val[2]:'', isset($val[3])?$val[3]:'', isset($val[4])?$val[4]:''); + if (! empty($reg[2])) $text.=$reg[2]; } print $text; print ''; diff --git a/htdocs/admin/tools/purge.php b/htdocs/admin/tools/purge.php index 4f3f14302fd..a872c0676f2 100644 --- a/htdocs/admin/tools/purge.php +++ b/htdocs/admin/tools/purge.php @@ -151,7 +151,7 @@ print ''; if ($choice != 'confirm_allfiles') { print '
    '; - print '
    '; + print '
    '; } print ''; diff --git a/htdocs/admin/triggers.php b/htdocs/admin/triggers.php index fc9d0489e9a..85139b56ba9 100644 --- a/htdocs/admin/triggers.php +++ b/htdocs/admin/triggers.php @@ -50,7 +50,7 @@ print "
    \n"; $template_dir = DOL_DOCUMENT_ROOT.'/core/tpl/'; $interfaces = new Interfaces($db); -$triggers = $interfaces->getTriggersList(0,'priority'); +$triggers = $interfaces->getTriggersList(); print ' diff --git a/htdocs/asterisk/cidlookup.php b/htdocs/asterisk/cidlookup.php index d1dcb501f41..6b566e60f55 100644 --- a/htdocs/asterisk/cidlookup.php +++ b/htdocs/asterisk/cidlookup.php @@ -28,10 +28,17 @@ * */ -$phone = $_GET['phone']; include '../master.inc.php'; +$phone = GETPOST('phone'); + + +// Security check +if (empty($conf->clicktodial->enabled)) { + print "Error: Module Click to dial not active\n"; + exit; +} // Check parameters if (empty($phone)) diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index 1484566dbaf..19fb5c193bb 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -287,7 +287,7 @@ if ($conf->product->enabled || $conf->product->service) { print $langs->trans("BarCodeNumberManager").": "; $objproduct=new Product($db); - print ''.$modBarCodeProduct->nom.' - '.$langs->trans("NextValue").': '.$modBarCodeProduct->getNextValue($objproduct).'
    '; + print ''.(isset($modBarCodeProduct->name)?$modBarCodeProduct->name:$modBarCodeProduct->nom).' - '.$langs->trans("NextValue").': '.$modBarCodeProduct->getNextValue($objproduct).'
    '; $disabled=0; } else diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index d862cb5da8f..0ce692674b1 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -121,8 +121,8 @@ if ($action == 'builddoc') if (! $error) { $code=$forbarcode; - $generator=$stdobject->barcode_type_coder; - $encoding=strtoupper($stdobject->barcode_type_code); + $generator=$stdobject->barcode_type_coder; // coder (loaded by fetch_barcode). Engine. + $encoding=strtoupper($stdobject->barcode_type_code); // code (loaded by fetch_barcode). Example 'ean', 'isbn', ... $barcodeimage=$conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png'; $diroutput=$conf->barcode->dir_temp; diff --git a/htdocs/bookmarks/admin/bookmark.php b/htdocs/bookmarks/admin/bookmark.php index 68adb30f7ab..95be1b5251a 100644 --- a/htdocs/bookmarks/admin/bookmark.php +++ b/htdocs/bookmarks/admin/bookmark.php @@ -80,7 +80,7 @@ print ''; -print '
    '; print $langs->trans("NbOfBoomarkToShow").''; print ''; print '

    '; +print '
    '; $db->close(); diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index ebfe7e78db6..a9d2d7eb6c0 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -48,11 +48,11 @@ function printBookmarksList($aDb, $aLangs) // Menu bookmark $ret.= ''; print ''; } diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index 7f8ceac853e..a77751fcb29 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -93,7 +93,7 @@ if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user,$objecttype,$objectid,$dbtablename,'','',$fieldid); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('categorycard')); +$hookmanager->initHooks(array('categorycard','globalcard')); /* @@ -102,7 +102,7 @@ $hookmanager->initHooks(array('categorycard')); $parameters=array('id'=>$socid); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks -$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors); +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) { @@ -207,8 +207,7 @@ if (empty($reshook)) } else { - setEventMessage($cat->error,'errors'); - setEventMessage($cat->errors,'errors'); + setEventMessages($cat->error,$this->errors,'errors'); } } } @@ -279,7 +278,7 @@ if ($socid) // Address print ''.$langs->trans('Address').''; - print dol_print_address($soc->address,'gmap','thirdparty',$object->id); + print dol_print_address($soc->address,'gmap','thirdparty',$soc->id); print ''; // Zip / Town @@ -396,7 +395,7 @@ else if ($id || $ref) llxHeader("","",$langs->trans("Member")); - $head=member_prepare_head($member, $user); + $head=member_prepare_head($member); $titre=$langs->trans("Member"); $picto='user'; dol_fiche_head($head, 'category', $titre,0,$picto); @@ -471,7 +470,7 @@ else if ($id || $ref) llxHeader("","",$langs->trans("Contact")); - $head=contact_prepare_head($object, $user); + $head=contact_prepare_head($object); $titre=$langs->trans("ContactsAddresses"); $picto='contact'; dol_fiche_head($head, 'category', $titre,0,$picto); @@ -551,7 +550,7 @@ else if ($id || $ref) { $langs->load("mails"); print ''.$langs->trans("NbOfEMailingsReceived").''; - print ''.$object->getNbOfEMailings().''; + print ''.$object->getNbOfEMailings().''; } else { @@ -622,32 +621,32 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1) if ($typeid == 3) $title = $langs->trans("MembersCategoriesShort"); if ($typeid == 4) $title = $langs->trans("ContactCategoriesShort"); + $linktocreate=''; + if ($showclassifyform && $user->rights->categorie->creer) + { + $linktocreate='id.'&type='.$typeid).'">'; + $linktocreate.=$langs->trans("CreateCat").' '; + $linktocreate.=img_picto($langs->trans("Create"),'filenew'); + $linktocreate.=""; + } + print '
    '; - print_fiche_titre($title,'',''); + print_fiche_titre($title,$linktocreate,''); // Form to add record into a category if ($showclassifyform) { - print '
    '; + print ''; print ''; print ''; print ''; print ''; print ''; print ''; - if ($user->rights->categorie->creer) - { - print ''; - } + print ''; + print ''; print ''; print '
    '; - print $langs->trans("ClassifyInCategory").'  '; + print ''.$langs->trans("ClassifyInCategory").'  '; print $form->select_all_categories($typeid,'auto'); - print ''; - print ''; - print 'id.'&type='.$typeid).'">'; - print $langs->trans("CreateCat").' '; - print img_picto($langs->trans("Create"),'filenew'); - print ""; - print '
    '; print '
    '; @@ -680,10 +679,7 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1) print ""; // Categorie - print ""; - //$c->id=; - //print $c->getNomUrl(1); - print img_object('','category').' '.$way.""; + print "".img_object('','category').' '.$way.""; // Link to delete from category print ''; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index f7de102d96d..31b08437aef 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -107,7 +107,7 @@ class Categorie extends CommonObject $this->type = $res['type']; $this->entity = $res['entity']; - $this->fetch_optionals($this->id,$extralabels); + $this->fetch_optionals($this->id,null); $this->db->free($resql); @@ -198,6 +198,8 @@ class Categorie extends CommonObject { $this->id = $id; + $action='create'; + // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('HookModuleNamedao')); @@ -289,11 +291,13 @@ class Categorie extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); if ($this->db->query($sql)) { + $action='update'; // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('HookCategorydao')); $parameters=array(); + $action='update'; $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { @@ -408,6 +412,17 @@ class Categorie extends CommonObject $error++; } } + if (! $error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_lang"; + $sql .= " WHERE fk_category = ".$this->id; + if (!$this->db->query($sql)) + { + $this->error=$this->db->lasterror(); + dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR); + $error++; + } + } // Delete category if (! $error) @@ -430,7 +445,7 @@ class Categorie extends CommonObject if ($result < 0) { $error++; - dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); + dol_syslog(get_class($this)."::delete erreur ".$this->error, LOG_ERR); } } } @@ -788,7 +803,7 @@ class Categorie extends CommonObject */ function get_full_arbo($type,$markafterid=0) { - global $langs; + global $conf, $langs; $this->cats = array(); @@ -798,11 +813,9 @@ class Categorie extends CommonObject // Init $this->cats array $sql = "SELECT DISTINCT c.rowid, c.label, c.description, c.fk_parent"; // Distinct reduce pb with old tables with duplicates - if (! empty($conf->global->MAIN_MULTILANGS)) - $sql.= ", t.label as label_trans, t.description as description_trans"; + if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= ", t.label as label_trans, t.description as description_trans"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie as c"; - if (! empty($conf->global->MAIN_MULTILANGS)) - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$current_lang."'"; + if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$current_lang."'"; $sql.= " WHERE c.entity IN (".getEntity('category',1).")"; $sql.= " AND c.type = ".$type; @@ -1263,15 +1276,15 @@ class Categorie extends CommonObject $result=''; $lien = ''; - $label=$langs->trans("ShowCategory").': '.$this->label; + $label=$langs->trans("ShowCategory").': '. ($this->ref?$this->ref:$this->label); $lienfin=''; $picto='category'; - if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); + if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; - if ($withpicto != 2) $result.=$lien.dol_trunc($this->ref,$maxlength).$lienfin; + if ($withpicto != 2) $result.=$lien.dol_trunc(($this->ref?$this->ref:$this->label),$maxlength).$lienfin; return $result; } @@ -1369,7 +1382,7 @@ class Categorie extends CommonObject // Objet $obj=array(); $obj['photo']=$photo; - if ($photo_vignette && is_file($dirthumb.$photo_vignette)) $obj['photo_vignette']=$photo_vignette; + if ($photo_vignette && is_file($dirthumb.$photo_vignette)) $obj['photo_vignette']='thumbs/' . $photo_vignette; else $obj['photo_vignette']=""; $tabobj[$nbphoto-1]=$obj; diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index aa82fdb455d..245509578d0 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -163,8 +163,7 @@ if (empty($reshook) && ! empty($extrafields->attribute_label)) print ''; print '
    '; -print '
    '; -print '
    '; +print '
    '; print ''; diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index eceeb2890bc..76a19c91d7d 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -171,7 +171,7 @@ $nbofentries=(count($data) - 1); if ($nbofentries > 0) { - print ''; + print ''; tree_recur($data,$data[0],0); print ''; } diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 69a8bb97eab..c54d7d889b2 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -241,7 +241,7 @@ if ($object->id) // Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine if ($obj['photo_vignette']) { - $filename='thumbs/'.$obj['photo_vignette']; + $filename=$obj['photo_vignette']; } else { diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 0c154a0b72f..98d4fb2b930 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -190,9 +190,11 @@ if ($action == 'edit') } } - print '
    '; - print '     '; - print '
    '; + print '
    '; + print ''; + print '     '; + print ''; + print '
    '; print ''; @@ -266,9 +268,11 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service print ''; print ''; - print '
    '; - print '     '; - print '
    '; + print '
    '; + print ''; + print '     '; + print ''; + print '
    '; print ''; diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 898d6626539..c55f324ab06 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -38,6 +38,7 @@ $type=GETPOST('type'); $action=GETPOST('action'); $confirm=GETPOST('confirm'); $removeelem = GETPOST('removeelem','int'); +$elemid=GETPOST('elemid'); if ($id == "") { @@ -120,6 +121,33 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi } } +if ($type==0 && $elemid && $action == 'addintocategory' && ($user->rights->produit->creer || $user->rights->service->creer)) +{ + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + $newobject = new Product($db); + $result = $newobject->fetch($elemid); + $elementtype = 'product'; + + // TODO Add into categ + $result=$object->add_type($newobject,$elementtype); + if ($result >= 0) + { + setEventMessage($langs->trans("WasAddedSuccessfully",$newobject->ref)); + } + else + { + if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') + { + setEventMessage($langs->trans("ObjectAlreadyLinkedToCategory"),'warnings'); + } + else + { + setEventMessages($object->error,$object->errors,'errors'); + } + } + +} + /* @@ -144,6 +172,7 @@ dol_fiche_head($head, 'card', $title, 0, 'category'); /* * Confirmation suppression */ + if ($action == 'delete') { print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type,$langs->trans('DeleteCategory'),$langs->trans('ConfirmDeleteCategory'),'confirm_delete'); @@ -212,7 +241,7 @@ else print "".$langs->trans("SubCats").''; if ($user->rights->categorie->creer) { - print ""; + print ""; print img_picto($langs->trans("Create"),'filenew'); print ""; } @@ -251,10 +280,9 @@ else print "\n"; } -// List of products +// List of products or services (type is type of category) if ($object->type == 0) { - $prods = $object->getObjectsInCateg("product"); if ($prods < 0) { @@ -262,6 +290,29 @@ if ($object->type == 0) } else { + $showclassifyform=1; $typeid=0; + + // Form to add record into a category + if ($showclassifyform) + { + print '
    '; + print '
    '; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
    '; + print $langs->trans("AddProductServiceIntoCategory").'  '; + print $form->select_produits('','elemid','',0,0,-1,2,'',1); + print ''; + print '
    '; + print '
    '; + } + print "
    "; print "\n"; print '\n"; diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/card.php similarity index 60% rename from htdocs/comm/action/fiche.php rename to htdocs/comm/action/card.php index 27be46bd9e1..faa4109f736 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2013 Juanjo Menent @@ -22,7 +22,7 @@ */ /** - * \file htdocs/comm/action/fiche.php + * \file htdocs/comm/action/card.php * \ingroup agenda * \brief Page for event card */ @@ -35,7 +35,10 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; -if (! empty($conf->projet->enabled)) { +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + +if (! empty($conf->projet->enabled)) +{ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -67,12 +70,13 @@ $result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions| if ($user->societe_id && $socid) $result = restrictedArea($user,'societe',$socid); $error=GETPOST("error"); -$donotclearsession=0; +$donotclearsession=GETPOST('donotclearsession')?GETPOST('donotclearsession'):0; $cactioncomm = new CActionComm($db); $object = new ActionComm($db); $contact = new Contact($db); $extrafields = new ExtraFields($db); +$formfile = new FormFile($db); // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); @@ -80,27 +84,52 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); //var_dump($_POST); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('actioncard')); +$hookmanager->initHooks(array('actioncard','globalcard')); /* * Actions */ -if (GETPOST('addassignedtouser')) +// Remove user to assigned list +if (GETPOST('removedassigned') || GETPOST('removedassigned') == '0') +{ + $idtoremove=GETPOST('removedassigned'); + + if (! empty($_SESSION['assignedtouser'])) $tmpassigneduserids=dol_json_decode($_SESSION['assignedtouser'],1); + else $tmpassigneduserids=array(); + + foreach ($tmpassigneduserids as $key => $val) + { + if ($val['id'] == $idtoremove || $val['id'] == -1) unset($tmpassigneduserids[$key]); + } + //var_dump($_POST['removedassigned']);exit; + $_SESSION['assignedtouser']=dol_json_encode($tmpassigneduserids); + $donotclearsession=1; + if ($action == 'add') $action = 'create'; + if ($action == 'update') $action = 'edit'; +} + +// Add user to assigned list +if (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser')) { // Add a new user - if (GETPOST('affectedto') > 0) + if (GETPOST('assignedtouser') > 0) { $assignedtouser=array(); - if (!empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true); - $assignedtouser[GETPOST('affectedto')]=array('transparency'=>GETPOST('transparency'),'mandatory'=>1); + if (! empty($_SESSION['assignedtouser'])) + { + $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true); + } + $assignedtouser[GETPOST('assignedtouser')]=array('id'=>GETPOST('assignedtouser'), 'transparency'=>GETPOST('transparency'),'mandatory'=>1); $_SESSION['assignedtouser']=dol_json_encode($assignedtouser); } $donotclearsession=1; - $action='create'; + if ($action == 'add') $action = 'create'; + if ($action == 'update') $action = 'edit'; } -// Add action + +// Add event if ($action == 'add') { $error=0; @@ -131,81 +160,92 @@ if ($action == 'add') // Check parameters if (! $datef && $percentage == 100) { - $error++; + $error++; $donotclearsession=1; $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")), 'errors'); } if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! GETPOST('label')) { - $error++; + $error++; $donotclearsession=1; $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Title")), 'errors'); } // Initialisation objet cactioncomm - if (! GETPOST('actioncode')) + if (! GETPOST('actioncode') > 0) // actioncode is id { - $error++; + $error++; $donotclearsession=1; $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); } else { - $result=$cactioncomm->fetch(GETPOST('actioncode')); + $object->type_code = GETPOST('actioncode'); } - // Initialisation objet actioncomm - $object->type_id = $cactioncomm->id; - $object->type_code = $cactioncomm->code; - $object->priority = GETPOST("priority")?GETPOST("priority"):0; - $object->fulldayevent = (! empty($fulldayevent)?1:0); - $object->location = GETPOST("location"); - $object->transparency = (GETPOST("transparency")=='on'?1:0); - $object->label = trim(GETPOST('label')); - $object->fk_element = GETPOST("fk_element"); - $object->elementtype = GETPOST("elementtype"); - if (! GETPOST('label')) + if (! $error) { - if (GETPOST('actioncode') == 'AC_RDV' && $contact->getFullName($langs)) + // Initialisation objet actioncomm + $object->priority = GETPOST("priority")?GETPOST("priority"):0; + $object->fulldayevent = (! empty($fulldayevent)?1:0); + $object->location = GETPOST("location"); + $object->label = trim(GETPOST('label')); + $object->fk_element = GETPOST("fk_element"); + $object->elementtype = GETPOST("elementtype"); + if (! GETPOST('label')) { - $object->label = $langs->transnoentitiesnoconv("TaskRDVWith",$contact->getFullName($langs)); - } - else - { - if ($langs->trans("Action".$object->type_code) != "Action".$object->type_code) + if (GETPOST('actioncode') == 'AC_RDV' && $contact->getFullName($langs)) { - $object->label = $langs->transnoentitiesnoconv("Action".$object->type_code)."\n"; + $object->label = $langs->transnoentitiesnoconv("TaskRDVWith",$contact->getFullName($langs)); } - else $object->label = $cactioncomm->libelle; + else + { + if ($langs->trans("Action".$object->type_code) != "Action".$object->type_code) + { + $object->label = $langs->transnoentitiesnoconv("Action".$object->type_code)."\n"; + } + else $object->label = $cactioncomm->libelle; + } + } + $object->fk_project = isset($_POST["projectid"])?$_POST["projectid"]:0; + $object->datep = $datep; + $object->datef = $datef; + $object->percentage = $percentage; + $object->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * 60; + + $listofuserid=array(); + if (! empty($_SESSION['assignedtouser'])) $listofuserid=dol_json_decode($_SESSION['assignedtouser']); + $i=0; + foreach($listofuserid as $key => $value) + { + if ($i == 0) // First entry + { + if ($value['id'] > 0) $object->userownerid=$value['id']; + $object->transparency = (GETPOST("transparency")=='on'?1:0); + } + + $object->userassigned[$value['id']]=array('id'=>$value['id'], 'transparency'=>(GETPOST("transparency")=='on'?1:0)); + + $i++; } } - $object->fk_project = isset($_POST["projectid"])?$_POST["projectid"]:0; - $object->datep = $datep; - $object->datef = $datef; - $object->percentage = $percentage; - $object->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * 60; - $usertodo=new User($db); - if ($_POST["affectedto"] > 0) + if (! $error && ! empty($conf->global->AGENDA_ENABLE_DONEBY)) { - $usertodo->fetch($_POST["affectedto"]); + if (GETPOST("doneby") > 0) $object->userdoneid = GETPOST("doneby","int"); } - $object->usertodo = $usertodo; - $userdone=new User($db); - if ($_POST["doneby"] > 0) - { - $userdone->fetch($_POST["doneby"]); - } - $object->userdone = $userdone; $object->note = trim($_POST["note"]); + if (isset($_POST["contactid"])) $object->contact = $contact; + if (GETPOST('socid','int') > 0) { - $societe = new Societe($db); - $societe->fetch(GETPOST('socid','int')); - $object->societe = $societe; + $object->socid=GETPOST('socid','int'); + $object->fetch_thirdparty(); + + $object->societe = $object->thirdparty; // For backward compatibility } // Special for module webcal and phenix @@ -214,16 +254,22 @@ if ($action == 'add') if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $object->use_phenix=1; // Check parameters + if (empty($object->userownerid) && empty($_SESSION['assignedtouser'])) + { + $error++; $donotclearsession=1; + $action = 'create'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionsOwnedBy")), 'errors'); + } if ($object->type_code == 'AC_RDV' && ($datep == '' || ($datef == '' && empty($fulldayevent)))) { - $error++; + $error++; $donotclearsession=1; $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")), 'errors'); } if (! GETPOST('apyear') && ! GETPOST('adyear')) { - $error++; + $error++; $donotclearsession=1; $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors'); } @@ -242,19 +288,24 @@ if ($action == 'add') { if (! $object->error) { + unset($_SESSION['assignedtouser']); + + $moreparam=''; + if ($user->id != $object->ownerid) $moreparam="usertodo=-1"; // We force to remove filter so created record is visible when going back to per user view. + $db->commit(); if (! empty($backtopage)) { - dol_syslog("Back to ".$backtopage); - header("Location: ".$backtopage); + dol_syslog("Back to ".$backtopage.($moreparam?(preg_match('/\?/',$backtopage)?'&'.$moreparam:'?'.$moreparam):'')); + header("Location: ".$backtopage.($moreparam?(preg_match('/\?/',$backtopage)?'&'.$moreparam:'?'.$moreparam):'')); } elseif($idaction) { - header("Location: ".DOL_URL_ROOT.'/comm/action/fiche.php?id='.$idaction); + header("Location: ".DOL_URL_ROOT.'/comm/action/card.php?id='.$idaction.($moreparam?'&'.$moreparam:'')); } else { - header("Location: ".DOL_URL_ROOT.'/comm/action/index.php'); + header("Location: ".DOL_URL_ROOT.'/comm/action/index.php'.($moreparam?'?'.$moreparam:'')); } exit; } @@ -265,42 +316,14 @@ if ($action == 'add') $langs->load("errors"); $error=$langs->trans($object->error); setEventMessage($error,'errors'); - $action = 'create'; + $action = 'create'; $donotclearsession=1; } } else { $db->rollback(); - $langs->load("errors"); - - if (! empty($object->error)) setEventMessage($langs->trans($object->error), 'errors'); - if (count($object->errors)) setEventMessage($object->errors, 'errors'); - - $action = 'create'; - } - } -} - -/* - * Action suppression de l'action - */ -if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes') -{ - $object->fetch($id); - - if ($user->rights->agenda->myactions->delete - || $user->rights->agenda->allactions->delete) - { - $result=$object->delete(); - - if ($result >= 0) - { - header("Location: index.php"); - exit; - } - else - { - setEventMessage($object->error,'errors'); + setEventMessages($object->error, $object->errors, 'errors'); + $action = 'create'; $donotclearsession=1; } } } @@ -326,47 +349,85 @@ if ($action == 'update') if ($p2min == -1) $p2min='0'; $object->fetch($id); + $object->fetch_userassigned(); $datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); $datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); - $object->fk_action = dol_getIdFromCode($db, $_POST["actioncode"], 'c_actioncomm'); - $object->label = $_POST["label"]; + $object->fk_action = dol_getIdFromCode($db, GETPOST("actioncode"), 'c_actioncomm'); + $object->label = GETPOST("label"); $object->datep = $datep; $object->datef = $datef; $object->percentage = $percentage; - $object->priority = $_POST["priority"]; - $object->fulldayevent= $_POST["fullday"]?1:0; + $object->priority = GETPOST("priority"); + $object->fulldayevent= GETPOST("fullday")?1:0; $object->location = GETPOST('location'); - $object->societe->id = $_POST["socid"]; - $object->contact->id = $_POST["contactid"]; - $object->fk_project = $_POST["projectid"]; - $object->note = $_POST["note"]; - $object->pnote = $_POST["note"]; - $object->fk_element = $_POST["fk_element"]; - $object->elementtype = $_POST["elementtype"]; + $object->socid = GETPOST("socid"); + $object->contactid = GETPOST("contactid",'int'); + //$object->societe->id = $_POST["socid"]; // deprecated + //$object->contact->id = $_POST["contactid"]; // deprecated + $object->fk_project = GETPOST("projectid",'int'); + $object->note = GETPOST("note"); + $object->pnote = GETPOST("note"); + $object->fk_element = GETPOST("fk_element"); + $object->elementtype = GETPOST("elementtype"); if (! $datef && $percentage == 100) { - $error=$langs->trans("ErrorFieldRequired",$langs->trans("DateEnd")); + $error++; $donotclearsession=1; + setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")),$object->errors,'errors'); $action = 'edit'; } - // Users - $usertodo=new User($db); - if ($_POST["affectedto"]) - { - $usertodo->fetch($_POST["affectedto"]); - } - $object->usertodo = $usertodo; - $object->transparency=(GETPOST("transparency")=='on'?1:0); + $transparency=(GETPOST("transparency")=='on'?1:0); - $userdone=new User($db); - if ($_POST["doneby"]) + // Users + $listofuserid=array(); + if (! empty($_SESSION['assignedtouser'])) // Now concat assigned users { - $userdone->fetch($_POST["doneby"]); + // Restore array with key with same value than param 'id' + $tmplist1=dol_json_decode($_SESSION['assignedtouser'], true); $tmplist2=array(); + foreach($tmplist1 as $key => $val) + { + if ($val['id'] > 0 && $val['id'] != $assignedtouser) $listofuserid[$val['id']]=$val; + } + } + else { + $assignedtouser=(! empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : 0); + if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser, 'mandatory'=>0, 'transparency'=>($user->id == $assignedtouser ? $transparency : '')); // Owner first + } + + $object->userassigned=array(); $object->userownerid=0; // Clear old content + $i=0; + foreach($listofuserid as $key => $val) + { + if ($i == 0) $object->userownerid = $val['id']; + $object->userassigned[$val['id']]=array('id'=>$val['id'], 'mandatory'=>0, 'transparency'=>($user->id == $val['id'] ? $transparency : '')); + $i++; + } + + if (! empty($conf->global->AGENDA_ENABLE_DONEBY)) + { + if (GETPOST("doneby")) $object->userdoneid=GETPOST("doneby","int"); + } + + // Check parameters + if (! GETPOST('actioncode') > 0) + { + $error++; $donotclearsession=1; + $action = 'edit'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); + } + else + { + $result=$cactioncomm->fetch(GETPOST('actioncode')); + } + if (empty($object->userownerid)) + { + $error++; $donotclearsession=1; + $action = 'edit'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionsOwnedBy")), 'errors'); } - $object->userdone = $userdone; // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); @@ -379,36 +440,61 @@ if ($action == 'update') if ($result > 0) { + unset($_SESSION['assignedtouser']); + $db->commit(); } else { + setEventMessages($object->error,$object->errors,'errors'); $db->rollback(); } } } - if ($result < 0) - { - setEventMessage($object->error,'errors'); - setEventMessage($object->errors,'errors'); - } - else + if (! $error) { if (! empty($backtopage)) { + unset($_SESSION['assignedtouser']); header("Location: ".$backtopage); exit; } } } +/* + * delete event + */ +if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes') +{ + $object->fetch($id); + + if ($user->rights->agenda->myactions->delete + || $user->rights->agenda->allactions->delete) + { + $result=$object->delete(); + + if ($result >= 0) + { + header("Location: index.php"); + exit; + } + else + { + setEventMessages($object->error,$object->errors,'errors'); + } + } +} + /* * Action move update, used when user move an event in calendar by drag'n drop */ if ($action == 'mupdate') { $object->fetch($id); + $object->fetch_userassigned(); + $shour = dol_print_date($object->datep,"%H"); $smin = dol_print_date($object->datep, "%M"); @@ -514,21 +600,22 @@ if ($action == 'create') print '
    '; print ''; print ''; + print ''; if ($backtopage) print ''; + if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) print ''; if (GETPOST("actioncode") == 'AC_RDV') print_fiche_titre($langs->trans("AddActionRendezVous")); else print_fiche_titre($langs->trans("AddAnAction")); print '
    '.$langs->trans("ProductsAndServices")."
    '; - // Type d'action actifs + // Type of event if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print ''; } - else print ''; // Title print 'global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").''; @@ -573,36 +660,36 @@ if ($action == 'create') print ''; // Location - print ''; + if (empty($conf->global->AGENDA_DISABLE_LOCATION)) + { + print ''; + } // Assigned to - $var=false; print ''; - - print '
    '.$langs->trans("Type").''; $formactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$object->type_code, "actioncode","systemauto"); print '
    '.$langs->trans("Location").'
    '.$langs->trans("Location").'
    '.$langs->trans("ActionAffectedTo").''; + $listofuserid=array(); if (empty($donotclearsession)) { - $assignedtouser=GETPOST("affectedtouser")?GETPOST("affectedtouser"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id); - $_SESSION['assignedtouser']=dol_json_encode(array($assignedtouser=>array('transparency'=>1,'mandatory'=>1))); + $assignedtouser=GETPOST("assignedtouser")?GETPOST("assignedtouser"):(! empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : $user->id); + if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser,'mandatory'=>0,'transparency'=>$object->transparency); // Owner first + $_SESSION['assignedtouser']=dol_json_encode($listofuserid); } - //print $form->select_dolusers_forevent('affectedto',1); - print $form->select_dolusers(GETPOST("affectedto")?GETPOST("affectedto"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id),'affectedto',1); - print '
    '; - - print '

    '; - - print ''; - - // Busy - print ''; // Realised by - if ($conf->global->AGENDA_ENABLE_DONEBY) + if (! empty($conf->global->AGENDA_ENABLE_DONEBY)) { print ''; } @@ -626,9 +713,9 @@ if ($action == 'create') $events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); //For external user force the company to user company if (!empty($user->societe_id)) { - print $form->select_company($user->societe_id,'socid','',1,1,0,$events); + print $form->select_thirdparty_list($user->societe_id,'socid','',1,1,0,$events); } else { - print $form->select_company('','socid','',1,1,0,$events); + print $form->select_thirdparty_list('','socid','',1,1,0,$events); } } @@ -652,7 +739,7 @@ if ($action == 'create') $numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:0),GETPOST("projectid")?GETPOST("projectid"):'','projectid'); if ($numproject==0) { - print '   '.$langs->trans("AddProject").''; + print '   '.$langs->trans("AddProject").''; } print ''; } @@ -692,11 +779,11 @@ if ($action == 'create') print '
    '.$langs->trans("Busy").''; - print ''; + else + { + if (!empty($_SESSION['assignedtouser'])) + { + $listofuserid=dol_json_decode($_SESSION['assignedtouser'], true); + } + } + print $form->select_dolusers_forevent(($action=='create'?'add':'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0'); + if (in_array($user->id,array_keys($listofuserid))) print $langs->trans("MyAvailability").': '.$langs->trans("Busy"); print '
    '.$langs->trans("ActionDoneBy").''; - print $form->select_dolusers(GETPOST("doneby")?GETPOST("doneby"):(! empty($object->userdone->id) && $percent==100?$object->userdone->id:0),'doneby',1); + print $form->select_dolusers(GETPOST("doneby")?GETPOST("doneby"):(! empty($object->userdoneid) && $percent==100?$object->userdoneid:0),'doneby',1); print '
    '; - print '

    '; + print '
    '; print ''; - print '     '; + print '     '; print ''; - print '
    '; + print ''; print ""; } @@ -704,41 +791,24 @@ if ($action == 'create') // View or edit if ($id > 0) { - if ($error) - { - dol_htmloutput_errors($error); - } + $result1=$object->fetch($id); + $result2=$object->fetch_thirdparty(); + $result3=$object->fetch_contact(); + $result4=$object->fetch_userassigned(); + $result5=$object->fetch_optionals($id,$extralabels); - $result=$object->fetch($id); - $object->fetch_optionals($id,$extralabels); - - if ($result < 0) + if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0) { dol_print_error($db,$object->error); exit; } - $societe = new Societe($db); - if ($object->societe->id) - { - $result=$societe->fetch($object->societe->id); - } - $object->societe = $societe; + if ($object->authorid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->authorid); $object->author=$tmpuser; } + if ($object->usermodid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usermodid); $object->usermod=$tmpuser; } - if ($object->author->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->author->id); $object->author=$tmpuser; } - if ($object->usermod->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usermod->id); $object->usermod=$tmpuser; } - if ($object->usertodo->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usertodo->id); $object->usertodo=$tmpuser; } - if ($object->userdone->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->userdone->id); $object->userdone=$tmpuser; } - - $contact = new Contact($db); - if ($object->contact->id) - { - $result=$contact->fetch($object->contact->id,$user); - } - $object->contact = $contact; /* - * Affichage onglets + * Show tabs */ $head=actions_prepare_head($object); @@ -749,7 +819,7 @@ if ($id > 0) // Confirmation suppression action if ($action == 'delete') { - print $form->formconfirm("fiche.php?id=".$id,$langs->trans("DeleteAction"),$langs->trans("ConfirmDeleteAction"),"confirm_delete",'','',1); + print $form->formconfirm("card.php?id=".$id,$langs->trans("DeleteAction"),$langs->trans("ConfirmDeleteAction"),"confirm_delete",'','',1); } if ($action == 'edit') @@ -780,13 +850,13 @@ if ($id > 0) print ''."\n"; } - // Fiche action en mode edition print '
    '; print ''; print ''; print ''; print ''; if ($backtopage) print ''; + if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) print ''; dol_fiche_head($head, 'card', $langs->trans("Action"),0,'action'); @@ -795,7 +865,7 @@ if ($id > 0) // Ref print ''.$langs->trans("Ref").''.$object->id.''; - // Type + // Type of event if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print ''.$langs->trans("Type").''; @@ -829,29 +899,50 @@ if ($id > 0) print ''; // Location - print ''.$langs->trans("Location").''; + if (empty($conf->global->AGENDA_DISABLE_LOCATION)) + { + print ''.$langs->trans("Location").''; + } // Assigned to - print ''.$langs->trans("ActionAffectedTo").''; - print $form->select_dolusers($object->usertodo->id>0?$object->usertodo->id:-1,'affectedto',1); - print ''; - - print '

    '; - - // Busy - print ''; // Realised by - if ($conf->global->AGENDA_ENABLE_DONEBY) + if (! empty($conf->global->AGENDA_ENABLE_DONEBY)) { print ''; } - print '
    '.$langs->trans("Busy").''; - print 'transparency?' checked="checked"':'').'">'; + print '
    '.$langs->trans("ActionAssignedTo").''; + $listofuserid=array(); + if (empty($donotclearsession)) + { + if ($object->userownerid > 0) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid,'transparency'=>$object->userassigned[$user->id]['transparency'],'answer_status'=>$object->userassigned[$user->id]['answer_status'],'mandatory'=>$object->userassigned[$user->id]['mandatory']); // Owner first + if (! empty($object->userassigned)) // Now concat assigned users + { + // Restore array with key with same value than param 'id' + $tmplist1=$object->userassigned; $tmplist2=array(); + foreach($tmplist1 as $key => $val) + { + if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val; + } + } + $_SESSION['assignedtouser']=dol_json_encode($listofuserid); + } + else + { + if (!empty($_SESSION['assignedtouser'])) + { + $listofuserid=dol_json_decode($_SESSION['assignedtouser'], true); + } + } + print $form->select_dolusers_forevent(($action=='create'?'add':'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0'); + if (in_array($user->id,array_keys($listofuserid))) print $langs->trans("MyAvailability").': id]['transparency']?' checked="checked"':'').'">'.$langs->trans("Busy"); print '
    '.$langs->trans("ActionDoneBy").''; - print $form->select_dolusers($object->userdone->id> 0?$object->userdone->id:-1,'doneby',1); + print $form->select_dolusers($object->userdoneid> 0?$object->userdoneid:-1,'doneby',1); print '


    '; + print ''; + + print '

    '; print ''; @@ -862,12 +953,12 @@ if ($id > 0) print ''; // Contact print ''; } @@ -881,10 +972,10 @@ if ($id > 0) $langs->load("project"); print ''; } @@ -922,9 +1013,11 @@ if ($id > 0) dol_fiche_end(); - print '
    '; - print '     '; - print '
    '; + print '
    '; + print ''; + print '     '; + print ''; + print '
    '; print ''; } @@ -952,111 +1045,104 @@ if ($id > 0) print ''; // Full day event - print ''; + print ''; + + $rowspan=4; + if (empty($conf->global->AGENDA_DISABLE_LOCATION)) $rowspan++; // Date start - print ''; - print ''; print ''; // Date end - print ''; // Status - print ''; // Location - print ''; + if (empty($conf->global->AGENDA_DISABLE_LOCATION)) + { + print ''; + } // Assigned to - print ''; - - print '
    '; $events=array(); $events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); - print $form->select_company($object->societe->id,'socid','',1,1,0,$events); + print $form->select_company($object->socid,'socid','',1,1,0,$events); print ''.$langs->trans("Contact").''; - $form->select_contacts($object->societe->id, $object->contact->id,'contactid',1); + $form->select_contacts($object->socid, $object->contactid,'contactid',1); print '
    '.$langs->trans("Project").''; - $numprojet=$formproject->select_projects($object->societe->id,$object->fk_project,'projectid'); + $numprojet=$formproject->select_projects($object->socid,$object->fk_project,'projectid'); if ($numprojet==0) { - print '   '.$langs->trans("AddProject").''; + print '   '.$langs->trans("AddProject").''; } print '
    '.$langs->trans("Title").''.$object->label.'
    '.$langs->trans("EventOnFullDay").''.yn($object->fulldayevent).'
    '.$langs->trans("EventOnFullDay").''.yn($object->fulldayevent, 3).'
    '.$langs->trans("DateActionStart").''; + print '
    '.$langs->trans("DateActionStart").''; if (! $object->fulldayevent) print dol_print_date($object->datep,'dayhour'); else print dol_print_date($object->datep,'day'); if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late")); print ''."\n"; - print '
    '; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' '; - print '
    '."\n"; - print '
    '; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' '; - print '
    '."\n"; - print '
    '; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' '; - print '
    '."\n"; - print '
    '; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' '; - print '
    '."\n"; - print '
    '.$langs->trans("DateActionEnd").''; + print '
    '.$langs->trans("DateActionEnd").''; if (! $object->fulldayevent) print dol_print_date($object->datef,'dayhour'); else print dol_print_date($object->datef,'day'); if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late")); print '
    '.$langs->trans("Status").' / '.$langs->trans("Percentage").''; + print '
    '.$langs->trans("Status").' / '.$langs->trans("Percentage").''; print $object->getLibStatut(4); print '
    '.$langs->trans("Location").''.$object->location.'
    '.$langs->trans("Location").''.$object->location.'
    '.$langs->trans("ActionAffectedTo").''; - if ($object->usertodo->id > 0) print $object->usertodo->getNomUrl(1); - print '


    '; - - // Busy - print ''; + print ''; // Done by if ($conf->global->AGENDA_ENABLE_DONEBY) { print ''; } - print '
    '.$langs->trans("Busy").''; - if ($object->usertodo->id > 0) print yn(($object->transparency > 0)?1:0); // We show nothing if event is assigned to nobody - print '
    '.$langs->trans("ActionAssignedTo").''; + $listofuserid=array(); + if (empty($donotclearsession)) + { + if ($object->userownerid > 0) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid,'transparency'=>$object->transparency); // Owner first + if (! empty($object->userassigned)) // Now concat assigned users + { + // Restore array with key with same value than param 'id' + $tmplist1=$object->userassigned; $tmplist2=array(); + foreach($tmplist1 as $key => $val) + { + if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val; + } + } + $_SESSION['assignedtouser']=dol_json_encode($listofuserid); + } + else + { + if (!empty($_SESSION['assignedtouser'])) + { + $listofuserid=dol_json_decode($_SESSION['assignedtouser'], true); + } + } + print $form->select_dolusers_forevent('view','assignedtouser',1); + if (in_array($user->id,array_keys($listofuserid))) print $langs->trans("MyAvailability").': '.(($object->userassigned[$user->id]['transparency'] > 0)?$langs->trans("Busy"):$langs->trans("Available")); // We show nothing if event is assigned to nobody + print '
    '.$langs->trans("ActionDoneBy").''; - if ($object->userdone->id > 0) print $object->userdone->getNomUrl(1); + if ($object->userdoneid > 0) + { + $tmpuser=new User($db); + $tmpuser->fetch($object->userdoneid); + print $tmpuser->getNomUrl(1); + } print '


    '; + print '
    '; + + print '

    '; + + print ''; // Third party - Contact if ($conf->societe->enabled) { - print ''; print ''; print ''; // Date start - print ''; - print ''; print ''; // Date end - print ''; // Location - print ''; + if (empty($conf->global->AGENDA_DISABLE_LOCATION)) + { + print ''; + } // Assigned to - print ''; - + print ''; + print '
    '.$langs->trans("ActionOnCompany").''.($object->societe->id?$object->societe->getNomUrl(1):$langs->trans("None")); - if ($object->societe->id && $object->type_code == 'AC_TEL') + print '
    '.$langs->trans("ActionOnCompany").''.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None")); + if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL') { - if ($object->societe->fetch($object->societe->id)) + if ($object->thirdparty->fetch($object->thirdparty->id)) { - print "
    ".dol_print_phone($object->societe->phone); + print "
    ".dol_print_phone($object->thirdparty->phone); } } print '
    '.$langs->trans("Contact").''; - if ($object->contact->id > 0) + if ($object->contactid > 0) { print $object->contact->getNomUrl(1); - if ($object->contact->id && $object->type_code == 'AC_TEL') + if ($object->contactid && $object->type_code == 'AC_TEL') { - if ($object->contact->fetch($object->contact->id)) + if ($object->contact->fetch($object->contactid)) { print "
    ".dol_print_phone($object->contact->phone_pro); } @@ -1137,9 +1223,9 @@ if ($id > 0) if ($action != 'edit') { if ($user->rights->agenda->allactions->create || - (($object->author->id == $user->id || $object->usertodo->id == $user->id) && $user->rights->agenda->myactions->create)) + (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)) { - print ''; + print ''; } else { @@ -1147,9 +1233,9 @@ if ($id > 0) } if ($user->rights->agenda->allactions->delete || - (($object->author->id == $user->id || $object->usertodo->id == $user->id) && $user->rights->agenda->myactions->delete)) + (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->delete)) { - print ''; + print ''; } else { @@ -1159,6 +1245,76 @@ if ($id > 0) } print ''; + + if ($action != 'edit') + { + // Link to agenda views + print '
    '; + print '
    '; + print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; + print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' '; + print '
    '."\n"; + print '
    '; + print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; + print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' '; + print '
    '."\n"; + print '
    '; + print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; + print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' '; + print '
    '."\n"; + print '
    '; + print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; + print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' '; + print '
    '."\n"; + print '
    '; + + if (empty($conf->global->AGENDA_DISABLE_BUILDDOC)) + { + print '
     
    '; + print ''; // ancre + + /* + * Documents generes + */ + + $filedir=$conf->agenda->multidir_output[$conf->entity].'/'.$object->id; + $urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id; + + $genallowed=$user->rights->agenda->myactions->create; + $delallowed=$user->rights->agenda->myactions->delete; + + $var=true; + + $somethingshown=$formfile->show_documents('agenda',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,0,0,'','','',$object->default_lang); + + print '
    '; + + + print '
    '; + + print '
     
    '; + } + } } diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 393082f3427..fb7195fdd68 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -39,36 +39,44 @@ class ActionComm extends CommonObject var $id; - var $type_id; // id into parent table llx_c_actioncomm (will be deprecated into future, link should not be required) - var $type_code; // code into parent table llx_c_actioncomm (will be deprecated into future, link should not be required). With defautl setup, should be AC_OTH_AUTO or AC_OTH - var $type; // label into parent table llx_c_actioncomm (will be deprecated into future, link should not be required) + var $type_id; // Id into parent table llx_c_actioncomm (used only if option to use type is set) + var $type_code; // Code into parent table llx_c_actioncomm (used only if option to use type is set). With default setup, should be AC_OTH_AUTO or AC_OTH. + var $type; // Label into parent table llx_c_actioncomm (used only if option to use type is set) + var $type_color; // Color into parent table llx_c_actioncomm (used only if option to use type is set) var $code; // Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...) var $label; var $datec; // Date creation record (datec) var $datem; // Date modification record (tms) - var $author; // Object user that create action - var $usermod; // Object user that modified action + var $author; // Object user that create action //deprecated + var $usermod; // Object user that modified action // deprecated + var $authorid; // Id user that create action + var $usermodid; // Id user that modified action var $datep; // Date action start (datep) var $datef; // Date action end (datep2) var $durationp = -1; // -1=Unkown duration // deprecated var $fulldayevent = 0; // 1=Event on full day - var $punctual = 1; // Milestone + var $punctual = 1; // Milestone // deprecated. Milestone is already event with end date = start date var $percentage; // Percentage var $location; // Location + var $transparency; // Transparency (ical standard). Used to say if people assigned to event are busy or not by event. 0=available, 1=busy, 2=busy (refused events) var $priority; // Small int (0 By default) var $note; // Description - var $usertodo; // Object user that must do action - var $userdone; // Object user that did action + var $userassigned = array(); // Array of user ids + var $userownerid; // Id of user owner + var $userdoneid; // Id of user done + var $usertodo; // Object user of owner // deprecated + var $userdone; // Object user that did action // deprecated + var $socid; + var $contactid; var $societe; // Company linked to action (optional) var $contact; // Contact linked to action (optional) var $fk_project; // Id of project (optional) - // Properties for links to other objects var $fk_element; // Id of record var $elementtype; // Type of record. This if property ->element of object linked to. @@ -87,18 +95,17 @@ class ActionComm extends CommonObject */ function __construct($db) { + global $langs; + $this->db = $db; - $this->author = new stdClass(); - $this->usermod = new stdClass(); - $this->usertodo = new stdClass(); - $this->userdone = new stdClass(); - $this->societe = new stdClass(); - $this->contact = new stdClass(); + $this->societe = new stdClass(); // deprecated + $this->contact = new stdClass(); // deprecated } /** - * Add an action/event into database + * Add an action/event into database. + * $this->type_id OR $this->type_code must be set. * * @param User $user Object user making action * @param int $notrigger 1 = disable triggers, 0 = enable triggers @@ -131,24 +138,32 @@ class ActionComm extends CommonObject if ($this->elementtype=='commande') $this->elementtype='order'; if ($this->elementtype=='contrat') $this->elementtype='contract'; - if (! $this->type_id && $this->type_code) + $userownerid=$this->userownerid; + $userdoneid=$this->userdoneid; + + // Be sure assigned user array is not empty. + if (count($this->userassigned) == 0) $this->userassigned = array('id'=>$userownerid); + + if (! $this->type_id || ! $this->type_code) { + $key=empty($this->type_id)?$this->type_code:$this->type_id; + // Get id from code $cactioncomm=new CActionComm($this->db); - $result=$cactioncomm->fetch($this->type_code); + $result=$cactioncomm->fetch($key); if ($result > 0) { $this->type_id=$cactioncomm->id; - $this->code=$cactioncomm->code; + $this->type_code=$cactioncomm->code; } else if ($result == 0) { - $this->error='Failed to get record with code '.$this->type_code.' from dictionary "type of events"'; + $this->error='Failed to get record with id '.$this->type_id.' code '.$this->type_code.' from dictionary "type of events"'; return -1; } else - { + { $this->error=$cactioncomm->error; return -1; } @@ -188,14 +203,14 @@ class ActionComm extends CommonObject $sql.= (strval($this->datef)!=''?"'".$this->db->idate($this->datef)."'":"null").","; $sql.= (isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null").","; // deprecated $sql.= (isset($this->type_id)?$this->type_id:"null").","; - $sql.= (isset($this->code)?" '".$this->code."'":"null").","; - $sql.= (isset($this->societe->id) && $this->societe->id > 0?" '".$this->societe->id."'":"null").","; + $sql.= (isset($this->type_code)?" '".$this->type_code."'":"null").","; + $sql.= (isset($this->socid) && $this->socid > 0?" '".$this->socid."'":"null").","; $sql.= (isset($this->fk_project) && $this->fk_project > 0?" '".$this->fk_project."'":"null").","; $sql.= " '".$this->db->escape($this->note)."',"; - $sql.= (isset($this->contact->id) && $this->contact->id > 0?"'".$this->contact->id."'":"null").","; + $sql.= (isset($this->contactid) && $this->contactid > 0?"'".$this->contactid."'":"null").","; $sql.= (isset($user->id) && $user->id > 0 ? "'".$user->id."'":"null").","; - $sql.= (isset($this->usertodo->id) && $this->usertodo->id > 0?"'".$this->usertodo->id."'":"null").","; - $sql.= (isset($this->userdone->id) && $this->userdone->id > 0?"'".$this->userdone->id."'":"null").","; + $sql.= ($userownerid>0?"'".$userownerid."'":"null").","; + $sql.= ($userdoneid>0?"'".$userdoneid."'":"null").","; $sql.= "'".$this->db->escape($this->label)."','".$this->percentage."','".$this->priority."','".$this->fulldayevent."','".$this->db->escape($this->location)."','".$this->punctual."',"; $sql.= "'".$this->transparency."',"; $sql.= (! empty($this->fk_element)?$this->fk_element:"null").","; @@ -209,22 +224,46 @@ class ActionComm extends CommonObject { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."actioncomm","id"); - // Actions on extra fields (by external module or standard code) - $hookmanager->initHooks(array('actioncommdao')); - $parameters=array('actcomm'=>$this->id); - $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - if (empty($reshook)) + // Now insert assignedusers + if (! $error) + { + foreach($this->userassigned as $key => $val) + { + $sql ="INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)"; + $sql.=" VALUES(".$this->id.", 'user', ".$val['id'].", ".($val['mandatory']?$val['mandatory']:'0').", ".($val['transparency']?$val['transparency']:'0').", ".($val['answer_status']?$val['answer_status']:'0').")"; + + $resql = $this->db->query($sql); + if (! $resql) + { + $error++; + $this->errors[]=$this->db->lasterror(); + } + //var_dump($sql);exit; + } + } + + if (! $error) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used - { - $result=$this->insertExtraFields(); - if ($result < 0) - { - $error++; - } - } + $action='create'; + + // Actions on extra fields (by external module or standard code) + // FIXME le hook fait double emploi avec le trigger !! + $hookmanager->initHooks(array('actioncommdao')); + $parameters=array('actcomm'=>$this->id); + $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) + { + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + } + else if ($reshook < 0) $error++; } - else if ($reshook < 0) $error++; if (! $error && ! $notrigger) { @@ -258,9 +297,10 @@ class ActionComm extends CommonObject * Load object from database * * @param int $id Id of action to get + * @param string $ref Ref of action to get * @return int <0 if KO, >0 if OK */ - function fetch($id) + function fetch($id, $ref='') { global $langs; @@ -279,14 +319,16 @@ class ActionComm extends CommonObject $sql.= " a.fk_user_action, a.fk_user_done,"; $sql.= " a.fk_contact, a.percent as percentage,"; $sql.= " a.fk_element, a.elementtype,"; - $sql.= " a.priority, a.fulldayevent, a.location, a.transparency,"; + $sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,"; $sql.= " c.id as type_id, c.code as type_code, c.libelle,"; $sql.= " s.nom as socname,"; $sql.= " u.firstname, u.lastname as lastname"; $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; - $sql.= " WHERE a.id=".$id." AND a.fk_action=c.id"; + $sql.= " WHERE a.fk_action=c.id"; + if ($ref) $sql.= " AND a.id=".$ref; // No field ref, we use id + else $sql.= " AND a.id=".$id; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); @@ -311,7 +353,7 @@ class ActionComm extends CommonObject $this->label = $obj->label; $this->datep = $this->db->jdate($obj->datep); $this->datef = $this->db->jdate($obj->datep2); - $this->durationp = $this->durationp; // deprecated +// $this->durationp = $this->durationp; // deprecated $this->datec = $this->db->jdate($obj->datec); $this->datem = $this->db->jdate($obj->datem); @@ -319,22 +361,30 @@ class ActionComm extends CommonObject $this->note = $obj->note; $this->percentage = $obj->percentage; - $this->author->id = $obj->fk_user_author; - $this->author->firstname = $obj->firstname; - $this->author->lastname = $obj->lastname; - $this->usermod->id = $obj->fk_user_mod; + $this->authorid = $obj->fk_user_author; + $this->usermodid = $obj->fk_user_mod; - $this->usertodo->id = $obj->fk_user_action; - $this->userdone->id = $obj->fk_user_done; + if (!is_object($this->author)) $this->author = new stdClass(); // For avoid warning + $this->author->id = $obj->fk_user_author; // deprecated + $this->author->firstname = $obj->firstname; // deprecated + $this->author->lastname = $obj->lastname; // deprecated + if (!is_object($this->usermod)) $this->usermod = new stdClass(); // For avoid warning + $this->usermod->id = $obj->fk_user_mod; // deprecated + + $this->userownerid = $obj->fk_user_action; + $this->userdoneid = $obj->fk_user_done; $this->priority = $obj->priority; $this->fulldayevent = $obj->fulldayevent; $this->location = $obj->location; $this->transparency = $obj->transparency; + $this->punctual = $obj->punctual; - $this->socid = $obj->fk_soc; // To have fetch_thirdparty method working - $this->societe->id = $obj->fk_soc; - $this->contact->id = $obj->fk_contact; - $this->fk_project = $obj->fk_project; + $this->socid = $obj->fk_soc; // To have fetch_thirdparty method working + $this->contactid = $obj->fk_contact; // To have fetch_contact method working + $this->fk_project = $obj->fk_project; // To have fetch_project method working + + $this->societe->id = $obj->fk_soc; // deprecated + $this->contact->id = $obj->fk_contact; // deprecated $this->fk_element = $obj->fk_element; $this->elementtype = $obj->elementtype; @@ -349,6 +399,42 @@ class ActionComm extends CommonObject } } + + /** + * Initialize this->userassigned array with list of id of user assigned to event + * + * @return int <0 if KO, >0 if OK + */ + function fetch_userassigned() + { + global $langs; + + $sql.="SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency"; + $sql.=" FROM ".MAIN_DB_PREFIX."actioncomm_resources"; + $sql.=" WHERE element_type = 'user' AND fk_actioncomm = ".$this->id; + $resql2=$this->db->query($sql); + if ($resql2) + { + $this->userassigned=array(); + + // If owner is known, we must but id first into list + if ($this->userownerid > 0) $this->userassigned[$this->userownerid]=array('id'=>$this->userownerid); // Set first so will be first into list. + + while ($obj = $this->db->fetch_object($resql2)) + { + if ($obj->fk_element > 0) $this->userassigned[$obj->fk_element]=array('id'=>$obj->fk_element, 'mandatory'=>$obj->mandatory, 'answer_status'=>$obj->answer_status, 'transparency'=>$obj->transparency); + if (empty($this->userownerid)) $this->userownerid=$obj->fk_element; // If not defined (should not happened, we fix this) + } + + return 1; + } + else + { + dol_print_error($this->db); + return -1; + } + } + /** * Delete event from database * @@ -442,12 +528,17 @@ class ActionComm extends CommonObject if ($this->fk_project < 0) $this->fk_project = 0; // Check parameters - if ($this->percentage == 0 && $this->userdone->id > 0) + if ($this->percentage == 0 && $this->userdoneid > 0) { $this->error="ErrorCantSaveADoneUserWithZeroPercentage"; return -1; } + $socid=($this->socid?$this->socid:((isset($this->societe->id) && $this->societe->id > 0) ? $this->societe->id : 0)); + $contactid=($this->contactid?$this->contactid:((isset($this->contact->id) && $this->contact->id > 0) ? $this->contact->id : 0)); + $userownerid=($this->userownerid?$this->userownerid:0); + $userdoneid=($this->userdoneid?$this->userdoneid:0); + $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm "; @@ -458,16 +549,16 @@ class ActionComm extends CommonObject $sql.= ", datep2 = ".(strval($this->datef)!='' ? "'".$this->db->idate($this->datef)."'" : 'null'); $sql.= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null"); // deprecated $sql.= ", note = ".($this->note ? "'".$this->db->escape($this->note)."'":"null"); - $sql.= ", fk_soc =". ($this->societe->id > 0 ? "'".$this->societe->id."'":"null"); $sql.= ", fk_project =". ($this->fk_project > 0 ? "'".$this->fk_project."'":"null"); - $sql.= ", fk_contact =". ($this->contact->id > 0 ? "'".$this->contact->id."'":"null"); + $sql.= ", fk_soc =". ($socid > 0 ? "'".$socid."'":"null"); + $sql.= ", fk_contact =". ($contactid > 0 ? "'".$contactid."'":"null"); $sql.= ", priority = '".$this->priority."'"; $sql.= ", fulldayevent = '".$this->fulldayevent."'"; $sql.= ", location = ".($this->location ? "'".$this->db->escape($this->location)."'":"null"); $sql.= ", transparency = '".$this->transparency."'"; $sql.= ", fk_user_mod = '".$user->id."'"; - $sql.= ", fk_user_action=".($this->usertodo->id > 0 ? "'".$this->usertodo->id."'":"null"); - $sql.= ", fk_user_done=".($this->userdone->id > 0 ? "'".$this->userdone->id."'":"null"); + $sql.= ", fk_user_action=".($userownerid > 0 ? "'".$userownerid."'":"null"); + $sql.= ", fk_user_done=".($userdoneid > 0 ? "'".$userdoneid."'":"null"); if (! empty($this->fk_element)) $sql.= ", fk_element=".($this->fk_element?$this->fk_element:"null"); if (! empty($this->elementtype)) $sql.= ", elementtype=".($this->elementtype?"'".$this->elementtype."'":"null"); $sql.= " WHERE id=".$this->id; @@ -475,8 +566,10 @@ class ActionComm extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); if ($this->db->query($sql)) { + $action='update'; // Actions on extra fields (by external module or standard code) + // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('actioncommdao')); $parameters=array('actcomm'=>$this->id); $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks @@ -493,7 +586,28 @@ class ActionComm extends CommonObject } else if ($reshook < 0) $error++; - if (! $notrigger) + // Now insert assignedusers + if (! $error) + { + $sql ="DELETE FROM ".MAIN_DB_PREFIX."actioncomm_resources where fk_actioncomm = ".$this->id." AND element_type = 'user'"; + $resql = $this->db->query($sql); + + foreach($this->userassigned as $key => $val) + { + $sql ="INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)"; + $sql.=" VALUES(".$this->id.", 'user', ".$val['id'].", ".($val['manadatory']?$val['manadatory']:'0').", ".($val['transparency']?$val['transparency']:'0').", ".($val['answer_status']?$val['answer_status']:'0').")"; + + $resql = $this->db->query($sql); + if (! $resql) + { + $error++; + $this->errors[]=$this->db->lasterror(); + } + //var_dump($sql);exit; + } + } + + if (! $error && ! $notrigger) { // Call trigger $result=$this->call_trigger('ACTION_MODIFY',$user); @@ -529,9 +643,11 @@ class ActionComm extends CommonObject * @param int $fk_element Id of element action is linked to * @param string $elementtype Type of element action is linked to * @param string $filter Other filter + * @param string $sortfield Sort on this field + * @param string $sortorder ASC or DESC * @return array or string Error string if KO, array with actions if OK */ - static function getActions($db, $socid=0, $fk_element=0, $elementtype='', $filter='') + static function getActions($db, $socid=0, $fk_element=0, $elementtype='', $filter='', $sortfield='', $sortorder='') { global $conf, $langs; @@ -547,6 +663,7 @@ class ActionComm extends CommonObject else $sql.= " AND a.fk_element = ".$fk_element." AND a.elementtype = '".$elementtype."'"; } if (! empty($filter)) $sql.= $filter; + if ($sortorder && $sortfield) $sql.=$db->order($sortfield, $sortorder); dol_syslog(get_class()."::getActions", LOG_DEBUG); $resql=$db->query($sql); @@ -744,8 +861,8 @@ class ActionComm extends CommonObject } /** - * Renvoie nom clicable (avec eventuellement le picto) - * Utilise $this->id, $this->code et $this->label + * Return URL of event + * Use $this->id, $this->type_code, $this->label and $this->type_label * * @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param int $maxlength Nombre de caracteres max dans libelle @@ -756,41 +873,36 @@ class ActionComm extends CommonObject */ function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto='') { - global $langs; + global $conf,$langs; $result=''; if ($option=='birthday') $lien = ''; - else $lien = ''; + else $lien = ''; $lienfin=''; $label=$this->label; - if (empty($label)) $label=$this->libelle; // Fro backward compatibility - //print 'rrr'.$this->libelle; + if (empty($label)) $label=$this->libelle; // For backward compatibility + //print 'rrr'.$this->libelle.'-'.$withpicto; if ($withpicto == 2) { $libelle=$label; - if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $libelle=$langs->trans("Action".$this->type_code); + if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $libelle=$langs->transnoentities("Action".$this->type_code); $libelleshort=''; } - else if (empty($this->libelle)) - { - $libelle=$label; - if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $libelle=$langs->trans("Action".$this->type_code); - $libelleshort=dol_trunc($label, $maxlength); - } else { - $libelle=$label; - $libelleshort=dol_trunc($label,$maxlength); + $libelle=(empty($this->libelle)?$label:$this->libelle.(($label && $label != $this->libelle)?' '.$label:'')); + if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($libelle)) $libelle=($langs->transnoentities("Action".$this->type_code) != "Action".$this->type_code)?$langs->transnoentities("Action".$this->type_code):$this->type_label; + $libelleshort=dol_trunc($libelle,$maxlength); } if ($withpicto) { - if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) - { - $libelle.=(($this->type_code && $libelle!=$langs->trans("Action".$this->type_code) && $langs->trans("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->trans("Action".$this->type_code).')':''); - } - $result.=$lien.img_object($langs->trans("ShowAction").': '.$libelle,($overwritepicto?$overwritepicto:'action')).$lienfin; + if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) // Add code into () + { + $libelle.=(($this->type_code && $libelle!=$langs->transnoentities("Action".$this->type_code) && $langs->transnoentities("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->transnoentities("Action".$this->type_code).')':''); + } + $result.=$lien.img_object($langs->trans("ShowAction").': '.$libelle, ($overwritepicto?$overwritepicto:'action'), 'class="classfortooltip"').$lienfin; } if ($withpicto==1) $result.=' '; $result.=$lien.$libelleshort.$lienfin; @@ -864,17 +976,19 @@ class ActionComm extends CommonObject $sql.= " a.label, a.code, a.note, a.fk_action as type_id,"; $sql.= " a.fk_soc,"; $sql.= " a.fk_user_author, a.fk_user_mod,"; - $sql.= " a.fk_user_action, a.fk_user_done,"; + $sql.= " a.fk_user_action,"; $sql.= " a.fk_contact, a.percent as percentage,"; $sql.= " a.fk_element, a.elementtype,"; - $sql.= " a.priority, a.fulldayevent, a.location,"; + $sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,"; $sql.= " u.firstname, u.lastname,"; $sql.= " s.nom as socname,"; $sql.= " c.id as type_id, c.code as type_code, c.libelle"; $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; // Link to get author of event for export $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; - $sql.= " WHERE a.fk_action=c.id"; + // We must filter on assignement table + if ($filters['logint'] || $filters['login']) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; + $sql.= " WHERE a.fk_action=c.id"; $sql.= " AND a.entity = ".$conf->entity; foreach ($filters as $key => $value) { @@ -883,17 +997,9 @@ class ActionComm extends CommonObject if ($key == 'id') $sql.=" AND a.id=".(is_numeric($value)?$value:0); if ($key == 'idfrom') $sql.=" AND a.id >= ".(is_numeric($value)?$value:0); if ($key == 'idto') $sql.=" AND a.id <= ".(is_numeric($value)?$value:0); - if ($key == 'login') - { - $login=$value; - $userforfilter=new User($this->db); - $result=$userforfilter->fetch('',$value); - $sql.= " AND ("; - $sql.= " a.fk_user_author = ".$userforfilter->id; - $sql.= " OR a.fk_user_action = ".$userforfilter->id; - $sql.= " OR a.fk_user_done = ".$userforfilter->id; - $sql.= ")"; - } + if ($key == 'project') $sql.=" AND a.fk_project=".(is_numeric($value)?$value:0); + // We must filter on assignement table + if ($key == 'logint' || $key == 'login') $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; if ($key == 'logina') { $logina=$value; @@ -901,19 +1007,12 @@ class ActionComm extends CommonObject $result=$userforfilter->fetch('',$value); $sql.= " AND a.fk_user_author = ".$userforfilter->id; } - if ($key == 'logint') + if ($key == 'logint' || $key == 'login') { $logint=$value; $userforfilter=new User($this->db); $result=$userforfilter->fetch('',$value); - $sql.= " AND a.fk_user_action = ".$userforfilter->id; - } - if ($key == 'logind') - { - $logind=$value; - $userforfilter=new User($this->db); - $result=$userforfilter->fetch('',$value); - $sql.= " AND a.fk_user_done = ".$userforfilter->id; + $sql.= " AND ar.fk_element = ".$userforfilter->id; } } $sql.= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import @@ -947,12 +1046,13 @@ class ActionComm extends CommonObject $event['fulldayevent']=$obj->fulldayevent; $event['location']=$obj->location; $event['transparency']=(($obj->transparency > 0)?'OPAQUE':'TRANSPARENT'); // OPAQUE (busy) or TRANSPARENT (not busy) + $event['punctual']=$obj->punctual; $event['category']=$obj->libelle; // libelle type action // Define $urlwithroot $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - $url=$urlwithroot.'/comm/action/fiche.php?id='.$obj->id; + $url=$urlwithroot.'/comm/action/card.php?id='.$obj->id; $event['url']=$url; $event['created']=$this->db->jdate($obj->datec)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600)); $event['modified']=$this->db->jdate($obj->datem)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600)); @@ -1031,7 +1131,7 @@ class ActionComm extends CommonObject */ function initAsSpecimen() { - global $user,$langs,$conf; + global $user,$langs,$conf,$user; $now=dol_now(); @@ -1052,9 +1152,12 @@ class ActionComm extends CommonObject $this->punctual=0; $this->percentage=0; $this->location='Location'; - $this->transparency=0; + $this->transparency=1; // 1 means opaque $this->priority=1; $this->note = 'Note'; + + $this->userownerid=$user->id; + $this->userassigned[$user->id]=array('id'=>$user->id, 'transparency'=> 1); } } diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 8908b4e2a46..77dfea739e1 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * * 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 @@ -37,6 +37,7 @@ class CActionComm var $type; var $libelle; var $active; + var $color; var $type_actions=array(); @@ -59,7 +60,7 @@ class CActionComm */ function fetch($id) { - $sql = "SELECT id, code, type, libelle, active"; + $sql = "SELECT id, code, type, libelle, color, active"; $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm"; if (is_numeric($id)) $sql.= " WHERE id=".$id; else $sql.= " WHERE code='".$id."'"; @@ -77,12 +78,13 @@ class CActionComm $this->type = $obj->type; $this->libelle = $obj->libelle; $this->active = $obj->active; + $this->color = $obj->color; $this->db->free($resql); return 1; } else - { + { $this->db->free($resql); return 0; } @@ -95,13 +97,13 @@ class CActionComm } /** - * Return list of event types + * Return list of event types: array(id=>label) or array(code=>label) * * @param int $active 1 or 0 to filter on event state active or not ('' by default = no filter) * @param string $idorcode 'id' or 'code' * @param string $excludetype Type to exclude * @param string $onlyautoornot Group list by auto events or not - * @return array Array of all event types if OK, <0 if KO + * @return mixed Array of all event types if OK, <0 if KO */ function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0) { @@ -111,7 +113,7 @@ class CActionComm $repid = array(); $repcode = array(); - $sql = "SELECT id, code, libelle, module, type"; + $sql = "SELECT id, code, libelle, module, type, color"; $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm"; if ($active != '') $sql.=" WHERE active=".$active; if (! empty($excludetype)) $sql.=($active != ''?" AND":" WHERE")." type <> '".$excludetype."'"; diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index 717d7269fa2..2dd6ea2b125 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -1,8 +1,8 @@ - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2013 Laurent Destailleur - * Copyright (C) 2012 Regis Houssin +/* Copyright (C) 2006 Roman Ozana + * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2013-2014 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin * * 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 @@ -261,6 +261,7 @@ class ICal */ function ical_rrule($value) { + $result=aray(); $rrule = explode(';',$value); foreach ($rrule as $line) { @@ -299,6 +300,7 @@ class ICal */ function ical_dt_date($key, $value) { + $return_value=array(); $value = $this->ical_date_to_unix($value); // Analyse TZID @@ -309,8 +311,8 @@ class ICal $value = str_replace('T', '', $value); return array($key,$value); } - // adding $value and $tzid - $key = $temp[0]; + + $key = $temp[0]; $temp = explode("=", $temp[1]); $return_value[$temp[0]] = $temp[1]; $return_value['unixtime'] = $value; @@ -330,8 +332,9 @@ class ICal { usort($temp, array(&$this, "ical_dtstart_compare")); return $temp; - } else - { + } + else + { return false; } } diff --git a/htdocs/comm/action/contact.php b/htdocs/comm/action/contact.php deleted file mode 100644 index 334da53a2f4..00000000000 --- a/htdocs/comm/action/contact.php +++ /dev/null @@ -1,258 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2012 Philippe Grand - * - * 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 . - */ - -/** - * \file htdocs/comm/action/contact.php - * \ingroup agenda - * \brief Page for multi-users event - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; - -$langs->load("companies"); -$langs->load("commercial"); -$langs->load("other"); -$langs->load("bills"); - -$id = GETPOST('id','int'); -$action = GETPOST('action','alpha'); -$ref = GETPOST('ref'); -$confirm = GETPOST('confirm'); -$lineid = GETPOST('lineid','int'); - -// Security check -$socid = GETPOST('socid','int'); -if ($user->societe_id) $socid=$user->societe_id; -if ($user->societe_id > 0) -{ - unset($_GET["action"]); - $action=''; -} -$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id'); - - -$object = new ActionComm($db); - - -/* - * Actions - */ - -// Add new contact -if ($action == 'addcontact' && $user->rights->action->creer) -{ - $result = $object->fetch($id); - - if ($object->id > 0) - { - $contactid = (GETPOST('userid','int') ? GETPOST('userid','int') : GETPOST('contactid','int')); - $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]); - } - - if ($result >= 0) - { - header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); - exit; - } - else - { - if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') - { - $langs->load("errors"); - setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); - } - else - { - setEventMessage($object->error, 'errors'); - } - } -} - -// modification d'un contact. On enregistre le type -if ($action == 'updateline') -{ - if ($object->fetch($id)) - { - $contact = $object->detail_contact($_POST["line"]); - $type = $_POST["type"]; - $statut = $contact->statut; - - $result = $object->update_contact($_POST["line"], $statut, $type); - if ($result >= 0) - { - $db->commit(); - } else - { - dol_print_error($db, "result=$result"); - $db->rollback(); - } - } - else - { - setEventMessage($object->error, 'errors'); - } -} - -// Bascule du statut d'un contact -else if ($action == 'swapstatut') -{ - if ($object->id > 0) - { - $result=$object->swapContactStatus(GETPOST('ligne')); - } -} - -// Efface un contact -else if ($action == 'deletecontact') -{ - $result = $object->delete_contact($lineid); - - if ($result >= 0) - { - header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); - exit; - } - else - { - dol_print_error($db); - } -} - -/* - * View - */ - -$form = new Form($db); -$formcompany= new FormCompany($db); - -$contactstatic=new Contact($db); -$userstatic=new User($db); - -$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda'; -llxHeader('',$langs->trans("Agenda"),$help_url); - - -if ($id > 0 || ! empty($ref)) -{ - if ($object->fetch($id,$ref) > 0) - { - - $head=actions_prepare_head($object); - dol_fiche_head($head, 'contact', $langs->trans("Action"),0,'action'); - - // Affichage fiche action en mode visu - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - - // Type - if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) - { - print ''; - } - - // Title - print ''; - - // Full day event - print ''; - - // Date start - print ''; - print ''; - print ''; - - // Date end - print ''; - - // Location - print ''; - - print '
    '.$langs->trans("Ref").''; - print $form->showrefnav($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); - print '
    '.$langs->trans("Type").''.$object->type.'
    '.$langs->trans("Title").''.$object->label.'
    '.$langs->trans("EventOnFullDay").''.yn($object->fulldayevent).'
    '.$langs->trans("DateActionStart").''; - if (! $object->fulldayevent) print dol_print_date($object->datep,'dayhour'); - else print dol_print_date($object->datep,'day'); - if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late")); - print ''."\n"; - print '
    '; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendar').' '; - print '
    '."\n"; - print '
    '; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarweek').' '; - print '
    '."\n"; - print '
    '; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarday').' '; - print '
    '."\n"; - print '
    '.$langs->trans("DateActionEnd").''; - if (! $object->fulldayevent) print dol_print_date($object->datef,'dayhour'); - else print dol_print_date($object->datef,'day'); - if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late")); - print '
    '.$langs->trans("Location").''.$object->location.'
    '; - - dol_fiche_end(); - - print '
    '; - - // Contacts lines (modules that overwrite templates must declare this into descriptor) - $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); - foreach($dirtpls as $reldir) - { - $res=@include dol_buildpath($reldir.'/contacts.tpl.php'); - if ($res) break; - } - - } - else - { - print "ErrorRecordNotFound"; - } -} - -llxFooter(); - -$db->close(); - diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index b000d2017d7..82d88089684 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -41,7 +41,7 @@ $langs->load("commercial"); $langs->load("other"); $langs->load("bills"); -$objectid = GETPOST('id', 'int'); +$id = GETPOST('id', 'int'); $action=GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); @@ -53,19 +53,14 @@ if ($user->societe_id > 0) unset($_GET["action"]); $action=''; } -$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id'); +$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id'); $object = new ActionComm($db); -if ($objectid > 0) +if ($id > 0) { - $ret = $object->fetch($objectid); - if ($ret > 0) { - $company=new Societe($db); - $company->fetch($object->societe->id); - $object->societe=$company; // For backward compatibility - $object->thirdparty=$company; - } + $ret = $object->fetch($id); + $object->fetch_thirdparty(); } // Get parameters @@ -101,18 +96,31 @@ llxHeader('',$langs->trans("Agenda"),$help_url); if ($object->id > 0) { + $result1=$object->fetch($id); + $result2=$object->fetch_thirdparty(); + $result3=$object->fetch_contact(); + $result4=$object->fetch_userassigned(); + $result5=$object->fetch_optionals($id,$extralabels); + + if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0) + { + dol_print_error($db,$object->error); + exit; + } + + if ($object->authorid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->authorid); $object->author=$tmpuser; } + if ($object->usermodid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usermodid); $object->usermod=$tmpuser; } + $author=new User($db); $author->fetch($object->author->id); $object->author=$author; - if ($object->contact->id > 0) $object->fetch_contact($object->contact->id); - if ($object->usertodo->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usertodo->id); $object->usertodo=$tmpuser; } $head=actions_prepare_head($object); $now=dol_now(); $delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60; - + dol_fiche_head($head, 'documents', $langs->trans("Action"),0,'action'); // Affichage fiche action en mode visu @@ -138,53 +146,15 @@ if ($object->id > 0) print '
    '.$langs->trans("EventOnFullDay").''.yn($object->fulldayevent).'
    '.$langs->trans("DateActionStart").''; + print '
    '.$langs->trans("DateActionStart").''; if (! $object->fulldayevent) print dol_print_date($object->datep,'dayhour'); else print dol_print_date($object->datep,'day'); if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late")); print ''."\n"; - print '
    '; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' '; - print '
    '."\n"; - print '
    '; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' '; - print '
    '."\n"; - print '
    '; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' '; - print '
    '."\n"; - print '
    '; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' '; - print '
    '."\n"; - print '
    '.$langs->trans("DateActionEnd").''; + print '
    '.$langs->trans("DateActionEnd").''; if (! $object->fulldayevent) print dol_print_date($object->datef,'dayhour'); else print dol_print_date($object->datef,'day'); if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late")); @@ -196,23 +166,49 @@ if ($object->id > 0) print '
    '.$langs->trans("Location").''.$object->location.'
    '.$langs->trans("Location").''.$object->location.'
    '.$langs->trans("ActionAffectedTo").''; - if ($object->usertodo->id > 0) print $object->usertodo->getNomUrl(1); - print '
    '.$langs->trans("ActionAffectedTo").''; + $listofuserid=array(); + if (empty($donotclearsession)) + { + if ($object->userownerid > 0) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid,'transparency'=>$object->transparency); // Owner first + if (! empty($object->userassigned)) // Now concat assigned users + { + // Restore array with key with same value than param 'id' + $tmplist1=$object->userassigned; $tmplist2=array(); + foreach($tmplist1 as $key => $val) + { + if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val; + } + } + $_SESSION['assignedtouser']=dol_json_encode($listofuserid); + } + else + { + if (!empty($_SESSION['assignedtouser'])) + { + $listofuserid=dol_json_decode($_SESSION['assignedtouser'], true); + } + } + print $form->select_dolusers_forevent('view','assignedtouser',1); + if (in_array($user->id,array_keys($listofuserid))) print $langs->trans("MyAvailability").': '.(($object->userassigned[$user->id]['transparency'] > 0)?$langs->trans("Busy"):$langs->trans("Available")); // We show nothing if event is assigned to nobody + print '


    '; // Third party - Contact - print ''; @@ -254,8 +250,20 @@ if ($object->id > 0) print ($object->priority?$object->priority:''); print ''; + // Other attributes + $parameters=array('colspan'=>' colspan="3"', 'colspanvalue'=>'3', 'id'=>$object->id); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $object->showOptionals($extrafields,'edit'); + } - print '
    '.$langs->trans("ActionOnCompany").''.($object->societe->id?$object->societe->getNomUrl(1):$langs->trans("None")); - if ($object->societe->id && $object->type_code == 'AC_TEL') + print '
    '.$langs->trans("ActionOnCompany").''.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None")); + if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL') { - if ($object->societe->fetch($object->societe->id)) + if ($object->thirdparty->fetch($object->thirdparty->id)) { - print "
    ".dol_print_phone($object->societe->phone); + print "
    ".dol_print_phone($object->thirdparty->phone); } } print '


    '; + + print '
    '; + + print '

    '; + + print ''; // Construit liste des fichiers $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); @@ -268,9 +276,59 @@ if ($object->id > 0) print ''; print ''; + print '
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
    '; - print ''; + dol_fiche_end(); + + + + if ($action != 'edit') + { + // Link to agenda views + print '
    '; + print '
    '; + print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; + print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' '; + print '
    '."\n"; + print '
    '; + print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; + print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' '; + print '
    '."\n"; + print '
    '; + print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; + print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' '; + print '
    '."\n"; + print '
    '; + print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; + print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' '; + print '
    '."\n"; + print '
    '; + + print '
    '; + print "

    "; + } + $modulepart = 'actions'; $permission = $user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create; @@ -282,6 +340,7 @@ else print $langs->trans("ErrorUnknown"); } -$db->close(); llxFooter(); + +$db->close(); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 7cec34cb6db..a8ed1181bd9 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -40,12 +40,15 @@ if (! empty($conf->projet->enabled)) { if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3; $filter=GETPOST("filter",'',3); -$filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","int",3); $filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3); -$filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filterd","int",3); $usergroup = GETPOST("usergroup","int",3); $showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; +// If not choice done on calendar owner, we filter on user. +if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) +{ + $filtert=$user->id; +} $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -67,9 +70,7 @@ if (! $user->rights->agenda->myactions->read) accessforbidden(); if (! $user->rights->agenda->allactions->read) $canedit=0; if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no permission to see all, we show only affected to me { - $filtera=$user->id; $filtert=$user->id; - $filterd=$user->id; } $action=GETPOST('action','alpha'); @@ -214,13 +215,13 @@ if (empty($action) || $action=='show_month') $max_day_in_prev_month = date("t",dol_mktime(0,0,0,$prev_month,1,$prev_year)); // Nb of days in previous month $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); // Nb of days in next month - // tmpday is a negative or null cursor to know how many days before the 1 to show on month view (if tmpday=0 we start on monday) - $tmpday = -date("w",dol_mktime(0,0,0,$month,1,$year))+2; + // tmpday is a negative or null cursor to know how many days before the 1st to show on month view (if tmpday=0, 1st is monday) + $tmpday = -date("w",dol_mktime(12,0,0,$month,1,$year,true))+2; // date('w') is 0 fo sunday $tmpday+=((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1)-1); - if ($tmpday >= 1) $tmpday -= 7; - // Define firstdaytoshow and lastdaytoshow + if ($tmpday >= 1) $tmpday -= 7; // If tmpday is 0 we start with sunday, if -6, we start with monday of previous week. + // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$max_day_in_prev_month+$tmpday,$prev_year); - $next_day=7-($max_day_in_month+1-$tmpday)%7; + $next_day=7 - ($max_day_in_month+1-$tmpday) % 7; if ($next_day < 6) $next_day+=7; $lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year); } @@ -242,9 +243,9 @@ if ($action=='show_week') $next_month = $next['month']; $next_day = $next['day']; - // Define firstdaytoshow and lastdaytoshow + // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) $firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year); - $lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 6, 'd'); + $lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd'); $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); @@ -261,7 +262,7 @@ if ($action == 'show_day') $next_month = $next['month']; $next_day = $next['day']; - // Define firstdaytoshow and lastdaytoshow + // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$prev_day,$prev_year); $lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year); } @@ -278,9 +279,7 @@ $param=''; if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode; if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($filter) $param.="&filter=".$filter; -if ($filtera) $param.="&filtera=".$filtera; if ($filtert) $param.="&filtert=".$filtert; -if ($filterd) $param.="&filterd=".$filterd; if ($socid) $param.="&socid=".$socid; if ($showbirthday) $param.="&showbirthday=1"; if ($pid) $param.="&projectid=".$pid; @@ -335,7 +334,7 @@ $paramnoaction=preg_replace('/action=[a-z_]+/','',$param); $head = calendars_prepare_head($paramnoaction); dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); -print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup); +print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup); dol_fiche_end(); $showextcals=$listofextcals; @@ -400,26 +399,29 @@ print_fiche_titre($s,$link.'     '.$nav, ''); // Get event in an array $eventarray=array(); -$sql = 'SELECT a.id,a.label,'; +$sql = 'SELECT '; +if ($usergroup > 0) $sql.=" DISTINCT"; +$sql.= ' a.id, a.label,'; $sql.= ' a.datep,'; $sql.= ' a.datep2,'; -$sql.= ' a.datea,'; -$sql.= ' a.datea2,'; $sql.= ' a.percent,'; -$sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,'; +$sql.= ' a.fk_user_author,a.fk_user_action,'; $sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,'; $sql.= ' a.fk_soc, a.fk_contact,'; -$sql.= ' ca.code'; +$sql.= ' ca.code as type_code, ca.libelle as type_label'; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; -if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu"; +// We must filter on assignement table +if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; +if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; $sql.= ' WHERE a.fk_action = ca.id'; $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'"; if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid; -if ($usergroup > 0) $sql.= " AND ugu.fk_user = a.fk_user_action"; +// We must filter on assignement table +if ($filtert > 0 || $usergroup > 0) $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; if ($action == 'show_day') { $sql.= " AND ("; @@ -453,13 +455,12 @@ if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; } if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; } -if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0) +// We must filter on assignement table +if ($filtert > 0 || $usergroup > 0) { $sql.= " AND ("; - if ($filtera > 0) $sql.= " a.fk_user_author = ".$filtera; - if ($filtert > 0) $sql.= ($filtera>0?" OR ":"")." a.fk_user_action = ".$filtert; - if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd; - if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup; + if ($filtert > 0) $sql.= "ar.fk_element = ".$filtert; + if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup; $sql.= ")"; } // Sort on date @@ -476,18 +477,25 @@ if ($resql) { $obj = $db->fetch_object($resql); + // Discard auto action if option is on + if (! empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->type_code == 'AC_OTH_AUTO') + { + $i++; + continue; + } + // Create a new object action $event=new ActionComm($db); $event->id=$obj->id; $event->datep=$db->jdate($obj->datep); // datep and datef are GMT date $event->datef=$db->jdate($obj->datep2); - $event->type_code=$obj->code; + $event->type_code=$obj->type_code; + $event->type_label=$obj->type_label; $event->libelle=$obj->label; $event->percentage=$obj->percent; - $event->author->id=$obj->fk_user_author; // user id of creator - $event->usertodo->id=$obj->fk_user_action; // user id of owner - $event->userdone->id=$obj->fk_user_done; // deprecated - // $event->userstodo=... with s after user, in future version, will be an array with all id of user assigned to event + $event->authorid=$obj->fk_user_author; // user id of creator + $event->userownerid=$obj->fk_user_action; // user id of owner + $event->fetch_userassigned(); // This load $event->userassigned $event->priority=$obj->priority; $event->fulldayevent=$obj->fulldayevent; $event->location=$obj->location; @@ -518,14 +526,14 @@ if ($resql) // Check values if ($event->date_end_in_calendar < $firstdaytoshow || - $event->date_start_in_calendar > $lastdaytoshow) + $event->date_start_in_calendar >= $lastdaytoshow) { // This record is out of visible range } else { if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow; - if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=$lastdaytoshow; + if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow-1); // Add an entry in actionarray for each day $daycursor=$event->date_start_in_calendar; @@ -655,7 +663,7 @@ if (count($listofextcals)) if (isset($icalevent['RRULE']) && is_array($icalevent['RRULE'])) //repeatable event { //if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow; - //if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=$lastdaytoshow; + //if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow-1); if ($icalevent['DTSTART;VALUE=DATE']) //fullday event { $datecurstart=dol_stringtotime($icalevent['DTSTART;VALUE=DATE'],1); @@ -694,10 +702,10 @@ if (count($listofextcals)) $until=empty($icalevent['RRULE']['UNTIL'])?0:dol_stringtotime($icalevent['RRULE']['UNTIL'],1); $maxrepeat=empty($icalevent['RRULE']['COUNT'])?0:$icalevent['RRULE']['COUNT']; if ($until && ($until+($datecurend-$datecurstart)) < $firstdaytoshow) continue; // We discard repeatable event that end before start date to show - if ($datecurstart > $lastdaytoshow) continue; // We discard repeatable event that start after end date to show + if ($datecurstart >= $lastdaytoshow) continue; // We discard repeatable event that start after end date to show $numofevent=0; - while (($datecurstart <= $lastdaytoshow) && (empty($maxrepeat) || ($numofevent < $maxrepeat))) + while (($datecurstart < $lastdaytoshow) && (empty($maxrepeat) || ($numofevent < $maxrepeat))) { if ($datecurend >= $firstdaytoshow) // We add event { @@ -829,7 +837,7 @@ if (count($listofextcals)) } // Add event into $eventarray if date range are ok. - if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar > $lastdaytoshow) + if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow) { //print 'x'.$datestart.'-'.$dateend;exit; //print 'x'.$datestart.'-'.$dateend;exit; @@ -839,7 +847,7 @@ if (count($listofextcals)) else { if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow; - if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=$lastdaytoshow; + if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow - 1); // Add an entry in actionarray for each day $daycursor=$event->date_start_in_calendar; @@ -870,6 +878,7 @@ if (count($listofextcals)) $maxnbofchar=18; $cachethirdparties=array(); $cachecontacts=array(); +$cacheusers=array(); // Define theme_datacolor array $color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php"; @@ -912,7 +921,7 @@ if (empty($action) || $action == 'show_month') // View by month echo " \n"; for ($iter_day = 0; $iter_day < 7; $iter_day++) { - /* Show days before the beginning of the current month (previous month) */ + /* Show days before the beginning of the current month (previous month) */ if ($tmpday <= 0) { $style='cal_other_month cal_past'; @@ -925,21 +934,20 @@ if (empty($action) || $action == 'show_month') // View by month elseif ($tmpday <= $max_day_in_month) { $curtime = dol_mktime(0, 0, 0, $month, $tmpday, $year); - $style='cal_current_month'; if ($iter_day == 6) $style.=' cal_current_month_right'; $today=0; if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1; if ($today) $style='cal_today'; if ($curtime < $todaytms) $style.=' cal_past'; - + //var_dump($todayarray['mday']."==".$tmpday." && ".$todayarray['mon']."==".$month." && ".$todayarray['year']."==".$year.' -> '.$style); echo ' '; show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam); echo " \n"; } /* Show days after the current month (next month) */ else - { + { $style='cal_other_month'; if ($iter_day == 6) $style.=' cal_other_month_right'; echo ' '; @@ -1023,7 +1031,7 @@ else // View by day $today=0; $todayarray=dol_getdate($now,'fast'); if ($todayarray['mday']==$day && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1; - if ($today) $style='cal_today'; + //if ($today) $style='cal_today'; $timestamp=dol_mktime(12,0,0,$month,$day,$year); $arraytimestamp=dol_getdate($timestamp); @@ -1069,7 +1077,7 @@ $db->close(); * @param int $year Year * @param int $monthshown Current month shown in calendar view * @param string $style Style to use for this day - * @param array &$eventarray Array of events + * @param array $eventarray Array of events * @param int $maxprint Nb of actions to show each day on month view (0 means no limit) * @param int $maxnbofchar Nb of characters to show for event line * @param string $newparam Parameters on current URL @@ -1080,9 +1088,9 @@ $db->close(); function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60) { global $user, $conf, $langs; - global $action, $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form + global $action, $filter, $filtert, $status, $actioncode; // Filters used into search form global $theme_datacolor; - global $cachethirdparties, $cachecontacts, $colorindexused; + global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused; print '
    '."\n"; @@ -1104,7 +1112,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa //$param='month='.$monthshown.'&year='.$year; $hourminsec='100000'; - print ''; + print ''; print img_picto($langs->trans("NewAction"),'edit_add.png'); print ''; } @@ -1132,20 +1140,26 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa { if ($i < $maxprint || $maxprint == 0 || ! empty($conf->global->MAIN_JS_SWITCH_AGENDA)) { - $ponct=($event->date_start_in_calendar == $event->date_end_in_calendar); + $keysofuserassigned=array_keys($event->userassigned); - // Define $color and $cssclass of event + $ponct=($event->date_start_in_calendar == $event->date_end_in_calendar); + + // Define $color (Hex string like '0088FF') and $cssclass of event $color=-1; $cssclass=''; $colorindex=-1; - if ((! empty($event->author->id) && $event->author->id == $user->id) - || (! empty($event->usertodo->id) && $event->usertodo->id == $user->id) - || (! empty($event->userdone->id) && $event->userdone->id == $user->id)) - { - $nummytasks++; $cssclass='family_mytasks'; - // TODO Set a color using user color - // Must defined rule to choose color of who to use. - // event->usertodo->id will still contains user id of owner - // event->userstodo will be an array in future. - // $color=$user->color; + if (in_array($user->id, $keysofuserassigned)) + { + $nummytasks++; $cssclass='family_mytasks'; + + if (empty($cacheusers[$event->userownerid])) + { + $newuser=new User($db); + $newuser->fetch($event->userownerid); + $cacheusers[$event->userownerid]=$newuser; + } + //var_dump($cacheusers[$event->userownerid]->color); + + // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event) + if (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color; } else if ($event->type_code == 'ICALEVENT') { @@ -1159,12 +1173,29 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $color=$event->icalcolor; $cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unsortable'); } - else if ($event->type_code == 'BIRTHDAY') { $numbirthday++; $colorindex=2; $cssclass='family_birthday unsortable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); } - else { $numother++; $cssclass='family_other'; } + else if ($event->type_code == 'BIRTHDAY') + { + $numbirthday++; $colorindex=2; $cssclass='family_birthday unsortable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); + } + else + { + $numother++; $cssclass='family_other'; + + if (empty($cacheusers[$event->userownerid])) + { + $newuser=new User($db); + $newuser->fetch($event->userownerid); + $cacheusers[$event->userownerid]=$newuser; + } + //var_dump($cacheusers[$event->userownerid]->color); + + // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event) + if (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color; + } if ($color == -1) // Color was not forced. Set color according to color index. { // Define color index if not yet defined - $idusertouse=($event->usertodo->id?$event->usertodo->id:0); + $idusertouse=($event->userownerid?$event->userownerid:0); if (isset($colorindexused[$idusertouse])) { $colorindex=$colorindexused[$idusertouse]; // Color already assigned to this user @@ -1280,7 +1311,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa print "
    \n"; } else - { + { if ($showinfo) { print $langs->trans("EventOnFullDay")."
    \n"; @@ -1344,9 +1375,9 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } else { - print ''.img_picto("all","1downarrow_selected.png").' ...'; print ' +'.(count($eventarray[$daykey])-$maxprint); diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index a2c75386e56..b8c913df271 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; +$langs->load("users"); $langs->load("companies"); $langs->load("agenda"); $langs->load("commercial"); @@ -44,18 +45,24 @@ $status=GETPOST("status",'alpha'); $type=GETPOST('type'); $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_USE_EVENT_TYPE)?'AC_OTH':'')); $dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear')); +$datestart=dol_mktime(0, 0, 0, GETPOST('datestartmonth'), GETPOST('datestartday'), GETPOST('datestartyear')); +$dateend=dol_mktime(0, 0, 0, GETPOST('dateendmonth'), GETPOST('dateendday'), GETPOST('dateendyear')); if ($actioncode == '') $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS); if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW); $filter=GETPOST("filter",'',3); -$filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","int",3); $filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3); -$filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filterd","int",3); $usergroup = GETPOST("usergroup","int",3); $showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; +// If not choice done on calendar owner, we filter on user. +if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) +{ + $filtert=$user->id; +} + $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); @@ -86,9 +93,14 @@ if (! $user->rights->agenda->myactions->read) accessforbidden(); if (! $user->rights->agenda->allactions->read) $canedit=0; if (! $user->rights->agenda->allactions->read || $filter=='mine') // If no permission to see all, we show only affected to me { - $filtera=$user->id; $filtert=$user->id; - $filterd=$user->id; +} + +// Purge search criteria +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $datestart=''; + $dateend=''; } // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array @@ -98,6 +110,7 @@ $hookmanager->initHooks(array('agendalist')); /* * Actions */ + if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday")) { $param=''; @@ -116,13 +129,29 @@ if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday")) * View */ +$form=new Form($db); +$userstatic=new User($db); + +$nav=''; +$nav.='  
    '; +if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $nav.=''; +if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav.=''; +if ($filter) $nav.=''; +if ($filtert) $nav.=''; +if ($socid) $nav.=''; +if ($showbirthday) $nav.=''; +if ($pid) $nav.=''; +if ($type) $nav.=''; +if ($usergroup) $nav.=''; +$nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1); +$nav.=' '; +$nav.='
    '; + $now=dol_now(); $help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda'; llxHeader('',$langs->trans("Agenda"),$help_url); -$form=new Form($db); - // Define list of all external calendars $listofextcals=array(); @@ -130,57 +159,55 @@ $param=''; if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode; if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($filter) $param.="&filter=".$filter; -if ($filtera) $param.="&filtera=".$filtera; if ($filtert) $param.="&filtert=".$filtert; -if ($filterd) $param.="&filterd=".$filterd; if ($socid) $param.="&socid=".$socid; if ($showbirthday) $param.="&showbirthday=1"; if ($pid) $param.="&projectid=".$pid; if ($type) $param.="&type=".$type; +if ($usergroup) $param.="&usergroup=".$usergroup; -$sql = "SELECT s.nom as societe, s.rowid as socid, s.client,"; -$sql.= " a.id, a.datep as dp, a.datep2 as dp2,"; -$sql.= " a.fk_contact, a.note, a.label, a.percent as percent,"; -$sql.= " c.code as acode, c.libelle,"; -$sql.= " ua.login as loginauthor, ua.rowid as useridauthor,"; -$sql.= " ut.login as logintodo, ut.rowid as useridtodo,"; -$sql.= " ud.login as logindone, ud.rowid as useriddone,"; +$sql = "SELECT"; +if ($usergroup > 0) $sql.=" DISTINCT"; +$sql.= " s.nom as societe, s.rowid as socid, s.client,"; +$sql.= " a.id, a.label, a.datep as dp, a.datep2 as dp2,"; +$sql.= ' a.fk_user_author,a.fk_user_action,'; +$sql.= " a.fk_contact, a.note, a.percent as percent,"; +$sql.= " c.code as type_code, c.libelle as type_label,"; $sql.= " sp.lastname, sp.firstname"; -$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c,"; -$sql.= " ".MAIN_DB_PREFIX.'user as u,'; -$sql.= " ".MAIN_DB_PREFIX."actioncomm as a"; +$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ua ON a.fk_user_author = ua.rowid"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ut ON a.fk_user_action = ut.rowid"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ud ON a.fk_user_done = ud.rowid"; -if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu"; +// We must filter on assignement table +if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; +if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; $sql.= " WHERE c.id = a.fk_action"; -$sql.= ' AND a.fk_user_author = u.rowid'; -$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; // To limit to entity +$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; if ($actioncode) $sql.=" AND c.code='".$db->escape($actioncode)."'"; if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; if ($socid > 0) $sql.= " AND s.rowid = ".$socid; -if ($usergroup > 0) $sql.= " AND ugu.fk_user = a.fk_user_action"; +// We must filter on assignement table +if ($filtert > 0 || $usergroup > 0) $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; if ($type) $sql.= " AND c.id = ".$type; if ($status == '0') { $sql.= " AND a.percent = 0"; } if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; } if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; } -if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0) +// We must filter on assignement table +if ($filtert > 0 || $usergroup > 0) { $sql.= " AND ("; - if ($filtera > 0) $sql.= " a.fk_user_author = ".$filtera; - if ($filtert > 0) $sql.= ($filtera>0?" OR ":"")." a.fk_user_action = ".$filtert; - if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd; - if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup; + if ($filtert > 0) $sql.= "ar.fk_element = ".$filtert; + if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup; $sql.= ")"; } -//if ($dateselect > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($dateselect)."' AND '".$db->idate($dateselect+3600*24-1).'"'; -if ($dateselect > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($dateselect)."' AND '".$db->idate($dateselect+3600*24-1)."'"; + +// The second or of next test is to take event with no end date (we suppose duration is 1 hour in such case) +if ($dateselect > 0) $sql.= " AND ((a.datep2 >= '".$db->idate($dateselect)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."') OR (a.datep2 IS NULL AND a.datep > '".$db->idate($dateselect-3600)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."'))"; +if ($datestart > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($datestart)."' AND '".$db->idate($datestart+3600*24-1)."'"; +if ($dateend > 0) $sql.= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend+3600*24-1)."'"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); //print $sql; @@ -207,7 +234,7 @@ if ($resql) $head = calendars_prepare_head($param); dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); - print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$action,-1,$actioncode,$usergroup); + print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,-1,$actioncode,$usergroup); dol_fiche_end(); // Add link to show birthdays @@ -227,7 +254,7 @@ if ($resql) } */ - print_barre_liste($newtitle, $page, $_SERVER["PHP_SELF"], $param,$sortfield,$sortorder,$link,$num,0,''); + print_barre_liste($newtitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $link, $num, 0, '', 0, $nav); //print '
    '; print '
    '."\n"; @@ -236,30 +263,28 @@ if ($resql) print ''; print ''; print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder); - //print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ActionUserAsk"),$_SERVER["PHP_SELF"],"ua.login",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AffectedTo"),$_SERVER["PHP_SELF"],"ut.login",$param,"","",$sortfield,$sortorder); - //print_liste_field_titre($langs->trans("DoneBy"),$_SERVER["PHP_SELF"],"ud.login",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="right"',$sortfield,$sortorder); print "\n"; print ''; print ''; print ''; + print ''; print ''; print ''; - print ''; - print ''; + //print ''; print ''; print ''; print "\n"; @@ -272,6 +297,13 @@ if ($resql) { $obj = $db->fetch_object($resql); + // Discard auto action if option is on + if (! empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->type_code == 'AC_OTH_AUTO') + { + $i++; + continue; + } + $var=!$var; print ""; @@ -279,7 +311,8 @@ if ($resql) // Action (type) print ''; @@ -327,44 +360,16 @@ if ($resql) } print ''; - // User author - print ''; - // User to do print ''; - // User did - /* - print ''; - */ - // Status/Percent print ''; @@ -384,6 +389,6 @@ else } -$db->close(); - llxFooter(); + +$db->close(); diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 5afda948a77..4e1de9768ac 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -39,14 +39,17 @@ if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3; $filter=GETPOST("filter",'',3); -$filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","int",3); $filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3); -$filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filterd","int",3); $usergroup = GETPOST("usergroup","int",3); //if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id; //$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; $showbirthday = 0; +// If not choice done on calendar owner, we filter on user. +if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) +{ + $filtert=$user->id; +} $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -68,9 +71,7 @@ if (! $user->rights->agenda->myactions->read) accessforbidden(); if (! $user->rights->agenda->allactions->read) $canedit=0; if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no permission to see all, we show only affected to me { - $filtera=$user->id; $filtert=$user->id; - $filterd=$user->id; } //$action=GETPOST('action','alpha'); @@ -96,7 +97,7 @@ if ($dateselect > 0) $tmp=empty($conf->global->MAIN_DEFAULT_WORKING_HOURS)?'9-18':$conf->global->MAIN_DEFAULT_WORKING_HOURS; $tmparray=explode('-',$tmp); -$begin_h = GETPOST('begin_h')?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9); +$begin_h = GETPOST('begin_h')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9); $end_h = GETPOST('end_h')?GETPOST('end_h'):($tmparray[1] != '' ? $tmparray[1] : 18); if ($begin_h < 0 || $begin_h > 23) $begin_h = 9; if ($end_h < 1 || $end_h > 24) $end_h = 18; @@ -108,7 +109,7 @@ $begin_d = GETPOST('begin_d')?GETPOST('begin_d','int'):($tmparray[0] != '' ? $tm $end_d = GETPOST('end_d')?GETPOST('end_d'):($tmparray[1] != '' ? $tmparray[1] : 5); if ($begin_d < 1 || $begin_d > 7) $begin_d = 1; if ($end_d < 1 || $end_d > 7) $end_d = 7; -if ($end_d <= $begin_d) $end_d = $begin_d + 1; +if ($end_d < $begin_d) $end_d = $begin_d + 1; if ($actioncode == '') $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS); @@ -125,6 +126,7 @@ if (GETPOST('viewday') || $action == 'show_day') { } // View by day +$langs->load("users"); $langs->load("agenda"); $langs->load("other"); $langs->load("commercial"); @@ -179,17 +181,11 @@ $next_year = $next['year']; $next_month = $next['month']; $next_day = $next['day']; -// Define firstdaytoshow and lastdaytoshow -$firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year); -$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 6, 'd'); - $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); $tmpday = $first_day; //print 'xx'.$prev_year.'-'.$prev_month.'-'.$prev_day; //print 'xx'.$next_year.'-'.$next_month.'-'.$next_day; -//print dol_print_date($firstdaytoshow,'day'); -//print dol_print_date($lastdaytoshow,'day'); $title=$langs->trans("DoneAndToDoActions"); if ($status == 'done') $title=$langs->trans("DoneActions"); @@ -199,9 +195,8 @@ $param=''; if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode; if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($filter) $param.="&filter=".$filter; -if ($filtera) $param.="&filtera=".$filtera; if ($filtert) $param.="&filtert=".$filtert; -if ($filterd) $param.="&filterd=".$filterd; +if ($usergroup) $param.="&usergroup=".$usergroup; if ($socid) $param.="&socid=".$socid; if ($showbirthday) $param.="&showbirthday=1"; if ($pid) $param.="&projectid=".$pid; @@ -225,9 +220,11 @@ $next_year = $next['year']; $next_month = $next['month']; $next_day = $next['day']; -// Define firstdaytoshow and lastdaytoshow +// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) $firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year); -$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 6, 'd'); +$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd'); +//print dol_print_date($firstdaytoshow,'dayhour'); +//print dol_print_date($lastdaytoshow,'dayhour'); $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); @@ -241,6 +238,20 @@ $nav.="   ('; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; + $nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1); $nav.=' '; $nav.=''; @@ -264,7 +275,7 @@ $paramnoaction=preg_replace('/action=[a-z_]+/','',$param); $head = calendars_prepare_head($paramnoaction); dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); -print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup); +print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup); dol_fiche_end(); $showextcals=$listofextcals; @@ -316,26 +327,29 @@ print_fiche_titre($s,$link.'     '.$nav, ''); // Get event in an array $eventarray=array(); -$sql = 'SELECT a.id,a.label,'; +$sql = 'SELECT'; +if ($usergroup > 0) $sql.=" DISTINCT"; +$sql.= ' a.id, a.label,'; $sql.= ' a.datep,'; $sql.= ' a.datep2,'; -$sql.= ' a.datea,'; -$sql.= ' a.datea2,'; $sql.= ' a.percent,'; -$sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,'; +$sql.= ' a.fk_user_author,a.fk_user_action,'; $sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,'; -$sql.= ' a.fk_soc, a.fk_contact,'; -$sql.= ' ca.code'; +$sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,'; +$sql.= ' ca.code, ca.color'; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; -if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu"; +// We must filter on assignement table +if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; +if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; $sql.= ' WHERE a.fk_action = ca.id'; $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'"; if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid; -if ($usergroup > 0) $sql.= " AND ugu.fk_user = a.fk_user_action"; +// We must filter on assignement table +if ($filtert > 0 || $usergroup > 0) $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; if ($action == 'show_day') { $sql.= " AND ("; @@ -369,13 +383,12 @@ if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; } if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; } -if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0) +// We must filter on assignement table +if ($filtert > 0 || $usergroup > 0) { $sql.= " AND ("; - if ($filtera > 0) $sql.= " a.fk_user_author = ".$filtera; - if ($filtert > 0) $sql.= ($filtera>0?" OR ":"")." a.fk_user_action = ".$filtert; - if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd; - if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup; + if ($filtert > 0) $sql.= "ar.fk_element = ".$filtert; + if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup; $sql.= ")"; } // Sort on date @@ -392,26 +405,39 @@ if ($resql) { $obj = $db->fetch_object($resql); + // Discard auto action if option is on + if (! empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->code == 'AC_OTH_AUTO') + { + $i++; + continue; + } + // Create a new object action $event=new ActionComm($db); $event->id=$obj->id; $event->datep=$db->jdate($obj->datep); // datep and datef are GMT date $event->datef=$db->jdate($obj->datep2); $event->type_code=$obj->code; - $event->libelle=$obj->label; // deprecated + $event->type_color=$obj->color; + //$event->libelle=$obj->label; // deprecated $event->label=$obj->label; $event->percentage=$obj->percent; - $event->author->id=$obj->fk_user_author; // user id of creator - $event->usertodo->id=$obj->fk_user_action; // user id of owner - $event->userdone->id=$obj->fk_user_done; // deprecated - // $event->userstodo=... with s after user, in future version, will be an array with all id of user assigned to event + //$event->author->id=$obj->fk_user_author; // user id of creator + $event->authorid=$obj->fk_user_author; // user id of creator + $event->userownerid=$obj->fk_user_action; // user id of owner + $event->fetch_userassigned(); // This load $event->userassigned $event->priority=$obj->priority; $event->fulldayevent=$obj->fulldayevent; $event->location=$obj->location; $event->transparency=$obj->transparency; - $event->societe->id=$obj->fk_soc; - $event->contact->id=$obj->fk_contact; + $event->socid=$obj->fk_soc; + $event->contactid=$obj->fk_contact; + //$event->societe->id=$obj->fk_soc; // deprecated + //$event->contact->id=$obj->fk_contact; // deprecated + + $event->fk_element=$obj->fk_element; + $event->elementtype=$obj->elementtype; // Defined date_start_in_calendar and date_end_in_calendar property // They are date start and end of action but modified to not be outside calendar view. @@ -422,7 +448,7 @@ if ($resql) else $event->date_end_in_calendar=$event->datep; } else - { + { $event->date_start_in_calendar=$event->datep; if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef; else $event->date_end_in_calendar=$event->datep; @@ -435,14 +461,14 @@ if ($resql) // Check values if ($event->date_end_in_calendar < $firstdaytoshow || - $event->date_start_in_calendar > $lastdaytoshow) + $event->date_start_in_calendar >= $lastdaytoshow) { // This record is out of visible range } else - { + { if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow; - if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=$lastdaytoshow; + if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow - 1); // Add an entry in actionarray for each day $daycursor=$event->date_start_in_calendar; @@ -454,7 +480,7 @@ if ($resql) $loop=true; $j=0; $daykey=dol_mktime(0,0,0,$mois,$jour,$annee); do - { + { //if ($event->id==408) print 'daykey='.$daykey.' '.$event->datep.' '.$event->datef.'
    '; $eventarray[$daykey][]=$event; @@ -477,7 +503,6 @@ else dol_print_error($db); } - $maxnbofchar=18; $cachethirdparties=array(); $cachecontacts=array(); @@ -553,30 +578,63 @@ while ($i < 7) } echo "
    \n"; + // Define $usernames $usernames = array(); //init -/* Use this to have list of users only if users have events -foreach ($eventarray as $daykey => $notused) +$usernamesid = array(); +/* Use this to have list of users only if users have events */ +if (! empty($conf->global->AGENDA_SHOWOWNERONLY_ONPERUSERVIEW)) { - $annee = date('Y',$daykey); - $mois = date('m',$daykey); - $jour = date('d',$daykey); - //if ($day==$jour && $month==$mois && $year==$annee) - //{ - //Tout les events à la même date : - foreach ($eventarray[$daykey] as $index => $event) - { - $myuser = new User($db); - $user_id = $event->usertodo->id; - $myuser->fetch($user_id); - $username = $myuser->getFullName($langs); - if (! in_array($username, $usernames)) - { - $usernames[] = $username; - } - } - //} -}*/ + foreach ($eventarray as $daykey => $notused) + { + // Get all assigned users for each event + foreach ($eventarray[$daykey] as $index => $event) + { + $event->fetch_userassigned(); + $listofuserid=$event->userassigned; + foreach($listofuserid as $userid => $tmp) + { + if (! in_array($userid, $usernamesid)) $usernamesid[$userid] = $userid; + } + } + } +} +/* Use this list to have for all users */ +else +{ + $sql = "SELECT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity"; + $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; + if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON u.rowid = ug.fk_user"; + $sql.= " WHERE u.entity IN (".getEntity('user',1).")"; + if ($usergroup > 0) $sql.= " AND ug.fk_usergroup = ".$usergroup; + if (GETPOST("usertodo","int",3) > 0) $sql.=" AND u.rowid = ".GETPOST("usertodo","int",3); + //print $sql; + $resql=$db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + if ($num) + { + while ($i < $num) + { + $obj = $db->fetch_object($resql); + $usernamesid[$obj->rowid]=$obj->rowid; + $i++; + } + } + } + else dol_print_error($db); +} +//var_dump($usernamesid); +foreach($usernamesid as $id) +{ + $tmpuser=new User($db); + $result=$tmpuser->fetch($id); + $usernames[]=$tmpuser; +} + +/* if ($filtert > 0) { $tmpuser = new User($db); @@ -594,67 +652,90 @@ else $tmpgroup = new UserGroup($db); //$tmpgroup->fetch($usergroup); No fetch, we want all users for all groups $usernames = $tmpgroup->listUsersForGroup(); +}*/ + +// Load array of colors by type +$colorsbytype=array(); +$labelbytype=array(); +$sql="SELECT code, color, libelle FROM ".MAIN_DB_PREFIX."c_actioncomm"; +$resql=$db->query($sql); +while ($obj = $db->fetch_object($resql)) +{ + $colorsbytype[$obj->code]=$obj->color; + $labelbytype[$obj->code]=$obj->libelle; } - // Loop on each user to show calendar +$todayarray=dol_getdate($now,'fast'); $sav = $tmpday; $showheader = true; +$var = false; +foreach ($usernames as $username) +{ + $var = ! $var; + echo ""; + echo ''; + $tmpday = $sav; -// listUsersForGroup may return -1 which is not traversable -if (is_array($usernames)) { - foreach ($usernames as $username) { - echo ""; - echo ''; - $tmpday = $sav; - - $i = 0; - for ($iter_day = 0; $iter_day < 7; $iter_day++) { - if (($i + 1) < $begin_d || ($i + 1) > $end_d) { - $i++; - continue; - } - - // Show days of the current week - $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); - $tmparray = dol_getdate($curtime, true); - $tmpday = $tmparray['mday']; - $tmpmonth = $tmparray['mon']; - $tmpyear = $tmparray['year']; - - $style = 'cal_current_month'; - if ($iter_day == 6) $style .= ' cal_other_month'; - $today = 0; - $todayarray = dol_getdate($now, true); - if ($todayarray['mday'] == $tmpday && $todayarray['mon'] == $month && $todayarray['year'] == $year) $today = 1; - if ($today) $style = 'cal_today_peruser'; - - show_day_events2( - $username, - $tmpday, - $month, - $year, - $monthshown, - $style, - $eventarray, - 0, - $maxnbofchar, - $newparam, - 1, - 300, - $showheader - ); - + // Lopp on each day of week + $i = 0; + for ($iter_day = 0; $iter_day < 7; $iter_day++) + { + if (($i + 1) < $begin_d || ($i + 1) > $end_d) + { $i++; + continue; } - echo "\n"; - $showheader = false; + + // Show days of the current week + $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); + $tmparray = dol_getdate($curtime,'fast'); + $tmpday = $tmparray['mday']; + $tmpmonth = $tmparray['mon']; + $tmpyear = $tmparray['year']; + + $style='cal_current_month'; + if ($iter_day == 6) $style.=' cal_other_month'; + $today=0; + if ($todayarray['mday']==$tmpday && $todayarray['mon']==$tmpmonth && $todayarray['year']==$tmpyear) $today=1; + if ($today) $style='cal_today_peruser'; + + show_day_events2($username, $tmpday, $tmpmonth, $tmpyear, $monthshown, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype, $var); + + $i++; } + echo "\n"; + $showheader = false; } echo "
    '; - print $form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1); + print $form->select_date($datestart, 'datestart', 0, 0, 1, '', 1, 0, 1); + print ''; + print $form->select_date($dateend, 'dateend', 0, 0, 1, '', 1, 0, 1); print ''; - //print '  '; - //print ''; + print ''; print '
    '; $actionstatic->id=$obj->id; - $actionstatic->type_code=$obj->acode; + $actionstatic->type_code=$obj->type_code; + $actionstatic->type_label=$obj->type_label; $actionstatic->libelle=$obj->label; print $actionstatic->getNomUrl(1,28); print ''; - if ($obj->useridauthor) - { - $userstatic=new User($db); - $userstatic->id=$obj->useridauthor; - $userstatic->login=$obj->loginauthor; - print $userstatic->getLoginUrl(1); - } - else print ' '; - print ''; - if ($obj->useridtodo) + if ($obj->fk_user_action > 0) { - $userstatic=new User($db); - $userstatic->id=$obj->useridtodo; - $userstatic->login=$obj->logintodo; + $userstatic->fetch($obj->fk_user_action); print $userstatic->getLoginUrl(1); } else print ' '; print ''; - if ($obj->useriddone) - { - $userstatic=new User($db); - $userstatic->id=$obj->useriddone; - $userstatic->login=$obj->logindone; - print $userstatic->getLoginUrl(1); - } - else print ' '; - print ''.$actionstatic->LibStatut($obj->percent,6).'
    ' . $username->getNomUrl(1). '
    ' . $username->getNomUrl(1) . '
    \n"; +if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) +{ + $langs->load("commercial"); + print '
    '.$langs->trans("Legend").':
    '; + foreach($colorsbytype as $code => $color) + { + if ($color) + { + print '
     
    '; + print $langs->trans("Action".$code)!="Action".$code?$langs->trans("Action".$code):$labelbytype[$code]; + //print $code; + print '
    '; + } + } + //$color=sprintf("%02x%02x%02x",$theme_datacolor[0][0],$theme_datacolor[0][1],$theme_datacolor[0][2]); + print '
     
    '; + print $langs->trans("Other"); + print '
    '; + /* TODO Show this if at least one cumulated event + print '
     
    '; + print $langs->trans("SeveralEvents"); + print '
    '; + */ +} + // Add js code to manage click on a box print ' '; - print '
    '; } // Form to confirm payment @@ -684,15 +687,15 @@ if (! GETPOST('action')) { $num = $db->num_rows($resql); $i = 0; - $var=True; + $var=true; - print_barre_liste($langs->trans('Payments'), $page, 'paiement.php','',$sortfield,$sortorder,'',$num); + print_barre_liste($langs->trans('Payments'), $page, $_SERVER["PHP_SELF"],'',$sortfield,$sortorder,'',$num); print ''; print ''; - print_liste_field_titre($langs->trans('Invoice'),'paiement.php','facnumber','','','',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Date'),'paiement.php','dp','','','',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Type'),'paiement.php','libelle','','','',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Amount'),'paiement.php','fa_amount','','','align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Invoice'),$_SERVER["PHP_SELF"],'facnumber','','','',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'dp','','','',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Type'),$_SERVER["PHP_SELF"],'libelle','','','',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Amount'),$_SERVER["PHP_SELF"],'fa_amount','','','align="right"',$sortfield,$sortorder); print ''; print "\n"; diff --git a/htdocs/compta/paiement/avalider.php b/htdocs/compta/paiement/avalider.php index 70e7507b96e..1afdf0e2c80 100644 --- a/htdocs/compta/paiement/avalider.php +++ b/htdocs/compta/paiement/avalider.php @@ -80,14 +80,14 @@ if ($resql) $i = 0; $var=True; - print_barre_liste($langs->trans("ReceivedCustomersPaymentsToValid"), $page, "avalider.php","",$sortfield,$sortorder,'',$num); + print_barre_liste($langs->trans("ReceivedCustomersPaymentsToValid"), $page, $_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num); print '
     
    '; print ''; - print_liste_field_titre($langs->trans("Ref"),"avalider.php","p.rowid","","",'width="60"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),"avalider.php","dp","","",'width="80" align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),"avalider.php","c.libelle","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountTTC"),"avalider.php","c.libelle","","",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"p.rowid","","",'width="60"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"dp","","",'width="80" align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle","","","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"c.libelle","","",'align="right"',$sortfield,$sortorder); print ""; print "\n"; @@ -96,7 +96,7 @@ if ($resql) $objp = $db->fetch_object($resql); $var=!$var; print ""; - print ''; + print ''; print '\n"; print "\n"; print ''; @@ -104,7 +104,7 @@ if ($resql) if ($objp->statut == 0) { - print ''.$langs->trans("PaymentStatusToValidShort").''; + print ''.$langs->trans("PaymentStatusToValidShort").''; } else { diff --git a/htdocs/compta/paiement/fiche.php b/htdocs/compta/paiement/card.php similarity index 96% rename from htdocs/compta/paiement/fiche.php rename to htdocs/compta/paiement/card.php index 74ec9f4cb69..d0e15307be5 100644 --- a/htdocs/compta/paiement/fiche.php +++ b/htdocs/compta/paiement/card.php @@ -20,10 +20,10 @@ */ /** - * \file htdocs/compta/paiement/fiche.php + * \file htdocs/compta/paiement/card.php * \ingroup facture * \brief Page of a customer payment - * \remarks Nearly same file than fournisseur/paiement/fiche.php + * \remarks Nearly same file than fournisseur/paiement/card.php */ require '../../main.inc.php'; @@ -79,7 +79,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture-> if ($result > 0) { $db->commit(); - header("Location: liste.php"); + header("Location: list.php"); exit; } else @@ -112,7 +112,9 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->facture-> $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $fac, $fac->modelpdf, $outputlangs); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + $fac->generateDocument($fac->modelpdf, $outputlangs); + } } header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); @@ -271,7 +273,7 @@ print '
     
    '.img_object($langs->trans("ShowPayment"),"payment").' '.$objp->rowid.''.img_object($langs->trans("ShowPayment"),"payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp),'day')."$objp->paiement_type $objp->num_paiement'.price($objp->amount).'
    '; */ $disable_delete = 0; -$sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.total_ttc, f.paye, f.fk_statut, pf.amount, s.nom, s.rowid as socid'; +$sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.total_ttc, f.paye, f.fk_statut, pf.amount, s.nom as name, s.rowid as socid'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s'; $sql.= ' WHERE pf.fk_facture = f.rowid'; $sql.= ' AND f.fk_soc = s.rowid'; @@ -320,7 +322,7 @@ if ($resql) // Third party print ''; $thirdpartystatic->id=$objp->socid; - $thirdpartystatic->nom=$objp->nom; + $thirdpartystatic->name=$objp->name; print $thirdpartystatic->getNomUrl(1); print ''; diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/card.php similarity index 99% rename from htdocs/compta/paiement/cheque/fiche.php rename to htdocs/compta/paiement/cheque/card.php index 920a1328a62..fbf9512e438 100644 --- a/htdocs/compta/paiement/cheque/fiche.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -20,7 +20,7 @@ */ /** - * \file htdocs/compta/paiement/cheque/fiche.php + * \file htdocs/compta/paiement/cheque/card.php * \ingroup bank, invoice * \brief Page for cheque deposits */ @@ -358,14 +358,14 @@ if ($action == 'new') print $form->select_comptes($filteraccountid,'accountid',0,'courant <> 2',1); print ''; print ''; - print '
    '; + print '
    '; print ''; if ($filterdate || $filteraccountid > 0) { print '   '; print ''; } - print '
    '; + print '
    '; //print ''; print ''; print '
    '; diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 39b8f209247..9db0591ee33 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -770,10 +770,10 @@ class RemiseCheque extends CommonObject $result=''; - $lien = ''; + $lien = ''; $lienfin=''; - if ($withpicto) $result.=($lien.img_object($langs->trans("ShowCheckReceipt"),'payment').$lienfin); + if ($withpicto) $result.=($lien.img_object($langs->trans("ShowCheckReceipt"), 'payment', 'class="classfortooltip"').$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php index 4e1d6190a4f..362493b7f19 100644 --- a/htdocs/compta/paiement/cheque/index.php +++ b/htdocs/compta/paiement/cheque/index.php @@ -29,6 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->load("banks"); $langs->load("categories"); +$langs->load("compta"); +$langs->load("bills"); // Security check if ($user->societe_id) $socid=$user->societe_id; @@ -77,7 +79,7 @@ if ($resql) print ""; print ''.$langs->trans("BankChecksToReceipt").''; print ''; - print ''.$num.''; + print ''.$num.''; print ''; print "\n"; } @@ -90,6 +92,7 @@ else //print ''; print '
    '; +$max=10; $sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.number as ref"; $sql.= ", bc.statut, bc.nbcheque"; @@ -98,8 +101,8 @@ $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc"; $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= " WHERE ba.rowid = bc.fk_bank_account"; $sql.= " AND bc.entity = ".$conf->entity; -$sql.= " ORDER BY bc.rowid"; -$sql.= " DESC LIMIT 10"; +$sql.= " ORDER BY bc.date_bordereau DESC, rowid DESC"; +$sql.= $db->plimit($max); $resql = $db->query($sql); @@ -107,7 +110,7 @@ if ($resql) { print ''; print ''; - print ''; + print ''; print '"; print ''; print ''; diff --git a/htdocs/compta/paiement/cheque/liste.php b/htdocs/compta/paiement/cheque/list.php similarity index 79% rename from htdocs/compta/paiement/cheque/liste.php rename to htdocs/compta/paiement/cheque/list.php index cafe8493b71..fdfe86ec178 100644 --- a/htdocs/compta/paiement/cheque/liste.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -19,7 +19,7 @@ */ /** - * \file htdocs/compta/paiement/cheque/liste.php + * \file htdocs/compta/paiement/cheque/list.php * \ingroup compta * \brief Page list of cheque deposits */ @@ -38,6 +38,9 @@ $langs->load("bills"); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'banque', '',''); +$search_ref = GETPOST('search_ref','int'); +$search_account = GETPOST('search_account','int'); +$search_amount = GETPOST('search_amount','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); @@ -57,6 +60,16 @@ $formother = new FormOther($db); $checkdepositstatic=new RemiseCheque($db); $accountstatic=new Account($db); +// If click on purge search criteria ? +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_ref=''; + $search_amount=''; + $search_account=''; + $year=''; + $month=''; +} + /* * View */ @@ -72,9 +85,9 @@ $sql.= " WHERE bc.fk_bank_account = ba.rowid"; $sql.= " AND bc.entity = ".$conf->entity; // Search criteria -if (GETPOST("search_ref")) $sql.=" AND bc.number=".GETPOST("search_ref",'int'); -if (GETPOST("search_account") > 0) $sql.=" AND bc.fk_bank_account=".GETPOST("search_account",'int'); -if (GETPOST("search_amount")) $sql.=" AND bc.amount=".price2num(GETPOST("search_amount")); +if ($search_ref) $sql.=" AND bc.number=".$search_ref; +if ($search_account > 0) $sql.=" AND bc.fk_bank_account=".$search_account; +if ($search_amount) $sql.=" AND bc.amount='".$db->escape(price2num(trim($search_amount)))."'"; if ($month > 0) { if ($year > 0 && empty($day)) @@ -103,7 +116,7 @@ if ($resql) print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num); - print ''; + print ''; print '
    '.$langs->trans("CheckReceiptShort").''.$langs->trans("LastCheckReceiptShort",$max).''.$langs->trans("Date")."'.$langs->trans("Account").''.$langs->trans("NbOfCheques").'
    '; print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bc.number","",$params,"",$sortfield,$sortorder); @@ -117,7 +130,7 @@ if ($resql) // Lignes des champs de filtre print ''; print ''; print ''; print ''; print ''; print ''; - print ''; - print "\n"; + print '\n"; $var=true; while ($i < min($num,$limit)) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 842050c61bc..42542e43a9c 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -221,7 +221,7 @@ class Paiement extends CommonObject if (!in_array($invoice->type, $affected_types)) dol_syslog("Invoice ".$facid." is not a standard, nor replacement invoice, nor credit note, nor deposit invoice. We do nothing more."); else if ($remaintopay) dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing more."); else if ($mustwait) dol_syslog("There is ".$mustwait." differed payment to process, we do nothing more."); - else + else { $result=$invoice->set_paid($user,'',''); if ($result<0) @@ -360,8 +360,8 @@ class Paiement extends CommonObject { // Appel des triggers $result=$this->call_trigger('PAYMENT_DELETE', $user); - if ($result < 0) - { + if ($result < 0) + { $this->db->rollback(); return -1; } @@ -422,7 +422,6 @@ class Paiement extends CommonObject $totalamount=$this->amount; if (empty($totalamount)) $totalamount=$this->total; // For backward compatibility - if ($mode == 'payment') $totalamount=$totalamount; if ($mode == 'payment_supplier') $totalamount=-$totalamount; // Insert payment into llx_bank @@ -453,8 +452,8 @@ class Paiement extends CommonObject if ( ! $error) { $url=''; - if ($mode == 'payment') $url=DOL_URL_ROOT.'/compta/paiement/fiche.php?id='; - if ($mode == 'payment_supplier') $url=DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='; + if ($mode == 'payment') $url=DOL_URL_ROOT.'/compta/paiement/card.php?id='; + if ($mode == 'payment_supplier') $url=DOL_URL_ROOT.'/fourn/paiement/card.php?id='; if ($url) { $result=$acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode); @@ -482,8 +481,8 @@ class Paiement extends CommonObject $result=$acc->add_url_line( $bank_line_id, $fac->thirdparty->id, - DOL_URL_ROOT.'/comm/fiche.php?socid=', - $fac->thirdparty->nom, + DOL_URL_ROOT.'/comm/card.php?socid=', + $fac->thirdparty->name, 'company' ); if ($result <= 0) dol_print_error($this->db); @@ -500,8 +499,8 @@ class Paiement extends CommonObject $result=$acc->add_url_line( $bank_line_id, $fac->thirdparty->id, - DOL_URL_ROOT.'/fourn/fiche.php?socid=', - $fac->thirdparty->nom, + DOL_URL_ROOT.'/fourn/card.php?socid=', + $fac->thirdparty->name, 'company' ); if ($result <= 0) dol_print_error($this->db); @@ -747,10 +746,10 @@ class Paiement extends CommonObject $result=''; - $lien = ''; + $lien = ''; $lienfin=''; - if ($withpicto) $result.=($lien.img_object($langs->trans("ShowPayment"),'payment').$lienfin); + if ($withpicto) $result.=($lien.img_object($langs->trans("ShowPayment"), 'payment', 'class="classfortooltip"').$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; return $result; diff --git a/htdocs/compta/paiement/info.php b/htdocs/compta/paiement/info.php index 8cc06397e62..84ef52c3a80 100644 --- a/htdocs/compta/paiement/info.php +++ b/htdocs/compta/paiement/info.php @@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; $langs->load("bills"); $langs->load("companies"); +$id=GETPOST('id'); + /* * View @@ -39,8 +41,8 @@ $langs->load("companies"); llxHeader(); $paiement = new Paiement($db); -$paiement->fetch($_GET["id"], $user); -$paiement->info($_GET["id"]); +$paiement->fetch($id); +$paiement->info($id); $head = payment_prepare_head($paiement); diff --git a/htdocs/compta/paiement/liste.php b/htdocs/compta/paiement/list.php similarity index 78% rename from htdocs/compta/paiement/liste.php rename to htdocs/compta/paiement/list.php index 6e3e1bc54ff..c7fd426babf 100644 --- a/htdocs/compta/paiement/liste.php +++ b/htdocs/compta/paiement/list.php @@ -19,7 +19,7 @@ */ /** - * \file htdocs/compta/paiement/liste.php + * \file htdocs/compta/paiement/list.php * \ingroup compta * \brief Page liste des paiements des factures clients */ @@ -42,6 +42,11 @@ $paymentstatic=new Paiement($db); $accountstatic=new Account($db); $companystatic=new Societe($db); +$search_ref=GETPOST("search_ref","int"); +$search_account=GETPOST("search_account","int"); +$search_paymenttype=GETPOST("search_paymenttype"); +$search_amount=GETPOST("search_amount"); +$search_company=GETPOST("search_company"); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); @@ -53,8 +58,14 @@ $limit = $conf->liste_limit; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="p.rowid"; - - +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_ref=""; + $search_account=""; + $search_amount=""; + $search_paymenttype=""; + $search_company=""; +} /* * View @@ -85,7 +96,7 @@ else //$sql.= " c.libelle as paiement_type,"; $sql.= " c.code as paiement_code,"; $sql.= " ba.rowid as bid, ba.label,"; - $sql.= " s.rowid as socid, s.nom"; + $sql.= " s.rowid as socid, s.nom as name"; //$sql.= " f.facnumber"; $sql.= " FROM (".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement as p)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid"; @@ -110,11 +121,11 @@ else else $sql.= " AND f.fk_user_author = ".$userid; } // Search criteria - if (GETPOST("search_ref")) $sql .=" AND p.rowid=".GETPOST("search_ref",'int'); - if (GETPOST("search_account") > 0) $sql .=" AND b.fk_account=".GETPOST("search_account",'int'); - if (GETPOST("search_paymenttype") != "") $sql .=" AND c.code='".GETPOST("search_paymenttype")."'"; - if (GETPOST("search_amount")) $sql .=" AND p.amount=".price2num(GETPOST("search_amount")); - if (GETPOST("search_company")) $sql .= natural_search('s.nom', GETPOST('search_company')); + if ($search_ref) $sql .=" AND p.rowid=".$search_ref; + if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; + if ($search_paymenttype != "") $sql .=" AND c.code='".$search_paymenttype."'"; + if ($search_amount) $sql .=" AND p.amount='".price2num($search_amount)."'"; + if ($search_company) $sql .= natural_search('s.nom', $search_company); } $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1, $offset); @@ -129,9 +140,9 @@ if ($resql) $paramlist=''; $paramlist.=(GETPOST("orphelins")?"&orphelins=1":""); - $paramlist.=($_REQUEST["search_ref"]?"&search_ref=".$_REQUEST["search_ref"]:""); - $paramlist.=($_REQUEST["search_company"]?"&search_company=".$_REQUEST["search_company"]:""); - $paramlist.=($_REQUEST["search_amount"]?"&search_amount=".$_REQUEST["search_amount"]:""); + $paramlist.=($search_ref?"&search_ref=".$search_ref:""); + $paramlist.=($search_company?"&search_company=".$search_company:""); + $paramlist.=($search_amount?"&search_amount=".$search_amount:""); print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num); @@ -149,26 +160,29 @@ if ($resql) { print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$paramlist,'align="right"',$sortfield,$sortorder); } - print "\n"; + print ''; + print "\n"; // Lines for filters fields print ''; print ''; print ''; print ''; print ''; print ''; print ''; if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { @@ -197,7 +211,7 @@ if ($resql) if ($objp->socid) { $companystatic->id=$objp->socid; - $companystatic->nom=$objp->nom; + $companystatic->name=$objp->name; print $companystatic->getNomUrl(1,'',24); } else print ' '; @@ -218,12 +232,13 @@ if ($resql) if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { print ''; } - + + print ''; print ''; $i++; diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index a54a0bcd935..1c452bc0b02 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -253,7 +253,7 @@ if ($_GET["action"] == 'create') print ''; print "\n"; - $var=True; + $var=true; $total=0; $totalrecu=0; @@ -312,13 +312,11 @@ if ($_GET["action"] == 'create') print "
    '; - print ''; + print ''; print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; @@ -125,16 +138,15 @@ if ($resql) $formother->select_year($year?$year:-1,'year',1, 20, 5); print ''; - $form->select_comptes($_REQUEST["search_account"],'search_account',0,'',1); + $form->select_comptes($search_account,'search_account',0,'',1); print ' '; - print ''; + print ''; print ''; - print ''; - print '
    '; + print ''; + print "
     
    '; - print ''; + print ''; print ' '; - print ''; + print ''; print ''; - $form->select_types_paiements($_REQUEST["search_paymenttype"],'search_paymenttype','',2,1,1); + $form->select_types_paiements($search_paymenttype,'search_paymenttype','',2,1,1); print ''; - $form->select_comptes($_REQUEST["search_account"],'search_account',0,'',1); + $form->select_comptes($search_account,'search_account',0,'',1); print ''; - print ''; + print ''; + print ''; print ''; + print ''; print ''; - if ($objp->statut == 0) print ''; + if ($objp->statut == 0) print ''; print $paymentstatic->LibStatut($objp->statut,5); if ($objp->statut == 0) print ''; print ' 
    '.$langs->trans("Amount").'
    "; - print '
    '; - + print '
    '; print ''; - print '   '; + print '     '; print ''; - - print '
    '; + print '
    '; print "\n"; } diff --git a/htdocs/compta/payment_sc/fiche.php b/htdocs/compta/payment_sc/card.php similarity index 88% rename from htdocs/compta/payment_sc/fiche.php rename to htdocs/compta/payment_sc/card.php index 5c6562b6fc0..dc2fad6d35d 100644 --- a/htdocs/compta/payment_sc/fiche.php +++ b/htdocs/compta/payment_sc/card.php @@ -19,10 +19,10 @@ */ /** - * \file htdocs/compta/payment_sc/fiche.php + * \file htdocs/compta/payment_sc/card.php * \ingroup facture * \brief Onglet payment of a social contribution - * \remarks Fichier presque identique a fournisseur/paiement/fiche.php + * \remarks Fichier presque identique a fournisseur/paiement/card.php */ require '../../main.inc.php'; @@ -98,10 +98,12 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->char $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $fac, $fac->modelpdf, $outputlangs); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + $fac->generateDocument($fac->modelpdf, $outputlangs); + } } - header('Location: fiche.php?id='.$paiement->id); + header('Location: card.php?id='.$paiement->id); exit; } else @@ -124,7 +126,7 @@ $form = new Form($db); $h=0; -$head[$h][0] = DOL_URL_ROOT.'/compta/payment_sc/fiche.php?id='.$_GET["id"]; +$head[$h][0] = DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$_GET["id"]; $head[$h][1] = $langs->trans("Card"); $hselected = $h; $h++; @@ -142,7 +144,7 @@ dol_fiche_head($head, $hselected, $langs->trans("PaymentSocialContribution"), 0, */ if ($action == 'delete') { - print $form->formconfirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2); + print $form->formconfirm('card.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2); } @@ -152,7 +154,7 @@ if ($action == 'delete') if ($action == 'valide') { $facid = $_GET['facid']; - print $form->formconfirm('fiche.php?id='.$paiement->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2); + print $form->formconfirm('card.php?id='.$paiement->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2); } @@ -211,7 +213,7 @@ $sql.= ' WHERE pf.fk_charge = f.rowid AND f.fk_type = pc.id'; $sql.= ' AND f.entity = '.$conf->entity; $sql.= ' AND pf.rowid = '.$paiement->id; -dol_syslog("compta/payment_sc/fiche.php", LOG_DEBUG); +dol_syslog("compta/payment_sc/card.php", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -291,7 +293,7 @@ if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { if ($user->rights->facture->paiement) { - print ''.$langs->trans('Valid').''; + print ''.$langs->trans('Valid').''; } } } @@ -303,7 +305,7 @@ if ($_GET['action'] == '') { if (! $disable_delete) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } else { diff --git a/htdocs/compta/prelevement/bon.php b/htdocs/compta/prelevement/bon.php deleted file mode 100644 index 20d60c3a55b..00000000000 --- a/htdocs/compta/prelevement/bon.php +++ /dev/null @@ -1,103 +0,0 @@ - - * Copyright (C) 2005 Laurent Destailleur - * Copyright (C) 2010-2012 Juanjo Menent - * - * 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 . - */ - -/** - * \file htdocs/compta/prelevement/bon.php - * \ingroup prelevement - * \brief Fiche apercu du bon de prelevement - */ - -require('../../main.inc.php'); -require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); -$langs->load("bills"); -$langs->load("categories"); - -// Security check -$socid=0; -$id = GETPOST('id','int'); -$ref = GETPOST('ref','alpha'); -if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'prelevement', $id); - - -llxHeader('','Bon de prelevement'); - -$form = new Form($db); - -if ($id > 0 || ! empty($ref)) -{ - $object = new BonPrelevement($db,""); - - if ($object->fetch($id) == 0) - { - $head = prelevement_prepare_head($object); - dol_fiche_head($head, 'preview', 'Prelevement : '. $object->ref); - - print ''; - - print ''; - print ''; - print ''; - print '
    '.$langs->trans("Ref").''.$object->ref.'
    '.$langs->trans("Amount").''.price($object->amount).'
    '.$langs->trans("File").''; - - $relativepath = 'bon/'.$object->ref; - - print ''.$object->ref.''; - - print '

    '; - - $fileimage = $conf->prelevement->dir_output.'/receipts/'.$object->ref.'.ps.png.0'; - $fileps = $conf->prelevement->dir_output.'/receipts/'.$object->ref.'.ps'; - - // Conversion du PDF en image png si fichier png non existant - if (!file_exists($fileimage)) - { - if (class_exists("Imagick")) - { - $ret = dol_convert_file($file,'png',$fileimage); - if ($ret < 0) $error++; - } - else - { - $langs->load("errors"); - print ''.$langs->trans("ErrorNoImagickReadimage").''; - } - } - - if (file_exists($fileimage)) - { - print ''; - - } - - dol_fiche_end(); - } - else - { - dol_print_error($db); - } -} - -llxFooter(); diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index 97e4401ec27..c2d67b4551b 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -73,14 +73,14 @@ if ($result) $urladd= "&statut=".$statut; - print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, "bons.php", $urladd, $sortfield, $sortorder, '', $num); + print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num); print"\n\n"; print ''; print ''; - print_liste_field_titre($langs->trans("WithdrawalsReceipts"),"bons.php","p.ref",'','','class="liste_titre"'); - print_liste_field_titre($langs->trans("Date"),"bons.php","p.datec","","",'class="liste_titre" align="center"'); + print_liste_field_titre($langs->trans("WithdrawalsReceipts"),$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"'); + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"p.datec","","",'class="liste_titre" align="center"'); print ''; print ''; @@ -104,7 +104,7 @@ if ($result) print $bon->LibStatut($obj->statut,2); print " "; - print ''.$obj->ref."\n"; + print ''.$obj->ref."\n"; print '\n"; diff --git a/htdocs/compta/prelevement/fiche.php b/htdocs/compta/prelevement/card.php similarity index 84% rename from htdocs/compta/prelevement/fiche.php rename to htdocs/compta/prelevement/card.php index e594beae1d6..9875c8df906 100644 --- a/htdocs/compta/prelevement/fiche.php +++ b/htdocs/compta/prelevement/card.php @@ -18,7 +18,7 @@ */ /** - * \file htdocs/compta/prelevement/fiche.php + * \file htdocs/compta/prelevement/card.php * \ingroup prelevement * \brief Fiche prelevement */ @@ -69,7 +69,7 @@ if ( $action == 'confirm_credite' && GETPOST('confirm','alpha') == 'yes') $bon->set_credite(); - header("Location: fiche.php?id=".$id); + header("Location: card.php?id=".$id); exit; } @@ -92,7 +92,7 @@ if ($action == 'infotrans' && $user->rights->prelevement->bons->send) $bon->set_infotrans($user, $dt, GETPOST('methode','alpha')); } - header("Location: fiche.php?id=".$id); + header("Location: card.php?id=".$id); exit; } else @@ -105,7 +105,7 @@ if ($action == 'infotrans' && $user->rights->prelevement->bons->send) if ($error) { - header("Location: fiche.php?id=".$id."&error=$error"); + header("Location: card.php?id=".$id."&error=$error"); exit; } } @@ -120,7 +120,7 @@ if ($action == 'infocredit' && $user->rights->prelevement->bons->credit) if ($error) { - header("Location: fiche.php?id=".$id."&error=$error"); + header("Location: card.php?id=".$id."&error=$error"); exit; } } @@ -150,7 +150,7 @@ if ($id > 0) /*if ($action == 'credite') { - print $form->formconfirm("fiche.php?id=".$bon->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite",'',1,1); + print $form->formconfirm("card.php?id=".$bon->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite",'',1,1); }*/ @@ -201,7 +201,7 @@ if ($id > 0) if (empty($bon->date_trans) && $user->rights->prelevement->bons->send && $action=='settransmitted') { - print ''; + print ''; print ''; print ''; print '
    '.$langs->trans("Amount").'
    '.dol_print_date($db->jdate($obj->datec),'day')."
    '; @@ -218,13 +218,13 @@ if ($id > 0) print '
    '; print '';*/ print '

    '; - print '
    '; + print '
    '; print ''; } if (! empty($bon->date_trans) && $bon->date_credit == 0 && $user->rights->prelevement->bons->credit && $action=='setcredited') { - print '
    '; + print ''; print ''; print ''; print ''; @@ -235,7 +235,7 @@ if ($id > 0) print ''; print '
    '; print '
    '.$langs->trans("ThisWillAlsoAddPaymentOnInvoice"); - print '
    '; + print '
    '; print ''; } @@ -247,15 +247,15 @@ if ($id > 0) if (empty($bon->date_trans) && $user->rights->prelevement->bons->send) { - print "id."\">".$langs->trans("SetToStatusSent").""; + print "id."\">".$langs->trans("SetToStatusSent").""; } if (! empty($bon->date_trans) && $bon->date_credit == 0) { - print "id."\">".$langs->trans("ClassCredited").""; + print "id."\">".$langs->trans("ClassCredited").""; } - print "id."\">".$langs->trans("Delete").""; + print "id."\">".$langs->trans("Delete").""; print "
    "; } diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 25065b24590..e4fa1e05d29 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1,8 +1,9 @@ * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2010-2015 Juanjo Menent * Copyright (C) 2010-2014 Laurent Destailleur + * Copyright (C) 2014 Ferran Marcet * * 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 @@ -55,6 +56,8 @@ class BonPrelevement extends CommonObject var $statut; // 0-Wait, 1-Trans, 2-Done var $labelstatut=array(); + var $invoice_in_error=array(); + /** * Constructor @@ -164,7 +167,7 @@ class BonPrelevement extends CommonObject /** * Add line to withdrawal * - * @param int &$line_id id line to add + * @param int $line_id id line to add * @param int $client_id id invoice customer * @param string $client_nom name of cliente * @param int $amount amount of invoice @@ -733,8 +736,8 @@ class BonPrelevement extends CommonObject function Create($banque=0, $agence=0, $mode='real') { global $conf,$langs; - - dol_syslog(get_class($this)."::Create banque=$banque agence=$agence"); + + dol_syslog(__METHOD__."::Bank=".$banque." Office=".$agence, LOG_DEBUG); require_once (DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); require_once (DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); @@ -754,13 +757,15 @@ class BonPrelevement extends CommonObject $factures = array(); $factures_prev = array(); $factures_result = array(); + $factures_prev_id=array(); + $factures_errors=array(); if (! $error) { $sql = "SELECT f.rowid, pfd.rowid as pfdrowid, f.fk_soc"; $sql.= ", pfd.code_banque, pfd.code_guichet, pfd.number, pfd.cle_rib"; $sql.= ", pfd.amount"; - $sql.= ", s.nom"; + $sql.= ", s.nom as name"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; @@ -776,7 +781,8 @@ class BonPrelevement extends CommonObject //if ($banque) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'"; //if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'"; - dol_syslog(get_class($this)."::Create", LOG_DEBUG); + dol_syslog(__METHOD__."::Read invoices, sql=".$sql, LOG_DEBUG); + $resql = $this->db->query($sql); if ($resql) { @@ -790,13 +796,12 @@ class BonPrelevement extends CommonObject $i++; } $this->db->free($resql); - dol_syslog($i." invoices to withdraw"); + dol_syslog(__METHOD__."::Read invoices, ".$i." invoices to withdraw", LOG_DEBUG); } else { - $error = 1; - dol_syslog("Erreur -1"); - dol_syslog($this->db->error()); + $error++; + dol_syslog(__METHOD__."::Read invoices error ".$this->db->error(), LOG_ERR); } } @@ -807,7 +812,7 @@ class BonPrelevement extends CommonObject // Check RIB $i = 0; - dol_syslog("Start RIB check"); + dol_syslog(__METHOD__."::Check RIB", LOG_DEBUG); if (count($factures) > 0) { @@ -820,7 +825,9 @@ class BonPrelevement extends CommonObject { $bac = new CompanyBankAccount($this->db); $bac->fetch(0,$soc->id); + if ($bac->verif() >= 1) + //if (true) { $factures_prev[$i] = $fac; /* second tableau necessaire pour BonPrelevement */ @@ -829,24 +836,24 @@ class BonPrelevement extends CommonObject } else { - dol_syslog("Error on default bank number RIB/IBAN for thirdparty reported by verif() ".$fact->socid." ".$soc->nom, LOG_ERR); - $facture_errors[$fac[0]]="Error on default bank number RIB/IBAN for thirdparty reported by function verif() ".$fact->socid." ".$soc->nom; + dol_syslog(__METHOD__."::Check RIB Error on default bank number RIB/IBAN for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_ERR); + $this->invoice_in_error[$fac[0]]="Error on default bank number RIB/IBAN for invoice ".$fact->getNomUrl(0)." for thirdparty (reported by function verif) ".$soc->name; } } else { - dol_syslog("Failed to read company", LOG_ERR); + dol_syslog(__METHOD__."::Check RIB Failed to read company", LOG_ERR); } } else { - dol_syslog("Failed to read invoice", LOG_ERR); + dol_syslog(__METHOD__."::Check RIB Failed to read invoice", LOG_ERR); } } } else { - dol_syslog("No invoice to process"); + dol_syslog(__METHOD__."::Check RIB No invoice to process", LOG_ERR); } } @@ -886,58 +893,61 @@ class BonPrelevement extends CommonObject */ if (!$error) { - $ref = "T".substr($year,-2).$month; + $ref = substr($year,-2).$month; + + $sql = "SELECT substring(ref from char_length(ref) - 1)"; + $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons"; + $sql.= " WHERE ref LIKE '%".$ref."%'"; + $sql.= " AND entity = ".$conf->entity; + $sql.= " ORDER BY ref DESC LIMIT 1"; + + dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG); + dol_syslog(__METHOD__."::Treatments", LOG_DEBUG); + $resql = $this->db->query($sql); - $sql = "SELECT count(*)"; - $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons"; - $sql.= " WHERE ref LIKE '".$ref."%'"; - $sql.= " AND entity = ".$conf->entity; + if ($resql) + { + $row = $this->db->fetch_row($resql); + $ref = "T".$ref.str_pad(dol_substr("00".intval($row[0])+1),2,"0",STR_PAD_LEFT); + + $filebonprev = $ref; + + // Create withdraw receipt in database + $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons ("; + $sql.= " ref, entity, datec"; + $sql.= ") VALUES ("; + $sql.= "'".$this->db->escape($ref)."'"; + $sql.= ", ".$conf->entity; + $sql.= ", '".$this->db->idate($now)."'"; + $sql.= ")"; + + dol_syslog(__METHOD__, LOG_DEBUG); + $resql = $this->db->query($sql); + + if ($resql) + { + $prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons"); + + $dir=$conf->prelevement->dir_output.'/receipts'; + $file=$filebonprev; + if (! is_dir($dir)) dol_mkdir($dir); + + $bonprev = new BonPrelevement($this->db, $dir."/".$file); + $bonprev->id = $prev_id; + } + else + { + $error++; + dol_syslog(__METHOD__."::Create withdraw receipt ".$this->db->error(), LOG_ERR); + } + } + else + { + $error++; + dol_syslog(__METHOD__."::Get last withdraw receipt ".$this->db->error(), LOG_ERR); + } - dol_syslog(get_class($this)."::Create", LOG_DEBUG); - $resql = $this->db->query($sql); - - if ($resql) - { - $row = $this->db->fetch_row($resql); - } - else - { - $error++; - dol_syslog("Erreur recherche reference"); - } - - $ref = $ref . substr("00".($row[0]+1), -2); - - $filebonprev = $ref; - - // Create withdraw receipt in database - $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons ("; - $sql.= " ref, entity, datec"; - $sql.= ") VALUES ("; - $sql.= "'".$this->db->escape($ref)."'"; - $sql.= ", ".$conf->entity; - $sql.= ", '".$this->db->idate($now)."'"; - $sql.= ")"; - - dol_syslog(get_class($this)."::Create", LOG_DEBUG); - $resql = $this->db->query($sql); - - if ($resql) - { - $prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons"); - - $dir=$conf->prelevement->dir_output.'/receipts'; - $file=$filebonprev; - if (! is_dir($dir)) dol_mkdir($dir); - - $bonprev = new BonPrelevement($this->db, $dir."/".$file); - $bonprev->id = $prev_id; - } - else - { - $error++; - dol_syslog("Erreur creation du bon de prelevement"); - } + } /* @@ -980,13 +990,12 @@ class BonPrelevement extends CommonObject $sql.= ", fk_prelevement_bons = ".$prev_id; $sql.= " WHERE rowid = ".$fac[1]; - dol_syslog(get_class($this)."::Create", LOG_DEBUG); + dol_syslog(__METHOD__."::Update Orders::Sql=".$sql, LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; - dol_syslog("Erreur mise a jour des demandes"); - dol_syslog($this->db->error()); + dol_syslog(__METHOD__."::Update Orders::Error=".$this->db->error(), LOG_ERR); } } @@ -1001,8 +1010,8 @@ class BonPrelevement extends CommonObject * Withdraw receipt */ - dol_syslog("Debut prelevement - Nombre de factures ".count($factures_prev)); - + dol_syslog(__METHOD__."::Init withdraw receipt for ".count($factures_prev)." invoices", LOG_DEBUG); + if (count($factures_prev) > 0) { $bonprev->date_echeance = $datetimeprev; @@ -1024,8 +1033,7 @@ class BonPrelevement extends CommonObject //Build file $bonprev->generate(); } - dol_syslog($filebonprev); - dol_syslog("Fin prelevement"); + dol_syslog(__METHOD__."::End withdraw receipt, file ".$filebonprev, LOG_DEBUG); } /* @@ -1037,12 +1045,14 @@ class BonPrelevement extends CommonObject $sql.= " WHERE rowid = ".$prev_id; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::Create", LOG_DEBUG); + dol_syslog(__METHOD__."::Update total, sql=".$sql, LOG_DEBUG); + $resql=$this->db->query($sql); if (! $resql) { $error++; dol_syslog("Erreur mise a jour du total - $sql"); + dol_syslog(__METHOD__."::Error update total: ".$this->db->error(), LOG_ERR); } /* @@ -1055,7 +1065,6 @@ class BonPrelevement extends CommonObject else { $this->db->rollback(); - dol_syslog("Error",LOG_ERR); } return count($factures_prev); @@ -1118,16 +1127,16 @@ class BonPrelevement extends CommonObject $result=''; - $lien = ''; + $lien = ''; $lienfin=''; if ($option == 'xxx') { - $lien = ''; + $lien = ''; $lienfin=''; } - if ($withpicto) $result.=($lien.img_object($langs->trans("ShowWithdraw"),'payment').$lienfin.' '); + if ($withpicto) $result.=($lien.img_object($langs->trans("ShowWithdraw"), 'payment', 'class="classfortooltip"').$lienfin.' '); $result.=$lien.$this->ref.$lienfin; return $result; } @@ -1225,26 +1234,24 @@ class BonPrelevement extends CommonObject * @return int 0 if OK, <0 if KO */ //TODO: Optimize code to read lines in a single function - function Generate() + function generate() { global $conf,$langs,$mysoc; $result = 0; - dol_syslog(get_class($this)."::Generate build file ".$this->filename); + dol_syslog(get_class($this)."::generate build file ".$this->filename); $this->file = fopen($this->filename,"w"); $found=0; // Build file for European countries - if (! $mysoc->isInEEC()) + if ($mysoc->isInEEC()) { $found++; /** - * SECTION CREATION FICHIER SEPA - * SECTION CREATION FICHIER SEPA * SECTION CREATION FICHIER SEPA */ // SEPA Initialisation @@ -1262,7 +1269,7 @@ class BonPrelevement extends CommonObject * section Debiteur (sepa Debiteurs bloc lines) */ $sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, soc.datec, c.code as country_code,"; - $sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,"; + $sql.= " pl.client_nom as name, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,"; $sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum"; $sql.= " FROM"; $sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; @@ -1286,7 +1293,7 @@ class BonPrelevement extends CommonObject while ($i < $num) { $obj = $this->db->fetch_object($resql); - $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->facnumber, $obj->idfac, $obj->iban, $obj->bic, $obj->datec, $obj->drum); + $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->name, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->facnumber, $obj->idfac, $obj->iban, $obj->bic, $obj->datec, $obj->drum); $this->total = $this->total + $obj->somme; $i++; } @@ -1307,8 +1314,6 @@ class BonPrelevement extends CommonObject } /** - * SECTION CREATION FICHIER SEPA - * SECTION CREATION FICHIER SEPA * SECTION CREATION FICHIER SEPA */ // SEPA File Header @@ -1342,7 +1347,7 @@ class BonPrelevement extends CommonObject fputs($this->file, ' '.$CrLf); fputs($this->file, ''.$CrLf); - $sql = "SELECT pl.amount"; + /*$sql = "SELECT pl.amount"; $sql.= " FROM"; $sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; $sql.= " ".MAIN_DB_PREFIX."facture as f,"; @@ -1368,7 +1373,7 @@ class BonPrelevement extends CommonObject else { $result = -2; - } + }*/ } @@ -1400,11 +1405,14 @@ class BonPrelevement extends CommonObject } } else - { + { $result = -2; } + $langs->load('withdrawals'); - fputs($this->file, $langs->trans('WithdrawalFileNotCapable')); + + // TODO Add here code to generate a generic file + fputs($this->file, $langs->trans('WithdrawalFileNotCapable', $mysoc->country_code)); } fclose($this->file); @@ -1490,7 +1498,7 @@ class BonPrelevement extends CommonObject * Write recipient of request (customer) * * @param string $row_code_client soc.code_client as code, - * @param string $row_nom pl.client_nom AS nom, + * @param string $row_nom pl.client_nom AS name, * @param string $row_address soc.address AS adr, * @param string $row_zip soc.zip * @param string $row_town soc.town @@ -1628,7 +1636,7 @@ class BonPrelevement extends CommonObject * @param int $nombre 0 or 1 * @param float $total Total * @param string $CrLf End of line character - * @return SEPA + * @return string String with SEAP Sender */ function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n') { // SEPA INITIALISATION @@ -1810,21 +1818,21 @@ class BonPrelevement extends CommonObject if ($mode == 1) { - if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut0').' '.$langs->trans($this->labelstatut[$statut]); - if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1').' '.$langs->trans($this->labelstatut[$statut]); + if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1').' '.$langs->trans($this->labelstatut[$statut]); + if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut3').' '.$langs->trans($this->labelstatut[$statut]); if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6').' '.$langs->trans($this->labelstatut[$statut]); } if ($mode == 2) { - if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut0'); - if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1'); + if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1'); + if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut3'); if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6'); } if ($mode == 3) { - if ($statut==0) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut0'); - if ($statut==1) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut1'); + if ($statut==0) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut1'); + if ($statut==1) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut3'); if ($statut==2) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut6'); } } diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php index 9c4bf96e8b3..581fb3152af 100644 --- a/htdocs/compta/prelevement/class/ligneprelevement.class.php +++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php @@ -138,20 +138,20 @@ class LignePrelevement if ($mode == 1) { - if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); + if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut1').' '.$langs->trans($this->statuts[$statut]); if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]),'statut8').' '.$langs->trans($this->statuts[$statut]); } if ($mode == 2) { - if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0'); + if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut1'); if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut4'); if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]),'statut8'); } if ($mode == 3) { - if ($statut==0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut0'); + if ($statut==0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut1'); if ($statut==2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut4'); if ($statut==3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut8'); } diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 51f9a83ed3c..d0b467f294b 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -173,7 +173,8 @@ class RejetPrelevement } //Tag invoice as unpaid dol_syslog("RejetPrelevement::Create set_unpaid fac ".$fac->ref); - $fac->set_unpaid($fac->id, $user); + + $fac->set_unpaid($user); //TODO: Must be managed by notifications module // Send email to sender of the standing order request @@ -194,7 +195,7 @@ class RejetPrelevement } /** - * Envoi mail + * Send email to all users that has asked the withdraw request * * @param Facture $fac Invoice object * @return void @@ -244,7 +245,7 @@ class RejetPrelevement $arr_mime = array(); $arr_name = array(); $facref = $fac->ref; - $socname = $soc->nom; + $socname = $soc->name; $amount = price($fac->total_ttc); $userinfo = $this->user->getFullName($langs); diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index a3f7ca2ace8..e4cb4b65c30 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -70,6 +70,10 @@ if ($action == 'create') if ($result == 0) { $mesg='
    '.$langs->trans("NoInvoiceCouldBeWithdrawed").'
    '; + foreach($bprev->invoice_in_error as $key => $val) + { + $mesg.=$val."
    \n"; + } } } @@ -156,7 +160,7 @@ print '
    '; * Invoices waiting for withdraw */ -$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, s.nom, s.rowid as socid,"; +$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, s.nom as name, s.rowid as socid,"; $sql.= " pfd.date_demande"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f,"; $sql.= " ".MAIN_DB_PREFIX."societe as s,"; @@ -179,6 +183,7 @@ if ($resql) print ''; print ''.$langs->trans("Invoice").''; print ''.$langs->trans("ThirdParty").''; + print ''.$langs->trans("RIB").''; print ''.$langs->trans("AmountTTC").''; print ''.$langs->trans("DateRequest").''; print ''; @@ -190,16 +195,22 @@ if ($resql) { $obj = $db->fetch_object($resql); $var=!$var; - print ''; + print ''; + print ''; $invoicestatic->id=$obj->rowid; $invoicestatic->ref=$obj->facnumber; print $invoicestatic->getNomUrl(1,'withdraw'); print ''; + // Thirdparty print ''; - $thirdpartystatic->id=$obj->socid; - $thirdpartystatic->nom=$obj->nom; - print $thirdpartystatic->getNomUrl(1,'customer'); + $thirdpartystatic->fetch($obj->socid); + print $thirdpartystatic->getNomUrl(1,'card'); print ''; + // RIB + print ''; + print $thirdpartystatic->display_rib(); + print ''; + // Amount print ''; print price($obj->total_ttc,0,$langs,0,0,-1,$conf->currency); print ''; @@ -211,7 +222,7 @@ if ($resql) $i++; } } - else print ''.$langs->trans("None").''; + else print ''.$langs->trans("None").''; print ""; print "
    \n"; } diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index 4cd3098bfc3..364e073676b 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->load("banks"); $langs->load("categories"); -$langs->load("widthdrawals"); +$langs->load("withdrawals"); $langs->load("companies"); // Security check @@ -67,7 +67,7 @@ if (! $sortfield) $sortfield="f.facnumber"; */ $sql= "SELECT f.facnumber, f.rowid, f.total_ttc,"; -$sql.= " s.nom, s.rowid as socid,"; +$sql.= " s.nom as name, s.rowid as socid,"; $sql.= " pfd.date_demande as date_demande,"; $sql.= " pfd.fk_user_demande"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f,"; @@ -112,8 +112,8 @@ if ($resql) print ''; print '
    '; - print ''; - print ''; + print ''; + print ''; print ''; print ''; print '
    '; @@ -137,7 +137,7 @@ if ($resql) print ''; $thirdpartystatic->id=$obj->socid; - $thirdpartystatic->nom=$obj->nom; + $thirdpartystatic->name=$obj->name; print $thirdpartystatic->getNomUrl(1,'customer'); print ''; diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index 92cd8c4c6a9..d11fefbb6cb 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -63,17 +63,17 @@ if ($prev_id) print ''.$langs->trans("Ref").''.$bon->getNomUrl(1).''; print ''.$langs->trans("Date").''.dol_print_date($bon->datec,'day').''; print ''.$langs->trans("Amount").''.price($bon->amount).''; - + // Status print ''.$langs->trans('Status').''; print ''.$bon->getLibStatut(1).''; print ''; - + if($bon->date_trans <> 0) { $muser = new User($db); $muser->fetch($bon->user_trans); - + print ''.$langs->trans("TransData").''; print dol_print_date($bon->date_trans,'day'); print ' '.$langs->trans("By").' '.$muser->getFullName($langs).''; @@ -87,19 +87,19 @@ if ($prev_id) print dol_print_date($bon->date_credit,'day'); print ''; } - + print ''; - + print '
    '; - + print '
    '; print $langs->trans("WithdrawalFile").''; $relativepath = 'receipts/'.$bon->ref; print ''.$relativepath.''; print '
    '; - + dol_fiche_end(); - + } else { @@ -114,7 +114,7 @@ $offset = $conf->liste_limit * $page ; */ $sql = "SELECT pf.rowid"; $sql.= ",f.rowid as facid, f.facnumber as ref, f.total_ttc"; -$sql.= ", s.rowid as socid, s.nom, pl.statut"; +$sql.= ", s.rowid as socid, s.nom as name, pl.statut"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql.= ", ".MAIN_DB_PREFIX."prelevement_lignes as pl"; $sql.= ", ".MAIN_DB_PREFIX."prelevement_facture as pf"; @@ -144,9 +144,9 @@ if ($result) print"\n\n"; print ''; print ''; - print_liste_field_titre($langs->trans("Bill"),"factures.php","p.ref",'',$urladd,'class="liste_titre"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ThirdParty"),"factures.php","s.nom",'',$urladd,'class="liste_titre"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Amount"),"factures.php","f.total_ttc","",$urladd,'class="liste_titre" align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Bill"),$_SERVER["PHP_SELF"],"p.ref",'',$urladd,'class="liste_titre"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",'',$urladd,'class="liste_titre"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"f.total_ttc","",$urladd,'class="liste_titre" align="center"',$sortfield,$sortorder); print ''; $var=false; @@ -165,8 +165,8 @@ if ($result) print ''.$obj->ref."\n"; - print '\n"; + print '\n"; print '\n"; @@ -213,6 +213,7 @@ else dol_print_error($db); } -$db->close(); llxFooter(); + +$db->close(); diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index 905ab6f6bf1..161227aa121 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -62,17 +62,17 @@ if ($prev_id) print ''; print ''; print ''; - + // Status print ''; print ''; print ''; - + if($bon->date_trans <> 0) { $muser = new User($db); $muser->fetch($bon->user_trans); - + print ''; @@ -86,19 +86,19 @@ if ($prev_id) print dol_print_date($bon->date_credit,'day'); print ''; } - + print '
     
    '; - print img_object($langs->trans("ShowCompany"),"company"). ' '.stripslashes($obj->nom)."'; + print img_object($langs->trans("ShowCompany"),"company"). ' '.$obj->name."'.price($obj->total_ttc)."
    '.$langs->trans("Ref").''.$bon->getNomUrl(1).'
    '.$langs->trans("Date").''.dol_print_date($bon->datec,'day').'
    '.$langs->trans("Amount").''.price($bon->amount).'
    '.$langs->trans('Status').''.$bon->getLibStatut(1).'
    '.$langs->trans("TransData").''; print dol_print_date($bon->date_trans,'day'); print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'
    '; - + print '
    '; - + print '
    '; print $langs->trans("WithdrawalFile").''; $relativepath = 'receipts/'.$bon->ref; print ''.$relativepath.''; print '
    '; - + dol_fiche_end(); - + } else { @@ -112,7 +112,7 @@ $rej = new RejetPrelevement($db, $user); * Liste des factures */ $sql = "SELECT pl.rowid, pl.amount, pl.statut"; -$sql.= " , s.rowid as socid, s.nom"; +$sql.= " , s.rowid as socid, s.nom as name"; $sql.= " , pr.motif, pr.afacturer, pr.fk_facture"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; @@ -152,7 +152,7 @@ if ($resql) print img_picto('', 'statut'.$obj->statut).' '; print substr('000000'.$obj->rowid, -6); print ''; - print ''.stripslashes($obj->nom)."\n"; + print ''.$obj->name."\n"; print ''.price($obj->amount)."\n"; print ''.$rej->motifs[$obj->motif].''; diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index 37b6c708b96..0e9174ef034 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -106,7 +106,6 @@ if ($prev_id) /* * Stats - * */ $ligne=new LignePrelevement($db,$user); @@ -121,6 +120,8 @@ if ($prev_id) $num = $db->num_rows($resql); $i = 0; + print_fiche_titre($langs->trans("StatisticsByLineStatus"),'',''); + print"\n\n"; print ''; print ''; diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 911ffde6f99..1abc421cf46 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -96,7 +96,7 @@ print '

    '; */ $sql = "SELECT f.facnumber, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,"; $sql.= " pfd.date_demande,"; -$sql.= " s.nom, s.rowid as socid"; +$sql.= " s.nom as name, s.rowid as socid"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f,"; $sql.= " ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -137,7 +137,7 @@ if ($resql) print ''; $thirdpartystatic->id=$obj->socid; - $thirdpartystatic->nom=$obj->nom; + $thirdpartystatic->name=$obj->name; print $thirdpartystatic->getNomUrl(1,'customer'); print ''; diff --git a/htdocs/compta/prelevement/ligne.php b/htdocs/compta/prelevement/ligne.php index ebf5180eb0e..7907a55fda0 100644 --- a/htdocs/compta/prelevement/ligne.php +++ b/htdocs/compta/prelevement/ligne.php @@ -105,10 +105,13 @@ if ($action == 'confirm_rejet') } } + /* * View */ +$invoicestatic=new Facture($db); + llxHeader('',$langs->trans("StandingOrder")); $h = 0; @@ -131,12 +134,10 @@ if ($id) print ''; print ''; + print $bon->getNomUrl(1).''; print ''; print ''; - print ''; + print ''; if ($lipre->statut == 3) { @@ -190,7 +191,7 @@ if ($id) print ''; //Select yes/no - print ''; + print ''; print ''; @@ -215,7 +216,7 @@ if ($id) print '
    '.$langs->trans("WithdrawalsReceipts").''; - print ''.$lipre->bon_ref.'
    '.$langs->trans("Date").''.dol_print_date($bon->datec,'day').'
    '.$langs->trans("Amount").''.price($lipre->amount).'
    '.$langs->trans("Status").''; - - print $lipre->LibStatut($lipre->statut,1).'
    '.$langs->trans("Status").''.$lipre->LibStatut($lipre->statut,1).'
    '.$langs->trans("WithdrawalRefused").'
    '.$langs->trans("WithdrawalRefusedConfirm").' '.$soc->nom.' ?
    '.$langs->trans("WithdrawalRefusedConfirm").' '.$soc->name.' ?'; print $form->selectyesno("confirm",1,0); print '

    '; //Confirm Button - print '
    '; + print '
    '; print ''; } @@ -229,13 +230,20 @@ if ($id) if ($action == '') { - if ($bon->statut == 2 && $lipre->statut == 2 && $user->rights->prelevement->bons->credit) + if ($bon->statut == 2 && $lipre->statut == 2) { - print "id\">".$langs->trans("StandingOrderReject").""; + if ($user->rights->prelevement->bons->credit) + { + print "id\">".$langs->trans("StandingOrderReject").""; + } + else + { + print "trans("NotAllowed")."\">".$langs->trans("StandingOrderReject").""; + } } else { - print "".$langs->trans("StandingOrderReject").""; + print "trans("NotPossibleForThisStatusOfWithdrawReceiptORLine")."\">".$langs->trans("StandingOrderReject").""; } } @@ -256,8 +264,8 @@ if ($id) * Liste des factures */ $sql = "SELECT pf.rowid"; - $sql.= " ,f.rowid as facid, f.facnumber as ref, f.total_ttc"; - $sql.= " , s.rowid as socid, s.nom"; + $sql.= " ,f.rowid as facid, f.facnumber as ref, f.total_ttc, f.paye, f.fk_statut"; + $sql.= " , s.rowid as socid, s.nom as name"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; $sql.= " , ".MAIN_DB_PREFIX."prelevement_facture as pf"; @@ -287,7 +295,7 @@ if ($id) print"\n\n"; print ''; print ''; - print ''; + print ''; print ''; $var=True; @@ -307,11 +315,16 @@ if ($id) print ''.$obj->ref."\n"; - print '\n"; + print '\n"; print '\n"; + print '\n"; + print "\n"; $i++; diff --git a/htdocs/compta/prelevement/lignes.php b/htdocs/compta/prelevement/lignes.php index d7dac30b3af..c4724824f36 100644 --- a/htdocs/compta/prelevement/lignes.php +++ b/htdocs/compta/prelevement/lignes.php @@ -106,7 +106,7 @@ if ($prev_id) print '
    '.$langs->trans("Invoice").''.$langs->trans("ThirdParty").''.$langs->trans("Amount").''.$langs->trans("Invoice").''.$langs->trans("ThirdParty").''.$langs->trans("Amount").''.$langs->trans("Status").'
    '; - print img_object($langs->trans("ShowCompany"),"company"). ' '.stripslashes($obj->nom)."'; + print img_object($langs->trans("ShowCompany"),"company"). ' '.$obj->name."'.price($obj->total_ttc)."'; + $invoicestatic->fetch($obj->facid); + print $invoicestatic->getLibStatut(5); + print "
    '; dol_fiche_end(); - + } else { @@ -124,11 +124,9 @@ $pagenext = $page + 1; /* * Liste des lignes de prelevement - * - * */ $sql = "SELECT pl.rowid, pl.statut, pl.amount"; -$sql.= ", s.rowid as socid, s.nom"; +$sql.= ", s.rowid as socid, s.nom as name"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl"; $sql.= ", ".MAIN_DB_PREFIX."prelevement_bons as pb"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; @@ -149,13 +147,13 @@ if ($result) $urladd = "&id=".$prev_id; - print_barre_liste("", $page, "lignes.php", $urladd, $sortfield, $sortorder, '', $num); + print_barre_liste("", $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num); print"\n\n"; print ''; print ''; - print_liste_field_titre($langs->trans("Lines"),"lignes.php","pl.rowid",'',$urladd); - print_liste_field_titre($langs->trans("ThirdParty"),"lignes.php","s.nom",'',$urladd); - print_liste_field_titre($langs->trans("Amount"),"lignes.php","pl.amount","",$urladd,'align="center"'); + print_liste_field_titre($langs->trans("Lines"),$_SERVER["PHP_SELF"],"pl.rowid",'',$urladd); + print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",'',$urladd); + print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"pl.amount","",$urladd,'align="center"'); print ''; $var=false; @@ -175,7 +173,11 @@ if ($result) print substr('000000'.$obj->rowid, -6); print ''; - print '\n"; + $thirdparty=new Societe($db); + $thirdparty->fetch($obj->socid); + print '\n"; print '\n"; diff --git a/htdocs/compta/prelevement/liste.php b/htdocs/compta/prelevement/list.php similarity index 76% rename from htdocs/compta/prelevement/liste.php rename to htdocs/compta/prelevement/list.php index a9fb6024992..921736faedf 100644 --- a/htdocs/compta/prelevement/liste.php +++ b/htdocs/compta/prelevement/list.php @@ -19,7 +19,7 @@ */ /** - * \file htdocs/compta/prelevement/liste.php + * \file htdocs/compta/prelevement/list.php * \ingroup prelevement * \brief Page liste des prelevements */ @@ -42,10 +42,10 @@ $result = restrictedArea($user, 'prelevement','','','bons'); $page = GETPOST('page','int'); $sortorder = ((GETPOST('sortorder','alpha')=="")) ? "DESC" : GETPOST('sortorder','alpha'); $sortfield = ((GETPOST('sortfield','alpha')=="")) ? "p.datec" : GETPOST('sortfield','alpha'); -$search_line = GETPOST('search_ligne','alpha'); +$search_line = GETPOST('search_line','alpha'); $search_bon = GETPOST('search_bon','alpha'); $search_code = GETPOST('search_code','alpha'); -$search_societe = GETPOST('search_societe','alpha'); +$search_company = GETPOST('search_company','alpha'); $statut = GETPOST('statut','int'); $bon=new BonPrelevement($db,""); @@ -53,7 +53,14 @@ $ligne=new LignePrelevement($db,$user); $offset = $conf->liste_limit * $page ; - +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_line=""; + $search_bon=""; + $search_code=""; + $search_company=""; + $statut=""; +} /* * View @@ -63,7 +70,7 @@ llxHeader('',$langs->trans("WithdrawalsLines")); $sql = "SELECT p.rowid, p.ref, p.statut, p.datec"; $sql.= " ,f.rowid as facid, f.facnumber, f.total_ttc"; -$sql.= " , s.rowid as socid, s.nom, s.code_client"; +$sql.= " , s.rowid as socid, s.nom as name, s.code_client"; $sql.= " , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; @@ -88,9 +95,9 @@ if ($search_code) { $sql.= " AND s.code_client LIKE '%".$db->escape($search_code)."%'"; } -if ($search_societe) +if ($search_company) { - $sql .= " AND s.nom LIKE '%".$db->escape($search_societe)."%'"; + $sql .= " AND s.nom LIKE '%".$db->escape($search_company)."%'"; } $sql.=$db->order($sortfield,$sortorder); $sql.=$db->plimit($conf->liste_limit+1, $offset); @@ -120,17 +127,19 @@ if ($result) print ''; print ''; - print ''; + print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; - print ''; - print ''; + print ''; print ''; $var=True; @@ -155,16 +164,16 @@ if ($result) print $bon->LibStatut($obj->statut,2); print " "; - print ''.$obj->ref."\n"; + print ''.$obj->ref."\n"; print '\n"; print ''; - print '\n"; + print '\n"; - print '\n"; + print '\n"; print '\n"; diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php index 30b36a59775..0582e4f4091 100644 --- a/htdocs/compta/prelevement/rejets.php +++ b/htdocs/compta/prelevement/rejets.php @@ -85,13 +85,13 @@ if ($result) $num = $db->num_rows($result); $i = 0; - print_barre_liste($langs->trans("WithdrawsRefused"), $page, "rejets.php", $urladd, $sortfield, $sortorder, '', $num); + print_barre_liste($langs->trans("WithdrawsRefused"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num); print"\n\n"; print '
     
    '.stripslashes($obj->nom)."'; + print $thirdparty->getNomUrl(1); + print "'.price($obj->amount)." 
       
    '; + print ''; + print ''; + print ''; print img_object($langs->trans("ShowBill"),"bill"); print ' '.$obj->facnumber."'.$obj->nom."'.$obj->name."'.$obj->code_client."'.$obj->code_client."'.dol_print_date($db->jdate($obj->datec),'day')."
    '; print ''; - print_liste_field_titre($langs->trans("Line"),"rejets.php","p.ref",'',$urladd); - print_liste_field_titre($langs->trans("ThirdParty"),"rejets.php","s.nom",'',$urladd); - print_liste_field_titre($langs->trans("Reason"),"rejets.php","pr.motif","",$urladd); + print_liste_field_titre($langs->trans("Line"),$_SERVER["PHP_SELF"],"p.ref",'',$urladd); + print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",'',$urladd); + print_liste_field_titre($langs->trans("Reason"),$_SERVER["PHP_SELF"],"pr.motif","",$urladd); print ''; $var=True; @@ -108,7 +108,7 @@ if ($result) print substr('000000'.$obj->rowid, -6).""; - print '\n"; + print '\n"; print ''; print "\n"; diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php index 2c8607a9a56..c3667f8b69f 100644 --- a/htdocs/compta/prelevement/stats.php +++ b/htdocs/compta/prelevement/stats.php @@ -21,7 +21,7 @@ /** * \file htdocs/compta/prelevement/stats.php * \ingroup prelevement - * \brief Page de stats des prelevements + * \brief Page with statistics on withdrawals */ require('../../main.inc.php'); @@ -96,7 +96,7 @@ if ($resql) print ''; print ''; - $var=True; + $var=false; while ($i < $num) { diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index 42f91e3132b..59599e93dc6 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -64,8 +64,8 @@ if ($socid > 0) print '
    '.stripslashes($obj->nom)."'.stripslashes($obj->nom)."'.$rej->motifs[$obj->motif].'
    '.$langs->trans("Status").''.$langs->trans("Number").'%'.$langs->trans("Amount").'%
    '; - // Nom - print ''; + // Name + print ''; // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field @@ -181,7 +181,7 @@ if ($socid > 0) print '\n"; print ''; + print ''.img_object($langs->trans("ShowPayment"),"payment").' '.$langs->trans("Payment").' '.$objp->rowid.''; print "\n"; print "\n"; print ''; diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index d55930ef80f..9122ece2ed9 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -99,7 +99,7 @@ else } // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') -$modecompta=(GETPOST("modecompta")?GETPOST("modecompta"):$conf->global->COMPTA_MODE); +$modecompta=(GETPOST("modecompta")?GETPOST("modecompta"):$conf->global->ACCOUNTING_MODE); /* @@ -120,7 +120,7 @@ $total_ttc=0; // Affiche en-tete de rapport if ($modecompta=="CREANCES-DETTES") { - $nom=$langs->trans("AnnualByCompaniesDueDebtMode"); + $name=$langs->trans("AnnualByCompaniesDueDebtMode"); $calcmode=$langs->trans("CalcModeDebt"); $calcmode.='
    ('.$langs->trans("SeeReportInInputOutputMode",'
    ','').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); @@ -132,7 +132,7 @@ if ($modecompta=="CREANCES-DETTES") //$exportlink=$langs->trans("NotYetAvailable"); } else { - $nom=$langs->trans("AnnualByCompaniesInputOutputMode"); + $name=$langs->trans("AnnualByCompaniesInputOutputMode"); $calcmode=$langs->trans("CalcModeEngagement"); $calcmode.='
    ('.$langs->trans("SeeReportInDueDebtMode",'','').')'; //$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',1,1,0,'',1,0,1); @@ -142,7 +142,7 @@ else { $builddate=time(); //$exportlink=$langs->trans("NotYetAvailable"); } -report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode); +report_header($name,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode); // Show report array print '
    '.$langs->trans("Name").''.$societe->nom.'
    '.$langs->trans("Name").''.$societe->name.'
    '.dol_print_date($db->jdate($objp->dp),'day')."'; print '      '; // Decalage - print ''.img_object($langs->trans("ShowPayment"),"payment").' '.$langs->trans("Payment").' '.$objp->rowid.'  '.price($objp->amount).'
    '; @@ -160,7 +160,7 @@ print ''; if ($modecompta == 'CREANCES-DETTES') { - $sql = "SELECT s.nom, s.rowid as socid, sum(f.total) as amount_ht, sum(f.total_ttc) as amount_ttc"; + $sql = "SELECT s.nom as name, s.rowid as socid, sum(f.total) as amount_ht, sum(f.total_ttc) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; $sql.= " WHERE f.fk_soc = s.rowid"; @@ -178,7 +178,7 @@ else * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les * vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin) */ - $sql = "SELECT s.nom as nom, s.rowid as socid, sum(pf.amount) as amount_ttc"; + $sql = "SELECT s.nom as name, s.rowid as socid, sum(pf.amount) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf"; @@ -206,7 +206,7 @@ if ($result) { $var=!$var; print ""; - print "\n"; + print "\n"; if ($modecompta == 'CREANCES-DETTES') print "\n"; @@ -225,7 +225,7 @@ if ($result) { // On ajoute les paiements clients anciennes version, non lie par paiement_facture if ($modecompta != 'CREANCES-DETTES') { - $sql = "SELECT 'Autres' as nom, '0' as idp, sum(p.amount) as amount_ttc"; + $sql = "SELECT 'Autres' as name, '0' as idp, sum(p.amount) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= ", ".MAIN_DB_PREFIX."paiement as p"; @@ -236,8 +236,8 @@ if ($modecompta != 'CREANCES-DETTES') $sql.= " AND ba.entity = ".$conf->entity; if (! empty($date_start) && ! empty($date_end)) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; - $sql.= " GROUP BY nom, idp"; - $sql.= " ORDER BY nom"; + $sql.= " GROUP BY name, idp"; + $sql.= " ORDER BY name"; dol_syslog("get old customer payments not linked to invoices", LOG_DEBUG); $result = $db->query($sql); @@ -290,7 +290,7 @@ print ''; */ if ($modecompta == 'CREANCES-DETTES') { - $sql = "SELECT s.nom, s.rowid as socid, sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc"; + $sql = "SELECT s.nom as name, s.rowid as socid, sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f"; $sql.= " WHERE f.fk_soc = s.rowid"; @@ -338,7 +338,7 @@ if ($result) { $var=!$var; print ""; - print "\n"; + print "\n"; if ($modecompta == 'CREANCES-DETTES') print "\n"; @@ -381,7 +381,7 @@ print '"; - print ''; + print ''; if ($modecompta == 'CREANCES-DETTES') print ''; print ''; print ''; @@ -455,7 +455,7 @@ print '"; - print ''; + print ''; if ($modecompta == 'CREANCES-DETTES') print ''; print ''; @@ -547,123 +547,135 @@ if ($mysoc->tva_assuj == 'franchise') // Non assujeti * Salaries */ -print ''; -$sql = "SELECT u.rowid, u.firstname, u.lastname, p.fk_user, p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount"; -$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; -$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user"; -$sql.= " WHERE p.entity = ".$conf->entity; -if (! empty($date_start) && ! empty($date_end)) - $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; - -$sql.= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm"; -$sql.= " ORDER BY u.firstname"; - -dol_syslog("get payment salaries"); -$result=$db->query($sql); -$subtotal_ht = 0; -$subtotal_ttc = 0; -if ($result) +if ($conf->salaries->enabled) { - $num = $db->num_rows($result); - $var=true; - $i = 0; - if ($num) - { - while ($i < $num) - { - $obj = $db->fetch_object($result); + print ''; + $sql = "SELECT u.rowid, u.firstname, u.lastname, p.fk_user, p.label as label, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount"; + $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; + $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user"; + $sql.= " WHERE p.entity = ".$conf->entity; + if (! empty($date_start) && ! empty($date_end)) + $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; - $total_ht -= $obj->amount; - $total_ttc -= $obj->amount; - $subtotal_ht += $obj->amount; - $subtotal_ttc += $obj->amount; + $sql.= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm"; + $sql.= " ORDER BY u.firstname"; - $var = !$var; - print ""; + dol_syslog("get payment salaries"); + $result=$db->query($sql); + $subtotal_ht = 0; + $subtotal_ttc = 0; + if ($result) + { + $num = $db->num_rows($result); + $var=true; + $i = 0; + if ($num) + { + while ($i < $num) + { + $obj = $db->fetch_object($result); - print "\n"; + $total_ht -= $obj->amount; + $total_ttc -= $obj->amount; + $subtotal_ht += $obj->amount; + $subtotal_ttc += $obj->amount; - if ($modecompta == 'CREANCES-DETTES') print ''; - print ''; - print ''; - $i++; - } - } - else - { - $var = !$var; - print ""; - print ''; - print ''; - } -} -else -{ - dol_print_error($db); + $var = !$var; + print ""; + + print "\n"; + + if ($modecompta == 'CREANCES-DETTES') print ''; + print ''; + print ''; + $i++; + } + } + else + { + $var = !$var; + print ""; + print ''; + print ''; + } + } + else + { + dol_print_error($db); + } + print ''; + if ($modecompta == 'CREANCES-DETTES') + print ''; + print ''; + print ''; } + /* - * Dunning -*/ + * Donation + */ -print ''; -$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; -$sql.= " FROM ".MAIN_DB_PREFIX."don as p"; -$sql.= " WHERE p.entity = ".$conf->entity; -$sql.= " AND fk_statut=2"; -if (! empty($date_start) && ! empty($date_end)) - $sql.= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'"; -$sql.= " GROUP BY p.societe, p.firstname, p.lastname"; -$sql.= " ORDER BY p.societe, p.firstname, p.lastname"; - -dol_syslog("get dunning"); -$result=$db->query($sql); -$subtotal_ht = 0; -$subtotal_ttc = 0; -if ($result) +if ($conf->donation->enabled) { - $num = $db->num_rows($result); - $var=true; - $i = 0; - if ($num) + print ''; + $sql = "SELECT p.societe as name, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; + $sql.= " FROM ".MAIN_DB_PREFIX."don as p"; + $sql.= " WHERE p.entity = ".$conf->entity; + $sql.= " AND fk_statut=2"; + if (! empty($date_start) && ! empty($date_end)) + $sql.= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'"; + $sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm"; + $sql.= " ORDER BY p.societe, p.firstname, p.lastname, dm"; + + dol_syslog("get dunning"); + $result=$db->query($sql); + $subtotal_ht = 0; + $subtotal_ttc = 0; + if ($result) { - while ($i < $num) + $num = $db->num_rows($result); + $var=true; + $i = 0; + if ($num) { - $obj = $db->fetch_object($result); + while ($i < $num) + { + $obj = $db->fetch_object($result); - $total_ht += $obj->amount; - $total_ttc += $obj->amount; - $subtotal_ht -= $obj->amount; - $subtotal_ttc -= $obj->amount; + $total_ht += $obj->amount; + $total_ttc += $obj->amount; + $subtotal_ht += $obj->amount; + $subtotal_ttc += $obj->amount; + $var = !$var; + print ""; + + print "\n"; + + if ($modecompta == 'CREANCES-DETTES') print ''; + print ''; + print ''; + $i++; + } + } + else + { $var = !$var; print ""; - - print "\n"; - - if ($modecompta == 'CREANCES-DETTES') print ''; - print ''; + print ''; print ''; - $i++; } } else { - $var = !$var; - print ""; - print ''; - print ''; + dol_print_error($db); } + print ''; + if ($modecompta == 'CREANCES-DETTES') + print ''; + print ''; + print ''; } -else -{ - dol_print_error($db); -} -print ''; -if ($modecompta == 'CREANCES-DETTES') - print ''; -print ''; -print ''; /* * VAT diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 05c3a93e011..b586241c11e 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -48,7 +48,7 @@ if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accountin // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') -$modecompta=(GETPOST("modecompta")?GETPOST("modecompta"):$conf->global->COMPTA_MODE); +$modecompta=(GETPOST("modecompta")?GETPOST("modecompta"):$conf->global->ACCOUNTING_MODE); /* @@ -560,7 +560,7 @@ print ''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { - print ''; - print ''; + print ''; } print ''; @@ -601,7 +601,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) } print ""; - print ''; - print ''; + print ''; } print "\n"; @@ -637,7 +637,7 @@ $var=!$var; print ''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { - print '\n"; print ''; + // Ref + print ''; print ''; - print ''; - print ''; + // Label + print ''; print ''; // Type print ''; - print ''; - print ''; - print "\n"; + // Amount + print ''; + print '\n"; while ($i < min($num,$limit)) { diff --git a/htdocs/compta/sociales/charges.php b/htdocs/compta/sociales/charges.php index bce22caaed6..afe2c27a3be 100644 --- a/htdocs/compta/sociales/charges.php +++ b/htdocs/compta/sociales/charges.php @@ -149,6 +149,57 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr } } + // Action clone object +if ($action == 'confirm_clone' && $confirm != 'yes') { $action=''; } +if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->charges->creer)) +{ + $db->begin(); + + $originalId = $id; + + $object = new ChargeSociales($db); + $object->fetch($id); + + if ($object->id > 0) + { + $object->paye = 0; + $object->id = $object->ref = null; + + if(GETPOST('clone_for_next_month') != '') { + + $object->date_ech = strtotime('+1month', $object->date_ech); + $object->periode = strtotime('+1month', $object->periode); + } + + if ($object->check()) + { + $id = $object->create($user); + if ($id > 0) + { + $db->commit(); + $db->close(); + + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); + exit; + } + else + { + $id=$originalId; + $db->rollback(); + + setEventMessages($object->error,$object->errors, 'errors'); + } + } + } + else + { + $db->rollback(); + dol_print_error($db,$object->error); + } +} + + + /* @@ -240,6 +291,17 @@ if ($id > 0) dol_fiche_head($head, 'card', $langs->trans("SocialContribution"),0,'bill'); + // Clone confirmation + if ($action === 'clone') + { + $formclone=array( + array('type' => 'checkbox', 'name' => 'clone_for_next_month','label' => $langs->trans("CloneTaxForNextMonth"), 'value' => 1), + + ); + + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneTax'),$langs->trans('ConfirmCloneTax',$object->ref),'confirm_clone',$formclone,'yes'); + } + // Confirmation de la suppression de la charge if ($action == 'paid') { @@ -288,7 +350,7 @@ if ($id > 0) * Payments */ $sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,"; - $sql.= "c.libelle as paiement_type"; + $sql.= "c.code as type_code,c.libelle as paiement_type"; $sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p"; $sql.= ", ".MAIN_DB_PREFIX."c_paiement as c "; $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; @@ -319,10 +381,11 @@ if ($id > 0) $objp = $db->fetch_object($resql); $var=!$var; print "'; + print ''.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.''; print '\n"; - print "\n"; - print '\n"; + $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type; + print "\n"; + print '\n"; print ""; $totalpaye += $objp->amount; $i++; @@ -420,6 +483,12 @@ if ($id > 0) print "id&action=paid\">".$langs->trans("ClassifyPaid").""; } + // Clone + if ($user->rights->tax->charges->creer) + { + print "id&action=clone\">".$langs->trans("ToClone").""; + } + // Delete if ($user->rights->tax->charges->supprimer) { diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 09e4ebaef0c..4e7211c75b1 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -34,6 +34,11 @@ class ChargeSociales extends CommonObject public $table='chargesociales'; public $table_element='chargesociales'; + /** + * {@inheritdoc} + */ + protected $table_ref_field = 'ref'; + var $id; var $ref; var $date_ech; @@ -62,17 +67,19 @@ class ChargeSociales extends CommonObject /** * Retrouve et charge une charge sociale * - * @param int $id 1 si trouve, 0 sinon + * @param int $id Id + * @param string $ref Ref * @return void */ - function fetch($id) + function fetch($id, $ref='') { $sql = "SELECT cs.rowid, cs.date_ech,"; $sql.= " cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, cs.periode,"; $sql.= " c.libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs, ".MAIN_DB_PREFIX."c_chargesociales as c"; $sql.= " WHERE cs.fk_type = c.id"; - $sql.= " AND cs.rowid = ".$id; + if ($ref) $sql.= " AND cs.rowid = ".$ref; + else $sql.= " AND cs.rowid = ".$id; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); @@ -107,6 +114,24 @@ class ChargeSociales extends CommonObject } } + /** + * Check if a social contribution can be created into database + * + * @return boolean True or false + */ + function check() + { + $newamount=price2num($this->amount,'MT'); + + // Validation parametres + if (! $newamount > 0 || empty($this->date_ech) || empty($this->periode)) + { + return false; + } + + + return true; + } /** * Create a social contribution into database @@ -121,12 +146,12 @@ class ChargeSociales extends CommonObject // Nettoyage parametres $newamount=price2num($this->amount,'MT'); - // Validation parametres - if (! $newamount > 0 || empty($this->date_ech) || empty($this->periode)) - { - $this->error="ErrorBadParameter"; - return -2; - } + if (!$this->check()) + { + $this->error="ErrorBadParameter"; + return -2; + } + $this->db->begin(); @@ -341,7 +366,7 @@ class ChargeSociales extends CommonObject global $langs; $langs->load('customers'); $langs->load('bills'); - + if ($mode == 0) { if ($statut == 0) return $langs->trans("Unpaid"); @@ -399,7 +424,7 @@ class ChargeSociales extends CommonObject $lien = ''; $lienfin=''; - if ($withpicto) $result.=($lien.img_object($langs->trans("ShowSocialContribution").': '.$this->lib,'bill').$lienfin.' '); + if ($withpicto) $result.=($lien.img_object($langs->trans("ShowSocialContribution").': '.$this->lib, 'bill', 'class="classfortooltip"').$lienfin.' '); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$lien.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$lienfin; return $result; diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 972fa762b96..a94afc98f6e 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -220,7 +220,7 @@ class PaymentSocialContribution extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; $error=0; @@ -506,7 +506,7 @@ class PaymentSocialContribution extends CommonObject // Add link 'payment', 'payment_supplier', 'payment_sc' in bank_url between payment and bank transaction $url=''; - if ($mode == 'payment_sc') $url=DOL_URL_ROOT.'/compta/payment_sc/fiche.php?id='; + if ($mode == 'payment_sc') $url=DOL_URL_ROOT.'/compta/payment_sc/card.php?id='; if ($url) { $result=$acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode); @@ -588,10 +588,10 @@ class PaymentSocialContribution extends CommonObject if (!empty($this->id)) { - $lien = ''; + $lien = ''; $lienfin=''; - if ($withpicto) $result.=($lien.img_object($langs->trans("ShowPayment").': '.$this->ref,'payment').$lienfin.' '); + if ($withpicto) $result.=($lien.img_object($langs->trans("ShowPayment").': '.$this->ref, 'payment', 'class="classfortooltip"').$lienfin.' '); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$lien.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$lienfin; } diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index 022aaf14ff0..31e98370003 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -36,6 +36,9 @@ $socid = isset($_GET["socid"])?$_GET["socid"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'tax', '', '', 'charges'); +$search_ref = GETPOST('search_ref','int'); +$search_label = GETPOST('search_label','alpha'); +$search_amount = GETPOST('search_amount','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); @@ -65,6 +68,15 @@ else $typeid=$_REQUEST['typeid']; } +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_ref=""; + $search_label=""; + $search_amount=""; + $typeid=""; + $year=""; + $month=""; +} /* * View @@ -85,7 +97,11 @@ $sql.= " ".MAIN_DB_PREFIX."chargesociales as cs"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid"; $sql.= " WHERE cs.fk_type = c.id"; $sql.= " AND cs.entity = ".$conf->entity; -if (GETPOST("search_label")) $sql.=" AND cs.libelle LIKE '%".$db->escape(GETPOST("search_label"))."%'"; + +// Search criteria +if ($search_ref) $sql.=" AND cs.rowid=".$search_ref; +if ($search_label) $sql.=" AND cs.libelle LIKE '%".$db->escape($search_label)."%'"; +if ($search_amount) $sql.=" AND cs.amount='".$db->escape(price2num(trim($search_amount)))."'"; if ($year > 0) { $sql .= " AND ("; @@ -139,10 +155,8 @@ if ($resql) { print ''; - - print "
    '.$langs->trans("CustomersInvoices").'
     ".$langs->trans("Bills").' '.$objp->nom."".$langs->trans("Bills").' '.$objp->name."".price($objp->amount_ht)."
     ".$langs->trans("Bills")." socid."\">".$objp->nom."".$langs->trans("Bills")." socid."\">".$objp->name."".price(-$objp->amount_ht)."
    '.$langs->trans("SocialContributions").' ('.$langs->t if ($modecompta == 'CREANCES-DETTES') { - $sql = "SELECT c.id, c.libelle as nom, sum(cs.amount) as amount"; + $sql = "SELECT c.id, c.libelle as label, sum(cs.amount) as amount"; $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; $sql.= " WHERE cs.fk_type = c.id"; @@ -391,7 +391,7 @@ if ($modecompta == 'CREANCES-DETTES') } else { - $sql = "SELECT c.id, c.libelle as nom, sum(p.amount) as amount"; + $sql = "SELECT c.id, c.libelle as label, sum(p.amount) as amount"; $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; $sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p"; @@ -424,7 +424,7 @@ if ($result) { $var = !$var; print "
     '.$obj->nom.''.$obj->label.''.price(-$obj->amount).''.price(-$obj->amount).'
    '.$langs->trans("SocialContributions").' ('.$langs->t if ($modecompta == 'CREANCES-DETTES') { - $sql = "SELECT c.id, c.libelle as nom, sum(cs.amount) as amount"; + $sql = "SELECT c.id, c.libelle as label, sum(cs.amount) as amount"; $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; $sql.= " WHERE cs.fk_type = c.id"; @@ -468,7 +468,7 @@ if ($modecompta == 'CREANCES-DETTES') } else { - $sql = "SELECT c.id, c.libelle as nom, sum(p.amount) as amount"; + $sql = "SELECT c.id, c.libelle as label, sum(p.amount) as amount"; $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; $sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p"; @@ -501,7 +501,7 @@ if ($result) { $var = !$var; print "
     '.$obj->nom.''.$obj->label.''.price(-$obj->amount).''.price(-$obj->amount).'
    '.$langs->trans("Salaries").'
    '.$langs->trans("Salaries").'
     ".$langs->trans("Salaries")." fk_user."\">".$obj->firstname." ".$obj->lastname."'.price(-$obj->amount).''.price(-$obj->amount).'
     '.$langs->trans("None").'
     ".$langs->trans("Salaries")." fk_user."\">".$obj->firstname." ".$obj->lastname."'.price(-$obj->amount).''.price(-$obj->amount).'
     '.$langs->trans("None").'
    '.price(-$subtotal_ht).''.price(-$subtotal_ttc).'
    '.$langs->trans("Donation").'
    '.$langs->trans("Donation").'
     ".$langs->trans("Donation")." name."&search_name=".$obj->firstname." ".$obj->lastname."\">".$obj->name. " ".$obj->firstname." ".$obj->lastname."'.price($obj->amount).''.price($obj->amount).'
     ".$langs->trans("Donation")." nom."&search_name=".$obj->firstname." ".$obj->lastname."\">".$obj->nom. " ".$obj->firstname." ".$obj->lastname."'.price($obj->amount).''.price($obj->amount).''.$langs->trans("None").'
     '.$langs->trans("None").'
    '.price($subtotal_ht).''.price($subtotal_ttc).'
    '.price(-$subtotal_ht).''.price(-$subtotal_ttc).'
     '; + print ''; print ''; print $annee; if ($conf->global->SOCIETE_FISCAL_MONTH_START > 1) print '-'.($annee+1); @@ -571,7 +571,7 @@ print '
    '.$langs->trans("Month"). for ($annee = $year_start ; $annee <= $year_end ; $annee++) { print ''.$langs->trans("Outcome").''.$langs->trans("Income").''.$langs->trans("Income").'
     '; + print ' '; //if (isset($encaiss_ttc[$case]) && $encaiss_ttc[$case] != 0) if (isset($encaiss_ttc[$case])) { @@ -623,7 +623,7 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++) { $nbcols+=2; print ''.(isset($totsorties[$annee])?price(price2num($totsorties[$annee],'MT')):' ').''.(isset($totentrees[$annee])?price(price2num($totentrees[$annee],'MT')):' ').''.(isset($totentrees[$annee])?price(price2num($totentrees[$annee],'MT')):' ').'
    '.$langs->trans("Profit").' '; + print ' '; if (isset($totentrees[$annee]) || isset($totsorties[$annee])) { $in=(isset($totentrees[$annee])?price2num($totentrees[$annee], 'MT'):0); diff --git a/htdocs/compta/salaries/fiche.php b/htdocs/compta/salaries/card.php similarity index 94% rename from htdocs/compta/salaries/fiche.php rename to htdocs/compta/salaries/card.php index c46f83dd6fb..16ef809f713 100644 --- a/htdocs/compta/salaries/fiche.php +++ b/htdocs/compta/salaries/card.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/compta/salaries/fiche.php + * \file htdocs/compta/salaries/card.php * \ingroup salaries * \brief Page of salaries payments */ @@ -44,7 +44,7 @@ $result = restrictedArea($user, 'salaries', '', '', ''); $sal = new PaymentSalary($db); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('salarycard')); +$hookmanager->initHooks(array('salarycard','globalcard')); @@ -206,7 +206,7 @@ if ($action == 'create') $datesp=dol_get_first_day($pastmonthyear,$pastmonth,false); $dateep=dol_get_last_day($pastmonthyear,$pastmonth,false); } - print "
    \n"; + print "\n"; print ''; print ''; @@ -274,8 +274,11 @@ if ($action == 'create') print "
    "; - print '
      '; - print '
    '; + print '
    '; + print ''; + print '     '; + print ''; + print '
    '; print '
    '; } @@ -290,7 +293,7 @@ if ($action == 'create') if ($id) { $h = 0; - $head[$h][0] = DOL_URL_ROOT.'/compta/salaries/fiche.php?id='.$salpayment->id; + $head[$h][0] = DOL_URL_ROOT.'/compta/salaries/card.php?id='.$salpayment->id; $head[$h][1] = $langs->trans('Card'); $head[$h][2] = 'card'; $h++; @@ -367,7 +370,7 @@ if ($id) { if (! empty($user->rights->tax->charges->supprimer)) { - print ''.$langs->trans("Delete").''; + print ''.$langs->trans("Delete").''; } else { diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php index 5e728b0cc64..635ed77541f 100644 --- a/htdocs/compta/salaries/class/paymentsalary.class.php +++ b/htdocs/compta/salaries/class/paymentsalary.class.php @@ -73,7 +73,7 @@ class PaymentSalary extends CommonObject * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; @@ -127,7 +127,7 @@ class PaymentSalary extends CommonObject { // Call trigger $result=$this->call_trigger('PAYMENT_SALARY_MODIFY',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers //FIXME: Add rollback if trigger fail @@ -144,7 +144,7 @@ class PaymentSalary extends CommonObject * @param User $user User that load * @return int <0 if KO, >0 if OK */ - function fetch($id, $user=0) + function fetch($id, $user=null) { global $langs; $sql = "SELECT"; @@ -223,12 +223,12 @@ class PaymentSalary extends CommonObject global $conf, $langs; $error=0; - + // Call trigger $result=$this->call_trigger('PAYMENT_SALARY_DELETE',$user); if ($result < 0) return -1; // End call triggers - + $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary"; $sql.= " WHERE rowid=".$this->id; @@ -279,7 +279,7 @@ class PaymentSalary extends CommonObject function create($user) { global $conf,$langs; - + $error=0; // Clean parameters @@ -395,7 +395,7 @@ class PaymentSalary extends CommonObject if (! $error) { // Add link 'payment_salary' in bank_url between payment and bank transaction - $url=DOL_URL_ROOT.'/compta/salaries/fiche.php?id='; + $url=DOL_URL_ROOT.'/compta/salaries/card.php?id='; $result=$acc->add_url_line($bank_line_id, $this->id, $url, "(SalaryPayment)", "payment_salary"); if ($result <= 0) @@ -412,9 +412,8 @@ class PaymentSalary extends CommonObject $result=$acc->add_url_line( $bank_line_id, $this->fk_user, - DOL_URL_ROOT.'/user/fiche.php?id=', + DOL_URL_ROOT.'/user/card.php?id=', $langs->trans("SalaryPayment").' '.$fuser->getFullName($langs).' '.dol_print_date($this->datesp,'dayrfc').' '.dol_print_date($this->dateep,'dayrfc'), - '(User)', 'user' ); @@ -427,9 +426,9 @@ class PaymentSalary extends CommonObject // Call trigger $result=$this->call_trigger('PAYMENT_SALARY_CREATE',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers - + } else $error++; @@ -488,13 +487,13 @@ class PaymentSalary extends CommonObject $result=''; - $lien = ''; + $lien = ''; $lienfin=''; $picto='payment'; $label=$langs->trans("ShowSalaryPayment").': '.$this->ref; - if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); + if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; return $result; diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index b2fc3e1b4a3..678b3bfaa2e 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -33,6 +33,9 @@ $socid = GETPOST("socid","int"); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'salaries', '', '', ''); +$search_ref = GETPOST('search_ref','int'); +$search_label = GETPOST('search_label','alpha'); +$search_amount = GETPOST('search_amount','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); @@ -61,6 +64,14 @@ else $typeid=$_REQUEST['typeid']; } +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_ref=""; + $search_label=""; + $search_amount=""; + $typeid=""; +} + /* * View */ @@ -78,8 +89,11 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst $sql.= " ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE u.rowid = s.fk_user"; $sql.= " AND s.entity = ".$conf->entity; -if (GETPOST("search_label")) $sql.=" AND s.label LIKE '%".$db->escape(GETPOST("search_label"))."%'"; -if (GETPOST("search_amount")) $sql.=" AND s.amount = ".price2num(GETPOST("search_amount")); + +// Search criteria +if ($search_ref) $sql.=" AND s.rowid=".$search_ref; +if ($search_label) $sql.=" AND s.label LIKE '%".$db->escape($search_label)."%'"; +if ($search_amount) $sql.=" AND s.amount='".$db->escape(price2num(trim($search_amount)))."'"; if ($filtre) { $filtre=str_replace(":","=",$filtre); $sql .= " AND ".$filtre; @@ -118,19 +132,23 @@ if ($result) print "
    '; + print ''; + print '   '; $form->select_types_paiements($typeid,'typeid','',0,0,1,16); print ''; - print ''; - print '
    '; + print ''; + print "
    "; - print ''.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp),'day')."".$objp->paiement_type.' '.$objp->num_paiement."'.price($objp->amount)." ".$langs->trans("Currency".$conf->currency)."".$labeltype.' '.$objp->num_paiement."'.price($objp->amount)." ".$langs->trans("Currency".$conf->currency)."
    "; - - print ""; + print '
    '; + print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"id","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"cs.libelle","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); @@ -153,20 +167,26 @@ if ($resql) print "\n"; print ''; - print ''; - print ''; + // Ref + print ''; + // Label + print ''; // Type print ''; // Period end date print ''; - print ''; - print ''; + // Amount print ''; - print "\n"; + print ''; + print '\n"; while ($i < min($num,$limit)) { diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 1bc88e176d9..8263dc76cb8 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -39,7 +39,7 @@ if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta' if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport'); // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') -$modecompta = $conf->global->COMPTA_MODE; +$modecompta = $conf->global->ACCOUNTING_MODE; if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta"); $sortorder=isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; @@ -132,6 +132,8 @@ $tableparams = array_merge($commonparams, $tableparams); foreach($allparams as $key => $value) { $paramslink .= '&' . $key . '=' . $value; } + + /* * View */ @@ -174,12 +176,12 @@ report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportl // SQL request $catotal=0; -if ($modecompta == 'CREANCES-DETTES') +if ($modecompta == 'CREANCES-DETTES') { $sql = "SELECT DISTINCT p.rowid as rowid, p.ref as ref, p.label as label,"; $sql.= " sum(l.total_ht) as amount, sum(l.total_ttc) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as l, ".MAIN_DB_PREFIX."product as p"; - if ($selected_cat === -2) // Without any category + if ($selected_cat === -2) // Without any category { $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; } @@ -198,7 +200,7 @@ if ($modecompta == 'CREANCES-DETTES') if ($date_start && $date_end) { $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; } - if ($selected_cat === -2) // Without any category + if ($selected_cat === -2) // Without any category { $sql.=" AND cp.fk_product is null"; } @@ -209,7 +211,7 @@ if ($modecompta == 'CREANCES-DETTES') $sql.= " AND cp.fk_categorie = c.rowid AND cp.fk_product = p.rowid"; } $sql.= " AND f.entity = ".$conf->entity; - $sql.= " GROUP BY p.rowid"; + $sql.= " GROUP BY p.rowid, p.ref, p.label"; $sql.= " ORDER BY p.ref"; dol_syslog("cabyprodserv", LOG_DEBUG); @@ -336,7 +338,7 @@ if ($modecompta == 'CREANCES-DETTES') // Product $fullname=$name[$key]; if ($key >= 0) { - $linkname=''.img_object($langs->trans("ShowProduct"),'product').' '.$fullname.''; + $linkname=''.img_object($langs->trans("ShowProduct"),'product').' '.$fullname.''; } else { $linkname=$langs->trans("PaymentsNotLinkedToProduct"); } @@ -390,7 +392,7 @@ if ($modecompta == 'CREANCES-DETTES') // $modecompta != 'CREANCES-DETTES' // "Calculation of part of each product for accountancy in this mode is not possible. When a partial payment (for example 5 euros) is done on an // invoice with 2 product (product A for 10 euros and product B for 20 euros), what is part of paiment for product A and part of paiment for product B ? - // Because there is no way to know this, this report is not relevant. + // Because there is no way to know this, this report is not relevant. print '
    '.$langs->trans("TurnoverPerProductInCommitmentAccountingNotRelevant") . '
    '; } diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 708c77708cf..e88d370a0c6 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -36,7 +36,7 @@ if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta' if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport'); // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') -$modecompta = $conf->global->COMPTA_MODE; +$modecompta = $conf->global->ACCOUNTING_MODE; if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta"); $sortorder=isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; @@ -348,7 +348,7 @@ if (count($amount)) { // Third party $fullname=$name[$key]; if ($key >= 0) { - $linkname=''.img_object($langs->trans("ShowUser"),'user').' '.$fullname.''; + $linkname=''.img_object($langs->trans("ShowUser"),'user').' '.$fullname.''; } else { $linkname=$langs->trans("PaymentsNotLinkedToUser"); } @@ -359,9 +359,9 @@ if (count($amount)) { if ($modecompta != 'CREANCES-DETTES') { if ($key > 0) { - print ''; + print ''; } else { - print ''; + print ''; } } else { if ($key > 0) { @@ -377,9 +377,9 @@ if (count($amount)) { print ''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { if ($modecompta == 'CREANCES-DETTES') print ''; print ''; - print ''; + print ''; if ($annee != $year_end) print ''; } print ''; @@ -209,6 +209,8 @@ $maxyear=substr($maxyearmonth,0,4); $nowyear=strftime("%Y",dol_now()); $nowyearmonth=strftime("%Y-%m",dol_now()); $maxyearmonth=max($maxyearmonth,$nowyearmonth); +$now=dol_now(); +$casenow = dol_print_date($now,"%Y-%m"); // Loop on each month $nb_mois_decalage = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START-1):0; @@ -220,22 +222,37 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) print ""; print ""; - for ($annee = $year_start ; $annee <= $year_end ; $annee++) + for ($annee = $year_start -1 ; $annee <= $year_end ; $annee++) // We start one year before to have data to be able to make delta { - $now=dol_now(); $annee_decalage=$annee; if ($mois>12) {$annee_decalage=$annee+1;} - $casenow = dol_print_date($now,"%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"); - if ($modecompta == 'CREANCES-DETTES') { - // Valeur CA du mois w/o VAT + if ($annee >= $year_start) + { + if ($modecompta == 'CREANCES-DETTES') { + // Valeur CA du mois w/o VAT + print '"; + } + + // Valeur CA du mois print '"; - } - - // Valeur CA du mois - print '"; - // Pourcentage du mois - if ($annee_decalage > $minyear && $case <= $casenow) - { - if ($cum[$caseprev] && $cum[$case]) + // Pourcentage du mois + if ($annee_decalage > $minyear && $case <= $casenow) { - $percent=(round(($cum[$case]-$cum[$caseprev])/$cum[$caseprev],4)*100); - //print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X"; - print ''; + if ($cum[$caseprev] && $cum[$case]) + { + $percent=(round(($cum[$case]-$cum[$caseprev])/$cum[$caseprev],4)*100); + //print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X"; + print ''; + } + if ($cum[$caseprev] && ! $cum[$case]) + { + print ''; + } + if (! $cum[$caseprev] && $cum[$case]) + { + //print ''; + print ''; + } + if (isset($cum[$caseprev]) && ! $cum[$caseprev] && ! $cum[$case]) + { + print ''; + } + if (! isset($cum[$caseprev]) && ! $cum[$case]) + { + print ''; + } } - if ($cum[$caseprev] && ! $cum[$case]) + else { - print ''; + print ''; } - if (! $cum[$caseprev] && $cum[$case]) - { - //print ''; - print ''; - } - if (isset($cum[$caseprev]) && ! $cum[$caseprev] && ! $cum[$case]) - { - print ''; - } - if (! isset($cum[$caseprev]) && ! $cum[$case]) - { - print ''; - } - } - else - { - print ''; + if ($annee_decalage != $year_end) print ''; } $total_ht[$annee]+=!empty($cum_ht[$case]) ? $cum_ht[$case] : 0;; $total[$annee]+=$cum[$case]; - if ($annee_decalage != $year_end) print ''; } print ''; @@ -382,7 +385,7 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++) print ''; } } - + // Montant total if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear,$maxyear))) { @@ -398,24 +401,24 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++) { if ($total[$annee-1] && $total[$annee]) { $percent=(round(($total[$annee]-$total[$annee-1])/$total[$annee-1],4)*100); - print ''; + print ''; } if ($total[$annee-1] && ! $total[$annee]) { - print ''; + print ''; } if (! $total[$annee-1] && $total[$annee]) { - print ''; + print ''; } if (! $total[$annee-1] && ! $total[$annee]) { - print ''; + print ''; } } else { - print ''; diff --git a/htdocs/compta/tva/fiche.php b/htdocs/compta/tva/card.php similarity index 93% rename from htdocs/compta/tva/fiche.php rename to htdocs/compta/tva/card.php index a4a5a8831c4..b612a9b6459 100644 --- a/htdocs/compta/tva/fiche.php +++ b/htdocs/compta/tva/card.php @@ -18,7 +18,7 @@ */ /** - * \file htdocs/compta/tva/fiche.php + * \file htdocs/compta/tva/card.php * \ingroup tax * \brief Page of VAT payments */ @@ -42,7 +42,7 @@ $result = restrictedArea($user, 'tax', '', '', 'charges'); $tva = new Tva($db); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('taxvatcard')); +$hookmanager->initHooks(array('taxvatcard','globalcard')); @@ -181,7 +181,7 @@ if ($id) // Formulaire saisie tva if ($action == 'create') { - print "\n"; + print "\n"; print ''; print ''; @@ -230,8 +230,11 @@ if ($action == 'create') print "
    "; - print '
      '; - print '
    '; + print '
    '; + print ''; + print '     '; + print ''; + print '
    '; print ''; } @@ -246,7 +249,7 @@ if ($action == 'create') if ($id) { $h = 0; - $head[$h][0] = DOL_URL_ROOT.'/compta/tva/fiche.php?id='.$vatpayment->id; + $head[$h][0] = DOL_URL_ROOT.'/compta/tva/card.php?id='.$vatpayment->id; $head[$h][1] = $langs->trans('Card'); $head[$h][2] = 'card'; $h++; @@ -307,7 +310,7 @@ if ($id) { if (! empty($user->rights->tax->charges->supprimer)) { - print '
    '.$langs->trans("Delete").''; + print ''.$langs->trans("Delete").''; } else { diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 4e049594b49..96db35f915b 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -143,7 +143,7 @@ class Tva extends CommonObject * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; @@ -205,7 +205,7 @@ class Tva extends CommonObject * @param User $user User that load * @return int <0 if KO, >0 if OK */ - function fetch($id, $user=0) + function fetch($id, $user=null) { global $langs; $sql = "SELECT"; @@ -343,7 +343,7 @@ class Tva extends CommonObject } /** - * Total of the VAT from invoices emitted by the society. + * Total of the VAT from invoices emitted by the thirdparty. * * @param int $year Year * @return double Amount @@ -571,7 +571,7 @@ class Tva extends CommonObject } // Update links - $result=$acc->add_url_line($bank_line_id, $this->id, DOL_URL_ROOT.'/compta/tva/fiche.php?id=', "(VATPayment)", "payment_vat"); + $result=$acc->add_url_line($bank_line_id, $this->id, DOL_URL_ROOT.'/compta/tva/card.php?id=', "(VATPayment)", "payment_vat"); if ($result < 0) { $this->error=$acc->error; @@ -639,13 +639,13 @@ class Tva extends CommonObject $result=''; - $lien = ''; + $lien = ''; $lienfin=''; $picto='payment'; $label=$langs->trans("ShowVatPayment").': '.$this->ref; - if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); + if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; return $result; diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index 422354ee7c3..c2620fd34df 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -110,10 +110,10 @@ $fsearch.=' '; // Affiche en-tete du rapport if ($modetax==1) // Calculate on invoice for goods and services { - $nom=$langs->trans("VATReportByCustomersInDueDebtMode"); + $name=$langs->trans("VATReportByCustomersInDueDebtMode"); $calcmode=$langs->trans("CalcModeVATDebt"); $calcmode.='
    ('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; - //$nom.='
    ('.$langs->trans("SeeVATReportInInputOutputMode",'','').')'; + //$name.='
    ('.$langs->trans("SeeVATReportInInputOutputMode",'','').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); //$periodlink=($year_start?"".img_previous()."".img_next()."":""); $description=$langs->trans("RulesVATDueServices"); @@ -138,10 +138,10 @@ if ($modetax==1) // Calculate on invoice for goods and services } if ($modetax==0) // Invoice for goods, payment for services { - $nom=$langs->trans("VATReportByCustomersInInputOutputMode"); + $name=$langs->trans("VATReportByCustomersInInputOutputMode"); $calcmode=$langs->trans("CalcModeVATEngagement"); $calcmode.='
    ('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; - //$nom.='
    ('.$langs->trans("SeeVATReportInDueDebtMode",'','').')'; + //$name.='
    ('.$langs->trans("SeeVATReportInDueDebtMode",'','').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); //$periodlink=($year_start?"".img_previous()."".img_next()."":""); $description=$langs->trans("RulesVATInServices"); @@ -165,7 +165,7 @@ if ($modetax==0) // Invoice for goods, payment for services $amountsup=$langs->trans("AmountHT"); if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')'; } -report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); +report_header($name,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); $vatcust=$langs->trans("VATReceived"); $vatsup=$langs->trans("VATPaid"); @@ -223,7 +223,7 @@ if (is_array($coll_list)) print ""; print '"; $company_static->id=$coll->socid; - $company_static->nom=$coll->nom; + $company_static->name=$coll->name; $company_static->client=1; print ''; $find = array(' ','.'); @@ -304,7 +304,7 @@ if (is_array($coll_list)) print ""; print '"; $company_static->id=$coll->socid; - $company_static->nom=$coll->nom; + $company_static->name=$coll->name; $company_static->fournisseur=1; print ''; $find = array(' ','.'); diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index 16652327ef3..c0dcff6d5c3 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -60,7 +60,7 @@ if (isset($_GET["modetax"])) $modetax=$_GET["modetax"]; * * @param DoliDB $db Database handler * @param string $sql SQL Request - * @param date $date Date + * @param string $date Date * @return void */ function pt ($db, $sql, $date) diff --git a/htdocs/compta/tva/quadri.php b/htdocs/compta/tva/quadri.php index 0e22dc77f1b..f5d0065e7f3 100644 --- a/htdocs/compta/tva/quadri.php +++ b/htdocs/compta/tva/quadri.php @@ -60,7 +60,7 @@ function tva_coll($db,$y,$q) { global $conf; - if ($conf->global->COMPTA_MODE == "CREANCES-DETTES") + if ($conf->global->ACCOUNTING_MODE == "CREANCES-DETTES") { // if vat paid on due invoices $sql = "SELECT d.fk_facture as facid, f.facnumber as facnum, d.tva_tx as rate, d.total_ht as totalht, d.total_tva as amount"; @@ -128,7 +128,7 @@ function tva_paye($db, $y,$q) { global $conf; - if ($conf->global->COMPTA_MODE == "CREANCES-DETTES") + if ($conf->global->ACCOUNTING_MODE == "CREANCES-DETTES") { // Si on paye la tva sur les factures dues (non brouillon) $sql = "SELECT d.fk_facture_fourn as facid, f.facnumber as facnum, d.tva_tx as rate, d.total_ht as totalht, d.tva as amount"; @@ -212,7 +212,7 @@ print ""; print ""; print "\n"; -if ($conf->global->COMPTA_MODE == "CREANCES-DETTES") +if ($conf->global->ACCOUNTING_MODE == "CREANCES-DETTES") { $y = $year_current; @@ -250,7 +250,7 @@ if ($conf->global->COMPTA_MODE == "CREANCES-DETTES") } $x_both[$my_paye_rate]['paye']['links'] = ''; foreach($x_paye[$my_paye_rate]['facid'] as $id=>$dummy){ - $x_both[$my_paye_rate]['paye']['links'] .= '..'.substr($x_paye[$my_paye_rate]['facnum'][$id],-2).' '; + $x_both[$my_paye_rate]['paye']['links'] .= '..'.substr($x_paye[$my_paye_rate]['facnum'][$id],-2).' '; } } //now we have an array (x_both) indexed by rates for coll and paye diff --git a/htdocs/compta/tva/reglement.php b/htdocs/compta/tva/reglement.php index 9bb4337782e..45a69076492 100644 --- a/htdocs/compta/tva/reglement.php +++ b/htdocs/compta/tva/reglement.php @@ -35,6 +35,9 @@ $socid = isset($_GET["socid"])?$_GET["socid"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'tax', '', '', 'charges'); +$search_ref = GETPOST('search_ref','int'); +$search_label = GETPOST('search_label','alpha'); +$search_amount = GETPOST('search_amount','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); @@ -63,6 +66,14 @@ else $typeid=$_REQUEST['typeid']; } +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_ref=""; + $search_label=""; + $search_amount=""; + $typeid=""; +} + /* * View */ @@ -76,8 +87,9 @@ $sql = "SELECT t.rowid, t.amount, t.label, t.datev as dm, t.fk_typepayment as ty $sql.= " FROM ".MAIN_DB_PREFIX."tva as t"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON t.fk_typepayment = pst.id"; $sql.= " WHERE t.entity = ".$conf->entity; -if (GETPOST("search_label")) $sql.=" AND t.label LIKE '%".$db->escape(GETPOST("search_label"))."%'"; -if (GETPOST("search_amount")) $sql.=" AND t.amount = ".price2num(GETPOST("search_amount")); +if ($search_ref) $sql.=" AND t.rowid=".$search_ref; +if ($search_label) $sql.=" AND t.label LIKE '%".$db->escape($search_label)."%'"; +if ($search_amount) $sql.=" AND t.amount='".$db->escape(price2num(trim($search_amount)))."'"; if ($filtre) { $filtre=str_replace(":","=",$filtre); $sql .= " AND ".$filtre; @@ -85,7 +97,6 @@ if ($filtre) { if ($typeid) { $sql .= " AND t.fk_typepayment=".$typeid; } -$sql.= " GROUP BY t.rowid, t.fk_typepayment, t.amount, t.datev, t.label"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1,$offset); @@ -99,49 +110,48 @@ if ($result) $param=''; if ($typeid) $param.='&typeid='.$typeid; - + print_barre_liste($langs->trans("VATPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines); print ''; print '
     '; + print ''; + print ''; $formsocialcontrib->select_type_socialcontrib($typeid,'typeid',1,16,0); print '   '; - print ''; + print ''; print '
     '; + print ''; + print "
    '; if ($modecompta != 'CREANCES-DETTES') { if ($key > 0) { - print ''; + print ''; } else { - print ''; + print ''; } } else { if ($key > 0) { diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 3535db5594a..1d34f78a181 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -34,7 +34,7 @@ $langs->load("companies"); $langs->load("categories"); // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') -$modecompta = $conf->global->COMPTA_MODE; +$modecompta = $conf->global->ACCOUNTING_MODE; if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta"); $sortorder=isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; @@ -429,9 +429,9 @@ if (count($amount)) { print ''; if ($modecompta != 'CREANCES-DETTES') { if ($key > 0) { - print ''; + print ''; } else { - print ''; + print ''; } } else { if ($key > 0) { @@ -447,9 +447,9 @@ if (count($amount)) { print ''; if ($modecompta != 'CREANCES-DETTES') { if ($key > 0) { - print ''; + print ''; } else { - print ''; + print ''; } } else { if ($key > 0) { diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 59a7e478f9b..cfd816c29b6 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -38,7 +38,7 @@ else { $userid=GETPOST('userid','int'); $socid = GETPOST('socid','int'); // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') -$modecompta = $conf->global->COMPTA_MODE; +$modecompta = $conf->global->ACCOUNTING_MODE; if ($_GET["modecompta"]) $modecompta=$_GET["modecompta"]; // Security check @@ -184,7 +184,7 @@ print '
     '; - else print ''; + else print ''; print ''; print $annee; if ($conf->global->SOCIETE_FISCAL_MONTH_START > 1) print '-'.($annee+1); @@ -198,7 +198,7 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++) { if ($modecompta == 'CREANCES-DETTES') print ''.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").''.$langs->trans("Delta").''.$langs->trans("Delta").' 
    ".dol_print_date(dol_mktime(12,0,0,$mois_modulo,1,2000),"%B")."'; + if ($cum_ht[$case]) + { + $now_show_delta=1; // On a trouve le premier mois de la premiere annee generant du chiffre. + print ''.price($cum_ht[$case],1).''; + } + else + { + if ($minyearmonth < $case && $case <= max($maxyearmonth,$nowyearmonth)) { print '0'; } + else { print ' '; } + } + print "'; - if ($cum_ht[$case]) + if ($cum[$case]) { $now_show_delta=1; // On a trouve le premier mois de la premiere annee generant du chiffre. - print ''.price($cum_ht[$case],1).''; + print ''.price($cum[$case],1).''; } else { @@ -243,60 +260,46 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) else { print ' '; } } print "'; - if ($cum[$case]) - { - $now_show_delta=1; // On a trouve le premier mois de la premiere annee generant du chiffre. - print ''.price($cum[$case],1).''; - } - else - { - if ($minyearmonth < $case && $case <= max($maxyearmonth,$nowyearmonth)) { print '0'; } - else { print ' '; } - } - print "'.($percent>=0?"+$percent":"$percent").'%'.($percent>=0?"+$percent":"$percent").'%-100%+Inf%-+0%--100%'; + if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } + else { print ' '; } + print '+Inf%-+0%-'; - if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } - else { print ' '; } - print '  
     '.($percent>=0?"+$percent":"$percent").'%'.($percent>=0?"+$percent":"$percent").'%-100%-100%+Inf%+zzzz'.$total[$annee-1].$langs->trans('Inf').'%+0%+0%'; + print ''; if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear,$maxyear))) { print '-'; } else { print ' '; } print '
    '.$i."'.$company_static->getNomUrl(1,'customer').'
    '.$i."'.$company_static->getNomUrl(1,'supplier').'".$langs->trans("Invoices")."".$langs->trans("TotalToPay")."
    '; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"t.rowid","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"t.label","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"dm","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre(""); + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"t.rowid","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"t.label","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"dm","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre(""); print "\n"; - + print ''; - print ''; - print ''; + print ''; + print ''; print ''; // Type print ''; - print ''; - print ''; - print "\n"; - + print ''; + print '\n"; + while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); $var=!$var; - + if ($obj->payment_code <> '') { - $type = ''; + $type = ''; } else { $type = ''; } - + print ""; $tva_static->id=$obj->rowid; @@ -161,12 +171,12 @@ if ($result) } print ''; print ""; - print ""; + print ""; print "
      '; $form->select_types_paiements($typeid,'typeid','',0,0,1,16); print ''; - print ''; - print '
    '; + print ''; + print "
    '.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.' 
    '.$langs->trans("Total").'".price($total)." 
     
    "; - + print ''; - + $db->free($result); } else @@ -175,6 +185,6 @@ else } -$db->close(); - llxFooter(); + +$db->close(); diff --git a/htdocs/compta/ventilation/fiche.php b/htdocs/compta/ventilation/card.php similarity index 96% rename from htdocs/compta/ventilation/fiche.php rename to htdocs/compta/ventilation/card.php index b55f2b59475..7201dfe9e29 100644 --- a/htdocs/compta/ventilation/fiche.php +++ b/htdocs/compta/ventilation/card.php @@ -18,7 +18,7 @@ */ /** - * \file htdocs/compta/ventilation/fiche.php + * \file htdocs/compta/ventilation/card.php * \ingroup compta * \brief Page fiche ventilation */ @@ -106,7 +106,7 @@ if($_GET["id"]) if($objp->fk_code_ventilation == 0) { - print '
    '."\n"; + print ''."\n"; print ''; print ''; } diff --git a/htdocs/compta/ventilation/fournisseur/fiche.php b/htdocs/compta/ventilation/fournisseur/card.php similarity index 96% rename from htdocs/compta/ventilation/fournisseur/fiche.php rename to htdocs/compta/ventilation/fournisseur/card.php index 168b99eea35..d62694512fc 100644 --- a/htdocs/compta/ventilation/fournisseur/fiche.php +++ b/htdocs/compta/ventilation/fournisseur/card.php @@ -18,7 +18,7 @@ */ /** - * \file htdocs/compta/ventilation/fournisseur/fiche.php + * \file htdocs/compta/ventilation/fournisseur/card.php * \ingroup compta * \brief Page fiche ventilation */ @@ -95,7 +95,7 @@ if($_GET["id"]) if($objp->fk_code_ventilation == 0) { - print ''."\n"; + print ''."\n"; print ''; print ''; } diff --git a/htdocs/compta/ventilation/fournisseur/index.php b/htdocs/compta/ventilation/fournisseur/index.php deleted file mode 100644 index ebd4d2c4af5..00000000000 --- a/htdocs/compta/ventilation/fournisseur/index.php +++ /dev/null @@ -1,127 +0,0 @@ - - * Copyright (C) 2004 Laurent Destailleur - * Copyright (C) 2005 Simon TOSSER - * - * 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 . - * - */ - -/** - * \file htdocs/compta/ventilation/fournisseur/index.php - * \ingroup compta - * \brief Page accueil ventilation - */ - -require '../../../main.inc.php'; -$langs->load("suppliers"); - - -llxHeader('','Compta - Ventilation'); - -print_titre("Ventilation Comptable"); - -print ''; - -print '
    '; - - - -$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."facturedet"; -$sql .= " WHERE fk_code_ventilation = 0"; -$result = $db->query($sql); -if ($result) -{ - $row = $db->fetch_row($result); - $nbfac = $row[0]; - - $db->free($result); -} - -$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."paiement"; -$sql .= " WHERE fk_code_ventilation = 0"; - -$result = $db->query($sql); -if ($result) -{ - $row = $db->fetch_row($result); - $nbp = $row[0]; - - $db->free($result); -} - -$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."facture_fourn_det"; -$sql .= " WHERE fk_code_ventilation = 0"; -$result = $db->query($sql); -if ($result) -{ - $row = $db->fetch_row($result); - $nbfacfourn = $row[0]; - - $db->free($result); -} - -/*$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."paiementfourn"; -$sql .= " WHERE fk_code_ventilation = 0"; - -$result = $db->query($sql); -if ($result) -{ - $row = $db->fetch_row($result); - $nbpfourn = $row[0]; - - $db->free($result); -}*/ - -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -//print ''; -print "
    Lignes a ventiler
    TypeNb
    Factures clients'.$nbfac.'
    Paiements clients'.$nbp.'
    Factures fournisseurs'.$nbfacfourn.'
    Paiements fournisseurs'.$nbpfourn.'
    \n"; - -print '
    '; - -print ''; -print ''; - -$sql = "SELECT count(*), ccg.intitule FROM ".MAIN_DB_PREFIX."facturedet as fd"; -$sql .= " ,".MAIN_DB_PREFIX."compta_compte_generaux as ccg"; -$sql .= " WHERE fd.fk_code_ventilation = ccg.rowid"; -$sql .= " GROUP BY ccg.rowid"; - -$resql = $db->query($sql); -if ($resql) -{ - $i = 0; - $num = $db->num_rows($resql); - - while ($i < $num) - { - - $row = $db->fetch_row($resql); - - print ''; - $i++; - } - $db->free($resql); -} -print "
    TypeNb de lignes
    '.$row[1].''.$row[0].'
    \n"; - -print '
    '; - -llxFooter(); - diff --git a/htdocs/compta/ventilation/fournisseur/lignes.php b/htdocs/compta/ventilation/fournisseur/lignes.php deleted file mode 100644 index cb2a0e1439a..00000000000 --- a/htdocs/compta/ventilation/fournisseur/lignes.php +++ /dev/null @@ -1,114 +0,0 @@ - - * Copyright (C) 2005 Simon TOSSER - * 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 . - * - */ - -/** - * \file htdocs/compta/ventilation/fournisseur/lignes.php - * \ingroup facture - * \brief Page de detail des lignes de ventilation d'une facture - */ - -require '../../../main.inc.php'; - -$langs->load("bills"); - -if (!$user->rights->facture->lire) accessforbidden(); -if (!$user->rights->compta->ventilation->creer) accessforbidden(); -/* - * Securite acces client - */ -if ($user->societe_id > 0) accessforbidden(); - -llxHeader(''); - -/* - * Lignes de factures - * - */ -$page = $_GET["page"]; -if ($page < 0) $page = 0; -$limit = $conf->liste_limit; -$offset = $limit * $page ; - -$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ttc as price, l.qty, l.rowid, l.tva_tx, l.fk_code_ventilation, c.intitule, c.numero "; -$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as l"; -$sql .= " , ".MAIN_DB_PREFIX."facture_fourn as f"; -$sql .= " , ".MAIN_DB_PREFIX."compta_compte_generaux as c"; - -$sql .= " WHERE f.rowid = l.fk_facture_fourn AND f.fk_statut = 1 AND l.fk_code_ventilation <> 0 "; -$sql .= " AND c.rowid = l.fk_code_ventilation"; - -if (dol_strlen(trim($_GET["search_facture"]))) -{ - $sql .= " AND f.facnumber like '%".$_GET["search_facture"]."%'"; -} - -$sql .= " ORDER BY l.rowid DESC"; -$sql .= $db->plimit($limit+1,$offset); - -$result = $db->query($sql); - -if ($result) -{ - $num_lignes = $db->num_rows($result); - $i = 0; - - print_barre_liste("Lignes de facture ventilées",$page,"lignes.php","",$sortfield,$sortorder,'',$num_lignes); - - print ''; - print ''; - print ""; - print ''; - print ''; - print ''; - print "\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - $var=True; - while ($i < min($num_lignes, $limit)) - { - $objp = $db->fetch_object($result); - $var=!$var; - print ""; - - print ''; - - print ''; - print ''; - print ''; - print ''; - - print ""; - $i++; - } -} -else -{ - print $db->error(); -} - -print "
    Facture'.$langs->trans("Description").''.$langs->trans("Montant").''.$langs->trans("Compte").'
       
    '.$objp->facnumber.''.stripslashes(nl2br($objp->description)).''.price($objp->price).''.$objp->numero.''.stripslashes($objp->intitule).'
    "; - -$db->close(); - -llxFooter(); diff --git a/htdocs/compta/ventilation/fournisseur/liste.php b/htdocs/compta/ventilation/fournisseur/list.php similarity index 87% rename from htdocs/compta/ventilation/fournisseur/liste.php rename to htdocs/compta/ventilation/fournisseur/list.php index e3eb4cf487d..5213a4686be 100644 --- a/htdocs/compta/ventilation/fournisseur/liste.php +++ b/htdocs/compta/ventilation/fournisseur/list.php @@ -20,7 +20,7 @@ /** - * \file htdocs/compta/ventilation/liste.php + * \file htdocs/compta/ventilation/list.php * \ingroup compta * \brief Page de ventilation des lignes de facture */ @@ -60,7 +60,7 @@ if ($result) $num_lignes = $db->num_rows($result); $i = 0; - print_barre_liste("Lignes de facture à ventiler",$page,"liste.php","",$sortfield,$sortorder,'',$num_lignes); + print_barre_liste("Lignes de facture à ventiler",$page,"list.php","",$sortfield,$sortorder,'',$num_lignes); print ''; print ''; @@ -76,14 +76,14 @@ if ($result) $var=!$var; print ""; - print ''; + print ''; print ''; print ''; - print ''; diff --git a/htdocs/compta/ventilation/index.php b/htdocs/compta/ventilation/index.php deleted file mode 100644 index 8b9710844a7..00000000000 --- a/htdocs/compta/ventilation/index.php +++ /dev/null @@ -1,102 +0,0 @@ - - * Copyright (C) 2004-2005 Laurent Destailleur - * - * 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 . - * - */ - -/** - * \file htdocs/compta/ventilation/index.php - * \ingroup compta - * \brief Page accueil ventilation - */ - -require '../../main.inc.php'; - -$langs->load("compta"); -$langs->load("bills"); - -llxHeader('','Compta - Ventilation'); - -print_fiche_titre("Ventilation Comptable"); - -//print '
    Facture
    '.$objp->facnumber.''.$objp->facnumber.''.stripslashes(nl2br($objp->description)).''; print price($objp->price); print ''; + print ''; print img_edit(); print '
    '; -//print '
    '; -print '
    '; - -$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."facturedet as fd"; -$sql.= " , ".MAIN_DB_PREFIX."facture as f"; -$sql.= " WHERE fd.fk_code_ventilation = 0"; -$sql.= " AND f.rowid = fd.fk_facture AND f.fk_statut = 1"; - -$result = $db->query($sql); -if ($result) -{ - $row = $db->fetch_row($result); - $nbfac = $row[0]; - - $db->free($result); -} - -$var=true; - -print ''; -print ''; -print ''; -$var=!$var; -print "".''; -$var=!$var; -print "
    '.$langs->trans("Lines").'
    '.$langs->trans("Type").''.$langs->trans("Nb").'
    '.$langs->trans("Invoices").''.$nbfac.'
    \n"; - - -//print '
    '; -print '
    '; - - -print ''; -print ''; - -$sql = "SELECT count(*), ccg.intitule, ccg.rowid,ccg.numero FROM ".MAIN_DB_PREFIX."facturedet as fd"; -$sql.= " ,".MAIN_DB_PREFIX."compta_compte_generaux as ccg"; -$sql.= " WHERE fd.fk_code_ventilation = ccg.rowid"; -$sql.= " GROUP BY ccg.rowid"; - -$resql = $db->query($sql); -if ($resql) -{ - $i = 0; - $num = $db->num_rows($resql); - $var=true; - - while ($i < $num) - { - - $row = $db->fetch_row($resql); - $var=!$var; - print ''; - print ''; - $i++; - } - $db->free($resql); -} -print "
    '.$langs->trans("Type").''.$langs->trans("NbOfLines").''.$langs->trans("AccountNumber").''.$langs->trans("TransID").'
    '.$row[1].''.$row[0].''.$row[3].''.$row[2].'
    \n"; - -//print '
    '; -print ''; - - -llxFooter(); - -$db->close(); diff --git a/htdocs/compta/ventilation/lignes.php b/htdocs/compta/ventilation/lignes.php deleted file mode 100644 index 46276937afe..00000000000 --- a/htdocs/compta/ventilation/lignes.php +++ /dev/null @@ -1,141 +0,0 @@ - - * Copyright (C) 2006 Laurent Destailleur - * - * 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 . - * - */ - -/** - * \file htdocs/compta/ventilation/lignes.php - * \ingroup facture - * \brief Page de detail des lignes de ventilation d'une facture - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - -$langs->load("bills"); -$langs->load("compta"); - -if (!$user->rights->facture->lire) accessforbidden(); -if (!$user->rights->compta->ventilation->creer) accessforbidden(); - -// Securite acces client -if ($user->societe_id > 0) accessforbidden(); - - -llxHeader(''); - -/* -* Lignes de factures -* -*/ -$page = $_GET["page"]; -if ($page < 0) $page = 0; -$limit = $conf->liste_limit; -$offset = $limit * $page ; - -$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, f.total_ttc as price, l.qty, l.rowid, l.tva_tx, l.fk_code_ventilation, c.intitule, c.numero,"; -$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type"; -$sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; -$sql.= " , ".MAIN_DB_PREFIX."compta_compte_generaux as c"; -$sql.= " , ".MAIN_DB_PREFIX."facturedet as l"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; -$sql.= " WHERE f.rowid = l.fk_facture AND f.fk_statut = 1 AND l.fk_code_ventilation <> 0 "; -$sql.= " AND f.entity = ".$conf->entity; -$sql.= " AND c.rowid = l.fk_code_ventilation"; -if (dol_strlen(trim($_GET["search_facture"]))) -{ - $sql .= " AND f.facnumber LIKE '%".$_GET["search_facture"]."%'"; -} - -$sql .= " ORDER BY l.rowid DESC"; -$sql .= $db->plimit($limit+1,$offset); - -$result = $db->query($sql); - -if ($result) -{ - $num_lignes = $db->num_rows($result); - $i = 0; - - print_barre_liste($langs->trans("InvoiceDispatched"),$page,"lignes.php","",$sortfield,$sortorder,'',$num_lignes); - - print '
    '; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - $facture_static=new Facture($db); - $product_static=new Product($db); - - $var=True; - while ($i < min($num_lignes, $limit)) - { - $objp = $db->fetch_object($result); - $var=!$var; - $codeCompta = $objp->numero.' '.$objp->intitule; - - print ""; - - // Ref facture - $facture_static->ref=$objp->facnumber; - $facture_static->id=$objp->facid; - print ''; - - // Ref produit - $product_static->ref=$objp->product_ref; - $product_static->id=$objp->product_id; - $product_static->type=$objp->type; - print ''; - - print ''; - print ''; - print ''; - print ''; - - print ""; - $i++; - } -} -else -{ - print $db->error(); -} - -print "
    '.$langs->trans("Invoice").''.$langs->trans("Ref").''.$langs->trans("Label").''.$langs->trans("Description").''.$langs->trans("Montant").''.$langs->trans("Compte").'
        '; - print ''; - print '
    '.$facture_static->getNomUrl(1).''; - if ($product_static->id) print $product_static->getNomUrl(1); - else print ' '; - print ''.dol_trunc($objp->product_label,24).''.nl2br(dol_trunc($objp->description,32)).''.price($objp->price).''.$codeCompta.'
    "; - - -llxFooter(); -$db->close(); diff --git a/htdocs/compta/ventilation/liste.php b/htdocs/compta/ventilation/list.php similarity index 95% rename from htdocs/compta/ventilation/liste.php rename to htdocs/compta/ventilation/list.php index effa7689821..03a1b658cd2 100644 --- a/htdocs/compta/ventilation/liste.php +++ b/htdocs/compta/ventilation/list.php @@ -20,7 +20,7 @@ /** - * \file htdocs/compta/ventilation/liste.php + * \file htdocs/compta/ventilation/list.php * \ingroup compta * \brief Page de ventilation des lignes de facture */ @@ -69,7 +69,7 @@ if ($result) $num_lignes = $db->num_rows($result); $i = 0; - print_barre_liste($langs->trans("InvoiceLinesToDispatch"),$page,"liste.php","",$sortfield,$sortorder,'',$num_lignes); + print_barre_liste($langs->trans("InvoiceLinesToDispatch"),$page,"list.php","",$sortfield,$sortorder,'',$num_lignes); print ''; print ''; @@ -111,7 +111,7 @@ if ($result) print price($objp->price); print ''; - print ''; diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 32adc4b87c9..67147a6d06b 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -43,10 +43,10 @@ $dolibarr_main_document_root=''; // You can put several values, separated by a coma, but number of entries must match // number of entries into $dolibarr_main_document_root_alt. // Examples: -// $dolibarr_main_url_root_alt='/extensions'; +// $dolibarr_main_url_root_alt='/custom'; // $dolibarr_main_url_root_alt='/extensions1,/extensions2'; // -$dolibarr_main_url_root_alt=''; +//$dolibarr_main_url_root_alt='/custom'; // dolibarr_main_document_root_alt @@ -55,10 +55,10 @@ $dolibarr_main_url_root_alt=''; // You can put several values, separated by a coma, but number of entries must match // number of entries into $dolibarr_main_url_root_alt. // Examples: -// $dolibarr_main_document_root_alt='/var/www/dolibarr/htdocs/extensions'; +// $dolibarr_main_document_root_alt='/var/www/dolibarr/htdocs/custom'; // $dolibarr_main_document_root_alt='C:/My web sites/dolibarr/htdocs/extensions1,C:/My web sites/dolibarr/htdocs/extensions2'; // -$dolibarr_main_document_root_alt=''; +//$dolibarr_main_document_root_alt='/var/www/dolibarr/htdocs/custom'; // dolibarr_main_data_root diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 3cb150b8432..9e6624dda72 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -94,7 +94,7 @@ abstract class ActionsContactCardCommon /** * Load data control * - * @param string &$action Type of action + * @param string $action Type of action * @param int $id Id of object * @return void */ @@ -228,7 +228,7 @@ abstract class ActionsContactCardCommon /** * Set content of ->tpl array, to use into template * - * @param string &$action Type of action + * @param string $action Type of action * @param int $id Id * @return string HTML output */ diff --git a/htdocs/contact/canvas/default/actions_contactcard_default.class.php b/htdocs/contact/canvas/default/actions_contactcard_default.class.php index b39114cb3f5..3bfcf347c3f 100644 --- a/htdocs/contact/canvas/default/actions_contactcard_default.class.php +++ b/htdocs/contact/canvas/default/actions_contactcard_default.class.php @@ -75,7 +75,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon /** * Assign custom values for canvas * - * @param string &$action Type of action + * @param string $action Type of action * @param int $id Id * @return void */ diff --git a/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php index a0605d3656e..70d6b41bf35 100644 --- a/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php +++ b/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php @@ -50,7 +50,7 @@ echo $this->control->tpl['ajax_selectcountry']; ?> - + diff --git a/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php index a445444e42c..3be1d16bc8d 100644 --- a/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php +++ b/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php @@ -59,7 +59,7 @@ echo $this->control->tpl['ajax_selectcountry']; - + diff --git a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php index 623fad27e77..0b4b8a07fcb 100644 --- a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php +++ b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php @@ -44,7 +44,7 @@ dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors'] - + diff --git a/htdocs/contact/fiche.php b/htdocs/contact/card.php similarity index 94% rename from htdocs/contact/fiche.php rename to htdocs/contact/card.php index 4f793fe8538..afa64c0733e 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/card.php @@ -23,7 +23,7 @@ */ /** - * \file htdocs/contact/fiche.php + * \file htdocs/contact/card.php * \ingroup societe * \brief Card of a contact */ @@ -74,7 +74,7 @@ if (! empty($canvas)) $result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('contactcard')); +$hookmanager->initHooks(array('contactcard','globalcard')); /* @@ -83,7 +83,7 @@ $hookmanager->initHooks(array('contactcard')); $parameters=array('id'=>$id, 'objcanvas'=>$objcanvas); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks -$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors); +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) { @@ -142,10 +142,10 @@ if (empty($reshook)) { setEventMessage($object->error,'errors'); } - else + else { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); - exit; + exit; } } @@ -157,11 +157,11 @@ if (empty($reshook)) { setEventMessage($object->error,'errors'); } - else + else { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); - exit; - } + exit; + } } // Add contact @@ -221,7 +221,7 @@ if (empty($reshook)) { $db->commit(); if (! empty($backtopage)) $url=$backtopage; - else $url='fiche.php?id='.$id; + else $url='card.php?id='.$id; header("Location: ".$url); exit; } @@ -241,13 +241,20 @@ if (empty($reshook)) $result = $object->delete(); if ($result > 0) { - header("Location: ".DOL_URL_ROOT.'/contact/list.php'); - exit; + if ($backtopage) + { + header("Location: ".$backtopage); + exit; + } + else + { + header("Location: ".DOL_URL_ROOT.'/contact/list.php'); + exit; + } } else { - setEventMessage($object->error,'errors'); - setEventMessage($object->errors,'errors'); + setEventMessage($object->error,$object->errors,'errors'); } } @@ -360,13 +367,14 @@ else { if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1); + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id.($backtopage?'&backtopage='.$backtopage:''),$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1); } } /* * Onglets */ + $head=array(); if ($id > 0) { // Si edition contact deja existant @@ -379,9 +387,6 @@ else $head = contact_prepare_head($object); $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); - dol_fiche_head($head, 'card', $title, 0, 'contact'); - - dol_htmloutput_events(); } if ($user->rights->societe->contact->creer) @@ -431,13 +436,16 @@ else print ''."\n"; } - print '
    '; print ''; print ''; print ''; print ''; + + dol_fiche_head($head, 'card', '', 0, ''); + print '
    '.$langs->trans("Invoice").''; + print ''; print img_edit(); print '
    trans("Company"); ?>trans("ThirdParty"); ?> control->tpl['company']; ?>
    trans("Company"); ?>trans("ThirdParty"); ?> control->tpl['company']; ?>
    trans("Company"); ?>trans("ThirdParty"); ?> control->tpl['company']; ?>
    '; + // Name print ''; print ''; @@ -449,7 +457,7 @@ else { if ($socid > 0) { - print ''; + print ''; print ''; @@ -457,7 +465,7 @@ else print ''; } else { - print ''; } @@ -604,17 +612,18 @@ else } print ''; - print "
    lastname).'" autofocus="autofocus">
    '; print $objsoc->getNomUrl(1); print '
    '; + print '
    '; print $form->select_company($socid,'socid','',1); print '


    "; + print ""; + print dol_fiche_end(); - print '
    '; + print '
    '; print ''; if (! empty($backtopage)) { print '     '; print ''; } - print '
    '; + print ''; print ""; } @@ -667,6 +676,8 @@ else print ''; if (! empty($backtopage)) print ''; + dol_fiche_head($head, 'card', $title, 0, 'contact'); + print ''; // Ref @@ -683,7 +694,7 @@ else // Company if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { - print ''; + print ''; print ''; @@ -849,13 +860,15 @@ else else print $langs->trans("NoDolibarrAccess"); print ''; - print '
    '; print $form->select_company(GETPOST('socid','int')?GETPOST('socid','int'):($object->socid?$object->socid:-1),'socid','',1); print '

    '; + print ''; - print '
    '; + print dol_fiche_end(); + + print '
    '; print ''; - print '   '; + print '     '; print ''; - print '
    '; + print ''; print ""; } @@ -871,6 +884,8 @@ else dol_htmloutput_errors($error,$errors); + dol_fiche_head($head, 'card', $title, 0, 'contact'); + if ($action == 'create_user') { // Full firstname and lastname separated with a dot : firstname.lastname @@ -917,7 +932,7 @@ else // Company if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { - print ''.$langs->trans("Company").''; + print ''.$langs->trans("ThirdParty").''; if ($object->socid > 0) { $objsoc->fetch($object->socid); @@ -975,7 +990,7 @@ else { $langs->load("mails"); print ''.$langs->trans("NbOfEMailingsSend").''; - print ''.$object->getNbOfEMailings().''; + print ''.$object->getNbOfEMailings().''; } else { @@ -1071,7 +1086,7 @@ else print ""; - print ""; + print dol_fiche_end(); // Barre d'actions print '
    '; @@ -1082,35 +1097,51 @@ else { if ($user->rights->societe->contact->creer) { - print ''.$langs->trans('Modify').''; + print ''.$langs->trans('Modify').''; } if (! $object->user_id && $user->rights->user->user->creer) { - print ''.$langs->trans("CreateDolibarrLogin").''; + print ''.$langs->trans("CreateDolibarrLogin").''; } if ($user->rights->societe->contact->supprimer) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } // Activer if ($object->statut == 0 && $user->rights->societe->contact->creer) { - print ''.$langs->trans("Reactivate").''; + print ''.$langs->trans("Reactivate").''; } // Desactiver if ($object->statut == 1 && $user->rights->societe->contact->creer) { - print ''.$langs->trans("DisableUser").''; + print ''.$langs->trans("DisableUser").''; } } - print "

    "; + print ""; + print "
    "; if (! empty($conf->agenda->enabled)) { - print load_fiche_titre($langs->trans("TasksHistoryForThisContact"),'',''); + $objthirdparty=$objsoc; + $objcon=$object; + + $out=''; + $permok=$user->rights->agenda->myactions->create; + if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok) + { + $out.=''; + $out.=$langs->trans("AddAnAction").' '; + $out.=img_picto($langs->trans("AddAnAction"),'filenew'); + $out.=""; + } + + print load_fiche_titre($langs->trans("TasksHistoryForThisContact"),$out,''); print show_actions_todo($conf,$langs,$db,$objsoc,$object); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 878ee1fa956..cbc813968d1 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -185,7 +185,7 @@ class Contact extends CommonObject { // Call trigger $result=$this->call_trigger('CONTACT_CREATE',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers } @@ -220,7 +220,7 @@ class Contact extends CommonObject * @param string $action Current action for hookmanager * @return int <0 if KO, >0 if OK */ - function update($id, $user=0, $notrigger=0, $action='update') + function update($id, $user=null, $notrigger=0, $action='update') { global $conf, $langs, $hookmanager; @@ -283,6 +283,8 @@ class Contact extends CommonObject unset($this->state_code); unset($this->state); + $action='update'; + // Actions on extra fields (by external module or standard code) $hookmanager->initHooks(array('contactdao')); $parameters=array('socid'=>$this->id); @@ -304,7 +306,7 @@ class Contact extends CommonObject { // Call trigger $result=$this->call_trigger('CONTACT_MODIFY',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers } @@ -374,7 +376,7 @@ class Contact extends CommonObject $soc = new Societe($this->db); $soc->fetch($this->socid); - $info[$conf->global->LDAP_CONTACT_FIELD_COMPANY] = $soc->nom; + $info[$conf->global->LDAP_CONTACT_FIELD_COMPANY] = $soc->name; if ($soc->client == 1) $info["businessCategory"] = "Customers"; if ($soc->client == 2) $info["businessCategory"] = "Prospects"; if ($soc->fournisseur == 1) $info["businessCategory"] = "Suppliers"; @@ -427,7 +429,7 @@ class Contact extends CommonObject * @param User $user User asking to change alert or birthday * @return int <0 if KO, >=0 if OK */ - function update_perso($id, $user=0) + function update_perso($id, $user=null) { $error=0; $result=false; @@ -492,7 +494,7 @@ class Contact extends CommonObject * @param User $user Utilisateur (abonnes aux alertes) qui veut les alertes de ce contact * @return int -1 if KO, 0 if OK but not found, 1 if OK */ - function fetch($id, $user=0) + function fetch($id, $user=null) { global $langs; @@ -558,7 +560,7 @@ class Contact extends CommonObject $this->email = $obj->email; $this->jabberid = $obj->jabberid; - $this->skype = $obj->skype; + $this->skype = $obj->skype; $this->priv = $obj->priv; $this->mail = $obj->email; @@ -774,7 +776,7 @@ class Contact extends CommonObject { // Call trigger $result=$this->call_trigger('CONTACT_DELETE',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers } @@ -877,24 +879,25 @@ class Contact extends CommonObject * @param int $withpicto Include picto with link * @param string $option Where the link point to * @param int $maxlen Max length of + * @param string $moreparam Add more param into URL * @return string String with URL */ - function getNomUrl($withpicto=0,$option='',$maxlen=0) + function getNomUrl($withpicto=0,$option='',$maxlen=0,$moreparam='') { global $langs; $result=''; - $lien = ''; + $lien = ''; $lienfin=''; if ($option == 'xxx') { - $lien = ''; + $lien = ''; $lienfin=''; } - if ($withpicto) $result.=($lien.img_object($langs->trans("ShowContact").': '.$this->getFullName($langs),'contact').$lienfin.' '); + if ($withpicto) $result.=($lien.img_object($langs->trans("ShowContact").': '.$this->getFullName($langs), 'contact', 'class="classfortooltip"').$lienfin.' '); $result.=$lien.($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs)).$lienfin; return $result; } @@ -909,7 +912,7 @@ class Contact extends CommonObject global $langs; $langs->load("dict"); - $code=(! empty($this->civility_id)?$this->civility_id:(! empty($this->civility_id)?$this->civility_id:'')); + $code=(! empty($this->civility_id)?$this->civility_id:(! empty($this->civilite_id)?$this->civilite_id:'')); if (empty($code)) return ''; return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civility", "code", "label", $code); } @@ -1060,7 +1063,7 @@ class Contact extends CommonObject { // Call trigger $result=$this->call_trigger('CONTACT_ENABLEDISABLE',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers } diff --git a/htdocs/contact/exportimport.php b/htdocs/contact/exportimport.php index bcb3b9c2be0..e9e9c70966c 100644 --- a/htdocs/contact/exportimport.php +++ b/htdocs/contact/exportimport.php @@ -77,11 +77,11 @@ if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) $objsoc = new Societe($db); $objsoc->fetch($contact->socid); - print ''.$langs->trans("Company").''.$objsoc->getNomUrl(1).''; + print ''.$langs->trans("ThirdParty").''.$objsoc->getNomUrl(1).''; } else { - print ''.$langs->trans("Company").''; + print ''.$langs->trans("ThirdParty").''; print $langs->trans("ContactNotLinkedToCompany"); print ''; } diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php index fe3098eaa9a..170ed039904 100644 --- a/htdocs/contact/ldap.php +++ b/htdocs/contact/ldap.php @@ -105,11 +105,11 @@ if ($contact->socid > 0) $objsoc = new Societe($db); $objsoc->fetch($contact->socid); - print ''.$langs->trans("Company").''.$objsoc->getNomUrl(1).''; + print ''.$langs->trans("ThirdParty").''.$objsoc->getNomUrl(1).''; } else { - print ''.$langs->trans("Company").''; + print ''.$langs->trans("ThirdParty").''; print $langs->trans("ContactNotLinkedToCompany"); print ''; } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index d8e21b8cc4c..4413b721fc9 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -39,6 +39,7 @@ $contactid = GETPOST('id','int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'contact', $contactid,''); +$search_firstlast_only=GETPOST("search_firstlast_only"); $search_lastname=GETPOST("search_lastname"); $search_firstname=GETPOST("search_firstname"); $search_societe=GETPOST("search_societe"); @@ -51,8 +52,8 @@ $search_fax=GETPOST("search_fax"); $search_email=GETPOST("search_email"); $search_skype=GETPOST("search_skype"); $search_priv=GETPOST("search_priv"); -$search_categ = GETPOST("search_categ",'int'); -$search_status = GETPOST("search_status",'int'); +$search_categ=GETPOST("search_categ",'int'); +$search_status=GETPOST("search_status",'int'); if ($search_status=='') $search_status=1; // always display activ customer first @@ -74,15 +75,20 @@ $offset = $limit * $page; $langs->load("companies"); $titre = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses")); -if ($type == "c" || $type=="p") +if ($type == "p") +{ + $titre.=' ('.$langs->trans("ThirdPartyProspects").')'; + $urlfiche="card.php"; +} +if ($type == "c") { $titre.=' ('.$langs->trans("ThirdPartyCustomers").')'; - $urlfiche="fiche.php"; + $urlfiche="card.php"; } else if ($type == "f") { $titre.=' ('.$langs->trans("ThirdPartySuppliers").')'; - $urlfiche="fiche.php"; + $urlfiche="card.php"; } else if ($type == "o") { @@ -90,8 +96,9 @@ else if ($type == "o") $urlfiche=""; } -if (GETPOST('button_removefilter')) +if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter')) // Both tests are required to be compatible with all browsers { + $search_firstlast_only=""; $search_lastname=""; $search_firstname=""; $search_societe=""; @@ -154,6 +161,9 @@ else if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ; if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; +if ($search_firstlast_only) { + $sql .= natural_search(array('p.lastname','p.firstname'), $search_firstlast_only); +} if ($search_lastname) { // filter on lastname $sql .= natural_search('p.lastname', $search_lastname); } @@ -213,7 +223,7 @@ else if ($type == "p") // filtre sur type } if ($sall) { - $sql .= natural_search(array('p.lastname', 'p.firstname', 'p.email'), $sall); + $sql .= natural_search(array('p.lastname', 'p.firstname', 'p.email', 's.nom'), $sall); } if (! empty($socid)) { @@ -277,9 +287,12 @@ if ($result) if ($sall) { - print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname")." ".$langs->trans("or")." ".$langs->trans("EMail")."): ".$sall; + print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("ThirdParty")." ".$langs->trans("or")." ".$langs->trans("EMail")."): ".$sall; } - + if ($search_firstlast_only) + { + print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname")."): ".$search_firstlast_only; + } print ''; // Ligne des titres @@ -287,9 +300,9 @@ if ($result) print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"p.lastname", $begin, $param, '', $sortfield,$sortorder); print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"p.firstname", $begin, $param, '', $sortfield,$sortorder); print_liste_field_titre($langs->trans("PostOrFunction"),$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder); - if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom", $begin, $param, '', $sortfield,$sortorder); + if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom", $begin, $param, '', $sortfield,$sortorder); print_liste_field_titre($langs->trans("Phone"),$_SERVER["PHP_SELF"],"p.phone", $begin, $param, '', $sortfield,$sortorder); - print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mob", $begin, $param, '', $sortfield,$sortorder); + print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mobile", $begin, $param, '', $sortfield,$sortorder); print_liste_field_titre($langs->trans("Fax"),$_SERVER["PHP_SELF"],"p.fax", $begin, $param, '', $sortfield,$sortorder); print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email", $begin, $param, '', $sortfield,$sortorder); if (! empty($conf->skype->enabled)) { print_liste_field_titre($langs->trans("Skype"),$_SERVER["PHP_SELF"],"p.skype", $begin, $param, '', $sortfield,$sortorder); } @@ -343,9 +356,8 @@ if ($result) print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); print ''; print ''; print ''; @@ -378,7 +390,7 @@ if ($result) print ''; + print ''; } else { - print ''; } diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 92ba03e9861..173ccbcb265 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -111,11 +111,11 @@ if ($action == 'edit') $objsoc = new Societe($db); $objsoc->fetch($object->socid); - print ''; + print ''; } else { - print ''; } @@ -145,11 +145,11 @@ if ($action == 'edit') print "
    '; - print ''; - print '  '; - print ''; + print ''; + print ''; print '
    '; if ($obj->socid) { - print ''; + print ''; print img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->name,20).''; } else @@ -410,7 +422,7 @@ if ($result) // Links Add action and Export vcard print ''; - print ''.img_object($langs->trans("AddAction"),"action").''; + print ''.img_object($langs->trans("AddAction"),"action").''; print '   '; print ''; print img_picto($langs->trans("VCard"),'vcard.png').' '; diff --git a/htdocs/contact/note.php b/htdocs/contact/note.php index 73b0f513db9..ab8101dd739 100644 --- a/htdocs/contact/note.php +++ b/htdocs/contact/note.php @@ -98,12 +98,12 @@ if ($id > 0) $objsoc = new Societe($db); $objsoc->fetch($object->socid); - print '
    '.$langs->trans("Company").''.$objsoc->getNomUrl(1).'
    '.$langs->trans("ThirdParty").''.$objsoc->getNomUrl(1).'
    '.$langs->trans("Company").''; + print '
    '.$langs->trans("ThirdParty").''; print $langs->trans("ContactNotLinkedToCompany"); print '
    '.$langs->trans("Company").''.$objsoc->getNomUrl(1).'
    '.$langs->trans("ThirdParty").''.$objsoc->getNomUrl(1).'
    '.$langs->trans("Company").''; + print '
    '.$langs->trans("ThirdParty").''; print $langs->trans("ContactNotLinkedToCompany"); print '

    "; - print '
    '; + print '
    '; print ''; - print '   '; + print '     '; print ''; - print '
    '; + print ''; print ""; } @@ -179,12 +179,12 @@ else $objsoc = new Societe($db); $objsoc->fetch($object->socid); - print ''.$langs->trans("Company").''.$objsoc->getNomUrl(1).''; + print ''.$langs->trans("ThirdParty").''.$objsoc->getNomUrl(1).''; } else { - print ''.$langs->trans("Company").''; + print ''.$langs->trans("ThirdParty").''; print $langs->trans("ContactNotLinkedToCompany"); print ''; } diff --git a/htdocs/contact/vcard.php b/htdocs/contact/vcard.php index e78c298c541..77abf31ac89 100644 --- a/htdocs/contact/vcard.php +++ b/htdocs/contact/vcard.php @@ -75,7 +75,7 @@ if ($company->id) if (! $contact->zip) $v->setAddress("", "", $company->address, $company->town, "", $company->zip, $company->country_code, "WORK;POSTAL"); if ($company->email != $contact->email) $v->setEmail($company->email,'internet'); // Si contact lie a un tiers non de type "particulier" - if ($contact->typent_code != 'TE_PRIVATE') $v->setOrg($company->nom); + if ($contact->typent_code != 'TE_PRIVATE') $v->setOrg($company->name); } // Personal informations diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/card.php similarity index 91% rename from htdocs/contrat/fiche.php rename to htdocs/contrat/card.php index 165e8ae3c69..4770ff10e50 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/card.php @@ -1,12 +1,13 @@ - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2014 Marcos García * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,7 +24,7 @@ */ /** - * \file htdocs/contrat/fiche.php + * \file htdocs/contrat/card.php * \ingroup contrat * \brief Page of a contract */ @@ -35,6 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php'; require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/contract/modules_contract.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; if (! empty($conf->produit->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (! empty($conf->projet->enabled)) { @@ -65,11 +67,20 @@ $result=restrictedArea($user,'contrat',$id); $usehm=(! empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:0); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('contractcard')); +$hookmanager->initHooks(array('contractcard','globalcard')); $object = new Contrat($db); $extrafields = new ExtraFields($db); +// Load object +if ($id > 0 || ! empty($ref)) { + $ret = $object->fetch($id, $ref); + if ($ret > 0) + $ret = $object->fetch_thirdparty(); + if ($ret < 0) + dol_print_error('', $object->error); +} + // fetch optionals attributes and labels $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); @@ -84,7 +95,6 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, if ($action == 'confirm_active' && $confirm == 'yes' && $user->rights->contrat->activer) { - $object->fetch($id); $result = $object->active_line($user, GETPOST('ligne'), GETPOST('date'), GETPOST('dateend'), GETPOST('comment')); if ($result > 0) @@ -106,7 +116,6 @@ else if ($action == 'confirm_closeline' && $confirm == 'yes' && $user->rights->c } if (! $error) { - $object->fetch($id); $result = $object->close_line($user, GETPOST('ligne'), GETPOST('dateend'), urldecode(GETPOST('comment'))); if ($result > 0) { @@ -207,7 +216,7 @@ if ($action == 'add' && $user->rights->contrat->creer) $object->fk_project = GETPOST('projectid','int'); $object->remise_percent = GETPOST('remise_percent','alpha'); $object->ref = GETPOST('ref','alpha'); - $object->ref_customer = GETPOST('ref_customer','alpha'); + $object->ref_supplier = GETPOST('ref_supplier','alpha'); // If creation from another object of another module (Example: origin=propal, originid=1) if ($_POST['origin'] && $_POST['originid']) @@ -265,7 +274,7 @@ if ($action == 'add' && $user->rights->contrat->creer) { $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); - if ($product_type == 1) { //only services // TODO Exclude also deee + if ($product_type == 1 || (! empty($conf->global->CONTRACT_SUPPORT_PRODUCTS) && in_array($product_type, array(0,1)))) { // TODO Exclude also deee // service prédéfini if ($lines[$i]->fk_product > 0) { @@ -363,7 +372,6 @@ if ($action == 'add' && $user->rights->contrat->creer) else if ($action == 'classin' && $user->rights->contrat->creer) { - $object->fetch($id); $object->setProject(GETPOST('projectid')); } @@ -402,14 +410,6 @@ else if ($action == 'addline' && $user->rights->contrat->creer) if (! $error) { - $ret=$object->fetch($id); - if ($ret < 0) - { - setEventMessage($object->error,'errors'); - exit; - } - $ret=$object->fetch_thirdparty(); - // Clean parameters $date_start=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); $date_end=dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); @@ -526,23 +526,22 @@ else if ($action == 'addline' && $user->rights->contrat->creer) if ($result > 0) { - /* - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - $ret=$object->fetch($id); // Reload to get new records - contrat_pdf_create($db, $object->id, $object->modelpdf, $outputlangs); - } - */ + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + } unset($_POST ['prod_entry_mode']); @@ -584,14 +583,6 @@ else if ($action == 'addline' && $user->rights->contrat->creer) else if ($action == 'updateligne' && $user->rights->contrat->creer && ! GETPOST('cancel')) { - $ret=$object->fetch($id); - if ($ret < 0) - { - dol_print_error($db,$object->error); - exit; - } - - $object->fetch_thirdparty(); $objectline = new ContratLigne($db); if ($objectline->fetch(GETPOST('elrowid'))) { @@ -647,7 +638,6 @@ else if ($action == 'updateligne' && $user->rights->contrat->creer && ! GETPOST( else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->contrat->creer) { - $object->fetch($id); $result = $object->deleteline(GETPOST('lineid'),$user); if ($result >= 0) @@ -663,21 +653,17 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights-> else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->contrat->creer) { - $object->fetch($id); $result = $object->validate($user); } // Close all lines else if ($action == 'confirm_close' && $confirm == 'yes' && $user->rights->contrat->creer) { - $object->fetch($id); $result = $object->cloture($user); } else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->contrat->supprimer) { - $object->fetch($id); - $object->fetch_thirdparty(); $result=$object->delete($user); if ($result >= 0) { @@ -714,7 +700,6 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra } } else if ($action == 'update_extras') { // Fill array 'array_options' with data from update form - $object->fetch($id); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); if ($ret < 0) @@ -733,26 +718,28 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra $action = 'edit_extras'; setEventMessage($object->error,'errors'); } -} elseif ($action=='setref_customer') { - $result = $object->fetch($id); - if ($result < 0) { - setEventMessage($object->errors,'errors'); - } - $object->ref_customer=GETPOST('ref_customer','alpha'); +} elseif ($action=='setref_supplier') { - $result = $object->update($user); - if ($result < 0) { - setEventMessage($object->errors,'errors'); - $action='editref_customer'; - } else { - header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); - exit; + $cancelbutton = GETPOST('cancel'); + + if (!$cancelbutton) { + + $result = $object->fetch($id); + if ($result < 0) { + setEventMessage($object->errors, 'errors'); + } + $object->ref_supplier = GETPOST('ref_supplier', 'alpha'); + + $result = $object->update($user); + if ($result < 0) { + setEventMessage($object->errors, 'errors'); + $action = 'editref_supplier'; + } else { + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } } } elseif ($action=='setref') { - $result = $object->fetch($id); - if ($result < 0) { - setEventMessage($object->errors,'errors'); - } $object->ref=GETPOST('ref','alpha'); $result = $object->update($user); @@ -765,17 +752,53 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra } } +// Generation doc (depuis lien ou depuis cartouche doc) +else if ($action == 'builddoc' && $user->rights->contrat->creer) { + if (GETPOST('model')) { + $object->setDocModel($user, GETPOST('model')); + } + + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) { + $outputlangs = new Translate("", $conf); + $newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret = $object->fetch($id); // Reload to get new records + $result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + + if ($result <= 0) { + dol_print_error($db, $result); + exit(); + } else { + header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc')); + exit(); + } +} + +// Remove file in doc form +else if ($action == 'remove_file' && $user->rights->contrat->creer) { + if ($object->id > 0) { + require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; + + $langs->load("other"); + $upload_dir = $conf->contrat->dir_output; + $file = $upload_dir . '/' . GETPOST('file'); + $ret = dol_delete_file($file, 0, 0, 0, $object); + if ($ret) + setEventMessage($langs->trans("FileWasRemoved", GETPOST('file'))); + else + setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors'); + } +} + if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->contrat->creer) { if ($action == 'addcontact') { - $result = $object->fetch($id); - - if ($result > 0 && $id > 0) - { - $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); - $result = $object->add_contact($contactid, GETPOST('type'), GETPOST('source')); - } + $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); + $result = $object->add_contact($contactid, GETPOST('type'), GETPOST('source')); if ($result >= 0) { @@ -799,20 +822,12 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->contrat- // bascule du statut d'un contact else if ($action == 'swapstatut') { - if ($object->fetch($id)) - { - $result=$object->swapContactStatus(GETPOST('ligne')); - } - else - { - setEventMessage($object->error,'errors'); - } + $result=$object->swapContactStatus(GETPOST('ligne')); } // Efface un contact else if ($action == 'deletecontact') { - $object->fetch($id); $result = $object->delete_contact(GETPOST('lineid')); if ($result >= 0) @@ -834,11 +849,12 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->contrat- llxHeader('',$langs->trans("ContractCard"),"Contrat"); $form = new Form($db); +$formfile = new FormFile($db); $objectlignestatic=new ContratLigne($db); // Load object modContract -$module=(! empty($conf->global->CONTRACT_ADDON)?$conf->global->CONTRACT_ADDON:'mod_contract_olive'); +$module=(! empty($conf->global->CONTRACT_ADDON)?$conf->global->CONTRACT_ADDON:'mod_contract_serpis'); if (substr($module, 0, 13) == 'mod_contract_' && substr($module, -3) == 'php') { $module = substr($module, 0, dol_strlen($module)-4); @@ -926,9 +942,9 @@ if ($action == 'create') } print ''.$langs->trans('Ref').''.$tmpcode.''; - // Ref Int - print ''.$langs->trans('RefCustomer').''; - print ''; + // Ref supplier + print ''.$langs->trans('RefSupplier').''; + print ''; // Customer print ''; @@ -1011,13 +1027,18 @@ if ($action == 'create') print "\n"; + print '
    '; + if (is_object($objectsrc)) { print ''; print ''; - } - print '
    '; + if (empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) + { + print '
    '.$langs->trans("Note").': '.$langs->trans("OnlyLinesWithTypeServiceAreUsed"); + } + } print "\n"; @@ -1032,14 +1053,12 @@ else { $now=dol_now(); - if ($id > 0 || ! empty($ref)) + if ($object->id > 0) { - $result=$object->fetch($id,$ref); - if ($result < 0) dol_print_error($db,$object->error); + $object->fetch_thirdparty(); + $result=$object->fetch_lines(); // This also init $this->nbofserviceswait, $this->nbofservicesopened, $this->nbofservicesexpired=, $this->nbofservicesclosed if ($result < 0) dol_print_error($db,$object->error); - $result=$object->fetch_thirdparty(); - if ($result < 0) dol_print_error($db,$object->error); $nbofservices=count($object->lines); @@ -1110,7 +1129,7 @@ else print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref du contrat if (!empty($modCodeContract->code_auto)) { @@ -1129,9 +1148,9 @@ else print ''; print ''; print ''; @@ -1183,52 +1202,8 @@ else } // Other attributes - $parameters=array('colspan' => ' colspan="3"'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - - $res = $object->fetch_optionals($object->id, $extralabels); - if (empty($reshook) && ! empty($extrafields->attribute_label)) { - foreach ($extrafields->attribute_label as $key => $label) { - if ($action == 'edit_extras') { - $value = (isset($_POST ["options_" . $key]) ? $_POST ["options_" . $key] : $object->array_options ["options_" . $key]); - } else { - $value = $object->array_options ["options_" . $key]; - } - if ($extrafields->attribute_type [$key] == 'separate') { - print $extrafields->showSeparator($key); - } else { - print 'attribute_required [$key])) - print ' class="fieldrequired"'; - print '>' . $label . '' . "\n"; - } - } - } - - - + $cols = 3; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; print "
    '; - print $form->editfieldkey("RefCustomer",'ref_customer',$object->ref_customer,$object,$user->rights->contrat->creer); + print $form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); print ''; - print $form->editfieldval("RefCustomer",'ref_customer',$object->ref_customer,$object,$user->rights->contrat->creer); + print $form->editfieldval("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); print '
    '; - // Convert date into timestamp format - if (in_array($extrafields->attribute_type [$key], array('date','datetime'))) { - $value = isset($_POST ["options_" . $key]) ? dol_mktime($_POST ["options_" . $key . "hour"], $_POST ["options_" . $key . "min"], 0, $_POST ["options_" . $key . "month"], $_POST ["options_" . $key . "day"], $_POST ["options_" . $key . "year"]) : $db->jdate($object->array_options ['options_' . $key]); - } - - if ($action == 'edit_extras' && $user->rights->commande->creer && GETPOST('attribute') == $key) { - print '
    '; - print ''; - print ''; - print ''; - print ''; - - print $extrafields->showInputField($key, $value); - - print ''; - print '
    '; - } else { - print $extrafields->showOutputField($key, $value); - if ($object->statut == 0 && $user->rights->commande->creer) - print '' . img_picto('', 'edit') . ' ' . $langs->trans('Modify') . ''; - } - print '
    "; @@ -1261,8 +1236,10 @@ else /* * Lines of contracts */ - $productstatic=new Product($db); + if ($conf->product->enabled) { + $productstatic=new Product($db); + } $usemargins=0; if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1; @@ -1329,7 +1306,8 @@ else $productstatic->ref=$objp->label; print $productstatic->getNomUrl(0,'',16); } - if ($objp->description) print '
    '.dol_nl2br($objp->description); + if (! empty($conf->global->PRODUIT_DESC_IN_FORM) and $objp->description) + print '
    '.dol_nl2br($objp->description); print ''; } else @@ -1703,7 +1681,7 @@ else } // Form to add new line - if ($user->rights->contrat->creer && ($object->statut >= 0)) + if ($user->rights->contrat->creer && ($object->statut == 0)) { $dateSelector=1; @@ -1752,6 +1730,9 @@ else if ($user->societe_id == 0) { print '
    '; + + $parameters=array(); + $reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if ($object->statut == 0 && $nbofservices) { @@ -1793,16 +1774,29 @@ else print "
    "; } + print '
    '; - print '
    '; + /* + * Documents generes + */ + $filename = dol_sanitizeFileName($object->ref); + $filedir = $conf->contrat->dir_output . "/" . dol_sanitizeFileName($object->ref); + $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; + $genallowed = $user->rights->contrat->creer; + $delallowed = $user->rights->contrat->supprimer; + + $var = true; + + $somethingshown = $formfile->show_documents('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang); /* * Linked object block */ $somethingshown=$object->showLinkedObjectBlock(); - print ''; - print '
    '; + print '
    '; + + print '
    '; } } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index b4cf7c20322..bbba602fa02 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1,12 +1,13 @@ * Copyright (C) 2004-2012 Destailleur Laurent - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand * Copyright (C) 2010-2014 Juanjo Menent - * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Christophe Battarel + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2014 Marcos García * * 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 @@ -28,9 +29,9 @@ * \brief File of class to manage contracts */ -require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; -require_once(DOL_DOCUMENT_ROOT ."/margin/lib/margins.lib.php"); +require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/margin/lib/margins.lib.php'; /** * Class to manage contracts @@ -41,34 +42,151 @@ class Contrat extends CommonObject public $table_element='contrat'; public $table_element_line='contratdet'; public $fk_element='fk_contrat'; + protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + /** + * {@inheritdoc} + */ + protected $table_ref_field = 'ref'; + + /** + * Id of the contract + * @var int + */ var $id; + + /** + * Reference of the contract + * @var string + */ var $ref; + + /** + * External reference of the contract. + * Used by 3rd party services + * @var string + */ var $ref_ext; - var $ref_customer; + + /** + * Supplier reference of the contract + * @var string + */ + var $ref_supplier; + + /** + * Client id linked to the contract + * @var int + */ var $socid; var $societe; // Objet societe + + /** + * Status of the contract + * @var int + */ var $statut=0; // 0=Draft, var $product; + /** + * TODO: Which is the correct one? + * Author of the contract + * @var + */ var $user_author; + + /** + * TODO: Which is the correct one? + * Author of the contract + * @var User + */ + public $user_creation; + + /** + * TODO: Which is the correct one? + * Author of the contract + * @var int + */ + public $fk_user_author; + + /** + * TODO: Which is the correct one? + * Author of the contract + * @var int + */ + public $user_author_id; + + /** + * @var User + */ + public $user_cloture; + + /** + * Date of creation + * @var int + */ var $date_creation; + + /** + * Date of last modification + * Not filled until you call ->info() + * @var int + */ + public $date_modification; + + /** + * Date of validation + * @var int + */ var $date_validation; + /** + * Date when contract was signed + * @var int + */ var $date_contrat; + + /** + * Date of contract closure + * @var int + * @deprecated we close contract lines, not a contract + */ var $date_cloture; var $commercial_signature_id; var $commercial_suivi_id; - var $note; // deprecated - var $note_private; - var $note_public; + /** + * @deprecated Use note_private or note_public instead + */ + var $note; + /** + * Private note + * @var string + */ + var $note_private; + + /** + * Public note + * @var string + */ + var $note_public; + var $modelpdf; + + /** + * @deprecated Use fk_project instead + */ var $fk_projet; + public $fk_project; + var $extraparams=array(); + /** + * Contract lines + * @var ContratLigne[] + */ var $lines=array(); @@ -85,7 +203,7 @@ class Contrat extends CommonObject /** * Return next contract ref * - * @param Societe $soc objet society + * @param Societe $soc Thirdparty object * @return string free reference for contract */ function getNextNumRef($soc) @@ -135,8 +253,8 @@ class Contrat extends CommonObject * * @param User $user Objet User qui active le contrat * @param int $line_id Id de la ligne de detail a activer - * @param timestamp $date Date d'ouverture - * @param timestamp $date_end Date fin prevue + * @param int $date Date d'ouverture + * @param int|string $date_end Date fin prevue * @param string $comment A comment typed by user * @return int <0 if KO, >0 if OK */ @@ -182,7 +300,7 @@ class Contrat extends CommonObject * * @param User $user Objet User qui active le contrat * @param int $line_id Id de la ligne de detail a activer - * @param timestamp $date_end Date fin + * @param int $date_end Date fin * @param string $comment A comment typed by user * @return int <0 if KO, >0 if OK */ @@ -275,9 +393,10 @@ class Contrat extends CommonObject * * @param User $user Objet User * @param string $force_number Reference to force on contract (not implemented yet) + * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers * @return int <0 if KO, >0 if OK */ - function validate($user, $force_number='') + function validate($user, $force_number='', $notrigger=0) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; global $langs, $conf; @@ -304,6 +423,7 @@ class Contrat extends CommonObject { $num = $this->ref; } + $this->newref = $num; if ($num) { @@ -320,30 +440,45 @@ class Contrat extends CommonObject $this->error=$this->db->lasterror(); } + // Trigger calls + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('CONTRACT_VALIDATE',$user); + if ($result < 0) { $error++; } + // End call triggers + } + if (! $error) { - $this->oldref = ''; + $this->oldref = $this->ref; // Rename directory if dir was a temporary ref if (preg_match('/^[\(]?PROV/i', $this->ref)) { // Rename of object directory ($this->ref = old ref, $num = new ref) // to not lose the linked files - $facref = dol_sanitizeFileName($this->ref); - $snumfa = dol_sanitizeFileName($num); - $dirsource = $conf->contract->dir_output.'/'.$facref; - $dirdest = $conf->contract->dir_output.'/'.$snumfa; + $oldref = dol_sanitizeFileName($this->ref); + $newref = dol_sanitizeFileName($num); + $dirsource = $conf->contract->dir_output.'/'.$oldref; + $dirdest = $conf->contract->dir_output.'/'.$newref; if (file_exists($dirsource)) { dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest); if (@rename($dirsource, $dirdest)) { - $this->oldref = $facref; - dol_syslog("Rename ok"); - // Deleting old PDF in new rep - dol_delete_file($conf->contract->dir_output.'/'.$snumfa.'/'.$facref.'*.*'); + // Rename docs starting with $oldref with $newref + $listoffiles=dol_dir_list($conf->contract->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/')); + foreach($listoffiles as $fileentry) + { + $dirsource=$fileentry['name']; + $dirdest=preg_replace('/^'.preg_quote($oldref,'/').'/',$newref, $dirsource); + $dirsource=$fileentry['path'].'/'.$dirsource; + $dirdest=$fileentry['path'].'/'.$dirdest; + @rename($dirsource, $dirdest); + } } } } @@ -357,15 +492,6 @@ class Contrat extends CommonObject $this->brouillon=0; $this->date_validation=$now; } - - // Trigger calls - if (! $error) - { - // Call trigger - $result=$this->call_trigger('CONTRACT_VALIDATE',$user); - if ($result < 0) { $error++; } - // End call triggers - } } else { @@ -400,8 +526,8 @@ class Contrat extends CommonObject $sql.= " fk_user_author,"; $sql.= " fk_projet,"; $sql.= " fk_commercial_signature, fk_commercial_suivi,"; - $sql.= " note_private, note_public, extraparams"; - $sql.= " ,ref_customer"; + $sql.= " note_private, note_public, model_pdf, extraparams"; + $sql.= " ,ref_supplier"; $sql.= " ,ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat"; if ($ref) @@ -421,11 +547,13 @@ class Contrat extends CommonObject { $this->id = $result["rowid"]; $this->ref = (!isset($result["ref"]) || !$result["ref"]) ? $result["rowid"] : $result["ref"]; - $this->ref_customer = $result["ref_customer"]; + $this->ref_supplier = $result["ref_supplier"]; $this->ref_ext = $result["ref_ext"]; $this->statut = $result["statut"]; $this->mise_en_service = $this->db->jdate($result["datemise"]); + $this->date_contrat = $this->db->jdate($result["datecontrat"]); + $this->date_creation = $this->db->jdate($result["datecontrat"]); $this->user_author_id = $result["fk_user_author"]; @@ -435,6 +563,7 @@ class Contrat extends CommonObject $this->note = $result["note_private"]; // deprecated $this->note_private = $result["note_private"]; $this->note_public = $result["note_public"]; + $this->modelpdf = $result["model_pdf"]; $this->fk_projet = $result["fk_projet"]; // deprecated $this->fk_project = $result["fk_projet"]; @@ -453,6 +582,18 @@ class Contrat extends CommonObject $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); $this->fetch_optionals($this->id,$extralabels); + /* + * Lines + */ + + $this->lines = array(); + + $result=$this->fetch_lines(); + if ($result < 0) + { + $this->error=$this->db->error(); + return -3; + } return $this->id; } @@ -475,7 +616,7 @@ class Contrat extends CommonObject /** * Load lignes array into this->lines * - * @return Array Return array of contract lines + * @return ContratLigne[] Return array of contract lines */ function fetch_lines() { @@ -723,7 +864,7 @@ class Contrat extends CommonObject // Insert contract $sql = "INSERT INTO ".MAIN_DB_PREFIX."contrat (datec, fk_soc, fk_user_author, date_contrat,"; $sql.= " fk_commercial_signature, fk_commercial_suivi, fk_projet,"; - $sql.= " ref, entity, note_private, note_public, ref_customer, ref_ext)"; + $sql.= " ref, entity, note_private, note_public, ref_supplier, ref_ext)"; $sql.= " VALUES ('".$this->db->idate($now)."',".$this->socid.",".$user->id; $sql.= ", '".$this->db->idate($this->date_contrat)."'"; $sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL"); @@ -733,7 +874,7 @@ class Contrat extends CommonObject $sql.= ", ".$conf->entity; $sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL"); $sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL"); - $sql.= ", ".(!empty($this->ref_customer)?("'".$this->db->escape($this->ref_customer)."'"):"NULL"); + $sql.= ", ".(!empty($this->ref_supplier)?("'".$this->db->escape($this->ref_supplier)."'"):"NULL"); $sql.= ", ".(!empty($this->ref_ext)?("'".$this->db->escape($this->ref_ext)."'"):"NULL"); $sql.= ")"; $resql=$this->db->query($sql); @@ -743,7 +884,7 @@ class Contrat extends CommonObject $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."contrat"); - + // Load object modContract $module=(! empty($conf->global->CONTRACT_ADDON)?$conf->global->CONTRACT_ADDON:'mod_contract_olive'); if (substr($module, 0, 13) == 'mod_contract_' && substr($module, -3) == 'php') @@ -977,7 +1118,7 @@ class Contrat extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; $error=0; @@ -985,7 +1126,7 @@ class Contrat extends CommonObject // Clean parameters if (isset($this->ref)) $this->ref=trim($this->ref); - if (isset($this->ref_customer)) $this->ref_customer=trim($this->ref_customer); + if (isset($this->ref_supplier)) $this->ref_supplier=trim($this->ref_supplier); if (isset($this->ref_ext)) $this->ref_ext=trim($this->ref_ext); if (isset($this->entity)) $this->entity=trim($this->entity); if (isset($this->statut)) $this->statut=trim($this->statut); @@ -1009,7 +1150,7 @@ class Contrat extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."contrat SET"; $sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").","; - $sql.= " ref_customer=".(isset($this->ref_customer)?"'".$this->db->escape($this->ref_customer)."'":"null").","; + $sql.= " ref_supplier=".(isset($this->ref_supplier)?"'".$this->db->escape($this->ref_supplier)."'":"null").","; $sql.= " ref_ext=".(isset($this->ref_ext)?"'".$this->db->escape($this->ref_ext)."'":"null").","; $sql.= " entity=".$conf->entity.","; $sql.= " date_contrat=".(dol_strlen($this->date_contrat)!=0 ? "'".$this->db->idate($this->date_contrat)."'" : 'null').","; @@ -1080,16 +1221,16 @@ class Contrat extends CommonObject * @param float $txlocaltax2 Local tax 2 rate * @param int $fk_product Id produit * @param float $remise_percent Pourcentage de remise de la ligne - * @param timestamp $date_start Date de debut prevue - * @param timestamp $date_end Date de fin prevue - * @param float $price_base_type HT or TTC + * @param int $date_start Date de debut prevue + * @param int $date_end Date de fin prevue + * @param string $price_base_type HT or TTC * @param float $pu_ttc Prix unitaire TTC * @param int $info_bits Bits de type de lignes * @param int $fk_fournprice Fourn price id * @param int $pa_ht Buying price HT * @return int <0 si erreur, >0 si ok */ - function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0) + function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0) { global $user, $langs, $conf, $mysoc; @@ -1237,20 +1378,20 @@ class Contrat extends CommonObject * @param float $pu Prix unitaire * @param int $qty Quantite * @param float $remise_percent Pourcentage de remise de la ligne - * @param timestamp $date_start Date de debut prevue - * @param timestamp $date_end Date de fin prevue + * @param int $date_start Date de debut prevue + * @param int $date_end Date de fin prevue * @param float $tvatx Taux TVA * @param float $localtax1tx Local tax 1 rate * @param float $localtax2tx Local tax 2 rate - * @param timestamp $date_debut_reel Date de debut reelle - * @param timestamp $date_fin_reel Date de fin reelle - * @param float $price_base_type HT or TTC + * @param int|string $date_debut_reel Date de debut reelle + * @param int|string $date_fin_reel Date de fin reelle + * @param string $price_base_type HT or TTC * @param int $info_bits Bits de type de lignes * @param int $fk_fournprice Fourn price id * @param int $pa_ht Buying price HT * @return int < 0 si erreur, > 0 si ok */ - function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0, $localtax2tx=0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0) + function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0.0, $localtax2tx=0.0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0) { global $user, $conf, $langs, $mysoc; @@ -1287,7 +1428,7 @@ class Contrat extends CommonObject $localtaxes_type=getLocalTaxesFromRate($tvatx, 0, $this->societe, $mysoc); - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtaxtx1, $txlocaltaxtx2, 0, $price_base_type, $info_bits, 1, '', $localtaxes_type); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtax1tx, $localtax2tx, 0, $price_base_type, $info_bits, 1, '', $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -1300,19 +1441,19 @@ class Contrat extends CommonObject // TODO A virer // Anciens indicateurs: $price, $remise (a ne plus utiliser) $remise = 0; - $price = price2num(round($pu_ht, 2)); + $price = price2num(round($pu, 2)); if (dol_strlen($remise_percent) > 0) { - $remise = round(($pu_ht * $remise_percent / 100), 2); - $price = $pu_ht - $remise; + $remise = round(($pu * $remise_percent / 100), 2); + $price = $pu - $remise; } if (empty($pa_ht)) $pa_ht=0; // si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente if ($pa_ht == 0) { - if ($pu_ht > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) - $pa_ht = $pu_ht * (1 - $remise_percent / 100); + if ($pu > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) + $pa_ht = $pu * (1 - $remise_percent / 100); } $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet set description='".$this->db->escape($desc)."'"; @@ -1428,6 +1569,7 @@ class Contrat extends CommonObject * * @param User $user Object user * @return int <0 if KO, >0 if OK + * @deprecated This function will never be used. Status of a contract is status of its lines. */ function update_statut($user) { @@ -1531,14 +1673,14 @@ class Contrat extends CommonObject $result=''; - $lien = ''; + $lien = ''; $lienfin=''; $picto='contract'; $label=$langs->trans("ShowContract").': '.$this->ref; - if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); + if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$lien.($maxlength?dol_trunc($this->ref,$maxlength):$this->ref).$lienfin; return $result; @@ -1845,7 +1987,6 @@ class Contrat extends CommonObject while ($xnbp < $nbp) { $line=new ContratLigne($this->db); - $line->desc=$langs->trans("Description")." ".$xnbp; $line->qty=1; $line->subprice=100; $line->price=100; @@ -1865,6 +2006,40 @@ class Contrat extends CommonObject $this->total_tva = $xnbp*19.6; $this->total_ttc = $xnbp*119.6; } + + /** + * Create a document onto disk according to template module. + * + * @param string $modele Force model to use ('' to not force) + * @param Translate $outputlangs Object langs to use for output + * @param int $hidedetails Hide details of lines + * @param int $hidedesc Hide description + * @param int $hideref Hide ref + * @return int 0 if KO, 1 if OK + */ + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + { + global $conf,$user,$langs; + + $langs->load("contracts"); + + // Positionne le modele sur le nom du modele a utiliser + if (! dol_strlen($modele)) + { + if (! empty($conf->global->CONTRACT_ADDON_PDF)) + { + $modele = $conf->global->CONTRACT_ADDON_PDF; + } + else + { + $modele = 'strato'; + } + } + + $modelpath = "core/modules/contract/doc/"; + + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + } } @@ -1881,6 +2056,13 @@ class ContratLigne extends CommonObject var $fk_product; var $statut; // 0 inactive, 4 active, 5 closed var $label; + + /** + * @var string + * @deprecated Use $label instead + */ + public $libelle; + var $description; var $date_commande; var $date_ouverture_prevue; // date start planned @@ -1898,6 +2080,13 @@ class ContratLigne extends CommonObject var $fk_remise_except; var $subprice; // Unit price HT + + /** + * @var float + * @deprecated Use $price_ht instead + */ + public $price; + var $price_ht; var $total_ht; @@ -2013,14 +2202,14 @@ class ContratLigne extends CommonObject $result=''; - $lien = ''; + $lien = ''; $lienfin=''; $picto='contract'; $label=$langs->trans("ShowContractOfService").': '.$this->label; - if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); + if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$lien.$this->label.$lienfin; return $result; @@ -2280,7 +2469,7 @@ class ContratLigne extends CommonObject $sql.= ",total_localtax1=".price2num($this->total_localtax1,'MT').""; $sql.= ",total_localtax2=".price2num($this->total_localtax2,'MT').""; $sql.= ",total_ttc=".price2num($this->total_ttc,'MT').""; - $sql.= " WHERE rowid = ".$this->rowid; + $sql.= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::update_total", LOG_DEBUG); @@ -2340,5 +2529,3 @@ class ContratLigne extends CommonObject } } - - diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index 7156b69777c..1528e472cbe 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -139,7 +139,7 @@ if ($id > 0 || ! empty($ref)) */ print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Reference du contrat print ''; - $colspan='0'; - } - else - { - $out .= ''; - } - // Convert date into timestamp format - if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) - { - $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->db->jdate($this->array_options['options_'.$key]); - } - - if($extrafields->attribute_required[$key]) - $label = ''.$label.''; - - $out .= ''; - $out .=''; - - switch($mode) { - case "view": - $out .= $extrafields->showOutputField($key,$value); - break; - case "edit": - $out .= $extrafields->showInputField($key,$value,'',$keyprefix); - break; - } - - $out .= ''."\n"; - - if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) $out .= ''; - else $out .= ''; - $e++; - } - } - $out .= "\n"; - $out .= ' '; - $out .= ' - '; - } - return $out; - } - - /** * Function to check if an object is used by others. * Check is done into this->childtables. There is no check into llx_element_element. @@ -2794,14 +2572,14 @@ abstract class CommonObject if (! empty($conf->margin->enabled) && empty($user->societe_id)) { if ($conf->global->MARGIN_TYPE == "1") - print ''; + print ''; else - print ''; + print ''; if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) - print ''; + print ''; if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) - print ''; + print ''; } // Total HT @@ -2838,6 +2616,11 @@ abstract class CommonObject $parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline); $reshook=$hookmanager->executeHooks('printObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks } + else + { + $parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline); + $reshook=$hookmanager->executeHooks('printObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + } } else { @@ -3276,25 +3059,33 @@ abstract class CommonObject $marginInfo = $this->getMarginInfos($force_price); - if (! empty($conf->global->MARGININFO_HIDE_SHOW)) + if (! empty($conf->global->MARGIN_ADD_SHOWHIDE_BUTTON)) // FIXME Warning this feature rely on an external js file that may be removed. Using native js function document.cookie should be better { - print ""; - if ($conf->global->MARGININFO_HIDE_SHOW == 2) print ''; // hide by default + print $langs->trans('ShowMarginInfos').' : '; + $hidemargininfos = $_COOKIE['DOLUSER_MARGININFO_HIDE_SHOW']; + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + + print ''; + if (!empty($hidemargininfos)) print ''; } - print '
    '.$langs->trans("Ref").''; diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index e17a0c67389..6c520105c36 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -107,7 +107,7 @@ if ($object->id) print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Reference print ''; diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 680ea9c201f..3d0fee451be 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -75,7 +75,7 @@ print '
    '; if (! empty($conf->contrat->enabled)) { $var=false; - print '
    '; + print ''; print ''; print '
    '.$langs->trans('Ref').''.$form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '').'
    '; print ''; @@ -227,7 +227,7 @@ print "
    '.$langs->trans("SearchAContract").'

    "; if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) { $sql = "SELECT c.rowid as ref, c.rowid,"; - $sql.= " s.nom, s.rowid as socid"; + $sql.= " s.nom as name, s.rowid as socid"; $sql .= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.rowid = c.fk_soc"; @@ -245,7 +245,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) print ''; print ''; - print ''; + print ''; if ($num) { $companystatic=new Societe($db); @@ -262,7 +262,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) print ''; print ''; @@ -298,7 +298,7 @@ $sql.= ' sum('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.d $sql.= ' sum('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now)."')",1,0).') as nb_expired,'; $sql.= ' sum('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now - $conf->contrat->services->expires->warning_delay)."')",1,0).') as nb_late,'; $sql.= ' sum('.$db->ifsql("cd.statut=5",1,0).') as nb_closed,'; -$sql.= " c.rowid as cid, c.ref, c.datec, c.tms, c.statut, s.nom, s.rowid as socid"; +$sql.= " c.rowid as cid, c.ref, c.datec, c.tms, c.statut, s.nom as name, s.rowid as socid"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,"; $sql.= " ".MAIN_DB_PREFIX."contrat as c"; @@ -342,7 +342,7 @@ if ($result) print ''; print ''; print ''; @@ -369,7 +369,7 @@ print '
    '; // Last modified services $sql = "SELECT c.ref, c.fk_soc, "; $sql.= " cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat, cd.date_fin_validite,"; -$sql.= " s.nom,"; +$sql.= " s.nom as name,"; $sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype"; $sql.= " FROM (".MAIN_DB_PREFIX."contrat as c"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; @@ -416,17 +416,17 @@ if ($resql) } else { - print ''.img_object($langs->trans("ShowService"),"service"); + print ''.img_object($langs->trans("ShowService"),"service"); if ($obj->label) print ' '.dol_trunc($obj->label,20).''; else print ' '.dol_trunc($obj->note,20); } print ''; print ''; - print ''; @@ -447,7 +447,7 @@ print '
    '; // Not activated services $sql = "SELECT c.ref, c.fk_soc, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,"; -$sql.= " s.nom,"; +$sql.= " s.nom as name,"; $sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype"; $sql.= " FROM (".MAIN_DB_PREFIX."contrat as c"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; @@ -471,7 +471,7 @@ if ($resql) print '
    '.$langs->trans("DraftContracts").($num?' ('.$num.')':'').'
    '.$langs->trans("DraftContracts").($num?' '.$num.'':'').'
    '; $companystatic->id=$obj->socid; - $companystatic->nom=$obj->nom; + $companystatic->name=$obj->name; $companystatic->client=1; print $companystatic->getNomUrl(1,'',16); print ''; $staticcompany->id=$obj->socid; - $staticcompany->nom=$obj->nom; + $staticcompany->name=$obj->name; print $staticcompany->getNomUrl(1,'',20); print ''.dol_print_date($obj->tms,'dayhour').''; $staticcompany->id=$obj->fk_soc; - $staticcompany->nom=$obj->nom; + $staticcompany->name=$obj->name; print $staticcompany->getNomUrl(1,'',20); print ''; + print ''; $dateend=$db->jdate($obj->date_fin_validite); print $staticcontratligne->LibStatut($obj->statut, 3, ($dateend && $dateend < $now)?1:0); print '
    '; - print ''; + print ''; print "\n"; $var=True; @@ -496,14 +496,14 @@ if ($resql) } else { - print ''.img_object($langs->trans("ShowService"),"service"); + print ''.img_object($langs->trans("ShowService"),"service"); if ($obj->label) print ' '.dol_trunc($obj->label,20).''; else print ' '.dol_trunc($obj->note,20); } print ''; print ''; print '
    '.$langs->trans("NotActivatedServices").' ('.$num.')
    '.$langs->trans("NotActivatedServices").' '.$num.'
    '; $staticcompany->id=$obj->fk_soc; - $staticcompany->nom=$obj->nom; + $staticcompany->name=$obj->name; print $staticcompany->getNomUrl(1,'',20); print ''; @@ -526,7 +526,7 @@ print '
    '; // Expired services $sql = "SELECT c.ref, c.fk_soc, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,"; -$sql.= " s.nom,"; +$sql.= " s.nom as name,"; $sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype"; $sql.= " FROM (".MAIN_DB_PREFIX."contrat as c"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; @@ -551,7 +551,7 @@ if ($resql) print ''; - print ''; + print ''; print "\n"; $var=True; @@ -576,14 +576,14 @@ if ($resql) } else { - print ''.img_object($langs->trans("ShowService"),"service"); + print ''.img_object($langs->trans("ShowService"),"service"); if ($obj->label) print ' '.dol_trunc($obj->label,20).''; else print ' '.dol_trunc($obj->note,20); } print ''; print ''; print '
    '.$langs->trans("ListOfExpiredServices").' ('.$num.')
    '.$langs->trans("ListOfExpiredServices").' '.$num.'
    '; $staticcompany->id=$obj->fk_soc; - $staticcompany->nom=$obj->nom; + $staticcompany->name=$obj->name; print $staticcompany->getNomUrl(1,'',20); print ''; diff --git a/htdocs/contrat/liste.php b/htdocs/contrat/list.php similarity index 77% rename from htdocs/contrat/liste.php rename to htdocs/contrat/list.php index 6bd9e249bc7..b83ecc329b7 100644 --- a/htdocs/contrat/liste.php +++ b/htdocs/contrat/list.php @@ -20,7 +20,7 @@ */ /** - * \file htdocs/contrat/liste.php + * \file htdocs/contrat/list.php * \ingroup contrat * \brief Page liste des contrats */ @@ -40,11 +40,11 @@ if ($page == -1) { $page = 0 ; } $limit = $conf->liste_limit; $offset = $limit * $page ; -$search_nom=GETPOST('search_nom'); +$search_name=GETPOST('search_name'); $search_contract=GETPOST('search_contract'); -$search_ref_customer=GETPOST('search_ref_customer','alpha'); +$search_ref_supplier=GETPOST('search_ref_supplier','alpha'); $sall=GETPOST('sall'); -$statut=GETPOST('statut')?GETPOST('statut'):1; +$search_status=GETPOST('search_status'); $socid=GETPOST('socid'); if (! $sortfield) $sortfield="c.rowid"; @@ -58,6 +58,17 @@ $result = restrictedArea($user, 'contrat', $id); $staticcontrat=new Contrat($db); $staticcontratligne=new ContratLigne($db); +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_name=""; + $search_contract=""; + $search_ref_supplier=""; + $sall=""; + $search_status=""; +} + +if ($search_status == '') $search_status=1; + /* * View @@ -68,14 +79,13 @@ $now=dol_now(); llxHeader(); $sql = 'SELECT'; +$sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_supplier,"; +$sql.= " s.nom as name, s.rowid as socid,"; $sql.= ' SUM('.$db->ifsql("cd.statut=0",1,0).') as nb_initial,'; $sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite >= '".$db->idate($now)."')",1,0).') as nb_running,'; $sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now)."')",1,0).') as nb_expired,'; $sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now - $conf->contrat->services->expires->warning_delay)."')",1,0).') as nb_late,'; -$sql.= ' SUM('.$db->ifsql("cd.statut=5",1,0).') as nb_closed,'; -$sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut,"; -$sql.= " s.nom, s.rowid as socid"; -$sql.= " ,c.ref_customer"; +$sql.= ' SUM('.$db->ifsql("cd.statut=5",1,0).') as nb_closed'; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."contrat as c"; @@ -84,21 +94,20 @@ $sql.= " WHERE c.fk_soc = s.rowid "; $sql.= " AND c.entity = ".$conf->entity; if ($socid) $sql.= " AND s.rowid = ".$socid; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($search_nom) { - $sql .= natural_search('s.nom', $search_nom); +if ($search_name) { + $sql .= natural_search('s.nom', $search_name); } if ($search_contract) { $sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract); } -if (!empty($search_ref_customer)) { - $sql .= natural_search(array('c.ref_customer'), $search_ref_customer); +if (!empty($search_ref_supplier)) { + $sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier); } if ($sall) { $sql .= natural_search(array('s.nom', 'cd.label', 'cd.description'), $sall); } -$sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut,"; -$sql.= " s.nom, s.rowid"; -$sql.= " ORDER BY $sortfield $sortorder"; +$sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_supplier, s.nom, s.rowid"; +$sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($conf->liste_limit + 1, $offset); $resql=$db->query($sql); @@ -107,16 +116,17 @@ if ($resql) $num = $db->num_rows($resql); $i = 0; - print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], '&search_contract='.$search_contract.'&search_nom='.$search_nom, $sortfield, $sortorder,'',$num); + print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], '&search_contract='.$search_contract.'&search_name='.$search_name, $sortfield, $sortorder,'',$num); + print ''; print ''; print ''; $param='&search_contract='.$search_contract; - $param.='&search_nom='.$search_nom; - $param.='&search_ref_customer='.$search_ref_customer; + $param.='&search_name='.$search_name; + $param.='&search_ref_supplier='.$search_ref_supplier; print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_customer","","$param",'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder); //print_liste_field_titre($langs->trans("DateCreation"), $_SERVER["PHP_SELF"], "c.datec","","$param",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateContract"), $_SERVER["PHP_SELF"], "c.date_contrat","","$param",'align="center"',$sortfield,$sortorder); @@ -127,24 +137,22 @@ if ($resql) print ''; print "\n"; - print ''; print ''; print ''; print ''; print ''; print ''; print ''; //print ''; - print '"; - print "\n"; - print ''; + print '\n"; $var=true; while ($i < min($num,$limit)) @@ -152,12 +160,12 @@ if ($resql) $obj = $db->fetch_object($resql); $var=!$var; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; //print ''; print ''; //print ''; @@ -170,7 +178,8 @@ if ($resql) } $db->free($resql); - print "
    '.$staticcontratligne->LibStatut(5,3).'
    '; print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print '  '; - print "
    '; + print ''; + print "
    '; + print ''; print img_object($langs->trans("ShowContract"),"contract").' '.(isset($obj->ref) ? $obj->ref : $obj->cid) .''; if ($obj->nb_late) print img_warning($langs->trans("Late")); print ''.$obj->ref_customer.''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.''.$obj->ref_supplier.''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.''.dol_print_date($obj->datec).''.dol_print_date($db->jdate($obj->date_contrat)).''.$staticcontrat->LibStatut($obj->statut,3).'
    "; + print '
    '; + print ''; } else { diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index cd782d73444..502b354ee69 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -75,7 +75,7 @@ if ($id > 0 || ! empty($ref)) print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Reference print ''; diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index 2f656d14211..22ae64ef9cd 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -44,7 +44,7 @@ if (! $sortfield) $sortfield="c.rowid"; if (! $sortorder) $sortorder="ASC"; $filter=GETPOST("filter"); -$search_nom=GETPOST("search_nom"); +$search_name=GETPOST("search_name"); $search_contract=GETPOST("search_contract"); $search_service=GETPOST("search_service"); $statut=GETPOST('statut')?GETPOST('statut'):1; @@ -69,6 +69,21 @@ $staticcontrat=new Contrat($db); $staticcontratligne=new ContratLigne($db); $companystatic=new Societe($db); +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_name=""; + $search_contract=""; + $search_service=""; + $op1month=""; + $op1day=""; + $op1year=""; + $filter_op1=""; + $op2month=""; + $op2day=""; + $op2year=""; + $filter_op2=""; +} + /* * View */ @@ -80,7 +95,7 @@ $form=new Form($db); llxHeader(); $sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut,"; -$sql.= " s.rowid as socid, s.nom,"; +$sql.= " s.rowid as socid, s.nom as name,"; $sql.= " cd.rowid, cd.description, cd.statut,"; $sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype,"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " sc.fk_soc, sc.fk_user,"; @@ -101,7 +116,7 @@ if ($mode == "0") $sql.= " AND cd.statut = 0"; if ($mode == "4") $sql.= " AND cd.statut = 4"; if ($mode == "5") $sql.= " AND cd.statut = 5"; if ($filter == "expired") $sql.= " AND cd.date_fin_validite < '".$db->idate($now)."'"; -if ($search_nom) $sql.= " AND s.nom LIKE '%".$db->escape($search_nom)."%'"; +if ($search_name) $sql.= " AND s.nom LIKE '%".$db->escape($search_name)."%'"; if ($search_contract) $sql.= " AND c.rowid = '".$db->escape($search_contract)."'"; if ($search_service) $sql.= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')"; if ($socid > 0) $sql.= " AND s.rowid = ".$socid; @@ -122,7 +137,7 @@ if ($resql) $param=''; if ($search_contract) $param.='&search_contract='.urlencode($search_contract); - if ($search_nom) $param.='&search_nom='.urlencode($search_nom); + if ($search_name) $param.='&search_name='.urlencode($search_name); if ($search_service) $param.='&search_service='.urlencode($search_service); if ($mode) $param.='&mode='.$mode; if ($filter) $param.='&filter='.$filter; @@ -136,24 +151,24 @@ if ($resql) if ($mode == "4" && $filter != "expired") $title=$langs->trans("ListOfRunningServices"); if ($mode == "4" && $filter == "expired") $title=$langs->trans("ListOfExpiredServices"); if ($mode == "5") $title=$langs->trans("ListOfClosedServices"); - print_barre_liste($title, $page, "services.php", $param, $sortfield, $sortorder,'',$num); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num); print '
    '.$langs->trans('Ref').''.$form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '').'
    '; print ''; - print_liste_field_titre($langs->trans("Contract"),"services.php", "c.rowid",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Service"),"services.php", "p.description",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),"services.php", "s.nom",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Contract"),$_SERVER["PHP_SELF"], "c.rowid",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Service"),$_SERVER["PHP_SELF"], "p.description",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"], "s.nom",$param,"","",$sortfield,$sortorder); // Date debut - if ($mode == "0") print_liste_field_titre($langs->trans("DateStartPlannedShort"),"services.php", "cd.date_ouverture_prevue",$param,'',' align="center"',$sortfield,$sortorder); - if ($mode == "" || $mode > 0) print_liste_field_titre($langs->trans("DateStartRealShort"),"services.php", "cd.date_ouverture",$param,'',' align="center"',$sortfield,$sortorder); + if ($mode == "0") print_liste_field_titre($langs->trans("DateStartPlannedShort"),$_SERVER["PHP_SELF"], "cd.date_ouverture_prevue",$param,'',' align="center"',$sortfield,$sortorder); + if ($mode == "" || $mode > 0) print_liste_field_titre($langs->trans("DateStartRealShort"),$_SERVER["PHP_SELF"], "cd.date_ouverture",$param,'',' align="center"',$sortfield,$sortorder); // Date fin - if ($mode == "" || $mode < 5) print_liste_field_titre($langs->trans("DateEndPlannedShort"),"services.php", "cd.date_fin_validite",$param,'',' align="center"',$sortfield,$sortorder); - else print_liste_field_titre($langs->trans("DateEndRealShort"),"services.php", "cd.date_cloture",$param,'',' align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),"services.php", "cd.statut,c.statut",$param,"","align=\"right\"",$sortfield,$sortorder); + if ($mode == "" || $mode < 5) print_liste_field_titre($langs->trans("DateEndPlannedShort"),$_SERVER["PHP_SELF"], "cd.date_fin_validite",$param,'',' align="center"',$sortfield,$sortorder); + else print_liste_field_titre($langs->trans("DateEndRealShort"),$_SERVER["PHP_SELF"], "cd.date_cloture",$param,'',' align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"], "cd.statut,c.statut",$param,"","align=\"right\"",$sortfield,$sortorder); print "\n"; - print ''; + print ''; print ''; print ''; @@ -168,7 +183,7 @@ if ($resql) print ''; // Third party print ''; print ''; - print '"; - print "\n"; + print '\n"; print ''; $contractstatic=new Contrat($db); @@ -225,7 +240,7 @@ if ($resql) // Third party print ''; diff --git a/htdocs/contrat/tpl/linkedobjectblock.tpl.php b/htdocs/contrat/tpl/linkedobjectblock.tpl.php index 702ed8d81ff..d94d45489fd 100644 --- a/htdocs/contrat/tpl/linkedobjectblock.tpl.php +++ b/htdocs/contrat/tpl/linkedobjectblock.tpl.php @@ -43,7 +43,7 @@ foreach($linkedObjectBlock as $object) $var=!$var; ?> > + trans("ShowContract"),"contract").' '.$object->ref; ?> diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index 55a538a2195..d5f8ea7c18c 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -28,7 +28,7 @@ $extrasize=GETPOST('size'); if (GETPOST('type')=='double' && strpos($extrasize,',')===false) $extrasize='24,8'; if (GETPOST('type')=='date') $extrasize=''; if (GETPOST('type')=='datetime') $extrasize=''; -if (GETPOST('type')=='select') $extrasize=''; +if (GETPOST('type')=='select') $extrasize=''; // Add attribute @@ -87,7 +87,7 @@ if ($action == 'add') $mesg[]=$langs->trans("ErrorNoValueForRadioType"); $action = 'create'; } - if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox')) && GETPOST('param')) + if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox')) && GETPOST('param')) { // Construct array for parameter (value of select list) $parameters = GETPOST('param'); @@ -95,7 +95,7 @@ if ($action == 'add') foreach($parameters_array as $param_ligne) { if (!empty($param_ligne)) { - if (preg_match_all('/,/',$param_ligne,$matches)) + if (preg_match_all('/,/',$param_ligne,$matches)) { if (count($matches[0])>1) { $error++; @@ -104,7 +104,7 @@ if ($action == 'add') $action = 'create'; } } - else + else { $error++; $langs->load("errors"); @@ -112,12 +112,12 @@ if ($action == 'add') $action = 'create'; } } - } + } } if (! $error) { - // attrname must be alphabetical and lower case only + // attrname must be alphabetical and lower case only if (isset($_POST["attrname"]) && preg_match("/^[a-z0-9-_]+$/",$_POST['attrname'])) { // Construct array for parameter (value of select list) @@ -139,9 +139,9 @@ if ($action == 'add') list($key,$value) = explode(',',$param_ligne); $params['options'][$key] = $value; } - } - - $result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$default_value,$params); + } + + $result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$default_value,$params,(GETPOST('alwayseditable')?1:0)); if ($result > 0) { setEventMessage($langs->trans('SetupSaved')); @@ -164,7 +164,7 @@ if ($action == 'add') $action = 'create'; } } - else + else { setEventMessage($mesg,'errors'); } @@ -278,7 +278,7 @@ if ($action == 'update') $params['options'][$key] = $value; } } - $result=$extrafields->update($_POST['attrname'],$_POST['label'],$_POST['type'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$pos,$params); + $result=$extrafields->update($_POST['attrname'],$_POST['label'],$_POST['type'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$pos,$params,(GETPOST('alwayseditable')?1:0)); if ($result > 0) { setEventMessage($langs->trans('SetupSaved')); diff --git a/htdocs/core/actions_printipp.inc.php b/htdocs/core/actions_printipp.inc.php new file mode 100644 index 00000000000..3c18faa813b --- /dev/null +++ b/htdocs/core/actions_printipp.inc.php @@ -0,0 +1,45 @@ + + * + * 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 . + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/core/actions_printipp.inc.php + * \brief Code for actions print_file to print file using ipp + */ + + +// $action must be defined +// $db, $user, $conf, $langs must be defined +// Filename to print must be provided into 'file' parameter + +// Print file +if ($action == 'print_file' and $user->rights->printipp->read) +{ + $langs->load("printipp"); + require_once DOL_DOCUMENT_ROOT . '/core/class/dolprintipp.class.php'; + $printer = new dolPrintIPP($db, $conf->global->PRINTIPP_HOST, $conf->global->PRINTIPP_PORT, $user->login, $conf->global->PRINTIPP_USER, $conf->global->PRINTIPP_PASSWORD); + $result = $printer->print_file(GETPOST('file', 'alpha'), GETPOST('printer', 'alpha')); + if ($result) + { + setEventMessage($result,'warnings'); + } + else + { + setEventMessage($langs->trans("FileWasSentToPrinter", basename(GETPOST('file')))); + } + $action = ''; +} diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 337cf59c9b0..49de1529321 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -87,10 +87,10 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO if ($result > 0) { - if ($_POST['sendto']) + if (trim($_POST['sendto'])) { // Recipient is provided into free text - $sendto = $_POST['sendto']; + $sendto = trim($_POST['sendto']); $sendtoid = 0; } elseif ($_POST['receiver'] != '-1') @@ -107,6 +107,22 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $sendtoid = $_POST['receiver']; } } + if (trim($_POST['sendtocc'])) + { + $sendtocc = trim($_POST['sendtocc']); + } + elseif ($_POST['receivercc'] != '-1') + { + // Recipient was provided from combo list + if ($_POST['receivercc'] == 'thirdparty') // Id of third party + { + $sendtocc = $thirdparty->email; + } + else // Id du contact + { + $sendtocc = $thirdparty->contact_get_property($_POST['receivercc'],'email'); + } + } if (dol_strlen($sendto)) { @@ -115,8 +131,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; $message = $_POST['message']; - $sendtocc = $_POST['sendtocc']; - $sendtobcc=''; + $sendtobcc= GETPOST('sendtoccc'); if ($mode == 'emailfromproposal') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO); if ($mode == 'emailfromorder') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO); if ($mode == 'emailfrominvoice') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO); @@ -126,13 +141,14 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO if ($action == 'send' || $action == 'relance') { if (dol_strlen($_POST['subject'])) $subject = $_POST['subject']; - $actionmsg2=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; + $actionmsg2=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; if ($message) { - $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; - $actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n"; - $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; - $actionmsg.=$message; + $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; + if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); + $actionmsg = dol_concatdesc($actionmsg, $message); } } @@ -171,7 +187,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($db); - $result=$interface->run_triggers('COMPANY_SENTBYMAIL',$object,$user,$langs,$conf); + $result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } diff --git a/htdocs/core/ajax/loadinplace.php b/htdocs/core/ajax/loadinplace.php index 69a0bbc72c7..de3a4e57d19 100644 --- a/htdocs/core/ajax/loadinplace.php +++ b/htdocs/core/ajax/loadinplace.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2011-2014 Regis Houssin * * 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 @@ -98,7 +98,7 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($ dol_include_once('/'.$module.'/class/actions_'.$subelement.'.class.php'); $classname = 'Actions'.ucfirst($subelement); $object = new $classname($db); - $ret = $object->$methodname(); + $ret = $object->$methodname($fk_element); if ($ret > 0) echo json_encode($object->$cachename); } } diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php new file mode 100644 index 00000000000..6ac5abd3bbb --- /dev/null +++ b/htdocs/core/ajax/objectonoff.php @@ -0,0 +1,49 @@ +. + */ + +/** + * \file htdocs/core/ajax/productonoff.php + * \brief File to set tosell and tobuy for product + */ + +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); +if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; + +$action=GETPOST('action','alpha'); +$id=GETPOST('id', 'int'); +$value=GETPOST('value', 'int'); +$field=GETPOST('field', 'alpha'); +$element=GETPOST('element', 'alpha'); + +$object = new GenericObject($db); +/* + * View + */ + +top_httphead(); + +print ''."\n"; + +// Registering new values +if (($action == 'set') && ! empty($id)) + $object->setValueFrom($field, $value, $element, $id); diff --git a/htdocs/core/antispamimage.php b/htdocs/core/antispamimage.php index c3bc217e100..a16844dd715 100644 --- a/htdocs/core/antispamimage.php +++ b/htdocs/core/antispamimage.php @@ -51,8 +51,6 @@ for($i = 0; $i < $length; $i++) $sessionkey='dol_antispam_value'; $_SESSION[$sessionkey]=$string; -header("Content-type: image/png"); - $img = imagecreate(80,32); if (empty($img)) { @@ -60,6 +58,8 @@ if (empty($img)) exit; } +header("Content-type: image/png"); + $background_color = imagecolorallocate($img, 250, 250, 250); $ecriture_color = imagecolorallocate($img, 0, 0, 0); imagestring($img, 4, 24, 8, $string, $ecriture_color); diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index ae138ae1422..89d05b92b79 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -63,8 +63,8 @@ class box_actions extends ModeleBoxes if ($user->rights->agenda->myactions->read) { $sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage,"; - $sql.= " ta.code,"; - $sql.= " s.nom, s.rowid as socid"; + $sql.= " ta.code, ta.libelle as type_label,"; + $sql.= " s.nom as name, s.rowid as socid"; $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm AS ta, "; $sql.= MAIN_DB_PREFIX."actioncomm AS a)"; if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; @@ -96,23 +96,23 @@ class box_actions extends ModeleBoxes if ($objp->percentage >= 0 && $objp->percentage < 100 && $datelimite < ($now - $delay_warning)) $late=img_warning($langs->trans("Late")); //($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label) - $label=$objp->label; + $label=empty($objp->label)?$objp->type_label:$objp->label; $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => ("action"), - 'url' => DOL_URL_ROOT."/comm/action/fiche.php?id=".$objp->id); + 'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id); $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => dol_trunc($label,32), 'text2'=> $late, - 'url' => DOL_URL_ROOT."/comm/action/fiche.php?id=".$objp->id); + 'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id); $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => ($objp->socid?'company':''), 'url' => ($objp->socid?DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid:'')); $this->info_box_contents[$i][3] = array('td' => 'align="left"', - 'text' => dol_trunc($objp->nom,24), + 'text' => dol_trunc($objp->name,24), 'url' => DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid); $this->info_box_contents[$i][4] = array('td' => 'align="left" class="nowrap"', @@ -155,10 +155,11 @@ class box_actions extends ModeleBoxes global $langs, $conf; parent::showBox($this->info_box_head, $this->info_box_contents); if ($conf->global->SHOW_DIALOG_HOMEPAGE) - { + { $actioncejour=false; $contents=$this->info_box_contents; $nblines=count($contents); + $bcx=array(); $bcx[0] = 'class="box_pair"'; $bcx[1] = 'class="box_impair"'; if ($contents[0][0]['text'] != $langs->trans("NoActionsToDo")) @@ -170,7 +171,7 @@ class box_actions extends ModeleBoxes if (isset($contents[$i])) { // on affiche que les évènement du jours ou passé - // qui ne sont pas à 100% + // qui ne sont pas à 100% $actioncejour=true; $var=!$var; // TR @@ -193,8 +194,8 @@ class box_actions extends ModeleBoxes print ''; } } - print '
    '; - print ''; + print ''; print ''; $arrayofoperators=array('<'=>'<','>'=>'>'); @@ -184,9 +199,9 @@ if ($resql) $filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year); print $form->select_date($filter_date2,'op2',0,0,1); print ''; - print "
    '; + print ''; + print "
    '; $companystatic->id=$obj->socid; - $companystatic->nom=$obj->nom; + $companystatic->name=$obj->name; $companystatic->client=1; print $companystatic->getNomUrl(1,'customer',28); print '
    - trans("ShowContract"),"contract").' '.$object->ref; ?> date_contrat,'day'); ?>   getLibStatut(6); ?>
    '; - + print '
    '; + } print ''; if ($actioncejour) diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index f37079fa037..d118bc8a4bc 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -114,7 +114,7 @@ class box_activity extends ModeleBoxes $billurl="viewstatut=2&paye=1&year=".$objp->annee; $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => $objp->nb, 'url' => DOL_URL_ROOT."/compta/facture/liste.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills" + 'text' => $objp->nb, 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills" ); $this->info_box_contents[$i][3] = array('td' => 'align="right"', @@ -214,7 +214,7 @@ class box_activity extends ModeleBoxes $this->info_box_contents[$i][2] = array('td' => 'align="right"', 'text' => $objp->nb, - 'url' => DOL_URL_ROOT."/commande/liste.php?mainmenu=commercial&leftmenu=orders&viewstatut=".$objp->fk_statut + 'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=".$objp->fk_statut ); $totalnb += $objp->nb; diff --git a/htdocs/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php index 5cb1e3ddad4..968eefef4b9 100644 --- a/htdocs/core/boxes/box_bookmarks.php +++ b/htdocs/core/boxes/box_bookmarks.php @@ -53,7 +53,7 @@ class box_bookmarks extends ModeleBoxes $this->max=$max; $this->info_box_head = array('text' => $langs->trans("BoxMyLastBookmarks",$max), - 'sublink' => DOL_URL_ROOT.'/bookmarks/liste.php'); + 'sublink' => DOL_URL_ROOT.'/bookmarks/list.php'); if ($user->rights->bookmark->creer) { $this->info_box_head['subpicto']='object_bookmark'; @@ -101,7 +101,7 @@ class box_bookmarks extends ModeleBoxes { $mytxt=$langs->trans("NoRecordedBookmarks"); if ($user->rights->bookmark->creer) $mytxt.=' '.$langs->trans("ClickToAdd"); - $this->info_box_contents[$i][0] = array('td' => 'align="center" colspan="2"', 'url'=> DOL_URL_ROOT.'/bookmarks/liste.php', 'text'=>$mytxt); + $this->info_box_contents[$i][0] = array('td' => 'align="center" colspan="2"', 'url'=> DOL_URL_ROOT.'/bookmarks/list.php', 'text'=>$mytxt); } $db->free($result); diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index 12145294d64..4e651e8bdcc 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -37,12 +37,28 @@ class box_clients extends ModeleBoxes var $depends = array("societe"); var $db; - var $param; + var $enabled = 1; var $info_box_head = array(); var $info_box_contents = array(); + /** + * Constructor + * + * @param DoliDB $db Database handler + * @param string $param More parameters + */ + function __construct($db,$param='') + { + global $conf, $user; + + $this->db = $db; + + // disable box for such cases + if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled=0; // disabled by this option + } + /** * Load data for box to show them later * @@ -63,7 +79,7 @@ class box_clients extends ModeleBoxes if ($user->rights->societe->lire) { - $sql = "SELECT s.nom, s.rowid as socid, s.datec, s.tms, s.status"; + $sql = "SELECT s.nom as name, s.rowid as socid, s.datec, s.tms, s.status"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.client IN (1, 3)"; @@ -78,7 +94,7 @@ class box_clients extends ModeleBoxes if ($result) { $num = $db->num_rows($result); - if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $url= DOL_URL_ROOT."/comm/fiche.php?socid="; + if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $url= DOL_URL_ROOT."/comm/card.php?socid="; else $url= DOL_URL_ROOT."/societe/soc.php?socid="; $i = 0; @@ -93,7 +109,7 @@ class box_clients extends ModeleBoxes 'url' => $url.$objp->socid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->nom, + 'text' => $objp->name, 'url' => $url.$objp->socid); $this->info_box_contents[$i][2] = array('td' => 'align="right"', diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index 1b7de3cca7f..1bb6fe9b27a 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -58,22 +58,25 @@ class box_commandes extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $commandestatic=new Commande($db); - $this->info_box_head = array('text' => $langs->trans("BoxTitleLastCustomerOrders",$max)); + $userstatic = new User($db); + + $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."CustomerOrders",$max)); if ($user->rights->commande->lire) { - - $sql = "SELECT s.nom, s.rowid as socid,"; - $sql.= " c.ref, c.tms, c.rowid,"; - $sql.= " c.fk_statut, c.facture"; + $sql = "SELECT s.nom as name, s.rowid as socid,"; + $sql.= " c.ref, c.tms, c.rowid, c.date_commande,"; + $sql.= " c.fk_statut, c.fk_user_valid, c.facture, c.total_ht"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."commande as c"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.rowid"; $sql.= " AND c.entity = ".$conf->entity; + if (! empty($conf->global->ORDER_BOX_LAST_ORDERS_VALIDATED_ONLY)) $sql.=" AND c.fk_statut = 1"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; - $sql.= " ORDER BY c.date_commande DESC, c.ref DESC "; + if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY c.date_commande DESC, c.ref DESC "; + else $sql.= " ORDER BY c.tms DESC, c.ref DESC "; $sql.= $db->plimit($max, 0); $result = $db->query($sql); @@ -86,29 +89,43 @@ class box_commandes extends ModeleBoxes while ($i < $num) { $objp = $db->fetch_object($result); + $date=$db->jdate($objp->date_commande); $datem=$db->jdate($objp->tms); - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', + $this->info_box_contents[$i][] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/commande/fiche.php?id=".$objp->rowid); + 'url' => DOL_URL_ROOT."/commande/card.php?id=".$objp->rowid); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', + $this->info_box_contents[$i][] = array('td' => 'align="left"', 'text' => $objp->ref, - 'url' => DOL_URL_ROOT."/commande/fiche.php?id=".$objp->rowid); + 'url' => DOL_URL_ROOT."/commande/card.php?id=".$objp->rowid); - $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', + $this->info_box_contents[$i][] = array('td' => 'align="left" width="16"', 'logo' => 'company', - 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); - $this->info_box_contents[$i][3] = array('td' => 'align="left"', - 'text' => $objp->nom, - 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); + $this->info_box_contents[$i][] = array('td' => 'align="left"', + 'text' => $objp->name, + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); - $this->info_box_contents[$i][4] = array('td' => 'align="right"', - 'text' => dol_print_date($datem,'day'), + $this->info_box_contents[$i][] = array('td' => 'align="right"', + 'text' => price($objp->total_ht), + ); + + if (! empty($conf->global->ORDER_BOX_LAST_ORDERS_SHOW_VALIDATE_USER)) + { + if ($objp->fk_user_valid > 0) $userstatic->fetch($objp->fk_user_valid); + $this->info_box_contents[$i][] = array('td' => 'align="right"', + 'text' => (($objp->fk_user_valid > 0)?$userstatic->getNomUrl(1):''), + 'url' => (($objp->fk_user_valid > 0)?DOL_URL_ROOT.'/user/card.php?id='.$objp->fk_user_valid:'') + ); + } + + $this->info_box_contents[$i][] = array('td' => 'align="right"', + 'text' => dol_print_date($date,'day'), ); - $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', + $this->info_box_contents[$i][] = array('td' => 'align="right" width="18"', 'text' => $commandestatic->LibStatut($objp->fk_statut,$objp->facture,3)); $i++; diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index c66326b27fb..45c8f1a4819 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -79,7 +79,7 @@ class box_comptes extends ModeleBoxes if ($user->rights->banque->lire) { $sql = "SELECT rowid, ref, label, bank, number, courant, clos, rappro, url,"; - $sql.= " code_banque, code_guichet, cle_rib, bic, iban_prefix,"; + $sql.= " code_banque, code_guichet, cle_rib, bic, iban_prefix as iban,"; $sql.= " domiciliation, proprio, owner_address,"; $sql.= " account_number, currency_code,"; $sql.= " min_allowed, min_desired, comment"; diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index a6fe663087e..e10c9ae7ed9 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -96,11 +96,11 @@ class box_contacts extends ModeleBoxes $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/contact/fiche.php?id=".$objp->rowid); + 'url' => DOL_URL_ROOT."/contact/card.php?id=".$objp->rowid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $contactstatic->getFullName($langs,0), - 'url' => DOL_URL_ROOT."/contact/fiche.php?id=".$objp->rowid); + 'url' => DOL_URL_ROOT."/contact/card.php?id=".$objp->rowid); $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => ($objp->fk_soc > 0?'company':''), diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index 26c3f269f3d..dc0ff8e5382 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -60,7 +60,7 @@ class box_contracts extends ModeleBoxes if ($user->rights->contrat->lire) { - $sql = "SELECT s.nom, s.rowid as socid,"; + $sql = "SELECT s.nom as name, s.rowid as socid,"; $sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.fin_validite, c.date_cloture"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -96,20 +96,20 @@ class box_contracts extends ModeleBoxes $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid); + 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref 'text2'=> $late, - 'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid); + 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid); $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', - 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); $this->info_box_contents[$i][3] = array('td' => 'align="left"', - 'text' => dol_trunc($objp->nom,40), - 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); + 'text' => dol_trunc($objp->name,40), + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => dol_print_date($datec,'day')); diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 2e8f94e29ff..b0fdd6d9d09 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -56,7 +56,7 @@ class box_factures extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $facturestatic=new Facture($db); - $text = $langs->trans("BoxTitleLastCustomerBills",$max); + $text = $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."CustomerBills",$max); $this->info_box_head = array( 'text' => $text, 'limit'=> dol_strlen($text) @@ -64,9 +64,9 @@ class box_factures extends ModeleBoxes if ($user->rights->facture->lire) { - $sql = "SELECT f.rowid as facid, f.facnumber, f.type, f.amount, f.datef as df"; + $sql = "SELECT f.rowid as facid, f.facnumber, f.type, f.total as total_ht, f.datef as df"; $sql.= ", f.paye, f.fk_statut, f.datec, f.tms"; - $sql.= ", s.nom, s.rowid as socid"; + $sql.= ", s.nom as name, s.rowid as socid"; $sql.= ", f.date_lim_reglement as datelimite"; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -75,7 +75,8 @@ class box_factures extends ModeleBoxes $sql.= " AND f.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; - $sql.= " ORDER BY f.tms DESC"; + if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY f.datef DESC, f.facnumber DESC "; + else $sql.= " ORDER BY f.tms DESC, f.facnumber DESC "; $sql.= $db->plimit($max, 0); $result = $db->query($sql); @@ -91,7 +92,8 @@ class box_factures extends ModeleBoxes { $objp = $db->fetch_object($result); $datelimite=$db->jdate($objp->datelimite); - $datec=$db->jdate($objp->datec); + $date=$db->jdate($objp->df); + $datem=$db->jdate($objp->tms); $picto='bill'; if ($objp->type == 1) $picto.='r'; @@ -110,18 +112,22 @@ class box_factures extends ModeleBoxes $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', - 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); $this->info_box_contents[$i][3] = array('td' => 'align="left"', - 'text' => $objp->nom, + 'text' => $objp->name, 'maxlength'=>40, - 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); $this->info_box_contents[$i][4] = array('td' => 'align="right"', - 'text' => dol_print_date($datec,'day'), + 'text' => price($objp->total_ht), ); - $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', + $this->info_box_contents[$i][5] = array('td' => 'align="right"', + 'text' => dol_print_date($date,'day'), + ); + + $this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"', 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3)); $i++; diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index d9cfa9bf5cd..914f442bea4 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -58,13 +58,13 @@ class box_factures_fourn extends ModeleBoxes $facturestatic=new FactureFournisseur($db); $this->info_box_head = array( - 'text' => $langs->trans("BoxTitleLastSupplierBills",$max) + 'text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."SupplierBills",$max) ); if ($user->rights->fournisseur->facture->lire) { - $sql = "SELECT s.nom, s.rowid as socid,"; - $sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.amount,"; + $sql = "SELECT s.nom as name, s.rowid as socid,"; + $sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.total_ht,"; $sql.= " f.paye, f.fk_statut,"; $sql.= ' f.datef as df,'; $sql.= ' f.datec as datec,'; @@ -76,7 +76,8 @@ class box_factures_fourn extends ModeleBoxes $sql.= " AND f.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; - $sql.= " ORDER BY f.tms DESC"; + if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY f.datef DESC, f.ref DESC "; + else $sql.= " ORDER BY f.tms DESC, f.ref DESC "; $sql.= $db->plimit($max, 0); $result = $db->query($sql); @@ -92,34 +93,35 @@ class box_factures_fourn extends ModeleBoxes { $objp = $db->fetch_object($result); $datelimite=$db->jdate($objp->datelimite); - $datec=$db->jdate($objp->datec); + $date=$db->jdate($objp->df); + $datem=$db->jdate($objp->tms); $late = ''; if ($objp->paye == 0 && $datelimite && $datelimite < ($now - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date, dol_print_date($datelimite,'day'))); $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid); + 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => ($objp->ref?$objp->ref:$objp->facid), 'text2'=> $late, - 'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid); + 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid); $this->info_box_contents[$i][2] = array('td' => 'align="left"', 'text' => $objp->ref_supplier, - 'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid); + 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid); $this->info_box_contents[$i][3] = array('td' => 'align="left" width="16"', 'logo' => 'company', - 'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid); + 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); $this->info_box_contents[$i][4] = array('td' => 'align="left"', - 'text' => $objp->nom, - 'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid); + 'text' => $objp->name, + 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); $this->info_box_contents[$i][5] = array('td' => 'align="right"', - 'text' => dol_print_date($datec,'day')); + 'text' => dol_print_date($date,'day')); $fac = new FactureFournisseur($db); $fac->fetch($objp->facid); diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index 742bd04cf82..aa217f1c436 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -60,7 +60,7 @@ class box_factures_fourn_imp extends ModeleBoxes if ($user->rights->fournisseur->facture->lire) { - $sql = "SELECT s.nom, s.rowid as socid,"; + $sql = "SELECT s.nom as name, s.rowid as socid,"; $sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.date_lim_reglement as datelimite,"; $sql.= " f.amount, f.datef as df,"; $sql.= " f.paye, f.fk_statut, f.type"; @@ -95,24 +95,24 @@ class box_factures_fourn_imp extends ModeleBoxes $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid); + 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => ($objp->ref?$objp->ref:$objp->facid), 'text2'=> $late, - 'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid); + 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid); $this->info_box_contents[$i][2] = array('td' => 'align="left"', 'text' => $objp->ref_supplier, - 'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid); + 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid); $this->info_box_contents[$i][3] = array('td' => 'align="left" width="16"', 'logo' => 'company', - 'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid); + 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); $this->info_box_contents[$i][4] = array('td' => 'align="left"', - 'text' => $objp->nom, - 'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid); + 'text' => $objp->name, + 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); $this->info_box_contents[$i][5] = array('td' => 'align="right"', 'text' => dol_print_date($datelimite,'day')); diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index 72c34dee559..e6df1530f8d 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -63,7 +63,7 @@ class box_factures_imp extends ModeleBoxes if ($user->rights->facture->lire) { - $sql = "SELECT s.nom, s.rowid as socid,"; + $sql = "SELECT s.nom as name, s.rowid as socid,"; $sql.= " f.facnumber, f.date_lim_reglement as datelimite,"; $sql.= " f.amount, f.datef as df,"; $sql.= " f.paye, f.fk_statut, f.rowid as facid"; @@ -107,12 +107,12 @@ class box_factures_imp extends ModeleBoxes $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', - 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); $this->info_box_contents[$i][3] = array('td' => 'align="left"', - 'text' => $objp->nom, + 'text' => $objp->name, 'maxlength'=>44, - 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => dol_print_date($datelimite,'day'), diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index 32038c61928..9cce737eb9a 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -65,17 +65,14 @@ class box_ficheinter extends ModeleBoxes $sql.= " f.datec,"; $sql.= " f.date_valid as datev,"; $sql.= " f.tms as datem,"; - $sql.= " s.nom, s.rowid as socid, s.client"; + $sql.= " s.nom as name, s.rowid as socid, s.client"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (! $user->rights->societe->client->voir) - $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (! $user->rights->societe->client->voir) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."fichinter as f"; $sql.= " WHERE f.fk_soc = s.rowid "; $sql.= " AND f.entity = ".$conf->entity; - if (! $user->rights->societe->client->voir && !$user->societe_id) - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if (! $user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; - $sql.= " ORDER BY f.tms DESC"; $sql.= $db->plimit($max, 0); @@ -98,19 +95,19 @@ class box_ficheinter extends ModeleBoxes $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/fichinter/fiche.php?id=".$objp->rowid); + 'url' => DOL_URL_ROOT."/fichinter/card.php?id=".$objp->rowid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some interventions have no ref - 'url' => DOL_URL_ROOT."/fichinter/fiche.php?id=".$objp->rowid); + 'url' => DOL_URL_ROOT."/fichinter/card.php?id=".$objp->rowid); $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', - 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); $this->info_box_contents[$i][3] = array('td' => 'align="left"', - 'text' => dol_trunc($objp->nom,40), - 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); + 'text' => dol_trunc($objp->name,40), + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => dol_print_date($datec,'day')); diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index 0157e5acada..f233221ccaa 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -62,7 +62,7 @@ class box_fournisseurs extends ModeleBoxes if ($user->rights->societe->lire) { - $sql = "SELECT s.nom, s.rowid as socid, s.datec, s.tms, s.status"; + $sql = "SELECT s.nom as name, s.rowid as socid, s.datec, s.tms, s.status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.fournisseur = 1"; @@ -86,11 +86,11 @@ class box_fournisseurs extends ModeleBoxes $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid); + 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->nom, - 'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid); + 'text' => $objp->name, + 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); $this->info_box_contents[$i][2] = array('td' => 'align="right"', 'text' => dol_print_date($datem, "day")); diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index b272f350717..9b2a5437b8a 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -215,9 +215,9 @@ class box_graph_invoices_permonth extends ModeleBoxes $stringtoshow.='
    '; $stringtoshow.=''; $stringtoshow.=''; - $stringtoshow.=' '.$langs->trans("NumberOfBillsByMonth"); + $stringtoshow.=' '.$langs->trans("NumberOfBillsByMonth"); $stringtoshow.='   '; - $stringtoshow.=' '.$langs->trans("AmountOfBillsByMonthHT"); + $stringtoshow.=' '.$langs->trans("AmountOfBillsByMonthHT"); $stringtoshow.='
    '; $stringtoshow.=$langs->trans("Year").' '; $stringtoshow.=''; diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index c882acd40c1..7c2aa53da97 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -214,9 +214,9 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; - $stringtoshow.=' '.$langs->trans("NumberOfBillsByMonth"); + $stringtoshow.=' '.$langs->trans("NumberOfBillsByMonth"); $stringtoshow.='   '; - $stringtoshow.=' '.$langs->trans("AmountOfBillsByMonthHT"); + $stringtoshow.=' '.$langs->trans("AmountOfBillsByMonthHT"); $stringtoshow.='
    '; $stringtoshow.=$langs->trans("Year").' '; $stringtoshow.=''; diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index 5084691d321..75f0f60660f 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -215,9 +215,9 @@ class box_graph_orders_permonth extends ModeleBoxes $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; - $stringtoshow.=' '.$langs->trans("NumberOfOrdersByMonth"); + $stringtoshow.=' '.$langs->trans("NumberOfOrdersByMonth"); $stringtoshow.='   '; - $stringtoshow.=' '.$langs->trans("AmountOfOrdersByMonthHT"); + $stringtoshow.=' '.$langs->trans("AmountOfOrdersByMonthHT"); $stringtoshow.='
    '; $stringtoshow.=$langs->trans("Year").' '; $stringtoshow.=''; diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index f398ae9dcb1..70d62cac348 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -214,9 +214,9 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; - $stringtoshow.=' '.$langs->trans("NumberOfOrdersByMonth"); + $stringtoshow.=' '.$langs->trans("NumberOfOrdersByMonth"); $stringtoshow.='   '; - $stringtoshow.=' '.$langs->trans("AmountOfOrdersByMonthHT"); + $stringtoshow.=' '.$langs->trans("AmountOfOrdersByMonthHT"); $stringtoshow.='
    '; $stringtoshow.=$langs->trans("Year").' '; $stringtoshow.=''; diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index 974ccaed446..fd866f5df89 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -218,9 +218,9 @@ class box_graph_propales_permonth extends ModeleBoxes $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; - $stringtoshow.=' '.$langs->trans("NumberOfProposalsByMonth"); + $stringtoshow.=' '.$langs->trans("NumberOfProposalsByMonth"); $stringtoshow.='   '; - $stringtoshow.=' '.$langs->trans("AmountOfProposalsByMonthHT"); + $stringtoshow.=' '.$langs->trans("AmountOfProposalsByMonthHT"); $stringtoshow.='
    '; $stringtoshow.=$langs->trans("Year").' '; $stringtoshow.=''; diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index 966a8ab7d10..4760a3aaf89 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -115,11 +115,11 @@ class box_members extends ModeleBoxes $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/adherents/fiche.php?rowid=".$objp->rowid); + 'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $memberstatic->getFullName($langs), - 'url' => DOL_URL_ROOT."/adherents/fiche.php?rowid=".$objp->rowid); + 'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid); $this->info_box_contents[$i][2] = array('td' => 'align="right"', 'text' => dol_print_date($datem, "day")); diff --git a/htdocs/core/boxes/box_osc_client.php b/htdocs/core/boxes/box_osc_client.php deleted file mode 100644 index 956811ea4e3..00000000000 --- a/htdocs/core/boxes/box_osc_client.php +++ /dev/null @@ -1,112 +0,0 @@ - - * Copyright (C) 2005-2008 Laurent Destailleur - * - * 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 . - */ - -/** - * \file htdocs/core/boxes/box_osc_client.php - * \ingroup osc - * \brief Module to generate box of shop customers - */ - -include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; - - -/** - * Class to manage the box to show last customers of shop - */ -class box_osc_clients extends ModeleBoxes -{ - var $boxcode="nbofcustomers"; - var $boximg="object_company"; - var $boxlabel="BoxNbOfCustomers"; - var $depends = array("boutique"); - - var $db; - var $param; - - var $info_box_head = array(); - var $info_box_contents = array(); - - - /** - * Load data into info_box_contents array to show array later. - * - * @param int $max Maximum number of records to load - * @return void - */ - function loadBox($max=5) - { - global $conf, $user, $langs, $db; - $langs->load("boxes"); - - $this->max=$max; - - $this->info_box_head = array('text' => $langs->trans("BoxTitleNbOfCustomers",$max)); - - if ($user->rights->boutique->lire) - { - $sql = "SELECT count(*) as cus FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."customers"; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - - $i = 0; - - while ($i < $num) - { - $objp = $db->fetch_object($resql); - - $this->info_box_contents[$i][0] = array('td' => 'align="center" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/boutique/client/index.php"); - $this->info_box_contents[$i][1] = array('td' => 'align="center"', - 'text' => $objp->cus, - 'url' => DOL_URL_ROOT."/boutique/client/index.php"); - $i++; - } - - $db->free($resql); - } - else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } - } - else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', - 'text' => $langs->trans("ReadPermissionNotAllowed")); - } - - } - - /** - * Method to show box - * - * @param array $head Array with properties of box title - * @param array $contents Array with properties of box lines - * @return void - */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); - } - -} - diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index 30669c4f392..d3772ff65f1 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -101,11 +101,11 @@ class box_produits extends ModeleBoxes $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => ($objp->fk_product_type==1?'object_service':'object_product'), - 'url' => DOL_URL_ROOT."/product/fiche.php?id=".$objp->rowid); + 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->label, - 'url' => DOL_URL_ROOT."/product/fiche.php?id=".$objp->rowid); + 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); if ($objp->price_base_type == 'HT') { diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index ec526a76492..1079f623492 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -108,11 +108,11 @@ class box_produits_alerte_stock extends ModeleBoxes $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => ($objp->fk_product_type==1?'object_service':'object_product'), - 'url' => DOL_URL_ROOT."/product/fiche.php?id=".$objp->rowid); + 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->label, - 'url' => DOL_URL_ROOT."/product/fiche.php?id=".$objp->rowid); + 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); if ($objp->price_base_type == 'HT') { diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 62ed89dd65b..ef38a2537e6 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -1,5 +1,6 @@ + * Copyright (C) 2014 Marcos García * 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 @@ -15,9 +16,9 @@ */ /** - * \file htdocs/core/boxes/box_activite.php - * \ingroup projet - * \brief Module to show Projet activity of the current Year + * \file htdocs/core/boxes/box_activite.php + * \ingroup projet + * \brief Module to show Projet activity of the current Year */ include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"); @@ -36,23 +37,27 @@ class box_project extends ModeleBoxes var $info_box_head = array(); var $info_box_contents = array(); - /** - * \brief Constructeur de la classe - */ - function box_project() - { - global $langs; - $langs->load("boxes"); - $langs->load("projects"); + /** + * Constructor + * + * @param DoliDB $db Database handler + * @param string $param More parameters + */ + function __construct($db,$param='') + { + global $langs; + $langs->load("boxes"); + $langs->load("projects"); - $this->boxlabel="Projet"; - } + $this->db = $db; + $this->boxlabel="Projects"; + } /** * Load data for box to show them later * - * @param int $max Maximum number of records to load - * @return void + * @param int $max Maximum number of records to load + * @return void */ function loadBox($max=5) { @@ -63,18 +68,12 @@ class box_project extends ModeleBoxes $totalMnt = 0; $totalnb = 0; $totalnbTask=0; - include_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php"); - require_once(DOL_DOCUMENT_ROOT."/core/lib/project.lib.php"); - $projectstatic=new Project($db); - - - $textHead = $langs->trans("Projet"); + $textHead = $langs->trans("Projects"); $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); // list the summary of the orders - if ($user->rights->projet->lire) - { + if ($user->rights->projet->lire) { $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut "; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; @@ -83,34 +82,37 @@ class box_project extends ModeleBoxes $sql.= " ORDER BY p.datec DESC"; $sql.= $db->plimit($max, 0); - $result = $db->query($sql); + $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows($result); - $i = 0; - while ($i < $num) - { - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_projectpub'); + if ($result) { + $num = $db->num_rows($result); + $i = 0; + while ($i < $num) { + $objp = $db->fetch_object($result); - $objp = $db->fetch_object($result); - $projectstatic->fetch($objp->rowid); + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => 'object_project', + 'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' =>$projectstatic->getNomUrl(1) - ); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $objp->ref, + 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid + ); - $this->info_box_contents[$i][2] = array('td' => 'align="left"', - 'text' => $objp->title - ); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="left"', + 'text' => $objp->title + ); $sql ="SELECT count(*) as nb, sum(progress) as totprogress"; $sql.=" FROM ".MAIN_DB_PREFIX."projet as p LEFT JOIN ".MAIN_DB_PREFIX."projet_task as pt on pt.fk_projet = p.rowid"; $sql.=" WHERE p.entity = ".$conf->entity; $resultTask = $db->query($sql); - if ($resultTask) - { + if ($resultTask) { $objTask = $db->fetch_object($resultTask); $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format($objTask->nb, 0, ',', ' ')." ".$langs->trans("Tasks")); if ($objTask->nb > 0 ) @@ -118,9 +120,7 @@ class box_project extends ModeleBoxes else $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); $totalnbTask += $objTask->nb; - } - else - { + } else { $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format(0, 0, ',', ' ')); $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); } diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index 73e554de2b6..e9bd47b2a9e 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -56,84 +56,93 @@ class box_propales extends ModeleBoxes $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; - $propalstatic=new Propal($db); + $propalstatic=new Propal($db); - $this->info_box_head = array('text' => $langs->trans("BoxTitleLastPropals",$max)); + $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."Propals",$max)); - if ($user->rights->propale->lire) - { - $sql = "SELECT s.nom, s.rowid as socid,"; - $sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sql.= ", ".MAIN_DB_PREFIX."propal as p"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE p.fk_soc = s.rowid"; - $sql.= " AND p.entity = ".$conf->entity; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; - $sql.= " ORDER BY p.datep DESC, p.ref DESC "; - $sql.= $db->plimit($max, 0); + if ($user->rights->propale->lire) + { + $sql = "SELECT s.nom as name, s.rowid as socid,"; + $sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tms"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; + $sql.= ", ".MAIN_DB_PREFIX."propal as p"; + if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= " WHERE p.fk_soc = s.rowid"; + $sql.= " AND p.entity = ".$conf->entity; + if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY p.datep DESC, p.ref DESC "; + else $sql.= " ORDER BY p.tms DESC, p.ref DESC "; + $sql.= $db->plimit($max, 0); - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows($result); - $now=dol_now(); + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + $now=dol_now(); - $i = 0; + $i = 0; - while ($i < $num) - { - $objp = $db->fetch_object($result); - $datec=$db->jdate($objp->datec); - $dateterm=$db->jdate($objp->fin_validite); - $dateclose=$db->jdate($objp->date_cloture); + while ($i < $num) + { + $objp = $db->fetch_object($result); + $date=$db->jdate($objp->dp); + $datec=$db->jdate($objp->datec); + $datem=$db->jdate($objp->tms); + $dateterm=$db->jdate($objp->fin_validite); + $dateclose=$db->jdate($objp->date_cloture); - $late = ''; - if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); } + $late = ''; + if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) { + $late = img_warning($langs->trans("Late")); + } - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/comm/propal.php?id=".$objp->rowid); + $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', + 'logo' => $this->boximg, + 'url' => DOL_URL_ROOT."/comm/propal.php?id=".$objp->rowid); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->ref, - 'text2'=> $late, - 'url' => DOL_URL_ROOT."/comm/propal.php?id=".$objp->rowid); + $this->info_box_contents[$i][1] = array('td' => 'align="left"', + 'text' => $objp->ref, + 'text2'=> $late, + 'url' => DOL_URL_ROOT."/comm/propal.php?id=".$objp->rowid); - $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', - 'logo' => 'company', - 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); + $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', + 'logo' => 'company', + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); - $this->info_box_contents[$i][3] = array('td' => 'align="left"', - 'text' => dol_trunc($objp->nom,40), - 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); + $this->info_box_contents[$i][3] = array('td' => 'align="left"', + 'text' => dol_trunc($objp->name,40), + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); - $this->info_box_contents[$i][4] = array('td' => 'align="right"', - 'text' => dol_print_date($datec,'day')); + $this->info_box_contents[$i][4] = array('td' => 'align="right"', + 'text' => price($objp->total_ht), + ); - $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', - 'text' => $propalstatic->LibStatut($objp->fk_statut,3)); + $this->info_box_contents[$i][5] = array('td' => 'align="right"', + 'text' => dol_print_date($date,'day')); - $i++; - } + $this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"', + 'text' => $propalstatic->LibStatut($objp->fk_statut,3)); - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedProposals")); + $i++; + } - $db->free($result); - } - else - { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } - } - else - { - $this->info_box_contents[0][0] = array('td' => 'align="left"', - 'text' => $langs->trans("ReadPermissionNotAllowed")); - } + if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedProposals")); + + $db->free($result); + } + else + { + $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql)); + } + } + else + { + $this->info_box_contents[0][0] = array('td' => 'align="left"', + 'text' => $langs->trans("ReadPermissionNotAllowed")); + } } /** diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index c0234f97dc3..3020f12f0c4 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -39,11 +39,28 @@ class box_prospect extends ModeleBoxes var $depends = array("societe"); var $db; + var $enabled = 1; var $info_box_head = array(); var $info_box_contents = array(); + /** + * Constructor + * + * @param DoliDB $db Database handler + * @param string $param More parameters + */ + function __construct($db,$param='') + { + global $conf, $user; + + $this->db = $db; + + // disable box for such cases + if (! empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $this->enabled=0; // disabled by this option + } + /** * Load data into info_box_contents array to show array later. * @@ -63,7 +80,7 @@ class box_prospect extends ModeleBoxes if ($user->rights->societe->lire) { - $sql = "SELECT s.nom, s.rowid as socid, s.fk_stcomm, s.datec, s.tms, s.status"; + $sql = "SELECT s.nom as name, s.rowid as socid, s.fk_stcomm, s.datec, s.tms, s.status"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.client IN (2, 3)"; @@ -89,11 +106,11 @@ class box_prospect extends ModeleBoxes $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->nom, - 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); + 'text' => $objp->name, + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); $this->info_box_contents[$i][2] = array('td' => 'align="right"', 'text' => dol_print_date($datem, "day")); diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index 264178cc3ea..eb48fc83d2b 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -62,7 +62,7 @@ class box_services_contracts extends ModeleBoxes if ($user->rights->service->lire && $user->rights->contrat->lire) { - $sql = "SELECT s.nom, s.rowid as socid,"; + $sql = "SELECT s.nom as name, s.rowid as socid,"; $sql.= " c.rowid,"; $sql.= " cd.rowid as cdid, cd.tms as datem, cd.statut,"; $sql.= " p.rowid as pid, p.label, p.fk_product_type"; @@ -113,21 +113,21 @@ class box_services_contracts extends ModeleBoxes $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => ($objp->fk_product_type==1?'object_service':'object_product'), - 'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid); + 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->label, 'maxlength' => 16, - 'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid); + 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid); $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', - 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); $this->info_box_contents[$i][3] = array('td' => 'align="left"', - 'text' => $objp->nom, + 'text' => $objp->name, 'maxlength' => 28, - 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => dol_print_date($datem,'day')); diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index 5e488b3c6db..52f3777e2af 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -63,7 +63,7 @@ class box_services_expired extends ModeleBoxes // Select contracts with at least one expired service $sql = "SELECT "; $sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat,"; - $sql.= " s.nom, s.rowid as socid,"; + $sql.= " s.nom as name, s.rowid as socid,"; $sql.= " MIN(cd.date_fin_validite) as date_line, COUNT(cd.rowid) as nb_services"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe s, ".MAIN_DB_PREFIX."contratdet as cd"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -93,19 +93,19 @@ class box_services_expired extends ModeleBoxes $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid); + 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref - 'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid); + 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid); $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', - 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); $this->info_box_contents[$i][3] = array('td' => 'align="left"', - 'text' => dol_trunc($objp->nom,40), - 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); + 'text' => dol_trunc($objp->name,40), + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); $this->info_box_contents[$i][4] = array('td' => 'align="center"', 'text' => dol_print_date($dateline,'day'), diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index a976112c1ad..d14bf1a539f 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -58,12 +58,12 @@ class box_supplier_orders extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; $supplierorderstatic=new CommandeFournisseur($db); - $this->info_box_head = array('text' => $langs->trans("BoxTitleLatestSupplierOrders", $max)); + $this->info_box_head = array('text' => $langs->trans("BoxTitleLatest".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."SupplierOrders", $max)); if ($user->rights->fournisseur->commande->lire) { - $sql = "SELECT s.nom, s.rowid as socid,"; - $sql.= " c.ref, c.tms, c.rowid,"; + $sql = "SELECT s.nom as name, s.rowid as socid,"; + $sql.= " c.ref, c.tms, c.rowid, c.date_commande,"; $sql.= " c.fk_statut"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c"; @@ -72,7 +72,8 @@ class box_supplier_orders extends ModeleBoxes $sql.= " AND c.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; - $sql.= " ORDER BY c.date_commande DESC, c.ref DESC "; + if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY c.date_commande DESC, c.ref DESC "; + else $sql.= " ORDER BY c.tms DESC, c.ref DESC "; $sql.= $db->plimit($max, 0); $result = $db->query($sql); @@ -84,10 +85,11 @@ class box_supplier_orders extends ModeleBoxes while ($i < $num) { $objp = $db->fetch_object($result); - $datem=$db->jdate($objp->tms); + $date=$db->jdate($objp->date_commande); + $datem=$db->jdate($objp->tms); - $urlo = DOL_URL_ROOT."/fourn/commande/fiche.php?id=".$objp->rowid; - $urls = DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid; + $urlo = DOL_URL_ROOT."/fourn/commande/card.php?id=".$objp->rowid; + $urls = DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid; $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, @@ -102,11 +104,11 @@ class box_supplier_orders extends ModeleBoxes 'url' => $urls); $this->info_box_contents[$i][3] = array('td' => 'align="left"', - 'text' => $objp->nom, + 'text' => $objp->name, 'url' => $urls); $this->info_box_contents[$i][4] = array('td' => 'align="right"', - 'text' => dol_print_date($datem,'day'), + 'text' => dol_print_date($date,'day'), ); $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index c15bc9831ce..d20ee2017d6 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -1,5 +1,6 @@ + * * 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 @@ -15,10 +16,10 @@ */ /** - * \file htdocs/core/boxes/box_task.php - * \ingroup Projet - * \brief Module to Task activity of the current year - * \version $Id: box_task.php,v 1.1 2012/09/11 Charles-François BENKE + * \file htdocs/core/boxes/box_task.php + * \ingroup Projet + * \brief Module to Task activity of the current year + * \version $Id: box_task.php,v 1.1 2012/09/11 Charles-François BENKE */ include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"); @@ -29,34 +30,36 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); */ class box_task extends ModeleBoxes { - var $boxcode="projet"; - var $boximg="object_projecttask"; - var $boxlabel; - //var $depends = array("projet"); - var $db; - var $param; + var $boxcode="projet"; + var $boximg="object_projecttask"; + var $boxlabel; + //var $depends = array("projet"); + var $db; + var $param; - var $info_box_head = array(); - var $info_box_contents = array(); + var $info_box_head = array(); + var $info_box_contents = array(); - /** - * \brief Constructeur de la classe - * - * @return void - */ - function box_task() - { - global $langs; - $langs->load("boxes"); - $langs->load("projects"); - $this->boxlabel="Tasks"; - } + /** + * Constructor + * + * @param DoliDB $db Database handler + * @param string $param More parameters + */ + function __construct($db,$param='') + { + global $langs; + $langs->load("boxes"); + $langs->load("projects"); + $this->boxlabel="Tasks"; + $this->db = $db; + } /** * Load data for box to show them later * - * @param int $max Maximum number of records to load - * @return void + * @param int $max Maximum number of records to load + * @return void */ function loadBox($max=5) { @@ -75,8 +78,7 @@ class box_task extends ModeleBoxes $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); // list the summary of the orders - if ($user->rights->projet->lire) - { + if ($user->rights->projet->lire) { $sql = "SELECT pt.fk_statut, count(pt.rowid) as nb, sum(ptt.task_duration) as durationtot, sum(pt.planned_workload) as plannedtot"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet_task_time as ptt"; @@ -88,23 +90,23 @@ class box_task extends ModeleBoxes $result = $db->query($sql); - if ($result) - { + if ($result) { $num = $db->num_rows($result); $i = 0; - while ($i < $num) - { - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_projecttask'); + while ($i < $num) { + $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_projecttask'); - $objp = $db->fetch_object($result); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' =>$langs->trans("Task")." ".$taskstatic->LibStatut($objp->fk_statut,0) - ); + $objp = $db->fetch_object($result); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' =>$langs->trans("Task")." ".$taskstatic->LibStatut($objp->fk_statut,0) + ); - $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => $objp->nb." ".$langs->trans("Tasks"), - 'url' => DOL_URL_ROOT."/projet/tasks/index.php?leftmenu=projects&viewstatut=".$objp->fk_statut - ); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="right"', + 'text' => $objp->nb." ".$langs->trans("Tasks"), + 'url' => DOL_URL_ROOT."/projet/tasks/index.php?leftmenu=projects&viewstatut=".$objp->fk_statut + ); $totalnb += $objp->nb; $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->plannedtot,'all',25200,5)); $totalplannedtot += $objp->plannedtot; @@ -126,7 +128,7 @@ class box_task extends ModeleBoxes $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot,'all',25200,5)); $this->info_box_contents[$i][4] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totaldurationtot,'all',25200,5)); $this->info_box_contents[$i][5] = array('td' => '', 'text' => ""); - + } /** diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 275154cd80e..c6b6dad7acb 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -181,6 +181,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" global $langs,$conf; $MAXLENGTHBOX=60; // Mettre 0 pour pas de limite + $bcx=array(); $bcx[0] = 'class="box_pair"'; $bcx[1] = 'class="box_impair"'; $var = false; @@ -227,7 +228,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" print '
    '; // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object print img_picto($langs->trans("MoveBox",$this->box_id),'grip_title','class="boxhandle hideonsmartphone" style="cursor:move;"'); - print img_picto($langs->trans("Close",$this->box_id),'close_title','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"'); + print img_picto($langs->trans("Close2",$this->box_id),'close_title','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"'); $label=$head['text']; if (! empty($head['graph'])) $label.=' ('.$langs->trans("Graph").')'; print ''; diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index a289b43c4a9..5288dc635cb 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -118,10 +118,10 @@ class CMailFile $this->mixed_boundary = "multipart_x." . time() . ".x_boundary"; // On defini related_boundary - $this->related_boundary = 'mul_'.dol_hash(uniqid("dolibarr2")); + $this->related_boundary = 'mul_'.dol_hash(uniqid("dolibarr2"), 3); // Force md5 hash (does not contains special chars) // On defini alternative_boundary - $this->alternative_boundary = 'mul_'.dol_hash(uniqid("dolibarr3")); + $this->alternative_boundary = 'mul_'.dol_hash(uniqid("dolibarr3"), 3); // Force md5 hash (does not contains special chars) // If ending method not defined if (empty($conf->global->MAIN_MAIL_SENDMODE)) $conf->global->MAIN_MAIL_SENDMODE='mail'; @@ -971,7 +971,7 @@ class CMailFile } // cid - $this->html_images[$i]["cid"] = dol_hash(uniqid(time())); + $this->html_images[$i]["cid"] = dol_hash(uniqid(time()), 3); // Force md5 hash (does not contains special chars) $this->html = preg_replace("/src=\"$src\"|src='$src'/i", "src=\"cid:".$this->html_images[$i]["cid"]."\"", $this->html); } $i++; diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index 7d0bf5fad0c..5620e641df0 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -54,7 +54,6 @@ class CSMSFile * @param int $deferred Deferred or not * @param int $priority Priority * @param int $class Class - * @return int */ function __construct($to,$from,$msg,$deliveryreceipt=0,$deferred=0,$priority=3,$class=1) { diff --git a/htdocs/core/class/antivir.class.php b/htdocs/core/class/antivir.class.php index 68241cb4d62..d7f765fa510 100644 --- a/htdocs/core/class/antivir.class.php +++ b/htdocs/core/class/antivir.class.php @@ -40,7 +40,6 @@ class AntiVir * Constructor * * @param DoliDB $db Database handler - * @return AntiVir */ function __construct($db) { diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index f51056b2551..959decc581c 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -125,7 +125,7 @@ class Canvas /** * Shared method for canvas to assign values for templates * - * @param string &$action Action string + * @param string $action Action string * @param int $id Object id (if ref not provided) * @param string $ref Object ref (if id not provided) * @return void @@ -181,7 +181,7 @@ class Canvas /** * Shared method for canvas to execute actions * - * @param string &$action Action string + * @param string $action Action string * @param int $id Object id * @return mixed Return return code of doActions of canvas * @deprecated This function is called if you add a doActions class inside your canvas. Try to not diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index 088dfaf327b..59980cea7a9 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -191,7 +191,7 @@ class Ccountry // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; $error=0; @@ -256,10 +256,10 @@ class Ccountry // extends CommonObject /** - * Delete object in database + * Delete object in database * - * @param User $user User that delete - * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @param User $user User that delete + * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ function delete($user, $notrigger=0) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 256e9b074e4..fbf5363b753 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -118,10 +118,9 @@ abstract class CommonDocGenerator 'mycompany_idprof5'=>$mysoc->idprof5, 'mycompany_idprof6'=>$mysoc->idprof6, 'mycompany_vatnumber'=>$mysoc->tva_intra, - // Only private not exists for "mysoc" - 'mycompany_note'=>$mysoc->note_private - //'mycompany_note_private'=>$mysoc->note_private, - //'mycompany_note_public'=>$mysoc->note_public, + // Only private not exists for "mysoc" + 'mycompany_note_private'=>$mysoc->note_private, + ); } @@ -166,6 +165,7 @@ abstract class CommonDocGenerator 'company_customeraccountancycode'=>$object->code_compta, 'company_supplieraccountancycode'=>$object->code_compta_fournisseur, 'company_juridicalstatus'=>$object->forme_juridique, + 'company_outstanding_limit'=>$object->outstanding_limit, 'company_capital'=>$object->capital, 'company_idprof1'=>$object->idprof1, 'company_idprof2'=>$object->idprof2, @@ -290,6 +290,10 @@ abstract class CommonDocGenerator 'current_datehour'=>dol_print_date($now,'dayhour','tzuser'), 'current_server_date'=>dol_print_date($now,'day','tzserver'), 'current_server_datehour'=>dol_print_date($now,'dayhour','tzserver'), + 'current_date_locale'=>dol_print_date($now,'day','tzuser',$outputlangs), + 'current_datehour_locale'=>dol_print_date($now,'dayhour','tzuser',$outputlangs), + 'current_server_date_locale'=>dol_print_date($now,'day','tzserver',$outputlangs), + 'current_server_datehour_locale'=>dol_print_date($now,'dayhour','tzserver',$outputlangs), ); return $array_other; @@ -357,7 +361,8 @@ abstract class CommonDocGenerator $array_key.'_total_discount_ht' => price2num($object->getTotalDiscount()), $array_key.'_note_private'=>$object->note, - $array_key.'_note'=>$object->note_public, + $array_key.'_note_public'=>$object->note_public, + $array_key.'_note'=>$object->note_public, // For backward compatibility // Payments $array_key.'_already_payed_locale'=>price($alreadypayed, 0, $outputlangs), $array_key.'_remain_to_pay_locale'=>price($object->total_ttc - $sumpayed, 0, $outputlangs), @@ -383,7 +388,7 @@ abstract class CommonDocGenerator $extralabels = $extrafields->fetch_name_optionals_label($extrafieldkey,true); $object->fetch_optionals($object->id,$extralabels); - $resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key=$array_key,$outputlangs); + $resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key,$outputlangs); } return $resarray; } diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index f44efafbffa..90ad3e196e3 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -358,10 +358,14 @@ abstract class CommonInvoice extends CommonObject } } + + +require_once DOL_DOCUMENT_ROOT .'/core/class/commonobjectline.class.php'; + /** * Parent class of all other business classes for details of elements (invoices, contracts, proposals, orders, ...) */ -abstract class CommonInvoiceLine extends CommonObject +abstract class CommonInvoiceLine extends CommonObjectLine { } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 50b9a35f4fe..e8f06bd06dc 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3,10 +3,10 @@ * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2011-2014 Philippe Grand - * Copyright (C) 2012 Marcos García + * Copyright (C) 2012-2014 Marcos García * * 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 @@ -34,9 +34,19 @@ */ abstract class CommonObject { - protected $db; + public $db; + + /** + * @var error Error string + * @deprecated Use instead the array of error strings + */ public $error; + + /** + * @var errors Aray of error string + */ public $errors; + public $canvas; // Contains canvas name if it is public $name; @@ -47,6 +57,9 @@ abstract class CommonObject public $array_options=array(); + /** + * @var Societe + */ public $thirdparty; public $linkedObjectsIds; // Loaded by ->fetchObjectLinked @@ -54,6 +67,12 @@ abstract class CommonObject // No constructor as it is an abstract class + /** + * Column name of the ref field. + * @var string + */ + protected $table_ref_field = ''; + /** * Check an object id/ref exists @@ -156,7 +175,7 @@ abstract class CommonObject * Add a link between element $this->element and a contact * * @param int $fk_socpeople Id of contact to link - * @param int $type_contact Type of contact (code or id) + * @param int $type_contact Type of contact (code or id). For example: SALESREPFOLL * @param int $source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user) * @param int $notrigger Disable all triggers * @return int <0 if KO, >0 if OK @@ -192,9 +211,10 @@ abstract class CommonObject // On recherche id type_contact $sql = "SELECT tc.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc"; - $sql.= " WHERE element='".$this->element."'"; - $sql.= " AND source='".$source."'"; - $sql.= " AND code='".$type_contact."' AND active=1"; + $sql.= " WHERE tc.element='".$this->element."'"; + $sql.= " AND tc.source='".$source."'"; + $sql.= " AND tc.code='".$type_contact."' AND tc.active=1"; + //print $sql; $resql=$this->db->query($sql); if ($resql) { @@ -337,12 +357,14 @@ abstract class CommonObject /** * Delete all links between an object $this and all its contacts * - * @return int >0 if OK, <0 if KO + * @param string $source '' or 'internal' or 'external' + * @param string $code Type of contact (code or id) + * @return int >0 if OK, <0 if KO */ - function delete_linked_contact() + function delete_linked_contact($source='',$code='') { $temp = array(); - $typeContact = $this->liste_type_contact(''); + $typeContact = $this->liste_type_contact($source,'',0,0,$code); foreach($typeContact as $key => $value) { @@ -351,7 +373,7 @@ abstract class CommonObject $listId = implode(",", $temp); $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact"; - $sql.= " WHERE element_id =".$this->id; + $sql.= " WHERE element_id = ".$this->id; $sql.= " AND fk_c_type_contact IN (".$listId.")"; dol_syslog(get_class($this)."::delete_linked_contact", LOG_DEBUG); @@ -360,7 +382,7 @@ abstract class CommonObject return 1; } else - { + { $this->error=$this->db->lasterror(); return -1; } @@ -478,21 +500,23 @@ abstract class CommonObject * @param string $source 'internal', 'external' or 'all' * @param string $order Sort order by : 'code' or 'rowid' * @param string $option 0=Return array id->label, 1=Return array code->label - * @param string $activeonly 0=all type of contact, 1=only the active + * @param string $activeonly 0=all status of contact, 1=only the active + * @param string $code Type of contact (Example: 'CUSTOMER', 'SERVICE') * @return array Array list of type of contacts (id->label if option=0, code->label if option=1) */ - function liste_type_contact($source='internal', $order='code', $option=0, $activeonly=0) + function liste_type_contact($source='internal', $order='', $option=0, $activeonly=0, $code='') { global $langs; + if (empty($order)) $order='code'; + $tab = array(); $sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql.= " WHERE tc.element='".$this->element."'"; - if ($activeonly == 1) - $sql.= " AND tc.active=1"; // only the active type - - if (! empty($source)) $sql.= " AND tc.source='".$source."'"; + if ($activeonly == 1) $sql.= " AND tc.active=1"; // only the active type + if (! empty($source) && $source != 'all') $sql.= " AND tc.source='".$source."'"; + if (! empty($code)) $sql.= " AND tc.code='".$code."'"; $sql.= " ORDER by tc.".$order; //print "sql=".$sql; @@ -577,11 +601,15 @@ abstract class CommonObject /** * Charge le contact d'id $id dans this->contact * - * @param int $contactid Id du contact + * @param int $contactid Id du contact. Use this->contactid if empty. * @return int <0 if KO, >0 if OK */ - function fetch_contact($contactid) + function fetch_contact($contactid='') { + if (empty($contactid)) $contactid=$this->contactid; + + if (empty($contactid)) return 0; + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $contact = new Contact($this->db); $result=$contact->fetch($contactid); @@ -592,16 +620,22 @@ abstract class CommonObject /** * Load the third party of object, from id $this->socid or $this->fk_soc, into this->thirdparty * - * @return int <0 if KO, >0 if OK + * @param int $force_thirdparty_id Force thirdparty id + * @return int <0 if KO, >0 if OK */ - function fetch_thirdparty() + function fetch_thirdparty($force_thirdparty_id=0) { global $conf; - if (empty($this->socid) && empty($this->fk_soc) && empty($this->fk_thirdparty)) return 0; + if (empty($this->socid) && empty($this->fk_soc) && empty($this->fk_thirdparty) && empty($force_thirdparty_id)) return 0; + + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + + $idtofetch=isset($this->socid)?$this->socid:(isset($this->fk_soc)?$this->fk_soc:$this->fk_thirdparty); + if ($force_thirdparty_id) $idtofetch=$force_thirdparty_id; $thirdparty = new Societe($this->db); - $result=$thirdparty->fetch(isset($this->socid)?$this->socid:(isset($this->fk_soc)?$this->fk_soc:$this->fk_thirdparty)); + $result=$thirdparty->fetch($idtofetch); $this->client = $thirdparty; // deprecated $this->thirdparty = $thirdparty; @@ -616,9 +650,35 @@ abstract class CommonObject } + /** + * Looks for an object with ref matching the wildcard provided + * It does only work when $this->table_ref_field is set + * + * @param string $ref Wildcard + * @return int >1 = OK, 0 = Not found or table_ref_field not defined, <0 = KO + */ + public function fetchOneLike($ref) + { + if (!$this->table_ref_field) { + return 0; + } + + $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE '.$this->table_ref_field.' LIKE "'.$this->db->escape($ref).'" LIMIT 1'; + + $query = $this->db->query($sql); + + if (!$this->db->num_rows($query)) { + return 0; + } + + $result = $this->db->fetch_object($query); + + return $this->fetch($result->rowid); + } + /** * Load data for barcode into properties ->barcode_type* - * Properties ->barcode_type that is id of barcode type is used to find other properties, but + * Properties ->barcode_type that is id of barcode. Type is used to find other properties, but * if it is not defined, ->element must be defined to know default barcode type. * * @return int <0 if KO, 0 if can't guess type of barcode (ISBN, EAN13...), >0 if OK (all barcode properties loaded) @@ -1738,6 +1798,7 @@ abstract class CommonObject * @param string $origin Linked element type * @param int $origin_id Linked element id * @return int <=0 if KO, >0 if OK + * @see fetchObjectLinked, updateObjectLinked, deleteObjectLinked */ function add_object_linked($origin=null, $origin_id=null) { @@ -1781,6 +1842,7 @@ abstract class CommonObject * @param string $targettype Object target type * @param string $clause 'OR' or 'AND' clause used when both source id and target id are provided * @return void + * @see add_object_linked, updateObjectLinked, deleteObjectLinked */ function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR') { @@ -1810,6 +1872,12 @@ abstract class CommonObject $sourcetype = (! empty($sourcetype) ? $sourcetype : $this->element); $targettype = (! empty($targettype) ? $targettype : $this->element); + if (empty($sourceid) && empty($targetid)) + { + dol_syslog('Bad usage of function. No source nor target id defined (nor as parameter nor as object id)', LOG_ERROR); + return -1; + } + // Links beetween objects are stored in this table $sql = 'SELECT fk_source, sourcetype, fk_target, targettype'; $sql.= ' FROM '.MAIN_DB_PREFIX.'element_element'; @@ -1828,7 +1896,7 @@ abstract class CommonObject } } else - { + { $sql.= "(fk_source = '".$sourceid."' AND sourcetype = '".$sourcetype."')"; $sql.= " ".$clause." (fk_target = '".$targetid."' AND targettype = '".$targettype."')"; } @@ -1935,6 +2003,7 @@ abstract class CommonObject * @param int $targetid Object target id * @param string $targettype Object target type * @return int >0 if OK, <0 if KO + * @see add_object_linked, fetObjectLinked, deleteObjectLinked */ function updateObjectLinked($sourceid='', $sourcetype='', $targetid='', $targettype='') { @@ -1980,6 +2049,7 @@ abstract class CommonObject * @param int $targetid Object target id * @param string $targettype Object target type * @return int >0 if OK, <0 if KO + * @see add_object_linked, updateObjectLinked, fetchObjectLinked */ function deleteObjectLinked($sourceid='', $sourcetype='', $targetid='', $targettype='') { @@ -2035,6 +2105,8 @@ abstract class CommonObject */ function setStatut($status,$elementId='',$elementType='') { + global $user,$langs,$conf; + $elementId = (!empty($elementId)?$elementId:$this->id); $elementTable = (!empty($elementType)?$elementType:$this->table_element); @@ -2050,9 +2122,36 @@ abstract class CommonObject dol_syslog(get_class($this)."::setStatut", LOG_DEBUG); if ($this->db->query($sql)) { - $this->db->commit(); - $this->statut = $status; - return 1; + $error = 0; + + $trigkey=''; + if ($this->element == 'fichinter' && $status == 2) $trigkey='FICHINTER_CLASSIFY_BILLED'; + if ($this->element == 'fichinter' && $status == 1) $trigkey='FICHINTER_CLASSIFY_UNBILLED'; + + if ($trigkey) + { + // Appel des triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($this->db); + $result=$interface->run_triggers($trigkey,$this,$user,$langs,$conf); + if ($result < 0) { + $error++; $this->errors=$interface->errors; + } + // Fin appel triggers + } + + if (! $error) + { + $this->db->commit(); + $this->statut = $status; + return 1; + } + else + { + $this->db->rollback(); + dol_syslog(get_class($this)."::setStatus ".$this->error,LOG_ERR); + return -1; + } } else { @@ -2092,7 +2191,6 @@ abstract class CommonObject $obj = $this->db->fetch_object($resql); if ($obj) { - $this->id = $obj->rowid; $this->canvas = $obj->canvas; return 1; } @@ -2124,326 +2222,6 @@ abstract class CommonObject } } - - /** - * Function to get extra fields of a member into $this->array_options - * This method is in most cases called by method fetch of objects but you can call it separately. - * - * @param int $rowid Id of line - * @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label() - * @return int <0 if error, 0 if no optionals to find nor found, 1 if a line is found and optional loaded - */ - function fetch_optionals($rowid,$optionsArray='') - { - if (! is_array($optionsArray)) - { - // optionsArray not already loaded, so we load it - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafields = new ExtraFields($this->db); - $optionsArray = $extrafields->fetch_name_optionals_label($this->table_element); - } - - - // Request to get complementary values - if (count($optionsArray) > 0) - { - $sql = "SELECT rowid"; - foreach ($optionsArray as $name => $label) - { - $sql.= ", ".$name; - } - $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields"; - $sql.= " WHERE fk_object = ".$rowid; - - dol_syslog(get_class($this)."::fetch_optionals", LOG_DEBUG); - $resql=$this->db->query($sql); - if ($resql) - { - $numrows=$this->db->num_rows($resql); - if ($numrows) - { - $tab = $this->db->fetch_array($resql); - - foreach ($tab as $key => $value) - { - // Test fetch_array ! is_int($key) because fetch_array seult is a mix table with Key as alpha and Key as int (depend db engine) - if ($key != 'rowid' && $key != 'tms' && $key != 'fk_member' && ! is_int($key)) - { - // we can add this attribute to adherent object - $this->array_options["options_$key"]=$value; - } - } - } - - $this->db->free($resql); - - if ($numrows) return $numrows; - else return 0; - } - else - { - dol_print_error($this->db); - return -1; - } - } - return 0; - } - - /** - * Delete all extra fields values for the current object. - * - * @return int <0 if KO, >0 if OK - */ - function deleteExtraFields() - { - global $langs; - - $error=0; - - $this->db->begin(); - - $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id; - dol_syslog(get_class($this)."::deleteExtraFields delete", LOG_DEBUG); - $resql=$this->db->query($sql_del); - if (! $resql) - { - $this->error=$this->db->lasterror(); - $this->db->rollback(); - return -1; - } - else - { - $this->db->commit(); - return 1; - } - } - - /** - * Add/Update all extra fields values for the current object. - * All data to describe values to insert are stored into $this->array_options=array('keyextrafield'=>'valueextrafieldtoadd') - * - * @return int -1=error, O=did nothing, 1=OK - */ - function insertExtraFields() - { - global $conf,$langs; - - $error=0; - - if (! empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0; // For avoid conflicts if trigger used - - if (! empty($this->array_options)) - { - // Check parameters - $langs->load('admin'); - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafields = new ExtraFields($this->db); - $optionsArray = $extrafields->fetch_name_optionals_label($this->table_element); - - foreach($this->array_options as $key => $value) - { - $attributeKey = substr($key,8); // Remove 'options_' prefix - $attributeType = $extrafields->attribute_type[$attributeKey]; - $attributeSize = $extrafields->attribute_size[$attributeKey]; - $attributeLabel = $extrafields->attribute_label[$attributeKey]; - switch ($attributeType) - { - case 'int': - if (!is_numeric($value) && $value!='') - { - $error++; $this->errors[]=$langs->trans("ExtraFieldHasWrongValue",$attributeLabel); - return -1; - } - elseif ($value=='') - { - $this->array_options[$key] = null; - } - break; - case 'price': - $this->array_options[$key] = price2num($this->array_options[$key]); - break; - case 'date': - $this->array_options[$key]=$this->db->idate($this->array_options[$key]); - break; - case 'datetime': - $this->array_options[$key]=$this->db->idate($this->array_options[$key]); - break; - } - } - $this->db->begin(); - - $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id; - dol_syslog(get_class($this)."::insertExtraFields delete", LOG_DEBUG); - $this->db->query($sql_del); - $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object"; - foreach($this->array_options as $key => $value) - { - $attributeKey = substr($key,8); // Remove 'options_' prefix - // Add field of attribut - if ($extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate - $sql.=",".$attributeKey; - } - $sql .= ") VALUES (".$this->id; - foreach($this->array_options as $key => $value) - { - $attributeKey = substr($key,8); // Remove 'options_' prefix - // Add field o fattribut - if($extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate) - { - if ($this->array_options[$key] != '') - { - $sql.=",'".$this->db->escape($this->array_options[$key])."'"; - } - else - { - $sql.=",null"; - } - } - } - $sql.=")"; - - dol_syslog(get_class($this)."::insertExtraFields insert", LOG_DEBUG); - $resql = $this->db->query($sql); - if (! $resql) - { - $this->error=$this->db->lasterror(); - $this->db->rollback(); - return -1; - } - else - { - $this->db->commit(); - return 1; - } - } - else return 0; - } - - /** - * Function to show lines of extrafields with output datas - * - * @param object $extrafields Extrafield Object - * @param string $mode Show output (view) or input (edit) for extrafield - * @param array $params Optionnal parameters - * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) - * - * @return string - */ - function showOptionals($extrafields, $mode='view', $params=0, $keyprefix='') - { - global $_POST, $conf; - - $out = ''; - - if (count($extrafields->attribute_label) > 0) - { - $out .= "\n"; - $out .= ' '; - $out .= "\n"; - - $e = 0; - foreach($extrafields->attribute_label as $key=>$label) - { - if (is_array($params) && count($params)>0) { - if (array_key_exists('colspan',$params)) { - $colspan=$params['colspan']; - } - }else { - $colspan='3'; - } - switch($mode) { - case "view": - $value=$this->array_options["options_".$key]; - break; - case "edit": - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$this->array_options["options_".$key]); - break; - } - if ($extrafields->attribute_type[$key] == 'separate') - { - $out .= $extrafields->showSeparator($key); - } - else - { - $csstyle=''; - if (is_array($params) && count($params)>0) { - if (array_key_exists('style',$params)) { - $csstyle=$params['style']; - } - } - if ( !empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) - { - $out .= '
    '.$label.'
    '.$langs->trans('BuyingPrice').''.$langs->trans('BuyingPrice').''.$langs->trans('CostPrice').''.$langs->trans('CostPrice').''.$langs->trans('MarginRate').''.$langs->trans('MarginRate').''.$langs->trans('MarkRate').''.$langs->trans('MarkRate').'
    '; + print '
    '; print ''; - print ''; - print ''; + print ''; + print ''; if ($conf->global->MARGIN_TYPE == "1") - print ''; + print ''; else - print ''; - print ''; + print ''; + print ''; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''; + print ''; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print ''; + print ''; print ''; if (! empty($conf->product->enabled)) @@ -3443,6 +3234,105 @@ abstract class CommonObject } } + /** + * Common function for all objects extending CommonObject for generating documents + * + * @param string $modelspath Relative folder where models are placed + * @param string $modele Model to use + * @param Translate $outputlangs Language to use + * @param int $hidedetails 1 to hide details. 0 by default + * @param int $hidedesc 1 to hide product description. 0 by default + * @param int $hideref 1 to hide product reference. 0 by default + * @return int 1 if OK -1 if not OK + */ + protected function commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref) + { + global $conf, $langs; + + $srctemplatepath=''; + + // Increase limit for PDF build + $err=error_reporting(); + error_reporting(0); + @set_time_limit(120); + error_reporting($err); + + // If selected modele is a filename template (then $modele="modelname:filename") + $tmp=explode(':',$modele,2); + if (! empty($tmp[1])) + { + $modele=$tmp[0]; + $srctemplatepath=$tmp[1]; + } + + // Search template files + $file=''; $classname=''; $filefound=0; + $dirmodels=array('/'); + if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); + foreach($dirmodels as $reldir) + { + foreach(array('doc','pdf') as $prefix) + { + $file = $prefix."_".$modele.".modules.php"; + + // On verifie l'emplacement du modele + $file=dol_buildpath($reldir.$modelspath.$file,0); + if (file_exists($file)) + { + $filefound=1; + $classname=$prefix.'_'.$modele; + break; + } + } + if ($filefound) break; + } + + // Charge le modele + if ($filefound) + { + require_once $file; + + $obj = new $classname($this->db); + //$obj->message = $message; + + // We save charset_output to restore it because write_file can change it if needed for + // output format that does not support UTF8. + $sav_charset_output=$outputlangs->charset_output; + if ($obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) + { + $outputlangs->charset_output=$sav_charset_output; + + // We delete old preview + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + dol_delete_preview($this); + + // Success in building document. We build meta file. + dol_meta_create($this); + + return 1; + } + else + { + $outputlangs->charset_output=$sav_charset_output; + dol_print_error($this->db,"Error generating document for ".__CLASS__.". Error: ".$obj->error); + return -1; + } + + } + else + { + dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file)); + return -1; + } + } + + + /* Functions common to commonobject and commonobjectline */ + + + /* For triggers */ + + /** * Call trigger based on this instance * NB: Error from trigger are stacked in interface->errors @@ -3475,4 +3365,327 @@ abstract class CommonObject return $result; } + + /* Functions for extrafields */ + + + /** + * Function to get extra fields of a member into $this->array_options + * This method is in most cases called by method fetch of objects but you can call it separately. + * + * @param int $rowid Id of line + * @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label() + * @return int <0 if error, 0 if no optionals to find nor found, 1 if a line is found and optional loaded + */ + function fetch_optionals($rowid='',$optionsArray='') + { + if (empty($rowid)) $rowid=$this->id; + + if (! is_array($optionsArray)) + { + // optionsArray not already loaded, so we load it + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($this->db); + $optionsArray = $extrafields->fetch_name_optionals_label($this->table_element); + } + + // Request to get complementary values + if (count($optionsArray) > 0) + { + $sql = "SELECT rowid"; + foreach ($optionsArray as $name => $label) + { + $sql.= ", ".$name; + } + $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields"; + $sql.= " WHERE fk_object = ".$rowid; + + dol_syslog(get_class($this)."::fetch_optionals", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + $numrows=$this->db->num_rows($resql); + if ($numrows) + { + $tab = $this->db->fetch_array($resql); + + foreach ($tab as $key => $value) + { + // Test fetch_array ! is_int($key) because fetch_array seult is a mix table with Key as alpha and Key as int (depend db engine) + if ($key != 'rowid' && $key != 'tms' && $key != 'fk_member' && ! is_int($key)) + { + // we can add this attribute to adherent object + $this->array_options["options_".$key]=$value; + } + } + } + + $this->db->free($resql); + + if ($numrows) return $numrows; + else return 0; + } + else + { + dol_print_error($this->db); + return -1; + } + } + return 0; + } + + /** + * Delete all extra fields values for the current object. + * + * @return int <0 if KO, >0 if OK + */ + function deleteExtraFields() + { + global $langs; + + $error=0; + + $this->db->begin(); + + $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id; + dol_syslog(get_class($this)."::deleteExtraFields delete", LOG_DEBUG); + $resql=$this->db->query($sql_del); + if (! $resql) + { + $this->error=$this->db->lasterror(); + $this->db->rollback(); + return -1; + } + else + { + $this->db->commit(); + return 1; + } + } + + /** + * Add/Update all extra fields values for the current object. + * All data to describe values to insert are stored into $this->array_options=array('keyextrafield'=>'valueextrafieldtoadd') + * + * @return int -1=error, O=did nothing, 1=OK + */ + function insertExtraFields() + { + global $conf,$langs; + + $error=0; + + if (! empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0; // For avoid conflicts if trigger used + + if (! empty($this->array_options)) + { + // Check parameters + $langs->load('admin'); + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($this->db); + $optionsArray = $extrafields->fetch_name_optionals_label($this->table_element); + + foreach($this->array_options as $key => $value) + { + $attributeKey = substr($key,8); // Remove 'options_' prefix + $attributeType = $extrafields->attribute_type[$attributeKey]; + $attributeSize = $extrafields->attribute_size[$attributeKey]; + $attributeLabel = $extrafields->attribute_label[$attributeKey]; + switch ($attributeType) + { + case 'int': + if (!is_numeric($value) && $value!='') + { + $error++; $this->errors[]=$langs->trans("ExtraFieldHasWrongValue",$attributeLabel); + return -1; + } + elseif ($value=='') + { + $this->array_options[$key] = null; + } + break; + case 'price': + $this->array_options[$key] = price2num($this->array_options[$key]); + break; + case 'date': + $this->array_options[$key]=$this->db->idate($this->array_options[$key]); + break; + case 'datetime': + $this->array_options[$key]=$this->db->idate($this->array_options[$key]); + break; + } + } + $this->db->begin(); + + $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id; + dol_syslog(get_class($this)."::insertExtraFields delete", LOG_DEBUG); + $this->db->query($sql_del); + $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object"; + foreach($this->array_options as $key => $value) + { + $attributeKey = substr($key,8); // Remove 'options_' prefix + // Add field of attribut + if ($extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate + $sql.=",".$attributeKey; + } + $sql .= ") VALUES (".$this->id; + foreach($this->array_options as $key => $value) + { + $attributeKey = substr($key,8); // Remove 'options_' prefix + // Add field o fattribut + if($extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate) + { + if ($this->array_options[$key] != '') + { + $sql.=",'".$this->db->escape($this->array_options[$key])."'"; + } + else + { + $sql.=",null"; + } + } + } + $sql.=")"; + + dol_syslog(get_class($this)."::insertExtraFields insert", LOG_DEBUG); + $resql = $this->db->query($sql); + if (! $resql) + { + $this->error=$this->db->lasterror(); + $this->db->rollback(); + return -1; + } + else + { + $this->db->commit(); + return 1; + } + } + else return 0; + } + + /** + * Function to show lines of extrafields with output datas + * + * @param object $extrafields Extrafield Object + * @param string $mode Show output (view) or input (edit) for extrafield + * @param array $params Optionnal parameters + * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) + * + * @return string + */ + function showOptionals($extrafields, $mode='view', $params=0, $keyprefix='') + { + global $_POST, $conf; + + $out = ''; + + if (count($extrafields->attribute_label) > 0) + { + $out .= "\n"; + $out .= ' '; + $out .= "\n"; + + $e = 0; + foreach($extrafields->attribute_label as $key=>$label) + { + if (is_array($params) && count($params)>0) { + if (array_key_exists('colspan',$params)) { + $colspan=$params['colspan']; + } + }else { + $colspan='3'; + } + switch($mode) { + case "view": + $value=$this->array_options["options_".$key]; + break; + case "edit": + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$this->array_options["options_".$key]); + break; + } + if ($extrafields->attribute_type[$key] == 'separate') + { + $out .= $extrafields->showSeparator($key); + } + else + { + $csstyle=''; + if (is_array($params) && count($params)>0) { + if (array_key_exists('style',$params)) { + $csstyle=$params['style']; + } + } + if ( !empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) + { + $out .= ''; + $colspan='0'; + } + else + { + $out .= ''; + } + // Convert date into timestamp format + if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) + { + $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->db->jdate($this->array_options['options_'.$key]); + } + + if($extrafields->attribute_required[$key]) + $label = ''.$label.''; + + $out .= ''; + $out .=''; + + switch($mode) { + case "view": + $out .= $extrafields->showOutputField($key,$value); + break; + case "edit": + $out .= $extrafields->showInputField($key,$value,'',$keyprefix); + break; + } + + $out .= ''; + + if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) $out .= ''; + else $out .= ''; + $e++; + } + } + $out .= "\n"; + $out .= ' + '."\n"; + $out .= ' '."\n"; + } + return $out; + } + } diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php index 675e1cf0794..c3c8d823a34 100644 --- a/htdocs/core/class/commonobjectline.class.php +++ b/htdocs/core/class/commonobjectline.class.php @@ -26,36 +26,12 @@ * Parent class for class inheritance lines of business objects * This class is useless for the moment so no inherit are done on it */ -abstract class CommonObjectLine +abstract class CommonObjectLine extends CommonObject { - /** - * Call trigger based on this instance - * NB: Error from trigger are stacked in interface->errors - * NB2: If return code of triggers are < 0, action calling trigger should cancel all transaction. - * - * @param string $trigger_name trigger's name to execute - * @param User $user Object user - * @return int Result of run_triggers - */ - function call_trigger($trigger_name, $user) - { - global $langs,$conf; + // TODO - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers($trigger_name,$this,$user,$langs,$conf); - if ($result < 0) - { - if (!empty($this->errors)) - { - $this->errors=array_merge($this->errors,$interface->errors); - } - else - { - $this->errors=$interface->errors; - } - } - return $result; - } + // Currently we need function at end of file CommonObject for all object lines. Should find a way to avoid duplicate code. + + // For the moment we use the extends on CommonObject until PHP min is 5.4 so use Traits. } diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index b6225de2913..238cd171a5a 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -72,8 +72,6 @@ class Conf /** * Constructor - * - * @return Conf */ function __construct() { @@ -364,14 +362,38 @@ class Conf unset($this->global->PRODUIT_USE_SEARCH_TO_SELECT); unset($this->global->COMPANY_USE_SEARCH_TO_SELECT); unset($this->global->CONTACT_USE_SEARCH_TO_SELECT); + unset($this->global->PROJECT_USE_SEARCH_TO_SELECT); + } + + if (! empty($conf->productbatch->enabled)) + { + $this->global->STOCK_CALCULATE_ON_BILL=0; + $this->global->STOCK_CALCULATE_ON_VALIDATE_ORDER=0; + $this->global->STOCK_CALCULATE_ON_SHIPMENT=1; + $this->global->STOCK_CALCULATE_ON_SUPPLIER_BILL=0; + $this->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER=0; + $this->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER=1; + } + + if (! empty($conf->productbatch->enabled)) + { + $this->global->STOCK_CALCULATE_ON_BILL=0; + $this->global->STOCK_CALCULATE_ON_VALIDATE_ORDER=0; + $this->global->STOCK_CALCULATE_ON_SHIPMENT=1; + $this->global->STOCK_CALCULATE_ON_SUPPLIER_BILL=0; + $this->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER=0; + $this->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER=1; } // conf->currency if (empty($this->global->MAIN_MONNAIE)) $this->global->MAIN_MONNAIE='EUR'; $this->currency=$this->global->MAIN_MONNAIE; - // conf->global->COMPTA_MODE = Option des modules Comptabilites (simple ou expert). Defini le mode de calcul des etats comptables (CA,...) - if (empty($this->global->COMPTA_MODE)) $this->global->COMPTA_MODE='RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES' + // conf->global->ACCOUNTING_MODE = Option des modules Comptabilites (simple ou expert). Defini le mode de calcul des etats comptables (CA,...) + if (empty($this->global->ACCOUNTING_MODE)) $this->global->ACCOUNTING_MODE='RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES' + + // By default, suppliers ojbects can be linked to all projects + $conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS = 1; // conf->liste_limit = constante de taille maximale des listes if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) $this->global->MAIN_SIZE_LISTE_LIMIT=25; @@ -428,6 +450,9 @@ class Conf // Define list of limited modules if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,facture,categorie,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda,adherent'; // '' means 'all'. Note that contact is added here as it should be a module later. + // Enable select2 + if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)) $conf->global->MAIN_USE_JQUERY_MULTISELECT='select2'; + // Timeouts if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) $this->global->MAIN_USE_CONNECT_TIMEOUT=10; if (empty($this->global->MAIN_USE_RESPONSE_TIMEOUT)) $this->global->MAIN_USE_RESPONSE_TIMEOUT=30; diff --git a/htdocs/core/class/ctypent.class.php b/htdocs/core/class/ctypent.class.php index eea64ed10ac..027dda53dd3 100644 --- a/htdocs/core/class/ctypent.class.php +++ b/htdocs/core/class/ctypent.class.php @@ -198,7 +198,7 @@ class Ctypent // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; $error=0; diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index f0291c9d567..98b1309149e 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -451,7 +451,7 @@ class DiscountAbsolute } - if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); + if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; $result.=$lien.$ref.$lienfin; return $result; diff --git a/htdocs/core/class/dolgeoip.class.php b/htdocs/core/class/dolgeoip.class.php index 9844e6b74c9..7cddd4c16f5 100644 --- a/htdocs/core/class/dolgeoip.class.php +++ b/htdocs/core/class/dolgeoip.class.php @@ -40,7 +40,6 @@ class DolGeoIP * * @param string $type 'country' or 'city' * @param string $datfile Data file - * @return GeoIP */ function __construct($type,$datfile) { diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 33888b057b7..c400dc151d3 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -253,7 +253,7 @@ class DolGraph /** * Set legend * - * @param string $legend Legend + * @param array $legend Legend. Example: array('seriename1','seriname2',...) * @return void */ function SetLegend($legend) diff --git a/htdocs/core/class/dolprintipp.class.php b/htdocs/core/class/dolprintipp.class.php index 942ee3da3c3..b6e09547743 100644 --- a/htdocs/core/class/dolprintipp.class.php +++ b/htdocs/core/class/dolprintipp.class.php @@ -45,7 +45,6 @@ class dolprintIPP * @param string $userid userid * @param string $user user * @param string $password password - * @return printIPP */ function __construct($db,$host,$port,$userid,$user,$password) { @@ -83,19 +82,22 @@ class dolprintIPP * @param string $file file * @param string $module module * - * @return void + * @return string '' if OK, Error message if KO */ - function print_file($file,$module) + function print_file($file, $module) { global $conf,$db; + include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php'; + $ipp = new CupsPrintIPP(); - $ipp->setLog(DOL_DATA_ROOT.'/printipp.log','file',3); // logging very verbose + $ipp->setLog(DOL_DATA_ROOT.'/dolibarr_printipp.log','file',3); // logging very verbose $ipp->setHost($this->host); $ipp->setPort($this->port); $ipp->setJobName($file,true); $ipp->setUserName($this->userid); if (! empty($this->user)) $ipp->setAuthentication($this->user,$this->password); + // select printer uri for module order, propal,... $sql = 'SELECT rowid,printer_uri,copy FROM '.MAIN_DB_PREFIX.'printer_ipp WHERE module="'.$module.'"'; $result = $this->db->query($sql); @@ -108,13 +110,23 @@ class dolprintIPP } else { - $ipp->setPrinterURI($conf->global->PRINTIPP_URI_DEFAULT); + if (! empty($conf->global->PRINTIPP_URI_DEFAULT)) + { + $ipp->setPrinterURI($conf->global->PRINTIPP_URI_DEFAULT); + } + else + { + return 'NoDefaultPrinterDefined'; + } } } + // Set number of copy $ipp->setCopies($obj->copy); $ipp->setData(DOL_DATA_ROOT.'/'.$module.'/'.$file); $ipp->printJob(); + + return ''; } /** diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index ba4dcfb94f6..299026a84bb 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -111,7 +111,7 @@ class Events // extends CommonObject $this->description=trim($this->description); // Check parameters - if (! $this->description) { $this->error='ErrorBadValueForParameter'; return -1; } + if (empty($this->description)) { $this->error='ErrorBadValueForParameter'; return -1; } // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."events("; @@ -129,7 +129,7 @@ class Events // extends CommonObject $sql.= " ".($_SERVER['HTTP_USER_AGENT']?"'".dol_trunc($_SERVER['HTTP_USER_AGENT'],250)."'":'NULL').","; $sql.= " '".$this->db->idate($this->dateevent)."',"; $sql.= " ".($user->id?"'".$user->id."'":'NULL').","; - $sql.= " '".$this->db->escape($this->description)."'"; + $sql.= " '".$this->db->escape(dol_trunc($this->description,250))."'"; $sql.= ")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); @@ -154,7 +154,7 @@ class Events // extends CommonObject * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; @@ -191,7 +191,7 @@ class Events // extends CommonObject * @param User $user User that load * @return int <0 if KO, >0 if OK */ - function fetch($id, $user=0) + function fetch($id, $user=null) { global $langs; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index c4bb2afcd44..30c97e9f1ef 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -50,6 +50,8 @@ class ExtraFields var $attribute_param; // Int to store position of attribute var $attribute_pos; + // Int to store if attribute is editable regardless of the document status + var $attribute_alwayseditable; var $error; var $errno; @@ -103,9 +105,10 @@ class ExtraFields * @param int $required Is field required or not * @param string $default_value Defaulted value * @param array $param Params for field + * @param int $alwayseditable Is attribute always editable regardless of the document status * @return int <=0 if KO, >0 if OK */ - function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0,$default_value='', $param=0) + function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param=0, $alwayseditable=0) { if (empty($attrname)) return -1; if (empty($label)) return -1; @@ -119,7 +122,7 @@ class ExtraFields if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate') { // Add declaration of field into table - $result2=$this->create_label($attrname,$label,$type,$pos,$size,$elementtype, $unique, $required, $param); + $result2=$this->create_label($attrname,$label,$type,$pos,$size,$elementtype, $unique, $required, $param, $alwayseditable); $err2=$this->errno; if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS')) { @@ -154,7 +157,7 @@ class ExtraFields { $table=$elementtype.'_extrafields'; - if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) + if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9_]*$/",$attrname) && ! is_numeric($attrname)) { if ($type=='boolean') { $typedb='int'; @@ -217,17 +220,17 @@ class ExtraFields * @param int $unique Is field unique or not * @param int $required Is field required or not * @param array||string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) + * @param int $alwayseditable Is attribute always editable regardless of the document status * @return int <=0 if KO, >0 if OK */ - private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='') + private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0) { global $conf; // Clean parameters if (empty($pos)) $pos=0; - - if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) + if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname) && ! is_numeric($attrname)) { if(is_array($param) and count($param) > 0) { @@ -242,7 +245,7 @@ class ExtraFields $params=''; } - $sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(name, label, type, pos, size, entity, elementtype, fieldunique, fieldrequired, param)"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(name, label, type, pos, size, entity, elementtype, fieldunique, fieldrequired, param, alwayseditable)"; $sql.= " VALUES('".$attrname."',"; $sql.= " '".$this->db->escape($label)."',"; $sql.= " '".$type."',"; @@ -252,7 +255,8 @@ class ExtraFields $sql.= " '".$elementtype."',"; $sql.= " '".$unique."',"; $sql.= " '".$required."',"; - $sql.= " '".$params."'"; + $sql.= " '".$params."',"; + $sql.= " '".$alwayseditable."'"; $sql.=')'; dol_syslog(get_class($this)."::create_label", LOG_DEBUG); @@ -348,9 +352,10 @@ class ExtraFields * @param int $required Is field required or not * @param int $pos Position of attribute * @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) + * @param int $alwayseditable Is attribute always editable regardless of the document status * @return int >0 if OK, <=0 if KO */ - function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='') + function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0) { $table=$elementtype.'_extrafields'; @@ -385,7 +390,7 @@ class ExtraFields { if ($label) { - $result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required,$pos,$param); + $result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required,$pos,$param,$alwayseditable); } if ($result > 0) { @@ -433,9 +438,10 @@ class ExtraFields * @param int $required Is field required or not * @param int $pos Position of attribute * @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) + * @param int $alwayseditable Is attribute always editable regardless of the document status * @return int <=0 if KO, >0 if OK */ - private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='') + private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0) { global $conf; dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required); @@ -466,6 +472,7 @@ class ExtraFields $sql.= " fieldunique,"; $sql.= " fieldrequired,"; $sql.= " pos,"; + $sql.= " alwayseditable,"; $sql.= " param"; $sql.= ") VALUES ("; $sql.= "'".$attrname."',"; @@ -477,6 +484,7 @@ class ExtraFields $sql.= " '".$unique."',"; $sql.= " '".$required."',"; $sql.= " '".$pos."',"; + $sql.= " '".$alwayseditable."',"; $sql.= " '".$param."'"; $sql.= ")"; dol_syslog(get_class($this)."::update_label", LOG_DEBUG); @@ -503,34 +511,22 @@ class ExtraFields /** - * Load array of labels - * - * @return void - */ - function fetch_optionals() - { - $this->fetch_name_optionals_label(); - } - - - /** - * Load array this->attribute_label + * Load array this->attribute_xxx like attribute_label, attribute_type, ... * * @param string $elementtype Type of element ('adherent', 'commande', societe', 'facture', 'propal', 'product', ...) * @param boolean $forceload Force load of extra fields whatever is option MAIN_EXTRAFIELDS_DISABLED * @return array Array of attributes for all extra fields */ - function fetch_name_optionals_label($elementtype='adherent',$forceload=false) + function fetch_name_optionals_label($elementtype,$forceload=false) { global $conf; $array_name_label=array(); // For avoid conflicts with external modules - if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) - return $array_name_label; + if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return $array_name_label; - $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos"; + $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable"; $sql.= " FROM ".MAIN_DB_PREFIX."extrafields"; $sql.= " WHERE entity IN (0,".$conf->entity.")"; if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'"; @@ -558,15 +554,16 @@ class ExtraFields $this->attribute_required[$tab->name]=$tab->fieldrequired; $this->attribute_param[$tab->name]=unserialize($tab->param); $this->attribute_pos[$tab->name]=$tab->pos; + $this->attribute_alwayseditable[$tab->name]=$tab->alwayseditable; } } - - return $array_name_label; } else { print dol_print_error($this->db); } + + return $array_name_label; } @@ -743,15 +740,17 @@ class ExtraFields if (strpos($InfoFieldList[4], 'extra')!==false) { $sql.= ' as main, '.MAIN_DB_PREFIX .$InfoFieldList[0].'_extrafields as extra'; - $sqlwhere.= ' AND extra.fk_object=main.'.$InfoFieldList[2]. ' AND '.$InfoFieldList[4]; + $sqlwhere.= ' WHERE extra.fk_object=main.'.$InfoFieldList[2]. ' AND '.$InfoFieldList[4]; } else { - $sqlwhere.= ' AND '.$InfoFieldList[4]; + $sqlwhere.= ' WHERE '.$InfoFieldList[4]; } + }else { + $sqlwhere.= ' WHERE 1'; } if (in_array($InfoFieldList[0],array('tablewithentity'))) $sqlwhere.= ' AND entity = '.$conf->entity; // Some tables may have field, some other not. For the moment we disable it. - $sql.=preg_replace('/^ AND /','',$sqlwhere); + //$sql.=preg_replace('/^ AND /','',$sqlwhere); //print $sql; dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG); @@ -979,7 +978,10 @@ class ExtraFields { foreach ($fields_label as $field_toshow) { - $translabel=$langs->trans($obj->$field_toshow); + $translabel=''; + if (!empty($obj->$field_toshow)) { + $translabel=$langs->trans($obj->$field_toshow); + } if ($translabel!=$field_toshow) { $value.=dol_trunc($translabel,18).' '; }else { @@ -989,7 +991,10 @@ class ExtraFields } else { - $translabel=$langs->trans($obj->$InfoFieldList[1]); + $translabel=''; + if (!empty($obj->$InfoFieldList[1])) { + $translabel=$langs->trans($obj->$InfoFieldList[1]); + } if ($translabel!=$obj->$InfoFieldList[1]) { $value=dol_trunc($translabel,18); }else { @@ -1040,7 +1045,7 @@ class ExtraFields * Fill array_options property of object by extrafields value (using for data sent by forms) * * @param array $extralabels $array of extrafields - * @param object &$object Object + * @param object $object Object * @param string $onlykey Only following key is filled * @return int 1 if array_options set / 0 if no value */ diff --git a/htdocs/core/class/google.class.php b/htdocs/core/class/google.class.php index 7f36c6f0d99..b0649f575fc 100644 --- a/htdocs/core/class/google.class.php +++ b/htdocs/core/class/google.class.php @@ -36,7 +36,6 @@ class GoogleAPI * * @param DoliDB $db Database handler * @param string $key Google key - * @return GoogleAPI */ function __construct($db,$key) { diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 3afcd941ee9..3ad0ec897f9 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2010-2012 Regis Houssin + * Copyright (C) 2010-2014 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -47,7 +47,7 @@ class HookManager /** * Constructor * - * @param DoliDB $db Handler acces base de donnees + * @param DoliDB $db Database handler */ function __construct($db) { @@ -56,13 +56,13 @@ class HookManager /** - * Init array this->hooks with instantiated action controlers. + * Init array $this->hooks with instantiated action controlers. * First, a hook is declared by a module by adding a constant MAIN_MODULE_MYMODULENAME_HOOKS * with value 'nameofcontext1:nameofcontext2:...' into $this->const of module descriptor file. - * This make conf->hooks_modules loaded with an entry ('modulename'=>array(nameofcontext1,nameofcontext2,...)) - * When initHooks function is called, with initHooks(list_of_contexts), an array this->hooks is defined with instance of controler + * This makes $conf->hooks_modules loaded with an entry ('modulename'=>array(nameofcontext1,nameofcontext2,...)) + * When initHooks function is called, with initHooks(list_of_contexts), an array $this->hooks is defined with instance of controler * class found into file /mymodule/class/actions_mymodule.class.php (if module has declared the context as a managed context). - * Then when a hook is executeHook('aMethod'...) is called, the method aMethod found into class will be executed. + * Then when a hook executeHooks('aMethod'...) is called, the method aMethod found into class will be executed. * * @param array $arraycontext Array list of searched hooks tab/features. For example: 'thirdpartycard' (for hook methods into page card thirdparty), 'thirdpartydao' (for hook methods into Societe), ... * @return int Always 1 @@ -114,9 +114,9 @@ class HookManager * * @param string $method Name of method hooked ('doActions', 'printSearchForm', 'showInputField', ...) * @param array $parameters Array of parameters - * @param Object &$object Object to use hooks on - * @param string &$action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...) - * @return mixed For doActions,formObjectOptions,pdf_xxx: Return 0 if we want to keep standard actions, >0 if if want to stop standard actions, <0 means KO. + * @param Object $object Object to use hooks on + * @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...) + * @return mixed For doActions,formObjectOptions,pdf_xxx: Return 0 if we want to keep standard actions, >0 if we want to stop standard actions, <0 means KO. * For printSearchForm,printLeftBlock,printTopRightMenu,formAddObjectLine,...: Return HTML string. TODO Deprecated. Must always return an int and things to print into ->resprints. * Can also return some values into an array ->results. * $this->error or this->errors are also defined by class called by this function if error. @@ -131,6 +131,7 @@ class HookManager // Define type of hook ('output', 'returnvalue' or 'addreplace'). 'addreplace' should be type for all hooks. 'output' and 'returnvalue' are deprecated. $hooktype='output'; if (preg_match('/^pdf_/',$method)) $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are returnvalue hooks. When there is 2 hooks of this type, only last one win. + if ($method =='insertExtraFields') $hooktype='returnvalue'; if (in_array( $method, array( @@ -144,15 +145,16 @@ class HookManager 'moveUploadedFile', 'pdf_writelinedesc', 'paymentsupplierinvoices', - 'printSearchForm' + 'printSearchForm', + 'formatEvent' ) )) $hooktype='addreplace'; - // Loop on each hook to qualify modules that declared context + // Loop on each hook to qualify modules that have declared context $modulealreadyexecuted=array(); $resaction=0; $error=0; $result=''; $this->resPrint=''; $this->resArray=array(); - foreach($this->hooks as $modules) // this->hooks is an array with context as key and value is an array of modules that handle this context + foreach($this->hooks as $context => $modules) // $this->hooks is an array with context as key and value is an array of modules that handle this context { if (! empty($modules)) { @@ -160,27 +162,29 @@ class HookManager { //print "Before hook ".get_class($actionclassinstance)." method=".$method." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction." result=".$result."
    \n"; - //print 'class='.get_class($actionclassinstance).' method='.$method.' action='.$action; - // jump to next class if method does not exists + // jump to next module/class if method does not exist if (! method_exists($actionclassinstance,$method)) continue; - // test to avoid to run twice a hook, when a module implements several active contexts + + // test to avoid running twice a hook, when a module implements several active contexts if (in_array($module,$modulealreadyexecuted)) continue; - $modulealreadyexecuted[$module]=$module; + $modulealreadyexecuted[$module]=$module; // Use the $currentcontext in method to avoid running twice + + // Clean class (an error may have been set from a previous call of another method for same module/hook) + $actionclassinstance->error=0; + $actionclassinstance->errors=array(); + + // Add current context to avoid method execution in bad context, you can add this test in your method : eg if($currentcontext != 'formfile') return; + $parameters['currentcontext'] = $context; // Hooks that must return int (hooks with type 'addreplace') if ($hooktype == 'addreplace') { + dol_syslog("Call method ".$method." of class ".get_class($actionclassinstance).", module=".$module.", hooktype=".$hooktype, LOG_DEBUG); $resaction += $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example) if ($resaction < 0 || ! empty($actionclassinstance->error) || (! empty($actionclassinstance->errors) && count($actionclassinstance->errors) > 0)) { $error++; $this->error=$actionclassinstance->error; $this->errors=array_merge($this->errors, (array) $actionclassinstance->errors); - // TODO dead code to remove (do not enable this, but fix hook instead) - /* Change must be inside the method of hook if required. Only hook must decide if $action must be modified or not. - if ($method == 'doActions') - { - if ($action=='add') $action='create'; - if ($action=='update') $action='edit'; - }*/ + dol_syslog("Error on hook module=".$module.", method ".$method.", class ".get_class($actionclassinstance).", hooktype=".$hooktype.(empty($this->error)?'':" ".$this->error).(empty($this->errors)?'':" ".join(",",$this->errors)), LOG_ERR); } if (is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results); @@ -192,6 +196,7 @@ class HookManager // TODO. this should be done into the method of hook by returning nothing if (is_array($parameters) && ! empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number) continue; + //dol_syslog("Call method ".$method." of class ".get_class($actionclassinstance).", module=".$module.", hooktype=".$hooktype, LOG_DEBUG); $result = $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example) if (! empty($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php old mode 100644 new mode 100755 index 6b0e9b4d895..46e99ba272e --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2013 Regis Houssin + * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2006 Marc Barilley/Ocebo * Copyright (C) 2007 Franky Van Liedekerke @@ -12,8 +12,9 @@ * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2010-2014 Philippe Grand * Copyright (C) 2011 Herve Prot - * Copyright (C) 2012 Marcos García + * Copyright (C) 2012-2014 Marcos García * Copyright (C) 2013 Raphaël Doursenaud + * Copyright (C) 2014 Alexandre Spangaro * * 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 @@ -124,11 +125,11 @@ class Form * @param string $typeofdata Type of data ('string' by default, 'amount', 'email', 'numeric:99', 'text' or 'textarea:rows:cols', 'day' or 'datepicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select:xxx'...) * @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of value). Use '' to use same than $value * @param object $extObject External object - * @param string $success Success message + * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') * @param string $moreparam More param to add on a href URL * @return string HTML edit field */ - function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata='string', $editvalue='', $extObject=null, $success=null, $moreparam='') + function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata='string', $editvalue='', $extObject=null, $custommsg=null, $moreparam='') { global $conf,$langs,$db; @@ -140,7 +141,7 @@ class Form // When option to edit inline is activated if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && ! preg_match('/^select;|datehourpicker/',$typeofdata)) // TODO add jquery timepicker { - $ret.=$this->editInPlace($object, $value, $htmlname, $perm, $typeofdata, $editvalue, $extObject, $success); + $ret.=$this->editInPlace($object, $value, $htmlname, $perm, $typeofdata, $editvalue, $extObject, $custommsg); } else { @@ -193,7 +194,7 @@ class Form { $ret.='
    '; } @@ -244,10 +245,10 @@ class Form * @param string $inputType Type of input ('numeric', 'datepicker', 'textarea:rows:cols', 'ckeditor:dolibarr_zzz:width:height:?:1:rows:cols', 'select:xxx') * @param string $editvalue When in edit mode, use this value as $value instead of value * @param object $extObject External object - * @param string $success Success message + * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') * @return string HTML edit in place */ - private function editInPlace($object, $value, $htmlname, $condition, $inputType='textarea', $editvalue=null, $extObject=null, $success=null) + private function editInPlace($object, $value, $htmlname, $condition, $inputType='textarea', $editvalue=null, $extObject=null, $custommsg=null) { global $conf; @@ -334,7 +335,18 @@ class Form $out.= ''."\n"; if (! empty($savemethod)) $out.= ''."\n"; if (! empty($ext_element)) $out.= ''."\n"; - if (! empty($success)) $out.= ''."\n"; + if (! empty($custommsg)) + { + if (is_array($custommsg)) + { + if (!empty($custommsg['success'])) + $out.= ''."\n"; + if (!empty($custommsg['error'])) + $out.= ''."\n"; + } + else + $out.= ''."\n"; + } if ($inputType == 'textarea') { $out.= ''."\n"; $out.= ''."\n"; @@ -387,16 +399,28 @@ class Form if ($tooltipon == 1 || $tooltipon == 3) $paramfortooltiptd=' class="classfortooltip'.($extracss?' '.$extracss:'').'" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td tag to store tooltip else $paramfortooltiptd =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag $s=""; - if (empty($notabs)) $s.='
    '.$langs->trans('Margins').''.$langs->trans('SellingPrice').''.$langs->trans('Margins').''.$langs->trans('SellingPrice').''.$langs->trans('BuyingPrice').''.$langs->trans('BuyingPrice').''.$langs->trans('CostPrice').''.$langs->trans('Margin').''.$langs->trans('CostPrice').''.$langs->trans('Margin').''.$langs->trans('MarginRate').''.$langs->trans('MarginRate').''.$langs->trans('MarkRate').''.$langs->trans('MarkRate').'
    '.$label.'
    '; $ret.=''; - $ret.='
    '."\n"; + if (preg_match('/ckeditor|textarea/',$typeofdata)) $ret.='
    '."\n"; $ret.=''; $ret.='
    '; - if ($direction < 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14">'.$img.''; + if (empty($notabs)) $s.='
    '; + if ($direction < 0) { + $s.='<'.$tag.$paramfortooltipimg; + if ($tag == 'td') { + $s .= ' valign="top" width="14"'; + } + $s.= '>'.$img.''; + } // Use another method to help avoid having a space in value in order to use this value with jquery // TODO add this in css - //if ($text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.(($direction < 0)?' ':'').$text.(($direction > 0)?' ':'').''; + //if ($text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.(($direction < 0)?' ':'').$text.(($direction > 0)?' ':'').''; $paramfortooltiptd.= (($direction < 0)?' style="padding-left: 3px !important;"':''); $paramfortooltiptd.= (($direction > 0)?' style="padding-right: 3px !important;"':''); - if ((string) $text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.$text.''; - if ($direction > 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14">'.$img.''; - if (empty($notabs)) $s.='
    '; + if ((string) $text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.$text.''; + if ($direction > 0) { + $s.='<'.$tag.$paramfortooltipimg; + if ($tag == 'td') { + $s .= ' valign="top" width="14"'; + } + $s.= '>'.$img.''; + } + if (empty($notabs)) $s.=''; return $s; } @@ -466,9 +490,11 @@ class Form $out=''; $countryArray=array(); + $favorite=array(); $label=array(); + $atleastonefavorite=0; - $sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label"; + $sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite"; $sql.= " FROM ".MAIN_DB_PREFIX."c_country"; $sql.= " WHERE active = 1"; //$sql.= " ORDER BY code ASC"; @@ -491,15 +517,22 @@ class Form $countryArray[$i]['code_iso'] = $obj->code_iso; $countryArray[$i]['code_iso3'] = $obj->code_iso3; $countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso)!="Country".$obj->code_iso?$langs->transnoentitiesnoconv("Country".$obj->code_iso):($obj->label!='-'?$obj->label:'')); - $label[$i] = dol_string_unaccent($countryArray[$i]['label']); + $countryArray[$i]['favorite'] = $obj->favorite; + $favorite[$i] = $obj->favorite; + $label[$i] = dol_string_unaccent($countryArray[$i]['label']); $i++; } - array_multisort($label, SORT_ASC, $countryArray); + array_multisort($favorite, SORT_DESC, $label, SORT_ASC, $countryArray); foreach ($countryArray as $row) { - //print 'rr'.$selected.'-'.$row['label'].'-'.$row['code_iso'].'
    '; + if ($row['favorite'] && $row['code_iso']) $atleastonefavorite++; + if (empty($row['favorite']) && $atleastonefavorite) + { + $atleastonefavorite=0; + $out.= ''; + } if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label']) ) { $foundselected=true; @@ -725,7 +758,7 @@ class Form * @param int $showempty Add an empty field * @param int $showtype Show third party type in combolist (customer, prospect or supplier) * @param int $forcecombo Force to use combo box - * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) + * @param array $events Event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @param int $limit Maximum number of elements * @return string HTML string with * @deprecated Use select_thirdparty instead @@ -758,7 +791,7 @@ class Form $outarray=array(); // On recherche les societes - $sql = "SELECT s.rowid, s.nom, s.client, s.fournisseur, s.code_client, s.code_fournisseur"; + $sql = "SELECT s.rowid, s.nom as name, s.client, s.fournisseur, s.code_client, s.code_fournisseur"; $sql.= " FROM ".MAIN_DB_PREFIX ."societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.entity IN (".getEntity('societe', 1).")"; @@ -795,17 +828,20 @@ class Form $resql=$this->db->query($sql); if ($resql) { - if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT) && ! $forcecombo) + if ($conf->use_javascript_ajax && ! $forcecombo) { include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; $out.= ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT); + $nodatarole=' data-role="none"'; } // Construct $out and $outarray - $out.= ''."\n"; - $textifempty=' '; - if (! empty($conf->use_javascript_ajax) || $forcecombo) $textifempty=' '; + $textifempty=''; + // Do not use textempty = ' ' or ' ' here, or search on key will search on ' key'. + //$textifempty=' '; + //if (! empty($conf->use_javascript_ajax) || $forcecombo) $textifempty=''; if ($showempty) $out.= ''."\n"; $num = $this->db->num_rows($resql); @@ -823,11 +859,11 @@ class Form if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) { $label .= $obj->code_fournisseur. ' - '; } - $label.=' '.$obj->nom; + $label.=' '.$obj->name; } else { - $label=$obj->nom; + $label=$obj->name; } if ($showtype) @@ -983,16 +1019,12 @@ class Form // On recherche les societes $sql = "SELECT sp.rowid, sp.lastname, sp.statut, sp.firstname, sp.poste"; - if ($showsoc > 0) { - $sql.= " , s.nom as company"; - } + if ($showsoc > 0) $sql.= " , s.nom as company"; $sql.= " FROM ".MAIN_DB_PREFIX ."socpeople as sp"; - if ($showsoc > 0) { - $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX ."societe as s ON s.rowid=sp.fk_soc "; - } + if ($showsoc > 0) $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX ."societe as s ON s.rowid=sp.fk_soc"; $sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")"; if ($socid > 0) $sql.= " AND sp.fk_soc=".$socid; - if (! empty($conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) $sql.= " AND sp.statut<>0 "; + if (! empty($conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) $sql.= " AND sp.statut<>0"; $sql.= " ORDER BY sp.lastname ASC"; dol_syslog(get_class($this)."::select_contacts", LOG_DEBUG); @@ -1001,13 +1033,14 @@ class Form { $num=$this->db->num_rows($resql); - if ($conf->use_javascript_ajax && $conf->global->CONTACT_USE_SEARCH_TO_SELECT && ! $forcecombo && ! $options_only) + if ($conf->use_javascript_ajax && ! $forcecombo && ! $options_only) { include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; $out.= ajax_combobox($htmlname, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT); + $nodatarole=' data-role="none"'; } - if ($htmlname != 'none' || $options_only) $out.= ''; if ($showempty == 1) $out.= ''; if ($showempty == 2) $out.= ''; $num = $this->db->num_rows($resql); @@ -1126,6 +1159,9 @@ class Form // If no preselected user defined, we take current user if ((is_numeric($selected) && ($selected < -1 || empty($selected))) && empty($conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) $selected=$user->id; + $excludeUsers=null; + $includeUsers=null; + // Permettre l'exclusion d'utilisateurs if (is_array($exclude)) $excludeUsers = implode("','",$exclude); // Permettre l'inclusion d'utilisateurs @@ -1161,7 +1197,7 @@ class Form else $sql.= " WHERE u.entity IS NOT NULL"; } else - { + { if (! empty($conf->multicompany->transverse_mode)) { $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug"; @@ -1177,7 +1213,7 @@ class Form if (is_array($exclude) && $excludeUsers) $sql.= " AND u.rowid NOT IN ('".$excludeUsers."')"; if (is_array($include) && $includeUsers) $sql.= " AND u.rowid IN ('".$includeUsers."')"; if (! empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX)) $sql.= " AND u.statut <> 0"; - if (! empty($morefilter)) $sql.=$morefilter; + if (! empty($morefilter)) $sql.=" ".$morefilter; $sql.= " ORDER BY u.lastname ASC"; dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG); @@ -1188,7 +1224,15 @@ class Form $i = 0; if ($num) { - $out.= ''; if ($show_empty) $out.= ''."\n"; $userstatic=new User($this->db); @@ -1247,7 +1291,7 @@ class Form } else { - $out.=($moreinfo?' - ':' (').$obj->label; + $out.=($moreinfo?' - ':' (').($obj->label?$obj->label:$langs->trans("EntityNameNotDefined")); $moreinfo++; } } @@ -1259,7 +1303,7 @@ class Form } else { - $out.= ''; $out.= ''; } $out.= ''; @@ -1275,7 +1319,9 @@ class Form /** * Return select list of users. Selected users are stored into session. + * List of users are provided into $_SESSION['assignedtouser']. * + * @param string $action Value for $action * @param string $htmlname Field name in form * @param int $show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue * @param array $exclude Array list of users id to exclude @@ -1289,30 +1335,47 @@ class Form * @return string HTML select string * @see select_dolgroups */ - function select_dolusers_forevent($htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='') + function select_dolusers_forevent($action='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='') { global $conf,$user,$langs; $userstatic=new User($this->db); + $out=''; // Method with no ajax //$out.=''; - $out=$this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); - $out.=''; + if ($action == 'view') + { + $out.=''; + } + else + { + $out.=''; + $out.=''; + $out.=$this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); + $out.=''; + } $assignedtouser=array(); - if (!empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true); - if (count($assignedtouser)) $out.='
    '; - // dol_json_decode may return false on error which is not traversable - if (is_array($assignedtouser)) { - foreach($assignedtouser as $key => $value) - { - $userstatic->fetch($key); - $out.=$userstatic->getNomUrl(1); - //$out.=' '.($value['mandatory']?$langs->trans("Mandatory"):$langs->trans("Optional")); - //$out.=' '.($value['transparency']?$langs->trans("Busy"):$langs->trans("NotBusy")); - $out.='
    '; - } - } + if (!empty($_SESSION['assignedtouser'])) + { + $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true); + } + $nbassignetouser=count($assignedtouser); + + if ($nbassignetouser && $action != 'view') $out.='
    '; + $i=0; $ownerid=0; + foreach($assignedtouser as $key => $value) + { + if ($value['id'] == $ownerid) continue; + $userstatic->fetch($value['id']); + $out.=$userstatic->getNomUrl(1); + if ($i == 0) { $ownerid = $value['id']; $out.=' ('.$langs->trans("Owner").')'; } + if ($nbassignetouser > 1 && $action != 'view') $out.=' '; + //$out.=' '.($value['mandatory']?$langs->trans("Mandatory"):$langs->trans("Optional")); + //$out.=' '.($value['transparency']?$langs->trans("Busy"):$langs->trans("NotBusy")); + $out.='
    '; + $i++; + } //$out.=''; return $out; @@ -1556,9 +1619,9 @@ class Form /** * constructProductListOption * - * @param resultset &$objp Resultset of fetch - * @param string &$opt Option - * @param string &$optJson Option + * @param resultset $objp Resultset of fetch + * @param string $opt Option + * @param string $optJson Option * @param int $price_level Price level * @param string $selected Preselected value * @return void @@ -1580,6 +1643,8 @@ class Form $outqty=1; $outdiscount=0; + $maxlengtharticle=(empty($conf->global->PRODUCT_MAX_LENGTH_COMBO)?48:$conf->global->PRODUCT_MAX_LENGTH_COMBO); + $label=$objp->label; if (! empty($objp->label_translated)) $label=$objp->label_translated; if (! empty($filterkey) && $filterkey != '') $label=preg_replace('/('.preg_quote($filterkey).')/i','$1',$label,1); @@ -1599,11 +1664,11 @@ class Form else if ($objp->stock <= 0) $opt.= ' class="product_line_stock_too_low"'; } $opt.= '>'; - $opt.= $objp->ref.' - '.dol_trunc($label,32).' - '; + $opt.= $objp->ref.' - '.dol_trunc($label,$maxlengtharticle).' - '; $objRef = $objp->ref; if (! empty($filterkey) && $filterkey != '') $objRef=preg_replace('/('.preg_quote($filterkey).')/i','$1',$objRef,1); - $outval.=$objRef.' - '.dol_trunc($label,32).' - '; + $outval.=$objRef.' - '.dol_trunc($label,$maxlengtharticle).' - '; $found=0; @@ -1649,7 +1714,7 @@ class Form } // Price by quantity - if (!empty($objp->quantity) && $objp->quantity >= 1 && $conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) + if (!empty($objp->quantity) && $objp->quantity >= 1 && ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) { $found = 1; $outqty=$objp->quantity; @@ -1775,7 +1840,7 @@ class Form // mode=2 means suppliers products $urloption=($socid > 0?'socid='.$socid.'&':'').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished; print ajax_autocompleter('', $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); - print ($hidelabel?'':$langs->trans("RefOrLabel").' : ').''; + print ($hidelabel?'':$langs->trans("RefOrLabel").' : ').''; } else { @@ -1794,11 +1859,12 @@ class Form * @param string $filterkey Filtre des produits * @param int $statut -1=Return all products, 0=Products not on sell, 1=Products on sell * @param int $outputmode 0=HTML select string, 1=Array + * @param int $limit Limit of line number * @return array Array of keys for json */ - function select_produits_fournisseurs_list($socid,$selected='',$htmlname='productid',$filtertype='',$filtre='',$filterkey='',$statut=-1,$outputmode=0) + function select_produits_fournisseurs_list($socid,$selected='',$htmlname='productid',$filtertype='',$filtre='',$filterkey='',$statut=-1,$outputmode=0,$limit=100) { - global $langs,$conf; + global $langs,$conf,$db; $out=''; $outarray=array(); @@ -1807,7 +1873,7 @@ class Form $sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration,"; $sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,"; - $sql.= " s.nom"; + $sql.= " pfp.fk_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; if ($socid) $sql.= " AND pfp.fk_soc = ".$socid; @@ -1836,6 +1902,7 @@ class Form $sql.=')'; } $sql.= " ORDER BY pfp.ref_fourn DESC, pfp.quantity ASC"; + $sql.= $db->plimit($limit); // Build output string @@ -1843,6 +1910,7 @@ class Form $result=$this->db->query($sql); if ($result) { + require_once DOL_DOCUMENT_ROOT.'/product/class/priceparser.class.php'; $num = $this->db->num_rows($result); @@ -1880,13 +1948,24 @@ class Form $outval.=$objRef; if (! empty($objp->idprodfournprice)) $outval.=' ('.$objRefFourn.')'; $outval.=' - '; - $opt.=dol_trunc($objp->label,18).' - '; - $outval.=dol_trunc($label,18).' - '; + $opt.=dol_trunc($label, 72).' - '; + $outval.=dol_trunc($label, 72).' - '; if (! empty($objp->idprodfournprice)) { $outqty=$objp->quantity; $outdiscount=$objp->remise_percent; + if (!empty($objp->fk_price_expression)) { + $priceparser = new PriceParser($this->db); + $price_result = $priceparser->parseProductSupplier($objp->fk_product, $objp->fk_price_expression, $objp->quantity, $objp->tva_tx); + if ($price_result >= 0) { + $objp->fprice = $price_result; + if ($objp->quantity >= 1) + { + $objp->unitprice = $objp->fprice / $objp->quantity; + } + } + } if ($objp->quantity == 1) { $opt.= price($objp->fprice,1,$langs,0,0,-1,$conf->currency)."/"; @@ -1919,8 +1998,8 @@ class Form } if (! $socid) { - $opt .= " - ".dol_trunc($objp->nom,8); - $outval.=" - ".dol_trunc($objp->nom,8); + $opt .= " - ".dol_trunc($objp->name,8); + $outval.=" - ".dol_trunc($objp->name,8); } } else @@ -1975,7 +2054,7 @@ class Form $sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration,"; $sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.unitprice,"; - $sql.= " s.nom"; + $sql.= " pfp.fk_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid"; @@ -2000,6 +2079,7 @@ class Form } else { + require_once DOL_DOCUMENT_ROOT.'/product/class/priceparser.class.php'; $form.= ''; $i = 0; @@ -2012,8 +2092,19 @@ class Form if($num == 1) { $opt .= ' selected="selected"'; } - $opt.= '>'.$objp->nom.' - '.$objp->ref_fourn.' - '; + $opt.= '>'.$objp->name.' - '.$objp->ref_fourn.' - '; + if (!empty($objp->fk_price_expression)) { + $priceparser = new PriceParser($this->db); + $price_result = $priceparser->parseProductSupplier($objp->fk_product, $objp->fk_price_expression, $objp->quantity, $objp->tva_tx); + if ($price_result >= 0) { + $objp->fprice = $price_result; + if ($objp->quantity >= 1) + { + $objp->unitprice = $objp->fprice / $objp->quantity; + } + } + } if ($objp->quantity == 1) { $opt.= price($objp->fprice,1,$langs,0,0,-1,$conf->currency)."/"; @@ -2522,7 +2613,7 @@ class Form $i++; } print ""; - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); } else { print $langs->trans("NoShippingMethodDefined"); } @@ -2675,6 +2766,7 @@ class Form * @param int $maxlength Maximum length for labels * @param int $excludeafterid Exclude all categories after this leaf in category tree. * @return void + * @see select_categories */ function select_all_categories($type, $selected='', $htmlname="parent", $maxlength=64, $excludeafterid=0) { @@ -2798,8 +2890,8 @@ class Form } else if ($input['type'] == 'select') { - $more.=''; - if (! empty($input['label'])) $more.=$input['label'].''; + $more.=''; + if (! empty($input['label'])) $more.=$input['label'].''; $more.=$this->selectarray($input['name'],$input['values'],$input['default'],1); $more.=''."\n"; } @@ -2846,7 +2938,7 @@ class Form // JQUI method dialog is broken with jmobile, we use standard HTML. // Note: When using dol_use_jmobile or no js, you must also check code for button use a GET url with action=xxx and check that you also output the confirm code when action=xxx - // See page product/fiche.php for example + // See page product/card.php for example if (! empty($conf->dol_use_jmobile)) $useajax=0; if (empty($conf->use_javascript_ajax)) $useajax=0; @@ -2877,12 +2969,13 @@ class Form // Show JQuery confirm box. Note that global var $useglobalvars is used inside this template $formconfirm.= ''; + $formconfirm.= ''."\n"; - $formconfirm.= ''; + $formconfirm.= "\n"; } else { $formconfirm.= "\n\n"; $formconfirm.= '
    '."\n"; - $formconfirm.= ''; + $formconfirm.= ''."\n"; $formconfirm.= ''."\n"; $formconfirm.= ''."\n"; @@ -2995,13 +3089,14 @@ class Form /** * Show a form to select a project * - * @param int $page Page - * @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id) - * @param int $selected Id pre-selected project - * @param string $htmlname Name of select field + * @param int $page Page + * @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id) + * @param int $selected Id pre-selected project + * @param string $htmlname Name of select field + * @param int $discard_closed Hide all closed projects * @return void */ - function form_project($page, $socid, $selected='', $htmlname='projectid') + function form_project($page, $socid, $selected='', $htmlname='projectid', $discard_closed=0) { global $langs; @@ -3018,8 +3113,7 @@ class Form print ''; print '
    '; print ''; print ''; print '
    '; - //print "$socid,$selected,$htmlname"; - $formproject->select_projects($socid,$selected,$htmlname); + $formproject->select_projects($socid,$selected,$htmlname,20,0,1,$discard_closed); print '
    '; @@ -3030,7 +3124,7 @@ class Form { $projet = new Project($this->db); $projet->fetch($selected); - //print ''.$projet->title.''; + //print ''.$projet->title.''; print $projet->getNomUrl(0,'',1); } else @@ -3046,7 +3140,7 @@ class Form * @param int $page Page * @param string $selected Id condition pre-selectionne * @param string $htmlname Name of select html field - * @param int $addempty Ajoute entree vide + * @param int $addempty Add empty entry * @return void */ function form_conditions_reglement($page, $selected='', $htmlname='cond_reglement_id', $addempty=0) @@ -3363,7 +3457,7 @@ class Form { $addcontact = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); print 'Cette societe n\'a pas de contact, veuillez en cr�er un avant de faire votre proposition commerciale
    '; - print ''.$addcontact.''; + print ''.$addcontact.''; } print ''; print ''; @@ -3691,7 +3785,7 @@ class Form * @param string $prefix Prefix for fields name * @param int $h 1=Show also hours * @param int $m 1=Show also minutes - * @param int $empty 0=Fields required, 1=Empty input is allowed + * @param int $empty 0=Fields required, 1=Empty inputs are allowed, 2=Empty inputs are allowed for hours only * @param string $form_name Not used * @param int $d 1=Show days, month, years * @param int $addnowbutton Add a button "Now" @@ -3710,9 +3804,13 @@ class Form if($prefix=='') $prefix='re'; if($h == '') $h=0; if($m == '') $m=0; - if($empty == '') $empty=0; + $emptydate=0; + $emptyhours=0; + if ($empty == 1) { $emptydate=1; $emptyhours=1; } + if ($empty == 2) { $emptydate=0; $emptyhours=1; } + $orig_set_time=$set_time; - if ($set_time === '' && $empty == 0) + if ($set_time === '' && $emptydate == 0) { include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $set_time = dol_now('tzuser')-(getServerTimeZoneInt('now')*3600); // set_time must be relative to PHP server timezone @@ -3734,8 +3832,11 @@ class Form $syear = dol_print_date($set_time, "%Y"); $smonth = dol_print_date($set_time, "%m"); $sday = dol_print_date($set_time, "%d"); - $shour = dol_print_date($set_time, "%H"); - $smin = dol_print_date($set_time, "%M"); + if ($orig_set_time != '') + { + $shour = dol_print_date($set_time, "%H"); + $smin = dol_print_date($set_time, "%M"); + } } else { @@ -3797,7 +3898,7 @@ class Form // Day $retstring.=''; - if ($empty || $set_time == -1) + if ($emptydate || $set_time == -1) { $retstring.=''; } @@ -3810,7 +3911,7 @@ class Form $retstring.=""; $retstring.=''; - if ($empty || $set_time == -1) + if ($emptydate || $set_time == -1) { $retstring.=''; } @@ -3825,7 +3926,7 @@ class Form $retstring.=""; // Year - if ($empty || $set_time == -1) + if ($emptydate || $set_time == -1) { $retstring.=''; } @@ -3848,7 +3949,7 @@ class Form { // Show hour $retstring.=''; - if ($empty) $retstring.=''; + if ($emptyhours) $retstring.=''; for ($hour = 0; $hour < 24; $hour++) { if (strlen($hour) < 2) $hour = "0" . $hour; @@ -3862,7 +3963,7 @@ class Form { // Show minutes $retstring.=''; - if ($empty) $retstring.=''; + if ($emptyhours) $retstring.=''; for ($min = 0; $min < 60 ; $min++) { if (strlen($min) < 2) $min = "0" . $min; @@ -3921,18 +4022,22 @@ class Form /** * Function to show a form to select a duration on a page * - * @param string $prefix Prefix + * @param string $prefix Prefix for input fields * @param int $iSecond Default preselected duration (number of seconds) * @param int $disabled Disable the combo box * @param string $typehour If 'select' then input hour and input min is a combo, if 'text' input hour is in text and input min is a combo * @param string $minunderhours If 1, show minutes selection under the hours + * @param int $nooutput Do not output html string but return it * @return void */ - function select_duration($prefix, $iSecond='', $disabled=0, $typehour='select', $minunderhours=0) + function select_duration($prefix, $iSecond='', $disabled=0, $typehour='select', $minunderhours=0, $nooutput=0) { global $langs; + $retstring=''; + $hourSelected=0; $minSelected=0; + if ($iSecond) { require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -3943,36 +4048,51 @@ class Form if ($typehour=='select') { - print ''; for ($hour = 0; $hour < 25; $hour++) // For a duration, we allow 24 hours { - print '"; + $retstring.=">".$hour.""; } - print ""; + $retstring.=""; } elseif ($typehour=='text') { - print ''; + $retstring.=''; } - print $langs->trans('Hours'); + else return 'BadValueForParameterTypeHour'; - if ($minunderhours) print '
    '; - else print " "; + $retstring.=' '.$langs->trans('HourShort'); - print ''; + for ($min = 0; $min <= 55; $min=$min+5) + { + $retstring.=''."\n"; - unset($array[$key]); - } - } - } - - if (! empty($array)) - { - foreach ($array as $key => $value) - { - $out.= ''."\n"; - } - } - } - else + if (! empty($array)) { foreach ($array as $key => $value) { @@ -4108,7 +4234,7 @@ class Form } $out.= '>'; - $newval = ($translate ? $langs->trans(ucfirst($value)) : $value); + $newval = ($translate ? $langs->trans($value) : $value); $newval = ($key_in_label ? $key.' - '.$newval : $newval); $out.= dol_htmlentitiesbr($newval); $out.= ''."\n"; @@ -4124,18 +4250,18 @@ class Form /** * Return an html string with a select combo box to choose yes or no * - * @param string $htmlname Name of html select field - * @param string $value Pre-selected value - * @param int $option 0 return yes/no, 1 return 1/0 - * @param bool $disabled true or false - * @return mixed See option + * @param string $htmlname Name of html select field + * @param string $value Pre-selected value + * @param int $option 0 return yes/no, 1 return 1/0 + * @param bool $disabled true or false + * @param useempty $useempty 1=Add empty line + * @return mixed See option */ - function selectyesno($htmlname,$value='',$option=0,$disabled=false) + function selectyesno($htmlname,$value='',$option=0,$disabled=false,$useempty='') { global $langs; $yes="yes"; $no="no"; - if ($option) { $yes="1"; @@ -4145,15 +4271,17 @@ class Form $disabled = ($disabled ? ' disabled="disabled"' : ''); $resultyesno = ''."\n"; return $resultyesno; @@ -4223,7 +4351,7 @@ class Form * @param string $morehtmlref Code html supplementaire a afficher apres ref * @param string $moreparam More param to add in nav link url. * @param int $nodbprefix Do not include DB prefix to forge table name - * @return tring Portion HTML avec ref + boutons nav + * @return string Portion HTML avec ref + boutons nav */ function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0) { @@ -4270,7 +4398,7 @@ class Form /** * Return HTML code to output a barcode * - * @param Object &$object Object containing data to retrieve file name + * @param Object $object Object containing data to retrieve file name * @param int $width Width of photo * @return string HTML code to output barcode */ @@ -4362,7 +4490,7 @@ class Form { global $dolibarr_main_url_root; $ret.=''; - $ret.='Photo found on Gravatar'; + $ret.='Photo found on Gravatar'; // gravatar need md5 hash } else { @@ -4401,7 +4529,7 @@ class Form $out=''; // On recherche les groupes - $sql = "SELECT ug.rowid, ug.nom "; + $sql = "SELECT ug.rowid, ug.nom as name"; if (! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity) { $sql.= ", e.label"; @@ -4425,11 +4553,20 @@ class Form $resql=$this->db->query($sql); if ($resql) { - $num = $this->db->num_rows($resql); + // Enhance with select2 + if ($conf->use_javascript_ajax) + { + include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; + $out.= ajax_combobox($htmlname); + $nodatarole=' data-role="none"'; + } + + $out.= ''; if ($show_empty) $out.= ''."\n"; while ($i < $num) @@ -4446,7 +4583,7 @@ class Form } $out.= '>'; - $out.= $obj->nom; + $out.= $obj->name; if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1) { $out.= " (".$obj->label.")"; @@ -4458,8 +4595,8 @@ class Form } else { - $out.= ''; } diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 696a70867cf..333969fc3b3 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -266,6 +266,8 @@ class FormActions if ($selected == 'manual') $selected='AC_OTH'; if ($selected == 'auto') $selected='AC_OTH_AUTO'; + if (! empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO)) unset($arraylist['AC_OTH_AUTO']); + print $form->selectarray($htmlname, $arraylist, $selected); if ($user->admin && empty($onlyautoornot) && empty($hideinfohelp)) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); } diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 042474781d7..30ecadedb55 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -53,9 +53,10 @@ class FormAdmin * @param array $filter Array of keys to exclude in list * @param int $showempty Add empty value * @param int $showwarning Show a warning if language is not complete + * @param int $disabled Disable edit of select * @return string Return HTML select string with list of languages */ - function select_language($selected='',$htmlname='lang_id',$showauto=0,$filter=0,$showempty=0,$showwarning=0) + function select_language($selected='',$htmlname='lang_id',$showauto=0,$filter=0,$showempty=0,$showwarning=0,$disabled=0) { global $langs; @@ -63,7 +64,7 @@ class FormAdmin $out=''; - $out.= ''; if ($showempty) { $out.= ''; } $i++; @@ -292,7 +292,7 @@ class FormCompany * Retourne la liste deroulante des regions actives dont le pays est actif * La cle de la liste est le code (il peut y avoir plusieurs entree pour * un code donnee mais dans ce cas, le champ pays et lang differe). - * Ainsi les liens avec les regions se font sur une region independemment de son nom. + * Ainsi les liens avec les regions se font sur une region independemment de son name. * * @param string $selected Preselected value * @param string $htmlname Name of HTML select field @@ -520,118 +520,105 @@ class FormCompany * @param string $htmlname Name of HTML form * @param array $limitto Disable answers that are not id in this array list * @param int $forceid This is to force another object id than object->id - * @param array $events More js events option. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @param string $moreparam String with more param to add into url when noajax search is used. * @return int The selected third party ID */ - function selectCompaniesForNewContact($object, $var_id, $selected='', $htmlname='newcompany', $limitto='', $forceid=0, $events=array(), $moreparam='') + function selectCompaniesForNewContact($object, $var_id, $selected='', $htmlname='newcompany', $limitto='', $forceid=0, $moreparam='') { global $conf, $langs; - // On recherche les societes - $sql = "SELECT s.rowid, s.nom FROM"; - $sql.= " ".MAIN_DB_PREFIX."societe as s"; - $sql.= " WHERE s.entity IN (".getEntity('societe', 1).")"; - if ($selected && $conf->use_javascript_ajax && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) $sql.= " AND rowid = ".$selected; - else + if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) { - // For ajax search we limit here. For combo list, we limit later - if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT - && is_array($limitto) && count($limitto)) - { - $sql.= " AND rowid IN (".join(',',$limitto).")"; - } - } - $sql.= " ORDER BY nom ASC"; + // Use Ajax search + $minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT)?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:2); - $resql = $this->db->query($sql); - if ($resql) - { - if ($conf->use_javascript_ajax && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) + $socid=0; $name=''; + if ($selected > 0) { - // Use Ajax search - $minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT)?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:2); - - $socid=0; - if ($selected) + $tmpthirdparty=new Societe($this->db); + $result = $tmpthirdparty->fetch($selected); + if ($result > 0) { - $obj = $this->db->fetch_object($resql); - $socid = $obj->rowid?$obj->rowid:''; + $socid = $selected; + $name = $tmpthirdparty->name; } + } - // We recall a page after a small delay when a new input has been selected - $htmloption=''; - //$javaScript = "window.location=\'".$_SERVER['PHP_SELF']."?".$var_id."=".($forceid>0?$forceid:$object->id)."&".$htmlname."=\' + document.getElementById(\'".$htmlname."\').value;"; - //$htmloption.= 'onChange="ac_delay(\''.$javaScript.'\',\'500\');"'; // When we select with mouse - //$htmloption.= 'onKeyUp="if (event.keyCode== 13) { ac_delay(\''.$javaScript.'\',\'500\'); }"'; // When we select with keyboard + // Refresh contacts list on thirdparty list change + $htmloption=''; - if (count($events)) // If there is some ajax events to run once selection is done, we add code here to run events - { - print ''; - } - - print "\n".''."\n"; - //print ''; - //print ''; - //print ''; - //print '
    '; - if ($obj->rowid == 0) - { - print ''; - } - else - { - print ''; - } - print ajax_autocompleter(($socid?$socid:-1),$htmlname,DOL_URL_ROOT.'/societe/ajaxcompanies.php','',$minLength); - //print '
    '; - //print "\n"; - return $socid; + $("select#" + htmlname).html(response.value); + } + } + ); + }; + }); + '; } - else + + print "\n".''."\n"; + print ''; + print ajax_autocompleter(($socid?$socid:-1),$htmlname,DOL_URL_ROOT.'/societe/ajaxcompanies.php','',$minLength); + return $socid; + } + else + { + // Search to list thirdparties + $sql = "SELECT s.rowid, s.nom as name FROM"; + $sql.= " ".MAIN_DB_PREFIX."societe as s"; + $sql.= " WHERE s.entity IN (".getEntity('societe', 1).")"; + // For ajax search we limit here. For combo list, we limit later + if (is_array($limitto) && count($limitto)) + { + $sql.= " AND s.rowid IN (".join(',',$limitto).")"; + } + $sql.= " ORDER BY s.nom ASC"; + + $resql = $this->db->query($sql); + if ($resql) { - // No Ajax search print '\n"; return $firstCompany; } - } - else - { - dol_print_error($this->db); + else + { + dol_print_error($this->db); + print 'Error sql'; + } } } @@ -682,22 +670,21 @@ class FormCompany * @param string $selected Default selected value * @param string $htmlname HTML select name * @param string $source Source ('internal' or 'external') - * @param string $order Sort criteria + * @param string $sortorder Sort criteria * @param int $showempty 1=Add en empty line * @return void */ - function selectTypeContact($object, $selected, $htmlname = 'type', $source='internal', $order='code', $showempty=0) + function selectTypeContact($object, $selected, $htmlname = 'type', $source='internal', $sortorder='code', $showempty=0) { if (is_object($object) && method_exists($object, 'liste_type_contact')) { - $lesTypes = $object->liste_type_contact($source, $order, 0, 1); + $lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1); print '\n"; diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index e0d550b4205..0eb2d4d4b26 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -65,7 +65,7 @@ class FormContract $sql.= " WHERE c.entity = ".$conf->entity; //if ($contratListId) $sql.= " AND c.rowid IN (".$contratListId.")"; if ($socid == 0) $sql.= " AND (c.fk_soc = 0 OR c.fk_soc IS NULL)"; - else $sql.= " AND c.fk_soc = ".$socid; + if ($socid > 0) $sql.= " AND (c.fk_soc=".$socid." OR c.fk_soc IS NULL)"; dol_syslog(get_class($this)."::select_contract", LOG_DEBUG); $resql=$db->query($sql); diff --git a/htdocs/core/class/html.formcron.class.php b/htdocs/core/class/html.formcron.class.php index bce8d9f041e..4de88a7bfc9 100644 --- a/htdocs/core/class/html.formcron.class.php +++ b/htdocs/core/class/html.formcron.class.php @@ -4,7 +4,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * 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, @@ -14,6 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . + * or see http://www.gnu.org/ */ /** diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 447f96ff61c..bea2fa7347e 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -73,12 +73,12 @@ class FormFile global $conf,$langs, $hookmanager; $hookmanager->initHooks(array('formfile')); - if (! empty($conf->browser->phone)) return 0; + if (! empty($conf->browser->layout) && $conf->browser->layout != 'classic') return 0; if ((! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) && $useajax) || ($useajax==2)) { - // TODO: Cheeck this works with 2 forms on same page - // TODO: Cheeck this works with GED module, otherwise, force useajax to 0 + // TODO: Check this works with 2 forms on same page + // TODO: Check this works with GED module, otherwise, force useajax to 0 // TODO: This does not support option savingdocmask // TODO: This break feature to upload links too return $this->_formAjaxFileUpload($object); @@ -133,9 +133,10 @@ class FormFile if ($perm) { $langs->load('other'); - $out .= ' ('.$langs->trans("MaxSize").': '.$max.' '.$langs->trans("Kb"); - $out .= ' '.info_admin($langs->trans("ThisLimitIsDefinedInSetup",$max,$maxphp),1); - $out .= ')'; + //$out .= ' ('.$langs->trans("MaxSize").': '.$max.' '.$langs->trans("Kb"); + $out .= ' '; + $out.=info_admin($langs->trans("ThisLimitIsDefinedInSetup",$max,$maxphp),1); + //$out .= ')'; } } else @@ -270,7 +271,13 @@ class FormFile if (! empty($iconPDF)) { return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir); } - $printer = (!empty($user->rights->printipp->read) && !empty($conf->printipp->enabled))?true:false; + + $printer=0; + if (in_array($modulepart,array('facture','propal','proposal','order','commande'))) // This feature is implemented only for such elements + { + $printer = (!empty($user->rights->printipp->read) && !empty($conf->printipp->enabled))?true:false; + } + $hookmanager->initHooks(array('formfile')); $forname='builddoc'; $out=''; @@ -300,6 +307,10 @@ class FormFile include_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php'; $modellist=ModeleThirdPartyDoc::liste_modeles($this->db); } + } + else if ($modulepart == 'agenda') + { + null; } else if ($modulepart == 'propal') { @@ -355,6 +366,15 @@ class FormFile $modellist=ModelePDFFactures::liste_modeles($this->db); } } + elseif ($modulepart == 'contract') + { + if (is_array($genallowed)) $modellist=$genallowed; + else + { + include_once DOL_DOCUMENT_ROOT.'/core/modules/contract/modules_contract.php'; + $modellist=ModelePDFContract::liste_modeles($this->db); + } + } elseif ($modulepart == 'project') { if (is_array($genallowed)) $modellist=$genallowed; @@ -424,6 +444,7 @@ class FormFile } else { + // For normalized standard modules $file=dol_buildpath('/core/modules/'.$modulepart.'/modules_'.$modulepart.'.php',0); if (file_exists($file)) @@ -465,14 +486,14 @@ class FormFile // Model if (! empty($modellist)) { - $out.= ''; + $out.= ''; $out.= ''.$langs->trans('Model').' '; if (is_array($modellist) && count($modellist) == 1) // If there is only one element { $arraykeys=array_keys($modellist); $modelselected=$arraykeys[0]; } - $out.= $form->selectarray('model',$modellist,$modelselected,$showempty,0,0); + $out.= $form->selectarray('model', $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', ''); $out.= ''; } else @@ -483,7 +504,7 @@ class FormFile } // Language code (if multilang) - $out.= ''; + $out.= ''; if (($allowgenifempty || (is_array($modellist) && count($modellist) > 0)) && $conf->global->MAIN_MULTILANGS && ! $forcenomultilang && (! empty($modellist) || $showempty)) { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; @@ -499,7 +520,7 @@ class FormFile // Button $addcolumforpicto=($delallowed || $printer || $morepicto); - $out.= ''; + $out.= ''; $genbutton = 'trans("None").''; + $out.=''.$langs->trans("None").''; } $this->numoffiles++; @@ -759,7 +780,7 @@ class FormFile if ($nboffiles > 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; - $var=false; + $var=true; foreach($filearray as $key => $file) // filearray must be only files here { if ($file['name'] != '.' @@ -835,7 +856,7 @@ class FormFile } if ($nboffiles == 0) { - print ''; + print ''; if (empty($textifempty)) print $langs->trans("NoFileFound"); else print $textifempty; print ''; @@ -977,7 +998,6 @@ class FormFile if ($modulepart == 'user') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');} if (! $id && ! $ref) continue; - $found=0; if (! empty($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) { @@ -986,7 +1006,19 @@ class FormFile else { //print 'Fetch '.$id." - ".$ref.'
    '; - $result=$object_instance->fetch($id,$ref); + + if ($id) { + $result = $object_instance->fetch($id); + } else { + //fetchOneLike looks for objects with wildcards in its reference. + //It is useful for those masks who get underscores instead of their actual symbols + //fetchOneLike requires some info in the object. If it doesn't have it, then 0 is returned + //that's why we look only look fetchOneLike when fetch returns 0 + if (!$result = $object_instance->fetch('', $ref)) { + $result = $object_instance->fetchOneLike($ref); + } + } + if ($result > 0) { $found=1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]=dol_clone($object_instance); } // Save object into a cache if ($result == 0) { $found=1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]='notfound'; unset($filearray[$key]); } } @@ -1023,7 +1055,7 @@ class FormFile if (count($filearray) == 0) { - print ''; + print ''; if (empty($textifempty)) print $langs->trans("NoFileFound"); else print $textifempty; print ''; @@ -1080,6 +1112,8 @@ class FormFile global $bc; global $sortfield, $sortorder; + $langs->load("link"); + require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; $link = new Link($this->db); $links = array(); @@ -1188,7 +1222,7 @@ class FormFile } if ($nboflinks == 0) { - print ''; + print ''; print $langs->trans("NoLinkFound"); print ''; } diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 6f70ba71673..07edb962371 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -651,7 +651,7 @@ class FormMail if ($this->withform == 1 || $this->withform == -1) { - $out.= '
    '; + $out.= '
    '; $out.= 'withfile == 2 && $conf->use_javascript_ajax) @@ -664,7 +664,7 @@ class FormMail $out.= '     '; $out.= ''; } - $out.= '
    '."\n"; + $out.= ''."\n"; } $out.= ''."\n"; @@ -680,7 +680,7 @@ class FormMail /** * Return template of email - * Search into table c_email_template + * Search into table c_email_templates * * @param DoliDB $db Database handler * @param string $type_template Get message for key module @@ -692,22 +692,25 @@ class FormMail { $ret=array(); - $sql = "SELECT topic, content"; + $sql = "SELECT label, topic, content, lang"; $sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates'; $sql.= " WHERE type_template='".$db->escape($type_template)."'"; $sql.= " AND entity IN (".getEntity("c_email_templates").")"; $sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")"; - // TODO Add field and where filter on language code + if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')"; + $sql.= $db->order("lang,label","ASC"); //print $sql; $resql = $db->query($sql); if ($resql) { - $obj = $db->fetch_object($resql); + $obj = $db->fetch_object($resql); // Get first found if ($obj) { + $ret['label']=$obj->label; $ret['topic']=$obj->topic; $ret['content']=$obj->content; + $ret['lang']=$obj->lang; } else { @@ -722,8 +725,10 @@ class FormMail elseif ($type_template=='fichinter_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendFichInter"); } elseif ($type_template=='thirdparty') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentThirdparty"); } + $ret['label']='default'; $ret['topic']=''; $ret['content']=$defaultmessage; + $ret['lang']=$outputlangs->defaultlang; } $db->free($resql); diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 968dcd3856e..68a7b677667 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -307,18 +307,29 @@ class FormOther * @param string $htmlname Name of combo list * @param int $nocateg Show also an entry "Not categorized" * @return string Html combo list code + * @see select_all_categories */ function select_categories($type,$selected=0,$htmlname='search_categ',$nocateg=0) { - global $langs; + global $conf, $langs; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Load list of "categories" $static_categs = new Categorie($this->db); $tab_categs = $static_categs->get_full_arbo($type); + $moreforfilter = ''; + $nodatarole = ''; + // Enhance with select2 + if ($conf->use_javascript_ajax) + { + include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; + $moreforfilter.= ajax_combobox('select_categ_'.$htmlname); + $nodatarole=' data-role="none"'; + } + // Print a select with each of them - $moreforfilter =''; $moreforfilter.=''; // Should use -1 to say nothing if (is_array($tab_categs)) @@ -348,16 +359,26 @@ class FormOther * @param string $htmlname Name of combo list (example: 'search_sale') * @param User $user Object user * @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status + * @param int $showempty 1=show also an empty value * @return string Html combo list code */ - function select_salesrepresentatives($selected,$htmlname,$user,$showstatus=0) + function select_salesrepresentatives($selected,$htmlname,$user,$showstatus=0,$showempty=1) { global $conf,$langs; $langs->load('users'); + $out = ''; + $nodatarole = ''; + // Enhance with select2 + if ($conf->use_javascript_ajax) + { + include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; + $out.= ajax_combobox($htmlname); + $nodatarole=' data-role="none"'; + } // Select each sales and print them in a select input - $moreforfilter =''; + if ($showempty) $out.=''; // Get list of users allowed to be viewed $sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login"; @@ -382,34 +403,35 @@ class FormOther { while ($obj_usr = $this->db->fetch_object($resql_usr)) { - $moreforfilter.=''; + $out.=($moreinfo?')':''); + $out.=''; } $this->db->free($resql_usr); } @@ -417,9 +439,9 @@ class FormOther { dol_print_error($this->db); } - $moreforfilter.=''; + $out.=''; - return $moreforfilter; + return $out; } /** @@ -462,7 +484,7 @@ class FormOther /** * Write lines of a project (all lines of a project if parent = 0) * - * @param int &$inc Cursor counter + * @param int $inc Cursor counter * @param int $parent Id of parent task we want to see * @param array $lines Array of task lines * @param int $level Level @@ -559,13 +581,13 @@ class FormOther * * @param string $set_color Pre-selected color * @param string $prefix Name of HTML field - * @param string $form_name Name of form + * @param string $form_name Deprecated. Not used. * @param int $showcolorbox 1=Show color code and color box, 0=Show only color code * @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813') * @return void * @deprecated */ - function select_color($set_color='', $prefix='f_color', $form_name='objForm', $showcolorbox=1, $arrayofcolors='') + function select_color($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='') { print $this->selectColor($set_color, $prefix, $form_name, $showcolorbox, $arrayofcolors); } @@ -575,13 +597,13 @@ class FormOther * * @param string $set_color Pre-selected color * @param string $prefix Name of HTML field - * @param string $form_name Name of form + * @param string $form_name Deprecated. Not used. * @param int $showcolorbox 1=Show color code and color box, 0=Show only color code * @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813') * @param string $morecss Add css style into input field * @return void */ - function selectColor($set_color='', $prefix='f_color', $form_name='objForm', $showcolorbox=1, $arrayofcolors='', $morecss='') + function selectColor($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='', $morecss='') { global $langs,$conf; @@ -1033,6 +1055,7 @@ class FormOther if ($nbboxactivated) { $langs->load("boxes"); + $langs->load("projects"); $emptybox=new ModeleBoxes($db); diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 4042bb16e31..c09b7237496 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -49,11 +49,12 @@ class FormProjets * @param int $selected Id project preselected * @param string $htmlname Nom de la zone html * @param int $maxlength Maximum length of label - * @param int $option_only Option only + * @param int $option_only Return only html options lines without the select tag * @param int $show_empty Add an empty line + * @param int $discard_closed Discard closed projects * @return int Nber of project if OK, <0 if KO */ - function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlength=16, $option_only=0, $show_empty=1) + function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlength=16, $option_only=0, $show_empty=1, $discard_closed=0) { global $user,$conf,$langs; @@ -104,6 +105,12 @@ class FormProjets } else { + if ($discard_closed && $obj->fk_statut == 2) + { + $i++; + continue; + } + $labeltoshow=dol_trunc($obj->ref,18); //if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')'; //else $labeltoshow.=' ('.$langs->trans("Private").')'; @@ -115,12 +122,17 @@ class FormProjets { $disabled=0; $labeltoshow.=' '.dol_trunc($obj->title,$maxlength); - if (! $obj->fk_statut > 0) + if ($obj->fk_statut == 0) { $disabled=1; $labeltoshow.=' - '.$langs->trans("Draft"); } - if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid)) + else if ($obj->fk_statut == 2) + { + $disabled=1; + $labeltoshow.=' - '.$langs->trans("Closed"); + } + else if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid)) { $disabled=1; $labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany"); @@ -162,15 +174,15 @@ class FormProjets } /** - * Build Select List of element associable to a project + * Build a HTML select list of element of same thirdparty to suggest to link them to project * - * @param string $table_element Table of the element to update - * @param int $socid socid to filter - * @return string The HTML select list of element + * @param string $table_element Table of the element to update + * @param int $socid socid to filter + * @return string The HTML select list of element */ function select_element($table_element,$socid=0) { - global $conf; + global $conf, $langs; $projectkey="fk_projet"; switch ($table_element) @@ -179,7 +191,10 @@ class FormProjets $sql = "SELECT rowid, facnumber as ref"; break; case "facture_fourn": - $sql = "SELECT rowid, ref"; + $sql = "SELECT rowid, ref, ref_supplier"; + break; + case "commande_fourn": + $sql = "SELECT rowid, ref, ref_supplier"; break; case "facture_rec": $sql = "SELECT rowid, titre as ref"; @@ -214,14 +229,22 @@ class FormProjets while ($i < $num) { $obj = $this->db->fetch_object($resql); - $sellist .=''; + $ref=$obj->ref?$obj->ref:$obj->rowid; + if (! empty($obj->ref_supplier)) $ref.=' ('.$obj->ref_supplier.')'; + $sellist .=''; $i++; } $sellist .=''; } - return $sellist ; - + /*else + { + $sellist = ''; + }*/ $this->db->free($resql); + + return $sellist ; }else { $this->error=$this->db->lasterror(); dol_syslog(get_class($this) . "::select_element " . $this->error, LOG_ERR); diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php index 2b70053cb28..51841a27e24 100644 --- a/htdocs/core/class/html.formsms.class.php +++ b/htdocs/core/class/html.formsms.class.php @@ -277,7 +277,7 @@ function limitChars(textarea, limit, infodiv) { $defaultmessage=$this->withbody; } - $defaultmessage=make_substitutions($defaultmessage,$this->substit,$langs); + $defaultmessage=make_substitutions($defaultmessage,$this->substit); if (isset($_POST["message"])) $defaultmessage=$_POST["message"]; $defaultmessage=str_replace('\n',"\n",$defaultmessage); @@ -320,15 +320,14 @@ function limitChars(textarea, limit, infodiv) print "\n"; - print '
    '; - print "trans("SendSms")."\""; - print ">"; + print '
    '; + print ''; if ($this->withcancel) { - print "     "; - print "trans("Cancel")."\">"; + print '  &nbnp;  '; + print ''; } - print "
    \n"; + print ''; print "\n"; print "\n"; diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index fdc2d6fbe4f..14d1bec0841 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -40,21 +40,21 @@ class InfoBox /** * Return array of boxes qualified for area and user * - * @param DoliDB $db Database handler - * @param string $mode 'available' or 'activated' - * @param string $zone Name or area (-1 for all, 0 for Homepage, 1 for xxx, ...) - * @param User $user Object user to filter - * @param array $excludelist Array of box id (box.box_id = boxes_def.rowid) to exclude - * @return array Array of boxes + * @param DoliDB $db Database handler + * @param string $mode 'available' or 'activated' + * @param string $zone Name or area (-1 for all, 0 for Homepage, 1 for xxx, ...) + * @param User|null $user Object user to filter + * @param array $excludelist Array of box id (box.box_id = boxes_def.rowid) to exclude + * @return array Array of boxes */ - static function listBoxes($db, $mode, $zone, $user, $excludelist=array()) + static function listBoxes($db, $mode, $zone, $user=null, $excludelist=array()) { global $conf; $boxes=array(); $confuserzone='MAIN_BOXES_'.$zone; - if ($mode == 'activated') + if ($mode == 'activated') // activated { $sql = "SELECT b.rowid, b.position, b.box_order, b.fk_user,"; $sql.= " d.rowid as box_id, d.file, d.note, d.tms"; @@ -66,18 +66,11 @@ class InfoBox else $sql.= " AND b.fk_user = 0"; $sql.= " ORDER BY b.box_order"; } - else + else // available { $sql = "SELECT d.rowid as box_id, d.file, d.note, d.tms"; $sql.= " FROM ".MAIN_DB_PREFIX."boxes_def as d"; - if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) - { - $sql.= " WHERE entity IN (1,".$conf->entity.")"; // TODO add method for define another master entity - } - else - { - $sql.= " WHERE entity = ".$conf->entity; - } + $sql.= " WHERE d.entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")"; } dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user)?$user->id:'')."", LOG_DEBUG); @@ -92,6 +85,7 @@ class InfoBox if (! in_array($obj->box_id, $excludelist)) { + if (preg_match('/^([^@]+)@([^@]+)$/i',$obj->file,$regs)) { $boxname = preg_replace('/\.php$/i','',$regs[1]); @@ -104,9 +98,11 @@ class InfoBox $relsourcefile = "/core/boxes/".$boxname.".php"; } + //print $obj->box_id.'-'.$boxname.'-'.$relsourcefile.'
    '; + // TODO PERF Do not make "dol_include_once" here, nor "new" later. This means, we must store a 'depends' field to store modules list, then // the "enabled" condition for modules forbidden for external users and the depends condition can be done. - // Goal is to avoid making a new instance for each boxes returned by select. + // Goal is to avoid making a "new" done for each boxes returned by select. dol_include_once($relsourcefile); if (class_exists($boxname)) { @@ -161,15 +157,19 @@ class InfoBox //print 'xx module='.$module.' enabled='.$enabled; if ($enabled) $boxes[]=$box; else unset($box); - } + } + else + { + dol_syslog("Failed to load box '".$boxname."' into file '".$relsourcefile."'", LOG_WARNING); + } } $j++; } } else - { - //dol_print_error($db); - $error=$db->lasterror(); + { + dol_syslog($db->lasterror(),LOG_ERR); + return array('error'=>$db->lasterror()); } return $boxes; @@ -202,7 +202,8 @@ class InfoBox $db->begin(); - // Sauve parametre indiquant que le user a une config dediee + // Save parameters to say user has a dedicated setup + $tab=array(); $confuserzone='MAIN_BOXES_'.$zone; $tab[$confuserzone]=1; if (dol_set_user_param($db, $conf, $user, $tab) < 0) diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php index 50a9cced421..199c342020d 100644 --- a/htdocs/core/class/interfaces.class.php +++ b/htdocs/core/class/interfaces.class.php @@ -23,15 +23,16 @@ * \brief Fichier de la classe de gestion des triggers */ -require_once DOL_DOCUMENT_ROOT.'/core/triggers/DolibarrTriggers.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; + /** * Class to manage triggers */ - class Interfaces { - var $dir; // Directory with all core and external triggers files + var $db; + var $dir; // Directory with all core and external triggers files var $errors = array(); // Array for errors /** @@ -60,7 +61,9 @@ class Interfaces // Check parameters if (! is_object($object) || ! is_object($conf)) // Error { - dol_syslog(get_class($this).'::run_triggers was called with wrong parameters action='.$action.' object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf), LOG_ERR); + $this->error='function run_triggers called with wrong parameters action='.$action.' object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf); + dol_syslog(get_class($this).'::run_triggers '.$this->error, LOG_ERR); + $this->errors[]=$this->error; return -1; } if (! is_object($user) || ! is_object($langs)) // Warning diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 30eeca5a486..95436a51e29 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -370,7 +370,7 @@ class Ldap * Ldap object connect and bind must have been done * * @param string $dn DN entry key - * @param string[] $info Attributes array + * @param array $info Attributes array * @param User $user Objet user that create * @return int <0 if KO, >0 if OK */ @@ -423,7 +423,7 @@ class Ldap * Ldap object connect and bind must have been done * * @param string $dn DN entry key - * @param string[] $info Attributes array + * @param array $info Attributes array * @param string $user Objet user that modify * @return int <0 if KO, >0 if OK */ @@ -475,7 +475,7 @@ class Ldap * Ldap object connect and bind must have been done * * @param string $dn DN entry key - * @param string[] $info Attributes array + * @param array $info Attributes array * @param User $user Objet user that update * @param string $olddn Old DN entry key (before update) * @return int <0 if KO, >0 if OK @@ -563,7 +563,7 @@ class Ldap * Build a LDAP message * * @param string $dn DN entry key - * @param string[] $info Attributes array + * @param array $info Attributes array * @return string Content of file */ function dump_content($dn, $info) @@ -605,7 +605,7 @@ class Ldap * Dump a LDAP message to ldapinput.in file * * @param string $dn DN entry key - * @param string[] $info Attributes array + * @param array $info Attributes array * @return int <0 if KO, >0 if OK */ function dump($dn, $info) @@ -642,7 +642,7 @@ class Ldap * Ldap object connect and bind must have been done * * @param string $dn DN entry key - * @param string[] $info Attributes array + * @param array $info Attributes array * @param User $user Objet user that create * @return int <0 if KO, >0 if OK */ @@ -694,7 +694,7 @@ class Ldap * Ldap object connect and bind must have been done * * @param string $dn DN entry key - * @param string[] $info Attributes array + * @param array $info Attributes array * @param User $user Objet user that create * @return int <0 if KO, >0 if OK */ @@ -746,7 +746,7 @@ class Ldap * Ldap object connect and bind must have been done * * @param string $dn DN entry key - * @param string[] $info Attributes array + * @param array $info Attributes array * @param User $user Objet user that create * @return int <0 if KO, >0 if OK */ @@ -847,6 +847,7 @@ class Ldap */ function getAttributeValues($filterrecord,$attribute) { + $attributes=array(); $attributes[0] = $attribute; // We need to search for this user in order to get their entry. @@ -1075,9 +1076,9 @@ class Ldap $subcount = hexdec(substr($hex_sid,2,2)); // Get count of sub-auth entries $auth = hexdec(substr($hex_sid,4,12)); // SECURITY_NT_AUTHORITY $result = "$rev-$auth"; - for ($x=0;$x < $subcount; $x++) { - $subauth[$x] = hexdec($this->littleEndian(substr($hex_sid,16+($x*8),8))); // get all SECURITY_NT_AUTHORITY - $result .= "-".$subauth[$x]; + for ($x=0;$x < $subcount; $x++) + { + $result .= "-".hexdec($this->littleEndian(substr($hex_sid,16+($x*8),8))); // get all SECURITY_NT_AUTHORITY } return $result; } @@ -1090,9 +1091,9 @@ class Ldap * car conflit majuscule-minuscule. A n'utiliser que pour les pages * 'Fiche LDAP' qui affiche champ lisibles par defaut. * - * @param string $checkDn DN de recherche (Ex: ou=users,cn=my-domain,cn=com) - * @param string $filter Filtre de recherche (ex: (sn=nom_personne) ) - * @return array Tableau des reponses (cle en minuscule-valeur) + * @param string $checkDn DN de recherche (Ex: ou=users,cn=my-domain,cn=com) + * @param string $filter Search filter (ex: (sn=nom_personne) ) + * @return array|int Array with answers (key lowercased - value) */ function search($checkDn, $filter) { diff --git a/htdocs/core/class/link.class.php b/htdocs/core/class/link.class.php index 0c7d52f9569..0cdc6a8c4a8 100644 --- a/htdocs/core/class/link.class.php +++ b/htdocs/core/class/link.class.php @@ -187,7 +187,7 @@ class Link extends CommonObject { // Call trigger $result=$this->call_trigger('LINK_MODIFY',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers } @@ -197,6 +197,7 @@ class Link extends CommonObject $this->db->commit(); return 1; } else { + setEventMessages('', $this->errors, 'errors'); $this->db->rollback(); return -1; } @@ -222,7 +223,7 @@ class Link extends CommonObject /** * Loads all links from database * - * @param array &$links array of Link objects to fill + * @param array $links array of Link objects to fill * @param string $objecttype type of the associated object in dolibarr * @param int $objectid id of the associated object in dolibarr * @param string $sortfield field used to sort diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index aa43c545c8d..30f5960e0ce 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -74,7 +74,7 @@ class Menubase * @param User $user User that create * @return int <0 if KO, Id of record if OK */ - function create($user=0) + function create($user=null) { global $conf, $langs; @@ -185,7 +185,7 @@ class Menubase * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; @@ -250,7 +250,7 @@ class Menubase * @param User $user User that load * @return int <0 if KO, >0 if OK */ - function fetch($id, $user=0) + function fetch($id, $user=null) { global $langs; @@ -376,7 +376,7 @@ class Menubase * @param string $myleftmenu Value for leftmenu to filter menu to load (always '') * @param int $type_user 0=Menu for backoffice, 1=Menu for front office * @param string $menu_handler Filter on name of menu_handler used (auguria, eldy...) - * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @return array Return array with menu entries for top menu */ function menuTopCharger($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu) @@ -404,7 +404,7 @@ class Menubase * @param string $myleftmenu Value for leftmenu to filter menu to load (always '') * @param int $type_user 0=Menu for backoffice, 1=Menu for front office * @param string $menu_handler Filter on name of menu_handler used (auguria, eldy...) - * @param array &$tabMenu Array with menu entries already loaded + * @param array $tabMenu Array with menu entries already loaded * @return Menu Menu array for particular mainmenu value or full tabArray */ function menuLeftCharger($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu) @@ -489,7 +489,7 @@ class Menubase * @param string $myleftmenu Value for left that defined leftmenu * @param int $type_user Looks for menu entry for 0=Internal users, 1=External users * @param string $menu_handler Name of menu_handler used ('auguria', 'eldy'...) - * @param array &$tabMenu Array to store new entries found (in most cases, it's empty, but may be alreay filled) + * @param array $tabMenu Array to store new entries found (in most cases, it's empty, but may be alreay filled) * @return int >0 if OK, <0 if KO */ function menuLoad($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu) diff --git a/htdocs/core/class/mobiledetect.class.php b/htdocs/core/class/mobiledetect.class.php index 107a13f47e3..297058698aa 100644 --- a/htdocs/core/class/mobiledetect.class.php +++ b/htdocs/core/class/mobiledetect.class.php @@ -155,7 +155,7 @@ class MobileDetect 'Asus' => 'Asus.*Galaxy|PadFone.*Mobile', // @ref: http://www.micromaxinfo.com/mobiles/smartphones // Added because the codes might conflict with Acer Tablets. - 'Micromax' => 'Micromax.*\b(A210|A92|A88|A72|A111|A110Q|A115|A116|A110|A90S|A26|A51|A35|A54|A25|A27|A89|A68|A65|A57|A90)\b', + 'Micromax' => 'Micromax.*\bA\d+\b', 'Palm' => 'PalmSource|Palm', // avantgo|blazer|elaine|hiptop|plucker|xiino ; @todo - complete the regex. 'Vertu' => 'Vertu|Vertu.*Ltd|Vertu.*Ascent|Vertu.*Ayxta|Vertu.*Constellation(F|Quest)?|Vertu.*Monika|Vertu.*Signature', // Just for fun ;) // @ref: http://www.pantech.co.kr/en/prod/prodList.do?gbrand=VEGA (PANTECH) @@ -179,7 +179,7 @@ class MobileDetect protected static $tabletDevices = array( 'iPad' => 'iPad|iPad.*Mobile', // @todo: check for mobile friendly emails topic. 'NexusTablet' => 'Android.*Nexus[\s]+(7|10)|^.*Android.*Nexus(?:(?!Mobile).)*$', - 'SamsungTablet' => 'SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P1000|GT-P1003|GT-P1010|GT-P3105|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P3100|GT-P3108|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7320|GT-P7511|GT-N8000|GT-P8510|SGH-I497|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-P3113|GT-P5113|GT-P8110|GT-N8010|GT-N8005|GT-N8020|GT-P1013|GT-P6201|GT-P7501|GT-N5100|GT-N5105|GT-N5110|SHV-E140K|SHV-E140L|SHV-E140S|SHV-E150S|SHV-E230K|SHV-E230L|SHV-E230S|SHW-M180K|SHW-M180L|SHW-M180S|SHW-M180W|SHW-M300W|SHW-M305W|SHW-M380K|SHW-M380S|SHW-M380W|SHW-M430W|SHW-M480K|SHW-M480S|SHW-M480W|SHW-M485W|SHW-M486W|SHW-M500W|GT-I9228|SCH-P739|SCH-I925|GT-I9200|GT-I9205|GT-P5200|GT-P5210|GT-P5210X|SM-T311|SM-T310|SM-T310X|SM-T210|SM-T210R|SM-T211|SM-P600|SM-P601|SM-P605|SM-P900|SM-P901|SM-T217|SM-T217A|SM-T217S|SM-P6000|SM-T3100|SGH-I467|XE500|SM-T110|GT-P5220|GT-I9200X|GT-N5110X|GT-N5120|SM-P905|SM-T111|SM-T2105|SM-T315|SM-T320|SM-T320X|SM-T321|SM-T520|SM-T525|SM-T530NU|SM-T230NU|SM-T330NU|SM-T900|XE500T1C|SM-P605V|SM-P905V|SM-P600X|SM-P900X|SM-T210X|SM-T230|SM-T230X|SM-T325|GT-P7503|SM-T531|SM-T330|SM-T530|SM-T705C|SM-T535|SM-T331', // SCH-P709|SCH-P729|SM-T2558 - Samsung Mega - treat them like a regular phone. + 'SamsungTablet' => 'SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P\d+|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-N8000|SGH-I497|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-N8010|GT-N8005|GT-N8020|GT-N5100|GT-N5105|GT-N5110|SHV-E140K|SHV-E140L|SHV-E140S|SHV-E150S|SHV-E230K|SHV-E230L|SHV-E230S|SHW-M180K|SHW-M180L|SHW-M180S|SHW-M180W|SHW-M300W|SHW-M305W|SHW-M380K|SHW-M380S|SHW-M380W|SHW-M430W|SHW-M480K|SHW-M480S|SHW-M480W|SHW-M485W|SHW-M486W|SHW-M500W|GT-I9228|SCH-P739|SCH-I925|GT-I9200|GT-I9205|SM-T\d+|SM-P600|SM-P601|SM-P605|SM-P900|SM-P901|SM-P6000|SM-T3100|SGH-I467|XE500|GT-I9200X|GT-N5110X|GT-N5120|SM-P905|XE500T1C|SM-P605V|SM-P905V|SM-P600X|SM-P900X', // SCH-P709|SCH-P729|SM-T2558 - Samsung Mega - treat them like a regular phone. // @reference: http://www.labnol.org/software/kindle-user-agent-string/20378/ 'Kindle' => 'Kindle|Silk.*Accelerated|Android.*\b(KFOT|KFTT|KFJWI|KFJWA|KFOTE|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|WFJWAE)\b', // Only the Surface tablets with Windows RT are considered mobile. @@ -637,6 +637,11 @@ class MobileDetect return null; } + /** + * getMobileHeaders + * + * @return string mobile Headers + */ public function getMobileHeaders() { return self::$mobileHeaders; @@ -963,10 +968,15 @@ class MobileDetect $this->setDetectionType(self::DETECTION_TYPE_MOBILE); - if ($this->checkHttpHeadersForMobile()) { + if ($this->checkHttpHeadersForMobile()) + { + //print "Found it's a mobile from http header"; return true; - } else { - return $this->matchDetectionRulesAgainstUA(); + } + else + { + //print "Check into user agent ".$this->getUserAgent(); + return $this->matchDetectionRulesAgainstUA(); } } @@ -1073,39 +1083,37 @@ class MobileDetect /** * Check the version of the given property in the User-Agent. - * Will return a float number. (eg. 2_0 will return 2.0, 4.3.1 will return 4.31) + * Will return a string or float number. (eg. 2_0 will return 2.0, 4.3.1 will return 4.31) * - * @param string $propertyName The name of the property. See self::getProperties() array - * keys for all possible properties. - * @param string $type Either self::VERSION_TYPE_STRING to get a string value or - * self::VERSION_TYPE_FLOAT indicating a float value. This parameter - * is optional and defaults to self::VERSION_TYPE_STRING. Passing an - * invalid parameter will default to the this type as well. + * @param string $propertyName The name of the property. See self::getProperties() array keys for all possible properties (Ex: 'iPad', 'Android', ...). + * @param string $type Either self::VERSION_TYPE_STRING to get a string value or + * self::VERSION_TYPE_FLOAT indicating a float value. This parameter + * is optional and defaults to self::VERSION_TYPE_STRING. Passing an + * invalid parameter will default to this type as well. * - * @return string|float The version of the property we are trying to extract. + * @return string|float|boolean The version of the property we are trying to extract. */ public function version($propertyName, $type = self::VERSION_TYPE_STRING) { - if (empty($propertyName)) { - return false; - } + if (empty($propertyName)) return false; //set the $type to the default if we don't recognize the type - if ($type != self::VERSION_TYPE_STRING && $type != self::VERSION_TYPE_FLOAT) { + if ($type != self::VERSION_TYPE_STRING && $type != self::VERSION_TYPE_FLOAT) + { $type = self::VERSION_TYPE_STRING; } $properties = self::getProperties(); // Check if the property exists in the properties array. - if (array_key_exists($propertyName, $properties)) { - + if (array_key_exists($propertyName, $properties)) + { // Prepare the pattern to be matched. // Make sure we always deal with an array (string is converted). $properties[$propertyName] = (array) $properties[$propertyName]; - foreach ($properties[$propertyName] as $propertyMatchString) { - + foreach ($properties[$propertyName] as $propertyMatchString) + { $propertyPattern = str_replace('[VER]', self::VER, $propertyMatchString); // Escape the special character which is the delimiter. @@ -1114,14 +1122,13 @@ class MobileDetect // Identify and extract the version. preg_match('/'.$propertyPattern.'/is', $this->userAgent, $match); - if (!empty($match[1])) { + if (!empty($match[1])) + { $version = ( $type == self::VERSION_TYPE_FLOAT ? $this->prepareVersionNo($match[1]) : $match[1] ); return $version; } - } - } return false; @@ -1130,7 +1137,7 @@ class MobileDetect /** * Retrieve the mobile grading, using self::MOBILE_GRADE_* constants. * - * @return string One of the self::MOBILE_GRADE_* constants. + * @return string One of the self::MOBILE_GRADE_* constants. */ public function mobileGrade() { @@ -1210,7 +1217,8 @@ class MobileDetect // @reference: http://my.opera.com/community/openweb/idopera/ $this->version('Opera', self::VERSION_TYPE_FLOAT)>=10 && !$isMobile - ){ + ) + { return self::MOBILE_GRADE_A; } @@ -1231,7 +1239,8 @@ class MobileDetect // @todo: report this (tested on Nokia N71) $this->version('Opera Mobi', self::VERSION_TYPE_FLOAT)>=11 && $this->is('SymbianOS') - ){ + ) + { return self::MOBILE_GRADE_B; } @@ -1241,7 +1250,8 @@ class MobileDetect // Windows Mobile - Tested on the HTC Leo (WinMo 5.2) $this->match('MSIEMobile|Windows CE.*Mobile') || $this->version('Windows Mobile', self::VERSION_TYPE_FLOAT)<=5.2 - ){ + ) + { return self::MOBILE_GRADE_C; } diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index b0be8bd1cdd..db88671f7ff 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2014 Juanjo Menent * * 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 @@ -32,6 +33,7 @@ class Notify var $id; var $db; var $error; + var $errors=array(); var $author; var $ref; @@ -84,34 +86,50 @@ class Notify { global $conf; - $num=-1; + $error=0; + $num=0; - $sql = "SELECT n.rowid"; - $sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n,"; - $sql.= " ".MAIN_DB_PREFIX."socpeople as c,"; - $sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,"; - $sql.= " ".MAIN_DB_PREFIX."societe as s"; - $sql.= " WHERE n.fk_contact = c.rowid"; - $sql.= " AND a.rowid = n.fk_action"; - $sql.= " AND n.fk_soc = s.rowid"; - if (is_numeric($action)) $sql.= " AND n.fk_action = ".$action; // Old usage - else $sql.= " AND a.code = '".$action."'"; // New usage - $sql.= " AND s.entity IN (".getEntity('societe', 1).")"; - $sql.= " AND s.rowid = ".$socid; - - dol_syslog("Notify.class::countDefinedNotifications ".$action.", ".$socid."", LOG_DEBUG); - - $resql = $this->db->query($sql); - if ($resql) + if (! $error) { - $num = $this->db->num_rows($resql); - } - else + $sql = "SELECT n.rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n,"; + $sql.= " ".MAIN_DB_PREFIX."socpeople as c,"; + $sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,"; + $sql.= " ".MAIN_DB_PREFIX."societe as s"; + $sql.= " WHERE n.fk_contact = c.rowid"; + $sql.= " AND a.rowid = n.fk_action"; + $sql.= " AND n.fk_soc = s.rowid"; + if (is_numeric($action)) $sql.= " AND n.fk_action = ".$action; // Old usage + else $sql.= " AND a.code = '".$action."'"; // New usage + $sql.= " AND s.entity IN (".getEntity('societe', 1).")"; + $sql.= " AND s.rowid = ".$socid; + + dol_syslog(get_class($this)."::countDefinedNotifications ".$action.", ".$socid."", LOG_DEBUG); + + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + } + else + { + $error++; + $this->error=$this->db->error.' sql='.$sql; + } + } + + if (! $error) { - $this->error=$this->db->error.' sql='.$sql; - return -1; + // List of notifications enabled for fixed email + foreach($conf->global as $key => $val) + { + if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$action.'/', $key, $reg)) continue; + $num++; + } } + // TODO return array with list of email instead of number, + type of notification (contacts or fixed email) + if ($error) return -1; return $num; } @@ -120,23 +138,43 @@ class Notify * If yes, send mail and save trace into llx_notify. * * @param string $action Code of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage) - * @param int $socid Id of third party - * @param string $texte Message to send - * @param string $objet_type Type of object the notification deals on (facture, order, propal, order_supplier...). Just for log in llx_notify. - * @param int $objet_id Id of object the notification deals on - * @param string $file Attach a file + * @param Object $object Object the notification deals on * @return int <0 if KO, or number of changes if OK */ - function send($action, $socid, $texte, $objet_type, $objet_id, $file="") + function send($action, $object) { global $conf,$langs,$mysoc,$dolibarr_main_url_root; - $langs->load("other"); + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - dol_syslog(get_class($this)."::send action=".$action.", socid=".$socid.", texte=".$texte.", objet_type=".$objet_type.", objet_id=".$objet_id.", file=".$file); + dol_syslog(get_class($this)."::send action=".$action.", object=".$object->id); - $sql = "SELECT s.nom, c.email, c.rowid as cid, c.lastname, c.firstname,"; - $sql.= " a.rowid as adid, a.label, a.code, n.rowid"; + $langs->load("other"); + + // Define $urlwithroot + $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); + $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + + // Define some vars + $application = $mysoc->name; + //if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $application = $conf->global->MAIN_APPLICATION_TITLE; + $replyto = $conf->notification->email_from; + $filename = basename($file); + $mimefile = dol_mimetype($file); + $object_type = ''; + $link = ''; + $num = 0; + + if (! in_array($action, array('BILL_VALIDATE', 'ORDER_VALIDATE', 'PROPAL_VALIDATE', 'FICHINTER_VALIDATE', 'ORDER_SUPPLIER_APPROVE', 'ORDER_SUPPLIER_REFUSE', 'SHIPPING_VALIDATE'))) + { + return 0; + } + + + // Check notification per third party + $sql = "SELECT s.nom, c.email, c.rowid as cid, c.lastname, c.firstname, c.default_lang,"; + $sql.= " a.rowid as adid, a.label, a.code, n.rowid, n.type"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,"; $sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,"; $sql.= " ".MAIN_DB_PREFIX."notify_def as n,"; @@ -145,7 +183,7 @@ class Notify $sql.= " AND n.fk_soc = s.rowid"; if (is_numeric($action)) $sql.= " AND n.fk_action = ".$action; // Old usage else $sql.= " AND a.code = '".$action."'"; // New usage - $sql .= " AND s.rowid = ".$socid; + $sql .= " AND s.rowid = ".$object->socid; $result = $this->db->query($sql); if ($result) @@ -155,7 +193,7 @@ class Notify if ($num > 0) { $i = 0; - while ($i < $num) // For each notification couple defined (third party/actioncode) + while ($i < $num && ! $error) // For each notification couple defined (third party/actioncode) { $obj = $this->db->fetch_object($result); @@ -164,48 +202,80 @@ class Notify if (dol_strlen($obj->email)) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $application=($conf->global->MAIN_APPLICATION_TITLE?$conf->global->MAIN_APPLICATION_TITLE:'Dolibarr ERP/CRM'); + // Set output language + $outputlangs = $langs; + if ($obj->default_lang && $obj->default_lang != $langs->defaultlang) + { + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang($obj->default_lang); + } - $subject = '['.$application.'] '.$langs->transnoentitiesnoconv("DolibarrNotification"); + switch ($action) { + case 'BILL_VALIDATE': + $link='/compta/facture.php?facid='.$object->id; + $dir_output = $conf->facture->dir_output; + $object_type = 'facture'; + $mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated",$object->ref); + break; + case 'ORDER_VALIDATE': + $link='/commande/card.php?id='.$object->id; + $dir_output = $conf->commande->dir_output; + $object_type = 'order'; + $mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$object->ref); + break; + case 'PROPAL_VALIDATE': + $link='/comm/propal.php?id='.$object->id; + $dir_output = $conf->propal->dir_output; + $object_type = 'propal'; + $mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$object->ref); + break; + case 'FICHINTER_VALIDATE': + $link='/fichinter/card.php?id='.$object->id; + $dir_output = $conf->facture->dir_output; + $object_type = 'ficheinter'; + $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref); + break; + case 'ORDER_SUPPLIER_APPROVE': + $link='/fourn/commande/card.php?id='.$object->id; + $dir_output = $conf->fournisseur->dir_output.'/commande/'; + $object_type = 'order_supplier'; + $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; + $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$object->ref,$user->getFullName($langs)); + $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; + break; + case 'ORDER_SUPPLIER_REFUSE': + $link='/fourn/commande/card.php?id='.$object->id; + $dir_output = $conf->fournisseur->dir_output.'/commande/'; + $object_type = 'order_supplier'; + $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; + $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$object->ref,$user->getFullName($langs)); + $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; + break; + case 'SHIPPING_VALIDATE': + $dir_output = $conf->expedition->dir_output.'/sending/'; + $object_type = 'order_supplier'; + $mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated",$object->ref); + break; + } + $ref = dol_sanitizeFileName($object->ref); + $pdf_path = $dir_output."/".$ref."/".$ref.".pdf"; + if (! dol_is_file($pdf_path)) + { + // We can't add PDF as it is not generated yet. + $filepdf = ''; + } + else + { + $filepdf = $pdf_path; + } - $message = $langs->transnoentities("YouReceiveMailBecauseOfNotification",$application,$mysoc->name)."\n"; - $message.= $langs->transnoentities("YouReceiveMailBecauseOfNotification2",$application,$mysoc->name)."\n"; + $subject = '['.$application.'] '.$outputlangs->transnoentitiesnoconv("DolibarrNotification"); + + $message = $outputlangs->transnoentities("YouReceiveMailBecauseOfNotification",$application,$mysoc->name)."\n"; + $message.= $outputlangs->transnoentities("YouReceiveMailBecauseOfNotification2",$application,$mysoc->name)."\n"; $message.= "\n"; - $message.= $texte; - // Add link - $link=''; - switch($objet_type) - { - case 'ficheinter': - $link='/fichinter/fiche.php?id='.$objet_id; - break; - case 'propal': - $link='/comm/propal.php?id='.$objet_id; - break; - case 'facture': - $link='/compta/facture.php?facid='.$objet_id; - break; - case 'order': - $link='/commande/fiche.php?id='.$objet_id; - break; - case 'order_supplier': - $link='/fourn/commande/fiche.php?id='.$objet_id; - break; - } - // Define $urlwithroot - $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); - $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file - //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - if ($link) $message.="\n".$urlwithroot.$link; - - $filename = basename($file); - - $mimefile=dol_mimetype($file); - - $msgishtml=0; - - $replyto = $conf->notification->email_from; + $message.= $mesg; + if ($link) $message=dol_concatdesc($message,$urlwithroot.$link); $mailfile = new CMailFile( $subject, @@ -218,26 +288,22 @@ class Notify '', '', 0, - $msgishtml + -1 ); if ($mailfile->sendfile()) { - $now=dol_now(); - $sendto = htmlentities($sendto); - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_contact, objet_type, objet_id, email)"; - $sql.= " VALUES ('".$this->db->idate($now)."', ".$actiondefid.", ".$obj->cid.", '".$objet_type."', ".$objet_id.", '".$this->db->escape($obj->email)."')"; - dol_syslog("Notify::send", LOG_DEBUG); - if (! $this->db->query($sql) ) + $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, objet_id, email)"; + $sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$actiondefid.", ".$object->socid.", ".$obj->cid.", '".$obj->type."', '".$object_type."', ".$object->id.", '".$this->db->escape($obj->email)."')"; + if (! $this->db->query($sql)) { dol_print_error($this->db); } } else - { - $this->error=$mailfile->error; - //dol_syslog("Notify::send ".$this->error, LOG_ERR); + { + $error++; + $this->errors[]=$mailfile->error; } } else @@ -246,20 +312,133 @@ class Notify } $i++; } - return $i; } else { - dol_syslog("No notification sent, nothing into notification setup for the thirdparty socid = ".$socid); - return 0; + dol_syslog("No notification to thirdparty sent, nothing into notification setup for the thirdparty socid = ".$object->socid); } } else { - $this->error=$this->db->lasterror(); + $error++; + $this->errors[]=$this->db->lasterror(); return -1; } + // Check notification using fixed email + if (! $error) + { + $param='NOTIFICATION_FIXEDEMAIL_'.$action; + if (! empty($conf->global->$param)) + { + $sendto = $conf->global->$param; + $actiondefid = dol_getIdFromCode($this->db, $action, 'c_action_trigger', 'code', 'rowid'); + if ($actiondefid <= 0) dol_print_error($this->db, 'Failed to get id from code'); + + $object_type = ''; + $link = ''; + $num++; + + switch ($action) { + case 'BILL_VALIDATE': + $link='/compta/facture.php?facid='.$object->id; + $dir_output = $conf->facture->dir_output; + $object_type = 'facture'; + $mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated",$object->ref); + break; + case 'ORDER_VALIDATE': + $link='/commande/card.php?id='.$object->id; + $dir_output = $conf->commande->dir_output; + $object_type = 'order'; + $mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$object->ref); + break; + case 'PROPAL_VALIDATE': + $link='/comm/propal.php?id='.$object->id; + $dir_output = $conf->propal->dir_output; + $object_type = 'propal'; + $mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$object->ref); + break; + case 'FICHINTER_VALIDATE': + $link='/fichinter/card.php?id='.$object->id; + $dir_output = $conf->facture->dir_output; + $object_type = 'ficheinter'; + $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref); + break; + case 'ORDER_SUPPLIER_APPROVE': + $link='/fourn/commande/card.php?id='.$object->id; + $dir_output = $conf->fournisseur->dir_output.'/commande/'; + $object_type = 'order_supplier'; + $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; + $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$object->ref,$user->getFullName($langs)); + $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; + break; + case 'ORDER_SUPPLIER_REFUSE': + $link='/fourn/commande/card.php?id='.$object->id; + $dir_output = $conf->fournisseur->dir_output.'/commande/'; + $object_type = 'order_supplier'; + $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; + $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$object->ref,$user->getFullName($langs)); + $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; + break; + case 'SHIPPING_VALIDATE': + $dir_output = $conf->expedition->dir_output.'/sending/'; + $object_type = 'order_supplier'; + $mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated",$object->ref); + break; + } + $ref = dol_sanitizeFileName($object->ref); + $pdf_path = $dir_output."/".$ref."/".$ref.".pdf"; + if (! dol_is_file($pdf_path)) + { + // We can't add PDF as it is not generated yet. + $filepdf = ''; + } + else + { + $filepdf = $pdf_path; + } + + $subject = '['.$application.'] '.$langs->transnoentitiesnoconv("DolibarrNotification"); + + $message = $langs->transnoentities("YouReceiveMailBecauseOfNotification",$application,$mysoc->name)."\n"; + $message.= $langs->transnoentities("YouReceiveMailBecauseOfNotification2",$application,$mysoc->name)."\n"; + $message.= "\n"; + $message.= $mesg; + if ($link) $message=dol_concatdesc($message,$urlwithroot.$link); + + $mailfile = new CMailFile( + $subject, + $sendto, + $replyto, + $message, + array($file), + array($mimefile), + array($filename[count($filename)-1]), + '', + '', + 0, + -1 + ); + + if ($mailfile->sendfile()) + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, objet_id, email)"; + $sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$actiondefid.", ".$object->socid.", null, '".$obj->type."', '".$object_type."', ".$object->id.", '".$this->db->escape($conf->global->$param)."')"; + if (! $this->db->query($sql)) + { + dol_print_error($this->db); + } + } + else + { + $error++; + $this->errors[]=$mailfile->error; + } + } + } + + if (! $error) return $num; + else return -1 * $error; } } diff --git a/htdocs/core/class/openid.class.php b/htdocs/core/class/openid.class.php index 5165dcb4994..a5e01998ecd 100644 --- a/htdocs/core/class/openid.class.php +++ b/htdocs/core/class/openid.class.php @@ -247,6 +247,12 @@ class SimpleOpenID } } + /** + * array2url + * + * @param array $arr An array + * @return boolean|string false if KO, string of url if OK + */ function array2url($arr) { // converts associated array to URL Query String if (!is_array($arr)){ @@ -259,6 +265,14 @@ class SimpleOpenID return $query; } + /** + * FSOCK_Request + * + * @param string $url URL + * @param string $method Method + * @param string $params Params + * @return boolean|unknown + */ function FSOCK_Request($url, $method="GET", $params = "") { $fp = fsockopen("ssl://www.myopenid.com", 443, $errno, $errstr, 3); // Connection timeout is 3 seconds @@ -283,6 +297,14 @@ class SimpleOpenID } } + /** + * CURL_Request + * + * @param string $url URL + * @param string $method Method + * @param string $params Params + * @return boolean|unknown + */ function CURL_Request($url, $method="GET", $params = "") { // Remember, SSL MUST BE SUPPORTED if (is_array($params)) $params = $this->array2url($params); @@ -305,6 +327,12 @@ class SimpleOpenID return $response; } + /** + * HTML2OpenIDServer + * + * @param string $content Content + * @return array Array of servers + */ function HTML2OpenIDServer($content) { $get = array(); diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index 80ca1b155b7..5a156b1eda7 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -194,7 +194,7 @@ class RssParser } $this->_urlRSS = $urlRSS; - $newpathofdestfile=$cachedir.'/'.dol_hash($this->_urlRSS); + $newpathofdestfile=$cachedir.'/'.dol_hash($this->_urlRSS,3); // Force md5 hash (does not contains special chars) $newmask='0644'; //dol_syslog("RssPArser::parser parse url=".$urlRSS." => cache file=".$newpathofdestfile); @@ -258,7 +258,7 @@ class RssParser if (!is_resource($xmlparser)) { $this->error="ErrorFailedToCreateParser"; return -1; } - + xml_set_object($xmlparser, $this); xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element'); xml_set_character_data_handler($xmlparser, 'feed_cdata'); @@ -268,7 +268,7 @@ class RssParser //var_dump($rss->_format);exit; } } - + // If $rss loaded if ($rss) { @@ -452,7 +452,7 @@ class RssParser * * @param string $p Start * @param string $element Tag - * @param array &$attrs Attributes of tags + * @param array $attrs Attributes of tags * @return void */ function feed_start_element($p, $element, &$attrs) @@ -644,7 +644,7 @@ class RssParser /** * To concat 2 string with no warning if an operand is not defined * - * @param string &$str1 Str1 + * @param string $str1 Str1 * @param string $str2 Str2 * @return string String cancatenated */ diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 61a098330c2..5c7d73eb136 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1159,7 +1159,7 @@ class SMTPs $this->_msgContent[$strType]['data'] = $strContent; if ( $this->getMD5flag() ) - $this->_msgContent[$strType]['md5'] = dol_hash($strContent); + $this->_msgContent[$strType]['md5'] = dol_hash($strContent, 3); //} } @@ -1329,7 +1329,7 @@ class SMTPs $this->_msgContent['attachment'][$strFileName]['data'] = $strContent; if ( $this->getMD5flag() ) - $this->_msgContent['attachment'][$strFileName]['md5'] = dol_hash($strContent); + $this->_msgContent['attachment'][$strFileName]['md5'] = dol_hash($strContent, 3); } } @@ -1356,7 +1356,7 @@ class SMTPs $this->_msgContent['image'][$strImageName]['data'] = $strContent; if ( $this->getMD5flag() ) - $this->_msgContent['image'][$strImageName]['md5'] = dol_hash($strContent); + $this->_msgContent['image'][$strImageName]['md5'] = dol_hash($strContent, 3); } } // END DOL_CHANGE LDR @@ -1487,8 +1487,8 @@ class SMTPs function _setBoundary() { $this->_smtpsBoundary = "multipart_x." . time() . ".x_boundary"; - $this->_smtpsRelatedBoundary = 'mul_'.dol_hash(uniqid("dolibarr2")); - $this->_smtpsAlternativeBoundary = 'mul_'.dol_hash(uniqid("dolibarr3")); + $this->_smtpsRelatedBoundary = 'mul_'.dol_hash(uniqid("dolibarr2"), 3); + $this->_smtpsAlternativeBoundary = 'mul_'.dol_hash(uniqid("dolibarr3"), 3); } /** diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 7462a40e897..7347b065a79 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -33,7 +33,6 @@ class Translate var $defaultlang; // Current language for current user var $direction = 'ltr'; // Left to right or Right to left - var $charset_inputfile=array(); // To store charset encoding used for language var $charset_output='UTF-8'; // Codage used by "trans" method outputs var $tab_translate=array(); // Array of all translations key=>value @@ -198,6 +197,12 @@ class Translate if ($alt < 1 && isset($langarray[1]) && strtolower($langarray[0]) == strtolower($langarray[1])) $alt=1; if ($alt < 2 && strtolower($langofdir) == 'en_us') $alt=2; + if (empty($langofdir)) // This may occurs when load is called without setting the language and without providing a value for forcelangdir + { + dol_syslog("Error: ".get_class($this)."::Load was called but language was not set yet with langs->setDefaultLang(). Nothing will be loaded.", LOG_WARNING); + return -1; + } + foreach($this->dir as $keydir => $searchdir) { // Directory of translation files @@ -701,6 +706,7 @@ class Translate * @param string $currency_code Currency Code * @param string $amount If not '', show currency + amount according to langs ($10, 10€). * @return string Amount + Currency symbol encoded into UTF8 + * @deprecated Use method price to output a price */ function getCurrencyAmount($currency_code, $amount) { diff --git a/htdocs/core/datepicker.php b/htdocs/core/datepicker.php index 7e0333bc5aa..9c584c2ef6e 100644 --- a/htdocs/core/datepicker.php +++ b/htdocs/core/datepicker.php @@ -2,6 +2,7 @@ /* Copyright (C) phpBSM * Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2005-2007 Regis Houssin + * Copyright (C) 2014 Juanjo Menent * * This file is a modified version of datepicker.php from phpBSM to fix some * bugs, to add new features and to dramatically increase speed. @@ -26,7 +27,7 @@ */ if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language -if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); @@ -39,6 +40,7 @@ require_once '../main.inc.php'; if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); // If language was forced on URL by the main.inc.php $langs->load("main"); +$langs->load("agenda"); $right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); $left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); @@ -57,7 +59,7 @@ if (GETPOST('mode') && GETPOST('mode') == 'test') } else { - print 'Calendar'; + print ''.$langs->trans("Calendar").''; } // Define tradMonths javascript array (we define this in datapicker AND in parent page to avoid errors with IE8) @@ -183,13 +185,14 @@ function displayBox($selectedDate,$month,$year) onClick="loadMonth('','','','','defaultlang ?>')">>> - trans("ShortSunday") ?> - trans("ShortMonday") ?> - trans("ShortTuesday") ?> - trans("ShortWednesday") ?> - trans("ShortThursday") ?> - trans("ShortFriday") ?> - trans("ShortSaturday") ?> + global->MAIN_START_WEEK) ? (int) $conf->global->MAIN_START_WEEK : 0; + $day_names = array('ShortSunday', 'ShortMonday', 'ShortTuesday', 'ShortWednesday', 'ShortThursday', 'ShortFriday', 'ShortSaturday'); + for( $i=0; $i < 7; $i++ ) + { + echo '', $langs->trans($day_names[($i + $first_day_of_week) % 7]), '', "\n"; + } + ?> "; $cols=0; - for($i=0;$i< $mydate["wday"];$i++) + for($i=0;$i< ($mydate["wday"]+7-$first_day_of_week)%7;$i++) { echo " "; $cols++; @@ -213,7 +216,7 @@ function displayBox($selectedDate,$month,$year) } else { - if ($mydate["wday"]==0) + if ($mydate["wday"]==$first_day_of_week) { echo ""; $cols=0; @@ -237,7 +240,7 @@ function displayBox($selectedDate,$month,$year) echo ">".sprintf("%02s",$mydate["mday"]).""; $cols++; - if ($mydate["wday"]==6) echo "\n"; + if ($mydate != $firstdate && $mydate["wday"]==(($first_day_of_week + 6)%7)) echo "\n"; //$thedate=strtotime("tomorrow",$thedate); $day++; diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php index 8b5f2c86810..0fbf22b0745 100644 --- a/htdocs/core/db/Database.interface.php +++ b/htdocs/core/db/Database.interface.php @@ -121,9 +121,9 @@ interface Database /** * List tables into a database * - * @param string $database Name of database - * @param string $table Nmae of table filter ('xxx%') - * @return resource Resource + * @param string $database Name of database + * @param string $table Nmae of table filter ('xxx%') + * @return array List of tables in an array */ function DDLListTables($database, $table = ''); @@ -386,9 +386,9 @@ interface Database * 19700101020000 -> 3600 with TZ+1 and gmt=0 * 19700101020000 -> 7200 whaterver is TZ if gmt=1 * - * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) - * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ - * @return date Date TMS + * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) + * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ + * @return timestamp|string Date TMS */ function jdate($string, $gm=false); diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index e0921f7acac..baf38bd9a39 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -17,8 +17,8 @@ */ /** - * \file htdocs/core/db/dolidb.class.php - * \brief Class file to manage Dolibarr database access + * \file htdocs/core/db/DoliDB.class.php + * \brief Class file to manage Dolibarr database access */ require_once DOL_DOCUMENT_ROOT .'/core/db/Database.interface.php'; @@ -46,6 +46,10 @@ abstract class DoliDB implements Database public $database_name; //! Database username public $database_user; + //! Database host + public $database_host; + //! Database port + public $database_port; //! >=1 if a transaction is opened, 0 otherwise public $transaction_opened; //! Last successful query @@ -137,8 +141,12 @@ abstract class DoliDB implements Database { $this->transaction_opened=0; dol_syslog("COMMIT Transaction".($log?' '.$log:''),LOG_DEBUG); + return 1; + } + else + { + return 0; } - return $ret; } else { @@ -150,8 +158,8 @@ abstract class DoliDB implements Database /** * Annulation d'une transaction et retour aux anciennes valeurs * - * @param string $log Add more log to default log line - * @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur + * @param string $log Add more log to default log line + * @return resource|int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur */ function rollback($log='') { @@ -248,7 +256,7 @@ abstract class DoliDB implements Database /** * Return last error label * - * @return string lasterror + * @return string Last error */ function lasterror() { @@ -260,9 +268,9 @@ abstract class DoliDB implements Database * 19700101020000 -> 3600 with TZ+1 and gmt=0 * 19700101020000 -> 7200 whaterver is TZ if gmt=1 * - * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) - * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ - * @return date Date TMS + * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) + * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ + * @return timestamp|string Date TMS */ function jdate($string, $gm=false) { diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 09885257ef6..0f86f01693c 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -53,13 +53,14 @@ class DoliDBMssql extends DoliDB * @param string $pass Mot de passe * @param string $name Nom de la database * @param int $port Port of database server - * @return int 1 if OK, 0 if not */ function __construct($type, $host, $user, $pass, $name='', $port=0) { global $conf,$langs; $this->database_user=$user; + $this->database_host=$host; + $this->database_port=$port; $this->transaction_opened=0; if (! function_exists("mssql_connect")) @@ -255,8 +256,12 @@ class DoliDBMssql extends DoliDB { $this->transaction_opened=0; dol_syslog("COMMIT Transaction",LOG_DEBUG); + return 1; + } + else + { + return 0; } - return $ret; } else { @@ -672,7 +677,7 @@ class DoliDBMssql extends DoliDB * * @param string $database Name of database * @param string $table Nmae of table filter ('xxx%') - * @return resource Resource + * @return array List of tables in an array */ function DDLListTables($database,$table='') { diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 5be76d6d5d7..bd3e77f37d5 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -50,7 +50,6 @@ class DoliDBMysql extends DoliDB * @param string $pass Mot de passe * @param string $name Nom de la database * @param int $port Port of database server - * @return int 1 if OK, 0 if not */ function __construct($type, $host, $user, $pass, $name='', $port=0) { @@ -61,6 +60,8 @@ class DoliDBMysql extends DoliDB if (! empty($conf->db->dolibarr_main_db_collation)) $this->forcecollate=$conf->db->dolibarr_main_db_collation; $this->database_user=$user; + $this->database_host=$host; + $this->database_port=$port; $this->transaction_opened=0; @@ -585,7 +586,7 @@ class DoliDBMysql extends DoliDB * * @param string $database Name of database * @param string $table Nmae of table filter ('xxx%') - * @return resource Resource + * @return array List of tables in an array */ function DDLListTables($database, $table='') { diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 31cad578ce8..cd692db677c 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -50,7 +50,6 @@ class DoliDBMysqli extends DoliDB * @param string $pass Mot de passe * @param string $name Nom de la database * @param int $port Port of database server - * @return int 1 if OK, 0 if not */ function __construct($type, $host, $user, $pass, $name='', $port=0) { @@ -61,6 +60,8 @@ class DoliDBMysqli extends DoliDB if (! empty($conf->db->dolibarr_main_db_collation)) $this->forcecollate=$conf->db->dolibarr_main_db_collation; $this->database_user=$user; + $this->database_host=$host; + $this->database_port=$port; $this->transaction_opened=0; @@ -355,7 +356,6 @@ class DoliDBMysqli extends DoliDB * @return int Nombre de lignes * @see num_rows */ - function affected_rows($resultset) { // If resultset not provided, we take the last used by connexion @@ -590,7 +590,7 @@ class DoliDBMysqli extends DoliDB * * @param string $database Name of database * @param string $table Nmae of table filter ('xxx%') - * @return resource Resource + * @return array List of tables in an array */ function DDLListTables($database, $table='') { diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 25263deee46..19d0cabc07f 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -60,7 +60,6 @@ class DoliDBPgsql extends DoliDB * @param string $pass Mot de passe * @param string $name Nom de la database * @param int $port Port of database server - * @return int 1 if OK, 0 if not */ function __construct($type, $host, $user, $pass, $name='', $port=0) { @@ -71,6 +70,8 @@ class DoliDBPgsql extends DoliDB if (! empty($conf->db->dolibarr_main_db_collation)) $this->forcecollate=$conf->db->dolibarr_main_db_collation; $this->database_user=$user; + $this->database_host=$host; + $this->database_port=$port; $this->transaction_opened=0; @@ -387,7 +388,7 @@ class DoliDBPgsql extends DoliDB if ((! empty($host) && $host == "socket") && ! defined('NOLOCALSOCKETPGCONNECT')) { $con_string = "dbname='".$name."' user='".$login."' password='".$passwd."'"; // $name may be empty - $this->db = pg_connect($con_string); + $this->db = @pg_connect($con_string); } // if local connection failed or not requested, use TCP/IP @@ -397,7 +398,7 @@ class DoliDBPgsql extends DoliDB if (! $port) $port = 5432; $con_string = "host='".$host."' port='".$port."' dbname='".$name."' user='".$login."' password='".$passwd."'"; - $this->db = pg_connect($con_string); + $this->db = @pg_connect($con_string); } // now we test if at least one connect method was a success @@ -667,7 +668,7 @@ class DoliDBPgsql extends DoliDB /** * Renvoie le code erreur generique de l'operation precedente. * - * @return error_num (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...) + * @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...) */ function errno() { @@ -733,7 +734,7 @@ class DoliDBPgsql extends DoliDB /** * Renvoie le texte de l'erreur pgsql de l'operation precedente * - * @return error_text + * @return string Error text */ function error() { @@ -836,7 +837,7 @@ class DoliDBPgsql extends DoliDB // Test charset match LC_TYPE (pgsql error otherwise) //print $charset.' '.setlocale(LC_CTYPE,'0'); exit; - $sql='CREATE DATABASE '.$database.' OWNER '.$owner.' ENCODING \''.$charset.'\''; + $sql='CREATE DATABASE "'.$database.'" OWNER "'.$owner.'" ENCODING \''.$charset.'\''; dol_syslog($sql,LOG_DEBUG); $ret=$this->query($sql); return $ret; @@ -846,8 +847,8 @@ class DoliDBPgsql extends DoliDB * List tables into a database * * @param string $database Name of database - * @param string $table Nmae of table filter ('xxx%') - * @return resource Resource + * @param string $table Name of table filter ('xxx%') + * @return array List of tables in an array */ function DDLListTables($database, $table='') { @@ -860,7 +861,7 @@ class DoliDBPgsql extends DoliDB { $listtables[] = $row[0]; } - return $listtables; + return $listtables; } /** diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index dd040a9b199..b16114a773f 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -50,7 +50,6 @@ class DoliDBSqlite extends DoliDB * @param string $pass Mot de passe * @param string $name Nom de la database * @param int $port Port of database server - * @return int 1 if OK, 0 if not */ function __construct($type, $host, $user, $pass, $name='', $port=0) { @@ -61,6 +60,8 @@ class DoliDBSqlite extends DoliDB if (! empty($conf->db->dolibarr_main_db_collation)) $this->forcecollate=$conf->db->dolibarr_main_db_collation; $this->database_user=$user; + $this->database_host=$host; + $this->database_port=$port; $this->transaction_opened=0; @@ -534,7 +535,7 @@ class DoliDBSqlite extends DoliDB /** * Renvoie le code erreur generique de l'operation precedente. * - * @return string $error_num (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...) + * @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...) */ function errno() { @@ -596,7 +597,7 @@ class DoliDBSqlite extends DoliDB /** * Renvoie le texte de l'erreur mysql de l'operation precedente. * - * @return string $error_text + * @return string Error text */ function error() { @@ -737,8 +738,8 @@ class DoliDBSqlite extends DoliDB * List tables into a database * * @param string $database Name of database - * @param string $table Nmae of table filter ('xxx%') - * @return resource Resource + * @param string $table Name of table filter ('xxx%') + * @return array List of tables in an array */ function DDLListTables($database, $table='') { diff --git a/htdocs/core/filemanagerdol/connectors/php/basexml.php b/htdocs/core/filemanagerdol/connectors/php/basexml.php index 72c36761386..7565aae8211 100644 --- a/htdocs/core/filemanagerdol/connectors/php/basexml.php +++ b/htdocs/core/filemanagerdol/connectors/php/basexml.php @@ -47,6 +47,14 @@ function SetXmlHeaders() header('Content-Type: text/xml; charset=utf-8'); } +/** + * CreateXmlHeader + * + * @param string $command Command + * @param string $resourceType Resource type + * @param string $currentFolder Current folder + * @return void + */ function CreateXmlHeader( $command, $resourceType, $currentFolder ) { SetXmlHeaders(); @@ -63,6 +71,11 @@ function CreateXmlHeader( $command, $resourceType, $currentFolder ) $GLOBALS['HeaderSent'] = true ; } +/** + * CreateXmlFooter + * + * @return void + */ function CreateXmlFooter() { echo '' ; diff --git a/htdocs/core/filemanagerdol/connectors/php/commands.php b/htdocs/core/filemanagerdol/connectors/php/commands.php index 6369ac9d3ae..3a0dc0378ea 100644 --- a/htdocs/core/filemanagerdol/connectors/php/commands.php +++ b/htdocs/core/filemanagerdol/connectors/php/commands.php @@ -53,6 +53,13 @@ function GetFolders( $resourceType, $currentFolder ) echo "" ; } +/** + * GetFoldersAndFiles + * + * @param string $resourceType Resource type + * @param string $currentFolder Current folder + * @return void + */ function GetFoldersAndFiles( $resourceType, $currentFolder ) { // Map the virtual path to the local server path. @@ -111,6 +118,13 @@ function GetFoldersAndFiles( $resourceType, $currentFolder ) echo '' ; } +/** + * Create folder + * + * @param string $resourceType Resource type + * @param string $currentFolder Current folder + * @return void + */ function CreateFolder( $resourceType, $currentFolder ) { if (!isset($_GET)) { diff --git a/htdocs/core/filemanagerdol/connectors/php/connector.php b/htdocs/core/filemanagerdol/connectors/php/connector.php index 810f75601b6..23d4eb79d77 100644 --- a/htdocs/core/filemanagerdol/connectors/php/connector.php +++ b/htdocs/core/filemanagerdol/connectors/php/connector.php @@ -35,13 +35,18 @@ if ( !$Config['Enabled'] ) DoResponse(); +/** + * DoResponse + * + * @return void + */ function DoResponse() { if (!isset($_GET)) { global $_GET; } if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) ) - return ; + return; // Get the main request informaiton. $sCommand = $_GET['Command'] ; @@ -60,7 +65,7 @@ function DoResponse() if ( $sCommand == 'FileUpload' ) { FileUpload($sResourceType, $sCurrentFolder, $sCommand); - return ; + return; } CreateXmlHeader($sCommand, $sResourceType, $sCurrentFolder); @@ -70,16 +75,16 @@ function DoResponse() { case 'GetFolders' : GetFolders($sResourceType, $sCurrentFolder); - break ; + break; case 'GetFoldersAndFiles' : GetFoldersAndFiles($sResourceType, $sCurrentFolder); - break ; + break; case 'CreateFolder' : CreateFolder($sResourceType, $sCurrentFolder); - break ; + break; } CreateXmlFooter(); - exit ; + exit; } diff --git a/htdocs/core/filemanagerdol/connectors/php/io.php b/htdocs/core/filemanagerdol/connectors/php/io.php index 4183b0e0573..966efd0f0af 100644 --- a/htdocs/core/filemanagerdol/connectors/php/io.php +++ b/htdocs/core/filemanagerdol/connectors/php/io.php @@ -115,11 +115,18 @@ function ServerMapFolder($resourceType, $folderPath, $sCommand) return CombinePaths($sResourceTypePath, $folderPath); } -function GetParentFolder( $folderPath ) +/** + * GetParentFolder + * + * @param string $folderPath Folder path + * @return string Parent folder + */ +function GetParentFolder($folderPath) { - $sPattern = "-[/\\\\][^/\\\\]+[/\\\\]?$-" ; - return preg_replace($sPattern, '', $folderPath); + $sPattern = "-[/\\\\][^/\\\\]+[/\\\\]?$-" ; + return preg_replace($sPattern, '', $folderPath); } + /** * CreateServerFolder * @@ -189,46 +196,57 @@ function CreateServerFolder($folderPath, $lastFolder = null) return '' ; } +/** + * Get Root Path + * + * @return string real path + */ function GetRootPath() { - if (!isset($_SERVER)) { - global $_SERVER; - } - $sRealPath = realpath('./'); - // #2124 ensure that no slash is at the end - $sRealPath = rtrim($sRealPath,"\\/"); + if (!isset($_SERVER)) { + global $_SERVER; + } + $sRealPath = realpath('./'); + // #2124 ensure that no slash is at the end + $sRealPath = rtrim($sRealPath,"\\/"); - $sSelfPath = $_SERVER['PHP_SELF'] ; - $sSelfPath = substr($sSelfPath, 0, strrpos($sSelfPath, '/')); + $sSelfPath = $_SERVER['PHP_SELF'] ; + $sSelfPath = substr($sSelfPath, 0, strrpos($sSelfPath, '/')); - $sSelfPath = str_replace('/', DIRECTORY_SEPARATOR, $sSelfPath); + $sSelfPath = str_replace('/', DIRECTORY_SEPARATOR, $sSelfPath); - $position = strpos($sRealPath, $sSelfPath); + $position = strpos($sRealPath, $sSelfPath); - // This can check only that this script isn't run from a virtual dir - // But it avoids the problems that arise if it isn't checked - if ( $position === false || $position <> strlen($sRealPath) - strlen($sSelfPath) ) - SendError(1, 'Sorry, can\'t map "UserFilesPath" to a physical path. You must set the "UserFilesAbsolutePath" value in "editor/filemanager/connectors/php/config.php".'); + // This can check only that this script isn't run from a virtual dir + // But it avoids the problems that arise if it isn't checked + if ( $position === false || $position <> strlen($sRealPath) - strlen($sSelfPath) ) + SendError(1, 'Sorry, can\'t map "UserFilesPath" to a physical path. You must set the "UserFilesAbsolutePath" value in "editor/filemanager/connectors/php/config.php".'); - return substr($sRealPath, 0, $position); + return substr($sRealPath, 0, $position); } // Emulate the asp Server.mapPath function. // given an url path return the physical directory that it corresponds to function Server_MapPath( $path ) { - // This function is available only for Apache - if (function_exists('apache_lookup_uri')) - { - $info = apache_lookup_uri($path); - return $info->filename . $info->path_info ; - } + // This function is available only for Apache + if (function_exists('apache_lookup_uri')) { + $info = apache_lookup_uri($path); + return $info->filename . $info->path_info ; + } - // This isn't correct but for the moment there's no other solution - // If this script is under a virtual directory or symlink it will detect the problem and stop - return GetRootPath() . $path ; + // This isn't correct but for the moment there's no other solution + // If this script is under a virtual directory or symlink it will detect the problem and stop + return GetRootPath() . $path ; } +/** + * Is Allowed Extension + * + * @param string $sExtension File extension + * @param string $resourceType ressource type + * @return boolean true or false + */ function IsAllowedExt($sExtension, $resourceType) { global $Config ; @@ -245,6 +263,12 @@ function IsAllowedExt($sExtension, $resourceType) return true ; } +/** + * Is Allowed Type + * + * @param string $resourceType ressource type + * @return boolean true or false + */ function IsAllowedType($resourceType) { global $Config ; @@ -257,8 +281,8 @@ function IsAllowedType($resourceType) /** * IsAllowedCommand * - * @param string $sCommand Command - * @return boolean True or false + * @param string $sCommand Command + * @return boolean True or false */ function IsAllowedCommand($sCommand) { diff --git a/htdocs/core/filemanagerdol/connectors/php/upload.php b/htdocs/core/filemanagerdol/connectors/php/upload.php index cf329590aed..664ffbf2bdb 100644 --- a/htdocs/core/filemanagerdol/connectors/php/upload.php +++ b/htdocs/core/filemanagerdol/connectors/php/upload.php @@ -27,7 +27,14 @@ require 'util.php'; require 'io.php'; require 'commands.php'; -function SendError( $number, $text ) +/** + * SendError + * + * @param string $number Number + * @param string $text Text + * @return void + */ +function SendError($number, $text) { SendUploadResults($number, '', '', $text); } diff --git a/htdocs/core/js/editinplace.js b/htdocs/core/js/editinplace.js index 4fe29e4b4fb..17d70220b31 100644 --- a/htdocs/core/js/editinplace.js +++ b/htdocs/core/js/editinplace.js @@ -1,4 +1,4 @@ -// Copyright (C) 2011-2012 Regis Houssin +// Copyright (C) 2011-2014 Regis Houssin // Copyright (C) 2011 Laurent Destailleur // // This program is free software; you can redistribute it and/or modify @@ -358,12 +358,19 @@ $(document).ready(function() { var res = $.parseJSON(result); if (res.error) { $(obj).html(obj.revert); - $.jnotify(res.error, "error", true); + var htmlname = $(obj).attr('id').substr(8); + var errormsg = $( '#errormsg_' + htmlname ).val(); + if (errormsg != undefined) { + $.jnotify(errormsg, "error", true); + } else { + $.jnotify(res.error, "error", true); + } + } else { var htmlname = $(obj).attr('id').substr(8); - var success = $( '#success_' + htmlname ).val(); - if (success != undefined) { - $.jnotify(success, "ok"); + var successmsg = $( '#successmsg_' + htmlname ).val(); + if (successmsg != undefined) { + $.jnotify(successmsg, "ok"); } $(obj).html(res.value); $(obj).hide(); diff --git a/htdocs/core/js/lib_head.js b/htdocs/core/js/lib_head.js index 40b1473698e..962e4c39f47 100644 --- a/htdocs/core/js/lib_head.js +++ b/htdocs/core/js/lib_head.js @@ -631,7 +631,7 @@ function hideMessage(fieldId,message) { /* - * TODO Used by admin page only ? + * Used by button to set on/off */ function setConstant(url, code, input, entity, strict) { $.get( url, { @@ -689,7 +689,7 @@ function setConstant(url, code, input, entity, strict) { } /* - * TODO Used by admin page only ? + * Used by button to set on/off */ function delConstant(url, code, input, entity, strict) { $.get( url, { @@ -743,7 +743,7 @@ function delConstant(url, code, input, entity, strict) { } /* - * TODO Used by admin page only ? + * Used by button to set on/off */ function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton, strict) { var boxConfirm = box; diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index 69e47569b07..f9f39a53f7d 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -26,40 +26,39 @@ /** * Prepare array with list of admin tabs * - * @param Object $object Accounting account - * + * @param Object $object Object instance we show card * @return array Array of tabs to show */ -function admin_accounting_prepare_head($object) +function admin_accounting_prepare_head($object=null) { global $langs, $conf; - + $h = 0; $head = array (); - + $head[$h][0] = dol_buildpath('/accountancy/admin/index.php', 1); $head[$h][1] = $langs->trans("Configuration"); $head[$h][2] = 'general'; $h ++; - + // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_admin'); - + $head[$h][0] = dol_buildpath('/accountancy/admin/journaux.php', 1); $head[$h][1] = $langs->trans("Journaux"); $head[$h][2] = 'journal'; $h ++; - + $head[$h][0] = dol_buildpath('/accountancy/admin/export.php', 1); $head[$h][1] = $langs->trans("Export"); $head[$h][2] = 'export'; $h ++; - + complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_admin', 'remove'); - + return $head; } @@ -72,23 +71,23 @@ function admin_accounting_prepare_head($object) function accounting_prepare_head($object) { global $langs, $conf; - + $h = 0; $head = array (); - + $head[$h][0] = dol_buildpath('/accountancy/admin/card.php', 1) . '?id=' . $object->id; $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'card'; $h ++; - + // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_account'); - + complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_account', 'remove'); - + return $head; } @@ -96,25 +95,25 @@ function accounting_prepare_head($object) * Return general accounting account with defined length * * @param string $account General accounting account - * @return string String with defined length + * @return string String with defined length */ function length_accountg($account) { global $conf; - + $g = $conf->global->ACCOUNTING_LENGTH_GACCOUNT; - + if (! empty($g)) { // Clean parameters $i = strlen($account); - + if ($i >= 2) { while ( $i < $g ) { $account .= '0'; - + $i ++; } - + return $account; } else { return $account; @@ -128,25 +127,25 @@ function length_accountg($account) * Return auxiliary accounting account with defined length * * @param string $accounta Auxiliary accounting account - * @return string String with defined length + * @return string String with defined length */ function length_accounta($accounta) { global $conf, $langs; - + $a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT; - + if (! empty($a)) { // Clean parameters $i = strlen($accounta); - + if ($i >= 2) { while ( $i < $a ) { $accounta .= '0'; - + $i ++; } - + return $accounta; } else { return $accounta; @@ -162,8 +161,8 @@ function length_accounta($accounta) * @param string $txt Accounting account * @param int $len Length * @param int $end Number of characters - * - * @return string Formated string + * + * @return string Formated string */ function length_exportsage($txt, $len, $end) { @@ -171,11 +170,11 @@ function length_exportsage($txt, $len, $end) // problem with this function, but we need to have the number of letter if (strlen($txt) == $len) { $res = $txt; - } + } elseif (strlen($txt) > $len) { $res = substr($txt, 0, $len); - } + } else { if ($end == 1) { diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 14963b72288..a54cb5fcc79 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -70,7 +70,7 @@ function versioncompare($versionarray1,$versionarray2) if ($operande1 < $operande2) { $ret = -$level; break; } if ($operande1 > $operande2) { $ret = $level; break; } } - //print join('.',$versionarray1).'('.count($versionarray1).') / '.join('.',$versionarray2).'('.count($versionarray2).') => '.$ret; + //print join('.',$versionarray1).'('.count($versionarray1).') / '.join('.',$versionarray2).'('.count($versionarray2).') => '.$ret.'
    '."\n"; return $ret; } @@ -516,11 +516,6 @@ function security_prepare_head() $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT."/admin/proxy.php"; - $head[$h][1] = $langs->trans("ExternalAccess"); - $head[$h][2] = 'proxy'; - $h++; - $head[$h][0] = DOL_URL_ROOT."/admin/security_other.php"; $head[$h][1] = $langs->trans("Miscellaneous"); $head[$h][2] = 'misc'; @@ -531,6 +526,16 @@ function security_prepare_head() $head[$h][2] = 'passwords'; $h++; + $head[$h][0] = DOL_URL_ROOT."/admin/security_file.php"; + $head[$h][1] = $langs->trans("Files"); + $head[$h][2] = 'file'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/admin/proxy.php"; + $head[$h][1] = $langs->trans("ExternalAccess"); + $head[$h][2] = 'proxy'; + $h++; + $head[$h][0] = DOL_URL_ROOT."/admin/events.php"; $head[$h][1] = $langs->trans("Audit"); $head[$h][2] = 'audit'; @@ -712,7 +717,7 @@ function activateModule($value,$withdeps=1) // Test if Dolibarr version ok $verdol=versiondolibarrarray(); $vermin=isset($objMod->need_dolibarr_version)?$objMod->need_dolibarr_version:0; - //print 'eee'.versioncompare($verdol,$vermin).join(',',$verdol).' - '.join(',',$vermin);exit; + //print 'eee '.versioncompare($verdol,$vermin).' - '.join(',',$verdol).' - '.join(',',$vermin);exit; if (is_array($vermin) && versioncompare($verdol,$vermin) < 0) { return $langs->trans("ErrorModuleRequireDolibarrVersion",versiontostring($vermin)); @@ -851,18 +856,18 @@ function unActivateModule($value, $requiredby=1) /** * Add external modules to list of dictionaries * - * @param array &$taborder Taborder - * @param array &$tabname Tabname - * @param array &$tablib Tablib - * @param array &$tabsql Tabsql - * @param array &$tabsqlsort Tabsqlsort - * @param array &$tabfield Tabfield - * @param array &$tabfieldvalue Tabfieldvalue - * @param array &$tabfieldinsert Tabfieldinsert - * @param array &$tabrowid Tabrowid - * @param array &$tabcond Tabcond - * @param array &$tabhelp Tabhelp - * @param array &$tabfieldcheck Tabfieldcheck + * @param array $taborder Taborder + * @param array $tabname Tabname + * @param array $tablib Tablib + * @param array $tabsql Tabsql + * @param array $tabsqlsort Tabsqlsort + * @param array $tabfield Tabfield + * @param array $tabfieldvalue Tabfieldvalue + * @param array $tabfieldinsert Tabfieldinsert + * @param array $tabrowid Tabrowid + * @param array $tabcond Tabcond + * @param array $tabhelp Tabhelp + * @param array $tabfieldcheck Tabfieldcheck * @return int 1 */ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql,&$tabsqlsort,&$tabfield,&$tabfieldvalue,&$tabfieldinsert,&$tabrowid,&$tabcond,&$tabhelp,&$tabfieldcheck) @@ -965,6 +970,7 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql { //var_dump($objMod->dictionaries['tabname']); $taborder[] = 0; + $tabfieldcheck[] = array(); $tabhelp[] = array(); foreach($objMod->dictionaries['tabname'] as $val) { $taborder[] = count($tabname)+1; @@ -978,7 +984,7 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql foreach($objMod->dictionaries['tabfieldinsert'] as $val) $tabfieldinsert[] = $val; foreach($objMod->dictionaries['tabrowid'] as $val) $tabrowid[] = $val; foreach($objMod->dictionaries['tabcond'] as $val) $tabcond[] = $val; - foreach($objMod->dictionaries['tabfieldcheck'] as $val) $tabfieldcheck[] = $val; + if (! empty($objMod->dictionaries['tabfieldcheck'])) foreach($objMod->dictionaries['tabfieldcheck'] as $val) $tabfieldcheck[] = $val; if (! empty($objMod->dictionaries['tabhelp'])) foreach($objMod->dictionaries['tabhelp'] as $val) $tabhelp[] = $val; //foreach($objMod->dictionaries['tabsqlsort'] as $val) $tablib[] = $val; //$tabname = array_merge ($tabname, $objMod->dictionaries['tabname']); @@ -1192,7 +1198,7 @@ function showModulesExludedForExternal($modules) $text .= $langs->trans('Module'.$module->numero.'Name'); } } - return img_picto($langs->trans('InfoAdmin'), 'star').' '.$text; + return $text; } diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 27b02e060e8..80e556378c0 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -70,36 +70,13 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh { print ''; print ''; - //print $langs->trans("ActionsAskedBy"); - //print '  '; - //print $form->select_dolusers($filtera, 'userasked', 1, '', ! $canedit); - //print '   '.$langs->trans("or") . ' '; - print $langs->trans("ActionAffectedTo").'   '; + print $langs->trans("ActionsToDoBy").'   '; print ''; - //print $langs->trans("User"); print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit); - if (! empty($conf->use_javascript_ajax)) - { - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; - print ajax_combobox('usertodo'); - } - if (empty($conf->dol_optimize_smallscreen)) print '   '.$langs->trans("or") . ' '; - else print '
    '; - print $langs->trans("Group").'   '; + if (empty($conf->dol_optimize_smallscreen)) print '   '.$langs->trans("or") . ' '.$langs->trans("Group").'   '; print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit); - if (! empty($conf->use_javascript_ajax)) - { - print ajax_combobox('usergroup'); - } print ''; - /*print ''; - print ''; - print $langs->trans("or") . ' ' . $langs->trans("ActionsDoneBy"); - print '  '; - print $form->select_dolusers($filterd, 'userdone', 1, '', ! $canedit); - print '';*/ - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions=new FormActions($db); @@ -147,16 +124,18 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print ''; print ''.$langs->trans("WorkingTimeRange").''; print ""; - print ' - '; + print ''; + if (empty($conf->dol_use_jmobile)) print ' - '; print ''; - print ' '.$langs->trans("H"); + if (empty($conf->dol_use_jmobile)) print ' '.$langs->trans("H"); print ''; // Filter on days print ''; print ''.$langs->trans("WorkingDaysRange").''; print ""; - print ' - '; + print ''; + if (empty($conf->dol_use_jmobile)) print ' - '; print ''; print ''; } @@ -170,7 +149,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh if (! empty($conf->browser->phone)) print ''; else print ''; - if (! empty($conf->browser->phone)) print '
    '; + if (! empty($conf->browser->phone)) print '
    '; else print ''; print ''; $staticaction->type_code=$obj->code; - $staticaction->libelle=$obj->label; + $staticaction->label=($obj->label?$obj->label:$obj->type_label); $staticaction->id=$obj->id; print ''; @@ -435,26 +414,18 @@ function actions_prepare_head($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/comm/action/fiche.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/comm/action/card.php?id='.$object->id; $head[$h][1] = $langs->trans("CardAction"); $head[$h][2] = 'card'; $h++; - if (! empty($conf->global->AGENDA_USE_SEVERAL_CONTACTS)) - { - $head[$h][0] = DOL_URL_ROOT.'/comm/action/contact.php?id='.$object->id; - $head[$h][1] = $langs->trans("Contacts"); - $head[$h][2] = 'contact'; - $h++; - } - // Attached files require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $upload_dir = $conf->agenda->dir_output . "/" . $object->id; $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); $head[$h][0] = DOL_URL_ROOT.'/comm/action/document.php?id='.$object->id; $head[$h][1] = $langs->trans("Documents"); - if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')'; + if ($nbFiles > 0) $head[$h][1].= ' '.$nbFiles.''; $head[$h][2] = 'documents'; $h++; diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 9081fba5550..96c7bc8d05a 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -173,6 +173,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt } $("#search_'.$htmlname.'").trigger("change"); // To tell that input text field was modified } + ,delay: 500 }).data( "autocomplete" )._renderItem = function( ul, item ) { return $( "
  • " ) .data( "item.autocomplete", item ) @@ -319,74 +320,71 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0) { global $conf; - if (! empty($conf->browser->phone)) return ''; // combobox disabled for smartphones (does not works) + //if (! empty($conf->browser->phone)) return ''; // combobox disabled for smartphones (does not works) + //if (! empty($conf->dol_use_jmobile)) return ''; // select2 works with jmobile if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return ''; - - /* Some properties for combobox: - minLengthToAutocomplete: 2, - comboboxContainerClass: "comboboxContainer", - comboboxValueContainerClass: "comboboxValueContainer", - comboboxValueContentClass: "comboboxValueContent", - comboboxDropDownClass: "comboboxDropDownContainer", - comboboxDropDownButtonClass: "comboboxDropDownButton", - comboboxDropDownItemClass: "comboboxItem", - comboboxDropDownItemHoverClass: "comboboxItemHover", - comboboxDropDownGroupItemHeaderClass: "comboboxGroupItemHeader", - comboboxDropDownGroupItemContainerClass: "comboboxGroupItemContainer", - animationType: "slide", - width: "500px" */ - + if (empty($conf->use_javascript_ajax)) return ''; + + if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete=0; + $msg = '\n"; return $msg; @@ -459,3 +457,89 @@ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, return $out; } +/** + * On/off button for object + * + * @param int $object Id product to set + * @param string $code Name of constant : status or status_buy for product by example + * @param string $field Name of database field : tosell or tobuy for product by example + * @param string $text_on Text if on + * @param string $text_off Text if off + * @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid')) + * @return void + */ +function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input=array()) +{ + global $langs; + + $out= ''; + $out.= ''.img_picto($langs->trans($text_off),'switch_off').''; + $out.= ''.img_picto($langs->trans($text_on),'switch_on').''; + + return $out; +} + diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 349cb15063f..e3fb787657b 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -36,7 +36,7 @@ function bank_prepare_head($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT . '/compta/bank/fiche.php?id=' . $object->id; + $head[$h][0] = DOL_URL_ROOT . '/compta/bank/card.php?id=' . $object->id; $head[$h][1] = $langs->trans("AccountCard"); $head[$h][2] = 'bankname'; $h++; @@ -89,6 +89,39 @@ function bank_prepare_head($object) return $head; } +/** + * Prepare array with list of tabs + * + * @param Object $object Object related to tabs + * @return array Array of tabs to shoc + */ +function bank_admin_prepare_head($object) +{ + global $langs, $conf, $user; + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT . '/admin/bank.php'; + $head[$h][1] = $langs->trans("Miscellaneous"); + $head[$h][2] = 'general'; + $h++; + + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $this->tabs = array('entity:-tabname); to remove a tab + complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank_admin'); + + $head[$h][0] = DOL_URL_ROOT.'/admin/bank_extrafields.php'; + $head[$h][1] = $langs->trans("ExtraFields"); + $head[$h][2] = 'attributes'; + $h++; + + complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank_admin', 'remove'); + + return $head; + } /** * Check account number informations for a bank account diff --git a/htdocs/core/lib/barcode.lib.php b/htdocs/core/lib/barcode.lib.php index bc0422a5fb4..243b862ff88 100644 --- a/htdocs/core/lib/barcode.lib.php +++ b/htdocs/core/lib/barcode.lib.php @@ -52,7 +52,6 @@ if (empty($font_loc)) die('DOL_DEFAULT_TTF_BOLD must de defined with full path t if (defined('PHP-BARCODE_PATH_COMMAND')) $genbarcode_loc=constant('PHP-BARCODE_PATH_COMMAND'); else $genbarcode_loc = $conf->global->GENBARCODE_LOCATION; -//dol_syslog("genbarcode_loc=".$genbarcode_loc." - env_windows=".$_SERVER['WINDIR']); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index e3ad4ef3eb7..0504727b61e 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -37,7 +37,7 @@ */ function societe_prepare_head($object) { - global $langs, $conf, $user; + global $db, $langs, $conf, $user; $h = 0; $head = array(); @@ -48,7 +48,7 @@ function societe_prepare_head($object) if ($object->client==1 || $object->client==2 || $object->client==3) { - $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/comm/card.php?socid='.$object->id; $head[$h][1] = ''; if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && ($object->client==2 || $object->client==3)) $head[$h][1] .= $langs->trans("Prospect"); if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && $object->client==3) $head[$h][1] .= '/'; @@ -58,7 +58,7 @@ function societe_prepare_head($object) } if (! empty($conf->fournisseur->enabled) && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) { - $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/fourn/card.php?socid='.$object->id; $head[$h][1] = $langs->trans("Supplier"); $head[$h][2] = 'supplier'; $h++; @@ -67,7 +67,7 @@ function societe_prepare_head($object) if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) { $head[$h][0] = DOL_URL_ROOT.'/societe/societecontact.php?socid='.$object->id; - $head[$h][1] = $langs->trans("Contact"); + $head[$h][1] = $langs->trans("ContactsAddresses"); $head[$h][2] = 'contact'; $h++; } @@ -109,8 +109,29 @@ function societe_prepare_head($object) // Notifications if (! empty($conf->notification->enabled)) { - $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$object->id; + $nbNote = 0; + $sql = "SELECT COUNT(n.rowid) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n"; + $sql.= " WHERE fk_soc = ".$object->id; + $resql=$db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + $nbNote=$obj->nb; + $i++; + } + } + else { + dol_print_error($db); + } + + $head[$h][0] = DOL_URL_ROOT.'/societe/notify/card.php?socid='.$object->id; $head[$h][1] = $langs->trans("Notifications"); + if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; $head[$h][2] = 'notify'; $h++; } @@ -121,7 +142,7 @@ function societe_prepare_head($object) if(!empty($object->note_public)) $nbNote++; $head[$h][0] = DOL_URL_ROOT.'/societe/note.php?id='.$object->id; $head[$h][1] = $langs->trans("Note"); - if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')'; + if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; $head[$h][2] = 'note'; $h++; @@ -131,7 +152,7 @@ function societe_prepare_head($object) $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); $head[$h][0] = DOL_URL_ROOT.'/societe/document.php?socid='.$object->id; $head[$h][1] = $langs->trans("Documents"); - if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')'; + if($nbFiles > 0) $head[$h][1].= ' '.$nbFiles.''; $head[$h][2] = 'document'; $h++; } @@ -196,10 +217,9 @@ function societe_prepare_head2($object) /** * Return array head with list of tabs to view object informations. * - * @param Object $object Thirdparty * @return array head array with tabs */ -function societe_admin_prepare_head($object) +function societe_admin_prepare_head() { global $langs, $conf, $user; @@ -215,7 +235,7 @@ function societe_admin_prepare_head($object) // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab - complete_head_from_modules($conf,$langs,$object,$head,$h,'company_admin'); + complete_head_from_modules($conf,$langs,null,$head,$h,'company_admin'); $head[$h][0] = DOL_URL_ROOT.'/societe/admin/societe_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsThirdParties"); @@ -227,7 +247,7 @@ function societe_admin_prepare_head($object) $head[$h][2] = 'attributes_contacts'; $h++; - complete_head_from_modules($conf,$langs,$object,$head,$h,'company_admin','remove'); + complete_head_from_modules($conf,$langs,null,$head,$h,'company_admin','remove'); return $head; } @@ -440,8 +460,8 @@ function show_projects($conf,$langs,$db,$object,$backtopage='') $buttoncreate=''; if (! empty($conf->projet->enabled) && $user->rights->projet->creer) { - //$buttoncreate=''.$langs->trans("AddProject").''; - $buttoncreate=''.$langs->trans("AddProject"); + //$buttoncreate=''.$langs->trans("AddProject").''; + $buttoncreate=''.$langs->trans("AddProject"); if (empty($conf->dol_optimize_smallscreen)) $buttoncreate.=' '.img_picto($langs->trans("AddProject"),'filenew'); $buttoncreate.=''."\n"; } @@ -471,7 +491,7 @@ function show_projects($conf,$langs,$db,$object,$backtopage='') $projectstatic = new Project($db); $i=0; - $var=true; + $var=false; while ($i < $num) { $obj = $db->fetch_object($result); @@ -486,7 +506,7 @@ function show_projects($conf,$langs,$db,$object,$backtopage='') print ""; // Ref - print ''; + print ''; // Label print ''; // Date start @@ -500,8 +520,9 @@ function show_projects($conf,$langs,$db,$object,$backtopage='') } } else - { - print ''; + { + $var = false; + print ''; } $db->free($result); } @@ -540,6 +561,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $search_status = GETPOST("search_status",'int'); if ($search_status=='') $search_status=1; // always display activ customer first $search_name = GETPOST("search_name",'alpha'); + $search_addressphone = GETPOST("search_addressphone",'alpha'); if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="p.lastname"; @@ -557,7 +579,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') if ($user->rights->societe->contact->creer) { $addcontact = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); - $buttoncreate=''.$addcontact; + $buttoncreate=''.$addcontact; if (empty($conf->dol_optimize_smallscreen)) $buttoncreate.=' '.img_picto($addcontact,'filenew'); $buttoncreate.=''."\n"; } @@ -582,18 +604,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ''; print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Poste"),$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PhonePro"),$_SERVER["PHP_SELF"],"p.phone","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mobile","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Fax"),$_SERVER["PHP_SELF"],"p.fax","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email","",$param,'',$sortfield,$sortorder); - if (! empty($conf->skype->enabled)) - { - $colspan++; - print ''; - } + print_liste_field_titre($langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email"),$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'',$sortfield,$sortorder); - // Copy to clipboard - print ""; // Add to agenda if (! empty($conf->agenda->enabled) && ! empty($user->rights->agenda->myactions->create)) { @@ -606,32 +618,24 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ''; + // Name - Position print ''; - print ''; - print ''; + // Address / Phone + print ''; + // Email print ''; - print ''; - - print ''; - if (! empty($conf->skype->enabled)) - { - $colspan++; - print ''; - } - // Status print ''; - // Copy to clipboard - print ""; - // Add to agenda if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { @@ -647,7 +651,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ""; - $sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays as country_id, p.poste, p.phone, p.phone_mobile, p.fax, p.email, p.skype, p.statut "; + $sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays as country_id, p.poste, p.phone, p.phone_mobile, p.phone_perso, p.fax, p.email, p.skype, p.statut "; $sql .= ", p.civility as civility_id, p.address, p.zip, p.town"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " WHERE p.fk_soc = ".$object->id; @@ -676,76 +680,52 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $contactstatic->lastname = $obj->lastname; $contactstatic->firstname = $obj->firstname; $contactstatic->civility_id = $obj->civility_id; - print $contactstatic->getNomUrl(1); + print $contactstatic->getNomUrl(1,'',0,'&backtopage='.urlencode($backtopage)); + print ''; - print ''; - $country_code = getCountry($obj->country_id, 'all'); - // Lien click to dial + // Address and phone print ''; - print ''; - print ''; - print ''; + $outdone=0; + $contactstatic->address = $obj->address; + $contactstatic->zip = $obj->zip; + $contactstatic->town = $obj->town; + $contactstatic->country_id = $obj->country_id; + $coords = $contactstatic->getFullAddress(1,', '); + if (! empty($conf->use_javascript_ajax)) + { + $namecoords = $contactstatic->getFullName($langs,1).'
    '.$coords; + // hideonsmatphone because copyToClipboard call jquery dialog that does not work with jmobile + print ''; + print img_picto($langs->trans("Address"), 'object_address.png'); + print ' '; + } + if ($coords) { print dol_print_address($coords,'address_contact_'.$obj->rowid, 'contact', $obj->rowid); $outdone++; } + if ($obj->phone || $obj->phone_mobile || $obj->phone_perso) print ($outdone?'
    ':''); + if ($obj->phone) { print dol_print_phone($obj->phone,$country_code['code'],$obj->rowid,$object->id,'AC_TEL',' ','phone'); $outdone++; } + if ($obj->phone_mobile) { print dol_print_phone($obj->phone_mobile,$country_code['code'],$obj->rowid,$object->id,'AC_TEL',' ','phone'); $outdone++; } + if ($obj->phone_perso) { print dol_print_phone($obj->phone_perso,$country_code['code'],$obj->rowid,$object->id,'AC_TEL',' ','phone'); $outdone++; } + if ($obj->fax) { print dol_print_phone($obj->fax,$country_code['code'],$obj->rowid,$object->id,'AC_FAX',' ','fax'); $outdone++; } + print '
    '; + $outdone=0; + if ($obj->email) print dol_print_email($obj->email,$obj->rowid,$object->id,'AC_EMAIL',0,0,1); if (! empty($conf->skype->enabled)) { - print ''; + if ($obj->skype) print ($outdone?'
    ':'').dol_print_skype($obj->skype,$obj->rowid,$object->id,'AC_SKYPE'); } + print ''; // Status print ''; - print ''; - // Add to agenda if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { print ''; } @@ -754,7 +734,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') if ($user->rights->societe->contact->creer) { print ''; } @@ -766,7 +746,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') } else { - print ""; + print ""; print ''; print "\n"; } @@ -914,22 +894,12 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0) if (get_class($object) == 'Societe') $out.=''; $out.=''; $out.=''; $out.=''; $sql = "SELECT a.id, a.label,"; $sql.= " a.datep as dp,"; - $sql.= " a.datea as da,"; + $sql.= " a.datep2 as dp2,"; $sql.= " a.percent,"; $sql.= " a.fk_user_author, a.fk_contact,"; $sql.= " a.fk_element, a.elementtype,"; @@ -970,10 +940,20 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0) $obj = $db->fetch_object($result); $datep=$db->jdate($obj->dp); + $datep2=$db->jdate($obj->dp2); $out.=""; - $out.='\n"; + $out.='\n"; // Picto warning $out.=''; $out.=''; $out.=''; @@ -1217,8 +1188,14 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) // Champ date $out.='\n"; // Picto @@ -1238,7 +1215,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) } if (isset($histo[$key]['type']) && $histo[$key]['type']=='mailing') { - $out.=''.img_object($langs->trans("ShowEMailing"),"email").' '; + $out.=''.img_object($langs->trans("ShowEMailing"),"email").' '; $transcode=$langs->trans("Action".$histo[$key]['acode']); $libelle=($transcode!="Action".$histo[$key]['acode']?$transcode:'Send mass mailing'); $out.=dol_trunc($libelle,40); @@ -1251,6 +1228,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) // Objet lie // TODO uniformize $out.=''; print '
    '; @@ -206,7 +185,7 @@ function show_array_actions_to_do($max=5) include_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; $sql = "SELECT a.id, a.label, a.datep as dp, a.datep2 as dp2, a.fk_user_author, a.percent,"; - $sql.= " c.code, c.libelle,"; + $sql.= " c.code, c.libelle as type_label,"; $sql.= " s.nom as sname, s.rowid, s.client"; $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c LEFT JOIN "; $sql.= " ".MAIN_DB_PREFIX."actioncomm as a ON c.id = a.fk_action"; @@ -243,7 +222,7 @@ function show_array_actions_to_do($max=5) print '
    '.$staticaction->getNomUrl(1,34).'
    '.img_object($langs->trans("ShowProject"),($obj->public?'projectpub':'project'))." ".$obj->ref.''.img_object($langs->trans("ShowProject"),($obj->public?'projectpub':'project'))." ".$obj->ref.''.$obj->title.'
    '.$langs->trans("None").'
    '.$langs->trans("None").'
    '.$langs->trans("Skype").' 
    '; print ''; print '  '; + //print ''; + print '    '; - print $form->selectarray('search_status', array('-1'=>'','0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); + print $form->selectarray('search_status', array('-1'=>'','0'=>$contactstatic->LibStatut(0,1),'1'=>$contactstatic->LibStatut(1,1)),$search_status); print ' 
    '; + if ($obj->poste) print $obj->poste; print ''.$obj->poste.''; - print dol_print_phone($obj->phone,$country_code['code'],$obj->rowid,$object->id,'AC_TEL'); - print ''; - print dol_print_phone($obj->phone_mobile,$country_code['code'],$obj->rowid,$object->id,'AC_TEL'); - print ''; - print dol_print_phone($obj->fax,$country_code['code'],$obj->rowid,$object->id,'AC_FAX'); - print ''; - print dol_print_email($obj->email,$obj->rowid,$object->id,'AC_EMAIL'); - print ''; - print dol_print_skype($obj->skype,$obj->rowid,$object->id,'AC_SKYPE'); - print ''.$contactstatic->getLibStatut(5).''; - if (! empty($conf->use_javascript_ajax)) - { - // Copy to clipboard - $coords = ''; - if (!empty($object->name)) $coords .= $object->name."
    "; - $coords .= $contactstatic->getFullName($langs,1).' '; - $coords .= "
    "; - if (!empty($obj->address)) - { - $coords .= dol_nl2br($obj->address,1,true)."
    "; - if (!empty($obj->zip)) $coords .= $obj->zip.' '; - if (!empty($obj->town)) $coords .= $obj->town; - if (!empty($obj->country_id)) $coords .= "
    ".$country_code['label']; - } - else if (!empty($object->address)) - { - $coords .= dol_nl2br($object->address,1,true)."
    "; - if (!empty($object->zip)) $coords .= $object->zip.' '; - if (!empty($object->town)) $coords .= $object->town; - if (!empty($object->country_id)) $coords .= "
    ".$country_code['label']; - } - // hideonsmatphone because copyToClipboard call jquery dialog that does not work with jmobile - print ''; - print img_picto($langs->trans("Address"), 'object_address.png'); - print ''; - } - print '
    '; - if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) - { - print ''; - print img_object($langs->trans("Rendez-Vous"),"action_rdv"); - print ' '; - } - print ''; + print ''; print img_object($langs->trans("Event"),"action"); print ''; - print ''; + print ''; print img_edit(); print '
    '.$langs->trans("None").'
    '; - $permok=$user->rights->agenda->myactions->create; - if (($object->id || $objcon->id) && $permok) - { - $out.=''; - $out.=$langs->trans("AddAnAction").' '; - $out.=img_picto($langs->trans("AddAnAction"),'filenew'); - $out.=""; - } $out.='
    '.dol_print_date($datep,'dayhour')."'; + $out.=dol_print_date($datep,'dayhour'); + if ($datep2 && $datep2 != $datep) + { + $tmpa=dol_getdate($datep,true); + $tmpb=dol_getdate($datep2,true); + if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $out.='-'.dol_print_date($datep2,'hour'); + else $out.='-'.dol_print_date($datep2,'dayhour'); + } + $out.="'; @@ -1103,7 +1083,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) 'type'=>'action', 'id'=>$obj->id, 'datestart'=>$db->jdate($obj->dp), - 'date'=>$db->jdate($obj->dp2), + 'dateend'=>$db->jdate($obj->dp2), 'note'=>$obj->label, 'percent'=>$obj->percent, 'acode'=>$obj->acode, @@ -1154,7 +1134,8 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) $histo[$numaction]=array( 'type'=>'mailing', 'id'=>$obj->id, - 'date'=>$db->jdate($obj->da), + 'datestart'=>$db->jdate($obj->da), + 'dateend'=>$db->jdate($obj->da), 'note'=>$obj->note, 'percent'=>$obj->percentage, 'acode'=>$obj->acode, @@ -1197,16 +1178,6 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) if (get_class($object) == 'Societe') $out.=''; $out.=''; - $permok=$user->rights->agenda->myactions->create; - if ((! empty($object->id) || ! empty($objcon->id)) && $permok) - { - $out.=''; - $out.=$langs->trans("AddAnAction").' '; - $out.=img_picto($langs->trans("AddAnAction"),'filenew'); - $out.=""; - } $out.='
    '; - if ($histo[$key]['date']) $out.=dol_print_date($histo[$key]['date'],'dayhour'); - else if ($histo[$key]['datestart']) $out.=dol_print_date($histo[$key]['datestart'],'dayhour'); + $out.=dol_print_date($histo[$key]['datestart'],'dayhour'); + if ($histo[$key]['dateend'] && $histo[$key]['dateend'] != $histo[$key]['datestart']) + { + $tmpa=dol_getdate($histo[$key]['datestart'],true); + $tmpb=dol_getdate($histo[$key]['dateend'],true); + if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $out.='-'.dol_print_date($histo[$key]['dateend'],'hour'); + else $out.='-'.dol_print_date($histo[$key]['dateend'],'dayhour'); + } $out.="'; + //var_dump($histo[$key]['elementtype']); if (isset($histo[$key]['elementtype'])) { if ($histo[$key]['elementtype'] == 'propal' && ! empty($conf->propal->enabled)) @@ -1259,13 +1237,13 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) $propalstatic->id=$histo[$key]['fk_element']; $out.=$propalstatic->getNomUrl(1); } - elseif ($histo[$key]['elementtype'] == 'commande' && ! empty($conf->commande->enabled)) + elseif (($histo[$key]['elementtype'] == 'order' || $histo[$key]['elementtype'] == 'commande') && ! empty($conf->commande->enabled)) { $orderstatic->ref=$langs->trans("Order"); $orderstatic->id=$histo[$key]['fk_element']; $out.=$orderstatic->getNomUrl(1); } - elseif ($histo[$key]['elementtype'] == 'facture' && ! empty($conf->facture->enabled)) + elseif (($histo[$key]['elementtype'] == 'invoice' || $histo[$key]['elementtype'] == 'facture') && ! empty($conf->facture->enabled)) { $facturestatic->ref=$langs->trans("Invoice"); $facturestatic->id=$histo[$key]['fk_element']; diff --git a/htdocs/core/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php index 2518f7b7883..8d9ba9296a4 100644 --- a/htdocs/core/lib/contact.lib.php +++ b/htdocs/core/lib/contact.lib.php @@ -35,7 +35,7 @@ function contact_prepare_head($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/contact/fiche.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/contact/card.php?id='.$object->id; $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/core/lib/contract.lib.php b/htdocs/core/lib/contract.lib.php index e51f7594ac9..b7e82c6dbf2 100644 --- a/htdocs/core/lib/contract.lib.php +++ b/htdocs/core/lib/contract.lib.php @@ -34,7 +34,7 @@ function contract_prepare_head($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/contrat/fiche.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/contrat/card.php?id='.$object->id; $head[$h][1] = $langs->trans("ContractCard"); $head[$h][2] = 'card'; $h++; @@ -60,7 +60,7 @@ function contract_prepare_head($object) if(!empty($object->note_public)) $nbNote++; $head[$h][0] = DOL_URL_ROOT.'/contrat/note.php?id='.$object->id; $head[$h][1] = $langs->trans("Notes"); - if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')'; + if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; $head[$h][2] = 'note'; $h++; } @@ -70,7 +70,7 @@ function contract_prepare_head($object) $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); $head[$h][0] = DOL_URL_ROOT.'/contrat/document.php?id='.$object->id; $head[$h][1] = $langs->trans("Documents"); - if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')'; + if($nbFiles > 0) $head[$h][1].= ' '.$nbFiles.''; $head[$h][2] = 'documents'; $h++; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index eaf6b9e83dd..d2c6ce4bd4f 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -169,7 +169,7 @@ function convertTime2Seconds($iHours=0,$iMinutes=0,$iSeconds=0) * @param string $format Output format (all: total delay days hour:min like "2 days 12:30"", allhourmin: total delay hours:min like "60:30", allhour: total delay hours without min/sec like "60:30", fullhour: total delay hour decimal like "60.5" for 60:30, hour: only hours part "12", min: only minutes part "30", sec: only seconds part, month: only month part, year: only year part); * @param int $lengthOfDay Length of day (default 86400 seconds for 1 day, 28800 for 8 hour) * @param int $lengthOfWeek Length of week (default 7) - * @return sTime Formated text of duration + * @return string Formated text of duration * Example: 0 return 00:00, 3600 return 1:00, 86400 return 1d, 90000 return 1 Day 01:00 */ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7) @@ -443,10 +443,11 @@ function dol_get_next_week($day, $week, $month, $year) * @param mixed $gm False or 0 or 'server' = Return date to compare with server TZ, True or 1 to compare with GM date. * Exemple: dol_get_first_day(1970,1,false) will return -3600 with TZ+1, after a dol_print_date will return 1970-01-01 00:00:00 * Exemple: dol_get_first_day(1970,1,true) will return 0 whatever is TZ, after a dol_print_date will return 1970-01-01 00:00:00 - * @return int Date for first day + * @return int Date for first day, '' if error */ function dol_get_first_day($year,$month=1,$gm=false) { + if ($year > 9999) return ''; return dol_mktime(0,0,0,$month,1,$year,$gm); } @@ -456,10 +457,11 @@ function dol_get_first_day($year,$month=1,$gm=false) * @param int $year Year * @param int $month Month * @param boolean $gm False or 0 or 'server' = Return date to compare with server TZ, True or 1 to compare with GM date. - * @return int Date for first day + * @return int Date for first day, '' if error */ function dol_get_last_day($year,$month=12,$gm=false) { + if ($year > 9999) return ''; if ($month == 12) { $month = 1; @@ -564,9 +566,10 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR') $nbFerie = 0; // Check to ensure we use correct parameters - if ((($timestampEnd - $timestampStart) % 86400) != 0) return 'ErrorDates must use same hour and be GMT dates'; + if ((($timestampEnd - $timestampStart) % 86400) != 0) return 'ErrorDates must use same hours and must be GMT dates'; - while ($timestampStart < $timestampEnd) // Loop end when equals + $i=0; + while ($timestampStart < $timestampEnd && ($i < 50000)) // Loop end when equals (Test on i is a security loop to avoid infinite loop) { $ferie=false; $countryfound=0; @@ -574,7 +577,6 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR') $jour = date("d", $timestampStart); $mois = date("m", $timestampStart); $annee = date("Y", $timestampStart); - if ($countrycode == 'FR') { $countryfound=1; @@ -720,8 +722,10 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR') if ($ferie) $nbFerie++; // Increase number of days (on go up into loop) - $jour++; - $timestampStart=dol_mktime(0,0,0,$mois,$jour,$annee,1); // Generate GMT date for next day + $timestampStart=dol_time_plus_duree($timestampStart, 1, 'd'); + //var_dump($jour.' '.$mois.' '.$annee.' '.$timestampStart); + + $i++; } return $nbFerie; @@ -762,13 +766,16 @@ function num_between_day($timestampStart, $timestampEnd, $lastday=0) * @param int $inhour 0: return number of days, 1: return number of hours * @param int $lastday We include last day, 0: no, 1:yes * @param int $halfday Tag to define half day when holiday start and end + * @param string $country_code Country code (company country code if not defined) * @return int Number of days or hours */ -function num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $halfday=0) +function num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $halfday=0, $country_code='') { - global $langs; + global $langs,$mysoc; - dol_syslog('num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday); + if (empty($country_code)) $country_code=$mysoc->country_code; + + dol_syslog('num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday.' country_code='.$country_code); // Check parameters if (! is_int($timestampStart) && ! is_float($timestampStart)) return 'ErrorBadParameter_num_open_day'; @@ -777,7 +784,9 @@ function num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $ha //print 'num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday; if ($timestampStart < $timestampEnd) { - $nbOpenDay = num_between_day($timestampStart, $timestampEnd, $lastday) - num_public_holiday($timestampStart, $timestampEnd, $lastday); + $numdays = num_between_day($timestampStart, $timestampEnd, $lastday); + $numholidays = num_public_holiday($timestampStart, $timestampEnd, $country_code); + $nbOpenDay = $numdays - $numholidays; $nbOpenDay.= " " . $langs->trans("Days"); if ($inhour == 1 && $nbOpenDay <= 3) $nbOpenDay = $nbOpenDay*24 . $langs->trans("HourShort"); return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday)); diff --git a/htdocs/core/lib/ecm.lib.php b/htdocs/core/lib/ecm.lib.php index 2f12976e49f..34294f502e8 100644 --- a/htdocs/core/lib/ecm.lib.php +++ b/htdocs/core/lib/ecm.lib.php @@ -31,19 +31,23 @@ */ function ecm_prepare_dasboard_head($object) { - global $langs, $conf, $user; + global $langs, $conf, $user, $form; + global $helptext1, $helptext2; + $h = 0; $head = array(); + $helptext =$langs->trans("ECMAreaDesc").'
    '; + $helptext.=$langs->trans("ECMAreaDesc2"); $head[$h][0] = DOL_URL_ROOT.'/ecm/index.php'; - $head[$h][1] = $langs->trans("ECMSectionsManual").img_help(1,$helptext1); + $head[$h][1] = $langs->trans("ECMSectionsManual").$form->textwithpicto('', $helptext, 1, 'info', '', 0, 3); $head[$h][2] = 'index'; $h++; if (! empty($conf->global->ECM_AUTO_TREE_ENABLED)) { $head[$h][0] = DOL_URL_ROOT.'/ecm/index_auto.php'; - $head[$h][1] = $langs->trans("ECMSectionsAuto").img_help(1,$helptext2); + $head[$h][1] = $langs->trans("ECMSectionsAuto").$form->textwithpicto('', $helptext, 1, 'info', '', 0, 3); $head[$h][2] = 'index_auto'; $h++; } diff --git a/htdocs/core/lib/emailing.lib.php b/htdocs/core/lib/emailing.lib.php index 613b12dadad..239f36721ee 100644 --- a/htdocs/core/lib/emailing.lib.php +++ b/htdocs/core/lib/emailing.lib.php @@ -34,7 +34,7 @@ function emailing_prepare_head($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT."/comm/mailing/fiche.php?id=".$object->id; + $head[$h][0] = DOL_URL_ROOT."/comm/mailing/card.php?id=".$object->id; $head[$h][1] = $langs->trans("MailCard"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/core/lib/fichinter.lib.php b/htdocs/core/lib/fichinter.lib.php index b8d2e87fdff..89f685590b3 100644 --- a/htdocs/core/lib/fichinter.lib.php +++ b/htdocs/core/lib/fichinter.lib.php @@ -38,7 +38,7 @@ function fichinter_prepare_head($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/fichinter/fiche.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/fichinter/card.php?id='.$object->id; $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'card'; $h++; @@ -72,7 +72,7 @@ function fichinter_prepare_head($object) if(!empty($object->note_public)) $nbNote++; $head[$h][0] = DOL_URL_ROOT.'/fichinter/note.php?id='.$object->id; $head[$h][1] = $langs->trans('Notes'); - if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')'; + if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; $head[$h][2] = 'note'; $h++; } @@ -82,7 +82,7 @@ function fichinter_prepare_head($object) $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); $head[$h][0] = DOL_URL_ROOT.'/fichinter/document.php?id='.$object->id; $head[$h][1] = $langs->trans("Documents"); - if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')'; + if($nbFiles > 0) $head[$h][1].= ' '.$nbFiles.''; $head[$h][2] = 'documents'; $h++; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 8590f63803f..4b9e7eb520f 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -43,7 +43,7 @@ function dol_basename($pathfile) * @param string $types Can be "directories", "files", or "all" * @param int $recursive Determines whether subdirectories are searched * @param string $filter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function - * @param string[] $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview\.png)$','^\.')) + * @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview\.png)$','^\.')) * @param string $sortcriteria Sort criteria ("","fullname","name","date","size") * @param string $sortorder Sort order (SORT_ASC, SORT_DESC) * @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only @@ -139,6 +139,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil $level1name=(isset($reg[1])?$reg[1]:''); $file_list[] = array( "name" => $file, + "path" => $path, "level1name" => $level1name, "fullname" => $path.'/'.$file, "date" => $filedate, @@ -166,6 +167,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil $level1name=(isset($reg[1])?$reg[1]:''); $file_list[] = array( "name" => $file, + "path" => $path, "level1name" => $level1name, "fullname" => $path.'/'.$file, "date" => $filedate, @@ -954,7 +956,7 @@ function dol_meta_create($object) if (is_dir($dir)) { $nblignes = count($object->lines); - $client = $object->client->nom . " " . $object->client->address . " " . $object->client->zip . " " . $object->client->town; + $client = $object->client->name . " " . $object->client->address . " " . $object->client->zip . " " . $object->client->town; $meta = "REFERENCE=\"" . $object->ref . "\" DATE=\"" . dol_print_date($object->date,'') . "\" NB_ITEMS=\"" . $nblignes . "\" @@ -1294,7 +1296,7 @@ function dol_uncompress($inputfile,$outputdir) * * @param string $dir Directory to scan * @param string $regexfilter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function - * @param string[] $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview\.png)$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function + * @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview\.png)$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function * @param int $nohook Disable all hooks * @return string Full path to most recent file */ @@ -1636,14 +1638,14 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu else $original_file=$conf->facture->dir_output.'/payments/'.$original_file; } - // Wrapping pour les exports de compta + // Wrapping for accounting exports else if ($modulepart == 'export_compta') { - if ($fuser->rights->compta->ventilation->creer || preg_match('/^specimen/i',$original_file)) + if ($fuser->rights->accounting->ventilation->dispatch || preg_match('/^specimen/i',$original_file)) { $accessallowed=1; } - $original_file=$conf->compta->dir_output.'/'.$original_file; + $original_file=$conf->accounting->dir_output.'/'.$original_file; } // Wrapping pour les expedition diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 58d553e36d5..e4e7b04b057 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -37,7 +37,7 @@ function facturefourn_prepare_head($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$object->id; $head[$h][1] = $langs->trans('CardBill'); $head[$h][2] = 'card'; $h++; @@ -63,7 +63,7 @@ function facturefourn_prepare_head($object) if(!empty($object->note_public)) $nbNote++; $head[$h][0] = DOL_URL_ROOT.'/fourn/facture/note.php?facid='.$object->id; $head[$h][1] = $langs->trans('Notes'); - if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')'; + if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; $head[$h][2] = 'note'; $h++; } @@ -73,7 +73,7 @@ function facturefourn_prepare_head($object) $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); $head[$h][0] = DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$object->id; $head[$h][1] = $langs->trans('Documents'); - if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')'; + if($nbFiles > 0) $head[$h][1].= ' '.$nbFiles.''; $head[$h][2] = 'documents'; $h++; @@ -100,7 +100,7 @@ function ordersupplier_prepare_head($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/fiche.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/card.php?id='.$object->id; $head[$h][1] = $langs->trans("OrderCard"); $head[$h][2] = 'card'; $h++; @@ -135,7 +135,7 @@ function ordersupplier_prepare_head($object) if(!empty($object->note_public)) $nbNote++; $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/note.php?id='.$object->id; $head[$h][1] = $langs->trans("Notes"); - if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')'; + if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; $head[$h][2] = 'note'; $h++; } @@ -145,7 +145,7 @@ function ordersupplier_prepare_head($object) $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); - if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')'; + if($nbFiles > 0) $head[$h][1].= ' '.$nbFiles.''; $head[$h][2] = 'documents'; $h++; @@ -160,10 +160,9 @@ function ordersupplier_prepare_head($object) /** * Return array head with list of tabs to view object informations. * - * @param Object $object order * @return array head array with tabs */ -function supplierorder_admin_prepare_head($object) +function supplierorder_admin_prepare_head() { global $langs, $conf, $user; @@ -180,7 +179,7 @@ function supplierorder_admin_prepare_head($object) $head[$h][2] = 'invoice'; $h++; - complete_head_from_modules($conf,$langs,$object,$head,$h,'supplierorder_admin'); + complete_head_from_modules($conf,$langs,null,$head,$h,'supplierorder_admin'); $head[$h][0] = DOL_URL_ROOT.'/admin/supplierorder_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsSupplierOrders"); @@ -192,7 +191,7 @@ function supplierorder_admin_prepare_head($object) $head[$h][2] = 'supplierinvoice'; $h++; - complete_head_from_modules($conf,$langs,$object,$head,$h,'supplierorder_admin','remove'); + complete_head_from_modules($conf,$langs,null,$head,$h,'supplierorder_admin','remove'); return $head; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2acf4071052..bd195e27eab 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10,7 +10,7 @@ * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2013 Alexandre Spangaro - * Copyright (C) 2014 Marcos García + * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Cédric GROSS * * This program is free software; you can redistribute it and/or modify @@ -44,14 +44,31 @@ include_once DOL_DOCUMENT_ROOT .'/core/lib/json.lib.php'; * @param string $class Class name * @param string $member Name of property * @return mixed Return value of static property - * @deprecated PHP 5.3 is now the minimum requirement, this is no longer necessary */ function getStaticMember($class, $member) { - if (isset($class::$member)) { - return $class::$member; - } + // This part is deprecated. Uncomment if for php 5.2.*, and comment next isset class::member + /*if (version_compare(phpversion(), '5.3.0', '<')) + { + if (is_object($class)) $class = get_class($class); + $classObj = new ReflectionClass($class); + $result = null; + $found=0; + foreach($classObj->getStaticProperties() as $prop => $value) + { + if ($prop == $member) + { + $result = $value; + $found++; + break; + } + } + + if ($found) return $result; + }*/ + + if (isset($class::$member)) return $class::$member; dol_print_error('','Try to get a static member "'.$member.'" in class "'.$class.'" that does not exists or is not static.'); return null; } @@ -148,6 +165,7 @@ function getBrowserInfo() $detectmobile=new MobileDetect(); $phone=$detectmobile->isMobile(); $tablet=$detectmobile->isTablet(); + unset($detectmobile); // free memory return array('browsername'=>$name, 'browserversion'=>$version, 'browseros'=>$os, 'browserfirefox'=>$firefox, 'layout'=> ($tablet?'tablet':($phone?'phone':'classic')), 'phone'=>$phone, 'tablet'=>$tablet); } @@ -170,11 +188,11 @@ function dol_shutdown() * Return value of a param into GET or POST supervariable * * @param string $paramname Name of parameter to found - * @param string $check Type of check (''=no check, 'int'=check it's numeric, 'alpha'=check it's text and sign, 'aZ'=check it's a-z only, 'array'=check it's array, 'san_alpha'= Use filter_var with FILTER_SANITIZE_STRING, 'custom'= custom filter specify $filter and $options) + * @param string $check Type of check (''=no check, 'int'=check it's numeric, 'alpha'=check it's text and sign, 'aZ'=check it's a-z only, 'array'=check it's array, 'san_alpha'= Use filter_var with FILTER_SANITIZE_STRING (do not use this for free text string), 'custom'= custom filter specify $filter and $options) * @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get, 4 = post then get then cookie) * @param int $filter Filter to apply when $check is set to custom. (See http://php.net/manual/en/filter.filters.php for détails) * @param mixed $options Options to pass to filter_var when $check is set to custom - * @return string||string[] Value found, or '' if check fails + * @return string||string[] Value found (string or array), or '' if check fails */ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL) { @@ -453,6 +471,18 @@ function dol_string_nospecial($str,$newstr='_',$badchars='') return str_replace($forbidden_chars_to_replace,$newstr,str_replace($forbidden_chars_to_remove,"",$str)); } + +/** + * Encode string for xml usage + * + * @param string $string String to encode + * @return string String encoded + */ +function dolEscapeXML($string) +{ + return strtr($string, array('\''=>''','"'=>'"','&'=>'&','<'=>'<','>'=>'>')); +} + /** * Returns text escaped for inclusion into javascript code * @@ -629,7 +659,7 @@ function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto */ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0) { - global $conf; + global $conf,$langs; $out="\n".'
    '."\n"; @@ -654,35 +684,82 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p } // Show tabs + $bactive=false; + // if =0 we don't use the feature + $limittoshow=($conf->global->MAXTABS_IN_CARD?$conf->global->MAXTABS_IN_CARD:99); + $displaytab=0; + for ($i = 0 ; $i <= $maxkey ; $i++) { - $isactive=(is_numeric($active) && $i == $active) || (! is_numeric($active) && $active == $links[$i][2]); - $out.='
    '; - if (isset($links[$i][2]) && $links[$i][2] == 'image') + if ((is_numeric($active) && $i == $active) || (! is_numeric($active) && $active == $links[$i][2])) { - if (!empty($links[$i][0])) - { - $out.=''.$links[$i][1].''."\n"; - } - else - { - $out.=''.$links[$i][1].''."\n"; - } + $isactive=true; + $bactive=true; + if ($i <=$limittoshow) + $limittoshow++; } - else if (! empty($links[$i][1])) + else + $isactive=false; + + if ($i <=$limittoshow || $isactive ) { - //print "x $i $active ".$links[$i][2]." z"; - if ($isactive) + $out.='
    '; + if (isset($links[$i][2]) && $links[$i][2] == 'image') { - $out.=''.$links[$i][1].''."\n"; + if (!empty($links[$i][0])) + { + $out.=''.$links[$i][1].''."\n"; + } + else + { + $out.=''.$links[$i][1].''."\n"; + } } - else + else if (! empty($links[$i][1])) { - $out.=''.$links[$i][1].''."\n"; + //print "x $i $active ".$links[$i][2]." z"; + if ($isactive) + { + $out.=''.$links[$i][1].''."\n"; + } + else + { + $out.=''.$links[$i][1].''."\n"; + } } + $out.='
    '; } - $out.='
    '; + else + { + $outmore.='
    '; + if (isset($links[$i][2]) && $links[$i][2] == 'image') + { + if (!empty($links[$i][0])) + $outmore.=''.$links[$i][1].''."\n"; + else + $outmore.=''.$links[$i][1].''."\n"; + + } + else if (! empty($links[$i][1])) + $outmore.=''.$links[$i][1].''."\n"; + + $outmore.='
    '; + } + $displaytab=$i; + } + + if ($displaytab > $limittoshow) + { + $out.='
    '; + $out.=''.$langs->trans("More").'...'; + $out.='
    '.$outmore.'
    '; + $out.="
    \n"; + + $out.=""; } $out.="
    \n"; @@ -736,11 +813,12 @@ function dol_bc($var,$moreclass='') * @param Object $object A company or contact object * @param int $withcountry 1=Add country into address string * @param string $sep Separator to use to build string + * @param Tranlsate $outputlangs Object lang that contains language for text translation. * @return string Formated string */ -function dol_format_address($object,$withcountry=0,$sep="\n") +function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='') { - global $conf; + global $conf,$langs; $ret=''; $countriesusingstate=array('AU','US','IN','GB','ES','UK','TR'); @@ -769,7 +847,7 @@ function dol_format_address($object,$withcountry=0,$sep="\n") else if (in_array($object->country_code,array('ES','TR'))) // ES: title firstname name \n address lines \n zip town \n state \n country { $ret .= ($ret ? $sep : '' ).$object->zip; - $ret .= ' '.$object->town; + $ret .= ($object->town?' '.$object->town:''); if ($object->state && in_array($object->country_code,$countriesusingstate)) { $ret.="\n".$object->state; @@ -779,14 +857,14 @@ function dol_format_address($object,$withcountry=0,$sep="\n") else // Other: title firstname name \n address lines \n zip town \n country { $ret .= ($ret ? $sep : '' ).$object->zip; - $ret .= ' '.$object->town; + $ret .= ($object->town?' '.$object->town:''); if ($object->state && in_array($object->country_code,$countriesusingstate)) { $ret.=", ".$object->state; } } - - if ($withcountry) $ret.=($object->country?$sep.$object->country:''); + if (! is_object($outputlangs)) $outputlangs=$langs; + if ($withcountry) $ret.=($object->country_code?($ret?$sep:'').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)):''); return $ret; } @@ -997,6 +1075,8 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e */ function dol_getdate($timestamp,$fast=false) { + global $conf; + $usealternatemethod=false; if ($timestamp <= 0) $usealternatemethod=true; // <= 1970 if ($timestamp >= 2145913200) $usealternatemethod=true; // >= 2038 @@ -1008,6 +1088,19 @@ function dol_getdate($timestamp,$fast=false) else { $arrayinfo=getdate($timestamp); + + $startday=isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1; + if($startday==1) + { + if ($arrayinfo["wday"]==0) + { + $arrayinfo["wday"]=6; + } + else + { + $arrayinfo["wday"]=$arrayinfo["wday"]-1; + } + } } return $arrayinfo; @@ -1026,7 +1119,7 @@ function dol_getdate($timestamp,$fast=false) * @param int $year Year * @param mixed $gm True or 1 or 'gmt'=Input informations are GMT values, False or 0 or 'server' = local to server TZ, 'user' = local to user TZ * @param int $check 0=No check on parameters (Can use day 32, etc...) - * @return int Date as a timestamp, '' if error + * @return timestamp|string Date as a timestamp, '' if error * @see dol_print_date, dol_stringtotime, dol_getdate */ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1) @@ -1070,11 +1163,16 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1) $default_timezone=@date_default_timezone_get(); } } - else $localtz = new DateTimeZone('UTC'); + + if (empty($localtz)) { + $localtz = new DateTimeZone('UTC'); + } + $dt = new DateTime(null,$localtz); $dt->setDate($year,$month,$day); $dt->setTime((int) $hour, (int) $minute, (int) $second); $date=$dt->getTimestamp(); // should include daylight saving time + return $date; } else { @@ -1092,8 +1190,8 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1) { $date=mktime($hour,$minute,$second,$month,$day,$year); }*/ + return ''; } - return $date; } @@ -1200,9 +1298,10 @@ function dol_print_url($url,$target='_blank',$max=32) * @param int $addlink 0=no link, 1=email has a html email link (+ link to create action if constant AGENDA_ADDACTIONFOREMAIL is on) * @param int $max Max number of characters to show * @param int $showinvalid Show warning if syntax email is wrong + * @param int $withpicto Show picto * @return string HTML Link */ -function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid=1) +function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid=1,$withpicto=0) { global $conf,$user,$langs; @@ -1227,8 +1326,8 @@ function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid= if (($cid || $socid) && ! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { $type='AC_EMAIL'; $link=''; - if (! empty($conf->global->AGENDA_ADDACTIONFOREMAIL)) $link=''.img_object($langs->trans("AddAction"),"calendar").''; - $newemail='
    '.$newemail.'  '.$link.'
    '; + if (! empty($conf->global->AGENDA_ADDACTIONFOREMAIL)) $link=''.img_object($langs->trans("AddAction"),"calendar").''; + if ($link) $newemail='
    '.$newemail.' '.$link.'
    '; } } else @@ -1239,18 +1338,18 @@ function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid= $newemail.=img_warning($langs->trans("ErrorBadEMail",$email)); } } - return $newemail; + return '
    '.($withpicto?img_picto($langs->trans("EMail"), 'object_email.png').' ':'').$newemail.'
    '; } /** * Show Skype link * * @param string $skype Skype to show (only skype, without 'Name of recipient' before) - * @param int $cid Id of contact if known - * @param int $socid Id of third party if known - * @param int $addlink 0=no link to create action - * @param int $max Max number of characters to show - * @return string HTML Link + * @param int $cid Id of contact if known + * @param int $socid Id of third party if known + * @param int $addlink 0=no link to create action + * @param int $max Max number of characters to show + * @return string HTML Link */ function dol_print_skype($skype,$cid=0,$socid=0,$addlink=0,$max=64) { @@ -1265,18 +1364,18 @@ function dol_print_skype($skype,$cid=0,$socid=0,$addlink=0,$max=64) $newskype=''; - $newskype.=' '; - $newskype.=' '; + $newskype.='    '; - $newskype.=' '; + $newskype.=''; $newskype.=''; if (($cid || $socid) && ! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { $type='AC_SKYPE'; $link=''; - if (! empty($conf->global->AGENDA_ADDACTIONFORSKYPE)) $link=''.img_object($langs->trans("AddAction"),"calendar").''; - $newskype='
    '.$newskype.'  '.$link.'
    '; + if (! empty($conf->global->AGENDA_ADDACTIONFORSKYPE)) $link=''.img_object($langs->trans("AddAction"),"calendar").''; + $newskype='
    '.$newskype.($link?' '.$link:'').'
    '; } } else @@ -1296,9 +1395,10 @@ function dol_print_skype($skype,$cid=0,$socid=0,$addlink=0,$max=64) * @param int $socid Id of third party if known * @param int $addlink ''=no link to create action, 'AC_TEL'=add link to clicktodial (if module enabled) and add link to create event (if conf->global->AGENDA_ADDACTIONFORPHONE set) * @param string $separ Separation between numbers for a better visibility example : xx.xx.xx.xx.xx + * @param string $withpicto Show picto * @return string Formated phone number */ -function dol_print_phone($phone,$country='',$cid=0,$socid=0,$addlink='',$separ=" ") +function dol_print_phone($phone,$country='',$cid=0,$socid=0,$addlink='',$separ=" ",$withpicto='') { global $conf,$user,$langs,$mysoc; @@ -1373,12 +1473,12 @@ function dol_print_phone($phone,$country='',$cid=0,$socid=0,$addlink='',$separ=" { $type='AC_TEL'; $link=''; if ($addlink == 'AC_FAX') $type='AC_FAX'; - if (! empty($conf->global->AGENDA_ADDACTIONFORPHONE)) $link=''.img_object($langs->trans("AddAction"),"calendar").''; - if ($link) $newphone='
    '.$newphone.'  '.$link.'
    '; + if (! empty($conf->global->AGENDA_ADDACTIONFORPHONE)) $link=''.img_object($langs->trans("AddAction"),"calendar").''; + if ($link) $newphone='
    '.$newphone.' '.$link.'
    '; } } - return $newphone; + return '
    '.($withpicto?img_picto(($withpicto=='fax'?$langs->trans("Fax"):$langs->trans("Phone")), 'object_'.($withpicto=='fax'?'phoning_fax':'phoning').'.png').' ':'').$newphone.'
    '; } /** @@ -1731,14 +1831,18 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie', * @param string $trunc Where to trunc: right, left, middle (size must be a 2 power), wrap * @param string $stringencoding Tell what is source string encoding * @param int $nodot Truncation do not add ... after truncation. So it's an exact truncation. + * @param int $display Trunc is use to display and can be changed for small screen * @return string Truncated string */ -function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodot=0) +function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodot=0, $display=0) { global $conf; - if ($size==0 || ! empty($conf->global->MAIN_DISABLE_TRUNC)) return $string; + if (empty($stringencoding)) $stringencoding='UTF-8'; + if ($size==0 || ! empty($conf->global->MAIN_DISABLE_TRUNC)) return $string; + // reduce for small screen + if ($conf->dol_optimize_smallscreen==1 && $display==1) $size = round($size/3); // We go always here if ($trunc == 'right') { @@ -1808,13 +1912,15 @@ function img_picto($titlealt, $picto, $options = '', $pictoisfullpath = false, $ } else { - // By default, we search $url/theme/$theme/img/$picto + // We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto $url = DOL_URL_ROOT; $theme = $conf->theme; $path = 'theme/'.$theme; - if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) $path = $conf->global->MAIN_OVERWRITE_THEME_RES.'/theme/'.$conf->global->MAIN_OVERWRITE_THEME_RES; - //if (! empty($conf->global->MAIN_FORCETHEMEDIR)) $path = preg_replace('/^\//', '', $conf->global->MAIN_FORCETHEMEDIR).'/'.$path; // TODO What if there is both FORCETHEMDIR and OVERWRITE_THEM_RES + if (! empty($conf->global->MAIN_OVERWRITE_THEME_PATH)) $path = $conf->global->MAIN_OVERWRITE_THEME_PATH.'/theme/'.$theme; // If the theme does not have the same name as the module + else if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) $path = $conf->global->MAIN_OVERWRITE_THEME_RES.'/theme/'.$conf->global->MAIN_OVERWRITE_THEME_RES; // To allow an external module to overwrite image resources whatever is activated theme + else if (! empty($conf->modules_parts['theme']) && array_key_exists($theme, $conf->modules_parts['theme'])) $path = $theme.'/theme/'.$theme; // If the theme have the same name as the module + // If we ask an image into $url/$mymodule/img (instead of default path) if (preg_match('/^([^@]+)@([^@]+)$/i',$picto,$regs)) { @@ -1824,10 +1930,10 @@ function img_picto($titlealt, $picto, $options = '', $pictoisfullpath = false, $ // Clean parameters if (! preg_match('/(\.png|\.gif)$/i',$picto)) $picto .= '.png'; // If alt path are defined, define url where img file is, according to physical path - foreach ($conf->file->dol_document_root as $type => $dirroot) // ex: array(["main"]=>"/home/maindir/htdocs", ["alt0"]=>"/home/moddir/htdocs", ...) + foreach ($conf->file->dol_document_root as $type => $dirroot) // ex: array(["main"]=>"/home/maindir/htdocs", ["alt0"]=>"/home/moddir0/htdocs", ...) { if ($type == 'main') continue; - if (file_exists($dirroot.'/'.$path.'/img/'.$picto)) + if (file_exists($dirroot.'/'.$path.'/img/'.$picto)) // This need a lot of time, that's why enabling alternative dir like "custom" dir is not recommanded { $url=DOL_URL_ROOT.$conf->file->dol_url_root[$type]; break; @@ -1940,29 +2046,31 @@ function img_pdf($titlealt = 'default', $size = 3) * Show logo + * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. + * @param string $other Add more attributes on img * @return string Return tag img */ -function img_edit_add($titlealt = 'default') +function img_edit_add($titlealt = 'default', $other = '') { global $conf, $langs; if ($titlealt == 'default') $titlealt = $langs->trans('Add'); - return img_picto($titlealt, 'edit_add.png'); + return img_picto($titlealt, 'edit_add.png', $other); } /** * Show logo - * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. + * @param string $other Add more attributes on img * @return string Return tag img */ -function img_edit_remove($titlealt = 'default') +function img_edit_remove($titlealt = 'default', $other='') { global $conf, $langs; if ($titlealt == 'default') $titlealt = $langs->trans('Remove'); - return img_picto($titlealt, 'edit_remove.png'); + return img_picto($titlealt, 'edit_remove.png', $other); } /** @@ -2265,9 +2373,9 @@ function img_search($titlealt = 'default', $other = '') global $conf, $langs; if ($titlealt == 'default') $titlealt = $langs->trans('Search'); - + $img = img_picto($titlealt, 'search.png', $other, false, 1); - + $input = ''; @@ -2286,9 +2394,9 @@ function img_searchclear($titlealt = 'default', $other = '') global $conf, $langs; if ($titlealt == 'default') $titlealt = $langs->trans('Search'); - + $img = img_picto($titlealt, 'searchclear.png', $other, false, 1); - + $input = ''; @@ -2550,10 +2658,11 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m } /** - * Show a title (deprecated. use print_fiche_titre instead) + * Show a title. * * @param string $title Title to show * @return string Title to show + * @deprecated Use print_fiche_titre instead */ function print_titre($title) { @@ -2622,10 +2731,11 @@ function load_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath * @param int $num number of records found by select with limit+1 * @param int $totalnboflines Total number of records/lines for all pages (if known) * @param string $picto Icon to use before title (should be a 32x32 transparent png file) - * @param int $pictoisfullpath 1=Icon name is a full absolute url of image + * @param int $pictoisfullpath 1=Icon name is a full absolute url of image + * @param string $morehtml More html to show * @return void */ -function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines=0, $picto='title.png', $pictoisfullpath=0) +function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines=0, $picto='title.png', $pictoisfullpath=0, $morehtml='') { global $conf,$langs; @@ -2701,6 +2811,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so } } print_fleche_navigation($page,$file,$options,$nextpage,$pagelist); + if ($morehtml) print $morehtml; print '
    '."\n"; @@ -2840,9 +2951,13 @@ function price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerou { if ($currency_code == 'auto') $currency_code=$conf->currency; - $listofcurrenciesbefore=array('USD'); + $listofcurrenciesbefore=array('USD','GBP','AUD'); if (in_array($currency_code,$listofcurrenciesbefore)) $cursymbolbefore.=$outlangs->getCurrencySymbol($currency_code); - else $cursymbolafter.=$outlangs->getCurrencySymbol($currency_code); + else + { + $tmpcur=$outlangs->getCurrencySymbol($currency_code); + $cursymbolafter.=($tmpcur == $currency_code ? ' '.$tmpcur : $tmpcur); + } } $output=$cursymbolbefore.$output.$end.$cursymbolafter; @@ -2860,7 +2975,7 @@ function price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerou * 'MT'=Round to Max for totals with Tax (MAIN_MAX_DECIMALS_TOT) * 'MS'=Round to Max Shown (MAIN_MAX_DECIMALS_SHOWN) * @param int $alreadysqlnb Put 1 if you know that content is already universal format number - * @return string Amount with universal numeric format (Example: '99.99999') + * @return string Amount with universal numeric format (Example: '99.99999') or unchanged text if conversion fails. * * @see price Opposite function of price2num */ @@ -3534,7 +3649,7 @@ function get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $id * Return yes or no in current language * * @param string $yesno Value to test (1, 'yes', 'true' or 0, 'no', 'false') - * @param string $case 1=Yes/No, 0=yes/no + * @param string $case 1=Yes/No, 0=yes/no, 2=Disabled checkbox, 3=Disabled checkbox + Yes/No * @param int $color 0=texte only, 1=Text is formated with a color font style ('ok' or 'error'), 2=Text is formated with 'ok' color. * @return string HTML string */ @@ -3544,12 +3659,20 @@ function yn($yesno, $case=1, $color=0) $result='unknown'; if ($yesno == 1 || strtolower($yesno) == 'yes' || strtolower($yesno) == 'true') // A mettre avant test sur no a cause du == 0 { - $result=($case?$langs->trans("Yes"):$langs->trans("yes")); + $result=$langs->trans('yes'); + if ($case == 1 || $case == 3) $result=$langs->trans("Yes"); + if ($case == 2) $result=''; + if ($case == 3) $result=' '.$result; + $classname='ok'; } elseif ($yesno == 0 || strtolower($yesno) == 'no' || strtolower($yesno) == 'false') { - $result=($case?$langs->trans("No"):$langs->trans("no")); + $result=$langs->trans("no"); + if ($case == 1 || $case == 3) $result=$langs->trans("No"); + if ($case == 2) $result=''; + if ($case == 3) $result=' '.$result; + if ($color == 2) $classname='ok'; else $classname='error'; } @@ -3710,6 +3833,7 @@ function dol_nl2br($stringtoencode,$nl2brmode=0,$forxml=false) } } + /** * This function is called to encode a string into a HTML string but differs from htmlentities because * all entities but &,<,> are converted. This permits to encode special chars to entities with no double @@ -3795,13 +3919,14 @@ function dol_html_entity_decode($a,$b,$c='UTF-8') /** * Replace htmlentities functions to manage errors * http://php.net/manual/en/function.htmlentities.php + * TODO Remove this function to replace it with direct htmlentities. * * @param string $string The input string. * @param int $flags Flags(see PHP doc above) * @param string $encoding Encoding * @param bool $double_encode When double_encode is turned off PHP will not encode existing html entities * @return string $ret Encoded string - * @deprecated Since PHP4 support is no longer available, this function does not make sense + * @deprecated Since PHP4 support is no longer available, this function does not make sense. */ function dol_htmlentities($string, $flags=null, $encoding='UTF-8', $double_encode=false) { @@ -3838,6 +3963,7 @@ function dol_string_is_good_iso($s) * @param string $s String to check * @param int $maxchar Not yet used * @return int Number of lines + * @see dol_nboflines_bis */ function dol_nboflines($s,$maxchar=0) { @@ -3856,6 +3982,7 @@ function dol_nboflines($s,$maxchar=0) * @param int $maxlinesize Largeur de ligne en caracteres (ou 0 si pas de limite - defaut) * @param string $charset Give the charset used to encode the $text variable in memory. * @return int Number of lines + * @see dol_nboflines */ function dol_nboflines_bis($text,$maxlinesize=0,$charset='UTF-8') { @@ -3954,10 +4081,7 @@ function dol_concatdesc($text1,$text2,$forxml=false) } /** - * Make substition into a string - * There is two type of substitions: - * - From $substitutionarray (oldval=>newval) - * - From special constants (__XXX__=>f(objet->xxx)) by substitutions modules + * Make substition into a string replacing key with vals from $substitutionarray (oldval=>newval) * * @param string $chaine Source string in which we must do substitution * @param array $substitutionarray Array with key->val to substitute @@ -3983,7 +4107,7 @@ function make_substitutions($chaine,$substitutionarray) /** * Complete the $substitutionarray with more entries * - * @param array &$substitutionarray Array substitution old value => new value value + * @param array $substitutionarray Array substitution old value => new value value * @param Translate $outputlangs If we want substitution from special constants, we provide a language * @param Object $object If we want substitution from special constants, we provide data in a source object * @param Mixed $parameters Add more parameters (useful to pass product lines) @@ -4142,7 +4266,11 @@ function setEventMessages($mesg, $mesgs, $style='mesgs') { if (! in_array((string) $style, array('mesgs','warnings','errors'))) dol_print_error('','Bad parameter for setEventMessage'); if (empty($mesgs)) setEventMessage($mesg, $style); - else setEventMessage($mesgs, $style); + else + { + if (! empty($mesg) && ! in_array($mesg, $mesgs)) setEventMessage($mesg, $style); // Add message string if not already into array + setEventMessage($mesgs, $style); + } } /** @@ -4342,7 +4470,7 @@ function dol_htmloutput_errors($mesgstring='', $mesgarray='', $keepembedded=0) * or descending output and uses optionally natural case insensitive sorting (which * can be optionally case sensitive as well). * - * @param array &$array Array to sort (array of array('key','otherkey1','otherkey2'...)) + * @param array $array Array to sort (array of array('key','otherkey1','otherkey2'...)) * @param string $index Key in array to use for sorting criteria * @param int $order Sort order * @param int $natsort 1=use "natural" sort (natsort), 0=use "standard" sort (asort) @@ -4505,6 +4633,7 @@ function dol_eval($s,$returnvalue=0) global $leftmenu; global $rights; global $object; + global $soc; //print $s."
    \n"; if ($returnvalue) return @eval('return '.$s.';'); @@ -4532,6 +4661,8 @@ function picto_from_langcode($codelang) { global $langs; + if (empty($codelang)) return ''; + if ($codelang == 'auto') { return img_picto_common($langs->trans('AutoDetectLang'), 'flags/int.png'); @@ -4559,26 +4690,26 @@ function picto_from_langcode($codelang) * Complete or removed entries into a head array (used to build tabs) with value added by external modules. * Such values are declared into $conf->modules_parts['tab']. * - * @param Conf $conf Object conf - * @param Translate $langs Object langs - * @param Object $object Object object - * @param array &$head Object head - * @param int &$h New position to fill - * @param string $type Value for object where objectvalue can be - * 'thirdparty' to add a tab in third party view - * 'intervention' to add a tab in intervention view - * 'supplier_order' to add a tab in supplier order view - * 'supplier_invoice' to add a tab in supplier invoice view - * 'invoice' to add a tab in customer invoice view - * 'order' to add a tab in customer order view - * 'product' to add a tab in product view - * 'propal' to add a tab in propal view - * 'user' to add a tab in user view - * 'group' to add a tab in group view - * 'member' to add a tab in fundation member view - * 'categories_x' to add a tab in category view ('x': type of category (0=product, 1=supplier, 2=customer, 3=member) - * 'ecm' to add a tab for another ecm view - * @param string $mode 'add' to complete head, 'remove' to remove entries + * @param Conf $conf Object conf + * @param Translate $langs Object langs + * @param Object|null $object Object object + * @param array $head Object head + * @param int $h New position to fill + * @param string $type Value for object where objectvalue can be + * 'thirdparty' to add a tab in third party view + * 'intervention' to add a tab in intervention view + * 'supplier_order' to add a tab in supplier order view + * 'supplier_invoice' to add a tab in supplier invoice view + * 'invoice' to add a tab in customer invoice view + * 'order' to add a tab in customer order view + * 'product' to add a tab in product view + * 'propal' to add a tab in propal view + * 'user' to add a tab in user view + * 'group' to add a tab in group view + * 'member' to add a tab in fundation member view + * 'categories_x' to add a tab in category view ('x': type of category (0=product, 1=supplier, 2=customer, 3=member) + * 'ecm' to add a tab for another ecm view + * @param string $mode 'add' to complete head, 'remove' to remove entries * @return void */ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode='add') @@ -4767,19 +4898,6 @@ function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=') } -/** - * Convert an array with RGB value into hex RGB value - * - * @param array $arraycolor Array - * @param string $colorifnotfound Color code to return if entry not defined - * @return string RGB hex value (without # before). For example: FF00FF - */ -function colorArrayToHex($arraycolor,$colorifnotfound='888888') -{ - if (! is_array($arraycolor)) return $colorifnotfound; - return dechex($arraycolor[0]).dechex($arraycolor[1]).dechex($arraycolor[2]); -} - /** * Set focus onto field with selector * diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 19611dd9404..0fa197b63b7 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2014 Laurent Destailleur * Copyright (C) 2008-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2014 Marcos García @@ -479,6 +479,50 @@ function clean_url($url,$http=1) else return $url; } + + +/** + * Returns an email value with obfuscated parts. + * + * @param string $mail Email + * @param string $replace Replacement character (defaul : *) + * @param int $nbreplace Number of replacement character (default : 8) + * @param int $nbdisplaymail Number of character unchanged (default: 4) + * @param int $nbdisplaydomain Number of character unchanged of domain (default: 3) + * @param bool $displaytld Display tld (default: true) + * @return string Return email with hidden parts or ''; + */ +function dolObfuscateEmail($mail, $replace="*", $nbreplace=8, $nbdisplaymail=4, $nbdisplaydomain=3, $displaytld=true) +{ + if(!isValidEmail($mail))return ''; + $tab = explode('@', $mail); + $tab2 = explode('.',$tab[1]); + $string_replace = ''; + $mail_name = $tab[0]; + $mail_domaine = $tab2[0]; + $mail_tld = ''; + + for($i=1; $i < count($tab2) && $displaytld ;$i++) + { + $mail_tld .= '.'.$tab2[$i]; + } + + for($i=0; $i < $nbreplace; $i++){ + $string_replace .= $replace; + } + + if(strlen($mail_name) > $nbdisplaymail){ + $mail_name = substr($mail_name, 0, $nbdisplaymail); + } + + if(strlen($mail_domaine) > $nbdisplaydomain){ + $mail_domaine = substr($mail_domaine, strlen($mail_domaine)-$nbdisplaydomain); + } + + return $mail_name . $string_replace . $mail_domaine . $mail_tld; +} + + /** * Return lines of an html table from an array * Used by array2table function only @@ -529,17 +573,18 @@ function array2table($data,$tableMarkup=1,$tableoptions='',$troptions='',$tdopti /** * Return last or next value for a mask (according to area we should not reset) * - * @param DoliDB $db Database handler + * @param DoliDB $db Database handler * @param string $mask Mask to use * @param string $table Table containing field with counter * @param string $field Field containing already used values of counter * @param string $where To add a filter on selection (for exemple to filter on invoice types) * @param Societe $objsoc The company that own the object we need a counter for * @param string $date Date to use for the {y},{m},{d} tags. - * @param string $mode 'next' for next value or 'last' for last value - * @return string New value (numeric) or error message + * @param string $mode 'next' for next value or 'last' for last value + * @param bool $bentityon Activate the entity filter. Default is true (for modules not compatible with multicompany) + * @return string New value (numeric) or error message */ -function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$mode='next') +function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$mode='next', $bentityon=true) { global $conf; @@ -563,7 +608,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m $maskraz=-1; $maskoffset=0; $resetEveryMonth=false; - if (dol_strlen($maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits'; + if (dol_strlen($maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits'; // Extract value for third party mask counter if (preg_match('/\{(c+)(0*)\}/i',$mask,$regClientRef)) @@ -575,7 +620,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m $maskrefclient_clientcode=substr($valueforccc,0,dol_strlen($maskrefclient_maskclientcode));//get n first characters of client code where n is length in mask $maskrefclient_clientcode=str_pad($maskrefclient_clientcode,dol_strlen($maskrefclient_maskclientcode),"#",STR_PAD_RIGHT);//padding maskrefclient_clientcode for having exactly n characters in maskrefclient_clientcode $maskrefclient_clientcode=dol_string_nospecial($maskrefclient_clientcode);//sanitize maskrefclient_clientcode for sql insert and sql select like - if (dol_strlen($maskrefclient_maskcounter) > 0 && dol_strlen($maskrefclient_maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits'; + if (dol_strlen($maskrefclient_maskcounter) > 0 && dol_strlen($maskrefclient_maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits'; } else $maskrefclient=''; @@ -583,8 +628,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m if (preg_match('/\{(t+)\}/i',$mask,$regType)) { $masktype=$regType[1]; - $masktype_value=substr(preg_replace('/^TE_/','',$objsoc->typent_code),0,dol_strlen($regType[1]));//get n first characters of client code where n is length in mask - $masktype_value=str_pad($masktype_value,dol_strlen($regType[1]),"#",STR_PAD_RIGHT); + $masktype_value=substr(preg_replace('/^TE_/','',$objsoc->typent_code),0,dol_strlen($regType[1]));// get n first characters of thirdpaty typent_code (where n is length in mask) + $masktype_value=str_pad($masktype_value,dol_strlen($regType[1]),"#",STR_PAD_RIGHT); // we fill on right with # to have same number of char than into mask } else { @@ -605,7 +650,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m // Now maskwithnocode = 0000ddmmyyyyccc for example // and maskcounter = 0000 for example //print "maskwithonlyymcode=".$maskwithonlyymcode." maskwithnocode=".$maskwithnocode."\n
    "; - //var_dump($reg); + //var_dump($reg); // If an offset is asked if (! empty($reg[2]) && preg_match('/^\+/',$reg[2])) $maskoffset=preg_replace('/^\+/','',$reg[2]); @@ -622,17 +667,16 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m //print "yearoffset=".$yearoffset." yearoffsettype=".$yearoffsettype; if (is_numeric($yearoffsettype) && $yearoffsettype >= 1) - $maskraz=$yearoffsettype; // For backward compatibility + $maskraz=$yearoffsettype; // For backward compatibility else if ($yearoffsettype === '0' || (! empty($yearoffsettype) && ! is_numeric($yearoffsettype) && $conf->global->SOCIETE_FISCAL_MONTH_START > 1)) - $maskraz = $conf->global->SOCIETE_FISCAL_MONTH_START; + $maskraz = $conf->global->SOCIETE_FISCAL_MONTH_START; //print "maskraz=".$maskraz; // -1=no reset - if ($maskraz > 0) // A reset is required - { - if ($maskraz == 99) { - $maskraz = date('m', $date); - $resetEveryMonth = true; - } + if ($maskraz > 0) { // A reset is required + if ($maskraz == 99) { + $maskraz = date('m', $date); + $resetEveryMonth = true; + } if ($maskraz > 12) return 'ErrorBadMaskBadRazMonth'; // Define posy, posm and reg @@ -739,8 +783,10 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m $sql = "SELECT MAX(".$sqlstring.") as val"; $sql.= " FROM ".MAIN_DB_PREFIX.$table; $sql.= " WHERE ".$field." LIKE '".$maskLike."'"; - $sql.= " AND ".$field." NOT LIKE '%PROV%'"; - $sql.= " AND entity IN (".getEntity($table, 1).")"; + $sql.= " AND ".$field." NOT LIKE '(PROV%)'"; + if ($bentityon) // only if entity enable + $sql.= " AND entity IN (".getEntity($table, 1).")"; + if ($where) $sql.=$where; if ($sqlwhere) $sql.=' AND '.$sqlwhere; @@ -780,7 +826,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m $sql.= " FROM ".MAIN_DB_PREFIX.$table; $sql.= " WHERE ".$field." LIKE '".$maskLike."'"; $sql.= " AND ".$field." NOT LIKE '%PROV%'"; - $sql.= " AND entity IN (".getEntity($table, 1).")"; + if ($bentityon) // only if entity enable + $sql.= " AND entity IN (".getEntity($table, 1).")"; if ($where) $sql.=$where; if ($sqlwhere) $sql.=' AND '.$sqlwhere; @@ -833,7 +880,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m $maskrefclient_sql.= " FROM ".MAIN_DB_PREFIX.$table; //$sql.= " WHERE ".$field." not like '(%'"; $maskrefclient_sql.= " WHERE ".$field." LIKE '".$maskrefclient_maskLike."'"; - $maskrefclient_sql.= " AND entity IN (".getEntity($table, 1).")"; + if ($bentityon) // only if entity enable + $maskrefclient_sql.= " AND entity IN (".getEntity($table, 1).")"; if ($where) $maskrefclient_sql.=$where; //use the same optional where as general mask if ($sqlwhere) $maskrefclient_sql.=' AND '.$sqlwhere; //use the same sqlwhere as general mask $maskrefclient_sql.=' AND (SUBSTRING('.$field.', '.(strpos($maskwithnocode,$maskrefclient)+1).', '.dol_strlen($maskrefclient_maskclientcode).")='".$maskrefclient_clientcode."')"; @@ -915,7 +963,7 @@ function check_value($mask,$value) $maskcounter=$reg[1]; $maskraz=-1; $maskoffset=0; - if (dol_strlen($maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits'; + if (dol_strlen($maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits'; // Extract value for third party mask counter if (preg_match('/\{(c+)(0*)\}/i',$mask,$regClientRef)) @@ -927,7 +975,7 @@ function check_value($mask,$value) $maskrefclient_clientcode=substr('',0,dol_strlen($maskrefclient_maskclientcode));//get n first characters of client code to form maskrefclient_clientcode $maskrefclient_clientcode=str_pad($maskrefclient_clientcode,dol_strlen($maskrefclient_maskclientcode),"#",STR_PAD_RIGHT);//padding maskrefclient_clientcode for having exactly n characters in maskrefclient_clientcode $maskrefclient_clientcode=dol_string_nospecial($maskrefclient_clientcode);//sanitize maskrefclient_clientcode for sql insert and sql select like - if (dol_strlen($maskrefclient_maskcounter) > 0 && dol_strlen($maskrefclient_maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits'; + if (dol_strlen($maskrefclient_maskcounter) > 0 && dol_strlen($maskrefclient_maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits'; } else $maskrefclient=''; @@ -1108,7 +1156,7 @@ function numero_semaine($time) * Convertit une masse d'une unite vers une autre unite * * @param float $weight Masse a convertir - * @param int &$from_unit Unite originale en puissance de 10 + * @param int $from_unit Unite originale en puissance de 10 * @param int $to_unit Nouvelle unite en puissance de 10 * @return float Masse convertie */ @@ -1143,8 +1191,8 @@ function weight_convert($weight,&$from_unit,$to_unit) * * @param DoliDB $db Handler database * @param Conf $conf Object conf - * @param User &$user Object user - * @param array $tab Tableau (cle=>valeur) des parametres a sauvegarder + * @param User $user Object user + * @param array $tab Array (key=>value) with all parameters to save * @return int <0 if KO, >0 if OK * * @see dolibarr_get_const, dolibarr_set_const, dolibarr_del_const @@ -1221,7 +1269,7 @@ function dol_print_reduction($reduction,$langs) $string = ''; if ($reduction == 100) { - $string = $langs->trans("Offered"); + $string = $langs->transnoentities("Offered"); } else { @@ -1293,6 +1341,7 @@ function getListOfModels($db,$type,$maxfilenamelength=0) $sql.= " FROM ".MAIN_DB_PREFIX."document_model"; $sql.= " WHERE type = '".$type."'"; $sql.= " AND entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")"; + $sql.= " ORDER BY description DESC"; dol_syslog('/core/lib/function2.lib.php::getListOfModels', LOG_DEBUG); $resql = $db->query($sql); @@ -1787,3 +1836,42 @@ function fetchObjectByElement($element_id,$element_type) { } return 0; } + + +/** + * Convert an array with RGB value into hex RGB value + * + * @param array $arraycolor Array + * @param string $colorifnotfound Color code to return if entry not defined + * @return string RGB hex value (without # before). For example: FF00FF + * @see Make the opposite of colorStringToArray + */ +function colorArrayToHex($arraycolor,$colorifnotfound='888888') +{ + if (! is_array($arraycolor)) return $colorifnotfound; + return dechex($arraycolor[0]).dechex($arraycolor[1]).dechex($arraycolor[2]); +} + + +/** + * Convert a string RGB value ('FFFFFF', '255,255,255') into an array RGB array(255,255,255) + * + * @param string $stringcolor String with hex (FFFFFF) or comma RGB ('255,255,255') + * @param string $colorifnotfound Color code to return if entry not defined + * @return string RGB hex value (without # before). For example: FF00FF + * @see Make the opposite of colorArrayToHex + */ +function colorStringToArray($stringcolor,$colorifnotfound=array(88,88,88)) +{ + if (is_array($stringcolor)) return $stringcolor; // If already into correct output format, we return as is + $tmp=preg_match('/^([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])$/',$stringcolor,$reg); + if (! $tmp) + { + $tmp=explode(',',$stringcolor); + if (count($tmp) < 3) return $colorifnotfound; + return $tmp; + } + return array(hexdec($reg[1]),hexdec($reg[2]),hexdec($reg[3])); +} + + diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index 8a9ac1385be..50c02125fb7 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -72,6 +72,13 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea curl_setopt($ch, CURLOPT_POST, 1); // POST curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // Setting param x=a&y=z as POST fields } + else if ($postorget == 'PUT') + { + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT' + if ( ! is_array($param) ) + parse_str($param, $array_param); + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array_param)); // Setting param x=a&y=z as PUT fields + } else if ($postorget == 'HEAD') { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD'); // HTTP request is 'HEAD' diff --git a/htdocs/core/lib/holiday.lib.php b/htdocs/core/lib/holiday.lib.php index 209ca16f585..bb42f2e0760 100644 --- a/htdocs/core/lib/holiday.lib.php +++ b/htdocs/core/lib/holiday.lib.php @@ -34,7 +34,7 @@ function holiday_prepare_head($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT . '/holiday/fiche.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/holiday/card.php?id='.$object->id; $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 2afb4686162..ac9da88bdc2 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -79,7 +79,7 @@ function facture_prepare_head($object) if(!empty($object->note_public)) $nbNote++; $head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id; $head[$h][1] = $langs->trans('Notes'); - if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')'; + if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; $head[$h][2] = 'note'; $h++; } @@ -89,7 +89,7 @@ function facture_prepare_head($object) $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); $head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id; $head[$h][1] = $langs->trans('Documents'); - if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')'; + if($nbFiles > 0) $head[$h][1].= ' '.$nbFiles.''; $head[$h][2] = 'documents'; $h++; @@ -106,10 +106,9 @@ function facture_prepare_head($object) /** * Return array head with list of tabs to view object informations. * - * @param Object $object Invoice * @return array head array with tabs */ -function invoice_admin_prepare_head($object) +function invoice_admin_prepare_head() { global $langs, $conf, $user; @@ -125,7 +124,7 @@ function invoice_admin_prepare_head($object) // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab - complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice_admin'); + complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin'); $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_cust_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoices"); @@ -137,7 +136,7 @@ function invoice_admin_prepare_head($object) $head[$h][2] = 'attributeslines'; $h++; - complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice_admin','remove'); + complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin','remove'); return $head; } diff --git a/htdocs/core/lib/invoice2.lib.php b/htdocs/core/lib/invoice2.lib.php index 39405db4468..866cf004ca6 100644 --- a/htdocs/core/lib/invoice2.lib.php +++ b/htdocs/core/lib/invoice2.lib.php @@ -2,19 +2,20 @@ /* * Copyright (C) 2009-2013 Laurent Destailleur * -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ + * 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 . + * or see http://www.gnu.org/ + */ /** * \file htdocs/core/lib/invoice2.lib.php @@ -41,12 +42,13 @@ require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'); * @param date $paymentdatebefore Payment before date (must includes hour) * @param int $usestdout Add information onto standard output * @param int $regenerate ''=Use existing PDF files, 'nameofpdf'=Regenerate all PDF files using the template - * @param string $option Suffix to add into file name of generated PDF + * @param string $filesuffix Suffix to add into file name of generated PDF * @param string $paymentbankid Only if payment on this bank account id * @param array $thirdpartiesid List of thirdparties id when using filter excludethirdpartiesid or onlythirdpartiesid + * @param string $fileprefix Prefix to add into filename of generated PDF * @return int Error code */ -function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, $usestdout, $regenerate=0, $option='', $paymentbankid='', $thirdpartiesid='') +function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, $usestdout, $regenerate=0, $filesuffix='', $paymentbankid='', $thirdpartiesid='', $fileprefix='mergedpdf') { $sql = "SELECT DISTINCT f.rowid, f.facnumber"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; @@ -174,7 +176,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte if ($regenerate || ! dol_is_file($filename)) { if ($usestdout) print "Build PDF for invoice ".$obj->facnumber." - Lang = ".$outputlangs->defaultlang."\n"; - $result=facture_pdf_create($db, $fac, $regenerate?$regenerate:$fac->modelpdf, $outputlangs); + $result= $fac->generateDocument($regenerate?$regenerate:$fac->modelpdf, $outputlangs); } else { if ($usestdout) print "PDF for invoice ".$obj->facnumber." already exists\n"; @@ -220,13 +222,6 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); //$pdf->SetCompression(false); - - //$pdf->Open(); - //$pdf->AddPage(); - //$title=$langs->trans("BillsCustomersUnpaid"); - //if ($option=='late') $title=$langs->trans("BillsCustomersUnpaid"); - //$pdf->MultiCell(100, 3, $title, 0, 'J'); - // Add all others foreach($files as $file) { @@ -248,9 +243,9 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte dol_mkdir($diroutputpdf); // Save merged file - $filename='mergedpdf'; - - if (! empty($option)) $filename.='_'.$option; + $filename=$fileprefix; + if (empty($filename)) $filename='mergedpdf'; + if (! empty($filesuffix)) $filename.='_'.$filesuffix; $file=$diroutputpdf.'/'.$filename.'.pdf'; if (! $error && $pagecount) diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php index 00d5970d77e..0d92233e62a 100644 --- a/htdocs/core/lib/json.lib.php +++ b/htdocs/core/lib/json.lib.php @@ -254,7 +254,7 @@ function dol_json_decode($json, $assoc=false) foreach ($array as $key => $value) { - $object->{$key} = $value; + if ($key) $object->{$key} = $value; } return $object; diff --git a/htdocs/core/lib/ldap.lib.php b/htdocs/core/lib/ldap.lib.php index caee12ed135..d5a362663b7 100644 --- a/htdocs/core/lib/ldap.lib.php +++ b/htdocs/core/lib/ldap.lib.php @@ -117,7 +117,7 @@ function show_ldap_test_button($butlabel,$testlabel,$key,$dn,$objectclass) /** * Show a LDAP array into an HTML output array. * - * @param string $result Array to show. This array is already encoded into charset_output + * @param array $result Array to show. This array is already encoded into charset_output * @param int $level Level * @param int $count Count * @param string $var Var diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index 67b6794f3a3..879478daf8d 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -34,7 +34,7 @@ function member_prepare_head($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/adherents/fiche.php?rowid='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/adherents/card.php?rowid='.$object->id; $head[$h][1] = $langs->trans("MemberCard"); $head[$h][2] = 'general'; $h++; @@ -88,7 +88,7 @@ function member_prepare_head($object) $head[$h][0] = DOL_URL_ROOT.'/adherents/note.php?id='.$object->id; $head[$h][1] = $langs->trans("Note"); $head[$h][2] = 'note'; - if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')'; + if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; $h++; $head[$h][0] = DOL_URL_ROOT.'/adherents/document.php?id='.$object->id; @@ -174,7 +174,7 @@ function member_stats_prepare_head($object) $head[$h][1] = $langs->trans("Country"); $head[$h][2] = 'statscountry'; $h++; - + $head[$h][0] = DOL_URL_ROOT.'/adherents/stats/geo.php?mode=memberbyregion'; $head[$h][1] = $langs->trans("Region"); $head[$h][2] = 'statsregion'; diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 43427acd59a..abdf1b648a5 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -42,7 +42,7 @@ function commande_prepare_head($object) if (! empty($conf->commande->enabled) && $user->rights->commande->lire) { - $head[$h][0] = DOL_URL_ROOT.'/commande/fiche.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/commande/card.php?id='.$object->id; $head[$h][1] = $langs->trans("OrderCard"); $head[$h][2] = 'order'; $h++; @@ -89,7 +89,7 @@ function commande_prepare_head($object) if(!empty($object->note_public)) $nbNote++; $head[$h][0] = DOL_URL_ROOT.'/commande/note.php?id='.$object->id; $head[$h][1] = $langs->trans('Notes'); - if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')'; + if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; $head[$h][2] = 'note'; $h++; } @@ -99,7 +99,7 @@ function commande_prepare_head($object) $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); $head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); - if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')'; + if($nbFiles > 0) $head[$h][1].= ' '.$nbFiles.''; $head[$h][2] = 'documents'; $h++; @@ -116,10 +116,9 @@ function commande_prepare_head($object) /** * Return array head with list of tabs to view object informations. * - * @param Object $object order - * @return array head array with tabs + * @return array head array with tabs */ -function order_admin_prepare_head($object) +function order_admin_prepare_head() { global $langs, $conf, $user; @@ -131,7 +130,7 @@ function order_admin_prepare_head($object) $head[$h][2] = 'general'; $h++; - complete_head_from_modules($conf,$langs,$object,$head,$h,'order_admin'); + complete_head_from_modules($conf,$langs,null,$head,$h,'order_admin'); $head[$h][0] = DOL_URL_ROOT.'/admin/order_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); @@ -143,7 +142,7 @@ function order_admin_prepare_head($object) $head[$h][2] = 'attributeslines'; $h++; - complete_head_from_modules($conf,$langs,$object,$head,$h,'order_admin','remove'); + complete_head_from_modules($conf,$langs,null,$head,$h,'order_admin','remove'); return $head; } diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index f4d3b80ee8c..591956bbffc 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -32,7 +32,7 @@ function payment_prepare_head(Paiement $object) { $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/card.php?id='.$object->id; $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'payment'; $h++; @@ -67,7 +67,7 @@ function payment_supplier_prepare_head(Paiement $object) { $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$object->id; $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'payment'; $h++; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 0f3e097bddd..129d32fc7d9 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1,11 +1,12 @@ - * Copyright (C) 2006 Rodolphe Quiedeville - * Copyright (C) 2007 Patrick Raguin - * Copyright (C) 2010-2012 Regis Houssin - * Copyright (C) 2010 Juanjo Menent - * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2014 Cedric GROSS +/* Copyright (C) 2006-2011 Laurent Destailleur + * Copyright (C) 2006 Rodolphe Quiedeville + * Copyright (C) 2007 Patrick Raguin + * Copyright (C) 2010-2012 Regis Houssin + * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2014 Cedric GROSS + * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -166,7 +167,7 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P') * This class is an enhanced FPDI class that support method writeHTMLCell */ class FPDI_DolExtended extends FPDI - { + { /** * __call * @@ -311,7 +312,10 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target if ($mode == 'source') { - $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($sourcecompany))."\n"; + $withCountry = 0; + if (!empty($sourcecompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) $withCountry = 1; + + $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($sourcecompany, $withCountry, "\n", $outputlangs))."\n"; if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS)) { @@ -422,7 +426,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target /** * Show header of page for PDF generation * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Translate $outputlangs Object lang for output * @param int $page_height Height of page * @return void @@ -434,16 +438,16 @@ function pdf_pagehead(&$pdf,$outputlangs,$page_height) // Add a background image on document if (! empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF)) // Warning, this option make TCPDF generation beeing crazy and some content disappeared behin the image { - $pdf->SetAutoPageBreak(0,0); // Disable auto pagebreak before adding image + $pdf->SetAutoPageBreak(0,0); // Disable auto pagebreak before adding image $pdf->Image($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_X:0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y:0), 0, $page_height); - $pdf->SetAutoPageBreak(1,0); // Restore pagebreak + $pdf->SetAutoPageBreak(1,0); // Restore pagebreak } } /** * Add a draft watermark on PDF files * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Translate $outputlangs Object lang * @param int $h Height of PDF * @param int $w Width of PDF @@ -483,12 +487,12 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text) /** * Show bank informations for PDF generation * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Translate $outputlangs Object lang * @param int $curx X * @param int $cury Y * @param Account $account Bank account object - * @param int $onlynumber Output only number + * @param int $onlynumber Output only number (bank+desk+key+number according to country, but without name of bank and domiciliation) * @param int $default_font_size Default font size * @return float The Y PDF position */ @@ -498,7 +502,6 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default $diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE); $diffsizecontent=(empty($conf->global->PDF_DIFFSIZE_CONTENT)?4:$conf->global->PDF_DIFFSIZE_CONTENT); - $pdf->SetXY($curx, $cury); if (empty($onlynumber)) @@ -510,10 +513,14 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default $outputlangs->load("banks"); + // Use correct name of bank id according to country + $bickey="BICNumber"; + if ($account->getCountryCode() == 'IN') $bickey="SWIFT"; + // Get format of bank account according to its country $usedetailedbban=$account->useDetailedBBAN(); - //$onlynumber=0; $usedetailedbban=0; // For tests + $onlynumber=0; $usedetailedbban=1; // For tests if ($usedetailedbban) { $savcurx=$curx; @@ -588,7 +595,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default } $curx=$savcurx; - $cury+=10; + $cury+=9; } else { @@ -605,12 +612,6 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default if ($diffsizecontent <= 2) $cury+=1; } - // Use correct name of bank id according to country - $ibankey="IBANNumber"; - $bickey="BICNumber"; - if ($account->getCountryCode() == 'IN') $ibankey="IFSC"; - if ($account->getCountryCode() == 'IN') $bickey="SWIFT"; - $pdf->SetFont('','',$default_font_size - $diffsizecontent); if (empty($onlynumber) && ! empty($account->domiciliation)) @@ -625,15 +626,29 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default } else if (! $usedetailedbban) $cury+=1; + // Use correct name of bank id according to country + $ibankey="IBANNumber"; + if ($account->getCountryCode() == 'IN') $ibankey="IFSC"; if (! empty($account->iban)) { + $ibanDisplay_temp = $outputlangs->convToOutputCharset($account->iban); + $ibanDisplay = ""; + + for($i = 0; $i < dol_strlen($ibanDisplay_temp); $i++) + { + $ibanDisplay .= $ibanDisplay_temp[$i]; + if($i%4 == 3 && $i > 0) $ibanDisplay .= " "; + } + + $pdf->SetFont('','B',$default_font_size - 3); $pdf->SetXY($curx, $cury); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities($ibankey).': ' . $outputlangs->convToOutputCharset($account->iban), 0, 'L', 0); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities($ibankey).': ' . $ibanDisplay, 0, 'L', 0); $cury+=3; } if (! empty($account->bic)) { + $pdf->SetFont('','B',$default_font_size - 3); $pdf->SetXY($curx, $cury); $pdf->MultiCell(100, 3, $outputlangs->transnoentities($bickey).': ' . $outputlangs->convToOutputCharset($account->bic), 0, 'L', 0); } @@ -641,11 +656,10 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default return $pdf->getY(); } - /** * Show footer of page for PDF generation * - * @param PDF &$pdf The PDF factory + * @param PDF $pdf The PDF factory * @param Translate $outputlangs Object lang for output * @param string $paramfreetext Constant name of free text * @param Societe $fromcompany Object company @@ -671,11 +685,11 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass { // Make substitution $substitutionarray=array( - '__FROM_NAME__' => $fromcompany->nom, - '__FROM_EMAIL__' => $fromcompany->email, - '__TOTAL_TTC__' => $object->total_ttc, - '__TOTAL_HT__' => $object->total_ht, - '__TOTAL_VAT__' => $object->total_vat + '__FROM_NAME__' => $fromcompany->name, + '__FROM_EMAIL__' => $fromcompany->email, + '__TOTAL_TTC__' => $object->total_ttc, + '__TOTAL_HT__' => $object->total_ht, + '__TOTAL_VAT__' => $object->total_vat ); complete_substitutions_array($substitutionarray,$outputlangs,$object); $newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray); @@ -747,7 +761,9 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass // Capital if ($fromcompany->capital) { - $line3.=($line3?" - ":"").$outputlangs->transnoentities("CapitalOf",price($fromcompany->capital, 0, $outputlangs, 0, 0, 0, $conf->currency)); + $tmpamounttoshow = price2num($fromcompany->capital); // This field is a free string + if (is_numeric($tmpamounttoshow) && $tmpamounttoshow > 0) $line3.=($line3?" - ":"").$outputlangs->transnoentities("CapitalOf",price($tmpamounttoshow, 0, $outputlangs, 0, 0, 0, $conf->currency)); + else $line3.=($line3?" - ":"").$outputlangs->transnoentities("CapitalOf",$tmpamounttoshow,$outputlangs); } // Prof Id 1 if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || ! $fromcompany->idprof2)) @@ -859,7 +875,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass /** * Show linked objects for PDF generation * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param object $object Object * @param Translate $outputlangs Object lang * @param int $posx X @@ -897,7 +913,7 @@ function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$w,$h,$al /** * Output line description into PDF * - * @param PDF &$pdf PDF object + * @param PDF $pdf PDF object * @param Object $object Object * @param int $i Current line number * @param Translate $outputlangs Object lang for output @@ -1257,7 +1273,7 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0) * * @param Object $object Object * @param int $i Current line number - * @param Tranlate $outputlangs Object langs for output + * @param Translate $outputlangs Object langs for output * @param int $hidedetails Hide value (0 = no, 1 = yes, 2 = just special lines) * @return void */ diff --git a/htdocs/core/lib/prelevement.lib.php b/htdocs/core/lib/prelevement.lib.php index dde5981cf75..53f54d66f70 100644 --- a/htdocs/core/lib/prelevement.lib.php +++ b/htdocs/core/lib/prelevement.lib.php @@ -39,19 +39,11 @@ function prelevement_prepare_head($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$object->id; $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'prelevement'; $h++; - if (! empty($conf->global->MAIN_USE_PREVIEW_TABS)) - { - $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$object->id; - $head[$h][1] = $langs->trans("Preview"); - $head[$h][2] = 'preview'; - $h++; - } - $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$object->id; $head[$h][1] = $langs->trans("Lines"); $head[$h][2] = 'lines'; diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index d8f814e06c3..741dd98de6d 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -39,7 +39,7 @@ function product_prepare_head($object, $user) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT."/product/fiche.php?id=".$object->id; + $head[$h][0] = DOL_URL_ROOT."/product/card.php?id=".$object->id; $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'card'; $h++; @@ -83,13 +83,13 @@ function product_prepare_head($object, $user) // Sub products if (! empty($conf->global->PRODUIT_SOUSPRODUITS)) { - $head[$h][0] = DOL_URL_ROOT."/product/composition/fiche.php?id=".$object->id; + $head[$h][0] = DOL_URL_ROOT."/product/composition/card.php?id=".$object->id; $head[$h][1] = $langs->trans('AssociatedProducts'); $head[$h][2] = 'subproduct'; $h++; } - $head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$object->id; + $head[$h][0] = DOL_URL_ROOT."/product/stats/card.php?id=".$object->id; $head[$h][1] = $langs->trans('Statistics'); $head[$h][2] = 'stats'; $h++; @@ -147,10 +147,9 @@ function product_prepare_head($object, $user) /** * Return array head with list of tabs to view object informations. * -* @param Object $object Product * @return array head array with tabs */ -function product_admin_prepare_head($object=null) +function product_admin_prepare_head() { global $langs, $conf, $user; @@ -166,14 +165,14 @@ function product_admin_prepare_head($object=null) // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:-tabname); to remove a tab - complete_head_from_modules($conf,$langs,$object,$head,$h,'product_admin'); + complete_head_from_modules($conf,$langs,null,$head,$h,'product_admin'); $head[$h][0] = DOL_URL_ROOT.'/product/admin/product_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); $head[$h][2] = 'attributes'; $h++; - complete_head_from_modules($conf,$langs,$object,$head,$h,'product_admin','remove'); + complete_head_from_modules($conf,$langs,null,$head,$h,'product_admin','remove'); return $head; } @@ -316,6 +315,7 @@ function measuring_units_string($unit,$measuring_style='') { global $langs; + $measuring_units=array(); if ($measuring_style == 'weight') { $measuring_units[3] = $langs->trans("WeightUnitton"); diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 7a8f2302c12..a2c6cca18eb 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2014 Laurent Destailleur * Copyright (C) 2010 Regis Houssin * Copyright (C) 2011 Juanjo Menent * @@ -38,7 +38,7 @@ function project_prepare_head($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/projet/fiche.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/projet/card.php?id='.$object->id; $head[$h][1] = $langs->trans("Project"); $head[$h][2] = 'project'; $h++; @@ -71,7 +71,7 @@ function project_prepare_head($object) if(!empty($object->note_public)) $nbNote++; $head[$h][0] = DOL_URL_ROOT.'/projet/note.php?id='.$object->id; $head[$h][1] = $langs->trans('Notes'); - if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')'; + if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; $head[$h][2] = 'notes'; $h++; } @@ -81,7 +81,7 @@ function project_prepare_head($object) $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); $head[$h][0] = DOL_URL_ROOT.'/projet/document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); - if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')'; + if($nbFiles > 0) $head[$h][1].= ' '.$nbFiles.''; $head[$h][2] = 'document'; $h++; @@ -149,7 +149,7 @@ function task_prepare_head($object) if(!empty($object->note_public)) $nbNote++; $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/note.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');; $head[$h][1] = $langs->trans('Notes'); - if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')'; + if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; $head[$h][2] = 'task_notes'; $h++; } @@ -206,13 +206,13 @@ function project_admin_prepare_head() /** * Show task lines with a particular parent * - * @param string &$inc Counter that count number of lines legitimate to show (for return) + * @param string $inc Counter that count number of lines legitimate to show (for return) * @param int $parent Id of parent task to start - * @param array &$lines Array of all tasks - * @param int &$level Level of task + * @param array $lines Array of all tasks + * @param int $level Level of task * @param string $var Color * @param int $showproject Show project columns - * @param int &$taskrole Array of roles of user for each tasks + * @param int $taskrole Array of roles of user for each tasks * @param int $projectsListId List of id of project allowed to user (string separated with comma) * @param int $addordertick Add a tick to move task * @return void @@ -357,7 +357,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print ''; // Planned Workload (in working hours) - print ''; + print ''; $fullhour=convertSecondToTime($lines[$i]->planned_workload,'allhourmin'); $workingdelay=convertSecondToTime($lines[$i]->planned_workload,'all',86400,7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks if ($lines[$i]->planned_workload) @@ -384,10 +384,13 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t else print '
    '; print ''; - // Progress calculated - // Note: ->duration is in fact time spent i think + // Progress calculated (Note: ->duration is time spent) print ''; - if ($lines[$i]->planned_workload) print round(100 * $lines[$i]->duration / $lines[$i]->planned_workload,2).' %'; + if ($lines[$i]->planned_workload || $lines[$i]->duration) + { + if ($lines[$i]->planned_workload) print round(100 * $lines[$i]->duration / $lines[$i]->planned_workload,2).' %'; + else print $langs->trans('WorkloadNotDefined'); + } print ''; // Tick to drag and drop @@ -422,7 +425,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print ''; print ''; print ''; - print ''; + print ''; print convertSecondToTime($total_projectlinesa_planned, 'allhourmin'); print ''; print ''; @@ -430,7 +433,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print convertSecondToTime($total_projectlinesa_spent, 'allhourmin'); print ''; print ''; - if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent_if_planned / $total_projectlinesa_planned,2).' %'; + if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned,2).' %'; print ''; if ($addordertick) print ''; print ''; @@ -443,20 +446,26 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t /** * Output a task line * - * @param string &$inc ? + * @param string $inc ? * @param string $parent ? - * @param Object $lines ? - * @param int &$level ? - * @param string &$projectsrole ? - * @param string &$tasksrole ? + * @param Task[] $lines ? + * @param int $level ? + * @param string $projectsrole ? + * @param string $tasksrole ? * @param string $mine Show only task lines I am assigned to * @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to * @return $inc */ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0) { - global $user, $bc, $langs; - global $form, $projectstatic, $taskstatic; + global $db, $user, $bc, $langs; + global $form, $formother, $projectstatic, $taskstatic; + + if (! is_object($formother)) + { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; + $formother = new FormOther($db); + } $lastprojectid=0; @@ -526,7 +535,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr // Progress declared % print ''; - print $lines[$i]->progress.' %'; + print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress'); print ''; // Time spent @@ -556,13 +565,16 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr $disabledtask=1; } - print ''; - $s =$form->select_date('',$lines[$i]->id,'','','',"addtime",1,0,1,$disabledtask); + // Form to add new time + print ''; + $s=''; + $s.=$form->select_date('',$lines[$i]->id,0,0,2,"addtime",1,0,1,$disabledtask); $s.='   '; - $s.=$form->select_duration($lines[$i]->id,'',$disabledtask,'text'); + $s.=$form->select_duration($lines[$i]->id,'',$disabledtask,'text',0,1); $s.=' '; print $s; print ''; + print ''; if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject")); else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou")); @@ -589,10 +601,10 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr /** * Search in task lines with a particular parent if there is a task for a particular user (in taskrole) * - * @param string &$inc Counter that count number of lines legitimate to show (for return) + * @param string $inc Counter that count number of lines legitimate to show (for return) * @param int $parent Id of parent task to start - * @param array &$lines Array of all tasks - * @param string &$taskrole Array of task filtered on a particular user + * @param array $lines Array of all tasks + * @param string $taskrole Array of task filtered on a particular user * @return int 1 if there is */ function searchTaskInChild(&$inc, $parent, &$lines, &$taskrole) diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index bc0c7cae868..fd227d512b7 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -83,7 +83,7 @@ function propal_prepare_head($object) if(!empty($object->note_public)) $nbNote++; $head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?id='.$object->id; $head[$h][1] = $langs->trans('Notes'); - if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')'; + if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; $head[$h][2] = 'note'; $h++; } @@ -93,7 +93,7 @@ function propal_prepare_head($object) $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); $head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); - if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')'; + if($nbFiles > 0) $head[$h][1].= ' '.$nbFiles.''; $head[$h][2] = 'document'; $h++; @@ -110,10 +110,9 @@ function propal_prepare_head($object) /** * Return array head with list of tabs to view object informations. * - * @param Object $object Propal * @return array head array with tabs */ -function propal_admin_prepare_head($object) +function propal_admin_prepare_head() { global $langs, $conf, $user; @@ -129,7 +128,7 @@ function propal_admin_prepare_head($object) // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab - complete_head_from_modules($conf,$langs,$object,$head,$h,'propal_admin'); + complete_head_from_modules($conf,$langs,null,$head,$h,'propal_admin'); $head[$h][0] = DOL_URL_ROOT.'/comm/admin/propal_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); @@ -141,7 +140,7 @@ function propal_admin_prepare_head($object) $head[$h][2] = 'attributeslines'; $h++; - complete_head_from_modules($conf,$langs,$object,$head,$h,'propal_admin','remove'); + complete_head_from_modules($conf,$langs,null,$head,$h,'propal_admin','remove'); return $head; } diff --git a/htdocs/core/lib/report.lib.php b/htdocs/core/lib/report.lib.php index d41594c3193..e6fbd7e59bc 100644 --- a/htdocs/core/lib/report.lib.php +++ b/htdocs/core/lib/report.lib.php @@ -26,15 +26,15 @@ /** * Show header of a VAT report * -* @param string $nom Name of report -* @param string $variante Link for alternate report -* @param string $period Period of report -* @param string $periodlink Link to switch period -* @param string $description Description -* @param int $builddate Date generation -* @param string $exportlink Link for export or '' -* @param array $moreparam Array with list of params to add into form -* @param string $calcmode Calculation mode +* @param string $nom Name of report +* @param string $variante Link for alternate report +* @param string $period Period of report +* @param string $periodlink Link to switch period +* @param string $description Description +* @param timestamp|integer $builddate Date generation +* @param string $exportlink Link for export or '' +* @param array $moreparam Array with list of params to add into form +* @param string $calcmode Calculation mode * @return void */ function report_header($nom,$variante,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='') @@ -79,7 +79,7 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat print ''; print ''; } - + // Ligne de la periode d'analyse du rapport print ''; print ''.$langs->trans("ReportPeriod").''; diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index c8cccefda7f..f00abaa339f 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -70,11 +70,11 @@ function dol_decode($chain) /** * Returns a hash of a string. - * If constant MAIN_SECURITY_HASH_ALGO is defined, we use this function as hashing function (md5 by default) - * If constant MAIN_SECURITY_SALT is defined, we use it as a salt + * If constant MAIN_SECURITY_HASH_ALGO is defined, we use this function as hashing function. + * If constant MAIN_SECURITY_SALT is defined, we use it as a salt. * * @param string $chain String to hash - * @param int $type Type of hash (0:auto, 1:sha1, 2:sha1+md5) + * @param int $type Type of hash (0:auto, 1:sha1, 2:sha1+md5, 3:md5) * @return string Hash of string */ function dol_hash($chain,$type=0) @@ -86,9 +86,12 @@ function dol_hash($chain,$type=0) if ($type == 1) return sha1($chain); else if ($type == 2) return sha1(md5($chain)); + else if ($type == 3) return md5($chain); else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1') return sha1($chain); else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1md5') return sha1(md5($chain)); - else return md5($chain); + + // No enconding defined + return md5($chain); } @@ -100,7 +103,7 @@ function dol_hash($chain,$type=0) * @param string $features Features to check (it must be module name. Examples: 'societe', 'contact', 'produit&service', 'produit|service', ...) * @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional). * @param string $dbtablename 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional) - * @param string $feature2 Feature to check, second level of permission (optional) + * @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'. * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional) * @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional) * @param Canvas $objcanvas Object canvas @@ -140,7 +143,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature // Check read permission from module $readok=1; $nbko=0; - foreach ($featuresarray as $feature) + foreach ($featuresarray as $feature) // first we check nb of test ko { if (! empty($user->societe_id) && ! empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && ! in_array($feature,$listofmodules)) // If limits on modules for external users, module must be into list of modules for external users { @@ -174,11 +177,17 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature } else if (! empty($feature2)) // This should be used for future changes { + $tmpreadok=1; foreach($feature2 as $subfeature) { - if (! empty($subfeature) && empty($user->rights->$feature->$subfeature->lire) && empty($user->rights->$feature->$subfeature->read)) { $readok=0; $nbko++; } - else if (empty($subfeature) && empty($user->rights->$feature->lire) && empty($user->rights->$feature->read)) { $readok=0; $nbko++; } - else { $readok=1; break; } // Break is to bypass second test if the first is ok + if (! empty($subfeature) && empty($user->rights->$feature->$subfeature->lire) && empty($user->rights->$feature->$subfeature->read)) { $tmpreadok=0; } + else if (empty($subfeature) && empty($user->rights->$feature->lire) && empty($user->rights->$feature->read)) { $tmpreadok=0; } + else { $tmpreadok=1; break; } // Break is to bypass second test if the first is ok + } + if (! $tmpreadok) // We found a test on feature that is ko + { + $readok=0; // All tests are ko (we manage here the and, the or will be managed later using $nbko). + $nbko++; } } else if (! empty($feature) && ($feature!='user' && $feature!='usergroup')) // This is for old permissions diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 40dd2c03ac3..fe0c9809296 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -440,7 +440,7 @@ function encodedecode_dbpassconf($level=0) /** * Return a generated password using default module * - * @param boolean $generic true=Create generic password (a MD5 string), false=Use the configured password generation module + * @param boolean $generic true=Create generic password (use default crypt function), false=Use the configured password generation module * @return string New value for password */ function getRandomPassword($generic=false) diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index d2ff595b734..dd08c8b6c79 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -41,7 +41,7 @@ function shipping_prepare_head($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT."/expedition/fiche.php?id=".$object->id; + $head[$h][0] = DOL_URL_ROOT."/expedition/card.php?id=".$object->id; $head[$h][1] = $langs->trans("SendingCard"); $head[$h][2] = 'shipping'; $h++; @@ -52,7 +52,7 @@ function shipping_prepare_head($object) $object->fetchObjectLinked($object->id,$object->element); if (! empty($object->linkedObjectsIds['delivery'][0])) // If there is a delivery { - $head[$h][0] = DOL_URL_ROOT."/livraison/fiche.php?id=".$object->linkedObjectsIds['delivery'][0]; + $head[$h][0] = DOL_URL_ROOT."/livraison/card.php?id=".$object->linkedObjectsIds['delivery'][0]; $head[$h][1] = $langs->trans("DeliveryCard"); $head[$h][2] = 'delivery'; $h++; @@ -99,13 +99,13 @@ function delivery_prepare_head($object) if ($conf->expedition_bon->enabled && $user->rights->expedition->lire) { - $head[$h][0] = DOL_URL_ROOT."/expedition/fiche.php?id=".$object->origin_id; + $head[$h][0] = DOL_URL_ROOT."/expedition/card.php?id=".$object->origin_id; $head[$h][1] = $langs->trans("SendingCard"); $head[$h][2] = 'shipping'; $h++; } - $head[$h][0] = DOL_URL_ROOT."/livraison/fiche.php?id=".$object->id; + $head[$h][0] = DOL_URL_ROOT."/livraison/card.php?id=".$object->id; $head[$h][1] = $langs->trans("DeliveryCard"); $head[$h][2] = 'delivery'; $h++; @@ -207,7 +207,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='') print ""; // Sending id - print ''.img_object($langs->trans("ShowSending"),'sending').' '.$objp->exp_ref.''; + print ''.img_object($langs->trans("ShowSending"),'sending').' '.$objp->exp_ref.''; // Description if ($objp->fk_product > 0) @@ -310,7 +310,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='') // Ref print ''; print $receiving->getNomUrl($db); - //print ''.img_object($langs->trans("ShowReceiving"),'sending').' '.$objp->livraison_ref.''; + //print ''.img_object($langs->trans("ShowReceiving"),'sending').' '.$objp->livraison_ref.''; print ''; // Qty received //print ''; diff --git a/htdocs/core/lib/stock.lib.php b/htdocs/core/lib/stock.lib.php index 3305f76875d..758b2e96582 100644 --- a/htdocs/core/lib/stock.lib.php +++ b/htdocs/core/lib/stock.lib.php @@ -34,7 +34,7 @@ function stock_prepare_head($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/product/stock/card.php?id='.$object->id; $head[$h][1] = $langs->trans("WarehouseCard"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index 62e46b7b9f7..cc9478f5d61 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -124,7 +124,7 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction } if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) { - $sql = "SELECT s.rowid as socid, s.nom as nom, s.siren as tva_intra, s.tva_assuj as assuj,"; + $sql = "SELECT s.rowid as socid, s.nom as name, s.siren as tva_intra, s.tva_assuj as assuj,"; $sql.= " sum(fd.total_ht) as amount, sum(fd.".$total_tva.") as tva,"; $sql.= " sum(fd.".$total_localtax1.") as localtax1,"; $sql.= " sum(fd.".$total_localtax2.") as localtax2"; diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index 1bbf2e55e27..470da211f2e 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -28,7 +28,7 @@ /** * Show indent and picto of a tree line. Return array with information of line. * - * @param array &$fulltree Array of entries in correct order + * @param array $fulltree Array of entries in correct order * @param string $key Key of entry into fulltree to show picto * @param int $silent Do not output indent and picto, returns only value * @return array array(0 or 1 if at least one of this level after, 0 or 1 if at least one of higher level after, nbofdirinsub, nbofdocinsub) diff --git a/htdocs/core/lib/trip.lib.php b/htdocs/core/lib/trip.lib.php index ae38a1bf706..45619b10d6f 100644 --- a/htdocs/core/lib/trip.lib.php +++ b/htdocs/core/lib/trip.lib.php @@ -34,7 +34,7 @@ function trip_prepare_head($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT . '/compta/deplacement/fiche.php?id=' . $object->id; + $head[$h][0] = DOL_URL_ROOT . '/compta/deplacement/card.php?id=' . $object->id; $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 276efe85f02..41b7996cbfd 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -44,7 +44,7 @@ function user_prepare_head($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/user/fiche.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/user/card.php?id='.$object->id; $head[$h][1] = $langs->trans("UserCard"); $head[$h][2] = 'user'; $h++; @@ -101,7 +101,7 @@ function user_prepare_head($object) if(!empty($object->note)) $nbNote++; $head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id; $head[$h][1] = $langs->trans("Note"); - if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')'; + if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; $head[$h][2] = 'note'; $h++; @@ -111,7 +111,7 @@ function user_prepare_head($object) $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); $head[$h][0] = DOL_URL_ROOT.'/user/document.php?userid='.$object->id; $head[$h][1] = $langs->trans("Documents"); - if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')'; + if($nbFiles > 0) $head[$h][1].= ' '.$nbFiles.''; $head[$h][2] = 'document'; $h++; @@ -126,7 +126,12 @@ function user_prepare_head($object) return $head; } - +/** + * Prepare array with list of tabs + * + * @param Group $object Object group + * @return array Array of tabs + */ function group_prepare_head($object) { global $langs, $conf, $user; @@ -140,7 +145,7 @@ function group_prepare_head($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/user/group/fiche.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/user/group/card.php?id='.$object->id; $head[$h][1] = $langs->trans("GroupCard"); $head[$h][2] = 'group'; $h++; @@ -195,6 +200,11 @@ function user_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); $head[$h][2] = 'attributes'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/user/admin/group_extrafields.php'; + $head[$h][1] = $langs->trans("ExtraFields")." ".$langs->trans("Groups"); + $head[$h][2] = 'attributes_group'; $h++; // Show more tabs from modules @@ -237,9 +247,9 @@ function entity_prepare_head($object, $aEntities) /** * Show list of themes. Show all thumbs of themes * - * @param User $fuser User concerned or '' for global theme - * @param int $edit 1 to add edit form - * @param boolean $foruserprofile Show for user profile view + * @param User|null $fuser User concerned or null for global theme + * @param int $edit 1 to add edit form + * @param boolean $foruserprofile Show for user profile view * @return void */ function show_theme($fuser,$edit=0,$foruserprofile=false) @@ -260,7 +270,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) $selected_theme=''; if (empty($foruserprofile)) $selected_theme=$conf->global->MAIN_THEME; - else $selected_theme=empty($fuser->conf->MAIN_THEME)?'':$fuser->conf->MAIN_THEME; + else $selected_theme=((is_object($fuser) && ! empty($fuser->conf->MAIN_THEME))?$fuser->conf->MAIN_THEME:''); $colspan=2; if ($foruserprofile) $colspan=4; diff --git a/htdocs/core/lib/ws.lib.php b/htdocs/core/lib/ws.lib.php index 1e7f4b4e522..533a13e1fb6 100644 --- a/htdocs/core/lib/ws.lib.php +++ b/htdocs/core/lib/ws.lib.php @@ -27,9 +27,9 @@ * Check authentication array and set error, errorcode, errorlabel * * @param array $authentication Array with authentication informations ('login'=>,'password'=>,'entity'=>,'dolibarrkey'=>) - * @param int &$error Number of errors - * @param string &$errorcode Error string code - * @param string &$errorlabel Error string label + * @param int $error Number of errors + * @param string $errorcode Error string code + * @param string $errorlabel Error string label * @return User Return user object identified by login/pass/entity into authentication array */ function check_authentication($authentication,&$error,&$errorcode,&$errorlabel) diff --git a/htdocs/core/login/functions_dolibarr.php b/htdocs/core/login/functions_dolibarr.php index d1555678313..8e5a8b13ea9 100644 --- a/htdocs/core/login/functions_dolibarr.php +++ b/htdocs/core/login/functions_dolibarr.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2007-2014 Laurent Destailleur * Copyright (C) 2007-2009 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent * @@ -20,7 +20,7 @@ /** * \file htdocs/core/login/functions_dolibarr.php * \ingroup core - * \brief Authentication functions for Dolibarr mode + * \brief Authentication functions for Dolibarr mode (check user on login or email and check pass) */ @@ -50,13 +50,15 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest= { // If test username/password asked, we define $test=false and $login var if ok, set $_SESSION["dol_loginmesg"] if ko $table = MAIN_DB_PREFIX."user"; - $usernamecol = 'login'; + $usernamecol1 = 'login'; + $usernamecol2 = 'email'; $entitycol = 'entity'; - $sql ='SELECT rowid, entity, pass, pass_crypted'; + $sql ='SELECT rowid, login, entity, pass, pass_crypted'; $sql.=' FROM '.$table; - $sql.=' WHERE '.$usernamecol." = '".$db->escape($usertotest)."'"; - $sql.=' AND '.$entitycol." IN (0," . ($entity ? $entity : 1) . ")"; + $sql.=' WHERE ('.$usernamecol1." = '".$db->escape($usertotest)."'"; + if (preg_match('/@/',$usertotest)) $sql.=' OR '.$usernamecol2." = '".$db->escape($usertotest)."'"; + $sql.=') AND '.$entitycol." IN (0," . ($entity ? $entity : 1) . ")"; dol_syslog("functions_dolibarr::check_user_password_dolibarr", LOG_DEBUG); $resql=$db->query($sql); @@ -106,7 +108,7 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest= // Password ok ? if ($passok) { - $login=$usertotest; + $login=$obj->login; } else { diff --git a/htdocs/core/login/functions_forceuser.php b/htdocs/core/login/functions_forceuser.php index c990c0bd45e..94201c74ad0 100644 --- a/htdocs/core/login/functions_forceuser.php +++ b/htdocs/core/login/functions_forceuser.php @@ -46,4 +46,3 @@ function check_user_password_forceuser($usertotest,$passwordtotest,$entitytotest return $login; } - diff --git a/htdocs/core/login/functions_http.php b/htdocs/core/login/functions_http.php index 9d03913d2bc..285ebebbabf 100644 --- a/htdocs/core/login/functions_http.php +++ b/htdocs/core/login/functions_http.php @@ -43,4 +43,3 @@ function check_user_password_http($usertotest,$passwordtotest,$entitytotest) return $login; } - diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 36291883755..b5818362591 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -16,7 +16,6 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/index.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 60, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('mailing|export|import|opensurvey', '$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled || $conf->opensurvey->enabled', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run || $user->rights->opensurvey->read', '', 2, 90, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('boutique', '! empty($conf->boutique->enabled)', 11__+MAX_llx_menu__, __HANDLER__, 'top', 'shop', '', 0, '/boutique/index.php?mainmenu=shop&leftmenu=', 'OSCommerce', -1, 'shop', '', '', 0, 100, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 110, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm', '$conf->holiday->enabled || $conf->deplacement->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/compta/hrm.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->holiday->write || $user->rights->deplacement->lire', '', 0, 80, __ENTITY__); @@ -27,9 +26,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 103__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/modules.php?leftmenu=setup', 'Modules', 1, 'admin', '', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 104__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/boxes.php?leftmenu=setup', 'Boxes', 1, 'admin', '', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 105__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/menus.php?leftmenu=setup', 'Menus', 1, 'admin', '', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 114__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/fiscalyear.php?leftmenu=setup', 'Fiscalyear', 1, 'admin', '', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 106__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/delais.php?leftmenu=setup', 'Alerts', 1, 'admin', '', '', 2, 7, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 108__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/proxy.php?leftmenu=setup', 'Security', 1, 'admin', '', '', 2, 8, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 108__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/security_other.php?leftmenu=setup', 'Security', 1, 'admin', '', '', 2, 8, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 110__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/limits.php?leftmenu=setup', 'MenuLimits', 1, 'admin', '', '', 2, 9, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 107__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/pdf.php?leftmenu=setup', 'PDF', 1, 'admin', '', '', 2, 10, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 109__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/mails.php?leftmenu=setup', 'Emails', 1, 'admin', '', '', 2, 11, __ENTITY__); @@ -39,32 +37,32 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left -- Home - Sytem info insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$user->admin', __HANDLER__, 'left', 300__+MAX_llx_menu__, 'home', 'admintools', 1__+MAX_llx_menu__, '/admin/tools/index.php?leftmenu=admintools', 'SystemTools', 0, 'admin', '', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 201__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/dolibarr.php?leftmenu=admintools', 'InfoDolibarr', 1, 'admin', '', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 208__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/system/modules.php?leftmenu=admintools', 'Modules', 2, 'admin', '', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 207__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/triggers.php?leftmenu=admintools', 'Triggers', 2, 'admin', '', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 202__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/system/modules.php?leftmenu=admintools', 'Modules', 2, 'admin', '', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 203__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/triggers.php?leftmenu=admintools', 'Triggers', 2, 'admin', '', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 204__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/browser.php?leftmenu=admintools', 'InfoBrowser', 1, 'admin', '', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 204__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/os.php?leftmenu=admintools', 'InfoOS', 1, 'admin', '', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 205__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/web.php?leftmenu=admintools', 'InfoWebServer', 1, 'admin', '', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 206__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/phpinfo.php?leftmenu=admintools', 'InfoPHP', 1, 'admin', '', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 205__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/os.php?leftmenu=admintools', 'InfoOS', 1, 'admin', '', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 206__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/web.php?leftmenu=admintools', 'InfoWebServer', 1, 'admin', '', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 207__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/phpinfo.php?leftmenu=admintools', 'InfoPHP', 1, 'admin', '', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 210__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/database.php?leftmenu=admintools', 'InfoDatabase', 1, 'admin', '', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 301__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/dolibarr_export.php?leftmenu=admintools', 'Backup', 1, 'admin', '', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 302__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/dolibarr_import.php?leftmenu=admintools', 'Restore', 1, 'admin', '', '', 2, 7, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 305__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/update.php?leftmenu=admintools', 'MenuUpgrade', 1, 'admin', '', '', 2, 8, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools" && function_exists("eaccelerator_info")', __HANDLER__, 'left', 304__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/eaccelerator.php?leftmenu=admintools', 'EAccelerator', 1, 'admin', '', '', 2, 9, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 306__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/listevents.php?leftmenu=admintools', 'Audit', 1, 'admin', '', '', 2, 10, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools" && function_exists("eaccelerator_info")', __HANDLER__, 'left', 306__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/eaccelerator.php?leftmenu=admintools', 'EAccelerator', 1, 'admin', '', '', 2, 9, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 307__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/listevents.php?leftmenu=admintools', 'Audit', 1, 'admin', '', '', 2, 10, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 308__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/listsessions.php?leftmenu=admintools', 'Sessions', 1, 'admin', '', '', 2, 11, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 303__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/purge.php?leftmenu=admintools', 'Purge', 1, 'admin', '', '', 2, 12, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 307__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/support/index.php?leftmenu=admintools', 'HelpCenter', 1, 'help', '', '_blank', 2, 13, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 203__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/about.php?leftmenu=admintools', 'About', 1, 'admin', '', '', 2, 14, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 309__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/purge.php?leftmenu=admintools', 'Purge', 1, 'admin', '', '', 2, 12, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 310__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/support/index.php?leftmenu=admintools', 'HelpCenter', 1, 'help', '', '_blank', 2, 13, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 311__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/about.php?leftmenu=admintools', 'About', 1, 'admin', '', '', 2, 14, __ENTITY__); -- Home - Menu users and groups insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 400__+MAX_llx_menu__, 'home', 'users', 1__+MAX_llx_menu__, '/user/home.php?leftmenu=users', 'MenuUsersAndGroups', 0, 'users', '', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 401__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/index.php?leftmenu=users', 'Users', 1, 'users', '$user->rights->user->user->lire || $user->admin', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 402__+MAX_llx_menu__, 'home', '', 401__+MAX_llx_menu__, '/user/fiche.php?leftmenu=users&action=create', 'NewUser', 2, 'users', '$user->rights->user->user->creer || $user->admin', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 402__+MAX_llx_menu__, 'home', '', 401__+MAX_llx_menu__, '/user/card.php?leftmenu=users&action=create', 'NewUser', 2, 'users', '$user->rights->user->user->creer || $user->admin', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 403__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/group/index.php?leftmenu=users', 'Groups', 1, 'users', '($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 404__+MAX_llx_menu__, 'home', '', 403__+MAX_llx_menu__, '/user/group/fiche.php?leftmenu=users&action=create', 'NewGroup', 2, 'users', '($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 404__+MAX_llx_menu__, 'home', '', 403__+MAX_llx_menu__, '/user/group/card.php?leftmenu=users&action=create', 'NewGroup', 2, 'users', '($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin', '', 2, 0, __ENTITY__); -- Third parties insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?leftmenu=thirdparties', 'ThirdParty', 0, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/soc.php?action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/fourn/liste.php?leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/fourn/list.php?leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/soc.php?leftmenu=supplier&action=create&type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/comm/prospect/list.php?leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 507__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/societe/soc.php?leftmenu=prospects&action=create&type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); @@ -72,7 +70,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 510__+MAX_llx_menu__, 'companies', '', 509__+MAX_llx_menu__, '/societe/soc.php?leftmenu=customers&action=create&type=c', 'MenuNewCustomer', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); -- Third parties - Contacts insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 600__+MAX_llx_menu__, 'companies', 'contacts', 2__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts', 'ContactsAddresses', 0, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 601__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/fiche.php?leftmenu=contacts&action=create', 'NewContactAddress', 1, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 601__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/card.php?leftmenu=contacts&action=create', 'NewContactAddress', 1, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 602__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 604__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts&type=p', 'ThirdPartyProspects', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 605__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts&type=c', 'ThirdPartyCustomers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 2, __ENTITY__); @@ -80,39 +78,39 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 607__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts&type=o', 'Others', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 4, __ENTITY__); -- Third parties - Category customer insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 650__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=1', 'SuppliersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 651__+MAX_llx_menu__, 'companies', '', 650__+MAX_llx_menu__, '/categories/fiche.php?action=create&type=1', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 651__+MAX_llx_menu__, 'companies', '', 650__+MAX_llx_menu__, '/categories/card.php?action=create&type=1', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); -- Third parties - Category supplier insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 660__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=2', 'CustomersProspectsCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 661__+MAX_llx_menu__, 'companies', '', 660__+MAX_llx_menu__, '/categories/fiche.php?action=create&type=2', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 661__+MAX_llx_menu__, 'companies', '', 660__+MAX_llx_menu__, '/categories/card.php?action=create&type=2', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); -- Third parties - Category contact insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 670__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=4', 'ContactCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 671__+MAX_llx_menu__, 'companies', '', 670__+MAX_llx_menu__, '/categories/fiche.php?action=create&type=4', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 671__+MAX_llx_menu__, 'companies', '', 670__+MAX_llx_menu__, '/categories/card.php?action=create&type=4', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); -- Product - Product insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2800__+MAX_llx_menu__, 'products', 'product', 3__+MAX_llx_menu__, '/product/index.php?leftmenu=product&type=0', 'Products', 0, 'products', '$user->rights->produit->lire', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2801__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/fiche.php?leftmenu=product&action=create&type=0', 'NewProduct', 1, 'products', '$user->rights->produit->creer', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2802__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/liste.php?leftmenu=product&type=0', 'List', 1, 'products', '$user->rights->produit->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2801__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/card.php?leftmenu=product&action=create&type=0', 'NewProduct', 1, 'products', '$user->rights->produit->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2802__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/list.php?leftmenu=product&type=0', 'List', 1, 'products', '$user->rights->produit->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2803__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassort.php?type=0', 'Stocks', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 2804__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/popuprop.php?leftmenu=stats&type=0', 'Statistics', 1, 'main', '$user->rights->produit->lire', '', 2, 5, __ENTITY__); -- Product - Services insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->service->enabled', __HANDLER__, 'left', 2900__+MAX_llx_menu__, 'products', 'service', 3__+MAX_llx_menu__, '/product/index.php?leftmenu=service&type=1', 'Services', 0, 'products', '$user->rights->service->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->service->enabled', __HANDLER__, 'left', 2901__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/fiche.php?leftmenu=service&action=create&type=1', 'NewService', 1, 'products', '$user->rights->service->creer', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->service->enabled', __HANDLER__, 'left', 2902__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/liste.php?leftmenu=service&type=1', 'List', 1, 'products', '$user->rights->service->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->service->enabled', __HANDLER__, 'left', 2901__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/card.php?leftmenu=service&action=create&type=1', 'NewService', 1, 'products', '$user->rights->service->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->service->enabled', __HANDLER__, 'left', 2902__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/list.php?leftmenu=service&type=1', 'List', 1, 'products', '$user->rights->service->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 2903__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/popuprop.php?leftmenu=stats&type=1', 'Statistics', 1, 'main', '$user->rights->service->lire', '', 2, 5, __ENTITY__); -- Product - Stocks insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3100__+MAX_llx_menu__, 'products', 'stock', 3__+MAX_llx_menu__, '/product/stock/index.php?leftmenu=stock', 'Stock', 0, 'stocks', '$user->rights->stock->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3101__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/fiche.php?action=create', 'MenuNewWarehouse', 1, 'stocks', '$user->rights->stock->creer', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3102__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/liste.php', 'List', 1, 'stocks', '$user->rights->stock->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3101__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/card.php?action=create', 'MenuNewWarehouse', 1, 'stocks', '$user->rights->stock->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3102__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/list.php', 'List', 1, 'stocks', '$user->rights->stock->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3104__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/mouvement.php', 'Movements', 1, 'stocks', '$user->rights->stock->mouvement->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3105__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/replenish.php', 'Replenishments', 1, 'stocks', '$user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php', 'StockTransfer', 1, 'stocks', '$user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); -- Product - Categories insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3200__+MAX_llx_menu__, 'products', 'cat', 3__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=0', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3201__+MAX_llx_menu__, 'products', '', 3200__+MAX_llx_menu__, '/categories/fiche.php?action=create&type=0', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3201__+MAX_llx_menu__, 'products', '', 3200__+MAX_llx_menu__, '/categories/card.php?action=create&type=0', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); -- Product - Shipment insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->expedition->enabled', __HANDLER__, 'left', 1300__+MAX_llx_menu__, 'commercial', 'sendings', 3__+MAX_llx_menu__, '/expedition/index.php?leftmenu=sendings', 'Shipments', 0, 'sendings', '$user->rights->expedition->lire', '', 2, 6, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->expedition->enabled && $leftmenu=="sendings"', __HANDLER__, 'left', 1301__+MAX_llx_menu__, 'commercial', '', 1300__+MAX_llx_menu__, '/expedition/fiche.php?action=create2&leftmenu=sendings', 'NewSending', 1, 'sendings', '$user->rights->expedition->creer', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->expedition->enabled && $leftmenu=="sendings"', __HANDLER__, 'left', 1302__+MAX_llx_menu__, 'commercial', '', 1300__+MAX_llx_menu__, '/expedition/liste.php?leftmenu=sendings', 'List', 1, 'sendings', '$user->rights->expedition->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->expedition->enabled && $leftmenu=="sendings"', __HANDLER__, 'left', 1301__+MAX_llx_menu__, 'commercial', '', 1300__+MAX_llx_menu__, '/expedition/card.php?action=create2&leftmenu=sendings', 'NewSending', 1, 'sendings', '$user->rights->expedition->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->expedition->enabled && $leftmenu=="sendings"', __HANDLER__, 'left', 1302__+MAX_llx_menu__, 'commercial', '', 1300__+MAX_llx_menu__, '/expedition/list.php?leftmenu=sendings', 'List', 1, 'sendings', '$user->rights->expedition->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->expedition->enabled && $leftmenu=="sendings"', __HANDLER__, 'left', 1303__+MAX_llx_menu__, 'commercial', '', 1300__+MAX_llx_menu__, '/expedition/stats/index.php?leftmenu=sendings', 'Statistics', 1, 'sendings', '$user->rights->expedition->lire', '', 2, 2, __ENTITY__); -- Commercial - Proposals @@ -127,24 +125,24 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 1110__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/stats/index.php?leftmenu=propals', 'Statistics', 1, 'propal', '$user->rights->propale->lire', '', 2, 4, __ENTITY__); -- Commercial - Customer's orders insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1200__+MAX_llx_menu__, 'commercial', 'orders', 5__+MAX_llx_menu__, '/commande/index.php?leftmenu=orders', 'CustomersOrders', 0, 'orders', '$user->rights->commande->lire', '', 2, 5, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1201__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/fiche.php?action=create&leftmenu=orders', 'NewOrder', 1, 'orders', '$user->rights->commande->creer', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1202__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/liste.php?leftmenu=orders', 'List', 1, 'orders', '$user->rights->commande->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1203__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/liste.php?leftmenu=orders&viewstatut=0', 'StatusOrderDraftShort', 1, 'orders', '$user->rights->commande->lire', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1204__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/liste.php?leftmenu=orders&viewstatut=1', 'StatusOrderValidated', 1, 'orders', '$user->rights->commande->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1205__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/liste.php?leftmenu=orders&viewstatut=2', 'StatusOrderOnProcessShort', 1, 'orders', '$user->rights->commande->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1206__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/liste.php?leftmenu=orders&viewstatut=3', 'StatusOrderToBill', 1, 'orders', '$user->rights->commande->lire', '', 2, 5, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1207__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/liste.php?leftmenu=orders&viewstatut=4', 'StatusOrderProcessed', 1, 'orders', '$user->rights->commande->lire', '', 2, 6, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1208__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/liste.php?leftmenu=orders&viewstatut=-1', 'StatusOrderCanceledShort', 1, 'orders', '$user->rights->commande->lire', '', 2, 7, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1201__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/card.php?action=create&leftmenu=orders', 'NewOrder', 1, 'orders', '$user->rights->commande->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1202__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/list.php?leftmenu=orders', 'List', 1, 'orders', '$user->rights->commande->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1203__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?leftmenu=orders&viewstatut=0', 'StatusOrderDraftShort', 1, 'orders', '$user->rights->commande->lire', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1204__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?leftmenu=orders&viewstatut=1', 'StatusOrderValidated', 1, 'orders', '$user->rights->commande->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1205__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?leftmenu=orders&viewstatut=2', 'StatusOrderOnProcessShort', 1, 'orders', '$user->rights->commande->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1206__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?leftmenu=orders&viewstatut=3', 'StatusOrderToBill', 1, 'orders', '$user->rights->commande->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1207__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?leftmenu=orders&viewstatut=4', 'StatusOrderProcessed', 1, 'orders', '$user->rights->commande->lire', '', 2, 6, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1208__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?leftmenu=orders&viewstatut=-1', 'StatusOrderCanceledShort', 1, 'orders', '$user->rights->commande->lire', '', 2, 7, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1209__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/stats/index.php?leftmenu=orders', 'Statistics', 1, 'orders', '$user->rights->commande->lire', '', 2, 4, __ENTITY__); -- Commercial - Supplier's orders insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled', __HANDLER__, 'left', 5100__+MAX_llx_menu__, 'commercial', 'orders_suppliers', 5__+MAX_llx_menu__, '/fourn/commande/index.php?leftmenu=orders_suppliers', 'SuppliersOrders', 0, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 6, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled', __HANDLER__, 'left', 5101__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/fourn/commande/fiche.php?action=create&leftmenu=orders_suppliers', 'NewOrder', 1, 'orders', '$user->rights->fournisseur->commande->creer', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled', __HANDLER__, 'left', 5102__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/fourn/commande/liste.php?leftmenu=orders_suppliers&viewstatut=0', 'List', 1, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled', __HANDLER__, 'left', 5101__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/fourn/commande/card.php?action=create&leftmenu=orders_suppliers', 'NewOrder', 1, 'orders', '$user->rights->fournisseur->commande->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled', __HANDLER__, 'left', 5102__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/fourn/commande/list.php?leftmenu=orders_suppliers&viewstatut=0', 'List', 1, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled', __HANDLER__, 'left', 5108__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/commande/stats/index.php?leftmenu=orders_suppliers&mode=supplier', 'Statistics', 1, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 7, __ENTITY__); -- Commercial - Contracts insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1400__+MAX_llx_menu__, 'commercial', 'contracts', 5__+MAX_llx_menu__, '/contrat/index.php?leftmenu=contracts', 'Contracts', 0, 'contracts', '$user->rights->contrat->lire', '', 2, 7, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1401__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/fiche.php?&action=create&leftmenu=contracts', 'NewContract', 1, 'contracts', '$user->rights->contrat->creer', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1402__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/liste.php?leftmenu=contracts', 'List', 1, 'contracts', '$user->rights->contrat->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1401__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/card.php?&action=create&leftmenu=contracts', 'NewContract', 1, 'contracts', '$user->rights->contrat->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1402__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/list.php?leftmenu=contracts', 'List', 1, 'contracts', '$user->rights->contrat->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1403__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts', 'MenuServices', 1, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled&&$leftmenu=="contracts"', __HANDLER__, 'left', 1404__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=0', 'MenuInactiveServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled&&$leftmenu=="contracts"', __HANDLER__, 'left', 1405__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=4', 'MenuRunningServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 1, __ENTITY__); @@ -152,11 +150,11 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled&&$leftmenu=="contracts"', __HANDLER__, 'left', 1407__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=5', 'MenuClosedServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 3, __ENTITY__); -- Commercial - Interventions insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1500__+MAX_llx_menu__, 'commercial', 'ficheinter', 5__+MAX_llx_menu__, '/fichinter/list.php?leftmenu=ficheinter', 'Interventions', 0, 'interventions', '$user->rights->ficheinter->lire', '', 2, 8, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1501__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/fiche.php?action=create&leftmenu=ficheinter', 'NewIntervention', 1, 'interventions', '$user->rights->ficheinter->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1501__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/card.php?action=create&leftmenu=ficheinter', 'NewIntervention', 1, 'interventions', '$user->rights->ficheinter->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1502__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/list.php?leftmenu=ficheinter', 'List', 1, 'interventions', '$user->rights->ficheinter->lire', '', 2, 1, __ENTITY__); -- Accountancy - Supplier invoice insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled', __HANDLER__, 'left', 1600__+MAX_llx_menu__, 'accountancy', 'supplier_bills', 6__+MAX_llx_menu__, '/fourn/facture/list.php?leftmenu=suppliers_bills', 'BillsSuppliers', 0, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled', __HANDLER__, 'left', 1601__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/fiche.php?action=create&leftmenu=suppliers_bills', 'NewBill', 1, 'bills', '$user->rights->fournisseur->facture->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled', __HANDLER__, 'left', 1601__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/card.php?action=create&leftmenu=suppliers_bills', 'NewBill', 1, 'bills', '$user->rights->fournisseur->facture->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled', __HANDLER__, 'left', 1602__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/impayees.php?leftmenu=suppliers_bills', 'Unpaid', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled', __HANDLER__, 'left', 1603__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/paiement.php?leftmenu=suppliers_bills', 'Payments', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled', __HANDLER__, 'left', 1604__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills&mode=supplier', 'Statistics', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 8, __ENTITY__); @@ -165,75 +163,80 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1701__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture.php?action=create&leftmenu=customers_bills', 'NewBill', 1, 'bills', '$user->rights->facture->creer', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1702__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/fiche-rec.php?leftmenu=customers_bills', 'Repeatable', 1, 'bills', '$user->rights->facture->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1703__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/impayees.php?action=facturer&leftmenu=customers_bills', 'Unpaid', 1, 'bills', '$user->rights->facture->lire', '', 2, 5, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1704__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/paiement/liste.php?leftmenu=customers_bills', 'Payments', 1, 'bills', '$user->rights->facture->lire', '', 2, 6, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1704__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/paiement/list.php?leftmenu=customers_bills', 'Payments', 1, 'bills', '$user->rights->facture->lire', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'accountancy', '', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?leftmenu=customers_bills', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__); -- Accountancy - Orders to bill -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'accountancy', 'orders', 6__+MAX_llx_menu__, '/commande/liste.php?leftmenu=orders&viewstatut=3', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'accountancy', 'orders', 6__+MAX_llx_menu__, '/commande/list.php?leftmenu=orders&viewstatut=3', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__); -- Donations insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled', __HANDLER__, 'left', 2000__+MAX_llx_menu__, 'accountancy', 'donations', 6__+MAX_llx_menu__, '/compta/dons/index.php?leftmenu=donations&mainmenu=accountancy', 'Donations', 0, 'donations', '$user->rights->don->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2001__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/fiche.php?leftmenu=donations&mainmenu=accountancy&action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2002__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/liste.php?leftmenu=donations&mainmenu=accountancy', 'List', 1, 'donations', '$user->rights->don->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2001__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/card.php?leftmenu=donations&mainmenu=accountancy&action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2002__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/list.php?leftmenu=donations&mainmenu=accountancy', 'List', 1, 'donations', '$user->rights->don->lire', '', 2, 1, __ENTITY__); --insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/stats.php?leftmenu=donations&mainmenu=accountancy', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__); -- Special expenses insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled || $conf->salaries->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'accountancy', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy', 'MenuSpecialExpenses', 0, 'compta', '(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read)', '', 0, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled', __HANDLER__, 'left', 2210__+MAX_llx_menu__, 'accountancy', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy', 'Salaries', 1, 'salaries', '$user->rights->salaries->read', '', 0, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2211__+MAX_llx_menu__, 'accountancy', '', 2210__+MAX_llx_menu__, '/compta/salaries/fiche.php?leftmenu=tax_salary&action=create', 'NewPayment', 2, 'companies', '$user->rights->salaries->write', '', 0, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2211__+MAX_llx_menu__, 'accountancy', '', 2210__+MAX_llx_menu__, '/compta/salaries/card.php?leftmenu=tax_salary&action=create', 'NewPayment', 2, 'companies', '$user->rights->salaries->write', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2212__+MAX_llx_menu__, 'accountancy', '', 2210__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary', 'Payments', 2, 'companies', '$user->rights->salaries->read', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2250__+MAX_llx_menu__, 'accountancy', 'tax_social', 2200__+MAX_llx_menu__, '/compta/sociales/index.php?leftmenu=tax_social', 'SocialContributions', 1, '', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2251__+MAX_llx_menu__, 'accountancy', '', 2250__+MAX_llx_menu__, '/compta/sociales/charges.php?leftmenu=tax_social&action=create', 'MenuNewSocialContribution', 2, '', '$user->rights->tax->charges->creer', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2252__+MAX_llx_menu__, 'accountancy', '', 2250__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax_social&mainmenu=accountancy&mode=sconly', 'Payments', 2, '', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS)', __HANDLER__, 'left', 2300__+MAX_llx_menu__, 'accountancy', 'tax_vat', 2200__+MAX_llx_menu__, '/compta/tva/index.php?leftmenu=tax_vat&mainmenu=accountancy', 'VAT', 1, 'companies', '$user->rights->tax->charges->lire', '', 0, 7, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2301__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/fiche.php?leftmenu=tax_vat&action=create', 'NewPayment', 2, 'companies', '$user->rights->tax->charges->creer', '', 0, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2301__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/card.php?leftmenu=tax_vat&action=create', 'NewPayment', 2, 'companies', '$user->rights->tax->charges->creer', '', 0, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2302__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/reglement.php?leftmenu=tax_vat', 'Payments', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2303__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/clients.php?leftmenu=tax_vat', 'ReportByCustomers', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2304__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/quadri_detail.php?leftmenu=tax_vat', 'ReportByQuarter', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__); -- Ventilation (accounting) -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'ventil', 6__+MAX_llx_menu__, '/compta/ventilation/index.php?leftmenu=ventil', 'Ventilation', 0, 'companies', '$user->rights->compta->ventilation->lire', '', 0, 8, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '/compta/ventilation/liste.php', 'ToDispatch', 1, 'companies', '$user->rights->compta->ventilation->lire', '', 0, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '/compta/ventilation/lignes.php', 'Dispatched', 1, 'companies', '$user->rights->compta->ventilation->lire', '', 0, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION', __HANDLER__, 'left', 2403__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '/compta/param/', 'Setup', 1, 'companies', '$user->rights->compta->ventilation->parametrer', '', 0, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION', __HANDLER__, 'left', 2404__+MAX_llx_menu__, 'accountancy', '', 2403__+MAX_llx_menu__, '/compta/param/comptes/liste.php', 'List', 2, 'companies', '$user->rights->compta->ventilation->parametrer', '', 0, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION', __HANDLER__, 'left', 2405__+MAX_llx_menu__, 'accountancy', '', 2403__+MAX_llx_menu__, '/compta/param/comptes/fiche.php?action=create', 'New', 2, 'companies', '$user->rights->compta->ventilation->parametrer', '', 0, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION', __HANDLER__, 'left', 2406__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '/compta/export/', 'Export', 1, 'companies', '$user->rights->compta->ventilation->lire', '', 0, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION', __HANDLER__, 'left', 2407__+MAX_llx_menu__, 'accountancy', '', 2406__+MAX_llx_menu__, '/compta/export/index.php', 'New', 2, 'companies', '$user->rights->compta->ventilation->lire', '', 0, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION', __HANDLER__, 'left', 2408__+MAX_llx_menu__, 'accountancy', '', 2406__+MAX_llx_menu__, '/compta/export/liste.php', 'List', 2, 'companies', '$user->rights->compta->ventilation->lire', '', 0, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'ventil_customer', 6__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=ventil_customer', 'CustomersVentilation', 0, 'accountancy', '$user->rights->accounting->ventilation->read', '', 0, 8, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="ventil_customer"', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '/accountancy/customer/list.php', 'ToDispatch', 1, 'accountancy', '$user->rights->accounting->ventilation->dispatch', '', 0, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="ventil_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '/accountancy/customer/lines.php', 'Dispatched', 1, 'accountancy', '$user->rights->accounting->ventilation->read', '', 0, 1, __ENTITY__); + +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 2410__+MAX_llx_menu__, 'accountancy', 'ventil_supplier', 6__+MAX_llx_menu__, '/accountancy/supplier/index.php?leftmenu=ventil_supplier', 'SuppliersVentilation', 0, 'accountancy', '$user->rights->accounting->ventilation->read', '', 0, 9, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu=="ventil_supplier"', __HANDLER__, 'left', 2411__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/list.php', 'ToDispatch', 1, 'accountancy', '$user->rights->accounting->ventilation->dispatch', '', 0, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu=="ventil_supplier"', __HANDLER__, 'left', 2412__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/lines.php', 'Dispatched', 1, 'accountancy', '$user->rights->accounting->ventilation->read', '', 0, 1, __ENTITY__); -- Rapports insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2700__+MAX_llx_menu__, 'accountancy', 'ca', 6__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca&mainmenu=accountancy', 'Reportings', 0, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 11, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2701__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca', 'ReportInOut', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2702__+MAX_llx_menu__, 'accountancy', '', 2701__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2703__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/stats/index.php?leftmenu=ca', 'ReportTurnover', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2704__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/casoc.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2705__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyuser.php?leftmenu=ca', 'ByUsers', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2708__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?leftmenu=ca', 'ByProductsAndServices', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2706__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/journal/sellsjournal.php?leftmenu=ca', 'SellsJournal', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2707__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/journal/purchasesjournal.php?leftmenu=ca', 'PurchasesJournal', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2701__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca', 'ReportInOut', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2702__+MAX_llx_menu__, 'accountancy', '', 2701__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2703__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/stats/index.php?leftmenu=ca', 'ReportTurnover', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2704__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/casoc.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2705__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyuser.php?leftmenu=ca', 'ByUsers', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2708__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?leftmenu=ca', 'ByProductsAndServices', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2706__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/journal/sellsjournal.php?leftmenu=ca', 'SellsJournal', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2707__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/journal/purchasesjournal.php?leftmenu=ca', 'PurchasesJournal', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); +-- Book Keeping +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2720__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 6__+MAX_llx_menu__, '/accountancy/bookkeeping/list.php?leftmenu=bookkeeping', 'Bookkeeping', 0, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 12, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="bookkeeping"', __HANDLER__, 'left', 2721__+MAX_llx_menu__, 'accountancy', '', 2720__+MAX_llx_menu__, '/accountancy/bookkeeping/listbyyear.php', 'ByYear', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="bookkeeping"', __HANDLER__, 'left', 2722__+MAX_llx_menu__, 'accountancy', '', 2720__+MAX_llx_menu__, '/accountancy/bookkeeping/balancebymonth.php', 'AccountBalanceByMonth', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 1, __ENTITY__); +-- Fiscal year & Chart of accounts +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled"', __HANDLER__, 'left', 2750__+MAX_llx_menu__, 'home', '', 6__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?leftmenu=setup', 'Fiscalyear', 1, 'main', '$user->rights->accounting->fiscalyear', '', 2, 20, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled"', __HANDLER__, 'left', 2751__+MAX_llx_menu__, 'home', '', 6__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy', 'Chartofaccounts', 1, 'main', '$user->rights->accounting->chartofaccount', '', 2, 21, __ENTITY__); -- Check deposit insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '! empty($conf->banque->enabled) && (! empty($conf->facture->enabled)) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON)', __HANDLER__, 'left', 1711__+MAX_llx_menu__, 'accountancy', 'checks', 14__+MAX_llx_menu__, '/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank', 'MenuChequeDeposits', 0, 'bills', '$user->rights->banque->lire', '', 2, 9, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '! empty($conf->banque->enabled) && (! empty($conf->facture->enabled)) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON)', __HANDLER__, 'left', 1712__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/fiche.php?leftmenu=checks&action=new', 'NewCheckDeposit', 1, 'compta', '$user->rights->banque->lire', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '! empty($conf->banque->enabled) && (! empty($conf->facture->enabled)) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON)', __HANDLER__, 'left', 1713__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/liste.php?leftmenu=checks', 'List', 1, 'bills', '$user->rights->banque->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '! empty($conf->banque->enabled) && (! empty($conf->facture->enabled)) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON)', __HANDLER__, 'left', 1712__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/card.php?leftmenu=checks&action=new', 'NewCheckDeposit', 1, 'compta', '$user->rights->banque->lire', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '! empty($conf->banque->enabled) && (! empty($conf->facture->enabled)) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON)', __HANDLER__, 'left', 1713__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/list.php?leftmenu=checks', 'List', 1, 'bills', '$user->rights->banque->lire', '', 2, 1, __ENTITY__); -- Withdrawal insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled', __HANDLER__, 'left', 2500__+MAX_llx_menu__, 'accountancy', 'withdraw', 14__+MAX_llx_menu__, '/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank', 'StandingOrders', 0, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 9, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2502__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/create.php?leftmenu=withdraw', 'NewStandingOrder', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2503__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/bons.php?leftmenu=withdraw', 'WithdrawalsReceipts', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2504__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/liste.php?leftmenu=withdraw', 'WithdrawalsLines', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2504__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/list.php?leftmenu=withdraw', 'WithdrawalsLines', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2506__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/rejets.php?leftmenu=withdraw', 'Rejects', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2507__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/stats.php?leftmenu=withdraw', 'Statistics', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 6, __ENTITY__); -- Bank insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled', __HANDLER__, 'left', 2600__+MAX_llx_menu__, 'accountancy', 'bank', 14__+MAX_llx_menu__, '/compta/bank/index.php?leftmenu=bank&mainmenu=bank', 'MenuBankCash', 0, 'banks', '$user->rights->banque->lire', '', 0, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2601__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/fiche.php?action=create&leftmenu=bank', 'MenuNewFinancialAccount', 1, 'banks', '$user->rights->banque->configurer', '', 0, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2601__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/card.php?action=create&leftmenu=bank', 'MenuNewFinancialAccount', 1, 'banks', '$user->rights->banque->configurer', '', 0, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2602__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/categ.php?leftmenu=bank', 'Rubriques', 1, 'categories', '$user->rights->banque->configurer', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2603__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/search.php?leftmenu=bank', 'ListTransactions', 1, 'banks', '$user->rights->banque->lire', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2604__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/budget.php?leftmenu=bank', 'ListTransactionsByCategory', 1, 'banks', '$user->rights->banque->lire', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2606__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/virement.php?leftmenu=bank', 'BankTransfers', 1, 'banks', '$user->rights->banque->transfer', '', 0, 5, __ENTITY__); -- Project insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3600__+MAX_llx_menu__, 'project', 'projects', 7__+MAX_llx_menu__, '/projet/index.php?leftmenu=projects', 'Projects', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3601__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/fiche.php?leftmenu=projects&action=create', 'NewProject', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3602__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/liste.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3601__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/card.php?leftmenu=projects&action=create', 'NewProject', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3602__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/list.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3610__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/index.php?leftmenu=projects&mode=mine', 'MyProjects', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3611__+MAX_llx_menu__, 'project', '', 3610__+MAX_llx_menu__, '/projet/fiche.php?leftmenu=projects&action=create&mode=mine', 'NewProject', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3612__+MAX_llx_menu__, 'project', '', 3610__+MAX_llx_menu__, '/projet/liste.php?leftmenu=projects&mode=mine', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3610__+MAX_llx_menu__, 'project', 'myprojects', 7__+MAX_llx_menu__, '/projet/index.php?leftmenu=projects&mode=mine', 'MyProjects', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3611__+MAX_llx_menu__, 'project', '', 3610__+MAX_llx_menu__, '/projet/card.php?leftmenu=projects&action=create&mode=mine', 'NewProject', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3612__+MAX_llx_menu__, 'project', '', 3610__+MAX_llx_menu__, '/projet/list.php?leftmenu=projects&mode=mine', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3700__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects', 'Activities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); @@ -244,27 +247,27 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3801__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&action=create&mode=mine', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3802__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks/index.php?leftmenu=projects&mode=mine', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3803__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/activity/list.php?leftmenu=projects&mode=mine', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__); - +-- Tools insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3901__+MAX_llx_menu__, 'tools', '', 3900__+MAX_llx_menu__, '/comm/mailing/fiche.php?leftmenu=mailing&action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3902__+MAX_llx_menu__, 'tools', '', 3900__+MAX_llx_menu__, '/comm/mailing/liste.php?leftmenu=mailing', 'List', 1, 'mails', '$user->rights->mailing->lire', '', 0, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3901__+MAX_llx_menu__, 'tools', '', 3900__+MAX_llx_menu__, '/comm/mailing/card.php?leftmenu=mailing&action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3902__+MAX_llx_menu__, 'tools', '', 3900__+MAX_llx_menu__, '/comm/mailing/list.php?leftmenu=mailing', 'List', 1, 'mails', '$user->rights->mailing->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->export->enabled', __HANDLER__, 'left', 4100__+MAX_llx_menu__, 'tools', 'export', 8__+MAX_llx_menu__, '/exports/index.php?leftmenu=export', 'FormatedExport', 0, 'exports', '$user->rights->export->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->export->enabled', __HANDLER__, 'left', 4101__+MAX_llx_menu__, 'tools', '', 4100__+MAX_llx_menu__, '/exports/export.php?leftmenu=export', 'NewExport', 1, 'exports', '$user->rights->export->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->import->enabled', __HANDLER__, 'left', 4130__+MAX_llx_menu__, 'tools', 'import', 8__+MAX_llx_menu__, '/imports/index.php?leftmenu=import', 'FormatedImport', 0, 'exports', '$user->rights->import->run', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->import->enabled', __HANDLER__, 'left', 4131__+MAX_llx_menu__, 'tools', '', 4130__+MAX_llx_menu__, '/imports/import.php?leftmenu=import', 'NewImport', 1, 'exports', '$user->rights->import->run', '', 2, 0, __ENTITY__); -- Members insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4200__+MAX_llx_menu__, 'members', 'members', 13__+MAX_llx_menu__, '/adherents/index.php?leftmenu=members&mainmenu=members', 'Members', 0, 'members', '$user->rights->adherent->lire', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4201__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/fiche.php?leftmenu=members&action=create', 'NewMember', 1, 'members', '$user->rights->adherent->creer', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4202__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/liste.php', 'List', 1, 'members', '$user->rights->adherent->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4203__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/liste.php?leftmenu=members&statut=-1', 'MenuMembersToValidate', 2, 'members', '$user->rights->adherent->lire', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4204__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/liste.php?leftmenu=members&statut=1', 'MenuMembersValidated', 2, 'members', '$user->rights->adherent->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4205__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/liste.php?leftmenu=members&statut=1&filter=outofdate', 'MenuMembersNotUpToDate', 2, 'members', '$user->rights->adherent->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4206__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/liste.php?leftmenu=members&statut=1&filter=uptodate', 'MenuMembersUpToDate', 2, 'members', '$user->rights->adherent->lire', '', 2, 5, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4207__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/liste.php?leftmenu=members&statut=0', 'MenuMembersResiliated', 2, 'members', '$user->rights->adherent->lire', '', 2, 6, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4201__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/card.php?leftmenu=members&action=create', 'NewMember', 1, 'members', '$user->rights->adherent->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4202__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/list.php', 'List', 1, 'members', '$user->rights->adherent->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4203__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/list.php?leftmenu=members&statut=-1', 'MenuMembersToValidate', 2, 'members', '$user->rights->adherent->lire', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4204__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/list.php?leftmenu=members&statut=1', 'MenuMembersValidated', 2, 'members', '$user->rights->adherent->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4205__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/list.php?leftmenu=members&statut=1&filter=outofdate', 'MenuMembersNotUpToDate', 2, 'members', '$user->rights->adherent->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4206__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/list.php?leftmenu=members&statut=1&filter=uptodate', 'MenuMembersUpToDate', 2, 'members', '$user->rights->adherent->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4207__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/list.php?leftmenu=members&statut=0', 'MenuMembersResiliated', 2, 'members', '$user->rights->adherent->lire', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4208__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/stats/geo.php?leftmenu=members&mode=memberbycountry', 'MenuMembersStats', 1, 'members', '$user->rights->adherent->lire', '', 2, 7, __ENTITY__); -- Members - Subscriptions insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4300__+MAX_llx_menu__, 'members', '', 13__+MAX_llx_menu__, '/adherents/index.php?leftmenu=members&mainmenu=members', 'Subscriptions', 0, 'compta', '$user->rights->adherent->cotisation->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4301__+MAX_llx_menu__, 'members', '', 4300__+MAX_llx_menu__, '/adherents/liste.php?statut=-1&leftmenu=accountancy&mainmenu=members', 'NewSubscription', 1, 'compta', '$user->rights->adherent->cotisation->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4301__+MAX_llx_menu__, 'members', '', 4300__+MAX_llx_menu__, '/adherents/list.php?statut=-1&leftmenu=accountancy&mainmenu=members', 'NewSubscription', 1, 'compta', '$user->rights->adherent->cotisation->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4302__+MAX_llx_menu__, 'members', '', 4300__+MAX_llx_menu__, '/adherents/cotisations.php?leftmenu=members', 'List', 1, 'compta', '$user->rights->adherent->cotisation->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4303__+MAX_llx_menu__, 'members', '', 4300__+MAX_llx_menu__, '/adherents/stats/index.php?leftmenu=members', 'MenuMembersStats', 1, 'members', '$user->rights->adherent->lire', '', 2, 7, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4500__+MAX_llx_menu__, 'members', 'export', 13__+MAX_llx_menu__, '/adherents/index.php?leftmenu=export&mainmenu=members', 'Exports', 0, 'members', '$user->rights->adherent->export', '', 2, 3, __ENTITY__); @@ -276,16 +279,16 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4702__+MAX_llx_menu__, 'members', '', 4700__+MAX_llx_menu__, '/adherents/type.php?leftmenu=setup&mainmenu=members', 'List', 1, 'members', '$user->rights->adherent->configurer', '', 2, 1, __ENTITY__); -- Members - Category member insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5200__+MAX_llx_menu__, 'members', 'cat', 13__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=3', 'MembersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5201__+MAX_llx_menu__, 'members', '', 5200__+MAX_llx_menu__, '/categories/fiche.php?action=create&type=3', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5201__+MAX_llx_menu__, 'members', '', 5200__+MAX_llx_menu__, '/categories/card.php?action=create&type=3', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); -- HRM - Holiday insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5000__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/holiday/index.php?&leftmenu=hrm', 'CPTitreMenu', 0, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5001__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/fiche.php?&action=request', 'MenuAddCP', 1, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5001__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/card.php?&action=request', 'MenuAddCP', 1, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5002__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/define_holiday.php?&action=request', 'MenuConfCP', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5003__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/view_log.php?&action=request', 'MenuLogCP', 1, 'holiday', '$user->rights->holiday->view_log', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5004__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/month_report.php?&action=request', 'MenuReportMonth', 1, 'holiday', '$user->rights->holiday->month_report', '', 0, 4, __ENTITY__); -- HRM - Trips and expenses insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2100__+MAX_llx_menu__, 'accountancy', 'tripsandexpenses', 15__+MAX_llx_menu__, '/compta/deplacement/index.php?leftmenu=tripsandexpenses', 'TripsAndExpenses', 0, 'trips', '$user->rights->deplacement->lire', '', 0, 5, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2101__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/fiche.php?action=create&leftmenu=tripsandexpenses', 'New', 1, 'trips', '$user->rights->deplacement->creer', '', 0, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2101__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/card.php?action=create&leftmenu=tripsandexpenses', 'New', 1, 'trips', '$user->rights->deplacement->creer', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2102__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/list.php?leftmenu=tripsandexpenses', 'List', 1, 'trips', '$user->rights->deplacement->lire', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2103__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses', 'Statistics', 1, 'trips', '$user->rights->deplacement->lire', '', 0, 2, __ENTITY__); diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index bf5de3c6a91..e0f1e1b05d9 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -31,8 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; * @param DoliDB $db Database handler * @param string $atarget Target * @param int $type_user 0=Menu for backoffice, 1=Menu for front office - * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) - * @param array &$menu Object Menu to return back list of menu entries + * @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @param array $menu Object Menu to return back list of menu entries * @param int $noout Disable output (Initialise &$menu only). * @return int 0 */ @@ -203,8 +203,8 @@ function print_end_menu_array_auguria() * @param DoliDB $db Database handler * @param array $menu_array_before Table of menu entries to show before entries of menu handler * @param array $menu_array_after Table of menu entries to show after entries of menu handler - * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) - * @param Menu &$menu Object Menu to return back list of menu entries + * @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @param Menu $menu Object Menu to return back list of menu entries * @param int $noout Disable output (Initialise &$menu only). * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all) @@ -231,7 +231,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM print ''; print ''; print ''; print ''; print '
    '."\n"; @@ -262,7 +262,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM while ($i < $numr) { $objp = $db->fetch_object($resql); - $newmenu->add('/compta/bank/fiche.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire); + $newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire); if ($objp->rappro && $objp->courant != 2 && empty($objp->clos)) // If not cash account and not closed and can be reconciliate { $newmenu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate); @@ -273,6 +273,42 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM else dol_print_error($db); $db->free($resql); } + + if (! empty($conf->accounting->enabled) && !empty($user->rights->accounting->mouvements->lire) && $mainmenu == 'accountancy') // Entry in accountancy journal for each bank account + { + $newmenu->add('/accountancy/journal/index.php?leftmenu=journal',$langs->trans("Journaux"),0,$user->rights->banque->lire); + + if ($leftmenu == 'journal') + { + $sql = "SELECT rowid, label, accountancy_journal"; + $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; + $sql.= " WHERE entity = ".$conf->entity; + $sql.= " AND clos = 0"; + $sql.= " ORDER BY label"; + + $resql = $db->query($sql); + if ($resql) + { + $numr = $db->num_rows($resql); + $i = 0; + + if ($numr > 0) + + while ($i < $numr) + { + $objp = $db->fetch_object($resql); + $newmenu->add('/accountancy/journal/bankjournal.php?id_account='.$objp->rowid,$langs->trans("Journal").' - '.$objp->label,1,$user->rights->accounting->comptarapport->lire); + $i++; + } + } + else dol_print_error($db); + $db->free($resql); + + // Add other journal + $newmenu->add("/accountancy/journal/sellsjournal.php?leftmenu=journal",$langs->trans("SellsJournal"),1,$user->rights->accounting->comptarapport->lire); + $newmenu->add("/accountancy/journal/purchasesjournal.php?leftmenu=journal",$langs->trans("PurchasesJournal"),1,$user->rights->accounting->comptarapport->lire); + } + } if ($conf->ftp->enabled && $mainmenu == 'ftp') // Entry for FTP { @@ -402,8 +438,8 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM * Function to test if an entry is enabled or not * * @param string $type_user 0=We need backoffice menu, 1=We need frontoffice menu - * @param array &$menuentry Array for menu entry - * @param array &$listofmodulesforexternal Array with list of modules allowed to external users + * @param array $menuentry Array for menu entry + * @param array $listofmodulesforexternal Array with list of modules allowed to external users * @return int 0=Hide, 1=Show, 2=Show gray */ function dol_auguria_showmenu($type_user, &$menuentry, &$listofmodulesforexternal) @@ -430,4 +466,3 @@ function dol_auguria_showmenu($type_user, &$menuentry, &$listofmodulesforexterna if (! $menuentry['perms']) return 2; // No permissions and user is external return 1; } - diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index ddb28c58648..88052f380c0 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -211,7 +211,6 @@ class MenuManager // We add sub entry print str_pad('',1).'
  • '; // ui-btn to highlight on clic print ''; - print str_pad('',12,' '); if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") print $langs->trans("Access"); // No translation else print $langs->trans(ucfirst($val['mainmenu'])."Dashboard"); print ''; @@ -228,7 +227,6 @@ class MenuManager if ($val2['level']==0) print str_pad('',$val2['level']+1).''; // ui-btn to highlight on clic else print str_pad('',$val2['level']+1).'
  • '; // ui-btn to highlight on clic if ($relurl2) print ''; - print str_pad('',($val2['level']+1)*12,' '); print $val2['titre']; if ($relurl2) print ''; print '
  • '."\n"; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 1d7aa1a5a9a..a2819ffb2c4 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -32,8 +32,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; * @param DoliDB $db Database handler * @param string $atarget Target (Example: '' or '_top') * @param int $type_user 0=Menu for backoffice, 1=Menu for front office - * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) - * @param array &$menu Object Menu to return back list of menu entries + * @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @param array $menu Object Menu to return back list of menu entries * @param int $noout Disable output (Initialise &$menu only). * @return int 0 */ @@ -236,26 +236,6 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) $menu->add('/core/tools.php?mainmenu=tools&leftmenu=', $langs->trans("Tools"), 0, $showmode, $atarget, "tools", ''); } - // OSCommerce 1 - $tmpentry=array('enabled'=>(! empty($conf->boutique->enabled)), - 'perms'=>1, - 'module'=>'boutique'); - $showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal); - if ($showmode) - { - $langs->load("shop"); - - $classname=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "shop") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; } - else $classname = 'class="tmenu"'; - $idsel='shop'; - - if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); - if (empty($noout)) print_text_menu_entry($langs->trans("OSCommerce"), $showmode, DOL_URL_ROOT.'/boutique/index.php?mainmenu=shop&leftmenu=', $id, $idsel, $classname, $atarget); - if (empty($noout)) print_end_menu_entry($showmode); - $menu->add('/boutique/index.php?mainmenu=shop&leftmenu=', $langs->trans("OSCommerce"), 0, $showmode, $atarget, "shop", ''); - } - // Members $tmpentry=array('enabled'=>(! empty($conf->adherent->enabled)), 'perms'=>(! empty($user->rights->adherent->lire)), @@ -374,7 +354,7 @@ function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname, if ($showmode == 1) { print ''; - print '
    '; + print '
    '; print '
    '; print ''; print ''; @@ -428,8 +408,8 @@ function print_end_menu_array() * @param DoliDB $db Database handler * @param array $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add) * @param array $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add) - * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) - * @param Menu &$menu Object Menu to return back list of menu entries + * @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @param Menu $menu Object Menu to return back list of menu entries * @param int $noout Disable output (Initialise &$menu only). * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all) @@ -456,7 +436,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu print ''; print ''; print ''; print ''; print '
    '."\n"; @@ -507,7 +487,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu } $newmenu->add("/admin/boxes.php?mainmenu=home", $langs->trans("Boxes"),1); $newmenu->add("/admin/delais.php?mainmenu=home",$langs->trans("Alerts"),1); - $newmenu->add("/admin/proxy.php?mainmenu=home", $langs->trans("Security"),1); + $newmenu->add("/admin/security_other.php?mainmenu=home", $langs->trans("Security"),1); $newmenu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"),1); $newmenu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"),1); $newmenu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails"),1); @@ -562,9 +542,9 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (empty($leftmenu) || $leftmenu=="users") { $newmenu->add("/user/index.php", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin); - $newmenu->add("/user/fiche.php?action=create", $langs->trans("NewUser"),2, $user->rights->user->user->creer || $user->admin); + $newmenu->add("/user/card.php?action=create", $langs->trans("NewUser"),2, $user->rights->user->user->creer || $user->admin); $newmenu->add("/user/group/index.php", $langs->trans("Groups"), 1, ($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin); - $newmenu->add("/user/group/fiche.php?action=create", $langs->trans("NewGroup"), 2, ($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin); + $newmenu->add("/user/group/card.php?action=create", $langs->trans("NewGroup"), 2, ($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin); } } @@ -617,15 +597,15 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->societe->enabled) && ! empty($conf->fournisseur->enabled)) { $langs->load("suppliers"); - $newmenu->add("/fourn/liste.php?leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers'); + $newmenu->add("/fourn/list.php?leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers'); $newmenu->add("/societe/soc.php?leftmenu=suppliers&action=create&type=f",$langs->trans("MenuNewSupplier"), 2, $user->rights->societe->creer && $user->rights->fournisseur->lire); - //$newmenu->add("/fourn/liste.php?leftmenu=suppliers", $langs->trans("List"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire); + //$newmenu->add("/fourn/list.php?leftmenu=suppliers", $langs->trans("List"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire); //$newmenu->add("/contact/list.php?leftmenu=suppliers&type=f",$langs->trans("Contacts"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire && $user->rights->societe->contact->lire); } // Contacts - $newmenu->add("/contact/list.php?leftmenu=contacts", (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")), 0, $user->rights->societe->contact->lire, '', $mainmenu, 'contacts'); - $newmenu->add("/contact/fiche.php?leftmenu=contacts&action=create", (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress")), 1, $user->rights->societe->contact->creer); + $newmenu->add("/societe/index.php?leftmenu=thirdparties", (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ThirdParty") : $langs->trans("ContactsAddresses")), 0, $user->rights->societe->contact->lire, '', $mainmenu, 'contacts'); + $newmenu->add("/contact/card.php?leftmenu=contacts&action=create", (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress")), 1, $user->rights->societe->contact->creer); $newmenu->add("/contact/list.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->contact->lire); if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $newmenu->add("/contact/list.php?leftmenu=contacts&type=p", $langs->trans("Prospects"), 2, $user->rights->societe->contact->lire); if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->rights->societe->contact->lire); @@ -641,18 +621,18 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { // Categories prospects/customers $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $langs->trans("CustomersProspectsCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - $newmenu->add("/categories/fiche.php?action=create&type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); + $newmenu->add("/categories/card.php?action=create&type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); } // Categories Contact $newmenu->add("/categories/index.php?leftmenu=cat&type=4", $langs->trans("ContactCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - $newmenu->add("/categories/fiche.php?action=create&type=4", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); + $newmenu->add("/categories/card.php?action=create&type=4", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); // Categories suppliers if (! empty($conf->fournisseur->enabled)) { $newmenu->add("/categories/index.php?leftmenu=cat&type=1", $langs->trans("SuppliersCategoriesShort"), 0, $user->rights->categorie->lire); - $newmenu->add("/categories/fiche.php?action=create&type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); + $newmenu->add("/categories/card.php?action=create&type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); } - //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); + //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire); } } @@ -685,14 +665,14 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("orders"); $newmenu->add("/commande/index.php?leftmenu=orders", $langs->trans("CustomersOrders"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); - $newmenu->add("/commande/fiche.php?action=create&leftmenu=orders", $langs->trans("NewOrder"), 1, $user->rights->commande->creer); - $newmenu->add("/commande/liste.php?leftmenu=orders", $langs->trans("List"), 1, $user->rights->commande->lire); - if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->commande->lire); - if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->commande->lire); - if (empty($leftmenu) || $leftmenu=="orders" && ! empty($conf->expedition->enabled)) $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=2", $langs->trans("StatusOrderSentShort"), 2, $user->rights->commande->lire); - if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=3", $langs->trans("StatusOrderToBill"), 2, $user->rights->commande->lire); // The translation key is StatusOrderToBill but it means StatusDelivered. TODO We should renamed this later - if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire); - if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire); + $newmenu->add("/commande/card.php?action=create&leftmenu=orders", $langs->trans("NewOrder"), 1, $user->rights->commande->creer); + $newmenu->add("/commande/list.php?leftmenu=orders", $langs->trans("List"), 1, $user->rights->commande->lire); + if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->commande->lire); + if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->commande->lire); + if (empty($leftmenu) || $leftmenu=="orders" && ! empty($conf->expedition->enabled)) $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=2", $langs->trans("StatusOrderSentShort"), 2, $user->rights->commande->lire); + if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=3", $langs->trans("StatusOrderToBill"), 2, $user->rights->commande->lire); // The translation key is StatusOrderToBill but it means StatusDelivered. TODO We should renamed this later + if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire); + if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire); $newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->rights->commande->lire); } @@ -701,17 +681,17 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("orders"); $newmenu->add("/fourn/commande/index.php?leftmenu=orders_suppliers",$langs->trans("SuppliersOrders"), 0, $user->rights->fournisseur->commande->lire, '', $mainmenu, 'orders_suppliers'); - $newmenu->add("/fourn/commande/fiche.php?action=create&leftmenu=orders_suppliers", $langs->trans("NewOrder"), 1, $user->rights->fournisseur->commande->creer); - $newmenu->add("/fourn/commande/liste.php?leftmenu=orders_suppliers", $langs->trans("List"), 1, $user->rights->fournisseur->commande->lire); + $newmenu->add("/fourn/commande/card.php?action=create&leftmenu=orders_suppliers", $langs->trans("NewOrder"), 1, $user->rights->fournisseur->commande->creer); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers", $langs->trans("List"), 1, $user->rights->fournisseur->commande->lire); - if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/liste.php?leftmenu=orders_suppliers&statut=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->fournisseur->commande->lire); - if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/liste.php?leftmenu=orders_suppliers&statut=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->fournisseur->commande->lire); - if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/liste.php?leftmenu=orders_suppliers&statut=2", $langs->trans("StatusOrderApprovedShort"), 2, $user->rights->fournisseur->commande->lire); - if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/liste.php?leftmenu=orders_suppliers&statut=3", $langs->trans("StatusOrderOnProcess"), 2, $user->rights->fournisseur->commande->lire); - if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/liste.php?leftmenu=orders_suppliers&statut=4", $langs->trans("StatusOrderReceivedPartially"), 2, $user->rights->fournisseur->commande->lire); - if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/liste.php?leftmenu=orders_suppliers&statut=5", $langs->trans("StatusOrderReceivedAll"), 2, $user->rights->fournisseur->commande->lire); - if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/liste.php?leftmenu=orders_suppliers&statut=6,7", $langs->trans("StatusOrderCanceled"), 2, $user->rights->fournisseur->commande->lire); - if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/liste.php?leftmenu=orders_suppliers&statut=9", $langs->trans("StatusOrderRefused"), 2, $user->rights->fournisseur->commande->lire); + if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->fournisseur->commande->lire); + if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->fournisseur->commande->lire); + if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=2", $langs->trans("StatusOrderApprovedShort"), 2, $user->rights->fournisseur->commande->lire); + if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=3", $langs->trans("StatusOrderOnProcess"), 2, $user->rights->fournisseur->commande->lire); + if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=4", $langs->trans("StatusOrderReceivedPartially"), 2, $user->rights->fournisseur->commande->lire); + if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=5", $langs->trans("StatusOrderReceivedAll"), 2, $user->rights->fournisseur->commande->lire); + if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=6,7", $langs->trans("StatusOrderCanceled"), 2, $user->rights->fournisseur->commande->lire); + if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=9", $langs->trans("StatusOrderRefused"), 2, $user->rights->fournisseur->commande->lire); $newmenu->add("/commande/stats/index.php?leftmenu=orders_suppliers&mode=supplier", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire); @@ -722,8 +702,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("contracts"); $newmenu->add("/contrat/index.php?leftmenu=contracts", $langs->trans("Contracts"), 0, $user->rights->contrat->lire, '', $mainmenu, 'contracts'); - $newmenu->add("/contrat/fiche.php?&action=create&leftmenu=contracts", $langs->trans("NewContract"), 1, $user->rights->contrat->creer); - $newmenu->add("/contrat/liste.php?leftmenu=contracts", $langs->trans("List"), 1, $user->rights->contrat->lire); + $newmenu->add("/contrat/card.php?action=create&leftmenu=contracts", $langs->trans("NewContract"), 1, $user->rights->contrat->creer); + $newmenu->add("/contrat/list.php?leftmenu=contracts", $langs->trans("List"), 1, $user->rights->contrat->lire); $newmenu->add("/contrat/services.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->rights->contrat->lire); if (empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=0", $langs->trans("MenuInactiveServices"), 2, $user->rights->contrat->lire); if (empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=4", $langs->trans("MenuRunningServices"), 2, $user->rights->contrat->lire); @@ -736,7 +716,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("interventions"); $newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire, '', $mainmenu, 'ficheinter'); - $newmenu->add("/fichinter/fiche.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer); + $newmenu->add("/fichinter/card.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer); $newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->rights->ficheinter->lire); } @@ -760,7 +740,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/compta/facture/impayees.php?leftmenu=customers_bills",$langs->trans("Unpaid"),1,$user->rights->facture->lire); - $newmenu->add("/compta/paiement/liste.php?leftmenu=customers_bills_payments",$langs->trans("Payments"),1,$user->rights->facture->lire); + $newmenu->add("/compta/paiement/list.php?leftmenu=customers_bills_payments",$langs->trans("Payments"),1,$user->rights->facture->lire); if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { @@ -776,7 +756,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("bills"); $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills'); - $newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer); + $newmenu->add("/fourn/facture/card.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer); $newmenu->add("/fourn/facture/impayees.php", $langs->trans("Unpaid"),1,$user->rights->fournisseur->facture->lire); $newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire); @@ -787,17 +767,29 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->commande->enabled)) { $langs->load("orders"); - if (! empty($conf->facture->enabled)) $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=-3", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); + if (! empty($conf->facture->enabled)) $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=-3", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); // if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); } + // Supplier Orders + if (! empty($conf->fournisseur->enabled)) + { + if (! empty($conf->global->SUPPLIER_MENU_ORDER_RECEIVED_INTO_INVOICE)) + { + $langs->load("supplier"); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders&search_status=5", $langs->trans("MenuOrdersSupplierToBill"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); + // if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); + } + } + + // Donations if (! empty($conf->don->enabled)) { $langs->load("donations"); $newmenu->add("/compta/dons/index.php?leftmenu=donations&mainmenu=accountancy",$langs->trans("Donations"), 0, $user->rights->don->lire, '', $mainmenu, 'donations'); - if (empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/compta/dons/fiche.php?action=create",$langs->trans("NewDonation"), 1, $user->rights->don->creer); - if (empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/compta/dons/liste.php",$langs->trans("List"), 1, $user->rights->don->lire); + if (empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/compta/dons/card.php?action=create",$langs->trans("NewDonation"), 1, $user->rights->don->creer); + if (empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/compta/dons/list.php",$langs->trans("List"), 1, $user->rights->don->lire); //if ($leftmenu=="donations") $newmenu->add("/compta/dons/stats.php",$langs->trans("Statistics"), 1, $user->rights->don->lire); } @@ -814,7 +806,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("salaries"); $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy",$langs->trans("Salaries"),1,$user->rights->salaries->read, '', $mainmenu, 'tax_salary'); - if (empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/fiche.php?leftmenu=tax_salary&action=create",$langs->trans("NewPayment"),2,$user->rights->salaries->write); + if (empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/card.php?leftmenu=tax_salary&action=create",$langs->trans("NewPayment"),2,$user->rights->salaries->write); if (empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary",$langs->trans("Payments"),2,$user->rights->salaries->read); } @@ -828,7 +820,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (empty($conf->global->TAX_DISABLE_VAT_MENUS)) { $newmenu->add("/compta/tva/index.php?leftmenu=tax_vat&mainmenu=accountancy",$langs->trans("VAT"),1,$user->rights->tax->charges->lire, '', $mainmenu, 'tax_vat'); - if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/tva/fiche.php?leftmenu=tax_vat&action=create",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer); + if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/tva/card.php?leftmenu=tax_vat&action=create",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer); if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/tva/reglement.php?leftmenu=tax_vat",$langs->trans("Payments"),2,$user->rights->tax->charges->lire); if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire); if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); @@ -839,7 +831,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if($mysoc->useLocalTax(1) && (isset($mysoc->localtax1_assuj) && $mysoc->localtax1_assuj=="1")) { $newmenu->add("/compta/localtax/index.php?leftmenu=tax_vat&mainmenu=accountancy&localTaxType=1",$langs->transcountry("LT1",$mysoc->country_code),1,$user->rights->tax->charges->lire); - if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/fiche.php?leftmenu=tax_vat&action=create&localTaxType=1",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/card.php?leftmenu=tax_vat&action=create&localTaxType=1",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer); if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/reglement.php?leftmenu=tax_vat&localTaxType=1",$langs->trans("Payments"),2,$user->rights->tax->charges->lire); if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_vat&localTaxType=1", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire); if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_vat&localTaxType=1", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); @@ -848,7 +840,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if($mysoc->useLocalTax(2) && (isset($mysoc->localtax2_assuj) && $mysoc->localtax2_assuj=="1")) { $newmenu->add("/compta/localtax/index.php?leftmenu=tax_vat&mainmenu=accountancy&localTaxType=2",$langs->transcountry("LT2",$mysoc->country_code),1,$user->rights->tax->charges->lire); - if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/fiche.php?leftmenu=tax_vat&action=create&localTaxType=2",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/card.php?leftmenu=tax_vat&action=create&localTaxType=2",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer); if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/reglement.php?leftmenu=tax_vat&localTaxType=2",$langs->trans("Payments"),2,$user->rights->tax->charges->lire); if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_vat&localTaxType=2", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire); if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_vat&localTaxType=2", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); @@ -863,13 +855,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $langs->load("accountancy"); $newmenu->add("/accountancy/customer/index.php?leftmenu=ventil_customer",$langs->trans("CustomersVentilation"),0,$user->rights->accounting->ventilation->read, '', $mainmenu, 'ventil_customer'); - if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/customer/list.php",$langs->trans("ToDispatch"),1,$user->rights->accounting->ventilation->read); + if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/customer/list.php",$langs->trans("ToDispatch"),1,$user->rights->accounting->ventilation->dispatch); if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/customer/lines.php",$langs->trans("Dispatched"),1,$user->rights->accounting->ventilation->read); if (! empty($conf->fournisseur->enabled)) { $newmenu->add("/accountancy/supplier/index.php?leftmenu=ventil_supplier",$langs->trans("SuppliersVentilation"),0,$user->rights->accounting->ventilation->read, '', $mainmenu, 'ventil_supplier'); - if (empty($leftmenu) || $leftmenu=="ventil_supplier") $newmenu->add("/accountancy/supplier/list.php",$langs->trans("ToDispatch"),1,$user->rights->accounting->ventilation->read); + if (empty($leftmenu) || $leftmenu=="ventil_supplier") $newmenu->add("/accountancy/supplier/list.php",$langs->trans("ToDispatch"),1,$user->rights->accounting->ventilation->dispatch); if (empty($leftmenu) || $leftmenu=="ventil_supplier") $newmenu->add("/accountancy/supplier/lines.php",$langs->trans("Dispatched"),1,$user->rights->accounting->ventilation->read); } } @@ -963,7 +955,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->accounting->enabled)) { $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy", $langs->trans("Fiscalyear"),0,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear'); - $newmenu->add("/accountancy/admin/account.php?mainmenu=home", $langs->trans("Chartofaccounts"),0,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear'); + $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy", $langs->trans("Chartofaccounts"),0,$user->rights->accounting->chartofaccount, '', $mainmenu, 'chartofaccount'); } } @@ -982,7 +974,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $newmenu->add("/compta/bank/index.php?leftmenu=bank&mainmenu=bank",$langs->trans("MenuBankCash"),0,$user->rights->banque->lire, '', $mainmenu, 'bank'); - $newmenu->add("/compta/bank/fiche.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer); + $newmenu->add("/compta/bank/card.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer); $newmenu->add("/compta/bank/categ.php",$langs->trans("Rubriques"),1,$user->rights->banque->configurer); $newmenu->add("/compta/bank/search.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire); @@ -1002,7 +994,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (empty($leftmenu) || $leftmenu=="withdraw") $newmenu->add("/compta/prelevement/bons.php?mainmenu=bank",$langs->trans("WithdrawalsReceipts"),1,$user->rights->prelevement->bons->lire); - if (empty($leftmenu) || $leftmenu=="withdraw") $newmenu->add("/compta/prelevement/liste.php?mainmenu=bank",$langs->trans("WithdrawalsLines"),1,$user->rights->prelevement->bons->lire); + if (empty($leftmenu) || $leftmenu=="withdraw") $newmenu->add("/compta/prelevement/list.php?mainmenu=bank",$langs->trans("WithdrawalsLines"),1,$user->rights->prelevement->bons->lire); if (empty($leftmenu) || $leftmenu=="withdraw") $newmenu->add("/compta/prelevement/rejets.php?mainmenu=bank",$langs->trans("Rejects"),1,$user->rights->prelevement->bons->lire); if (empty($leftmenu) || $leftmenu=="withdraw") $newmenu->add("/compta/prelevement/stats.php?mainmenu=bank",$langs->trans("Statistics"),1,$user->rights->prelevement->bons->lire); @@ -1013,8 +1005,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->banque->enabled) && (! empty($conf->facture->enabled)) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON)) { $newmenu->add("/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank",$langs->trans("MenuChequeDeposits"),0,$user->rights->banque->cheque, '', $mainmenu, 'checks'); - $newmenu->add("/compta/paiement/cheque/fiche.php?leftmenu=checks&action=new&mainmenu=bank",$langs->trans("NewChequeDeposit"),1,$user->rights->banque->cheque); - $newmenu->add("/compta/paiement/cheque/liste.php?leftmenu=checks&mainmenu=bank",$langs->trans("List"),1,$user->rights->banque->cheque); + $newmenu->add("/compta/paiement/cheque/card.php?leftmenu=checks&action=new&mainmenu=bank",$langs->trans("NewChequeDeposit"),1,$user->rights->banque->cheque); + $newmenu->add("/compta/paiement/cheque/list.php?leftmenu=checks&mainmenu=bank",$langs->trans("List"),1,$user->rights->banque->cheque); } } @@ -1028,8 +1020,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->product->enabled)) { $newmenu->add("/product/index.php?leftmenu=product&type=0", $langs->trans("Products"), 0, $user->rights->produit->lire, '', $mainmenu, 'product'); - $newmenu->add("/product/fiche.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->rights->produit->creer); - $newmenu->add("/product/liste.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->rights->produit->lire); + $newmenu->add("/product/card.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->rights->produit->creer); + $newmenu->add("/product/list.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->rights->produit->lire); if (! empty($conf->propal->enabled)) { $newmenu->add("/product/popuprop.php?leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->rights->produit->lire && $user->rights->propale->lire); @@ -1044,8 +1036,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->service->enabled)) { $newmenu->add("/product/index.php?leftmenu=service&type=1", $langs->trans("Services"), 0, $user->rights->service->lire, '', $mainmenu, 'service'); - $newmenu->add("/product/fiche.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->rights->service->creer); - $newmenu->add("/product/liste.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->rights->service->lire); + $newmenu->add("/product/card.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->rights->service->creer); + $newmenu->add("/product/list.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->rights->service->lire); if (! empty($conf->propal->enabled)) { $newmenu->add("/product/popuprop.php?leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->rights->service->lire && $user->rights->propale->lire); @@ -1057,20 +1049,20 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("categories"); $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - $newmenu->add("/categories/fiche.php?action=create&type=0", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); - //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); + $newmenu->add("/categories/card.php?action=create&type=0", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); + //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire); } - // Stocks + // Warehouse if (! empty($conf->stock->enabled)) { $langs->load("stocks"); - $newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Stocks"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock'); - if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/fiche.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer); - if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/liste.php", $langs->trans("List"), 1, $user->rights->stock->lire); - if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/mouvement.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire); - if ($conf->fournisseur->enabled) if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire); - if ($conf->fournisseur->enabled) if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/massstockmove.php", $langs->trans("StockTransfer"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire); + $newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock'); + $newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer); + $newmenu->add("/product/stock/list.php", $langs->trans("List"), 1, $user->rights->stock->lire); + $newmenu->add("/product/stock/mouvement.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire); + if ($conf->fournisseur->enabled) $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire); + if ($conf->fournisseur->enabled) $newmenu->add("/product/stock/massstockmove.php", $langs->trans("StockTransfer"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire); } // Expeditions @@ -1078,8 +1070,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("sendings"); $newmenu->add("/expedition/index.php?leftmenu=sendings", $langs->trans("Shipments"), 0, $user->rights->expedition->lire, '', $mainmenu, 'sendings'); - $newmenu->add("/expedition/fiche.php?action=create2&leftmenu=sendings", $langs->trans("NewSending"), 1, $user->rights->expedition->creer); - $newmenu->add("/expedition/liste.php?leftmenu=sendings", $langs->trans("List"), 1, $user->rights->expedition->lire); + $newmenu->add("/expedition/card.php?action=create2&leftmenu=sendings", $langs->trans("NewSending"), 1, $user->rights->expedition->creer); + $newmenu->add("/expedition/list.php?leftmenu=sendings", $langs->trans("List"), 1, $user->rights->expedition->lire); $newmenu->add("/expedition/stats/index.php?leftmenu=sendings", $langs->trans("Statistics"), 1, $user->rights->expedition->lire); } @@ -1099,7 +1091,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // Security check $newmenu->add("/societe/soc.php?leftmenu=suppliers&action=create&type=f",$langs->trans("NewSupplier"), 1, $user->rights->societe->creer && $user->rights->fournisseur->lire); - $newmenu->add("/fourn/liste.php",$langs->trans("List"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire); + $newmenu->add("/fourn/list.php",$langs->trans("List"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire); $newmenu->add("/contact/list.php?leftmenu=suppliers&type=f",$langs->trans("Contacts"), 1, $user->rights->societe->contact->lire && $user->rights->fournisseur->lire); $newmenu->add("/fourn/stats.php",$langs->trans("Statistics"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire); } @@ -1108,7 +1100,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("bills"); $newmenu->add("/fourn/facture/list.php?leftmenu=orders", $langs->trans("Bills"), 0, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'orders'); - $newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"), 1, $user->rights->fournisseur->facture->creer); + $newmenu->add("/fourn/facture/card.php?action=create",$langs->trans("NewBill"), 1, $user->rights->fournisseur->facture->creer); $newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"), 1, $user->rights->fournisseur->facture->lire); } @@ -1117,15 +1109,15 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $langs->load("orders"); $newmenu->add("/fourn/commande/index.php?leftmenu=suppliers",$langs->trans("Orders"), 0, $user->rights->fournisseur->commande->lire, '', $mainmenu, 'suppliers'); $newmenu->add("/societe/societe.php?leftmenu=supplier", $langs->trans("NewOrder"), 1, $user->rights->fournisseur->commande->creer); - $newmenu->add("/fourn/commande/liste.php?leftmenu=suppliers", $langs->trans("List"), 1, $user->rights->fournisseur->commande->lire); + $newmenu->add("/fourn/commande/list.php?leftmenu=suppliers", $langs->trans("List"), 1, $user->rights->fournisseur->commande->lire); } if (! empty($conf->categorie->enabled)) { $langs->load("categories"); $newmenu->add("/categories/index.php?leftmenu=cat&type=1", $langs->trans("Categories"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - $newmenu->add("/categories/fiche.php?action=create&type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); - //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); + $newmenu->add("/categories/card.php?action=create&type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); + //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire); } } @@ -1140,14 +1132,14 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $langs->load("projects"); // Project affected to user - $newmenu->add("/projet/index.php?leftmenu=projects&mode=mine", $langs->trans("MyProjects"), 0, $user->rights->projet->lire, '', $mainmenu, 'projects'); - $newmenu->add("/projet/fiche.php?leftmenu=projects&action=create&mode=mine", $langs->trans("NewProject"), 1, $user->rights->projet->creer); - $newmenu->add("/projet/liste.php?leftmenu=projects&mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire); + $newmenu->add("/projet/index.php?leftmenu=projects&mode=mine", $langs->trans("MyProjects"), 0, $user->rights->projet->lire, '', $mainmenu, 'myprojects'); + $newmenu->add("/projet/card.php?leftmenu=projects&action=create&mode=mine", $langs->trans("NewProject"), 1, $user->rights->projet->creer); + $newmenu->add("/projet/list.php?leftmenu=projects&mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire); // All project i have permission on - $newmenu->add("/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire && $user->rights->projet->lire); - $newmenu->add("/projet/fiche.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer && $user->rights->projet->creer); - $newmenu->add("/projet/liste.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire && $user->rights->projet->lire); + $newmenu->add("/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire && $user->rights->projet->lire, '', $mainmenu, 'projects'); + $newmenu->add("/projet/card.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer && $user->rights->projet->creer); + $newmenu->add("/projet/list.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire && $user->rights->projet->lire); // Project affected to user $newmenu->add("/projet/activity/index.php?mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire); @@ -1174,7 +1166,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $langs->load("holiday"); $newmenu->add("/holiday/index.php?&leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->write, '', $mainmenu, 'hrm'); - $newmenu->add("/holiday/fiche.php?&action=request", $langs->trans("MenuAddCP"), 1,$user->rights->holiday->write); + $newmenu->add("/holiday/card.php?&action=request", $langs->trans("MenuAddCP"), 1,$user->rights->holiday->write); $newmenu->add("/holiday/define_holiday.php?&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->define_holiday); $newmenu->add("/holiday/view_log.php?&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->view_log); $newmenu->add("/holiday/month_report.php?&action=request", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->month_report); @@ -1185,7 +1177,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("trips"); $newmenu->add("/compta/deplacement/index.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->rights->deplacement->lire, '', $mainmenu, 'tripsandexpenses'); - $newmenu->add("/compta/deplacement/fiche.php?action=create&leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("New"), 1, $user->rights->deplacement->creer); + $newmenu->add("/compta/deplacement/card.php?action=create&leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("New"), 1, $user->rights->deplacement->creer); $newmenu->add("/compta/deplacement/list.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("List"), 1, $user->rights->deplacement->lire); $newmenu->add("/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("Statistics"), 1, $user->rights->deplacement->lire); } @@ -1203,8 +1195,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $langs->load("mails"); $newmenu->add("/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->rights->mailing->lire, '', $mainmenu, 'mailing'); - $newmenu->add("/comm/mailing/fiche.php?leftmenu=mailing&action=create", $langs->trans("NewMailing"), 1, $user->rights->mailing->creer); - $newmenu->add("/comm/mailing/liste.php?leftmenu=mailing", $langs->trans("List"), 1, $user->rights->mailing->lire); + $newmenu->add("/comm/mailing/card.php?leftmenu=mailing&action=create", $langs->trans("NewMailing"), 1, $user->rights->mailing->creer); + $newmenu->add("/comm/mailing/list.php?leftmenu=mailing", $langs->trans("List"), 1, $user->rights->mailing->lire); } if (! empty($conf->export->enabled)) @@ -1234,17 +1226,17 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $langs->load("compta"); $newmenu->add("/adherents/index.php?leftmenu=members&mainmenu=members",$langs->trans("Members"),0,$user->rights->adherent->lire, '', $mainmenu, 'members'); - $newmenu->add("/adherents/fiche.php?leftmenu=members&action=create",$langs->trans("NewMember"),1,$user->rights->adherent->creer); - $newmenu->add("/adherents/liste.php?leftmenu=members",$langs->trans("List"),1,$user->rights->adherent->lire); - $newmenu->add("/adherents/liste.php?leftmenu=members&statut=-1",$langs->trans("MenuMembersToValidate"),2,$user->rights->adherent->lire); - $newmenu->add("/adherents/liste.php?leftmenu=members&statut=1",$langs->trans("MenuMembersValidated"),2,$user->rights->adherent->lire); - $newmenu->add("/adherents/liste.php?leftmenu=members&statut=1&filter=uptodate",$langs->trans("MenuMembersUpToDate"),2,$user->rights->adherent->lire); - $newmenu->add("/adherents/liste.php?leftmenu=members&statut=1&filter=outofdate",$langs->trans("MenuMembersNotUpToDate"),2,$user->rights->adherent->lire); - $newmenu->add("/adherents/liste.php?leftmenu=members&statut=0",$langs->trans("MenuMembersResiliated"),2,$user->rights->adherent->lire); - $newmenu->add("/adherents/stats/geo.php?leftmenu=members&mode=memberbycountry",$langs->trans("MenuMembersStats"),1,$user->rights->adherent->lire); + $newmenu->add("/adherents/card.php?leftmenu=members&action=create",$langs->trans("NewMember"),1,$user->rights->adherent->creer); + $newmenu->add("/adherents/list.php?leftmenu=members",$langs->trans("List"),1,$user->rights->adherent->lire); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=-1",$langs->trans("MenuMembersToValidate"),2,$user->rights->adherent->lire); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=1",$langs->trans("MenuMembersValidated"),2,$user->rights->adherent->lire); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=uptodate",$langs->trans("MenuMembersUpToDate"),2,$user->rights->adherent->lire); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=outofdate",$langs->trans("MenuMembersNotUpToDate"),2,$user->rights->adherent->lire); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=0",$langs->trans("MenuMembersResiliated"),2,$user->rights->adherent->lire); + $newmenu->add("/adherents/stats/index.php?leftmenu=members",$langs->trans("MenuMembersStats"),1,$user->rights->adherent->lire); $newmenu->add("/adherents/index.php?leftmenu=members&mainmenu=members",$langs->trans("Subscriptions"),0,$user->rights->adherent->cotisation->lire); - $newmenu->add("/adherents/liste.php?leftmenu=members&statut=-1,1&mainmenu=members",$langs->trans("NewSubscription"),1,$user->rights->adherent->cotisation->creer); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=-1,1&mainmenu=members",$langs->trans("NewSubscription"),1,$user->rights->adherent->cotisation->creer); $newmenu->add("/adherents/cotisations.php?leftmenu=members",$langs->trans("List"),1,$user->rights->adherent->cotisation->lire); $newmenu->add("/adherents/stats/index.php?leftmenu=members",$langs->trans("MenuMembersStats"),1,$user->rights->adherent->lire); @@ -1253,8 +1245,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("categories"); $newmenu->add("/categories/index.php?leftmenu=cat&type=3", $langs->trans("Categories"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - $newmenu->add("/categories/fiche.php?action=create&type=3", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); - //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); + $newmenu->add("/categories/card.php?action=create&type=3", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); + //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire); } $newmenu->add("/adherents/index.php?leftmenu=export&mainmenu=members",$langs->trans("Exports"),0,$user->rights->adherent->export, '', $mainmenu, 'export'); @@ -1294,7 +1286,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu while ($i < $numr) { $objp = $db->fetch_object($resql); - $newmenu->add('/compta/bank/fiche.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire); + $newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire); if ($objp->rappro && $objp->courant != 2 && empty($objp->clos)) // If not cash account and not closed and can be reconciliate { $newmenu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate); @@ -1368,7 +1360,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { for ($j=0; $j < $tabul; $j++) { - $tabstring.='     '; + $tabstring.='   '; } } @@ -1434,8 +1426,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu * Function to test if an entry is enabled or not * * @param string $type_user 0=We need backoffice menu, 1=We need frontoffice menu - * @param array &$menuentry Array for menu entry - * @param array &$listofmodulesforexternal Array with list of modules allowed to external users + * @param array $menuentry Array for menu entry + * @param array $listofmodulesforexternal Array with list of modules allowed to external users * @return int 0=Hide, 1=Show, 2=Show gray */ function dol_eldy_showmenu($type_user, &$menuentry, &$listofmodulesforexternal) diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index e7e76ed7669..af85537d455 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -177,7 +177,6 @@ class MenuManager print ''; - print str_pad('',12,' '); if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") print $langs->trans("Access"); // No translation else print $langs->trans(ucfirst($val['mainmenu'])."Dashboard"); print ''; @@ -199,7 +198,6 @@ class MenuManager //print ' data-ajax="false"'; print '>'; } - print str_pad('',($val2['level']+1)*12,' '); print $val2['titre']; if ($relurl2) print ''; print ''."\n"; diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php index 3bf7eddecce..32554e1511a 100644 --- a/htdocs/core/modules/action/rapport.pdf.php +++ b/htdocs/core/modules/action/rapport.pdf.php @@ -185,7 +185,7 @@ class CommActionRapport /** * Write content of pages * - * @param PDF &$pdf Object pdf + * @param PDF $pdf Object pdf * @param Translate $outputlangs Object langs * @return int 1 */ @@ -210,6 +210,7 @@ class CommActionRapport $sql.= " WHERE c.id=a.fk_action AND a.fk_user_author = u.rowid"; $sql.= " AND a.datep BETWEEN '".$this->db->idate(dol_get_first_day($this->year,$this->month,false))."'"; $sql.= " AND '".$this->db->idate(dol_get_last_day($this->year,$this->month,false))."'"; + $sql.= " AND a.entity = ".$conf->entity; $sql.= " ORDER BY a.datep DESC"; $eventstatic=new ActionComm($this->db); @@ -299,7 +300,7 @@ class CommActionRapport /** * Show top header of page. * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Translate $outputlangs Object lang for output * @param int $pagenb Page nb * @return void diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index e03bdc6d2e9..0bd7a262a9c 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -20,7 +20,7 @@ */ /** - * \file htdocs/core/modules/product/mod_barcode_product_standard.php + * \file htdocs/core/modules/barcode/mod_barcode_product_standard.php * \ingroup barcode * \brief File of class to manage barcode numbering with standard rule */ @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/barcode/modules_barcode.class.php' */ class mod_barcode_product_standard extends ModeleNumRefBarCode { - var $nom='Standard'; // Model Name + var $name='Standard'; // Model Name var $code_modifiable; // Editable code var $code_modifiable_invalide; // Modified code if it is invalid var $code_modifiable_null; // Modified code if it is null @@ -162,7 +162,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode * Check validity of code according to its rules * * @param DoliDB $db Database handler - * @param string &$code Code to check/correct + * @param string $code Code to check/correct * @param Product $product Object product * @param int $thirdparty_type 0 = customer/prospect , 1 = supplier * @param string $type type of barcode (EAN, ISBN, ...) @@ -177,7 +177,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode global $conf; //var_dump($code.' '.$product->ref.' '.$thirdparty_type);exit; - + require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; $result=0; @@ -282,7 +282,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode { $newcodefortest=substr($newcodefortest,0,12); } - + $result=check_value($mask,$newcodefortest); return $result; diff --git a/htdocs/core/modules/barcode/modules_barcode.class.php b/htdocs/core/modules/barcode/modules_barcode.class.php index 0f87306354a..d03302f36b7 100644 --- a/htdocs/core/modules/barcode/modules_barcode.class.php +++ b/htdocs/core/modules/barcode/modules_barcode.class.php @@ -62,7 +62,7 @@ abstract class ModeleNumRefBarCode $langs->load("bills"); return $langs->trans("NoDescription"); } - + /** Return model name * * @param Translate $langs Object langs @@ -70,10 +70,10 @@ abstract class ModeleNumRefBarCode */ function getNom($langs) { - return $this->nom; + return empty($this->name)?$this->nom:$this->name; } - - /** Return a numbering example + + /** Return a numbering example * * @param Translate $langs Object langs * @return string Example @@ -96,7 +96,7 @@ abstract class ModeleNumRefBarCode global $langs; return $langs->trans("Function_getNextValue_InModuleNotWorking"); } - + /** Return version of module * * @return string Version @@ -112,7 +112,7 @@ abstract class ModeleNumRefBarCode if ($this->version) return $this->version; return $langs->trans("NotAvailable"); } - + /** * Return description of module parameters * @@ -128,7 +128,7 @@ abstract class ModeleNumRefBarCode $langs->load("admin"); $s=''; - $s.=$langs->trans("Name").': '.$this->nom.'
    '; + $s.=$langs->trans("Name").': '.$this->name.'
    '; $s.=$langs->trans("Version").': '.$this->getVersion().'
    '; if ($type != -1) $s.=$langs->trans("ValidityControledByModule").': '.$this->getNom($langs).'
    '; $s.='
    '; @@ -171,6 +171,6 @@ abstract class ModeleNumRefBarCode return $s; } - + } diff --git a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php index c2ac3aaa628..5d1222da6dd 100644 --- a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php @@ -111,7 +111,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts } } - $_file = $dir . "/bordereau-".$number.".pdf"; + $file = $dir . "/bordereau-".$number.".pdf"; // Add pdfgeneration hook if (! is_object($hookmanager)) @@ -120,7 +120,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts $hookmanager=new HookManager($this->db); } $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('outputlangs'=>$outputlangs); + $parameters=array('file'=>$file, 'outputlangs'=>$outputlangs); global $action; $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks @@ -177,7 +177,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts $pdf->Close(); - $pdf->Output($_file,'F'); + $pdf->Output($file,'F'); // Add pdfgeneration hook if (! is_object($hookmanager)) @@ -191,7 +191,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts $reshook=$hookmanager->executeHooks('adterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if (! empty($conf->global->MAIN_UMASK)) - @chmod($_file, octdec($conf->global->MAIN_UMASK)); + @chmod($file, octdec($conf->global->MAIN_UMASK)); $outputlangs->charset_output=$sav_charset_output; return 1; // Pas d'erreur @@ -201,7 +201,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts /** * Generate Header * - * @param PDF &$pdf Pdf object + * @param PDF $pdf Pdf object * @param int $page Current page number * @param int $pages Total number of pages * @param Translate $outputlangs Object language for output @@ -307,7 +307,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts /** * Output array * - * @param PDF &$pdf PDF object + * @param PDF $pdf PDF object * @param int $pagenb Page nb * @param int $pages Pages * @param Translate $outputlangs Object lang @@ -365,7 +365,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts /** * Show footer of page. Need this->emetteur object * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param Object $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 895ad153fc8..1b7da875073 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -277,7 +277,7 @@ class doc_generic_order_odt extends ModelePDFCommandes // Make substitution $substitutionarray=array( - '__FROM_NAME__' => $this->emetteur->nom, + '__FROM_NAME__' => $this->emetteur->name, '__FROM_EMAIL__' => $this->emetteur->email, '__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_HT__' => $object->total_ht, @@ -329,73 +329,19 @@ class doc_generic_order_odt extends ModelePDFCommandes { } - // Make substitutions into odt of user info - $tmparray=$this->get_substitutionarray_user($user,$outputlangs); - //var_dump($tmparray); exit; - foreach($tmparray as $key=>$value) - { - try { - if (preg_match('/logo$/',$key)) // Image - { - //var_dump($value);exit; - if (file_exists($value)) $odfHandler->setImage($key, $value); - else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); - } - else // Text - { - $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - } - catch(OdfException $e) - { - } - } - // Make substitutions into odt of mysoc - $tmparray=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); - //var_dump($tmparray); exit; - foreach($tmparray as $key=>$value) - { - try { - if (preg_match('/logo$/',$key)) // Image - { - //var_dump($value);exit; - if (file_exists($value)) $odfHandler->setImage($key, $value); - else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); - } - else // Text - { - $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - } - catch(OdfException $e) - { - } - } - // Make substitutions into odt of thirdparty - $tmparray=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); - foreach($tmparray as $key=>$value) - { - try { - if (preg_match('/logo$/',$key)) // Image - { - if (file_exists($value)) $odfHandler->setImage($key, $value); - else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); - } - else // Text - { - $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - } - catch(OdfException $e) - { - } - } - // Replace tags of object + external modules - $tmparray=$this->get_substitutionarray_object($object,$outputlangs); + // Make substitutions into odt + $array_user=$this->get_substitutionarray_user($user,$outputlangs); + $array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); + $array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); + $array_objet=$this->get_substitutionarray_object($object,$outputlangs); + $array_other=$this->get_substitutionarray_other($outputlangs); + + $tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other); complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray); $reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + foreach($tmparray as $key=>$value) { try { @@ -483,7 +429,7 @@ class doc_generic_order_odt extends ModelePDFCommandes } $reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - + if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 2b7ee2f18a3..510a1bd88a1 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -544,7 +544,7 @@ class pdf_einstein extends ModelePDFCommandes /** * Show payments table * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object order * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output @@ -559,7 +559,7 @@ class pdf_einstein extends ModelePDFCommandes /** * Show miscellaneous information (payment mode, payment term, ...) * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object @@ -743,7 +743,7 @@ class pdf_einstein extends ModelePDFCommandes /** * Show total to pay * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Facture $object Object invoice * @param int $deja_regle Montant deja regle * @param int $posy Position depart @@ -1000,7 +1000,7 @@ class pdf_einstein extends ModelePDFCommandes /** * Show table for lines * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param string $tab_top Top position of table * @param string $tab_height Height of table (rectangle) * @param int $nexY Y (not used) @@ -1095,7 +1095,7 @@ class pdf_einstein extends ModelePDFCommandes /** * Show top header of page. * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output @@ -1188,7 +1188,7 @@ class pdf_einstein extends ModelePDFCommandes if ($showaddress) { // Sender properties - $carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); + $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client); // Show sender $posy=42; @@ -1233,12 +1233,12 @@ class pdf_einstein extends ModelePDFCommandes { // On peut utiliser le nom de la societe du contact if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $object->client->nom; + else $socname = $object->client->name; $carac_client_name=$outputlangs->convToOutputCharset($socname); } else { - $carac_client_name=$outputlangs->convToOutputCharset($object->client->nom); + $carac_client_name=$outputlangs->convToOutputCharset($object->client->name); } $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target'); @@ -1274,7 +1274,7 @@ class pdf_einstein extends ModelePDFCommandes /** * Show footer of page. Need this->emetteur object * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param Object $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php index 290341e5ddb..2b8aaa21818 100644 --- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php @@ -543,7 +543,7 @@ class pdf_proforma extends ModelePDFCommandes /** * Show payments table * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object order * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output @@ -558,7 +558,7 @@ class pdf_proforma extends ModelePDFCommandes /** * Show miscellaneous information (payment mode, payment term, ...) * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object @@ -700,7 +700,7 @@ class pdf_proforma extends ModelePDFCommandes /** * Show total to pay * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Facture $object Object invoice * @param int $deja_regle Montant deja regle * @param int $posy Position depart @@ -957,7 +957,7 @@ class pdf_proforma extends ModelePDFCommandes /** * Show table for lines * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param string $tab_top Top position of table * @param string $tab_height Height of table (rectangle) * @param int $nexY Y (not used) @@ -1052,7 +1052,7 @@ class pdf_proforma extends ModelePDFCommandes /** * Show top header of page. * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output @@ -1145,7 +1145,7 @@ class pdf_proforma extends ModelePDFCommandes if ($showaddress) { // Sender properties - $carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); + $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client); // Show sender $posy=42; @@ -1190,12 +1190,12 @@ class pdf_proforma extends ModelePDFCommandes { // On peut utiliser le nom de la societe du contact if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $object->client->nom; + else $socname = $object->client->name; $carac_client_name=$outputlangs->convToOutputCharset($socname); } else { - $carac_client_name=$outputlangs->convToOutputCharset($object->client->nom); + $carac_client_name=$outputlangs->convToOutputCharset($object->client->name); } $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target'); @@ -1231,7 +1231,7 @@ class pdf_proforma extends ModelePDFCommandes /** * Show footer of page. Need this->emetteur object * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param Object $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text diff --git a/htdocs/core/modules/commande/modules_commande.php b/htdocs/core/modules/commande/modules_commande.php index 63806e4cb46..18a586d3b63 100644 --- a/htdocs/core/modules/commande/modules_commande.php +++ b/htdocs/core/modules/commande/modules_commande.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2014 Marcos García * * 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 @@ -159,94 +160,9 @@ abstract class ModeleNumRefCommandes * @param int $hidedesc Hide description * @param int $hideref Hide ref * @return int 0 if KO, 1 if OK + * @deprecated Use the new function generateDocument of Commande class */ -function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) +function commande_pdf_create(DoliDB $db, Commande $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { - global $conf,$user,$langs,$hookmanager; - $langs->load("orders"); - - $error=0; - - $srctemplatepath=''; - - // Positionne le modele sur le nom du modele a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->COMMANDE_ADDON_PDF)) - { - $modele = $conf->global->COMMANDE_ADDON_PDF; - } - else - { - $modele = 'einstein'; - } - } - - // If selected modele is a filename template (then $modele="modelname:filename") - $tmp=explode(':',$modele,2); - if (! empty($tmp[1])) - { - $modele=$tmp[0]; - $srctemplatepath=$tmp[1]; - } - - // Search template files - $file=''; $classname=''; $filefound=0; - $dirmodels=array('/'); - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); - foreach($dirmodels as $reldir) - { - foreach(array('doc','pdf') as $prefix) - { - $file = $prefix."_".$modele.".modules.php"; - - // On verifie l'emplacement du modele - $file=dol_buildpath($reldir."core/modules/commande/doc/".$file,0); - if (file_exists($file)) - { - $filefound=1; - $classname=$prefix.'_'.$modele; - break; - } - } - if ($filefound) break; - } - - // Charge le modele - if ($filefound) - { - require_once $file; - - $obj = new $classname($db); - //$obj->message = $message; - - // We save charset_output to restore it because write_file can change it if needed for - // output format that does not support UTF8. - $sav_charset_output=$outputlangs->charset_output; - if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) - { - $outputlangs->charset_output=$sav_charset_output; - - // We delete old preview - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - dol_delete_preview($object); - - // Success in building document. We build meta file. - dol_meta_create($object); - - return 1; - } - else - { - $outputlangs->charset_output=$sav_charset_output; - dol_print_error($db,"order_pdf_create Error: ".$obj->error); - return -1; - } - - } - else - { - dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file)); - return -1; - } + return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index c4d8eb4a1e4..46364b23d0d 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -53,6 +53,18 @@ class pdf_strato extends ModelePDFContract var $marge_haute; var $marge_basse; + /** + * Issuer + * @var Societe + */ + public $emetteur; + + /** + * Recipient + * @var Societe + */ + public $recipient; + /** * Constructor * @@ -227,29 +239,9 @@ class pdf_strato extends ModelePDFContract $iniY = $tab_top + 7; $curY = $tab_top + 7; - $nexY = $tab_top + 7; + $nexY = $tab_top + 2; $pdf->SetXY($this->marge_gauche, $tab_top); - $pdf->MultiCell(190,8,$outputlangs->transnoentities("Description"),0,'L',0); - $pdf->line($this->marge_gauche, $tab_top + 8, $this->page_largeur-$this->marge_droite, $tab_top + 8); - - $pdf->SetFont('', '', $default_font_size - 1); - - $pdf->MultiCell(0, 3, ''); // Set interline to 3 - $pdf->SetXY($this->marge_gauche, $tab_top + 8); - $text=$object->description; - if ($object->duree > 0) - { - $totaltime=convertSecondToTime($object->duree,'all',$conf->global->MAIN_DURATION_OF_WORKDAY); - $text.=($text?' - ':'').$langs->trans("Total").": ".$totaltime; - } - $desc=dol_htmlentitiesbr($text,1); - //print $outputlangs->convToOutputCharset($desc); exit; - - $pdf->writeHTMLCell(180, 3, 10, $tab_top + 8, $outputlangs->convToOutputCharset($desc), 0, 1); - $nexY = $pdf->GetY(); - - $pdf->line($this->marge_gauche, $nexY, $this->page_largeur-$this->marge_droite, $nexY); $pdf->MultiCell(0, 2, ''); // Set interline to 3. Then writeMultiCell must use 3 also. @@ -273,7 +265,20 @@ class pdf_strato extends ModelePDFContract $pageposbefore=$pdf->getPage(); // Description of product line - $txt=''.dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true)." - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration),1,$outputlangs->charset_output).''; + + if ($objectligne->datei) { + $datei = dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true); + } else { + $datei = $langs->trans("Unknown"); + } + + if ($objectligne->duration) { + $durationi = convertSecondToTime($objectligne->duration); + } else { + $durationi = $langs->trans("Unknown"); + } + + $txt=''.dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".$datei." - ".$outputlangs->transnoentities("Duration")." : ".$durationi,1,$outputlangs->charset_output).''; $desc=dol_htmlentitiesbr($objectligne->desc,1); $pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,$desc), 0, 1, 0); @@ -380,7 +385,7 @@ class pdf_strato extends ModelePDFContract /** * Show table for lines * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param string $tab_top Top position of table * @param string $tab_height Height of table (rectangle) * @param int $nexY Y @@ -446,7 +451,7 @@ class pdf_strato extends ModelePDFContract /** * Show top header of page. * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output @@ -521,7 +526,7 @@ class pdf_strato extends ModelePDFContract $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->datec,"day",false,$outputlangs,true), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_creation,"day",false,$outputlangs,true), '', 'R'); if ($object->client->code_client) { @@ -543,7 +548,7 @@ class pdf_strato extends ModelePDFContract $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; } - $carac_emetteur .= pdf_build_address($outputlangs,$this->emetteur); + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client); // Show sender $posy=42; @@ -581,17 +586,17 @@ class pdf_strato extends ModelePDFContract $result=$object->fetch_contact($arrayidcontact[0]); } + $this->recipient = $object->client; + // Recipient name - if (! empty($usecontact)) - { + if (! empty($usecontact)) { // On peut utiliser le nom de la societe du contact if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $object->client->nom; - $this->recipient->name=$outputlangs->convToOutputCharset($socname); + else $socname = $object->client->name; + $this->recipient->name = $outputlangs->convToOutputCharset($socname); } - else - { - $this->recipient->name=$outputlangs->convToOutputCharset($object->client->nom); + else { + $this->recipient->name = $outputlangs->convToOutputCharset($object->client->name); } $carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->client, (isset($object->contact)?$object->contact:''), $usecontact, 'target'); @@ -625,7 +630,7 @@ class pdf_strato extends ModelePDFContract /** * Show footer of page. Need this->emetteur object * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param Object $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text diff --git a/htdocs/core/modules/contract/mod_contract_olive.php b/htdocs/core/modules/contract/mod_contract_olive.php index 2b10d520b25..6d22aebeb3d 100644 --- a/htdocs/core/modules/contract/mod_contract_olive.php +++ b/htdocs/core/modules/contract/mod_contract_olive.php @@ -43,7 +43,7 @@ class mod_contract_olive extends ModelNumRefContracts var $code_auto = 0; // Numerotation automatique - /** + /** * Return description of module * * @return string Description of module @@ -51,7 +51,7 @@ class mod_contract_olive extends ModelNumRefContracts function info() { global $langs; - + $langs->load("companies"); return $langs->trans("LeopardNumRefModelDesc"); } @@ -74,7 +74,7 @@ class mod_contract_olive extends ModelNumRefContracts * Check validity of code according to its rules * * @param DoliDB $db Database handler - * @param string &$code Code to check/correct + * @param string $code Code to check/correct * @param Product $product Object product * @param int $type 0 = product , 1 = service * @return int 0 if OK diff --git a/htdocs/core/modules/contract/modules_contract.php b/htdocs/core/modules/contract/modules_contract.php index 689509f2a59..9ffd5d93881 100644 --- a/htdocs/core/modules/contract/modules_contract.php +++ b/htdocs/core/modules/contract/modules_contract.php @@ -6,6 +6,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2013 Philippe Grand + * Copyright (C) 2014 Marcos García * * 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 @@ -154,92 +155,9 @@ class ModelNumRefContracts * @param int $hidedesc Hide description * @param int $hideref Hide ref * @return int 0 if KO, 1 if OK + * @deprecated Use the new function generateDocument of Contrat class */ -function contract_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) +function contract_pdf_create(DoliDB $db, Contrat $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { - global $conf,$langs,$user,$hookmanager; - $langs->load("contracts"); - - $error=0; - - $srctemplatepath=''; - - // Positionne modele sur le nom du modele de contrat a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->CONTRACT_ADDON_PDF)) - { - $modele = $conf->global->CONTRACT_ADDON_PDF; - } - else - { - $modele = 'strato'; - } - } - - // If selected modele is a filename template (then $modele="modelname:filename") - $tmp=explode(':',$modele,2); - if (! empty($tmp[1])) - { - $modele=$tmp[0]; - $srctemplatepath=$tmp[1]; - } - - // Search template files - $file=''; $classname=''; $filefound=0; - $dirmodels=array('/'); - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); - foreach($dirmodels as $reldir) - { - foreach(array('doc','pdf') as $prefix) - { - $file = $prefix."_".$modele.".modules.php"; - - // On verifie l'emplacement du modele - $file=dol_buildpath($reldir."core/modules/contract/doc/".$file,0); - if (file_exists($file)) - { - $filefound=1; - $classname=$prefix.'_'.$modele; - break; - } - } - if ($filefound) break; - } - - // Charge le modele - if ($filefound) - { - require_once $file; - - $obj = new $classname($db); - - // We save charset_output to restore it because write_file can change it if needed for - // output format that does not support UTF8. - $sav_charset_output=$outputlangs->charset_output; - if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) - { - $outputlangs->charset_output=$sav_charset_output; - - // We delete old preview - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - dol_delete_preview($object); - - // Success in building document. We build meta file. - dol_meta_create($object); - - return 1; - } - else - { - $outputlangs->charset_output=$sav_charset_output; - dol_print_error($db,"contract_pdf_create Error: ".$obj->error); - return 0; - } - } - else - { - print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); - return 0; - } + return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } diff --git a/htdocs/core/modules/dons/html_cerfafr.html b/htdocs/core/modules/dons/html_cerfafr.html index 2dc9c72968c..ca3f3510eee 100644 --- a/htdocs/core/modules/dons/html_cerfafr.html +++ b/htdocs/core/modules/dons/html_cerfafr.html @@ -157,8 +157,8 @@
    -
    __Date__ & __Signature__
    -
    __NOW__
    +
    __Date__ & __Signature__
    +
    __NOW__
    diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index b4325139878..aaddbc1d748 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -277,7 +277,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition // Make substitution $substitutionarray=array( - '__FROM_NAME__' => $this->emetteur->nom, + '__FROM_NAME__' => $this->emetteur->name, '__FROM_EMAIL__' => $this->emetteur->email, '__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_HT__' => $object->total_ht, @@ -483,7 +483,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition } $reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - + if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 9b088504649..145eeafcdde 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -73,7 +73,7 @@ class pdf_merou extends ModelePdfExpedition /** * Function to build pdf onto disk * - * @param Object &$object Object expedition to generate (or id if old method) + * @param Object $object Object expedition to generate (or id if old method) * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -376,7 +376,7 @@ class pdf_merou extends ModelePdfExpedition /** * Show table for lines * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param string $tab_top Top position of table * @param string $tab_height Height of table (rectangle) * @param int $nexY Y @@ -417,7 +417,7 @@ class pdf_merou extends ModelePdfExpedition /** * Show footer of page. Need this->emetteur object * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param Object $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text @@ -446,7 +446,7 @@ class pdf_merou extends ModelePdfExpedition /** * Show top header of page. * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output @@ -539,7 +539,7 @@ class pdf_merou extends ModelePdfExpedition $pdf->SetTextColor(0,0,0); // Sender properties - $carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); + $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client); $pdf->SetFont('','', $default_font_size - 3); $pdf->SetXY($blSocX,$blSocY+4); @@ -617,12 +617,12 @@ class pdf_merou extends ModelePdfExpedition { // On peut utiliser le nom de la societe du contact if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $object->client->nom; + else $socname = $object->client->name; $carac_client_name=$outputlangs->convToOutputCharset($socname); } else { - $carac_client_name=$outputlangs->convToOutputCharset($object->client->nom); + $carac_client_name=$outputlangs->convToOutputCharset($object->client->name); } $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,((!empty($object->contact))?$object->contact:null),$usecontact,'targetwithdetails'); diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index d0b503d1ee6..ea6601b8396 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -76,7 +76,7 @@ class pdf_rouget extends ModelePdfExpedition /** * Function to build pdf onto disk * - * @param Object &$object Object expedition to generate (or id if old method) + * @param Object $object Object expedition to generate (or id if old method) * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -377,7 +377,7 @@ class pdf_rouget extends ModelePdfExpedition /** * Show table for lines * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param string $tab_top Top position of table * @param string $tab_height Height of table (rectangle) * @param int $nexY Y @@ -432,7 +432,7 @@ class pdf_rouget extends ModelePdfExpedition /** * Show top header of page. * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output @@ -587,7 +587,7 @@ class pdf_rouget extends ModelePdfExpedition $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; } - $carac_emetteur .= pdf_build_address($outputlangs,$this->emetteur); + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client); // Show sender $posx=$this->marge_gauche; @@ -631,12 +631,12 @@ class pdf_rouget extends ModelePdfExpedition { // On peut utiliser le nom de la societe du contact if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $object->client->nom; + else $socname = $object->client->name; $carac_client_name=$outputlangs->convToOutputCharset($socname); } else { - $carac_client_name=$outputlangs->convToOutputCharset($object->client->nom); + $carac_client_name=$outputlangs->convToOutputCharset($object->client->name); } $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,(!empty($object->contact)?$object->contact:null),$usecontact,'targetwithdetails'); @@ -672,7 +672,7 @@ class pdf_rouget extends ModelePdfExpedition /** * Show footer of page. Need this->emetteur object * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param Object $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text diff --git a/htdocs/core/modules/expedition/modules_expedition.php b/htdocs/core/modules/expedition/modules_expedition.php index 3f2938ef25f..43292ae95c4 100644 --- a/htdocs/core/modules/expedition/modules_expedition.php +++ b/htdocs/core/modules/expedition/modules_expedition.php @@ -6,6 +6,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2011-2013 Philippe Grand + * Copyright (C) 2014 Marcos García * * 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 @@ -149,100 +150,9 @@ abstract class ModelNumRefExpedition * @param string $modele Force le modele a utiliser ('' to not force) * @param Translate $outputlangs Objet lang a utiliser pour traduction * @return int <=0 if KO, >0 if OK + * @deprecated Use the new function generateDocument of Expedition class */ -function expedition_pdf_create($db, $object, $modele, $outputlangs) +function expedition_pdf_create(DoliDB $db, Expedition $object, $modele, $outputlangs) { - global $conf,$user,$langs; - - $langs->load("sendings"); - - $error=0; - - $srctemplatepath=''; - - // Sets the model on the model name to use - if (! dol_strlen($modele)) - { - if (! empty($conf->global->EXPEDITION_ADDON_PDF)) - { - $modele = $conf->global->EXPEDITION_ADDON_PDF; - } - else - { - $modele = 'rouget'; - } - } - - // If selected model is a filename template (then $modele="modelname:filename") - $tmp=explode(':',$modele,2); - if (! empty($tmp[1])) - { - $modele=$tmp[0]; - $srctemplatepath=$tmp[1]; - } - - // Search template files - $file=''; $classname=''; $filefound=0; - $dirmodels=array('/'); - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); - foreach($dirmodels as $reldir) - { - foreach(array('doc','pdf') as $prefix) - { - $file = $prefix."_".$modele.".modules.php"; - - // We check the model location - $file=dol_buildpath($reldir."core/modules/expedition/doc/".$file,0); - if (file_exists($file)) - { - $filefound=1; - $classname=$prefix.'_'.$modele; - break; - } - } - if ($filefound) break; - } - - // Load the model - if ($filefound) - { - require_once $file; - - $obj = new $classname($db); - - $result=$object->fetch_origin(); - - // We save charset_output to restore it because write_file can change it if needed for - // output format that does not support UTF8. - $sav_charset_output=$outputlangs->charset_output; - if ($obj->write_file($object, $outputlangs, $srctemplatepath) > 0) - { - $outputlangs->charset_output=$sav_charset_output; - - // we delete preview files - //require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - //dol_delete_preview($object); - - return 1; - } - else - { - $outputlangs->charset_output=$sav_charset_output; - dol_syslog("Erreur dans expedition_pdf_create"); - dol_print_error($db,$obj->error); - return 0; - } - } - else - { - if (! $conf->global->EXPEDITION_ADDON_PDF) - { - print $langs->trans("Error")." ".$langs->trans("Error_EXPEDITION_ADDON_PDF_NotDefined"); - } - else - { - print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); - } - return 0; - } + return $object->generateDocument($modele, $outputlangs); } diff --git a/htdocs/core/modules/export/export_excel.modules.php b/htdocs/core/modules/export/export_excel.modules.php index bab287ff3b6..87923b4cb9c 100644 --- a/htdocs/core/modules/export/export_excel.modules.php +++ b/htdocs/core/modules/export/export_excel.modules.php @@ -190,6 +190,14 @@ class ExportExcel extends ModeleExports return -1; } } + + if (!empty($conf->global->MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR)) { + $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_discISAM; + $cacheSettings = array ( + 'dir' => $conf->global->MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR + ); + PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings); + } $this->workbook = new PHPExcel(); $this->workbook->getProperties()->setCreator($user->getFullName($outputlangs).' - Dolibarr '.DOL_VERSION); diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 0084df11e72..2ca90b13ace 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -285,7 +285,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures // Make substitution $substitutionarray=array( - '__FROM_NAME__' => $this->emetteur->nom, + '__FROM_NAME__' => $this->emetteur->name, '__FROM_EMAIL__' => $this->emetteur->email, '__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_HT__' => $object->total_ht, @@ -337,15 +337,15 @@ class doc_generic_invoice_odt extends ModelePDFFactures { } - // Make substitutions into odt of user info + // Make substitutions into odt $array_user=$this->get_substitutionarray_user($user,$outputlangs); $array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); $array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); $array_objet=$this->get_substitutionarray_object($object,$outputlangs); $array_propal=is_object($propal_object)?$this->get_substitutionarray_object($propal_object,$outputlangs,'propal'):array(); - $array_other=$this->get_substitutionarray_other($user,$outputlangs); + $array_other=$this->get_substitutionarray_other($outputlangs); - $tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_propal); + $tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_propal,$array_other); complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray); @@ -440,7 +440,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures } $reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - + if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 8a8ab5fa89e..6d1f5636b85 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -182,7 +182,7 @@ class pdf_crabe extends ModelePDFFactures } } if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva; - + if ($conf->facture->dir_output) { $object->fetch_thirdparty(); @@ -369,7 +369,7 @@ class pdf_crabe extends ModelePDFFactures // $pdf->Image does not increase value return by getY, so we save it manually $posYAfterImage=$curY+$imglinesize['height']; } - + // Description of product line $curX = $this->posxdesc-1; @@ -407,7 +407,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->commitTransaction(); } $posYAfterDescription=$pdf->GetY(); - + $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); $pdf->setPage($pageposbefore); @@ -487,7 +487,7 @@ class pdf_crabe extends ModelePDFFactures $this->tva[$vatrate] += $tvaligne; if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage; - + // Add line if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) { @@ -599,7 +599,7 @@ class pdf_crabe extends ModelePDFFactures /** * Show payments table * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object invoice * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output @@ -735,7 +735,7 @@ class pdf_crabe extends ModelePDFFactures /** * Show miscellaneous information (payment mode, payment term, ...) * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object @@ -891,7 +891,7 @@ class pdf_crabe extends ModelePDFFactures /** * Show total to pay * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Facture $object Object invoice * @param int $deja_regle Montant deja regle * @param int $posy Position depart @@ -1185,7 +1185,7 @@ class pdf_crabe extends ModelePDFFactures /** * Show table for lines * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param string $tab_top Top position of table * @param string $tab_height Height of table (rectangle) * @param int $nexY Y (not used) @@ -1241,7 +1241,7 @@ class pdf_crabe extends ModelePDFFactures //$pdf->MultiCell($this->posxtva-$this->posxpicture-1,2, $outputlangs->transnoentities("Photo"),'','C'); } } - + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); @@ -1289,7 +1289,7 @@ class pdf_crabe extends ModelePDFFactures /** * Show top header of page. * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output @@ -1434,7 +1434,7 @@ class pdf_crabe extends ModelePDFFactures if ($showaddress) { // Sender properties - $carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); + $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client); // Show sender $posy=42; @@ -1479,12 +1479,12 @@ class pdf_crabe extends ModelePDFFactures { // On peut utiliser le nom de la societe du contact if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $object->client->nom; + else $socname = $object->client->name; $carac_client_name=$outputlangs->convToOutputCharset($socname); } else { - $carac_client_name=$outputlangs->convToOutputCharset($object->client->nom); + $carac_client_name=$outputlangs->convToOutputCharset($object->client->name); } $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target'); @@ -1520,7 +1520,7 @@ class pdf_crabe extends ModelePDFFactures /** * Show footer of page. Need this->emetteur object * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param Object $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php index ae0d9f98cda..bca513e3fd6 100644 --- a/htdocs/core/modules/facture/modules_facture.php +++ b/htdocs/core/modules/facture/modules_facture.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2014 Marcos García * * 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 @@ -154,101 +155,10 @@ abstract class ModeleNumRefFactures * @param int $hidedesc Hide description * @param int $hideref Hide ref * @return int <0 if KO, >0 if OK + * @deprecated Use the new function generateDocument of Facture class */ -function facture_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) +function facture_pdf_create(DoliDB $db, Facture $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { - global $conf,$user,$langs; - - $langs->load("bills"); - - $error=0; - - // Increase limit for PDF build - $err=error_reporting(); - error_reporting(0); - @set_time_limit(120); - error_reporting($err); - - $srctemplatepath=''; - - // Positionne le modele sur le nom du modele a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->FACTURE_ADDON_PDF)) - { - $modele = $conf->global->FACTURE_ADDON_PDF; - } - else - { - $modele = 'crabe'; - } - } - - // If selected modele is a filename template (then $modele="modelname:filename") - $tmp=explode(':',$modele,2); - if (! empty($tmp[1])) - { - $modele=$tmp[0]; - $srctemplatepath=$tmp[1]; - } - - // Search template files - $file=''; $classname=''; $filefound=0; - $dirmodels=array('/'); - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); - foreach($dirmodels as $reldir) - { - foreach(array('doc','pdf') as $prefix) - { - $file = $prefix."_".$modele.".modules.php"; - - // On verifie l'emplacement du modele - $file=dol_buildpath($reldir."core/modules/facture/doc/".$file,0); - if (file_exists($file)) - { - $filefound=1; - $classname=$prefix.'_'.$modele; - break; - } - } - if ($filefound) break; - } - - // Charge le modele - if ($filefound) - { - require_once $file; - - $obj = new $classname($db); - - // We save charset_output to restore it because write_file can change it if needed for - // output format that does not support UTF8. - $sav_charset_output=$outputlangs->charset_output; - if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) - { - $outputlangs->charset_output=$sav_charset_output; - - // We delete old preview - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - dol_delete_preview($object); - - // Success in building document. We build meta file. - dol_meta_create($object); - - return 1; - } - else - { - $outputlangs->charset_output=$sav_charset_output; - dol_print_error($db,"facture_pdf_create Error: ".$obj->error); - return -1; - } - - } - else - { - dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file)); - return -1; - } + return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 80cf628838d..9cc39cfb5b0 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -270,7 +270,32 @@ class pdf_soleil extends ModelePDFFicheinter $txt=''.dol_htmlentitiesbr($txt,1,$outputlangs->charset_output).''; $desc=dol_htmlentitiesbr($objectligne->desc,1); + $pdf->startTransaction(); $pdf->writeHTMLCell(0, 0, $curX, $curY + 1, dol_concatdesc($txt,$desc), 0, 1, 0); + $pageposafter=$pdf->getPage(); + if ($pageposafter > $pageposbefore) // There is a pagebreak + { + $pdf->rollbackTransaction(true); + $pageposafter=$pageposbefore; + //print $pageposafter.'-'.$pageposbefore;exit; + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + $pdf->writeHTMLCell(0, 0, $curX, $curY, $txt.'
    '.$desc, LR, 1, 0); + $pageposafter=$pdf->getPage(); + $posyafter=$pdf->GetY(); + //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; + if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text + { + if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page + { + $pdf->AddPage('','',true); + $pdf->setPage($pageposafter+1); + } + } + } + else // No pagebreak + { + $pdf->commitTransaction(); + } $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); @@ -362,7 +387,7 @@ class pdf_soleil extends ModelePDFFicheinter /** * Show table for lines * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param string $tab_top Top position of table * @param string $tab_height Height of table (rectangle) * @param int $nexY Y @@ -425,7 +450,7 @@ class pdf_soleil extends ModelePDFFicheinter /** * Show top header of page. * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output @@ -522,7 +547,7 @@ class pdf_soleil extends ModelePDFFicheinter $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; } - $carac_emetteur .= pdf_build_address($outputlangs,$this->emetteur); + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client); // Show sender $posy=42; @@ -565,12 +590,12 @@ class pdf_soleil extends ModelePDFFicheinter { // On peut utiliser le nom de la societe du contact if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $object->client->nom; + else $socname = $object->client->name; $carac_client_name=$outputlangs->convToOutputCharset($socname); } else { - $carac_client_name=$outputlangs->convToOutputCharset($object->client->nom); + $carac_client_name=$outputlangs->convToOutputCharset($object->client->name); } $carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->client, (isset($object->contact)?$object->contact:''), $usecontact, 'target'); @@ -604,7 +629,7 @@ class pdf_soleil extends ModelePDFFicheinter /** * Show footer of page. Need this->emetteur object * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param Object $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text diff --git a/htdocs/boutique/admin/index.html b/htdocs/core/modules/livraison/doc/index.html similarity index 100% rename from htdocs/boutique/admin/index.html rename to htdocs/core/modules/livraison/doc/index.html diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php similarity index 98% rename from htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php rename to htdocs/core/modules/livraison/doc/pdf_typhon.modules.php index 569cfdff85e..e3e9be99411 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2008 Chiptronik * Copyright (C) 2011-2012 Philippe Grand @@ -21,7 +21,7 @@ */ /** - * \file htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php + * \file htdocs/core/modules/livraison/doc/pdf_typhon.modules.php * \ingroup livraison * \brief File of class to manage receving receipts with template Typhon * \author Laurent Destailleur @@ -97,11 +97,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Define position of columns $this->posxdesc=$this->marge_gauche+1; - $this->posxcomm=900; + $this->posxcomm=112; //$this->posxtva=112; //$this->posxup=126; - $this->posxqty=140; - $this->posxremainingqty=165; + $this->posxqty=165; + $this->posxremainingqty=185; //$this->posxdiscount=162; //$this->postotalht=174; if ($this->page_largeur < 210) // To work with US executive format @@ -558,7 +558,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder /** * Show miscellaneous information (payment mode, payment term, ...) * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object @@ -585,7 +585,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder /** * Show table for lines * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param string $tab_top Top position of table * @param string $tab_height Height of table (rectangle) * @param int $nexY Y (not used) @@ -636,21 +636,21 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->line($this->posxqty, $tab_top, $this->posxqty, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxqty, $tab_top+1); - $pdf->MultiCell($this->posxremainingqty - $this->posxqty, 2, $outputlangs->transnoentities("QtyShipped"),'','C'); + $pdf->MultiCell($this->posxremainingqty - $this->posxqty, 2, $outputlangs->transnoentities("QtyShipped"),'','R'); } // Remain to ship $pdf->line($this->posxremainingqty, $tab_top, $this->posxremainingqty, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxremainingqty, $tab_top+1); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxremainingqty, 2, $outputlangs->transnoentities("KeepToShip"),'','C'); + $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxremainingqty, 2, $outputlangs->transnoentities("KeepToShip"),'','R'); } } /** * Show top header of page. * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output @@ -825,12 +825,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder { // On peut utiliser le nom de la societe du contact if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $object->client->nom; + else $socname = $object->client->name; $carac_client_name=$outputlangs->convToOutputCharset($socname); } else { - $carac_client_name=$outputlangs->convToOutputCharset($object->client->nom); + $carac_client_name=$outputlangs->convToOutputCharset($object->client->name); } $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target'); @@ -866,7 +866,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder /** * Show footer of page. Need this->emetteur object * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param Object $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text diff --git a/htdocs/core/modules/livraison/modules_livraison.php b/htdocs/core/modules/livraison/modules_livraison.php index fe8e4220281..22c25bcfd5f 100644 --- a/htdocs/core/modules/livraison/modules_livraison.php +++ b/htdocs/core/modules/livraison/modules_livraison.php @@ -4,6 +4,7 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2006-2011 Regis Houssin * Copyright (C) 2011-2012 Philippe Grand + * Copyright (C) 2014 Marcos García * * 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 @@ -154,92 +155,10 @@ abstract class ModeleNumRefDeliveryOrder * @param string $modele force le modele a utiliser ('' to not force) * @param Translate $outputlangs objet lang a utiliser pour traduction * @return int 0 if KO, 1 if OK + * @deprecated Use the new function generateDocument of Livraison class */ -function delivery_order_pdf_create($db, $object, $modele, $outputlangs='') +function delivery_order_pdf_create(DoliDB $db, Livraison $object, $modele, $outputlangs='') { - global $conf,$user,$langs; - - $langs->load("deliveries"); - - $error=0; - - $srctemplatepath=''; - - // Positionne modele sur le nom du modele de bon de livraison a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->LIVRAISON_ADDON_PDF)) - { - $modele = $conf->global->LIVRAISON_ADDON_PDF; - } - else - { - $modele = 'typhon'; - } - } - - // If selected modele is a filename template (then $modele="modelname:filename") - $tmp=explode(':',$modele,2); - if (! empty($tmp[1])) - { - $modele=$tmp[0]; - $srctemplatepath=$tmp[1]; - } - - // Search template files - $file=''; $classname=''; $filefound=0; - $dirmodels=array('/'); - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); - foreach($dirmodels as $reldir) - { - foreach(array('doc','pdf') as $prefix) - { - $file = $prefix."_".$modele.".modules.php"; - - // On verifie l'emplacement du modele - $file=dol_buildpath($reldir."core/modules/livraison/pdf/".$file,0); - if (file_exists($file)) - { - $filefound=1; - $classname=$prefix.'_'.$modele; - break; - } - } - if ($filefound) break; - } - - // Charge le modele - if ($filefound) - { - require_once $file; - - $obj = new $classname($db); - - // We save charset_output to restore it because write_file can change it if needed for - // output format that does not support UTF8. - $sav_charset_output=$outputlangs->charset_output; - if ($obj->write_file($object,$outputlangs) > 0) - { - $outputlangs->charset_output=$sav_charset_output; - - // we delete preview files - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - dol_delete_preview($object); - - return 1; - } - else - { - $outputlangs->charset_output=$sav_charset_output; - dol_syslog("Erreur dans delivery_order_pdf_create"); - dol_print_error($db,$obj->error); - return 0; - } - } - else - { - print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); - return 0; - } + return $object->generateDocument($modele, $outputlangs); } diff --git a/htdocs/core/modules/livraison/pdf/index.html b/htdocs/core/modules/livraison/pdf/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 2729234483f..3f8df87cd7a 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -158,7 +158,7 @@ class mailing_contacts1 extends MailingTargets */ function url($id) { - return ''.img_object('',"contact").''; + return ''.img_object('',"contact").''; } diff --git a/htdocs/core/modules/mailings/contacts2.modules.php b/htdocs/core/modules/mailings/contacts2.modules.php index 35d840125a7..fe49ce56b35 100644 --- a/htdocs/core/modules/mailings/contacts2.modules.php +++ b/htdocs/core/modules/mailings/contacts2.modules.php @@ -61,7 +61,7 @@ class mailing_contacts2 extends MailingTargets */ function url($id) { - return ''.img_object('',"contact").''; + return ''.img_object('',"contact").''; } /** diff --git a/htdocs/core/modules/mailings/contacts3.modules.php b/htdocs/core/modules/mailings/contacts3.modules.php index 327e36cf826..92640291088 100644 --- a/htdocs/core/modules/mailings/contacts3.modules.php +++ b/htdocs/core/modules/mailings/contacts3.modules.php @@ -59,7 +59,7 @@ class mailing_contacts3 extends MailingTargets */ function url($id) { - return ''.img_object('',"contact").''; + return ''.img_object('',"contact").''; } /** diff --git a/htdocs/core/modules/mailings/contacts4.modules.php b/htdocs/core/modules/mailings/contacts4.modules.php index c86ca871c17..59355b372fe 100644 --- a/htdocs/core/modules/mailings/contacts4.modules.php +++ b/htdocs/core/modules/mailings/contacts4.modules.php @@ -59,7 +59,7 @@ class mailing_contacts4 extends MailingTargets */ function url($id) { - return ''.img_object('',"contact").''; + return ''.img_object('',"contact").''; } /** diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index aa76e6b9efc..dd6e18dfa91 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -140,7 +140,7 @@ class mailing_fraise extends MailingTargets */ function url($id) { - return ''.img_object('',"user").''; + return ''.img_object('',"user").''; } diff --git a/htdocs/core/modules/mailings/framboise.modules.php b/htdocs/core/modules/mailings/framboise.modules.php index 4572d894bac..c647466e796 100644 --- a/htdocs/core/modules/mailings/framboise.modules.php +++ b/htdocs/core/modules/mailings/framboise.modules.php @@ -59,7 +59,7 @@ class mailing_framboise extends MailingTargets global $conf, $langs; $langs->load("members"); $langs->load("companies"); - + $cibles = array(); // Select the members from category @@ -229,11 +229,7 @@ class mailing_framboise extends MailingTargets */ function url($id) { - //$companystatic=new Societe($this->db); - //$companystatic->id=$id; - //$companystatic->nom=''; - //return $companystatic->getNomUrl(1); // Url too long - return ''.img_object('',"user").''; + return ''.img_object('',"user").''; } } diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php index b8482a24c3e..50da9252ecc 100644 --- a/htdocs/core/modules/mailings/modules_mailings.php +++ b/htdocs/core/modules/mailings/modules_mailings.php @@ -27,8 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; /** - * \class MailingTargets - * \brief Parent class of emailing target selectors modules + * Parent class of emailing target selectors modules */ class MailingTargets // This can't be abstract as it is used for some method { diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php index 61c3e2fb464..2c93b588524 100644 --- a/htdocs/core/modules/mailings/pomme.modules.php +++ b/htdocs/core/modules/mailings/pomme.modules.php @@ -129,7 +129,7 @@ class mailing_pomme extends MailingTargets */ function url($id) { - return ''.img_object('',"user").''; + return ''.img_object('',"user").''; } diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 9d7fb16aaab..df8ec79f988 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -240,10 +240,6 @@ class mailing_thirdparties extends MailingTargets */ function url($id) { - //$companystatic=new Societe($this->db); - //$companystatic->id=$id; - //$companystatic->nom=''; - //return $companystatic->getNomUrl(1); // Url too long return ''.img_object('',"company").''; } diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index a907ad0ec3f..5837329a476 100644 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -40,7 +40,7 @@ class mailing_thirdparties_services_expired extends MailingTargets function __construct($db) { global $conf; - + $this->db=$db; $this->arrayofproducts=array(); @@ -233,10 +233,6 @@ class mailing_thirdparties_services_expired extends MailingTargets */ function url($id) { - //$companystatic=new Societe($this->db); - //$companystatic->id=$id; - //$companystatic->nom=''; - //return $companystatic->getNomUrl(1); // Url too long return ''.img_object('',"company").''; } diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index 043a2e89f5c..cef4155c607 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -99,7 +99,7 @@ class pdf_standard * Methode qui permet de modifier la taille des caracteres * Cela modiera aussi l'espace entre chaque ligne * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param int $pt point * @return void */ @@ -118,7 +118,7 @@ class pdf_standard * - %LOGO% is replace with company logo * - %PHOTO% is replace with photo provided as parameter * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param string $textleft Text left * @param string $header Header * @param string $footer Footer @@ -300,7 +300,7 @@ class pdf_standard /** * Print dot line * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param int $x1 X1 * @param int $y1 Y1 * @param int $x2 X2 @@ -341,7 +341,7 @@ class pdf_standard /** * Fonction realisant une croix aux 4 coins des cartes * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param int $x1 X1 * @param int $y1 Y1 * @param int $x2 X2 @@ -412,7 +412,7 @@ class pdf_standard /** * Set format * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param string $format Format * @return void */ diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 9a544b1ece0..e074bfe82f1 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -229,6 +229,14 @@ class modAccounting extends DolibarrModules $this->rights[$r][4] = 'fiscalyear'; $this->rights[$r][5] = ''; $r++; + + $this->rights[$r][0] = 50440; + $this->rights[$r][1] = 'Manage chart of accounts'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 1; + $this->rights[$r][4] = 'chartofaccount'; + $this->rights[$r][5] = ''; + $r++; // Main menu entries $this->menus = array(); diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 8d7b930df08..c633734b227 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2009-2011 Regis Houssin @@ -214,7 +214,7 @@ class modAgenda extends DolibarrModules 'type'=>'left', 'titre'=>'NewAction', 'mainmenu'=>'agenda', - 'url'=>'/comm/action/fiche.php?mainmenu=agenda&leftmenu=agenda&action=create', + 'url'=>'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create', 'langs'=>'commercial', 'position'=>101, 'perms'=>'($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create)', @@ -394,7 +394,7 @@ class modAgenda extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s on ac.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co on s.fk_pays = co.rowid'; $this->export_sql_end[$r] .=' Where ac.entity = '.$conf->entity; - $this->export_sql_end[$r] .=' ORDER BY datep'; + $this->export_sql_end[$r] .=' ORDER BY ac.datep'; } diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php index 43fbe916c47..0d383603a06 100644 --- a/htdocs/core/modules/modBanque.class.php +++ b/htdocs/core/modules/modBanque.class.php @@ -182,7 +182,7 @@ class modBanque extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture as f ON f.rowid = pf.fk_facture'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON f.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' WHERE ba.rowid = b.fk_account AND bch.rowid = b.fk_bordereau and bch.fk_bank_account=ba.rowid'; - $this->export_sql_end[$r] .=' AND b.fk_type = "CHQ"'; + $this->export_sql_end[$r] .=" AND b.fk_type = 'CHQ'"; $this->export_sql_end[$r] .=' AND p.fk_paiement = 7'; $this->export_sql_end[$r] .=' AND ba.entity = '.$conf->entity; $this->export_sql_order[$r] =' ORDER BY b.datev, b.num_releve'; diff --git a/htdocs/core/modules/modBoutique.class.php b/htdocs/core/modules/modBoutique.class.php deleted file mode 100644 index 837dd8c6c24..00000000000 --- a/htdocs/core/modules/modBoutique.class.php +++ /dev/null @@ -1,118 +0,0 @@ - - * Copyright (C) 2004-2008 Laurent Destailleur - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier - * - * 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 . - */ - -/** - * \defgroup oscommerce Module oscommerce - * \brief Module pour gerer une boutique et interface avec OSCommerce - * \file htdocs/core/modules/modBoutique.class.php - * \ingroup oscommerce - * \brief Fichier de description et activation du module OSCommerce - */ - -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; - - -/** - * Classe de description et activation du module OSCommerce - */ -class modBoutique extends DolibarrModules -{ - - /** - * Constructor. Define names, constants, directories, boxes, permissions - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db = $db; - $this->numero = 800; - - $this->family = "products"; - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) - $this->name = preg_replace('/^mod/i','',get_class($this)); - $this->description = "Interface de visualisation d'une boutique OSCommerce ou OSCSS"; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 1; - - // Data directories to create when module is enabled - $this->dirs = array(); - - // Config pages -// $this->config_page_url = array("boutique.php","osc-languages.php"); - $this->config_page_url = array("boutique.php@boutique"); - - // Dependancies - $this->depends = array(); - $this->requiredby = array(); - $this->conflictwith = array("modOSCommerceWS"); - $this->langfiles = array("shop"); - - // Constants - $this->const = array(); - $r=0; - - $this->const[$r][0] = "OSC_DB_HOST"; - $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "localhost"; - $this->const[$r][3] = "Host for OSC database for OSCommerce module 1"; - $this->const[$r][4] = 0; - $r++; - - // Boites - $this->boxes = array(); - - // Permissions - $this->rights = array(); - $this->rights_class = 'boutique'; - } - - /** - * Function called when module is enabled. - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. - * It also creates data directories. - * - * @param string $options Options when enabling module ('', 'noboxes') - * @return int 1 if OK, 0 if KO - */ - function init($options='') - { - $sql = array(); - - return $this->_init($sql,$options); - } - - /** - * Function called when module is disabled. - * Remove from database constants, boxes and permissions from Dolibarr database. - * Data directories are not deleted - * - * @param string $options Options when enabling module ('', 'noboxes') - * @return int 1 if OK, 0 if KO - */ - function remove($options='') - { - $sql = array(); - - return $this->_remove($sql,$options); - } - -} diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index 7a9434ab934..4a2f0bc20b4 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -98,8 +98,10 @@ class modCommande extends DolibarrModules $this->const[$r][4] = 0; // Boxes - $this->boxes = array(); - $this->boxes = array(0=>array('file'=>'box_commandes.php','enabledbydefaulton'=>'Home'),2=>array('file'=>'box_graph_orders_permonth.php','enabledbydefaulton'=>'Home')); + $this->boxes = array( + 0=>array('file'=>'box_commandes.php','enabledbydefaulton'=>'Home'), + 2=>array('file'=>'box_graph_orders_permonth.php','enabledbydefaulton'=>'Home') + ); // Permissions $this->rights = array(); @@ -173,16 +175,20 @@ class modCommande extends DolibarrModules $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='CustomersOrdersAndOrdersLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r]=array(array("commande","commande","export")); - $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','co.label'=>'Country','co.code'=>"CountryCode",'s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation",'c.date_commande'=>"OrderDate",'c.amount_ht'=>"Amount",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total_ttc'=>"TotalTTC",'c.facture'=>"Billed",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate','cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','co.label'=>'Country','co.code'=>"CountryCode",'s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation",'c.date_commande'=>"OrderDate",'c.amount_ht'=>"Amount",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total_ttc'=>"TotalTTC",'c.facture'=>"Billed",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate','c.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','c.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Number",'c.remise_percent'=>"Number",'c.total_ht'=>"Number",'c.total_ttc'=>"Number",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Number",'cd.qty'=>"Number",'cd.total_ht'=>"Number",'cd.total_tva'=>"Number",'cd.total_ttc'=>"Number",'p.rowid'=>'List:Product:ref','p.ref'=>'Text','p.label'=>'Text'); $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Number",'c.remise_percent'=>"Number",'c.total_ht'=>"Number",'c.total_ttc'=>"Number",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Number",'cd.qty'=>"Number",'cd.total_ht'=>"Number",'cd.total_tva'=>"Number",'cd.total_ttc'=>"Number",'p.rowid'=>'List:Product:ref','p.ref'=>'Text','p.label'=>'Text'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','co.label'=>'company','co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"order",'c.ref'=>"order",'c.ref_client'=>"order",'c.fk_soc'=>"order",'c.date_creation'=>"order",'c.date_commande'=>"order",'c.amount_ht'=>"order",'c.remise_percent'=>"order",'c.total_ht'=>"order",'c.total_ttc'=>"order",'c.facture'=>"order",'c.fk_statut'=>"order",'c.note'=>"order",'c.date_livraison'=>"order",'cd.rowid'=>'order_line','cd.label'=>"order_line",'cd.description'=>"order_line",'cd.product_type'=>'order_line','cd.tva_tx'=>"order_line",'cd.qty'=>"order_line",'cd.total_ht'=>"order_line",'cd.total_tva'=>"order_line",'cd.total_ttc'=>"order_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product'); $this->export_dependencies_array[$r]=array('order_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'commande as c, '.MAIN_DB_PREFIX.'societe as s'; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; - $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'commandedet as cd'; + $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'commande as c'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON c.fk_user_author = uc.rowid'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON c.fk_user_valid = uc.rowid'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'commande_extrafields as extra ON c.rowid = extra.fk_object'; + $this->export_sql_end[$r] .=' , '.MAIN_DB_PREFIX.'commandedet as cd'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on cd.fk_product = p.rowid'; $this->export_sql_end[$r] .=' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_commande'; $this->export_sql_end[$r] .=' AND c.entity = '.$conf->entity; diff --git a/htdocs/core/modules/modComptabilite.class.php b/htdocs/core/modules/modComptabilite.class.php index f4f943bc3cc..74002f0065f 100644 --- a/htdocs/core/modules/modComptabilite.class.php +++ b/htdocs/core/modules/modComptabilite.class.php @@ -93,30 +93,6 @@ class modComptabilite extends DolibarrModules $this->rights[$r][3] = 1; $this->rights[$r][4] = 'resultat'; $this->rights[$r][5] = 'lire'; - - $r++; - $this->rights[$r][0] = 96; - $this->rights[$r][1] = 'Parametrer la ventilation'; - $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'ventilation'; - $this->rights[$r][5] = 'parametrer'; - - $r++; - $this->rights[$r][0] = 97; - $this->rights[$r][1] = 'Lire les ventilations de factures'; - $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; - $this->rights[$r][4] = 'ventilation'; - $this->rights[$r][5] = 'lire'; - - $r++; - $this->rights[$r][0] = 98; - $this->rights[$r][1] = 'Ventiler les lignes de factures'; - $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'ventilation'; - $this->rights[$r][5] = 'creer'; } diff --git a/htdocs/core/modules/modContrat.class.php b/htdocs/core/modules/modContrat.class.php index 2ffc46b60bb..4906d9e3954 100644 --- a/htdocs/core/modules/modContrat.class.php +++ b/htdocs/core/modules/modContrat.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2011 Juanjo Menent * This program is free software; you can redistribute it and/or modify @@ -41,6 +41,8 @@ class modContrat extends DolibarrModules */ function __construct($db) { + global $conf; + $this->db = $db; $this->numero = 54; @@ -114,6 +116,53 @@ class modContrat extends DolibarrModules $this->rights[5][3] = 0; $this->rights[5][4] = 'supprimer'; + // Exports + //-------- + $r=1; + + $this->export_code[$r]=$this->rights_class.'_'.$r; + $this->export_label[$r]='ContractAndServices'; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_icon[$r]='contract'; + $this->export_permission[$r]=array(array("contrat","export")); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode', + 's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode', + 's.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra', + 'co.rowid'=>"contractId",'co.ref'=>"contactRef",'co.datec'=>"contractDateCreation",'co.date_contrat'=>"DateContract",'co.mise_en_service'=>"DateMiseService", + 'co.fin_validite'=>"EndValidity",'co.date_cloture'=>"Cloture",'co.note_private'=>"NotePrivate",'co.note_public'=>"NotePublic", + 'cod.rowid'=>'LineId','cod.label'=>"LineLabel",'cod.description'=>"LineDescription",'cod.price_ht'=>"LineUnitPrice",'cod.tva_tx'=>"LineVATRate", + 'cod.qty'=>"LineQty",'cod.total_ht'=>"LineTotalHT",'cod.total_tva'=>"LineTotalVAT",'cod.total_ttc'=>"LineTotalTTC", + 'cod.date_ouverture'=>"DateStart",'cod.date_ouverture_prevue'=>"DateStartPrevis",'cod.date_fin_validite'=>"EndValidity",'cod.date_cloture'=>"DateEnd", + 'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); + + $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company', + 's.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company', + 's.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company', + 'co.rowid'=>"Contract",'co.ref'=>"Contract",'co.datec'=>"Contract",'co.date_contrat'=>"Contract",'co.mise_en_service'=>"Contract", + 'co.fin_validite'=>"Contract",'co.date_cloture'=>"Contract",'co.note_private'=>"Contract",'co.note_public'=>"Contract", + 'cod.rowid'=>'contract_line','cod.label'=>"contract_line",'cod.description'=>"contract_line",'cod.price_ht'=>"contract_line",'cod.tva_tx'=>"contract_line", + 'cod.qty'=>"contract_line",'cod.total_ht'=>"contract_line",'cod.total_tva'=>"contract_line",'cod.total_ttc'=>"contract_line", + 'cod.date_ouverture'=>"contract_line",'cod.date_ouverture_prevue'=>"contract_line",'cod.date_fin_validite'=>"contract_line",'cod.date_cloture'=>"contract_line", + 'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product'); + + $this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text', + 's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text', + 's.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text', + 'co.ref'=>"Text",'co.datec'=>"Date",'co.date_contrat'=>"Date",'co.mise_en_service'=>"Date", + 'co.fin_validite'=>"Date",'co.date_cloture'=>"Date",'co.note_private'=>"Text",'co.note_public'=>"Text", + 'cod.label'=>"Text",'cod.description'=>"Text",'cod.price_ht'=>"Numeric",'cod.tva_tx'=>"Numeric", + 'cod.qty'=>"Numeric",'cod.total_ht'=>"Numeric",'cod.total_tva'=>"Numeric",'cod.total_ttc'=>"Numeric", + 'cod.date_ouverture'=>"Date",'cod.date_ouverture_prevue'=>"Date",'cod.date_fin_validite'=>"Date",'cod.date_cloture'=>"Date", + 'p.rowid'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text'); + + + $this->export_sql_start[$r]='SELECT DISTINCT '; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,'; + $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'contrat as co,'; + $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'contratdet as cod'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (cod.fk_product = p.rowid)'; + $this->export_sql_end[$r] .=' WHERE co.fk_soc = s.rowid and co.rowid = cod.fk_contrat'; + $this->export_sql_end[$r] .=' AND co.entity = '.$conf->entity; } diff --git a/htdocs/core/modules/modDeplacement.class.php b/htdocs/core/modules/modDeplacement.class.php index 24536bc5a68..75d3ab328c8 100644 --- a/htdocs/core/modules/modDeplacement.class.php +++ b/htdocs/core/modules/modDeplacement.class.php @@ -78,25 +78,31 @@ class modDeplacement extends DolibarrModules $this->rights_class = 'deplacement'; $this->rights[1][0] = 171; - $this->rights[1][1] = 'Lire les deplacements'; + $this->rights[1][1] = 'Lire ses notes de frais et deplacements et celles de sa hierarchy'; $this->rights[1][2] = 'r'; $this->rights[1][3] = 1; $this->rights[1][4] = 'lire'; $this->rights[2][0] = 172; - $this->rights[2][1] = 'Creer/modifier les deplacements'; + $this->rights[2][1] = 'Creer/modifier une note de frais et deplacements'; $this->rights[2][2] = 'w'; $this->rights[2][3] = 0; $this->rights[2][4] = 'creer'; $this->rights[3][0] = 173; - $this->rights[3][1] = 'Supprimer les deplacements'; + $this->rights[3][1] = 'Supprimer les notes de frais et deplacements'; $this->rights[3][2] = 'd'; $this->rights[3][3] = 0; $this->rights[3][4] = 'supprimer'; + $this->rights[3][0] = 174; + $this->rights[3][1] = 'Lire toutes les notes de frais'; + $this->rights[3][2] = 'd'; + $this->rights[3][3] = 0; + $this->rights[3][4] = 'readall'; + $this->rights[6][0] = 178; - $this->rights[6][1] = 'Exporter les deplacements'; + $this->rights[6][1] = 'Exporter les notes de frais et deplacements'; $this->rights[6][2] = 'd'; $this->rights[6][3] = 0; $this->rights[6][4] = 'export'; diff --git a/htdocs/core/modules/modDynamicPrices.class.php b/htdocs/core/modules/modDynamicPrices.class.php new file mode 100755 index 00000000000..3a47e6a70e9 --- /dev/null +++ b/htdocs/core/modules/modDynamicPrices.class.php @@ -0,0 +1,122 @@ + + * + * 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 . + */ + +/** + * \defgroup produit Module dynamic prices + * \brief Module to manage dynamic prices in products + * \file htdocs/core/modules/modDynamicPrices.class.php + * \ingroup produit + * \brief File to describe module to manage dynamic prices in products + */ +include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; + + +/** + * Class descriptor of DynamicPrices module + */ +class modDynamicPrices extends DolibarrModules +{ + + /** + * Constructor. Define names, constants, directories, boxes, permissions + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + $this->db = $db; + $this->numero = 2200; + + $this->family = "products"; + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) + $this->name = preg_replace('/^mod/i','',get_class($this)); + $this->description = "Enable the usage of math expressions for prices"; + $this->version = 'experimental'; // 'experimental' or 'dolibarr' or version + // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); + // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) + $this->special = 0; + // Name of image file used for this module. + $this->picto='technic'; + + // Data directories to create when module is enabled + $this->dirs = array(); + + // Config pages + //------------- + //$this->config_page_url = array(); + + // Dependancies + //------------- + $this->depends = array(); + $this->requiredby = array(); + $this->langfiles = array("other"); + + // Constantes + //----------- + $this->const = array(); + + // New pages on tabs + // ----------------- + $this->tabs = array(); + + // Boxes + //------ + $this->boxes = array(); + + // Permissions + //------------ + $this->rights = array(); + $this->rights_class = 'dynamicprices'; + $r=0; + } + + + /** + * Function called when module is enabled. + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * It also creates data directories + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + function init($options='') + { + // Prevent pb of modules not correctly disabled + //$this->remove($options); + + $sql = array(); + + return $this->_init($sql,$options); + } + + /** + * Function called when module is disabled. + * Remove from database constants, boxes and permissions from Dolibarr database. + * Data directories are not deleted + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + function remove($options='') + { + $sql = array(); + + return $this->_remove($sql,$options); + } + +} diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index eadfa84ba6c..e45b40a3f57 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -213,7 +213,7 @@ class modHoliday extends DolibarrModules 'titre'=>'MenuAddCP', 'mainmenu'=>'holiday', 'leftmenu'=>'holiday_add', - 'url'=>'/holiday/fiche.php?mainmenu=holiday&action=request', + 'url'=>'/holiday/card.php?mainmenu=holiday&action=request', 'langs'=>'holiday', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>101, 'enabled'=>'$conf->holiday->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. diff --git a/htdocs/core/modules/modMargin.class.php b/htdocs/core/modules/modMargin.class.php index b17d82d051d..19100576a83 100644 --- a/htdocs/core/modules/modMargin.class.php +++ b/htdocs/core/modules/modMargin.class.php @@ -106,8 +106,8 @@ class modMargin extends DolibarrModules 'url'=>'/margin/index.php', 'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>100, - 'enabled'=>'$user->rights->margins->liretous', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled. - 'perms'=>'1', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules + 'enabled'=>'$conf->margin->enabled', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled. + 'perms'=>'$user->rights->margins->liretous', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules 'target'=>'', 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both $r++; diff --git a/htdocs/core/modules/modPrintIPP.class.php b/htdocs/core/modules/modPrintIPP.class.php index d9e2166b4e6..3cdcd6cdfa6 100644 --- a/htdocs/core/modules/modPrintIPP.class.php +++ b/htdocs/core/modules/modPrintIPP.class.php @@ -51,7 +51,7 @@ class modPrintIPP extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Print via Cups IPP Printer."; - $this->version = 'experimental'; // 'development' or 'experimental' or 'dolibarr' or version + $this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) $this->special = 1; @@ -67,10 +67,11 @@ class modPrintIPP extends DolibarrModules $this->config_page_url = array("printipp.php@printipp"); // Dependances + $this->hidden = (! empty($_SERVER["WINDIR"])); $this->depends = array(); $this->requiredby = array(); - $this->phpmin = array(5,1); // Minimum version of PHP required by module - $this->need_dolibarr_version = array(3,2); // Minimum version of Dolibarr required by module + $this->phpmin = array(5,1); // Minimum version of PHP required by module + $this->need_dolibarr_version = array(3,7,-2); // Minimum version of Dolibarr required by module $this->conflictwith = array(); $this->langfiles = array("printipp"); diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 87dbc3e6dde..a23fc59a2d0 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -198,7 +198,7 @@ class modProduct extends DolibarrModules $this->export_entities_array[$r][$fieldname]='product'; } } - // End add axtra fields + // End add extra fields $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p'; @@ -210,14 +210,14 @@ class modProduct extends DolibarrModules { // Exports product multiprice $r++; - $this->export_code[$r]=$this->rights_class.'_'.$key; + $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]="ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r]=array(array("produit","export")); $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref", - 'pr.price_base_type'=>"PriceBase",'pr.price_level'=>"PriceLevel", - 'pr.price'=>"HT",'pr.price_ttc'=>"TTC", - 'pr.price_min'=>"MinPriceHT",'pr.price_min_ttc'=>"MinPriceTTC", - 'pr.tva_tx'=>'VATRate', + 'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel", + 'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC", + 'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC", + 'pr.tva_tx'=>'PriceLevelVATRate', 'pr.date_price'=>'DateCreation'); //$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Number",'p.surface'=>"Number",'p.volume'=>"Number",'p.weight'=>"Number",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Number",'p.price_ttc'=>"Number",'p.tva_tx'=>'Number','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date'); $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product", @@ -304,11 +304,11 @@ class modProduct extends DolibarrModules $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon $this->import_tables_array[$r]=array('pr'=>MAIN_DB_PREFIX.'product_price'); $this->import_tables_creator_array[$r]=array('pr'=>'fk_user_author'); // Fields to store import user id - $this->import_fields_array[$r]=array('pr.fk_product'=>"Id*", - 'pr.price_base_type'=>"PriceBase",'pr.price_level'=>"PriceLevel", - 'pr.price'=>"HT",'pr.price_ttc'=>"TTC", - 'pr.price_min'=>"MinPriceHT",'pr.price_min_ttc'=>"MinPriceTTC", - 'pr.tva_tx'=>'VATRate', + $this->import_fields_array[$r]=array('pr.fk_product'=>"ProductRowid*", + 'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel", + 'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC", + 'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC", + 'pr.tva_tx'=>'PriceLevelVATRate', 'pr.date_price'=>'DateCreation*'); $this->import_regex_array[$r]=array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); $this->import_examplevalues_array[$r]=array('pr.fk_product'=>"1", @@ -332,7 +332,6 @@ class modProduct extends DolibarrModules */ function init($options='') { - // Permissions $this->remove($options); $sql = array(); diff --git a/htdocs/core/modules/modProductBatch.class.php b/htdocs/core/modules/modProductBatch.class.php index 0cd30f04d22..4dd7d0a81ae 100644 --- a/htdocs/core/modules/modProductBatch.class.php +++ b/htdocs/core/modules/modProductBatch.class.php @@ -49,7 +49,7 @@ class modProductBatch extends DolibarrModules $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Batch number, eat-by and sell-by date management module"; - $this->rights_class = 'stock'; + $this->rights_class = 'productbatch'; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'experimental'; // Key used in llx_const table to save module status enabled/disabled (where dluo is value of property name of module in uppercase) @@ -67,7 +67,7 @@ class modProductBatch extends DolibarrModules $this->config_page_url = array(); // Dependencies - $this->depends = array("modProduct","modStock"); // List of modules id that must be enabled if this module is enabled + $this->depends = array("modProduct","modStock","modExpedition","modSupplier"); // List of modules id that must be enabled if this module is enabled. modExpedition is required to manage batch exit (by manual stock decrease on shipment), modSupplier to manage batch entry (after supplier order). $this->requiredby = array(); // List of modules id to disable if this one is disabled $this->phpmin = array(5,0); // Minimum version of PHP required by module $this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index e97005c37be..2a390118b72 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -169,7 +169,7 @@ class modPropale extends DolibarrModules $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='ProposalsAndProposalsLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r]=array(array("propale","export")); - $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','co.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.datec'=>"DateCreation",'c.datep'=>"DatePropal",'c.fin_validite'=>"DateEndPropal",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total'=>"TotalTTC",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate','cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','co.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.datec'=>"DateCreation",'c.datep'=>"DatePropal",'c.fin_validite'=>"DateEndPropal",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total'=>"TotalTTC",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate','c.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','c.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date",'c.fin_validite'=>"Date",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text'); $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date",'c.fin_validite'=>"Date",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.ref'=>'Text','p.label'=>'Text'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"propal",'c.ref'=>"propal",'c.ref_client'=>"propal",'c.fk_soc'=>"propal",'c.datec'=>"propal",'c.datep'=>"propal",'c.fin_validite'=>"propal",'c.remise_percent'=>"propal",'c.total_ht'=>"propal",'c.total'=>"propal",'c.fk_statut'=>"propal",'c.note_public'=>"propal",'c.date_livraison'=>"propal",'cd.rowid'=>'propal_line','cd.label'=>"propal_line",'cd.description'=>"propal_line",'cd.product_type'=>'propal_line','cd.tva_tx'=>"propal_line",'cd.qty'=>"propal_line",'cd.total_ht'=>"propal_line",'cd.total_tva'=>"propal_line",'cd.total_ttc'=>"propal_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product'); @@ -178,7 +178,11 @@ class modPropale extends DolibarrModules $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s '; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; - $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'propal as c, '.MAIN_DB_PREFIX.'propaldet as cd'; + $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'propal as c'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON c.fk_user_author = uc.rowid'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON c.fk_user_valid = uc.rowid'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'propal_extrafields as extra ON c.rowid = extra.fk_object'; + $this->export_sql_end[$r] .=', '.MAIN_DB_PREFIX.'propaldet as cd'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (cd.fk_product = p.rowid)'; $this->export_sql_end[$r] .=' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_propal'; $this->export_sql_end[$r] .=' AND c.entity = '.$conf->entity; diff --git a/htdocs/core/modules/modSalaries.class.php b/htdocs/core/modules/modSalaries.class.php index c82e3d83784..35f5a145bee 100644 --- a/htdocs/core/modules/modSalaries.class.php +++ b/htdocs/core/modules/modSalaries.class.php @@ -23,7 +23,7 @@ */ /** - * \defgroup tax Module salaries + * \defgroup salaries Module salaries * \brief Module to include salaries management * \file htdocs/core/modules/modSalaries.class.php * \ingroup salaries diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index 363fcaf6467..839d50709c7 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -60,7 +60,7 @@ class modService extends DolibarrModules $this->picto='service'; // Data directories to create when module is enabled - $this->dirs = array("/produit/temp"); + $this->dirs = array("/product/temp"); // Dependancies $this->depends = array(); @@ -147,7 +147,7 @@ class modService extends DolibarrModules if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'service')); if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'service')); // Add extra fields - $sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product'"; + $sql="SELECT name, label, type FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product'"; $resql=$this->db->query($sql); if ($resql) // This can fail when class is used on old database (during migration for example) { @@ -155,8 +155,28 @@ class modService extends DolibarrModules { $fieldname='extra.'.$obj->name; $fieldlabel=ucfirst($obj->label); - $this->export_fields_array[$r][$fieldname]=$fieldlabel; - $this->export_entities_array[$r][$fieldname]='product'; + $typeFilter="Text"; + switch($obj->type) + { + case 'int': + case 'double': + case 'price': + $typeFilter="Numeric"; + break; + case 'date': + case 'datetime': + $typeFilter="Date"; + break; + case 'boolean': + $typeFilter="Boolean"; + break; + case 'sellist': + $typeFilter="List:".$obj->param; + break; + } + $this->export_fields_array[$r][$fieldname]=$fieldlabel; + $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; + $this->export_entities_array[$r][$fieldname]='product'; } } // End add extra fields @@ -164,7 +184,8 @@ class modService extends DolibarrModules $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object'; - $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 1 AND p.entity IN ('.getEntity("product", 1).')'; + if (! empty($conf->fournisseur->enabled)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc'; + $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 1 AND p.entity IN ('.getEntity("product", 1).')'; if (empty($conf->product->enabled)) // We enable next import templates only if module product not already enabled (to avoid duplicate entries) @@ -186,7 +207,7 @@ class modService extends DolibarrModules $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product", 'pr.price_base_type'=>"product",'pr.price_level'=>"product",'pr.price'=>"product", 'pr.price_ttc'=>"product", - 'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC", + 'pr.price_min'=>"product",'pr.price_min_ttc'=>"product", 'pr.tva_tx'=>'product', 'pr.date_price'=>"product"); $this->export_sql_start[$r]='SELECT DISTINCT '; @@ -208,10 +229,10 @@ class modService extends DolibarrModules $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon $this->import_tables_array[$r]=array('p'=>MAIN_DB_PREFIX.'product','extra'=>MAIN_DB_PREFIX.'product_extrafields'); $this->import_tables_creator_array[$r]=array('p'=>'fk_user_author'); // Fields to store import user id - $this->import_fields_array[$r]=array('p.ref'=>"Ref*",'p.label'=>"Label*",'p.description'=>"Description",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.duration'=>"Duration",'p.customcode'=>'CustomCode','p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",'p.tva_tx'=>'VAT','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation*'); + $this->import_fields_array[$r]=array('p.ref'=>"Ref*",'p.label'=>"Label*",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.duration'=>"Duration",'p.customcode'=>'CustomCode','p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",'p.tva_tx'=>'VAT','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation*'); if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.barcode'=>'BarCode')); // Add extra fields - $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product'"; + $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity = ".$conf->entity; $resql=$this->db->query($sql); if ($resql) // This can fail when class is used on old database (during migration for example) { @@ -225,7 +246,7 @@ class modService extends DolibarrModules // End add extra fields $this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'product'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_regex_array[$r]=array('p.ref'=>'[^ ]','p.tosell'=>'^[0|1]$','p.tobuy'=>'^[0|1]$','p.fk_product_type'=>'^[0|1]$','p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); - $this->import_examplevalues_array[$r]=array('p.ref'=>"PR123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31'); + $this->import_examplevalues_array[$r]=array('p.ref'=>"PREF123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31'); if (empty($conf->product->enabled)) // We enable next import templates only if module product not already enabled (to avoid duplicate entries) @@ -297,7 +318,6 @@ class modService extends DolibarrModules */ function init($options='') { - // Permissions et valeurs par defaut $this->remove($options); $sql = array(); diff --git a/htdocs/core/modules/modSyncSupplierWebServices.class.php b/htdocs/core/modules/modSyncSupplierWebServices.class.php new file mode 100644 index 00000000000..c17892ee217 --- /dev/null +++ b/htdocs/core/modules/modSyncSupplierWebServices.class.php @@ -0,0 +1,121 @@ + + * + * 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 . + */ + +/** + * \defgroup webservices Module webservices + * \brief Module to enable client for supplier WebServices + * \file htdocs/core/modules/modSyncSupplierWebServices.class.php + * \ingroup webservices + * \brief File to describe client for supplier webservices module + */ +include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; + +/** + * Class to describe a WebServices module + */ +class modSyncSupplierWebServices extends DolibarrModules +{ + + /** + * Constructor. Define names, constants, directories, boxes, permissions + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + $this->db = $db; + $this->numero = 2650; + + $this->family = "technic"; + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) + $this->name = preg_replace('/^mod/i','',get_class($this)); + $this->description = "Enable the client for external supplier web services"; + $this->version = 'experimental'; // 'experimental' or 'dolibarr' or version + // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); + // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) + $this->special = 1; + // Name of image file used for this module. + $this->picto='technic'; + + // Data directories to create when module is enabled + $this->dirs = array(); + + // Config pages + //------------- + //$this->config_page_url = array("webservices.php@webservices"); + + // Dependancies + //------------- + $this->depends = array(); + $this->requiredby = array(); + $this->langfiles = array("other"); + + // Constantes + //----------- + $this->const = array(); + + // New pages on tabs + // ----------------- + $this->tabs = array(); + + // Boxes + //------ + $this->boxes = array(); + + // Permissions + //------------ + $this->rights = array(); + $this->rights_class = 'syncsupplierwebservices'; + $r=0; + } + + + /** + * Function called when module is enabled. + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * It also creates data directories + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + function init($options='') + { + // Prevent pb of modules not correctly disabled + //$this->remove($options); + + $sql = array(); + + return $this->_init($sql,$options); + } + + /** + * Function called when module is disabled. + * Remove from database constants, boxes and permissions from Dolibarr database. + * Data directories are not deleted + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + function remove($options='') + { + $sql = array(); + + return $this->_remove($sql,$options); + } + +} diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php index b6e35f95f8e..8ae45bdc681 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php @@ -99,7 +99,7 @@ class pdf_standardlabel * Methode qui permet de modifier la taille des caracteres * Cela modiera aussi l'espace entre chaque ligne * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param int $pt point * @return void */ @@ -117,7 +117,7 @@ class pdf_standardlabel * - %LOGO% is replace with company logo * - %PHOTO% is replace with photo provided as parameter * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param string $textleft Text left * @param string $header Header * @param string $footer Footer @@ -292,7 +292,7 @@ class pdf_standardlabel /** * Print dot line * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param int $x1 X1 * @param int $y1 Y1 * @param int $x2 X2 @@ -333,7 +333,7 @@ class pdf_standardlabel /** * Fonction realisant une croix aux 4 coins des cartes * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param int $x1 X1 * @param int $y1 Y1 * @param int $x2 X2 @@ -404,7 +404,7 @@ class pdf_standardlabel /** * Set format * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param string $format Format * @return void */ diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index 3ab5fdb9e09..5a041fd31ce 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/product/modules_product.class.php' class mod_codeproduct_elephant extends ModeleProductCode { var $nom='Elephant'; // Nom du modele + var $name='Elephant'; // Nom du modele var $code_modifiable; // Code modifiable var $code_modifiable_invalide; // Code modifiable si il est invalide var $code_modifiable_null; // Code modifiables si il est null @@ -220,7 +221,7 @@ class mod_codeproduct_elephant extends ModeleProductCode * Check validity of code according to its rules * * @param DoliDB $db Database handler - * @param string &$code Code to check/correct + * @param string $code Code to check/correct * @param Product $product Object product * @param int $type 0 = customer/prospect , 1 = supplier * @return int 0 if OK diff --git a/htdocs/core/modules/product/mod_codeproduct_leopard.php b/htdocs/core/modules/product/mod_codeproduct_leopard.php index df71792ee86..3b850e1ba91 100644 --- a/htdocs/core/modules/product/mod_codeproduct_leopard.php +++ b/htdocs/core/modules/product/mod_codeproduct_leopard.php @@ -40,6 +40,7 @@ class mod_codeproduct_leopard extends ModeleProductCode */ var $nom='Leopard'; // Nom du modele + var $name='Leopard'; // Nom du modele var $code_modifiable; // Code modifiable var $code_modifiable_invalide; // Code modifiable si il est invalide var $code_modifiable_null; // Code modifiables si il est null @@ -91,7 +92,7 @@ class mod_codeproduct_leopard extends ModeleProductCode * Check validity of code according to its rules * * @param DoliDB $db Database handler - * @param string &$code Code to check/correct + * @param string $code Code to check/correct * @param Product $product Object product * @param int $type 0 = product , 1 = service * @return int 0 if OK diff --git a/htdocs/core/modules/product/modules_product.class.php b/htdocs/core/modules/product/modules_product.class.php index 66affcf256a..0bfd3f8f03e 100644 --- a/htdocs/core/modules/product/modules_product.class.php +++ b/htdocs/core/modules/product/modules_product.class.php @@ -46,7 +46,7 @@ abstract class ModeleProductCode */ function getNom($langs) { - return $this->nom; + return empty($this->name)?$this->nom:$this->name; } @@ -147,7 +147,7 @@ abstract class ModeleProductCode $langs->load("admin"); $s=''; - if ($type == -1) $s.=$langs->trans("Name").': '.$this->nom.'
    '; + if ($type == -1) $s.=$langs->trans("Name").': '.$this->getNom($langs).'
    '; if ($type == -1) $s.=$langs->trans("Version").': '.$this->getVersion().'
    '; if ($type == 0) $s.=$langs->trans("ProductCodeDesc").'
    '; if ($type == 1) $s.=$langs->trans("ServiceCodeDesc").'
    '; diff --git a/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php similarity index 94% rename from htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php rename to htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index 5b3aa9a85e2..f19d8a0e3a0 100644 --- a/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -19,7 +19,7 @@ */ /** - * \file htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php + * \file htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php * \ingroup project * \brief File of class to build ODT documents for third parties */ @@ -113,7 +113,7 @@ class doc_generic_project_odt extends ModelePDFProjects { global $conf; - return array( + $resarray=array( 'object_id'=>$object->id, 'object_ref'=>$object->ref, 'object_title'=>$object->title, @@ -127,6 +127,21 @@ class doc_generic_project_odt extends ModelePDFProjects 'object_public'=>$object->public, 'object_statut'=>$object->getLibStatut() ); + + // Retrieve extrafields + if (is_array($object->array_options) && count($object->array_options)) + { + $extrafieldkey=$object->element; + + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($this->db); + $extralabels = $extrafields->fetch_name_optionals_label($extrafieldkey,true); + $object->fetch_optionals($object->id,$extralabels); + + $resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key,$outputlangs); + } + + return $resarray; } /** @@ -339,7 +354,7 @@ class doc_generic_project_odt extends ModelePDFProjects $texte.= '
    '; $texte.= ''; $texte.= '
    '; - + // Scan directories if (count($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; @@ -452,7 +467,7 @@ class doc_generic_project_odt extends ModelePDFProjects // Make substitution $substitutionarray=array( - '__FROM_NAME__' => $this->emetteur->nom, + '__FROM_NAME__' => $this->emetteur->name, '__FROM_EMAIL__' => $this->emetteur->email, ); complete_substitutions_array($substitutionarray, $langs, $object); @@ -485,69 +500,13 @@ class doc_generic_project_odt extends ModelePDFProjects // Make substitutions into odt of user info - $tmparray=$this->get_substitutionarray_user($user,$outputlangs); - foreach($tmparray as $key=>$value) - { - try { - if (preg_match('/logo$/',$key)) // Image - { - //var_dump($value);exit; - if (file_exists($value)) $odfHandler->setImage($key, $value); - else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); - } - else // Text - { - $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - } - catch(OdfException $e) - { - } - } - // Make substitutions into odt of mysoc - $tmparray=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); - //var_dump($tmparray); exit; - foreach($tmparray as $key=>$value) - { - try { - if (preg_match('/logo$/',$key)) // Image - { - //var_dump($value);exit; - if (file_exists($value)) $odfHandler->setImage($key, $value); - else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); - } - else // Text - { - $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - } - catch(OdfException $e) - { - } - } + $array_user=$this->get_substitutionarray_user($user,$outputlangs); + $array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); + $array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); + $array_objet=$this->get_substitutionarray_object($object,$outputlangs); + $array_other=$this->get_substitutionarray_other($outputlangs); - // Make substitutions into odt of thirdparty - $tmparray=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); - foreach($tmparray as $key=>$value) - { - try { - if (preg_match('/logo$/',$key)) // Image - { - if (file_exists($value)) $odfHandler->setImage($key, $value); - else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); - } - else // Text - { - $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - } - catch(OdfException $e) - { - } - } - - // Replace tags of object + external modules - $tmparray=$this->get_substitutionarray_object($object,$outputlangs); + $tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other); complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray); @@ -1020,7 +979,7 @@ class doc_generic_project_odt extends ModelePDFProjects } $reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - + if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); diff --git a/htdocs/boutique/client/class/index.html b/htdocs/core/modules/project/doc/index.html similarity index 100% rename from htdocs/boutique/client/class/index.html rename to htdocs/core/modules/project/doc/index.html diff --git a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php similarity index 98% rename from htdocs/core/modules/project/pdf/pdf_baleine.modules.php rename to htdocs/core/modules/project/doc/pdf_baleine.modules.php index 0165a01a9bc..ea5ae8e9156 100644 --- a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/core/modules/project/pdf/pdf_baleine.modules.php + * \file htdocs/core/modules/project/doc/pdf_baleine.modules.php * \ingroup project * \brief Fichier de la classe permettant de generer les projets au modele Baleine * \author Regis Houssin @@ -337,7 +337,7 @@ class pdf_baleine extends ModelePDFProjects /** * Show table for lines * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param string $tab_top Top position of table * @param string $tab_height Height of table (rectangle) * @param int $nexY Y @@ -370,7 +370,7 @@ class pdf_baleine extends ModelePDFProjects /** * Show top header of page. * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output @@ -456,7 +456,7 @@ class pdf_baleine extends ModelePDFProjects /** * Show footer of page. Need this->emetteur object * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param Object $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text diff --git a/htdocs/core/modules/project/mod_project_simple.php b/htdocs/core/modules/project/mod_project_simple.php index 17ae9f29ddf..49e4586d07b 100644 --- a/htdocs/core/modules/project/mod_project_simple.php +++ b/htdocs/core/modules/project/mod_project_simple.php @@ -35,11 +35,12 @@ class mod_project_simple extends ModeleNumRefProjects var $prefix='PJ'; var $error=''; var $nom = "Simple"; + var $name = "Simple"; - /** + /** * Return description of numbering module - * + * * @return string Text with description */ function info() @@ -49,9 +50,9 @@ class mod_project_simple extends ModeleNumRefProjects } - /** + /** * Return an example of numbering module values - * + * * @return string Example */ function getExample() @@ -62,7 +63,7 @@ class mod_project_simple extends ModeleNumRefProjects /** Test si les numeros deja en vigueur dans la base ne provoquent pas de * de conflits qui empechera cette numerotation de fonctionner. - * + * * @return boolean false si conflit, true si ok */ function canBeActivated() @@ -97,7 +98,7 @@ class mod_project_simple extends ModeleNumRefProjects /** * Return next value - * + * * @param Societe $objsoc Object third party * @param Project $project Object project * @return string Value if OK, 0 if KO @@ -130,7 +131,7 @@ class mod_project_simple extends ModeleNumRefProjects //$yymm = strftime("%y%m",time()); $yymm = strftime("%y%m",$date); - + if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is else $num = sprintf("%04s",$max+1); @@ -139,9 +140,9 @@ class mod_project_simple extends ModeleNumRefProjects } - /** + /** * Return next reference not yet used as a reference - * + * * @param Societe $objsoc Object third party * @param Project $project Object project * @return string Next not used reference diff --git a/htdocs/core/modules/project/mod_project_universal.php b/htdocs/core/modules/project/mod_project_universal.php index 5633a61f8ac..e76ed349b46 100644 --- a/htdocs/core/modules/project/mod_project_universal.php +++ b/htdocs/core/modules/project/mod_project_universal.php @@ -33,11 +33,12 @@ class mod_project_universal extends ModeleNumRefProjects var $version='dolibarr'; // 'development', 'experimental', 'dolibarr' var $error = ''; var $nom = 'Universal'; + var $name = 'Universal'; /** * Renvoi la description du modele de numerotation - * + * * @return string Texte descripif */ function info() @@ -78,7 +79,7 @@ class mod_project_universal extends ModeleNumRefProjects /** * Renvoi un exemple de numerotation - * + * * @return string Example */ function getExample() @@ -99,7 +100,7 @@ class mod_project_universal extends ModeleNumRefProjects /** * Return next value - * + * * @param Societe $objsoc Object third party * @param Project $project Object project * @return string Value if OK, 0 if KO @@ -126,9 +127,9 @@ class mod_project_universal extends ModeleNumRefProjects } - /** + /** * Return next reference not yet used as a reference - * + * * @param Societe $objsoc Object third party * @param Project $project Object project * @return string Next not used reference diff --git a/htdocs/core/modules/project/modules_project.php b/htdocs/core/modules/project/modules_project.php index ecaf0213bc0..54d981e51a4 100644 --- a/htdocs/core/modules/project/modules_project.php +++ b/htdocs/core/modules/project/modules_project.php @@ -1,5 +1,6 @@ + * Copyright (C) 2014 Marcos García * * 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 @@ -151,93 +152,10 @@ abstract class ModeleNumRefProjects * @param int $hidedesc Hide description * @param int $hideref Hide ref * @return int 0 if KO, 1 if OK + * @deprecated Use the new function generateDocument of Project class */ -function project_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) +function project_pdf_create(DoliDB $db, Project $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { - global $conf,$langs; - $langs->load("projects"); - - $error=0; - - $srctemplatepath=''; - - // Positionne modele sur le nom du modele de projet a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->PROJECT_ADDON_PDF)) - { - $modele = $conf->global->PROJECT_ADDON_PDF; - } - else - { - $modele='baleine'; - } - } - - // If selected modele is a filename template (then $modele="modelname:filename") - $tmp=explode(':',$modele,2); - if (! empty($tmp[1])) - { - $modele=$tmp[0]; - $srctemplatepath=$tmp[1]; - } - - // Search template files - $file=''; $classname=''; $filefound=0; - $dirmodels=array('/'); - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); - foreach($dirmodels as $reldir) - { - foreach(array('doc','pdf') as $prefix) - { - $file = $prefix."_".$modele.".modules.php"; - - // On verifie l'emplacement du modele - $file=dol_buildpath($reldir."core/modules/project/pdf/".$file,0); - if (file_exists($file)) - { - $filefound=1; - $classname=$prefix.'_'.$modele; - break; - } - } - if ($filefound) break; - } - - // Charge le modele - if ($filefound) - { - require_once $file; - - $obj = new $classname($db); - - // We save charset_output to restore it because write_file can change it if needed for - // output format that does not support UTF8. - $sav_charset_output=$outputlangs->charset_output; - if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) - { - $outputlangs->charset_output=$sav_charset_output; - - // we delete preview files - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - dol_delete_preview($object); - - // Success in building document. We build meta file. - dol_meta_create($object); - - return 1; - } - else - { - $outputlangs->charset_output=$sav_charset_output; - dol_print_error($db,"project_pdf_create Error: ".$obj->error); - return 0; - } - } - else - { - print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); - return 0; - } + return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } diff --git a/htdocs/core/modules/project/pdf/index.html b/htdocs/core/modules/project/pdf/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/core/modules/project/task/pdf/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php similarity index 90% rename from htdocs/core/modules/project/task/pdf/doc_generic_task_odt.modules.php rename to htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index acbd33bcc5a..c074cba31e5 100644 --- a/htdocs/core/modules/project/task/pdf/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -1,28 +1,28 @@ * Copyright (C) 2012 Juanjo Menent -* Copyright (C) 2013 Florian Henry -* -* 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 . -* or see http://www.gnu.org/ -*/ + * Copyright (C) 2013 Florian Henry + * + * 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 . + * or see http://www.gnu.org/ + */ /** - * \file htdocs/core/modules/project/task/pdf/doc_generic_task_odt.modules.php + * \file htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php * \ingroup project * \brief File of class to build ODT documents for third parties -*/ + */ require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/project/task/modules_task.php'; @@ -114,7 +114,7 @@ class doc_generic_task_odt extends ModelePDFTask { global $conf; - return array( + $resarray=array( 'object_id'=>$object->id, 'object_ref'=>$object->ref, 'object_title'=>$object->title, @@ -128,6 +128,21 @@ class doc_generic_task_odt extends ModelePDFTask 'object_public'=>$object->public, 'object_statut'=>$object->getLibStatut() ); + + // Retrieve extrafields + if (is_array($object->array_options) && count($object->array_options)) + { + $extrafieldkey=$object->element; + + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($this->db); + $extralabels = $extrafields->fetch_name_optionals_label($extrafieldkey,true); + $object->fetch_optionals($object->id,$extralabels); + + $resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key,$outputlangs); + } + + return $resarray; } /** @@ -304,7 +319,7 @@ class doc_generic_task_odt extends ModelePDFTask $texte = $this->description.".
    \n"; $texte.= '
    '; $texte.= ''; - $texte.= ''; + $texte.= ''; $texte.= ''; $texte.= ''; @@ -367,7 +382,7 @@ class doc_generic_task_odt extends ModelePDFTask */ function write_file($object,$outputlangs,$srctemplatepath) { - global $user,$langs,$conf,$mysoc; + global $user,$langs,$conf,$mysoc,$hookmanager; if (empty($srctemplatepath)) { @@ -438,7 +453,7 @@ class doc_generic_task_odt extends ModelePDFTask // Make substitution $substitutionarray=array( - '__FROM_NAME__' => $this->emetteur->nom, + '__FROM_NAME__' => $this->emetteur->name, '__FROM_EMAIL__' => $this->emetteur->email, ); complete_substitutions_array($substitutionarray, $langs, $object); @@ -471,70 +486,13 @@ class doc_generic_task_odt extends ModelePDFTask // Make substitutions into odt of user info - $tmparray=$this->get_substitutionarray_user($user,$outputlangs); - //var_dump($tmparray); exit; - foreach($tmparray as $key=>$value) - { - try { - if (preg_match('/logo$/',$key)) // Image - { - //var_dump($value);exit; - if (file_exists($value)) $odfHandler->setImage($key, $value); - else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); - } - else // Text - { - $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - } - catch(OdfException $e) - { - } - } - // Make substitutions into odt of mysoc - $tmparray=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); - //var_dump($tmparray); exit; - foreach($tmparray as $key=>$value) - { - try { - if (preg_match('/logo$/',$key)) // Image - { - //var_dump($value);exit; - if (file_exists($value)) $odfHandler->setImage($key, $value); - else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); - } - else // Text - { - $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - } - catch(OdfException $e) - { - } - } + $array_user=$this->get_substitutionarray_user($user,$outputlangs); + $array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); + $array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); + $array_objet=$this->get_substitutionarray_object($project,$outputlangs); + $array_other=$this->get_substitutionarray_other($outputlangs); - // Make substitutions into odt of thirdparty - $tmparray=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); - foreach($tmparray as $key=>$value) - { - try { - if (preg_match('/logo$/',$key)) // Image - { - if (file_exists($value)) $odfHandler->setImage($key, $value); - else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); - } - else // Text - { - $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - } - catch(OdfException $e) - { - } - } - - // Replace tags of object + external modules - $tmparray=$this->get_substitutionarray_object($project,$outputlangs); + $tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other); complete_substitutions_array($tmparray, $outputlangs, $object); foreach($tmparray as $key=>$value) { @@ -819,8 +777,8 @@ class doc_generic_task_odt extends ModelePDFTask // Call the beforeODTSave hook $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); $reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - - + + // Write new file if (!empty($conf->global->MAIN_ODT_AS_PDF)) { try { @@ -838,9 +796,9 @@ class doc_generic_task_odt extends ModelePDFTask return -1; } } - + $reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - + if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); diff --git a/htdocs/boutique/commande/class/index.html b/htdocs/core/modules/project/task/doc/index.html similarity index 100% rename from htdocs/boutique/commande/class/index.html rename to htdocs/core/modules/project/task/doc/index.html diff --git a/htdocs/core/modules/project/task/mod_task_simple.php b/htdocs/core/modules/project/task/mod_task_simple.php index eb8928d3b8f..0e7b416d72e 100644 --- a/htdocs/core/modules/project/task/mod_task_simple.php +++ b/htdocs/core/modules/project/task/mod_task_simple.php @@ -35,11 +35,12 @@ class mod_task_simple extends ModeleNumRefTask var $prefix='TK'; var $error=''; var $nom = "Simple"; + var $name = "Simple"; - /** + /** * Return description of numbering module - * + * * @return string Text with description */ function info() @@ -49,9 +50,9 @@ class mod_task_simple extends ModeleNumRefTask } - /** + /** * Return an example of numbering module values - * + * * @return string Example */ function getExample() @@ -62,7 +63,7 @@ class mod_task_simple extends ModeleNumRefTask /** Test si les numeros deja en vigueur dans la base ne provoquent pas de * de conflits qui empechera cette numerotation de fonctionner. - * + * * @return boolean false si conflit, true si ok */ function canBeActivated() @@ -98,7 +99,7 @@ class mod_task_simple extends ModeleNumRefTask /** * Return next value - * + * * @param Societe $objsoc Object third party * @param Task $task Object Task * @return string Value if OK, 0 if KO @@ -130,7 +131,7 @@ class mod_task_simple extends ModeleNumRefTask //$yymm = strftime("%y%m",time()); $yymm = strftime("%y%m",$date); - + if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is else $num = sprintf("%04s",$max+1); @@ -139,9 +140,9 @@ class mod_task_simple extends ModeleNumRefTask } - /** + /** * Return next reference not yet used as a reference - * + * * @param Societe $objsoc Object third party * @param Task $task Object task * @return string Next not used reference diff --git a/htdocs/core/modules/project/task/mod_task_universal.php b/htdocs/core/modules/project/task/mod_task_universal.php index 1e99f904116..529814079c1 100644 --- a/htdocs/core/modules/project/task/mod_task_universal.php +++ b/htdocs/core/modules/project/task/mod_task_universal.php @@ -33,11 +33,12 @@ class mod_task_universal extends ModeleNumRefTask var $version='dolibarr'; // 'development', 'experimental', 'dolibarr' var $error = ''; var $nom = 'Universal'; + var $name = 'Universal'; /** * Renvoi la description du modele de numerotation - * + * * @return string Texte descripif */ function info() @@ -78,7 +79,7 @@ class mod_task_universal extends ModeleNumRefTask /** * Renvoi un exemple de numerotation - * + * * @return string Example */ function getExample() @@ -99,7 +100,7 @@ class mod_task_universal extends ModeleNumRefTask /** * Return next value - * + * * @param Societe $objsoc Object third party * @param Project $project Object project * @return string Value if OK, 0 if KO @@ -126,9 +127,9 @@ class mod_task_universal extends ModeleNumRefTask } - /** + /** * Return next reference not yet used as a reference - * + * * @param Societe $objsoc Object third party * @param Project $project Object project * @return string Next not used reference diff --git a/htdocs/core/modules/project/task/modules_task.php b/htdocs/core/modules/project/task/modules_task.php index c72d221ead1..f861b1bf002 100644 --- a/htdocs/core/modules/project/task/modules_task.php +++ b/htdocs/core/modules/project/task/modules_task.php @@ -1,6 +1,7 @@ * Copyright (C) 2010 Florian Henry + * Copyright (C) 2014 Marcos García * * 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 @@ -152,92 +153,10 @@ abstract class ModeleNumRefTask * @param int $hideref Hide ref * @param HookManager $hookmanager Hook manager instance * @return int 0 if KO, 1 if OK + * @deprecated Use the new function generateDocument of Task class */ -function task_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false) +function task_pdf_create(DoliDB $db, Task $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false) { - global $conf,$langs; - $langs->load("projects"); - - $error=0; - - $srctemplatepath=''; - - // Positionne modele sur le nom du modele de projet a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->PROJECT_TASK_ADDON_PDF)) - { - $modele = $conf->global->PROJECT_TASK_ADDON_PDF; - } - else - { - $modele='nodefault'; - } - } - - // If selected modele is a filename template (then $modele="modelname:filename") - $tmp=explode(':',$modele,2); - if (! empty($tmp[1])) - { - $modele=$tmp[0]; - $srctemplatepath=$tmp[1]; - } - - // Search template files - $file=''; $classname=''; $filefound=0; - $dirmodels=array('/'); - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); - foreach($dirmodels as $reldir) - { - foreach(array('doc','pdf') as $prefix) - { - $file = $prefix."_".$modele.".modules.php"; - - // On verifie l'emplacement du modele - $file=dol_buildpath($reldir."core/modules/project/task/pdf/".$file,0); - if (file_exists($file)) - { - $filefound=1; - $classname=$prefix.'_'.$modele; - break; - } - } - if ($filefound) break; - } - - // Charge le modele - if ($filefound) - { - require_once $file; - - $obj = new $classname($db); - // We save charset_output to restore it because write_file can change it if needed for - // output format that does not support UTF8. - $sav_charset_output=$outputlangs->charset_output; - if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $hookmanager) > 0) - { - $outputlangs->charset_output=$sav_charset_output; - - // we delete preview files - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - dol_delete_preview($object); - - // Success in building document. We build meta file. - dol_meta_create($object); - - return 1; - } - else - { - $outputlangs->charset_output=$sav_charset_output; - dol_print_error($db,"task_pdf_create Error: ".$obj->error); - return 0; - } - } - else - { - print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); - return 0; - } + return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); } diff --git a/htdocs/core/modules/project/task/pdf/index.html b/htdocs/core/modules/project/task/pdf/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index f216d69a0fd..8f79094befc 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -311,7 +311,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales // Make substitution $substitutionarray=array( - '__FROM_NAME__' => $this->emetteur->nom, + '__FROM_NAME__' => $this->emetteur->name, '__FROM_EMAIL__' => $this->emetteur->email, '__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_HT__' => $object->total_ht, @@ -363,70 +363,14 @@ class doc_generic_proposal_odt extends ModelePDFPropales { } - // Make substitutions into odt of user info - $tmparray=$this->get_substitutionarray_user($user,$outputlangs); - //var_dump($tmparray); exit; - foreach($tmparray as $key=>$value) - { - try { - if (preg_match('/logo$/',$key)) // Image - { - //var_dump($value);exit; - if (file_exists($value)) $odfHandler->setImage($key, $value); - else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); - } - else // Text - { - $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - } - catch(OdfException $e) - { - } - } - // Make substitutions into odt of mysoc - $tmparray=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); - //var_dump($tmparray); exit; - foreach($tmparray as $key=>$value) - { - try { - if (preg_match('/logo$/',$key)) // Image - { - //var_dump($value);exit; - if (file_exists($value)) $odfHandler->setImage($key, $value); - else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); - } - else // Text - { - $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - } - catch(OdfException $e) - { - } - } - // Make substitutions into odt of thirdparty - $tmparray=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); - foreach($tmparray as $key=>$value) - { - try { - if (preg_match('/logo$/',$key)) // Image - { - if (file_exists($value)) $odfHandler->setImage($key, $value); - else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); - } - else // Text - { - $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - } - catch(OdfException $e) - { - } - } - // Replace tags of object + external modules - $tmparray=$this->get_substitutionarray_object($object,$outputlangs); - //print_r($tmparray); exit; + // Make substitutions into odt + $array_user=$this->get_substitutionarray_user($user,$outputlangs); + $array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); + $array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); + $array_objet=$this->get_substitutionarray_object($object,$outputlangs); + $array_other=$this->get_substitutionarray_other($outputlangs); + + $tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other); complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray); @@ -518,7 +462,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales } $reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - + if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index f1871c175a6..35953b8521f 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -600,7 +600,7 @@ class pdf_azur extends ModelePDFPropales /** * Show payments table * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object proposal * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output @@ -615,7 +615,7 @@ class pdf_azur extends ModelePDFPropales /** * Show miscellaneous information (payment mode, payment term, ...) * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object @@ -730,7 +730,7 @@ class pdf_azur extends ModelePDFPropales if (! empty($conf->global->FACTURE_CHQ_NUMBER)) { $diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE); - + if ($conf->global->FACTURE_CHQ_NUMBER > 0) { $account = new Account($this->db); @@ -793,7 +793,7 @@ class pdf_azur extends ModelePDFPropales /** * Show total to pay * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Facture $object Object invoice * @param int $deja_regle Montant deja regle * @param int $posy Position depart @@ -1065,7 +1065,7 @@ class pdf_azur extends ModelePDFPropales /** * Show table for lines * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param string $tab_top Top position of table * @param string $tab_height Height of table (rectangle) * @param int $nexY Y (not used) @@ -1169,7 +1169,7 @@ class pdf_azur extends ModelePDFPropales /** * Show top header of page. * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output @@ -1284,7 +1284,7 @@ class pdf_azur extends ModelePDFPropales $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; } - $carac_emetteur .= pdf_build_address($outputlangs,$this->emetteur); + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client); // Show sender $posy=42; @@ -1328,12 +1328,12 @@ class pdf_azur extends ModelePDFPropales { // On peut utiliser le nom de la societe du contact if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $object->client->nom; + else $socname = $object->client->name; $carac_client_name=$outputlangs->convToOutputCharset($socname); } else { - $carac_client_name=$outputlangs->convToOutputCharset($object->client->nom); + $carac_client_name=$outputlangs->convToOutputCharset($object->client->name); } $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target'); @@ -1369,7 +1369,7 @@ class pdf_azur extends ModelePDFPropales /** * Show footer of page. Need this->emetteur object * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param Object $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text diff --git a/htdocs/core/modules/propale/modules_propale.php b/htdocs/core/modules/propale/modules_propale.php index 04b75bae091..9b0cc1d82a2 100644 --- a/htdocs/core/modules/propale/modules_propale.php +++ b/htdocs/core/modules/propale/modules_propale.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2014 Marcos García * * 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 @@ -155,95 +156,10 @@ abstract class ModeleNumRefPropales * @param int $hidedesc Hide description * @param int $hideref Hide ref * @return int 0 if KO, 1 if OK + * @deprecated Use the new function generateDocument of Propal class */ -function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) +function propale_pdf_create(DoliDB $db, Propal $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { - global $conf,$user,$langs; - $langs->load("propale"); - - $error=0; - - $srctemplatepath=''; - - // Positionne le modele sur le nom du modele a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->PROPALE_ADDON_PDF)) - { - $modele = $conf->global->PROPALE_ADDON_PDF; - } - else - { - $modele = 'azur'; - } - } - - // If selected modele is a filename template (then $modele="modelname:filename") - $tmp=explode(':',$modele,2); - if (! empty($tmp[1])) - { - $modele=$tmp[0]; - $srctemplatepath=$tmp[1]; - } - - // Search template files - $file=''; $classname=''; $filefound=0; - $dirmodels=array('/'); - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); - foreach($dirmodels as $reldir) - { - foreach(array('doc','pdf') as $prefix) - { - $file = $prefix."_".$modele.".modules.php"; - - // On verifie l'emplacement du modele - $file=dol_buildpath($reldir."core/modules/propale/doc/".$file,0); - if (file_exists($file)) - { - $filefound=1; - $classname=$prefix.'_'.$modele; - break; - } - } - if ($filefound) break; - } - - // Charge le modele - if ($filefound) - { - require_once $file; - - $obj = new $classname($db); - //$obj->message = $message; - - // We save charset_output to restore it because write_file can change it if needed for - // output format that does not support UTF8. - $sav_charset_output=$outputlangs->charset_output; - if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) - { - $outputlangs->charset_output=$sav_charset_output; - - // We delete old preview - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - dol_delete_preview($object); - - // Success in building document. We build meta file. - dol_meta_create($object); - - return 1; - } - else - { - $outputlangs->charset_output=$sav_charset_output; - dol_print_error($db,"propal_pdf_create Error: ".$obj->error); - return -1; - } - - } - else - { - dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file)); - return -1; - } + return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 6f48cc1baca..f9726eedbed 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -260,7 +260,7 @@ class pdf_paiement /** * Show top header of page. * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param int $page Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output @@ -319,7 +319,7 @@ class pdf_paiement /** * Output body * - * @param PDF &$pdf PDF object + * @param PDF $pdf PDF object * @param string $page Page * @param array $lines Array of lines * @param Translate $outputlangs Object langs diff --git a/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php b/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php new file mode 100644 index 00000000000..7440a357ea8 --- /dev/null +++ b/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php @@ -0,0 +1,219 @@ + + * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/core/modules/security/generate/modGeneratePassPerso.class.php + * \ingroup core + * \brief File to manage no password generation. + */ + +require_once DOL_DOCUMENT_ROOT .'/core/modules/security/generate/modules_genpassword.php'; + + +/** + * \class modGeneratePassPerso + * \brief Class to generate a password according to personal rules + */ +class modGeneratePassPerso extends ModeleGenPassword +{ + var $id; + var $length; + var $length2; // didn't overright display + var $NbMaj; + var $NbNum; + var $NbSpe; + var $NbRepeat; + var $WithoutAmbi; + + var $db; + var $conf; + var $lang; + var $user; + + var $Maj; + var $Min; + var $Nb; + var $Spe; + var $Ambi; + var $All; + + /** + * Constructor + * + * @param DoliDB $db Database handler + * @param Conf $conf Handler de conf + * @param Translate $langs Handler de langue + * @param User $user Handler du user connecte + */ + function __construct($db, $conf, $langs, $user) + { + $this->id = "Perso"; + $this->length = $langs->trans("SetupPerso"); + + $this->db=$db; + $this->conf=$conf; + $this->langs=$langs; + $this->user=$user; + + if(empty($conf->global->USER_PASSWORD_PATTERN)){ + // default value (8carac, 1maj, 1digit, 1spe, 3 repeat, no ambi at auto generation. + dolibarr_set_const($db, "USER_PASSWORD_PATTERN", '8;1;1;1;3;1','chaine',0,'',$conf->entity); + } + + $this->Maj = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + $this->Min = strtolower($this->Maj); + $this->Nb = "0123456789"; + $this->Spe = "!@#$%&*()_-+={}[]\\|:;'/"; + $this->Ambi = array("1","I","l","|","O","0"); + + $tabConf = explode(";",$conf->global->USER_PASSWORD_PATTERN); + $this->length2 = $tabConf[0]; + $this->NbMaj = $tabConf[1]; + $this->NbNum = $tabConf[2]; + $this->NbSpe = $tabConf[3]; + $this->NbRepeat = $tabConf[4]; + $this->WithoutAmbi = $tabConf[5]; + + if ($this->WithoutAmbi) + { + $this->Maj = str_replace($this->Ambi,"",$this->Maj); + $this->Min = str_replace($this->Ambi,"",$this->Min); + $this->Nb = str_replace($this->Ambi,"",$this->Nb); + $this->Spe = str_replace($this->Ambi,"",$this->Spe); + } + + $this->All = str_shuffle($this->Maj. $this->Min. $this->Nb. $this->Spe); + //$this->All = $this->Maj. $this->Min. $this->Nb. $this->Spe; + //$this->All = $this->Spe; + + } + + /** + * Return description of module + * + * @return string Description of text + */ + function getDescription() + { + global $langs; + return $langs->trans("PasswordGenerationPerso"); + } + + /** + * Return an example of password generated by this module + * + * @return string Example of password + */ + function getExample() + { + return $this->getNewGeneratedPassword(); + } + + /** + * Build new password + * + * @return string Return a new generated password + */ + function getNewGeneratedPassword() + { + $pass = ""; + for($i=0; $i<$this->NbMaj; $i++){ // Y + $pass .= $this->Maj[rand(0,strlen($this->Maj) - 1)]; + } + + for($i=0; $i<$this->NbNum; $i++){ // X + $pass .= $this->Nb[rand(0,strlen($this->Nb) - 1)]; + } + + for($i=0; $i<$this->NbSpe; $i++){ // @ + $pass .= $this->Spe[rand(0,strlen($this->Spe) - 1)]; + } + + for($i=strlen($pass);$i<$this->length2; $i++){ // y + $pass .= $this->All[rand(0,strlen($this->All) -1)]; + } + + $pass = str_shuffle($pass); + + if ($this->validatePassword($pass)) + { + return $pass; + } + + return $this->getNewGeneratedPassword(); + } + + /** + * Validate a password + * + * @param string $password Password to check + * @return int 0 if KO, >0 if OK + */ + function validatePassword($password) + { + $password_a = str_split($password); + $maj = str_split($this->Maj); + $num = str_split($this->Nb); + $spe = str_split($this->Spe); + + if(count(array_intersect($password_a, $maj)) < $this->NbMaj){ + return 0; + } + + if(count(array_intersect($password_a, $num)) < $this->NbNum){ + return 0; + } + + if(count(array_intersect($password_a, $spe)) < $this->NbSpe){ + return 0; + } + + if(!$this->consecutiveInterationSameCharacter($password)){ + return 0; + } + + return 1; + } + + /** + * consecutive iterations of the same character + * + * @param string $password Password to check + * @return int 0 if KO, >0 if OK + */ + function consecutiveInterationSameCharacter($password){ + $last = ""; + $count = 0; + $char = str_split($password); + foreach($char as $c){ + if($c != $last){ + $last = $c; + $count = 0; + }else{ + $count++; + } + + if($count >= $this->NbRepeat) { + return 0; + } + } + return 1; + } +} + diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 94dd1b814e7..c24070c2e23 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -30,12 +30,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php' /** - * \class mod_codeclient_elephant - * \brief Class to manage third party code with elephant rule + * Class to manage third party code with elephant rule */ class mod_codeclient_elephant extends ModeleThirdPartyCode { var $nom='Elephant'; // Nom du modele + var $name='Elephant'; // Nom du modele var $code_modifiable; // Code modifiable var $code_modifiable_invalide; // Code modifiable si il est invalide var $code_modifiable_null; // Code modifiables si il est null @@ -239,7 +239,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode * Check validity of code according to its rules * * @param DoliDB $db Database handler - * @param string &$code Code to check/correct + * @param string $code Code to check/correct * @param Societe $soc Object third party * @param int $type 0 = customer/prospect , 1 = supplier * @return int 0 if OK diff --git a/htdocs/core/modules/societe/mod_codeclient_leopard.php b/htdocs/core/modules/societe/mod_codeclient_leopard.php index 313a14ad246..94c9c04d2e2 100644 --- a/htdocs/core/modules/societe/mod_codeclient_leopard.php +++ b/htdocs/core/modules/societe/mod_codeclient_leopard.php @@ -39,6 +39,7 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode */ var $nom='Leopard'; // Nom du modele + var $name='Leopard'; // Nom du modele var $code_modifiable; // Code modifiable var $code_modifiable_invalide; // Code modifiable si il est invalide var $code_modifiable_null; // Code modifiables si il est null @@ -90,7 +91,7 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode * Check validity of code according to its rules * * @param DoliDB $db Database handler - * @param string &$code Code to check/correct + * @param string $code Code to check/correct * @param Societe $soc Object third party * @param int $type 0 = customer/prospect , 1 = supplier * @return int 0 if OK diff --git a/htdocs/core/modules/societe/mod_codeclient_monkey.php b/htdocs/core/modules/societe/mod_codeclient_monkey.php index f85de6b47d3..88ec1a6e8db 100644 --- a/htdocs/core/modules/societe/mod_codeclient_monkey.php +++ b/htdocs/core/modules/societe/mod_codeclient_monkey.php @@ -28,12 +28,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php' /** - * \class mod_codeclient_monkey - * \brief Classe permettant la gestion monkey des codes tiers + * Classe permettant la gestion monkey des codes tiers */ class mod_codeclient_monkey extends ModeleThirdPartyCode { var $nom='Monkey'; // Nom du modele + var $name='Monkey'; // Nom du modele var $code_modifiable; // Code modifiable var $code_modifiable_invalide; // Code modifiable si il est invalide var $code_modifiable_null; // Code modifiables si il est null @@ -52,6 +52,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode function __construct() { $this->nom = "Monkey"; + $this->name = "Monkey"; $this->version = "dolibarr"; $this->code_null = 1; $this->code_modifiable = 1; @@ -140,7 +141,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode $date = dol_now(); $yymm = strftime("%y%m",$date); - + if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is else $num = sprintf("%04s",$max+1); @@ -153,7 +154,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode * Check validity of code according to its rules * * @param DoliDB $db Database handler - * @param string &$code Code to check/correct + * @param string $code Code to check/correct * @param Societe $soc Object third party * @param int $type 0 = customer/prospect , 1 = supplier * @return int 0 if OK diff --git a/htdocs/core/modules/societe/mod_codecompta_aquarium.php b/htdocs/core/modules/societe/mod_codecompta_aquarium.php index 57d8f0c20a6..1efc062ab2c 100644 --- a/htdocs/core/modules/societe/mod_codecompta_aquarium.php +++ b/htdocs/core/modules/societe/mod_codecompta_aquarium.php @@ -32,7 +32,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php' class mod_codecompta_aquarium extends ModeleAccountancyCode { var $nom='Aquarium'; - var $version='dolibarr'; // 'development', 'experimental', 'dolibarr' + var $name='Aquarium'; + var $version='dolibarr'; // 'development', 'experimental', 'dolibarr' var $prefixcustomeraccountancycode; var $prefixsupplieraccountancycode; @@ -73,7 +74,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode $texte.= '
    '; $s1= $form->textwithpicto('',$tooltip,1,1); $s2= $form->textwithpicto('',$tooltip,1,1); - $texte.= ''; $texte.= ''; $texte.= '
    '.$langs->trans("ModuleCompanyCode".$this->nom,$s1,$s2)."
    \n"; + $texte.= '
    '.$langs->trans("ModuleCompanyCode".$this->name,$s1,$s2)."
    \n"; $texte.= '
     
    '; @@ -109,7 +110,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode $i = 0; $this->db = $db; - dol_syslog("mod_codecompta_aquarium::get_code search code for type=".$type." company=".(! empty($societe->nom)?$societe->nom:'')); + dol_syslog("mod_codecompta_aquarium::get_code search code for type=".$type." company=".(! empty($societe->name)?$societe->name:'')); // Regle gestion compte compta $codetouse=''; diff --git a/htdocs/core/modules/societe/mod_codecompta_panicum.php b/htdocs/core/modules/societe/mod_codecompta_panicum.php index b2240f7a9fc..15099eb0538 100644 --- a/htdocs/core/modules/societe/mod_codecompta_panicum.php +++ b/htdocs/core/modules/societe/mod_codecompta_panicum.php @@ -26,13 +26,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php' /** - * \class mod_codecompta_panicum - * \brief Class to manage accountancy code of thirdparties with Panicum rules + * Class to manage accountancy code of thirdparties with Panicum rules */ class mod_codecompta_panicum extends ModeleAccountancyCode { var $nom='Panicum'; - var $version='dolibarr'; // 'development', 'experimental', 'dolibarr' + var $name='Panicum'; + var $version='dolibarr'; // 'development', 'experimental', 'dolibarr' /** @@ -51,7 +51,7 @@ class mod_codecompta_panicum extends ModeleAccountancyCode */ function info($langs) { - return $langs->trans("ModuleCompanyCode".$this->nom); + return $langs->trans("ModuleCompanyCode".$this->name); } /** diff --git a/htdocs/core/modules/societe/modules_societe.class.php b/htdocs/core/modules/societe/modules_societe.class.php index 9a117ac8435..f1fc05d29db 100644 --- a/htdocs/core/modules/societe/modules_societe.class.php +++ b/htdocs/core/modules/societe/modules_societe.class.php @@ -184,7 +184,7 @@ abstract class ModeleThirdPartyCode $langs->load("admin"); $s=''; - if ($type == -1) $s.=$langs->trans("Name").': '.$this->nom.'
    '; + if ($type == -1) $s.=$langs->trans("Name").': '.$this->getNom($langs).'
    '; if ($type == -1) $s.=$langs->trans("Version").': '.$this->getVersion().'
    '; if ($type == 0) $s.=$langs->trans("CustomerCodeDesc").'
    '; if ($type == 1) $s.=$langs->trans("SupplierCodeDesc").'
    '; diff --git a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php index 1d4e9f262f8..51eb675057e 100644 --- a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php +++ b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Philippe Grand + * Copyright (C) 2014 Marcos García * * 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 @@ -143,105 +144,10 @@ abstract class ModeleNumRefSuppliersInvoices * @param int $hidedesc Hide description * @param int $hideref Hide ref * @return int 0 if KO, 1 if OK + * */ function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { - global $conf, $user, $langs; - - $langs->load("suppliers"); - - $error=0; - - // Increase limit for PDF build - $err=error_reporting(); - error_reporting(0); - @set_time_limit(120); - error_reporting($err); - - $srctemplatepath=''; - - // Set the model on the model name to use - if (! dol_strlen($modele)) - { - if (! empty($conf->global->INVOICE_SUPPLIER_ADDON_PDF)) - { - $modele = $conf->global->INVOICE_SUPPLIER_ADDON_PDF; - } - else - { - $modele = 'canelle'; - } - } - - // If selected modele is a filename template (then $modele="modelname:filename") - $tmp=explode(':',$modele,2); - if (! empty($tmp[1])) - { - $modele=$tmp[0]; - $srctemplatepath=$tmp[1]; - } - - // Search template files - $file=''; $classname=''; $filefound=0; - $dirmodels=array('/'); - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); - foreach($dirmodels as $reldir) - { - foreach(array('doc','pdf') as $prefix) - { - $file = $prefix."_".$modele.".modules.php"; - - // We checked the location of the model - $file=dol_buildpath($reldir."core/modules/supplier_invoice/pdf/".$file,0); - if (file_exists($file)) - { - $filefound=1; - $classname=$prefix.'_'.$modele; - break; - } - } - if ($filefound) break; - } - - // Load the model - if ($filefound) - { - require_once $file; - - $obj = new $classname($db,$object); - - // We save charset_output to restore it because write_file can change it if needed for - // output format that does not support UTF8. - $sav_charset_output=$outputlangs->charset_output; - if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) - { - $outputlangs->charset_output=$sav_charset_output; - - // we delete preview files - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - dol_delete_preview($object); - - return 1; - } - else - { - $outputlangs->charset_output=$sav_charset_output; - dol_syslog("Erreur dans supplier_invoice_pdf_create"); - dol_print_error($db,$obj->error); - return 0; - } - } - else - { - if (! $conf->global->INVOICE_SUPPLIER_ADDON_PDF) - { - print $langs->trans("Error")." ".$langs->trans("Error_INVOICE_SUPPLIER_ADDON_PDF_NotDefined"); - } - else - { - print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); - } - return 0; - } + return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index f61f49cc471..6b57b961da4 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -58,9 +58,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices * Constructor * * @param DoliDB $db Database handler - * @param Object $object Supplier invoice */ - function __construct($db,$object) + function __construct($db) { global $conf,$langs,$mysoc; @@ -91,12 +90,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $this->franchise=!$mysoc->tva_assuj; - // Get source company - if (! is_object($object->thirdparty)) $object->fetch_thirdparty(); - if (! is_object($object->thirdparty)) $object->thirdparty=$mysoc; // If fetch_thirdparty fails, object has no socid (specimen) - $this->emetteur=$object->thirdparty; - if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined - // Defini position des colonnes $this->posxdesc=$this->marge_gauche+1; $this->posxtva=112; @@ -139,6 +132,12 @@ class pdf_canelle extends ModelePDFSuppliersInvoices { global $user,$langs,$conf,$mysoc,$hookmanager; + // Get source company + if (! is_object($object->thirdparty)) $object->fetch_thirdparty(); + if (! is_object($object->thirdparty)) $object->thirdparty=$mysoc; // If fetch_thirdparty fails, object has no socid (specimen) + $this->emetteur=$object->thirdparty; + if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined + if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; @@ -505,7 +504,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices /** * Show total to pay * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Facture $object Object invoice * @param int $deja_regle Montant deja regle * @param int $posy Position depart @@ -700,7 +699,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices /** * Show table for lines * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param string $tab_top Top position of table * @param string $tab_height Height of table (rectangle) * @param int $nexY Y (not used) @@ -796,7 +795,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices /** * Show payments table * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object invoice * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output @@ -880,7 +879,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices /** * Show top header of page. * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output @@ -971,7 +970,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices if ($showaddress) { // Sender properties - $carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); + $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client); // Show sender $posy=42; @@ -1016,12 +1015,12 @@ class pdf_canelle extends ModelePDFSuppliersInvoices { // On peut utiliser le nom de la societe du contact if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $mysoc->nom; + else $socname = $mysoc->name; $carac_client_name=$outputlangs->convToOutputCharset($socname); } else { - $carac_client_name=$outputlangs->convToOutputCharset($mysoc->nom); + $carac_client_name=$outputlangs->convToOutputCharset($mysoc->name); } $carac_client=pdf_build_address($outputlangs,$this->emetteur,$mysoc,((!empty($object->contact))?$object->contact:null),$usecontact,'target'); @@ -1055,7 +1054,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices /** * Show footer of page. Need this->emetteur object * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param Object $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text diff --git a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php index edf2f928ddb..bc544363b39 100644 --- a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php +++ b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2011-2013 Philippe Grand + * Copyright (C) 2014 Marcos García * * 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 @@ -149,104 +150,10 @@ abstract class ModeleNumRefSuppliersOrders * @param int $hidedesc Hide description * @param int $hideref Hide ref * @return int 0 if KO, 1 if OK + * @deprecated Use the new function generateDocument of CommandeFournisseur class */ -function supplier_order_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) +function supplier_order_pdf_create(DoliDB $db, CommandeFournisseur $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { - global $conf, $user, $langs; - $langs->load("suppliers"); - - $error=0; - - // Increase limit for PDF build - $err=error_reporting(); - error_reporting(0); - @set_time_limit(120); - error_reporting($err); - - $srctemplatepath=''; - - // Sets the model on the model name to use - if (! dol_strlen($modele)) - { - if (! empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF)) - { - $modele = $conf->global->COMMANDE_SUPPLIER_ADDON_PDF; - } - else - { - $modele = 'muscadet'; - } - } - - // If selected model is a filename template (then $modele="modelname:filename") - $tmp=explode(':',$modele,2); - if (! empty($tmp[1])) - { - $modele=$tmp[0]; - $srctemplatepath=$tmp[1]; - } - - // Search template files - $file=''; $classname=''; $filefound=0; - $dirmodels=array('/'); - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); - foreach($dirmodels as $reldir) - { - foreach(array('doc','pdf') as $prefix) - { - $file = $prefix."_".$modele.".modules.php"; - - // We check the model location - $file=dol_buildpath($reldir."core/modules/supplier_order/pdf/".$file,0); - if (file_exists($file)) - { - $filefound=1; - $classname=$prefix.'_'.$modele; - break; - } - } - if ($filefound) break; - } - - // Load the model - if ($filefound) - { - require_once $file; - - $obj = new $classname($db,$object); - - // We save charset_output to restore it because write_file can change it if needed for - // output format that does not support UTF8. - $sav_charset_output=$outputlangs->charset_output; - if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) - { - $outputlangs->charset_output=$sav_charset_output; - - // we delete preview files - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - dol_delete_preview($object); - - return 1; - } - else - { - $outputlangs->charset_output=$sav_charset_output; - dol_syslog("Erreur dans supplier_order_pdf_create"); - dol_print_error($db,$obj->error); - return 0; - } - } - else - { - if (! $conf->global->COMMANDE_SUPPLIER_ADDON_PDF) - { - print $langs->trans("Error")." ".$langs->trans("Error_COMMANDE_SUPPLIER_ADDON_PDF_NotDefined"); - } - else - { - print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); - } - return 0; - } + return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index bb1a4233382..29bd483b39b 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -61,9 +61,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * Constructor * * @param DoliDB $db Database handler - * @param Object $object Supplier order */ - function __construct($db,$object) + function __construct($db) { global $conf,$langs,$mysoc; @@ -531,7 +530,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders /** * Show payments table * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object order * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output @@ -546,7 +545,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders /** * Show miscellaneous information (payment mode, payment term, ...) * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object @@ -609,7 +608,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders /** * Show total to pay * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Facture $object Object invoice * @param int $deja_regle Montant deja regle * @param int $posy Position depart @@ -820,7 +819,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders /** * Show table for lines * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param string $tab_top Top position of table * @param string $tab_height Height of table (rectangle) * @param int $nexY Y (not used) @@ -915,7 +914,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders /** * Show top header of page. * - * @param PDF &$pdf Object PDF + * @param PDF $pdf Object PDF * @param Object $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output @@ -1023,7 +1022,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if ($showaddress) { // Sender properties - $carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); + $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client); // Show sender $posy=42; @@ -1107,7 +1106,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders /** * Show footer of page. Need this->emetteur object * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param Object $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text diff --git a/htdocs/core/modules/syslog/logHandler.php b/htdocs/core/modules/syslog/logHandler.php index d2fba9bd9d7..1701ca2bdce 100644 --- a/htdocs/core/modules/syslog/logHandler.php +++ b/htdocs/core/modules/syslog/logHandler.php @@ -1,4 +1,19 @@ . + * or see http://www.gnu.org/ + */ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandlerInterface.php'; diff --git a/htdocs/core/modules/syslog/logHandlerInterface.php b/htdocs/core/modules/syslog/logHandlerInterface.php index 7b5a4aa1bdd..f0d78735155 100644 --- a/htdocs/core/modules/syslog/logHandlerInterface.php +++ b/htdocs/core/modules/syslog/logHandlerInterface.php @@ -1,4 +1,25 @@ . + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/core/modules/syslog/logHandlerInterface.php + * \ingroup syslog + * \brief LogHandlerInterface + */ /** * LogHandlerInterface @@ -44,7 +65,7 @@ interface LogHandlerInterface /** * Return if logger active * - * @return boolen True if active + * @return boolean True if active */ public function isActive(); diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index ddb30df4e45..331b7331194 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -49,7 +49,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface */ public function isActive() { - return 1; + return true; } /** diff --git a/htdocs/core/modules/syslog/mod_syslog_firephp.php b/htdocs/core/modules/syslog/mod_syslog_firephp.php index 8ff2a52fa05..31a3fb13431 100644 --- a/htdocs/core/modules/syslog/mod_syslog_firephp.php +++ b/htdocs/core/modules/syslog/mod_syslog_firephp.php @@ -53,7 +53,7 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface restore_include_path(); if ($res) { - return 1; + return true; } } catch(Exception $e) @@ -61,7 +61,7 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface print ''."\n"; } - return -1; + return false; } ///** diff --git a/htdocs/core/modules/syslog/mod_syslog_syslog.php b/htdocs/core/modules/syslog/mod_syslog_syslog.php index 9b0d854e2e8..58ac241695c 100644 --- a/htdocs/core/modules/syslog/mod_syslog_syslog.php +++ b/htdocs/core/modules/syslog/mod_syslog_syslog.php @@ -47,12 +47,9 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface public function isActive() { // This function does not exists on some ISP (Ex: Free in France) - if (!function_exists('openlog')) - { - return 0; - } + if (!function_exists('openlog')) return false; - return 1; + return true; } /** diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index 2d18c6154f8..3a51a5f7567 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -173,11 +173,11 @@ if (! empty($conf->use_javascript_ajax)) print '
    '; print ''.$langs->trans("Recenter").''; print $langs->trans("DefineNewAreaToPick").'...
    '; - print '
    '; + print '
    '; print '
    '; print ''; print '
    '; - print '

    '; + print '
    '; print '
    '.$langs->trans("NewSizeAfterCropping").': diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php index c83fdafcf7e..49fefc3ebed 100644 --- a/htdocs/core/search_page.php +++ b/htdocs/core/search_page.php @@ -85,7 +85,7 @@ if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! em && ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE)) { $langs->load("products"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/product/liste.php', DOL_URL_ROOT.'/product/liste.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall'); + $searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', '', 'sall'.rand(0,10)); $nbofsearch++; } @@ -93,14 +93,14 @@ if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! em && ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE)) { $langs->load("products"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/fourn/product/liste.php', DOL_URL_ROOT.'/fourn/product/liste.php', img_object('','product').' '.$langs->trans("SupplierRef"), 'products', 'srefsupplier'); + $searchform.=printSearchForm(DOL_URL_ROOT.'/fourn/product/list.php', DOL_URL_ROOT.'/fourn/product/list.php', img_object('','product').' '.$langs->trans("SupplierRef"), 'products', 'srefsupplier'); $nbofsearch++; } if (! empty($conf->adherent->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_ADHERENT) && $user->rights->adherent->lire) { $langs->load("members"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/liste.php', DOL_URL_ROOT.'/adherents/liste.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall'); + $searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall', 'sall'.rand(0,10)); $nbofsearch++; } diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index e4c4d75c85e..56cca5af04f 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -87,8 +87,8 @@ -
    - +
    + textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"),1,0)?> textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0)?>
    @@ -101,6 +101,8 @@ trans("Unique"); ?>> trans("Required"); ?>> + +trans("AlwaysEditable"); ?>>

    ">   diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index e24a3e86948..493634c84a5 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -54,6 +54,7 @@ $size=$extrafields->attribute_size[$attrname]; $unique=$extrafields->attribute_unique[$attrname]; $required=$extrafields->attribute_required[$attrname]; $pos=$extrafields->attribute_pos[$attrname]; +$alwayseditable=$extrafields->attribute_alwayseditable[$attrname]; $param=$extrafields->attribute_param[$attrname]; if((($type == 'select') || ($type == 'checkbox') ||(($type == 'radio'))) && is_array($param)) @@ -97,8 +98,8 @@ if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') ||(($typ -
    - +
    + textwithpicto('', $langs->trans("ExtrafieldParamHelp".$type),1,0)?>
    @@ -110,6 +111,8 @@ if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') ||(($typ trans("Unique"); ?>> trans("Required"); ?>> + +trans("AlwaysEditable"); ?>> diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 35849720e7d..6aaf0f5f28d 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013 Laurent Destailleur +/* Copyright (C) 2012 Regis Houssin + * Copyright (C) 2013-2014 Laurent Destailleur * * 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 @@ -20,12 +20,8 @@ * $withproject (if we are on task contact) */ -if (! class_exists('Contact')) { - require DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -} -if (! class_exists('FormCompany')) { - require DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -} +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; $module = $object->element; @@ -60,9 +56,13 @@ $userstatic=new User($db);
     
    - - +
    " /> @@ -77,7 +77,13 @@ $userstatic=new User($db);
    ">
    - +
    " /> @@ -86,13 +92,9 @@ $userstatic=new User($db); '; ?>
    trans("ThirdPartyContacts"); ?>
    - 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); - ?>
    socid; ?> - selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, $events); ?> + selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0); ?>
    select_contacts($selectedCompany, '', 'contactid'); ?> @@ -109,7 +111,8 @@ $userstatic=new User($db);
    - +
    trans("Source"); ?>
    @@ -123,7 +126,8 @@ $userstatic=new User($db); element == 'shipping' && is_object($objectsrc)) $tmpobject=$objectsrc; @@ -197,7 +201,7 @@ $userstatic=new User($db); ?> statut >= 0) echo ''; ?>
    -
    +
     "> diff --git a/htdocs/core/tpl/document_actions_pre_headers.tpl.php b/htdocs/core/tpl/document_actions_pre_headers.tpl.php index a4d97e7defb..36b6ce75fe1 100644 --- a/htdocs/core/tpl/document_actions_pre_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_pre_headers.tpl.php @@ -72,11 +72,16 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') $link->id = $linkid; $link->fetch(); $res = $link->delete($user); + $langs->load('link'); - if ($res) { + if ($res > 0) { setEventMessage($langs->trans("LinkRemoved", $link->label)); } else { - setEventMessage($langs->trans("ErrorFailedToDeleteLink", $link->label), 'errors'); + if (count($link->errors)) { + setEventMessages('', $link->errors, 'errors'); + } else { + setEventMessage($langs->trans("ErrorFailedToDeleteLink", $link->label), 'errors'); + } } } header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id.(!empty($withproject)?'&withproject=1':'')); diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php new file mode 100644 index 00000000000..7f0115b83bc --- /dev/null +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -0,0 +1,97 @@ + + * Copyright (C) 2014 Juanjo Menent + * + * 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 . + * + * Need to have following variables defined: + * $object (invoice, order, ...) + * $conf + * $langs + * + * $cols + */ + +//$res = $object->fetch_optionals($object->id, $extralabels); +$parameters = array('colspan' => ' colspan="'.$cols.'"', 'cols' => $cols, 'socid' => $object->fk_soc); +$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); + +if (empty($reshook) && ! empty($extrafields->attribute_label)) +{ + foreach ($extrafields->attribute_label as $key => $label) + { + if ($action == 'edit_extras') + { + $value = (isset($_POST["options_" . $key]) ? $_POST["options_" . $key] : $object->array_options["options_" . $key]); + } + else + { + $value = $object->array_options["options_" . $key]; + } + if ($extrafields->attribute_type[$key] == 'separate') + { + print $extrafields->showSeparator($key); + } + else + { + print ''; + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>' . $label . ''; + + //TODO Improve element and rights detection + //var_dump($user->rights); + $permok=false; + $keyforperm=$object->element; + if ($object->element == 'fichinter') $keyforperm='ficheinter'; + if (isset($user->rights->$keyforperm)) $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write; + if ($object->element=='order_supplier') $permok=$user->rights->fournisseur->commande->creer; + if ($object->element=='invoice_supplier') $permok=$user->rights->fournisseur->facture->creer; + + if (($object->statut == 0 || $extrafields->attribute_alwayseditable[$key]) + && $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key)) + print ''; + + print '
    ' . img_edit().'
    '; + print ''; + + // Convert date into timestamp format + if (in_array($extrafields->attribute_type[$key], array('date','datetime'))) { + $value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $db->jdate($object->array_options['options_' . $key]); + } + + //TODO Improve element and rights detection + if ($action == 'edit_extras' && $permok && GETPOST('attribute') == $key) + { + print ''; + print ''; + print ''; + print ''; + print ''; + + print $extrafields->showInputField($key, $value); + + print ''; + + print ''; + } + else + { + print $extrafields->showOutputField($key, $value); + } + print '' . "\n"; + } + } +} diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index dd50e24c8e6..bf5456a7d8d 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -47,6 +47,8 @@ $(document).ready(function () {
    +
    "; + print "
    "; print "\n"; diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 23313d27f13..aaa69ec7f42 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -96,7 +96,7 @@ class Cronjob extends CommonObject $error=0; $now=dol_now(); - + // Clean parameters if (isset($this->label)) $this->label=trim($this->label); @@ -501,7 +501,7 @@ class Cronjob extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index dd9eb8b6289..3c2844f3fe4 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -64,7 +64,7 @@ $pageprev = $page - 1; $pagenext = $page + 1; // Do we click on purge search criteria ? -if (GETPOST("button_removefilter")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_label=''; $status=-1; @@ -100,6 +100,21 @@ if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->ex if ($result < 0) { setEventMessage($object->error,'errors'); } + else + { + $res = $object->reprogram_jobs($user->login); + if ($res > 0) + { + if ($object->lastresult > 0) setEventMessage($langs->trans("JobFinished"),'warnings'); + else setEventMessage($langs->trans("JobFinished"),'mesgs'); + $action=''; + } + else + { + setEventMessage($object->error,'errors'); + $action=''; + } + } header("Location: ".DOL_URL_ROOT.'/cron/list.php?status=-1'); // Make a call to avoid to run twice job when using back exit; @@ -150,17 +165,17 @@ print ''; print ''; print ''; $arg_url='&page='.$page.'&status='.$status.'&search_label='.$search_label; -print_liste_field_titre($langs->trans("CronLabel"),$_SERVEUR['PHP_SELF'],"t.label","",$arg_url,'',$sortfield,$sortorder); +print_liste_field_titre($langs->trans("CronLabel"),$_SERVER["PHP_SELF"],"t.label","",$arg_url,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("CronTask"),'','',"",$arg_url,'',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("CronDtStart"),$_SERVEUR['PHP_SELF'],"t.datestart","",$arg_url,'',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("CronDtEnd"),$_SERVEUR['PHP_SELF'],"t.dateend","",$arg_url,'',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("CronDtLastLaunch"),$_SERVEUR['PHP_SELF'],"t.datelastrun","",$arg_url,'',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("CronDtNextLaunch"),$_SERVEUR['PHP_SELF'],"t.datenextrun","",$arg_url,'',$sortfield,$sortorder); +print_liste_field_titre($langs->trans("CronDtStart"),$_SERVER["PHP_SELF"],"t.datestart","",$arg_url,'',$sortfield,$sortorder); +print_liste_field_titre($langs->trans("CronDtEnd"),$_SERVER["PHP_SELF"],"t.dateend","",$arg_url,'',$sortfield,$sortorder); +print_liste_field_titre($langs->trans("CronDtLastLaunch"),$_SERVER["PHP_SELF"],"t.datelastrun","",$arg_url,'',$sortfield,$sortorder); +print_liste_field_titre($langs->trans("CronDtNextLaunch"),$_SERVER["PHP_SELF"],"t.datenextrun","",$arg_url,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("CronFrequency"),'',"","",$arg_url,'',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("CronNbRun"),$_SERVEUR['PHP_SELF'],"t.nbrun","",$arg_url,'',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("CronLastResult"),$_SERVEUR['PHP_SELF'],"t.lastresult","",$arg_url,'',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("CronLastOutput"),$_SERVEUR['PHP_SELF'],"t.lastoutput","",$arg_url,'',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("Enabled"),$_SERVEUR['PHP_SELF'],"t.status","",$arg_url,'align="center"',$sortfield,$sortorder); +print_liste_field_titre($langs->trans("CronNbRun"),$_SERVER["PHP_SELF"],"t.nbrun","",$arg_url,'',$sortfield,$sortorder); +print_liste_field_titre($langs->trans("CronLastResult"),$_SERVER["PHP_SELF"],"t.lastresult","",$arg_url,'',$sortfield,$sortorder); +print_liste_field_titre($langs->trans("CronLastOutput"),$_SERVER["PHP_SELF"],"t.lastoutput","",$arg_url,'',$sortfield,$sortorder); +print_liste_field_titre($langs->trans("Enabled"),$_SERVER["PHP_SELF"],"t.status","",$arg_url,'align="center"',$sortfield,$sortorder); print ''; print ''; diff --git a/htdocs/custom/.gitignore b/htdocs/custom/.gitignore new file mode 100644 index 00000000000..ed069fdfd81 --- /dev/null +++ b/htdocs/custom/.gitignore @@ -0,0 +1,4 @@ +/a* +/b* +/c* +/d* diff --git a/htdocs/custom/README.md b/htdocs/custom/README.md new file mode 100644 index 00000000000..e46934902cb --- /dev/null +++ b/htdocs/custom/README.md @@ -0,0 +1,24 @@ +# DOLIBARR ERP & CRM custom directory for external modules. + +This directory is dedicated to store external modules. +To use it, just copy here the directory of the module into this directory. + +Note: On linux or MAC systems, it is better to unzip/store the external module directory into +a different place than this directory and just adding a symbolic link here to the htdocs directory +of the module. + +For example on Linux OS: Get the module from the command +mkdir ~/git; cd ~/git +git clone https://git.doliforge.org/p/newmodule/newmodule.git +Then create the symbolic link +ln -fs ~/git/newmodule/htdocs /path_to_dolibarr/htdocs/custom/newmodule + +WARNING !!! +You must also enable the custom directory into dolibarr conf/conf.php file by adding the following +two lines, so dolibarr will also scan this directories to find external external modules: + +$dolibarr_main_url_root_alt='/custom'; +$dolibarr_main_document_root_alt='/path_to_dolibarr/htdocs/custom/'; + +(This is not enabled by default because enabling external module may slow down application) + diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index aae1e275d8f..a4379250914 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -184,7 +184,7 @@ class EcmDirectory // extends CommonObject * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; @@ -428,7 +428,7 @@ class EcmDirectory // extends CommonObject $newref=$this->ref; $newlabel=$langs->trans("ShowECMSection").': '.$newref; - if ($withpicto) $result.=($lien.img_object($newlabel,$picto).$lienfin); + if ($withpicto) $result.=($lien.img_object($newlabel, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$lien.($max?dol_trunc($newref,$max,'middle'):$newref).$lienfin; return $result; diff --git a/htdocs/ecm/docdir.php b/htdocs/ecm/docdir.php index dd40205fc13..b1f09ffcb22 100644 --- a/htdocs/ecm/docdir.php +++ b/htdocs/ecm/docdir.php @@ -175,11 +175,11 @@ if ($action == 'create') print '

    '; - print '
    '; + print '
    '; print ''; - print '     '; + print '     '; print ''; - print '
    '; + print '
    '; print ''; } diff --git a/htdocs/ecm/docother.php b/htdocs/ecm/docother.php index f219e352c64..d1fda6b793a 100644 --- a/htdocs/ecm/docother.php +++ b/htdocs/ecm/docother.php @@ -104,8 +104,6 @@ print_fiche_titre($langs->trans("ECMAutoOrg")); //$head = societe_prepare_head($societe); -//dol_fiche_head($head, 'document', $societe->nom); - /* * Confirmation de la suppression d'une ligne produit @@ -113,7 +111,7 @@ print_fiche_titre($langs->trans("ECMAutoOrg")); if ($_GET['action'] == 'delete_file') { print $form->formconfirm($_SERVER["PHP_SELF"].'?socid='.$socid.'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile'); - + } // Construit liste des fichiers diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 8f9bd5573bf..d675542140c 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -416,12 +416,6 @@ if (! empty($conf->global->ECM_AUTO_TREE_ENABLED)) print_fiche_titre($langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager")); -$helptext1=''; $helptext2=''; -$helptext1.=$langs->trans("ECMAreaDesc"); -$helptext1.=$langs->trans("ECMAreaDesc2"); -$helptext2.=$langs->trans("ECMAreaDesc"); -$helptext2.=$langs->trans("ECMAreaDesc2"); - /* print '
    '; print $langs->trans("ECMAreaDesc")."
    "; diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index 7d0fc5c64bf..7626774b24c 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -409,7 +409,7 @@ if (! empty($conf->global->ECM_AUTO_TREE_ENABLED)) if (! empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } if (! empty($conf->tax->enabled)) { $langs->load("compta"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBySocialContributions")); } if (! empty($conf->projet->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsByProjects")); } - if (! empty($conf->ficheinter->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsByInterventions")); } + if (! empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsByInterventions")); } $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsByUsers")); } diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/card.php similarity index 92% rename from htdocs/expedition/fiche.php rename to htdocs/expedition/card.php index 15b0a16a13e..7ccd24f871b 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/card.php @@ -7,6 +7,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Marcos García * Copyright (C) 2014 Cedric GROSS + * Copyright (C) 2014 Francis Appels * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,7 +24,7 @@ */ /** - * \file htdocs/expedition/fiche.php + * \file htdocs/expedition/card.php * \ingroup expedition * \brief Fiche descriptive d'une expedition */ @@ -81,13 +82,31 @@ if ($id > 0 || ! empty($ref)) } // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('expeditioncard')); +$hookmanager->initHooks(array('expeditioncard','globalcard')); + /* * Actions */ + +$warehousecanbeselectedlater=1; +if (($action == 'create') || ($action == 'add')) +{ + if (! empty($conf->productbatch->enabled)) + { + if (! (GETPOST('entrepot_id','int') > 0)) + { + $langs->load("errors"); + setEventMessage($langs->trans("WarehouseMustBeSelectedAtFirstStepWhenProductBatchModuleOn"),'errors'); + header("Location: ".DOL_URL_ROOT.'/expedition/shipment.php?id='.$id); + exit; + } + } +} + $parameters=array(); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($action == 'add') { @@ -207,7 +226,7 @@ if ($action == 'add') if (! $error) { $db->commit(); - header("Location: fiche.php?id=".$object->id); + header("Location: card.php?id=".$object->id); exit; } else @@ -226,7 +245,7 @@ else if ($action == 'create_delivery' && $conf->livraison_bon->enabled && $user- $result = $object->create_delivery($user); if ($result > 0) { - header("Location: ".DOL_URL_ROOT.'/livraison/fiche.php?id='.$result); + header("Location: ".DOL_URL_ROOT.'/livraison/card.php?id='.$result); exit; } else @@ -248,26 +267,23 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->exped } else { - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - $ret=$object->fetch($id); // Reload to get new records - $result=expedition_pdf_create($db,$object,$object->modelpdf,$outputlangs); - } - if ($result < 0) - { - dol_print_error($db,$result); - exit; - } + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result < 0) dol_print_error($db,$result); + } } } @@ -336,7 +352,7 @@ else if ($action == 'settrackingnumber' || $action == 'settrackingurl' { if ($object->update($user) >= 0) { - header("Location: fiche.php?id=".$object->id); + header("Location: card.php?id=".$object->id); exit; } setEventMessage($object->error,'errors'); @@ -362,7 +378,7 @@ else if ($action == 'builddoc') // En get ou en post $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - $result=expedition_pdf_create($db,$object,$object->modelpdf,$outputlangs); + $result = $object->generateDocument($object->modelpdf, $outputlangs); if ($result <= 0) { dol_print_error($db,$result); @@ -461,12 +477,13 @@ if ($action == 'send' && ! GETPOST('addfile','alpha') && ! GETPOST('removedfile' if (dol_strlen(GETPOST('subject','alpha'))) $subject=GETPOST('subject','alpha'); else $subject = $langs->transnoentities('Shipping').' '.$object->ref; $actiontypecode='AC_SHIP'; - $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; + $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; if ($message) { - $actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n"; - $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; - $actionmsg.=$message; + if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); + $actionmsg = dol_concatdesc($actionmsg, $message); } $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); } @@ -591,7 +608,7 @@ if ($action == 'create') print_fiche_titre($langs->trans("CreateASending")); if (! $origin) { - $mesg='
    '.$langs->trans("ErrorBadParameters").'
    '; + setEventMessage($langs->trans("ErrorBadParameters"),'errors'); } dol_htmloutput_mesg($mesg); @@ -634,11 +651,11 @@ if ($action == 'create') print ''; if ($origin == 'commande' && ! empty($conf->commande->enabled)) { - print $langs->trans("RefOrder").''.img_object($langs->trans("ShowOrder"),'order').' '.$object->ref; + print $langs->trans("RefOrder").''.img_object($langs->trans("ShowOrder"),'order').' '.$object->ref; } if ($origin == 'propal' && ! empty($conf->propal->enabled)) { - print $langs->trans("RefProposal").''.img_object($langs->trans("ShowProposal"),'propal').' '.$object->ref; + print $langs->trans("RefProposal").''.img_object($langs->trans("ShowProposal"),'propal').' '.$object->ref; } print ''; print "\n"; @@ -662,7 +679,8 @@ if ($action == 'create') print ''.$langs->trans("DateDeliveryPlanned").''; print ''; //print dol_print_date($object->date_livraison,"day"); // date_livraison come from order and will be stored into date_delivery planed. - print $form->select_date($object->date_livraison?$object->date_livraison:-1,'date_delivery',1,1); + $date_delivery = ($date_delivery?$date_delivery:$object->date_livraison); // $date_delivery comes from GETPOST + print $form->select_date($date_delivery?$date_delivery:-1,'date_delivery',1,1); print "\n"; print ''; @@ -769,10 +787,13 @@ if ($action == 'create') print ''; if (! empty($conf->stock->enabled)) { - if (empty($conf->productbatch->enabled)) { - print ''.$langs->trans("Warehouse").' / '.$langs->trans("Stock").''; - } else { - print ''.$langs->trans("Warehouse").' / '.$langs->trans("Batch").' / '.$langs->trans("Stock").''; + if (empty($conf->productbatch->enabled)) + { + print ''.$langs->trans("Warehouse").' ('.$langs->trans("Stock").')'; + } + else + { + print ''.$langs->trans("Warehouse").' / '.$langs->trans("Batch").' ('.$langs->trans("Stock").')'; } } print "\n"; @@ -826,7 +847,7 @@ if ($action == 'create') print ''; } else - { + { print ""; if ($type==1) $text = img_object($langs->trans('Service'),'service'); else $text = img_object($langs->trans('Product'),'product'); @@ -859,17 +880,19 @@ if ($action == 'create') $quantityAsked = $line->qty; $quantityToBeDelivered = $quantityAsked - $quantityDelivered; + $warehouse_id = GETPOST('entrepot_id','int'); + $defaultqty=0; - if (GETPOST('entrepot_id','int') > 0) + if ($warehouse_id > 0) { //var_dump($product); - $stock = $product->stock_warehouse[GETPOST('entrepot_id','int')]->real; + $stock = $product->stock_warehouse[$warehouse_id]->real; $stock+=0; // Convertit en numerique $defaultqty=min($quantityToBeDelivered, $stock); if (($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) || $defaultqty < 0) $defaultqty=0; } - if (empty($conf->productbatch->enabled) || ! ($product->hasbatch() and is_object($product->stock_warehouse[GETPOST('entrepot_id','int')]))) + if (empty($conf->productbatch->enabled) || ! ($product->hasbatch() and is_object($product->stock_warehouse[$warehouse_id]))) { // Quantity to send print ''; @@ -890,14 +913,14 @@ if ($action == 'create') // Show warehouse combo list $ent = "entl".$indiceAsked; $idl = "idl".$indiceAsked; - $tmpentrepot_id = is_numeric(GETPOST($ent,'int'))?GETPOST($ent,'int'):GETPOST('entrepot_id','int'); + $tmpentrepot_id = is_numeric(GETPOST($ent,'int'))?GETPOST($ent,'int'):$warehouse_id; print $formproduct->selectWarehouses($tmpentrepot_id,'entl'.$indiceAsked,'',1,0,$line->fk_product); - if ($tmpentrepot_id > 0 && $tmpentrepot_id == GETPOST('entrepot_id','int')) + if ($tmpentrepot_id > 0 && $tmpentrepot_id == $warehouse_id) { //print $stock.' '.$quantityToBeDelivered; if ($stock < $quantityToBeDelivered) { - print ' '.img_warning($langs->trans("StockTooLow")); // Stock too low for entrepot_id but we may have change warehouse + print ' '.img_warning($langs->trans("StockTooLow")); // Stock too low for this $warehouse_id but you can change warehouse } } } @@ -926,17 +949,20 @@ if ($action == 'create') $img=img_warning($langs->trans("StockTooLow")); } print "      -> - ".$value['fullpath']." + ".$value['fullpath']." (".$value['nb'].") ".$value['nb_total']."   ".$value['stock']." ".$img.""; } } } - } else { + } + else + { print ''; $subj=0; print ''; - foreach ($product->stock_warehouse[GETPOST('entrepot_id','int')]->detail_batch as $dbatch) { + foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) + { //var_dump($dbatch); $substock=$dbatch->qty +0 ; print ''; @@ -944,8 +970,13 @@ if ($action == 'create') print ''; print ''; + + $staticwarehouse=new Entrepot($db); + $staticwarehouse->fetch($warehouse_id); + print $staticwarehouse->getNomUrl(0).' / '; + print ''; - print $langs->trans("DetailBatchFormat", dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->batch, $dbatch->qty); + print $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty); if ($defaultqty<=0) { $defaultqty=0; } else { @@ -960,7 +991,7 @@ if ($action == 'create') print ""; - print '
    '; + print '
    '; print ''; @@ -1040,7 +1071,7 @@ else if ($id || $ref) } /* * Confirmation de l'annulation - */ + */ if ($action == 'annuler') { print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('CancelSending'),$langs->trans("ConfirmCancelSending",$object->ref),'confirm_cancel','',0,1); @@ -1087,7 +1118,7 @@ else if ($id || $ref) print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print ''; @@ -1433,16 +1464,30 @@ else if ($id || $ref) $entrepot->fetch($lines[$i]->entrepot_id); print $entrepot->getNomUrl(1); } + else if (count($lines[$i]->details_entrepot) > 1) + { + $detail = ''; + foreach ($lines[$i]->details_entrepot as $detail_entrepot) { + if ($detail_entrepot->entrepot_id > 0) { + $entrepot = new Entrepot($db); + $entrepot->fetch($detail_entrepot->entrepot_id); + $detail.= $langs->trans("DetailWarehouseFormat",$entrepot->libelle,$detail_entrepot->qty_shipped).'
    '; + } + } + print $form->textwithtooltip($langs->trans("DetailWarehouseNumber"),$detail); + } print ''; } // Batch number managment - if (! empty($conf->productbatch->enabled)) { - if (isset($lines[$i]->detail_batch) ) { - print ''; @@ -1598,7 +1643,7 @@ else if ($id || $ref) // Build document if it not exists if (! $file || ! is_readable($file)) { - $result=expedition_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + $result = $object->generateDocument(GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db,$result); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index d2527d1fca0..46f2cbc70fe 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -6,6 +6,8 @@ * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Cedric GROSS + * Copyright (C) 2014 Marcos García + * Copyright (C) 2014 Francis Appels * * 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 @@ -111,7 +113,7 @@ class Expedition extends CommonObject /** * Return next contract ref * - * @param Societe $soc Objet society + * @param Societe $soc Thirdparty object * @return string Free reference for contract */ function getNextNumRef($soc) @@ -277,7 +279,7 @@ class Expedition extends CommonObject { // Call trigger $result=$this->call_trigger('SHIPPING_CREATE',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers if (! $error) @@ -501,9 +503,10 @@ class Expedition extends CommonObject * Validate object and update stock if option enabled * * @param User $user Object user that validate + * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers * @return int <0 if OK, >0 if KO */ - function valid($user) + function valid($user, $notrigger=0) { global $conf, $langs; @@ -545,6 +548,7 @@ class Expedition extends CommonObject { $numref = "EXP".$this->id; } + $this->newref = $numref; $now=dol_now(); @@ -586,10 +590,9 @@ class Expedition extends CommonObject $cpt = $this->db->num_rows($resql); for ($i = 0; $i < $cpt; $i++) { - if($obj->qty <= 0) continue; - - dol_syslog(get_class($this)."::valid movement index ".$i); $obj = $this->db->fetch_object($resql); + if($obj->qty <= 0) continue; + dol_syslog(get_class($this)."::valid movement index ".$i); //var_dump($this->lines[$i]); $mouvS = new MouvementStock($this->db); @@ -598,12 +601,14 @@ class Expedition extends CommonObject // We use warehouse selected for each line $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref)); if ($result < 0) { $error++; break; } - + if (! empty($conf->productbatch->enabled)) { $details=ExpeditionLigneBatch::FetchAll($this->db,$obj->rowid); - foreach ($details as $dbatch) { - $result=$mouvS->livraison_batch($dbatch->fk_origin_stock,$dbatch->dluo_qty); - if ($result < 0) { $error++; $this->errors[]=$mouvS->$error; break 2; } + if (! empty($details)) { + foreach ($details as $dbatch) { + $result=$mouvS->livraison_batch($dbatch->fk_origin_stock,$dbatch->dluo_qty); + if ($result < 0) { $error++; $this->errors[]=$mouvS->$error; break 2; } + } } } } @@ -616,9 +621,17 @@ class Expedition extends CommonObject } } + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('SHIPPING_VALIDATE',$user); + if ($result < 0) { $error++; } + // End call triggers + } + if (! $error) { - $this->oldref=''; + $this->oldref = $this->ref; // Rename directory if dir was a temporary ref if (preg_match('/^[\(]?PROV/i', $this->ref)) @@ -635,11 +648,17 @@ class Expedition extends CommonObject if (@rename($dirsource, $dirdest)) { - $this->oldref = $oldref; - - dol_syslog("Rename ok"); - // Suppression ancien fichier PDF dans nouveau rep - dol_delete_file($dirdest.'/'.$oldref.'*.*'); + dol_syslog("Rename ok"); + // Rename docs starting with $oldref with $newref + $listoffiles=dol_dir_list($conf->expedition->dir_output.'/sending/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/')); + foreach($listoffiles as $fileentry) + { + $dirsource=$fileentry['name']; + $dirdest=preg_replace('/^'.preg_quote($oldref,'/').'/',$newref, $dirsource); + $dirsource=$fileentry['path'].'/'.$dirsource; + $dirdest=$fileentry['path'].'/'.$dirdest; + @rename($dirsource, $dirdest); + } } } } @@ -652,14 +671,6 @@ class Expedition extends CommonObject $this->statut = 1; } - if (! $error) - { - // Call trigger - $result=$this->call_trigger('SHIPPING_VALIDATE',$user); - if ($result < 0) { $error++; } - // End call triggers - } - if (! $error) { $this->db->commit(); @@ -722,25 +733,25 @@ class Expedition extends CommonObject function addline($entrepot_id, $id, $qty) { global $conf, $langs; - + $num = count($this->lines); $line = new ExpeditionLigne($this->db); $line->entrepot_id = $entrepot_id; $line->origin_line_id = $id; $line->qty = $qty; - + if($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT) { $orderline = new OrderLine($this->db); $orderline->fetch($id); $fk_product = $orderline->fk_product; - + if (!empty($orderline->fk_product)) { $product=new Product($this->db); $result=$product->fetch($fk_product); $product_type=$product->type; - + if($product_type == 0 && $product->stock_reel < $qty) { $this->error=$langs->trans('ErrorStockIsNotEnough'); $this->db->rollback(); @@ -791,7 +802,7 @@ class Expedition extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; $error=0; @@ -865,7 +876,7 @@ class Expedition extends CommonObject { // Call trigger $result=$this->call_trigger('SHIPPING_MODIFY',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers } } @@ -913,7 +924,7 @@ class Expedition extends CommonObject if ($conf->productbatch->enabled) { require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php'; - if ( ExpeditionLigneBatch::deletefromexp($this->db,$this->id)<0) + if ( ExpeditionLigneBatch::deletefromexp($this->db,$this->id)<0) {$error++;$this->errors[]="Error ".$this->db->lasterror();} } // Stock control @@ -979,7 +990,7 @@ class Expedition extends CommonObject { // Call trigger $result=$this->call_trigger('SHIPPING_DELETE',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers if (! $error) @@ -1067,7 +1078,7 @@ class Expedition extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = cd.fk_product"; $sql.= " WHERE ed.fk_expedition = ".$this->id; $sql.= " AND ed.fk_origin_line = cd.rowid"; - $sql.= " ORDER BY cd.rang"; + $sql.= " ORDER BY cd.rang, ed.fk_origin_line"; dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); $resql = $this->db->query($sql); @@ -1077,6 +1088,8 @@ class Expedition extends CommonObject $num = $this->db->num_rows($resql); $i = 0; + $lineindex = 0; + $originline = 0; $this->total_ht = 0; $this->total_tva = 0; @@ -1086,13 +1099,25 @@ class Expedition extends CommonObject while ($i < $num) { - $line = new ExpeditionLigne($this->db); $obj = $this->db->fetch_object($resql); + if ($originline == $obj->fk_origin_line) { + $line->entrepot_id = 0; // entrepod_id in details_entrepot + $line->qty_shipped += $obj->qty_shipped; + } else { + $line = new ExpeditionLigne($this->db); + $line->entrepot_id = $obj->fk_entrepot; + $line->qty_shipped = $obj->qty_shipped; + } + + $detail_entrepot = new stdClass; + $detail_entrepot->entrepot_id = $obj->fk_entrepot; + $detail_entrepot->qty_shipped = $obj->qty_shipped; + $line->details_entrepot[] = $detail_entrepot; + $line->line_id = $obj->line_id; $line->fk_origin_line = $obj->fk_origin_line; $line->origin_line_id = $obj->fk_origin_line; // TODO deprecated - $line->entrepot_id = $obj->fk_entrepot; $line->fk_product = $obj->fk_product; $line->fk_product_type = $obj->fk_product_type; $line->ref = $obj->product_ref; // TODO deprecated @@ -1102,7 +1127,6 @@ class Expedition extends CommonObject $line->label = $obj->custom_label; $line->description = $obj->description; $line->qty_asked = $obj->qty_asked; - $line->qty_shipped = $obj->qty_shipped; $line->weight = $obj->weight; $line->weight_units = $obj->weight_units; $line->length = $obj->length; @@ -1115,7 +1139,7 @@ class Expedition extends CommonObject // For invoicing $tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type); // We force type to 0 $line->desc = $obj->description; // We need ->desc because some code into CommonObject use desc (property defined for other elements) - $line->qty = $obj->qty_shipped; + $line->qty = $line->qty_shipped; $line->total_ht = $tabprice[0]; $line->total_localtax1 = $tabprice[9]; $line->total_localtax2 = $tabprice[10]; @@ -1137,14 +1161,28 @@ class Expedition extends CommonObject // Eat-by date if (! empty($conf->productbatch->enabled)) { /* test on conf at begining of file sometimes doesn't include expeditionbatch - * May be conf is not well initialized for dark reason + * May be conf is not well initialized for dark reason */ require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php'; - $line->detail_batch=ExpeditionLigneBatch::FetchAll($this->db,$obj->line_id); + if ($originline != $obj->fk_origin_line) { + $line->detail_batch = ExpeditionLigneBatch::FetchAll($this->db,$obj->line_id); + } else { + $line->detail_batch = array_merge($line->detail_batch,ExpeditionLigneBatch::FetchAll($this->db,$obj->line_id)); + } + } + if ($originline != $obj->fk_origin_line) { + $this->lines[$lineindex] = $line; + $lineindex++; + } else { + $line->total_ht += $tabprice[0]; + $line->total_localtax1 += $tabprice[9]; + $line->total_localtax2 += $tabprice[10]; + $line->total_ttc += $tabprice[2]; + $line->total_tva += $tabprice[1]; } - $this->lines[$i] = $line; $i++; + $originline = $obj->fk_origin_line; } $this->db->free($resql); return 1; @@ -1171,7 +1209,7 @@ class Expedition extends CommonObject $result=''; - $url = DOL_URL_ROOT.'/expedition/fiche.php?id='.$this->id; + $url = DOL_URL_ROOT.'/expedition/card.php?id='.$this->id; if ($short) return $url; @@ -1181,7 +1219,7 @@ class Expedition extends CommonObject $picto='sending'; $label=$langs->trans("ShowSending").': '.$this->ref; - if ($withpicto) $result.=($linkstart.img_object($label,$picto).$linkend); + if ($withpicto) $result.=($linkstart.img_object($label, $picto, 'class="classfortooltip"').$linkend); if ($withpicto && $withpicto != 2) $result.=' '; $result.=$linkstart.$this->ref.$linkend; return $result; @@ -1519,10 +1557,14 @@ class Expedition extends CommonObject global $conf; $sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut=2'; - $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0 ;'; - if ($this->db->query($sql) ) + $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0'; + + $resql=$this->db->query($sql); + if ($resql) { //TODO: Option to set order billed if 100% of order is shipped + $this->statut=2; + $this->billed=1; return 1; } else @@ -1532,6 +1574,39 @@ class Expedition extends CommonObject } } + /** + * Cree un bon d'expedition sur disque + * + * @param string $modele Force le modele a utiliser ('' to not force) + * @param Translate $outputlangs Objet lang a utiliser pour traduction + * @return int <=0 if KO, >0 if OK + */ + public function generateDocument($modele, $outputlangs) + { + global $conf,$user,$langs; + + $langs->load("sendings"); + + // Sets the model on the model name to use + if (! dol_strlen($modele)) + { + if (! empty($conf->global->EXPEDITION_ADDON_PDF)) + { + $modele = $conf->global->EXPEDITION_ADDON_PDF; + } + else + { + $modele = 'rouget'; + } + } + + $modelpath = "core/modules/expedition/doc/"; + + $this->fetch_origin(); + + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, 0, 0, 0); + } + } diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index 49b83692630..c09b3e415cd 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -159,7 +159,7 @@ if ($id > 0 || ! empty($ref)) */ print '
    '.$langs->trans("Ref").''; + if (! empty($conf->productbatch->enabled)) + { + if (isset($lines[$i]->detail_batch)) + { + print ''; $detail = ''; foreach ($lines[$i]->detail_batch as $dbatch) { - $detail.= $langs->trans("DetailBatchFormat",dol_print_date($dbatch->eatby,"day"),dol_print_date($dbatch->sellby,"day"),$dbatch->batch,$dbatch->dluo_qty).'
    '; + $detail.= $langs->trans("DetailBatchFormat",$dbatch->batch,dol_print_date($dbatch->eatby,"day"),dol_print_date($dbatch->sellby,"day"),$dbatch->dluo_qty).'
    '; } print $form->textwithtooltip($langs->trans("DetailBatchNumber"),$detail); print '
    '; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print ''; print ''; @@ -224,7 +228,7 @@ else dol_print_error($db); * Last shipments */ $sql = "SELECT e.rowid, e.ref"; -$sql.= ", s.nom, s.rowid as socid"; +$sql.= ", s.nom as name, s.rowid as socid"; $sql.= ", c.ref as commande_ref, c.rowid as commande_id"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping' AND el.sourcetype IN ('commande')"; @@ -253,9 +257,9 @@ if ($resql) { $var=!$var; $obj = $db->fetch_object($resql); - print ''; - print ''; + print ''; print '
    '.$langs->trans("Ref").''; diff --git a/htdocs/expedition/index.php b/htdocs/expedition/index.php index 5ce833e5e3f..2b41a939c7b 100644 --- a/htdocs/expedition/index.php +++ b/htdocs/expedition/index.php @@ -44,14 +44,12 @@ llxHeader('',$langs->trans("Shipment"),$helpurl); print_fiche_titre($langs->trans("SendingsArea")); -//print ''; -//print '"; print ''; print ''; $i++; } @@ -116,7 +114,7 @@ if ($resql) /* * Commandes a traiter */ -$sql = "SELECT c.rowid, c.ref, s.nom, s.rowid as socid"; +$sql = "SELECT c.rowid, c.ref, c.fk_statut, s.nom as name, s.rowid as socid"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -138,7 +136,7 @@ if ($resql) $i = 0; print '
    '; print '
    '; $var=false; print ''; -print ''; +print ''; print ''; print ''; print '
    '.$langs->trans("SearchASending").'
    '; @@ -64,7 +62,7 @@ print "

    \n"; $clause = " WHERE "; $sql = "SELECT e.rowid, e.ref"; -$sql.= ", s.nom, s.rowid as socid"; +$sql.= ", s.nom as name, s.rowid as socid"; $sql.= ", c.ref as commande_ref, c.rowid as commande_id"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping'"; @@ -101,10 +99,10 @@ if ($resql) print $shipment->getNomUrl(1); print "
    '; - print ''.$obj->nom.''; + print ''.$obj->name.''; print ''; - if ($obj->commande_id) print ''.$obj->commande_ref.''; + if ($obj->commande_id) print ''.$obj->commande_ref.''; print '
    '; print ''; - print ''; + print ''; $var = True; while ($i < $num) { @@ -148,13 +146,19 @@ if ($resql) print ''; print ''; + print ''; + print ''; + print ''; $i++; } print "
    '.$langs->trans("OrdersToProcess").'
    '.$langs->trans("OrdersToProcess").'
    '; $orderstatic->id=$obj->rowid; $orderstatic->ref=$obj->ref; + $orderstatic->statut=$obj->fk_statut; + $orderstatic->facturee=0; print $orderstatic->getNomUrl(1); print ''; - $companystatic->nom=$obj->nom; + $companystatic->name=$obj->name; $companystatic->id=$obj->socid; print $companystatic->getNomUrl(1,'customer',32); - print '
    '; + print $orderstatic->getLibStatut(3); + print '

    "; @@ -169,7 +173,7 @@ print '
    '; /* * Commandes en traitement */ -$sql = "SELECT c.rowid, c.ref, c.fk_statut as status, c.facture as billed, s.nom, s.rowid as socid"; +$sql = "SELECT c.rowid, c.ref, c.fk_statut as status, c.facture as billed, s.nom as name, s.rowid as socid"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -202,7 +206,7 @@ if ( $resql ) print $orderstatic->getNomUrl(1); print '
    '; - $companystatic->nom=$obj->nom; + $companystatic->name=$obj->name; $companystatic->id=$obj->socid; print $companystatic->getNomUrl(1,'customer'); print '
    '.img_object($langs->trans("ShowSending"),"sending").' '; + print '
    '.img_object($langs->trans("ShowSending"),"sending").' '; print $obj->ref.''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.''; if ($obj->commande_id) { @@ -274,7 +278,6 @@ if ($resql) else dol_print_error($db); -//print '
    '; print '
    '; diff --git a/htdocs/expedition/liste.php b/htdocs/expedition/list.php similarity index 74% rename from htdocs/expedition/liste.php rename to htdocs/expedition/list.php index 91eb7056b2c..2468c9084d2 100644 --- a/htdocs/expedition/liste.php +++ b/htdocs/expedition/list.php @@ -18,7 +18,7 @@ */ /** - * \file htdocs/expedition/liste.php + * \file htdocs/expedition/list.php * \ingroup expedition * \brief Page to list all shipments */ @@ -36,7 +36,7 @@ $result = restrictedArea($user, 'expedition',$expeditionid,''); $search_ref_exp = GETPOST("search_ref_exp"); $search_ref_liv = GETPOST('search_ref_liv'); -$search_societe = GETPOST("search_societe"); +$search_company = GETPOST("search_company"); $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); @@ -51,12 +51,12 @@ if (! $sortfield) $sortfield="e.ref"; if (! $sortorder) $sortorder="DESC"; $limit = $conf->liste_limit; -// Do we click on purge search criteria ? -if (GETPOST("button_removefilter_x")) +// Purge search criteria +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_ref_exp=''; $search_ref_liv=''; - $search_societe=''; + $search_company=''; } /* @@ -92,7 +92,7 @@ if ($socid) } if ($search_ref_exp) $sql .= natural_search('e.ref', $search_ref_exp); if ($search_ref_liv) $sql .= natural_search('l.ref', $search_ref_liv); -if ($search_societe) $sql .= natural_search('s.nom', $search_societe); +if ($search_company) $sql .= natural_search('s.nom', $search_company); $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1,$offset); @@ -107,32 +107,34 @@ if ($resql) $param=""; if ($search_ref_exp) $param.= "&search_ref_exp=".$search_ref_exp; if ($search_ref_liv) $param.= "&search_ref_liv=".$search_ref_liv; - if ($search_societe) $param.= "&search_societe=".$search_societe; + if ($search_company) $param.= "&search_company=".$search_company; - print_barre_liste($langs->trans('ListOfSendings'), $page, "liste.php",$param,$sortfield,$sortorder,'',$num); + print_barre_liste($langs->trans('ListOfSendings'), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num); $i = 0; + print '
    '."\n"; print ''; print ''; - print_liste_field_titre($langs->trans("Ref"),"ship2bill.php","e.ref","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),"ship2bill.php","s.nom", "", $param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateDeliveryPlanned"),"ship2bill.php","e.date_delivery","",$param, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"e.ref","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"],"s.nom", "", $param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateDeliveryPlanned"), $_SERVER["PHP_SELF"],"e.date_delivery","",$param, 'align="center"',$sortfield,$sortorder); if($conf->livraison_bon->enabled) { - print_liste_field_titre($langs->trans("DeliveryOrder"),"ship2bill.php","e.date_expedition","",$param, '',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateReceived"),"ship2bill.php","e.date_expedition","",$param, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DeliveryOrder"), $_SERVER["PHP_SELF"],"e.date_expedition","",$param, '',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateReceived"), $_SERVER["PHP_SELF"],"e.date_expedition","",$param, 'align="center"',$sortfield,$sortorder); } - print_liste_field_titre($langs->trans("Status"),"ship2bill.php","e.fk_statut","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"],"e.fk_statut","",$param,'align="right"',$sortfield,$sortorder); + print ''; print "\n"; - + // Lignes des champs de filtre print ''; print ''; print ''; print ''; if($conf->livraison_bon->enabled) { @@ -141,19 +143,15 @@ if ($resql) print ''; print ''; } - print ''; + print ''; print ''; - + print "\n"; - + $var=True; while ($i < min($num,$limit)) @@ -161,20 +159,24 @@ if ($resql) $objp = $db->fetch_object($resql); $var=!$var; + + // Ref print ""; print "\n"; + // Third party print ''; - // Date delivery planed + + // Date delivery planed print "'; - print ''; - print ''; + print ''; + print ''; // Total TVA - print ''; - print ''; + print ''; + print ''; // Total TTC - print ''; - print ''; + print ''; + print ''; // Statut print ''; @@ -563,7 +564,7 @@ if ($id > 0 || ! empty($ref)) { $img=img_warning($langs->trans("StockTooLow")); } - print ''; + print ''; print ''; print ''; print ''; @@ -606,7 +607,7 @@ if ($id > 0 || ! empty($ref)) { if ($user->rights->expedition->creer) { - print ''.$langs->trans("NewSending").''; + print ''.$langs->trans("NewSending").''; if ($toBeShippedTotal <= 0) { print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend")); @@ -628,7 +629,7 @@ if ($id > 0 || ! empty($ref)) { print_titre($langs->trans("NewSending")); - print ''; + print ''; print ''; print ''; print ''; @@ -642,12 +643,15 @@ if ($id > 0 || ! empty($ref)) if (! empty($conf->stock->enabled)) { - print ''; + $warehousecanbeselectedlater=1; + if (! empty($conf->productbatch->enabled)) $warehousecanbeselectedlater=0; + + print ''.$langs->trans("WarehouseSource").''; print ''; } diff --git a/htdocs/expedition/tpl/linkedobjectblock.tpl.php b/htdocs/expedition/tpl/linkedobjectblock.tpl.php index 364afb92177..72206c13e2b 100644 --- a/htdocs/expedition/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expedition/tpl/linkedobjectblock.tpl.php @@ -47,7 +47,7 @@ foreach($linkedObjectBlock as $object) $var=!$var; ?> > + trans("ShowShipping"),"sending").' '.$object->ref; ?>"; print '"; print ""; -print ""; +print ""; print ""; $var=!$var; @@ -114,9 +114,9 @@ print ""; print "
     
    '; print ''; print ''; - print ''; + print ''; print '  '; - // Développé dans la 3.7 - //print img_search(); - //print img_searchclear(); - print ''; + print ''; print ''; - print ''; print ''.$langs->trans("All").' / '.$langs->trans("None").''; print '
    "; $shipment->id=$objp->rowid; $shipment->ref=$objp->ref; print $shipment->getNomUrl(1); print "'; $companystatic->id=$objp->socid; $companystatic->ref=$objp->socname; - $companystatic->nom=$objp->socname; + $companystatic->name=$objp->socname; print $companystatic->getNomUrl(1); print '"; print dol_print_date($db->jdate($objp->date_expedition),"day"); /*$now = time(); diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index 27d53b03cd6..01a341d7ab5 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -101,7 +101,7 @@ if ($id > 0 || ! empty($ref)) print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print ''; diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 0ad306ef8a3..bce365447e1 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -164,7 +164,7 @@ if ($id > 0 || ! empty($ref)) } // Onglet commande - $nbrow=7; + $nbrow=8; if (! empty($conf->projet->enabled)) $nbrow++; print '
    '.$langs->trans("Ref").'
    '; @@ -264,6 +264,7 @@ if ($id > 0 || ! empty($ref)) print dol_print_date($commande->date_livraison,'daytext'); } print ''; + // Note on several rows print ''; @@ -277,7 +278,7 @@ if ($id > 0 || ! empty($ref)) if ($action != 'editshippingmethod' && $user->rights->expedition->creer) print ''; print '
    '.$langs->trans('NotePublic').' :
    '; print nl2br($commande->note_public); print '
    id.'">'.img_edit($langs->trans('SetShippingMode'),1).'
    '; - print '
    '; + print ''; if ($action == 'editshippingmethod') { $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->shipping_method_id, 'shipping_method_id', 1); } else { @@ -349,16 +350,16 @@ if ($id > 0 || ! empty($ref)) // Total HT print '
    '.$langs->trans('AmountHT').''.price($commande->total_ht).''.$langs->trans('Currency'.$conf->currency).'
    '.price($commande->total_ht, 0, '', 1, -1, -1, $conf->currency).'
    '.$langs->trans('AmountVAT').''.price($commande->total_tva).''.$langs->trans('Currency'.$conf->currency).'
    '.$langs->trans('AmountVAT').''.price($commande->total_tva, 0, '', 1, -1, -1, $conf->currency).'
    '.$langs->trans('AmountTTC').''.price($commande->total_ttc).''.$langs->trans('Currency'.$conf->currency).'
    '.$langs->trans('AmountTTC').''.price($commande->total_ttc, 0, '', 1, -1, -1, $conf->currency).'
    '.$langs->trans('Status').'
          -> '.$value['fullpath'].' ('.$value['nb'].')
          -> '.$value['fullpath'].' ('.$value['nb'].') '.$value['nb_total'].'  '.$langs->trans("WarehouseSource").''; print $formproduct->selectWarehouses(-1,'entrepot_id','',1); if (count($formproduct->cache_warehouses) <= 0) { - print '   '.$langs->trans("WarehouseSourceNotDefined").' '.$langs->trans("AddOne").''; + print '   '.$langs->trans("WarehouseSourceNotDefined").' '.$langs->trans("AddOne").''; } print '
    - trans("ShowShipping"),"sending").' '.$object->ref; ?> date_creation,'day'); ?> date_delivery,'day'); ?> '; print '
    '; -print '
    '; +print '
    '; if (count($export->array_export_code)) { if ($user->rights->export->creer) @@ -102,12 +102,12 @@ if (count($export->array_export_code)) print ''.$langs->trans("NewExport").''; } /* - print '
    rights->export->creer?'':' disabled="disabled"'); - print '>
    '; + print '>
    '; */ } -print '
    '; +print ''; print '
    '; print '
    '; diff --git a/htdocs/externalsite/admin/externalsite.php b/htdocs/externalsite/admin/externalsite.php index 95d0a4397de..45f47c7d824 100644 --- a/htdocs/externalsite/admin/externalsite.php +++ b/htdocs/externalsite/admin/externalsite.php @@ -99,7 +99,7 @@ $var=!$var; print "
    '.$langs->trans("Label")."global->EXTERNALSITE_LABEL) || $conf->global->EXTERNALSITE_LABEL=='ExternalSite')?'':$conf->global->EXTERNALSITE_LABEL)) . "\" size=\"12\">My menu entry".$langs->trans("ExampleMyMenuEntry")."
    "; -print '
    '; -print "trans("Save")."\">"; -print "
    "; +print '
    '; +print ''; +print '
    '; print "\n"; diff --git a/htdocs/externalsite/frames.php b/htdocs/externalsite/frames.php index 0fca246e9ee..c0b5cf92e7e 100644 --- a/htdocs/externalsite/frames.php +++ b/htdocs/externalsite/frames.php @@ -58,10 +58,10 @@ print " <body> - <br><center> + <br><div class=\"center\"> Sorry, your browser is too old or not correctly configured to view this area.<br> Your browser must support frames.<br> - </center> + </div> </body> diff --git a/htdocs/fichinter/admin/fichinter_extrafields.php b/htdocs/fichinter/admin/fichinter_extrafields.php index cab0886f5ff..8cb95a30f63 100644 --- a/htdocs/fichinter/admin/fichinter_extrafields.php +++ b/htdocs/fichinter/admin/fichinter_extrafields.php @@ -92,6 +92,7 @@ print ''.$langs->trans("Type").''; print ''.$langs->trans("Size").''; print ''.$langs->trans("Unique").''; print ''.$langs->trans("Required").''; +print ''.$langs->trans("AlwaysEditable").''; print ' '; print "\n"; @@ -107,6 +108,7 @@ foreach($extrafields->attribute_type as $key => $value) print ''.$extrafields->attribute_size[$key]."\n"; print ''.yn($extrafields->attribute_unique[$key])."\n"; print ''.yn($extrafields->attribute_required[$key])."\n"; + print ''.yn($extrafields->attribute_alwayseditable[$key])."\n"; // TODO This must be generalised into all page to admin extrafield. Mutualize code here is easy and will save a lot of code print ''.img_edit().''; print "  ".img_delete()."\n"; print ""; diff --git a/htdocs/fichinter/apercu.php b/htdocs/fichinter/apercu.php index 753a74a3ed6..0d4d3421538 100644 --- a/htdocs/fichinter/apercu.php +++ b/htdocs/fichinter/apercu.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent * @@ -40,6 +40,11 @@ $ref = GETPOST('ref','alpha'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); + +/* + * View + */ + llxHeader(); $form = new Form($db); @@ -139,7 +144,7 @@ if ($id > 0 || ! empty($ref)) // Client print "".$langs->trans("Customer").""; print ''; - print ''.$soc->nom.''; + print ''.$soc->name.''; print ''; print ''; @@ -150,10 +155,12 @@ if ($id > 0 || ! empty($ref)) // Date print ''.$langs->trans("Date").''; - print "".dol_print_date($object->date,"daytext")."\n"; + print "".dol_print_date($object->datec,"daytext")."\n"; print ''; print ''; + + dol_fiche_end(); } else { @@ -165,7 +172,7 @@ if ($id > 0 || ! empty($ref)) // Si fichier png PDF d'1 page trouve if (file_exists($fileimage)) { - print ''; + print ''; } // Si fichier png PDF de plus d'1 page trouve elseif (file_exists($fileimagebis)) @@ -178,13 +185,12 @@ elseif (file_exists($fileimagebis)) if (file_exists($dir_output.$preview)) { - print '

    '; + print '

    '; } } } -print ''; - -$db->close(); llxFooter(); + +$db->close(); diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/card.php similarity index 86% rename from htdocs/fichinter/fiche.php rename to htdocs/fichinter/card.php index edd5372471e..f618e6ff9ad 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/card.php @@ -1,9 +1,10 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2013 Florian Henry + * Copyright (C) 2014 Ferran Marcet * * 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 @@ -20,7 +21,7 @@ */ /** - * \file htdocs/fichinter/fiche.php + * \file htdocs/fichinter/card.php * \brief Page of intervention * \ingroup ficheinter */ @@ -64,6 +65,7 @@ $mesg = GETPOST('msg','alpha'); $origin=GETPOST('origin','alpha'); $originid=(GETPOST('originid','int')?GETPOST('originid','int'):GETPOST('origin_id','int')); // For backward compatibility $note_public = GETPOST('note_public'); +$lineid = GETPOST('line_id','int'); //PDF $hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); @@ -75,7 +77,7 @@ if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('interventioncard')); +$hookmanager->initHooks(array('interventioncard','globalcard')); $object = new Fichinter($db); $extrafields = new ExtraFields($db); @@ -96,7 +98,11 @@ $permissionnote=$user->rights->ficheinter->creer; // Used by the include of acti * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once +$parameters=array('socid'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->ficheinter->creer) { @@ -513,7 +519,7 @@ else if ($action == 'classifybilled' && $user->rights->ficheinter->creer) } else { - $mesg='

    '.$object->error.'
    '; + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -538,7 +544,7 @@ else if ($action == 'classifyunbilled' && $user->rights->ficheinter->creer) else if ($action == 'updateline' && $user->rights->ficheinter->creer && GETPOST('save','alpha') == $langs->trans("Save")) { $objectline = new FichinterLigne($db); - if ($objectline->fetch(GETPOST('line_id','int')) <= 0) + if ($objectline->fetch($lineid) <= 0) { dol_print_error($db); exit; @@ -594,7 +600,7 @@ else if ($action == 'updateline' && $user->rights->ficheinter->creer && GETPOST( else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->ficheinter->creer) { $objectline = new FichinterLigne($db); - if ($objectline->fetch(GETPOST('line_id','int')) <= 0) + if ($objectline->fetch($lineid) <= 0) { dol_print_error($db); exit; @@ -626,7 +632,7 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights-> else if ($action == 'up' && $user->rights->ficheinter->creer) { - $object->line_up(GETPOST('line_id','int')); + $object->line_up($lineid); // Define output language $outputlangs = $langs; @@ -640,13 +646,13 @@ else if ($action == 'up' && $user->rights->ficheinter->creer) } if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) fichinter_create($db, $object, $object->modelpdf, $outputlangs); - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.GETPOST('line_id','int')); + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.$lineid); exit; } else if ($action == 'down' && $user->rights->ficheinter->creer) { - $object->line_down(GETPOST('line_id','int')); + $object->line_down($lineid); // Define output language $outputlangs = $langs; @@ -660,7 +666,7 @@ else if ($action == 'down' && $user->rights->ficheinter->creer) } if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) fichinter_create($db, $object, $object->modelpdf, $outputlangs); - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.GETPOST('line_id','int')); + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.$lineid); exit; } @@ -739,14 +745,15 @@ if ($action == 'send' && ! GETPOST('cancel','alpha') && (empty($conf->global->MA if (strlen(GETPOST('subject','alphs'))) $subject = GETPOST('subject','alpha'); else $subject = $langs->transnoentities('Intervention').' '.$object->ref; $actiontypecode='AC_OTH_AUTO'; - $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; + $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; if ($message) { - $actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n"; - $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; - $actionmsg.=$message; + if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); + $actionmsg = dol_concatdesc($actionmsg, $message); } - $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); + $actionmsg2=$langs->transnoentities("InterventionSentByEMail",$object->ref); } // Create form object @@ -1044,7 +1051,7 @@ if ($action == 'create') $numprojet=$formproject->select_projects($soc->id,GETPOST('projectid','int'),'projectid'); if ($numprojet==0) { - print '   '.$langs->trans("AddProject").''; + print '   '.$langs->trans("AddProject").''; } print ''; } @@ -1057,7 +1064,7 @@ if ($action == 'create') $numcontrat=$formcontract->select_contract($soc->id,GETPOST('contratid','int'),'contratid',0,1); if ($numcontrat==0) { - print '   '.$langs->trans("AddContract").''; + print '   '.$langs->trans("AddContract").''; } print ''; } @@ -1115,9 +1122,9 @@ if ($action == 'create') print ''; } - print '

    '; + print '
    '; print ''; - print '
    '; + print ''; print ''; } @@ -1130,10 +1137,10 @@ if ($action == 'create') print ''; print ''; - print '
    '; + print '
    '; print ''; print ''; - print '
    '; + print ''; print ''; } @@ -1157,14 +1164,15 @@ else if ($id > 0 || ! empty($ref)) dol_fiche_head($head, 'card', $langs->trans("InterventionCard"), 0, 'intervention'); - // Confirmation de la suppression de la fiche d'intervention + $formconfirm=''; + + // Confirm deletion of intervention if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete','',0,1); - + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete','',0,1); } - // Confirmation validation + // Confirm validation if ($action == 'validate') { // on verifie si l'objet est en numerotation provisoire @@ -1184,29 +1192,34 @@ else if ($id > 0 || ! empty($ref)) } $text=$langs->trans('ConfirmValidateIntervention',$numref); - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateIntervention'), $text, 'confirm_validate','',0,1); - + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateIntervention'), $text, 'confirm_validate','',1,1); } - // Confirmation de la validation de la fiche d'intervention + // Confirm back to draft if ($action == 'modify') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify','',0,1); - + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify','',0,1); } - // Confirmation de la suppression d'une ligne d'intervention + // Confirm deletion of line if ($action == 'ask_deleteline') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&line_id='.GETPOST('line_id','int'), $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1); - + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&line_id='.$lineid, $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1); } + if (!$formconfirm) + { + $parameters=array('lineid'=>$lineid); + $formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + } + + // Print form confirm + print $formconfirm; + print '
    '; print ''; if ($action == 'edit_extras') print ''; if ($action == 'contrat') print ''; - print ''; print ''; @@ -1214,18 +1227,18 @@ else if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''; // Third party - print ""; + print ""; if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) { // Duration print ''; - print ''; + print ''; print ''; } @@ -1303,7 +1316,7 @@ else if ($id > 0 || ! empty($ref)) { $contratstatic = new Contrat($db); $contratstatic->fetch($object->fk_contrat); - //print ''.$projet->title.''; + //print ''.$projet->title.''; print $contratstatic->getNomUrl(0,'',1); } else @@ -1316,51 +1329,11 @@ else if ($id > 0 || ! empty($ref)) } // Statut - print ''; + print ''; - // Other attributes (TODO Move this into an include) - $parameters=array('colspan' => ' colspan="3"'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - foreach($extrafields->attribute_label as $key=>$label) - { - if ($action == 'edit_extras') { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - } else { - $value=$object->array_options["options_".$key]; - } - if ($extrafields->attribute_type[$key] == 'separate') - { - print $extrafields->showSeparator($key); - } - else - { - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''."\n"; - } - } - } + // Other attributes + $cols = 3; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; print "
    '.$langs->trans("Ref").''; + print '
    '.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print '
    ".$langs->trans("Company")."".$object->client->getNomUrl(1)."
    ".$langs->trans("Company").''.$object->client->getNomUrl(1)."
    '.$langs->trans("TotalDuration").''.convertSecondToTime($object->duree, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).''.convertSecondToTime($object->duree, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'
    '.$langs->trans("Status").''.$object->getLibStatut(4).'
    '.$langs->trans("Status").''.$object->getLibStatut(4).'
    '; - // Convert date into timestamp format - if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) - { - $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$db->jdate($object->array_options['options_'.$key]); - } - if ($action == 'edit_extras' && $user->rights->ficheinter->creer && GETPOST('attribute') == $key) - { - print ''; - - print $extrafields->showInputField($key,$value); - - print '   '; - } - else - { - print $extrafields->showOutputField($key,$value); - if (($object->statut == 0 || $object->statut == 1) && $user->rights->ficheinter->creer) print '   '.img_picto('','edit').' '.$langs->trans('Modify').''; - } - print '
    "; @@ -1400,6 +1373,8 @@ else if ($id > 0 || ! empty($ref)) $sql.= ' ft.date as date_intervention'; $sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft'; $sql.= ' WHERE ft.fk_fichinter = '.$object->id; + if (!empty($conf->global->FICHINTER_HIDE_EMPTY_DURATION)) + $sql.= ' AND ft.duree <> 0'; $sql.= ' ORDER BY ft.rang ASC, ft.rowid'; $resql = $db->query($sql); @@ -1513,7 +1488,9 @@ else if ($id > 0 || ! empty($ref)) // Duration print ''; - $form->select_duration('duration',$objp->duree); + $selectmode='select'; + if (! empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) $selectmode='text'; + $form->select_duration('duration',$objp->duree, $selectmode); print ''; print ''; @@ -1611,93 +1588,100 @@ else if ($id > 0 || ! empty($ref)) /* * Actions buttons */ + print '
    '; - if ($user->societe_id == 0) + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been + // modified by hook + if (empty($reshook)) { - if ($action != 'editdescription' && ($action != 'presend')) + if ($user->societe_id == 0) { - // Validate - if ($object->statut == 0 && $user->rights->ficheinter->creer && (count($object->lines) > 0 || ! empty($conf->global->FICHINTER_DISABLE_DETAILS))) + if ($action != 'editdescription' && ($action != 'presend')) { - print ''; - } - - // Modify - if ($object->statut == 1 && $user->rights->ficheinter->creer) - { - print ''; - } - - // Send - if ($object->statut > 0) - { - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send) + // Validate + if ($object->statut == 0 && $user->rights->ficheinter->creer && (count($object->lines) > 0 || ! empty($conf->global->FICHINTER_DISABLE_DETAILS))) { - print ''; + print ''; } - else print ''; - } - // Event agenda - if (! empty($conf->global->FICHINTER_ADDLINK_TO_EVENT)) - { - if (! empty($conf->agenda->enabled) && $object->statut > 0) + // Modify + if ($object->statut == 1 && $user->rights->ficheinter->creer) { - $langs->load("agenda"); + print ''; + } + + // Send + if ($object->statut > 0) + { + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send) + { + print ''; + } + else print ''; + } + + // Event agenda + if (! empty($conf->global->FICHINTER_ADDLINK_TO_EVENT)) + { + if (! empty($conf->agenda->enabled) && $object->statut > 0) + { + $langs->load("agenda"); + if ($object->statut < 2) + { + if ($user->rights->agenda->myactions->create) print ''; + else print ''; + } + } + } + + // Proposal + if (! empty($conf->propal->enabled) && $object->statut > 0) + { + $langs->load("propal"); if ($object->statut < 2) { - if ($user->rights->agenda->myactions->create) print ''; - else print ''; + if ($user->rights->propal->creer) print ''; + else print ''; } } - } - // Proposal - if (! empty($conf->propal->enabled) && $object->statut > 0) - { - $langs->load("propal"); - if ($object->statut < 2) + // Invoicing + if (! empty($conf->facture->enabled) && $object->statut > 0) { - if ($user->rights->propal->creer) print ''; - else print ''; - } - } - - // Invoicing - if (! empty($conf->facture->enabled) && $object->statut > 0) - { - $langs->load("bills"); - if ($object->statut < 2) - { - if ($user->rights->facture->creer) print ''; - else print ''; - } - - if (! empty($conf->global->FICHINTER_CLASSIFY_BILLED)) - { - if ($object->statut != 2) + $langs->load("bills"); + if ($object->statut < 2) { - print ''; + if ($user->rights->facture->creer) print ''; + else print ''; } - else + + if (! empty($conf->global->FICHINTER_CLASSIFY_BILLED)) { - print ''; + if ($object->statut != 2) + { + print ''; + } + else + { + print ''; + } } } - } - // Delete - if (($object->statut == 0 && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) - { - print ''; - } + // Delete + if (($object->statut == 0 && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) + { + print ''; + } + } } } diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 6aaf29c7ac2..b7887c25278 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -37,6 +37,11 @@ class Fichinter extends CommonObject public $fk_element='fk_fichinter'; public $table_element_line='fichinterdet'; + /** + * {@inheritdoc} + */ + protected $table_ref_field = 'ref'; + var $id; var $socid; // Id client @@ -79,6 +84,9 @@ class Fichinter extends CommonObject $this->statuts_short[0]='Draft'; $this->statuts_short[1]='Validated'; $this->statuts_short[2]='StatusInterInvoiced'; + $this->statuts_logo[0]='statut0'; + $this->statuts_logo[1]='statut4'; + $this->statuts_logo[2]='statut6'; } @@ -240,6 +248,7 @@ class Fichinter extends CommonObject $sql.= ", fk_projet = ".$this->fk_project; $sql.= ", note_private = ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null"); $sql.= ", note_public = ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null"); + $sql.= ", fk_user_modif = ".$user->id; $sql.= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::update", LOG_DEBUG); @@ -373,9 +382,10 @@ class Fichinter extends CommonObject * Validate a intervention * * @param User $user User that validate - * @return int <0 if KO, >0 if OK + * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers + * @return int <0 if KO, >0 if OK */ - function setValid($user) + function setValid($user, $notrigger=0) { global $conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -397,6 +407,7 @@ class Fichinter extends CommonObject { $num = $this->ref; } + $this->newref = $num; $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter"; $sql.= " SET fk_statut = 1"; @@ -415,9 +426,17 @@ class Fichinter extends CommonObject $error++; } + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('FICHINTER_VALIDATE',$user); + if ($result < 0) { $error++; } + // End call triggers + } + if (! $error) { - $this->oldref = ''; + $this->oldref = $this->ref; // Rename directory if dir was a temporary ref if (preg_match('/^[\(]?PROV/i', $this->ref)) @@ -425,20 +444,26 @@ class Fichinter extends CommonObject // Rename of object directory ($this->ref = old ref, $num = new ref) // to not lose the linked files $oldref = dol_sanitizeFileName($this->ref); - $snum = dol_sanitizeFileName($num); + $newref = dol_sanitizeFileName($num); $dirsource = $conf->ficheinter->dir_output.'/'.$oldref; - $dirdest = $conf->ficheinter->dir_output.'/'.$snum; + $dirdest = $conf->ficheinter->dir_output.'/'.$newref; if (file_exists($dirsource)) { - dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest); + dol_syslog(get_class($this)."::setValid rename dir ".$dirsource." into ".$dirdest); if (@rename($dirsource, $dirdest)) { - $this->oldref = $oldref; - - dol_syslog("Rename ok"); - // Suppression ancien fichier PDF dans nouveau rep - dol_delete_file($conf->ficheinter->dir_output.'/'.$snum.'/'.$oldref.'*.*'); + dol_syslog("Rename ok"); + // Rename docs starting with $oldref with $newref + $listoffiles=dol_dir_list($conf->ficheinter->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/')); + foreach($listoffiles as $fileentry) + { + $dirsource=$fileentry['name']; + $dirdest=preg_replace('/^'.preg_quote($oldref,'/').'/',$newref, $dirsource); + $dirsource=$fileentry['path'].'/'.$dirsource; + $dirdest=$fileentry['path'].'/'.$dirdest; + @rename($dirsource, $dirdest); + } } } } @@ -453,14 +478,6 @@ class Fichinter extends CommonObject $this->date_validation=$now; } - if (! $error) - { - // Call trigger - $result=$this->call_trigger('FICHINTER_VALIDATE',$user); - if ($result < 0) { $error++; } - // End call triggers - } - if (! $error) { $this->db->commit(); @@ -499,37 +516,23 @@ class Fichinter extends CommonObject global $langs; if ($mode == 0) - { return $langs->trans($this->statuts[$statut]); - } + if ($mode == 1) - { return $langs->trans($this->statuts_short[$statut]); - } + if ($mode == 2) - { - if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]); - if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]); - if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]); - } + return img_picto($langs->trans($this->statuts_short[$statut]), $this->statuts_logo[$statut]).' '.$langs->trans($this->statuts_short[$statut]); + if ($mode == 3) - { - if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); - if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); - if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); - } + return img_picto($langs->trans($this->statuts_short[$statut]), $this->statuts_logo[$statut]); + if ($mode == 4) - { - if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); - if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); - if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); - } + return img_picto($langs->trans($this->statuts_short[$statut]),$this->statuts_logo[$statut]).' '.$langs->trans($this->statuts[$statut]); + if ($mode == 5) - { - if ($statut==0) return ''.$langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); - if ($statut==1) return ''.$langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); - if ($statut==2) return ''.$langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); - } + return ''.$langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),$this->statuts_logo[$statut]); + } /** @@ -545,14 +548,14 @@ class Fichinter extends CommonObject $result=''; - $lien = ''; + $lien = ''; $lienfin=''; $picto='intervention'; $label=$langs->trans("Show").': '.$this->ref; - if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); + if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; return $result; @@ -563,7 +566,7 @@ class Fichinter extends CommonObject * Returns the next non used reference of intervention * depending on the module numbering assets within FICHEINTER_ADDON * - * @param Societe $soc Object society + * @param Societe $soc Thirdparty object * @return string Free reference for intervention */ function getNextNumRef($soc) @@ -619,9 +622,11 @@ class Fichinter extends CommonObject global $conf; $sql = "SELECT f.rowid,"; - $sql.= " datec,"; + $sql.= " f.datec,"; + $sql.= " f.tms as date_modification,"; $sql.= " f.date_valid as datev,"; $sql.= " f.fk_user_author,"; + $sql.= " f.fk_user_modif as fk_user_modification,"; $sql.= " f.fk_user_valid"; $sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f"; $sql.= " WHERE f.rowid = ".$id; @@ -637,6 +642,7 @@ class Fichinter extends CommonObject $this->id = $obj->rowid; $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->date_modification); $this->date_validation = $this->db->jdate($obj->datev); $cuser = new User($this->db); @@ -649,6 +655,13 @@ class Fichinter extends CommonObject $vuser->fetch($obj->fk_user_valid); $this->user_validation = $vuser; } + if ($obj->fk_user_modification) + { + $muser = new User($this->db); + $muser->fetch($obj->fk_user_modification); + $this->user_modification = $muser; + } + } $this->db->free($resql); } @@ -805,7 +818,8 @@ class Fichinter extends CommonObject if ($user->rights->ficheinter->creer) { $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter "; - $sql.= " SET description = '".$this->db->escape($description)."'"; + $sql.= " SET description = '".$this->db->escape($description)."',"; + $sql.= " fk_user_modif = ".$user->id; $sql.= " WHERE rowid = ".$this->id; $sql.= " AND entity = ".$conf->entity; diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php index 8f540dd2ebd..b0f9ada3af7 100644 --- a/htdocs/fichinter/contact.php +++ b/htdocs/fichinter/contact.php @@ -144,6 +144,9 @@ if ($id > 0 || ! empty($ref)) print '
    '; + if (! empty($conf->global->FICHINTER_HIDE_ADD_CONTACT_USER)) $hideaddcontactforuser=1; + if (! empty($conf->global->FICHINTER_HIDE_ADD_CONTACT_THIPARTY)) $hideaddcontactforthirdparty=1; + // Contacts lines include DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php'; } diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index 1e90f2985c7..fd039efff24 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -131,6 +131,7 @@ else print $langs->trans("ErrorUnknown"); } + llxFooter(); $db->close(); diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 4dfb8489c9c..851077b510f 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -49,14 +49,26 @@ $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) $sortorder="DESC"; -if (! $sortfield) $sortfield="fd.date"; +if (! $sortfield) +{ + if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sortfield="fd.date"; + else $sortfield="f.ref"; +} $limit = $conf->liste_limit; -$search_ref=GETPOST('search_ref','alpha'); +$search_ref=GETPOST('search_ref')?GETPOST('search_ref','alpha'):GETPOST('search_inter','alpha'); $search_company=GETPOST('search_company','alpha'); $search_desc=GETPOST('search_desc','alpha'); $search_status=GETPOST('search_status'); +$sall=GETPOST('sall'); +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_ref=""; + $search_company=""; + $search_desc=""; + $search_status=""; +} /* * View @@ -70,13 +82,12 @@ llxHeader('', $langs->trans("Intervention")); $sql = "SELECT"; $sql.= " f.ref, f.rowid as fichid, f.fk_statut, f.description,"; -$sql.= " fd.description as descriptiondetail, fd.date as dp, fd.duree,"; -$sql.= " s.nom, s.rowid as socid, s.client"; +if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sql.= " fd.description as descriptiondetail, fd.date as dp, fd.duree,"; +$sql.= " s.nom as name, s.rowid as socid, s.client"; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s"; -if (! $user->rights->societe->client->voir && empty($socid)) - $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (! $user->rights->societe->client->voir && empty($socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."fichinter as f)"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid"; +if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid"; $sql.= " WHERE f.fk_soc = s.rowid "; $sql.= " AND f.entity = ".$conf->entity; if ($search_ref) { @@ -86,7 +97,8 @@ if ($search_company) { $sql .= natural_search('s.nom', $search_company); } if ($search_desc) { - $sql .= natural_search(array('f.description', 'fd.description'), $search_desc); + if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sql .= natural_search(array('f.description', 'fd.description'), $search_desc); + else $sql .= natural_search(array('f.description'), $search_desc); } if ($search_status != '' && $search_status >= 0) { $sql .= ' AND f.fk_statut = '.$search_status; @@ -95,15 +107,27 @@ if (! $user->rights->societe->client->voir && empty($socid)) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = " . $socid; +if ($sall) { + $arraytosearch=array('f.ref', 'f.description', 's.nom'); + if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $arraytosearch=array('f.ref', 'f.description', 's.nom', 'fd.description'); + $sql .= natural_search($arraytosearch, $sall); +} $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1, $offset); +//print $sql; $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); - $urlparam="&socid=$socid"; + $urlparam=''; + if ($socid) $urlparam.="&socid=".$socid; + if ($search_ref) $urlparam.="&search_ref=".urlencode($search_ref); + if ($search_company) $urlparam.="&search_company=".urlencode($search_company); + if ($search_desc) $urlparam.="&search_desc=".urlencode($search_desc); + if ($search_status != '' && $search_status > -1) $urlparam.="&search_status=".urlencode($search_status); + print_barre_liste($langs->trans("ListOfInterventions"), $page, $_SERVER['PHP_SELF'], $urlparam, $sortfield, $sortorder, '', $num); print ''."\n"; @@ -120,6 +144,7 @@ if ($result) print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],"fd.duree","",$urlparam,'align="right"',$sortfield,$sortorder); } print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.fk_statut","",$urlparam,'align="right"',$sortfield,$sortorder); + print_liste_field_titre('',$_SERVER["PHP_SELF"], ''); print "\n"; print ''; @@ -139,10 +164,11 @@ if ($result) } print ''; $liststatus=$interventionstatic->statuts_short; - print $form->selectarray('search_status', $liststatus, GETPOST('search_status'), 1, 0, 0, '', 1); - print ''; + print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1); print ''; - print "\n"; + print ''; + print ''; + print "\n"; $companystatic=new Societe($db); @@ -160,7 +186,7 @@ if ($result) print $interventionstatic->getNomUrl(1); print "\n"; print ''; - $companystatic->nom=$objp->nom; + $companystatic->name=$objp->name; $companystatic->id=$objp->socid; $companystatic->client=$objp->client; print $companystatic->getNomUrl(1,'',44); @@ -174,6 +200,7 @@ if ($result) } print ''.$interventionstatic->LibStatut($objp->fk_statut,5).''; + print ' '; print "\n"; $total += $objp->duree; @@ -183,7 +210,7 @@ if ($result) if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) { print ''.$langs->trans("Total").''; - print ''.convertSecondToTime($total).' '; + print ''.convertSecondToTime($total).'  '; print ''; } diff --git a/htdocs/fichinter/tpl/linkedobjectblock.tpl.php b/htdocs/fichinter/tpl/linkedobjectblock.tpl.php index e104bea2a7a..4e0d6b753e7 100644 --- a/htdocs/fichinter/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fichinter/tpl/linkedobjectblock.tpl.php @@ -42,7 +42,7 @@ foreach($linkedObjectBlock as $object) $var=!$var; ?> > - trans("ShowIntervention"),"intervention").' '.$object->ref; ?> + trans("ShowIntervention"),"intervention").' '.$object->ref; ?> datev,'day'); ?> getLibStatut(3); ?> diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 6f8a2bb9b2c..ee269646c84 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -29,7 +29,7 @@ * \brief File that include conf.php file and commons lib like functions.lib.php */ -if (! defined('DOL_VERSION')) define('DOL_VERSION','3.7.0-alpha'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','3.8.0-alpha'); if (! defined('EURO')) define('EURO',chr(128)); // Define syslog constants diff --git a/htdocs/fourn/ajax/getSupplierPrices.php b/htdocs/fourn/ajax/getSupplierPrices.php old mode 100644 new mode 100755 index fc891af53a3..e14e872a24f --- a/htdocs/fourn/ajax/getSupplierPrices.php +++ b/htdocs/fourn/ajax/getSupplierPrices.php @@ -13,12 +13,11 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * */ /** * \file /htdocs/fourn/ajax/getSupplierPrices.php - * \brief File to return Ajax response on get supplier prices + * \brief File to return an Ajax response to get a supplier prices */ if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal @@ -29,6 +28,7 @@ if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; $idprod=GETPOST('idprod','int'); @@ -44,12 +44,15 @@ top_httphead(); //print ''."\n"; -if (! empty($idprod)) +if ($idprod > 0) { + $producttmp=new ProductFournisseur($db); + $producttmp->fetch($idprod); + $sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration,"; $sql.= " pfp.ref_fourn,"; $sql.= " pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice, pfp.charges, pfp.unitcharges,"; - $sql.= " s.nom"; + $sql.= " pfp.fk_price_expression, pfp.tva_tx, s.nom as name"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = pfp.fk_product"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = pfp.fk_soc"; @@ -67,15 +70,28 @@ if (! empty($idprod)) if ($num) { + require_once DOL_DOCUMENT_ROOT.'/product/class/priceparser.class.php'; $i = 0; while ($i < $num) { $objp = $db->fetch_object($result); + if (!empty($objp->fk_price_expression)) { + $priceparser = new PriceParser($db); + $price_result = $priceparser->parseProductSupplier($idprod, $objp->fk_price_expression, $objp->quantity, $objp->tva_tx); + if ($price_result >= 0) { + $objp->fprice = $price_result; + if ($objp->quantity >= 1) + { + $objp->unitprice = $objp->fprice / $objp->quantity; + } + } + } + $price = $objp->fprice * (1 - $objp->remise_percent / 100); $unitprice = $objp->unitprice * (1 - $objp->remise_percent / 100); - $title = $objp->nom.' - '.$objp->ref_fourn.' - '; + $title = $objp->name.' - '.$objp->ref_fourn.' - '; if ($objp->quantity == 1) { @@ -99,6 +115,7 @@ if (! empty($idprod)) if ($objp->duration) $label .= " - ".$objp->duration; $label = price($price,0,$langs,0,0,-1,$conf->currency)."/".$langs->trans("Unit"); + if ($objp->ref_fourn) $label.=' ('.$objp->ref_fourn.')'; $prices[] = array("id" => $objp->idprodfournprice, "price" => price($price,0,'',0), "label" => $label, "title" => $title); $i++; @@ -107,6 +124,10 @@ if (! empty($idprod)) $db->free($result); } } + + // Add price for pmp + $price=$producttmp->pmp; + $prices[] = array("id" => 'pmpprice', "price" => $price, "label" => $langs->trans("PMPValueShort").': '.price($price,0,$langs,0,0,-1,$conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price,0,$langs,0,0,-1,$conf->currency)); } echo json_encode($prices); diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/card.php similarity index 75% rename from htdocs/fourn/fiche.php rename to htdocs/fourn/card.php index 11e505334cd..0447bd0a758 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/card.php @@ -1,9 +1,10 @@ * Copyright (C) 2003 Eric Seigne - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2014 Jean Heimburger * * 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 @@ -20,7 +21,7 @@ */ /** - * \file htdocs/fourn/fiche.php + * \file htdocs/fourn/card.php * \ingroup fournisseur, facture * \brief Page for supplier third party card (view, edit) */ @@ -48,22 +49,30 @@ $result = restrictedArea($user, 'societe&fournisseur', $id, '&societe'); $object = new Fournisseur($db); +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('suppliercard','globalcard')); + /* * Action */ $parameters=array('socid'=>$socid); -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($action == 'setsupplieraccountancycode') { - $result=$object->fetch($id); - $object->code_compta_fournisseur=$_POST["supplieraccountancycode"]; - $result=$object->update($object->id,$user,1,0,1); - if ($result < 0) - { - $mesg=join(',',$object->errors); - } + $cancelbutton = GETPOST('cancel'); + if (! $cancelbutton) + { + $result=$object->fetch($id); + $object->code_compta_fournisseur=$_POST["supplieraccountancycode"]; + $result=$object->update($object->id,$user,1,0,1); + if ($result < 0) + { + $mesg=join(',',$object->errors); + } + } $action=""; } // conditions de reglement @@ -89,12 +98,22 @@ if ($action == 'setmode' && $user->rights->societe->creer) $contactstatic = new Contact($db); $form = new Form($db); -if ($object->fetch($id)) +if ($id > 0 && empty($object->id)) { - llxHeader('',$langs->trans('SupplierCard')); + // Load data of third party + $res=$object->fetch($id); + if ($object->id <= 0) dol_print_error($db,$object->error); +} + +if ($object->id > 0) +{ + $title=$langs->trans("SupplierCard"); + if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name; + $help_url=''; + llxHeader('',$title, $help_url); /* - * Affichage onglets + * Show tabs */ $head = societe_prepare_head($object); @@ -169,24 +188,15 @@ if ($object->fetch($id)) print ''; // Local Taxes - if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") + if ($mysoc->useLocalTax(1)) { - print ''.$langs->trans('LocalTax1IsUsedES').''; - print yn($object->localtax1_assuj); - print ''; - print ''.$langs->trans('LocalTax2IsUsedES').''; - print yn($object->localtax2_assuj); - print ''; - } - elseif($mysoc->localtax1_assuj=="1") - { - print ''.$langs->trans("LocalTax1IsUsedES").''; + print ''.$langs->trans("LocalTax1IsUsed").''; print yn($object->localtax1_assuj); print ''; } - elseif($mysoc->localtax2_assuj=="1") + if ($mysoc->useLocalTax(2)) { - print ''.$langs->trans("LocalTax2IsUsedES").''; + print ''.$langs->trans("LocalTax2IsUsed").''; print yn($object->localtax2_assuj); print ''; } @@ -285,7 +295,7 @@ if ($object->fetch($id)) print ''; print ''; print '
    '.$langs->trans("ProductsAndServices").''; - print ''.$langs->trans("All").' ('.$object->nbOfProductRefs().')'; + print ''.$langs->trans("All").' ('.$object->nbOfProductRefs().')'; print '
    '; } @@ -299,6 +309,28 @@ if ($object->fetch($id)) if ($user->rights->fournisseur->commande->lire) { + + + // TODO move to DAO class + // Check if there are supplier orders billable + $sql2 = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_supplier,'; + $sql2.= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut'; + $sql2.= ' FROM '.MAIN_DB_PREFIX.'societe as s'; + $sql2.= ', '.MAIN_DB_PREFIX.'commande_fournisseur as c'; + $sql2.= ' WHERE c.fk_soc = s.rowid'; + $sql2.= ' AND s.rowid = '.$object->id; + // Show orders with status validated, shipping started and delivered (well any order we can bill) + $sql2.= " AND c.fk_statut IN (5)"; + // Find order that are not already invoiced + $sql2 .= " AND c.rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='invoice_supplier')"; + $resql2=$db->query($sql2); + if ($resql2) { + $orders2invoice = $db->num_rows($resql2); + $db->free($resql2); + } else { + setEventMessage($db->lasterror(),'errors'); + } + // TODO move to DAO class $sql = "SELECT p.rowid,p.ref, p.date_commande as dc, p.fk_statut"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p "; @@ -319,7 +351,7 @@ if ($object->fetch($id)) print ''; print ''; print ''; - print ''; + print ''; print ''; print '
    '.$langs->trans("LastOrders",($num<$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' ('.$num.')'.$langs->trans("AllOrders").' ('.$num.')'.img_picto($langs->trans("Statistics"),'stats').'
    '; print ''; @@ -331,7 +363,7 @@ if ($object->fetch($id)) $var=!$var; print ""; - print ''.img_object($langs->trans("ShowOrder"),"order")." ".$obj->ref.''; + print ''.img_object($langs->trans("ShowOrder"),"order")." ".$obj->ref.''; print ''; if ($obj->dc) { @@ -367,13 +399,13 @@ if ($object->fetch($id)) if ($user->rights->fournisseur->facture->lire) { // TODO move to DAO class - $sql = 'SELECT f.rowid,f.libelle,f.ref_supplier,f.fk_statut,f.datef as df,f.total_ttc as amount,f.paye,'; + $sql = 'SELECT f.rowid,f.libelle,f.ref,f.ref_supplier,f.fk_statut,f.datef as df,f.total_ttc as amount,f.paye,'; $sql.= ' SUM(pf.amount) as am'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON f.rowid=pf.fk_facturefourn'; $sql.= ' WHERE f.fk_soc = '.$object->id; $sql.= " AND f.entity =".$conf->entity; - $sql.= ' GROUP BY f.rowid,f.libelle,f.ref_supplier,f.fk_statut,f.datef,f.total_ttc,f.paye'; + $sql.= ' GROUP BY f.rowid,f.libelle,f.ref,f.ref_supplier,f.fk_statut,f.datef,f.total_ttc,f.paye'; $sql.= ' ORDER BY f.datef DESC'; $resql=$db->query($sql); if ($resql) @@ -397,8 +429,14 @@ if ($object->fetch($id)) $var=!$var; print ''; print ''; - print ''; - print img_object($langs->trans('ShowBill'),'bill').' '.$obj->ref_supplier.' '.dol_trunc($obj->libelle,14).''; + print ''; + $facturestatic->id=$obj->rowid; + $facturestatic->ref=($obj->ref?$obj->ref:$obj->rowid).($obj->ref_supplier?' - '.$obj->ref_supplier:''); + //$facturestatic->ref_supplier=$obj->ref_supplier; + print $facturestatic->getNomUrl(1); + //print img_object($langs->trans('ShowBill'),'bill').' '.($obj->ref?$obj->ref:$obj->rowid).' - '.$obj->ref_supplier.''; + print ' '.dol_trunc($obj->libelle,14); + print ''; print ''.dol_print_date($db->jdate($obj->df),'day').''; print ''.price($obj->amount).''; print ''; @@ -425,19 +463,30 @@ if ($object->fetch($id)) /* * Barre d'actions */ + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been + // modified by hook + if (empty($reshook)) + { print '
    '; if ($user->rights->fournisseur->commande->creer) { $langs->load("orders"); - print ''.$langs->trans("AddOrder").''; + print ''.$langs->trans("AddOrder").''; } if ($user->rights->fournisseur->facture->creer) { $langs->load("bills"); - print ''.$langs->trans("AddBill").''; + print ''.$langs->trans("AddBill").''; + } + + if ($user->rights->fournisseur->facture->creer) + { + if (! empty($orders2invoice) && $orders2invoice > 0) print ''; + else print ''; } // Add action @@ -445,7 +494,7 @@ if ($object->fetch($id)) { if ($user->rights->agenda->myactions->create) { - print ''.$langs->trans("AddAction").''; + print ''.$langs->trans("AddAction").''; } else { @@ -480,6 +529,7 @@ if ($object->fetch($id)) show_actions_done($conf,$langs,$db,$object); } } +} else { dol_print_error($db); diff --git a/htdocs/fourn/class/fournisseur.class.php b/htdocs/fourn/class/fournisseur.class.php index 71942a27f97..35620bf91fb 100644 --- a/htdocs/fourn/class/fournisseur.class.php +++ b/htdocs/fourn/class/fournisseur.class.php @@ -184,7 +184,7 @@ class Fournisseur extends Societe $arr = array(); - $sql = "SELECT s.rowid, s.nom"; + $sql = "SELECT s.rowid, s.nom as name"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.fournisseur = 1"; @@ -196,16 +196,14 @@ class Fournisseur extends Societe if ($resql) { while ($obj=$this->db->fetch_object($resql)) - { - $arr[$obj->rowid] = stripslashes($obj->nom); - } - + { + $arr[$obj->rowid] = $obj->name; + } } else { dol_print_error($this->db); - $this->error=$this->db->error(); - + $this->error=$this->db->lasterror(); } return $arr; } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 07964e69d58..b8c14f2879e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2010-2014 Philippe Grand - * Copyright (C) 2012 Marcos García + * Copyright (C) 2012-2014 Marcos García * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador * @@ -45,6 +45,11 @@ class CommandeFournisseur extends CommonOrder public $fk_element = 'fk_commande'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + /** + * {@inheritdoc} + */ + protected $table_ref_field = 'ref'; + var $id; var $ref; // TODO deprecated @@ -317,9 +322,10 @@ class CommandeFournisseur extends CommonOrder * * @param User $user Validator User * @param int $idwarehouse Id of warehouse to use for stock decrease + * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers * @return int <0 if KO, >0 if OK */ - function valid($user,$idwarehouse=0) + function valid($user,$idwarehouse=0,$notrigger=0) { global $langs,$conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -342,12 +348,13 @@ class CommandeFournisseur extends CommonOrder $num = $this->getNextNumRef($soc); } else - { + { $num = $this->ref; } + $this->newref = $num; $sql = 'UPDATE '.MAIN_DB_PREFIX."commande_fournisseur"; - $sql.= " SET ref='".$num."',"; + $sql.= " SET ref='".$this->db->escape($num)."',"; $sql.= " fk_statut = 1,"; $sql.= " date_valid='".$this->db->idate(dol_now())."',"; $sql.= " fk_user_valid = ".$user->id; @@ -361,9 +368,17 @@ class CommandeFournisseur extends CommonOrder $error++; } + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('ORDER_SUPPLIER_VALIDATE',$user); + if ($result < 0) $error++; + // End call triggers + } + if (! $error) { - $this->oldref=''; + $this->oldref = $this->ref; // Rename directory if dir was a temporary ref if (preg_match('/^[\(]?PROV/i', $this->ref)) @@ -380,11 +395,17 @@ class CommandeFournisseur extends CommonOrder if (@rename($dirsource, $dirdest)) { - $this->oldref = $oldref; - dol_syslog("Rename ok"); - // Suppression ancien fichier PDF dans nouveau rep - dol_delete_file($dirdest.'/'.$oldref.'*.*'); + // Rename docs starting with $oldref with $newref + $listoffiles=dol_dir_list($conf->fournisseur->dir_output.'/commande/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/')); + foreach($listoffiles as $fileentry) + { + $dirsource=$fileentry['name']; + $dirdest=preg_replace('/^'.preg_quote($oldref,'/').'/',$newref, $dirsource); + $dirsource=$fileentry['path'].'/'.$dirsource; + $dirdest=$fileentry['path'].'/'.$dirdest; + @rename($dirsource, $dirdest); + } } } } @@ -397,18 +418,6 @@ class CommandeFournisseur extends CommonOrder $this->ref = $num; } - if (! $error) - { - // Call trigger - $result=$this->call_trigger('ORDER_SUPPLIER_VALIDATE',$user); - if ($result < 0) - { - $this->db->rollback(); - return -1; - } - // End call triggers - } - if (! $error) { $this->db->commit(); @@ -523,13 +532,13 @@ class CommandeFournisseur extends CommonOrder $result=''; - $lien = ''; + $lien = ''; $lienfin=''; $picto='order'; $label=$langs->trans("ShowOrder").': '.$this->ref; - if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); + if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; $result.=$lien.$this->ref.$lienfin; return $result; @@ -619,9 +628,10 @@ class CommandeFournisseur extends CommonOrder $num = $this->getNextNumRef($soc); } else - { + { $num = $this->ref; } + $this->newref = $num; $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur"; $sql.= " SET ref='".$this->db->escape($num)."',"; @@ -823,7 +833,7 @@ class CommandeFournisseur extends CommonOrder $result = 0; if ($user->rights->fournisseur->commande->commander) { - $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = 3, fk_input_method=".$methode.",date_commande=".$this->db->idate("$date"); + $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = 3, fk_input_method=".$methode.", date_commande='".$this->db->idate($date)."'"; $sql .= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::commande", LOG_DEBUG); @@ -948,6 +958,8 @@ class CommandeFournisseur extends CommonOrder if (! $error) { + $action='create'; + // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('supplierorderdao')); @@ -1923,6 +1935,47 @@ class CommandeFournisseur extends CommonOrder } } + /** + * Charge indicateurs this->nb de tableau de bord + * + * @return int <0 si ko, >0 si ok + */ + function load_state_board() + { + global $conf, $user; + + $this->nb=array(); + $clause = "WHERE"; + + $sql = "SELECT count(co.rowid) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as co"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON co.fk_soc = s.rowid"; + if (!$user->rights->societe->client->voir && !$user->societe_id) + { + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; + $sql.= " WHERE sc.fk_user = " .$user->id; + $clause = "AND"; + } + $sql.= " ".$clause." co.entity = ".$conf->entity; + + $resql=$this->db->query($sql); + if ($resql) + { + while ($obj=$this->db->fetch_object($resql)) + { + $this->nb["supplier_orders"]=$obj->nb; + } + $this->db->free($resql); + return 1; + } + else + { + dol_print_error($this->db); + $this->error=$this->db->error(); + return -1; + } + } + /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -1970,7 +2023,8 @@ class CommandeFournisseur extends CommonOrder } /** - * Returns the translated input method + * Returns the translated input method of object (defined if $this->methode_commande_id > 0). + * This function make a sql request to get translation. No cache yet, try to not use it inside a loop. * * @return string */ @@ -1980,21 +2034,19 @@ class CommandeFournisseur extends CommonOrder if ($this->methode_commande_id > 0) { - $sql = "SELECT rowid, code, libelle"; + $sql = "SELECT rowid, code, libelle as label"; $sql.= " FROM ".MAIN_DB_PREFIX.'c_input_method'; $sql.= " WHERE active=1 AND rowid = ".$db->escape($this->methode_commande_id); $query = $db->query($sql); - if ($query && $db->num_rows($query)) { - $result = $db->fetch_object($query); + $obj = $db->fetch_object($query); - $string = $langs->trans($result->code); - - if ($string == $result->code) + $string = $langs->trans($obj->code); + if ($string == $obj->code) { - $string = $obj->libelle != '-' ? $obj->libelle : ''; + $string = $obj->label != '-' ? $obj->label : ''; } return $string; @@ -2005,6 +2057,42 @@ class CommandeFournisseur extends CommonOrder return ''; } + + /** + * Create a document onto disk according to template model. + * + * @param string $modele Force template to use ('' to not force) + * @param Translate $outputlangs Object lang to use for traduction + * @param int $hidedetails Hide details of lines + * @param int $hidedesc Hide description + * @param int $hideref Hide ref + * @return int 0 if KO, 1 if OK + */ + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + { + global $conf, $user, $langs; + + $langs->load("suppliers"); + + // Sets the model on the model name to use + if (! dol_strlen($modele)) + { + if (! empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF)) + { + $modele = $conf->global->COMMANDE_SUPPLIER_ADDON_PDF; + } + else + { + $modele = 'muscadet'; + } + } + + $modelpath = "core/modules/supplier_order/pdf/"; + + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + + } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 4ceea058b4f..b931b566a61 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Philippe Grand * Copyright (C) 2013 Florian Henry + * Copyright (C) 2014 Marcos García * * 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 @@ -42,6 +43,11 @@ class FactureFournisseur extends CommonInvoice public $fk_element='fk_facture_fourn'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + /** + * {@inheritdoc} + */ + protected $table_ref_field = 'ref'; + var $rowid; var $ref; var $product_ref; @@ -145,7 +151,7 @@ class FactureFournisseur extends CommonInvoice */ function create($user) { - global $langs,$conf; + global $langs,$conf,$hookmanager; $error=0; $now=dol_now(); @@ -254,9 +260,28 @@ class FactureFournisseur extends CommonInvoice $result=$this->update_price(); if ($result > 0) { + $action='create'; + + // Actions on extra fields (by external module or standard code) + // FIXME le hook fait double emploi avec le trigger !! + $hookmanager->initHooks(array('supplierinvoicedao')); + $parameters=array('socid'=>$this->id); + $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) + { + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + } + else if ($reshook < 0) $error++; // Call trigger $result=$this->call_trigger('BILL_SUPPLIER_CREATE',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers if (! $error) @@ -413,6 +438,15 @@ class FactureFournisseur extends CommonInvoice $this->socid = $obj->socid; $this->socnom = $obj->socnom; + // Retreive all extrafield + // fetch optionals attributes and labels + require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); + $extrafields=new ExtraFields($this->db); + $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); + $this->fetch_optionals($this->id,$extralabels); + + if ($this->statut == 0) $this->brouillon = 1; + $result=$this->fetch_lines(); if ($result < 0) { @@ -512,7 +546,7 @@ class FactureFournisseur extends CommonInvoice * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; $error=0; @@ -601,7 +635,7 @@ class FactureFournisseur extends CommonInvoice { // Call trigger $result=$this->call_trigger('BILL_SUPPLIER_UPDATE',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers } } @@ -672,9 +706,9 @@ class FactureFournisseur extends CommonInvoice // Call trigger $result=$this->call_trigger('BILL_SUPPLIER_DELETE',$user); if ($result < 0) - { + { $this->db->rollback(); - return -1; + return -1; } // Fin appel triggers } @@ -766,7 +800,7 @@ class FactureFournisseur extends CommonInvoice { // Call trigger $result=$this->call_trigger('BILL_SUPPLIER_PAYED',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers } else @@ -814,7 +848,7 @@ class FactureFournisseur extends CommonInvoice { // Call trigger $result=$this->call_trigger('BILL_SUPPLIER_UNPAYED',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers } else @@ -842,9 +876,10 @@ class FactureFournisseur extends CommonInvoice * @param User $user Object user that validate * @param string $force_number Reference to force on invoice * @param int $idwarehouse Id of warehouse for stock change + * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers * @return int <0 if KO, =0 if nothing to do, >0 if OK */ - function validate($user, $force_number='', $idwarehouse=0) + function validate($user, $force_number='', $idwarehouse=0, $notrigger=0) { global $conf,$langs; @@ -876,9 +911,10 @@ class FactureFournisseur extends CommonInvoice $num = $this->getNextNumRef($this->client); } else - { + { $num = $this->ref; } + $this->newref = $num; $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn"; $sql.= " SET ref='".$num."', fk_statut = 1, fk_user_valid = ".$user->id; @@ -910,31 +946,46 @@ class FactureFournisseur extends CommonInvoice } } + // Triggers call + if (! $error && $notrigger) + { + // Call trigger + $result=$this->call_trigger('BILL_SUPPLIER_VALIDATE',$user); + if ($result < 0) $error++; + // End call triggers + } + if (! $error) { - $this->oldref = ''; + $this->oldref = $this->ref; // Rename directory if dir was a temporary ref if (preg_match('/^[\(]?PROV/i', $this->ref)) { // On renomme repertoire facture ($this->ref = ancienne ref, $num = nouvelle ref) // in order not to lose the attached files - $facref = dol_sanitizeFileName($this->ref); - $snumfa = dol_sanitizeFileName($num); + $oldref = dol_sanitizeFileName($this->ref); + $newref = dol_sanitizeFileName($num); - $dirsource = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2).$facref; - $dirdest = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2).$snumfa; + $dirsource = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2).$oldref; + $dirdest = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2).$newref; if (file_exists($dirsource)) { dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest); if (@rename($dirsource, $dirdest)) { - $this->oldref = $facref; - dol_syslog("Rename ok"); - // Suppression ancien fichier PDF dans nouveau rep - dol_delete_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2).$snumfa.'/'.$facref.'*.*'); + // Rename docs starting with $oldref with $newref + $listoffiles=dol_dir_list($conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2).$newref, 'files', 1, '^'.preg_quote($oldref,'/')); + foreach($listoffiles as $fileentry) + { + $dirsource=$fileentry['name']; + $dirdest=preg_replace('/^'.preg_quote($oldref,'/').'/',$newref, $dirsource); + $dirsource=$fileentry['path'].'/'.$dirsource; + $dirdest=$fileentry['path'].'/'.$dirdest; + @rename($dirsource, $dirdest); + } } } } @@ -948,15 +999,6 @@ class FactureFournisseur extends CommonInvoice //$this->date_validation=$now; this is stored into log table } - // Triggers call - if (! $error) - { - // Call trigger - $result=$this->call_trigger('BILL_SUPPLIER_VALIDATE',$user); - if ($result < 0) $error++; - // End call triggers - } - if (! $error) { $this->db->commit(); @@ -1118,8 +1160,8 @@ class FactureFournisseur extends CommonInvoice global $conf, $langs, $user; // Call trigger $result=$this->call_trigger('LINEBILL_SUPPLIER_CREATE',$user); - if ($result < 0) - { + if ($result < 0) + { $this->db->rollback(); return -1; } @@ -1214,7 +1256,7 @@ class FactureFournisseur extends CommonInvoice } $this->db->begin(); - + $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET"; $sql.= " description ='".$this->db->escape($desc)."'"; $sql.= ", pu_ht = ".price2num($pu_ht); @@ -1248,8 +1290,8 @@ class FactureFournisseur extends CommonInvoice global $conf, $langs, $user; // Call trigger $result=$this->call_trigger('LINEBILL_SUPPLIER_UPDATE',$user); - if ($result < 0) - { + if ($result < 0) + { $this->db->rollback(); return -1; } @@ -1260,7 +1302,7 @@ class FactureFournisseur extends CommonInvoice $result=$this->update_price('','auto'); $this->db->commit(); - + return $result; } else @@ -1293,7 +1335,7 @@ class FactureFournisseur extends CommonInvoice { // Call trigger $result=$this->call_trigger('LINEBILL_SUPPLIER_DELETE',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers } @@ -1438,7 +1480,7 @@ class FactureFournisseur extends CommonInvoice } else { - $lien = ''; + $lien = ''; $lienfin=''; } $label=$langs->trans("ShowInvoice").': '.$this->ref; @@ -1447,7 +1489,7 @@ class FactureFournisseur extends CommonInvoice $ref=$this->ref; if (empty($ref)) $ref=$this->id; - if ($withpicto) $result.=($lien.img_object($label,'bill').$lienfin.' '); + if ($withpicto) $result.=($lien.img_object($label, 'bill', 'class="classfortooltip"').$lienfin.' '); $result.=$lien.($max?dol_trunc($ref,$max):$ref).$lienfin; return $result; } @@ -1456,7 +1498,7 @@ class FactureFournisseur extends CommonInvoice * Return next reference of supplier invoice not already used (or last reference) * according to numbering module defined into constant INVOICE_SUPPLIER_ADDON_NUMBER * - * @param Society $soc object company + * @param Societe $soc Thirdparty object * @param string $mode 'next' for next value or 'last' for last value * @return string free ref or last ref */ @@ -1596,6 +1638,48 @@ class FactureFournisseur extends CommonInvoice $this->total_ttc = $xnbp*119.6; } + /** + * Load indicators for dashboard (this->nbtodo and this->nbtodolate) + * + * @return int <0 if KO, >0 if OK + */ + function load_state_board() + { + global $conf, $user; + + $this->nb=array(); + + $clause = "WHERE"; + + $sql = "SELECT count(f.rowid) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid"; + if (!$user->rights->societe->client->voir && !$user->societe_id) + { + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; + $sql.= " WHERE sc.fk_user = " .$user->id; + $clause = "AND"; + } + $sql.= " ".$clause." f.entity = ".$conf->entity; + + $resql=$this->db->query($sql); + if ($resql) + { + while ($obj=$this->db->fetch_object($resql)) + { + $this->nb["supplier_invoices"]=$obj->nb; + } + $this->db->free($resql); + return 1; + } + else + { + dol_print_error($this->db); + $this->error=$this->db->error(); + return -1; + } + } + /** * Load an object from its id and create a new one in database * @@ -1670,4 +1754,38 @@ class FactureFournisseur extends CommonInvoice } } + /** + * Create a document onto disk according to template model. + * + * @param string $modele Force template to use ('' to not force) + * @param Translate $outputlangs Object lang a utiliser pour traduction + * @param int $hidedetails Hide details of lines + * @param int $hidedesc Hide description + * @param int $hideref Hide ref + * @return int 0 if KO, 1 if OK + */ + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + { + global $conf, $user, $langs; + + $langs->load("suppliers"); + + // Set the model on the model name to use + if (! dol_strlen($modele)) + { + if (! empty($conf->global->INVOICE_SUPPLIER_ADDON_PDF)) + { + $modele = $conf->global->INVOICE_SUPPLIER_ADDON_PDF; + } + else + { + $modele = 'canelle'; + } + } + + $modelpath = "core/modules/supplier_invoice/pdf/"; + + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php old mode 100644 new mode 100755 index bbb6dbdb33a..52b9fc80c21 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -1,9 +1,9 @@ * Copyright (C) 2006-2011 Laurent Destailleur - * Copyright (C) 2009-2012 Regis Houssin + * Copyright (C) 2009-2014 Regis Houssin * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2012 Christophe Battarel * * 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 @@ -27,6 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/priceparser.class.php'; /** @@ -55,6 +56,8 @@ class ProductFournisseur extends Product var $fourn_unitprice; var $fourn_tva_npr; + var $fk_price_expression; + /** * Constructor @@ -205,7 +208,7 @@ class ProductFournisseur extends Product { // Call trigger $result=$this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_UPDATE',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers if (empty($error)) @@ -281,13 +284,13 @@ class ProductFournisseur extends Product $error++; } } - + if (! $error) { // Call trigger $result=$this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_CREATE',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers if (empty($error)) @@ -320,13 +323,14 @@ class ProductFournisseur extends Product /** * Loads the price information of a provider * - * @param int $rowid Line id - * @return int < 0 if KO, 0 if OK but not found, > 0 if OK + * @param int $rowid Line id + * @param int $ignore_expression Ignores the math expression for calculating price and uses the db value instead + * @return int < 0 if KO, 0 if OK but not found, > 0 if OK */ - function fetch_product_fournisseur_price($rowid) + function fetch_product_fournisseur_price($rowid, $ignore_expression = 0) { $sql = "SELECT pfp.rowid, pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability,"; - $sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.fk_product, pfp.charges, pfp.unitcharges"; // , pfp.recuperableonly as fourn_tva_npr"; FIXME this field not exist in llx_product_fournisseur_price + $sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.fk_product, pfp.charges, pfp.unitcharges, pfp.fk_price_expression"; // , pfp.recuperableonly as fourn_tva_npr"; FIXME this field not exist in llx_product_fournisseur_price $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= " WHERE pfp.rowid = ".$rowid; @@ -351,6 +355,25 @@ class ProductFournisseur extends Product $this->fk_product = $obj->fk_product; $this->fk_availability = $obj->fk_availability; //$this->fourn_tva_npr = $obj->fourn_tva_npr; // FIXME this field not exist in llx_product_fournisseur_price + $this->fk_price_expression = $obj->fk_price_expression; + + if (empty($ignore_expression) && !empty($this->fk_price_expression)) { + $priceparser = new PriceParser($this->db); + $price_result = $priceparser->parseProductSupplier($this->fk_product, $this->fk_price_expression, $this->fourn_qty, $this->fourn_tva_tx); + if ($price_result >= 0) { + $this->fourn_price = $price_result; + //recalculation of unitprice, as probably the price changed... + if ($this->fourn_qty!=0) + { + $this->fourn_unitprice = price2num($this->fourn_price/$this->fourn_qty,'MU'); + } + else + { + $this->fourn_unitprice=""; + } + } + } + return 1; } else @@ -379,7 +402,7 @@ class ProductFournisseur extends Product global $conf; $sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,"; - $sql.= " pfp.rowid as product_fourn_pri_id, pfp.ref_fourn, pfp.fk_product as product_fourn_id,"; + $sql.= " pfp.rowid as product_fourn_pri_id, pfp.ref_fourn, pfp.fk_product as product_fourn_id, pfp.fk_price_expression,"; $sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.unitcharges, pfp.info_bits"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; @@ -416,6 +439,16 @@ class ProductFournisseur extends Product $prodfourn->fk_availability = $record["fk_availability"]; $prodfourn->id = $prodid; $prodfourn->fourn_tva_npr = $record["info_bits"]; + $prodfourn->fk_price_expression = $record["fk_price_expression"]; + + if (!empty($prodfourn->fk_price_expression)) { + $priceparser = new PriceParser($this->db); + $price_result = $priceparser->parseProductSupplier($prodid, $prodfourn->fk_price_expression, $prodfourn->fourn_qty, $prodfourn->fourn_tva_tx); + if ($price_result >= 0) { + $prodfourn->fourn_price = $price_result; + $prodfourn->fourn_unitprice = null; //force recalculation of unitprice, as probably the price changed... + } + } if (!isset($prodfourn->fourn_unitprice)) { @@ -467,7 +500,8 @@ class ProductFournisseur extends Product $sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,"; $sql.= " pfp.rowid as product_fourn_price_id, pfp.ref_fourn,"; - $sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.tva_tx, pfp.charges, pfp.unitcharges"; + $sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.tva_tx, pfp.charges, pfp.unitcharges, "; + $sql.= " pfp.remise, pfp.remise_percent, pfp.fk_price_expression"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= " WHERE s.entity IN (".getEntity('societe', 1).")"; $sql.= " AND pfp.fk_product = ".$prodid; @@ -494,6 +528,7 @@ class ProductFournisseur extends Product $this->fourn_tva_tx = $record["tva_tx"]; $this->fourn_id = $record["fourn_id"]; $this->fourn_name = $record["supplier_name"]; + $this->fk_price_expression = $record["fk_price_expression"]; $this->id = $prodid; $this->db->free($resql); return 1; @@ -505,6 +540,39 @@ class ProductFournisseur extends Product } } + /** + * Sets the price expression + * + * @param string $expression_id Expression + * @return int <0 if KO, >0 if OK + */ + function setPriceExpression($expression_id) + { + global $conf; + + // Clean parameters + $this->db->begin(); + + $sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price"; + $sql.= " SET fk_price_expression = ".$expression_id; + $sql.= " WHERE rowid = ".$this->product_fourn_price_id; + + dol_syslog(get_class($this)."::setPriceExpression", LOG_DEBUG); + + $resql = $this->db->query($sql); + if ($resql) + { + $this->db->commit(); + return 1; + } + else + { + $this->error=$this->db->error()." sql=".$sql; + $this->db->rollback(); + return -1; + } + } + /** * Display supplier of product * diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index f41cee3c2b7..443216d899d 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -29,8 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; /** - * \class PaiementFourn - * \brief Classe permettant la gestion des paiements des factures fournisseurs + * Class to manage payments for supplier invoices */ class PaiementFourn extends Paiement { @@ -345,7 +344,7 @@ class PaiementFourn extends Paiement */ function info($id) { - $sql = 'SELECT c.rowid, datec, fk_user_author, tms'; + $sql = 'SELECT c.rowid, datec, fk_user_author as fk_user_creat, tms'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as c'; $sql.= ' WHERE c.rowid = '.$id; @@ -357,6 +356,7 @@ class PaiementFourn extends Paiement { $obj = $this->db->fetch_object($resql); $this->id = $obj->rowid; + if ($obj->fk_user_creat) { $cuser = new User($this->db); @@ -381,10 +381,10 @@ class PaiementFourn extends Paiement } /** - * Retourne la liste des factures sur lesquels porte le paiement + * Return list of supplier invoices the payment point to * - * @param string $filter Critere de filtre - * @return array Tableau des id de factures + * @param string $filter SQL filter + * @return array Array of supplier invoice id */ function getBillsArray($filter='') { @@ -488,7 +488,7 @@ class PaiementFourn extends Paiement $result=''; - $lien = ''; + $lien = ''; $lienfin=''; $text=$this->ref; // Sometimes ref contains label @@ -499,7 +499,7 @@ class PaiementFourn extends Paiement $text=$langs->trans($reg[1]); } - if ($withpicto) $result.=($lien.img_object($langs->trans("ShowPayment"),'payment').$lienfin); + if ($withpicto) $result.=($lien.img_object($langs->trans("ShowPayment"), 'payment', 'class="classfortooltip"').$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$lien.$text.$lienfin; return $result; diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/card.php similarity index 72% rename from htdocs/fourn/commande/fiche.php rename to htdocs/fourn/commande/card.php index f4f69fbd269..b90bd275e4c 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/card.php @@ -7,6 +7,7 @@ * Copyright (C) 2011 Philippe Grand * Copyright (C) 2012 Marcos García * Copyright (C) 2013 Florian Henry + * Copyright (C) 2014 Ion Agorria * * 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 @@ -24,7 +25,7 @@ */ /** - * \file htdocs/fourn/commande/fiche.php + * \file htdocs/fourn/commande/card.php * \ingroup supplier, order * \brief Card supplier order */ @@ -43,7 +44,9 @@ if (!empty($conf->produit->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; if (!empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP +$langs->load('admin'); $langs->load('orders'); $langs->load('sendings'); $langs->load('companies'); @@ -72,7 +75,7 @@ if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'fournisseur', $id, '', 'commande'); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('ordersuppliercard')); +$hookmanager->initHooks(array('ordersuppliercard','globalcard')); $object = new CommandeFournisseur($db); $extrafields = new ExtraFields($db); @@ -110,6 +113,7 @@ $permissionnote=$user->rights->fournisseur->commande->creer; // Used by the incl $parameters=array('socid'=>$socid); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once @@ -132,9 +136,10 @@ else if ($action == 'setmode' && $user->rights->fournisseur->commande->creer) } // bank account -else if ($action == 'setbankaccount' && $user->rights->fournisseur->commande->creer) { +else if ($action == 'setbankaccount' && $user->rights->fournisseur->commande->creer) +{ $result=$object->setBankAccount(GETPOST('fk_account', 'int')); - } +} // date de livraison if ($action == 'setdate_livraison' && $user->rights->fournisseur->commande->creer) @@ -340,19 +345,22 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer) { $ret=$object->fetch($object->id); // Reload to get new records + // Define output language if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { - // Define output language $outputlangs = $langs; - $newlang=GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records - supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result < 0) dol_print_error($db,$result); } unset($_POST ['prod_entry_mode']); @@ -437,19 +445,26 @@ else if ($action == 'update_line' && $user->rights->fournisseur->commande->creer unset($_POST['date_end']); unset($localtax1_tx); unset($localtax2_tx); + if ($result >= 0) { - $outputlangs = $langs; - if (GETPOST('lang_id')) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang(GETPOST('lang_id')); - } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - $ret=$object->fetch($object->id); // Reload to get new records - supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - } + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result < 0) dol_print_error($db,$result); + } } else { @@ -473,7 +488,7 @@ else if ($action == 'confirm_deleteproductline' && $confirm == 'yes' && $user->r if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $ret=$object->fetch($object->id); // Reload to get new records - supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } } else @@ -495,17 +510,23 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fourn $result = $object->valid($user); if ($result >= 0) { - $outputlangs = $langs; - if (GETPOST('lang_id')) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang(GETPOST('lang_id')); - } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - $ret=$object->fetch($object->id); // Reload to get new records - supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - } + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result < 0) dol_print_error($db,$result); + } } else { @@ -550,7 +571,7 @@ else if ($action == 'confirm_approve' && $confirm == 'yes' && $user->rights->fou if ($result > 0) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { - supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); exit; @@ -582,7 +603,7 @@ else if ($action == 'confirm_commande' && $confirm == 'yes' && $user->rights->fo if ($result > 0) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { - supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); exit; @@ -599,7 +620,7 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->four $result=$object->delete($user); if ($result > 0) { - header("Location: ".DOL_URL_ROOT.'/fourn/commande/liste.php'); + header("Location: ".DOL_URL_ROOT.'/fourn/commande/list.php'); exit; } else @@ -689,7 +710,9 @@ else if ($action == 'up' && $user->rights->fournisseur->commande->creer) $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + } header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#'.$_GET['rowid'])); exit; } @@ -703,7 +726,9 @@ else if ($action == 'down' && $user->rights->fournisseur->commande->creer) $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + } header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#'.$_GET['rowid'])); exit; } @@ -721,7 +746,7 @@ else if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) / $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang(GETPOST('lang_id')); } - $result=supplier_order_pdf_create($db, $object,$object->modelpdf,$outputlangs, $hidedetails, $hidedesc, $hideref); + $result= $object->generateDocument($object->modelpdf,$outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db,$result); @@ -914,12 +939,13 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G if (dol_strlen(GETPOST('subject'))) $subject=GETPOST('subject'); else $subject = $langs->transnoentities('CustomerOrder').' '.$object->ref; $actiontypecode='AC_SUP_ORD'; - $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; + $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; if ($message) { - $actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n"; - $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; - $actionmsg.=$message; + if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); + $actionmsg = dol_concatdesc($actionmsg, $message); } $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); } @@ -1017,6 +1043,99 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G } } +if ($action == 'webservice' && GETPOST('mode', 'alpha') == "send" && ! GETPOST('cancel')) +{ + $ws_url = $object->thirdparty->webservices_url; + $ws_key = $object->thirdparty->webservices_key; + $ws_user = GETPOST('ws_user','alpha'); + $ws_password = GETPOST('ws_password','alpha'); + $ws_entity = GETPOST('ws_entity','int'); + $ws_thirdparty = GETPOST('ws_thirdparty','int'); + + // NS and Authentication parameters + $ws_ns='http://www.dolibarr.org/ns/'; + $ws_authentication=array( + 'dolibarrkey'=>$ws_key, + 'sourceapplication'=>'DolibarrWebServiceClient', + 'login'=>$ws_user, + 'password'=>$ws_password, + 'entity'=>$ws_entity + ); + + //Is sync supplier web services module activated? and everything filled? + if (empty($conf->syncsupplierwebservices->enabled)) { + setEventMessage($langs->trans("WarningModuleNotActive",$langs->transnoentities("Module2650Name"))); + } else if (empty($ws_url) || empty($ws_key)) { + setEventMessage($langs->trans("ErrorWebServicesFieldsRequired"), 'errors'); + } else if (empty($ws_user) || empty($ws_password) || empty($ws_thirdparty)) { + setEventMessage($langs->trans("ErrorFieldsRequired"), 'errors'); + } + else + { + //Create SOAP client and connect it to order + $soapclient_order = new nusoap_client($ws_url."/webservices/server_order.php"); + $soapclient_order->soap_defencoding='UTF-8'; + $soapclient_order->decodeUTF8(false); + + //Create SOAP client and connect it to product/service + $soapclient_product = new nusoap_client($ws_url."/webservices/server_productorservice.php"); + $soapclient_product->soap_defencoding='UTF-8'; + $soapclient_product->decodeUTF8(false); + + //Prepare the order lines from order + $order_lines = array(); + foreach ($object->lines as $line) + { + $ws_parameters = array('authentication' => $ws_authentication, 'id' => '', 'ref' => $line->ref_supplier); + $result_product = $soapclient_product->call("getProductOrService", $ws_parameters, $ws_ns, ''); + + if ($result_product["result"]["result_code"] == "OK") + { + $order_lines[] = array( + 'desc' => $line->product_desc, + 'type' => $line->product_type, + 'product_id' => $result_product["product"]["id"], + 'vat_rate' => $line->tva_tx, + 'qty' => $line->qty, + 'price' => $line->price, + 'unitprice' => $line->subprice, + 'total_net' => $line->total_ht, + 'total_vat' => $line->total_tva, + 'total' => $line->total_ttc, + 'date_start' => $line->date_start, + 'date_end' => $line->date_end, + ); + } + } + + //Prepare the order header + $order = array( + 'thirdparty_id' => $ws_thirdparty, + 'date' => dol_print_date(dol_now(),'dayrfc'), + 'total_net' => $object->total_ht, + 'total_var' => $object->total_tva, + 'total' => $object->total_ttc, + 'lines' => $order_lines + ); + + $ws_parameters = array('authentication'=>$ws_authentication, 'order' => $order); + $result_order = $soapclient_order->call("createOrder", $ws_parameters, $ws_ns, ''); + + if (empty($result_order["result"]["result_code"])) //No result, check error str + { + setEventMessage($langs->trans("SOAPError")." '".$soapclient_order->error_str."'", 'errors'); + } + else if ($result_order["result"]["result_code"] != "OK") //Something went wrong + { + setEventMessage($langs->trans("SOAPError")." '".$result_order["result"]["result_code"]."' - '".$result_order["result"]["result_label"]."'", 'errors'); + } + else + { + setEventMessage($langs->trans("RemoteOrderRef")." ".$result_order["ref"], 'mesgs'); + } + } +} + if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->fournisseur->commande->creer) { if ($action == 'addcontact') @@ -1144,10 +1263,14 @@ if ($action=="create") print ''; // Bank Account - print '' . $langs->trans('BankAccount') . ''; - $form->select_comptes($fk_account, 'fk_account', 0, '', 1); - print ''; - + if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER) && ! empty($conf->banque->enabled)) + { + $langs->load("bank"); + print '' . $langs->trans('BankAccount') . ''; + $form->select_comptes($fk_account, 'fk_account', 0, '', 1); + print ''; + } + print ''.$langs->trans('NotePublic').''; print ''; $doleditor = new DolEditor('note_public', GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); @@ -1178,25 +1301,26 @@ if ($action=="create") // Bouton "Create Draft" print "\n"; - print '
    '; + print '
    '; print "\n"; } elseif (! empty($object->id)) { - $author = new User($db); - $author->fetch($object->user_author_id); - $societe = new Fournisseur($db); $result=$societe->fetch($object->socid); if ($result < 0) dol_print_error($db); + $author = new User($db); + $author->fetch($object->user_author_id); + + $res=$object->fetch_optionals($object->id,$extralabels); + $head = ordersupplier_prepare_head($object); $title=$langs->trans("SupplierOrder"); dol_fiche_head($head, 'card', $title, 0, 'order'); - $res=$object->fetch_optionals($object->id,$extralabels); /* * Confirmation de la suppression de la commande @@ -1325,7 +1449,7 @@ elseif (! empty($object->id)) print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print ''; @@ -1414,24 +1538,27 @@ elseif (! empty($object->id)) print ''; // Bank Account - print ''; - print ''; - + if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER) && ! empty($conf->banque->enabled)) + { + print ''; + print ''; + } + // Delivery date planed - print ''; + print "
    '.$langs->trans("Ref").'
    '; - print ''; - print '
    '; - print $langs->trans('BankAccount'); - print ''; - if ($action != 'editbankaccount' && $user->rights->fournisseur->commande->creer) - print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'
    '; - print '
    '; - if ($action == 'editbankaccount') { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); - } else { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); - } - print '
    '; + print ''; + print '
    '; + print $langs->trans('BankAccount'); + print ''; + if ($action != 'editbankaccount' && $user->rights->fournisseur->commande->creer) + print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'
    '; + print '
    '; + if ($action == 'editbankaccount') { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); + } else { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); + } + print '
    '; + print '
    '; print ''; @@ -1452,13 +1579,13 @@ elseif (! empty($object->id)) { print $object->date_livraison ? dol_print_date($object->date_livraison,'daytext') : ' '; } - print ''; + print ''; // Project if (! empty($conf->projet->enabled)) { $langs->load('projects'); - print '
    '; print $langs->trans('DateDeliveryPlanned'); print '
    '; + print '
    '; print ''; @@ -1479,72 +1606,8 @@ elseif (! empty($object->id)) } // Other attributes - $parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - if ($action == 'edit_extras') - { - print ''; - print ''; - print ''; - print ''; - } - - foreach($extrafields->attribute_label as $key=>$label) - { - if ($action == 'edit_extras') { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - } else { - $value=$object->array_options["options_".$key]; - } - - if ($extrafields->attribute_type[$key] == 'separate') - { - print $extrafields->showSeparator($key); - } - else - { - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''."\n"; - } - } - - if(count($extrafields->attribute_label) > 0) - { - if ($action == 'edit_extras' && $user->rights->fournisseur->commande->creer) - { - print ''; - } - else - { - if ($object->statut == 0 && $user->rights->fournisseur->commande->creer) - { - print ''; - } - } - } - } + $cols = 3; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; // Ligne de 3 colonnes print ''; @@ -1805,206 +1868,6 @@ elseif (! empty($object->id)) dol_fiche_end(); - if ($action != 'presend') - { - /** - * Boutons actions - */ - if ($user->societe_id == 0 && $action != 'edit_line' && $action != 'delete') - { - print '
    '; - - // Validate - if ($object->statut == 0 && $num > 0) - { - if ($user->rights->fournisseur->commande->valider) - { - print ''.$langs->trans('Validate').''; - } - } - - // Modify - if ($object->statut == 1) - { - if ($user->rights->fournisseur->commande->commander) - { - print ''.$langs->trans("Modify").''; - } - } - - // Approve - if ($object->statut == 1) - { - if ($user->rights->fournisseur->commande->approuver) - { - print ''.$langs->trans("ApproveOrder").''; - print ''.$langs->trans("RefuseOrder").''; - } - else - { - print ''.$langs->trans("ApproveOrder").''; - print ''.$langs->trans("RefuseOrder").''; - } - } - - // Send - if (in_array($object->statut, array(2, 3, 4, 5))) - { - if ($user->rights->fournisseur->commande->commander) - { - print ''.$langs->trans('SendByMail').''; - } - } - - // Reopen - if (in_array($object->statut, array(2, 5, 6, 7, 9))) - { - if ($user->rights->fournisseur->commande->commander) - { - print ''.$langs->trans("ReOpen").''; - } - } - - // Create bill - if (! empty($conf->fournisseur->enabled) && $object->statut >= 2) // 2 means accepted - { - if ($user->rights->fournisseur->facture->creer) - { - print ''.$langs->trans("CreateBill").''; - } - - //if ($user->rights->fournisseur->commande->creer && $object->statut > 2) - //{ - // print ''.$langs->trans("ClassifyBilled").''; - //} - } - - // Cancel - if ($object->statut == 2) - { - if ($user->rights->fournisseur->commande->commander) - { - print ''.$langs->trans("CancelOrder").''; - } - } - - // Clone - if ($user->rights->fournisseur->commande->creer) - { - print ''.$langs->trans("ToClone").''; - } - - // Delete - if ($user->rights->fournisseur->commande->supprimer) - { - print ''.$langs->trans("Delete").''; - } - - print "
    "; - } - print "
    "; - - - print '
    '; - - /* - * Documents generes - */ - $comfournref = dol_sanitizeFileName($object->ref); - $file = $conf->fournisseur->dir_output . '/commande/' . $comfournref . '/' . $comfournref . '.pdf'; - $relativepath = $comfournref.'/'.$comfournref.'.pdf'; - $filedir = $conf->fournisseur->dir_output . '/commande/' . $comfournref; - $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed=$user->rights->fournisseur->commande->creer; - $delallowed=$user->rights->fournisseur->commande->supprimer; - - print $formfile->showdocuments('commande_fournisseur',$comfournref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,0,0,'','','',$object->thirdparty->default_lang); - $somethingshown=$formfile->numoffiles; - - /* - * Linked object block - */ - $somethingshown=$object->showLinkedObjectBlock(); - - print '
    '; - - - // List of actions on element - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; - $formactions=new FormActions($db); - $somethingshown=$formactions->showactions($object,'order_supplier',$socid); - - - if ($user->rights->fournisseur->commande->commander && $object->statut == 2) - { - /* - * Commander (action=commande) - */ - print '
    '; - print '
    '; - print ''; - print ''; - print '
    '; print $langs->trans('Project'); print '
    '; - // Convert date into timestamp format - if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) - { - $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$db->jdate($object->array_options['options_'.$key]); - } - - if ($action == 'edit_extras' && $user->rights->fournisseur->commande->creer) - { - print $extrafields->showInputField($key,$value); - } - else - { - print $extrafields->showOutputField($key,$value); - } - - print '
    '; - print ''; - print ''; - print '
    '.img_picto('','edit').' '.$langs->trans('Modify').'
    '.$langs->trans("AmountHT").'
    '; - print ''; - print ''; - - print ''; - - print ''; - print ''; - print '
    '.$langs->trans("ToOrder").'
    '.$langs->trans("OrderDate").''; - $date_com = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); - print $form->select_date($date_com,'','','','',"commande"); - print '
    '.$langs->trans("OrderMode").''; - $formorder->selectInputMethod(GETPOST('methodecommande'), "methodecommande", 1); - print '
    '.$langs->trans("Comment").'
    '; - print ''; - } - - if ($user->rights->fournisseur->commande->receptionner && ($object->statut == 3 || $object->statut == 4)) - { - /* - * Receptionner (action=livraison) - */ - print '
    '; - print '
    '; - print ''; - print ''; - print ''; - print ''; - print '\n"; - - print "'; - print ''; - print ''; - print "
    '.$langs->trans("Receive").'
    '.$langs->trans("DeliveryDate").''; - print $form->select_date('','','','','',"commande"); - print "
    ".$langs->trans("Delivery")."\n"; - $liv = array(); - $liv[''] = ' '; - $liv['tot'] = $langs->trans("TotalWoman"); - $liv['par'] = $langs->trans("PartialWoman"); - $liv['nev'] = $langs->trans("NeverReceived"); - $liv['can'] = $langs->trans("Canceled"); - - print $form->selectarray("type",$liv); - - print '
    '.$langs->trans("Comment").'
    \n"; - print "
    \n"; - } - - // List of actions on element - /* Hidden because" available into "Log" tab - print '
    '; - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; - $formactions=new FormActions($db); - $somethingshown=$formactions->showactions($object,'order_supplier',$socid); - */ - - print ''; - } - /* * Action presend */ @@ -2033,7 +1896,7 @@ elseif (! empty($object->id)) // Build document if it not exists if (! $file || ! is_readable($file)) { - $result=supplier_order_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + $result= $object->generateDocument(GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db,$result); @@ -2110,6 +1973,430 @@ elseif (! empty($object->id)) print '
    '; } + /* + * Action webservice + */ + elseif ($action == 'webservice' && GETPOST('mode', 'alpha') != "send" && ! GETPOST('cancel')) + { + $mode = GETPOST('mode', 'alpha'); + $ws_url = $object->thirdparty->webservices_url; + $ws_key = $object->thirdparty->webservices_key; + $ws_user = GETPOST('ws_user','alpha'); + $ws_password = GETPOST('ws_password','alpha'); + + // NS and Authentication parameters + $ws_ns = 'http://www.dolibarr.org/ns/'; + $ws_authentication = array( + 'dolibarrkey'=>$ws_key, + 'sourceapplication'=>'DolibarrWebServiceClient', + 'login'=>$ws_user, + 'password'=>$ws_password, + 'entity'=>'' + ); + + print_titre($langs->trans('CreateRemoteOrder')); + + //Is everything filled? + if (empty($ws_url) || empty($ws_key)) { + setEventMessage($langs->trans("ErrorWebServicesFieldsRequired"), 'errors'); + $mode = "init"; + $error_occurred = true; //Don't allow to set the user/pass if thirdparty fields are not filled + } else if ($mode != "init" && (empty($ws_user) || empty($ws_password))) { + setEventMessage($langs->trans("ErrorFieldsRequired"), 'errors'); + $mode = "init"; + } + + if ($mode == "init") + { + //Table/form header + print ''; + print ''; + print ''; + print ''; + print ''; + + if ($error_occurred) + { + print "
    ".$langs->trans("ErrorOccurredReviseAndRetry")."
    "; + print ''; + } + else + { + $textinput_size = "50"; + // Webservice url + print ''; + //Remote User + print ''; + //Remote Password + print ''; + //Submit button + print ''; + } + + //End table/form + print ''; + print '
    '.$langs->trans("WebServiceURL").''.dol_print_url($ws_url).'
    '.$langs->trans("User").'
    '.$langs->trans("Password").'
    '; + print ''; + print '     '; + //Cancel button + print ''; + print '
    '; + } + elseif ($mode == "check") + { + $ws_entity = ''; + $ws_thirdparty = ''; + $error_occurred = false; + + //Create SOAP client and connect it to user + $soapclient_user = new nusoap_client($ws_url."/webservices/server_user.php"); + $soapclient_user->soap_defencoding='UTF-8'; + $soapclient_user->decodeUTF8(false); + + //Get the thirdparty associated to user + $ws_parameters = array('authentication'=>$ws_authentication, 'id' => '', 'ref'=>$ws_user); + $result_user = $soapclient_user->call("getUser", $ws_parameters, $ws_ns, ''); + $user_status_code = $result_user["result"]["result_code"]; + + if ($user_status_code == "OK") + { + //Fill the variables + $ws_entity = $result_user["user"]["entity"]; + $ws_authentication['entity'] = $ws_entity; + $ws_thirdparty = $result_user["user"]["fk_thirdparty"]; + if (empty($ws_thirdparty)) + { + setEventMessage($langs->trans("RemoteUserMissingAssociatedSoc"), 'errors'); + $error_occurred = true; + } + else + { + //Create SOAP client and connect it to product/service + $soapclient_product = new nusoap_client($ws_url."/webservices/server_productorservice.php"); + $soapclient_product->soap_defencoding='UTF-8'; + $soapclient_product->decodeUTF8(false); + + // Iterate each line and get the reference that uses the supplier of that product/service + $i = 0; + foreach ($object->lines as $line) { + $i = $i + 1; + $ref_supplier = $line->ref_supplier; + $line_id = $i."º) ".$line->product_ref.": "; + if (empty($ref_supplier)) { + continue; + } + $ws_parameters = array('authentication' => $ws_authentication, 'id' => '', 'ref' => $ref_supplier); + $result_product = $soapclient_product->call("getProductOrService", $ws_parameters, $ws_ns, ''); + if (!$result_product) + { + setEventMessage($line_id.$langs->trans("SOAPError")." ".$soapclient_product->error_str." - ".$soapclient_product->response, 'errors'); + $error_occurred = true; + break; + } + + // Check the result code + $status_code = $result_product["result"]["result_code"]; + if (empty($status_code)) //No result, check error str + { + setEventMessage($langs->trans("SOAPError")." '".$soapclient_order->error_str."'", 'errors'); + } + else if ($status_code != "OK") //Something went wrong + { + if ($status_code == "NOT_FOUND") + { + setEventMessage($line_id.$langs->trans("SupplierMissingRef")." '".$ref_supplier."'", 'warnings'); + } + else + { + setEventMessage($line_id.$langs->trans("ResponseNonOK")." '".$status_code."' - '".$result_product["result"]["result_label"]."'", 'errors'); + $error_occurred = true; + break; + } + } + + + // Ensure that price is equal and warn user if it's not + $supplier_price = price($result_product["product"]["price_net"]); //Price of client tab in supplier dolibarr + $local_price = NULL; //Price of supplier as stated in product suppliers tab on this dolibarr, NULL if not found + + $product_fourn = new ProductFournisseur($db); + $product_fourn_list = $product_fourn->list_product_fournisseur_price($line->fk_product); + if (count($product_fourn_list)>0) + { + foreach($product_fourn_list as $product_fourn_line) + { + //Only accept the line where the supplier is the same at this order and has the same ref + if ($product_fourn_line->fourn_id == $object->socid && $product_fourn_line->fourn_ref == $ref_supplier) { + $local_price = price($product_fourn_line->fourn_price); + } + } + } + + if ($local_price != NULL && $local_price != $supplier_price) { + setEventMessage($line_id.$langs->trans("RemotePriceMismatch")." ".$supplier_price." - ".$local_price, 'warnings'); + } + + // Check if is in sale + if (empty($result_product["product"]["status_tosell"])) { + setEventMessage($line_id.$langs->trans("ProductStatusNotOnSellShort")." '".$ref_supplier."'", 'warnings'); + } + } + } + + } + elseif ($user_status_code == "PERMISSION_DENIED") + { + setEventMessage($langs->trans("RemoteUserNotPermission"), 'errors'); + $error_occurred = true; + } + elseif ($user_status_code == "BAD_CREDENTIALS") + { + setEventMessage($langs->trans("RemoteUserBadCredentials"), 'errors'); + $error_occurred = true; + } + else + { + setEventMessage($langs->trans("ResponseNonOK")." '".$user_status_code."'", 'errors'); + $error_occurred = true; + } + + //Form + print '
    '; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if ($error_occurred) + { + print "
    ".$langs->trans("ErrorOccurredReviseAndRetry")."
    "; + } + else + { + print ''; + print '     '; + } + print ''; + print '
    '; + } + } + /* + * Show buttons + */ + else + { + /** + * Boutons actions + */ + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been + // modified by hook + if (empty($reshook)) + { + if ($user->societe_id == 0 && $action != 'edit_line' && $action != 'delete') + { + print '
    '; + + // Validate + if ($object->statut == 0 && $num > 0) + { + if ($user->rights->fournisseur->commande->valider) + { + print ''.$langs->trans('Validate').''; + } + } + + // Modify + if ($object->statut == 1) + { + if ($user->rights->fournisseur->commande->commander) + { + print ''.$langs->trans("Modify").''; + } + } + + // Approve + if ($object->statut == 1) + { + if ($user->rights->fournisseur->commande->approuver) + { + print ''.$langs->trans("ApproveOrder").''; + print ''.$langs->trans("RefuseOrder").''; + } + else + { + print ''.$langs->trans("ApproveOrder").''; + print ''.$langs->trans("RefuseOrder").''; + } + } + + // Send + if (in_array($object->statut, array(2, 3, 4, 5))) + { + if ($user->rights->fournisseur->commande->commander) + { + print ''.$langs->trans('SendByMail').''; + } + } + + // Reopen + if (in_array($object->statut, array(2, 5, 6, 7, 9))) + { + if ($user->rights->fournisseur->commande->commander) + { + print ''.$langs->trans("ReOpen").''; + } + } + + // Create bill + if (! empty($conf->fournisseur->enabled) && $object->statut >= 2) // 2 means accepted + { + if ($user->rights->fournisseur->facture->creer) + { + print ''.$langs->trans("CreateBill").''; + } + + //if ($user->rights->fournisseur->commande->creer && $object->statut > 2) + //{ + // print ''.$langs->trans("ClassifyBilled").''; + //} + } + + + // Create a remote order using WebService only if module is activated + if (! empty($conf->syncsupplierwebservices->enabled) && $object->statut >= 2) // 2 means accepted + { + print ''.$langs->trans('CreateRemoteOrder').''; + } + + // Cancel + if ($object->statut == 2) + { + if ($user->rights->fournisseur->commande->commander) + { + print ''.$langs->trans("CancelOrder").''; + } + } + + // Clone + if ($user->rights->fournisseur->commande->creer) + { + print ''.$langs->trans("ToClone").''; + } + + // Delete + if ($user->rights->fournisseur->commande->supprimer) + { + print ''.$langs->trans("Delete").''; + } + + print "
    "; + } + } + print "
    "; + + + print '
    '; + + /* + * Documents generes + */ + $comfournref = dol_sanitizeFileName($object->ref); + $file = $conf->fournisseur->dir_output . '/commande/' . $comfournref . '/' . $comfournref . '.pdf'; + $relativepath = $comfournref.'/'.$comfournref.'.pdf'; + $filedir = $conf->fournisseur->dir_output . '/commande/' . $comfournref; + $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; + $genallowed=$user->rights->fournisseur->commande->creer; + $delallowed=$user->rights->fournisseur->commande->supprimer; + + print $formfile->showdocuments('commande_fournisseur',$comfournref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,0,0,'','','',$object->thirdparty->default_lang); + $somethingshown=$formfile->numoffiles; + + /* + * Linked object block + */ + $somethingshown=$object->showLinkedObjectBlock(); + + print '
    '; + + + // List of actions on element + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + $formactions=new FormActions($db); + $somethingshown=$formactions->showactions($object,'order_supplier',$socid); + + + if ($user->rights->fournisseur->commande->commander && $object->statut == 2) + { + /* + * Commander (action=commande) + */ + print '
    '; + print '
    '; + print ''; + print ''; + print ''; + print ''; + print ''; + + print ''; + + print ''; + print ''; + print '
    '.$langs->trans("ToOrder").'
    '.$langs->trans("OrderDate").''; + $date_com = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + print $form->select_date($date_com,'','','','',"commande"); + print '
    '.$langs->trans("OrderMode").''; + $formorder->selectInputMethod(GETPOST('methodecommande'), "methodecommande", 1); + print '
    '.$langs->trans("Comment").'
    '; + print '
    '; + } + + if ($user->rights->fournisseur->commande->receptionner && ($object->statut == 3 || $object->statut == 4)) + { + /* + * Receptionner (action=livraison) + */ + print '
    '; + print '
    '; + print ''; + print ''; + print ''; + print ''; + print '\n"; + + print "'; + print ''; + print ''; + print "
    '.$langs->trans("Receive").'
    '.$langs->trans("DeliveryDate").''; + print $form->select_date('','','','','',"commande"); + print "
    ".$langs->trans("Delivery")."\n"; + $liv = array(); + $liv[''] = ' '; + $liv['tot'] = $langs->trans("TotalWoman"); + $liv['par'] = $langs->trans("PartialWoman"); + $liv['nev'] = $langs->trans("NeverReceived"); + $liv['can'] = $langs->trans("Canceled"); + + print $form->selectarray("type",$liv); + + print '
    '.$langs->trans("Comment").'
    \n"; + print "
    \n"; + } + + // List of actions on element + /* Hidden because" available into "Log" tab + print '
    '; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + $formactions=new FormActions($db); + $somethingshown=$formactions->showactions($object,'order_supplier',$socid); + */ + + print '
    '; + } print '
    '; } diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index ba32a143f8c..b8eabb9be6c 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -146,7 +146,7 @@ if ($id > 0 || ! empty($ref)) */ print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print ''; diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index bea467340e6..11158b21f60 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -405,9 +405,9 @@ if ($id > 0 || ! empty($ref)) // print ' / '.$commande->ref_supplier; // Not yet available print '" class="flat">

    '; - print '
    '; + print '>'; } if (! $nbproduct && $nbfreeproduct) { diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index a3681b8fc02..2949aedcf14 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -110,7 +110,7 @@ if ($object->id > 0) print '
    '.$langs->trans("Ref").'
    '; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print ''; diff --git a/htdocs/fourn/commande/history.php b/htdocs/fourn/commande/history.php index e53b3974cf4..c864dce3b88 100644 --- a/htdocs/fourn/commande/history.php +++ b/htdocs/fourn/commande/history.php @@ -76,7 +76,7 @@ if ($id > 0 || ! empty($ref)) print '
    '.$langs->trans("Ref").'
    '; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print ''; @@ -160,7 +160,7 @@ if ($id > 0 || ! empty($ref)) print '\n"; // User - print ''; // Comment diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index 85557877d76..0f04ee91eaa 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -59,7 +59,7 @@ print ''; -print ''; +print ''; print ''; diff --git a/htdocs/fourn/commande/liste.php b/htdocs/fourn/commande/list.php similarity index 78% rename from htdocs/fourn/commande/liste.php rename to htdocs/fourn/commande/list.php index c02ab0685f7..4f0974abd10 100644 --- a/htdocs/fourn/commande/liste.php +++ b/htdocs/fourn/commande/list.php @@ -21,7 +21,7 @@ */ /** - * \file htdocs/fourn/commande/liste.php + * \file htdocs/fourn/commande/list.php * \ingroup fournisseur * \brief List of suppliers orders */ @@ -39,23 +39,36 @@ $langs->load("sendings"); $search_ref=GETPOST('search_ref'); $search_refsupp=GETPOST('search_refsupp'); -$search_nom=GETPOST('search_nom'); +$search_company=GETPOST('search_company'); $search_user=GETPOST('search_user'); $search_ttc=GETPOST('search_ttc'); $sall=GETPOST('search_all'); $search_status=GETPOST('search_status','int'); -if ($search_status == '') $search_status=-1; $page = GETPOST('page','int'); $socid = GETPOST('socid','int'); $sortorder = GETPOST('sortorder','alpha'); $sortfield = GETPOST('sortfield','alpha'); +$viewstatut=GETPOST('viewstatut'); + // Security check $orderid = GETPOST('orderid'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'fournisseur', $orderid, '', 'commande'); +// Purge search criteria +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_ref=''; + $search_refsupp=''; + $search_company=''; + $search_user=''; + $search_ttc=''; + $search_status=''; +} + +if ($search_status == '') $search_status=-1; /* * View @@ -66,7 +79,7 @@ if ($socid > 0) { $fourn = new Fournisseur($db); $fourn->fetch($socid); - $title .= ' ('.$fourn->nom.')'; + $title .= ' ('.$fourn->name.')'; } llxHeader('',$title); @@ -85,7 +98,7 @@ $offset = $conf->liste_limit * $page ; * Mode Liste */ -$sql = "SELECT s.rowid as socid, s.nom, cf.date_commande as dc,"; +$sql = "SELECT s.rowid as socid, s.nom as name, cf.date_commande as dc,"; $sql.= " cf.rowid,cf.ref, cf.ref_supplier, cf.fk_statut, cf.total_ttc, cf.fk_user_author,cf.date_livraison,"; $sql.= " u.login"; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s,"; @@ -100,9 +113,9 @@ if ($search_ref) { $sql .= natural_search('cf.ref', $search_ref); } -if ($search_nom) +if ($search_company) { - $sql .= natural_search('s.nom', $search_nom); + $sql .= natural_search('s.nom', $search_company); } if ($search_user) { @@ -110,7 +123,7 @@ if ($search_user) } if ($search_ttc) { - $sql .= " AND total_ttc = ".price2num($search_ttc); + $sql .= " AND total_ttc = '".$db->escape(price2num($search_ttc))."'"; } if ($sall) { @@ -152,13 +165,14 @@ if ($resql) $i = 0; $param=""; - if ($search_ref) $param.="&search_ref=".$search_ref; - if ($search_nom) $param.="&search_nom=".$search_nom; - if ($search_user) $param.="&search_user=".$search_user; - if ($search_ttc) $param.="&search_ttc=".$search_ttc; - if ($search_refsupp) $param.="&search_refsupp=".$search_refsupp; - if ($socid) $param.="&socid=".$socid; - if ($search_status >= 0) $param.="&search_status=".$search_status; + if ($search_ref) $param.="&search_ref=".$search_ref; + if ($search_company) $param.="&search_company=".$search_company; + if ($search_user) $param.="&search_user=".$search_user; + if ($search_ttc) $param.="&search_ttc=".$search_ttc; + if ($search_refsupp) $param.="&search_refsupp=".$search_refsupp; + if ($socid) $param.="&socid=".$socid; + if ($search_status >= 0) $param.="&search_status=".$search_status; + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); print ''; print '
    '.$langs->trans("Ref").''.$commande->LibStatut($obj->fk_statut,4)."'; + print ''; print img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'
    '; */ $var=false; print ''; -print ''; +print ''; print ''; print ''; print '"; print ''; - print ''; + print ''; print "\n"; } } @@ -184,7 +184,7 @@ if ($resql) print ""; print ''; - print ''; + print ''; print "\n"; $i++; @@ -204,7 +204,7 @@ else if (! empty($conf->fournisseur->enabled)) { - $sql = "SELECT c.rowid, c.ref, s.nom, s.rowid as socid"; + $sql = "SELECT c.rowid, c.ref, s.nom as name, s.rowid as socid"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -232,8 +232,8 @@ if (! empty($conf->fournisseur->enabled)) $obj = $db->fetch_object($resql); print ""; print '"; - print ''; + print "rowid."\">".img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref.""; + print ''; $i++; } } @@ -300,7 +300,7 @@ print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -369,7 +369,7 @@ else dol_print_error($db); * Orders to process */ /* - $sql = "SELECT c.rowid, c.ref, c.fk_statut, s.nom, s.rowid as socid"; + $sql = "SELECT c.rowid, c.ref, c.fk_statut, s.nom as name, s.rowid as socid"; $sql.=" FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -387,7 +387,7 @@ $num = $db->num_rows($resql); print '
    '.$langs->trans("SearchOrder").'
    '; @@ -125,7 +125,7 @@ if ($resql) $var=!$var; print "
    '.$commandestatic->LibStatut($statut,0).''.(isset($vals[$statut])?$vals[$statut]:0).''.(isset($vals[$statut])?$vals[$statut]:0).'
    '.$langs->trans($commandestatic->statuts[$row[1]]).''.$row[0].' '.$commandestatic->LibStatut($row[1],3).''.$row[0].' '.$commandestatic->LibStatut($row[1],3).'
    '; - print "rowid."\">".img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref."'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->nom,24).'
    '.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->name,24).'
    '; */ $max=5; -$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.tms, s.nom, s.rowid as socid"; +$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.tms, s.nom as name, s.rowid as socid"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -353,7 +353,7 @@ if ($resql) print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.''.dol_print_date($db->jdate($obj->tms),'day').''.$commandestatic->LibStatut($obj->fk_statut,5).'
    '; print ''; -print ''; +print ''; if ($num) { @@ -421,7 +421,7 @@ print '
    '.$langs->trans("OrdersToProcess").' ('.$num.')
    '.$langs->trans("OrdersToProcess").' ('.$num.')
    '; print '
    '.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->nom,24).''.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->name,24).''.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).'
    '; @@ -178,7 +192,7 @@ if ($resql) print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -186,10 +200,9 @@ if ($resql) print ''; - print ''; - print ''; + print '\n"; $var=true; @@ -204,7 +217,7 @@ if ($resql) print ""; // Ref - print ''."\n"; + print ''."\n"; // Author $userstatic->id=$obj->fk_user_author; @@ -255,6 +268,8 @@ if ($resql) } print "
     '; $formorder->selectSupplierOrderStatus($search_status,1,'search_status'); print ''; - print ''; - print '
    '; + print ''; + print "
    '.img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref.''; + print ''.img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref.''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->fournisseur->dir_output.'/commande' . '/' . dol_sanitizeFileName($obj->ref); print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); @@ -215,8 +228,8 @@ if ($resql) // Company - print ''.img_object($langs->trans("ShowCompany"),"company").' '; - print $obj->nom.''.img_object($langs->trans("ShowCompany"),"company").' '; + print $obj->name.'
    \n"; print "\n"; + + print '
    '.img_help(1,'').' '.$langs->trans("ToBillSeveralOrderSelectCustomer", $langs->transnoentitiesnoconv("CreateInvoiceForThisCustomer")).'
    '; $db->free($resql); } diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index b9cbf6e33b7..6a1c6cfe80e 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -91,7 +91,7 @@ if ($id > 0 || ! empty($ref)) */ print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print ''; diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php new file mode 100644 index 00000000000..6792e9356b1 --- /dev/null +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -0,0 +1,595 @@ + + * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 Andreu Bisquerra Gaya + * Copyright (C) 2012 David Rodriguez Martinez + * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2014 Florian Henry + * + * 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 . + */ + +/** + * \file htdocs/fourn/commande/orderstoinvoice.php + * \ingroup commande + * \brief Page to invoice multiple supplier orders + */ +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; +require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_invoice/modules_facturefournisseur.php'; +if (! empty($conf->projet->enabled)) { + require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; +} + +$langs->load('orders'); +$langs->load('deliveries'); +$langs->load('companies'); + +if (! $user->rights->facture->creer) + accessforbidden(); + +$id = (GETPOST('id') ? GETPOST('id', 'int') : GETPOST("facid")); // For backward compatibility +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); +$sref = GETPOST('sref'); +$sref_client = GETPOST('sref_client'); +$sall = GETPOST('sall'); +$socid = GETPOST('socid', 'int'); +$selected = GETPOST('orders_to_invoice'); +$sortfield = GETPOST("sortfield", 'alpha'); +$sortorder = GETPOST("sortorder", 'alpha'); +$viewstatut = GETPOST('viewstatut'); + +if (! $sortfield) + $sortfield = 'c.rowid'; +if (! $sortorder) + $sortorder = 'DESC'; + +$now = dol_now(); +$date_start = dol_mktime(0, 0, 0, $_REQUEST["date_startmonth"], $_REQUEST["date_startday"], $_REQUEST["date_startyear"]); // Date for local PHP server +$date_end = dol_mktime(23, 59, 59, $_REQUEST["date_endmonth"], $_REQUEST["date_endday"], $_REQUEST["date_endyear"]); +$date_starty = dol_mktime(0, 0, 0, $_REQUEST["date_start_delymonth"], $_REQUEST["date_start_delyday"], $_REQUEST["date_start_delyyear"]); // Date for local PHP server +$date_endy = dol_mktime(23, 59, 59, $_REQUEST["date_end_delymonth"], $_REQUEST["date_end_delyday"], $_REQUEST["date_end_delyyear"]); + +if ($action == 'create') { + if (is_array($selected) == false) { + $mesgs = array ( + '
    ' . $langs->trans('Error_OrderNotChecked') . '
    ' + ); + } else { + $origin = GETPOST('origin'); + $originid = GETPOST('originid'); + } +} + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; +$hookmanager = new HookManager($db); +$hookmanager->initHooks(array('orderstoinvoicesupplier')); + +/* + * Actions + */ + +if (($action == 'create' || $action == 'add') && empty($mesgs)) { + + require_once DOL_DOCUMENT_ROOT . '/core/lib/fourn.lib.php'; + if (! empty($conf->projet->enabled)) + require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; + + $langs->load('bills'); + $langs->load('products'); + $langs->load('main'); + if (isset($_GET['orders_to_invoice'])) { + $orders_id = $_GET['orders_to_invoice']; + $n = count($orders_id); + $i = 0; + + $originid = $orders_id[0]; + $_GET['originid'] = $orders_id[0]; + } + if (isset($_POST['orders_to_invoice'])) { + $orders_id = $_POST['orders_to_invoice']; + $nn = count($orders_id); + $ii = 0; + + $originid = $orders_id[0]; + $_POST['originid'] = $orders_id[0]; + } + + $projectid = GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : 0; + $lineid = GETPOST('lineid', 'int'); + $userid = GETPOST('userid', 'int'); + $search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref') : GETPOST('search_ref'); + + // Security check + if ($user->societe_id) + $socid = $user->societe_id; + $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); + + $usehm = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE; + $object = new FactureFournisseur($db); + + // Insert new invoice in database + if ($action == 'add' && $user->rights->fournisseur->facture->creer) { + $object->socid = GETPOST('socid'); + $db->begin(); + $error = 0; + + // Standard or deposit or proforma invoice + $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + if (empty($datefacture)) { + $datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y")); + } + if (! $error) { + $object->ref = $_POST['ref']; + $object->ref_supplier = $_POST['ref_supplier']; + $object->socid = $_POST['socid']; + $object->libelle = $_POST['libelle']; + $object->date = $datefacture; + $object->date_echeance = $datedue; + $object->note_public = GETPOST('note_public'); + $object->note_private = GETPOST('note_private'); + $object->cond_reglement_id = GETPOST('cond_reglement_id'); + $object->mode_reglement_id = GETPOST('mode_reglement_id'); + $projectid = GETPOST('projectid'); + if ($projectid > 0) + $object->fk_project = $projectid; + + // Auto calculation of date due if not filled by user + if (empty($object->date_echeance)) + $object->date_echeance = $object->calculate_date_lim_reglement(); + + if ($_POST['origin'] && $_POST['originid']) { + $object->origin = $_POST['origin']; + $object->origin_id = $orders_id[$ii]; + $object->linked_objects = $orders_id; + $id = $object->create($user); + + if ($id > 0) { + foreach ( $orders_id as $origin => $origin_id ) { + $origin_id = (! empty($origin_id) ? $origin_id : $object->origin_id); + $db->begin(); + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "element_element ("; + $sql .= "fk_source"; + $sql .= ", sourcetype"; + $sql .= ", fk_target"; + $sql .= ", targettype"; + $sql .= ") VALUES ("; + $sql .= $origin_id; + $sql .= ", '" . $object->origin . "'"; + $sql .= ", " . $id; + $sql .= ", '" . $object->element . "'"; + $sql .= ")"; + + if ($db->query($sql)) { + $db->commit(); + } else { + $db->rollback(); + } + } + + while ( $ii < $nn ) { + $objectsrc = new CommandeFournisseur($db); + dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines"); + $result = $objectsrc->fetch($orders_id[$ii]); + if ($result > 0) { + $lines = $objectsrc->lines; + if (empty($lines) && method_exists($objectsrc, 'fetch_lines')) { + $objectsrc->fetch_lines(); + $lines = $objectsrc->lines; + } + $fk_parent_line = 0; + $num = count($lines); + for($i = 0; $i < $num; $i ++) { + $desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle); + + $desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle); + $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0); + + // Dates + // TODO mutualiser + $date_start = $lines[$i]->date_debut_prevue; + if ($lines[$i]->date_debut_reel) + $date_start = $lines[$i]->date_debut_reel; + if ($lines[$i]->date_start) + $date_start = $lines[$i]->date_start; + $date_end = $lines[$i]->date_fin_prevue; + if ($lines[$i]->date_fin_reel) + $date_end = $lines[$i]->date_fin_reel; + if ($lines[$i]->date_end) + $date_end = $lines[$i]->date_end; + + // Reset fk_parent_line for no child products and special product + if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) { + $fk_parent_line = 0; + } + // FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example. + $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->qty, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, 'HT', $product_type); + + if ($result > 0) { + $lineid = $result; + } else { + $lineid = 0; + $error ++; + break; + } + // Defined the new fk_parent_line + if ($result > 0 && $lines[$i]->product_type == 9) { + $fk_parent_line = $result; + } + } + } else { + $mesgs[] = $objectsrc->error; + $error ++; + } + $ii ++; + } + } else { + $mesgs[] = $object->error; + $error ++; + } + } + } + + // End of object creation, we show it + if ($id > 0 && ! $error) { + $db->commit(); + header('Location: ' . DOL_URL_ROOT . '/fourn/facture/card.php?facid=' . $id); + exit(); + } else { + $db->rollback(); + $action = 'create'; + $_GET["origin"] = $_POST["origin"]; + $_GET["originid"] = $_POST["originid"]; + $mesgs[] = '
    ' . $object->error . '
    '; + } + } +} + +/* + * View + */ + +$html = new Form($db); +$htmlother = new FormOther($db); +$formfile = new FormFile($db); +$companystatic = new Societe($db); + +// Mode creation +if ($action == 'create' && empty($mesgs)) { + + llxHeader(); + print_fiche_titre($langs->trans('NewBill')); + + $soc = new Societe($db); + if ($socid) + $res = $soc->fetch($socid); + if ($res) { + $cond_reglement_id = $soc->cond_reglement_id; + $mode_reglement_id = $soc->mode_reglement_id; + } + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : ''; + + print '
    '; + print ''; + print ''; + print '' . "\n"; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
    '.$langs->trans("Ref").'
    '; + + // Ref + print ''; + + // Ref supplier + print ''; + print ''; + + // Third party + print ''; + print '' . "\n"; + + // Date invoice + print ''; + // Payment term + print ''; + // Payment mode + print ''; + // Project + if (! empty($conf->projet->enabled)) { + $formproject = new FormProjets($db); + + $langs->load('projects'); + print ''; + } + + $objectsrc = new CommandeFournisseur($db); + $listoforders = array (); + foreach ( $selected as $sel ) { + $result = $objectsrc->fetch($sel); + if ($result > 0) { + $listoforders[] = $objectsrc->ref; + } + } + + // Other attributes + $parameters = array ( + 'objectsrc' => $objectsrc, + 'idsrc' => $listoforders, + 'colspan' => ' colspan="3"' + ); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + + // Modele PDF + print ''; + print '"; + + // Public note + print ''; + print ''; + print ''; + // Private note + if (empty($user->societe_id)) { + print ''; + print ''; + print ''; + } + + print '
    ' . $langs->trans('Ref') . '' . $langs->trans('Draft') . '
    ' . $langs->trans('RefSupplier') . '
    ' . $langs->trans('Customer') . ''; + print $soc->getNomUrl(1); + print ''; + print '
    ' . $langs->trans('Date') . ''; + $html->select_date('', '', '', '', '', "add", 1, 1); + print '
    ' . $langs->trans('PaymentConditionsShort') . ''; + $html->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id'); + print '
    ' . $langs->trans('PaymentMode') . ''; + $html->select_types_paiements(isset($_POST['mode_reglement_id']) ? $_POST['mode_reglement_id'] : $mode_reglement_id, 'mode_reglement_id'); + print '
    ' . $langs->trans('Project') . ''; + $formproject->select_projects($soc->id, $projectid, 'projectid'); + print '
    ' . $langs->trans('Model') . ''; + $liste = ModelePDFSuppliersInvoices::liste_modeles($db); + print $html->selectarray('model', $liste, $conf->global->INVOICE_SUPPLIER_ADDON_PDF); + print "
    ' . $langs->trans('NotePublic') . ''; + print '
    ' . $langs->trans('NotePrivate') . ''; + print '
    '; + + while ( $i < $n ) { + print ''; + + $i ++; + } + + // Button "Create Draft" + print '
    '; + print "\n"; + + print '
    \n"; +} + +// Mode liste +if (($action != 'create' && $action != 'add') || ! empty($mesgs)) { + llxHeader(); + ?> + +rights->societe->client->voir && ! $socid) + $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; + $sql .= ' WHERE c.entity = ' . $conf->entity; + $sql .= ' AND c.fk_soc = s.rowid'; + + // Show orders with status validated, shipping started and delivered (well any order we can bill) + $sql .= " AND c.fk_statut IN (5)"; + + // Find order that are not already invoiced + $sql .= " AND c.rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='invoice_supplier')"; + + if ($socid) + $sql .= ' AND s.rowid = ' . $socid; + if (! $user->rights->societe->client->voir && ! $socid) + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; + if ($sref) { + $sql .= " AND c.ref LIKE '%" . $db->escape($sref) . "%'"; + } + if ($sall) { + $sql .= " AND (c.ref LIKE '%" . $db->escape($sall) . "%' OR c.note LIKE '%" . $db->escape($sall) . "%')"; + } + + // Date filter + if ($date_start && $date_end) + $sql .= " AND c.date_commande >= '" . $db->idate($date_start) . "' AND c.date_commande <= '" . $db->idate($date_end) . "'"; + if ($date_starty && $date_endy) + $sql .= " AND c.date_livraison >= '" . $db->idate($date_starty) . "' AND c.date_livraison <= '" . $db->idate($date_endy) . "'"; + + if (! empty($sref_client)) { + $sql .= ' AND c.ref_supplier LIKE \'%' . $db->escape($sref_client) . '%\''; + } + $sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder; + dol_syslog('fourn/commande/ordertoinvoice.php sql=' . $sql); + $resql = $db->query($sql); + + if ($resql) { + if ($socid) { + $soc = new Societe($db); + $soc->fetch($socid); + } + $title = $langs->trans('ListOfSupplierOrders'); + $title .= ' - ' . $langs->trans('StatusOrderReceivedAllShort'); + $num = $db->num_rows($resql); + print_fiche_titre($title); + $i = 0; + $period = $html->select_date($date_start, 'date_start', 0, 0, 1, '', 1, 0, 1) . ' - ' . $html->select_date($date_end, 'date_end', 0, 0, 1, '', 1, 0, 1); + $periodely = $html->select_date($date_starty, 'date_start_dely', 0, 0, 1, '', 1, 0, 1) . ' - ' . $html->select_date($date_endy, 'date_end_dely', 0, 0, 1, '', 1, 0, 1); + + if (! empty($socid)) { + // Company + $companystatic->id = $socid; + $companystatic->nom = $soc->nom; + print '

    ' . $companystatic->getNomUrl(1, 'customer') . '

    '; + } + + print ''; + print ''; + print_liste_field_titre($langs->trans('Ref'), 'orderstoinvoice.php', 'c.ref', '', '&socid=' . $socid, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans('RefSupplier'), 'orderstoinvoice.php', 'c.ref_supplier', '', '&socid=' . $socid, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans('OrderDate'), 'orderstoinvoice.php', 'c.date_commande', '', '&socid=' . $socid, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans('DeliveryDate'), 'orderstoinvoice.php', 'c.date_livraison', '', '&socid=' . $socid, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans('Status'), '', '', '', '', 'align="right"'); + print_liste_field_titre($langs->trans('GenerateBill'), '', '', '', '', 'align="center"'); + print ''; + + // Lignes des champs de filtre + print ''; + print ''; + print ''; + print ''; + // print ''; + + // DATE DELIVERY + print ''; + + // SEARCH BUTTON + print ''; + + print ''; + print ''; + + print ''; + $var = True; + $generic_commande = new CommandeFournisseur($db); + + while ( $i < $num ) { + $objp = $db->fetch_object($resql); + $var = ! $var; + print ''; + print ''; + + print ''; + + // Order date + print ''; + + // Delivery date + print ''; + + // Statut + print ''; + + // Checkbox + print ''; + + print ''; + + $total = $total + $objp->price; + $subtotal = $subtotal + $objp->price; + $i ++; + } + print '
    '; + // REF + print ''; + print ''; + print ''; + print ''; + + // DATE ORDER + print ''; + print $period; + print ''; + print $periodely; + print ''; + print ''; + + // ALL/NONE + print ''; + if ($conf->use_javascript_ajax) + print '' . $langs->trans("All") . ' / ' . $langs->trans("None") . ''; + print '
    '; + + $generic_commande->id = $objp->rowid; + $generic_commande->ref = $objp->ref; + + print ''; + print ''; + + print '
    '; + print $generic_commande->getNomUrl(1, $objp->fk_statut); + print ''; + $filename = dol_sanitizeFileName($objp->ref); + $filedir = $conf->fournisseur->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref); + $urlsource = $_SERVER['PHP_SELF'] . '?id=' . $objp->rowid; + print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir); + print '
    '; + print '
    ' . $objp->ref_supplier . ''; + print dol_print_date($db->jdate($objp->date_commande), 'day'); + print ''; + print dol_print_date($db->jdate($objp->date_livraison), 'day'); + print '' . $generic_commande->LibStatut($objp->fk_statut, 5) . ''; + print ''; + print '
    '; + + /* + * Boutons actions + */ + print '
    '; + print '
    '; + print ''; + print ''; + print '
    '; + // print ''.$langs->trans("GoBack").''; + print ''; + print '
    '; + print '
    '; + print ''; + $db->free($resql); + } else { + print dol_print_error($db); + } +} + +dol_htmloutput_mesg($mesg, $mesgs); + +llxFooter(); +$db->close(); diff --git a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php index fc1942e0f61..3a9d8f5bebe 100644 --- a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php @@ -45,7 +45,7 @@ foreach($linkedObjectBlock as $object) $var=!$var; ?> > - trans("ShowOrder"),"order").' '.$object->ref; ?> + trans("ShowOrder"),"order").' '.$object->ref; ?> date,'day'); ?> rights->fournisseur->commande->lire) { diff --git a/htdocs/fourn/contact.php b/htdocs/fourn/contact.php index 70748c8bd57..acdac3ab9a1 100644 --- a/htdocs/fourn/contact.php +++ b/htdocs/fourn/contact.php @@ -94,13 +94,13 @@ if ($result) $num = $db->num_rows($result); $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses")); - print_barre_liste($title." (".$langs->trans("Suppliers").")",$page, "contact.php", "",$sortfield,$sortorder,"",$num); + print_barre_liste($title." (".$langs->trans("Suppliers").")",$page, $_SERVER["PHP_SELF"], "",$sortfield,$sortorder,"",$num); print ''; print ''; - print_liste_field_titre($langs->trans("Lastname"),"contact.php","p.name", $begin, "", "", $sortfield,$sortorder); - print_liste_field_titre($langs->trans("Firstname"),"contact.php","p.firstname", $begin, "", "", $sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),"contact.php","s.nom", $begin, "", "", $sortfield,$sortorder); + print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"p.name", $begin, "", "", $sortfield,$sortorder); + print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"p.firstname", $begin, "", "", $sortfield,$sortorder); + print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom", $begin, "", "", $sortfield,$sortorder); print ''; print ''; print "\n"; @@ -114,9 +114,9 @@ if ($result) print ""; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/card.php similarity index 93% rename from htdocs/fourn/facture/fiche.php rename to htdocs/fourn/facture/card.php index 9d20c2b9722..05e8590628f 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/card.php @@ -24,7 +24,7 @@ */ /** - * \file htdocs/fourn/facture/fiche.php + * \file htdocs/fourn/facture/card.php * \ingroup facture, fournisseur * \brief Page for supplier invoice card (view, edit, validate) */ @@ -69,9 +69,13 @@ if (! empty($user->societe_id)) $socid=$user->societe_id; $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('invoicesuppliercard')); +$hookmanager->initHooks(array('invoicesuppliercard','globalcard')); $object=new FactureFournisseur($db); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); // Load object if ($id > 0 || ! empty($ref)) @@ -88,6 +92,7 @@ $permissionnote=$user->rights->fournisseur->facture->creer; // Used by the inclu $parameters=array('socid'=>$socid); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once @@ -295,10 +300,16 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) $_GET['socid']=$_POST['socid']; $error++; } - + + // Fill array 'array_options' with data from add form + if (! $error) { $db->begin(); + + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object); + if ($ret < 0) $error ++; $tmpproject = GETPOST('projectid', 'int'); @@ -475,7 +486,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $outputlangs = $langs; - $result=supplier_invoice_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + $result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db,$result); @@ -526,11 +537,11 @@ elseif ($action == 'update_line' && $user->rights->fournisseur->facture->creer) } - $localtax1tx= get_localtax($_POST['tauxtva'], 1, $mysoc,$object->thirdparty); - $localtax2tx= get_localtax($_POST['tauxtva'], 2, $mysoc,$object->thirdparty); + $localtax1_tx= get_localtax($_POST['tauxtva'], 1, $mysoc,$object->thirdparty); + $localtax2_tx= get_localtax($_POST['tauxtva'], 2, $mysoc,$object->thirdparty); $remise_percent=GETPOST('remise_percent'); - $result=$object->updateline(GETPOST('lineid'), $label, $pu, GETPOST('tauxtva'), $localtax1tx, $localtax2tx, GETPOST('qty'), GETPOST('idprod'), $price_base_type, 0, $type, $remise_percent); + $result=$object->updateline(GETPOST('lineid'), $label, $pu, GETPOST('tauxtva'), $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('idprod'), $price_base_type, 0, $type, $remise_percent); if ($result >= 0) { unset($_POST['label']); @@ -626,13 +637,13 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) $tvatx=get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, $_POST['idprodfournprice']); $npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, $_POST['idprodfournprice']); - $localtax1tx= get_localtax($tvatx, 1, $mysoc,$object->thirdparty); - $localtax2tx= get_localtax($tvatx, 2, $mysoc,$object->thirdparty); + $localtax1_tx= get_localtax($tvatx, 1, $mysoc,$object->thirdparty); + $localtax2_tx= get_localtax($tvatx, 2, $mysoc,$object->thirdparty); $type = $productsupplier->type; // TODO Save the product supplier ref into database into field ref_supplier (must rename field ref into ref_supplier first) - $result=$object->addline($desc, $productsupplier->fourn_pu, $tvatx, $localtax1tx, $localtax2tx, $qty, $idprod, $remise_percent, '', '', 0, $npr); + $result=$object->addline($desc, $productsupplier->fourn_pu, $tvatx, $localtax1_tx, $localtax2_tx, $qty, $idprod, $remise_percent, '', '', 0, $npr); } if ($idprod == -2 || $idprod == 0) { @@ -688,24 +699,23 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) { $db->commit(); - // Define output language - $outputlangs = $langs; - $newlang=GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result < 0) dol_print_error($db,$result); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - $result=supplier_invoice_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result <= 0) - { - dol_print_error($db,$result); - exit; - } - } unset($_POST ['prod_entry_mode']); @@ -769,20 +779,23 @@ elseif ($action == 'edit' && $user->rights->fournisseur->facture->creer) { $object->set_draft($user); - $outputlangs = $langs; - if (! empty($_REQUEST['lang_id'])) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($_REQUEST['lang_id']); - } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { - $result=supplier_invoice_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result <= 0) - { - dol_print_error($db,$result); - exit; - } - } + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result < 0) dol_print_error($db,$result); + } $action=''; } @@ -892,12 +905,13 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P if (dol_strlen($_POST['subject'])) $subject=$_POST['subject']; else $subject = $langs->transnoentities('CustomerOrder').' '.$object->ref; $actiontypecode='AC_SUP_INV'; - $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; + $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; if ($message) { - $actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n"; - $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; - $actionmsg.=$message; + if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); + $actionmsg = dol_concatdesc($actionmsg, $message); } $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); } @@ -1016,7 +1030,7 @@ elseif ($action == 'builddoc') $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - $result=supplier_invoice_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + $result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db,$result); @@ -1053,6 +1067,45 @@ elseif ($action == 'remove_file') } } +elseif ($action == 'update_extras') +{ + // Fill array 'array_options' with data from add form + $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + + if($ret < 0) $error++; + + if (!$error) + { + // Actions on extra fields (by external module or standard code) + // FIXME le hook fait double emploi avec le trigger !! + $hookmanager->initHooks(array('supplierinvoicedao')); + $parameters=array('id'=>$object->id); + + $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks + + if (empty($reshook)) + { + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + + $result=$object->insertExtraFields(); + + if ($result < 0) + { + $error++; + } + + } + } + else if ($reshook < 0) $error++; + } + else + { + $action = 'edit_extras'; + } +} + if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->fournisseur->facture->creer) { if ($action == 'addcontact') @@ -1128,6 +1181,9 @@ llxHeader('','',''); // Mode creation if ($action == 'create') { + $facturestatic = new FactureFournisseur($db); + $extralabels = $extrafields->fetch_name_optionals_label($facturestatic->table_element); + print_fiche_titre($langs->trans('NewBill')); dol_htmloutput_events(); @@ -1368,6 +1424,11 @@ if ($action == 'create') print ''; // print ''; print ''; + + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $object->showOptionals($extrafields, 'edit'); + } if (is_object($objectsrc)) { @@ -1438,7 +1499,7 @@ if ($action == 'create') // Bouton "Create Draft" print "
    '.$langs->trans("Email").''.$langs->trans("Phone").'
    '.img_object($langs->trans("ShowContact"),"contact").' '.$obj->lastname.''.img_object($langs->trans("ShowContact"),"contact").' '.$obj->lastname.''.$obj->firstname.''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.''.$obj->email.''.$obj->phone.'
    \n"; - print '
    '; + print '
    '; print "\n"; @@ -1479,6 +1540,9 @@ else $societe = new Fournisseur($db); $result=$societe->fetch($object->socid); if ($result < 0) dol_print_error($db); + + // fetch optionals attributes and labels + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); /* * View card @@ -1699,7 +1763,7 @@ else $objp = $db->fetch_object($result); $var=!$var; print ''; - print ''.img_object($langs->trans('ShowPayment'),'payment').' '.dol_print_date($db->jdate($objp->dp),'day')."\n"; + print ''.img_object($langs->trans('ShowPayment'),'payment').' '.dol_print_date($db->jdate($objp->dp),'day')."\n"; print ''; print $form->form_modes_reglement(null, $objp->paiement_type,'none').' '.$objp->num_paiement; print ''; @@ -1883,9 +1947,9 @@ else print ''; } - // Other options - $parameters=array('colspan' => ' colspan="4"'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + // Other attributes + $cols = 4; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; print ''; @@ -2244,21 +2308,24 @@ else */ $somethingshown=$object->showLinkedObjectBlock(); + $linktoelem=''; + if (empty($somethingshown) && ! empty($conf->fournisseur->enabled)) { - print '
    ' . $langs->trans('LinkedOrder') . ''; + $linktoelem.=($linktoelem?'   ':'').'' . $langs->trans('LinkedOrder') . ''; print ' '; - print '
    '; //print ''; //print '
    '; @@ -2348,7 +2418,7 @@ else // Build document if it not exists if (! $file || ! is_readable($file)) { - $result=supplier_invoice_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + $result = $object->generateDocument(GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db,$result); diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index d47433af4f5..c7219c6e415 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -168,30 +168,6 @@ if ($object->id > 0) print $form->editfieldval("Label",'label',$object->label,$object,0); print ''; - // Status - $alreadypaid=$object->getSommePaiement(); - print ''.$langs->trans('Status').''.$object->getLibStatut(4,$alreadypaid).''; - - // Amount - print ''.$langs->trans('AmountHT').''.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).''; - print ''.$langs->trans('AmountVAT').''.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).''; - - // Amount Local Taxes - //TODO: Place into a function to control showing by country or study better option - if ($societe->localtax1_assuj=="1") //Localtax1 - { - print ''.$langs->transcountry("AmountLT1",$societe->country_code).''; - print ''.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).''; - print ' '; - } - if ($societe->localtax2_assuj=="1") //Localtax2 - { - print ''.$langs->transcountry("AmountLT2",$societe->country_code).''; - print ''.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).''; - print ''; - } - print ''.$langs->trans('AmountTTC').''.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).''; - print '
    '; print ''; diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php index 4b2c61c02a5..83d4b830c5f 100644 --- a/htdocs/fourn/facture/impayees.php +++ b/htdocs/fourn/facture/impayees.php @@ -47,6 +47,31 @@ if ($user->societe_id > 0) $socid = $user->societe_id; } +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); + +$search_ref = GETPOST('search_ref','alpha'); +$search_ref_supplier = GETPOST('search_ref_supplier','alpha'); +$search_company = GETPOST('search_company','alpha'); +$search_amount_no_tax = GETPOST('search_amount_no_tax','alpha'); +$search_amount_all_tax = GETPOST('search_amount_all_tax','alpha'); + +$page = GETPOST("page",'int'); +if ($page == -1) { $page = 0; } +$offset = $conf->liste_limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortfield) $sortfield="f.date_lim_reglement"; +if (! $sortorder) $sortorder="ASC"; + +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_ref=""; + $search_ref_supplier=""; + $search_company=""; + $search_amount_no_tax=""; + $search_amount_all_tax=""; +} /* * View @@ -61,34 +86,9 @@ $title=$langs->trans("BillsSuppliersUnpaid"); $facturestatic=new FactureFournisseur($db); $companystatic=new Societe($db); - -/*************************************************************************** -* * -* Mode Liste * -* * -***************************************************************************/ - -$sortfield = GETPOST("sortfield",'alpha'); -$sortorder = GETPOST("sortorder",'alpha'); - -$search_ref = GETPOST('search_ref','alpha'); -$search_ref_supplier = GETPOST('search_ref_supplier','alpha'); -$search_societe = GETPOST('search_societe','alpha'); -$search_montant_ht = GETPOST('search_montant_ht','int'); -$search_montant_ttc = GETPOST('search_montant_ttc','int'); - - -$page = GETPOST("page",'int'); -if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; -if (! $sortfield) $sortfield="f.date_lim_reglement"; -if (! $sortorder) $sortorder="ASC"; - if ($user->rights->fournisseur->facture->lire) { - $sql = "SELECT s.rowid as socid, s.nom,"; + $sql = "SELECT s.rowid as socid, s.nom as name,"; $sql.= " f.rowid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc,"; $sql.= " f.datef as df, f.date_lim_reglement as datelimite, "; $sql.= " f.paye as paye, f.rowid as facid, f.fk_statut"; @@ -117,26 +117,26 @@ if ($user->rights->fournisseur->facture->lire) if ($search_ref) { - $sql .= " AND f.rowid LIKE '%".$search_ref."%'"; + $sql .= " AND f.ref LIKE '%".$search_ref."%'"; } if ($search_ref_supplier) { $sql .= " AND f.ref_supplier LIKE '%".$search_ref_supplier."%'"; } - if ($search_societe) + if ($search_company) { - $sql .= " AND s.nom LIKE '%".$search_societe."%'"; + $sql .= " AND s.nom LIKE '%".$search_company."%'"; } - if ($search_montant_ht) + if ($search_amount_no_tax) { - $sql .= " AND f.total_ht = '".$search_montant_ht."'"; + $sql .= " AND f.total_ht = '".$search_amount_no_tax."'"; } - if ($search_montant_ttc) + if ($search_amount_all_tax) { - $sql .= " AND f.total_ttc = '".$search_montant_ttc."'"; + $sql .= " AND f.total_ttc = '".$search_amount_all_tax."'"; } if (dol_strlen(GETPOST('sf_re')) > 0) @@ -144,7 +144,7 @@ if ($user->rights->fournisseur->facture->lire) $sql .= " AND f.ref_supplier LIKE '%".GETPOST('sf_re')."%'"; } - $sql.= " GROUP BY s.rowid, s.nom, f.rowid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc, f.datef, f.date_lim_reglement, f.paye, f.fk_statut, s.rowid, s.nom"; + $sql.= " GROUP BY s.rowid, s.nom, f.rowid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc, f.datef, f.date_lim_reglement, f.paye, f.fk_statut"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.=$db->order($sortfield,$sortorder); if (! in_array("f.ref_supplier",explode(',',$sortfield))) $sql.= ", f.ref_supplier DESC"; @@ -165,15 +165,15 @@ if ($user->rights->fournisseur->facture->lire) if ($search_ref) $param.='&search_ref='.urlencode($search_ref); if ($search_ref_supplier) $param.='&search_ref_supplier='.urlencode($search_ref_supplier); - if ($search_societe) $param.='&search_societe='.urlencode($search_societe); - if ($search_montant_ht) $param.='&search_montant_ht='.urlencode($search_montant_ht); - if ($search_montant_ttc) $param.='&search_montant_ttc='.urlencode($search_montant_ttc); + if ($search_company) $param.='&search_company='.urlencode($search_company); + if ($search_amount_no_tax) $param.='&search_amount_no_tax='.urlencode($search_amount_no_tax); + if ($search_amount_all_tax) $param.='&search_amount_all_tax='.urlencode($search_amount_all_tax); $param.=($option?"&option=".$option:""); if (! empty($late)) $param.='&late='.urlencode($late); $urlsource=str_replace('&','&',$param); - $titre=($socid?$langs->trans("BillsSuppliersUnpaidForCompany",$soc->nom):$langs->trans("BillsSuppliersUnpaid")); + $titre=($socid?$langs->trans("BillsSuppliersUnpaidForCompany",$soc->name):$langs->trans("BillsSuppliersUnpaid")); if ($option == 'late') $titre.=' ('.$langs->trans("Late").')'; else $titre.=' ('.$langs->trans("All").')'; @@ -209,15 +209,15 @@ if ($user->rights->fournisseur->facture->lire) print ''; print ''; print ''; - print "\n"; + print ''; + print "\n"; if ($num > 0) { @@ -241,7 +241,7 @@ if ($user->rights->fournisseur->facture->lire) print $facturestatic->getNomUrl(1); print "\n"; - print '\n"; + print ''; print '\n"; print ''; @@ -258,7 +258,7 @@ if ($user->rights->fournisseur->facture->lire) print ""; print ""; - // Affiche statut de la facture + // Show invoice status print ''; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 673ac3fea6f..2a01602eadc 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; if (!$user->rights->fournisseur->facture->lire) accessforbidden(); @@ -63,9 +64,28 @@ $pagenext = $page + 1; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="fac.datef,fac.rowid"; -$month = GETPOST('month','int'); -$year = GETPOST('year','int'); +$search_ref = GETPOST("search_ref","int"); +$search_ref_supplier = GETPOST("search_ref_supplier","alpha"); +$search_label = GETPOST("search_label","alpha"); +$search_company = GETPOST("search_company","alpha"); +$search_amount_no_tax = GETPOST("search_amount_no_tax","alpha"); +$search_amount_all_tax = GETPOST("search_amount_all_tax","alpha"); +$month = GETPOST("month","int"); +$year = GETPOST("year","int"); +$filter = GETPOST("filtre"); +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers +{ + $search_ref=""; + $search_ref_supplier=""; + $search_label=""; + $search_company=""; + $search_amount_no_tax=""; + $search_amount_all_tax=""; + $year=""; + $month=""; + $filter=""; +} /* * Actions @@ -92,9 +112,6 @@ if ($mode == 'search') } } - - - /* * View */ @@ -106,11 +123,13 @@ $formfile = new FormFile($db); llxHeader('',$langs->trans("SuppliersInvoices"),'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores'); -$sql = "SELECT s.rowid as socid, s.nom, "; +$sql = "SELECT s.rowid as socid, s.nom as name, "; $sql.= " fac.rowid as facid, fac.ref, fac.ref_supplier, fac.datef, fac.date_lim_reglement as date_echeance,"; $sql.= " fac.total_ht, fac.total_ttc, fac.paye as paye, fac.fk_statut as fk_statut, fac.libelle"; +if (! empty($conf->global->PROJECT_SHOW_REF_INTO_LISTS)) $sql.=", p.rowid as project_id, p.ref as project_ref"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as fac"; +if (! empty($conf->global->PROJECT_SHOW_REF_INTO_LISTS)) $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = fac.fk_projet"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE fac.entity = ".$conf->entity; $sql.= " AND fac.fk_soc = s.rowid"; @@ -119,9 +138,9 @@ if ($socid) { $sql .= " AND s.rowid = ".$socid; } -if (GETPOST('filtre') && GETPOST('filtre') != -1) // GETPOST('filtre') may be a string +if ($filter && $filter != -1) // GETPOST('filtre') may be a string { - $filtrearr = explode(",", GETPOST('filtre')); + $filtrearr = explode(",", $filter); foreach ($filtrearr as $fil) { $filt = explode(":", $fil); @@ -129,14 +148,14 @@ if (GETPOST('filtre') && GETPOST('filtre') != -1) // GETPOST('filtre') may be a } } -if (GETPOST("search_ref")) +if ($search_ref) { - if (is_numeric(GETPOST("search_ref"))) $sql .= natural_search(array('fac.rowid', 'fac.ref'), GETPOST('search_ref'));// For backward compatibility - else $sql .= natural_search('fac.ref', GETPOST("search_ref")); + if (is_numeric($search_ref)) $sql .= natural_search(array('fac.ref'), $search_ref); + else $sql .= natural_search('fac.ref', $search_ref); } -if (GETPOST("search_ref_supplier")) +if (search_ref_supplier) { - $sql .= natural_search('fac.ref_supplier', GETPOST('search_ref_supplier')); + $sql .= natural_search('fac.ref_supplier', $search_ref_supplier); } if ($month > 0) { @@ -149,24 +168,24 @@ else if ($year > 0) { $sql.= " AND fac.datef BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } -if (GETPOST("search_libelle")) +if ($search_label) { - $sql .= natural_search('fac.libelle', GETPOST('search_libelle')); + $sql .= natural_search('fac.libelle', $search_label); } -if (GETPOST("search_societe")) +if ($search_company) { - $sql .= natural_search('s.nom', GETPOST('search_societe')); + $sql .= natural_search('s.nom', $search_company); } -if (GETPOST("search_montant_ht")) +if ($search_amount_no_tax) { - $sql .= " AND fac.total_ht = '".$db->escape(price2num(GETPOST("search_montant_ht")))."'"; + $sql .= " AND fac.total_ht = '".$db->escape(price2num($search_amount_no_tax))."'"; } -if (GETPOST("search_montant_ttc")) +if ($search_amount_all_tax) { - $sql .= " AND fac.total_ttc = '".$db->escape(price2num(GETPOST("search_montant_ttc")))."'"; + $sql .= " AND fac.total_ttc = '".$db->escape(price2num($search_amount_all_tax))."'"; } $nbtotalofrecords = 0; @@ -192,17 +211,17 @@ if ($resql) } $param='&socid='.$socid; - if ($month) $param.='&month='.urlencode($month); - if ($year) $param.='&year=' .urlencode($year); - if (GETPOST("search_ref")) $param.='&search_ref='.urlencode(GETPOST("search_ref")); - if (GETPOST("search_ref_supplier")) $param.='&search_ref_supplier'.urlencode(GETPOST("search_ref_supplier")); - if (GETPOST("search_libelle")) $param.='&search_libelle='.urlencode(GETPOST("search_libelle")); - if (GETPOST("search_societe")) $param.='&search_societe='.urlencode(GETPOST("search_societe")); - if (GETPOST("search_montant_ht")) $param.='&search_montant_ht='.urlencode(GETPOST("search_montant_ht")); - if (GETPOST("search_montant_ttc")) $param.='&search_montant_ttc='.urlencode(GETPOST("search_montant_ttc")); - if (GETPOST("filtre") && GETPOST('filtre') != -1) $param.='&filtre='.urlencode(GETPOST("filtre")); + if ($month) $param.='&month='.urlencode($month); + if ($year) $param.='&year=' .urlencode($year); + if ($search_ref) $param.='&search_ref='.urlencode($search_ref); + if ($search_ref_supplier) $param.='&search_ref_supplier'.urlencode($search_ref_supplier); + if ($search_label) $param.='&search_label='.urlencode($search_label); + if ($search_company) $param.='&search_company='.urlencode($search_company); + if ($search_amount_no_tax) $param.='&search_amount_no_tax='.urlencode($search_amount_no_tax); + if ($search_amount_all_tax) $param.='&search_amount_all_tax='.urlencode($search_amount_all_tax); + if ($filter && $filter != -1) $param.='&filtre='.urlencode($filter); - print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->nom":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); + print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print ''; print '
      '; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; - print '
    '.dol_trunc($objp->ref_supplier,12)."'.dol_trunc($objp->ref_supplier,12).''.dol_print_date($db->jdate($objp->df),'day')."'.dol_print_date($db->jdate($objp->datelimite),'day'); @@ -250,7 +250,7 @@ if ($user->rights->fournisseur->facture->lire) print ''; $companystatic->id=$objp->socid; - $companystatic->nom=$objp->nom; + $companystatic->name=$objp->name; print $companystatic->getNomUrl(1,'supplier',32); print '".price($objp->total_ttc)."".price($objp->am)."'; print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$objp->am); print '
    '; print ''; @@ -212,19 +231,21 @@ if ($resql) print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"fac.date_lim_reglement","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"fac.libelle","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); + if (! empty($conf->global->PROJECT_SHOW_REF_INTO_LISTS)) print_liste_field_titre($langs->trans("Project"),$_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"fac.total_ht","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"fac.total_ttc","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye","",$param,'align="right"',$sortfield,$sortorder); + print ''; print "\n"; // Lignes des champs de filtre print ''; print ''; print ''; print ''; print ''; print ''; print ''; + if (! empty($conf->global->PROJECT_SHOW_REF_INTO_LISTS)) + { + print ''; + } + print ''; print "\n"; $facturestatic=new FactureFournisseur($db); $supplierstatic=new Fournisseur($db); + $projectstatic=new Project($db); $var=true; $total=0; @@ -279,8 +309,17 @@ if ($resql) print ''; print ''; + if (! empty($conf->global->PROJECT_SHOW_REF_INTO_LISTS)) + { + $projectstatic->id=$obj->project_id; + $projectstatic->ref=$obj->project_ref; + print ''; + } print ''; print ''; $total+=$obj->total_ht; @@ -293,6 +332,8 @@ if ($resql) print $facturestatic->LibStatut($obj->paye,$obj->fk_statut,5); print ''; + print ''; + print "\n"; $i++; @@ -301,9 +342,11 @@ if ($resql) // Print total print ''; print ''; + if (! empty($conf->global->PROJECT_SHOW_REF_INTO_LISTS)) print ''; print ''; print ''; print ''; + print ''; print "\n"; } } diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index a93ac142e9a..afd914546a6 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -68,10 +68,13 @@ $hookmanager->initHooks(array('paymentsupplier')); $parameters=array('socid'=>$socid); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + /* * Actions */ + if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes')) { $error = 0; @@ -213,8 +216,8 @@ if ($action == 'confirm_paiement' && $confirm == 'yes') else $invoiceid=$facid; } } - if ($invoiceid > 0) $loc = DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$invoiceid; - else $loc = DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$paiement_id; + if ($invoiceid > 0) $loc = DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$invoiceid; + else $loc = DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$paiement_id; header('Location: '.$loc); exit; } @@ -246,7 +249,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $datefacture=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $dateinvoice=($datefacture==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datefacture); - $sql = 'SELECT s.nom, s.rowid as socid,'; + $sql = 'SELECT s.nom as name, s.rowid as socid,'; $sql.= ' f.rowid, f.ref, f.ref_supplier, f.amount, f.total_ttc as total'; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'facture_fourn as f'; @@ -271,14 +274,14 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print ''; print ''; - print ''; + print ''; print '
     
    '; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; @@ -235,23 +256,32 @@ if ($resql) print ' '; - print ''; + print ''; print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; - print ''; - $liststatus=array('paye:0'=>$langs->trans("Unpayed"), 'paye:1'=>$langs->trans("Payed")); - print $form->selectarray('filtre', $liststatus, GETPOST('filtre'), 1); - print ''; + $liststatus=array('paye:0'=>$langs->trans("Unpaid"), 'paye:1'=>$langs->trans("Paid")); + print $form->selectarray('filtre', $liststatus, $filter, 1); + print ''; + print ''; + print ''; print '
    '.dol_trunc($obj->libelle,36).''; $supplierstatic->id=$obj->socid; - $supplierstatic->nom=$obj->nom; + $supplierstatic->name=$obj->name; print $supplierstatic->getNomUrl(1,'',12); + print ''; + if ($obj->project_id > 0) print $projectstatic->getNomUrl(1); + print ''.price($obj->total_ht).''.price($obj->total_ttc).' 
    '.$langs->trans("Total").''.price($total).''.price($total_ttc).'  
    '; print ''; print ''; print '"; - print "\n"; + print "rowid\">$objp->ref\n"; print ""; print "'."\n"; - $companystatic->nom=$objp->nom; + $companystatic->name=$objp->name; $companystatic->id=$objp->socid; print '"; print "\n"; - print "\n"; + print "\n"; print ''; print '\n"; @@ -149,7 +149,7 @@ if ($socid > 0) print '\n"; // Author - print ''; + print ''; print "\n"; @@ -176,7 +176,7 @@ if ($socid > 0) print '\n"; print ''; + print ''.img_object($langs->trans("ShowPayment"),"payment").' '.$langs->trans("Payment").' '.$objp->rowid.''; print "\n"; print "\n"; print ''; @@ -184,7 +184,7 @@ if ($socid > 0) print '\n"; // Auteur - print ''; + print ''; print ''; diff --git a/htdocs/ftp/admin/ftpclient.php b/htdocs/ftp/admin/ftpclient.php index 1b252c480af..91d6aef388b 100644 --- a/htdocs/ftp/admin/ftpclient.php +++ b/htdocs/ftp/admin/ftpclient.php @@ -198,7 +198,8 @@ else print '
    '.$langs->trans('Payment').'
    '.$langs->trans('Company').''; $supplierstatic->id=$obj->socid; - $supplierstatic->name=$obj->nom; + $supplierstatic->name=$obj->name; print $supplierstatic->getNomUrl(1,'supplier'); print '
    '.$langs->trans('Date').''; @@ -414,8 +417,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Bouton Enregistrer if ($action != 'add_paiement') { - print '

    '.$langs->trans("ClosePaidInvoicesAutomatically"); - print '
    '; + print '<
    '.$langs->trans("ClosePaidInvoicesAutomatically"); + print '
    '; } // Form to confirm payment @@ -455,9 +458,18 @@ if (empty($action)) $search_paymenttype=GETPOST('search_paymenttype'); $search_amount=GETPOST('search_amount'); $search_company=GETPOST('search_company'); + + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers + { + $search_ref=""; + $search_account=""; + $search_paymenttype=""; + $search_amount=""; + $search_company=""; + } $sql = 'SELECT p.rowid as pid, p.datep as dp, p.amount as pamount, p.num_paiement,'; - $sql.= ' s.rowid as socid, s.nom,'; + $sql.= ' s.rowid as socid, s.nom as name,'; $sql.= ' c.libelle as paiement_type,'; $sql.= ' ba.rowid as bid, ba.label,'; if (!$user->rights->societe->client->voir) $sql .= ' sc.fk_soc, sc.fk_user,'; @@ -491,7 +503,7 @@ if (empty($action)) } if (! empty($search_amount)) { - $sql .= " AND p.amount=".price2num($search_amount); + $sql .= " AND p.amount='".price2num($search_amount)."'"; } if (! empty($search_company)) { @@ -512,30 +524,31 @@ if (empty($action)) $paramlist=''; $paramlist.=(! empty($search_ref)?"&search_ref=".$search_ref:""); $paramlist.=(! empty($search_company)?"&search_company=".$search_company:""); - $paramlist.=(! empty($search_amount)?"&search_amount=".$search_amount:""); + $paramlist.=(! empty($search_amount)?"&search_amount='".$search_amount:""); - print_barre_liste($langs->trans('SupplierPayments'), $page, 'paiement.php',$paramlist,$sortfield,$sortorder,'',$num); + print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num); print ''; print ''; print ''; - print_liste_field_titre($langs->trans('RefPayment'),'paiement.php','p.rowid','',$paramlist,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Date'),'paiement.php','dp','',$paramlist,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('ThirdParty'),'paiement.php','s.nom','',$paramlist,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Type'),'paiement.php','c.libelle','',$paramlist,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Account'),'paiement.php','ba.label','',$paramlist,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Amount'),'paiement.php','f.amount','',$paramlist,'align="right"',$sortfield,$sortorder); - //print_liste_field_titre($langs->trans('Invoice'),'paiement.php','ref_supplier','',$paramlist,'',$sortfield,$sortorder); - print "\n"; + print_liste_field_titre($langs->trans('RefPayment'),$_SERVER["PHP_SELF"],'p.rowid','',$paramlist,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'dp','',$paramlist,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('ThirdParty'),$_SERVER["PHP_SELF"],'s.nom','',$paramlist,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Type'),$_SERVER["PHP_SELF"],'c.libelle','',$paramlist,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Account'),$_SERVER["PHP_SELF"],'ba.label','',$paramlist,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Amount'),$_SERVER["PHP_SELF"],'p.amount','',$paramlist,'align="right"',$sortfield,$sortorder); + //print_liste_field_titre($langs->trans('Invoice'),$_SERVER["PHP_SELF"],'ref_supplier','',$paramlist,'',$sortfield,$sortorder); + print ''; + print "\n"; // Lines for filters fields print ''; print ''; print ''; print ''; print ''; print ''; + print ''; + print ''; print "\n"; while ($i < min($num,$limit)) @@ -556,13 +571,13 @@ if (empty($action)) print ''; // Ref payment - print ''; + print ''; // Date print '\n"; print ''; @@ -581,7 +596,8 @@ if (empty($action)) print '';*/ - + + print ''; print ''; $i++; } diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php index c10fea8bb8a..a6d9164a91c 100644 --- a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php @@ -32,6 +32,7 @@ echo '
    '; if ($num > 1) print_titre($langs->trans("RelatedBills")); else print_titre($langs->trans("RelatedBill")); ?> +
     
    '; - print ''; + print ''; print ' '; - print ''; + print ''; print ''; $form->select_types_paiements($search_paymenttype,'search_paymenttype','',2,1,1); @@ -544,9 +557,11 @@ if (empty($action)) $form->select_comptes($search_account,'search_account',0,'',1); print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print '
    '.img_object($langs->trans('ShowPayment'),'payment').' '.$objp->pid.''.img_object($langs->trans('ShowPayment'),'payment').' '.$objp->pid.''.dol_print_date($db->jdate($objp->dp),'day')."'; - if ($objp->socid) print ''.img_object($langs->trans('ShowCompany'),'company').' '.dol_trunc($objp->nom,32).''; + if ($objp->socid) print ''.img_object($langs->trans('ShowCompany'),'company').' '.dol_trunc($objp->name,32).''; else print ' '; print ''; print $invoicesupplierstatic->getNomUrl(1); print ' 
    @@ -46,7 +47,7 @@ foreach($linkedObjectBlock as $object) $var=!$var; ?> > + trans("ShowBill"),"bill").' '.$object->ref; ?>"; print ''; print ''; - print ''; + print ''; print "\n"; $i++; @@ -106,8 +106,8 @@ if (! empty($conf->fournisseur->enabled)) { $langs->load("orders"); - $sql = "SELECT cf.rowid, cf.ref, cf.total_ttc"; - $sql.= ", s.nom, s.rowid as socid"; + $sql = "SELECT cf.rowid, cf.ref, cf.total_ttc,"; + $sql.= " s.nom as name, s.rowid as socid"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; @@ -141,7 +141,7 @@ if (! empty($conf->fournisseur->enabled)) print ''; print ''; @@ -164,7 +164,7 @@ if (! empty($conf->fournisseur->enabled)) if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) { $sql = "SELECT ff.ref_supplier, ff.rowid, ff.total_ttc, ff.type"; - $sql.= ", s.nom, s.rowid as socid"; + $sql.= ", s.nom as name, s.rowid as socid"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; @@ -199,7 +199,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- print ''; print ''; @@ -233,7 +233,7 @@ print '
    '; * List last modified supliers */ $max=10; -$sql = "SELECT s.rowid as socid, s.nom, s.town, s.datec, s.tms, s.prefix_comm, s.code_fournisseur, s.code_compta_fournisseur"; +$sql = "SELECT s.rowid as socid, s.nom as name, s.town, s.datec, s.tms, s.prefix_comm, s.code_fournisseur, s.code_compta_fournisseur"; $sql.= ", st.libelle as stcomm"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st"; @@ -266,8 +266,8 @@ if ($resql) $var=!$var; print "
    "; - print '\n"; + print '\n"; print ''; print ''; print "\n"; diff --git a/htdocs/fourn/liste.php b/htdocs/fourn/list.php similarity index 73% rename from htdocs/fourn/liste.php rename to htdocs/fourn/list.php index 341f3ffca54..b0d7caf8695 100644 --- a/htdocs/fourn/liste.php +++ b/htdocs/fourn/list.php @@ -20,7 +20,7 @@ */ /** - * \file htdocs/fourn/liste.php + * \file htdocs/fourn/list.php * \ingroup fournisseur * \brief Home page of supplier area */ @@ -32,15 +32,15 @@ $langs->load("suppliers"); $langs->load("orders"); $langs->load("companies"); -$socname = GETPOST("socname"); -$search_nom = GETPOST("search_nom"); -$search_zipcode = GETPOST("search_zipcode"); -$search_town = GETPOST("search_town"); -$search_code_fournisseur = GETPOST("search_code_fournisseur"); -$search_compta_fournisseur = GETPOST("search_compta_fournisseur"); -$search_datec = GETPOST("search_datec"); -$search_categ = GETPOST('search_categ','int'); -$catid = GETPOST("catid",'int'); +$socname = GETPOST("socname"); +$search_name = GETPOST("search_name"); +$search_zipcode = GETPOST("search_zipcode"); +$search_town = GETPOST("search_town"); +$search_supplier_code = GETPOST("search_supplier_code"); +$search_supplier_accounting = GETPOST("search_supplier_accounting"); +$search_datec = GETPOST("search_datec"); +$search_categ = GETPOST('search_categ','int'); +$catid = GETPOST("catid",'int'); // Security check $socid = GETPOST('socid','int'); @@ -60,12 +60,26 @@ if (! $sortfield) $sortfield="nom"; // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('supplierlist')); +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $socname=""; + $search_name=""; + $search_zipcode=""; + $search_town=""; + $search_supplier_code=""; + $search_supplier_accounting=""; + $search_datec=""; + $search_categ=""; + $catid=""; +} + /* * Actions */ $parameters=array(); $reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); /* @@ -78,7 +92,7 @@ $thirdpartystatic=new Societe($db); $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('',$langs->trans("ThirdParty"),$help_url); -$sql = "SELECT s.rowid as socid, s.nom, s.zip, s.town, s.datec, st.libelle as stcomm, s.prefix_comm, s.status as status, "; +$sql = "SELECT s.rowid as socid, s.nom as name, s.zip, s.town, s.datec, st.libelle as stcomm, s.prefix_comm, s.status as status, "; $sql.= "code_fournisseur, code_compta_fournisseur"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; @@ -94,15 +108,15 @@ if ($socname) { $sortfield = "s.nom"; $sortorder = "ASC"; } -if ($search_nom) { - $sql .= natural_search('s.nom', $search_nom); +if ($search_name) { + $sql .= natural_search('s.nom', $search_name); } if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'"; if ($search_town) { $sql .= natural_search('s.town', $search_town); } -if ($search_code_fournisseur) $sql .= " AND s.code_fournisseur LIKE '%".$db->escape($search_code_fournisseur)."%'"; -if ($search_compta_fournisseur) $sql .= " AND s.code_compta_fournisseur LIKE '%".$db->escape($search_compta_fournisseur)."%'"; +if ($search_supplier_code) $sql .= " AND s.code_fournisseur LIKE '%".$db->escape($search_supplier_code)."%'"; +if ($search_supplier_accounting) $sql .= " AND s.code_compta_fournisseur LIKE '%".$db->escape($search_supplier_accounting)."%'"; if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'"; if ($catid > 0) $sql.= " AND cf.fk_categorie = ".$catid; if ($catid == -2) $sql.= " AND cf.fk_categorie IS NULL"; @@ -118,14 +132,14 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($conf->liste_limit+1, $offset); -dol_syslog('fourn/liste.php:', LOG_DEBUG); +dol_syslog('fourn/list.php:', LOG_DEBUG); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; - $param = "&search_nom=".$search_nom."&search_code_fournisseur=".$search_code_fournisseur."&search_zipcode=".$search_zipcode."&search_town=".$search_town; + $param = "&search_name=".$search_name."&search_supplier_code=".$search_supplier_code."&search_zipcode=".$search_zipcode."&search_town=".$search_town; if ($search_categ != '') $param.='&search_categ='.$search_categ; print_barre_liste($langs->trans("ListOfSuppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); @@ -165,26 +179,28 @@ if ($resql) print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; print ''; print ''; print ''; - print ''; - + print '\n"; + $parameters=array(); $formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook @@ -198,7 +214,7 @@ if ($resql) $var=!$var; $thirdpartystatic->id=$obj->socid; - $thirdpartystatic->nom=$obj->nom; + $thirdpartystatic->name=$obj->name; $thirdpartystatic->status=$obj->status; print ""; diff --git a/htdocs/fourn/paiement/fiche.php b/htdocs/fourn/paiement/card.php similarity index 94% rename from htdocs/fourn/paiement/fiche.php rename to htdocs/fourn/paiement/card.php index f5f7114ada5..179e810d182 100644 --- a/htdocs/fourn/paiement/fiche.php +++ b/htdocs/fourn/paiement/card.php @@ -19,10 +19,10 @@ */ /** - * \file htdocs/fourn/paiement/fiche.php + * \file htdocs/fourn/paiement/card.php * \ingroup facture, fournisseur * \brief Tab to show a payment of a supplier invoice - * \remarks Fichier presque identique a compta/paiement/fiche.php + * \remarks Fichier presque identique a compta/paiement/card.php */ require '../../main.inc.php'; @@ -107,7 +107,7 @@ if ($action == 'setnum_paiement' && ! empty($_POST['num_paiement'])) $res = $object->update_num($_POST['num_paiement']); if ($res === 0) { - $setEventMessage($langs->trans('PaymentNumberUpdateSucceeded')); + setEventMessage($langs->trans('PaymentNumberUpdateSucceeded')); } else { @@ -234,7 +234,7 @@ if ($result > 0) * Liste des factures */ $allow_delete = 1 ; - $sql = 'SELECT f.rowid, f.ref, f.ref_supplier, f.total_ttc, pf.amount, f.rowid as facid, f.paye, f.fk_statut, s.nom, s.rowid as socid'; + $sql = 'SELECT f.rowid, f.ref, f.ref_supplier, f.total_ttc, pf.amount, f.rowid as facid, f.paye, f.fk_statut, s.nom as name, s.rowid as socid'; $sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf,'.MAIN_DB_PREFIX.'facture_fourn as f,'.MAIN_DB_PREFIX.'societe as s'; $sql .= ' WHERE pf.fk_facturefourn = f.rowid AND f.fk_soc = s.rowid'; $sql .= ' AND pf.fk_paiementfourn = '.$object->id; @@ -268,13 +268,13 @@ if ($result > 0) $var=!$var; print ''; // Ref - print '\n"; // Ref supplier print '\n"; // Third party - print ''; + print ''; // Expected to pay print ''; // Status diff --git a/htdocs/fourn/paiement/info.php b/htdocs/fourn/paiement/info.php index 5e3ea3f18f6..409b567959a 100644 --- a/htdocs/fourn/paiement/info.php +++ b/htdocs/fourn/paiement/info.php @@ -52,6 +52,6 @@ print '
    trans("Ref"); ?>
    - trans("ShowBill"),"bill").' '.$object->ref; ?> date,'day'); ?> rights->fournisseur->facture->lire) { diff --git a/htdocs/fourn/index.php b/htdocs/fourn/index.php index bfdf1b1ce45..9da28281779 100644 --- a/htdocs/fourn/index.php +++ b/htdocs/fourn/index.php @@ -86,7 +86,7 @@ if ($resql) print "
    '.$langs->trans($commande->statuts[$row[1]]).''.$row[0].''.$commande->LibStatut($row[1],3).''.$commande->LibStatut($row[1],3).'
    '; $companystatic->id=$obj->socid; - $companystatic->nom=$obj->nom; + $companystatic->name=$obj->name; $companystatic->client=0; print $companystatic->getNomUrl(1,'',16); print ''; $companystatic->id=$obj->socid; - $companystatic->nom=$obj->nom; + $companystatic->name=$obj->name; $companystatic->client=0; print $companystatic->getNomUrl(1,'',16); print '
    '.img_object($langs->trans("ShowSupplier"),"company").''; - print " socid."\">".$obj->nom."'.img_object($langs->trans("ShowSupplier"),"company").''; + print " socid."\">".$obj->name."'.$obj->code_fournisseur.' '.dol_print_date($db->jdate($obj->tms),'day').'
    '; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; + print ''; + print "
    '.img_object($langs->trans('ShowBill'),'bill').' '; + print ''.img_object($langs->trans('ShowBill'),'bill').' '; print ($objp->ref?$objp->ref:$objp->rowid); print "'.$objp->ref_supplier."'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.''.img_object($langs->trans('ShowCompany'),'company').' '.$objp->name.''.price($objp->total_ttc).'
    '; print ''; -$db->close(); - llxFooter(); + +$db->close(); diff --git a/htdocs/fourn/product/categorie.php b/htdocs/fourn/product/categorie.php index b2d353046df..448cf19e61e 100644 --- a/htdocs/fourn/product/categorie.php +++ b/htdocs/fourn/product/categorie.php @@ -72,7 +72,7 @@ if ($_GET["id"]) $h=0; - $head[$h][0] = DOL_URL_ROOT."/fourn/product/fiche.php?id=".$product->id; + $head[$h][0] = DOL_URL_ROOT."/fourn/product/card.php?id=".$product->id; $head[$h][1] = $langs->trans("Card"); $h++; @@ -95,7 +95,7 @@ if ($_GET["id"]) $head[$h][1] = $langs->trans("Photos"); $h++; - $head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id; + $head[$h][0] = DOL_URL_ROOT."/product/stats/card.php?id=".$product->id; $head[$h][1] = $langs->trans('Statistics'); $h++; diff --git a/htdocs/fourn/product/index.php b/htdocs/fourn/product/index.php index 14f4790f5af..28e84e30f6a 100644 --- a/htdocs/fourn/product/index.php +++ b/htdocs/fourn/product/index.php @@ -43,7 +43,7 @@ print '
    '; /* * Zone recherche produit/service */ -print ''; +print ''; print ''; print ''; print "\n"; @@ -81,13 +81,13 @@ print '"; - print ''; + print ''; print ""; } if (! empty($conf->service->enabled)) { print ""; - print ''; + print ''; print ""; } print '
    '.$langs->trans("Statistics").'product->enabled)) { print "
    '.$langs->trans("Products").''.round($prodser[0]).''.$langs->trans("Products").''.round($prodser[0]).'
    '.$langs->trans("Services").''.round($prodser[1]).''.$langs->trans("Services").''.round($prodser[1]).'
    '; @@ -125,10 +125,10 @@ if ($resql) $objp = $db->fetch_object($resql); $var=!$var; print "
    rowid\">"; + print "rowid\">"; if ($objp->fk_product_type==1) print img_object($langs->trans("ShowService"),"service"); else print img_object($langs->trans("ShowProduct"),"product"); - print " rowid\">$objp->ref $objp->label"; if ($objp->fk_product_type==1) print $langs->trans('ShowService'); diff --git a/htdocs/fourn/product/liste.php b/htdocs/fourn/product/list.php similarity index 91% rename from htdocs/fourn/product/liste.php rename to htdocs/fourn/product/list.php index c8911837a40..afaf4c8e796 100644 --- a/htdocs/fourn/product/liste.php +++ b/htdocs/fourn/product/list.php @@ -21,7 +21,7 @@ */ /** - * \file htdocs/fourn/product/liste.php + * \file htdocs/fourn/product/list.php * \ingroup produit * \brief Page liste des produits ou services */ @@ -88,7 +88,7 @@ if ($fourn_id) $sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type,"; $sql.= " ppf.fk_soc, ppf.ref_fourn, ppf.price as price, ppf.quantity as qty, ppf.unitprice,"; -$sql.= " s.rowid as socid, s.nom"; +$sql.= " s.rowid as socid, s.nom as name"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; if ($catid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as ppf ON p.rowid = ppf.fk_product"; @@ -108,7 +108,7 @@ if ($sref) } if ($snom) { - $sql .= natural_search('p.label', $snom); + $sql .= natural_search('s.nom', $snom); } if($catid) { @@ -118,10 +118,17 @@ if ($fourn_id > 0) { $sql .= " AND ppf.fk_soc = ".$fourn_id; } +// Count total nb of records without orderby and limit +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} $sql .= " ORDER BY ".$sortfield." ".$sortorder; $sql .= $db->plimit($limit + 1, $offset); -dol_syslog("fourn/product/liste.php:", LOG_DEBUG); +dol_syslog("fourn/product/list.php:", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -132,25 +139,25 @@ if ($resql) if ($num == 1 && (GETPOST("mode") == 'search')) { $objp = $db->fetch_object($resql); - header("Location: ".DOL_URL_ROOT."/product/fiche.php?id=".$objp->rowid); + header("Location: ".DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); exit; } - if (! empty($supplier->id)) $texte = $langs->trans("ListOfSupplierProductForSupplier",$supplier->nom); + if (! empty($supplier->id)) $texte = $langs->trans("ListOfSupplierProductForSupplier",$supplier->name); else $texte = $langs->trans("List"); llxHeader("","",$texte); $param="&tobuy=".$tobuy."&sref=".$sref."&snom=".$snom."&fourn_id=".$fourn_id.(isset($type)?"&type=".$type:"").(empty($sRefSupplier)?"":"&srefsupplier=".$sRefSupplier); - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); if (isset($catid)) { print "
    "; $c = new Categorie($db); - $ways = $c->print_all_ways(' > ','fourn/product/liste.php'); + $ways = $c->print_all_ways(' > ','fourn/product/list.php'); print " > ".$ways[0]."
    \n"; print "

    "; } @@ -212,7 +219,7 @@ if ($resql) print '
    '.$objp->label.''; if ($companystatic->id > 0) print $companystatic->getNomUrl(1,'supplier'); diff --git a/htdocs/fourn/product/photos.php b/htdocs/fourn/product/photos.php index d60a4aab4d0..f20c360de6c 100644 --- a/htdocs/fourn/product/photos.php +++ b/htdocs/fourn/product/photos.php @@ -65,7 +65,7 @@ if ($id) $h=0; - $head[$h][0] = DOL_URL_ROOT."/fourn/product/fiche.php?id=".$object->id; + $head[$h][0] = DOL_URL_ROOT."/fourn/product/card.php?id=".$object->id; $head[$h][1] = $langs->trans("Card"); $h++; @@ -89,7 +89,7 @@ if ($id) $h++; } - $head[$h][0] = DOL_URL_ROOT."/product/fiche.php?id=".$object->id; + $head[$h][0] = DOL_URL_ROOT."/product/card.php?id=".$object->id; $head[$h][1] = $langs->trans("CommercialCard"); $h++; diff --git a/htdocs/fourn/recap-fourn.php b/htdocs/fourn/recap-fourn.php index 3d3fd9f2dcb..c09f52b8407 100644 --- a/htdocs/fourn/recap-fourn.php +++ b/htdocs/fourn/recap-fourn.php @@ -139,7 +139,7 @@ if ($socid > 0) print "
    ".dol_print_date($fac->date)."id\">".img_object($langs->trans("ShowBill"),"bill")." ".$fac->ref."id\">".img_object($langs->trans("ShowBill"),"bill")." ".$fac->ref."'.$fac->getLibStatut(2,$totalpaye).''.price($fac->total_ttc)."'.price($solde)."'.img_object($langs->trans("ShowUser"),'user').' '.$objf->login.''.img_object($langs->trans("ShowUser"),'user').' '.$objf->login.'
    '.dol_print_date($db->jdate($objp->dp))."'; print '      '; // Decalage - print ''.img_object($langs->trans("ShowPayment"),"payment").' '.$langs->trans("Payment").' '.$objp->rowid.'  '.price($objp->amount).''.price($solde)."'.img_object($langs->trans("ShowUser"),'user').' '.$objp->login.''.img_object($langs->trans("ShowUser"),'user').' '.$objp->login.'
    '; - ?>
    ">
    + ?> +
    ">
    $date_fin) { - header('Location: fiche.php?action=request&error=datefin'); + header('Location: card.php?action=request&error=datefin'); exit; } @@ -106,7 +106,7 @@ if ($action == 'create') $verifCP = $cp->verifDateHolidayCP($userID, $date_debut, $date_fin, $halfday); if (! $verifCP) { - header('Location: fiche.php?action=request&error=alreadyCP'); + header('Location: card.php?action=request&error=alreadyCP'); exit; } @@ -114,14 +114,14 @@ if ($action == 'create') $nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday); if($nbopenedday < 0.5) { - header('Location: fiche.php?action=request&error=DureeHoliday'); + header('Location: card.php?action=request&error=DureeHoliday'); exit; } // Si pas de validateur choisi if ($valideur < 1) { - header('Location: fiche.php?action=request&error=Valideur'); + header('Location: card.php?action=request&error=Valideur'); exit; } @@ -137,13 +137,13 @@ if ($action == 'create') // Si pas d'erreur SQL on redirige vers la fiche de la demande if ($verif > 0) { - header('Location: fiche.php?id='.$verif); + header('Location: card.php?id='.$verif); exit; } else { // Sinon on affiche le formulaire de demande avec le message d'erreur SQL - header('Location: fiche.php?action=request&error=SQL_Create&msg='.$cp->error); + header('Location: card.php?action=request&error=SQL_Create&msg='.$cp->error); exit; } } @@ -165,7 +165,7 @@ if ($action == 'update') // Si pas le droit de modifier une demande if (! $user->rights->holiday->write) { - header('Location: fiche.php?action=request&error=CantUpdate'); + header('Location: card.php?action=request&error=CantUpdate'); exit; } @@ -185,25 +185,25 @@ if ($action == 'update') // Si pas de date de début if (empty($_POST['date_debut_'])) { - header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=nodatedebut'); + header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=nodatedebut'); exit; } // Si pas de date de fin if (empty($_POST['date_fin_'])) { - header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=nodatefin'); + header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=nodatefin'); exit; } // Si date de début après la date de fin if ($date_debut > $date_fin) { - header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=datefin'); + header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=datefin'); exit; } // Si pas de valideur choisi if ($valideur < 1) { - header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=Valideur'); + header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=Valideur'); exit; } @@ -211,7 +211,7 @@ if ($action == 'update') $nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday); if ($nbopenedday < 0.5) { - header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=DureeHoliday'); + header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=DureeHoliday'); exit; } @@ -225,18 +225,18 @@ if ($action == 'update') $verif = $cp->update($user->id); if ($verif > 0) { - header('Location: fiche.php?id='.$_POST['holiday_id']); + header('Location: card.php?id='.$_POST['holiday_id']); exit; } else { // Sinon on affiche le formulaire de demande avec le message d'erreur SQL - header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=SQL_Create&msg='.$cp->error); + header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=SQL_Create&msg='.$cp->error); exit; } } } else { - header('Location: fiche.php?id='.$_POST['holiday_id']); + header('Location: card.php?id='.$_POST['holiday_id']); exit; } } @@ -305,7 +305,7 @@ if ($action == 'confirm_send') if (!$emailTo) { - header('Location: fiche.php?id='.$_GET['id']); + header('Location: card.php?id='.$_GET['id']); exit; } @@ -354,7 +354,7 @@ if ($action == 'confirm_send') $message.= "\n"; $message.= "- ".$langs->transnoentitiesnoconv("Name")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; $message.= "- ".$langs->transnoentitiesnoconv("Period")." : ".dol_print_date($cp->date_debut,'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($cp->date_fin,'day')."\n"; - $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/fiche.php?id=".$cp->rowid."\n\n"; + $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$cp->rowid."\n\n"; $message.= "\n"; $mail = new CMailFile($subject,$emailTo,$emailFrom,$message); @@ -364,16 +364,16 @@ if ($action == 'confirm_send') if (!$result) { - header('Location: fiche.php?id='.$_GET['id'].'&error=mail&error_content='.$mail->error); + header('Location: card.php?id='.$_GET['id'].'&error=mail&error_content='.$mail->error); exit; } - header('Location: fiche.php?id='.$_GET['id']); + header('Location: card.php?id='.$_GET['id']); exit; } else { // Sinon on affiche le formulaire de demande avec le message d'erreur SQL - header('Location: fiche.php?id='.$_GET['id'].'&error=SQL_Create&msg='.$cp->error); + header('Location: card.php?id='.$_GET['id'].'&error=SQL_Create&msg='.$cp->error); exit; } } @@ -417,7 +417,7 @@ if($action == 'confirm_valid') if (!$emailTo) { - header('Location: fiche.php?id='.$_GET['id']); + header('Location: card.php?id='.$_GET['id']); exit; } @@ -439,7 +439,7 @@ if($action == 'confirm_valid') $message.= "- ".$langs->transnoentitiesnoconv("ValidatedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; - $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/fiche.php?id=".$cp->rowid."\n\n"; + $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$cp->rowid."\n\n"; $message.= "\n"; $mail = new CMailFile($subject,$emailTo,$emailFrom,$message); @@ -448,15 +448,15 @@ if($action == 'confirm_valid') $result=$mail->sendfile(); if(!$result) { - header('Location: fiche.php?id='.$_GET['id'].'&error=mail&error_content='.$mail->error); + header('Location: card.php?id='.$_GET['id'].'&error=mail&error_content='.$mail->error); exit; } - header('Location: fiche.php?id='.$_GET['id']); + header('Location: card.php?id='.$_GET['id']); exit; } else { // Sinon on affiche le formulaire de demande avec le message d'erreur SQL - header('Location: fiche.php?id='.$_GET['id'].'&error=SQL_Create&msg='.$cp->error); + header('Location: card.php?id='.$_GET['id'].'&error=SQL_Create&msg='.$cp->error); exit; } @@ -491,7 +491,7 @@ if ($action == 'confirm_refuse') if (!$emailTo) { - header('Location: fiche.php?id='.$_GET['id']); + header('Location: card.php?id='.$_GET['id']); exit; } @@ -514,7 +514,7 @@ if ($action == 'confirm_refuse') $message.= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; - $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/fiche.php?id=".$cp->rowid."\n\n"; + $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$cp->rowid."\n\n"; $message.= "\n"; $mail = new CMailFile($subject,$emailTo,$emailFrom,$message); @@ -523,22 +523,22 @@ if ($action == 'confirm_refuse') $result=$mail->sendfile(); if(!$result) { - header('Location: fiche.php?id='.$_GET['id'].'&error=mail&error_content='.$mail->error); + header('Location: card.php?id='.$_GET['id'].'&error=mail&error_content='.$mail->error); exit; } - header('Location: fiche.php?id='.$_GET['id']); + header('Location: card.php?id='.$_GET['id']); exit; } else { // Sinon on affiche le formulaire de demande avec le message d'erreur SQL - header('Location: fiche.php?id='.$_GET['id'].'&error=SQL_Create&msg='.$cp->error); + header('Location: card.php?id='.$_GET['id'].'&error=SQL_Create&msg='.$cp->error); exit; } } } else { - header('Location: fiche.php?id='.$_GET['id'].'&error=NoMotifRefuse'); + header('Location: card.php?id='.$_GET['id'].'&error=NoMotifRefuse'); exit; } } @@ -600,7 +600,7 @@ if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes') if (!$emailTo) { - header('Location: fiche.php?id='.$_GET['id']); + header('Location: card.php?id='.$_GET['id']); exit; } @@ -622,7 +622,7 @@ if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes') $message.= $langs->transnoentities("HolidaysCanceledBody", dol_print_date($cp->date_debut,'day'), dol_print_date($cp->date_fin,'day'))."\n"; $message.= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; - $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/fiche.php?id=".$cp->rowid."\n\n"; + $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$cp->rowid."\n\n"; $message.= "\n"; $mail = new CMailFile($subject,$emailTo,$emailFrom,$message); @@ -632,17 +632,17 @@ if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes') if(!$result) { - header('Location: fiche.php?id='.$_GET['id'].'&error=mail&error_content='.$mail->error); + header('Location: card.php?id='.$_GET['id'].'&error=mail&error_content='.$mail->error); exit; } - header('Location: fiche.php?id='.$_GET['id']); + header('Location: card.php?id='.$_GET['id']); exit; } else { // Sinon on affiche le formulaire de demande avec le message d'erreur SQL - header('Location: fiche.php?id='.$_GET['id'].'&error=SQL_Create&msg='.$cp->error); + header('Location: card.php?id='.$_GET['id'].'&error=SQL_Create&msg='.$cp->error); exit; } @@ -761,7 +761,6 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create print ''; } else print $form->select_users(GETPOST('userid')?GETPOST('userid'):$user->id,'userid',0,'',0); - //var_dump($cp->getConfCP('nbHolidayDeducted')); $nb_holiday = $cp->getCPforUser($user->id) / $cp->getConfCP('nbHolidayDeducted'); print '   '.$langs->trans('SoldeCPUser', round($nb_holiday,2)).''; print ''; @@ -823,11 +822,11 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create print '
    '; print ''."\n"; - print '
    '; + print '
    '; print ''; print '    '; print ''; - print '
    '; + print '
    '; } } @@ -901,33 +900,33 @@ else { if($user->rights->holiday->delete) { - print $form->formconfirm("fiche.php?id=".$id,$langs->trans("TitleDeleteCP"),$langs->trans("ConfirmDeleteCP"),"confirm_delete", '', 0, 1); + print $form->formconfirm("card.php?id=".$id,$langs->trans("TitleDeleteCP"),$langs->trans("ConfirmDeleteCP"),"confirm_delete", '', 0, 1); } } // Si envoi en validation if ($action == 'sendToValidate' && $cp->statut == 1 && $user->id == $cp->fk_user) { - print $form->formconfirm("fiche.php?id=".$id,$langs->trans("TitleToValidCP"),$langs->trans("ConfirmToValidCP"),"confirm_send", '', 1, 1); + print $form->formconfirm("card.php?id=".$id,$langs->trans("TitleToValidCP"),$langs->trans("ConfirmToValidCP"),"confirm_send", '', 1, 1); } // Si validation de la demande if ($action == 'valid') { - print $form->formconfirm("fiche.php?id=".$id,$langs->trans("TitleValidCP"),$langs->trans("ConfirmValidCP"),"confirm_valid", '', 1, 1); + print $form->formconfirm("card.php?id=".$id,$langs->trans("TitleValidCP"),$langs->trans("ConfirmValidCP"),"confirm_valid", '', 1, 1); } // Si refus de la demande if ($action == 'refuse') { $array_input = array(array('type'=>"text",'label'=> $langs->trans('DetailRefusCP'),'name'=>"detail_refuse",'size'=>"50",'value'=>"")); - print $form->formconfirm("fiche.php?id=".$id."&action=confirm_refuse", $langs->trans("TitleRefuseCP"), $langs->trans('ConfirmRefuseCP'), "confirm_refuse", $array_input, 1, 0); + print $form->formconfirm("card.php?id=".$id."&action=confirm_refuse", $langs->trans("TitleRefuseCP"), $langs->trans('ConfirmRefuseCP'), "confirm_refuse", $array_input, 1, 0); } // Si annulation de la demande if ($action == 'cancel') { - print $form->formconfirm("fiche.php?id=".$id,$langs->trans("TitleCancelCP"),$langs->trans("ConfirmCancelCP"),"confirm_cancel", '', 1, 1); + print $form->formconfirm("card.php?id=".$id,$langs->trans("TitleCancelCP"),$langs->trans("ConfirmCancelCP"),"confirm_cancel", '', 1, 1); } $head=holiday_prepare_head($cp); @@ -1126,26 +1125,26 @@ else // Boutons d'actions if ($canedit && $cp->statut == 1) { - print ''.$langs->trans("EditCP").''; + print ''.$langs->trans("EditCP").''; } if ($canedit && $cp->statut == 1) { - print ''.$langs->trans("Validate").''; + print ''.$langs->trans("Validate").''; } if ($user->rights->holiday->delete && $cp->statut == 1) // If draft { - print ''.$langs->trans("DeleteCP").''; + print ''.$langs->trans("DeleteCP").''; } if ($user->id == $cp->fk_validator && $cp->statut == 2) { - print ''.$langs->trans("Approve").''; - print ''.$langs->trans("ActionRefuseCP").''; + print ''.$langs->trans("Approve").''; + print ''.$langs->trans("ActionRefuseCP").''; } if (($user->id == $cp->fk_validator || $user->id == $cp->fk_user) && ($cp->statut == 2 || $cp->statut == 3)) // Status validated or approved { - if (($cp->date_debut > dol_now()) || $user->admin) print ''.$langs->trans("ActionCancelCP").''; + if (($cp->date_debut > dol_now()) || $user->admin) print ''.$langs->trans("ActionCancelCP").''; else print ''.$langs->trans("ActionCancelCP").''; } diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index b88547729c1..1a3e9f7ecd3 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -470,7 +470,7 @@ class Holiday extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; $error=0; @@ -655,21 +655,21 @@ class Holiday extends CommonObject */ function getNomUrl($withpicto=0) { - global $langs; + global $langs; - $result=''; + $result=''; - $lien = ''; - $lienfin=''; + $lien = ''; + $lienfin=''; - $picto='holiday'; + $picto='holiday'; - $label=$langs->trans("Show").': '.$this->ref; + $label=$langs->trans("Show").': '.$this->ref; - if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); - if ($withpicto && $withpicto != 2) $result.=' '; - if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; - return $result; + if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); + if ($withpicto && $withpicto != 2) $result.=' '; + if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; + return $result; } @@ -780,7 +780,7 @@ class Holiday extends CommonObject $groupe = $objet->value; // On liste les groupes de Dolibarr - $sql = "SELECT u.rowid, u.nom"; + $sql = "SELECT u.rowid, u.nom as name"; $sql.= " FROM ".MAIN_DB_PREFIX."usergroup as u"; $sql.= " ORDER BY u.rowid"; @@ -798,9 +798,9 @@ class Holiday extends CommonObject while ($obj = $this->db->fetch_object($result)) { if($groupe==$obj->rowid) { - $selectGroup.= ''."\n"; + $selectGroup.= ''."\n"; } else { - $selectGroup.= ''."\n"; + $selectGroup.= ''."\n"; } } $selectGroup.= ''."\n"; @@ -820,7 +820,7 @@ class Holiday extends CommonObject /** * Met à jour une option du module Holiday Payés * - * @param string $name nom du paramètre de configuration + * @param string $name name du paramètre de configuration * @param string $value vrai si mise à jour OK sinon faux * @return boolean ok or ko */ @@ -842,7 +842,7 @@ class Holiday extends CommonObject /** * Retourne la valeur d'un paramètre de configuration * - * @param string $name nom du paramètre de configuration + * @param string $name name du paramètre de configuration * @return string retourne la valeur du paramètre */ function getConfCP($name) @@ -955,7 +955,7 @@ class Holiday extends CommonObject /** * Retourne un checked si vrai * - * @param string $name nom du paramètre de configuration + * @param string $name name du paramètre de configuration * @return string retourne checked si > 0 */ function getCheckOption($name) { @@ -1045,7 +1045,8 @@ class Holiday extends CommonObject $result = $this->db->query($sql); if($result) { $obj = $this->db->fetch_object($result); - return number_format($obj->nb_holiday,2); + //return number_format($obj->nb_holiday,2); + return $obj->nb_holiday; } else { return '0'; } diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 62e8fc698c9..fa3f745de81 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -144,17 +144,14 @@ if($cp_events == 1) print '
    '; } -dol_fiche_head(); - print '
    '."\n"; print ''; print ''; print ""; -print ''; -print ''; +print ''; print ''; print ''; -print ''; +print ''; print ''; foreach($listUsers as $users) @@ -163,7 +160,6 @@ foreach($listUsers as $users) $var=!$var; print ''; - print ''; print '
    '.$langs->trans('ID').''.$langs->trans('Employee').''.$langs->trans('Employee').''.$langs->trans('Available').''.$langs->trans('Note').''.$langs->trans('UpdateButtonCP').'
    '.$users['rowid'].''; $userstatic->id=$users['rowid']; $userstatic->lastname=$users['name']; @@ -183,8 +179,6 @@ foreach($listUsers as $users) print '
    '; print '
    '; -dol_fiche_end(); - llxFooter(); $db->close(); diff --git a/htdocs/holiday/index.php b/htdocs/holiday/index.php index 26f413a4e43..86c4eca49eb 100644 --- a/htdocs/holiday/index.php +++ b/htdocs/holiday/index.php @@ -64,6 +64,19 @@ $search_employe = GETPOST('search_employe'); $search_valideur = GETPOST('search_valideur'); $search_statut = GETPOST('select_statut'); +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_ref=""; + $month_create=""; + $year_create=""; + $month_start=""; + $year_start=""; + $month_end=""; + $year_end=""; + $search_employe=""; + $search_valideur=""; + $search_statut=""; +} /* * Actions @@ -71,8 +84,6 @@ $search_statut = GETPOST('select_statut'); // None - - /* * View */ @@ -257,7 +268,7 @@ print_liste_field_titre($langs->trans("Employe"),$_SERVER["PHP_SELF"],"cp.fk_use print_liste_field_titre($langs->trans("ValidatorCP"),$_SERVER["PHP_SELF"],"cp.fk_validator","",'','',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateDebCP"),$_SERVER["PHP_SELF"],"cp.date_debut","",'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateFinCP"),$_SERVER["PHP_SELF"],"cp.date_fin","",'','align="center"',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("Duration")); +print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],'','','','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cp.statut","",'','align="center"',$sortfield,$sortorder); print ''; print "\n"; @@ -323,7 +334,8 @@ print ''; // ACTION print ''; -print ''; +print ''; +print ''; print ''; print "\n"; @@ -386,7 +398,7 @@ if ($user_id == $user->id) { print '
    '; print ''; } diff --git a/htdocs/holiday/tomergewithdefine_holiday.php b/htdocs/holiday/tomergewithdefine_holiday.php old mode 100755 new mode 100644 index 4bf904528a0..46dde3028a4 --- a/htdocs/holiday/tomergewithdefine_holiday.php +++ b/htdocs/holiday/tomergewithdefine_holiday.php @@ -46,7 +46,7 @@ llxHeader(array(),$langs->trans('CPTitreMenu')); print_fiche_titre($langs->trans('MenuConfCP')); -$congespayes = new Holidays($db); +$congespayes = new Holiday($db); $listUsers = $congespayes->fetchUsers(false, true); // Si il y a une action de mise à jour diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index 58a1bf3e931..b846d158227 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -22,8 +22,7 @@ */ /** - * \class Import - * \brief Class to manage imports + * Class to manage imports */ class Import { @@ -313,10 +312,12 @@ class Import { if (! $notrigger) { + /* Not used. This is not a business object. To convert it we must herit from CommonObject // Call trigger $result=$this->call_trigger('IMPORT_DELETE',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers + */ } } diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 0b4856fab61..9314059fb03 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -1278,7 +1278,7 @@ if ($step == 5 && $datatoimport) print '
    '; // Actions - print '
    '; + print '
    '; if ($user->rights->import->run) { print ''.$langs->trans("RunSimulateImportFile").''; @@ -1287,7 +1287,7 @@ if ($step == 5 && $datatoimport) { print ''.$langs->trans("RunSimulateImportFile").''; } - print '
    '; + print '
    '; } else { @@ -1401,15 +1401,15 @@ if ($step == 5 && $datatoimport) // Show import id $importid=dol_print_date(dol_now(),'%Y%m%d%H%M%S'); - print '
    '; + print '
    '; print $langs->trans("NowClickToRunTheImport",$langs->transnoentitiesnoconv("RunImportFile")).'
    '; print $langs->trans("DataLoadedWithId",$importid).'
    '; - print '
    '; + print '
    '; print '
    '; // Actions - print '
    '; + print '
    '; if ($user->rights->import->run) { if (empty($nboferrors)) @@ -1429,7 +1429,7 @@ if ($step == 5 && $datatoimport) print ''.$langs->trans("RunImportFile").''; } - print '
    '; + print ''; } } @@ -1664,12 +1664,12 @@ if ($step == 6 && $datatoimport) // Show result - print '
    '; print '
    '; + print '
    '; print $langs->trans("NbOfLinesImported",$nbok).'

    '; print $langs->trans("FileWasImported",$importid).'
    '; print $langs->trans("YouCanUseImportIdToFindRecord",$importid).'
    '; - print '
    '; + print ''; } @@ -1751,8 +1751,8 @@ function show_elem($fieldssource,$pos,$key,$var,$nostyle='') /** * Return not used field number * - * @param array &$fieldssource Array of field source - * @param array &$listofkey Array of keys + * @param array $fieldssource Array of field source + * @param array $listofkey Array of keys * @return void */ function getnewkey(&$fieldssource,&$listofkey) diff --git a/htdocs/imports/index.php b/htdocs/imports/index.php index 2ccb92e1970..ada73d97559 100644 --- a/htdocs/imports/index.php +++ b/htdocs/imports/index.php @@ -85,7 +85,7 @@ else print ''; print '
    '; -print '
    '; +print '
    '; if (count($import->array_import_code)) { //if ($user->rights->import->run) @@ -97,7 +97,7 @@ if (count($import->array_import_code)) // print ''.$langs->trans("NewImport").''; //} } -print '
    '; +print ''; print '
    '; diff --git a/htdocs/includes/evalmath/README.md b/htdocs/includes/evalmath/README.md new file mode 100755 index 00000000000..6011e3fb676 --- /dev/null +++ b/htdocs/includes/evalmath/README.md @@ -0,0 +1,11 @@ +evalmath.class.php +================== + +Version 1.0 + +Taken from http://www.phpclasses.org/browse/file/11680.html, cred to Miles Kaufmann + +This repository is cloned for two reasons: + +1. To allow downloading the code without signing in to phpclasses.org. +2. To add very small improvements to the code. diff --git a/htdocs/includes/evalmath/evalmath.class.php b/htdocs/includes/evalmath/evalmath.class.php new file mode 100755 index 00000000000..bd1755b0a20 --- /dev/null +++ b/htdocs/includes/evalmath/evalmath.class.php @@ -0,0 +1,393 @@ + + +================================================================================ + +NAME + EvalMath - safely evaluate math expressions + +SYNOPSIS + include('evalmath.class.php'); + $m = new EvalMath; + // basic evaluation: + $result = $m->evaluate('2+2'); + // supports: order of operation; parentheses; negation; built-in functions + $result = $m->evaluate('-8(5/2)^2*(1-sqrt(4))-8'); + // create your own variables + $m->evaluate('a = e^(ln(pi))'); + // or functions + $m->evaluate('f(x,y) = x^2 + y^2 - 2x*y + 1'); + // and then use them + $result = $m->evaluate('3*f(42,a)'); + +DESCRIPTION + Use the EvalMath class when you want to evaluate mathematical expressions + from untrusted sources. You can define your own variables and functions, + which are stored in the object. Try it, it's fun! + +METHODS + $m->evalute($expr) + Evaluates the expression and returns the result. If an error occurs, + prints a warning and returns false. If $expr is a function assignment, + returns true on success. + + $m->e($expr) + A synonym for $m->evaluate(). + + $m->vars() + Returns an associative array of all user-defined variables and values. + + $m->funcs() + Returns an array of all user-defined functions. + +PARAMETERS + $m->suppress_errors + Set to true to turn off warnings when evaluating expressions + + $m->last_error + If the last evaluation failed, contains a string describing the error. + (Useful when suppress_errors is on). + + $m->last_error_code + If the last evaluation failed, 2 element array with numeric code and extra info + +AUTHOR INFORMATION + Copyright 2005, Miles Kaufmann. + +LICENSE + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + 1 Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +class EvalMath { + + var $suppress_errors = false; + var $last_error = null; + var $last_error_code = null; + + var $v = array('e'=>2.71,'pi'=>3.14); // variables (and constants) + var $f = array(); // user-defined functions + var $vb = array('e', 'pi'); // constants + var $fb = array( // built-in functions + 'sin','sinh','arcsin','asin','arcsinh','asinh', + 'cos','cosh','arccos','acos','arccosh','acosh', + 'tan','tanh','arctan','atan','arctanh','atanh', + 'sqrt','abs','ln','log'); + + function EvalMath() { + // make the variables a little more accurate + $this->v['pi'] = pi(); + $this->v['e'] = exp(1); + } + + function e($expr) { + return $this->evaluate($expr); + } + + function evaluate($expr) { + $this->last_error = null; + $this->last_error_code = null; + $expr = trim($expr); + if (substr($expr, -1, 1) == ';') $expr = substr($expr, 0, strlen($expr)-1); // strip semicolons at the end + //=============== + // is it a variable assignment? + if (preg_match('/^\s*([a-z]\w*)\s*=\s*(.+)$/', $expr, $matches)) { + if (in_array($matches[1], $this->vb)) { // make sure we're not assigning to a constant + return $this->trigger(1, "cannot assign to constant '$matches[1]'", $matches[1]); + } + if (($tmp = $this->pfx($this->nfx($matches[2]))) === false) return false; // get the result and make sure it's good + $this->v[$matches[1]] = $tmp; // if so, stick it in the variable array + return $this->v[$matches[1]]; // and return the resulting value + //=============== + // is it a function assignment? + } elseif (preg_match('/^\s*([a-z]\w*)\s*\(\s*([a-z]\w*(?:\s*,\s*[a-z]\w*)*)\s*\)\s*=\s*(.+)$/', $expr, $matches)) { + $fnn = $matches[1]; // get the function name + if (in_array($matches[1], $this->fb)) { // make sure it isn't built in + return $this->trigger(2, "cannot redefine built-in function '$matches[1]()'", $matches[1]); + } + $args = explode(",", preg_replace("/\s+/", "", $matches[2])); // get the arguments + if (($stack = $this->nfx($matches[3])) === false) return false; // see if it can be converted to postfix + for ($i = 0; $iv)) { + $stack[$i] = $this->v[$token]; + } else { + return $this->trigger(3, "undefined variable '$token' in function definition", $token); + } + } + } + $this->f[$fnn] = array('args'=>$args, 'func'=>$stack); + return true; + //=============== + } else { + return $this->pfx($this->nfx($expr)); // straight up evaluation, woo + } + } + + function vars() { + $output = $this->v; + unset($output['pi']); + unset($output['e']); + return $output; + } + + function funcs() { + $output = array(); + foreach ($this->f as $fnn=>$dat) + $output[] = $fnn . '(' . implode(',', $dat['args']) . ')'; + return $output; + } + + //===================== HERE BE INTERNAL METHODS ====================\\ + + // Convert infix to postfix notation + function nfx($expr) { + + $index = 0; + $stack = new EvalMathStack; + $output = array(); // postfix form of expression, to be passed to pfx() + $expr = trim(strtolower($expr)); + + $ops = array('+', '-', '*', '/', '^', '_'); + $ops_r = array('+'=>0,'-'=>0,'*'=>0,'/'=>0,'^'=>1); // right-associative operator? + $ops_p = array('+'=>0,'-'=>0,'*'=>1,'/'=>1,'_'=>1,'^'=>2); // operator precedence + + $expecting_op = false; // we use this in syntax-checking the expression + // and determining when a - is a negation + + if (preg_match("/[^\w\s+*^\/()\.,-]/", $expr, $matches)) { // make sure the characters are all good + return $this->trigger(4, "illegal character '{$matches[0]}'", $matches[0]); + } + + while(1) { // 1 Infinite Loop ;) + $op = substr($expr, $index, 1); // get the first character at the current index + // find out if we're currently at the beginning of a number/variable/function/parenthesis/operand + $ex = preg_match('/^([a-z]\w*\(?|\d+(?:\.\d*)?|\.\d+|\()/', substr($expr, $index), $match); + //=============== + if ($op == '-' and !$expecting_op) { // is it a negation instead of a minus? + $stack->push('_'); // put a negation on the stack + $index++; + } elseif ($op == '_') { // we have to explicitly deny this, because it's legal on the stack + return $this->trigger(4, "illegal character '_'", "_"); // but not in the input expression + //=============== + } elseif ((in_array($op, $ops) or $ex) and $expecting_op) { // are we putting an operator on the stack? + if ($ex) { // are we expecting an operator but have a number/variable/function/opening parethesis? + $op = '*'; $index--; // it's an implicit multiplication + } + // heart of the algorithm: + while($stack->count > 0 and ($o2 = $stack->last()) and in_array($o2, $ops) and ($ops_r[$op] ? $ops_p[$op] < $ops_p[$o2] : $ops_p[$op] <= $ops_p[$o2])) { + $output[] = $stack->pop(); // pop stuff off the stack into the output + } + // many thanks: http://en.wikipedia.org/wiki/Reverse_Polish_notation#The_algorithm_in_detail + $stack->push($op); // finally put OUR operator onto the stack + $index++; + $expecting_op = false; + //=============== + } elseif ($op == ')' and $expecting_op) { // ready to close a parenthesis? + while (($o2 = $stack->pop()) != '(') { // pop off the stack back to the last ( + if (is_null($o2)) return $this->trigger(5, "unexpected ')'", ")"); + else $output[] = $o2; + } + if (preg_match("/^([a-z]\w*)\($/", $stack->last(2), $matches)) { // did we just close a function? + $fnn = $matches[1]; // get the function name + $arg_count = $stack->pop(); // see how many arguments there were (cleverly stored on the stack, thank you) + $output[] = $stack->pop(); // pop the function and push onto the output + if (in_array($fnn, $this->fb)) { // check the argument count + if($arg_count > 1) + return $this->trigger(6, "wrong number of arguments ($arg_count given, 1 expected)", array($arg_count, 1)); + } elseif (array_key_exists($fnn, $this->f)) { + if ($arg_count != count($this->f[$fnn]['args'])) + return $this->trigger(6, "wrong number of arguments ($arg_count given, " . count($this->f[$fnn]['args']) . " expected)", array($arg_count, count($this->f[$fnn]['args']))); + } else { // did we somehow push a non-function on the stack? this should never happen + return $this->trigger(7, "internal error"); + } + } + $index++; + //=============== + } elseif ($op == ',' and $expecting_op) { // did we just finish a function argument? + while (($o2 = $stack->pop()) != '(') { + if (is_null($o2)) return $this->trigger(5, "unexpected ','", ","); // oops, never had a ( + else $output[] = $o2; // pop the argument expression stuff and push onto the output + } + // make sure there was a function + if (!preg_match("/^([a-z]\w*)\($/", $stack->last(2), $matches)) + return $this->trigger(5, "unexpected ','", ","); + $stack->push($stack->pop()+1); // increment the argument count + $stack->push('('); // put the ( back on, we'll need to pop back to it again + $index++; + $expecting_op = false; + //=============== + } elseif ($op == '(' and !$expecting_op) { + $stack->push('('); // that was easy + $index++; + $allow_neg = true; + //=============== + } elseif ($ex and !$expecting_op) { // do we now have a function/variable/number? + $expecting_op = true; + $val = $match[1]; + if (preg_match("/^([a-z]\w*)\($/", $val, $matches)) { // may be func, or variable w/ implicit multiplication against parentheses... + if (in_array($matches[1], $this->fb) or array_key_exists($matches[1], $this->f)) { // it's a func + $stack->push($val); + $stack->push(1); + $stack->push('('); + $expecting_op = false; + } else { // it's a var w/ implicit multiplication + $val = $matches[1]; + $output[] = $val; + } + } else { // it's a plain old var or num + $output[] = $val; + } + $index += strlen($val); + //=============== + } elseif ($op == ')') { // miscellaneous error checking + return $this->trigger(5, "unexpected ')'", ")"); + } elseif (in_array($op, $ops) and !$expecting_op) { + return $this->trigger(8, "unexpected operator '$op'", $op); + } else { // I don't even want to know what you did to get here + return $this->trigger(9, "an unexpected error occured"); + } + if ($index == strlen($expr)) { + if (in_array($op, $ops)) { // did we end with an operator? bad. + return $this->trigger(10, "operator '$op' lacks operand", $op); + } else { + break; + } + } + while (substr($expr, $index, 1) == ' ') { // step the index past whitespace (pretty much turns whitespace + $index++; // into implicit multiplication if no operator is there) + } + + } + while (!is_null($op = $stack->pop())) { // pop everything off the stack and push onto output + if ($op == '(') return $this->trigger(11, "expecting ')'", ")"); // if there are (s on the stack, ()s were unbalanced + $output[] = $op; + } + return $output; + } + + // evaluate postfix notation + function pfx($tokens, $vars = array()) { + + if ($tokens == false) return false; + + $stack = new EvalMathStack; + + foreach ($tokens as $token) { // nice and easy + // if the token is a binary operator, pop two values off the stack, do the operation, and push the result back on + if (in_array($token, array('+', '-', '*', '/', '^'))) { + if (is_null($op2 = $stack->pop())) return $this->trigger(12, "internal error"); + if (is_null($op1 = $stack->pop())) return $this->trigger(13, "internal error"); + switch ($token) { + case '+': + $stack->push($op1+$op2); break; + case '-': + $stack->push($op1-$op2); break; + case '*': + $stack->push($op1*$op2); break; + case '/': + if ($op2 == 0) return $this->trigger(14, "division by zero"); + $stack->push($op1/$op2); break; + case '^': + $stack->push(pow($op1, $op2)); break; + } + // if the token is a unary operator, pop one value off the stack, do the operation, and push it back on + } elseif ($token == "_") { + $stack->push(-1*$stack->pop()); + // if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on + } elseif (preg_match("/^([a-z]\w*)\($/", $token, $matches)) { // it's a function! + $fnn = $matches[1]; + if (in_array($fnn, $this->fb)) { // built-in function: + if (is_null($op1 = $stack->pop())) return $this->trigger(15, "internal error"); + $fnn = preg_replace("/^arc/", "a", $fnn); // for the 'arc' trig synonyms + if ($fnn == 'ln') $fnn = 'log'; + eval('$stack->push(' . $fnn . '($op1));'); // perfectly safe eval() + } elseif (array_key_exists($fnn, $this->f)) { // user function + // get args + $args = array(); + for ($i = count($this->f[$fnn]['args'])-1; $i >= 0; $i--) { + if (is_null($args[$this->f[$fnn]['args'][$i]] = $stack->pop())) return $this->trigger(16, "internal error"); + } + $stack->push($this->pfx($this->f[$fnn]['func'], $args)); // yay... recursion!!!! + } + // if the token is a number or variable, push it on the stack + } else { + if (is_numeric($token)) { + $stack->push($token); + } elseif (array_key_exists($token, $this->v)) { + $stack->push($this->v[$token]); + } elseif (array_key_exists($token, $vars)) { + $stack->push($vars[$token]); + } else { + return $this->trigger(17, "undefined variable '$token'", $token); + } + } + } + // when we're out of tokens, the stack should have a single element, the final result + if ($stack->count != 1) return $this->trigger(18, "internal error"); + return $stack->pop(); + } + + // trigger an error, but nicely, if need be + function trigger($code, $msg, $info = null) { + $this->last_error = $msg; + $this->last_error_code = array($code, $info); + if (!$this->suppress_errors) trigger_error($msg, E_USER_WARNING); + return false; + } +} + +// for internal use +class EvalMathStack { + + var $stack = array(); + var $count = 0; + + function push($val) { + $this->stack[$this->count] = $val; + $this->count++; + } + + function pop() { + if ($this->count > 0) { + $this->count--; + return $this->stack[$this->count]; + } + return null; + } + + function last($n=1) { + if (isset($this->stack[$this->count-$n])) { + return $this->stack[$this->count-$n]; + } + return; + } +} diff --git a/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt b/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt deleted file mode 100644 index 1076f8b4b2b..00000000000 --- a/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2009 Michael Aufreiter, http://www.quasipartikel.at - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/htdocs/includes/jquery/plugins/multiselect/css/ui.multiselect.css b/htdocs/includes/jquery/plugins/multiselect/css/ui.multiselect.css deleted file mode 100644 index 7d3a44801d2..00000000000 --- a/htdocs/includes/jquery/plugins/multiselect/css/ui.multiselect.css +++ /dev/null @@ -1,31 +0,0 @@ -/* Multiselect -----------------------------------*/ - -.ui-multiselect { border: solid 1px; font-size: 0.8em; } -.ui-multiselect ul { -moz-user-select: none; } -.ui-multiselect li { margin: 0; padding: 0; cursor: default; line-height: 20px; height: 20px; font-size: 11px; list-style: none; padding-right: 18px; overflow: hidden; } -.ui-multiselect li a { color: #999; text-decoration: none; padding: 0; display: block; float: left; cursor: pointer;} -.ui-multiselect li.ui-draggable-dragging { padding-left: 10px; } - -.ui-multiselect div.selected { position: relative; padding: 0; margin: 0; border: 0; float:left; } -.ui-multiselect ul.selected { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; position: relative; width: 100%; } - -.ui-multiselect div.available { position: relative; padding: 0; margin: 0; border: 0; float:left; } -.ui-multiselect ul.available { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; width: 100%; } -.ui-multiselect ul.available li { padding-left: 10px; } - -.ui-multiselect div.right-column { border-left: 1px solid; } - -.ui-multiselect .ui-state-default { border: none; margin-bottom: 1px; position: relative; padding-left: 20px;} -.ui-multiselect .ui-state-hover { border: none; } -.ui-multiselect .ui-widget-header {border: none; font-size: 11px; margin-bottom: 1px;} - -.ui-multiselect .add-all { float: right; padding: 7px;} -.ui-multiselect .remove-all { float: right; padding: 7px;} -.ui-multiselect .search { float: left; padding: 4px;} -.ui-multiselect .count { float: left; padding: 7px;} - -.ui-multiselect li span.ui-icon-arrowthick-2-n-s { position: absolute; left: 2px; } -.ui-multiselect li a.action { position: absolute; right: 2px; top: 2px; } - -.ui-multiselect input.search { height: 14px; padding: 1px; opacity: 0.5; margin: 4px; width: 100px; } \ No newline at end of file diff --git a/htdocs/includes/jquery/plugins/multiselect/js/ui.multiselect.js b/htdocs/includes/jquery/plugins/multiselect/js/ui.multiselect.js deleted file mode 100644 index eb4578fc782..00000000000 --- a/htdocs/includes/jquery/plugins/multiselect/js/ui.multiselect.js +++ /dev/null @@ -1,480 +0,0 @@ -/* - * jQuery UI Multiselect - * - * Authors: - * Michael Aufreiter (quasipartikel.at) - * Yanick Rochon (yanick.rochon[at]gmail[dot]com) - * - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. - * - * http://www.quasipartikel.at/multiselect/ - * - * - * Depends: - * ui.core.js - * ui.sortable.js - * - * Optional: - * localization (http://plugins.jquery.com/project/localisation) - * scrollTo (http://plugins.jquery.com/project/ScrollTo) - * - * Todo: - * Make batch actions faster - * Implement dynamic insertion through remote calls - */ - - -(function($) { - -$.widget("ui.multiselect", { - options: { - sortable: true, - dragToAdd: true, - searchable: true, - doubleClickable: true, - animated: 'fast', - show: 'slideDown', - hide: 'slideUp', - dividerLocation: 0.6, - selectedContainerOnLeft: true, - width: null, - height: null, - nodeComparator: function(node1,node2) { - var text1 = node1.text(), - text2 = node2.text(); - return text1 == text2 ? 0 : (text1 < text2 ? -1 : 1); - }, - includeRemoveAll: true, - includeAddAll: true, - pressEnterKeyToAddAll: false - }, - _create: function() { - this.element.hide(); - this.id = this.element.attr("id"); - this.container = $('
    ').insertAfter(this.element); - this.count = 0; // number of currently selected options - this.selectedContainer = $('
    '); - if (this.options.selectedContainerOnLeft) { - this.selectedContainer.appendTo(this.container); - this.availableContainer = $('
    ').appendTo(this.container); - this.availableContainer.addClass('right-column'); - } - else - { - this.availableContainer = $('
    ').appendTo(this.container); - this.selectedContainer.appendTo(this.container); - this.selectedContainer.addClass('right-column'); - } - this.selectedActions = $('
    0 '+$.ui.multiselect.locale.itemsCount+''+(this.options.includeRemoveAll?''+$.ui.multiselect.locale.removeAll+'':' ')+'
    ').appendTo(this.selectedContainer); - this.availableActions = $('
    '+(this.options.includeAddAll?''+$.ui.multiselect.locale.addAll+'':' ')+'
    ').appendTo(this.availableContainer); - this.selectedList = $('
    ').bind('selectstart', function(){return false;}).appendTo(this.selectedContainer); - this.availableList = $('
    ').bind('selectstart', function(){return false;}).appendTo(this.availableContainer); - - var that = this; - - var width = this.options.width; - if (!width) { - width = this.element.width(); - } - var height = this.options.height; - if (!height) { - height = this.element.height(); - } - - // set dimensions - this.container.width(width-2); - if (this.options.selectedContainerOnLeft) { - this.selectedContainer.width(Math.floor(width*this.options.dividerLocation)-1); - this.availableContainer.width(Math.floor(width*(1-this.options.dividerLocation))-2); - } - else - { - this.selectedContainer.width(Math.floor(width*this.options.dividerLocation)-2); - this.availableContainer.width(Math.floor(width*(1-this.options.dividerLocation))-1); - } - - // fix list height to match
    '."\n"; +print ''."\n"; llxFooter(); diff --git a/htdocs/opensurvey/wizard/index.php b/htdocs/opensurvey/wizard/index.php index db2948a1cd3..3c10c256742 100644 --- a/htdocs/opensurvey/wizard/index.php +++ b/htdocs/opensurvey/wizard/index.php @@ -43,15 +43,15 @@ llxHeader('', $langs->trans("OpenSurvey"), '', "", 0, 0, $arrayofjs, $arrayofcss print_fiche_titre($langs->trans("CreatePoll")); -print '
    -
    '; -print '

    '.$langs->trans("OrganizeYourMeetingEasily").'

    -
    -
    -
    -
    -
    -
    '; +print '
    '; +print '
    '; +print '

    '.$langs->trans("OrganizeYourMeetingEasily").'

    '; +print '
    '; +print '
    '; +print '
    '; +print '
    '; +print '
    '; +print '
    '; llxFooter(); diff --git a/htdocs/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php index 30e02591190..19ce68c750c 100644 --- a/htdocs/paybox/admin/paybox.php +++ b/htdocs/paybox/admin/paybox.php @@ -195,7 +195,7 @@ print ''; -print '
    '; +print '
    '; print '

    '; diff --git a/htdocs/paybox/lib/paybox.lib.php b/htdocs/paybox/lib/paybox.lib.php index 09bacc3764f..a55687db823 100644 --- a/htdocs/paybox/lib/paybox.lib.php +++ b/htdocs/paybox/lib/paybox.lib.php @@ -131,7 +131,7 @@ function print_paybox_redirect($PRICE,$CURRENCY,$EMAIL,$urlok,$urlko,$TAG) $IBS_MODE=1; // Mode formulaire $IBS_PORTEUR=$EMAIL; $IBS_RETOUR="montant:M;ref:R;auto:A;trans:T"; // Format des parametres du get de validation en reponse (url a definir sous paybox) - //$IBS_TXT="
    ".$langsiso->trans("YouWillBeRedirectedOnPayBox")."
    ".$langsiso->trans("PleaseBePatient")."...
    "; + //$IBS_TXT="
    ".$langsiso->trans("YouWillBeRedirectedOnPayBox")."
    ".$langsiso->trans("PleaseBePatient")."...
    "; $IBS_TXT=' '; // Use a space $IBS_BOUTPI=$langs->trans("Wait"); //$IBS_BOUTPI=''; @@ -280,10 +280,10 @@ function html_print_paybox_footer($fromcompany,$langs) } print '


    '."\n"; - print '
    '."\n"; - print $fromcompany->nom.'
    '; + print '
    '."\n"; + print $fromcompany->name.'
    '; print $line1.'
    '; print $line2; - print '
    '."\n"; + print ''."\n"; } diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index 69b0664eb9d..eec35e38430 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -93,7 +93,7 @@ llxHeader('',$langs->trans("PaypalSetup")); $linkback=''.$langs->trans("BackToModuleList").''; -print_fiche_titre(' - '.$langs->trans("ModuleSetup"),$linkback,'paypal_logo@paypal'); +print_fiche_titre($langs->trans("ModuleSetup").' PayPal',$linkback); print '
    '; $head=paypaladmin_prepare_head(); @@ -232,7 +232,7 @@ print ''; print ''; -print '
    '; +print '
    '; print ''; diff --git a/htdocs/paypal/img/object_paypal.png b/htdocs/paypal/img/object_paypal.png index 4ff3c80565d..74ac4392ded 100644 Binary files a/htdocs/paypal/img/object_paypal.png and b/htdocs/paypal/img/object_paypal.png differ diff --git a/htdocs/paypal/img/paypal.png b/htdocs/paypal/img/paypal.png deleted file mode 100644 index 2caabff50b7..00000000000 Binary files a/htdocs/paypal/img/paypal.png and /dev/null differ diff --git a/htdocs/paypal/img/paypal_logo.png b/htdocs/paypal/img/paypal_logo.png deleted file mode 100644 index 2a4fd7c9ad5..00000000000 Binary files a/htdocs/paypal/img/paypal_logo.png and /dev/null differ diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index cc678fce011..2e8ab4bf0b8 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -153,11 +153,11 @@ function html_print_paypal_footer($fromcompany,$langs) } print '


    '."\n"; - print '
    '."\n"; - print $fromcompany->nom.'
    '; + print '
    '."\n"; + print $fromcompany->name.'
    '; print $line1.'
    '; print $line2; - print '
    '."\n"; + print ''."\n"; } /** @@ -683,7 +683,8 @@ function hash_call($methodName,$nvpStr) exit;*/ curl_setopt($ch, CURLOPT_URL, $API_Endpoint); curl_setopt($ch, CURLOPT_VERBOSE, 1); - curl_setopt($ch, CURLOPT_SSLVERSION, 3); // Force SSLv3 + //curl_setopt($ch, CURLOPT_SSLVERSION, 3); // Force SSLv3 + curl_setopt($ch, CURLOPT_SSLVERSION, 1); // Force TLSv1 //turning off the server and peer verification(TrustManager Concept). curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); diff --git a/htdocs/printipp/admin/printipp.php b/htdocs/printipp/admin/printipp.php index 68dee5ca22b..28ad55453eb 100644 --- a/htdocs/printipp/admin/printipp.php +++ b/htdocs/printipp/admin/printipp.php @@ -35,6 +35,7 @@ if (! $user->admin) accessforbidden(); $action = GETPOST('action','alpha'); $mode = GETPOST('mode','alpha'); +$value = GETPOST('value','alpha'); if (!$mode) $mode='config'; @@ -68,6 +69,17 @@ if ($action == 'setvalue' && $user->admin) } } +// Set default model +else if ($action == 'setprinteruri') +{ + if (dolibarr_set_const($db, "PRINTIPP_URI_DEFAULT",$value,'chaine',0,'',$conf->entity)) + { + // La constante qui a ete lue en avant du nouveau set + // on passe donc par une variable pour avoir un affichage coherent + $conf->global->PRINTIPP_URI_DEFAULT = $value; + } +} + /* * View @@ -82,11 +94,6 @@ print_fiche_titre($langs->trans("PrintIPPSetup"),$linkback,'setup'); $head=printippadmin_prepare_head(); -dol_fiche_head($head, $mode, $langs->trans("ModuleSetup")); - -print $langs->trans("PrintIPPDesc")."
    \n"; - -print '
    '; if ($mode == 'config' && $user->admin) { @@ -94,8 +101,11 @@ if ($mode == 'config' && $user->admin) print ''; print ''; + dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic'); - print ''; + print $langs->trans("PrintIPPDesc")."

    \n"; + + print '
    '; $var=true; print ''; @@ -103,8 +113,9 @@ if ($mode == 'config' && $user->admin) print ''; print "\n"; + /* $var=!$var; - print ''; - + */ + $var=!$var; print ''; $var=!$var; - print ''; $var=!$var; - print ''; @@ -156,16 +168,22 @@ if ($mode == 'config' && $user->admin) //print ''; //print "\n"; - print ''; - print '
    '.$langs->trans("Value").'
    '; + print '
    '; print $langs->trans("PRINTIPP_ENABLED").''; if (! empty($conf->use_javascript_ajax)) @@ -123,7 +134,8 @@ if ($mode == 'config' && $user->admin) } } print '
    '; print $langs->trans("PRINTIPP_HOST").''; @@ -139,13 +151,13 @@ if ($mode == 'config' && $user->admin) print '
    '; + print '
    '; print $langs->trans("PRINTIPP_USER").''; print ''; print '
    '; + print '
    '; print $langs->trans("PRINTIPP_PASSWORD").''; print ''; print '
    '.$langs->trans("Value").'

    '; + dol_fiche_end(); + + print '
    '; + print ''; } if ($mode == 'test' && $user->admin) { - print ''; + dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic'); + + print $langs->trans("PrintIPPDesc")."

    \n"; + + print '
    '; $printer = new dolPrintIPP($db,$conf->global->PRINTIPP_HOST,$conf->global->PRINTIPP_PORT,$user->login,$conf->global->PRINTIPP_USER,$conf->global->PRINTIPP_PASSWORD); $var=true; print '
    '; @@ -180,6 +198,7 @@ if ($mode == 'test' && $user->admin) //print ''; print ''; print ''; + print ''; print "\n"; $list = $printer->getlist_available_printers(); @@ -200,14 +219,27 @@ if ($mode == 'test' && $user->admin) //print ''; print ''; print ''; + // Defaut + print "'; print "\n"; } print '
    DeviceMediaSupported'.$langs->trans("Select").'
    '.$printer_det->device_uri->_value0.''.$printer_det->media_default->_value0.''.$printer_det->media_type_supported->_value1.'"; + if ($conf->global->PRINTIPP_URI_DEFAULT == "$value") + { + print img_picto($langs->trans("Default"),'on'); + } + else + { + print ''.img_picto($langs->trans("Disabled"),'off').''; + } + print '
    '; if (count($list) == 0) print $langs->trans("NoPrinterFound"); + + dol_fiche_end(); } -dol_fiche_end(); + llxFooter(); diff --git a/htdocs/printipp/lib/printipp.lib.php b/htdocs/printipp/lib/printipp.lib.php index c87080032f5..64c14609df5 100644 --- a/htdocs/printipp/lib/printipp.lib.php +++ b/htdocs/printipp/lib/printipp.lib.php @@ -36,12 +36,12 @@ function printippadmin_prepare_head() $head = array(); $head[$h][0] = DOL_URL_ROOT."/printipp/admin/printipp.php?mode=config"; - $head[$h][1] = $langs->trans("Config"); + $head[$h][1] = $langs->trans("CupsServer"); $head[$h][2] = 'config'; $h++; $head[$h][0] = DOL_URL_ROOT."/printipp/admin/printipp.php?mode=test"; - $head[$h][1] = $langs->trans("Test"); + $head[$h][1] = $langs->trans("Printer"); $head[$h][2] = 'test'; $h++; diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index e79ffcf13c6..2d0c1cca468 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -44,13 +44,13 @@ $value = GETPOST('value','alpha'); // Pricing Rules $select_pricing_rules=array( -'PRODUCT_PRICE_UNIQ'=>$langs->trans('PriceCatalogue'), // Unique price -'PRODUIT_MULTIPRICES'=>$langs->trans('MultiPricesAbility'), // Several prices according to a customer level -'PRODUIT_CUSTOMER_PRICES'=>$langs->trans('PriceByCustomer') // Different price for each customer +'PRODUCT_PRICE_UNIQ'=>$langs->trans('PriceCatalogue'), // Unique price +'PRODUIT_MULTIPRICES'=>$langs->trans('MultiPricesAbility'), // Several prices according to a customer level +'PRODUIT_CUSTOMER_PRICES'=>$langs->trans('PriceByCustomer'), // Different price for each customer ); -if ($conf->global->MAIN_FEATURES_LEVEL==2) +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { - $select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY'] = $langs->trans('PriceByQuantity'); + $select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY'] = $langs->trans('PriceByQuantity'); // TODO If this is enabled, price must be hidden when price by qty is enabled, also price for quantity must be used when adding product into order/propal/invoice $select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY&PRODUIT_MULTIPRICES'] = $langs->trans('MultiPricesAbility') . '+' . $langs->trans('PriceByQuantity'); } @@ -125,7 +125,7 @@ if ($action == 'pricingrule') else { $multirule=explode('&',$princingrules); - foreach($multirule as $rulesselected) + foreach($multirule as $rulesselected) { $res = dolibarr_set_const($db, $rulesselected, 1, 'chaine', 0, '', $conf->entity); } @@ -137,8 +137,8 @@ if ($action == 'pricingrule') $res = dolibarr_set_const($db, $rule, 0, 'chaine', 0, '', $conf->entity); } } - - } + + } } else if ($action == 'sousproduits') { @@ -262,7 +262,7 @@ foreach ($dirproduct as $dirroot) $var = !$var; print ''."\n"; - print ''.$modCodeProduct->nom.''."\n"; + print ''.$modCodeProduct->name.''."\n"; print ''.$modCodeProduct->info($langs).''."\n"; print ''.$modCodeProduct->getExample($langs).''."\n"; diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index a4aae519b98..84dacf8db43 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -298,10 +298,9 @@ else */ print ''; - print ''; // Boutons actions - print '
    '; + print '
    '; print ''; print '
    '; diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index 61a1c3bff73..7dda37b6f2c 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -58,32 +58,32 @@ $price_by_qty_rowid = GETPOST('pbq', 'int'); dol_syslog(join(',', $_GET)); // print_r($_GET); -if (! empty($action) && $action == 'fetch' && ! empty($id)) { +if (! empty($action) && $action == 'fetch' && ! empty($id)) +{ require DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; - + $outjson = array(); - + $object = new Product($db); $ret = $object->fetch($id); - if ($ret > 0) { + if ($ret > 0) + { $outref = $object->ref; $outlabel = $object->label; $outdesc = $object->description; $outtype = $object->type; $outqty = 1; $outdiscount = 0; - + $found = false; - + // Price by qty - if (! empty($price_by_qty_rowid) && $price_by_qty_rowid >= 1 && (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))) // If we need a - // particular price related - // to qty + if (! empty($price_by_qty_rowid) && $price_by_qty_rowid >= 1 && (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))) // If we need a particular price related to qty { $sql = "SELECT price, unitprice, quantity, remise_percent"; $sql .= " FROM " . MAIN_DB_PREFIX . "product_price_by_qty "; $sql .= " WHERE rowid=" . $price_by_qty_rowid . ""; - + $result = $db->query($sql); if ($result) { $objp = $db->fetch_object($result); @@ -98,7 +98,7 @@ if (! empty($action) && $action == 'fetch' && ! empty($id)) { } } } - + // Multiprice if (! $found && isset($price_level) && $price_level >= 1 && (! empty($conf->global->PRODUIT_MULTIPRICES))) // If we need a particular price // level (from 1 to 6) @@ -110,7 +110,7 @@ if (! empty($action) && $action == 'fetch' && ! empty($id)) { $sql .= " AND price_level=" . $price_level; $sql .= " ORDER BY date_price"; $sql .= " DESC LIMIT 1"; - + $result = $db->query($sql); if ($result) { $objp = $db->fetch_object($result); @@ -123,16 +123,16 @@ if (! empty($action) && $action == 'fetch' && ! empty($id)) { } } } - + // Price by customer if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES) && ! empty($socid)) { - + require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; - + $prodcustprice = new Productcustomerprice($db); - + $filter = array('t.fk_product' => $object->id,'t.fk_soc' => $socid); - + $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); if ($result) { if (count($prodcustprice->lines) > 0) { @@ -144,48 +144,48 @@ if (! empty($action) && $action == 'fetch' && ! empty($id)) { } } } - + if (! $found) { $outprice_ht = price($object->price); $outprice_ttc = price($object->price_ttc); $outpricebasetype = $object->price_base_type; $outtva_tx = $object->tva_tx; } - + $outjson = array('ref' => $outref,'label' => $outlabel,'desc' => $outdesc,'type' => $outtype,'price_ht' => $outprice_ht,'price_ttc' => $outprice_ttc,'pricebasetype' => $outpricebasetype,'tva_tx' => $outtva_tx,'qty' => $outqty,'discount' => $outdiscount); } - + echo json_encode($outjson); } else { require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; - + $langs->load("products"); $langs->load("main"); - + top_httphead(); - + if (empty($htmlname)) return; - + $match = preg_grep('/(' . $htmlname . '[0-9]+)/', array_keys($_GET)); sort($match); $idprod = (! empty($match [0]) ? $match [0] : ''); - + if (! GETPOST($htmlname) && ! GETPOST($idprod)) return; - + // When used from jQuery, the search term is added as GET param "term". $searchkey = (GETPOST($idprod) ? GETPOST($idprod) : (GETPOST($htmlname) ? GETPOST($htmlname) : '')); - + $form = new Form($db); if (empty($mode) || $mode == 1) { $arrayresult = $form->select_produits_list("", $htmlname, $type, "", $price_level, $searchkey, $status, 2, $outjson, $socid); } elseif ($mode == 2) { $arrayresult = $form->select_produits_fournisseurs_list($socid, "", $htmlname, $type, "", $searchkey, $status, $outjson, $socid); } - + $db->close(); - + if ($outjson) print json_encode($arrayresult); } diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index ddbd3c015ff..44c28f383b5 100644 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -67,7 +67,7 @@ class ActionsCardProduct /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * - * @param string &$action Type of action + * @param string $action Type of action * @param string $id Id of object * @param string $ref Ref of object * @return void diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php index cee958be50f..cbb9e10750c 100644 --- a/htdocs/product/canvas/service/actions_card_service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -66,7 +66,7 @@ class ActionsCardService /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * - * @param string &$action Type of action + * @param string $action Type of action * @param string $id Id of object * @param string $ref Ref of object * @return void diff --git a/htdocs/product/fiche.php b/htdocs/product/card.php similarity index 95% rename from htdocs/product/fiche.php rename to htdocs/product/card.php index 3ae836d0214..50ed04a29df 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/card.php @@ -1,16 +1,16 @@ - * Copyright (C) 2004-2014 Laurent Destailleur - * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2006 Auguria SARL - * Copyright (C) 2010-2014 Juanjo Menent - * Copyright (C) 2013-2014 Marcos García - * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2011-2014 Alexandre Spangaro - * Copyright (C) 2014 Cédric Gross - * Copyright (C) 2014 Ferran Marcet +/* Copyright (C) 2001-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2005 Eric Seigne + * Copyright (C) 2005-2014 Regis Houssin + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2006 Auguria SARL + * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2013-2014 Marcos García + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2011-2014 Alexandre Spangaro + * Copyright (C) 2014 Cédric Gross + * Copyright (C) 2014 Ferran Marcet * * 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 @@ -27,7 +27,7 @@ */ /** - * \file htdocs/product/fiche.php + * \file htdocs/product/card.php * \ingroup product * \brief Page to show product */ @@ -48,7 +48,7 @@ $langs->load("products"); $langs->load("other"); if (! empty($conf->stock->enabled)) $langs->load("stocks"); if (! empty($conf->facture->enabled)) $langs->load("bills"); -if ($conf->productbatch->enabled) $langs->load("productbatch"); +if (! empty($conf->productbatch->enabled)) $langs->load("productbatch"); $mesg=''; $error=0; $errors=array(); $_error=0; @@ -74,7 +74,7 @@ if ($id > 0 || ! empty($ref)) // Get object canvas (By default, this is not defined, so standard usage of dolibarr) $canvas = !empty($object->canvas)?$object->canvas:GETPOST("canvas"); -$objcanvas=''; +$objcanvas=null; if (! empty($canvas)) { require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; @@ -88,7 +88,7 @@ $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype,$objcanvas); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('productcard')); +$hookmanager->initHooks(array('productcard','globalcard')); @@ -101,7 +101,7 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barc $parameters=array('id'=>$id, 'ref'=>$ref, 'objcanvas'=>$objcanvas); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks -$error=$hookmanager->error; $errors=$hookmanager->errors; +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) { @@ -124,7 +124,7 @@ if (empty($reshook)) // Barcode value if ($action == 'setbarcode' && $createbarcode) { - $result=$object->check_barcode(GETPOST('barcode'),GETPOT('barcode_type_code')); + $result=$object->check_barcode(GETPOST('barcode'),GETPOST('barcode_type_code')); if ($result >= 0) { @@ -422,11 +422,10 @@ if (empty($reshook)) $_error++; $action = ""; - $mesg='
    '.$langs->trans("ErrorProductAlreadyExists",$object->ref); + $mesg=$langs->trans("ErrorProductAlreadyExists",$object->ref); $mesg.=' '.$langs->trans("ShowCardHere").'.'; - $mesg.='
    '; setEventMessage($mesg, 'errors'); - //dol_print_error($object->db); + $object->fetch($id); } else { @@ -464,7 +463,7 @@ if (empty($reshook)) if ($result > 0) { - header('Location: '.DOL_URL_ROOT.'/product/liste.php?type='.$object->type.'&delprod='.urlencode($object->ref)); + header('Location: '.DOL_URL_ROOT.'/product/list.php?type='.$object->type.'&delprod='.urlencode($object->ref)); exit; } else @@ -652,7 +651,7 @@ if (empty($reshook)) if ($result > 0) { - header("Location: ".DOL_URL_ROOT."/commande/fiche.php?id=".$commande->id); + header("Location: ".DOL_URL_ROOT."/commande/card.php?id=".$commande->id); exit; } } @@ -840,7 +839,7 @@ else print ''; $tmpcode=''; if (! empty($modCodeProduct->code_auto)) $tmpcode=$modCodeProduct->getNextValue($object,$type); - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; if ($_error) { print $langs->trans("RefAlreadyExists"); @@ -863,9 +862,9 @@ else print ''; // Batch number management - if ($conf->productbatch->enabled) + if (! empty($conf->productbatch->enabled)) { - print ''.$langs->trans("Status").' ('.$langs->trans("Batch").')'; + print ''.$langs->trans("ManageLotSerial").''; $statutarray=array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch")); print $form->selectarray('status_batch',$statutarray,GETPOST('status_batch')); print ''; @@ -1054,7 +1053,7 @@ else print '
    '; //} - print '
    '; + print '
    '; print ''; } @@ -1084,7 +1083,7 @@ else print ''; // Ref - print ''; + print ''; // Label print ''; @@ -1123,7 +1122,7 @@ else // Batch number managment if ($conf->productbatch->enabled) { - print ''; @@ -1290,8 +1289,11 @@ else print '
    '; //} - print '
        '; - print '
    '; + print '
    '; + print ''; + print '     '; + print ''; + print '
    '; print ''; } @@ -1420,20 +1422,32 @@ else // Status (to sell) print ''; // Status (to buy) print ''; - // Batch number management (to batch) - if ($conf->productbatch->enabled) { - print ''; - } + // Batch number management (to batch) + if ($conf->productbatch->enabled) { + print ''; + } // Description print ''; @@ -1533,7 +1547,9 @@ else } // Note - print ''; + print ' '."\n"; + print ''."\n"; + print ' '."\n"; print "
    '.$langs->trans("Ref").'
    '.$langs->trans("Ref").'
    '.$langs->trans("Label").'
    '.$langs->trans("Status").' ('.$langs->trans("Lot").')'; + print '
    '.$langs->trans("ManageLotSerial").''; $statutarray=array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch")); print $form->selectarray('status_batch',$statutarray,$object->status_batch); print '
    '.$langs->trans("Status").' ('.$langs->trans("Sell").')'; - print $object->getLibStatut(2,0); + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { + print ajax_object_onoff($object, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); + } else { + print $object->getLibStatut(2,0); + } print '
    '.$langs->trans("Status").' ('.$langs->trans("Buy").')'; - print $object->getLibStatut(2,1); + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { + print ajax_object_onoff($object, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); + } else { + print $object->getLibStatut(2,1); + } print '
    '.$langs->trans("Status").' ('.$langs->trans("Lot").')'; - print $object->getLibStatut(2,2); - print '
    '.$langs->trans("ManageLotSerial").''; + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { + print ajax_object_onoff($object, 'status_batch', 'tobatch', 'ProductStatusOnBatch', 'ProductStatusNotOnBatch'); + } else { + print $object->getLibStatut(0,2); + } + print '
    '.$langs->trans("Description").''.(dol_textishtml($object->description)?$object->description:dol_nl2br($object->description,1,true)).'
    '.$langs->trans("Note").''.(dol_textishtml($object->note)?$object->note:dol_nl2br($object->note,1,true)).'
    '.$langs->trans("Note").''.(dol_textishtml($object->note)?$object->note:dol_nl2br($object->note,1,true)).'
    \n"; @@ -1562,7 +1578,7 @@ $formquestionclone=array( if (($action == 'delete' && (empty($conf->use_javascript_ajax) || ! empty($conf->dol_use_jmobile))) // Output when action = clone if jmobile or no js || (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) // Always output when not jmobile nor js { - print $form->formconfirm("fiche.php?id=".$object->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete",'',0,"action-delete"); + print $form->formconfirm("card.php?id=".$object->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete",'',0,"action-delete"); } // Clone confirmation diff --git a/htdocs/product/class/priceexpression.class.php b/htdocs/product/class/priceexpression.class.php new file mode 100755 index 00000000000..45fd9f9fa30 --- /dev/null +++ b/htdocs/product/class/priceexpression.class.php @@ -0,0 +1,349 @@ + + * Copyright (C) 2014 Juanjo Menent +/* Copyright (C) 2014 Ion Agorria + * + * 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 . + */ + +/** + * \file htdocs/product/class/priceexpression.class.php + * \ingroup product + * \brief Class for accesing price expression table + */ + + +/** + * Class for accesing price expression table + */ +class PriceExpression +{ + var $db; //!< To store db handler + var $error; //!< To return error code (or message) + var $errors=array(); //!< To return several error codes (or messages) + var $id; + var $title; + var $expression; + + /** + * Constructor + * + * @param DoliDb $db Database handler + */ + function __construct($db) + { + $this->db = $db; + return 1; + } + + + /** + * Create object into database + * + * @param User $user User that creates + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @return int <0 if KO, Id of created object if OK + */ + function create($user, $notrigger=0) + { + $error=0; + + // Clean parameters + if (isset($this->title)) $this->title=trim($this->title); + if (isset($this->expression)) $this->expression=trim($this->expression); + + // Insert request + $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_price_expression ("; + $sql.= "title, expression"; + $sql.= ") VALUES ("; + $sql.= " ".(isset($this->title)?"'".$this->db->escape($this->title)."'":"''").","; + $sql.= " ".(isset($this->expression)?"'".$this->db->escape($this->expression)."'":"''"); + $sql.= ")"; + + $this->db->begin(); + + dol_syslog(get_class($this)."::create", LOG_DEBUG); + $resql=$this->db->query($sql); + if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + + if (! $error) + { + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); + + if (! $notrigger) + { + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + + //// Call triggers + //$result=$this->call_trigger('MYOBJECT_CREATE',$user); + //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + //// End call triggers + } + } + + // Commit or rollback + if ($error) + { + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__." ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + else + { + $this->db->commit(); + return $this->id; + } + } + + + /** + * Load object in memory from the database + * + * @param int $id Id object + * @return int < 0 if KO, 0 if OK but not found, > 0 if OK + */ + function fetch($id) + { + $sql = "SELECT title, expression"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_price_expression"; + $sql.= " WHERE rowid = ".$id; + + dol_syslog(get_class($this)."::fetch"); + $resql=$this->db->query($sql); + if ($resql) + { + $obj = $this->db->fetch_object($resql); + if ($obj) + { + $this->id = $id; + $this->title = $obj->title; + $this->expression = $obj->expression; + return 1; + } + else + { + return 0; + } + } + else + { + $this->error="Error ".$this->db->lasterror(); + return -1; + } + } + + /** + * List all price expressions + * + * @return array Array of price expressions + */ + function list_price_expression() + { + $sql = "SELECT rowid, title, expression"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_price_expression"; + $sql.= " ORDER BY title"; + + dol_syslog(get_class($this)."::list_price_expression"); + $resql=$this->db->query($sql); + if ($resql) + { + $retarray = array(); + + while ($record = $this->db->fetch_array($resql)) + { + $price_expression_obj = new PriceExpression($this->db); + $price_expression_obj->id = $record["rowid"]; + $price_expression_obj->title = $record["title"]; + $price_expression_obj->expression = $record["expression"]; + $retarray[]=$price_expression_obj; + } + + $this->db->free($resql); + return $retarray; + } + else + { + $this->error=$this->db->error(); + return -1; + } + } + + + /** + * Returns any existing rowid with specified title + * + * @param String $title Title of expression + * @return int < 0 if KO, 0 if OK but not found, > 0 rowid + */ + function find_title($title) + { + $sql = "SELECT rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_price_expression"; + $sql.= " WHERE title = '".$this->db->escape($title)."'"; + + dol_syslog(get_class($this)."::find_title"); + $resql=$this->db->query($sql); + if ($resql) + { + $obj = $this->db->fetch_object($resql); + if ($obj) + { + return (int) $obj->rowid; + } + else + { + return 0; + } + } + else + { + $this->error="Error ".$this->db->lasterror(); + return -1; + } + } + + + /** + * Update object into database + * + * @param User $user User that modifies + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @return int <0 if KO, >0 if OK + */ + function update($user=0, $notrigger=0) + { + $error=0; + + // Clean parameters + if (isset($this->title)) $this->title=trim($this->title); + if (isset($this->expression)) $this->expression=trim($this->expression); + + // Update request + $sql = "UPDATE ".MAIN_DB_PREFIX."c_price_expression SET"; + $sql.= " title = ".(isset($this->title)?"'".$this->db->escape($this->title)."'":"''").","; + $sql.= " expression = ".(isset($this->expression)?"'".$this->db->escape($this->expression)."'":"''").""; + $sql.= " WHERE rowid = ".$this->id; + + $this->db->begin(); + + dol_syslog(get_class($this)."::update"); + $resql = $this->db->query($sql); + if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + + if (! $error) + { + if (! $notrigger) + { + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + + //// Call triggers + //$result=$this->call_trigger('MYOBJECT_MODIFY',$user); + //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + //// End call triggers + } + } + + // Commit or rollback + if ($error) + { + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + else + { + $this->db->commit(); + return 1; + } + } + + + /** + * Delete object in database + * + * @param int $rowid Row id of expression + * @param User $user User that deletes + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @return int <0 if KO, >0 if OK + */ + function delete($rowid, $user, $notrigger=0) + { + $error=0; + + $this->db->begin(); + + if (! $error) + { + if (! $notrigger) + { + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + + //// Call triggers + //$result=$this->call_trigger('MYOBJECT_DELETE',$user); + //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + //// End call triggers + } + } + + if (! $error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."c_price_expression"; + $sql.= " WHERE rowid = ".$rowid; + + dol_syslog(get_class($this)."::delete"); + $resql = $this->db->query($sql); + if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + } + + // Commit or rollback + if ($error) + { + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + else + { + $this->db->commit(); + return 1; + } + } + + /** + * Initialise object with example values + * Id must be 0 if object instance is a specimen + * + * @return void + */ + function initAsSpecimen() + { + $this->id=0; + $this->expression=''; + } +} diff --git a/htdocs/product/class/priceparser.class.php b/htdocs/product/class/priceparser.class.php new file mode 100755 index 00000000000..5e4fb949cbb --- /dev/null +++ b/htdocs/product/class/priceparser.class.php @@ -0,0 +1,240 @@ + + * + * 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 . + */ + +/** + * \file htdocs/product/class/priceparser.class.php + * \ingroup product + * \brief File of class to calculate prices using expression + */ +require_once DOL_DOCUMENT_ROOT.'/includes/evalmath/evalmath.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/priceexpression.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + +/** + * Class to parse product price expressions + */ +class PriceParser +{ + protected $db; + // Limit of expressions per price + public $limit = 100; + // The error that ocurred when parsing price + public $error; + // The expression that caused the error + public $error_expr; + //The special char + public $special_chr = "#"; + //The separator char + public $separator_chr = ";"; + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + $this->db = $db; + } + + /** + * Returns translated error + * + * @return string Translated error + */ + public function translatedError() + { + global $langs; + $langs->load("errors"); + /* + -No arg + 9, an unexpected error occured + 14, division by zero + 19, expression not found + 20, empty expression + + -1 Arg + 1, cannot assign to constant '%s' + 2, cannot redefine built-in function '%s' + 3, undefined variable '%s' in function definition + 4, illegal character '%s' + 5, unexpected '%s' + 8, unexpected operator '%s' + 10, operator '%s' lacks operand + 11, expecting '%s' + 17, undefined variable '%s' + 21, empty result '%s' + 22, negative result '%s' + + -2 Args + 6, wrong number of arguments (%s given, %s expected) + + -internal errors + 7, internal error + 12, internal error + 13, internal error + 15, internal error + 16, internal error + 18, internal error + */ + if (empty($this->error)) { + return $langs->trans("ErrorPriceExpressionUnknown", 0); //this is not supposed to happen + } + list($code, $info) = $this->error; + if (in_array($code, array(9, 14, 19, 20))) //Errors which have 0 arg + { + return $langs->trans("ErrorPriceExpression".$code); + } + else if (in_array($code, array(1, 2, 3, 4, 5, 8, 10, 11, 17, 21, 22))) //Errors which have 1 arg + { + return $langs->trans("ErrorPriceExpression".$code, $info); + } + else if (in_array($code, array(6))) //Errors which have 2 args + { + return $langs->trans("ErrorPriceExpression".$code, $info[0], $info[1]); + } + else if (in_array($code, array(7, 12, 13, 15, 16, 18))) //Internal errors + { + return $langs->trans("ErrorPriceExpressionInternal", $code); + } + else //Unknown errors + { + return $langs->trans("ErrorPriceExpressionUnknown", $code); + } + } + + /** + * Calculates price based on expression + * + * @param array $values Strings to replaces + * @param String $expression The expression to parse + * @return int > 0 if OK, < 1 if KO + */ + public function parseExpression($values, $expression) + { + //Check if empty + $expression = trim($expression); + if (empty($expression)) + { + $this->error = array(20, null); + return -1; + } + + //Prepare the lib, parameters and values + $em = new EvalMath(); + $em->suppress_errors = true; //Don't print errors on page + $this->error_expr = null; + $search = array(); + $replace = array(); + foreach ($values as $key => $value) { + if ($value !== null) { + $search[] = $this->special_chr.$key.$this->special_chr; + $replace[] = $value; + } + } + + //Iterate over each expression splitted by $separator_chr + $expression = str_replace("\n", $this->separator_chr, $expression); + $expressions = explode($this->separator_chr, $expression); + $expressions = array_slice($expressions, 0, $limit); + foreach ($expressions as $expr) { + $expr = trim($expr); + if (!empty($expr)) + { + $expr = str_ireplace($search, $replace, $expr); + $last_result = $em->evaluate($expr); + $this->error = $em->last_error_code; + if ($this->error !== null) { //$em->last_error is null if no error happened, so just check if error is not null + $this->error_expr = $expr; + return -2; + } + } + } + $vars = $em->vars(); + if (empty($vars["price"])) { + $vars["price"] = $last_result; + } + if ($vars["price"] === null) + { + $this->error = array(21, $expression); + return -3; + } + if ($vars["price"] < 0) + { + $this->error = array(22, $expression); + return -4; + } + return $vars["price"]; + } + + /** + * Calculates supplier product price based on product id and string expression + * + * @param int $product_id The Product id to get information + * @param string $expression The expression to parse + * @param int $quantity Min quantity + * @param int $tva_tx VAT rate + * @param array $extra_values Any aditional values for expression + * @return int > 0 if OK, < 1 if KO + */ + public function parseProductSupplierExpression($product_id, $expression, $quantity = null, $tva_tx = null, $extra_values = array()) + { + //Accessible values by expressions + $expression_values = array( + "quantity" => $quantity, + "tva_tx" => $tva_tx, + ); + $expression_values = array_merge($expression_values, $extra_values); + + //Retreive all extrafield for product and add it to expression_values + $extrafields = new ExtraFields($this->db); + $extralabels = $extrafields->fetch_name_optionals_label('product', true); + $product = new Product($this->db); + $product->fetch_optionals($product_id, $extralabels); + foreach($extrafields->attribute_label as $key=>$label) + { + $expression_values['options_'.$key] = $product->array_options['options_'.$key]; + } + + //Parse the expression and return the price + return $this->parseExpression($expression_values, $expression); + } + + /** + * Calculates supplier product price based on product id and expression id + * + * @param int $product_id The Product id to get information + * @param int $expression_id The expression to parse + * @param int $quantity Min quantity + * @param int $tva_tx VAT rate + * @param array $extra_values Any aditional values for expression + * @return int > 0 if OK, < 1 if KO + */ + public function parseProductSupplier($product_id, $expression_id, $quantity = null, $tva_tx = null, $extra_values = array()) + { + $price_expression = new PriceExpression($this->db); + $res = $price_expression->fetch($expression_id); + if ($res > 1) { + $this->error = array(19, null); + return -1; + } + + //Parse the expression and return the price + return $this->parseProductSupplierExpression($product_id, $price_expression->expression, $quantity, $tva_tx, $extra_values); + } +} \ No newline at end of file diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php old mode 100644 new mode 100755 index 8bd8632e2e1..294c8d1610e --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1,15 +1,15 @@ - * Copyright (C) 2004-2014 Laurent Destailleur - * Copyright (C) 2005-2013 Regis Houssin - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2007-2011 Jean Heimburger - * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2013-2014 Cedric GROSS - * Copyright (C) 2013-2014 Marcos García - * Copyright (C) 2011-2014 Alexandre Spangaro - * Copyright (C) 2014 Henry Florian - * Copyright (C) 2014 Philippe Grand +/* Copyright (C) 2001-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2005-2014 Regis Houssin + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2007-2011 Jean Heimburger + * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2013-2014 Cedric GROSS + * Copyright (C) 2013-2014 Marcos García + * Copyright (C) 2011-2014 Alexandre Spangaro + * Copyright (C) 2014 Henry Florian + * Copyright (C) 2014 Philippe Grand * * 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 @@ -46,6 +46,13 @@ class Product extends CommonObject protected $isnolinkedbythird = 1; // No field fk_soc protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + /** + * {@inheritdoc} + */ + protected $table_ref_field = 'ref'; + + var $regeximgext='\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff'; + //! Identifiant unique var $id ; //! Ref @@ -122,9 +129,9 @@ class Product extends CommonObject //! barcode var $barcode; // value var $barcode_type; // id - var $barcode_type_code; // code (loaded by fetch_barcode). Example ean, isbn... + var $barcode_type_code; // code (loaded by fetch_barcode). Example 'ean', 'isbn', ... var $barcode_type_label; // label (loaded by fetch_barcode) - var $barcode_type_coder; // coder (loaded by fetch_barcode) + var $barcode_type_coder; // coder (loaded by fetch_barcode). Engine. var $stats_propale=array(); var $stats_commande=array(); @@ -678,6 +685,8 @@ class Product extends CommonObject } } + $action='update'; + // Actions on extra fields (by external module or standard code) $hookmanager->initHooks(array('productdao')); $parameters=array('id'=>$this->id); @@ -1162,11 +1171,12 @@ class Product extends CommonObject */ function get_buyprice($prodfournprice,$qty,$product_id=0,$fourn_ref=0) { + require_once DOL_DOCUMENT_ROOT.'/product/class/priceparser.class.php'; $result = 0; // We do select by searching with qty and prodfournprice $sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity,"; - $sql.= " pfp.fk_product, pfp.ref_fourn, pfp.fk_soc, pfp.tva_tx"; + $sql.= " pfp.fk_product, pfp.ref_fourn, pfp.fk_soc, pfp.tva_tx, pfp.fk_price_expression"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= " WHERE pfp.rowid = ".$prodfournprice; if ($qty) $sql.= " AND pfp.quantity <= ".$qty; @@ -1178,6 +1188,13 @@ class Product extends CommonObject $obj = $this->db->fetch_object($resql); if ($obj && $obj->quantity > 0) // If found { + if (!empty($obj->fk_price_expression)) { + $priceparser = new PriceParser($this->db); + $price_result = $priceparser->parseProductSupplier($obj->fk_product, $obj->fk_price_expression, $obj->quantity, $obj->tva_tx); + if ($price_result >= 0) { + $obj->price = $price_result; + } + } $this->buyprice = $obj->price; // \deprecated $this->fourn_pu = $obj->price / $obj->quantity; // Prix unitaire du produit pour le fournisseur $fourn_id $this->ref_fourn = $obj->ref_fourn; // Ref supplier @@ -1189,7 +1206,7 @@ class Product extends CommonObject { // We do same select again but searching with qty, ref and id product $sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.fk_soc,"; - $sql.= " pfp.fk_product, pfp.ref_fourn as ref_supplier, pfp.tva_tx"; + $sql.= " pfp.fk_product, pfp.ref_fourn as ref_supplier, pfp.tva_tx, pfp.fk_price_expression"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= " WHERE pfp.ref_fourn = '".$fourn_ref."'"; $sql.= " AND pfp.fk_product = ".$product_id; @@ -1204,6 +1221,13 @@ class Product extends CommonObject $obj = $this->db->fetch_object($resql); if ($obj && $obj->quantity > 0) // If found { + if (!empty($obj->fk_price_expression)) { + $priceparser = new PriceParser($this->db); + $price_result = $priceparser->parseProductSupplier($obj->fk_product, $obj->fk_price_expression, $obj->quantity, $obj->tva_tx); + if ($result >= 0) { + $obj->price = $price_result; + } + } $this->buyprice = $obj->price; // deprecated $this->fourn_qty = $obj->quantity; // min quantity for price $this->fourn_pu = $obj->price / $obj->quantity; // Prix unitaire du produit pour le fournisseur $fourn_id @@ -1394,7 +1418,7 @@ class Product extends CommonObject if (! $id && ! $ref && ! $ref_ext) { $this->error='ErrorWrongParameters'; - dol_print_error(get_class($this)."::fetch ".$this->error, LOG_ERR); + dol_print_error(get_class($this)."::fetch ".$this->error); return -1; } @@ -1404,6 +1428,7 @@ class Product extends CommonObject $sql.= " weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,"; $sql.= " accountancy_code_buy, accountancy_code_sell, stock, pmp,"; $sql.= " datec, tms, import_key, entity, desiredstock, tobatch"; + $sql.= " ,ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; if ($id) $sql.= " WHERE rowid = ".$this->db->escape($id); else @@ -1479,6 +1504,8 @@ class Product extends CommonObject $this->import_key = $obj->import_key; $this->entity = $obj->entity; + $this->ref_ext = $obj->ref_ext; + $this->db->free($resql); @@ -2798,7 +2825,7 @@ class Product extends CommonObject } else if ($option == 'composition') { - $lien = ''; + $lien = ''; $lienfin=''; } else if ($option == 'category') @@ -2807,15 +2834,15 @@ class Product extends CommonObject } else { - $lien = ''; + $lien = ''; $lienfin=''; } $newref=$this->ref; if ($maxlength) $newref=dol_trunc($newref,$maxlength,'middle'); if ($withpicto) { - if ($this->type == 0) $result.=($lien.img_object($langs->trans("ShowProduct").' '.$this->ref,'product').$lienfin.' '); - if ($this->type == 1) $result.=($lien.img_object($langs->trans("ShowService").' '.$this->ref,'service').$lienfin.' '); + if ($this->type == 0) $result.=($lien.img_object($langs->trans("ShowProduct").' '.$this->label, 'product', 'class="classfortooltip"').$lienfin.' '); + if ($this->type == 1) $result.=($lien.img_object($langs->trans("ShowService").' '.$this->label, 'service', 'class="classfortooltip"').$lienfin.' '); } $result.=$lien.$newref.$lienfin; return $result; @@ -2856,7 +2883,7 @@ class Product extends CommonObject { global $langs; $langs->load('products'); - if ($conf->productbatch->enabled) $langs->load("productbatch"); + if (!empty($conf->productbatch->enabled)) $langs->load("productbatch"); if ($type == 2) { @@ -3027,56 +3054,71 @@ class Product extends CommonObject * * @return int < 0 if KO, > 0 if OK */ - function load_virtual_stock() - { - global $conf; + function load_virtual_stock() + { + global $conf; - if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) - { - $stock_commande_client=$stock_commande_fournisseur=0; - $stock_sending_client=$stock_reception_fournisseur=0; + $stock_commande_client=0; + $stock_commande_fournisseur=0; + $stock_sending_client=0; + $stock_reception_fournisseur=0; - if (! empty($conf->commande->enabled)) - { - $result=$this->load_stats_commande(0,'1,2'); - if ($result < 0) dol_print_error($db,$this->error); - $stock_commande_client=$this->stats_commande['qty']; - } - if (! empty($conf->expedition->enabled)) - { - $result=$this->load_stats_sending(0,'1,2'); - if ($result < 0) dol_print_error($db,$this->error); - $stock_sending_client=$this->stats_expedition['qty']; - } - if (! empty($conf->fournisseur->enabled)) - { - $result=$this->load_stats_commande_fournisseur(0,'3'); - if ($result < 0) dol_print_error($db,$this->error); - $stock_commande_fournisseur=$this->stats_commande_fournisseur['qty']; + if (! empty($conf->commande->enabled)) { + $result=$this->load_stats_commande(0,'1,2'); + if ($result < 0) dol_print_error($db,$this->error); + $stock_commande_client=$this->stats_commande['qty']; + } + if (! empty($conf->expedition->enabled)) { + $result=$this->load_stats_sending(0,'1,2'); + if ($result < 0) dol_print_error($db,$this->error); + $stock_sending_client=$this->stats_expedition['qty']; + } + if (! empty($conf->fournisseur->enabled)) { + $result=$this->load_stats_commande_fournisseur(0,'3,4'); + if ($result < 0) dol_print_error($db,$this->error); + $stock_commande_fournisseur=$this->stats_commande_fournisseur['qty']; - $result=$this->load_stats_reception(0,'3'); - if ($result < 0) dol_print_error($db,$this->error); - $stock_reception_fournisseur=$this->stats_reception['qty']; - } + $result=$this->load_stats_reception(0,'4'); + if ($result < 0) dol_print_error($db,$this->error); + $stock_reception_fournisseur=$this->stats_reception['qty']; + } - $this->stock_theorique=$this->stock_reel-($stock_commande_client-$stock_sending_client)+($stock_commande_fournisseur-$stock_reception_fournisseur); - //echo $this->stock_theorique.' = '.$this->stock_reel.' - ('.$stock_commande_client.' - '.$stock_sending_client.') + ('.$stock_commande_fournisseur.' - '.$stock_reception_fournisseur.')'; - } - } + // Stock decrease mode + if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) { + $this->stock_theorique=$this->stock_reel-$stock_commande_client+$stock_sending_client; + } + if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER)) { + $this->stock_theorique=$this->stock_reel; + } + if (! empty($conf->global->STOCK_CALCULATE_ON_BILL)) { + $this->stock_theorique=$this->stock_reel-$stock_commande_client; + } + // Stock Increase mode + if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) { + $this->stock_theorique+=$stock_commande_fournisseur-$stock_reception_fournisseur; + } + if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER)) { + $this->stock_theorique-=$stock_reception_fournisseur; + } + if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)) { + $this->stock_theorique+=$stock_commande_fournisseur-$stock_reception_fournisseur; + } + } /** - * Deplace fichier uploade sous le nom $files dans le repertoire sdir + * Move an uploaded file described into $file array into target directory $sdir. * - * @param string $sdir Repertoire destination finale - * @param string $file Nom du fichier uploade - * @param int $maxWidth Largeur maximum que dois faire la miniature (160 par defaut) - * @param int $maxHeight Hauteur maximum que dois faire la miniature (120 par defaut) - * @return void + * @param string $sdir Target directory + * @param string $file Array of file info of file to upload: array('name'=>..., 'tmp_name'=>...) + * @param int $maxWidth Largeur maximum que dois faire la miniature (160 by defaut) + * @param int $maxHeight Hauteur maximum que dois faire la miniature (120 by defaut) + * @return int <0 if KO, >0 if OK */ function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $result = 0; $dir = $sdir .'/'. get_exdir($this->id,2) . $this->id ."/photos"; dol_mkdir($dir); @@ -3095,6 +3137,9 @@ class Product extends CommonObject $this->add_thumb($originImage,$maxWidth,$maxHeight); } } + + if (is_numeric($result) && $result > 0) return 1; + else return -1; } /** @@ -3189,7 +3234,7 @@ class Product extends CommonObject if (! utf8_check($file)) $file=utf8_encode($file); // To be sure file is stored in UTF8 in memory - if (dol_is_file($dir.$file) && preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i', $dir.$file)) + if (dol_is_file($dir.$file) && preg_match('/('.$this->regeximgext.')$/i', $dir.$file)) { $nbphoto++; $photo = $file; @@ -3224,11 +3269,11 @@ class Product extends CommonObject $alt.=' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height']; if ($photo_vignette && $imgarray['height'] > $maxHeight) { $return.= ''; - $return.= ''; + $return.= 'dol_use_jmobile?'max-height':'height').'="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">'; } else { $return.= ''; - $return.= ''; + $return.= 'dol_use_jmobile?'max-height':'height').'="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">'; } $return.= ''."\n"; @@ -3238,7 +3283,7 @@ class Product extends CommonObject { $return.= '
    '; // On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites - if ($photo_vignette && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i', $photo) && ($product->imgWidth > $maxWidth || $product->imgHeight > $maxHeight)) + if ($photo_vignette && preg_match('/('.$this->regeximgext.')$/i', $photo) && ($product->imgWidth > $maxWidth || $product->imgHeight > $maxHeight)) { $return.= ''.img_picto($langs->trans('GenerateThumb'),'refresh').'  '; } @@ -3263,7 +3308,7 @@ class Product extends CommonObject } if ($size == 0) { // Format origine - $return.= ''; + $return.= ''; if ($showfilename) $return.= '
    '.$viewfilename; if ($showaction) @@ -3331,14 +3376,14 @@ class Product extends CommonObject while (($file = readdir($handle)) != false) { if (! utf8_check($file)) $file=utf8_encode($file); // readdir returns ISO - if (dol_is_file($dir.$file) && preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i', $dir.$file)) + if (dol_is_file($dir.$file) && preg_match('/('.$this->regeximgext.')$/i', $dir.$file)) { $nbphoto++; // On determine nom du fichier vignette $photo=$file; $photo_vignette=''; - if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i', $photo, $regs)) + if (preg_match('/('.$this->regeximgext.')$/i', $photo, $regs)) { $photo_vignette=preg_replace('/'.$regs[0].'/i', '', $photo).'_small'.$regs[0]; } @@ -3382,7 +3427,7 @@ class Product extends CommonObject dol_delete_file($file); // Si elle existe, on efface la vignette - if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$filename,$regs)) + if (preg_match('/('.$this->regeximgext.')$/i',$filename,$regs)) { $photo_vignette=preg_replace('/'.$regs[0].'/i','',$filename).'_small'.$regs[0]; if (file_exists(dol_osencode($dirthumb.$photo_vignette))) diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index c124f9648e3..088dccf6861 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -34,7 +34,7 @@ class Productbatch extends CommonObject private static $_table_element='product_batch'; //!< Name of table without prefix where object is stored var $id; - + var $tms=''; var $fk_product_stock; var $sellby=''; @@ -42,8 +42,9 @@ class Productbatch extends CommonObject var $batch=''; var $qty; var $import_key; + public $warehouseid; + - /** @@ -92,7 +93,7 @@ class Productbatch extends CommonObject $sql.= " ".(! isset($this->qty)?'NULL':$this->qty).","; $sql.= " ".(! isset($this->import_key)?'NULL':"'".$this->db->escape($this->import_key)."'").""; - + $sql.= ")"; $this->db->begin(); @@ -148,17 +149,18 @@ class Productbatch extends CommonObject global $langs; $sql = "SELECT"; $sql.= " t.rowid,"; - + $sql.= " t.tms,"; $sql.= " t.fk_product_stock,"; $sql.= " t.sellby,"; $sql.= " t.eatby,"; $sql.= " t.batch,"; $sql.= " t.qty,"; - $sql.= " t.import_key"; + $sql.= " t.import_key,"; + $sql.= " w.fk_entrepot"; - $sql.= " FROM ".MAIN_DB_PREFIX.self::$_table_element." as t"; + $sql.= " INNER JOIN ".MAIN_DB_PREFIX."product_stock w on t.fk_product_stock=w.rowid"; $sql.= " WHERE t.rowid = ".$id; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); @@ -177,6 +179,7 @@ class Productbatch extends CommonObject $this->batch = $obj->batch; $this->qty = $obj->qty; $this->import_key = $obj->import_key; + $this->warehouseid= $obj->fk_entrepot; } $this->db->free($resql); @@ -196,7 +199,7 @@ class Productbatch extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; $error=0; @@ -376,7 +379,7 @@ class Productbatch extends CommonObject function initAsSpecimen() { $this->id=0; - + $this->tms=''; $this->fk_product_stock=''; $this->sellby=''; @@ -384,14 +387,14 @@ class Productbatch extends CommonObject $this->batch=''; $this->import_key=''; - + } /** * Clean fields (triming) * * @return void - */ + */ private function clean_param() { if (isset($this->fk_product_stock)) $this->fk_product_stock=(int) trim($this->fk_product_stock); if (isset($this->batch)) $this->batch=trim($this->batch); @@ -429,7 +432,7 @@ class Productbatch extends CommonObject if (! empty($batch_number)) $sql.= " AND batch = '".$this->db->escape($batch_number)."'"; if (! empty($where)) $sql.= " AND (".implode(" OR ",$where).")"; - + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -439,7 +442,7 @@ class Productbatch extends CommonObject $obj = $this->db->fetch_object($resql); $this->id = $obj->rowid; - + $this->tms = $this->db->jdate($obj->tms); $this->fk_product_stock = $obj->fk_product_stock; $this->sellby = $this->db->jdate($obj->sellby); @@ -480,10 +483,10 @@ class Productbatch extends CommonObject $sql.= " t.qty,"; $sql.= " t.import_key"; - + $sql.= " FROM ".MAIN_DB_PREFIX.self::$_table_element." as t"; $sql.= " WHERE fk_product_stock=".$fk_product_stock; - + if ($with_qty) $sql.= " AND qty<>0"; dol_syslog("productbatch::findAll", LOG_DEBUG); $resql=$db->query($sql); diff --git a/htdocs/product/composition/fiche.php b/htdocs/product/composition/card.php similarity index 93% rename from htdocs/product/composition/fiche.php rename to htdocs/product/composition/card.php index 47f7bf9c42a..ca139a87965 100644 --- a/htdocs/product/composition/fiche.php +++ b/htdocs/product/composition/card.php @@ -21,7 +21,7 @@ */ /** - * \file htdocs/product/composition/fiche.php + * \file htdocs/product/composition/card.php * \ingroup product * \brief Page de la fiche produit */ @@ -112,7 +112,7 @@ $cancel <> $langs->trans("Cancel") && if ($cancel == $langs->trans("Cancel")) { $action = ''; - header("Location: fiche.php?id=".$_POST["id"]); + header("Location: card.php?id=".$_POST["id"]); exit; } @@ -130,24 +130,28 @@ if ($action == 'search') { $current_lang = $langs->getDefaultLang(); - $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.price, p.fk_product_type as type'; + $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,'; + $sql.= ' p.fk_product_type, p.tms as datem'; if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= ', pl.label as labelm, pl.description as descriptionm'; $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON p.rowid = cp.fk_product'; if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND lang='".($current_lang)."'"; - $sql.= ' WHERE p.entity IN ('.getEntity("product", 1).')'; + $sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')'; if ($key != "") { + // For natural search + $params = array('p.ref', 'p.label', 'p.description', 'p.note'); + // multilang if (! empty($conf->global->MAIN_MULTILANGS)) { - $sql.= " AND (p.ref LIKE '%".$key."%'"; - $sql.= " OR pl.label LIKE '%".$key."%')"; + $params[] = 'pl.label'; + $params[] = 'pl.description'; + $params[] = 'pl.note'; } - else - { - $sql.= " AND (p.ref LIKE '%".$key."%'"; - $sql.= " OR p.label LIKE '%".$key."%')"; + if (! empty($conf->barcode->enabled)) { + $params[] = 'p.barcode'; } + $sql .= natural_search($params, $key); } if (! empty($conf->categorie->enabled) && ! empty($parent) && $parent != -1) { @@ -295,7 +299,7 @@ if ($id > 0 || ! empty($ref)) } else { - print price($object->price).' '.$langs->trans($object->price_base_type); + print price($object->price).' '.$langs->trans($object->price_base_type?$object->price_base_type:'HT'); } print ''; @@ -307,7 +311,7 @@ if ($id > 0 || ! empty($ref)) } else { - print price($object->price_min).' '.$langs->trans($object->price_base_type); + print price($object->price_min).' '.$langs->trans($object->price_base_type?$object->price_base_type:'HT'); } print ''; } @@ -418,7 +422,7 @@ if ($id > 0 || ! empty($ref)) if (! empty($conf->categorie->enabled)) $rowspan++; print_fiche_titre($langs->trans("ProductToAddSearch"),'',''); - print '
    '; + print ''; print ''; + if (! empty($conf->dynamicprices->enabled)) { //Only show price mode and expression selector if module is enabled + // Price mode selector + print ''; + // This code hides the numeric price input if is not selected, loads the editor page if editor button is pressed + print ''; + } + // Price qty min - print ''; + print ''; print ''; // Charges ???? - if (! empty($conf->margin->enabled)) + if ($conf->global->PRODUCT_CHARGES) { - print ''; - print ''; - print ''; - print ''; + if (! empty($conf->margin->enabled)) + { + print ''; + print ''; + print ''; + print ''; + } } - + if (is_object($hookmanager)) { $parameters=array('id_fourn'=>$id_fourn,'prod_id'=>$product->id); @@ -404,9 +465,11 @@ if ($id || $ref) print '
    '; print ''; print $langs->trans("KeywordFilter").'   '; @@ -444,7 +448,7 @@ if ($id > 0 || ! empty($ref)) if ($action == 'search') { print '
    '; - print ''; + print ''; print ''; print ''; print ''; @@ -533,9 +537,11 @@ if ($id > 0 || ! empty($ref)) if($num > 0) { - print '
    trans("Update").'">'; - print '     '; - print '
    '; + print '
    '; + print 'trans("Update").'">'; + print '     '; + print ''; + print '
    '; } print ''; diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 1e8c7b7cd9a..6ca92968e8d 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -75,6 +75,7 @@ $modulepart='produit'; $parameters=array('id'=>$id); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); /* @@ -101,7 +102,7 @@ if ($object->id) dol_fiche_head($head, 'documents', $titre, 0, $picto); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); // Construit liste des fichiers $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); diff --git a/htdocs/product/expression.php b/htdocs/product/expression.php new file mode 100755 index 00000000000..68c57489bfb --- /dev/null +++ b/htdocs/product/expression.php @@ -0,0 +1,221 @@ + + * + * 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 . + */ + +/** + * \file htdocs/product/expression.php + * \ingroup product + * \brief Page for editing expression + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/priceexpression.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/priceparser.class.php'; + +$langs->load("products"); +$langs->load("accountancy"); //"Back" translation is on this file + +$id = GETPOST('id', 'int'); +$eid = GETPOST('eid', 'int'); +$action = GETPOST('action', 'alpha'); +$title = GETPOST('expression_title', 'alpha'); +$expression = GETPOST('expression'); +$tab = GETPOST('tab', 'alpha'); +$tab = (!empty($tab)) ? $tab : 'card'; + +// Security check +$result=restrictedArea($user,'produit|service&fournisseur',$id,'product&product','','','rowid'); + +//Initialize objects +$product = new Product($db); +$product->fetch($id, ''); + +$price_expression = new PriceExpression($db); + +//Fetch expression data +if (empty($eid)) //This also disables fetch when eid == 0 +{ + $eid = 0; +} +else if ($action != 'delete') +{ + $price_expression->fetch($eid); +} + +/* + * Actions + */ + +if ($action == 'add') +{ + if ($eid == 0) + { + $result = $price_expression->find_title($title); + if ($result == 0) //No existing entry found with title, ok + { + //Check the expression validity by parsing it + $priceparser = new PriceParser($db); + $price_result = $priceparser->parseProductSupplierExpression($id, $expression, 0, 0); + if ($price_result < 0) { //Expression is not valid + setEventMessage($priceparser->translatedError(), 'errors'); + } + else + { + $price_expression->title = $title; + $price_expression->expression = $expression; + $result = $price_expression->create($user); + if ($result > 0) //created successfully, set the eid to newly created entry + { + $eid = $price_expression->id; + } + else + { + setEventMessage("add: ".$price_expression->error, 'errors'); + } + } + } + else if ($result < 0) + { + setEventMessage("add find: ".$price_expression->error, 'errors'); + } + else + { + setEventMessage($langs->trans("ErrorRecordAlreadyExists"), 'errors'); + } + } +} + +if ($action == 'update') +{ + if ($eid != 0) + { + $result = $price_expression->find_title($title); + if ($result == 0 || $result == $eid) //No existing entry found with title or existing one is the current one, ok + { + //Check the expression validity by parsing it + $priceparser = new PriceParser($db); + $price_result = $priceparser->parseProductSupplierExpression($id, $expression, 0, 0); + if ($price_result < 0) { //Expression is not valid + setEventMessage($priceparser->translatedError(), 'errors'); + } + else + { + $price_expression->id = $eid; + $price_expression->title = $title; + $price_expression->expression = $expression; + $result = $price_expression->update($user); + if ($result < 0) + { + setEventMessage("update: ".$price_expression->error, 'errors'); + } + } + } + else if ($result < 0) + { + setEventMessage("update find: ".$price_expression->error, 'errors'); + } + else + { + setEventMessage($langs->trans("ErrorRecordAlreadyExists"), 'errors'); + } + } +} + +if ($action == 'delete') +{ + if ($eid != 0) + { + $result = $price_expression->delete($eid, $user); + if ($result < 0) + { + setEventMessage("delete: ".$price_expression->error, 'errors'); + } + $eid = 0; + } +} + +/* + * View + */ + +//Header +llxHeader("","",$langs->trans("CardProduct".$product->type)); +print_fiche_titre($langs->trans("PriceExpressionEditor")); +$form = new Form($db); + +//Form/Table +print '
    '; +print ''; +print ''; +print ''; + +// Price expression selector +print ''; + +// Title input +print ''; + +//Price expression editor +print ''; +print '
    '.$langs->trans("PriceExpressionSelected").''; +$price_expression_list = array(0 => $langs->trans("New")); //Put the new as first option +foreach ($price_expression->list_price_expression() as $entry) { + $price_expression_list[$entry->id] = $entry->title; +} +print $form->selectarray('expression_selection', $price_expression_list, $eid); +print '
    '.$langs->trans("Name").''; +print ''; +print '
    '.$form->textwithpicto($langs->trans("PriceExpressionEditor"),$langs->trans("PriceExpressionEditorHelp"),1).''; +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; +$doleditor=new DolEditor('expression',isset($price_expression->expression)?$price_expression->expression:'','',300,'','',false,false,false,4,80); +$doleditor->Create(); +print '
    '; + +//Buttons +print '
    '; +print ''; +print ''.$langs->trans("Back").''; +if ($eid == 0) +{ + print '
    '.$langs->trans('Delete').'
    '."\n"; +} +else +{ + print ''; +} +print '
    '; + +print '
    '; + +// This code reloads the page depending of selected option, goes back in history when back is pressed +print ''; + +llxFooter(); +$db->close(); diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php old mode 100644 new mode 100755 index 037bb2b1f8b..4f382d3b7f8 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2012 Juanjo Menent * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2014 Ion Agorria * * 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 @@ -30,11 +31,12 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/priceexpression.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/priceparser.class.php'; $langs->load("products"); $langs->load("suppliers"); $langs->load("bills"); -// Charges ???? if (! empty($conf->margin->enabled)) $langs->load("margins"); $id = GETPOST('id', 'int'); @@ -60,14 +62,10 @@ if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'produit|service&fournisseur',$fieldvalue,'product&product','','',$fieldtype); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('pricesuppliercard')); +$hookmanager->initHooks(array('pricesuppliercard','globalcard')); $product = new ProductFournisseur($db); $product->fetch($id,$ref); -$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks -$error=$hookmanager->error; $errors=$hookmanager->errors; - - $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -80,8 +78,8 @@ if (! $sortorder) $sortorder="ASC"; */ $parameters=array('socid'=>$socid, 'id_prod'=>$id); -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks -$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($action == 'remove_pf') { @@ -108,6 +106,7 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel")) $npr = preg_match('/\*/', $_POST['tva_tx']) ? 1 : 0 ; $tva_tx = str_replace('*','', GETPOST('tva_tx','alpha')); $tva_tx = price2num($tva_tx); + $price_expression = GETPOST('eid', 'int') == 0 ? 'NULL' : GETPOST('eid', 'int'); //Discard expression if not in expression mode if ($tva_tx == '') { @@ -131,8 +130,14 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel")) } if ($_POST["price"] < 0 || $_POST["price"] == '') { - $error++; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Price")), 'errors'); + if ($price_expression == 'NULL') { //This is not because of using expression instead of numeric price + $error++; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Price")), 'errors'); + } + else + { + $_POST["price"] = 0; + } } $product = new ProductFournisseur($db); @@ -178,6 +183,26 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel")) { $error++; setEventMessage($product->error, 'errors'); + } + else + { + if ($price_expression != 'NULL') { + //Check the expression validity by parsing it + $priceparser = new PriceParser($db); + $price_result = $priceparser->parseProductSupplier($id, $price_expression, $quantity, $tva_tx); + if ($price_result < 0) { //Expression is not valid + $error++; + setEventMessage($priceparser->translatedError(), 'errors'); + } + } + if (! $error && ! empty($conf->dynamicprices->enabled)) { + $ret=$product->setPriceExpression($price_expression); + if ($ret < 0) + { + $error++; + setEventMessage($product->error, 'errors'); + } + } } } @@ -271,7 +296,7 @@ if ($id || $ref) if ($rowid) { - $product->fetch_product_fournisseur_price($rowid); + $product->fetch_product_fournisseur_price($rowid, 1); //Ignore the math expression when getting the price print_fiche_titre($langs->trans("ChangeSupplierPrice")); } else @@ -373,8 +398,41 @@ if ($id || $ref) print ''; print '
    '.$langs->trans("PriceMode").''; + $price_expression = new PriceExpression($db); + $price_expression_list = array(0 => $langs->trans("PriceNumeric")); //Put the numeric mode as first option + foreach ($price_expression->list_price_expression() as $entry) { + $price_expression_list[$entry->id] = $entry->title; + } + $price_expression_preselection = GETPOST('eid') ? GETPOST('eid') : ($product->fk_price_expression ? $product->fk_price_expression : '0'); + print $form->selectarray('eid', $price_expression_list, $price_expression_preselection); + print ' 
    '.$langs->trans("PriceExpressionEditor").'
    '; + print '
    '.$langs->trans("PriceQtyMin").'
    '.$langs->trans("PriceQtyMin").''; print ' '; print $form->select_PriceBaseType((GETPOST('price_base_type')?GETPOST('price_base_type'):$product->price_base_type), "price_base_type"); @@ -387,15 +445,18 @@ if ($id || $ref) print '
    '.$langs->trans("Charges").''; - print '
    '.$langs->trans("Charges").''; + print '
    '; - print '
    '; - print '   '; - print '
    '; + print '
    '; + print ''; + print '     '; + print ''; + print '
    '; print ''; } @@ -448,11 +511,17 @@ if ($id || $ref) print ''.$langs->trans("VATRate").''; print ''.$langs->trans("PriceQtyMinHT").''; // Charges ???? - if (! empty($conf->margin->enabled)) print ''.$langs->trans("Charges").''; + if ($conf->global->PRODUCT_CHARGES) + { + if (! empty($conf->margin->enabled)) print ''.$langs->trans("Charges").''; + } print_liste_field_titre($langs->trans("UnitPriceHT"),$_SERVER["PHP_SELF"],"pfp.unitprice","",$param,'align="right"',$sortfield,$sortorder); print ''.$langs->trans("DiscountQtyMin").''; // Charges ???? - if (! empty($conf->margin->enabled)) print ''.$langs->trans("UnitCharges").''; + if ($conf->global->PRODUCT_CHARGES) + { + if (! empty($conf->margin->enabled)) print ''.$langs->trans("UnitCharges").''; + } print ''; print "\n"; @@ -498,13 +567,16 @@ if ($id || $ref) print ''; // Charges ???? - if (! empty($conf->margin->enabled)) - { - print ''; - print $productfourn->fourn_charges?price($productfourn->fourn_charges):""; - print ''; + if ($conf->global->PRODUCT_CHARGES) + { + if (! empty($conf->margin->enabled)) + { + print ''; + print $productfourn->fourn_charges?price($productfourn->fourn_charges):""; + print ''; + } } - + // Unit price print ''; print price($productfourn->fourn_unitprice); @@ -516,14 +588,17 @@ if ($id || $ref) print price2num($productfourn->fourn_remise_percent).'%'; print ''; - // Unit Charges ??? - if (! empty($conf->margin->enabled)) + // Charges ???? + if ($conf->global->PRODUCT_CHARGES) { - print ''; - print $productfourn->fourn_unitcharges?price($productfourn->fourn_unitcharges) : ($productfourn->fourn_qty?price($productfourn->fourn_charges/$productfourn->fourn_qty):" "); - print ''; + if (! empty($conf->margin->enabled)) + { + print ''; + print $productfourn->fourn_unitcharges?price($productfourn->fourn_unitcharges) : ($productfourn->fourn_qty?price($productfourn->fourn_charges/$productfourn->fourn_qty):" "); + print ''; + } } - + if (is_object($hookmanager)) { $parameters=array('id_pfp'=>$productfourn->product_fourn_price_id,'id_fourn'=>$id_fourn,'prod_id'=>$product->id); diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 0ace0fdc190..820f0829b61 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -1,8 +1,8 @@ - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2014 Charles-Fr BENKE +/* Copyright (C) 2001-2006 Rodolphe Quiedeville + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2005-2014 Regis Houssin + * Copyright (C) 2014 Charles-Fr BENKE * * 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 @@ -77,7 +77,7 @@ print '
    '; */ $rowspan=2; if (! empty($conf->barcode->enabled)) $rowspan++; -print '
    '; +print ''; print ''; print ''; print ""; @@ -123,26 +123,26 @@ print '"; - $statProducts.= ''; + $statProducts.= ''; $statProducts.= ""; $statProducts.= ""; - $statProducts.= ''; + $statProducts.= ''; $statProducts.= ""; $statProducts.= ""; - $statProducts.= ''; + $statProducts.= ''; $statProducts.= ""; } if (! empty($conf->service->enabled)) { $statServices = ""; - $statServices.= ''; + $statServices.= ''; $statServices.= ""; $statServices.= ""; - $statServices.= ''; + $statServices.= ''; $statServices.= ""; $statServices.= ""; - $statServices.= ''; + $statServices.= ''; $statServices.= ""; } @@ -167,13 +167,13 @@ print $total; print ''; print '
    '.$langs->trans("Statistics").'product->enabled)) { $statProducts = "
    '.$langs->trans("ProductsNotOnSell").''.round($prodser[0][0]).''.$langs->trans("ProductsNotOnSell").''.round($prodser[0][0]).'
    '.$langs->trans("ProductsOnSell").''.round($prodser[0][1]).''.$langs->trans("ProductsOnSell").''.round($prodser[0][1]).'
    '.$langs->trans("ProductsOnSellAndOnBuy").''.round($prodser[0][2]).''.$langs->trans("ProductsOnSellAndOnBuy").''.round($prodser[0][2]).'
    '.$langs->trans("ServicesNotOnSell").''.round($prodser[1][0]).''.$langs->trans("ServicesNotOnSell").''.round($prodser[1][0]).'
    '.$langs->trans("ServicesOnSell").''.round($prodser[1][1]).''.$langs->trans("ServicesOnSell").''.round($prodser[1][1]).'
    '.$langs->trans("ServicesOnSellAndOnBuy").''.round($prodser[1][2]).''.$langs->trans("ServicesOnSellAndOnBuy").''.round($prodser[1][2]).'
    '; -if (! empty($conf->categorie->enabled)) +if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHSTATS_ON_PRODUCTS)) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; print '
    '; print ''; print ''; - print ''; print ''; @@ -462,7 +462,7 @@ else } // Better buy price - if ($user->rights->produit->creer) + if ($user->rights->fournisseur->lire) { print ''; - + $product_static->status_buy = $objp->tobuy; + $product_static->status = $objp->tosell; // Status (to sell) - print ''; + print ''; + + // Status (to buy) + print ''; print ''; @@ -523,7 +537,7 @@ else $param.=($fourn_id?"&fourn_id=".$fourn_id:""); $param.=($search_categ?"&search_categ=".$search_categ:""); $param.=isset($type)?"&type=".$type:""; - print_barre_liste('', $page, "liste.php", $param, $sortfield, $sortorder,'',$num,$nbtotalofrecords); + print_barre_liste('', $page, "list.php", $param, $sortfield, $sortorder,'',$num,$nbtotalofrecords); $db->free($resql); diff --git a/htdocs/product/photos.php b/htdocs/product/photos.php index 09f03b15437..0ae65a7dec6 100644 --- a/htdocs/product/photos.php +++ b/htdocs/product/photos.php @@ -26,6 +26,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; @@ -59,7 +60,20 @@ if ($id > 0 || ! empty($ref)) if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) { - if ($object->id) $result = $object->add_photo($dir, $_FILES['userfile']); + if ($object->id) + { + if (image_format_supported($_FILES['userfile']['name']) >= 1) + { + $result = $object->add_photo($dir, $_FILES['userfile']); + if ($result > 0) setEventMessage($langs->trans("FileUploaded")); + else setEventMessage($langs->trans("FileNotUploaded"), 'errors'); + } + else + { + $langs->load("errors"); + setEventMessage($langs->trans("ErrorBadImageFormat"), 'errors'); + } + } } if ($action == 'confirm_delete' && $_GET["file"] && $confirm == 'yes' && ($user->rights->produit->creer || $user->rights->service->creer)) diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index 7d1f4da5682..92ad4cfbe1f 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2005 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2014 Marcos García * * 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 @@ -71,7 +72,9 @@ llxHeader('','',$helpurl); $sql = "SELECT count(*) as c"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; $sql.= ' WHERE entity IN ('.getEntity('product', 1).')'; -if (isset($type)) $sql.= " AND fk_product_type = ".$type; +if ($type !== '') { + $sql.= " AND fk_product_type = ".$type; +} $result=$db->query($sql); if ($result) @@ -82,23 +85,26 @@ if ($result) $param = ''; $title = $langs->trans("ListProductServiceByPopularity"); -if (isset($type)) -{ +if ($type !== '') { $param = '&type='.$type; - $title = $langs->trans("ListProductByPopularity"); - if ($type == 1) $title = $langs->trans("ListServiceByPopularity"); + + if ($type == 1) { + $title = $langs->trans("ListServiceByPopularity"); + } else { + $title = $langs->trans("ListProductByPopularity"); + } } -print_barre_liste($title, $page, "popuprop.php",$param,"","","",$num); +print_barre_liste($title, $page, $_SERVER["PHP_SELF"],$param,"","","",$num); print '
    '.$langs->trans("Categories").'
    '; + print '
    '; $sql = "SELECT c.label, count(*) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie_product as cs"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid"; @@ -341,8 +341,12 @@ llxFooter(); $db->close(); - - +/* + * Print html activity for product type + * + * @param int $product_type Type of product + * @return void + */ function activitytrim($product_type) { global $conf,$langs,$db; @@ -367,7 +371,8 @@ function activitytrim($product_type) $result = $db->query($sql); if ($result) { - $tmpyear=$beginyear; + //$tmpyear=$beginyear; // FIXME $beginyear is not defined + $tmpyear=0; $trim1=0; $trim2=0; $trim3=0; diff --git a/htdocs/product/liste.php b/htdocs/product/list.php similarity index 89% rename from htdocs/product/liste.php rename to htdocs/product/list.php index 682cd1dda6a..a5cc97defa7 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/list.php @@ -25,7 +25,7 @@ */ /** - * \file htdocs/product/liste.php + * \file htdocs/product/list.php * \ingroup produit * \brief Page to list products and services */ @@ -69,7 +69,7 @@ $limit = $conf->liste_limit; // Get object canvas (By default, this is not defined, so standard usage of dolibarr) $canvas=GETPOST("canvas"); -$objcanvas=''; +$objcanvas=null; if (! empty($canvas)) { require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; @@ -87,12 +87,14 @@ else $result=restrictedArea($user,'produit|service','','','','','',$objcanvas); * Actions */ -if (isset($_POST["button_removefilter_x"])) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $sref=""; $sbarcode=""; $snom=""; $search_categ=0; + $tosell=""; + $tobuy=""; } @@ -127,28 +129,27 @@ else { $texte = $langs->trans("ProductsAndServices"); } + // Add what we are searching for + if (! empty($sall)) $texte.= " - ".$sall; $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,'; $sql.= ' p.fk_product_type, p.tms as datem,'; - $sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte,'; + $sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; $sql.= ' MIN(pfp.unitprice) as minsellprice'; - $sql .= ', p.desiredstock'; $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; // multilang - if ($conf->global->MAIN_MULTILANGS) // si l'option est active - { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND pl.lang = '".$langs->getDefaultLang() ."'"; - } + if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND pl.lang = '".$langs->getDefaultLang() ."'"; $sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')'; if ($sall) { // For natural search $params = array('p.ref', 'p.label', 'p.description', 'p.note'); // multilang - if ($conf->global->MAIN_MULTILANGS) // si l'option est active + if (! empty($conf->global->MAIN_MULTILANGS)) { + $params[] = 'pl.label'; $params[] = 'pl.description'; $params[] = 'pl.note'; } @@ -169,7 +170,7 @@ else { $params = array('p.label'); // multilang - if ($conf->global->MAIN_MULTILANGS) // si l'option est active + if (! empty($conf->global->MAIN_MULTILANGS)) { $params[] = 'pl.label'; } @@ -199,7 +200,6 @@ else $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); - dol_syslog("product:list.php:", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -210,7 +210,7 @@ else if ($num == 1 && ($sall || $snom || $sref || $sbarcode) && $action != 'list') { $objp = $db->fetch_object($resql); - header("Location: fiche.php?id=".$objp->rowid); + header("Location: card.php?id=".$objp->rowid); exit; } @@ -239,13 +239,13 @@ else $param.=($search_categ?"&search_categ=".$search_categ:""); $param.=isset($type)?"&type=".$type:""; - print_barre_liste($texte, $page, "liste.php", $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); + print_barre_liste($texte, $page, "list.php", $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); if (! empty($catid)) { print "
    "; $c = new Categorie($db); - $ways = $c->print_all_ways(' > ','product/liste.php'); + $ways = $c->print_all_ways(' > ','product/list.php'); print " > ".$ways[0]."
    \n"; print "

    "; } @@ -383,7 +383,7 @@ else print '
    '; print ''; - print ''; + print ''; print '
    '; if ($objp->minsellprice != '') @@ -507,11 +507,25 @@ else } } - // Status (to buy) - print ''.$product_static->LibStatut($objp->tosell,5,0).''.$product_static->LibStatut($objp->tobuy,5,1).''; + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { + print ajax_object_onoff($product_static, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); + } else { + print $product_static->LibStatut($objp->tosell,5,0); + } + print ''; + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { + print ajax_object_onoff($product_static, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); + } else { + print $product_static->LibStatut($objp->tobuy,5,1); + } + print ' 
    '; print ""; -print_liste_field_titre($langs->trans('Ref'), 'popuprop.php', 'p.ref', '', '', '', $sortfield, $sortorder); -print_liste_field_titre($langs->trans('Type'), 'popuprop.php', 'p.type', '', '', '', $sortfield, $sortorder); -print_liste_field_titre($langs->trans('Label'), 'popuprop.php', 'p.label', '', '', '', $sortfield, $sortorder); -print_liste_field_titre($langs->trans('NbOfProposals'), 'popuprop.php', 'c', '', '', 'align="right"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans('Ref'), $_SERVER["PHP_SELF"], 'p.ref', '', '', '', $sortfield, $sortorder); +print_liste_field_titre($langs->trans('Type'), $_SERVER["PHP_SELF"], 'p.type', '', '', '', $sortfield, $sortorder); +print_liste_field_titre($langs->trans('Label'), $_SERVER["PHP_SELF"], 'p.label', '', '', '', $sortfield, $sortorder); +print_liste_field_titre($langs->trans('NbOfProposals'), $_SERVER["PHP_SELF"], 'c', '', '', 'align="right"', $sortfield, $sortorder); print "\n"; $sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type as type, count(*) as c"; @@ -106,7 +112,9 @@ $sql.= " FROM ".MAIN_DB_PREFIX."propaldet as pd"; $sql.= ", ".MAIN_DB_PREFIX."product as p"; $sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')'; $sql.= " AND p.rowid = pd.fk_product"; -if (isset($type)) $sql.= " AND fk_product_type = ".$type; +if ($type !== '') { + $sql.= " AND fk_product_type = ".$type; +} $sql.= " GROUP BY (p.rowid)"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit, $offset); @@ -141,7 +149,7 @@ if ($result) $var=!$var; print ""; - print ''; // MultiPrix -if (! empty($conf->global->PRODUIT_MULTIPRICES)) { - if (! empty($socid)) { +if (! empty($conf->global->PRODUIT_MULTIPRICES)) +{ + // Price and min price are variable (depends on level of company). + if (! empty($socid)) + { $soc = new Societe($db); $soc->id = $socid; $soc->fetch($socid); + // Selling price print ''; - - if ($object->multiprices_base_type ["$soc->price_level"] == 'TTC') { - print ''; - // Prix mini + // Price min print ''; // TVA - print ''; + print ''; } else { for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) { // TVA - if ($i == 1) // We show only price for level 1 + if ($i == 1) // We show only vat for level 1 { print ''; } @@ -393,12 +405,12 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { print ''; if ($object->multiprices_base_type ["$i"] == 'TTC') { - print ''; // Price by quantity - if ($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) { + if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) + { print '
    '; + print ''; if ($objp->type==1) print img_object($langs->trans("ShowService"),"service"); else print img_object($langs->trans("ShowProduct"),"product"); print " "; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index cc566e3ba6d..516a4be9fbd 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -55,11 +55,19 @@ $object = new Product($db); $error=0; + /* * Actions */ -if ($action == 'update_price' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { +if ($action == 'update_price' && GETPOST("cancel")) +{ + + $action=''; +} + +if ($action == 'update_price' && ! GETPOST("cancel") && ($user->rights->produit->creer || $user->rights->service->creer)) +{ $result = $object->fetch($id); $error=0; @@ -341,45 +349,49 @@ if ($isphoto) { print '
    ' . $langs->trans("SellingPrice") . '' . price($object->multiprices_ttc ["$soc->price_level"]); + print ''; + if ($object->multiprices_base_type["$soc->price_level"] == 'TTC') { + print price($object->multiprices_ttc["$soc->price_level"]); } else { - print '' . price($object->multiprices ["$soc->price_level"]); + print price($object->multiprices["$soc->price_level"]); } - - if ($object->multiprices_base_type ["$soc->price_level"]) { - print ' ' . $langs->trans($object->multiprices_base_type ["$soc->price_level"]); + if ($object->multiprices_base_type["$soc->price_level"]) { + print ' ' . $langs->trans($object->multiprices_base_type["$soc->price_level"]); } else { print ' ' . $langs->trans($object->price_base_type); } print '
    ' . $langs->trans("MinPrice") . ''; - if ($object->multiprices_base_type ["$soc->price_level"] == 'TTC') { - print price($object->multiprices_min_ttc ["$soc->price_level"]) . ' ' . $langs->trans($object->multiprices_base_type ["$soc->price_level"]); + if ($object->multiprices_base_type["$soc->price_level"] == 'TTC') + { + print price($object->multiprices_min_ttc["$soc->price_level"]) . ' ' . $langs->trans($object->multiprices_base_type["$soc->price_level"]); } else { - print price($object->multiprices_min ["$soc->price_level"]) . ' ' . $langs->trans($object->multiprices_base_type ["$soc->price_level"]); + print price($object->multiprices_min["$soc->price_level"]) . ' ' . $langs->trans(empty($object->multiprices_base_type["$soc->price_level"])?'HT':$object->multiprices_base_type["$soc->price_level"]); } print '
    ' . $langs->trans("VATRate") . '' . vatrate($object->multiprices_tva_tx ["$soc->price_level"], true) . '
    ' . $langs->trans("VATRate") . '' . vatrate($object->multiprices_tva_tx["$soc->price_level"], true) . '
    ' . $langs->trans("VATRate") . '' . vatrate($object->multiprices_tva_tx [1], true) . '
    ' . price($object->multiprices_ttc ["$i"]); + print '' . price($object->multiprices_ttc["$i"]); } else { - print '' . price($object->multiprices ["$i"]); + print '' . price($object->multiprices["$i"]); } - if ($object->multiprices_base_type ["$i"]) { + if ($object->multiprices_base_type["$i"]) { print ' ' . $langs->trans($object->multiprices_base_type ["$i"]); } else { print ' ' . $langs->trans($object->price_base_type); @@ -407,20 +419,25 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { // Prix mini print '
    ' . $langs->trans("MinPrice") . ' ' . $i . ''; - if ($object->multiprices_base_type ["$i"] == 'TTC') { - print price($object->multiprices_min_ttc ["$i"]) . ' ' . $langs->trans($object->multiprices_base_type ["$i"]); - } else { - print price($object->multiprices_min ["$i"]) . ' ' . $langs->trans($object->multiprices_base_type ["$i"]); + if (empty($object->multiprices_base_type["$i"])) $object->multiprices_base_type["$i"]="HT"; + if ($object->multiprices_base_type["$i"] == 'TTC') + { + print price($object->multiprices_min_ttc["$i"]) . ' ' . $langs->trans($object->multiprices_base_type["$i"]); + } + else + { + print price($object->multiprices_min["$i"]) . ' ' . $langs->trans($object->multiprices_base_type["$i"]); } print '
    ' . $langs->trans("PriceByQuantity") . ' ' . $i; print ''; if ($object->prices_by_qty [$i] == 1) { - print ''; + print '
    '; print ''; print ''; @@ -430,30 +447,30 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { print ''; print ''; foreach ($object->prices_by_qty_list [$i] as $ii => $prices) { - if ($action == 'edit_price_by_qty' && $rowid == $prices ['rowid'] && ($user->rights->produit->creer || $user->rights->service->creer)) { + if ($action == 'edit_price_by_qty' && $rowid == $prices['rowid'] && ($user->rights->produit->creer || $user->rights->service->creer)) { print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; - print ''; - print ''; + print ''; + print ''; // print ''; - print ''; + print ''; print ''; print ''; print ''; } else { print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; print ''; @@ -509,7 +526,8 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { print ''; // Price by quantity - if ($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) { + if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) + { print '"; } // Price by quantity - if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) { + if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) + { $type = ($objp->price_by_qty == 1) ? 'PriceByQuantity' : 'Standard'; print '"; } @@ -801,7 +825,7 @@ if ($result) { print ''; // User - print ''; + print ''; // Action if ($user->rights->produit->supprimer) { @@ -923,8 +947,11 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print '
    ' . $langs->trans("PriceByQuantityRange") . ' ' . $i . ' 
     ' . $object->price_base_type . ' ' . $object->price_base_type . '  % %
    ' . $prices ['quantity'] . '' . price($prices ['price']) . '' . price($prices ['unitprice']) . '' . price($prices ['remise_percent']) . ' %' . price($prices['price']) . '' . price($prices['unitprice']) . '' . price($prices['remise_percent']) . ' %'; if (($user->rights->produit->creer || $user->rights->service->creer)) { - print ''; + print ''; print img_edit() . ''; - print ''; + print ''; print img_delete() . ''; } else { print ' '; @@ -465,7 +482,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { if ($action != 'edit_price_by_qty' && ($user->rights->produit->creer || $user->rights->service->creer)) { print '
    '; print ''; - print ''; + print ''; print ''; print '
    ' . $langs->trans("PriceByQuantity"); if ($object->prices_by_qty [0] == 0) { print ' ' . $langs->trans("Activate"); @@ -517,7 +535,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { print ''; if ($object->prices_by_qty [0] == 1) { - print ''; + print '
    '; print ''; print ''; print ''; @@ -525,31 +543,33 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { print ''; print ''; print ''; - foreach ($object->prices_by_qty_list [0] as $ii => $prices) { - if ($action == 'edit_price_by_qty' && $rowid == $prices ['rowid'] && ($user->rights->produit->creer || $user->rights->service->creer)) { + foreach ($object->prices_by_qty_list [0] as $ii => $prices) + { + if ($action == 'edit_price_by_qty' && $rowid == $prices['rowid'] && ($user->rights->produit->creer || $user->rights->service->creer)) + { print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; - print ''; - print ''; + print ''; + print ''; // print ''; - print ''; + print ''; print ''; print ''; print ''; } else { print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print '
    ' . $langs->trans("PriceByQuantityRange") . '' . $langs->trans("HT") . '' . $langs->trans("Discount") . ' 
     ' . $object->price_base_type . ' ' . $object->price_base_type . '  % %
    ' . $prices ['quantity'] . '' . price($prices ['price']) . '' . price($prices ['unitprice']) . '' . price($prices ['remise_percent']) . ' %' . $prices['quantity'] . '' . price($prices['price']) . '' . price($prices['unitprice']) . '' . price($prices['remise_percent']) . ' %'; if (($user->rights->produit->creer || $user->rights->service->creer)) { - print ''; + print ''; print img_edit() . ''; - print ''; + print ''; print img_delete() . ''; } else { print ' '; @@ -662,8 +682,11 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> print '
    '; - print '

     '; - print '
    '; + print '
    '; + print ''; + print '     '; + print ''; + print '
    '; print '
    '; } else { @@ -788,7 +811,8 @@ if ($result) { print '
    ' . $objp->price_level . "' . $langs->trans($type) . "' . price($objp->price_min_ttc) . '' . img_object($langs->trans("ShowUser"), 'user') . ' ' . $objp->login . '' . img_object($langs->trans("ShowUser"), 'user') . ' ' . $objp->login . '
    '; - print '

     '; - print '
    '; + print '
    '; + print ''; + print '     '; + print ''; + print '
    '; print '
    '; } elseif ($action == 'edit_customer_price') { @@ -1005,8 +1032,11 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print '
    '; - print '

     '; - print '
    '; + print '
    '; + print ''; + print '     '; + print ''; + print '
    '; print '
    '; } elseif ($action == 'showlog_customer_price') { diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index d0b8c961afa..c8480d6e65a 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -63,7 +63,7 @@ $search_categ = GETPOST("search_categ"); // Get object canvas (By default, this is not defined, so standard usage of dolibarr) $canvas=GETPOST("canvas"); -$objcanvas=''; +$objcanvas=null; if (! empty($canvas)) { require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; @@ -173,7 +173,7 @@ if ($resql) if ($num == 1 && ($sall or $snom or $sref)) { $objp = $db->fetch_object($resql); - header("Location: fiche.php?id=$objp->rowid"); + header("Location: card.php?id=$objp->rowid"); exit; } @@ -194,11 +194,11 @@ if ($resql) if ($sref || $snom || $sall || GETPOST('search')) { - print_barre_liste($texte, $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num); } else { - print_barre_liste($texte, $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num); } if (! empty($catid)) @@ -211,7 +211,7 @@ if ($resql) print "

    "; } - print '
    '; + print ''; print ''; print ''; print ''; @@ -240,12 +240,12 @@ if ($resql) // Lignes des titres print ""; - print_liste_field_titre($langs->trans("Ref"),"reassort.php", "p.ref",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),"reassort.php", "p.label",$param,"","",$sortfield,$sortorder); - if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre($langs->trans("Duration"),"reassort.php", "p.duration",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("StockLimit"),"reassort.php", "p.seuil_stock_alerte",$param,"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DesiredStock"),"reassort.php", "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PhysicalStock"),"reassort.php", "stock_physique",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder); + if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("StockLimit"), $_SERVER["PHP_SELF"], "p.seuil_stock_alerte",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DesiredStock"), $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stock_physique",$param,"",'align="right"',$sortfield,$sortorder); // TODO Add info of running suppliers/customers orders //print_liste_field_titre($langs->trans("TheoreticalStock"),"reassort.php", "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder); print ' '; diff --git a/htdocs/product/stats/fiche.php b/htdocs/product/stats/card.php similarity index 99% rename from htdocs/product/stats/fiche.php rename to htdocs/product/stats/card.php index 8b366a40958..9600e6c0a44 100644 --- a/htdocs/product/stats/fiche.php +++ b/htdocs/product/stats/card.php @@ -20,7 +20,7 @@ */ /** - * \file htdocs/product/stats/fiche.php + * \file htdocs/product/stats/card.php * \ingroup product * \brief Page of product statistics */ diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 97e9a612ae1..472b9ce4a45 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -67,10 +67,10 @@ if ($id > 0 || ! empty($ref)) { $product = new Product($db); $result = $product->fetch($id, $ref); - + $parameters=array('id'=>$id); $reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks - $error=$hookmanager->error; $errors=$hookmanager->errors; + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); llxHeader("","",$langs->trans("CardProduct".$product->type)); @@ -83,8 +83,9 @@ if ($id > 0 || ! empty($ref)) $titre=$langs->trans("CardProduct".$product->type); $picto=($product->type==1?'service':'product'); dol_fiche_head($head, 'referers', $titre, 0, $picto); - + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); print ''; @@ -117,7 +118,7 @@ if ($id > 0 || ! empty($ref)) print ''; - $sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client, c.rowid, c.total_ht as total_ht, c.ref,"; + $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client, c.rowid, c.total_ht as total_ht, c.ref,"; $sql.= " c.date_commande, c.fk_statut as statut, c.facture, c.rowid as commandeid, d.qty"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; @@ -164,10 +165,10 @@ if ($id > 0 || ! empty($ref)) $var=!$var; print ""; - print '\n"; - print ''; + print ''; print "\n"; print ""; diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 22e3e2b30ba..73de0374ebe 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -67,10 +67,10 @@ if ($id > 0 || ! empty($ref)) { $product = new Product($db); $result = $product->fetch($id, $ref); - + $parameters=array('id'=>$id); $reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks - $error=$hookmanager->error; $errors=$hookmanager->errors; + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); llxHeader("","",$langs->trans("CardProduct".$product->type)); @@ -80,8 +80,9 @@ if ($id > 0 || ! empty($ref)) $titre=$langs->trans("CardProduct".$product->type); $picto=($product->type==1?'service':'product'); dol_fiche_head($head, 'referers', $titre, 0, $picto); - + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); print '
    '.img_object($langs->trans("ShowOrder"),"order").' '; + print ''.img_object($langs->trans("ShowOrder"),"order").' '; print $objp->ref; print "'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->nom,44).''.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->name,44).'".$objp->code_client.""; print dol_print_date($db->jdate($objp->date_commande))."
    '; @@ -109,7 +110,7 @@ if ($id > 0 || ! empty($ref)) print "
    "; print '
    '; - $sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client,"; + $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client,"; $sql.= " c.rowid, c.total_ht as total_ht, c.ref,"; $sql.= " c.date_commande, c.fk_statut as statut, c.rowid as commandeid, d.qty"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; @@ -147,7 +148,7 @@ if ($id > 0 || ! empty($ref)) print "\n"; $commandestatic=new CommandeFournisseur($db); - + if ($num > 0) { $var=True; @@ -155,7 +156,7 @@ if ($id > 0 || ! empty($ref)) { $objp = $db->fetch_object($result); $var=!$var; - + $commandestatic->id=$objp->commandeid; $commandestatic->ref=$objp->ref; $commandestatic->statut=$objp->statut; @@ -163,7 +164,7 @@ if ($id > 0 || ! empty($ref)) print ""; print ''.$commandestatic->getNomUrl(1)."\n"; print "\n"; - print ''.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->nom,44).''; + print ''.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->name,44).''; print "".$objp->code_client."\n"; print ''.dol_print_date($db->jdate($objp->date_commande)).""; print "".$objp->qty."\n"; diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index 518daf2b8f1..189ead2eaa2 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -73,7 +73,7 @@ if ($id > 0 || ! empty($ref)) $parameters=array('id'=>$id); $reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks - $error=$hookmanager->error; $errors=$hookmanager->errors; + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); llxHeader("","",$langs->trans("CardProduct".$product->type)); @@ -85,6 +85,7 @@ if ($id > 0 || ! empty($ref)) dol_fiche_head($head, 'referers', $titre, 0, $picto); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); print ''; @@ -123,7 +124,7 @@ if ($id > 0 || ! empty($ref)) $sql.= ' sum('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite <= '".$db->idate($now)."')",1,0).') as nb_late,'; $sql.= ' sum('.$db->ifsql("cd.statut=5",1,0).') as nb_closed,'; $sql.= " c.rowid as rowid, c.date_contrat, c.statut as statut,"; - $sql.= " s.nom, s.rowid as socid, s.code_client"; + $sql.= " s.nom as name, s.rowid as socid, s.code_client"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."contrat as c"; @@ -170,10 +171,10 @@ if ($id > 0 || ! empty($ref)) $var=!$var; print ""; - print '\n"; - print ''; + print ''; print "\n"; print ""; diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 6f717dd4e73..49e5651b065 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2014 Juanjo Menent * * 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 @@ -72,9 +73,10 @@ if ($id > 0 || ! empty($ref)) { $product = new Product($db); $result = $product->fetch($id, $ref); - + $parameters=array('id'=>$id); $reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); llxHeader("","",$langs->trans("CardProduct".$product->type)); @@ -87,8 +89,9 @@ if ($id > 0 || ! empty($ref)) $titre=$langs->trans("CardProduct".$product->type); $picto=($product->type==1?'service':'product'); dol_fiche_head($head, 'referers', $titre, 0, $picto); - + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); print '
    '.img_object($langs->trans("ShowContract"),"contract").' '; + print ''.img_object($langs->trans("ShowContract"),"contract").' '; print $objp->rowid; print "'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->nom,44).''.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->name,44).'".$objp->code_client.""; print dol_print_date($db->jdate($objp->date_contrat))."
    '; @@ -121,7 +124,7 @@ if ($id > 0 || ! empty($ref)) if ($user->rights->facture->lire) { - $sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client,"; + $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client,"; $sql.= " f.facnumber, f.total as total_ht,"; $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid, d.qty"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; @@ -153,7 +156,7 @@ if ($id > 0 || ! empty($ref)) print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","","&id=".$product->id,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&id=".$product->id,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","","&id=".$product->id,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total_ht","","&id=".$product->id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","","&id=".$product->id,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","","&id=".$product->id,'align="right"',$sortfield,$sortorder); print "\n"; @@ -169,7 +172,7 @@ if ($id > 0 || ! empty($ref)) $invoicestatic->ref=$objp->facnumber; print $invoicestatic->getNomUrl(1); print "\n"; - print ''; + print ''; print "\n"; print '"; diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 4cbeaec7e76..d8e30bdae6a 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -72,10 +72,10 @@ if ($id > 0 || ! empty($ref)) { $product = new Product($db); $result = $product->fetch($id, $ref); - + $parameters=array('id'=>$id); $reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks - $error=$hookmanager->error; $errors=$hookmanager->errors; + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); llxHeader("","",$langs->trans("CardProduct".$product->type)); @@ -88,9 +88,9 @@ if ($id > 0 || ! empty($ref)) $titre=$langs->trans("CardProduct".$product->type); $picto=($product->type==1?'service':'product'); dol_fiche_head($head, 'referers', $titre, 0, $picto); - - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); print '
    '.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->nom,44).''.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->name,44).'".$objp->code_client."'; print dol_print_date($db->jdate($objp->datef),'day')."
    '; @@ -122,7 +122,7 @@ if ($id > 0 || ! empty($ref)) print ''; - $sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client, f.ref, f.total_ht as total_ht,"; + $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client, f.ref, f.total_ht as total_ht,"; $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid, d.qty"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; @@ -172,7 +172,7 @@ if ($id > 0 || ! empty($ref)) $supplierinvoicestatic->ref=$objp->facnumber; print $supplierinvoicestatic->getNomUrl(1); print "\n"; - print ''; + print ''; print "\n"; print ""; diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index e9a78f18b05..566961d9c5f 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -66,9 +66,10 @@ if ($id > 0 || ! empty($ref)) { $product = new Product($db); $result = $product->fetch($id, $ref); - + $parameters=array('id'=>$id); $reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); llxHeader("","",$langs->trans("CardProduct".$product->type)); @@ -78,9 +79,9 @@ if ($id > 0 || ! empty($ref)) $titre=$langs->trans("CardProduct".$product->type); $picto=($product->type==1?'service':'product'); dol_fiche_head($head, 'referers', $titre,0,$picto); - - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); print '
    '.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->nom,44).''.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->name,44).'".$objp->code_client.""; print dol_print_date($db->jdate($objp->datef))."
    '; @@ -112,7 +113,7 @@ if ($id > 0 || ! empty($ref)) print ''; - $sql = "SELECT DISTINCT s.nom, s.rowid as socid, p.rowid as propalid, p.ref, p.total_ht as amount,"; + $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, p.rowid as propalid, p.ref, p.total_ht as amount,"; $sql.= "p.datep, p.fk_statut as statut, d.qty"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; @@ -160,7 +161,7 @@ if ($id > 0 || ! empty($ref)) print ''."\n"; - print ''; + print ''; print '"; print "\n"; diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/card.php similarity index 81% rename from htdocs/product/stock/fiche.php rename to htdocs/product/stock/card.php index 86e930d8cf1..b31305b448b 100644 --- a/htdocs/product/stock/fiche.php +++ b/htdocs/product/stock/card.php @@ -1,8 +1,8 @@ - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005 Simon Tosser - * Copyright (C) 2005-2009 Regis Houssin +/* Copyright (C) 2003-2006 Rodolphe Quiedeville + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2005 Simon Tosser + * Copyright (C) 2005-2014 Regis Houssin * * 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 @@ -19,7 +19,7 @@ */ /** - * \file htdocs/product/stock/fiche.php + * \file htdocs/product/stock/card.php * \ingroup stock * \brief Page fiche entrepot */ @@ -36,6 +36,8 @@ $langs->load("stocks"); $langs->load("companies"); $action=GETPOST('action'); +$cancel=GETPOST('cancel'); +$confirm=GETPOST('confirm'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -43,11 +45,13 @@ $id = GETPOST("id",'int'); if (! $sortfield) $sortfield="p.ref"; if (! $sortorder) $sortorder="DESC"; +$backtopage=GETPOST("backtopage"); + // Security check $result=restrictedArea($user,'stock'); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('warehousecard')); +$hookmanager->initHooks(array('warehousecard','globalcard')); /* @@ -59,26 +63,39 @@ if ($action == 'add' && $user->rights->stock->creer) { $object = new Entrepot($db); - $object->ref = $_POST["ref"]; - $object->libelle = $_POST["libelle"]; - $object->description = $_POST["desc"]; - $object->statut = $_POST["statut"]; - $object->lieu = $_POST["lieu"]; - $object->address = $_POST["address"]; - $object->zip = $_POST["zipcode"]; - $object->town = $_POST["town"]; - $object->country_id = $_POST["country_id"]; + $object->ref = GETPOST("ref"); + $object->libelle = GETPOST("libelle"); + $object->description = GETPOST("desc"); + $object->statut = GETPOST("statut"); + $object->lieu = GETPOST("lieu"); + $object->address = GETPOST("address"); + $object->zip = GETPOST("zipcode"); + $object->town = GETPOST("town"); + $object->country_id = GETPOST("country_id"); - if ($object->libelle) { + if (! empty($object->libelle)) + { $id = $object->create($user); if ($id > 0) { - header("Location: fiche.php?id=".$id); - exit; - } + setEventMessage($langs->trans("RecordSaved")); - $action = 'create'; - setEventMessage($object->error, 'errors'); + if (! empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } + else + { + header("Location: card.php?id=".$id); + exit; + } + } + else + { + $action = 'create'; + setEventMessage($object->error, 'errors'); + } } else { setEventMessage($langs->trans("ErrorWarehouseRefRequired"), 'errors'); @@ -87,14 +104,14 @@ if ($action == 'add' && $user->rights->stock->creer) } // Delete warehouse -if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->stock->supprimer) +if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->stock->supprimer) { $object = new Entrepot($db); $object->fetch($_REQUEST["id"]); $result=$object->delete($user); if ($result > 0) { - header("Location: ".DOL_URL_ROOT.'/product/stock/liste.php'); + header("Location: ".DOL_URL_ROOT.'/product/stock/list.php'); exit; } else @@ -105,19 +122,19 @@ if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->right } // Modification entrepot -if ($action == 'update' && $_POST["cancel"] <> $langs->trans("Cancel")) +if ($action == 'update' && $cancel <> $langs->trans("Cancel")) { $object = new Entrepot($db); if ($object->fetch($id)) { - $object->libelle = $_POST["libelle"]; - $object->description = $_POST["desc"]; - $object->statut = $_POST["statut"]; - $object->lieu = $_POST["lieu"]; - $object->address = $_POST["address"]; - $object->zip = $_POST["zipcode"]; - $object->town = $_POST["town"]; - $object->country_id = $_POST["country_id"]; + $object->libelle = GETPOST("libelle"); + $object->description = GETPOST("desc"); + $object->statut = GETPOST("statut"); + $object->lieu = GETPOST("lieu"); + $object->address = GETPOST("address"); + $object->zip = GETPOST("zipcode"); + $object->town = GETPOST("town"); + $object->country_id = GETPOST("country_id"); if ( $object->update($id, $user) > 0) { @@ -136,7 +153,7 @@ if ($action == 'update' && $_POST["cancel"] <> $langs->trans("Cancel")) } } -if ($_POST["cancel"] == $langs->trans("Cancel")) +if ($cancel == $langs->trans("Cancel")) { $action = ''; } @@ -159,40 +176,42 @@ if ($action == 'create') { print_fiche_titre($langs->trans("NewWarehouse")); - print "\n"; + print "\n"; print ''; print ''; - print ''."\n"; + print ''; + + dol_fiche_head(); print '
    '.img_object($langs->trans("ShowPropal"),"propal").' '; print $objp->ref; print ''.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->nom,44).''.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->name,44).''; print dol_print_date($db->jdate($objp->datep))."".$objp->qty."
    '; // Ref print ''; - print ''; + print ''; // Description print ''; print ''; // Zip / Town print ''; // Country print ''; @@ -205,7 +224,9 @@ if ($action == 'create') print '
    '.$langs->trans("Ref").'
    '.$langs->trans("LocationSummary").'
    '.$langs->trans("LocationSummary").'
    '.$langs->trans("Description").''; // Editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('desc',$object->description,'',180,'dolibarr_notes','In',false,true,$conf->fckeditor->enabled,5,70); + $doleditor=new DolEditor('desc',(!empty($object->description)?$object->description:''),'',180,'dolibarr_notes','In',false,true,$conf->fckeditor->enabled,5,70); $doleditor->Create(); print '
    '.$langs->trans('Address').'
    '.$langs->trans('Zip').''; - print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'),6); + print $formcompany->select_ziptown((!empty($object->zip)?$object->zip:''),'zipcode',array('town','selectcountry_id','state_id'),6); print ''.$langs->trans('Town').''; - print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id')); + print $formcompany->select_ziptown((!empty($object->town)?$object->town:''),'town',array('zipcode','selectcountry_id','state_id')); print '
    '.$langs->trans('Country').''; - print $form->select_country($object->country_id?$object->country_id:$mysoc->country_code,'country_id'); + print $form->select_country((!empty($object->country_id)?$object->country_id:$mysoc->country_code),'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
    '; - print '

    '; + dol_fiche_end(); + + print '
    '; print ''; } @@ -238,7 +259,7 @@ else print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print ''; + print ''; // Total PMP - print ''; - $totalvalue+=price2num($objp->pmp*$objp->value,'MT'); + print ''; + $totalvalue+=price2num($objp->ppmp*$objp->value,'MT'); // Price sell min if (empty($conf->global->PRODUIT_MULTIPRICES)) @@ -491,7 +512,7 @@ else { $langs->trans("WarehouseEdit"); - print ''; + print ''; print ''; print ''; print ''; @@ -537,8 +558,11 @@ else print '
    '.$langs->trans("Ref").''; @@ -261,7 +282,7 @@ else // Country print '
    '.$langs->trans('Country').''; - if (! empty($object->country_code)) + if (! empty($object->country_code)) { $img=picto_from_langcode($object->country_code); print ($img?$img.' ':''); @@ -336,17 +357,17 @@ else if (empty($action)) { if ($user->rights->stock->creer) - print "id."\">".$langs->trans("Modify").""; + print "id."\">".$langs->trans("Modify").""; else print "".$langs->trans("Modify").""; - + if ($user->rights->stock->supprimer) - print "id."\">".$langs->trans("Delete").""; + print "id."\">".$langs->trans("Delete").""; else print "".$langs->trans("Delete").""; } } - + print ""; @@ -375,7 +396,7 @@ else $sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.fk_product_type as type, p.pmp as ppmp, p.price, p.price_ttc,"; $sql.= " ps.pmp, ps.reel as value"; - $sql.= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p"; + $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p"; $sql.= " WHERE ps.fk_product = p.rowid"; $sql.= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse) $sql.= " AND ps.fk_entrepot = ".$object->id; @@ -424,10 +445,10 @@ else $totalunit+=$objp->value; // Price buy PMP - print ''.price(price2num($objp->pmp,'MU')).''.price(price2num($objp->ppmp,'MU')).''.price(price2num($objp->pmp*$objp->value,'MT')).''.price(price2num($objp->ppmp*$objp->value,'MT')).'
    '; - print '

     '; - print '
    '; + print '
    '; + print ''; + print '     '; + print ''; + print '
    '; print ''; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 78d4cc55a4e..c0627015be3 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -186,12 +186,12 @@ class Entrepot extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."stock_mouvement"; $sql.= " WHERE fk_entrepot = " . $this->id; - dol_syslog("Entrepot::delete", LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql1=$this->db->query($sql); $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_stock"; $sql.= " WHERE fk_entrepot = " . $this->id; - dol_syslog("Entrepot::delete", LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql2=$this->db->query($sql); if ($resql1 && $resql2) @@ -202,8 +202,8 @@ class Entrepot extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql1=$this->db->query($sql); - // Update denormalized fields because we change content of produt_stock - $sql = "UPDATE ".MAIN_DB_PREFIX."product p SET p.stock= (SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock ps WHERE ps.fk_product = p.rowid)"; + // Update denormalized fields because we change content of produt_stock. Warning: Do not use "SET p.stock", does not works with pgsql + $sql = "UPDATE ".MAIN_DB_PREFIX."product as p SET stock = (SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock as ps WHERE ps.fk_product = p.rowid)"; dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql2=$this->db->query($sql); @@ -217,7 +217,7 @@ class Entrepot extends CommonObject { $this->db->rollback(); $this->error=$this->db->lasterror(); - return -1; + return -2; } } else @@ -513,10 +513,10 @@ class Entrepot extends CommonObject $result=''; - $lien=''; + $lien=''; $lienfin=''; - if ($withpicto) $result.=($lien.img_object($langs->trans("ShowStock"),'stock').$lienfin.' '); + if ($withpicto) $result.=($lien.img_object($langs->trans("ShowStock"), 'stock', 'class="classfortooltip"').$lienfin.' '); $result.=$lien.$this->libelle.$lienfin; return $result; } @@ -540,7 +540,7 @@ class Entrepot extends CommonObject $this->description = 'WAREHOUSE SPECIMEN '.dol_print_date($now,'dayhourlog'); $this->statut=1; $this->specimen=1; - + $this->lieu='Location test'; $this->address='21 jump street'; $this->zip='99999'; diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 9e508f41461..ad99f68c9b0 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -163,21 +163,40 @@ class MouvementStock extends CommonObject { $newpmp=0; $newpmpwarehouse=0; - // Note: PMP is calculated on stock input only (type = 0 or 3). If type == 0 or 3, qty should be > 0. + // Note: PMP is calculated on stock input only (type of movement = 0 or 3). If type == 0 or 3, qty should be > 0. // Note: Price should always be >0 or 0. PMP should be always >0 (calculated on input) if (($type == 0 || $type == 3) && $price > 0) { + // If we will change PMP for the warehouse we edit and the product, we must first check/clean that PMP is defined + // on every stock entry with old value (so global updated value will match recalculated value from product_stock) + $sql = "UPDATE ".MAIN_DB_PREFIX."product_stock SET pmp = ".($oldpmp?$oldpmp:'0'); + $sql.= " WHERE pmp = 0 AND fk_product = ".$fk_product; + dol_syslog(get_class($this)."::_create", LOG_DEBUG); + $resql=$this->db->query($sql); + if (! $resql) + { + $this->error=$this->db->lasterror(); + $error = -4; + } + $oldqtytouse=($oldqty >= 0?$oldqty:0); // We make a test on oldpmp>0 to avoid to use normal rule on old data with no pmp field defined if ($oldpmp > 0) $newpmp=price2num((($oldqtytouse * $oldpmp) + ($qty * $price)) / ($oldqtytouse + $qty), 'MU'); - else $newpmp=$price; - $oldqtywarehousetouse=($oldqtywarehouse >= 0?$oldqtywarehouse:0); + else + { + $newpmp=$price; // For this product, PMP was not yet set. We will set it later. + } + $oldqtywarehousetouse=$oldqtywarehouse; if ($oldpmpwarehouse > 0) $newpmpwarehouse=price2num((($oldqtywarehousetouse * $oldpmpwarehouse) + ($qty * $price)) / ($oldqtywarehousetouse + $qty), 'MU'); else $newpmpwarehouse=$price; - //print "oldqtytouse=".$oldqtytouse." oldpmp=".$oldpmp." oldqtywarehousetouse=".$oldqtywarehousetouse." oldpmpwarehouse=".$oldpmpwarehouse." "; - //print "qty=".$qty." newpmp=".$newpmp." newpmpwarehouse=".$newpmpwarehouse; - //exit; + /*print "oldqtytouse=".$oldqtytouse." oldpmp=".$oldpmp." oldqtywarehousetouse=".$oldqtywarehousetouse." oldpmpwarehouse=".$oldpmpwarehouse." "; + print "qty=".$qty." newpmp=".$newpmp." newpmpwarehouse=".$newpmpwarehouse; + exit;*/ + } + else if ($type == 1 || $type == 2) + { + // After a stock decrease, we don't change value of PMP for product. } else { @@ -207,14 +226,17 @@ class MouvementStock extends CommonObject { $this->error=$this->db->lasterror(); $error = -3; - } else if(empty($fk_product_stock)){ + } + else if(empty($fk_product_stock)) + { $fk_product_stock = $this->db->last_insert_id(MAIN_DB_PREFIX."product_stock"); } - } + } // Update detail stock for sell-by date - if (($product->hasbatch()) && (! $error) && (! $skip_sellby)){ + if (($product->hasbatch()) && (! $error) && (! $skip_sellby)) + { $param_batch=array('fk_product_stock' =>$fk_product_stock, 'eatby'=>$eatby,'sellby'=>$sellby,'batchnumber'=>$batch); $result=$this->_create_batch($param_batch, $qty); if ($result<0) $error++; @@ -245,7 +267,6 @@ class MouvementStock extends CommonObject if ($movestock && ! $error) { - $this->product_id = $fk_product; $this->entrepot_id = $entrepot_id; $this->qty = $qty; @@ -474,7 +495,14 @@ class MouvementStock extends CommonObject } } - + + /** + * Get origin + * + * @param variant $fk_origin id of origin + * @param int $origintype origin type + * @return string name url + */ function get_origin($fk_origin, $origintype) { switch ($origintype) { case 'commande': diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index 1309da95a2a..dc394f898dc 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -15,7 +15,6 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * */ /** @@ -51,7 +50,7 @@ print '
    '; /* * Zone recherche entrepot */ -print '
    '; +print ''; print ''; print ''; print ""; @@ -89,7 +88,7 @@ if ($result) $objp = $db->fetch_object($result); $var=!$var; print ""; - print "\n"; + print "\n"; print ''; print "\n"; $i++; @@ -146,10 +145,10 @@ if ($resql) $var=!$var; print ""; print ''; - print "\n"; - print '\n"; print '"; - print ''; + print ''; // Location print ''; // PMP value diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 87fec698274..8a0b7297e2f 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2013 Laurent Destaileur + * Copyright (C) 2014 Regis Houssin * * 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 @@ -228,7 +229,7 @@ $warehousestatict = new Entrepot($db); $title = $langs->trans('MassMovement'); -llxHeader('', $title, $helpurl, ''); +llxHeader('', $title); print_fiche_titre($langs->trans("MassStockMovement")).'

    '; @@ -249,6 +250,8 @@ print ''; print '
    rowid\">".img_object($langs->trans("ShowStock"),"stock")." ".$objp->label."rowid\">".img_object($langs->trans("ShowStock"),"stock")." ".$objp->label."'.$entrepot->LibStatut($objp->statut,5).'
    '.dol_print_date($db->jdate($objp->datem),'dayhour').'rowid\">"; + print "rowid\">"; print img_object($langs->trans("ShowProduct"),"product").' '.$objp->produit; print "'; + print ''; print img_object($langs->trans("ShowWarehouse"),"stock").' '.$objp->stock; print "'; diff --git a/htdocs/product/stock/liste.php b/htdocs/product/stock/list.php similarity index 88% rename from htdocs/product/stock/liste.php rename to htdocs/product/stock/list.php index 04a9c03aa59..c85c501fa58 100644 --- a/htdocs/product/stock/liste.php +++ b/htdocs/product/stock/list.php @@ -1,7 +1,7 @@ - * Copyright (C) 2004-2014 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin +/* Copyright (C) 2001-2004 Rodolphe Quiedeville + * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2005-2014 Regis Houssin * * 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 @@ -18,7 +18,7 @@ */ /** - * \file htdocs/product/stock/liste.php + * \file htdocs/product/stock/list.php * \ingroup stock * \brief Page with warehouse and stock value */ @@ -31,15 +31,15 @@ $langs->load("stocks"); // Security check $result=restrictedArea($user,'stock'); -$sref=GETPOST("sref");; -$snom=GETPOST("snom"); -$sall=GETPOST("sall"); +$sref=GETPOST("sref","alpha"); +$snom=GETPOST("snom","alpha"); +$sall=GETPOST("sall","alpha"); $sortfield = GETPOST("sortfield"); $sortorder = GETPOST("sortorder"); if (! $sortfield) $sortfield="e.label"; if (! $sortorder) $sortorder="ASC"; -$page = $_GET["page"]; +$page = GETPOST("page"); if ($page < 0) $page = 0; $limit = $conf->liste_limit; $offset = $limit * $page; @@ -52,7 +52,7 @@ $year = strftime("%Y",time()); */ $sql = "SELECT e.rowid, e.label as ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays,"; -$sql.= " SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; +$sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid"; @@ -104,7 +104,7 @@ if ($result) { $objp = $db->fetch_object($result); print "
    '.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->ref.''.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->ref.''.$objp->lieu.'
    '; //print '
    '; +$param=''; + print '
    '; print getTitleFieldOfList($langs->trans('ProductRef'),0,$_SERVER["PHP_SELF"],'',$param,'','class="tagtd"',$sortfield,$sortorder); print getTitleFieldOfList($langs->trans('WarehouseSource'),0,$_SERVER["PHP_SELF"],'',$param,'','class="tagtd"',$sortfield,$sortorder); diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 1498b12a033..1bac6b9fef5 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -1,7 +1,7 @@ - * Copyright (C) 2004-2013 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin +/* Copyright (C) 2001-2006 Rodolphe Quiedeville + * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2005-2014 Regis Houssin * * 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 @@ -60,7 +60,7 @@ $offset = $conf->liste_limit * $page; if (! $sortfield) $sortfield="m.datem"; if (! $sortorder) $sortorder="DESC"; -if (GETPOST("button_removefilter")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $year=''; $month=''; @@ -213,7 +213,7 @@ if ($resql) print '
    '; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print '
    '.$langs->trans("Ref").''; @@ -332,9 +332,13 @@ if ($resql) print '
    '; - print '
     '; - print '
    '; - print '
    '; + print '
    '; + print ''; + print '     '; + print ''; + print '
    '; + + print ''; } /* @@ -370,8 +374,11 @@ if ($resql) print ''; - print '
     '; - print '
    '; + print '
    '; + print ''; + print '     '; + print ''; + print '
    '; print ''; } @@ -406,8 +413,8 @@ if ($resql) if ($search_product_ref) $param.='&search_product_ref='.urlencode($search_product_ref); if ($search_product) $param.='&search_product='.urlencode($search_product); if ($search_warehouse) $param.='&search_warehouse='.urlencode($search_warehouse); - if ($sref) $param.='&sref='.urlencode($sref); - if ($snom) $param.='&snom='.urlencode($snom); + if (!empty($sref)) $param.='&sref='.urlencode($sref); // FIXME $sref is not defined + if (!empty($snom)) $param.='&snom='.urlencode($snom); // FIXME $snom is not defined if ($search_user) $param.='&search_user='.urlencode($search_user); if ($idproduct > 0) $param.='&idproduct='.$idproduct; if ($id) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num,0,''); @@ -461,7 +468,6 @@ if ($resql) print ''; print ''; print ''; - print '  '; print ''; print ''; print "\n"; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index a2096c49f14..352750295af 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2013 Juanjo Menent - * Copyright (C) 2014 Cédric Gross + * Copyright (C) 2014-2015 Cédric Gross * * 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 @@ -31,6 +31,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; if (! empty($conf->productbatch->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; @@ -39,6 +40,7 @@ $langs->load("products"); $langs->load("orders"); $langs->load("bills"); $langs->load("stocks"); +$langs->load("sendings"); if (! empty($conf->productbatch->enabled)) $langs->load("productbatch"); @@ -121,10 +123,11 @@ if ($action == "correct_stock" && ! $cancel) if (is_numeric(GETPOST("nbpiece")) && $id) { if (empty($product)) { - $product = new Product($db); - $result=$product->fetch($id); + $product = new Product($db); + $result=$product->fetch($id); } - if ($product->hasbatch()) { + if ($product->hasbatch()) + { $d_eatby=dol_mktime(12, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); $d_sellby=dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); $result=$product->correct_stock_batch( @@ -138,15 +141,17 @@ if ($action == "correct_stock" && ! $cancel) $d_sellby, GETPOST('batch_number') ); // We do not change value of stock for a correction - } else { - $result=$product->correct_stock( - $user, - GETPOST("id_entrepot"), - GETPOST("nbpiece"), - GETPOST("mouvement"), - GETPOST("label"), - $priceunit - ); // We do not change value of stock for a correction + } + else + { + $result=$product->correct_stock( + $user, + GETPOST("id_entrepot"), + GETPOST("nbpiece"), + GETPOST("mouvement"), + GETPOST("label"), + $priceunit + ); // We do not change value of stock for a correction } if ($result > 0) @@ -166,13 +171,13 @@ if ($action == "correct_stock" && ! $cancel) // Transfer stock from a warehouse to another warehouse if ($action == "transfert_stock" && ! $cancel) { - if (! (GETPOST("id_entrepot_source") > 0) || ! (GETPOST("id_entrepot_destination") > 0)) + if (! (GETPOST("id_entrepot_source",'int') > 0) || ! (GETPOST("id_entrepot_destination",'int') > 0)) { setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Warehouse")), 'errors'); $error++; $action='transfert'; } - if (! GETPOST("nbpiece")) + if (! GETPOST("nbpiece",'int')) { setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("NumberOfUnit")), 'errors'); $error++; @@ -181,9 +186,9 @@ if ($action == "transfert_stock" && ! $cancel) if (! $error) { - if (GETPOST("id_entrepot_source") <> GETPOST("id_entrepot_destination")) + if (GETPOST("id_entrepot_source",'int') <> GETPOST("id_entrepot_destination",'int')) { - if (is_numeric(GETPOST("nbpiece")) && $id) + if (GETPOST("nbpiece",'int') && $id) { $product = new Product($db); $result=$product->fetch($id); @@ -194,31 +199,63 @@ if ($action == "transfert_stock" && ! $cancel) // Define value of products moved $pricesrc=0; - if (isset($product->stock_warehouse[GETPOST("id_entrepot_source")]->pmp)) $pricesrc=$product->stock_warehouse[GETPOST("id_entrepot_source")]->pmp; + //if (isset($product->stock_warehouse[GETPOST("id_entrepot_source")]->pmp)) $pricesrc=$product->stock_warehouse[GETPOST("id_entrepot_source")]->pmp; + if (isset($product->pmp)) $pricesrc=$product->pmp; $pricedest=$pricesrc; - //print 'price src='.$pricesrc.', price dest='.$pricedest;exit; + $pdluoid=GETPOST('pdluoid','int'); - // Remove stock - $result1=$product->correct_stock( - $user, - GETPOST("id_entrepot_source"), - GETPOST("nbpiece"), - 1, - GETPOST("label"), - $pricesrc - ); + if ($pdluoid>0) + { + $pdluo = new Productbatch($db); + $result=$pdluo->fetch($pdluoid); - // Add stock - $result2=$product->correct_stock( - $user, - GETPOST("id_entrepot_destination"), - GETPOST("nbpiece"), - 0, - GETPOST("label"), - $pricedest - ); + if ($result>0 && $pdluo->id) + { + // Remove stock + $result1=$product->correct_stock_batch( + $user, + $pdluo->warehouseid, + GETPOST("nbpiece",'int'), + 1, + GETPOST("label",'san_alpha'), + $pricesrc, + $pdluo->eatby,$pdluo->sellby,$pdluo->batch + ); + // Add stock + $result2=$product->correct_stock_batch( + $user, + GETPOST("id_entrepot_destination",'int'), + GETPOST("nbpiece",'int'), + 0, + GETPOST("label",'san_alpha'), + $pricedest, + $pdluo->eatby,$pdluo->sellby,$pdluo->batch + ); + } + } + else + { + // Remove stock + $result1=$product->correct_stock( + $user, + GETPOST("id_entrepot_source"), + GETPOST("nbpiece"), + 1, + GETPOST("label"), + $pricesrc + ); + // Add stock + $result2=$product->correct_stock( + $user, + GETPOST("id_entrepot_destination"), + GETPOST("nbpiece"), + 0, + GETPOST("label"), + $pricedest + ); + } if ($result1 >= 0 && $result2 >= 0) { $db->commit(); @@ -235,6 +272,48 @@ if ($action == "transfert_stock" && ! $cancel) } } +// Update batch information +if ($action == 'updateline' && GETPOST('save') == $langs->trans('Save')) +{ + + $pdluo = new Productbatch($db); + $result=$pdluo->fetch(GETPOST('pdluoid','int')); + + if ($result>0) + { + if ($pdluo->id) + { + if ((! GETPOST("sellby")) && (! GETPOST("eatby")) && (! GETPOST("batch_number"))) { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("atleast1batchfield")), 'errors'); + } + else + { + $d_eatby=dol_mktime(12, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); + $d_sellby=dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); + $pdluo->batch=GETPOST("batch_number",'san_alpha'); + $pdluo->eatby=$d_eatby; + $pdluo->sellby=$d_sellby; + $result=$pdluo->update($user); + if ($result<0) + { + setEventMessages($pdluo->error,$pdluo->errors, 'errors'); + } + } + } + else + { + setEventMessages($langs->trans('BatchInformationNotfound'),null, 'errors'); + } + } + else + { + setEventMessages($pdluo->error,null, 'errors'); + } + header("Location: product.php?id=".$id); + exit; +} + + /* * View @@ -276,19 +355,27 @@ if ($id > 0 || $ref) print ''.$langs->trans("Label").''.$product->libelle.''; print ''; - // Status (to sell) - print ''.$langs->trans("Status").' ('.$langs->trans("Sell").')'; - print $product->getLibStatut(2,0); - print ''; + // Status (to sell) + print ''.$langs->trans("Status").' ('.$langs->trans("Sell").')'; + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { + print ajax_object_onoff($product, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); + } else { + print $product->getLibStatut(2,0); + } + print ''; - // Status (to buy) - print ''.$langs->trans("Status").' ('.$langs->trans("Buy").')'; - print $product->getLibStatut(2,1); - print ''; + // Status (to buy) + print ''.$langs->trans("Status").' ('.$langs->trans("Buy").')'; + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { + print ajax_object_onoff($product, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); + } else { + print $product->getLibStatut(2,1); + } + print ''; if ($conf->productbatch->enabled) { - print ''.$langs->trans("Status").' ('.$langs->trans("l_sellby").')'; - print $product->getLibStatut(2,2); + print ''.$langs->trans("ManageLotSerial").''; + print $product->getLibStatut(0,2); print ''; } @@ -297,13 +384,50 @@ if ($id > 0 || $ref) print ''.price($product->pmp).' '.$langs->trans("HT").''; print ''; - // Sell price - print ''.$langs->trans("SellPriceMin").''; - print ''; - if (empty($conf->global->PRODUIT_MULTIPRICES)) print price($product->price).' '.$langs->trans("HT"); - else print $langs->trans("Variable"); - print ''; - print ''; + // Minimum Price + print ''.$langs->trans("BuyingPriceMin").''; + print ''; + $product_fourn = new ProductFournisseur($db); + if ($product_fourn->find_min_price_product_fournisseur($product->id) > 0) + { + if ($product_fourn->product_fourn_price_id > 0) print $product_fourn->display_price_product_fournisseur(); + else print $langs->trans("NotDefined"); + } + print ''; + + $object = $product; + if (empty($conf->global->PRODUIT_MULTIPRICES)) + { + // Price + print '' . $langs->trans("SellingPrice") . ''; + if ($object->price_base_type == 'TTC') { + print price($object->price_ttc) . ' ' . $langs->trans($object->price_base_type); + } else { + print price($object->price) . ' ' . $langs->trans($object->price_base_type); + } + print ''; + + // Price minimum + print '' . $langs->trans("MinPrice") . ''; + if ($object->price_base_type == 'TTC') { + print price($object->price_min_ttc) . ' ' . $langs->trans($object->price_base_type); + } else { + print price($object->price_min) . ' ' . $langs->trans($object->price_base_type); + } + print ''; + } + else + { + // Price + print '' . $langs->trans("SellingPrice") . ''; + print $langs->trans("Variable"); + print ''; + + // Price minimum + print '' . $langs->trans("MinPrice") . ''; + print $langs->trans("Variable"); + print ''; + } // Stock print ''.$form->editfieldkey("StockLimit",'stocklimit',$product->seuil_stock_alerte,$product,$user->rights->produit->creer).''; @@ -323,58 +447,62 @@ if ($id > 0 || $ref) print ''; print ''; - // Calculating a theorical value + // Calculating a theorical value + print ''.$langs->trans("VirtualStock").''; + print "".(empty($product->stock_theorique)?0:$product->stock_theorique); + if ($product->stock_theorique < $product->seuil_stock_alerte) { + print ' '.img_warning($langs->trans("StockLowerThanLimit")); + } + print ''; + print ''; - // If stock if stock increment is done on real sending - if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) - { - // Stock theorique - print ''.$langs->trans("VirtualStock").''; - print "".$product->stock_theorique; - if ($product->stock_theorique < $product->seuil_stock_alerte) - { - print ' '.img_warning($langs->trans("StockLowerThanLimit")); - } - print ''; - print ''; + print ''; + $text_stock_options = ''; + $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)?$langs->trans("DeStockOnShipment").'
    ':''); + $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER)?$langs->trans("DeStockOnValidateOrder").'
    ':''); + $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_BILL)?$langs->trans("DeStockOnBill").'
    ':''); + $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)?$langs->trans("ReStockOnBill").'
    ':''); + $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER)?$langs->trans("ReStockOnValidateOrder").'
    ':''); + $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)?$langs->trans("ReStockOnDispatchOrder").'
    ':''); + print $form->textwithtooltip($langs->trans("StockDiffPhysicTeoric"),$text_stock_options,2,1,img_picto('', 'info'),'',0);; + print ''; + print ''; - print ''; - if ($product->stock_theorique != $product->stock_reel) print $langs->trans("StockDiffPhysicTeoric"); - else print $langs->trans("RunningOrders"); - print ''; - print ''; + $found=0; + // Number of customer orders running + if (! empty($conf->commande->enabled)) + { + if ($found) print '
    '; else $found=1; + print $langs->trans("CustomersOrdersRunning").': '.$product->stats_commande['qty']; + $result=$product->load_stats_commande(0,'0'); + if ($result < 0) dol_print_error($db,$product->error); + print ' ('.$langs->trans("Draft").': '.$product->stats_commande['qty'].')'; + } - $found=0; + // Number of product from customer order already sent (partial shipping) + if (! empty($conf->expedition->enabled)) { + if ($found) print '
    '; else $found=1; + $result=$product->load_stats_sending(0,'2'); + print $langs->trans("SendingRunning").': '.$product->stats_expedition['qty']; + } - // Nbre de commande clients en cours - if (! empty($conf->commande->enabled)) - { - if ($found) print '
    '; else $found=1; - print $langs->trans("CustomersOrdersRunning").': '.($product->stats_commande['qty']-$product->stats_sendings['qty']); - $result=$product->load_stats_commande(0,'0'); - if ($result < 0) dol_print_error($db,$product->error); - print ' ('.$langs->trans("Draft").': '.$product->stats_commande['qty'].')'; - //print '
    '; - //print $langs->trans("CustomersSendingRunning").': '.$stock_sending_client; - } + // Number of supplier order running + if (! empty($conf->fournisseur->enabled)) { + if ($found) print '
    '; else $found=1; + $result=$product->load_stats_commande_fournisseur(0,'3,4'); + print $langs->trans("SuppliersOrdersRunning").': '.$product->stats_commande_fournisseur['qty']; + $result=$product->load_stats_commande_fournisseur(0,'0,1,2'); + if ($result < 0) dol_print_error($db,$product->error); + print ' ('.$langs->trans("DraftOrWaitingApproved").': '.$product->stats_commande_fournisseur['qty'].')'; + } - // Nbre de commande fournisseurs en cours - if (! empty($conf->fournisseur->enabled)) - { - if ($found) print '
    '; else $found=1; - print $langs->trans("SuppliersOrdersRunning").': '.($product->stats_commande_fournisseur['qty']-$product->stats_reception['qty']); - $result=$product->load_stats_commande_fournisseur(0,'0,1,2'); - if ($result < 0) dol_print_error($db,$product->error); - print ' ('.$langs->trans("DraftOrWaitingApproved").': '.$product->stats_commande_fournisseur['qty'].')'; - } - print ''; - } - - // If stock if stock increment is done on - // TODO Add information when stock increment is done on other option - - // TODO Add also information on possible decrease stock accroding to stock decrease option + // Number of product from supplier order already received (partial receipt) + if (! empty($conf->fournisseur->enabled)) { + if ($found) print '
    '; else $found=1; + print $langs->trans("SuppliersReceiptRunning").': '.$product->stats_reception['qty']; + } + print ''; // Last movement $sql = "SELECT max(m.datem) as datem"; @@ -458,20 +586,26 @@ if ($id > 0 || $ref) //eat-by date if ((! empty($conf->productbatch->enabled)) && $product->hasbatch()) { print ''; - print ''.$langs->trans("l_eatby").''; + print ''.$langs->trans("batch_number").''; + print ''; + print ''; + print ''; + print ''.$langs->trans("l_eatby").''; $form->select_date('','eatby','','',1,""); print ''; - print ''.$langs->trans("l_sellby").''; + print ''; + print ''.$langs->trans("l_sellby").''; $form->select_date('','sellby','','',1,""); print ''; - print ''.$langs->trans("batch_number").''; - print ''; - print ''; + print ''; } print ''; - print '
     '; - print '
    '; + print '
    '; + print ''; + print '     '; + print ''; + print '
    '; print ''; } @@ -480,15 +614,43 @@ if ($id > 0 || $ref) */ if ($action == "transfert") { + $pdluoid=GETPOST('pdluoid','int'); + + if ($pdluoid > 0) + { + $pdluo = new Productbatch($db); + $result=$pdluo->fetch($pdluoid); + + if ($result > 0) + { + $pdluoid=$pdluo->id; + } + else + { + dol_print_error($db); + } + } + print_titre($langs->trans("StockTransfer")); print '
    '."\n"; print ''; print ''; + if ($pdluoid) + { + print ''; + } print ''; print ''; print ''; print '
    '.$langs->trans("WarehouseSource").''; - print $formproduct->selectWarehouses(($_GET["dwid"]?$_GET["dwid"]:GETPOST('id_entrepot_source')),'id_entrepot_source','',1); + if ($pdluoid) + { + print $formproduct->selectWarehouses($pdluo->warehouseid,'id_entrepot_source','',1,1); + } + else + { + print $formproduct->selectWarehouses(($_GET["dwid"]?$_GET["dwid"]:GETPOST('id_entrepot_source')),'id_entrepot_source','',1); + } print ''.$langs->trans("WarehouseTarget").''; print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'),'id_entrepot_destination','',1); @@ -506,8 +668,11 @@ if ($id > 0 || $ref) print '
    '; - print '
     '; - print '
    '; + print '
    '; + print ''; + print '     '; + print ''; + print '
    '; print '
    '; } @@ -567,7 +732,7 @@ if (empty($action) && $product->id) /* - * Contenu des stocks + * Stock detail */ print '
    '; print ''; @@ -578,9 +743,10 @@ print ''; print ''; print ''; if ( (! empty($conf->productbatch->enabled)) && $product->hasbatch()) { - print ''; - print ''; + print ''; print ''; + print ''; + print ''; print ''; print ''; } @@ -613,31 +779,58 @@ if ($resql) print ''; print ''; // PMP - print ''; // Ditto : Show PMP from movement or from product - print ''; // Ditto : Show PMP from movement or from product + print ''; // Ditto : Show PMP from movement or from product + // Value purchase + print ''; // Ditto : Show PMP from movement or from product // Sell price print ''; // Ditto : Show PMP from movement or from product + // Value sell print ''; // Ditto : Show PMP from movement or from product else print $langs->trans("Variable"); print ''; ; $total += $obj->reel; - if (price2num($obj->pmp)) $totalwithpmp += $obj->reel; - $totalvalue = $totalvalue + price2num($obj->pmp*$obj->reel,'MU'); // Ditto : Show PMP from movement or from product - $totalvaluesell = $totalvaluesell + price2num($product->price*$obj->reel,'MU'); // Ditto : Show PMP from movement or from product + if (price2num($product->pmp)) $totalwithpmp += $obj->reel; + $totalvalue = $totalvalue + ($product->pmp*$obj->reel); // Ditto : Show PMP from movement or from product + $totalvaluesell = $totalvaluesell + ($product->price*$obj->reel); // Ditto : Show PMP from movement or from product //Batch Detail - if ((! empty($conf->productbatch->enabled)) && $product->hasbatch()) { + if ((! empty($conf->productbatch->enabled)) && $product->hasbatch()) + { $details=Productbatch::findAll($db,$obj->product_stock_id); if ($details<0) dol_print_error($db); - foreach ($details as $pdluo) { - print "\n".''; - print ''; - print ''; - print ''; - print ''; + foreach ($details as $pdluo) + { + if ( $action == 'editline' && GETPOST('lineid',int)==$pdluo->id ) + { //Current line edit + print "\n".''; + print ''; + print ''; + print ''; + print ''; + print ''; + } } } $i++; @@ -645,18 +838,21 @@ if ($resql) } } else dol_print_error($db); + print ''; print ''; print ''; +// Value purchase print ''; print ''; +// Value to sell print ''. if (!empty($conf->service->enabled) && $type == 1) print ''; print ''. ''. - ''. + ''. ''. ''. ''. // Ref ''; // Company - $href = DOL_URL_ROOT . '/fourn/fiche.php?socid=' . $obj->socid; + $href = DOL_URL_ROOT . '/fourn/card.php?socid=' . $obj->socid; print ''; + $obj->name . ''; // Author $userstatic->id = $obj->fk_user_author; diff --git a/htdocs/product/stock/valo.php b/htdocs/product/stock/valo.php index 03c779c0991..6f5cb7ae578 100644 --- a/htdocs/product/stock/valo.php +++ b/htdocs/product/stock/valo.php @@ -103,7 +103,7 @@ if ($result) { $objp = $db->fetch_object($result); print ""; - print ''; + print ''; print ''; // PMP value print ''; print '
    '.$langs->trans("Warehouse").''.$langs->trans("SellPriceMin").''.$langs->trans("EstimatedStockValueSellShort").'
    '.$langs->trans("l_eatby").''.$langs->trans("l_sellby").'
    '.$langs->trans("batch_number").''.$langs->trans("l_eatby").''.$langs->trans("l_sellby").'
    '.$entrepotstatic->getNomUrl(1).''.$obj->reel.($obj->reel<0?' '.img_warning():'').''.(price2num($obj->pmp)?price2num($obj->pmp,'MU'):'').''.(price2num($obj->pmp)?price(price2num($obj->pmp*$obj->reel,'MT')):'').''.(price2num($product->pmp)?price2num($product->pmp,'MU'):'').''.(price2num($product->pmp)?price(price2num($product->pmp*$obj->reel,'MT')):'').''; if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price,'MU'),1); else print $langs->trans("Variable"); print ''; if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price*$obj->reel,'MT'),1).'
    '. dol_print_date($pdluo->eatby,'day') .''. dol_print_date($pdluo->sellby,'day') .''.$pdluo->batch.''.$pdluo->qty.($pdluo->qty<0?' '.img_warning():'').'
    '; + print '
    '; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
    '; + $form->select_date($pdluo->eatby,'eatby','','',1,""); + print ''; + $form->select_date($pdluo->sellby,'sellby','','',1,""); + print ''.$pdluo->qty.($pdluo->qty<0?' '.img_warning():'').''; + print '
    '; + } + else + { + print "\n".'
    '; + print 'id.'">'.$langs->trans("StockMovement").''; + print 'id.'#'.$pdluo->id.'">'; + print img_edit().''.$pdluo->batch.''. dol_print_date($pdluo->eatby,'day') .''. dol_print_date($pdluo->sellby,'day') .''.$pdluo->qty.($pdluo->qty<0?' '.img_warning():'').'
    '.$langs->trans("Total").':'.$total.''; -print ($totalwithpmp?price($totalvalue/$totalwithpmp):' '); +print ($totalwithpmp?price(price2num($totalvalue/$totalwithpmp,'MU')):' '); // This value may have rounding errors print ''; -print price(price2num($totalvalue,'MT'),1); +print $totalvalue?price(price2num($totalvalue,'MT'),1):' '; print ''; if (empty($conf->global->PRODUIT_MULTI_PRICES)) print ($total?price($totalvaluesell/$total,1):' '); else print $langs->trans("Variable"); print ''; if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($totalvaluesell,'MT'),1); else print $langs->trans("Variable"); diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 04a1cf32e60..35835709ab8 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -1,6 +1,7 @@ - * Copyright (C) 2013-2014 Laurent Destaileur +/* Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2013-2014 Laurent Destaileur + * Copyright (C) 2014 Regis Houssin * * 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 @@ -50,6 +51,9 @@ $tobuy = GETPOST('tobuy', 'int'); $salert = GETPOST('salert', 'alpha'); $mode = GETPOST('mode','alpha'); +$fourn_id = GETPOST('fourn_id','int'); +$texte = ''; + $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); $page = GETPOST('page','int'); @@ -197,7 +201,7 @@ if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global $usevirtualstock=-1; if ($virtualdiffersfromphysical) { - $usevirtualstock=($conf->global->STOCK_USE_VIRTUAL_STOCK?1:0); + $usevirtualstock=(! empty($conf->global->STOCK_USE_VIRTUAL_STOCK)?1:0); if ($mode=='virtual') $usevirtualstock=1; if ($mode=='physical') $usevirtualstock=0; } @@ -426,7 +430,7 @@ print '
       ' . $langs->trans('AlertOnly') . ' ' . $langs->trans('AlertOnly') . '   '. diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index 5ebb36a7054..71fe1407a2d 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -1,6 +1,7 @@ + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2014 Regis Houssin * * 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 @@ -44,8 +45,7 @@ $result=restrictedArea($user,'produit|service'); * View */ -$helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|'; -$helpurl .= 'ES:Módulo_Stocks'; +$helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; $texte = $langs->trans('ReplenishmentOrders'); llxHeader('', $texte, $helpurl, ''); @@ -77,7 +77,7 @@ if (!$sortfield) $sortfield = 'cf.date_creation'; $offset = $conf->liste_limit * $page ; -$sql = 'SELECT s.rowid as socid, s.nom, cf.date_creation as dc,'; +$sql = 'SELECT s.rowid as socid, s.nom as name, cf.date_creation as dc,'; $sql.= ' cf.rowid, cf.ref, cf.fk_statut, cf.total_ttc, cf.fk_user_author,'; $sql.= ' u.login'; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'commande_fournisseur as cf'; @@ -132,7 +132,7 @@ if ($sall) { $sql .= ' AND (cf.ref LIKE "%' . $db->escape($sall) . '%" '; $sql .= 'OR cf.note LIKE "%' . $db->escape($sall) . '%")'; } -if ($socid) { +if (!empty($socid)) { $sql .= ' AND s.rowid = ' . $socid; } @@ -260,7 +260,7 @@ if ($resql) $var = !$var; if (!dispatched($obj->rowid) && (!$sproduct || in_array($sproduct, getProducts($obj->rowid)))) { - $href = DOL_URL_ROOT . '/fourn/commande/fiche.php?id=' . $obj->rowid; + $href = DOL_URL_ROOT . '/fourn/commande/card.php?id=' . $obj->rowid; print '
    '. @@ -269,11 +269,11 @@ if ($resql) ''. ''. img_object($langs->trans('ShowCompany'), 'company'). ' '. - $obj->nom . '
    '.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->ref.''.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->ref.''.$objp->lieu.''; diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index cd7e4cdcb3c..34b38fe8919 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -217,9 +217,11 @@ if ($action == 'edit') } } - print '
    '; - print '     '; - print '
    '; + print '
    '; + print ''; + print '     '; + print ''; + print '
    '; print ''; @@ -300,9 +302,11 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service print '
    '; - print '
    '; - print '     '; - print '
    '; + print '
    '; + print ''; + print '     '; + print ''; + print '
    '; print ''; diff --git a/htdocs/projet/activity/list.php b/htdocs/projet/activity/list.php index c0b3743c980..692e4ab08b4 100644 --- a/htdocs/projet/activity/list.php +++ b/htdocs/projet/activity/list.php @@ -83,6 +83,7 @@ if ($action == 'addtime' && $user->rights->projet->creer) foreach($timespent_duration as $key => $val) { $task->fetch($key); + $task->progress = GETPOST($key . 'progress', 'int'); $task->timespent_duration = $val; $task->timespent_fk_user = $user->id; $task->timespent_date = dol_mktime(12,0,0,$_POST["{$key}month"],$_POST["{$key}day"],$_POST["{$key}year"]); @@ -127,6 +128,9 @@ if ($id) $tasksarray=$taskstatic->getTasksArray(0,0,($project->id?$project->id:$projectsListId),$socid,0); // We want to see all task of project i am allowed to see, not only mine. Later only mine will be editable later. $projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($user,0,($project->id?$project->id:$projectsListId),0); $tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0,$user,($project->id?$project->id:$projectsListId),0); +//var_dump($tasksarray); +//var_dump($projectsrole); +//var_dump($taskrole); llxHeader("",$title,""); @@ -175,9 +179,9 @@ print ''.$langs->trans("LabelTask").''; print ''.$langs->trans("DateStart").''; print ''.$langs->trans("DateEnd").''; print ''.$langs->trans("PlannedWorkload").''; -print ''.$langs->trans("Progress").''; +print ''.$langs->trans("ProgressDeclared").''; print ''.$langs->trans("TimeSpent").''; -print ''.$langs->trans("AddDuration").''; +print ''.$langs->trans("NewTimeSpent").''; print "\n"; // By default, we can edit only tasks we are assigned to diff --git a/htdocs/projet/admin/project.php b/htdocs/projet/admin/project.php index a23f65edafb..915d4ef69ef 100644 --- a/htdocs/projet/admin/project.php +++ b/htdocs/projet/admin/project.php @@ -1,9 +1,9 @@ - * Copyright (C) 2011 Laurent Destailleur - * Copyright (C) 2011-2012 Juanjo Menent - * Copyright (C) 2011-2013 Philippe Grand - * Copyright (C) 2013 Florian Henry +/* Copyright (C) 2010-2014 Regis Houssin + * Copyright (C) 2011 Laurent Destailleur + * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2011-2013 Philippe Grand + * Copyright (C) 2013 Florian Henry * * 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 @@ -99,7 +99,7 @@ else if ($action == 'specimen') $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); foreach($dirmodels as $reldir) { - $file=dol_buildpath($reldir."core/modules/project/pdf/pdf_".$modele.".modules.php",0); + $file=dol_buildpath($reldir."core/modules/project/doc/pdf_".$modele.".modules.php",0); if (file_exists($file)) { $filefound=1; @@ -144,7 +144,7 @@ else if ($action == 'specimentask') $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); foreach($dirmodels as $reldir) { - $file=dol_buildpath($reldir."core/modules/project/task/pdf/pdf_".$modele.".modules.php",0); + $file=dol_buildpath($reldir."core/modules/project/task/doc/pdf_".$modele.".modules.php",0); if (file_exists($file)) { $filefound=1; @@ -177,6 +177,35 @@ else if ($action == 'specimentask') } } +// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) +if ($action == 'setModuleOptions') +{ + $post_size=count($_POST); + + $db->begin(); + + for($i=0;$i < $post_size;$i++) + { + if (array_key_exists('param'.$i,$_POST)) + { + $param=GETPOST("param".$i,'alpha'); + $value=GETPOST("value".$i,'alpha'); + if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + } + if (! $error) + { + $db->commit(); + setEventMessage($langs->trans("SetupSaved")); + } + else + { + $db->rollback(); + setEventMessage($langs->trans("Error"),'errors'); + } +} + // Activate a model else if ($action == 'set') { @@ -256,26 +285,10 @@ else if ($action == 'setmodtask') dolibarr_set_const($db, "PROJECT_TASK_ADDON",$value,'chaine',0,'',$conf->entity); } -else if ($action=='setModuleOptions') { - if (dolibarr_set_const($db, "PROJECT_ADDON_PDF_ODT_PATH",GETPOST('value1'),'chaine',0,'',$conf->entity)) - { - // La constante qui a ete lue en avant du nouveau set - // on passe donc par une variable pour avoir un affichage coherent - $conf->global->PROJECT_ADDON_PDF_ODT_PATH = GETPOST('value1'); - } -} -else if ($action=='setModuleOptionsTask') { - if (dolibarr_set_const($db, "PROJECT_TASK_ADDON_PDF_ODT_PATH",GETPOST('value1'),'chaine',0,'',$conf->entity)) - { - // La constante qui a ete lue en avant du nouveau set - // on passe donc par une variable pour avoir un affichage coherent - $conf->global->PROJECT_TASK_ADDON_PDF_ODT_PATH = GETPOST('value1'); - } -} /* * View -*/ + */ $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); @@ -336,7 +349,7 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { $var=!$var; - print ''.$module->nom."\n"; + print ''.$module->name."\n"; print $module->info(); print ''; @@ -437,7 +450,7 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { $var=!$var; - print ''.$module->nom."\n"; + print ''.$module->name."\n"; print $module->info(); print ''; @@ -542,99 +555,108 @@ clearstatcache(); $var=true; foreach ($dirmodels as $reldir) { - $dir = dol_buildpath($reldir."core/modules/project/pdf/"); - - if (is_dir($dir)) + foreach (array('','/doc') as $valdir) { - $handle=opendir($dir); - if (is_resource($handle)) + $dir = dol_buildpath($reldir."core/modules/project/".$valdir); + + if (is_dir($dir)) { - while (($file = readdir($handle))!==false) + $handle=opendir($dir); + if (is_resource($handle)) { - if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) + while (($file = readdir($handle))!==false) { - if (file_exists($dir.'/'.$file)) + $filelist[]=$file; + } + closedir($handle); + arsort($filelist); + + foreach($filelist as $file) + { + if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) { - $name = substr($file, 4, dol_strlen($file) -16); - $classname = substr($file, 0, dol_strlen($file) -12); - - require_once $dir.'/'.$file; - $module = new $classname($db); - - $modulequalified=1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; - - if ($modulequalified) + if (file_exists($dir.'/'.$file)) { - $var=!$var; - print ''; - print (empty($module->name)?$name:$module->name); - print "\n"; - if (method_exists($module,'info')) print $module->info($langs); - else print $module->description; - print "\n"; + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); - // Active - if (in_array($name, $def)) - { - print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; - print img_picto($langs->trans("Enabled"),'switch_on'); - print ''; - print ""; - } - else - { - print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; - print ""; - } + require_once $dir.'/'.$file; + $module = new $classname($db); - // Default - print ""; - if ($conf->global->PROJECT_ADDON_PDF == "$name") - { - print img_picto($langs->trans("Default"),'on'); - } - else - { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; - } - print ''; + $modulequalified=1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; - // Info - $htmltooltip = ''.$langs->trans("Name").': '.$module->name; - $htmltooltip.='
    '.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); - if ($module->type == 'pdf') + if ($modulequalified) { - $htmltooltip.='
    '.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; - } - $htmltooltip.='

    '.$langs->trans("FeaturesSupported").':'; - $htmltooltip.='
    '.$langs->trans("Logo").': '.yn($module->option_logo,1,1); - - print ''; - print $form->textwithpicto('',$htmltooltip,1,0); - print ''; + $var=!$var; + print ''; + print (empty($module->name)?$name:$module->name); + print "\n"; + if (method_exists($module,'info')) print $module->info($langs); + else print $module->description; + print "\n"; - // Preview - print ''; - if ($module->type == 'pdf') - { - print ''.img_object($langs->trans("Preview"),'bill').''; - } - else - { - print img_object($langs->trans("PreviewNotAvailable"),'generic'); - } - print ''; + // Active + if (in_array($name, $def)) + { + print "\n"; + print 'scandir.'&label='.urlencode($module->name).'">'; + print img_picto($langs->trans("Enabled"),'switch_on'); + print ''; + print ""; + } + else + { + print "\n"; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print ""; + } - print "\n"; - } + // Default + print ""; + if ($conf->global->PROJECT_ADDON_PDF == "$name") + { + print img_picto($langs->trans("Default"),'on'); + } + else + { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + } + print ''; + + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip.='
    '.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + if ($module->type == 'pdf') + { + $htmltooltip.='
    '.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; + } + $htmltooltip.='

    '.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='
    '.$langs->trans("Logo").': '.yn($module->option_logo,1,1); + + print ''; + print $form->textwithpicto('',$htmltooltip,1,0); + print ''; + + // Preview + print ''; + if ($module->type == 'pdf') + { + print ''.img_object($langs->trans("Preview"),'bill').''; + } + else + { + print img_object($langs->trans("PreviewNotAvailable"),'generic'); + } + print ''; + + print "\n"; + } + } } } } - closedir($handle); } } } @@ -688,98 +710,107 @@ clearstatcache(); $var=true; foreach ($dirmodels as $reldir) { - $dir = dol_buildpath($reldir."core/modules/project/task/pdf/"); - - if (is_dir($dir)) + foreach (array('','/doc') as $valdir) { - $handle=opendir($dir); - if (is_resource($handle)) + $dir = dol_buildpath($reldir."core/modules/project/task/".$valdir); + + if (is_dir($dir)) { - while (($file = readdir($handle))!==false) + $handle=opendir($dir); + if (is_resource($handle)) { - if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) + while (($file = readdir($handle))!==false) { - if (file_exists($dir.'/'.$file)) + $filelist[]=$file; + } + closedir($handle); + arsort($filelist); + + foreach($filelist as $file) + { + if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) { - $name = substr($file, 4, dol_strlen($file) -16); - $classname = substr($file, 0, dol_strlen($file) -12); - - require_once $dir.'/'.$file; - $module = new $classname($db); - - $modulequalified=1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; - - if ($modulequalified) + if (file_exists($dir.'/'.$file)) { - $var = !$var; - print ''; - print (empty($module->name)?$name:$module->name); - print "\n"; - if (method_exists($module,'info')) print $module->info($langs); - else print $module->description; - print "\n"; + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); - // Active - if (in_array($name, $def)) - { - print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; - print img_picto($langs->trans("Enabled"),'switch_on'); - print ''; - print ""; - } - else - { - print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; - print ""; - } + require_once $dir.'/'.$file; + $module = new $classname($db); - // Defaut - print ""; - if ($conf->global->PROJECT_TASK_ADDON_PDF == "$name") - { - print img_picto($langs->trans("Default"),'on'); - } - else - { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; - } - print ''; + $modulequalified=1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; - // Info - $htmltooltip = ''.$langs->trans("Name").': '.$module->name; - $htmltooltip.='
    '.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); - if ($module->type == 'pdf') + if ($modulequalified) { - $htmltooltip.='
    '.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; - } - $htmltooltip.='

    '.$langs->trans("FeaturesSupported").':'; - $htmltooltip.='
    '.$langs->trans("Logo").': '.yn($module->option_logo,1,1); - - print ''; - print $form->textwithpicto('',$htmltooltip,1,0); - print ''; + $var = !$var; + print ''; + print (empty($module->name)?$name:$module->name); + print "\n"; + if (method_exists($module,'info')) print $module->info($langs); + else print $module->description; + print "\n"; - // Preview - print ''; - if ($module->type == 'pdf') - { - print ''.img_object($langs->trans("Preview"),'bill').''; + // Active + if (in_array($name, $def)) + { + print "\n"; + print 'scandir.'&label='.urlencode($module->name).'">'; + print img_picto($langs->trans("Enabled"),'switch_on'); + print ''; + print ""; + } + else + { + print "\n"; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print ""; + } + + // Defaut + print ""; + if ($conf->global->PROJECT_TASK_ADDON_PDF == "$name") + { + print img_picto($langs->trans("Default"),'on'); + } + else + { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + } + print ''; + + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip.='
    '.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + if ($module->type == 'pdf') + { + $htmltooltip.='
    '.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; + } + $htmltooltip.='

    '.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='
    '.$langs->trans("Logo").': '.yn($module->option_logo,1,1); + + print ''; + print $form->textwithpicto('',$htmltooltip,1,0); + print ''; + + // Preview + print ''; + if ($module->type == 'pdf') + { + print ''.img_object($langs->trans("Preview"),'bill').''; + } + else + { + print img_object($langs->trans("PreviewNotAvailable"),'generic'); + } + print ''; + print "\n"; } - else - { - print img_object($langs->trans("PreviewNotAvailable"),'generic'); - } - print ''; - print "\n"; } } } } - closedir($handle); } } } diff --git a/htdocs/projet/fiche.php b/htdocs/projet/card.php similarity index 93% rename from htdocs/projet/fiche.php rename to htdocs/projet/card.php index 1fe3d91346d..1f6f430fccb 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/card.php @@ -18,7 +18,7 @@ */ /** - * \file htdocs/projet/fiche.php + * \file htdocs/projet/card.php * \ingroup projet * \brief Project card */ @@ -45,7 +45,7 @@ $mine = GETPOST('mode')=='mine' ? 1 : 0; //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('projectcard')); +$hookmanager->initHooks(array('projectcard','globalcard')); $object = new Project($db); $extrafields = new ExtraFields($db); @@ -74,7 +74,7 @@ $date_end=dol_mktime(0,0,0,GETPOST('projectendmonth','int'),GETPOST('projectendd $parameters=array('id'=>$socid, 'objcanvas'=>$objcanvas); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks -$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors); +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) { @@ -171,7 +171,7 @@ if (empty($reshook)) { $db->commit(); - header("Location:fiche.php?id=".$object->id); + header("Location:card.php?id=".$object->id); exit; } else @@ -260,7 +260,7 @@ if (empty($reshook)) { $db->commit(); - if (GETPOST('socid','int') > 0) $object->thirdparty->fetch(GETPOST('socid','int')); + if (GETPOST('socid','int') > 0) $object->fetch_thirdparty(GETPOST('socid','int')); else unset($object->thirdparty); } } @@ -277,7 +277,7 @@ if (empty($reshook)) $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang(GETPOST('lang_id')); } - $result=project_pdf_create($db, $object, $object->modelpdf, $outputlangs); + $result= $object->generateDocument($object->modelpdf, $outputlangs); if ($result <= 0) { dol_print_error($db,$result); @@ -434,9 +434,13 @@ if ($action == 'create' && $user->rights->projet->creer) // Customer print ''.$langs->trans("ThirdParty").''; - $text=$form->select_company(GETPOST('socid','int'),'socid','',1,1); - $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty"); - print $form->textwithtooltip($text.' '.img_help(),$texthelp,1); + $text=$form->select_company(GETPOST('socid','int'),'socid','',1,1); + if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) + { + $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty"); + print $form->textwithtooltip($text.' '.img_help(),$texthelp,1); + } + else print $text; print ''; // Public @@ -471,14 +475,14 @@ if ($action == 'create' && $user->rights->projet->creer) print ''; - print '
    '; + print '
    '; print ''; if (! empty($backtopage)) { print '     '; print ''; } - print '
    '; + print '
    '; print ''; @@ -615,7 +619,7 @@ else { print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print ''; } diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php index cdf90a918a3..a9b059fce81 100644 --- a/htdocs/projet/tasks/index.php +++ b/htdocs/projet/tasks/index.php @@ -51,7 +51,13 @@ $page = $page == -1 ? 0 : $page; $mine = $_REQUEST['mode']=='mine' ? 1 : 0; - +// Purge criteria +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_project=""; + $search_status=""; +} +if (empty($search_status)) $search_status=1; /* * View @@ -86,7 +92,7 @@ else $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid); // Get list of tasks in tasksarray and taskarrayfiltered -// We need all tasks (even not limited to a user because a task to user can have a parent that is not affected to him). +// We need all tasks (even not limited to a user because a task assigned to a user can have a parent that is not assigned to him and we need such parents). $tasksarray=$taskstatic->getTasksArray(0, 0, $projectstatic->id, $socid, 0, $search_project, $search_status); // We load also tasks limited to a particular user $tasksrole=($mine ? $taskstatic->getUserRolesForProjectsOrTasks(0,$user,$projectstatic->id,0) : ''); @@ -97,7 +103,7 @@ print '
    '.$langs->trans("Ref").''; @@ -685,7 +689,7 @@ else { if ($userWrite > 0) { - print ''.$langs->trans("Valid").''; + print ''.$langs->trans("Valid").''; } else { @@ -698,7 +702,7 @@ else { if ($userWrite > 0) { - print ''.$langs->trans("Modify").''; + print ''.$langs->trans("Modify").''; } else { @@ -711,7 +715,7 @@ else { if ($userWrite > 0) { - print ''.$langs->trans("Close").''; + print ''.$langs->trans("Close").''; } else { @@ -724,7 +728,7 @@ else { if ($userWrite > 0) { - print ''.$langs->trans("ReOpen").''; + print ''.$langs->trans("ReOpen").''; } else { @@ -737,7 +741,7 @@ else { if ($userWrite > 0) { - print ''.$langs->trans('ToClone').''; + print ''.$langs->trans('ToClone').''; } else { @@ -750,7 +754,7 @@ else { if ($userDelete > 0) { - print ''.$langs->trans("Delete").''; + print ''.$langs->trans("Delete").''; } else { diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 8cbaea46c39..5bf17d596a4 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2013 Florian Henry + * Copyright (C) 2014 Marcos García * * 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 @@ -37,6 +38,11 @@ class Project extends CommonObject public $fk_element = 'fk_projet'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + /** + * {@inheritdoc} + */ + protected $table_ref_field = 'ref'; + var $id; var $ref; var $description; @@ -297,7 +303,7 @@ class Project extends CommonObject else if (! empty($ref)) { $sql.= " WHERE ref='".$this->db->escape($ref)."'"; - $sql.= " AND entity IN (".getEntity('project').")"; + $sql.= " AND entity IN (".getEntity('project',1).")"; } dol_syslog(get_class($this)."::fetch", LOG_DEBUG); @@ -322,7 +328,6 @@ class Project extends CommonObject $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; $this->socid = $obj->fk_soc; - $this->societe->id = $obj->fk_soc; // TODO For backward compatibility $this->user_author_id = $obj->fk_user_creat; $this->public = $obj->public; $this->statut = $obj->fk_statut; @@ -388,19 +393,38 @@ class Project extends CommonObject /** * Return list of elements for type linked to project * - * @param string $type 'propal','order','invoice','order_supplier','invoice_supplier' - * @param string $tablename name of table associated of the type - * @return array List of orders linked to project, <0 if error + * @param string $type 'propal','order','invoice','order_supplier','invoice_supplier' + * @param string $tablename name of table associated of the type + * @param string $datefieldname name of table associated of the type + * @param string $dates Start date (at 00:00:00) + * @param string $datee End date (at 23:00:00) + * @return mixed List of orders linked to project, < 0 or string if error */ - function get_element_list($type, $tablename) + function get_element_list($type, $tablename, $datefieldname='', $dates='', $datee='') { $elements = array(); if ($type == 'agenda') + { $sql = "SELECT id as rowid FROM " . MAIN_DB_PREFIX . "actioncomm WHERE fk_project=" . $this->id; + } else + { $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . $tablename." WHERE fk_projet=" . $this->id; - if (! $sql) return -1; + } + if ($dates > 0) + { + if (empty($datefieldname) && ! empty($this->table_element_date)) $datefieldname=$this->table_element_date; + if (empty($datefieldname)) return 'Error this object has no date field defined'; + $sql.=" AND ".$datefieldname." >= '".$this->db->idate($dates)."'"; + } + if ($datee > 0) + { + if (empty($datefieldname) && ! empty($this->table_element_date)) $datefieldname=$this->table_element_date; + if (empty($datefieldname)) return 'Error this object has no date field defined'; + $sql.=" AND ".$datefieldname." <= '".$this->db->idate($datee)."'"; + } + if (! $sql) return -1; //print $sql; dol_syslog(get_class($this)."::get_element_list", LOG_DEBUG); @@ -460,48 +484,71 @@ class Project extends CommonObject } } - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task_extrafields"; - $sql.= " WHERE fk_object IN (SELECT rowid FROM " . MAIN_DB_PREFIX . "projet_task WHERE fk_projet=" . $this->id . ")"; - - dol_syslog(get_class($this) . "::delete", LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) + // Delete tasks + if (! $error) { - $this->errors[] = $this->db->lasterror(); - $error++; + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task_time"; + $sql.= " WHERE fk_task IN (SELECT rowid FROM " . MAIN_DB_PREFIX . "projet_task WHERE fk_projet=" . $this->id . ")"; + + $resql = $this->db->query($sql); + if (!$resql) + { + $this->errors[] = $this->db->lasterror(); + $error++; + } } - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task"; - $sql.= " WHERE fk_projet=" . $this->id; - - dol_syslog(get_class($this) . "::delete", LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) + if (! $error) { - $this->errors[] = $this->db->lasterror(); - $error++; + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task_extrafields"; + $sql.= " WHERE fk_object IN (SELECT rowid FROM " . MAIN_DB_PREFIX . "projet_task WHERE fk_projet=" . $this->id . ")"; + + $resql = $this->db->query($sql); + if (!$resql) + { + $this->errors[] = $this->db->lasterror(); + $error++; + } } - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet"; - $sql.= " WHERE rowid=" . $this->id; - - dol_syslog(get_class($this) . "::delete", LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) + if (! $error) { - $this->errors[] = $this->db->lasterror(); - $error++; + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task"; + $sql.= " WHERE fk_projet=" . $this->id; + + $resql = $this->db->query($sql); + if (!$resql) + { + $this->errors[] = $this->db->lasterror(); + $error++; + } } - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_extrafields"; - $sql.= " WHERE fk_object=" . $this->id; - - dol_syslog(get_class($this) . "::delete", LOG_DEBUG); - $resql = $this->db->query($sql); - if (! $resql) + // Delete project + if (! $error) { - $this->errors[] = $this->db->lasterror(); - $error++; + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet"; + $sql.= " WHERE rowid=" . $this->id; + + $resql = $this->db->query($sql); + if (!$resql) + { + $this->errors[] = $this->db->lasterror(); + $error++; + } + } + + if (! $error) + { + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_extrafields"; + $sql.= " WHERE fk_object=" . $this->id; + + $resql = $this->db->query($sql); + if (! $resql) + { + $this->errors[] = $this->db->lasterror(); + $error++; + } } if (empty($error)) @@ -526,16 +573,9 @@ class Project extends CommonObject { // Call trigger $result=$this->call_trigger('PROJECT_DELETE',$user); - if ($result < 0) - { + + if ($result < 0) { $error++; - if (! empty($interface->errors)) - { - foreach ($interface->errors as $errmsg ) { - dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR); - $this->errors[] =$errmsg; - } - } } // End call triggers } @@ -759,7 +799,7 @@ class Project extends CommonObject } else { - $lien = ''; + $lien = ''; $lienfin = ''; } } @@ -769,7 +809,7 @@ class Project extends CommonObject $label = $langs->trans("ShowProject") . ': ' . $this->ref . ($this->title ? ' - ' . $this->title : ''); - if ($withpicto) $result.=($lien . img_object($label, $picto) . $lienfin); + if ($withpicto) $result.=($lien . img_object($label, $picto, 'class="classfortooltip"') . $lienfin); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$lien . $this->ref . $lienfin . (($addlabel && $this->title) ? ' - ' . dol_trunc($this->title, ($addlabel > 1 ? $addlabel : 0)) : ''); return $result; @@ -891,7 +931,7 @@ class Project extends CommonObject $sql.= ", " . MAIN_DB_PREFIX . "element_contact as ec"; $sql.= ", " . MAIN_DB_PREFIX . "c_type_contact as ctc"; } - $sql.= " WHERE p.entity IN (".getEntity('project').")"; + $sql.= " WHERE p.entity IN (".getEntity('project',1).")"; // Internal users must see project he is contact to even if project linked to a third party he can't see. //if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; if ($socid > 0) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = " . $socid . ")"; @@ -1276,23 +1316,23 @@ class Project extends CommonObject /** * Associate element to a project * - * @param string $TableName Table of the element to update - * @param int $ElementSelectId Key-rowid of the line of the element to update + * @param string $tableName Table of the element to update + * @param int $elementSelectId Key-rowid of the line of the element to update * @return int 1 if OK or < 0 if KO */ - function update_element($TableName, $ElementSelectId) + function update_element($tableName, $elementSelectId) { - $sql="UPDATE ".MAIN_DB_PREFIX.$TableName; + $sql="UPDATE ".MAIN_DB_PREFIX.$tableName; if ($TableName=="actioncomm") { $sql.= " SET fk_project=".$this->id; - $sql.= " WHERE id=".$ElementSelectId; + $sql.= " WHERE id=".$elementSelectId; } else { $sql.= " SET fk_projet=".$this->id; - $sql.= " WHERE rowid=".$ElementSelectId; + $sql.= " WHERE rowid=".$elementSelectId; } dol_syslog(get_class($this)."::update_element", LOG_DEBUG); @@ -1305,5 +1345,73 @@ class Project extends CommonObject } } + + /** + * Associate element to a project + * + * @param string $tableName Table of the element to update + * @param int $elementSelectId Key-rowid of the line of the element to update + * @return int 1 if OK or < 0 if KO + */ + function remove_element($tableName, $elementSelectId) + { + $sql="UPDATE ".MAIN_DB_PREFIX.$tableName; + + if ($TableName=="actioncomm") + { + $sql.= " SET fk_project=NULL"; + $sql.= " WHERE id=".$elementSelectId; + } + else + { + $sql.= " SET fk_projet=NULL"; + $sql.= " WHERE rowid=".$elementSelectId; + } + + dol_syslog(get_class($this)."::remove_element", LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) { + $this->error=$this->db->lasterror(); + return -1; + }else { + return 1; + } + + } + + /** + * Create an intervention document on disk using template defined into PROJECT_ADDON_PDF + * + * @param string $modele force le modele a utiliser ('' par defaut) + * @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 + * @return int 0 if KO, 1 if OK + */ + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + { + global $conf,$langs; + + $langs->load("projects"); + + // Positionne modele sur le nom du modele de projet a utiliser + if (! dol_strlen($modele)) + { + if (! empty($conf->global->PROJECT_ADDON_PDF)) + { + $modele = $conf->global->PROJECT_ADDON_PDF; + } + else + { + $modele='baleine'; + } + } + + $modelpath = "core/modules/project/doc/"; + + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index acfad6108e9..786caafb7ec 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1,6 +1,7 @@ +/* Copyright (C) 2008-2014 Laurent Destailleur * Copyright (C) 2010-2012 Regis Houssin + * Copyright (C) 2014 Marcos García * * 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 @@ -41,7 +42,7 @@ class Task extends CommonObject var $fk_task_parent; var $label; var $description; - var $duration_effective; + var $duration_effective; // total of time spent on this task var $planned_workload; var $date_c; var $date_start; @@ -59,6 +60,7 @@ class Task extends CommonObject var $timespent_duration; var $timespent_old_duration; var $timespent_date; + var $timespent_datehour; // More accurate start date (same than timespent_date but includes hours, minutes and seconds) var $timespent_fk_user; var $timespent_note; @@ -140,8 +142,9 @@ class Task extends CommonObject } } - //Update extrafield - if (!$error) { + // Update extrafield + if (! $error) + { if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { $result=$this->insertExtraFields(); @@ -258,7 +261,7 @@ class Task extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; $error=0; @@ -284,8 +287,8 @@ class Task extends CommonObject $sql.= " description=".(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").","; $sql.= " duration_effective=".(isset($this->duration_effective)?$this->duration_effective:"null").","; $sql.= " planned_workload=".(isset($this->planned_workload)?$this->planned_workload:"0").","; - $sql.= " dateo=".($this->date_start!=''?$this->db->idate($this->date_start):'null').","; - $sql.= " datee=".($this->date_end!=''?$this->db->idate($this->date_end):'null').","; + $sql.= " dateo=".($this->date_start!=''?"'".$this->db->idate($this->date_start)."'":'null').","; + $sql.= " datee=".($this->date_end!=''?"'".$this->db->idate($this->date_end)."'":'null').","; $sql.= " progress=".$this->progress.","; $sql.= " rang=".((!empty($this->rang))?$this->rang:"0"); $sql.= " WHERE rowid=".$this->id; @@ -339,7 +342,7 @@ class Task extends CommonObject /** - * Delete object in database + * Delete task from database * * @param User $user User that delete * @param int $notrigger 0=launch triggers after, 1=disable triggers @@ -376,15 +379,32 @@ class Task extends CommonObject } } - // Delete rang of line - //$this->delRangOfLine($this->id, $this->element); + if (! $error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time"; + $sql.= " WHERE fk_task=".$this->id; - $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task"; - $sql.= " WHERE rowid=".$this->id; + $resql = $this->db->query($sql); + if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + } - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + if (! $error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_extrafields"; + $sql.= " WHERE fk_object=".$this->id; + + $resql = $this->db->query($sql); + if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + } + + if (! $error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task"; + $sql.= " WHERE rowid=".$this->id; + + $resql = $this->db->query($sql); + if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + } if (! $error) { @@ -409,7 +429,7 @@ class Task extends CommonObject return -1*$error; } else - { + { //Delete associated link file if ($conf->projet->dir_output) { @@ -477,22 +497,23 @@ class Task extends CommonObject * * @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param int $option Sur quoi pointe le lien + * @param int $mode Mode 'task', 'time', 'contact', 'note', document' define page to link to. * @return string Chaine avec URL */ - function getNomUrl($withpicto=0,$option='') + function getNomUrl($withpicto=0,$option='',$mode='task') { global $langs; $result=''; - $lien = ''; + $lien = ''; $lienfin=''; $picto='projecttask'; $label=$langs->trans("ShowTask").': '.$this->ref.($this->label?' - '.$this->label:''); - if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); + if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; return $result; @@ -742,18 +763,21 @@ class Task extends CommonObject // Clean parameters if (isset($this->timespent_note)) $this->timespent_note = trim($this->timespent_note); + if (empty($this->timespent_datehour)) $this->timespent_datehour = $this->timespent_date; $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task_time ("; $sql.= "fk_task"; $sql.= ", task_date"; + $sql.= ", task_datehour"; $sql.= ", task_duration"; $sql.= ", fk_user"; $sql.= ", note"; $sql.= ") VALUES ("; $sql.= $this->id; $sql.= ", '".$this->db->idate($this->timespent_date)."'"; + $sql.= ", '".$this->db->idate($this->timespent_datehour)."'"; $sql.= ", ".$this->timespent_duration; $sql.= ", ".$this->timespent_fk_user; $sql.= ", ".(isset($this->timespent_note)?"'".$this->db->escape($this->timespent_note)."'":"null"); @@ -763,7 +787,7 @@ class Task extends CommonObject if ($this->db->query($sql) ) { $tasktime_id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task_time"); - $ret = $tasktme_id; + $ret = $tasktime_id; if (! $notrigger) { @@ -784,6 +808,7 @@ class Task extends CommonObject { $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task"; $sql.= " SET duration_effective = duration_effective + '".price2num($this->timespent_duration)."'"; + if (isset($this->progress)) $sql.= ", progress = " . $this->progress; // Do not overwrite value if not provided $sql.= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG); @@ -793,12 +818,9 @@ class Task extends CommonObject $this->db->rollback(); $ret = -2; } - } - if ($ret >= 0) - { $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_time"; - $sql.= " SET thm = (SELECT thm FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".$this->timespent_fk_user.")"; + $sql.= " SET thm = (SELECT thm FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".$this->timespent_fk_user.")"; // set average hour rate of user $sql.= " WHERE rowid = ".$tasktime_id; dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG); @@ -814,6 +836,47 @@ class Task extends CommonObject return $ret; } + /** + * Calculate total of time spent for task + * + * @param int $id Id of object (here task) + * @return array Array of info for task array('min_date', 'max_date', 'total_duration') + */ + function getSummaryOfTimeSpent($id='') + { + global $langs; + + if (empty($id)) $id=$this->id; + + $result=array(); + + $sql = "SELECT"; + $sql.= " MIN(t.task_datehour) as min_date,"; + $sql.= " MAX(t.task_datehour) as max_date,"; + $sql.= " SUM(t.task_duration) as total_duration"; + $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; + $sql.= " WHERE t.fk_task = ".$id; + + dol_syslog(get_class($this)."::getSummaryOfTimeSpent", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + $obj = $this->db->fetch_object($resql); + + $result['min_date'] = $obj->min_date; + $result['max_date'] = $obj->max_date; + $result['total_duration'] = $obj->total_duration; + + $this->db->free($resql); + return $result; + } + else + { + dol_print_error($this->db); + return $result; + } + } + /** * Load object in memory from database * @@ -875,12 +938,14 @@ class Task extends CommonObject $ret = 0; // Clean parameters + if (empty($this->timespent_datehour)) $this->timespent_datehour = $this->timespent_date; if (isset($this->timespent_note)) $this->timespent_note = trim($this->timespent_note); $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_time SET"; $sql.= " task_date = '".$this->db->idate($this->timespent_date)."',"; + $sql.= " task_datehour = '".$this->db->idate($this->timespent_datehour)."',"; $sql.= " task_duration = ".$this->timespent_duration.","; $sql.= " fk_user = ".$this->timespent_fk_user.","; $sql.= " note = ".(isset($this->timespent_note)?"'".$this->db->escape($this->timespent_note)."'":"null"); @@ -1019,7 +1084,8 @@ class Task extends CommonObject $error=0; - $now=dol_now(); + //Use 00:00 of today if time is use on task. + $now=dol_mktime(0,0,0,dol_print_date(dol_now(),'%m'),dol_print_date(dol_now(),'%d'),dol_print_date(dol_now(),'%Y')); $datec = $now; @@ -1312,4 +1378,39 @@ class Task extends CommonObject } } + /** + * Create an intervention document on disk using template defined into PROJECT_TASK_ADDON_PDF + * + * @param string $modele force le modele a utiliser ('' par defaut) + * @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 HookManager $hookmanager Hook manager instance + * @return int 0 if KO, 1 if OK + */ + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false) + { + global $conf,$langs; + + $langs->load("projects"); + + // Positionne modele sur le nom du modele de projet a utiliser + if (! dol_strlen($modele)) + { + if (! empty($conf->global->PROJECT_TASK_ADDON_PDF)) + { + $modele = $conf->global->PROJECT_TASK_ADDON_PDF; + } + else + { + $modele='nodefault'; + } + } + + $modelpath = "core/modules/project/task/doc/"; + + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index f359f789c3f..bc8f5b3098c 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -1,6 +1,6 @@ - * Copyright (C) 2012 Laurent Destailleur +/* Copyright (C) 2010 Regis Houssin + * Copyright (C) 2012-2014 Laurent Destailleur * * 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 @@ -156,7 +156,7 @@ if ($id > 0 || ! empty($ref)) */ print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print ''; print ''; - print ''; - print "\n"; + print ''; while ($i < $num) { @@ -181,7 +198,7 @@ if ($resql) if ($objp->socid) { $socstatic->id=$objp->socid; - $socstatic->nom=$objp->nom; + $socstatic->name=$objp->name; print $socstatic->getNomUrl(1); } else diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index a086f632a36..b581ca01be9 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -83,7 +83,7 @@ if ($id > 0 || ! empty($ref)) print '
    '.$langs->trans('Ref').''; diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 611fc314481..cb9742e40cc 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -104,7 +104,7 @@ if ($object->id > 0) print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print '"; + //print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + + $i++; } + if ($num > $max) + { + print ''; + } + + print "
    '.$langs->trans("Ref").''; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index b5a1d089c96..bc7478a0dbb 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2012 Juanjo Menent * @@ -28,6 +28,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; @@ -50,7 +51,20 @@ if (! empty($conf->ficheinter->enabled)) $langs->load("interventions"); $projectid=GETPOST('id','int'); $ref=GETPOST('ref','alpha'); $action=GETPOST('action','alpha'); - +$datesrfc=GETPOST('datesrfc'); +$dateerfc=GETPOST('dateerfc'); +$dates=dol_mktime(0, 0, 0, GETPOST('datesmonth'), GETPOST('datesday'), GETPOST('datesyear')); +$datee=dol_mktime(23, 59, 59, GETPOST('dateemonth'), GETPOST('dateeday'), GETPOST('dateeyear')); +if (empty($dates) && ! empty($datesrfc)) $dates=dol_stringtotime($datesrfc); +if (empty($datee) && ! empty($dateerfc)) $datee=dol_stringtotime($dateerfc); +if (! isset($_POST['datesrfc']) && ! isset($_POST['datesday'])) +{ + $new=dol_now(); + $tmp=dol_getdate($new); + //$datee=$now + //$dates=dol_time_plus_duree($datee, -1, 'y'); + $dates=dol_get_first_day($tmp['year'],1); +} if ($projectid == '' && $ref == '') { dol_print_error('','Bad parameter'); @@ -101,7 +115,7 @@ dol_fiche_head($head, 'element', $langs->trans("Project"),0,($project->public?'p print ''; -$linkback = ''.$langs->trans("BackToList").''; +$linkback = ''.$langs->trans("BackToList").''; print ''; print '
    '.$langs->trans("Ref").''; // Define a complementary filter for search of next/prev ref. @@ -141,7 +155,7 @@ print '
    '; -print ''; +dol_fiche_end(); /* @@ -150,59 +164,79 @@ print ''; $listofreferent=array( 'propal'=>array( + 'name'=>"Proposalq", 'title'=>"ListProposalsAssociatedProject", 'class'=>'Propal', 'table'=>'propal', + 'datefieldname'=>'datep', 'test'=>$conf->propal->enabled && $user->rights->propale->lire), 'order'=>array( + 'name'=>"CustomerOrderq", 'title'=>"ListOrdersAssociatedProject", 'class'=>'Commande', 'table'=>'commande', + 'datefieldname'=>'date_commande', 'test'=>$conf->commande->enabled && $user->rights->commande->lire), 'invoice'=>array( + 'name'=>"CustomerInvoiceq", 'title'=>"ListInvoicesAssociatedProject", 'class'=>'Facture', 'margin'=>'add', 'table'=>'facture', + 'datefieldname'=>'datef', 'test'=>$conf->facture->enabled && $user->rights->facture->lire), 'invoice_predefined'=>array( + 'name'=>"PredefinedInvoices", 'title'=>"ListPredefinedInvoicesAssociatedProject", 'class'=>'FactureRec', 'table'=>'facture_rec', + 'datefieldname'=>'datec', 'test'=>$conf->facture->enabled && $user->rights->facture->lire), 'order_supplier'=>array( + 'name'=>"SuplierOrders", 'title'=>"ListSupplierOrdersAssociatedProject", 'class'=>'CommandeFournisseur', 'table'=>'commande_fournisseur', + 'datefieldname'=>'date_commande', 'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire), 'invoice_supplier'=>array( + 'name'=>"BillsSuppliers", 'title'=>"ListSupplierInvoicesAssociatedProject", 'class'=>'FactureFournisseur', 'margin'=>'minus', 'table'=>'facture_fourn', + 'datefieldname'=>'datef', 'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire), 'contract'=>array( + 'name'=>"Contracts", 'title'=>"ListContractAssociatedProject", 'class'=>'Contrat', 'table'=>'contrat', + 'datefieldname'=>'date_contrat', 'test'=>$conf->contrat->enabled && $user->rights->contrat->lire), 'intervention'=>array( + 'name'=>"Interventions", 'title'=>"ListFichinterAssociatedProject", 'class'=>'Fichinter', 'table'=>'fichinter', + 'datefieldname'=>'date_valid', 'disableamount'=>1, 'test'=>$conf->ficheinter->enabled && $user->rights->ficheinter->lire), 'trip'=>array( + 'name'=>"TripAndExpenses", 'title'=>"ListTripAssociatedProject", 'class'=>'Deplacement', 'table'=>'deplacement', + 'datefieldname'=>'dated', 'margin'=>'minus', 'disableamount'=>1, 'test'=>$conf->deplacement->enabled && $user->rights->deplacement->lire), 'agenda'=>array( + 'name'=>"Agenda", 'title'=>"ListActionsAssociatedProject", 'class'=>'ActionComm', 'table'=>'actioncomm', + 'datefieldname'=>'datep', 'disableamount'=>1, 'test'=>$conf->agenda->enabled && $user->rights->agenda->allactions->lire) ); @@ -213,19 +247,52 @@ if ($action=="addelement") $elementselectid = GETPOST("elementselect"); $result=$project->update_element($tablename, $elementselectid); if ($result<0) { - setEventMessage($mailchimp->error,'errors'); + setEventMessage($project->error,'errors'); + } +}elseif ($action == "unlink") { + + $tablename = GETPOST("tablename"); + $elementselectid = GETPOST("elementselect"); + + $result = $project->remove_element($tablename, $elementselectid); + if ($result < 0) { + setEventMessage($project->error, 'errors'); } } +$showdatefilter=0; foreach ($listofreferent as $key => $value) { $title=$value['title']; $classname=$value['class']; $tablename=$value['table']; + $datefieldname=$value['datefieldname']; $qualified=$value['test']; if ($qualified) { + if (! $showdatefilter) + { + print '
    '; + print ''; + print ''; + print ''; + //print ''; + print ''; + print ''; + print ''; + print '
    '.$langs->trans("Filter").':'.$langs->trans("From").' '; + print $form->select_date($dates,'dates',0,0,1); + print ''.$langs->trans("to").' '; + print $form->select_date($datee,'datee',0,0,1); + print ''; + print ''; + print '
    '; + print '

    '; + + $showdatefilter++; + } + print '
    '; print_titre($langs->trans($title)); @@ -238,6 +305,8 @@ foreach ($listofreferent as $key => $value) print '
    '; print ''; print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -247,15 +316,17 @@ foreach ($listofreferent as $key => $value) print '
    '.$langs->trans("SelectElement").''.$selectList.'
    '; print ''; - print ''; + print ''; print ''; print ''; if (empty($value['disableamount'])) print ''; + else print ''; if (empty($value['disableamount'])) print ''; + else print ''; print ''; print ''; - $elementarray = $project->get_element_list($key, $tablename); - if (count($elementarray)>0 && is_array($elementarray)) + $elementarray = $project->get_element_list($key, $tablename, $datefieldname, $dates, $datee); + if (is_array($elementarray) && count($elementarray)>0) { $var=true; $total_ht = 0; @@ -276,7 +347,9 @@ foreach ($listofreferent as $key => $value) $var=!$var; print ""; - + print '\n"; // Ref print ''; } + else print ''; // Amount if (empty($value['disableamount'])) @@ -313,6 +387,7 @@ foreach ($listofreferent as $key => $value) if (! $qualifiedfortotal) print ''; print ''; } + else print ''; // Status print ''; @@ -326,12 +401,18 @@ foreach ($listofreferent as $key => $value) } } - print ''; + print ''; if (empty($value['disableamount'])) print ''; + else print ''; if (empty($value['disableamount'])) print ''; + else print ''; print ''; print ''; } + else // error + { + print $elementarray; + } print "
    '.$langs->trans("Ref").''.$langs->trans("Ref").''.$langs->trans("Date").''.$langs->trans("ThirdParty").''.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").''.$langs->trans("Status").'
    '; + print '' . img_picto($langs->trans('Unlink'), 'editdelete') . ''; + print "'; print $element->getNomUrl(1); @@ -303,6 +376,7 @@ foreach ($listofreferent as $key => $value) if (! $qualifiedfortotal) print ''; print ''.$element->getLibStatut(5).'
    '.$langs->trans("Number").': '.$i.'
    '.$langs->trans("Number").': '.$i.''.$langs->trans("TotalHT").' : '.price($total_ht).''.$langs->trans("TotalTTC").' : '.price($total_ttc).' 
    "; @@ -350,7 +431,7 @@ foreach ($listofreferent as $key => $value) } if ($key == 'order' && ! empty($conf->commande->enabled) && $user->rights->commande->creer) { - print ''.$langs->trans("AddCustomerOrder").''; + print ''.$langs->trans("AddCustomerOrder").''; } if ($key == 'invoice' && ! empty($conf->facture->enabled) && $user->rights->facture->creer) { @@ -361,11 +442,11 @@ foreach ($listofreferent as $key => $value) { if ($key == 'order_supplier' && ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->creer) { - print ''.$langs->trans("AddSupplierInvoice").''; + print ''.$langs->trans("AddSupplierInvoice").''; } if ($key == 'invoice_supplier' && ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->creer) { - print ''.$langs->trans("AddSupplierOrder").''; + print ''.$langs->trans("AddSupplierOrder").''; } } } @@ -374,8 +455,13 @@ foreach ($listofreferent as $key => $value) } } -// Margin display of the project -print_titre("Margin"); +// Profit for all project +$langs->load("suppliers"); +$langs->load("bills"); +$langs->load("orders"); +$langs->load("proposals"); +$langs->load("margins"); +print_fiche_titre($langs->trans("Profit"),'',''); print ''; print ''; print ''; @@ -384,9 +470,9 @@ print ''; print ''; print ''; - foreach ($listofreferent as $key => $value) { + $name=$langs->trans($value['name']); $title=$value['title']; $classname=$value['class']; $tablename=$value['table']; @@ -415,7 +501,7 @@ foreach ($listofreferent as $key => $value) } print ''; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 0c06c30ba57..e6fdd3264ca 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -102,7 +102,7 @@ if ($id > 0 || ! empty($ref)) print '
    '.$langs->trans("Element").''.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").'
    '.$classname.''.$name.''.$i.''.price($total_ht).''.price($total_ttc).'
    '; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print '\n"; $sql = "SELECT count(p.rowid) as nb"; -$sql.= ", s.nom, s.rowid as socid"; +$sql.= ", s.nom as name, s.rowid as socid"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; $sql.= " WHERE p.entity = ".$conf->entity; @@ -127,7 +129,7 @@ if ( $resql ) if ($obj->socid) { $socstatic->id=$obj->socid; - $socstatic->nom=$obj->nom; + $socstatic->name=$obj->name; print $socstatic->getNomUrl(1); } else @@ -135,7 +137,7 @@ if ( $resql ) print $langs->trans("OthersNotLinkedToThirdParty"); } print ''; - print ''; + print ''; print "\n"; $i++; @@ -156,20 +158,23 @@ print ''; // Tasks for all resources of all opened projects and time spent for each task/resource print '
    '; -$sql = "SELECT p.ref, p.title, p.rowid as projectid, t.label, t.rowid as taskid, u.rowid as userid, t.planned_workload, t.dateo, t.datee, SUM(tasktime.task_duration) as timespent"; +$max = (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA); + +$sql = "SELECT p.ref, p.title, p.rowid as projectid, t.label, t.rowid as taskid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee, SUM(tasktime.task_duration) as timespent"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; -$sql.= " INNER JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid"; -$sql.= " INNER JOIN ".MAIN_DB_PREFIX."projet_task_time as tasktime on tasktime.fk_task = t.rowid"; -$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u on tasktime.fk_user = u.rowid"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tasktime on tasktime.fk_task = t.rowid"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on tasktime.fk_user = u.rowid"; $sql.= " WHERE p.entity = ".$conf->entity; -if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; +if ($mine || empty($user->rights->projet->all->lire)) $sql.= " AND p.rowid IN (".$projectsListId.")"; if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; $sql.= " AND p.fk_statut=1"; -$sql.= " GROUP BY p.title, p.rowid, t.label, t.rowid, u.rowid, t.planned_workload, t.dateo, t.datee"; -$sql.= " ORDER BY u.rowid, t.dateo, t.datee"; +$sql.= " GROUP BY p.ref, p.title, p.rowid, t.label, t.rowid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee"; +$sql.= " ORDER BY t.rowid, t.dateo, t.datee"; +$sql.= $db->plimit($max+1); // We want more to know if we have more than limit -$userstatic=new User($db); +$var=true; dol_syslog('projet:index.php: affectationpercent', LOG_DEBUG); $resql = $db->query($sql); @@ -178,75 +183,87 @@ if ( $resql ) $num = $db->num_rows($resql); $i = 0; - if ($num > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)) + print '
    '; + + print_fiche_titre($langs->trans("TasksOnOpenedProject"),'','').'
    '; + + print '
    '; diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 4e81c2efca3..ec807f5a5a3 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -49,6 +49,7 @@ $sortorder = GETPOST("sortorder",'alpha'); $socstatic=new Societe($db); $projectstatic=new Project($db); +$userstatic=new User($db); $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,($mine?$mine:(empty($user->rights->projet->all->lire)?0:2)),1); //var_dump($projectsListId); @@ -77,13 +78,14 @@ print '
    '; if (! empty($conf->projet->enabled) && $user->rights->projet->lire) { $var=false; - print ''; + print ''; print ''; print ''; print ''; print ''; print ''; - print ''; + print ''; + print ''; print ''; print ''; print "
    '.$langs->trans("SearchAProject").'
    :
    :
    :
    \n"; @@ -103,7 +105,7 @@ print_liste_field_titre($langs->trans("NbOfProjects"),"","","","",'align="right" print "
    '.$obj->nb.''.$obj->nb.'
    '; + print ''; + //print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + while ($i < $num && $i < $max) { -/* $langs->load("errors"); - print ''; - print '';*/ - } - else - { - print '
    '; + $obj = $db->fetch_object($resql); + $var=!$var; - print_fiche_titre($langs->trans("TimeSpent"),'','').'
    '; - - print '
    '.$langs->trans('TaskRessourceLinks').''.$langs->trans('Projects').''.$langs->trans('Task').''.$langs->trans('DateStart').''.$langs->trans('DateEnd').''.$langs->trans('PlannedWorkload').''.$langs->trans("ProgressDeclared").''; + print ''.$langs->trans('TimeSpent').''.$langs->trans("ProgressCalculated").''; + print '
    '; - print $langs->trans("WarningTooManyDataPleaseUseMoreFilters"); - print '
    '; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - while ($i < $num) + $username=''; + if ($obj->userid && $userstatic->id != $obj->userid) // We have a user and it is not last loaded user { - $obj = $db->fetch_object($resql); - $var=!$var; - - $username=''; - if ($obj->userid && $userstatic->id != $obj->userid) // We have a user and it is not last loaded user - { - $result=$userstatic->fetch($obj->userid); - if (! $result) $userstatic->id=0; - } - if ($userstatic->id) $username = $userstatic->getNomUrl(0,0); - - print ""; - print ''; - print ''; - print ''; - print ''; - print ''; - /* I disable this because information is wrong. This percent has no meaning for a particular resource. What do we want ? - * Percent of completion ? - * If we want to show completion, we must remove "user" into list, - if (empty($obj->planned_workload)) { - $percentcompletion = $langs->trans("Unknown"); - } else { - $percentcompletion = intval($obj->task_duration*100/$obj->planned_workload); - }*/ - print ''; - print "\n"; - - $i++; + $result=$userstatic->fetch($obj->userid); + if (! $result) $userstatic->id=0; } + if ($userstatic->id) $username = $userstatic->getNomUrl(0,0); - print "
    '.$langs->trans('TaskRessourceLinks').''.$langs->trans('Projects').''.$langs->trans('Task').''.$langs->trans('DateStart').''.$langs->trans('DateEnd').''.$langs->trans('TimeSpent').'
    '.$username.''; - $projectstatic->id=$obj->projectid; - $projectstatic->ref=$obj->ref; - $projectstatic->title=$obj->title; - print $projectstatic->getNomUrl(1,'',16); - //print ''.$obj->title.''; - print ''.$obj->label.''.dol_print_date($db->jdate($obj->dateo)).''.dol_print_date($db->jdate($obj->datee)).''; - //print $percentcompletion.' %'; - print convertSecondToTime($obj->timespent, 'all'); - print '
    "; + print "
    '.$username.''; + $projectstatic->id=$obj->projectid; + $projectstatic->ref=$obj->ref; + $projectstatic->title=$obj->title; + print $projectstatic->getNomUrl(1,'',16); + //print ''.$obj->title.''; + print ''; + if (! empty($obj->taskid)) + { + print ''.$obj->label.''; + } + else print $langs->trans("NoTasks"); + print ''.dol_print_date($db->jdate($obj->dateo),'day').''.dol_print_date($db->jdate($obj->datee),'day').''; + print convertSecondToTime($obj->planned_workload, 'all'); + print ''; + print ($obj->taskid>0)?$obj->progress.'%':''; + print ''; + print convertSecondToTime($obj->timespent, 'all'); + print ''; + if (! empty($obj->taskid)) + { + if (empty($obj->planned_workload) > 0) { + $percentcompletion = $langs->trans("WorkloadNotDefined"); + } else { + $percentcompletion = intval($obj->duration_effective*100/$obj->planned_workload).'%'; + } + } + print $percentcompletion; + print '
    '.$langs->trans("WarningTooManyDataPleaseUseMoreFilters").'
    "; + + $db->free($resql); } else diff --git a/htdocs/projet/liste.php b/htdocs/projet/list.php similarity index 83% rename from htdocs/projet/liste.php rename to htdocs/projet/list.php index a7404e5c23b..f00a6ef518b 100644 --- a/htdocs/projet/liste.php +++ b/htdocs/projet/list.php @@ -20,13 +20,14 @@ */ /** - * \file htdocs/projet/liste.php + * \file htdocs/projet/list.php * \ingroup projet * \brief Page to list projects */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->load('projects'); @@ -39,7 +40,7 @@ if ($socid > 0) { $soc = new Societe($db); $soc->fetch($socid); - $title .= ' ('.$soc->nom.')'; + $title .= ' ('.$soc->name.')'; } if (!$user->rights->projet->lire) accessforbidden(); @@ -61,8 +62,18 @@ $mine = $_REQUEST['mode']=='mine' ? 1 : 0; $search_ref=GETPOST("search_ref"); $search_label=GETPOST("search_label"); $search_societe=GETPOST("search_societe"); +$search_year=GETPOST("search_year"); $search_all=GETPOST("search_all"); +// Purge criteria +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_ref=""; + $search_label=""; + $search_societe=""; + $search_year=""; + $search_all=0; +} /* * View @@ -78,7 +89,7 @@ $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,($mine?$min $sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_statut, p.public, p.fk_user_creat"; $sql.= ", p.datec as date_create, p.dateo as date_start, p.datee as date_end"; -$sql.= ", s.nom, s.rowid as socid"; +$sql.= ", s.nom as name, s.rowid as socid"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; $sql.= " WHERE p.entity = ".$conf->entity; @@ -98,6 +109,10 @@ if ($search_societe) { $sql .= natural_search('s.nom', $search_societe); } +if ($search_year) { + $sql .= " AND (p.dateo IS NULL OR p.dateo <= ".$db->idate(dol_get_last_day($search_year,12,false)).")"; + $sql .= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($search_year,1,false)).")"; +} if ($search_all) { $sql .= natural_search(array('p.ref','p.title','s.nom'), $search_all); @@ -147,8 +162,10 @@ if ($resql) print ''; print '
     
    '; + print ''; + print ''; + print '
    '; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print '"; print ''; } @@ -348,12 +346,9 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; print ''; print ''; @@ -179,8 +179,6 @@ if ($object->id > 0) print '
    '.$langs->trans("Ref").''; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 994779fcac9..850b76bd3b3 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -64,7 +64,7 @@ if ($user->societe_id > 0) $socid = $user->societe_id; $result = restrictedArea($user, 'projet', $id); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('projecttaskcard')); +$hookmanager->initHooks(array('projecttaskcard','globalcard')); $progress=GETPOST('progress', 'int'); $label=GETPOST('label', 'alpha'); @@ -203,7 +203,7 @@ if ($id > 0 || ! empty($ref)) print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print ''; print ''; // Date start @@ -319,7 +320,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''; // Progress - print ''; @@ -416,7 +417,7 @@ else print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 3cc8b51ca1a..99d127fb9a9 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -57,7 +57,7 @@ $projectstatic = new Project($db); // Add new contact if ($action == 'addcontact' && $user->rights->projet->creer) { - $result = $object->fetch($id); + $result = $object->fetch($id, $ref); if ($result > 0 && $id > 0) { @@ -87,7 +87,7 @@ if ($action == 'addcontact' && $user->rights->projet->creer) // bascule du statut d'un contact if ($action == 'swapstatut' && $user->rights->projet->creer) { - if ($object->fetch($id)) + if ($object->fetch($id, $ref)) { $result=$object->swapContactStatus(GETPOST('ligne')); } @@ -100,7 +100,7 @@ if ($action == 'swapstatut' && $user->rights->projet->creer) // Efface un contact if ($action == 'deleteline' && $user->rights->projet->creer) { - $object->fetch($id); + $object->fetch($id, $ref); $result = $object->delete_contact($_GET["lineid"]); if ($result >= 0) @@ -152,10 +152,10 @@ $userstatic = new User($db); if ($id > 0 || ! empty($ref)) { - if ($object->fetch($id) > 0) + if ($object->fetch($id, $ref) > 0) { $result=$projectstatic->fetch($object->fk_project); - if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid); + if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); $object->project = dol_clone($projectstatic); @@ -179,7 +179,7 @@ if ($id > 0 || ! empty($ref)) // Define a complementary filter for search of next/prev ref. if (! $user->rights->projet->all->lire) { - $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,0); + $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0); $projectstatic->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")"; } print $form->showrefnav($projectstatic,'project_ref','',1,'ref','ref','',$param.'&withproject=1'); @@ -188,7 +188,7 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; @@ -215,8 +215,6 @@ if ($id > 0 || ! empty($ref)) print '
    '; @@ -300,7 +300,8 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print '
    '.$langs->trans("AffectedTo").''; - print $form->select_dolusers($user->id,'userid',1); + $contactsofproject=(! empty($object->id)?$object->getListContactId('internal'):''); + $form->select_users($user->id,'userid',0,'',0,'',$contactsofproject); print '
    '.$langs->trans("Progress").''; + print '
    '.$langs->trans("ProgressDeclared").''; print $formother->select_percent($progress,'progress'); print '
    '.$langs->trans("LabelTask").''.$langs->trans("DateStart").''.$langs->trans("DateEnd").''.$langs->trans("PlannedWorkload").''.$langs->trans("PlannedWorkload").''.$langs->trans("ProgressDeclared").''.$langs->trans("TimeSpent").''.$langs->trans("ProgressCalculated").'
    '.$langs->trans("Label").''.$projectstatic->title.'
    '.$langs->trans("ThirdParty").''; - if (! empty($projectstatic->societe->id)) print $projectstatic->societe->getNomUrl(1); + if (! empty($projectstatic->thirdparty->id)) print $projectstatic->thirdparty->getNomUrl(1); else print ' '; print '
    '; dol_fiche_end(); - - print '
    '; } // To verify role of users @@ -239,7 +237,7 @@ if ($id > 0 || ! empty($ref)) print '
    '.$langs->trans('Ref').''; if (! GETPOST('withproject') || empty($projectstatic->id)) { - $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1); + $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1); $object->next_prev_filter=" fk_projet in (".$projectsListId.")"; } else $object->next_prev_filter=" fk_projet = ".$projectstatic->id; @@ -259,7 +257,7 @@ if ($id > 0 || ! empty($ref)) // Customer print "
    ".$langs->trans("ThirdParty")."'; - if ($projectstatic->societe->id > 0) print $projectstatic->societe->getNomUrl(1); + if ($projectstatic->thirdparty->id > 0) print $projectstatic->thirdparty->getNomUrl(1); else print ' '; print '
    '; - $events=array(); - $events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); - $thirdpartyofproject=$projectstatic->getListContactId('thirdparty'); $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$projectstatic->societe->id; - $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', $thirdpartyofproject, 0, $events, '&withproject='.$withproject); + $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', $thirdpartyofproject, 0, '&withproject='.$withproject); print ''; diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 03ca7bae452..ee3b9288d3c 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -121,7 +121,7 @@ llxHeader('',$langs->trans('Task')); if ($object->id > 0) { - if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid); + $projectstatic->fetch_thirdparty(); $userWrite = $projectstatic->restrictedProjectArea($user,'write'); @@ -152,7 +152,7 @@ if ($object->id > 0) print '
    '.$langs->trans("Label").''.$projectstatic->title.'
    '.$langs->trans("ThirdParty").''; - if (! empty($projectstatic->societe->id)) print $projectstatic->societe->getNomUrl(1); + if (! empty($projectstatic->thirdparty->id)) print $projectstatic->thirdparty->getNomUrl(1); else print ' '; print '
    '; dol_fiche_end(); - - print '
    '; } $head = task_prepare_head($object); @@ -225,7 +223,7 @@ if ($object->id > 0) // Third party print '
    '.$langs->trans("ThirdParty").''; - if ($projectstatic->societe->id) print $projectstatic->societe->getNomUrl(1); + if ($projectstatic->thirdparty->id) print $projectstatic->thirdparty->getNomUrl(1); else print ' '; print '
    '; print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; @@ -122,11 +128,14 @@ print $form->selectarray('search_status', $listofstatus, $search_status); print ''; print ''; -print ''; -print "\n"; -if (count($tasksarray) > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)) +$max=1000; + +if (count($tasksarray) > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?$max:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)) { $langs->load("errors"); print ''; diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index 04e92c7c7f2..5b479085f61 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -51,7 +51,7 @@ if ($id > 0 || ! empty($ref)) if ($object->fetch($id,$ref) > 0) { $projectstatic->fetch($object->fk_project); - if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid); + if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); $object->project = dol_clone($projectstatic); } @@ -134,7 +134,7 @@ if ($object->id > 0) // Company print ''; print ''; @@ -161,8 +161,6 @@ if ($object->id > 0) print '
    '.$langs->trans("Project").''.$langs->trans("Status").''.$langs->trans("ProjectStatus").''.$langs->trans("RefTask").''.$langs->trans("LabelTask").''.$langs->trans("DateStart").''; print ' '; +print ''; +print ''; +print ''; print '
    '.$langs->trans("ThirdParty").''; - if (! empty($projectstatic->societe->id)) print $projectstatic->societe->getNomUrl(1); + if (! empty($projectstatic->thirdparty->id)) print $projectstatic->thirdparty->getNomUrl(1); else print ' '; print '
    '; dol_fiche_end(); - - print '
    '; } $head = task_prepare_head($object); @@ -196,7 +194,7 @@ if ($object->id > 0) // Third party print ''.$langs->trans("ThirdParty").''; - if ($projectstatic->societe->id > 0) print $projectstatic->societe->getNomUrl(1); + if ($projectstatic->thirdparty->id > 0) print $projectstatic->thirdparty->getNomUrl(1); else print' '; print ''; } diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 7337c152f4e..a64d5354768 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -50,7 +50,7 @@ if ($user->societe_id > 0) $socid = $user->societe_id; if (! $user->rights->projet->lire) accessforbidden(); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('projecttaskcard')); +$hookmanager->initHooks(array('projecttaskcard','globalcard')); $object = new Task($db); $extrafields = new ExtraFields($db); @@ -58,9 +58,11 @@ $projectstatic = new Project($db); // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + + /* * Actions -*/ + */ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer) { @@ -91,11 +93,10 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer) $ret = $extrafields->setOptionalsFromPost($extralabels,$object); $result=$object->update($user); - + if ($result < 0) { - setEventMessage($object->error,'errors'); - setEventMessage($object->errors,'errors'); + setEventMessages($object->error,$object->errors,'errors'); } } else @@ -121,8 +122,7 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->s } else { - $langs->load("errors"); - setEventMessage($langs->trans($object->error), 'errors'); + setEventMessages($object->error,$object->errors,'errors'); $action=''; } } @@ -159,7 +159,7 @@ if ($action == 'builddoc' && $user->rights->projet->creer) $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang(GETPOST('lang_id')); } - $result=task_pdf_create($db, $object, $object->modelpdf, $outputlangs); + $result= $object->generateDocument($object->modelpdf, $outputlangs); if ($result <= 0) { dol_print_error($db,$result); @@ -202,7 +202,7 @@ if ($id > 0 || ! empty($ref)) $res=$object->fetch_optionals($object->id,$extralabels); $result=$projectstatic->fetch($object->fk_project); - if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid); + if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); $object->project = dol_clone($projectstatic); @@ -235,7 +235,7 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("Label").''.$projectstatic->title.''; print ''.$langs->trans("ThirdParty").''; - if (! empty($projectstatic->societe->id)) print $projectstatic->societe->getNomUrl(1); + if (! empty($projectstatic->thirdparty->id)) print $projectstatic->thirdparty->getNomUrl(1); else print ' '; print ''; print ''; @@ -262,8 +262,6 @@ if ($id > 0 || ! empty($ref)) print ''; dol_fiche_end(); - - print '
    '; } /* @@ -295,9 +293,6 @@ if ($id > 0 || ! empty($ref)) //$arrayofuseridoftask=$object->getListContactId('internal'); $head=task_prepare_head($object); - dol_fiche_head($head, 'task_task', $langs->trans("Task"),0,'projecttask'); - - if ($action == 'edit' && $user->rights->projet->creer) { @@ -307,6 +302,8 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; + dol_fiche_head($head, 'task_task', $langs->trans("Task"),0,'projecttask'); + print ''; // Ref @@ -351,8 +348,8 @@ if ($id > 0 || ! empty($ref)) print $form->select_duration('planned_workload',$object->planned_workload,0,'text'); print ''; - // Progress - print ''; @@ -372,10 +369,12 @@ if ($id > 0 || ! empty($ref)) print '
    '.$langs->trans("Progress").''; + // Progress declared + print '
    '.$langs->trans("ProgressDeclared").''; print $formother->select_percent($object->progress,'progress'); print '
    '; - print '

    '; + dol_fiche_end(); + + print '
    '; print '   '; print ''; - print '
    '; + print '
    '; print ''; } @@ -383,10 +382,12 @@ if ($id > 0 || ! empty($ref)) { /* * Fiche tache en mode visu - */ + */ $param=($withproject?'&withproject=1':''); $linkback=$withproject?''.$langs->trans("BackToList").'':''; + dol_fiche_head($head, 'task_task', $langs->trans("Task"),0,'projecttask'); + if ($action == 'delete') { print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"].'&withproject='.$withproject,$langs->trans("DeleteATask"),$langs->trans("ConfirmDeleteATask"),"confirm_delete"); @@ -440,14 +441,20 @@ if ($id > 0 || ! empty($ref)) print convertSecondToTime($object->planned_workload,'allhourmin'); print ''; - // Progress + // Progress declared print ''.$langs->trans("ProgressDeclared").''; print $object->progress.' %'; print ''; - // Progress + // Progress calculated print ''.$langs->trans("ProgressCalculated").''; - print $object->progress.' %'; + if ($object->planned_workload) + { + $tmparray=$object->getSummaryOfTimeSpent(); + if ($tmparray['total_duration'] > 0) print round($tmparray['total_duration'] / $object->planned_workload * 100, 2).' %'; + else print '0 %'; + } + else print ''; print ''; // Description @@ -465,12 +472,11 @@ if ($id > 0 || ! empty($ref)) print ''; + dol_fiche_end(); } - dol_fiche_end(); - - if ($_GET["action"] != 'edit') + if ($action != 'edit') { /* * Actions @@ -504,7 +510,7 @@ if ($id > 0 || ! empty($ref)) /* * Documents generes - */ + */ $filename=dol_sanitizeFileName($projectstatic->ref). "/". dol_sanitizeFileName($object->ref); $filedir=$conf->projet->dir_output . "/" . dol_sanitizeFileName($projectstatic->ref). "/" .dol_sanitizeFileName($object->ref); $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 56048ad1cf2..9951902ec5b 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1,6 +1,6 @@ - * Copyright (C) 2006-2013 Laurent Destailleur + * Copyright (C) 2006-2014 Laurent Destailleur * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * @@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $langs->load('projects'); @@ -72,7 +73,7 @@ if ($action == 'addtimespent' && $user->rights->projet->creer) if (! $error) { - $object->fetch($id); + $object->fetch($id, $ref); $object->fetch_projet(); if (empty($object->projet->statut)) @@ -83,11 +84,11 @@ if ($action == 'addtimespent' && $user->rights->projet->creer) else { $object->timespent_note = $_POST["timespent_note"]; + $object->progress = GETPOST('progress', 'int'); $object->timespent_duration = $_POST["timespent_durationhour"]*60*60; // We store duration in seconds $object->timespent_duration+= $_POST["timespent_durationmin"]*60; // We store duration in seconds $object->timespent_date = dol_mktime(12,0,0,$_POST["timemonth"],$_POST["timeday"],$_POST["timeyear"]); $object->timespent_fk_user = $_POST["userid"]; - $result=$object->addTimeSpent($user); if ($result >= 0) { @@ -118,7 +119,7 @@ if ($action == 'updateline' && ! $_POST["cancel"] && $user->rights->projet->cree if (! $error) { - $object->fetch($id); + $object->fetch($id, $ref); $object->timespent_id = $_POST["lineid"]; $object->timespent_note = $_POST["timespent_note_line"]; @@ -180,22 +181,23 @@ if (! empty($project_ref) && ! empty($withproject)) /* * View -*/ + */ llxHeader("",$langs->trans("Task")); $form = new Form($db); +$formother = new FormOther($db); $userstatic = new User($db); if ($id > 0 || ! empty($ref)) { /* * Fiche projet en mode visu - */ - if ($object->fetch($id) >= 0) + */ + if ($object->fetch($id, $ref) >= 0) { $result=$projectstatic->fetch($object->fk_project); - if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid); + if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); $object->project = dol_clone($projectstatic); @@ -230,7 +232,7 @@ if ($id > 0 || ! empty($ref)) // Thirdparty print ''.$langs->trans("ThirdParty").''; - if (! empty($projectstatic->societe->id)) print $projectstatic->societe->getNomUrl(1); + if (! empty($projectstatic->thirdparty->id)) print $projectstatic->thirdparty->getNomUrl(1); else print ' '; print ''; print ''; @@ -257,8 +259,6 @@ if ($id > 0 || ! empty($ref)) print ''; dol_fiche_end(); - - print '
    '; } $head=task_prepare_head($object); @@ -290,8 +290,36 @@ if ($id > 0 || ! empty($ref)) // Label print ''.$langs->trans("Label").''.$object->label.''; + // Date start + print ''.$langs->trans("DateStart").''; + print dol_print_date($object->date_start,'dayhour'); + print ''; + + // Date end + print ''.$langs->trans("DateEnd").''; + print dol_print_date($object->date_end,'dayhour'); + print ''; + // Planned workload - print ''.$langs->trans("PlannedWorkload").''.convertSecondToTime($object->planned_workload,'allhourmin').''; + print ''.$langs->trans("PlannedWorkload").''; + print convertSecondToTime($object->planned_workload,'allhourmin'); + print ''; + + // Progress declared + print ''.$langs->trans("ProgressDeclared").''; + print $object->progress.' %'; + print ''; + + // Progress calculated + print ''.$langs->trans("ProgressCalculated").''; + if ($object->planned_workload) + { + $tmparray=$object->getSummaryOfTimeSpent(); + if ($tmparray['total_duration'] > 0) print round($tmparray['total_duration']/$object->planned_workload*100, 2).' %'; + else print '0 %'; + } + else print ''; + print ''; // Project if (empty($withproject)) @@ -302,7 +330,7 @@ if ($id > 0 || ! empty($ref)) // Third party print ''.$langs->trans("ThirdParty").''; - if ($projectstatic->societe->id) print $projectstatic->societe->getNomUrl(1); + if ($projectstatic->thirdparty->id) print $projectstatic->thirdparty->getNomUrl(1); else print ' '; print ''; } @@ -314,7 +342,7 @@ if ($id > 0 || ! empty($ref)) /* * Add time spent - */ + */ if ($user->rights->projet->creer) { print '
    '; @@ -331,8 +359,8 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("Date").''; print ''.$langs->trans("By").''; print ''.$langs->trans("Note").''; - print ''.$langs->trans("Duration").''; - print ' '; + print ''.$langs->trans("ProgressDeclared").''; + print ''.$langs->trans("NewTimeSpent").''; print "\n"; print ''; @@ -345,23 +373,29 @@ if ($id > 0 || ! empty($ref)) // Contributor print ''; - $restrictaddtimetocontactoftask=0; - if (empty($conf->global->PROJECT_TIME_ON_ALL_TASKS_MY_PROJECTS)) - { - $restrictaddtimetocontactoftask=$object->getListContactId('internal'); + print img_object('','user','class="hideonsmartphone"'); + $contactsoftask=$object->getListContactId('internal'); + if (count($contactsoftask)>0) { + $userid=$contactsoftask[0]; + print $form->select_dolusers($userid,'userid',0,'',0,'',$contactsoftask); + }else { + print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); } - print img_object('','user'); - print $form->select_dolusers($_POST["userid"]?$_POST["userid"]:$user->id,'userid',0,'',0,'',$restrictaddtimetocontactoftask); // Note: If user is not allowed it will be disabled into combo list and userid not posted print ''; // Note print ''; - print ''; + print ''; print ''; - // Duration + // Progress declared + print ''; + print $formother->select_percent(GETPOST('progress')?GETPOST('progress'):$object->progress,'progress'); + print ''; + + // Duration - Time spent print ''; - print $form->select_duration('timespent_duration',($_POST['timespent_duration']?$_POST['timespent_duration']:''),0,'text'); + print $form->select_duration('timespent_duration', ($_POST['timespent_duration']?$_POST['timespent_duration']:''), 0, 'text'); print ''; print ''; @@ -375,7 +409,7 @@ if ($id > 0 || ! empty($ref)) /* * List of time spent - */ + */ $sql = "SELECT t.rowid, t.task_date, t.task_duration, t.fk_user, t.note"; $sql.= ", u.lastname, u.firstname"; $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; @@ -408,13 +442,14 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; + print ''; print ''; print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; print "\n"; @@ -440,7 +475,15 @@ if ($id > 0 || ! empty($ref)) print ''."\n"; - //print_liste_field_titre($langs->trans("DateToBirth"),"public_list.php","birth",'',$param,$sortfield,$sortorder); // est-ce nécessaire ?? - print_liste_field_titre($langs->trans("EMail"),"public_list.php","email",'',$param,$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Zip"),"public_list.php","zip","",$param,$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Town"),"public_list.php","town","",$param,$sortfield,$sortorder); + //print_liste_field_titre($langs->trans("DateToBirth"), $_SERVER["PHP_SELF"],"birth",'',$param,$sortfield,$sortorder); // est-ce nécessaire ?? + print_liste_field_titre($langs->trans("EMail"), $_SERVER["PHP_SELF"],"email",'',$param,$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Zip"), $_SERVER["PHP_SELF"],"zip","",$param,$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Town"), $_SERVER["PHP_SELF"],"town","",$param,$sortfield,$sortorder); print "\n"; print "\n"; @@ -140,7 +140,6 @@ if ($result) $var=!$var; print ""; print ''."\n"; - //print "\n"; // est-ce nécessaire ?? print ''."\n"; print ''."\n"; print ''."\n"; diff --git a/htdocs/public/paybox/newpayment.php b/htdocs/public/paybox/newpayment.php index 47a93e39c32..0213ee7f6fa 100644 --- a/htdocs/public/paybox/newpayment.php +++ b/htdocs/public/paybox/newpayment.php @@ -166,7 +166,7 @@ if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcredi else if (! empty($conf->global->PAYBOX_CREDITOR)) $creditor=$conf->global->PAYBOX_CREDITOR; print ''."\n"; -print '
    '; +print '
    '; print '
    '; print ''; print ''; @@ -778,7 +778,7 @@ print '
    '."\n"; print '
    '.$langs->trans("Date").''.$langs->trans("By").''.$langs->trans("Note").''.$langs->trans("Duration").''.$langs->trans("TimeSpent").' 
    '; if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) { - print $form->select_dolusers($task_time->fk_user,'userid_line'); + $contactsoftask=$object->getListContactId('internal'); + if (!in_array($task_time->fk_user,$contactsoftask)) { + $contactsoftask[]=$task_time->fk_user; + } + if (count($contactsoftask)>0) { + print $form->select_dolusers($task_time->fk_user,'userid_line',0,'',0,'',$contactsoftask); + }else { + print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); + } } else { @@ -455,7 +498,7 @@ if ($id > 0 || ! empty($ref)) print ''; if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) { - print ''; + print ''; } else { diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index 3443f08788f..2b1d02ef493 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -65,10 +65,10 @@ if (! empty($_GET["year"])) $filters['year']=$_GET["year"]; if (! empty($_GET["id"])) $filters['id']=$_GET["id"]; if (! empty($_GET["idfrom"])) $filters['idfrom']=$_GET["idfrom"]; if (! empty($_GET["idto"])) $filters['idto']=$_GET["idto"]; +if (! empty($_GET["project"])) $filters['project']=$_GET["project"]; if (! empty($_GET["login"])) $filters['login']=$_GET["login"]; if (! empty($_GET["logina"])) $filters['logina']=$_GET["logina"]; if (! empty($_GET["logint"])) $filters['logint']=$_GET["logint"]; -if (! empty($_GET["logind"])) $filters['logind']=$_GET["logind"]; // Not older than if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100; $filters['notolderthan']=$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY; @@ -107,10 +107,10 @@ foreach ($filters as $key => $value) if ($key == 'id') $filename.='-id'.$value; if ($key == 'idfrom') $filename.='-idfrom'.$value; if ($key == 'idto') $filename.='-idto'.$value; + if ($key == 'project') $filename.='-project'.$value; if ($key == 'login') $filename.='-login'.$value; if ($key == 'logina') $filename.='-logina'.$value; // Author - if ($key == 'logind') $filename.='-logind'.$value; // Affected to - if ($key == 'logint') $filename.='-logint'.$value; // Done by + if ($key == 'logint') $filename.='-logint'.$value; // Assigned to } // Add extension if ($format == 'vcal') { $shortfilename.='.vcs'; $filename.='.vcs'; } diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 8a6bcd62e58..dba28538780 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -61,22 +61,22 @@ if (empty($reshook)) { $demoprofiles=array( array('default'=>'1', 'key'=>'profdemoservonly','label'=>'DemoCompanyServiceOnly', - 'disablemodules'=>'adherent,barcode,boutique,cashdesk,categorie,don,expedition,externalsite,mailmanspip,margin,prelevement,product,stock', + 'disablemodules'=>'adherent,barcode,cashdesk,categorie,don,expedition,externalsite,mailmanspip,margin,prelevement,product,stock', 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot8.png'), array('default'=>'-1','key'=>'profdemoshopwithdesk','label'=>'DemoCompanyShopWithCashDesk', - 'disablemodules'=>'adherent,boutique,categorie,don,externalsite,ficheinter,mailmanspip,prelevement,product,stock', + 'disablemodules'=>'adherent,categorie,don,externalsite,ficheinter,mailmanspip,prelevement,product,stock', 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png'), array('default'=>'0', 'key'=>'profdemoprodstock','label'=>'DemoCompanyProductAndStocks', - 'disablemodules'=>'adherent,boutique,contrat,categorie,don,externalsite,ficheinter,mailmanspip,prelevement,service', + 'disablemodules'=>'adherent,contrat,categorie,don,externalsite,ficheinter,mailmanspip,prelevement,service', 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png'), array('default'=>'0', 'key'=>'profdemoall','label'=>'DemoCompanyAll', - 'disablemodules'=>'adherent,boutique,don,externalsite,mailmanspip', + 'disablemodules'=>'adherent,don,externalsite,mailmanspip', 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot9.png'), array('default'=>'-1', 'key'=>'profdemofun','label'=>'DemoFundation', - 'disablemodules'=>'banque,barcode,boutique,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,facture,ficheinter,fournisseur,mailmanspip,margin,prelevement,product,projet,propal,propale,service,societe,stock,tax', + 'disablemodules'=>'banque,barcode,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,facture,ficheinter,fournisseur,mailmanspip,margin,prelevement,product,projet,propal,propale,service,societe,stock,tax', 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png'), array('default'=>'0', 'key'=>'profdemofun2','label'=>'DemoFundation2', - 'disablemodules'=>'barcode,boutique,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,facture,ficheinter,fournisseur,mailmanspip,margin,prelevement,product,projet,propal,propale,service,societe,stock,tax', + 'disablemodules'=>'barcode,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,facture,ficheinter,fournisseur,mailmanspip,margin,prelevement,product,projet,propal,propale,service,societe,stock,tax', 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png') ); @@ -88,7 +88,7 @@ if (empty($reshook)) 'mailmanspip','notification','syslog','user','webservices', // Extended modules 'memcached','numberwords','zipautofillfr'); - $alwayshiddenuncheckedmodules=array('boutique','ftp', + $alwayshiddenuncheckedmodules=array('ftp', // Extended modules 'awstats','bittorrent','bootstrap','cabinetmed','cmcic','concatpdf','customfield','dolicloud','filemanager','lightbox','mantis','monitoring','moretemplates','multicompany','nltechno','numberingpack','openstreetmap', 'ovh','phenix','phpsysinfo','pibarcode','postnuke','selectbank','skincoloreditor','submiteverywhere','survey','thomsonphonebook','topten','tvacerfa','voyage','webcalendar','webmail'); @@ -259,9 +259,7 @@ color: #444444 !important; margin: 8px 0px 8px 2px; -border-left: 1px solid #DDD; -border-right: 1px solid #DDD; -border-bottom: 1px solid #EEE; +border: 1px solid #bbb; border-radius: 8px; -moz-border-radius: 8px; @@ -269,11 +267,7 @@ border-radius: 8px; -webkit-box-shadow: 4px 4px 4px #EEE; box-shadow: 4px 4px 4px #EEE; -background-image: linear-gradient(bottom, rgb(246,248,250) 15%, rgb(235,235,238) 100%); -background-image: -o-linear-gradient(bottom, rgb(246,248,250) 15%, rgb(235,235,238) 100%); -background-image: -moz-linear-gradient(bottom, rgb(246,248,250) 15%, rgb(235,235,238) 100%); -background-image: -webkit-linear-gradient(bottom, rgb(246,248,250) 15%, rgb(235,235,238) 100%); -background-image: -ms-linear-gradient(bottom, rgb(246,248,250) 15%, rgb(235,235,238) 100%); +background: -webkit-linear-gradient(bottom, rgb(255,255,255) 85%, rgb(255,255,255) 100%); } @@ -311,7 +305,7 @@ print "\n"; print ''; print '
    '; -print '
    Dolibarr logo

    '; +print '
    Dolibarr logo

    '; print '
    '; print $langs->trans("DemoDesc").'
    '; diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index c8628bd26a0..bb218e4c0cf 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -110,9 +110,9 @@ function llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayo { $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png'; } - print '
    '; + print '
    '; print 'Logo'; - print '

    '; + print '
    '; print '
    '; } @@ -343,9 +343,9 @@ if ($action == 'added') // Si on a pas ete redirige print '
    '; - print '
    '; + print '
    '; print $langs->trans("NewMemberbyWeb"); - print '
    '; + print '
    '; llxFooterVierge(); exit; @@ -591,13 +591,13 @@ if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT) print "
    \n"; // Save -print '
    '; +print '
    '; print ''; if (! empty($backtopage)) { print '     '; } -print '
    '; +print ''; print "
    \n"; print ''; diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index d88e87c2d12..e672a6d59d3 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -126,10 +126,10 @@ if ($result) print '
    '.$langs->trans("Firstname").''; print ' '.$langs->trans("Lastname").''; print ' / '.$langs->trans("Company").'".$langs->trans("Photo")."
    '.dolGetFirstLastname($obj->firstname, $obj->lastname).($objp->societe?' / '.$objp->societe:'').'$objp->birth'.$objp->email.''.$objp->zip.''.$objp->town.'
    '."\n"; print ''."\n"; -print '
    '."\n"; +print '
    '."\n"; print '
    '; diff --git a/htdocs/public/paypal/newpayment.php b/htdocs/public/paypal/newpayment.php index afe685fb6ac..8c66f6157ba 100644 --- a/htdocs/public/paypal/newpayment.php +++ b/htdocs/public/paypal/newpayment.php @@ -268,7 +268,7 @@ if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcredi else if (! empty($conf->global->PAYPAL_CREDITOR)) $creditor=$conf->global->PAYPAL_CREDITOR; print ''."\n"; -print '
    '."\n"; +print '
    '."\n"; print '
    '."\n"; print ''."\n"; print ''."\n"; @@ -870,7 +870,12 @@ if (GETPOST("source") == 'membersubscription' && $valid) // Amount $var=!$var; print ''.$langs->trans("Amount"); - if (empty($amount)) print ' ('.$langs->trans("ToComplete").')'; + if (empty($amount)) + { + print ' ('.$langs->trans("ToComplete"); + if (! empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) print ' - '.$langs->trans("SeeHere").''; + print ')'; + } print ''; if (empty($amount) || ! is_numeric($amount)) { @@ -959,7 +964,7 @@ print ''."\n"; print ''."\n"; print '
    '."\n"; -print '
    '."\n"; +print '
    '."\n"; print '
    '; diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index b447be4574b..5ff161f0b1a 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -5,11 +5,13 @@ define("NOCSRFCHECK",1); // We accept to go on this page from external web site. require '../../main.inc.php'; -if (!empty($conf->global->MAIN_FEATURES_LEVEL)) +if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1') { - print "Page available onto dev environment only"; + print "Page available only frome remote address 127.0.0.1"; exit; } + + $usedolheader=0; // 1 = Test inside a dolibarr page, 0 = Use hard coded header @@ -30,16 +32,21 @@ if (empty($usedolheader)) + - + +" /> - + +-- + - + +
    - -
    -This page is a sample of page using tables. To make test with
    -- css (edit page to change)
    -- jmobile (edit page to enable/disable)
    +

    +This page is a sample of page using tables. It is designed to make test with
    +- css (edit page to change to test another css)
    +- jmobile (add parameter dol_use_jmobile=1 to enable view with jmobile)
    - dataTables
    - tablednd
    - +




    Example 0a : Table with div+div+div containg a select that should be overflowed and truncated => Use this to align text or form
    -
    +
    -
    +
    @@ -84,7 +90,7 @@ This page is a sample of page using tables. To make test with
    -
    +
    @@ -97,7 +103,7 @@ This page is a sample of page using tables. To make test with
    - + @@ -111,9 +117,8 @@ This page is a sample of page using tables. To make test with
    use_javascript_ajax) && $object->statut == 0) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; + if (! empty($conf->use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; ?> -
    line3
    @@ -302,7 +307,7 @@ $('xxxth').replaceWith( - +



    Example 3 : Standard table => Use this if you need the drag and drop for lines
    @@ -310,11 +315,10 @@ $('xxxth').replaceWith( use_javascript_ajax) && $object->statut == 0) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; + if (! empty($conf->use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; ?> - - +
    title1title2
    title1title2
    a1b1
    a2b2
    diff --git a/htdocs/public/test/test_forms.php b/htdocs/public/test/test_forms.php index 126c9723fa7..ece0c218160 100644 --- a/htdocs/public/test/test_forms.php +++ b/htdocs/public/test/test_forms.php @@ -1,48 +1,31 @@ global->MAIN_FEATURES_LEVEL)) +if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1') { - print "Page available onto dev environment only"; + print "Page available only frome remote address 127.0.0.1"; exit; } + + +llxHeader(); + ?> - - - - - - - -Test page - - - - - - - - - - - - - - - - -
    -
    -This page is a sample of page using html methods.
    +

    +This page is a sample of page using Dolibarr HTML widget methods. It is designed to make test with
    +- css (edit page to change to test another css)
    +- jmobile (add parameter dol_use_jmobile=1 to enable view with jmobile)
    +


    -select_date using tzuser date @@ -64,8 +47,41 @@ print '

    '."\n"; print "Test 3: We must have here 1970-01-01 00:00:00 selected (fields are mandatory)
    \n"; $form->select_date(dol_get_first_day(1970,1,false), 'test3', 1, 1, 0); -?> +print '

    '."\n"; -
    - - \ No newline at end of file +// Test4a: form->select_product +print "Test 4: Select product - "; +$form->select_produits(0,'producttest'); + +print '

    '."\n"; + +// Test4b: form->selectarray +print "Test 4: Select array - "; +$array=array(1=>'Value 1',2=>'Value 2',3=>'Value 3'); +$arrayselected=array(1,3); +print $form->selectarray('selectarray',$array); + +print '

    '."\n"; + +// Test5: a multiselect +print "Test 5: a multiselect
    \n"; +$array=array(1=>'Value 1',2=>'Value 2',3=>'Value 3'); +$arrayselected=array(1,3); +print $form->multiselectarray('testmulti', $array, $arrayselected, '', 0, '', 0, 250); + +print '

    '."\n"; + +// Test6: a select +print "Test 6a: a select
    \n"; +$array=array(1=>'Value 1',2=>'Value 2',3=>'Value 3 ith a very long text. aze eazeae e ae aeae a e a ea ea ea e a e aea e ae aeaeaeaze.'); +$selected=3; +print $form->selectarray('testselecta', $array, $selected, 1, 0, 0, 'style="min-width: 250px;"', 0, 0, 0, '', '', 1); +print '

    '; +print "Test 6b: a select
    \n"; +$array=array(1=>'Value 1',2=>'Value 2',3=>'Value 3'); +$selected=3; +print $form->selectarray('testselectb', $array, $selected, 1, 0, 0, 'style="min-width: 250px;"', 0, 0, 0, '', '', 1); + + +llxFooter(); +$db->close(); diff --git a/htdocs/resource/add.php b/htdocs/resource/add.php old mode 100755 new mode 100644 index fde152b6185..679644ac9e0 --- a/htdocs/resource/add.php +++ b/htdocs/resource/add.php @@ -32,7 +32,7 @@ if (! $res) die("Include of main fails"); require_once 'class/resource.class.php'; require_once 'class/html.formresource.class.php'; -// Load traductions files requiredby by page +// Load traductions files required by page $langs->load("resource"); $langs->load("companies"); $langs->load("other"); @@ -41,6 +41,7 @@ $langs->load("resource@resource"); // Get parameters $id = GETPOST('id','int'); $action = GETPOST('action','alpha'); +$cancel = GETPOST('cancel','alpha'); if (empty($sortorder)) $sortorder="DESC"; if (empty($sortfield)) $sortfield="t.rowid"; if (empty($arch)) $arch = 0; @@ -65,57 +66,64 @@ $object = new Resource($db); if ($action == 'confirm_add_resource') { - $error=''; - - $ref=GETPOST('ref','alpha'); - $description=GETPOST('description','alpha'); - $fk_code_type_resource=GETPOST('fk_code_type_resource','alpha'); - - if (empty($ref)) + if (! $cancel) { - $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")); - setEventMessage($mesg, 'errors'); - $error++; - } - - if (! $error) - { - $object=new Resource($db); - $object->ref=$ref; - $object->description=$description; - $object->fk_code_type_resource=$fk_code_type_resource; + $error=''; - $result=$object->create($user); - if ($result > 0) + $ref=GETPOST('ref','alpha'); + $description=GETPOST('description','alpha'); + $fk_code_type_resource=GETPOST('fk_code_type_resource','alpha'); + + if (empty($ref)) { - // Creation OK - $db->commit(); - setEventMessage($langs->trans('ResourceCreatedWithSuccess')); - Header("Location: card.php?id=" . $object->id); - return; + $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")); + setEventMessage($mesg, 'errors'); + $error++; + } + + if (! $error) + { + $object=new Resource($db); + $object->ref=$ref; + $object->description=$description; + $object->fk_code_type_resource=$fk_code_type_resource; + + $result=$object->create($user); + if ($result > 0) + { + // Creation OK + $db->commit(); + setEventMessage($langs->trans('ResourceCreatedWithSuccess')); + Header("Location: card.php?id=" . $object->id); + return; + } + else + { + // Creation KO + setEventMessage($object->error, 'errors'); + $action = ''; + } } else { - // Creation KO - setEventMessage($object->error, 'errors'); $action = ''; } } else { - $action = ''; + Header("Location: list.php"); } } -/*************************************************** -* VIEW -* -****************************************************/ +/* + * View + * + */ $form=new Form($db); $formresource = new FormResource($db); -if ( !$action ) +if (! $action) { $pagetitle=$langs->trans('AddResource'); llxHeader('',$pagetitle,''); @@ -161,8 +169,10 @@ if ( !$action ) print ''; - echo '
    ', - ' ', + echo '
    ', + '', + ' ', + '', '
    '; print ''; diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php old mode 100755 new mode 100644 index 38562557e3a..33a27796aaf --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -57,9 +57,10 @@ if( ! $user->rights->resource->read) $object = new Resource($db); -$hookmanager->initHooks(array('resource_card')); +$hookmanager->initHooks(array('resource_card','globalcard')); $parameters=array('resource_id'=>$id); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); /******************************************************************* @@ -86,7 +87,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->resource->write $object->ref = $ref; $object->description = $description; $object->fk_code_type_resource = $fk_code_type_resource; - + $result=$object->update($user); if ($result > 0) { @@ -98,9 +99,9 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->resource->write setEventMessage('
    '.$object->error.'
    '); $action='edit'; } - + } - else + else { setEventMessage($object->error,'errors'); $action='edit'; @@ -138,7 +139,7 @@ if ( $object->fetch($id) > 0 ) /*--------------------------------------- * Edit object - */ + */ print '
    '; print ''; print ''; @@ -149,13 +150,13 @@ if ( $object->fetch($id) > 0 ) // Ref print ''.$langs->trans("ResourceFormLabel_ref").''; print ''; - + // Type print ''.$langs->trans("ResourceType").''; print ''; - $ret = $formresource->select_types_resource($object->fk_code_type_resource,'fk_code_type_resource','',2); + $ret = $formresource->select_types_resource($object->fk_code_type_resource,'fk_code_type_resource','',2); print ''; - + // Description print ''.$langs->trans("Description").''; print ''; @@ -170,7 +171,7 @@ if ( $object->fetch($id) > 0 ) } else { - // Confirmation suppression resource line + // Confirm deleting resource line if ($action == 'delete') { print $form->formconfirm("card.php?&id=".$id,$langs->trans("DeleteResource"),$langs->trans("ConfirmDeleteResource"),"confirm_delete_resource",'','',1); @@ -194,7 +195,7 @@ if ( $object->fetch($id) > 0 ) print $object->type_label; print ''; print ''; - + // Description print ''; print '' . $langs->trans("ResourceFormLabel_description") . ''; @@ -215,8 +216,8 @@ if ( $object->fetch($id) > 0 ) $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been // modified by hook - if (empty($reshook)) - { + if (empty($reshook)) + { if ($action != "edit" ) { // Edit resource @@ -227,9 +228,9 @@ if ( $object->fetch($id) > 0 ) print '
    '; } } - if ($action != "delete" ) + if ($action != "delete" && $action != "edit") { - // Edit resource + // Delete resource if($user->rights->resource->delete) { print '
    '; diff --git a/htdocs/resource/class/actions_resource.class.php b/htdocs/resource/class/actions_resource.class.php index afcf9eb19b8..f8f0b5412f9 100644 --- a/htdocs/resource/class/actions_resource.class.php +++ b/htdocs/resource/class/actions_resource.class.php @@ -46,8 +46,8 @@ class ActionsResource * doActions for resource module * * @param array $parameters parameters - * @param Object &$object object - * @param string &$action action + * @param Object $object object + * @param string $action action * @return void */ /* Why a hook action ? TODO Remove this class and replace a method into commonobject diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php index 241d440cc0f..ca01963e30b 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -1,19 +1,20 @@ -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ + * + * 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 . + * or see http://www.gnu.org/ + */ /** * \file place/class/html.place.class.php diff --git a/htdocs/resource/class/resource.class.php b/htdocs/resource/class/resource.class.php index e947b4e7ed9..deea00f9c99 100644 --- a/htdocs/resource/class/resource.class.php +++ b/htdocs/resource/class/resource.class.php @@ -23,8 +23,8 @@ */ // Put here all includes required by your class file -require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); - +require_once DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"; +require_once DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php"; /** * DAO Resource object @@ -205,7 +205,7 @@ class Resource extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; $error=0; @@ -329,7 +329,7 @@ class Resource extends CommonObject function delete($rowid, $notrigger=0) { global $user,$langs,$conf; - + $error=0; if (! $notrigger) @@ -339,10 +339,10 @@ class Resource extends CommonObject if ($result < 0) return -1; // End call triggers } - + $sql = "DELETE FROM ".MAIN_DB_PREFIX."resource"; $sql.= " WHERE rowid =".$rowid; - + dol_syslog(get_class($this)."::delete", LOG_DEBUG); if ($this->db->query($sql)) { @@ -364,7 +364,7 @@ class Resource extends CommonObject return -1; } } - + /** * Load resource objects into $this->lines * @@ -388,7 +388,7 @@ class Resource extends CommonObject $sql.= " ty.label as type_label"; $sql.= " FROM ".MAIN_DB_PREFIX."resource as t"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_resource as ty ON ty.code=t.fk_code_type_resource"; - //$sql.= " WHERE t.entity IN (".getEntity('resource').")"; + $sql.= " WHERE t.entity IN (".getEntity('resource',1).")"; //Manage filter if (!empty($filter)){ @@ -402,7 +402,7 @@ class Resource extends CommonObject } } $sql.= " GROUP BY t.rowid"; - $sql.= " ORDER BY $sortfield $sortorder "; + $sql.= $this->db->order($sortfield,$sortorder); if ($limit) $sql.= $this->db->plimit($limit+1,$offset); dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); @@ -462,7 +462,7 @@ class Resource extends CommonObject $sql.= " t.fk_user_create,"; $sql.= " t.tms"; $sql.= ' FROM '.MAIN_DB_PREFIX .'element_resources as t '; - //$sql.= " WHERE t.entity IN (".getEntity('resource').")"; + $sql.= " WHERE t.entity IN (".getEntity('resource',1).")"; //Manage filter if (!empty($filter)){ @@ -476,7 +476,8 @@ class Resource extends CommonObject } } $sql.= " GROUP BY t.rowid"; - $sql.= " ORDER BY $sortfield $sortorder " . $this->db->plimit($limit+1,$offset); + $sql.= $this->db->order($sortfield,$sortorder); + if ($limit) $sql.= $this->db->plimit($limit+1,$offset); dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); $resql=$this->db->query($sql); @@ -500,9 +501,9 @@ class Resource extends CommonObject $line->fk_user_create = $obj->fk_user_create; if($obj->resource_id && $obj->resource_type) - $line->objresource = $this->fetchObjectByElement($obj->resource_id,$obj->resource_type); + $line->objresource = fetchObjectByElement($obj->resource_id,$obj->resource_type); if($obj->element_id && $obj->element_type) - $line->objelement = $this->fetchObjectByElement($obj->element_id,$obj->element_type); + $line->objelement = fetchObjectByElement($obj->element_id,$obj->element_type); $this->lines[$i] = $line; $i++; @@ -547,7 +548,7 @@ class Resource extends CommonObject $sql.= " t.fk_user_create,"; $sql.= " t.tms"; $sql.= ' FROM '.MAIN_DB_PREFIX .'element_resources as t '; - //$sql.= " WHERE t.entity IN (".getEntity('resource').")"; + $sql.= " WHERE t.entity IN (".getEntity('resource',1).")"; //Manage filter if (!empty($filter)){ @@ -561,7 +562,8 @@ class Resource extends CommonObject } } $sql.= " GROUP BY t.resource_id"; - $sql.= " ORDER BY " . $sortfield . " " . $sortorder . " " . $this->db->plimit($limit+1,$offset); + $sql.= $this->db->order($sortfield,$sortorder); + if ($limit) $sql.= $this->db->plimit($limit+1,$offset); dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); $resql=$this->db->query($sql); @@ -584,7 +586,7 @@ class Resource extends CommonObject $line->mandatory = $obj->mandatory; $line->fk_user_create = $obj->fk_user_create; - $this->lines[$i] = $this->fetchObjectByElement($obj->resource_id,$obj->resource_type); + $this->lines[$i] = fetchObjectByElement($obj->resource_id,$obj->resource_type); $i++; } @@ -633,7 +635,7 @@ class Resource extends CommonObject if (! $this->table_element) { - dol_print_error('',get_class($this)."::load_previous_next_ref was called on objet with property table_element not defined", LOG_ERR); + dol_print_error('',get_class($this)."::load_previous_next_ref was called on objet with property table_element not defined"); return -1; } @@ -695,7 +697,7 @@ class Resource extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update_element_resource($user=0, $notrigger=0) + function update_element_resource($user=null, $notrigger=0) { global $conf, $langs; $error=0; @@ -732,7 +734,7 @@ class Resource extends CommonObject { // Call trigger $result=$this->call_trigger('RESOURCE_MODIFY',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers } } @@ -796,16 +798,20 @@ class Resource extends CommonObject return $resources; } + /* + * Return an int number of resources linked to the element + * + * @return int + */ function fetchElementResources($element,$element_id) { - $resources = $this->getElementResources($element,$element_id); - $i=0; - foreach($resources as $nb => $resource) - { - $this->lines[$i] = $this->fetchObjectByElement($resource['resource_id'],$resource['resource_type']); - $i++; - } - return $i; + $resources = $this->getElementResources($element,$element_id); + $i=0; + foreach($resources as $nb => $resource) { + $this->lines[$i] = fetchObjectByElement($resource['resource_id'],$resource['resource_type']); + $i++; + } + return $i; } @@ -876,7 +882,7 @@ class Resource extends CommonObject $label=$langs->trans("ShowResource").': '.$this->ref; - if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); + if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; $result.=$lien.$this->ref.$lienfin; return $result; diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index c5329edd1f3..d50c9a4ec6f 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -1,6 +1,5 @@ +/* Copyright (C) 2013 Jean-François Ferry * * 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 @@ -32,7 +31,7 @@ require 'class/resource.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // Load traductions files requiredby by page -$langs->load("resource@resource"); +$langs->load("resource"); $langs->load("other"); // Get parameters @@ -70,8 +69,9 @@ $resource_id = GETPOST('fk_resource','int'); $resource_type = GETPOST('resource_type','alpha'); $busy = GETPOST('busy','int'); $mandatory = GETPOST('mandatory','int'); +$cancel = GETPOST('cancel','alpha'); -if($action == 'add_element_resource' && !GETPOST('cancel')) +if($action == 'add_element_resource' && ! $cancel) { $objstat = fetchObjectByElement($element_id,$element); $res = $objstat->add_element_resource($resource_id,$resource_type,$busy,$mandatory); @@ -138,11 +138,12 @@ if ($action == 'confirm_delete_linked_resource' && $user->rights->resource->dele $parameters=array('resource_id'=>resource_id); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks - +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); $parameters=array('resource_id'=>$resource_id); $reshook=$hookmanager->executeHooks('getElementResources',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); /*************************************************** @@ -250,9 +251,6 @@ else foreach ($object->available_resources as $modresources => $resources) { - $langs->load($resources); - //print '

    '.$modresources.'

    '; - $resources=(array) $resources; // To be sure $resources is an array foreach($resources as $resource_obj) { @@ -300,7 +298,7 @@ else { print '
    '; print '
    '; - print 'Add resource'; + print ''.$langs->trans('AddResource').''; print '
    '; print '
    '; } diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 3fde7b52999..ab70bc9a338 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -1,6 +1,5 @@ +/* Copyright (C) 2013-2014 Jean-François Ferry * * 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 @@ -53,9 +52,6 @@ $object = new Resource($db); $hookmanager->initHooks(array('resource_list')); -$parameters=array(); -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks - if (empty($sortorder)) $sortorder="DESC"; if (empty($sortfield)) $sortfield="t.rowid"; if (empty($arch)) $arch = 0; @@ -72,12 +68,20 @@ $pagenext = $page + 1; if( ! $user->rights->resource->read) accessforbidden(); -/*************************************************** - * VIEW -* -* Put here all code to build page -****************************************************/ +/* + * Action + */ + +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + + + +/* + * View + */ $pagetitle=$langs->trans('ResourcePageIndex'); llxHeader('',$pagetitle,''); @@ -111,7 +115,7 @@ else print_liste_field_titre($langs->trans('Id'),$_SERVER['PHP_SELF'],'t.rowid','',$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'t.ref','',$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('ResourceType'),$_SERVER['PHP_SELF'],'ty.code','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Edit')); + print_liste_field_titre($langs->trans('Action'),"","","","",'width="60" align="center"',"",""); print ''; foreach ($object->lines as $resource) @@ -123,20 +127,25 @@ else $style='style="background: orange;"'; print ''; - print $resource->id; + print ''.$resource->id.''; print ''; print ''; print $resource->ref; print ''; - + print ''; print $resource->type_label; print ''; - print ''; - print ''.$langs->trans('View').' '; - print ''.$langs->trans('Edit').''; + print ''; + print ''; + print img_edit(); + print ''; + print ' '; + print ''; + print img_delete(); + print ''; print ''; print ''; diff --git a/htdocs/societe/admin/contact_extrafields.php b/htdocs/societe/admin/contact_extrafields.php index 9bb756ac7ee..a0b72c80aea 100644 --- a/htdocs/societe/admin/contact_extrafields.php +++ b/htdocs/societe/admin/contact_extrafields.php @@ -68,7 +68,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("CompanySetup"),$linkback,'setup'); -$head = societe_admin_prepare_head(null); +$head = societe_admin_prepare_head(); dol_fiche_head($head, 'attributes_contacts', $langs->trans("ThirdParties"), 0, 'company'); diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index b1680d2803e..84a593d759a 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -84,7 +84,7 @@ if ($action == 'updateoptions') setEventMessage($langs->trans("Error"), 'errors'); } } - + if (GETPOST('CONTACT_USE_SEARCH_TO_SELECT')) { $contactsearch = GETPOST('activate_CONTACT_USE_SEARCH_TO_SELECT','alpha'); @@ -344,7 +344,7 @@ foreach ($dirsociete as $dirroot) $var = !$var; print ''."\n"; - print ''.$modCodeTiers->nom.''."\n"; + print ''.$modCodeTiers->name.''."\n"; print ''.$modCodeTiers->info($langs).''."\n"; print ''.$modCodeTiers->getExample($langs).''."\n"; @@ -420,7 +420,7 @@ foreach ($dirsociete as $dirroot) $var = !$var; print ''; - print ''.$modCodeCompta->nom."\n"; + print ''.$modCodeCompta->name."\n"; print $modCodeCompta->info($langs); print ''; print ''.$modCodeCompta->getExample($langs)."\n"; @@ -569,7 +569,7 @@ foreach ($dirsociete as $dirroot) } $htmltooltip.='

    '.$langs->trans("FeaturesSupported").':'; $htmltooltip.='
    '.$langs->trans("WatermarkOnDraft").': '.yn((! empty($module->option_draft_watermark)?$module->option_draft_watermark:''), 1, 1); - + print ''; print $form->textwithpicto('',$htmltooltip,1,0); print ''; @@ -632,19 +632,19 @@ while ($i < $nbofloop) if ($profid[$i][1]!='-') { $var = !$var; - + print ''; print ''.$profid[$i][0]."\n"; print $profid[$i][1]; print ''; - + $idprof_unique ='SOCIETE_IDPROF'.($i+1).'_UNIQUE'; $idprof_mandatory ='SOCIETE_IDPROF'.($i+1).'_MANDATORY'; $idprof_invoice_mandatory ='SOCIETE_IDPROF'.($i+1).'_INVOICE_MANDATORY'; $verif=(empty($conf->global->$idprof_unique)?false:true); $mandatory=(empty($conf->global->$idprof_mandatory)?false:true); $invoice_mandatory=(empty($conf->global->$idprof_invoice_mandatory)?false:true); - + if ($verif) { print '
    '; @@ -657,7 +657,7 @@ while ($i < $nbofloop) print img_picto($langs->trans("Disabled"),'switch_off'); print ''; } - + if ($mandatory) { print ''; @@ -670,7 +670,7 @@ while ($i < $nbofloop) print img_picto($langs->trans("Disabled"),'switch_off'); print ''; } - + if ($invoice_mandatory) { print ''; @@ -683,7 +683,7 @@ while ($i < $nbofloop) print img_picto($langs->trans("Disabled"),'switch_off'); print ''; } - + print "\n"; } $i++; @@ -711,7 +711,7 @@ print ' '."\n"; // Utilisation formulaire Ajax sur choix societe $var=!$var; print ""; -print ''.$form->textwithpicto($langs->trans("UseSearchToSelectCompany"),$langs->trans('UseSearchToSelectCompanyTooltip'),1).' '; +print ''.$form->textwithpicto($langs->trans("DelaiedFullListToSelectCompany"),$langs->trans('UseSearchToSelectCompanyTooltip'),1).' '; if (! $conf->use_javascript_ajax) { print ''; @@ -726,7 +726,7 @@ else '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",2).')', '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",3).')', ); - print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT",$arrval,$conf->global->COMPANY_USE_SEARCH_TO_SELECT); + print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT", $arrval, $conf->global->COMPANY_USE_SEARCH_TO_SELECT); print ''; print ''; print ""; @@ -735,7 +735,7 @@ print ''; $var=!$var; print ""; -print ''.$form->textwithpicto($langs->trans("UseSearchToSelectContact"),$langs->trans('UseSearchToSelectContactTooltip'),1).''; +print ''.$form->textwithpicto($langs->trans("DelaiedFullListToSelectContact"),$langs->trans('UseSearchToSelectContactTooltip'),1).''; if (! $conf->use_javascript_ajax) { print ''; @@ -750,7 +750,7 @@ else '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",2).')', '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",3).')', ); - print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT",$arrval,$conf->global->CONTACT_USE_SEARCH_TO_SELECT); + print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT", $arrval, $conf->global->CONTACT_USE_SEARCH_TO_SELECT); print ''; print ''; print ""; diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 1ad1eeceed5..a6ba3d7b1cf 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -47,8 +47,7 @@ $hookmanager->initHooks(array('agendathirdparty')); $parameters=array('id'=>$socid); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks -$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors); - +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -60,9 +59,6 @@ $contactstatic = new Contact($db); $form = new Form($db); -/* - * Fiche categorie de client et/ou fournisseur - */ if ($socid) { require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -71,79 +67,79 @@ if ($socid) $langs->load("companies"); - $soc = new Societe($db); - $result = $soc->fetch($socid); + $object = new Societe($db); + $result = $object->fetch($socid); llxHeader("",$langs->trans("Agenda"),''); if (! empty($conf->notification->enabled)) $langs->load("mails"); - $head = societe_prepare_head($soc); + $head = societe_prepare_head($object); dol_fiche_head($head, 'agenda', $langs->trans("ThirdParty"),0,'company'); print ''; print ''; if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { - print ''; + print ''; } - if ($soc->client) + if ($object->client) { print ''; } - if ($soc->fournisseur) + if ($object->fournisseur) { print ''; } if (! empty($conf->barcode->enabled)) { - print ''; + print ''; } print ""; // Zip / Town - print '"; - print '"; + print '"; + print '"; // Country - if ($soc->country) { + if ($object->country) { print ''; } // EMail print ''; // Web print ''; // Phone / Fax - print ''; - print ''; + print ''; + print ''; print '
    '.$langs->trans("ThirdPartyName").''; - print $form->showrefnav($soc,'socid','',($user->societe_id?0:1),'rowid','nom'); + print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom'); print '
    '.$langs->trans('Prefix').''.$soc->prefix_comm.'
    '.$langs->trans('Prefix').''.$object->prefix_comm.'
    '; print $langs->trans('CustomerCode').''; - print $soc->code_client; - if ($soc->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + print $object->code_client; + if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; print '
    '; print $langs->trans('SupplierCode').''; - print $soc->code_fournisseur; - if ($soc->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + print $object->code_fournisseur; + if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; print '
    '.$langs->trans('Gencod').''.$soc->barcode.'
    '.$langs->trans('Gencod').''.$object->barcode.'
    ".$langs->trans('Address').""; - dol_print_address($soc->address, 'gmap', 'thirdparty', $soc->id); + dol_print_address($object->address, 'gmap', 'thirdparty', $object->id); print "
    '.$langs->trans('Zip').''.$soc->zip."'.$langs->trans('Town').''.$soc->town."
    '.$langs->trans('Zip').''.$object->zip."'.$langs->trans('Town').''.$object->town."
    '.$langs->trans('Country').''; - $img=picto_from_langcode($soc->country_code); + $img=picto_from_langcode($object->country_code); print ($img?$img.' ':''); - print $soc->country; + print $object->country; print '
    '.$langs->trans('EMail').''; - print dol_print_email($soc->email,0,$soc->id,'AC_EMAIL'); + print dol_print_email($object->email,0,$object->id,'AC_EMAIL'); print '
    '.$langs->trans('Web').''; - print dol_print_url($soc->url); + print dol_print_url($object->url); print '
    '.$langs->trans('Phone').''.dol_print_phone($soc->phone,$soc->country_code,0,$soc->id,'AC_TEL').''.$langs->trans('Fax').''.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').'
    '.$langs->trans('Phone').''.dol_print_phone($object->phone,$object->country_code,0,$object->id,'AC_TEL').''.$langs->trans('Fax').''.dol_print_phone($object->fax,$object->country_code,0,$object->id,'AC_FAX').'
    '; @@ -160,7 +156,7 @@ if ($socid) { if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create)) { - print ''.$langs->trans("AddAction").''; + print ''.$langs->trans("AddAction").''; } else { @@ -172,13 +168,28 @@ if ($socid) print '
    '; - print load_fiche_titre($langs->trans("ActionsOnCompany"),'',''); + $objthirdparty=$object; + $objcon=new stdClass(); + + $out=''; + $permok=$user->rights->agenda->myactions->create; + if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok) + { + $out.=''; + $out.=$langs->trans("AddAnAction").' '; + $out.=img_picto($langs->trans("AddAnAction"),'filenew'); + $out.=""; + } + + print load_fiche_titre($langs->trans("ActionsOnCompany"),$out,''); // List of todo actions - show_actions_todo($conf,$langs,$db,$soc); + show_actions_todo($conf,$langs,$db,$object); // List of done actions - show_actions_done($conf,$langs,$db,$soc); + show_actions_done($conf,$langs,$db,$object); } diff --git a/htdocs/societe/ajaxcompanies.php b/htdocs/societe/ajaxcompanies.php index 8771c0219c7..b3565a2ca26 100644 --- a/htdocs/societe/ajaxcompanies.php +++ b/htdocs/societe/ajaxcompanies.php @@ -81,7 +81,7 @@ if (GETPOST('newcompany') || GETPOST('socid','int') || GETPOST('id_fourn')) if (! empty($conf->global->SOCIETE_ALLOW_SEARCH_ON_ROWID)) $sql.=" OR rowid = '" . $db->escape($socid) . "'"; $sql.=")"; } - if (! empty($_GET["filter"])) $sql.= " AND ".$_GET["filter"]; // Add other filters + if (GETPOST("filter")) $sql.= " AND ".GETPOST("filter","alpha"); // Add other filters $sql.= " ORDER BY nom ASC"; //dol_syslog("ajaxcompanies", LOG_DEBUG); diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index 27630fa4dfe..b94262bbb52 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -89,7 +89,7 @@ abstract class ActionsCardCommon /** * Load data control * - * @param int &$action Action code + * @param int $action Action code * @return void */ function doActions(&$action) @@ -242,14 +242,14 @@ abstract class ActionsCardCommon if ( $this->object->client == 1 ) { - header("Location: ".DOL_URL_ROOT."/comm/fiche.php?socid=".$this->object->id); + header("Location: ".DOL_URL_ROOT."/comm/card.php?socid=".$this->object->id); return; } else { if ( $this->object->fournisseur == 1 ) { - header("Location: ".DOL_URL_ROOT."/fourn/fiche.php?socid=".$this->object->id); + header("Location: ".DOL_URL_ROOT."/fourn/card.php?socid=".$this->object->id); return; } else @@ -305,7 +305,7 @@ abstract class ActionsCardCommon if ($result >= 0) { - header("Location: ".DOL_URL_ROOT."/societe/societe.php?delsoc=".$this->object->nom.""); + header("Location: ".DOL_URL_ROOT."/societe/societe.php?delsoc=".$this->object->name.""); exit; } else @@ -354,7 +354,7 @@ abstract class ActionsCardCommon /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * - * @param string &$action Type of action + * @param string $action Type of action * @param string $id Id of object * @param string $ref Ref of object * @return void diff --git a/htdocs/societe/canvas/company/actions_card_company.class.php b/htdocs/societe/canvas/company/actions_card_company.class.php index a47b6321792..d54af2b8bba 100644 --- a/htdocs/societe/canvas/company/actions_card_company.class.php +++ b/htdocs/societe/canvas/company/actions_card_company.class.php @@ -75,7 +75,7 @@ class ActionsCardCompany extends ActionsCardCommon /** * Execute actions * - * @param string &$action Type of action + * @param string $action Type of action * @param int $id Id of object * @return int <0 if KO, >0 if OK */ @@ -91,7 +91,7 @@ class ActionsCardCompany extends ActionsCardCommon /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * - * @param string &$action Type of action + * @param string $action Type of action * @param string $id Id of object * @param string $ref Ref of object * @return void diff --git a/htdocs/societe/canvas/individual/actions_card_individual.class.php b/htdocs/societe/canvas/individual/actions_card_individual.class.php index b8cb94a820b..2f00cd4bc27 100644 --- a/htdocs/societe/canvas/individual/actions_card_individual.class.php +++ b/htdocs/societe/canvas/individual/actions_card_individual.class.php @@ -75,7 +75,7 @@ class ActionsCardIndividual extends ActionsCardCommon /** * Execute actions * - * @param string &$action Action + * @param string $action Action * @param int $id Id of object (may be empty for creation) * @return int <0 if KO, >0 if OK */ @@ -91,7 +91,7 @@ class ActionsCardIndividual extends ActionsCardCommon /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * - * @param string &$action Type of action + * @param string $action Type of action * @param string $id Id of object * @param string $ref Ref of object * @return void diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php index 20c9068d4f6..748ba690ea0 100644 --- a/htdocs/societe/checkvat/checkVatPopup.php +++ b/htdocs/societe/checkvat/checkVatPopup.php @@ -158,7 +158,7 @@ else print '
    '; print $langs->trans("VATIntraManualCheck",$langs->trans("VATIntraCheckURL"),$langs->trans("VATIntraCheckURL")).'
    '; print '
    '; -print '
    '; +print '
    '; if ($messagetoshow) { diff --git a/htdocs/societe/class/address.class.php b/htdocs/societe/class/address.class.php index ec16128fb8a..55511922385 100644 --- a/htdocs/societe/class/address.class.php +++ b/htdocs/societe/class/address.class.php @@ -112,7 +112,7 @@ class Address if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - $this->error=$langs->trans("ErrorCompanyNameAlreadyExists",$this->nom); + $this->error=$langs->trans("ErrorCompanyNameAlreadyExists",$this->name); } $this->db->rollback(); @@ -176,7 +176,7 @@ class Address $this->fax = preg_replace("/\./","",$this->fax); $this->note = trim($this->note); - $result = $this->verify(); // Verifie que nom et label obligatoire + $result = $this->verify(); // Verifie que name et label obligatoire if ($result >= 0) { @@ -232,11 +232,11 @@ class Address * @param User $user Objet de l'utilisateur * @return int >0 si ok, <0 si ko */ - function fetch_lines($socid, $user=0) + function fetch_lines($socid, $user=null) { global $langs, $conf; - $sql = 'SELECT rowid, nom, client, fournisseur'; + $sql = 'SELECT rowid, nom as name, client, fournisseur'; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe'; $sql .= ' WHERE rowid = '.$socid; @@ -247,7 +247,7 @@ class Address { $obj = $this->db->fetch_object($resqlsoc); - $this->socname = $obj->nom; + $this->socname = $obj->name; $this->socid = $obj->rowid; $this->id = $obj->rowid; $this->client = $obj->client; @@ -325,7 +325,7 @@ class Address * @param User $user Objet de l'utilisateur * @return int >0 si ok, <0 si ko */ - function fetch_address($id, $user=0) + function fetch_address($id, $user=null) { global $langs; global $conf; @@ -426,7 +426,7 @@ class Address $lien = ''; $lienfin=''; - if ($withpicto) $result.=($lien.img_object($langs->trans("ShowAddress").': '.$this->label,'address').$lienfin.' '); + if ($withpicto) $result.=($lien.img_object($langs->trans("ShowAddress").': '.$this->label, 'address', 'class="classfortooltip"').$lienfin.' '); $result.=$lien.$this->label.$lienfin; return $result; } @@ -440,7 +440,7 @@ class Address */ function info($id) { - $sql = "SELECT s.rowid, s.nom, datec as date_creation, tms as date_modification,"; + $sql = "SELECT s.rowid, s.nom as name, datec as date_creation, tms as date_modification,"; $sql.= " fk_user_creat, fk_user_modif"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE s.rowid = ".$id; @@ -465,7 +465,7 @@ class Address $muser->fetch($obj->fk_user_modif); $this->user_modification = $muser; } - $this->ref = $obj->nom; + $this->ref = $obj->name; $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_modification = $this->db->jdate($obj->date_modification); } diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 79b59211b51..37e646d6b88 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -45,7 +45,6 @@ class CompanyBankAccount extends Account var $cle_rib; var $bic; var $iban; - var $iban_prefix; // deprecated var $proprio; var $owner_address; var $default_rib; @@ -141,7 +140,7 @@ class CompanyBankAccount extends Account $sql .= ",number='".$this->number."'"; $sql .= ",cle_rib='".$this->cle_rib."'"; $sql .= ",bic='".$this->bic."'"; - $sql .= ",iban_prefix = '".$this->iban_prefix."'"; + $sql .= ",iban_prefix = '".$this->iban."'"; $sql .= ",domiciliation='".$this->db->escape($this->domiciliation)."'"; $sql .= ",proprio = '".$this->db->escape($this->proprio)."'"; $sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'"; @@ -196,7 +195,6 @@ class CompanyBankAccount extends Account $this->cle_rib = $obj->cle_rib; $this->bic = $obj->bic; $this->iban = $obj->iban; - $this->iban_prefix = $obj->iban; // deprecated $this->domiciliation = $obj->domiciliation; $this->proprio = $obj->proprio; $this->owner_address = $obj->owner_address; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index cfd37436b72..8f2e64874c6 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -135,17 +135,17 @@ class Societe extends CommonObject var $barcode_type; /** * code (loaded by fetch_barcode) - * @var + * @var string */ var $barcode_type_code; /** * label (loaded by fetch_barcode) - * @var + * @var string */ var $barcode_type_label; /** * coder (loaded by fetch_barcode) - * @var + * @var string */ var $barcode_type_coder; @@ -334,6 +334,18 @@ class Societe extends CommonObject */ var $import_key; + /** + * Supplier WebServices URL + * @var string + */ + var $webservices_url; + + /** + * Supplier WebServices Key + * @var string + */ + var $webservices_key; + var $logo; var $logo_small; var $logo_mini; @@ -624,7 +636,7 @@ class Societe extends CommonObject // Clean parameters $this->id = $id; $this->name = $this->name?trim($this->name):trim($this->nom); - $this->nom = trim($this->nom); // TODO obsolete + $this->nom = $this->name; // For backward compatibility $this->ref_ext = trim($this->ref_ext); $this->address = $this->address?trim($this->address):trim($this->address); $this->zip = $this->zip?trim($this->zip):trim($this->zip); @@ -715,6 +727,10 @@ class Societe extends CommonObject $supplier=true; } + //Web services + $this->webservices_url = $this->webservices_url?clean_url($this->webservices_url,0):''; + $this->webservices_key = trim($this->webservices_key); + $this->db->begin(); // Check name is required and codes are ok or unique. @@ -795,6 +811,9 @@ class Societe extends CommonObject $sql .= ",default_lang = ".(! empty($this->default_lang)?"'".$this->default_lang."'":"null"); $sql .= ",logo = ".(! empty($this->logo)?"'".$this->logo."'":"null"); + $sql .= ",webservices_url = ".(! empty($this->webservices_url)?"'".$this->db->escape($this->webservices_url)."'":"null"); + $sql .= ",webservices_key = ".(! empty($this->webservices_key)?"'".$this->db->escape($this->webservices_key)."'":"null"); + if ($customer) { $sql .= ", code_client = ".(! empty($this->code_client)?"'".$this->db->escape($this->code_client)."'":"null"); @@ -859,6 +878,8 @@ class Societe extends CommonObject } } + $action='update'; + // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('thirdpartydao')); @@ -951,6 +972,7 @@ class Societe extends CommonObject $sql .= ', s.fk_typent as typent_id'; $sql .= ', s.fk_effectif as effectif_id'; $sql .= ', s.fk_forme_juridique as forme_juridique_code'; + $sql .= ', s.webservices_url, s.webservices_key'; $sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode'; $sql .= ', s.fk_departement, s.fk_pays as country_id, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.tva_assuj'; $sql .= ', s.mode_reglement_supplier, s.cond_reglement_supplier, s.localtax1_assuj, s.localtax1_value, s.localtax2_assuj, s.localtax2_value, s.fk_prospectlevel, s.default_lang, s.logo'; @@ -1086,6 +1108,9 @@ class Societe extends CommonObject $this->default_lang = $obj->default_lang; $this->logo = $obj->logo; + $this->webservices_url = $obj->webservices_url; + $this->webservices_key = $obj->webservices_key; + $this->outstanding_limit = $obj->outstanding_limit; // multiprix @@ -1316,6 +1341,19 @@ class Societe extends CommonObject } } + // Remove associated users + if (! $error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_commerciaux"; + $sql.= " WHERE fk_soc = " . $id; + dol_syslog(get_class($this)."::Delete", LOG_DEBUG); + if (! $this->db->query($sql)) + { + $error++; + $this->error = $this->db->lasterror(); + } + } + // Removed extrafields if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used { @@ -1685,15 +1723,15 @@ class Societe extends CommonObject if ($option == 'customer' || $option == 'compta') { - $lien = 'global->SOCIETE_DISABLE_PROSPECTS)) { - $lien = ''; $lienfin=''; - if ($withpicto) $result.=($lien.img_object($langs->trans("ShowCompany").': '.$name,'company').$lienfin); + if ($withpicto) $result.=($lien.img_object($langs->trans("ShowCompany").': '.$name, 'company', 'class="classfortooltip"').$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; $result.=$lien.($maxlen?dol_trunc($name,$maxlen):$name).$lienfin; @@ -2344,7 +2382,7 @@ class Societe extends CommonObject * * @param int $idprof 1,2,3,4 (Example: 1=siren,2=siret,3=naf,4=rcs/rm) * @param string $value Value of profid - * @param int $socid Id of society if update + * @param int $socid Id of thirdparty if update * @return boolean true if exists, false if not */ function id_prof_exists($idprof,$value,$socid=0) @@ -2775,7 +2813,7 @@ class Societe extends CommonObject } else // For backward compatibility { - dol_syslog("Your country setup use an old syntax. Reedit it using setup area.", LOG_WARNING); + dol_syslog("Your country setup use an old syntax. Reedit it using setup area.", LOG_ERR); include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; $country_code=getCountry($country_id,2,$this->db); // This need a SQL request, but it's the old feature that should not be used anymore $country_label=getCountry($country_id,0,$this->db); // This need a SQL request, but it's the old feature that should not be used anymore @@ -2865,10 +2903,10 @@ class Societe extends CommonObject } /** - * Check if thirdparty may using localtax or not + * Check if we must use localtax feature or not according to country (country of $mysocin most cases). * * @param int $localTaxNum To get info for only localtax1 or localtax2 - * @return array array(0=>boolean, 1=>boolean) + * @return boolean true or false */ function useLocalTax($localTaxNum=0) { @@ -2890,9 +2928,9 @@ class Societe extends CommonObject } /** - * Check if thirdparty is from a country using revenue stamps + * Check if we must use revenue stamps feature or not according to country (country of $mysocin most cases). * - * @return boolean Yes or no + * @return boolean true or false */ function useRevenueStamp() { diff --git a/htdocs/societe/commerciaux.php b/htdocs/societe/commerciaux.php index 47368dc9fe3..498257ea496 100644 --- a/htdocs/societe/commerciaux.php +++ b/htdocs/societe/commerciaux.php @@ -37,7 +37,7 @@ $socid = isset($_GET["socid"])?$_GET["socid"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'societe','',''); -$hookmanager->initHooks(array('salesrepresentativescard')); +$hookmanager->initHooks(array('salesrepresentativescard','globalcard')); /* * Actions @@ -57,8 +57,7 @@ if($_GET["socid"] && $_GET["commid"]) $parameters=array('id'=>$_GET["commid"]); $reshook=$hookmanager->executeHooks('doActions',$parameters,$soc,$action); // Note that $action and $object may have been modified by some hooks - $error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors); - + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) $soc->add_commercial($user, $_GET["commid"]); @@ -84,8 +83,7 @@ if($_GET["socid"] && $_GET["delcommid"]) $parameters=array('id'=>$_GET["delcommid"]); $reshook=$hookmanager->executeHooks('doActions',$parameters,$soc,$action); // Note that $action and $object may have been modified by some hooks - $error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors); - + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) $soc->del_commercial($user, $_GET["delcommid"]); @@ -186,7 +184,7 @@ if ($_GET["socid"]) null; // actions in normal case } - print ''; + print ''; print img_object($langs->trans("ShowUser"),"user").' '; print dolGetFirstLastname($obj->firstname, $obj->lastname)."\n"; print ' '; @@ -253,7 +251,7 @@ if ($_GET["socid"]) $obj = $db->fetch_object($resql); $var=!$var; print ""; - print ''; + print ''; print img_object($langs->trans("ShowUser"),"user").' '; print dolGetFirstLastname($obj->firstname, $obj->lastname)."\n"; print ''; diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 10d0f69dd8e..d8aad10d054 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -58,7 +58,7 @@ $month = GETPOST('month','int'); $year = GETPOST('year','int'); // Clean up on purge search criteria ? -if (GETPOST("button_removefilter")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $sref=''; $sprod_fulldescr=''; @@ -76,11 +76,18 @@ $langs->load("orders"); $langs->load("suppliers"); $langs->load("propal"); +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('consumptionthirdparty')); + /* * Actions */ +$parameters=array('id'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + /* @@ -494,10 +501,10 @@ if ($sql_select) } else if (empty($type_element) || $type_element == -1) { - print ''.$langs->trans("SelectElementAndClickRefresh").''; + print ''.$langs->trans("SelectElementAndClickRefresh").''; } else { - print ''.$langs->trans("FeatureNotYetAvailable").''; + print ''.$langs->trans("FeatureNotYetAvailable").''; } print ""; diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 2fde1ef5dcf..c2ad751f196 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -147,7 +147,7 @@ if ($object->id) print ''; - print '
    '; + dol_fiche_end(); $modulepart = 'societe'; $permission = $user->rights->societe->creer; diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index dad3c5cb5e0..a6a00bb0046 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Charles-Fr Benke * @@ -62,9 +62,9 @@ $rowspan=2; if (! empty($conf->barcode->enabled)) $rowspan++; print ''; print ''; -print ''; +print '
    '."\n"; print ''; -print ''; +print ''; print "'; print ''; @@ -78,10 +78,27 @@ if (! empty($conf->barcode->enabled)) print "'; //print ''; -print ''; - -print "
    '.$langs->trans("Search").'
    '.$langs->trans("SearchThirdparty").'
    "; print ':
    "; print ':

    "; +print ''."\n"; +print "
    \n"; +/* + * Search contact + */ +$rowspan=2; +if (! empty($conf->barcode->enabled)) $rowspan++; +print '
    '; +print ''."\n"; +print ''."\n"; +print ''; +print ''."\n"; +print "'; +print ''."\n"; +print "'; +//print ''; +print ''."\n"; +print "
    '.$langs->trans("SearchContact").'
    "; +print ':
    "; +print ':

    \n"; /* * Statistics area @@ -117,11 +134,11 @@ if ($result) } else dol_print_error($db); -print ''; +print '
    '."\n"; print ''; if (! empty($conf->use_javascript_ajax) && ((round($third['prospect'])?1:0)+(round($third['customer'])?1:0)+(round($third['supplier'])?1:0)+(round($third['other'])?1:0) >= 2)) { - print ''; + print ''."\n"; } else { if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) { - $statstring = ""; + $statstring = ""; $statstring.= ''; $statstring.= ""; } if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) { - $statstring.= ""; + $statstring.= ""; $statstring.= ''; $statstring.= ""; } if (! empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) { - $statstring2 = ""; - $statstring2.= ''; + $statstring2 = ""; + $statstring2.= ''; $statstring2.= ""; } print $statstring; @@ -159,14 +176,14 @@ print $total; print ''; print '
    '.$langs->trans("Statistics").'
    '; + print '
    '; $dataseries=array(); if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) $dataseries[]=array('label'=>$langs->trans("Prospects"),'data'=>round($third['prospect'])); if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) $dataseries[]=array('label'=>$langs->trans("Customers"),'data'=>round($third['customer'])); @@ -129,26 +146,26 @@ if (! empty($conf->use_javascript_ajax) && ((round($third['prospect'])?1:0)+(rou if (! empty($conf->societe->enabled)) $dataseries[]=array('label'=>$langs->trans("Others"),'data'=>round($third['other'])); $data=array('series'=>$dataseries); dol_print_graph('stats',300,180,$data,1,'pie',0); - print '
    '.$langs->trans("Prospects").''.round($third['prospect']).'
    '.$langs->trans("Customers").''.round($third['customer']).'
    '.$langs->trans("Suppliers").''.round($third['supplier']).'
    '.$langs->trans("Suppliers").''.round($third['supplier']).'
    '; -if (! empty($conf->categorie->enabled)) +if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES)) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $elementtype = 'societe'; print '
    '; print ''; print ''; - print '
    '.$langs->trans("Categories").'
    '; + print '
    '; $sql = "SELECT c.label, count(*) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie_societe as cs"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid"; @@ -250,12 +267,13 @@ if ($result) { $transRecordedType = $langs->trans("LastModifiedThirdParties",$max); + print "\n\n"; print ''; - print ''; + print ''; + print ''; + print ''; + print ''."\n"; $var=True; @@ -309,7 +327,8 @@ if ($result) $db->free(); - print "
    '.$transRecordedType.''; - print ' '; - print ''.$langs->trans('Status').''; - print '
    '.$transRecordedType.' '.$langs->trans('Status').'
    "; + print "
    \n"; + print "\n"; } } else diff --git a/htdocs/societe/info.php b/htdocs/societe/info.php index 446a4f415fb..9d06d203d9c 100644 --- a/htdocs/societe/info.php +++ b/htdocs/societe/info.php @@ -48,7 +48,7 @@ $hookmanager->initHooks(array('infothirdparty')); $parameters=array('id'=>$socid); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks -$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors); +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -59,21 +59,21 @@ $error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->e $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('',$langs->trans("ThirdParty"),$help_url); -$soc = new Societe($db); -$soc->fetch($socid); -$soc->info($socid); +$object = new Societe($db); +$object->fetch($socid); +$object->info($socid); /* * Affichage onglets */ -$head = societe_prepare_head($soc); +$head = societe_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("ThirdParty"),0,'company'); print '
    '; -dol_print_object_info($soc); +dol_print_object_info($object); print '
    '; diff --git a/htdocs/societe/notify/fiche.php b/htdocs/societe/notify/card.php similarity index 72% rename from htdocs/societe/notify/fiche.php rename to htdocs/societe/notify/card.php index 18de91a6a31..1845669dcfc 100644 --- a/htdocs/societe/notify/fiche.php +++ b/htdocs/societe/notify/card.php @@ -1,7 +1,7 @@ - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2010-2012 Juanjo Menent + * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2010-2014 Juanjo Menent * * 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 @@ -18,7 +18,7 @@ */ /** - * \file htdocs/societe/notify/fiche.php + * \file htdocs/societe/notify/card.php * \ingroup societe notification * \brief Tab for notifications of third party */ @@ -191,19 +191,17 @@ if ($result > 0) print ''; print ''; - // Help - print '
    '.$langs->trans("NotificationsDesc").'
    '; - - dol_fiche_end(); + // Help + print $langs->trans("NotificationsDesc").'

    '; print "\n"; // Add notification form print_fiche_titre($langs->trans("AddNewNotification"),'',''); - print '
    '; + print ''; print ''; print ''; @@ -212,9 +210,9 @@ if ($result > 0) // Line with titles print ''; print ''; - print_liste_field_titre($langs->trans("Contact"),"fiche.php","c.lastname",'',$param,'"width="45%"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre",'',$param,'"width="35%"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),"fiche.php","",'',$param,'"width="10%"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Target"),$_SERVER["PHP_SELF"],"c.lastname",'',$param,'"width="45%"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"a.titre",'',$param,'"width="35%"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"",'',$param,'"width="10%"',$sortfield,$sortorder); print_liste_field_titre(''); print ''; @@ -265,13 +263,40 @@ if ($result > 0) // Line with titles print '
    '; print ''; - print_liste_field_titre($langs->trans("Contact"),"fiche.php","c.lastname",'',$param,'"width="45%"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre",'',$param,'"width="35%"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),"fiche.php","",'',$param,'"width="10%"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Target"),$_SERVER["PHP_SELF"],"c.lastname",'',$param,'"width="45%"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"a.titre",'',$param,'"width="35%"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"",'',$param,'"width="10%"',$sortfield,$sortorder); print_liste_field_titre('','',''); print ''; - // List of notifications for contacts + // List of notifications enabled for fixed email + foreach($conf->global as $key => $val) + { + if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_(.*)/', $key, $reg)) continue; + //print $key.' - '.$val.' - '.$reg[1].'
    '; + print ''; + print ''; + print ''; + print ''; + print ''; + } + + // List of notifications enabled for contacts $sql = "SELECT n.rowid, n.type,"; $sql.= " a.code, a.label,"; $sql.= " c.rowid as contactid, c.lastname, c.firstname, c.email"; @@ -321,7 +346,7 @@ if ($result > 0) if ($obj->type == 'email') print $langs->trans("Email"); if ($obj->type == 'sms') print $langs->trans("SMS"); print ''; - print ''; + print ''; print ''; $i++; } @@ -343,21 +368,22 @@ if ($result > 0) // Line with titles print '
    '.$val; + if (isValidEmail($val)) + { + print ' <'.$val.'>'; + } + else + { + $langs->load("errors"); + print '   '.img_warning().' '.$langs->trans("ErrorBadEMail",$val); + } + print ''; + $label=($langs->trans("Notify_".$reg[1])!="Notify_".$reg[1]?$langs->trans("Notify_".$reg[1]):$reg[1]); + print $label; + print ''; + print $langs->trans("Email"); + print ''.$langs->trans("SeeModuleSetup").'
    '.img_delete().''.img_delete().'
    '; print ''; - print_liste_field_titre($langs->trans("Contact"),"fiche.php","c.lastname",'',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre",'',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),"fiche.php","a.daten",'',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Target"),$_SERVER["PHP_SELF"],"c.lastname",'',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"a.titre",'',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"",'',$param,'',$sortfield,$sortorder); + //print_liste_field_titre($langs->trans("Object"),$_SERVER["PHP_SELF"],"",'',$param,'"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"a.daten",'',$param,'align="right"',$sortfield,$sortorder); print ''; // List - $sql = "SELECT n.rowid, n.daten, n.email, n.objet_type, n.objet_id,"; - $sql.= " c.rowid as id, c.lastname, c.firstname, c.email,"; + $sql = "SELECT n.rowid, n.daten, n.email, n.objet_type as object_type, n.objet_id as object_id, n.type,"; + $sql.= " c.rowid as id, c.lastname, c.firstname, c.email as contactemail,"; $sql.= " a.code, a.label"; $sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,"; - $sql.= " ".MAIN_DB_PREFIX."notify as n, "; - $sql.= " ".MAIN_DB_PREFIX."socpeople as c"; + $sql.= " ".MAIN_DB_PREFIX."notify as n "; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as c ON n.fk_contact = c.rowid"; $sql.= " WHERE a.rowid = n.fk_action"; - $sql.= " AND c.rowid = n.fk_contact"; - $sql.= " AND c.fk_soc = ".$object->id; + $sql.= " AND n.fk_soc = ".$object->id; $resql=$db->query($sql); if ($resql) @@ -373,17 +399,37 @@ if ($result > 0) $obj = $db->fetch_object($resql); - $contactstatic->id=$obj->id; - $contactstatic->lastname=$obj->lastname; - $contactstatic->firstname=$obj->firstname; - print ''; print ''; - // TODO Add link to object here + print ''; + // TODO Add link to object here for other types + /*print '';*/ // print print''; print ''; @@ -400,7 +446,7 @@ if ($result > 0) } else dol_print_error('','RecordNotFound'); -$db->close(); llxFooter(); +$db->close(); diff --git a/htdocs/societe/notify/index.php b/htdocs/societe/notify/index.php index 47054424212..a1042087faf 100644 --- a/htdocs/societe/notify/index.php +++ b/htdocs/societe/notify/index.php @@ -51,13 +51,12 @@ $pagenext = $page + 1; /* - * Mode Liste - * + * View */ llxHeader(); -$sql = "SELECT s.nom, s.rowid as socid, c.lastname, c.firstname, a.label, n.rowid"; +$sql = "SELECT s.nom as name, s.rowid as socid, c.lastname, c.firstname, a.label, n.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,"; $sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,"; $sql.= " ".MAIN_DB_PREFIX."notify_def as n,"; @@ -78,13 +77,13 @@ if ($result) $i = 0; $paramlist=''; - print_barre_liste($langs->trans("ListOfNotificationsDone"), $page, "index.php", $paramlist, $sortfield,$sortorder,'',$num); + print_barre_liste($langs->trans("ListOfNotificationsDone"), $page, $_SERVER["PHP_SELF"], $paramlist, $sortfield,$sortorder,'',$num); print '
    '.$contactstatic->getNomUrl(1); - print $obj->email?' <'.$obj->email.'>':$langs->trans("NoMail"); + print '
    '; + if ($obj->id > 0) + { + $contactstatic->id=$obj->id; + $contactstatic->lastname=$obj->lastname; + $contactstatic->firstname=$obj->firstname; + print $contactstatic->getNomUrl(1); + print $obj->email?' <'.$obj->email.'>':$langs->trans("NoMail"); + } + else + { + print $obj->email; + } print ''; $label=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label); print $label; print ''; + if ($obj->type == 'email') print $langs->trans("Email"); + if ($obj->type == 'sms') print $langs->trans("Sms"); + print ''; + if ($obj->object_type == 'order') + { + $orderstatic->id=$obj->object_id; + $orderstatic->ref=... + print $orderstatic->getNomUrl(1); + } + print ''.dol_print_date($db->jdate($obj->daten), 'dayhour').'
    '; print ''; - print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","",'valign="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Contact"),"index.php","c.lastname","","",'valign="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Action"),"index.php","a.titre","","",'valign="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","",'valign="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"c.lastname","","",'valign="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"a.titre","","",'valign="center"',$sortfield,$sortorder); print "\n"; $var=True; while ($i < $num) @@ -94,7 +93,7 @@ if ($result) $var=!$var; print ""; - print "\n"; + print "\n"; print "\n"; print "\n"; print "\n"; diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 7ab39a10ddc..0932144a860 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -292,8 +292,11 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print '
    socid."\">".$obj->nom."socid."\">".$obj->name."".dolGetFirstLastname($obj->firstname, $obj->lastname)."".$obj->titre."
    '; - print '

     '; - print '
    '; + print '
    '; + print ''; + print '     '; + print ''; + print '
    '; print '
    '; } elseif ($action == 'edit_customer_price') { @@ -368,8 +371,11 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; - print '

     '; - print '
    '; + print '
    '; + print ''; + print '     '; + print ''; + print '
    '; print '
    '; } elseif ($action == 'showlog_customer_price') { diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index b95839d67b9..f57eb6a5b70 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Peter Fontaine * @@ -71,7 +71,7 @@ if ($action == 'update' && ! $_POST["cancel"]) $account->number = $_POST["number"]; $account->cle_rib = $_POST["cle_rib"]; $account->bic = $_POST["bic"]; - $account->iban_prefix = $_POST["iban_prefix"]; + $account->iban = $_POST["iban"]; $account->domiciliation = $_POST["domiciliation"]; $account->proprio = $_POST["proprio"]; $account->owner_address = $_POST["owner_address"]; @@ -129,7 +129,7 @@ if ($action == 'add' && ! $_POST["cancel"]) $account->number = $_POST["number"]; $account->cle_rib = $_POST["cle_rib"]; $account->bic = $_POST["bic"]; - $account->iban_prefix = $_POST["iban_prefix"]; + $account->iban = $_POST["iban"]; $account->domiciliation = $_POST["domiciliation"]; $account->proprio = $_POST["proprio"]; $account->owner_address = $_POST["owner_address"]; @@ -185,6 +185,7 @@ if ($action == 'confirm_delete' && $_GET['confirm'] == 'yes') } } + /* * View */ @@ -292,7 +293,7 @@ if ($socid && $action != 'edit' && $action != "create") } print ''.$langs->trans("IBAN").''; - print ''.$account->iban_prefix.''; + print ''.$account->iban.''; print ''.$langs->trans("BIC").''; print ''.$account->bic.''; @@ -317,8 +318,13 @@ if ($socid && $action != 'edit' && $action != "create") print '
    '.$langs->trans("RIBControlError").'
    '; } - print "
    "; + print "
    "; + + /* + * List of bank accounts + */ + print_titre($langs->trans("AllRIB")); $rib_list = $soc->get_all_rib(); @@ -339,7 +345,7 @@ if ($socid && $action != 'edit' && $action != "create") foreach ($rib_list as $rib) { - print ""; + print ""; // Label print ''.$rib->label.''; // Bank name @@ -382,7 +388,7 @@ if ($socid && $action != 'edit' && $action != "create") } if (count($rib_list) == 0) { - print ''.$langs->trans("NoBANRecord").''; + print ''.$langs->trans("NoBANRecord").''; } print ''; @@ -458,7 +464,7 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer) if ($val == 'AccountNumber') { - print ''.$langs->trans("BankAccountNumber").''; + print ''.$langs->trans("BankAccountNumber").''; print ''; print ''; } @@ -475,14 +481,14 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer) } // IBAN - print ''.$langs->trans("IBAN").''; - print ''; + print ''.$langs->trans("IBAN").''; + print ''; - print ''.$langs->trans("BIC").''; + print ''.$langs->trans("BIC").''; print ''; print ''.$langs->trans("BankAccountDomiciliation").''; - print ""; @@ -497,9 +503,11 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer) print '
    '; - print '
    '; - print '   '; - print '
    '; + print '
    '; + print ''; + print '     '; + print ''; + print '
    '; print ''; } @@ -556,7 +564,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer) // IBAN print ''.$langs->trans("IBAN").''; - print ''; + print ''; print ''.$langs->trans("BIC").''; print ''; @@ -577,9 +585,11 @@ if ($socid && $action == 'create' && $user->rights->societe->creer) print '
    '; - print '
    '; - print '   '; - print '
    '; + print '
    '; + print ''; + print '     '; + print ''; + print '
    '; print ''; } diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 8317a628c6a..5cde8eb572a 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -65,7 +65,7 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); // Get object canvas (By default, this is not defined, so standard usage of dolibarr) $object->getCanvas($socid); $canvas = $object->canvas?$object->canvas:GETPOST("canvas"); -$objcanvas=''; +$objcanvas=null; if (! empty($canvas)) { require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; @@ -77,7 +77,7 @@ if (! empty($canvas)) $result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', $objcanvas); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('thirdpartycard')); +$hookmanager->initHooks(array('thirdpartycard','globalcard')); /* @@ -86,7 +86,7 @@ $hookmanager->initHooks(array('thirdpartycard')); $parameters=array('id'=>$socid, 'objcanvas'=>$objcanvas); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks -$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors); +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) { @@ -106,7 +106,6 @@ if (empty($reshook)) { //obtidre selected del combobox $value=GETPOST('lt1'); - $object = new Societe($db); $object->fetch($socid); $res=$object->setValueFrom('localtax1_value', $value); } @@ -114,12 +113,11 @@ if (empty($reshook)) { //obtidre selected del combobox $value=GETPOST('lt2'); - $object = new Societe($db); $object->fetch($socid); $res=$object->setValueFrom('localtax2_value', $value); } - // Add new third party + // Add new or update third party if ((! GETPOST('getcustomercode') && ! GETPOST('getsuppliercode')) && ($action == 'add' || $action == 'update') && $user->rights->societe->creer) { @@ -136,48 +134,48 @@ if (empty($reshook)) { $object->particulier = GETPOST("private"); - $object->name = dolGetFirstLastname(GETPOST('firstname','san_alpha'),GETPOST('nom','san_alpha')?GETPOST('nom','san_alpha'):GETPOST('name','san_alpha')); + $object->name = dolGetFirstLastname(GETPOST('firstname','alpha'),GETPOST('nom','alpha')?GETPOST('nom','alpha'):GETPOST('name','alpha')); $object->civility_id = GETPOST('civility_id', 'int'); // Add non official properties - $object->name_bis = GETPOST('name','san_alpha')?GETPOST('name','san_alpha'):GETPOST('nom','san_alpha'); - $object->firstname = GETPOST('firstname','san_alpha'); + $object->name_bis = GETPOST('name','alpha')?GETPOST('name','alpha'):GETPOST('nom','alpha'); + $object->firstname = GETPOST('firstname','alpha'); } else { - $object->name = GETPOST('name', 'san_alpha')?GETPOST('name', 'san_alpha'):GETPOST('nom', 'san_alpha'); + $object->name = GETPOST('name', 'alpha')?GETPOST('name', 'alpha'):GETPOST('nom', 'alpha'); } - $object->address = GETPOST('address', 'san_alpha'); - $object->zip = GETPOST('zipcode', 'san_alpha'); - $object->town = GETPOST('town', 'san_alpha'); + $object->address = GETPOST('address', 'alpha'); + $object->zip = GETPOST('zipcode', 'alpha'); + $object->town = GETPOST('town', 'alpha'); $object->country_id = GETPOST('country_id', 'int'); $object->state_id = GETPOST('state_id', 'int'); - $object->skype = GETPOST('skype', 'san_alpha'); - $object->phone = GETPOST('phone', 'san_alpha'); - $object->fax = GETPOST('fax','san_alpha'); + $object->skype = GETPOST('skype', 'alpha'); + $object->phone = GETPOST('phone', 'alpha'); + $object->fax = GETPOST('fax','alpha'); $object->email = GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL); $object->url = GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL); - $object->idprof1 = GETPOST('idprof1', 'san_alpha'); - $object->idprof2 = GETPOST('idprof2', 'san_alpha'); - $object->idprof3 = GETPOST('idprof3', 'san_alpha'); - $object->idprof4 = GETPOST('idprof4', 'san_alpha'); - $object->idprof5 = GETPOST('idprof5', 'san_alpha'); - $object->idprof6 = GETPOST('idprof6', 'san_alpha'); - $object->prefix_comm = GETPOST('prefix_comm', 'san_alpha'); - $object->code_client = GETPOST('code_client', 'san_alpha'); - $object->code_fournisseur = GETPOST('code_fournisseur', 'san_alpha'); - $object->capital = GETPOST('capital', 'san_alpha'); - $object->barcode = GETPOST('barcode', 'san_alpha'); + $object->idprof1 = GETPOST('idprof1', 'alpha'); + $object->idprof2 = GETPOST('idprof2', 'alpha'); + $object->idprof3 = GETPOST('idprof3', 'alpha'); + $object->idprof4 = GETPOST('idprof4', 'alpha'); + $object->idprof5 = GETPOST('idprof5', 'alpha'); + $object->idprof6 = GETPOST('idprof6', 'alpha'); + $object->prefix_comm = GETPOST('prefix_comm', 'alpha'); + $object->code_client = GETPOST('code_client', 'alpha'); + $object->code_fournisseur = GETPOST('code_fournisseur', 'alpha'); + $object->capital = GETPOST('capital', 'alpha'); + $object->barcode = GETPOST('barcode', 'alpha'); - $object->tva_intra = GETPOST('tva_intra', 'san_alpha'); - $object->tva_assuj = GETPOST('assujtva_value', 'san_alpha'); - $object->status = GETPOST('status', 'san_alpha'); + $object->tva_intra = GETPOST('tva_intra', 'alpha'); + $object->tva_assuj = GETPOST('assujtva_value', 'alpha'); + $object->status = GETPOST('status', 'alpha'); // Local Taxes - $object->localtax1_assuj = GETPOST('localtax1assuj_value', 'san_alpha'); - $object->localtax2_assuj = GETPOST('localtax2assuj_value', 'san_alpha'); + $object->localtax1_assuj = GETPOST('localtax1assuj_value', 'alpha'); + $object->localtax2_assuj = GETPOST('localtax2assuj_value', 'alpha'); - $object->localtax1_value = GETPOST('lt1', 'san_alpha'); - $object->localtax2_value = GETPOST('lt2', 'san_alpha'); + $object->localtax1_value = GETPOST('lt1', 'alpha'); + $object->localtax2_value = GETPOST('lt2', 'alpha'); $object->forme_juridique_code = GETPOST('forme_juridique_code', 'int'); $object->effectif_id = GETPOST('effectif_id', 'int'); @@ -189,6 +187,10 @@ if (empty($reshook)) $object->commercial_id = GETPOST('commercial_id', 'int'); $object->default_lang = GETPOST('default_lang'); + // Webservices url/key + $object->webservices_url = GETPOST('webservices_url', 'custom', 0, FILTER_SANITIZE_URL); + $object->webservices_key = GETPOST('webservices_key', 'san_alpha'); + // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); @@ -217,6 +219,18 @@ if (empty($reshook)) $error++; $errors[] = $langs->trans("ErrorSupplierModuleNotEnabled"); $action = ($action=='add'?'create':'edit'); } + if (! empty($object->webservices_url)) { + //Check if has transport, without any the soap client will give error + if (strpos($object->webservices_url, "http") === false) + { + $object->webservices_url = "http://".$object->webservices_url; + } + if (! isValidUrl($object->webservices_url)) { + $langs->load("errors"); + $error++; $errors[] = $langs->trans("ErrorBadUrl",$object->webservices_url); + $action = ($action=='add'?'create':'edit'); + } + } // We set country_id, country_code and country for the selected country $object->country_id=GETPOST('country_id')!=''?GETPOST('country_id'):$mysoc->country_id; @@ -340,8 +354,8 @@ if (empty($reshook)) else { $url=$_SERVER["PHP_SELF"]."?socid=".$object->id; - if (($object->client == 1 || $object->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $url=DOL_URL_ROOT."/comm/fiche.php?socid=".$object->id; - else if ($object->fournisseur == 1) $url=DOL_URL_ROOT."/fourn/fiche.php?socid=".$object->id; + if (($object->client == 1 || $object->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $url=DOL_URL_ROOT."/comm/card.php?socid=".$object->id; + else if ($object->fournisseur == 1) $url=DOL_URL_ROOT."/fourn/card.php?socid=".$object->id; header("Location: ".$url); exit; @@ -446,7 +460,6 @@ if (empty($reshook)) $sql = "UPDATE ".MAIN_DB_PREFIX."adherent"; $sql.= " SET fk_soc = NULL WHERE fk_soc = " . $id; - dol_syslog(get_class($object)."::delete", LOG_DEBUG); if (! $object->db->query($sql)) { $error++; @@ -505,6 +518,7 @@ if (empty($reshook)) // Actions to send emails $id=$socid; $actiontypecode='AC_OTH_AUTO'; + $trigger_name='COMPANY_SENTBYMAIL'; $paramname='socid'; $mode='emailfromthirdparty'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; @@ -528,7 +542,7 @@ if (empty($reshook)) // Define output language $outputlangs = $langs; $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fac->client->default_lang; if (! empty($newlang)) { @@ -567,14 +581,22 @@ if (empty($reshook)) * View */ -$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; -llxHeader('',$langs->trans("ThirdParty"),$help_url); - $form = new Form($db); $formfile = new FormFile($db); $formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); +if ($socid > 0 && empty($object->id)) +{ + $res=$object->fetch($socid); + if ($result <= 0) dol_print_error('',$object->error); +} + +$title=$langs->trans("ThirdParty"); +if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name; +$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; +llxHeader('',$title,$help_url); + $countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) @@ -582,12 +604,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // ----------------------------------------- // When used with CANVAS // ----------------------------------------- - if (empty($object->error) && $socid) - { - $object = new Societe($db); - $result=$object->fetch($socid); - if ($result <= 0) dol_print_error('',$object->error); - } $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates $objcanvas->display_canvas($action); // Show template } @@ -638,31 +654,31 @@ else if (GETPOST("type")=='p') { $object->client=2; } if (! empty($conf->fournisseur->enabled) && (GETPOST("type")=='f' || GETPOST("type")=='')) { $object->fournisseur=1; } - $object->name = GETPOST('nom', 'san_alpha'); - $object->firstname = GETPOST('firstname', 'san_alpha'); + $object->name = GETPOST('nom', 'alpha'); + $object->firstname = GETPOST('firstname', 'alpha'); $object->particulier = $private; $object->prefix_comm = GETPOST('prefix_comm'); $object->client = GETPOST('client')?GETPOST('client'):$object->client; - $object->code_client = GETPOST('code_client', 'san_alpha'); + $object->code_client = GETPOST('code_client', 'alpha'); $object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur; - $object->code_fournisseur = GETPOST('code_fournisseur', 'san_alpha'); - $object->address = GETPOST('address', 'san_alpha'); - $object->zip = GETPOST('zipcode', 'san_alpha'); - $object->town = GETPOST('town', 'san_alpha'); + $object->code_fournisseur = GETPOST('code_fournisseur', 'alpha'); + $object->address = GETPOST('address', 'alpha'); + $object->zip = GETPOST('zipcode', 'alpha'); + $object->town = GETPOST('town', 'alpha'); $object->state_id = GETPOST('state_id', 'int'); - $object->skype = GETPOST('skype', 'san_alpha'); - $object->phone = GETPOST('phone', 'san_alpha'); - $object->fax = GETPOST('fax', 'san_alpha'); + $object->skype = GETPOST('skype', 'alpha'); + $object->phone = GETPOST('phone', 'alpha'); + $object->fax = GETPOST('fax', 'alpha'); $object->email = GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL); $object->url = GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL); $object->capital = GETPOST('capital', 'int'); - $object->barcode = GETPOST('barcode', 'san_alpha'); - $object->idprof1 = GETPOST('idprof1', 'san_alpha'); - $object->idprof2 = GETPOST('idprof2', 'san_alpha'); - $object->idprof3 = GETPOST('idprof3', 'san_alpha'); - $object->idprof4 = GETPOST('idprof4', 'san_alpha'); - $object->idprof5 = GETPOST('idprof5', 'san_alpha'); - $object->idprof6 = GETPOST('idprof6', 'san_alpha'); + $object->barcode = GETPOST('barcode', 'alpha'); + $object->idprof1 = GETPOST('idprof1', 'alpha'); + $object->idprof2 = GETPOST('idprof2', 'alpha'); + $object->idprof3 = GETPOST('idprof3', 'alpha'); + $object->idprof4 = GETPOST('idprof4', 'alpha'); + $object->idprof5 = GETPOST('idprof5', 'alpha'); + $object->idprof6 = GETPOST('idprof6', 'alpha'); $object->typent_id = GETPOST('typent_id', 'int'); $object->effectif_id = GETPOST('effectif_id', 'int'); $object->civility_id = GETPOST('civility_id', 'int'); @@ -677,7 +693,7 @@ else $object->localtax1_value =GETPOST('lt1', 'int'); $object->localtax2_value =GETPOST('lt2', 'int'); - $object->tva_intra = GETPOST('tva_intra', 'san_alpha'); + $object->tva_intra = GETPOST('tva_intra', 'alpha'); $object->commercial_id = GETPOST('commercial_id', 'int'); $object->default_lang = GETPOST('default_lang'); @@ -766,16 +782,19 @@ else print '
    '; print $langs->trans("ThirdPartyType").':     '; print '
    '; - print ''; print ''; print '     '; - print ''; - print ' '; - print $langs->trans("Individual"); - print ' ('.$langs->trans("ToCreateContactWithSameName").')'; + print ''; print '
    '; print "
    \n"; } @@ -793,6 +812,8 @@ else print ''; if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) print ''; + dol_fiche_head(null, 'card', '', 0, ''); + print ''; // Name, firstname @@ -806,7 +827,7 @@ else print ''; } print 'global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>'; - print ''; + print ''; if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''; @@ -817,7 +838,7 @@ else if ($conf->use_javascript_ajax) { print ''; - print ''; + print ''; print ''; print ''; @@ -1035,14 +1056,7 @@ else print $form->selectyesno('localtax2assuj_value',0,1); print ''; } -/* - if ($mysoc->country_code=='ES' && $mysoc->localtax2_assuj!="1" && ! empty($conf->fournisseur->enabled) && (GETPOST("type")=='f' || GETPOST("type")=='') ) - { - print ''; - } -*/ + if (! empty($conf->global->MAIN_MULTILANGS)) { print '
    '.$langs->trans('Prefix').'
     
    '; print $formcompany->select_civility($object->civility_id).'
    '.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).''; - print $form->selectyesno('localtax2assuj_value',0,1); - print '
    '."\n"; @@ -1079,9 +1093,11 @@ else print '
    '."\n"; - print '
    '; + dol_fiche_end(); + + print '
    '; print ''; - print '
    '."\n"; + print '
    '."\n"; print ''."\n"; } @@ -1095,9 +1111,6 @@ else if ($socid) { - $object = new Societe($db); - $res=$object->fetch($socid); - if ($res < 0) { dol_print_error($db,$object->error); exit; } $res=$object->fetch_optionals($object->id,$extralabels); //if ($res < 0) { dol_print_error($db); exit; } @@ -1147,39 +1160,43 @@ else if (GETPOST('nom')) { // We overwrite with values if posted - $object->name = GETPOST('nom', 'san_alpha'); - $object->prefix_comm = GETPOST('prefix_comm', 'san_alpha'); + $object->name = GETPOST('nom', 'alpha'); + $object->prefix_comm = GETPOST('prefix_comm', 'alpha'); $object->client = GETPOST('client', 'int'); - $object->code_client = GETPOST('code_client', 'san_alpha'); + $object->code_client = GETPOST('code_client', 'alpha'); $object->fournisseur = GETPOST('fournisseur', 'int'); - $object->code_fournisseur = GETPOST('code_fournisseur', 'san_alpha'); - $object->address = GETPOST('address', 'san_alpha'); - $object->zip = GETPOST('zipcode', 'san_alpha'); - $object->town = GETPOST('town', 'san_alpha'); + $object->code_fournisseur = GETPOST('code_fournisseur', 'alpha'); + $object->address = GETPOST('address', 'alpha'); + $object->zip = GETPOST('zipcode', 'alpha'); + $object->town = GETPOST('town', 'alpha'); $object->country_id = GETPOST('country_id')?GETPOST('country_id', 'int'):$mysoc->country_id; $object->state_id = GETPOST('state_id', 'int'); - $object->skype = GETPOST('skype', 'san_alpha'); - $object->phone = GETPOST('phone', 'san_alpha'); - $object->fax = GETPOST('fax', 'san_alpha'); + $object->skype = GETPOST('skype', 'alpha'); + $object->phone = GETPOST('phone', 'alpha'); + $object->fax = GETPOST('fax', 'alpha'); $object->email = GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL); $object->url = GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL); $object->capital = GETPOST('capital', 'int'); - $object->idprof1 = GETPOST('idprof1', 'san_alpha'); - $object->idprof2 = GETPOST('idprof2', 'san_alpha'); - $object->idprof3 = GETPOST('idprof3', 'san_alpha'); - $object->idprof4 = GETPOST('idprof4', 'san_alpha'); - $object->idprof5 = GETPOST('idprof5', 'san_alpha'); - $object->idprof6 = GETPOST('idprof6', 'san_alpha'); + $object->idprof1 = GETPOST('idprof1', 'alpha'); + $object->idprof2 = GETPOST('idprof2', 'alpha'); + $object->idprof3 = GETPOST('idprof3', 'alpha'); + $object->idprof4 = GETPOST('idprof4', 'alpha'); + $object->idprof5 = GETPOST('idprof5', 'alpha'); + $object->idprof6 = GETPOST('idprof6', 'alpha'); $object->typent_id = GETPOST('typent_id', 'int'); $object->effectif_id = GETPOST('effectif_id', 'int'); - $object->barcode = GETPOST('barcode', 'san_alpha'); + $object->barcode = GETPOST('barcode', 'alpha'); $object->forme_juridique_code = GETPOST('forme_juridique_code', 'int'); - $object->default_lang = GETPOST('default_lang', 'san_alpha'); + $object->default_lang = GETPOST('default_lang', 'alpha'); $object->tva_assuj = GETPOST('assujtva_value', 'int'); - $object->tva_intra = GETPOST('tva_intra', 'san_alpha'); + $object->tva_intra = GETPOST('tva_intra', 'alpha'); $object->status = GETPOST('status', 'int'); + // Webservices url/key + $object->webservices_url = GETPOST('webservices_url', 'custom', 0, FILTER_SANITIZE_URL); + $object->webservices_key = GETPOST('webservices_key', 'san_alpha'); + //Local Taxes $object->localtax1_assuj = GETPOST('localtax1assuj_value'); $object->localtax2_assuj = GETPOST('localtax2assuj_value'); @@ -1267,7 +1284,7 @@ else // Name print ''; - print ''; + print ''; // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field @@ -1559,6 +1576,14 @@ else print $object->showOptionals($extrafields,'edit'); } + // Webservices url/key + if (!empty($conf->syncsupplierwebservices->enabled)) { + print ''; + print ''; + print ''; + print ''; + } + // Logo print ''; print ''; @@ -1580,11 +1605,11 @@ else print ''; print '
    '; - print '
    '; + print '
    '; print ''; - print '     '; + print '     '; print ''; - print '
    '; + print '
    '; print ''; @@ -1596,9 +1621,6 @@ else /* * View */ - $object = new Societe($db); - $res=$object->fetch($socid); - if ($res < 0) { dol_print_error($db,$object->error); exit; } $res=$object->fetch_optionals($object->id,$extralabels); //if ($res < 0) { dol_print_error($db); exit; } @@ -1699,7 +1721,11 @@ else // Status print ''.$langs->trans("Status").''; print ''; - print $object->getLibStatut(2); + if (! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { + print ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased'); + } else { + print $object->getLibStatut(2); + } print ''; print $htmllogobar; $htmllogobar=''; print ''; @@ -1719,7 +1745,8 @@ else print ''.$langs->trans("Country").''; if (! empty($object->country_code)) { - $img=picto_from_langcode($object->country_code); + //$img=picto_from_langcode($object->country_code); + $img=''; if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0); else print ($img?$img.' ':'').$object->country; } @@ -2015,6 +2042,12 @@ else print "\n"; } + // Webservices url/key + if (!empty($conf->syncsupplierwebservices->enabled)) { + print ''.$langs->trans("WebServiceURL").''.dol_print_url($object->webservices_url).''; + print ''.$langs->trans('WebServiceKey').''.$object->webservices_key.''; + } + print ''; dol_fiche_end(); @@ -2157,7 +2190,7 @@ else if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC)) { - print '
    '; + print '
    '; print ''; // ancre /* @@ -2172,7 +2205,7 @@ else $somethingshown=$formfile->show_documents('company',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang); - print '
    '; + print '
    '; print '
    '; diff --git a/htdocs/societe/societe.php b/htdocs/societe/societe.php index f0b3532018b..2d046a3ec16 100644 --- a/htdocs/societe/societe.php +++ b/htdocs/societe/societe.php @@ -153,7 +153,7 @@ llxHeader('',$langs->trans("ThirdParty"),$help_url); // Do we click on purge search criteria ? -if (GETPOST("button_removefilter_x")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_categ=''; $search_sale=''; diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index 60e114be6a5..7a2274e81b5 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; $langs->load("orders"); $langs->load("companies"); -$id=GETPOST('id','int'); +$id=GETPOST('id','int')?GETPOST('id','int'):GETPOST('socid','int'); $ref=GETPOST('ref','alpha'); $action=GETPOST('action','alpha'); @@ -44,8 +44,9 @@ $result = restrictedArea($user, 'societe', $id,''); $object = new Societe($db); + /* - * Ajout d'un nouveau contact + * Actions */ if ($action == 'addcontact' && $user->rights->societe->creer) @@ -133,12 +134,9 @@ $userstatic=new User($db); /* Mode vue et edition */ /* */ /* *************************************************************************** */ -dol_htmloutput_mesg($mesg); if ($id > 0 || ! empty($ref)) { - $langs->trans("OrderCard"); - if ($object->fetch($id, $ref) > 0) { $soc = new Societe($db); @@ -154,12 +152,12 @@ if ($id > 0 || ! empty($ref)) print ''; print $form->showrefnav($object,'id','',($user->societe_id?0:1),'rowid','nom'); print ''; - + if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''.$langs->trans('Prefix').''.$object->prefix_comm.''; } - + if ($object->client) { print ''; @@ -168,7 +166,7 @@ if ($id > 0 || ! empty($ref)) if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; print ''; } - + if ($object->fournisseur) { print ''; @@ -216,7 +214,7 @@ if ($id > 0 || ! empty($ref)) { $titre=$langs->trans("MembersListOfTiers"); print '
    '; - + print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,''); print ""; @@ -230,13 +228,13 @@ if ($id > 0 || ! empty($ref)) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("EndSubscription"),$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder); print "\n"; - + $var=True; $i=0; while ($i < $num && $i < $conf->liste_limit) { $objp = $db->fetch_object($resql); - + $datefin=$db->jdate($objp->datefin); $memberstatic->id=$objp->rowid; $memberstatic->ref=$objp->rowid; @@ -244,43 +242,43 @@ if ($id > 0 || ! empty($ref)) $memberstatic->firstname=$objp->firstname; $companyname=$objp->company; - + $var=!$var; print ""; - + // Ref print "\n"; - + // Lastname - print "\n"; - + // Login print "\n"; - + // Type $membertypestatic->id=$objp->type_id; $membertypestatic->libelle=$objp->type; print ''; - + // Moral/Physique print "\n"; - + // EMail print "\n"; - + // Statut print '"; - + // End of subscription date if ($datefin) { @@ -303,7 +301,7 @@ if ($id > 0 || ! empty($ref)) } print ''; } - + print "\n"; $i++; } diff --git a/htdocs/support/default.css b/htdocs/support/default.css index d535ab0ea70..ea62df52ef0 100644 --- a/htdocs/support/default.css +++ b/htdocs/support/default.css @@ -18,7 +18,7 @@ body { font-size:12px; font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif; -background: #f9f9f9 url(headbg.jpg) 0 0 no-repeat; +background: #f9f9f9; /* background-color: #F4F4F4; */ margin: 5px 10px; } @@ -148,3 +148,11 @@ background: #DDDFDD; table { font-size: 12px; } table.login { border: 1px solid #C0C0C0; background: #F0F0F0; font-size: 12px; } + +.inline-block +{ + display:inline-block; + vertical-align: top; + margin: 12px; + min-width: 400px; +} diff --git a/htdocs/support/dolibarr_logo2.png b/htdocs/support/dolibarr_logo2.png deleted file mode 100644 index 7abd0ae8494..00000000000 Binary files a/htdocs/support/dolibarr_logo2.png and /dev/null differ diff --git a/htdocs/support/headbg.jpg b/htdocs/support/headbg.jpg deleted file mode 100644 index 5491c6e4acb..00000000000 Binary files a/htdocs/support/headbg.jpg and /dev/null differ diff --git a/htdocs/theme/.gitignore b/htdocs/theme/.gitignore index fab0672d598..59c154b7d5f 100644 --- a/htdocs/theme/.gitignore +++ b/htdocs/theme/.gitignore @@ -1 +1,3 @@ /bootstrap +/oblyon +/autre diff --git a/htdocs/theme/amarok/img/object_phoning_fax.png b/htdocs/theme/amarok/img/object_phoning_fax.png new file mode 100644 index 00000000000..b1266e84127 Binary files /dev/null and b/htdocs/theme/amarok/img/object_phoning_fax.png differ diff --git a/htdocs/theme/amarok/img/object_resource.png b/htdocs/theme/amarok/img/object_resource.png new file mode 100644 index 00000000000..8cda1f3f220 Binary files /dev/null and b/htdocs/theme/amarok/img/object_resource.png differ diff --git a/htdocs/theme/amarok/style.css.php b/htdocs/theme/amarok/style.css.php index 40d77cfd596..bd41d0735a5 100644 --- a/htdocs/theme/amarok/style.css.php +++ b/htdocs/theme/amarok/style.css.php @@ -298,7 +298,7 @@ div.floatright { float:; } -div.inline-block +.inline-block { display:inline-block; } @@ -347,6 +347,20 @@ th .button { /* ! Message d'erreur lors du login : */ center .error { padding:8px !important; padding-left:26px !important; padding-right:20px; width:inherit; max-width:450px;color:#552323 !important; font-size:14px; border-radius:8px; text-align: left;} +.badge { + display: inline-block; + min-width: 10px; + padding: 2px 5px; + font-size: 10px; + font-weight: 700; + line-height: 0.9em; + color: #fff; + text-align: center; + white-space: nowrap; + vertical-align: baseline; + background-color: #777; + border-radius: 10px; +} /* ============================================================================== */ @@ -2280,6 +2294,14 @@ ul.ulmenu { background-image: -o-linear-gradient( #eee,#e1e1e1 ) !important; background-image: linear-gradient( #eee,#e1e1e1 ) !important; } +.lilevel2 +{ + padding-left: 22px; +} +.lilevel3 +{ + padding-left: 54px; +} global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global- // Define image path files and other constants $fontlist='arial,tahoma,verdana,helvetica'; //$fontlist='Verdana,Helvetica,Arial,sans-serif'; $img_liste_titre=dol_buildpath($path.'/theme/'.$theme.'/img/menus/trtitle.png',1); -$img_head=dol_buildpath($path.'/theme/'.$theme.'/img/headbg2.jpg',1); +$img_head=''; $img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png',1); $dol_hide_topmenu=$conf->dol_hide_topmenu; $dol_hide_leftmenu=$conf->dol_hide_leftmenu; @@ -108,7 +108,7 @@ body { background-color: #FFFFFF; - background: #ffffff url() 0 0 no-repeat; + background-color: #FCFCFC; color: #101010; font-size: px; @@ -184,14 +184,6 @@ legend { margin-bottom: 8px; } padding: 0px 2px 0px 2px; margin: 0px 0px 0px 0px; } -.buttonajax { - font-family: ; - border: 0px; - background-image: url(); - background-position: bottom; - padding: 0px 0px 0px 0px; - margin: 0px 0px 0px 0px; -} form { padding: 0em 0em 0em 0em; margin: 0em 0em 0em 0em; @@ -204,7 +196,7 @@ div.floatright { float:; } -div.inline-block +.inline-block { display:inline-block; } @@ -236,6 +228,21 @@ div.inline-block .cursorpointer { cursor: pointer; } +.badge { + display: inline-block; + min-width: 10px; + padding: 2px 5px; + font-size: 10px; + font-weight: 700; + line-height: 0.9em; + color: #fff; + text-align: center; + white-space: nowrap; + vertical-align: baseline; + background-color: #777; + border-radius: 10px; +} + /* ============================================================================== */ /* Styles to hide objects */ @@ -400,7 +407,7 @@ $mainmenuusedarray=array_unique(explode(',',$mainmenuused)); $mainmenuusedarray=array(); // Disable $generic=1; -$divalreadydefined=array('home','companies','products','commercial','accountancy','project','tools','members','shop','agenda','ecm','cashdesk'); +$divalreadydefined=array('home','companies','products','commercial','accountancy','project','tools','members','agenda','ecm','cashdesk'); foreach($mainmenuusedarray as $val) { if (empty($val) || in_array($val,$divalreadydefined)) continue; @@ -2457,6 +2464,14 @@ ul.ulmenu { background-image: -o-linear-gradient( #eee,#e1e1e1 ) !important; background-image: linear-gradient( #eee,#e1e1e1 ) !important; } +.lilevel2 +{ + padding-left: 22px; +} +.lilevel3 +{ + padding-left: 54px; +} close(); diff --git a/htdocs/theme/bureau2crea/img/menus/shop.png b/htdocs/theme/bureau2crea/img/menus/shop.png deleted file mode 100644 index efd6859ab60..00000000000 Binary files a/htdocs/theme/bureau2crea/img/menus/shop.png and /dev/null differ diff --git a/htdocs/theme/bureau2crea/img/object_phoning_fax.png b/htdocs/theme/bureau2crea/img/object_phoning_fax.png new file mode 100644 index 00000000000..9f5a14edd23 Binary files /dev/null and b/htdocs/theme/bureau2crea/img/object_phoning_fax.png differ diff --git a/htdocs/theme/bureau2crea/img/object_resource.png b/htdocs/theme/bureau2crea/img/object_resource.png new file mode 100644 index 00000000000..8cda1f3f220 Binary files /dev/null and b/htdocs/theme/bureau2crea/img/object_resource.png differ diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index 950b2ce0001..b720bd4a802 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -209,14 +209,6 @@ legend { margin-bottom: 8px; } padding: 0px 2px 0px 2px; margin: 0px 0px 0px 0px; } -.buttonajax { - font-family: ; - border: 0px; - background-image: url(); - background-position: bottom; - padding: 0px 0px 0px 0px; - margin: 0px 0px 0px 0px; -} form { padding: 0em 0em 0em 0em; margin: 0em 0em 0em 0em; @@ -229,7 +221,7 @@ div.floatright { float:; } -div.inline-block +.inline-block { display:inline-block; } @@ -261,6 +253,20 @@ div.inline-block .cursorpointer { cursor: pointer; } +.badge { + display: inline-block; + min-width: 10px; + padding: 2px 5px; + font-size: 10px; + font-weight: 700; + line-height: 0.9em; + color: #fff; + text-align: center; + white-space: nowrap; + vertical-align: baseline; + background-color: #777; + border-radius: 10px; +} /* ============================================================================== */ @@ -432,7 +438,7 @@ $mainmenuusedarray=array_unique(explode(',',$mainmenuused)); $mainmenuusedarray=array(); // Disable $generic=1; -$divalreadydefined=array('home','companies','products','commercial','accountancy','project','tools','members','shop','agenda','ecm','cashdesk'); +$divalreadydefined=array('home','companies','products','commercial','accountancy','project','tools','members','agenda','ecm','cashdesk'); foreach($mainmenuusedarray as $val) { if (empty($val) || in_array($val,$divalreadydefined)) continue; @@ -2624,6 +2630,14 @@ ul.ulmenu { background-image: -o-linear-gradient( #eee,#e1e1e1 ) !important; background-image: linear-gradient( #eee,#e1e1e1 ) !important; } +.lilevel2 +{ + padding-left: 22px; +} +.lilevel3 +{ + padding-left: 54px; +} background-color: #FFFFFF; - /*background: #ffffff url() 0 0 no-repeat;*/ + background-color: #FCFCFC; color: #101010; font-size: px; @@ -185,14 +185,6 @@ legend { margin-bottom: 8px; } padding: 0px 2px 0px 2px; margin: 0px 0px 0px 0px; } -.buttonajax { - font-family: ; - border: 0px; - background-image: url(); - background-position: bottom; - padding: 0px 0px 0px 0px; - margin: 0px 0px 0px 0px; -} form { padding: 0em 0em 0em 0em; margin: 0em 0em 0em 0em; @@ -205,7 +197,7 @@ div.floatright { float:; } -div.inline-block +.inline-block { display:inline-block; } @@ -237,6 +229,20 @@ div.inline-block .cursorpointer { cursor: pointer; } +.badge { + display: inline-block; + min-width: 10px; + padding: 2px 5px; + font-size: 10px; + font-weight: 700; + line-height: 0.9em; + color: #fff; + text-align: center; + white-space: nowrap; + vertical-align: baseline; + background-color: #777; + border-radius: 10px; +} /* ============================================================================== */ @@ -545,10 +551,6 @@ div.mainmenu.tools { background-image: url(); } -div.mainmenu.shop { - background-image: url(); -} - div.mainmenu.google { background-image: url(); } @@ -572,7 +574,7 @@ foreach($conf->modules as $val) $mainmenuusedarray=array_unique(explode(',',$mainmenuused)); $generic=1; -$divalreadydefined=array('home','companies','products','commercial','accountancy','project','tools','members','shop','agenda','ecm','bookmark','cashdesk','geoipmaxmind','gravatar','clicktodial','paypal','webservices'); +$divalreadydefined=array('home','companies','products','commercial','accountancy','project','tools','members','agenda','ecm','bookmark','cashdesk','geoipmaxmind','gravatar','clicktodial','paypal','webservices'); foreach($mainmenuusedarray as $val) { if (empty($val) || in_array($val,$divalreadydefined)) continue; @@ -2535,6 +2537,14 @@ ul.ulmenu { background-image: -o-linear-gradient( #eee,#e1e1e1 ) !important; background-image: linear-gradient( #eee,#e1e1e1 ) !important; } +.lilevel2 +{ + padding-left: 22px; +} +.lilevel3 +{ + padding-left: 54px; +} conf loaded (not done into main because of NOLOGIN constant defined) if (empty($user->id) && ! empty($_SESSION['dol_login'])) $user->fetch('',$_SESSION['dol_login']); @@ -63,8 +64,8 @@ $theme='eldy'; // Value of theme if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; } // Define image path files and other constants -$fontlist='arial,tahoma,verdana,helvetica'; //$fontlist='Verdana,Helvetica,Arial,sans-serif'; -$img_head=dol_buildpath($path.'/theme/'.$theme.'/img/headbg2.jpg',1); +$fontlist='arial,tahoma,verdana,helvetica'; //$fontlist='Helvetica, Verdana, Arial, sans-serif'; +$img_head=''; $img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png',1); $dol_hide_topmenu=$conf->dol_hide_topmenu; $dol_hide_leftmenu=$conf->dol_hide_leftmenu; @@ -99,13 +100,13 @@ $colorbacktitle2=($colred-15).','.($colgreen-15).','.($colblue-15); $colorbacktabcard1=($colred+15).','.($colgreen+16).','.($colblue+17); // card $colorbacktabcard2=($colred-15).','.($colgreen-15).','.($colblue-15); $colorbacktabactive=($colred-15).','.($colgreen-15).','.($colblue-15); -$colorbacklineimpair1=(244+round($isred/3)).','.(244+round($isgreen/3)).','.(244+round($isblue/3)); // line impair -$colorbacklineimpair2=(250+round($isred/3)).','.(250+round($isgreen/3)).','.(250+round($isblue/3)); // line impair -$colorbacklineimpairhover=(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)); // line impair -$colorbacklinepair1='255,255,255'; // line pair -$colorbacklinepair2='255,255,255'; // line pair -$colorbacklinepairhover=(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)); -$colorbackbody='#fcfcfc'; +$colorbacklineimpair1='255,255,255'; // line impair +$colorbacklineimpair2='255,255,255'; // line impair +$colorbacklineimpairhover=(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)); // line impair +$colorbacklinepair1=(244+round($isred/3)).','.(244+round($isgreen/3)).','.(244+round($isblue/3)); // line pair +$colorbacklinepair2=(250+round($isred/3)).','.(250+round($isgreen/3)).','.(250+round($isblue/3)); // line pair +$colorbacklinepairhover=(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)); // line pair +$colorbackbody='#f9f9f9'; $colortext='40,40,40'; $fontsize='12'; $fontsizesmaller='11'; @@ -123,21 +124,16 @@ if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) $conf->global->THEME_ELDY_BACKTABCARD2='210,210,210'; // card $conf->global->THEME_ELDY_BACKTABCARD1='234,234,234'; $conf->global->THEME_ELDY_BACKTABACTIVE='234,234,234'; - //$conf->global->THEME_ELDY_BACKBODY='#ffffff url('.$img_head.') 0 0 no-repeat;'; - $conf->global->THEME_ELDY_BACKBODY='#fcfcfc;'; - $conf->global->THEME_ELDY_LINEPAIR1='242,242,242'; - $conf->global->THEME_ELDY_LINEPAIR2='248,248,248'; - $conf->global->THEME_ELDY_LINEPAIRHOVER='238,246,252'; + $conf->global->THEME_ELDY_BACKBODY='#f9f9f9;'; $conf->global->THEME_ELDY_LINEIMPAIR1='255,255,255'; $conf->global->THEME_ELDY_LINEIMPAIR2='255,255,255'; $conf->global->THEME_ELDY_LINEIMPAIRHOVER='238,246,252'; + $conf->global->THEME_ELDY_LINEPAIR1='242,242,242'; + $conf->global->THEME_ELDY_LINEPAIR2='248,248,248'; + $conf->global->THEME_ELDY_LINEPAIRHOVER='238,246,252'; $conf->global->THEME_ELDY_TEXT='50,50,130'; - if ($dol_use_jmobile) - { - $conf->global->THEME_ELDY_BACKTABCARD1='245,245,245'; // topmenu - $conf->global->THEME_ELDY_BACKTABCARD2='245,245,245'; - $conf->global->THEME_ELDY_BACKTABACTIVE='245,245,245'; - } + $conf->global->THEME_ELDY_FONT_SIZE1='12'; + $conf->global->THEME_ELDY_FONT_SIZE2='11'; } $colorbackhmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$user->conf->THEME_ELDY_TOPMENU_BACK1); @@ -168,6 +164,14 @@ if ((! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) && empty($user->conf-> $colorbacklinepairhover=''; } +// Format color value to match expected format (may be 'FFFFFF' or '255,255,255') +$colorbacktabcard1=join(',',colorStringToArray($colorbacktabcard1)); +$colorbacktabcard2=join(',',colorStringToArray($colorbacktabcard2)); + +// Format color value to match expected format (may be 'FFFFFF' or '255,255,255') +$colorbacktabcard1=join(',',colorStringToArray($colorbacktabcard1)); +$colorbacktabcard2=join(',',colorStringToArray($colorbacktabcard2)); + // Set text color to black or white $tmppart=explode(',',$colorbackhmenu1); $tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); @@ -264,7 +268,7 @@ input, textarea, select { border-top:solid 1px rgba(0,0,0,.3); border-bottom:solid 1px rgba(0,0,0,.2); /* box-shadow: 1px 1px 1px rgba(0,0,0,.2) inset;*/ - padding:2px; + padding:4px; margin-left:1px; margin-bottom:1px; margin-top:1px; @@ -308,46 +312,54 @@ legend { margin-bottom: 8px; } fieldset { border: 1px solid #AAAAAA !important; box-shadow: 2px 2px 3px #DDD; } -.button { +.button, sbmtConnexion { font-family: ; - background-image: url(); - background-position: bottom; - border: 1px solid #C0C0C0; - padding: 0.1em 0.7em; - margin: 0em 0.5em; - -moz-border-radius:0px 5px 0px 5px; - -webkit-border-radius:0px 5px 0px 5px; - border-radius:0px 5px 0px 5px; - -moz-box-shadow: 2px 2px 3px #DDD; - -webkit-box-shadow: 2px 2px 3px #DDD; - box-shadow: 2px 2px 3px #DDD; + border-color: #c5c5c5; + border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); + display: inline-block; + padding: 4px 14px; + margin-bottom: 0; + text-align: center; + cursor: pointer; + color: #333333; + text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); + background-color: #f5f5f5; + background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); + background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); + background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); + background-image: linear-gradient(to bottom, #ffffff, #e6e6e6); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0); + border-color: #e6e6e6 #e6e6e6 #bfbfbf; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + border: 1px solid #bbbbbb; + border-bottom-color: #a2a2a2; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); } .button:focus { - font-family: ; - color: #222244; - background-image: url(); - background-position: bottom; - border: 1px solid #C0C0C0; + -moz-box-shadow: 0px 0px 6px 1px rgba(0, 0, 60, 0.2), 0px 0px 0px rgba(60,60,60,0.1); + -webkit-box-shadow: 0px 0px 6px 1px rgba(0, 0, 60, 0.2), 0px 0px 0px rgba(60,60,60,0.1); + box-shadow: 0px 0px 6px 1px rgba(0, 0, 60, 0.2), 0px 0px 0px rgba(60,60,60,0.1); } .button:hover { - background: #dee7ec; + -moz-box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); + -webkit-box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); + box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); } .button:disabled { - background: #ddd; -} -.buttonajax { - font-family: ; - border: 0px; - background-image: url(); - background-position: bottom; - padding: 0.1em 0.7em; - margin: 0em 0.5em; - -moz-border-radius:0px 5px 0px 5px; - -webkit-border-radius:0px 5px 0px 5px; - border-radius:0px 5px 0px 5px; - -moz-box-shadow: 3px 3px 4px #DDD; - -webkit-box-shadow: 3px 3px 4px #DDD; - box-shadow: 3px 3px 4px #DDD; + opacity: 0.4; + filter: alpha(opacity=40); /* For IE8 and earlier */ + box-shadow: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + cursor: auto; } form { padding:0px; @@ -402,12 +414,33 @@ th .button { .cursorpointer { cursor: pointer; } +.badge { + display: inline-block; + min-width: 10px; + padding: 2px 5px; + font-size: 10px; + font-weight: 700; + line-height: 0.9em; + color: #fff; + text-align: center; + white-space: nowrap; + vertical-align: baseline; + background-color: #777; + border-radius: 10px; +} + +.borderrightlight +{ + border-right: 1px solid #DDD; +} /* ============================================================================== */ /* Styles to hide objects */ /* ============================================================================== */ .hideobject { display: none; } +.minwidth100 { min-width: 100px; } +.minwidth200 { min-width: 200px; } .hideonsmartphone { display: none; } .noenlargeonsmartphone { width : 50px !important; display: inline !important; } @@ -499,8 +532,8 @@ margin : 0px auto; div#tmenu_tooltip { @@ -671,16 +704,10 @@ div.mainmenu.bank { background-image: url(); } -div.mainmenu.bookmark { -} - div.mainmenu.cashdesk { background-image: url(); } -div.mainmenu.click2dial { -} - div.mainmenu.companies { background-image: url(); } @@ -701,12 +728,6 @@ div.mainmenu.ftp { background-image: url(); } -div.mainmenu.gravatar { -} - -div.mainmenu.geopipmaxmind { -} - div.mainmenu.hrm { background-image: url(); } @@ -715,9 +736,6 @@ div.mainmenu.members { background-image: url(); } -div.mainmenu.paypal { -} - div.mainmenu.products { background-image: url(); margin-left: 10px; @@ -731,18 +749,6 @@ div.mainmenu.tools { background-image: url(); } -div.mainmenu.shop { - background-image: url(); -} - -div.mainmenu.webservices { -} - -div.mainmenu.google { - background-image: url(); -} - - 'name of class for div') @@ -762,7 +768,7 @@ foreach($conf->modules as $val) $mainmenuusedarray=array_unique(explode(',',$mainmenuused)); $generic=1; -$divalreadydefined=array('home','companies','products','commercial','accountancy','project','tools','members','shop','agenda','holiday','bookmark','cashdesk','ecm','geoipmaxmind','gravatar','clicktodial','paypal','webservices'); +$divalreadydefined=array('home','companies','products','commercial','accountancy','project','tools','members','agenda','holiday','bookmark','cashdesk','ecm','geoipmaxmind','gravatar','clicktodial','paypal','webservices'); foreach($mainmenuusedarray as $val) { if (empty($val) || in_array($val,$divalreadydefined)) continue; @@ -812,7 +818,13 @@ foreach($mainmenuusedarray as $val) .bodylogin { - background: #ffffff url() 0 0 no-repeat; + background: #f0f0f0; + /* -moz-box-shadow: inset 0 0 10px #000000; + -webkit-box-shadow: inset 0 0 10px #000000; + box-shadow: inset 0 0 10px #000000; */ +} +.login_vertical_align { + padding: 10px; } form#login { margin-top: px; @@ -821,7 +833,7 @@ form#login { vertical-align: middle; } .login_table_title { - max-width: 540px; + max-width: 530px; color: #888888; text-shadow: 1px 1px 1px #FFF; } @@ -833,36 +845,51 @@ form#login { margin-right: 10px; padding-left:6px; padding-right:6px; - padding-top:12px; + padding-top:16px; padding-bottom:12px; - max-width: 540px; - border: 1px solid #C0C0C0; - background-color: #E0E0E0; + max-width: 560px; - -moz-box-shadow: 3px 3px 4px #DDD; - -webkit-box-shadow: 3px 3px 4px #DDD; - box-shadow: 3px 3px 4px #DDD; + background-color: #FFFFFF; + + -moz-box-shadow: 0 4px 23px 5px rgba(0, 0, 0, 0.2), 0 2px 6px rgba(60,60,60,0.15); + -webkit-box-shadow: 0 4px 23px 5px rgba(0, 0, 0, 0.2), 0 2px 6px rgba(60,60,60,0.15); + box-shadow: 0 4px 23px 5px rgba(0, 0, 0, 0.2), 0 2px 6px rgba(60,60,60,0.15); + /*-moz-box-shadow: 3px 2px 20px #CCC; + -webkit-box-shadow: 3px 2px 20px #CCC; + box-shadow: 3px 2px 20px #CCC;*/ border-radius: 8px; - border:solid 1px rgba(168,168,168,.4); + border:solid 1px rgba(80,80,80,.4); + border-top:solid 1px f8f8f8; + /* background-color: #f8f8f8; background-image: -o-linear-gradient(top, rgba(250,250,250,.6) 0%, rgba(192,192,192,.3) 100%); background-image: -moz-linear-gradient(top, rgba(250,250,250,.6) 0%, rgba(192,192,192,.3) 100%); background-image: -webkit-linear-gradient(top, rgba(250,250,250,.6) 0%, rgba(192,192,192,.3) 100%); background-image: -ms-linear-gradient(top, rgba(250,250,250,.6) 0%, rgba(192,192,192,.3) 100%); background-image: linear-gradient(top, rgba(250,250,250,.6) 0%, rgba(192,192,192,.3) 100%); + */ } div#login_left, div#login_right { display: inline-block; min-width: 245px; padding-top: 10px; + padding-left: 16px; + padding-right: 16px; text-align: center; vertical-align: middle; } table.login_table tr td table.none tr td { padding: 2px; } +table.login_table_securitycode { + border-spacing: 0px; +} +table.login_table_securitycode tr td { + padding-left: 0px; + padding-right: 4px; +} #securitycode { min-width: 60px; } @@ -923,6 +950,18 @@ img.login, img.printer, img.entity { font-weight: bold; } +.span-icon-user { + background: url() no-repeat scroll 7px 7px; +} +.span-icon-password { + background-image: url(); + background-repeat: no-repeat; +} +/* +.span-icon-user input, .span-icon-password input { + margin-right: 30px; +} +*/ /* ============================================================================== */ /* Menu gauche */ @@ -983,10 +1022,10 @@ div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks background-position:top; background-repeat:repeat-x; - border-left: 1px solid #CCCCCC; - border-right: 1px solid #D0D0D0; - border-bottom: 1px solid #DDDDDD; - border-top: 1px solid #DDDDDD; + border-left: 1px solid #AAA; + border-right: 1px solid #BBB; + border-bottom: 1px solid #BBB; + border-top: 1px solid #BBB; border-radius: 5px; -moz-border-radius: 5px; -moz-box-shadow: 3px 3px 4px #DDD; @@ -1015,10 +1054,10 @@ div.blockvmenusearch background-image: linear-gradient(bottom, rgb() 90%, rgb() 100%); - border-left: 1px solid #DDDDDD; - border-right: 1px solid #CCCCCC; - border-bottom: 1px solid #CCCCCC; - border-top: 1px solid #E8E8E8; + border-left: 1px solid #AAA; + border-right: 1px solid #CCC; + border-bottom: 1px solid #CCC; + border-top: 1px solid #CCC; border-radius: 5px; -moz-border-radius: 5px; -moz-box-shadow: 3px 3px 4px #DDD; @@ -1026,39 +1065,6 @@ div.blockvmenusearch box-shadow: 3px 3px 4px #DDD; } -div.blockvmenubookmarksold -{ - border-right: 1px solid #555555; - border-bottom: 1px solid #555555; - font-family: ; - color: #000000; - text-align: ; - text-decoration: none; - padding-left: 5px; - padding-right: 1px; - padding-top: 3px; - padding-bottom: 3px; - margin: 6px 0px 8px 2px; - background: #E3E6E8; - - - background-image: -o-linear-gradient(bottom, rgb() 90%, rgb() 100%); - background-image: -moz-linear-gradient(bottom, rgb() 90%, rgb() 100%); - background-image: -webkit-linear-gradient(bottom, rgb() 90%, rgb() 100%); - background-image: -ms-linear-gradient(bottom, rgb() 90%, rgb() 100%); - background-image: linear-gradient(bottom, rgb() 90%, rgb() 100%); - - - border-left: 1px solid #CCCCCC; - border-right: 1px solid #BBBBBB; - border-bottom: 1px solid #BBBBBB; - border-radius: 5px; - -moz-border-radius: 5px; - -moz-box-shadow: 3px 3px 4px #DDD; - -webkit-box-shadow: 3px 3px 4px #DDD; - box-shadow: 3px 3px 4px #DDD; -} - div.blockvmenuhelp { dol_optimize_smallscreen)) { ?> @@ -1357,7 +1363,8 @@ div.tabs { /* margin: 0px 0px 2px 6px; padding: 0px 6px 3px 0px; */ text-align: ; - margin-left: 4px !important; + margin-left: 6px !important; + margin-right: 6px !important; clear:both; height:100%; } @@ -1373,10 +1380,10 @@ div.tabBar { -moz-border-radius:6px; -webkit-border-radius: 6px; border-radius: 6px; - border-right: 1px solid #CCCCCC; - border-bottom: 1px solid #CCCCCC; - border-left: 1px solid #D0D0D0; - border-top: 1px solid #D8D8D8; + border-right: 1px solid #BBB; + border-bottom: 1px solid #BBB; + border-left: 1px solid #BBB; + border-top: 1px solid #CCC; width: auto; background-image: -o-linear-gradient(bottom, rgba(, 0.5) 25%, rgba(, 0.5) 100%); @@ -1432,9 +1439,9 @@ a.tab:link, a.tab:visited, a.tab:hover, a.tab#active { box-shadow: 0 -1px 4px rgba(0,0,0,.1); border-bottom: none; - border-right: 1px solid #CCCCCC; - border-left: 1px solid #D0D0D0; - border-top: 1px solid #D8D8D8; + border-right: 1px solid #BBB; + border-left: 1px solid #BBB; + border-top: 1px solid #CCC; background-image: -o-linear-gradient(bottom, rgb() 35%, rgb() 100%); @@ -1501,15 +1508,16 @@ span.tabspan { div.divButAction { margin-bottom: 1.4em; } .butAction, .butAction:link, .butAction:visited, .butAction:hover, .butAction:active, .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active { - font-family: ; - font-weight: bold; - background: white; - border: 1px solid #8CACBB; - color: #434956; text-decoration: none; white-space: nowrap; padding: 0.4em em; margin: 0em em; + font-family: ; + + font-weight: bold; + background: white; + border: 1px solid #8CACBB; + color: #434956; -moz-border-radius:0px 5px 0px 5px; -webkit-border-radius:0px 5px 0px 5px; border-radius:0px 5px 0px 5px; @@ -1531,16 +1539,17 @@ div.divButAction { margin-bottom: 1.4em; } } .butActionRefused { - font-family: !important; + text-decoration: none !important; + white-space: nowrap !important; + cursor: not-allowed; + padding: 0.4em em; + margin: 0em em; + font-family: !important; + font-weight: bold !important; background: white !important; border: 1px solid #AAAAAA !important; color: #AAAAAA !important; - text-decoration: none !important; - white-space: nowrap !important; - cursor: not-allowed; - padding: 0.4em 0.7em; - margin: 0em 0.7em; -moz-border-radius:0px 5px 0px 5px; -webkit-border-radius:0px 5px 0px 5px; border-radius:0px 5px 0px 5px; @@ -1559,6 +1568,77 @@ span.butAction, span.butActionDelete { cursor: pointer; } +/* Preapre for bootstrap look +.butAction, .butActionDelete, .butActionRefused { + border-color: #c5c5c5; + border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); + display: inline-block; + padding: 4px 14px; + margin-bottom: 0; + line-height: 20px; + text-align: center; + vertical-align: middle; + cursor: pointer; + color: #333333; + text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); + background-color: #f5f5f5; + background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); + background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); + background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); + background-image: linear-gradient(to bottom, #ffffff, #e6e6e6); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0); + border-color: #e6e6e6 #e6e6e6 #bfbfbf; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + border: 1px solid #bbbbbb; + border-bottom-color: #a2a2a2; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); +} + +.butAction { + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + background-color: #006dcc; + background-image: -moz-linear-gradient(top, #0088cc, #0044cc); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); + background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); + background-image: -o-linear-gradient(top, #0088cc, #0044cc); + background-image: linear-gradient(to bottom, #0088cc, #0044cc); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0); + border-color: #0044cc #0044cc #002a80; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); +} + +.butActionDelete { + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + background-color: #cc6d00; + background-image: -moz-linear-gradient(top, #cc8800, #cc4400); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#cc8800), to(#cc4400)); + background-image: -webkit-linear-gradient(top, #cc8800, #cc4400); + background-image: -o-linear-gradient(top, #cc8800, #cc4400); + background-image: linear-gradient(to bottom, #cc8800, #cc4400); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffcc8800', endColorstr='#ffcc4400', GradientType=0); + border-color: #cc4400 #cc4400 #802a00; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); +} +a.butAction:link, a.butAction:visited, a.butAction:hover, a.butAction:active { + color: #FFFFFF; +} +End bootstrap */ + + /* ============================================================================== */ /* Tables */ @@ -1614,7 +1694,7 @@ table.border, table.dataTable, .table-border, .table-border-col, .table-key-bord } table.border td, div.border div div.tagtd { - padding: 1px 2px 1px 2px; + padding: 2px 2px 2px 2px; border: 1px solid #D0D0D0; border-collapse: collapse; } @@ -1647,7 +1727,7 @@ table.noborder, table.formdoc, div.noborder { border-right-style: solid; border-left-width: 1px; - border-left-color: #CCCCCC; + border-left-color: #B0B0B0; border-left-style: solid; border-bottom-width: 1px; @@ -1757,7 +1837,7 @@ table.liste td { } */ -.impair:hover { +.impair:hover, td.nohover { background: rgb(); @@ -1768,13 +1848,13 @@ table.liste td { .impair, .nohover .impair:hover, tr.impair td.nohover { - background: linear-gradient(bottom, rgb() 85%, rgb() 100%) !important; - background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%) !important; - background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%) !important; - background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%) !important; - background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%) !important; + background: linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: #eaeaea !important; + background: #eaeaea; font-family: ; border: 0px; @@ -1783,24 +1863,24 @@ table.liste td { min-height: 18px; /* seems to not be used */ } -td.nohover, .pair:hover { +.pair:hover { - background: rgb() !important; + background: rgb(); - background: #fafafa !important; + background: #fafafa; border: 0px; } .pair, .nohover .pair:hover, tr.pair td.nohover { - background: linear-gradient(bottom, rgb() 85%, rgb() 100%) !important; - background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%) !important; - background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%) !important; - background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%) !important; - background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%) !important; + background: linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: #ffffff !important; + background: #ffffff; font-family: ; border: 0px; @@ -1876,6 +1956,10 @@ input.liste_titre { background: none; } +.margintable td { + border: 0px !important; +} + /* Disable shadows */ .noshadow { -moz-box-shadow: 0px 0px 0px #DDD !important; @@ -1894,18 +1978,6 @@ div.tabBar .noborder { * Boxes */ -.tdboxstats { - - background: -o-linear-gradient(bottom, rgb() 85%, rgb() 120%) !important; - background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 120%) !important; - background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 120%) !important; - background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 120%) !important; - background: linear-gradient(bottom, rgb() 85%, rgb() 120%) !important; - - background: #ffffff !important; - -} - .boxstats { margin: 3px; @@ -2078,9 +2150,11 @@ div.dolgraph div.legend, div.dolgraph div.legend div { background-color: rgba(25 div.dolgraph div.legend table tbody tr { height: auto; } .photo { -border: 0px; -/* filter:alpha(opacity=55); */ -/* opacity:.55; */ + border: 0px; +} +.photowithmargin { + margin-bottom: 2px; + margin-top: 2px; } .logo_setup @@ -2324,13 +2398,13 @@ table.cal_month { border-spacing: 0px; } .cal_past_month { opacity: 0.6; background: #EEEEEE; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_current_month { background: #FFFFFF; border-left: solid 1px #E0E0E0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_current_month_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } -.cal_today { background: #FFFFFF; border: solid 2px #6C7C7B; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } -.cal_today_peruser { background: #FFFFFF; border-right: solid 1px #6C7C7B; border-top: solid 1px #A0A0A0; border-bottom: solid 1px #A0A0A0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } -.cal_today_peruser_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; border-top: solid 1px #A0A0A0; border-right: solid 1px #6C7C7B; border-bottom: solid 1px #A0A0A0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_today { background: #FDFDF0; border-left: solid 1px #E0E0E0; border-bottom: solid 1px #E0E0E0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_today_peruser { background: #FDFDF0; border-right: solid 1px #E0E0E0; border-bottom: solid 1px #E0E0E0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_today_peruser_peruserleft { background: #FDFDF0; border-left: solid 3px #6C7C7B; border-right: solid 1px #E0E0E0; border-bottom: solid 1px #E0E0E0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_past { } .cal_peruser { padding: 0px; } .peruser_busy { background: #CC8888; } -.peruser_notbusy { background: #EEDDDD; } +.peruser_notbusy { background: #EEDDDD; opacity: 0.5; } table.cal_event { border: none; border-collapse: collapse; margin-bottom: 1px; -webkit-border-radius: 6px; border-radius: 6px; -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25); moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25); @@ -2346,6 +2420,11 @@ li.cal_event { border: none; list-style-type: none; } .cal_event a:active { color: #111111; font-size: 11px; font-weight: normal !important; } .cal_event a:hover { color: #111111; font-size: 11px; font-weight: normal !important; color:rgba(255,255,255,.75); } .cal_event_busy { } +.cal_peruserviewname { max-width: 100px; height: 22px; } + +.topmenuimage { + background-size: 28px auto; +} /* ============================================================================== */ /* Ajax - Liste deroulante de l'autocompletion */ @@ -2378,6 +2457,7 @@ li.cal_event { border: none; list-style-type: none; } cursor:pointer; } + /* ============================================================================== */ /* jQuery - jeditable */ /* ============================================================================== */ @@ -2566,7 +2646,7 @@ A.none, A.none:active, A.none:visited, A.none:hover { { line-height: 1em !important; } -.ui-autocomplete-input { margin: 0; padding: 2px; } +.ui-autocomplete-input { margin: 0; padding: 4px; } /* ============================================================================== */ @@ -2834,6 +2914,38 @@ div.dolEventError h1, div.dolEventError h2 { background-image: none; } +/* ============================================================================== */ +/* Select2 */ +/* ============================================================================== */ + +.select2-choice, +.select2-drop.select2-drop-above.select2-drop-active, +.select2-container-active .select2-choice, +.select2-container-active .select2-choices, +.select2-dropdown-open.select2-drop-above .select2-choice, +.select2-dropdown-open.select2-drop-above .select2-choices, +.select2-container-multi.select2-container-active .select2-choices +{ + border: 1px solid #aaa; +} + +.select2-drop-active +{ + border: 1px solid #aaa; + border-top: none; +} +a span.select2-chosen +{ + font-weight: normal !important; +} +.select2-container .select2-choice { + background-image: none; +} +.select2-results .select2-no-results, .select2-results .select2-searching, .select2-results .select2-ajax-error, .select2-results .select2-selection-limit +{ + background: #FFFFFF; +} + /* ============================================================================== */ /* JMobile */ @@ -2918,9 +3030,9 @@ a.ui-link { } /* Warning: setting this may make screen not beeing refreshed after a combo selection */ -.ui-body-c { +/*.ui-body-c { background: #fff; -} +}*/ div.ui-radio, div.ui-checkbox { @@ -3008,6 +3120,14 @@ border-top-right-radius: 6px; background-image: -o-linear-gradient( #ddd,#d1d1d1 ) !important; background-image: linear-gradient( #ddd,#d1d1d1 ) !important; } +.lilevel2 +{ + padding-left: 22px; +} +.lilevel3 +{ + padding-left: 54px; +} close(); diff --git a/htdocs/user/admin/group_extrafields.php b/htdocs/user/admin/group_extrafields.php new file mode 100644 index 00000000000..dbb9e863af4 --- /dev/null +++ b/htdocs/user/admin/group_extrafields.php @@ -0,0 +1,155 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2014 Alexis Algoud + * + * 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 . + */ + +/** + * \file htdocs/adherents/admin/adherent_extrafields.php + * \ingroup member + * \brief Page to setup extra fields of members + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + +$langs->load("users"); +$langs->load("admin"); + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label=ExtraFields::$type2label; +$type2label=array(''); +foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); + +$action=GETPOST('action', 'alpha'); +$attrname=GETPOST('attrname', 'alpha'); +$elementtype='usergroup'; //Must be the $table_element of the class that manage extrafield + +if (!$user->admin) accessforbidden(); + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + +$textobject=$langs->transnoentitiesnoconv("Groups"); + +$help_url='EN:Module_Users|FR:Module_Utilisateurs|ES:Módulo_Usuarios'; +llxHeader('',$langs->trans("UsersSetup"),$help_url); + + +$linkback=''.$langs->trans("BackToModuleList").''; +print_fiche_titre($langs->trans("UsersSetup"),$linkback,'setup'); + + +$head = user_admin_prepare_head(); + +dol_fiche_head($head, 'attributes_group', $langs->trans("Group"), 0, 'user'); + + +print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
    '."\n"; +print '
    '; + +// Load attribute_label +$extrafields->fetch_name_optionals_label($elementtype); + +print "
    "; print $memberstatic->getNomUrl(1); print "rowid\">"; + print "rowid\">"; print ((! empty($objp->lastname) || ! empty($objp->firstname)) ? dol_trunc($memberstatic->getFullName($langs)) : ''); print (((! empty($objp->lastname) || ! empty($objp->firstname)) && ! empty($companyname)) ? ' / ' : ''); print (! empty($companyname) ? dol_trunc($companyname, 32) : ''); print "".$objp->login."'; print $membertypestatic->getNomUrl(1,32); print '".$memberstatic->getmorphylib($objp->morphy)."".dol_print_email($objp->email,0,0,1)."'; print $memberstatic->LibStatut($objp->statut,$objp->cotisation,$datefin,2); print "
    "; + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; + +$var=True; +foreach($extrafields->attribute_type as $key => $value) +{ + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\n"; + print '\n"; + print '\n"; + print '\n"; + print '\n"; + print ""; + // $i++; +} + +print "
    '.$langs->trans("Label").''.$langs->trans("AttributeCode").''.$langs->trans("Type").''.$langs->trans("Size").''.$langs->trans("Unique").''.$langs->trans("Required").' 
    ".$extrafields->attribute_label[$key]."".$key."".$type2label[$extrafields->attribute_type[$key]]."'.$extrafields->attribute_size[$key]."'.yn($extrafields->attribute_unique[$key])."'.yn($extrafields->attribute_required[$key])."'.img_edit().''; + print "  ".img_delete()."
    "; + +dol_fiche_end(); + + +// Buttons +if ($action != 'create' && $action != 'edit') +{ + print '
    '; + print "".$langs->trans("NewAttribute").""; + print "
    "; +} + + +/* ************************************************************************** */ +/* */ +/* Creation d'un champ optionnel + /* */ +/* ************************************************************************** */ + +if ($action == 'create') +{ + print "
    "; + print_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +/* ************************************************************************** */ +/* */ +/* Edition d'un champ optionnel */ +/* */ +/* ************************************************************************** */ +if ($action == 'edit' && ! empty($attrname)) +{ + print "
    "; + print_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +llxFooter(); + +$db->close(); diff --git a/htdocs/user/agenda_extsites.php b/htdocs/user/agenda_extsites.php index 4109e7ab9a4..e46647f3b69 100644 --- a/htdocs/user/agenda_extsites.php +++ b/htdocs/user/agenda_extsites.php @@ -46,7 +46,7 @@ $actionsave=GETPOST('save','alpha'); if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5; $MAXAGENDA=empty($conf->global->AGENDA_EXT_NB)?5:$conf->global->AGENDA_EXT_NB; -// List of aviable colors +// List of available colors $colorlist=array('BECEDD','DDBECE','BFDDBE','F598B4','F68654','CBF654','A4A4A5'); // Security check @@ -122,6 +122,10 @@ $arrayofcss=array(); llxHeader('',$langs->trans("UserSetup"),'','',0,0,$arrayofjs,$arrayofcss); + +print '
    '; +print ''; + $head=user_prepare_head($fuser); dol_fiche_head($head, 'extsites', $langs->trans("User"), 0, 'user'); @@ -129,9 +133,6 @@ dol_fiche_head($head, 'extsites', $langs->trans("User"), 0, 'user'); print $langs->trans("AgendaExtSitesDesc")."
    \n"; print "
    \n"; -print ''; -print ''; - $selectedvalue=$conf->global->AGENDA_DISABLE_EXT; if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1; @@ -172,15 +173,15 @@ while ($i <= $MAXAGENDA) } print ''; -print '
    '; -print '
    '; +dol_fiche_end(); + +print '
    '; print "trans("Save")."\">"; -print "
    "; +print "
    "; print "\n"; -dol_fiche_end(); llxFooter(); diff --git a/htdocs/user/fiche.php b/htdocs/user/card.php similarity index 92% rename from htdocs/user/fiche.php rename to htdocs/user/card.php index ffe6336bc41..fe86717a4c9 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/card.php @@ -25,7 +25,7 @@ */ /** - * \file htdocs/user/fiche.php + * \file htdocs/user/card.php * \brief Tab of user card */ @@ -36,6 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; if (! empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; if (! empty($conf->multicompany->enabled)) dol_include_once('/multicompany/class/actions_multicompany.class.php'); @@ -89,7 +90,7 @@ $extrafields = new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('usercard')); +$hookmanager->initHooks(array('usercard','globalcard')); @@ -154,7 +155,7 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $candisableuser) } } -// Action ajout user +// Action Add user if ($action == 'add' && $canadduser) { $error = 0; @@ -206,6 +207,8 @@ if ($action == 'add' && $canadduser) $object->salaryextra = GETPOST("salaryextra")!=''?GETPOST("salaryextra"):''; $object->weeklyhours = GETPOST("weeklyhours")!=''?GETPOST("weeklyhours"):''; + $object->color = GETPOST("color")!=''?GETPOST("color"):''; + // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); @@ -258,7 +261,7 @@ if ($action == 'add' && $canadduser) } } -// Action ajout groupe utilisateur +// Action add usergroup if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield) { if ($group) @@ -351,6 +354,8 @@ if ($action == 'update' && ! $_POST["cancel"]) $object->salaryextra = GETPOST("salaryextra")!=''?GETPOST("salaryextra"):''; $object->weeklyhours = GETPOST("weeklyhours")!=''?GETPOST("weeklyhours"):''; + $object->color = GETPOST("color")!=''?GETPOST("color"):''; + // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); @@ -589,6 +594,7 @@ if ($action == 'adduserldap') */ $form = new Form($db); +$formother=new FormOther($db); llxHeader('',$langs->trans("UserCard")); @@ -670,7 +676,7 @@ if (($action == 'create') || ($action == 'adduserldap')) setEventMessage($ldap->error, 'errors'); } - // Si la liste des users est rempli, on affiche la liste deroulante + // If user list is full, we show drop-down list print "\n\n\n"; print '
    '; @@ -767,7 +773,7 @@ if (($action == 'create') || ($action == 'adduserldap')) } $password=$generated_password; - // Mot de passe + // Password print ''.$langs->trans("Password").''; print ''; if (! empty($ldap_sid)) @@ -789,7 +795,7 @@ if (($action == 'create') || ($action == 'adduserldap')) } print ''; - // Administrateur + // Administrator if (! empty($user->admin)) { print ''.$langs->trans("Administrator").''; @@ -975,6 +981,15 @@ if (($action == 'create') || ($action == 'adduserldap')) print ''; print "\n"; + // User color + if (! empty($conf->agenda->enabled)) + { + print ''.$langs->trans("ColorUser").''; + print ''; + print $formother->selectColor(GETPOST('color')?GETPOST('color'):$object->color, 'color', 'usercolorconfig', 1, '', 'hideifnotset'); + print ''; + } + // Note print ''; print $langs->trans("Note"); @@ -994,7 +1009,7 @@ if (($action == 'create') || ($action == 'adduserldap')) print "\n"; - print '

    '; + print '
    '; print "
    "; } @@ -1002,7 +1017,7 @@ else { /* ************************************************************************** */ /* */ - /* Visu et edition */ + /* View and edition */ /* */ /* ************************************************************************** */ @@ -1032,7 +1047,7 @@ else $userDisabled = 0; $statutUACF = ''; - //On verifie les options du compte + // Check options of user account if (count($ldap->uacf) > 0) { foreach ($ldap->uacf as $key => $statut) @@ -1068,7 +1083,7 @@ else */ if ($action == 'password') { - print $form->formconfirm("fiche.php?id=$object->id",$langs->trans("ReinitPassword"),$langs->trans("ConfirmReinitPassword",$object->login),"confirm_password", '', 0, 1); + print $form->formconfirm("card.php?id=$object->id",$langs->trans("ReinitPassword"),$langs->trans("ConfirmReinitPassword",$object->login),"confirm_password", '', 0, 1); } /* @@ -1076,23 +1091,23 @@ else */ if ($action == 'passwordsend') { - print $form->formconfirm("fiche.php?id=$object->id",$langs->trans("SendNewPassword"),$langs->trans("ConfirmSendNewPassword",$object->login),"confirm_passwordsend", '', 0, 1); + print $form->formconfirm("card.php?id=$object->id",$langs->trans("SendNewPassword"),$langs->trans("ConfirmSendNewPassword",$object->login),"confirm_passwordsend", '', 0, 1); } /* - * Confirmation desactivation + * Confirm deactivation */ if ($action == 'disable') { - print $form->formconfirm("fiche.php?id=$object->id",$langs->trans("DisableAUser"),$langs->trans("ConfirmDisableUser",$object->login),"confirm_disable", '', 0, 1); + print $form->formconfirm("card.php?id=$object->id",$langs->trans("DisableAUser"),$langs->trans("ConfirmDisableUser",$object->login),"confirm_disable", '', 0, 1); } /* - * Confirmation activation + * Confirm activation */ if ($action == 'enable') { - print $form->formconfirm("fiche.php?id=$object->id",$langs->trans("EnableAUser"),$langs->trans("ConfirmEnableUser",$object->login),"confirm_enable", '', 0, 1); + print $form->formconfirm("card.php?id=$object->id",$langs->trans("EnableAUser"),$langs->trans("ConfirmEnableUser",$object->login),"confirm_enable", '', 0, 1); } /* @@ -1100,7 +1115,7 @@ else */ if ($action == 'delete') { - print $form->formconfirm("fiche.php?id=$object->id",$langs->trans("DeleteAUser"),$langs->trans("ConfirmDeleteUser",$object->login),"confirm_delete", '', 0, 1); + print $form->formconfirm("card.php?id=$object->id",$langs->trans("DeleteAUser"),$langs->trans("ConfirmDeleteUser",$object->login),"confirm_delete", '', 0, 1); } /* @@ -1108,13 +1123,13 @@ else */ if ($action != 'edit') { - $rowspan=16; + $rowspan=17; print ''; // Ref print ''; - print ''; print ''."\n"; @@ -1123,10 +1138,12 @@ else if (! empty($conf->societe->enabled)) $rowspan++; if (! empty($conf->adherent->enabled)) $rowspan++; if (! empty($conf->skype->enabled)) $rowspan++; + if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) $rowspan = $rowspan+3; + if (! empty($conf->agenda->enabled)) $rowspan++; // Lastname print ''; - print ''; + print ''; // Photo print ''; - print ''; + print ''; print ''."\n"; // Position/Job print ''; - print ''; + print ''; print ''."\n"; // Login print ''; if (! empty($object->ldap_sid) && $object->statut==0) { - print ''; + print ''; } else { - print ''; + print ''; } print ''."\n"; @@ -1163,24 +1180,24 @@ else { if ($passDoNotExpire) { - print ''; + print ''; } else if($userChangePassNextLogon) { - print ''; + print ''; } else if($userDisabled) { - print ''; + print ''; } else { - print ''; + print ''; } } else { - print ''."\n"; // Administrator - print ''."\n"; // Type - print ''."\n"; } // Tel pro print ''; - print ''; + print ''; print ''."\n"; // Tel mobile print ''; - print ''; + print ''; print ''."\n"; // Fax print ''; - print ''; + print ''; print ''."\n"; // Skype if (! empty($conf->skype->enabled)) { - print ''; - print ''; + print ''; + print ''; print "\n"; } // EMail print ''; - print ''; + print ''; print "\n"; // Signature - print '\n"; // Hierarchy print ''; - print ''; print "\n"; - if ($conf->salaries->enabled && ! empty($user->rights->salaries->read)) + if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) { $langs->load("salaries"); // THM print ''; - print ''; print "\n"; // TJM print ''; - print ''; print "\n"; // Salary print ''; - print ''; print "\n"; @@ -1296,7 +1313,7 @@ else // Weeklyhours print ''; - print ''; print "\n"; @@ -1306,28 +1323,38 @@ else { $rowspan++; print ''; - print ''; + print ''; + } + + // Color user + if (! empty($conf->agenda->enabled)) + { + print ''; + print ''; + print "\n"; } // Status print ''; - print ''; print ''."\n"; print ''; - print ''; + print ''; print "\n"; print ''; - print ''; + print ''; print "\n"; if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) { print ''; - print ''; + print ''; print "\n"; } @@ -1335,7 +1362,7 @@ else if (! empty($conf->societe->enabled)) { print ''; - print ''; print ''."\n"; @@ -1363,7 +1390,7 @@ else { $langs->load("members"); print ''; - print ''; @@ -1957,7 +1987,7 @@ else print ''; print "\n"; - if ($conf->salaries->enabled && ! empty($user->rights->salaries->read)) + if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) { $langs->load("salaries"); @@ -2009,6 +2039,15 @@ else print ""; } + // User color + if (! empty($conf->agenda->enabled)) + { + print ''; + print ''; + } + // Status print ''; print '
    '.$langs->trans("Ref").''; + print ''; print $form->showrefnav($object,'id','',$user->rights->user->user->lire || $user->admin); print '
    '.$langs->trans("Lastname").''.$object->lastname.''.$object->lastname.''; @@ -1137,23 +1154,23 @@ else // Firstname print '
    '.$langs->trans("Firstname").''.$object->firstname.''.$object->firstname.'
    '.$langs->trans("PostOrFunction").''.$object->job.''.$object->job.'
    '.$langs->trans("Login").''.$langs->trans("LoginAccountDisableInDolibarr").''.$langs->trans("LoginAccountDisableInDolibarr").''.$object->login.''.$object->login.'
    '.$langs->trans("LdapUacf_".$statutUACF).''.$langs->trans("LdapUacf_".$statutUACF).''.$langs->trans("UserMustChangePassNextLogon",$ldap->domainFQDN).''.$langs->trans("UserMustChangePassNextLogon",$ldap->domainFQDN).''.$langs->trans("LdapUacf_".$statutUACF,$ldap->domainFQDN).''.$langs->trans("LdapUacf_".$statutUACF,$ldap->domainFQDN).''.$langs->trans("DomainPassword").''.$langs->trans("DomainPassword").''; + print ''; if ($object->pass) print preg_replace('/./i','*',$object->pass); else { @@ -1192,7 +1209,7 @@ else print '
    '.$langs->trans("Administrator").''; + print '
    '.$langs->trans("Administrator").''; if (! empty($conf->multicompany->enabled) && $object->admin && ! $object->entity) { print $form->textwithpicto(yn($object->admin),$langs->trans("SuperAdministratorDesc"),1,"superadmin"); @@ -1208,7 +1225,7 @@ else print '
    '.$langs->trans("Type").''; + print '
    '.$langs->trans("Type").''; $type=$langs->trans("Internal"); if ($object->societe_id) $type=$langs->trans("External"); print $form->textwithpicto($type,$langs->trans("InternalExternalDesc")); @@ -1218,47 +1235,47 @@ else // Ldap sid if ($object->ldap_sid) { - print '
    '.$langs->trans("Type").''; + print '
    '.$langs->trans("Type").''; print $langs->trans("DomainUser",$ldap->domainFQDN); print '
    '.$langs->trans("PhonePro").''.dol_print_phone($object->office_phone,'',0,0,1).''.dol_print_phone($object->office_phone,'',0,0,1).'
    '.$langs->trans("PhoneMobile").''.dol_print_phone($object->user_mobile,'',0,0,1).''.dol_print_phone($object->user_mobile,'',0,0,1).'
    '.$langs->trans("Fax").''.dol_print_phone($object->office_fax,'',0,0,1).''.dol_print_phone($object->office_fax,'',0,0,1).'
    '.$langs->trans("Skype").''.dol_print_skype($object->skype,0,0,1).'
    '.$langs->trans("Skype").''.dol_print_skype($object->skype,0,0,1).'
    '.$langs->trans("EMail").''.dol_print_email($object->email,0,0,1).''.dol_print_email($object->email,0,0,1).'
    '.$langs->trans('Signature').''; + print '
    '.$langs->trans('Signature').''; print dol_htmlentitiesbr($object->signature); print "
    '.$langs->trans("HierarchicalResponsible").''; + print ''; if (empty($object->fk_user)) print $langs->trans("None"); else { $huser=new User($db); @@ -1268,27 +1285,27 @@ else print '
    '.$langs->trans("THM").''; + print ''; print ($object->thm!=''?price($object->thm,'',$langs,1,-1,-1,$conf->currency):''); print '
    '.$langs->trans("TJM").''; + print ''; print ($object->tjm!=''?price($object->tjm,'',$langs,1,-1,-1,$conf->currency):''); print '
    '.$langs->trans("Salary").''; + print ''; print ($object->salary!=''?price($object->salary,'',$langs,1,-1,-1,$conf->currency):''); print '
    '.$langs->trans("WeeklyHours").''; + print ''; print price2num($object->weeklyhours); print '
    '.$langs->trans("AccountancyCode").''.$object->accountancy_code.''.$object->accountancy_code.'
    '.$langs->trans("ColorUser").''; + if ($object->color) print ''; + print '
    '.$langs->trans("Status").''; + print ''; print $object->getLibStatut(4); print '
    '.$langs->trans("LastConnexion").''.dol_print_date($object->datelastlogin,"dayhour").''.dol_print_date($object->datelastlogin,"dayhour").'
    '.$langs->trans("PreviousConnexion").''.dol_print_date($object->datepreviouslogin,"dayhour").''.dol_print_date($object->datepreviouslogin,"dayhour").'
    '.$langs->trans("OpenIDURL").''.$object->openid.''.$object->openid.'
    '.$langs->trans("LinkToCompanyContact").''; + print ''; if (isset($object->societe_id) && $object->societe_id > 0) { $societe = new Societe($db); @@ -1352,7 +1379,7 @@ else $contact->fetch($object->contact_id); if ($object->societe_id > 0) print ' / '; else print '
    '; - print ''.img_object($langs->trans("ShowContact"),'contact').' '.dol_trunc($contact->getFullName($langs),32).''; + print ''.img_object($langs->trans("ShowContact"),'contact').' '.dol_trunc($contact->getFullName($langs),32).''; } print '
    '.$langs->trans("LinkedToDolibarrMember").''; + print ''; if ($object->fk_member) { $adh=new Adherent($db); @@ -1574,7 +1601,7 @@ else print ''; if ($caneditgroup) { - print ''.img_object($langs->trans("ShowGroup"),"group").' '.$group->name.''; + print ''.img_object($langs->trans("ShowGroup"),"group").' '.$group->name.''; } else { @@ -1631,6 +1658,9 @@ else if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) $rowspan++; if (! empty($conf->societe->enabled)) $rowspan++; if (! empty($conf->adherent->enabled)) $rowspan++; + if (! empty($conf->skype->enabled)) $rowspan++; + if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) $rowspan = $rowspan+3; + if (! empty($conf->agenda->enabled)) $rowspan++; print '
    '; print ''; @@ -1696,7 +1726,7 @@ else print ''; } else - { + { print ''; print $object->job; } @@ -1918,7 +1948,7 @@ else print $doleditor->Create(1); } else - { + { print dol_htmlentitiesbr($object->signature); } print '
    '.$langs->trans("ColorUser").''; + print $formother->selectColor(GETPOST('color')?GETPOST('color'):$object->color, 'color', 'usercolorconfig', 1, '', 'hideifnotset'); + print '
    '.$langs->trans("Status").''; @@ -2029,7 +2068,7 @@ else { $contact = new Contact($db); $contact->fetch($object->contact_id); - print ' / '.img_object($langs->trans("ShowContact"),'contact').' '.dol_trunc($contact->getFullName($langs),32).''; + print ' / '.img_object($langs->trans("ShowContact"),'contact').' '.dol_trunc($contact->getFullName($langs),32).''; } } else @@ -2087,11 +2126,11 @@ else print '
    '; - print '
    '; + print '
    '; print ''; - print '   '; + print '     '; print ''; - print '
    '; + print '
    '; print ''; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 0e4c5596194..9ea4f3de9c5 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -51,7 +51,7 @@ class User extends CommonObject var $firstname; var $note; var $email; - var $skype; + var $skype; var $job; var $signature; var $office_phone; @@ -72,8 +72,10 @@ class User extends CommonObject var $datem; //! If this is defined, it is an external user - var $societe_id; - var $contact_id; + var $societe_id; // deprecated + var $contact_id; // deprecated + var $socid; + var $contactid; var $fk_member; var $fk_user; @@ -99,13 +101,14 @@ class User extends CommonObject var $users; // To store all tree of users hierarchy var $parentof; // To store an array of all parents for all ids. - var $accountancy_code; // Accountancy code in prevision of the complete accountancy module - var $thm; // Average cost of employee - var $tjm; // Average cost of employee - var $salary; // Monthly salary - var $salaryextra; // Monthly salary extra - var $weeklyhours; // Weekly hours + var $accountancy_code; // Accountancy code in prevision of the complete accountancy module + var $thm; // Average cost of employee + var $tjm; // Average cost of employee + var $salary; // Monthly salary + var $salaryextra; // Monthly salary extra + var $weeklyhours; // Weekly hours + var $color; // Define background color for user in agenda /** * Constructor de la classe @@ -135,7 +138,7 @@ class User extends CommonObject * * @param int $id Si defini, id a utiliser pour recherche * @param string $login Si defini, login a utiliser pour recherche - * @param strinf $sid Si defini, sid a utiliser pour recherche + * @param string $sid Si defini, sid a utiliser pour recherche * @param int $loadpersonalconf Also load personal conf of user (in $user->conf->xxx) * @return int <0 if KO, 0 not found, >0 if OK */ @@ -164,6 +167,7 @@ class User extends CommonObject $sql.= " u.salary,"; $sql.= " u.salaryextra,"; $sql.= " u.weeklyhours,"; + $sql.= " u.color,"; $sql.= " u.ref_int, u.ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; @@ -231,14 +235,17 @@ class User extends CommonObject $this->salary = $obj->salary; $this->salaryextra = $obj->salaryextra; $this->weeklyhours = $obj->weeklyhours; + $this->color = $obj->color; $this->datec = $this->db->jdate($obj->datec); $this->datem = $this->db->jdate($obj->datem); $this->datelastlogin = $this->db->jdate($obj->datel); $this->datepreviouslogin = $this->db->jdate($obj->datep); - $this->societe_id = $obj->fk_societe; - $this->contact_id = $obj->fk_socpeople; + $this->societe_id = $obj->fk_societe; // deprecated + $this->contact_id = $obj->fk_socpeople; // deprecated + $this->socid = $obj->fk_societe; + $this->contactid = $obj->fk_socpeople; $this->fk_member = $obj->fk_member; $this->fk_user = $obj->fk_user; @@ -266,7 +273,7 @@ class User extends CommonObject return -1; } - // Recupere parametrage global propre a l'utilisateur + // To get back the global configuration unique to the user if ($loadpersonalconf) { $sql = "SELECT param, value FROM ".MAIN_DB_PREFIX."user_param"; @@ -298,7 +305,7 @@ class User extends CommonObject } /** - * Ajoute un droit a l'utilisateur + * Add a right to the user * * @param int $rid id du droit a ajouter * @param string $allmodule Ajouter tous les droits du module allmodule @@ -400,7 +407,7 @@ class User extends CommonObject /** - * Retire un droit a l'utilisateur + * Remove a right to the user * * @param int $rid Id du droit a retirer * @param string $allmodule Retirer tous les droits du module allmodule @@ -668,7 +675,7 @@ class User extends CommonObject $this->db->begin(); - // Desactive utilisateur + // Deactivate user $sql = "UPDATE ".MAIN_DB_PREFIX."user"; $sql.= " SET statut = ".$this->statut; $sql.= " WHERE rowid = ".$this->id; @@ -713,7 +720,7 @@ class User extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); - // Supprime droits + // Remove rights $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user = ".$this->id; if (! $error && ! $this->db->query($sql)) @@ -730,7 +737,7 @@ class User extends CommonObject $this->error = $this->db->lasterror(); } - // Si contact, supprime lien + // If contact, remove link if ($this->contact_id) { $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET fk_user_creat = null WHERE rowid = ".$this->contact_id; @@ -1059,7 +1066,7 @@ class User extends CommonObject } /** - * Affectation des permissions par defaut + * Assign rights by default * * @return Si erreur <0, si ok renvoi le nbre de droits par defaut positionnes */ @@ -1138,6 +1145,7 @@ class User extends CommonObject $this->zip = empty($this->zip)?'':$this->zip; $this->town = empty($this->town)?'':$this->town; $this->accountancy_code = trim($this->accountancy_code); + $this->color = empty($this->color)?'':$this->color; // Check parameters if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email)) @@ -1168,6 +1176,7 @@ class User extends CommonObject $sql.= ", job = '".$this->db->escape($this->job)."'"; $sql.= ", signature = '".$this->db->escape($this->signature)."'"; $sql.= ", accountancy_code = '".$this->db->escape($this->accountancy_code)."'"; + $sql.= ", color = '".$this->db->escape($this->color)."'"; $sql.= ", note = '".$this->db->escape($this->note)."'"; $sql.= ", photo = ".($this->photo?"'".$this->db->escape($this->photo)."'":"null"); $sql.= ", openid = ".($this->openid?"'".$this->db->escape($this->openid)."'":"null"); @@ -1256,7 +1265,10 @@ class User extends CommonObject } } + $action='update'; + // Actions on extra fields (by external module or standard code) + // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('userdao')); $parameters=array('socid'=>$this->id); $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks @@ -1530,7 +1542,7 @@ class User extends CommonObject $mesg.= $outputlangs->transnoentitiesnoconv("Password")." = ".$password."\n\n"; $mesg.= "\n"; $mesg.= $outputlangs->transnoentitiesnoconv("YouMustClickToChange")." :\n"; - $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword&username='.$this->login."&passwordmd5=".dol_hash($password); + $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword&username='.$this->login."&passwordhash=".dol_hash($password); $mesg.= $url."\n\n"; $mesg.= $outputlangs->transnoentitiesnoconv("ForgetIfNothing")."\n\n"; dol_syslog(get_class($this)."::send_password url=".$url); @@ -1650,7 +1662,7 @@ class User extends CommonObject /** * Add user into a group * - * @param Group $group Id of group + * @param int $group Id of group * @param int $entity Entity * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK @@ -1709,7 +1721,7 @@ class User extends CommonObject /** * Remove a user from a group * - * @param Group $group Id of group + * @param int $group Id of group * @param int $entity Entity * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK @@ -1775,15 +1787,15 @@ class User extends CommonObject $result=''; - $lien = ''; + $lien = ''; $lienfin=''; if ($withpicto) { - $result.=($lien.img_object($langs->trans("ShowUser"),'user').$lienfin); + $result.=($lien.img_object($langs->trans("ShowUser"), 'user', 'class="classfortooltip"').$lienfin); if ($withpicto != 2) $result.=' '; } - $result.=$lien.$this->getFullName($langs).$lienfin; + $result.=$lien.$this->getFullName($langs,'','',24).$lienfin; return $result; } @@ -1800,12 +1812,12 @@ class User extends CommonObject $result=''; - $lien = ''; + $lien = ''; $lienfin=''; if ($option == 'xxx') { - $lien = ''; + $lien = ''; $lienfin=''; } @@ -1932,7 +1944,7 @@ class User extends CommonObject if ($this->office_fax && ! empty($conf->global->LDAP_FIELD_FAX)) $info[$conf->global->LDAP_FIELD_FAX] = $this->office_fax; if ($this->note && ! empty($conf->global->LDAP_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_FIELD_DESCRIPTION] = $this->note; if ($this->email && ! empty($conf->global->LDAP_FIELD_MAIL)) $info[$conf->global->LDAP_FIELD_MAIL] = $this->email; - if ($this->skype && ! empty($conf->global->LDAP_FIELD_SKYPE)) $info[$conf->global->LDAP_FIELD_SKYPE] = $this->skype; + if ($this->skype && ! empty($conf->global->LDAP_FIELD_SKYPE)) $info[$conf->global->LDAP_FIELD_SKYPE] = $this->skype; if ($conf->global->LDAP_SERVER_TYPE == 'egroupware') { @@ -1985,7 +1997,7 @@ class User extends CommonObject $this->firstname='SPECIMEN'; $this->note='This is a note'; $this->email='email@specimen.com'; - $this->skype='tom.hanson'; + $this->skype='tom.hanson'; $this->office_phone='0999999999'; $this->office_fax='0999999998'; $this->user_mobile='0999999997'; @@ -2114,7 +2126,7 @@ class User extends CommonObject /** * Update user using data from the LDAP * - * @param ldapuser &$ldapuser Ladp User + * @param ldapuser $ldapuser Ladp User * * @return int <0 if KO, >0 if OK */ @@ -2214,16 +2226,15 @@ class User extends CommonObject /** * Reconstruit l'arborescence hierarchique des users sous la forme d'un tableau - * Renvoi un tableau de tableau('id','id_parent',...) trie selon arbre et avec: - * id = id du user - * id_parent = id du user parent - * id_children = tableau des id enfant - * name = nom du user + * Set and return this->users that is an array sorted according to tree with arrays of: + * id = id user + * lastname + * firstname * fullname = nom avec chemin complet du user - * fullpath = chemin complet compose des id + * fullpath = chemin complet compose des id: "_grandparentid_parentid_id" * * @param int $deleteafterid Removed all users including the leaf $deleteafterid (and all its child) in user tree. - * @return array Array of users. this->users and this->parentof are set. + * @return array Array of users $this->users. Note: $this->parentof is also set. */ function get_full_tree($deleteafterid=0) { @@ -2302,6 +2313,29 @@ class User extends CommonObject return $this->users; } + /** + * Return list of all childs users in herarchy. + * + * @return array Array of user id lower than user. This overwrite this->users. + */ + function getAllChildIds() + { + // Init this->users + $this->get_full_tree(); + + $idtoscan=$this->id; + $childids=array(); + + dol_syslog("Build childid for id = ".$idtoscan); + foreach($this->users as $id => $val) + { + //var_dump($val['fullpath']); + if (preg_match('/_'.$idtoscan.'_/', $val['fullpath'])) $childids[$val['id']]=$val['id']; + } + + return $childids; + } + /** * For user id_user and its childs available in this->users, define property fullpath and fullname * diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 9bd0d64fe4c..599172c028e 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -4,6 +4,7 @@ * Copyright (c) 2005-2012 Regis Houssin * Copyright (C) 2012 Florian Henry * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2014 Alexis Algoud * * 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 @@ -40,6 +41,7 @@ class UserGroup extends CommonObject var $id; // Group id var $entity; // Entity of group var $nom; // Name of group + var $name; // Name of group // deprecated var $globalgroup; // Global group var $note; // Note on group var $datec; // Creation date of group @@ -68,7 +70,7 @@ class UserGroup extends CommonObject * Charge un objet group avec toutes ces caracteristiques (excpet ->members array) * * @param int $id id du groupe a charger - * @param string $groupname nom du groupe a charger + * @param string $groupname name du groupe a charger * @return int <0 if KO, >0 if OK */ function fetch($id='', $groupname='') @@ -98,13 +100,22 @@ class UserGroup extends CommonObject $this->ref = $obj->rowid; $this->entity = $obj->entity; $this->name = $obj->name; - $this->nom = $obj->name; //Deprecated + $this->nom = $obj->name; // Deprecated $this->note = $obj->note; $this->datec = $obj->datec; $this->datem = $obj->datem; $this->members=$this->listUsersForGroup(); + + // Retreive all extrafield for group + // fetch optionals attributes and labels + dol_include_once('/core/class/extrafields.class.php'); + $extrafields=new ExtraFields($this->db); + $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); + $this->fetch_optionals($this->id,$extralabels); + + // Sav current LDAP Current DN //$this->ldap_dn = $this->_load_ldap_dn($this->_load_ldap_info(),0); } @@ -178,7 +189,7 @@ class UserGroup extends CommonObject * * @param string $excludefilter Filter to exclude * @param int $mode 0=Return array of user instance, 1=Return array of users id only - * @return array|-1 Array of users or -1 on error + * @return mixed Array of users or -1 on error */ function listUsersForGroup($excludefilter='', $mode=0) { @@ -539,6 +550,17 @@ class UserGroup extends CommonObject $sql .= " WHERE fk_usergroup = ".$this->id; $this->db->query($sql); + // Remove extrafields + if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used + { + $result=$this->deleteExtraFields(); + if ($result < 0) + { + $error++; + dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); + } + } + $sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup"; $sql .= " WHERE rowid = ".$this->id; $result=$this->db->query($sql); @@ -568,7 +590,7 @@ class UserGroup extends CommonObject */ function create($notrigger=0) { - global $user, $conf, $langs; + global $user, $conf, $langs, $hookmanager; $error=0; $now=dol_now(); @@ -598,7 +620,27 @@ class UserGroup extends CommonObject if ($this->update(1) < 0) return -2; - if (! $notrigger) + $action='create'; + + // Actions on extra fields (by external module or standard code) + // FIXME le hook fait double emploi avec le trigger !! + $hookmanager->initHooks(array('groupdao')); + $parameters=array(); + $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) + { + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + } + else if ($reshook < 0) $error++; + + if (! $error && ! $notrigger) { // Call trigger $result=$this->call_trigger('GROUP_CREATE',$user); @@ -606,7 +648,9 @@ class UserGroup extends CommonObject // End call triggers } - $this->db->commit(); + if ($error > 0) { $error++; $this->db->rollback(); return -1; } + else $this->db->commit(); + return $this->id; } else @@ -625,7 +669,7 @@ class UserGroup extends CommonObject */ function update($notrigger=0) { - global $user, $conf, $langs; + global $user, $conf, $langs, $hookmanager; $error=0; @@ -638,7 +682,7 @@ class UserGroup extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."usergroup SET "; - $sql.= " nom = '" . $this->db->escape($this->nom) . "'"; + $sql.= " nom = '" . $this->db->escape($this->name) . "'"; $sql.= ", entity = " . $this->db->escape($entity); $sql.= ", note = '" . $this->db->escape($this->note) . "'"; $sql.= " WHERE rowid = " . $this->id; @@ -647,7 +691,27 @@ class UserGroup extends CommonObject $resql = $this->db->query($sql); if ($resql) { - if (! $notrigger) + $action='update'; + + // Actions on extra fields (by external module or standard code) + // FIXME le hook fait double emploi avec le trigger !! + $hookmanager->initHooks(array('groupdao')); + $parameters=array(); + $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) + { + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + } + else if ($reshook < 0) $error++; + + if (! $error && ! $notrigger) { // Call trigger $result=$this->call_trigger('GROUP_MODIFY',$user); @@ -709,8 +773,8 @@ class UserGroup extends CommonObject $info["objectclass"]=explode(',',$conf->global->LDAP_GROUP_OBJECT_CLASS); // Champs - if ($this->nom && ! empty($conf->global->LDAP_GROUP_FIELD_FULLNAME)) $info[$conf->global->LDAP_GROUP_FIELD_FULLNAME] = $this->nom; - //if ($this->nom && ! empty($conf->global->LDAP_GROUP_FIELD_NAME)) $info[$conf->global->LDAP_GROUP_FIELD_NAME] = $this->nom; + if ($this->name && ! empty($conf->global->LDAP_GROUP_FIELD_FULLNAME)) $info[$conf->global->LDAP_GROUP_FIELD_FULLNAME] = $this->name; + //if ($this->name && ! empty($conf->global->LDAP_GROUP_FIELD_NAME)) $info[$conf->global->LDAP_GROUP_FIELD_NAME] = $this->name; if ($this->note && ! empty($conf->global->LDAP_GROUP_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_GROUP_FIELD_DESCRIPTION] = $this->note; if (! empty($conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS)) { @@ -747,7 +811,7 @@ class UserGroup extends CommonObject $this->ref = 'SPECIMEN'; $this->specimen=1; - $this->nom='DOLIBARR GROUP SPECIMEN'; + $this->name='DOLIBARR GROUP SPECIMEN'; $this->note='This is a note'; $this->datec=time(); $this->datem=time(); diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index 3dc3c14cc12..f72a8eb0f15 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -155,10 +155,10 @@ if ($id > 0) print ''; - print '
    '; - print '     '; + print '
    '; + print '     '; print ''; - print '
    '; + print '
    '; print ''; } diff --git a/htdocs/user/document.php b/htdocs/user/document.php index b18424625ce..2659b9427c8 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -88,10 +88,11 @@ if ($id > 0 || ! empty($ref)) { $result = $object->fetch($id, $ref); - $upload_dir = $conf->user->multidir_output[$object->entity] . "/" . $object->id ; + $entitytouseforuserdir = $object->entity; + if (empty($entitytouseforuserdir)) $entitytouseforuserdir=1; + $upload_dir = $conf->user->multidir_output[$entitytouseforuserdir] . "/" . $object->id ; } - /* * Actions */ @@ -159,8 +160,8 @@ if ($object->id) print '
    '; - $modulepart = 'societe'; - $permission = $user->rights->societe->creer; + $modulepart = 'user'; + $permission = $user->rights->user->user->creer; $param = '&id=' . $object->id; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; } diff --git a/htdocs/user/group/fiche.php b/htdocs/user/group/card.php similarity index 86% rename from htdocs/user/group/fiche.php rename to htdocs/user/group/card.php index f97ef35ae6e..5f79c939432 100644 --- a/htdocs/user/group/fiche.php +++ b/htdocs/user/group/card.php @@ -20,13 +20,14 @@ */ /** - * \file htdocs/user/group/fiche.php + * \file htdocs/user/group/card.php * \brief Onglet groupes utilisateurs */ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; if(! empty($conf->multicompany->enabled)) dol_include_once('/multicompany/class/actions_multicompany.class.php'); // Defini si peux lire/modifier utilisateurs et permisssions @@ -59,6 +60,10 @@ if (! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->multico $object = new Usergroup($db); +$extrafields = new ExtraFields($db); +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + /** * Action remove group @@ -90,10 +95,14 @@ if ($action == 'add') setEventMessage($langs->trans("NameNotDefined"), 'errors'); $action="create"; // Go back to create page } else { - $object->nom = trim($_POST["nom"]); + $object->nom = trim($_POST["nom"]); // For backward compatibility + $object->name = trim($_POST["nom"]); $object->note = trim($_POST["note"]); - if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) $object->entity = 0; + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + + if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) $object->entity = 0; else $object->entity = $_POST["entity"]; $db->begin(); @@ -112,7 +121,7 @@ if ($action == 'add') $db->rollback(); $langs->load("errors"); - setEventMessage($langs->trans("ErrorGroupAlreadyExists",$object->nom), 'errors'); + setEventMessage($langs->trans("ErrorGroupAlreadyExists",$object->name), 'errors'); $action="create"; // Go back to create page } } @@ -168,9 +177,13 @@ if ($action == 'update') $object->oldcopy=dol_clone($object); - $object->nom = trim($_POST["group"]); + $object->name = trim($_POST["group"]); + $object->nom = $this->name; // For backward compatibility $object->note = dol_htmlcleanlastbr($_POST["note"]); + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) $object->entity = 0; else $object->entity = $_POST["entity"]; @@ -240,9 +253,18 @@ if ($action == 'create') $doleditor=new DolEditor('note','','',240,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_8,90); $doleditor->Create(); print "\n"; + + // Other attributes + $parameters=array('object' => $object, 'colspan' => ' colspan="2"'); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $object->showOptionals($extrafields,'edit'); + } + print "\n"; - print '

    '; + print '
    '; print ""; } @@ -311,6 +333,15 @@ else print ''.$langs->trans("Note").''; print ''.dol_htmlentitiesbr($object->note).' '; print "\n"; + + // Other attributes + $parameters=array('colspan' => ' colspan="2"'); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $object->showOptionals($extrafields); + } + print "\n"; print '
    '; @@ -412,7 +443,7 @@ else print ""; print ''; - print ''.img_object($langs->trans("ShowUser"),"user").' '.$useringroup->login.''; + print ''.img_object($langs->trans("ShowUser"),"user").' '.$useringroup->login.''; if ($useringroup->admin && ! $useringroup->entity) print img_picto($langs->trans("SuperAdministrator"),'redstar'); else if ($useringroup->admin) print img_picto($langs->trans("Administrator"),'star'); print ''; @@ -495,9 +526,17 @@ else $doleditor->Create(); print ''; print "\n"; + // Other attributes + $parameters=array('colspan' => ' colspan="2"'); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $object->showOptionals($extrafields,'edit'); + } + print "\n"; - print '

    '; + print '
    '; print ''; diff --git a/htdocs/user/group/index.php b/htdocs/user/group/index.php index d0766655d6a..1f06fa3a3c2 100644 --- a/htdocs/user/group/index.php +++ b/htdocs/user/group/index.php @@ -57,7 +57,7 @@ llxHeader(); print_fiche_titre($langs->trans("ListOfGroups")); -$sql = "SELECT g.rowid, g.nom, g.entity, g.datec, COUNT(DISTINCT ugu.fk_user) as nb"; +$sql = "SELECT g.rowid, g.nom as name, g.entity, g.datec, COUNT(DISTINCT ugu.fk_user) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."usergroup as g"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_usergroup = g.rowid"; if (! empty($conf->multicompany->enabled) && $conf->entity == 1 && ($conf->multicompany->transverse_mode || ($user->admin && ! $user->entity))) @@ -91,7 +91,7 @@ if ($resql) { print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],"g.entity",$param,"",'align="center"',$sortfield,$sortorder); } - print_liste_field_titre($langs->trans("NbOfUsers"),$_SERVER["PHP_SELF"],"g.nb",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("NbOfUsers"),$_SERVER["PHP_SELF"],"nb",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"g.datec",$param,"",'align="right"',$sortfield,$sortorder); print "\n"; $var=True; @@ -101,7 +101,7 @@ if ($resql) $var=!$var; print ""; - print ''.img_object($langs->trans("ShowGroup"),"group").' '.$obj->nom.''; + print ''.img_object($langs->trans("ShowGroup"),"group").' '.$obj->name.''; if (! $obj->entity) { print img_picto($langs->trans("GlobalGroup"),'redstar'); diff --git a/htdocs/user/group/ldap.php b/htdocs/user/group/ldap.php index c3e147620c2..f53775b9b3e 100644 --- a/htdocs/user/group/ldap.php +++ b/htdocs/user/group/ldap.php @@ -62,6 +62,10 @@ if ($action == 'dolibarr2ldap') $result=$ldap->connect_bind(); $info=$fgroup->_load_ldap_info(); + // Get a gid number for objectclass PosixGroup + if(in_array('posixGroup',$info['objectclass'])) + $info['gidNumber'] = $ldap->getNextGroupGid(); + $dn=$fgroup->_load_ldap_dn($info); $olddn=$dn; // We can say that old dn = dn as we force synchro @@ -104,7 +108,7 @@ print ''; // Name print ''.$langs->trans("Name").''; -print ''.$fgroup->nom; +print ''.$fgroup->name; if (!$fgroup->entity) { print img_picto($langs->trans("GlobalGroup"),'redstar'); diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index 5c52fa80a50..a910753c643 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -199,7 +199,7 @@ if ($id) // Nom print ''.$langs->trans("Name").''; - print ''.$fgroup->nom.''; + print ''.$fgroup->name.''; if (! $fgroup->entity) { print img_picto($langs->trans("GlobalGroup"),'redstar'); diff --git a/htdocs/user/hierarchy.php b/htdocs/user/hierarchy.php index 3c330f3a712..0d6c2f9a7b8 100644 --- a/htdocs/user/hierarchy.php +++ b/htdocs/user/hierarchy.php @@ -62,7 +62,7 @@ print_fiche_titre($langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicVi -// Charge tableau des categories +// Load hierarchy of users $user_arbo = $userstatic->get_full_tree(); // Define fulltree array diff --git a/htdocs/user/home.php b/htdocs/user/home.php index 824f505fddd..c9b3693f1ac 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -26,7 +26,7 @@ require '../main.inc.php'; if (! $user->rights->user->user->lire && ! $user->admin) { // Redirection vers la page de l'utilisateur - header("Location: fiche.php?id=".$user->id); + header("Location: card.php?id=".$user->id); exit; } @@ -129,7 +129,7 @@ if ($resql) $var=!$var; print ""; - print ''.img_object($langs->trans("ShowUser"),"user").' '.dolGetFirstLastname($obj->firstname,$obj->lastname).''; + print ''.img_object($langs->trans("ShowUser"),"user").' '.dolGetFirstLastname($obj->firstname,$obj->lastname).''; if (! empty($conf->multicompany->enabled) && $obj->admin && ! $obj->entity) { print img_picto($langs->trans("SuperAdministrator"),'redstar'); @@ -200,7 +200,7 @@ if ($canreadperms) { $max=5; - $sql = "SELECT g.rowid, g.nom, g.note, g.entity, g.datec"; + $sql = "SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec"; $sql.= " FROM ".MAIN_DB_PREFIX."usergroup as g"; if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && ($conf->multicompany->transverse_mode || ($user->admin && ! $user->entity))) { @@ -230,7 +230,7 @@ if ($canreadperms) $var=!$var; print ""; - print ''.img_object($langs->trans("ShowGroup"),"group").' '.$obj->nom.''; + print ''.img_object($langs->trans("ShowGroup"),"group").' '.$obj->name.''; if (! $obj->entity) { print img_picto($langs->trans("GlobalGroup"),'redstar'); diff --git a/htdocs/user/index.php b/htdocs/user/index.php index 8b7ba96a7f3..5d0b0ac77e4 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -73,7 +73,7 @@ $sql.= " u.tms as datem,"; $sql.= " u.datelastlogin,"; $sql.= " u.ldap_sid, u.statut, u.entity,"; $sql.= " u2.login as login2, u2.firstname as firstname2, u2.lastname as lastname2,"; -$sql.= " s.nom, s.canvas"; +$sql.= " s.nom as name, s.canvas"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_societe = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u2 ON u.fk_user = u2.rowid"; @@ -114,6 +114,10 @@ if ($result) print_liste_field_titre($langs->trans("LastName"),$_SERVER['PHP_SELF'],"u.lastname",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("FirstName"),$_SERVER['PHP_SELF'],"u.firstname",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"),$_SERVER['PHP_SELF'],"u.fk_societe",$param,"","",$sortfield,$sortorder); + if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode)) + { + print_liste_field_titre($langs->trans("Entity"),$_SERVER['PHP_SELF'],"u.entity",$param,"","",$sortfield,$sortorder); + } print_liste_field_titre($langs->trans("DateCreation"),$_SERVER['PHP_SELF'],"u.datec",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("LastConnexion"),$_SERVER['PHP_SELF'],"u.datelastlogin",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("HierarchicalResponsible"),$_SERVER['PHP_SELF'],"u2.login",$param,"",'align="center"',$sortfield,$sortorder); @@ -145,7 +149,7 @@ if ($result) $var=!$var; print ""; - print ''.img_object($langs->trans("ShowUser"),"user").' '.$obj->login.''; + print ''.img_object($langs->trans("ShowUser"),"user").' '.$obj->login.''; if (! empty($conf->multicompany->enabled) && $obj->admin && ! $obj->entity) { print img_picto($langs->trans("SuperAdministrator"),'redstar'); @@ -161,13 +165,24 @@ if ($result) if ($obj->fk_societe) { $companystatic->id=$obj->fk_societe; - $companystatic->nom=$obj->nom; + $companystatic->name=$obj->name; $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1); } - // Multicompany enabled - else if (! empty($conf->multicompany->enabled)) + else if ($obj->ldap_sid) { + print $langs->trans("DomainUser"); + } + else + { + print $langs->trans("InternalUser"); + } + print ''; + + // Multicompany enabled + if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode)) + { + print ''; if (! $obj->entity) { print $langs->trans("AllEntities"); @@ -181,16 +196,8 @@ if ($result) print $mc->label; } } + print ''; } - else if ($obj->ldap_sid) - { - print $langs->trans("DomainUser"); - } - else - { - print $langs->trans("InternalUser"); - } - print ''; // Date creation print ''.dol_print_date($db->jdate($obj->datec),"dayhour").''; diff --git a/htdocs/user/note.php b/htdocs/user/note.php index 448dd76d147..2a992aa3212 100644 --- a/htdocs/user/note.php +++ b/htdocs/user/note.php @@ -133,11 +133,11 @@ if ($id) if ($action == 'edit') { - print '

    '; + print '
    '; print ''; - print '   '; + print '     '; print ''; - print '
    '; + print '
    '; } print "\n"; diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 65e9e4ca7a6..860e74c5567 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -179,10 +179,10 @@ if ($action == 'edit') print ($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT)); print ''; print 'conf->MAIN_LANG_DEFAULT)?" checked":""); - print ! empty($dolibarr_main_demo)?' disabled="disabled"':''; // Disabled for demo + print empty($dolibarr_main_demo)?'':' disabled="disabled"'; // Disabled for demo print '> '.$langs->trans("UsePersonalValue").''; print ''; - print $formadmin->select_language((! empty($fuser->conf->MAIN_LANG_DEFAULT)?$fuser->conf->MAIN_LANG_DEFAULT:''),'main_lang_default',1); + print $formadmin->select_language((! empty($fuser->conf->MAIN_LANG_DEFAULT)?$fuser->conf->MAIN_LANG_DEFAULT:''),'main_lang_default',1,null,0,0,(! empty($dolibarr_main_demo))); print ''; // Taille max des listes @@ -190,7 +190,7 @@ if ($action == 'edit') print ''.$langs->trans("MaxSizeList").''; print ''.$conf->global->MAIN_SIZE_LISTE_LIMIT.''; print 'conf->MAIN_SIZE_LISTE_LIMIT)?" checked":""); - print ! empty($dolibarr_main_demo)?' disabled="disabled"':''; // Disabled for demo + print empty($dolibarr_main_demo)?'':' disabled="disabled"'; // Disabled for demo print '> '.$langs->trans("UsePersonalValue").''; print ''; @@ -202,11 +202,11 @@ if ($action == 'edit') dol_fiche_end(); - print '
    '; + print '
    '; print ''; - print '     '; + print '     '; print ''; - print '
    '; + print '
    '; print ''; diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index 4f1a36c6e04..44377f6168c 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -2,6 +2,7 @@ /* Copyright (C) 2007-2011 Laurent Destailleur * Copyright (C) 2008-2012 Regis Houssin * Copyright (C) 2008-2011 Juanjo Menent + * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,8 +28,8 @@ define("NOLOGIN",1); // This means this output page does not require to be logge require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -if (! empty($conf->ldap->enabled)) - require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +if (! empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; $langs->load("errors"); $langs->load("users"); @@ -48,7 +49,7 @@ $mode=$dolibarr_main_authentication; if (! $mode) $mode='http'; $username = GETPOST('username'); -$passwordmd5 = GETPOST('passwordmd5'); +$passwordhash = GETPOST('passwordhash'); $conf->entity = (GETPOST('entity') ? GETPOST('entity') : 1); // Instantiate hooks of thirdparty module only if not already define @@ -67,7 +68,7 @@ if (GETPOST('dol_use_jmobile') || ! empty($_SESSION['dol_use_jmobile'])) */ // Validate new password -if ($action == 'validatenewpassword' && $username && $passwordmd5) +if ($action == 'validatenewpassword' && $username && $passwordhash) { $edituser = new User($db); $result=$edituser->fetch('',$_GET["username"]); @@ -77,7 +78,7 @@ if ($action == 'validatenewpassword' && $username && $passwordmd5) } else { - if (dol_hash($edituser->pass_temp) == $passwordmd5) + if (dol_hash($edituser->pass_temp) == $passwordhash) { $newpassword=$edituser->setPassword($user,$edituser->pass_temp,0); dol_syslog("passwordforgotten.php new password for user->id=".$edituser->id." validated in database"); @@ -130,7 +131,8 @@ if ($action == 'buildnewpassword' && $username) // Success if ($edituser->send_password($user,$newpassword,1) > 0) { - $message = '
    '.$langs->trans("PasswordChangeRequestSent",$edituser->login,$edituser->email).'
    '; + + $message = '
    '.$langs->trans("PasswordChangeRequestSent",$edituser->login,dolObfuscateEmail($edituser->email)).'
    '; //$message.=$newpassword; $username=''; } diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index f9dbb54f8f4..b63b3e65ffc 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -276,7 +276,7 @@ print '
    '; if ($user->admin) print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules"), 0, 1).'
    '; // Show warning about external users -if (empty($user->societe_id)) print showModulesExludedForExternal($modules).'

    '."\n"; +if (empty($user->societe_id)) print info_admin(showModulesExludedForExternal($modules)).'

    '."\n"; // For multicompany transversal mode // TODO Place a hook here diff --git a/htdocs/webservices/admin/webservices.php b/htdocs/webservices/admin/webservices.php index a12f638a174..431150bd9e9 100644 --- a/htdocs/webservices/admin/webservices.php +++ b/htdocs/webservices/admin/webservices.php @@ -90,9 +90,9 @@ print ''; print ''; -print '
    '; +print '
    '; print ''; -print '
    '; +print ''; print ''; diff --git a/htdocs/webservices/demo_wsclient_actioncomm.php-NORUN b/htdocs/webservices/demo_wsclient_actioncomm.php-NORUN index 32df64218d3..1e14c07a5bf 100755 --- a/htdocs/webservices/demo_wsclient_actioncomm.php-NORUN +++ b/htdocs/webservices/demo_wsclient_actioncomm.php-NORUN @@ -53,8 +53,8 @@ if ($soapclient) $authentication=array( 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, 'sourceapplication'=>'DEMO', - 'login'=>'admin_dolibarDev', - 'password'=>'homedread', + 'login'=>'admin', + 'password'=>'changeme', 'entity'=>'1'); diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index d5d9c45fa36..dc07bc156ec 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -289,15 +289,15 @@ function getActionComm($authentication,$id) 'datem'=> dol_print_date($actioncomm->datem,'dayhourrfc'), 'note'=> $actioncomm->note, 'percentage'=> $actioncomm->percentage, - 'author'=> $actioncomm->author->id, - 'usermod'=> $actioncomm->usermod->id, - 'usertodo'=> $actioncomm->usertodo->id, - 'userdone'=> $actioncomm->userdone->id, + 'author'=> $actioncomm->authorid, + 'usermod'=> $actioncomm->usermodid, + 'usertodo'=> $actioncomm->userownerid, + 'userdone'=> $actioncomm->userdoneid, 'priority'=> $actioncomm->priority, 'fulldayevent'=> $actioncomm->fulldayevent, 'location'=> $actioncomm->location, - 'socid'=> $actioncomm->societe->id, - 'contactid'=> $actioncomm->contact->id, + 'socid'=> $actioncomm->socid, + 'contactid'=> $actioncomm->contactid, 'projectid'=> $actioncomm->fk_project, 'fk_element'=> $actioncomm->fk_element, 'elementtype'=> $actioncomm->elementtype); @@ -433,12 +433,12 @@ function createActionComm($authentication,$actioncomm) $newobject->datep=$actioncomm['datep']; $newobject->datef=$actioncomm['datef']; $newobject->type_code=$actioncomm['type_code']; - $newobject->societe->id=$actioncomm['socid']; + $newobject->socid=$actioncomm['socid']; $newobject->fk_project=$actioncomm['projectid']; $newobject->note=$actioncomm['note']; - $newobject->contact->id=$actioncomm['contactid']; - $newobject->usertodo->id=$actioncomm['usertodo']; - $newobject->userdone->id=$actioncomm['userdone']; + $newobject->contactid=$actioncomm['contactid']; + $newobject->userownerid=$actioncomm['usertodo']; + $newobject->userdoneid=$actioncomm['userdone']; $newobject->label=$actioncomm['label']; $newobject->percentage=$actioncomm['percentage']; $newobject->priority=$actioncomm['priority']; @@ -517,23 +517,23 @@ function updateActionComm($authentication,$actioncomm) if (! $error) { $objectfound=false; - + $object=new ActionComm($db); $result=$object->fetch($actioncomm['id']); - + if (!empty($object->id)) { - + $objectfound=true; $object->datep=$actioncomm['datep']; $object->datef=$actioncomm['datef']; $object->type_code=$actioncomm['type_code']; - $object->societe->id=$actioncomm['socid']; + $object->socid=$actioncomm['socid']; + $object->contactid=$actioncomm['contactid']; $object->fk_project=$actioncomm['projectid']; $object->note=$actioncomm['note']; - $object->contact->id=$actioncomm['contactid']; - $object->usertodo->id=$actioncomm['usertodo']; - $object->userdone->id=$actioncomm['userdone']; + $object->userownerid=$actioncomm['usertodo']; + $object->userdoneid=$actioncomm['userdone']; $object->label=$actioncomm['label']; $object->percentage=$actioncomm['percentage']; $object->priority=$actioncomm['priority']; @@ -541,7 +541,7 @@ function updateActionComm($authentication,$actioncomm) $object->location=$actioncomm['location']; $object->fk_element=$actioncomm['fk_element']; $object->elementtype=$actioncomm['elementtype']; - + //Retreive all extrafield for actioncomm // fetch optionals attributes and labels $extrafields=new ExtraFields($db); @@ -551,7 +551,7 @@ function updateActionComm($authentication,$actioncomm) $key='options_'.$key; $object->array_options[$key]=$actioncomm[$key]; } - + $db->begin(); $result=$object->update($fuser); diff --git a/htdocs/webservices/server_category.php b/htdocs/webservices/server_category.php index 3c723947764..345679f7c9a 100644 --- a/htdocs/webservices/server_category.php +++ b/htdocs/webservices/server_category.php @@ -106,56 +106,41 @@ $server->wsdl->addComplexType( 'tns:categorie' ); -/* - * Tableau des catégories - -$server->wsdl->addComplexType( - 'categories', - 'complexType', - 'array', - '', - 'SOAP-ENC:Array', - array(), - array( - array('id'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:categorie[]') - ), - 'tns:categories' -); + /* + * Image of product */ - -/* - * Les photos de la catégorie (un tableau indéxé qui contient les images avec leur vignette) + $server->wsdl->addComplexType( + 'PhotosArray', + 'complexType', + 'array', + 'sequence', + '', + array( + 'image' => array( + 'name' => 'image', + 'type' => 'tns:image', + 'minOccurs' => '0', + 'maxOccurs' => 'unbounded' + ) + ) + ); + + /* + * An image */ -$server->wsdl->addComplexType( - 'PhotosArray', - 'complexType', - 'array', - '', - 'SOAP-ENC:Array', - array(), - array( - array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:image[]') - ), - '' -); - -/* - * Une photo ( nom image / nom_vignette ) - */ -$server->wsdl->addComplexType( - 'image', - 'complexType', - 'array', - '', - 'SOAP-ENC:Array', - array(), - array( - 'photo' => array('name'=>'photo','type'=>'xsd:string'), - 'photo_vignette' => array('name'=>'photo_vignette','type'=>'xsd:string'), - 'imgWidth' => array('name'=>'imgWidth','type'=>'xsd:string'), - 'imgHeight' => array('name'=>'imgHeight','type'=>'xsd:string') - ) -); + $server->wsdl->addComplexType( + 'image', + 'complexType', + 'struct', + 'all', + '', + array( + 'photo' => array('name'=>'photo','type'=>'xsd:string'), + 'photo_vignette' => array('name'=>'photo_vignette','type'=>'xsd:string'), + 'imgWidth' => array('name'=>'imgWidth','type'=>'xsd:string'), + 'imgHeight' => array('name'=>'imgHeight','type'=>'xsd:string') + ) + ); /* * Retour diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index f42c270fa42..b7550244fc2 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -234,7 +234,7 @@ $server->register( * @param array $authentication Array of authentication information * @param int $id Id of object * @param string $ref Ref of object - * @param ref_ext $ref_ext Ref external of object + * @param string $ref_ext Ref external of object * @return mixed */ function getContact($authentication,$id,$ref='',$ref_ext='') @@ -655,6 +655,7 @@ function updateContact($authentication,$contact) $object->province_id=$contact['province_id']; + $object->phone_pro=$contact['phone_pro']; $object->phone_perso=$contact['phone_perso']; $object->phone_mobile=$contact['phone_mobile']; $object->fax=$contact['fax']; diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index d0f3e589f25..9c5bd24b463 100644 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -136,7 +136,9 @@ $server->wsdl->addComplexType( 'minOccurs' => '0', 'maxOccurs' => 'unbounded' ) - ) + ), + null, + 'tns:line' ); @@ -197,7 +199,9 @@ $server->wsdl->addComplexType( 'minOccurs' => '0', 'maxOccurs' => 'unbounded' ) - ) + ), + null, + 'tns:invoice' ); @@ -521,7 +525,15 @@ function createInvoice($authentication,$invoice) $newobject->statut=0; // We start with status draft $newobject->fk_project=$invoice['project_id']; $newobject->date_creation=$now; - $newobject->mode_reglement_id = $invoice['payment_mode_id']; + + //take mode_reglement and cond_reglement from thirdparty + $soc = new Societe($db); + $res=$soc->fetch($newobject->socid); + if ($res > 0) { + $newobject->mode_reglement_id = ! empty($invoice['payment_mode_id'])?$invoice['payment_mode_id']:$soc->mode_reglement_id; + $newobject->cond_reglement_id = $soc->cond_reglement_id; + } + else $newobject->mode_reglement_id = $invoice['payment_mode_id']; // Trick because nusoap does not store data with same structure if there is one or several lines $arrayoflines=array(); @@ -532,7 +544,7 @@ function createInvoice($authentication,$invoice) { // $key can be 'line' or '0','1',... $newline=new FactureLigne($db); - $newline->type=$line['type']; + $newline->product_type=$line['type']; $newline->desc=$line['desc']; $newline->fk_product=$line['fk_product']; $newline->tva_tx=$line['vat_rate']; @@ -541,6 +553,8 @@ function createInvoice($authentication,$invoice) $newline->total_ht=$line['total_net']; $newline->total_tva=$line['total_vat']; $newline->total_ttc=$line['total']; + $newline->date_start=dol_stringtotime($line['date_start']); + $newline->date_end=dol_stringtotime($line['date_end']); $newline->fk_product=$line['product_id']; $newobject->lines[]=$newline; } diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 387ed548506..9229d3b9c26 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -29,6 +29,7 @@ set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); require_once '../master.inc.php'; require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP require_once DOL_DOCUMENT_ROOT.'/core/lib/ws.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"); @@ -84,6 +85,52 @@ $server->wsdl->addComplexType( ) ); +$line_fields = array( + 'id' => array('name'=>'id','type'=>'xsd:string'), + 'type' => array('name'=>'type','type'=>'xsd:int'), + 'fk_commande' => array('name'=>'fk_commande','type'=>'xsd:int'), + 'fk_parent_line' => array('name'=>'fk_parent_line','type'=>'xsd:int'), + 'desc' => array('name'=>'desc','type'=>'xsd:string'), + 'qty' => array('name'=>'qty','type'=>'xsd:double'), + 'price' => array('name'=>'price','type'=>'xsd:double'), + 'unitprice' => array('name'=>'unitprice','type'=>'xsd:double'), + 'vat_rate' => array('name'=>'vat_rate','type'=>'xsd:double'), + + 'remise' => array('name'=>'remise','type'=>'xsd:double'), + 'remise_percent' => array('name'=>'remise_percent','type'=>'xsd:double'), + + 'total_net' => array('name'=>'total_net','type'=>'xsd:double'), + 'total_vat' => array('name'=>'total_vat','type'=>'xsd:double'), + 'total' => array('name'=>'total','type'=>'xsd:double'), + + 'date_start' => array('name'=>'date_start','type'=>'xsd:date'), + 'date_end' => array('name'=>'date_end','type'=>'xsd:date'), + + // From product + 'product_id' => array('name'=>'product_id','type'=>'xsd:int'), + 'product_ref' => array('name'=>'product_ref','type'=>'xsd:string'), + 'product_label' => array('name'=>'product_label','type'=>'xsd:string'), + 'product_desc' => array('name'=>'product_desc','type'=>'xsd:string') +); + + +//Retreive all extrafield for thirdsparty +// fetch optionals attributes and labels +$extrafields=new ExtraFields($db); +$extralabels=$extrafields->fetch_name_optionals_label('commandedet',true); +if (count($extrafields)>0) { + $extrafield_line_array = array(); +} +foreach($extrafields->attribute_label as $key=>$label) +{ + //$value=$object->array_options["options_".$key]; + $type =$extrafields->attribute_type[$key]; + if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';} + else {$type='xsd:string';} + $extrafield_line_array['options_'.$key]=array('name'=>'options_'.$key,'type'=>$type); +} +$line_fields=array_merge($line_fields,$extrafield_line_array); + // Define other specific objects $server->wsdl->addComplexType( 'line', @@ -91,33 +138,7 @@ $server->wsdl->addComplexType( 'struct', 'all', '', - array( - 'id' => array('name'=>'id','type'=>'xsd:string'), - 'type' => array('name'=>'type','type'=>'xsd:int'), - 'fk_commande' => array('name'=>'fk_commande','type'=>'xsd:int'), - 'fk_parent_line' => array('name'=>'fk_parent_line','type'=>'xsd:int'), - 'desc' => array('name'=>'desc','type'=>'xsd:string'), - 'qty' => array('name'=>'qty','type'=>'xsd:double'), - 'price' => array('name'=>'price','type'=>'xsd:double'), - 'unitprice' => array('name'=>'unitprice','type'=>'xsd:double'), - 'vat_rate' => array('name'=>'vat_rate','type'=>'xsd:double'), - - 'remise' => array('name'=>'remise','type'=>'xsd:double'), - 'remise_percent' => array('name'=>'remise_percent','type'=>'xsd:double'), - - 'total_net' => array('name'=>'total_net','type'=>'xsd:double'), - 'total_vat' => array('name'=>'total_vat','type'=>'xsd:double'), - 'total' => array('name'=>'total','type'=>'xsd:double'), - - 'date_start' => array('name'=>'date_start','type'=>'xsd:date'), - 'date_end' => array('name'=>'date_end','type'=>'xsd:date'), - - // From product - 'product_id' => array('name'=>'product_id','type'=>'xsd:int'), - 'product_ref' => array('name'=>'product_ref','type'=>'xsd:string'), - 'product_label' => array('name'=>'product_label','type'=>'xsd:string'), - 'product_desc' => array('name'=>'product_desc','type'=>'xsd:string') - ) + $line_fields ); /*$server->wsdl->addComplexType( @@ -151,53 +172,73 @@ $server->wsdl->addComplexType( ) ); +$order_fields = array( + 'id' => array('name'=>'id','type'=>'xsd:string'), + 'ref' => array('name'=>'ref','type'=>'xsd:string'), + 'ref_client' => array('name'=>'ref_client','type'=>'xsd:string'), + 'ref_ext' => array('name'=>'ref_ext','type'=>'xsd:string'), + 'ref_int' => array('name'=>'ref_int','type'=>'xsd:string'), + 'thirdparty_id' => array('name'=>'thirdparty_id','type'=>'xsd:int'), + 'status' => array('name'=>'status','type'=>'xsd:int'), + 'billed' => array('name'=>'billed','type'=>'xsd:string'), + 'total_net' => array('name'=>'total_net','type'=>'xsd:double'), + 'total_vat' => array('name'=>'total_vat','type'=>'xsd:double'), + 'total_localtax1' => array('name'=>'total_localtax1','type'=>'xsd:double'), + 'total_localtax2' => array('name'=>'total_localtax2','type'=>'xsd:double'), + 'total' => array('name'=>'total','type'=>'xsd:double'), + 'date' => array('name'=>'date','type'=>'xsd:date'), + 'date_creation' => array('name'=>'date_creation','type'=>'xsd:dateTime'), + 'date_validation' => array('name'=>'date_validation','type'=>'xsd:dateTime'), + 'date_modification' => array('name'=>'date_modification','type'=>'xsd:dateTime'), + 'remise' => array('name'=>'remise','type'=>'xsd:string'), + 'remise_percent' => array('name'=>'remise_percent','type'=>'xsd:string'), + 'remise_absolue' => array('name'=>'remise_absolue','type'=>'xsd:string'), + 'source' => array('name'=>'source','type'=>'xsd:string'), + 'note_private' => array('name'=>'note_private','type'=>'xsd:string'), + 'note_public' => array('name'=>'note_public','type'=>'xsd:string'), + 'project_id' => array('name'=>'project_id','type'=>'xsd:string'), + + 'mode_reglement_id' => array('name'=>'mode_reglement_id','type'=>'xsd:string'), + 'mode_reglement_code' => array('name'=>'mode_reglement_code','type'=>'xsd:string'), + 'mode_reglement' => array('name'=>'mode_reglement','type'=>'xsd:string'), + 'cond_reglement_id' => array('name'=>'cond_reglement_id','type'=>'xsd:string'), + 'cond_reglement_code' => array('name'=>'cond_reglement_code','type'=>'xsd:string'), + 'cond_reglement' => array('name'=>'cond_reglement','type'=>'xsd:string'), + 'cond_reglement_doc' => array('name'=>'cond_reglement_doc','type'=>'xsd:string'), + + 'date_livraison' => array('name'=>'date_livraison','type'=>'xsd:date'), + 'fk_delivery_address' => array('name'=>'fk_delivery_address','type'=>'xsd:int'), + 'demand_reason_id' => array('name'=>'demand_reason_id','type'=>'xsd:string'), + + 'lines' => array('name'=>'lines','type'=>'tns:LinesArray2') +); + +//Retreive all extrafield for thirdsparty +// fetch optionals attributes and labels +$extrafields=new ExtraFields($db); +$extralabels=$extrafields->fetch_name_optionals_label('commande',true); +if (count($extrafields)>0) { + $extrafield_array = array(); +} +foreach($extrafields->attribute_label as $key=>$label) +{ + //$value=$object->array_options["options_".$key]; + $type =$extrafields->attribute_type[$key]; + if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';} + else {$type='xsd:string';} + $extrafield_array['options_'.$key]=array('name'=>'options_'.$key,'type'=>$type); +} +$order_fields=array_merge($order_fields,$extrafield_array); + $server->wsdl->addComplexType( 'order', 'complexType', 'struct', 'all', '', - array( - 'id' => array('name'=>'id','type'=>'xsd:string'), - 'ref' => array('name'=>'ref','type'=>'xsd:string'), - 'ref_client' => array('name'=>'ref_client','type'=>'xsd:string'), - 'ref_ext' => array('name'=>'ref_ext','type'=>'xsd:string'), - 'ref_int' => array('name'=>'ref_int','type'=>'xsd:string'), - 'thirdparty_id' => array('name'=>'thirdparty_id','type'=>'xsd:int'), - 'status' => array('name'=>'status','type'=>'xsd:int'), - 'facturee' => array('name'=>'facturee','type'=>'xsd:string'), - 'total_net' => array('name'=>'total_net','type'=>'xsd:double'), - 'total_vat' => array('name'=>'total_vat','type'=>'xsd:double'), - 'total_localtax1' => array('name'=>'total_localtax1','type'=>'xsd:double'), - 'total_localtax2' => array('name'=>'total_localtax2','type'=>'xsd:double'), - 'total' => array('name'=>'total','type'=>'xsd:double'), - 'date' => array('name'=>'date','type'=>'xsd:date'), - 'date_creation' => array('name'=>'date_creation','type'=>'xsd:dateTime'), - 'date_validation' => array('name'=>'date_validation','type'=>'xsd:dateTime'), - 'date_modification' => array('name'=>'date_modification','type'=>'xsd:dateTime'), - 'remise' => array('name'=>'remise','type'=>'xsd:string'), - 'remise_percent' => array('name'=>'remise_percent','type'=>'xsd:string'), - 'remise_absolue' => array('name'=>'remise_absolue','type'=>'xsd:string'), - 'source' => array('name'=>'source','type'=>'xsd:string'), - 'note_private' => array('name'=>'note_private','type'=>'xsd:string'), - 'note_public' => array('name'=>'note_public','type'=>'xsd:string'), - 'project_id' => array('name'=>'project_id','type'=>'xsd:string'), - - 'mode_reglement_id' => array('name'=>'mode_reglement_id','type'=>'xsd:string'), - 'mode_reglement_code' => array('name'=>'mode_reglement_code','type'=>'xsd:string'), - 'mode_reglement' => array('name'=>'mode_reglement','type'=>'xsd:string'), - 'cond_reglement_id' => array('name'=>'cond_reglement_id','type'=>'xsd:string'), - 'cond_reglement_code' => array('name'=>'cond_reglement_code','type'=>'xsd:string'), - 'cond_reglement' => array('name'=>'cond_reglement','type'=>'xsd:string'), - 'cond_reglement_doc' => array('name'=>'cond_reglement_doc','type'=>'xsd:string'), - - 'date_livraison' => array('name'=>'date_livraison','type'=>'xsd:date'), - 'fk_delivery_address' => array('name'=>'fk_delivery_address','type'=>'xsd:int'), - 'demand_reason_id' => array('name'=>'demand_reason_id','type'=>'xsd:string'), - - 'lines' => array('name'=>'lines','type'=>'tns:LinesArray2') - ) + $order_fields ); + /* $server->wsdl->addComplexType( 'OrdersArray', @@ -273,8 +314,17 @@ $server->register( 'WS to create an order' ); +$server->register( + 'updateOrder', + array('authentication'=>'tns:authentication','order'=>'tns:order'), // Entry values + array('result'=>'tns:result','id'=>'xsd:string','ref'=>'xsd:string','ref_ext'=>'xsd:string'), // Exit values + $ns, + $ns.'#updateOrder', + $styledoc, + $styleuse, + 'WS to update an order' +); -// Register WSDL $server->register( 'validOrder', array('authentication'=>'tns:authentication','id'=>'xsd:string'), // Entry values @@ -398,7 +448,7 @@ function getOrder($authentication,$id='',$ref='',$ref_ext='') 'remise_absolue' => $order->remise_absolue, 'source' => $order->source, - 'facturee' => $order->facturee, + 'billed' => $order->billed, 'note_private' => $order->note_private, 'note_public' => $order->note_public, 'cond_reglement_id' => $order->cond_reglement_id, @@ -555,7 +605,7 @@ function getOrdersForThirdParty($authentication,$idthirdparty) 'remise_absolue' => $order->remise_absolue, 'source' => $order->source, - 'facturee' => $order->facturee, + 'billed' => $order->billed, 'note_private' => $order->note_private, 'note_public' => $order->note_public, 'cond_reglement_id' => $order->cond_reglement_id, @@ -638,12 +688,22 @@ function createOrder($authentication,$order) $newobject->note_private=$order['note_private']; $newobject->note_public=$order['note_public']; $newobject->statut=0; // We start with status draft - $newobject->facturee=$order['facturee']; + $newobject->billed=$order['billed']; $newobject->fk_project=$order['project_id']; $newobject->cond_reglement_id=$order['cond_reglement_id']; $newobject->demand_reason_id=$order['demand_reason_id']; $newobject->date_creation=$now; + // Retrieve all extrafield for order + // fetch optionals attributes and labels + $extrafields=new ExtraFields($db); + $extralabels=$extrafields->fetch_name_optionals_label('commandet',true); + foreach($extrafields->attribute_label as $key=>$label) + { + $key='options_'.$key; + $newobject->array_options[$key]=$order[$key]; + } + // Trick because nusoap does not store data with same structure if there is one or several lines $arrayoflines=array(); if (isset($order['lines']['line'][0])) $arrayoflines=$order['lines']['line']; @@ -664,6 +724,19 @@ function createOrder($authentication,$order) $newline->total_ht=$line['total_net']; $newline->total_tva=$line['total_vat']; $newline->total_ttc=$line['total']; + $newline->date_start=$line['date_start']; + $newline->date_end=$line['date_end']; + + // Retrieve all extrafield for lines + // fetch optionals attributes and labels + $extrafields=new ExtraFields($db); + $extralabels=$extrafields->fetch_name_optionals_label('commandedet',true); + foreach($extrafields->attribute_label as $key=>$label) + { + $key='options_'.$key; + $newline->array_options[$key]=$line[$key]; + } + $newobject->lines[]=$newline; } @@ -755,7 +828,7 @@ function validOrder($authentication,$id='') { // Define output language $outputlangs = $langs; - commande_pdf_create($db, $order, $order->modelpdf, $outputlangs, 0, 0, 0); + $order->generateDocument($order->modelpdf, $outputlangs); } else @@ -798,5 +871,109 @@ function validOrder($authentication,$id='') return $objectresp; } +/** + * Update an order + * + * @param array $authentication Array of authentication information + * @param array $order Order info + * @return array Array result + */ +function updateOrder($authentication,$order) +{ + global $db,$conf,$langs; + + $now=dol_now(); + + dol_syslog("Function: updateOrder login=".$authentication['login']); + + if ($authentication['entity']) $conf->entity=$authentication['entity']; + + // Init and check authentication + $objectresp=array(); + $errorcode='';$errorlabel=''; + $error=0; + $fuser=check_authentication($authentication,$error,$errorcode,$errorlabel); + // Check parameters + if (empty($order['id']) && empty($order['ref']) && empty($order['ref_ext'])) { + $error++; $errorcode='KO'; $errorlabel="Order id or ref or ref_ext is mandatory."; + } + + if (! $error) + { + $objectfound=false; + + include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + + $object=new Commande($db); + $result=$object->fetch($order['id'],(empty($order['id'])?$order['ref']:''),(empty($order['id']) && empty($order['ref'])?$order['ref_ext']:'')); + + if (!empty($object->id)) { + + $objectfound=true; + + $db->begin(); + + if (isset($order['status'])) + { + if ($order['status'] == -1) $result=$object->cancel($fuser); + if ($order['status'] == 1) $result=$object->valid($fuser); + if ($order['status'] == 0) $result=$object->set_reopen($fuser); + if ($order['status'] == 3) $result=$object->cloture($fuser); + } + + if (isset($order['billed'])) + { + if ($order['billed']) $result=$object->classifyBilled($fuser); + if (! $order['billed']) $result=$object->classifyBilled($fuser); + } + + //Retreive all extrafield for object + // fetch optionals attributes and labels + $extrafields=new ExtraFields($db); + $extralabels=$extrafields->fetch_name_optionals_label('commande',true); + foreach($extrafields->attribute_label as $key=>$label) + { + $key='options_'.$key; + if (isset($order[$key])) + { + $result=$object->setValueFrom($key, $order[$key], 'commande_extrafields'); + } + } + + if ($result <= 0) { + $error++; + } + } + + if ((! $error) && ($objectfound)) + { + $db->commit(); + $objectresp=array( + 'result'=>array('result_code'=>'OK', 'result_label'=>''), + 'id'=>$object->id + ); + } + elseif ($objectfound) + { + $db->rollback(); + $error++; + $errorcode='KO'; + $errorlabel=$object->error; + } else { + $error++; + $errorcode='NOT_FOUND'; + $errorlabel='Order id='.$order['id'].' ref='.$order['ref'].' ref_ext='.$order['ref_ext'].' cannot be found'; + } + } + + if ($error) + { + $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + } + + return $objectresp; +} + + // Return the results. $server->service(file_get_contents("php://input")); diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index ffe25f8e3e8..6f36b664a3b 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -327,7 +327,7 @@ $server->register( * @param array $authentication Array of authentication information * @param int $id Id of object * @param string $ref Ref of object - * @param ref_ext $ref_ext Ref external of object + * @param string $ref_ext Ref external of object * @param string $lang Lang to force * @return mixed */ @@ -378,7 +378,7 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang='' if (! empty($product->multilangs[$langs->defaultlang]["label"])) $product->label = $product->multilangs[$langs->defaultlang]["label"]; if (! empty($product->multilangs[$langs->defaultlang]["description"])) $product->description = $product->multilangs[$langs->defaultlang]["description"]; if (! empty($product->multilangs[$langs->defaultlang]["note"])) $product->note = $product->multilangs[$langs->defaultlang]["note"]; - + $productorservice_result_fields = array( 'id' => $product->id, 'ref' => $product->ref, @@ -396,7 +396,7 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang='' 'country_id' => $product->country_id>0?$product->country_id:'', 'country_code' => $product->country_code, 'custom_code' => $product->customcode, - + 'price_net' => $product->price, 'price' => $product->price_ttc, 'price_min_net' => $product->price_min, @@ -408,7 +408,7 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang='' //! Spanish local taxes 'localtax1_tx' => $product->localtax1_tx, 'localtax2_tx' => $product->localtax2_tx, - + 'stock_real' => $product->stock_reel, 'stock_alert' => $product->seuil_stock_alerte, 'pmp' => $product->pmp, @@ -416,19 +416,19 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang='' 'dir' => $pdir, 'images' => $product->liste_photos($dir,$nbmax=10) ); - + //Retreive all extrafield for thirdsparty // fetch optionals attributes and labels $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('product',true); //Get extrafield values $product->fetch_optionals($product->id,$extralabels); - + foreach($extrafields->attribute_label as $key=>$label) { $productorservice_result_fields=array_merge($productorservice_result_fields,array('options_'.$key => $product->array_options['options_'.$key])); } - + // Create $objectresp = array( 'result'=>array('result_code'=>'OK', 'result_label'=>''), @@ -533,7 +533,7 @@ function createProductOrService($authentication,$product) }*/ //var_dump($product['ref_ext']); //var_dump($product['lines'][0]['type']); - + $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('product',true); foreach($extrafields->attribute_label as $key=>$label) @@ -652,7 +652,7 @@ function updateProductOrService($authentication,$product) }*/ //var_dump($product['ref_ext']); //var_dump($product['lines'][0]['type']); - + $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('product',true); foreach($extrafields->attribute_label as $key=>$label) @@ -965,19 +965,19 @@ function getProductsForCategory($authentication,$id,$lang='') 'dir' => $pdir, 'images' => $obj->liste_photos($dir,$nbmax=10) ); - + //Retreive all extrafield for thirdsparty // fetch optionals attributes and labels $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('product',true); //Get extrafield values $product->fetch_optionals($obj->id,$extralabels); - + foreach($extrafields->attribute_label as $key=>$label) { $products[$iProduct]=array_merge($products[$iProduct],array('options_'.$key => $product->array_options['options_'.$key])); } - + $iProduct++; } diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 301511e0115..696723f7247 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -460,7 +460,7 @@ function createThirdParty($authentication,$thirdparty) $result=$newobject->create($fuser); if ($newobject->particulier && $result > 0) { $newobject->firstname = $thirdparty['firstname']; - $newobject->name_bis = $thirdparty['ref']; + $newobject->name_bis = $thirdparty['lastname']; $result = $newobject->create_individual($fuser); } if ($result <= 0) @@ -629,7 +629,7 @@ function updateThirdParty($authentication,$thirdparty) * getListOfThirdParties * * @param array $authentication Array of authentication information - * @param array $filterthirdparty Filter fields + * @param array $filterthirdparty Filter fields (key=>value to filer on. For example 'client'=>2, 'supplier'=>1, 'category'=>idcateg, 'name'=>'searchstring', ...) * @return array Array result */ function getListOfThirdParties($authentication,$filterthirdparty) @@ -661,9 +661,10 @@ function getListOfThirdParties($authentication,$filterthirdparty) $sql.=" WHERE entity=".$conf->entity; foreach($filterthirdparty as $key => $val) { - if ($key == 'client' && $val != '') $sql.=" AND s.client = ".$db->escape($val); + if ($key == 'name' && $val != '') $sql.=" AND s.name LIKE '%".$db->escape($val)."%'"; + if ($key == 'client' && $val != '') $sql.=" AND s.client = ".$db->escape($val); if ($key == 'supplier' && $val != '') $sql.=" AND s.fournisseur = ".$db->escape($val); - if ($key == 'category' && $val != '') $sql.=" AND s.rowid IN (SELECT fk_societe FROM ".MAIN_DB_PREFIX."categorie_societe WHERE fk_categorie=".$db->escape($val).") "; + if ($key == 'category' && $val != '') $sql.=" AND s.rowid IN (SELECT fk_societe FROM ".MAIN_DB_PREFIX."categorie_societe WHERE fk_categorie=".$db->escape($val).") "; } dol_syslog("Function: getListOfThirdParties", LOG_DEBUG); diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 4fb5cc81e8c..6339486922f 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -299,7 +299,7 @@ $server->register( * @param array $authentication Array of authentication information * @param int $id Id of object * @param string $ref Ref of object - * @param ref_ext $ref_ext Ref external of object + * @param string $ref_ext Ref external of object * @return mixed */ function getUser($authentication,$id,$ref='',$ref_ext='') diff --git a/scripts/accountancy/export-thirdpartyaccount.php b/scripts/accountancy/export-thirdpartyaccount.php old mode 100644 new mode 100755 diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index b1577cb26a2..1de66b491ed 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -226,7 +226,7 @@ if ($resql) { //Update status communication of thirdparty prospect $sqlx = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".$obj2->rowid.")"; - dol_syslog("fiche.php: set prospect thirdparty status", LOG_DEBUG); + dol_syslog("card.php: set prospect thirdparty status", LOG_DEBUG); $resqlx=$db->query($sqlx); if (! $resqlx) { @@ -236,7 +236,7 @@ if ($resql) //Update status communication of contact prospect $sqlx = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.rowid=".$obj2->rowid." AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)"; - dol_syslog("fiche.php: set prospect contact status", LOG_DEBUG); + dol_syslog("card.php: set prospect contact status", LOG_DEBUG); $resqlx=$db->query($sqlx); if (! $resqlx) diff --git a/scripts/invoices/rebuild_merge_pdf.php b/scripts/invoices/rebuild_merge_pdf.php index 357a09ccdbe..6fbcdb59538 100755 --- a/scripts/invoices/rebuild_merge_pdf.php +++ b/scripts/invoices/rebuild_merge_pdf.php @@ -71,6 +71,7 @@ $newlangid='en_EN'; // To force a new lang id $filter=array(); $regenerate=''; // Ask regenerate (contains name of model to use) $option=''; +$fileprefix='mergedpdf'; foreach ($argv as $key => $value) { @@ -84,6 +85,13 @@ foreach ($argv as $key => $value) $newlangid=$valarray[1]; print 'Use language '.$newlangid.".\n"; } + if (preg_match('/^prefix=/i',$value)) + { + $found=true; + $valarray=explode('=',$value); + $fileprefix=$valarray[1]; + print 'Use prefix for filename '.$fileprefix.".\n"; + } if (preg_match('/^regenerate=(.*)/i',$value,$reg)) { @@ -232,7 +240,7 @@ if (in_array('bank',$filter) && in_array('nopayment',$filter)) // Define SQL and SQL request to select invoices // Use $filter, $dateafterdate, datebeforedate, $paymentdateafter, $paymentdatebefore -$result=rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, 1, $regenerate, $option, $paymentonbankid, $thirdpartiesid); +$result=rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, 1, $regenerate, $option, $paymentonbankid, $thirdpartiesid, $fileprefix); @@ -283,6 +291,7 @@ function usage() print "To limit to some thirdparties, use filter=onlythirdparties id1,id2...\n"; print "To regenerate existing PDF, use regenerate=crabe\n"; print "To generate invoices in a language, use lang=xx_XX\n"; + print "To set prefix of generated file name, use prefix=myfileprefix\n"; print "\n"; print "Example: ".$script_file." filter=payments 20080101 20081231 lang=fr_FR regenerate=crabe\n"; print "Example: ".$script_file." filter=all lang=en_US\n"; diff --git a/scripts/odt2pdf/odt2pdf.sh b/scripts/odt2pdf/odt2pdf.sh index 0599e4291c5..9d9bf18a8c7 100755 --- a/scripts/odt2pdf/odt2pdf.sh +++ b/scripts/odt2pdf/odt2pdf.sh @@ -22,7 +22,7 @@ if [ -f "$1.odt" ] nbprocess=$(pgrep -c soffice) if [ $nbprocess -ne 1 ] then - soffice --invisible --accept="socket,host=127.0.0.1,port=8100;urp;" --nofirststartwizard --headless& + soffice --invisible --accept="socket,host=127.0.0.1,port=8100;urp;" --nofirststartwizard --headless & retcode=$? if [ $retcode -ne 0 ] then diff --git a/scripts/user/sync_groups_ldap2dolibarr.php b/scripts/user/sync_groups_ldap2dolibarr.php index c6bed990c14..93406276ead 100755 --- a/scripts/user/sync_groups_ldap2dolibarr.php +++ b/scripts/user/sync_groups_ldap2dolibarr.php @@ -136,19 +136,20 @@ if ($result >= 0) { $group = new UserGroup($db); $group->fetch('', $ldapgroup[$conf->global->LDAP_KEY_GROUPS]); - $group->nom = $ldapgroup[$conf->global->LDAP_GROUP_FIELD_FULLNAME]; + $group->name = $ldapgroup[$conf->global->LDAP_GROUP_FIELD_FULLNAME]; + $group->nom = $group->name; // For backward compatibility $group->note = $ldapgroup[$conf->global->LDAP_GROUP_FIELD_DESCRIPTION]; $group->entity = $conf->entity; //print_r($ldapgroup); if($group->id > 0) { // Group update - print $langs->transnoentities("GroupUpdate").' # '.$key.': name='.$group->nom; + print $langs->transnoentities("GroupUpdate").' # '.$key.': name='.$group->name; $res=$group->update(); if ($res > 0) { - print ' --> Updated group id='.$group->id.' name='.$group->nom; + print ' --> Updated group id='.$group->id.' name='.$group->name; } else { @@ -157,12 +158,12 @@ if ($result >= 0) } print "\n"; } else { // Group creation - print $langs->transnoentities("GroupCreate").' # '.$key.': name='.$group->nom; + print $langs->transnoentities("GroupCreate").' # '.$key.': name='.$group->name; $res=$group->create(); if ($res > 0) { - print ' --> Created group id='.$group->id.' name='.$group->nom; + print ' --> Created group id='.$group->id.' name='.$group->name; } else { diff --git a/test/phpunit/AdherentTest.php b/test/phpunit/AdherentTest.php index f9db37ab79e..334e42eb5f9 100644 --- a/test/phpunit/AdherentTest.php +++ b/test/phpunit/AdherentTest.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013 Marcos García +/* Copyright (C) 2010 Laurent Destailleur + * Copyright (C) 2013 Marcos García * * 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 @@ -19,9 +19,9 @@ /** * \file test/phpunit/AdherentTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; @@ -31,11 +31,10 @@ require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/adherents/class/adherent.class.php'; require_once dirname(__FILE__).'/../../htdocs/adherents/class/adherent_type.class.php'; -if (empty($user->id)) -{ - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -49,72 +48,77 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; */ class AdherentTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return AdherentTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return AdherentTest + */ + function __construct() { - global $conf,$user,$langs,$db; - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; - if (! empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { print "\n".__METHOD__." Company must be setup to have name-firstname in order 'Firstname Lastname'\n"; die(); } - - print __METHOD__."\n"; + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + if (! empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { + print "\n".__METHOD__." Company must be setup to have name-firstname in order 'Firstname Lastname'\n"; + die(); + } + + print __METHOD__."\n"; + } + + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * End phpunit tests - * - * @return void - */ + /** + * End phpunit tests + * + * @return void + */ protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } /** @@ -124,71 +128,71 @@ class AdherentTest extends PHPUnit_Framework_TestCase */ public function testAdherentTypeCreate() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new AdherentType($this->savdb); - $localobject->statut=1; - $localobject->libelle='Adherent type test'; - $localobject->cotisation=1; - $localobject->vote=1; - $result=$localobject->create($user); + $localobject=new AdherentType($this->savdb); + $localobject->statut=1; + $localobject->libelle='Adherent type test'; + $localobject->cotisation=1; + $localobject->vote=1; + $result=$localobject->create($user); print __METHOD__." result=".$result."\n"; - $this->assertLessThan($result, 0); + $this->assertLessThan($result, 0); - return $localobject->id; + return $localobject->id; } /** * testAdherentCreate * - * @param int $fk_adherent_type Id type of member - * @return int + * @param int $fk_adherent_type Id type of member + * @return int * * @depends testAdherentTypeCreate * The depends says test is run only if previous is ok */ public function testAdherentCreate($fk_adherent_type) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Adherent($this->savdb); - $localobject->initAsSpecimen(); - $localobject->typeid=$fk_adherent_type; - $result=$localobject->create($user); + $localobject=new Adherent($this->savdb); + $localobject->initAsSpecimen(); + $localobject->typeid=$fk_adherent_type; + $result=$localobject->create($user); print __METHOD__." result=".$result."\n"; - $this->assertLessThan($result, 0); + $this->assertLessThan($result, 0); - return $result; + return $result; } /** * testAdherentFetch * - * @param int $id Id of object to fetch - * @return object Fetched object + * @param int $id Id of object to fetch + * @return object Fetched object * * @depends testAdherentCreate * The depends says test is run only if previous is ok */ public function testAdherentFetch($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Adherent($this->savdb); - $result=$localobject->fetch($id); - print __METHOD__." id=".$id." result=".$result."\n"; + $localobject=new Adherent($this->savdb); + $result=$localobject->fetch($id); + print __METHOD__." id=".$id." result=".$result."\n"; $this->assertLessThan($result, 0); return $localobject; @@ -222,78 +226,78 @@ class AdherentTest extends PHPUnit_Framework_TestCase /** * testAdherentUpdate * - * @param Adherent $localobject Member instance - * @return Adherent + * @param Adherent $localobject Member instance + * @return Adherent * - * @depends testAdherentFetchLogin + * @depends testAdherentFetchLogin * The depends says test is run only if previous is ok */ public function testAdherentUpdate(Adherent $localobject) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; $timestamp = dol_now(); $localobject->civility_id = 0; - $localobject->login='newlogin'; - $localobject->societe='New company'; - $localobject->note='New note after update'; - //$localobject->note_public='New note public after update'; - $localobject->lastname='New name'; - $localobject->firstname='New firstname'; - $localobject->address='New address'; - $localobject->zip='New zip'; - $localobject->town='New town'; - $localobject->country_id=2; - $localobject->statut=0; + $localobject->login='newlogin'; + $localobject->societe='New company'; + $localobject->note='New note after update'; + //$localobject->note_public='New note public after update'; + $localobject->lastname='New name'; + $localobject->firstname='New firstname'; + $localobject->address='New address'; + $localobject->zip='New zip'; + $localobject->town='New town'; + $localobject->country_id=2; + $localobject->statut=0; $localobject->morphy=0; - $localobject->phone='New tel pro'; - $localobject->phone_perso='New tel perso'; - $localobject->phone_mobile='New tel mobile'; - $localobject->email='newemail@newemail.com'; + $localobject->phone='New tel pro'; + $localobject->phone_perso='New tel perso'; + $localobject->phone_mobile='New tel mobile'; + $localobject->email='newemail@newemail.com'; $localobject->birth=$timestamp; - $result=$localobject->update($user); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); - $result=$localobject->update_note($localobject->note); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); - //$result=$localobject->update_note_public($localobject->note_public); - //print __METHOD__." id=".$localobject->id." result=".$result."\n"; - //$this->assertLessThan($result, 0); + $result=$localobject->update($user); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + $result=$localobject->update_note($localobject->note); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + //$result=$localobject->update_note_public($localobject->note_public); + //print __METHOD__." id=".$localobject->id." result=".$result."\n"; + //$this->assertLessThan($result, 0); - $newobject=new Adherent($this->savdb); - $result=$newobject->fetch($localobject->id); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); + $newobject=new Adherent($this->savdb); + $result=$newobject->fetch($localobject->id); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); $this->assertEquals($localobject->civility_id, $newobject->civility_id); - $this->assertEquals($localobject->login, $newobject->login); - $this->assertEquals($localobject->societe, $newobject->societe); - $this->assertEquals($localobject->note, $newobject->note); - //$this->assertEquals($localobject->note_public, $newobject->note_public); - $this->assertEquals($localobject->lastname, $newobject->lastname); - $this->assertEquals($localobject->firstname, $newobject->firstname); - $this->assertEquals($localobject->address, $newobject->address); - $this->assertEquals($localobject->zip, $newobject->zip); - $this->assertEquals($localobject->town, $newobject->town); - $this->assertEquals($localobject->country_id, $newobject->country_id); - $this->assertEquals('BE', $newobject->country_code); + $this->assertEquals($localobject->login, $newobject->login); + $this->assertEquals($localobject->societe, $newobject->societe); + $this->assertEquals($localobject->note, $newobject->note); + //$this->assertEquals($localobject->note_public, $newobject->note_public); + $this->assertEquals($localobject->lastname, $newobject->lastname); + $this->assertEquals($localobject->firstname, $newobject->firstname); + $this->assertEquals($localobject->address, $newobject->address); + $this->assertEquals($localobject->zip, $newobject->zip); + $this->assertEquals($localobject->town, $newobject->town); + $this->assertEquals($localobject->country_id, $newobject->country_id); + $this->assertEquals('BE', $newobject->country_code); $this->assertEquals('Belgium', $newobject->country); - $this->assertEquals($localobject->statut, $newobject->statut); - $this->assertEquals($localobject->phone, $newobject->phone); - $this->assertEquals($localobject->phone_perso, $newobject->phone_perso); - $this->assertEquals($localobject->phone_mobile, $newobject->phone_mobile); - $this->assertEquals($localobject->email, $newobject->email); + $this->assertEquals($localobject->statut, $newobject->statut); + $this->assertEquals($localobject->phone, $newobject->phone); + $this->assertEquals($localobject->phone_perso, $newobject->phone_perso); + $this->assertEquals($localobject->phone_mobile, $newobject->phone_mobile); + $this->assertEquals($localobject->email, $newobject->email); $this->assertEquals($localobject->birth, $timestamp); $this->assertEquals($localobject->morphy, $newobject->morphy); //We return newobject because of new values - return $newobject; + return $newobject; } /** @@ -430,24 +434,24 @@ class AdherentTest extends PHPUnit_Framework_TestCase */ public function testAdherentValidate(Adherent $localobject) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $result=$localobject->validate($user); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); + $result=$localobject->validate($user); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); - return $localobject; + return $localobject; } /** * testAdherentOther * - * @param Adherent $localobject Member instance - * @return int Id of object + * @param Adherent $localobject Member instance + * @return int Id of object * * @depends testAdherentValidate * The depends says test is run only if previous is ok @@ -520,17 +524,43 @@ class AdherentTest extends PHPUnit_Framework_TestCase */ public function testAdherentDelete($localobject) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $result=$localobject->delete($localobject->id); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); + $result=$localobject->delete($localobject->id); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); - return $result; + return $localobject; } + + /** + * testAdherentTypeDelete + * + * @param Adherent $localobject Member instance + * @return void + * + * @depends testAdherentDelete + * The depends says test is run only if previous is ok + */ + public function testAdherentTypeDelete($localobject) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $localobjectat=new AdherentType($this->savdb); + $result=$localobjectat->fetch($localobject->typeid); + $result=$localobjectat->delete(); + print __METHOD__." result=".$result."\n"; + $this->assertLessThan($result, 0); + + return $localobject->id; + } } diff --git a/test/phpunit/AdminLibTest.php b/test/phpunit/AdminLibTest.php index 90b0951cc86..bef0c2eff9d 100644 --- a/test/phpunit/AdminLibTest.php +++ b/test/phpunit/AdminLibTest.php @@ -18,9 +18,9 @@ /** * \file test/phpunit/AdminLibTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; @@ -29,11 +29,10 @@ global $conf,$user,$langs,$db; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/core/lib/admin.lib.php'; -if (empty($user->id)) -{ - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -43,74 +42,76 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * * @backupGlobals disabled * @backupStaticAttributes enabled - * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. + * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ class AdminLibTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return AdminLibTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return AdminLibTest + */ + function __construct() { - global $conf,$user,$langs,$db; - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; - print __METHOD__."\n"; + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * End phpunit tests - * - * @return void - */ + /** + * End phpunit tests + * + * @return void + */ protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } /** @@ -120,25 +121,25 @@ class AdminLibTest extends PHPUnit_Framework_TestCase */ public function testVersionCompare() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $result=versioncompare(array(3,1,-4),array(3,1,1)); - print __METHOD__." result=".$result."\n"; - $this->assertEquals(-3,$result); - $result=versioncompare(array(3,1,0),array(3,1,1)); - print __METHOD__." result=".$result."\n"; - $this->assertEquals(-3,$result); - $result=versioncompare(array(3,1,0),array(3,2,0)); - print __METHOD__." result=".$result."\n"; - $this->assertEquals(-2,$result); - $result=versioncompare(array(3,1,0),array(3,1,0)); - print __METHOD__." result=".$result."\n"; - $this->assertEquals(0,$result); + $result=versioncompare(array(3,1,-4),array(3,1,1)); + print __METHOD__." result=".$result."\n"; + $this->assertEquals(-3,$result); + $result=versioncompare(array(3,1,0),array(3,1,1)); + print __METHOD__." result=".$result."\n"; + $this->assertEquals(-3,$result); + $result=versioncompare(array(3,1,0),array(3,2,0)); + print __METHOD__." result=".$result."\n"; + $this->assertEquals(-2,$result); + $result=versioncompare(array(3,1,0),array(3,1,0)); + print __METHOD__." result=".$result."\n"; + $this->assertEquals(0,$result); - return $result; + return $result; } } diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index d8dda85f2fc..5f5d3f940bb 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -1,6 +1,6 @@ - * Copyright (C) 2011-2012 Regis Houssin +/* Copyright (C) 2010-2012 Laurent Destailleur + * Copyright (C) 2011-2012 Regis Houssin * * 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 @@ -19,32 +19,29 @@ /** * \file test/phpunit/AllTest.php - * \ingroup test + * \ingroup test * \brief This file is a test suite to run all unit tests - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ print "PHP Version: ".phpversion()."\n"; print "Memory: ". ini_get('memory_limit')."\n"; global $conf,$user,$langs,$db; -//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver +//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver //require_once 'PHPUnit/Autoload.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; -if ($langs->defaultlang != 'en_US') -{ +if ($langs->defaultlang != 'en_US') { print "Error: Default language for company to run tests must be set to en_US or auto. Current is ".$langs->defaultlang."\n"; exit; } -if (! empty($conf->google->enabled)) -{ - print "Warning: Google module should not be enabled.\n"; +if (! empty($conf->google->enabled)) { + print "Warning: Google module should not be enabled.\n"; } -if (empty($user->id)) -{ - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -59,37 +56,37 @@ class AllTests * * @return void */ - public static function suite() + public static function suite() { - $suite = new PHPUnit_Framework_TestSuite('PHPUnit Framework'); + $suite = new PHPUnit_Framework_TestSuite('PHPUnit Framework'); //require_once dirname(__FILE__).'/CoreTest.php'; //$suite->addTestSuite('CoreTest'); - require_once dirname(__FILE__).'/AdminLibTest.php'; - $suite->addTestSuite('AdminLibTest'); - require_once dirname(__FILE__).'/DateLibTest.php'; - $suite->addTestSuite('DateLibTest'); - //require_once dirname(__FILE__).'/DateLibTzFranceTest.php'; - //$suite->addTestSuite('DateLibTzFranceTest'); - require_once dirname(__FILE__).'/MarginsLibTest.php'; - $suite->addTestSuite('MarginsLibTest'); - require_once dirname(__FILE__).'/FilesLibTest.php'; - $suite->addTestSuite('FilesLibTest'); - require_once dirname(__FILE__).'/JsonLibTest.php'; - $suite->addTestSuite('JsonLibTest'); - require_once dirname(__FILE__).'/ImagesLibTest.php'; - $suite->addTestSuite('ImagesLibTest'); - require_once dirname(__FILE__).'/FunctionsLibTest.php'; - $suite->addTestSuite('FunctionsLibTest'); - require_once dirname(__FILE__).'/Functions2LibTest.php'; - $suite->addTestSuite('Functions2LibTest'); - require_once dirname(__FILE__).'/XCalLibTest.php'; - $suite->addTestSuite('XCalLibTest'); + require_once dirname(__FILE__).'/AdminLibTest.php'; + $suite->addTestSuite('AdminLibTest'); + require_once dirname(__FILE__).'/DateLibTest.php'; + $suite->addTestSuite('DateLibTest'); + //require_once dirname(__FILE__).'/DateLibTzFranceTest.php'; + //$suite->addTestSuite('DateLibTzFranceTest'); + require_once dirname(__FILE__).'/MarginsLibTest.php'; + $suite->addTestSuite('MarginsLibTest'); + require_once dirname(__FILE__).'/FilesLibTest.php'; + $suite->addTestSuite('FilesLibTest'); + require_once dirname(__FILE__).'/JsonLibTest.php'; + $suite->addTestSuite('JsonLibTest'); + require_once dirname(__FILE__).'/ImagesLibTest.php'; + $suite->addTestSuite('ImagesLibTest'); + require_once dirname(__FILE__).'/FunctionsLibTest.php'; + $suite->addTestSuite('FunctionsLibTest'); + require_once dirname(__FILE__).'/Functions2LibTest.php'; + $suite->addTestSuite('Functions2LibTest'); + require_once dirname(__FILE__).'/XCalLibTest.php'; + $suite->addTestSuite('XCalLibTest'); - require_once dirname(__FILE__).'/LangTest.php'; - $suite->addTestSuite('LangTest'); - require_once dirname(__FILE__).'/SqlTest.php'; - $suite->addTestSuite('SqlTest'); + require_once dirname(__FILE__).'/LangTest.php'; + $suite->addTestSuite('LangTest'); + require_once dirname(__FILE__).'/SqlTest.php'; + $suite->addTestSuite('SqlTest'); require_once dirname(__FILE__).'/SecurityTest.php'; $suite->addTestSuite('SecurityTest'); @@ -98,8 +95,8 @@ class AllTests $suite->addTestSuite('NumberingModulesTest'); require_once dirname(__FILE__).'/PgsqlTest.php'; $suite->addTestSuite('PgsqlTest'); - require_once dirname(__FILE__).'/PdfDocTest.php'; - $suite->addTestSuite('PdfDocTest'); + require_once dirname(__FILE__).'/PdfDocTest.php'; + $suite->addTestSuite('PdfDocTest'); require_once dirname(__FILE__).'/BuildDocTest.php'; $suite->addTestSuite('BuildDocTest'); require_once dirname(__FILE__).'/CMailFileTest.php'; @@ -123,14 +120,21 @@ class AllTests require_once dirname(__FILE__).'/DiscountTest.php'; $suite->addTestSuite('DiscountTest'); + require_once dirname(__FILE__).'/ContratTest.php'; + $suite->addTestSuite('ContratTest'); + + require_once dirname(__FILE__).'/FichinterTest.php'; + $suite->addTestSuite('FichinterTest'); + + require_once dirname(__FILE__).'/PropalTest.php'; + $suite->addTestSuite('PropalTest'); + require_once dirname(__FILE__).'/CommandeTest.php'; $suite->addTestSuite('CommandeTest'); require_once dirname(__FILE__).'/CommandeFournisseurTest.php'; $suite->addTestSuite('CommandeFournisseurTest'); - require_once dirname(__FILE__).'/ContratTest.php'; - $suite->addTestSuite('ContratTest'); require_once dirname(__FILE__).'/FactureTest.php'; $suite->addTestSuite('FactureTest'); require_once dirname(__FILE__).'/FactureRecTest.php'; @@ -139,15 +143,14 @@ class AllTests $suite->addTestSuite('FactureTestRounding'); require_once dirname(__FILE__).'/FactureFournisseurTest.php'; $suite->addTestSuite('FactureFournisseurTest'); - require_once dirname(__FILE__).'/PropalTest.php'; - $suite->addTestSuite('PropalTest'); - require_once dirname(__FILE__).'/UserTest.php'; + + require_once dirname(__FILE__).'/UserTest.php'; $suite->addTestSuite('UserTest'); - require_once dirname(__FILE__).'/UserGroupTest.php'; + require_once dirname(__FILE__).'/UserGroupTest.php'; $suite->addTestSuite('UserGroupTest'); require_once dirname(__FILE__).'/BankAccountTest.php'; $suite->addTestSuite('BankAccountTest'); - require_once dirname(__FILE__).'/CompanyBankAccountTest.php'; + require_once dirname(__FILE__).'/CompanyBankAccountTest.php'; $suite->addTestSuite('CompanyBankAccountTest'); require_once dirname(__FILE__).'/ChargeSocialesTest.php'; $suite->addTestSuite('ChargeSocialesTest'); @@ -189,7 +192,7 @@ class AllTests // GUI require_once dirname(__FILE__).'/FormAdminTest.php'; - $suite->addTestSuite('FormAdminTest'); + $suite->addTestSuite('FormAdminTest'); return $suite; diff --git a/test/phpunit/BankAccountTest.php b/test/phpunit/BankAccountTest.php index 4983f1e2173..fa952b86640 100644 --- a/test/phpunit/BankAccountTest.php +++ b/test/phpunit/BankAccountTest.php @@ -18,9 +18,9 @@ /** * \file test/phpunit/ContratTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; @@ -29,11 +29,10 @@ global $conf,$user,$langs,$db; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/compta/bank/class/account.class.php'; -if (empty($user->id)) -{ - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -49,127 +48,129 @@ $langs->load("main"); */ class BankAccountTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return BankAccountTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return BankAccountTest + */ + function __construct() { - global $conf,$user,$langs,$db; - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; - print __METHOD__."\n"; + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * End phpunit tests - * - * @return void - */ + /** + * End phpunit tests + * + * @return void + */ protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } /** * testBankAccountCreate * - * @return int + * @return int */ public function testBankAccountCreate() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Account($this->savdb); - $localobject->initAsSpecimen(); - $localobject->date_solde=dol_now(); - $result=$localobject->create($user); + $localobject=new Account($this->savdb); + $localobject->initAsSpecimen(); + $localobject->date_solde=dol_now(); + $result=$localobject->create($user); - print __METHOD__." result=".$result."\n"; - $this->assertLessThan($result, 0); + print __METHOD__." result=".$result."\n"; + $this->assertLessThan($result, 0); - return $result; + return $result; } /** * testBankAccountFetch * - * @param int $id Id of contract - * @return int + * @param int $id Id of contract + * @return int * - * @depends testBankAccountCreate + * @depends testBankAccountCreate * The depends says test is run only if previous is ok */ public function testBankAccountFetch($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Account($this->savdb); - $result=$localobject->fetch($id); + $localobject=new Account($this->savdb); + $result=$localobject->fetch($id); - print __METHOD__." id=".$id." result=".$result."\n"; - $this->assertLessThan($result, 0); + print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertLessThan($result, 0); - return $localobject; + return $localobject; } /** * testBankAccountOther * - * @param Object $localobject Object contract - * @return int + * @param Object $localobject Object contract + * @return int * * @depends testBankAccountFetch * The depends says test is run only if previous is ok @@ -197,27 +198,27 @@ class BankAccountTest extends PHPUnit_Framework_TestCase /** * testBankAccountDelete * - * @param int $id Id of contract - * @return int + * @param int $id Id of contract + * @return int * - * @depends testBankAccountOther + * @depends testBankAccountOther * The depends says test is run only if previous is ok */ public function testBankAccountDelete($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Account($this->savdb); - $result=$localobject->fetch($id); - $result=$localobject->delete($id); + $localobject=new Account($this->savdb); + $result=$localobject->fetch($id); + $result=$localobject->delete($id); - print __METHOD__." id=".$id." result=".$result."\n"; - $this->assertLessThan($result, 0); - return $result; + print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $result; } } diff --git a/test/phpunit/BuildDocTest.php b/test/phpunit/BuildDocTest.php index 50f9598e79e..99098c432ea 100644 --- a/test/phpunit/BuildDocTest.php +++ b/test/phpunit/BuildDocTest.php @@ -1,6 +1,6 @@ - * Copyright (C) 2012 Regis Houssin +/* Copyright (C) 2010-2012 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin * * 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 @@ -19,9 +19,9 @@ /** * \file test/phpunit/BuildDocTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; @@ -42,7 +42,7 @@ require_once dirname(__FILE__).'/../../htdocs/core/lib/pdf.lib.php'; require_once dirname(__FILE__).'/../../htdocs/core/modules/facture/doc/pdf_crabe.modules.php'; require_once dirname(__FILE__).'/../../htdocs/core/modules/propale/doc/pdf_azur.modules.php'; require_once dirname(__FILE__).'/../../htdocs/core/modules/commande/doc/pdf_einstein.modules.php'; -require_once dirname(__FILE__).'/../../htdocs/core/modules/project/pdf/pdf_baleine.modules.php'; +require_once dirname(__FILE__).'/../../htdocs/core/modules/project/doc/pdf_baleine.modules.php'; require_once dirname(__FILE__).'/../../htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php'; require_once dirname(__FILE__).'/../../htdocs/core/modules/expedition/doc/pdf_merou.modules.php'; require_once dirname(__FILE__).'/../../htdocs/core/modules/expedition/doc/pdf_rouget.modules.php'; @@ -56,11 +56,10 @@ require_once dirname(__FILE__).'/../../htdocs/core/modules/project/modules_proje require_once dirname(__FILE__).'/../../htdocs/core/modules/fichinter/modules_fichinter.php'; require_once dirname(__FILE__).'/../../htdocs/core/modules/expedition/modules_expedition.php'; -if (empty($user->id)) -{ - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -74,35 +73,35 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; */ class BuildDocTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return BuildDocTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return BuildDocTest + */ + function __construct() { - global $conf,$user,$langs,$db; + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; + + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; + } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; if (! $conf->facture->enabled) { print __METHOD__." invoice module not enabled\n"; die(); } if (! $conf->commande->enabled) { print __METHOD__." order module not enabled\n"; die(); } @@ -112,41 +111,43 @@ class BuildDocTest extends PHPUnit_Framework_TestCase if (! $conf->ficheinter->enabled) { print __METHOD__." intervention module not enabled\n"; die(); } if (! $conf->deplacement->enabled) { print __METHOD__." trip module not enabled\n"; die(); } - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. - print __METHOD__."\n"; + print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * End phpunit tests - * - * @return void - */ + /** + * End phpunit tests + * + * @return void + */ protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } /** @@ -156,76 +157,76 @@ class BuildDocTest extends PHPUnit_Framework_TestCase */ public function testFactureBuild() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $conf->facture->dir_output.='/temp'; + $conf->facture->dir_output.='/temp'; - $localobjectcom=new Commande($this->savdb); - $localobjectcom->initAsSpecimen(); + $localobjectcom=new Commande($this->savdb); + $localobjectcom->initAsSpecimen(); - $localobject=new Facture($this->savdb); - $localobject->createFromOrder($localobjectcom); - $localobject->date_lim_reglement = dol_now() + 3600 * 24 *30; + $localobject=new Facture($this->savdb); + $localobject->createFromOrder($localobjectcom); + $localobject->date_lim_reglement = dol_now() + 3600 * 24 *30; - // Crabe (english) - $localobject->modelpdf='crabe'; - $result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $langs); - $this->assertLessThan($result, 0); - print __METHOD__." result=".$result."\n"; + // Crabe (english) + $localobject->modelpdf='crabe'; + $result = $localobject->generateDocument($localobject->modelpdf, $langs); + $this->assertLessThan($result, 0); + print __METHOD__." result=".$result."\n"; - // Crabe (japanese) - $newlangs1=new Translate("",$conf); - $newlangs1->setDefaultLang('ja_JP'); - $localobject->modelpdf='crabe'; - $result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $newlangs1); - $this->assertLessThan($result, 0); - print __METHOD__." result=".$result."\n"; + // Crabe (japanese) + $newlangs1=new Translate("",$conf); + $newlangs1->setDefaultLang('ja_JP'); + $localobject->modelpdf='crabe'; + $result = $localobject->generateDocument($localobject->modelpdf, $newlangs1); + $this->assertLessThan($result, 0); + print __METHOD__." result=".$result."\n"; - // Crabe (saudiarabia) - $newlangs2a=new Translate("",$conf); - $newlangs2a->setDefaultLang('sa_SA'); - $localobject->modelpdf='crabe'; - $result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $newlangs2a); - $this->assertLessThan($result, 0); - print __METHOD__." result=".$result."\n"; + // Crabe (saudiarabia) + $newlangs2a=new Translate("",$conf); + $newlangs2a->setDefaultLang('sa_SA'); + $localobject->modelpdf='crabe'; + $result = $localobject->generateDocument($localobject->modelpdf, $newlangs2a); + $this->assertLessThan($result, 0); + print __METHOD__." result=".$result."\n"; - // Crabe (english_saudiarabia) - $newlangs2b=new Translate("",$conf); - $newlangs2b->setDefaultLang('en_SA'); - $localobject->modelpdf='crabe'; - $result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $newlangs2b); - $this->assertLessThan($result, 0); - print __METHOD__." result=".$result."\n"; + // Crabe (english_saudiarabia) + $newlangs2b=new Translate("",$conf); + $newlangs2b->setDefaultLang('en_SA'); + $localobject->modelpdf='crabe'; + $result = $localobject->generateDocument($localobject->modelpdf, $newlangs2b); + $this->assertLessThan($result, 0); + print __METHOD__." result=".$result."\n"; - // Crabe (greek) - $newlangs3=new Translate("",$conf); - $newlangs3->setDefaultLang('el_GR'); - $localobject->modelpdf='crabe'; - $result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $newlangs3); - $this->assertLessThan($result, 0); - print __METHOD__." result=".$result."\n"; + // Crabe (greek) + $newlangs3=new Translate("",$conf); + $newlangs3->setDefaultLang('el_GR'); + $localobject->modelpdf='crabe'; + $result = $localobject->generateDocument($localobject->modelpdf, $newlangs3); + $this->assertLessThan($result, 0); + print __METHOD__." result=".$result."\n"; - // Crabe (chinese) - $newlangs4=new Translate("",$conf); - $newlangs4->setDefaultLang('zh_CN'); - $localobject->modelpdf='crabe'; - $result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $newlangs4); - $this->assertLessThan($result, 0); - print __METHOD__." result=".$result."\n"; + // Crabe (chinese) + $newlangs4=new Translate("",$conf); + $newlangs4->setDefaultLang('zh_CN'); + $localobject->modelpdf='crabe'; + $result = $localobject->generateDocument($localobject->modelpdf, $newlangs4); + $this->assertLessThan($result, 0); + print __METHOD__." result=".$result."\n"; - // Crabe (russian) - $newlangs5=new Translate("",$conf); - $newlangs5->setDefaultLang('ru_RU'); - $localobject->modelpdf='crabe'; - $result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $newlangs5); - $this->assertLessThan($result, 0); - print __METHOD__." result=".$result."\n"; + // Crabe (russian) + $newlangs5=new Translate("",$conf); + $newlangs5->setDefaultLang('ru_RU'); + $localobject->modelpdf='crabe'; + $result = $localobject->generateDocument($localobject->modelpdf, $newlangs5); + $this->assertLessThan($result, 0); + print __METHOD__." result=".$result."\n"; - return 0; + return 0; } /** @@ -247,7 +248,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase // Canelle $localobject->modelpdf='canelle'; - $result=supplier_invoice_pdf_create($db, $localobject, $localobject->modelpdf, $langs); + $result = $localobject->generateDocument($localobject->modelpdf, $langs); $this->assertLessThan($result, 0); print __METHOD__." result=".$result."\n"; @@ -274,7 +275,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase // Einstein $localobject->modelpdf='einstein'; - $result=commande_pdf_create($db, $localobject, $localobject->modelpdf, $langs); + $result = $localobject->generateDocument($localobject->modelpdf, $langs); $this->assertLessThan($result, 0); print __METHOD__." result=".$result."\n"; @@ -285,9 +286,9 @@ class BuildDocTest extends PHPUnit_Framework_TestCase /** * testCommandeFournisseurBuild - * - * @return int - */ + * + * @return int + */ public function testCommandeFournisseurBuild() { global $conf,$user,$langs,$db; @@ -302,7 +303,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase // Muscadet $localobject->modelpdf='muscadet'; - $result=supplier_order_pdf_create($db, $localobject, $localobject->modelpdf, $langs); + $result= $localobject->generateDocument($localobject->modelpdf, $langs); $this->assertLessThan($result, 0); print __METHOD__." result=".$result."\n"; @@ -329,7 +330,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase // Azur $localobject->modelpdf='azur'; - $result=propale_pdf_create($db, $localobject, $localobject->modelpdf, $langs); + $result = $localobject->generateDocument($localobject->modelpdf, $langs); $this->assertLessThan($result, 0); print __METHOD__." result=".$result."\n"; @@ -355,7 +356,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase // Baleine $localobject->modelpdf='baleine'; - $result=project_pdf_create($db, $localobject, $localobject->modelpdf, $langs); + $result = $localobject->generateDocument($localobject->modelpdf, $langs); $this->assertLessThan($result, 0); print __METHOD__." result=".$result."\n"; @@ -409,14 +410,14 @@ class BuildDocTest extends PHPUnit_Framework_TestCase // Merou $localobject->modelpdf='merou'; - $result=expedition_pdf_create($db, $localobject, $localobject->modelpdf, $langs); + $result= $localobject->generateDocument($localobject->modelpdf, $langs); $this->assertLessThan($result, 0); print __METHOD__." result=".$result."\n"; // Rouget $localobject->modelpdf='rouget'; - $result=expedition_pdf_create($db, $localobject, $localobject->modelpdf, $langs); + $result= $localobject->generateDocument($localobject->modelpdf, $langs); $this->assertLessThan($result, 0); print __METHOD__." result=".$result."\n"; diff --git a/test/phpunit/CMailFileTest.php b/test/phpunit/CMailFileTest.php index 26e18161b77..52a65a8949e 100755 --- a/test/phpunit/CMailFileTest.php +++ b/test/phpunit/CMailFileTest.php @@ -18,9 +18,9 @@ /** * \file test/phpunit/CMailFileTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; @@ -29,11 +29,10 @@ global $conf,$user,$langs,$db; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/core/class/CMailFile.class.php'; -if (empty($user->id)) -{ - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -47,70 +46,72 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; */ class CMailFileTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return CMailFile - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return CMailFile + */ + function __construct() { - global $conf,$user,$langs,$db; - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; - print __METHOD__."\n"; + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * End phpunit tests - * - * @return void - */ + /** + * End phpunit tests + * + * @return void + */ protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } /** @@ -120,19 +121,19 @@ class CMailFileTest extends PHPUnit_Framework_TestCase */ public function testCMailFileText() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new CMailFile('Test','test@test.com','from@from.com','Message txt',array(),array(),array(),'','',1,0); + $localobject=new CMailFile('Test','test@test.com','from@from.com','Message txt',array(),array(),array(),'','',1,0); - $result=$localobject->sendfile(); + $result=$localobject->sendfile(); print __METHOD__." result=".$result."\n"; - $this->assertFalse($result); // False because mail send disabled + $this->assertFalse($result); // False because mail send disabled - return $result; + return $result; } /** diff --git a/test/phpunit/CategorieTest.php b/test/phpunit/CategorieTest.php index 3d4801a5854..d9e030ef9ef 100755 --- a/test/phpunit/CategorieTest.php +++ b/test/phpunit/CategorieTest.php @@ -18,9 +18,9 @@ /** * \file test/phpunit/CategorieTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; @@ -30,11 +30,10 @@ require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/categories/class/categorie.class.php'; require_once dirname(__FILE__).'/../../htdocs/product/class/product.class.php'; -if (empty($user->id)) -{ - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -48,70 +47,72 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; */ class CategorieTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return CategorieTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return CategorieTest + */ + function __construct() { - global $conf,$user,$langs,$db; - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; - print __METHOD__."\n"; + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * End phpunit tests - * - * @return void - */ + /** + * End phpunit tests + * + * @return void + */ protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } /** @@ -121,145 +122,145 @@ class CategorieTest extends PHPUnit_Framework_TestCase */ public function testCategorieCreate() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - // We create a category - $localobject=new Categorie($this->savdb); - $localobject->initAsSpecimen(); + // We create a category + $localobject=new Categorie($this->savdb); + $localobject->initAsSpecimen(); - // Check it does not exist (return 0) - $resultCheck=$localobject->already_exists(); - print __METHOD__." resultCheck=".$resultCheck."\n"; - $this->assertEquals(0, $resultCheck); + // Check it does not exist (return 0) + $resultCheck=$localobject->already_exists(); + print __METHOD__." resultCheck=".$resultCheck."\n"; + $this->assertEquals(0, $resultCheck); - // Create - $resultFirstCreate=$localobject->create($user); - print __METHOD__." resultFirstCreate=".$resultFirstCreate."\n"; - $this->assertGreaterThan(0, $resultFirstCreate); + // Create + $resultFirstCreate=$localobject->create($user); + print __METHOD__." resultFirstCreate=".$resultFirstCreate."\n"; + $this->assertGreaterThan(0, $resultFirstCreate); - // We try to create another one with same ref - $localobject2=new Categorie($this->savdb); - $localobject2->initAsSpecimen(); + // We try to create another one with same ref + $localobject2=new Categorie($this->savdb); + $localobject2->initAsSpecimen(); - // Check it does exist (return 1) - $resultCheck=$localobject2->already_exists(); - print __METHOD__." resultCheck=".$resultCheck."\n"; - $this->assertGreaterThan(0, $resultCheck); + // Check it does exist (return 1) + $resultCheck=$localobject2->already_exists(); + print __METHOD__." resultCheck=".$resultCheck."\n"; + $this->assertGreaterThan(0, $resultCheck); - $resultSecondCreate=$localobject2->create($user); - print __METHOD__." result=".$resultSecondCreate."\n"; - $this->assertEquals(-4, $resultSecondCreate); + $resultSecondCreate=$localobject2->create($user); + print __METHOD__." result=".$resultSecondCreate."\n"; + $this->assertEquals(-4, $resultSecondCreate); - return $resultFirstCreate; + return $resultFirstCreate; } /** * testCategorieProduct * - * @param int $id Id of category - * @return int + * @param int $id Id of category + * @return int * - * @depends testCategorieCreate + * @depends testCategorieCreate * The depends says test is run only if previous is ok */ public function testCategorieProduct($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobjecttmp=new Categorie($this->savdb); - $localobjecttmp->initAsSpecimen(); - $localobjecttmp->label='Specimen Category for product'; - $localobjecttmp->type=0; // product category - $catid=$localobjecttmp->create($user); + $localobjecttmp=new Categorie($this->savdb); + $localobjecttmp->initAsSpecimen(); + $localobjecttmp->label='Specimen Category for product'; + $localobjecttmp->type=0; // product category + $catid=$localobjecttmp->create($user); print __METHOD__." catid=".$catid."\n"; $this->assertGreaterThan(0, $catid); // Try to create product linked to category - $localobject2=new Product($this->savdb); - $localobject2->initAsSpecimen(); - $localobject2->ref.='-CATEG'; - $localobject2->tva_npr=1; - $result=$localobject2->create($user); - $cat = new Categorie($this->savdb); - $cat->id = $catid; - $result=$cat->add_type($localobject2,"product"); + $localobject2=new Product($this->savdb); + $localobject2->initAsSpecimen(); + $localobject2->ref.='-CATEG'; + $localobject2->tva_npr=1; + $result=$localobject2->create($user); + $cat = new Categorie($this->savdb); + $cat->id = $catid; + $result=$cat->add_type($localobject2,"product"); - print __METHOD__." result=".$result."\n"; - $this->assertGreaterThan(0, $result); + print __METHOD__." result=".$result."\n"; + $this->assertGreaterThan(0, $result); - // Get list of categories for product - $localcateg=new Categorie($this->savdb); - $listofcateg=$localcateg->containing($localobject2->id, 'product', 'label'); - $this->assertTrue(in_array('Specimen Category for product',$listofcateg), 'Categ not found linked to product when it should'); + // Get list of categories for product + $localcateg=new Categorie($this->savdb); + $listofcateg=$localcateg->containing($localobject2->id, 'product', 'label'); + $this->assertTrue(in_array('Specimen Category for product',$listofcateg), 'Categ not found linked to product when it should'); - return $id; + return $id; } /** * testCategorieFetch * - * @param int $id Id of category - * @return int + * @param int $id Id of category + * @return int * - * @depends testCategorieProduct + * @depends testCategorieProduct * The depends says test is run only if previous is ok */ public function testCategorieFetch($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Categorie($this->savdb); - $result=$localobject->fetch($id); + $localobject=new Categorie($this->savdb); + $result=$localobject->fetch($id); - print __METHOD__." id=".$id." result=".$result."\n"; - $this->assertGreaterThan(0, $result); - return $localobject; + print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertGreaterThan(0, $result); + return $localobject; } /** * testCategorieUpdate * - * @param Category $localobject Category - * @return int + * @param Category $localobject Category + * @return int - * @depends testCategorieFetch + * @depends testCategorieFetch * The depends says test is run only if previous is ok */ public function testCategorieUpdate($localobject) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject->note='New note after update'; - $result=$localobject->update($user); + $localobject->note='New note after update'; + $result=$localobject->update($user); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertGreaterThan(0, $result); - return $localobject; + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertGreaterThan(0, $result); + return $localobject; } /** * testCategorieOther * - * @param Category $localobject Category - * @return int + * @param Category $localobject Category + * @return int * * @depends testCategorieUpdate * The depends says test is run only if previous is ok @@ -289,50 +290,50 @@ class CategorieTest extends PHPUnit_Framework_TestCase /** * testCategorieDelete * - * @param int $id Id of category - * @return int + * @param int $id Id of category + * @return int * * @depends testCategorieOther * The depends says test is run only if previous is ok */ public function testCategorieDelete($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Categorie($this->savdb); - $result=$localobject->fetch($id); - $result=$localobject->delete($user); + $localobject=new Categorie($this->savdb); + $result=$localobject->fetch($id); + $result=$localobject->delete($user); - print __METHOD__." id=".$id." result=".$result."\n"; - $this->assertGreaterThan(0, $result); - return $result; + print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertGreaterThan(0, $result); + return $result; } /** * testCategorieStatic * - * @return void + * @return void * * @depends testCategorieDelete */ public function testCategorieStatic() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Categorie($this->savdb); + $localobject=new Categorie($this->savdb); $retarray=$localobject->get_full_arbo(3); - print __METHOD__." retarray size=".count($retarray)."\n"; - $this->assertTrue(is_array($retarray)); - return $retarray; + print __METHOD__." retarray size=".count($retarray)."\n"; + $this->assertTrue(is_array($retarray)); + return $retarray; } } diff --git a/test/phpunit/ChargeSocialesTest.php b/test/phpunit/ChargeSocialesTest.php index 69b1f93f776..0836036afa5 100755 --- a/test/phpunit/ChargeSocialesTest.php +++ b/test/phpunit/ChargeSocialesTest.php @@ -80,6 +80,8 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/CommandeFournisseurTest.php b/test/phpunit/CommandeFournisseurTest.php index 90c0d10e3fb..67c120a2bb8 100644 --- a/test/phpunit/CommandeFournisseurTest.php +++ b/test/phpunit/CommandeFournisseurTest.php @@ -18,9 +18,9 @@ /** * \file test/phpunit/CommandeFournisseurTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; @@ -30,11 +30,10 @@ require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/fourn/class/fournisseur.commande.class.php'; require_once dirname(__FILE__).'/../../htdocs/fourn/class/fournisseur.product.class.php'; -if (empty($user->id)) -{ - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -49,71 +48,73 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; */ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return CommandeFournisseurTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return CommandeFournisseurTest + */ + function __construct() { - global $conf,$user,$langs,$db; - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; - print __METHOD__."\n"; + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; - //print $db->getVersion()."\n"; + print __METHOD__."\n"; + //print $db->getVersion()."\n"; } - /** - * End phpunit tests - * - * @return void - */ + /** + * End phpunit tests + * + * @return void + */ protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } /** @@ -123,169 +124,169 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase */ public function testCommandeFournisseurCreate() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - // Set supplier and product to use - $socid=1; - $societe=new Societe($db); - $societe->fetch($socid); - $product=new ProductFournisseur($db); - $product->fetch(0,'PIDRESS'); - if ($product->id <= 0) { print "\n".__METHOD__." A product with ref PIDRESS must exists into database"; die(); } + // Set supplier and product to use + $socid=1; + $societe=new Societe($db); + $societe->fetch($socid); + $product=new ProductFournisseur($db); + $product->fetch(0,'PIDRESS'); + if ($product->id <= 0) { print "\n".__METHOD__." A product with ref PIDRESS must exists into database"; die(); } - $quantity=10; - $ref_fourn='SUPPLIER_REF_PHPUNIT'; - $tva_tx=19.6; + $quantity=10; + $ref_fourn='SUPPLIER_REF_PHPUNIT'; + $tva_tx=19.6; - // Create supplier price - $result=$product->add_fournisseur($user, $societe->id, $ref_fourn, $quantity); // This insert record with no value for price. Values are update later with update_buyprice - $this->assertGreaterThanOrEqual(1, $result); - $result=$product->update_buyprice($quantity, 10, $user, 'HT', $societe, '', $ref_fourn, $tva_tx, 0, 0); - $this->assertGreaterThanOrEqual(0, $result); + // Create supplier price + $result=$product->add_fournisseur($user, $societe->id, $ref_fourn, $quantity); // This insert record with no value for price. Values are update later with update_buyprice + $this->assertGreaterThanOrEqual(1, $result); + $result=$product->update_buyprice($quantity, 10, $user, 'HT', $societe, '', $ref_fourn, $tva_tx, 0, 0); + $this->assertGreaterThanOrEqual(0, $result); - // Create supplier order with a too low quantity - $localobject=new CommandeFournisseur($db); - $localobject->initAsSpecimen(); - $localobject->lines=array(); // Overwrite lines of order - $line=new CommandeFournisseurLigne($db); - $line->desc=$langs->trans("Description")." specimen line too low"; - $line->qty=1; // So lower than $quantity - $line->fk_product=$product->id; - $line->ref_fourn=$ref_fourn; - $localobject->lines[]=$line; + // Create supplier order with a too low quantity + $localobject=new CommandeFournisseur($db); + $localobject->initAsSpecimen(); + $localobject->lines=array(); // Overwrite lines of order + $line=new CommandeFournisseurLigne($db); + $line->desc=$langs->trans("Description")." specimen line too low"; + $line->qty=1; // So lower than $quantity + $line->fk_product=$product->id; + $line->ref_fourn=$ref_fourn; + $localobject->lines[]=$line; - $result=$localobject->create($user); + $result=$localobject->create($user); print __METHOD__." result=".$result."\n"; - $this->assertEquals(-1, $result); // must be -1 because quantity is lower than minimum of supplier price + $this->assertEquals(-1, $result); // must be -1 because quantity is lower than minimum of supplier price - $sql="DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur where ref=''"; - $db->query($sql); + $sql="DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur where ref=''"; + $db->query($sql); - // Create supplier order - $localobject2=new CommandeFournisseur($db); - $localobject2->initAsSpecimen(); // This create 5 lines of first product found for socid 1 - $localobject2->lines=array(); // Overwrite lines of order - $line=new CommandeFournisseurLigne($db); - $line->desc=$langs->trans("Description")." specimen line ok"; - $line->qty=10; // So enough quantity - $line->fk_product=$product->id; - $line->ref_fourn=$ref_fourn; - $localobject2->lines[]=$line; + // Create supplier order + $localobject2=new CommandeFournisseur($db); + $localobject2->initAsSpecimen(); // This create 5 lines of first product found for socid 1 + $localobject2->lines=array(); // Overwrite lines of order + $line=new CommandeFournisseurLigne($db); + $line->desc=$langs->trans("Description")." specimen line ok"; + $line->qty=10; // So enough quantity + $line->fk_product=$product->id; + $line->ref_fourn=$ref_fourn; + $localobject2->lines[]=$line; - $result=$localobject2->create($user); - print __METHOD__." result=".$result."\n"; - $this->assertGreaterThanOrEqual(0, $result); + $result=$localobject2->create($user); + print __METHOD__." result=".$result."\n"; + $this->assertGreaterThanOrEqual(0, $result); - return $result; + return $result; } /** * testCommandeFournisseurFetch * - * @param int $id Id of supplier order - * @return void + * @param int $id Id of supplier order + * @return void * - * @depends testCommandeFournisseurCreate + * @depends testCommandeFournisseurCreate * The depends says test is run only if previous is ok */ public function testCommandeFournisseurFetch($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new CommandeFournisseur($this->savdb); - $result=$localobject->fetch($id); + $localobject=new CommandeFournisseur($this->savdb); + $result=$localobject->fetch($id); - print __METHOD__." id=".$id." result=".$result."\n"; + print __METHOD__." id=".$id." result=".$result."\n"; $this->assertLessThan($result, 0); - return $localobject; + return $localobject; } /** * testCommandeFournisseurValid * - * @param Object $localobject Supplier order - * @return void + * @param Object $localobject Supplier order + * @return void * - * @depends testCommandeFournisseurFetch + * @depends testCommandeFournisseurFetch * The depends says test is run only if previous is ok */ public function testCommandeFournisseurValid($localobject) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $result=$localobject->valid($user); + $result=$localobject->valid($user); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); - return $localobject; + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $localobject; } /** * testCommandeFournisseurApprove * - * @param Object $localobject Supplier order - * @return void + * @param Object $localobject Supplier order + * @return void * - * @depends testCommandeFournisseurValid + * @depends testCommandeFournisseurValid * The depends says test is run only if previous is ok */ public function testCommandeFournisseurApprove($localobject) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $result=$localobject->approve($user); + $result=$localobject->approve($user); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); - return $localobject; + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $localobject; } /** * testCommandeFournisseurCancel * - * @param Object $localobject Supplier order - * @return void + * @param Object $localobject Supplier order + * @return void * - * @depends testCommandeFournisseurValid + * @depends testCommandeFournisseurValid * The depends says test is run only if previous is ok */ public function testCommandeFournisseurCancel($localobject) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $result=$localobject->cancel($user); + $result=$localobject->cancel($user); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); - return $localobject; + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $localobject; } /** * testCommandeFournisseurOther * - * @param Object $localobject Supplier order - * @return void + * @param Object $localobject Supplier order + * @return void * * @depends testCommandeFournisseurCancel * The depends says test is run only if previous is ok @@ -314,27 +315,27 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase /** * testCommandeFournisseurDelete * - * @param int $id Id of order - * @return void + * @param int $id Id of order + * @return void * - * @depends testCommandeFournisseurOther + * @depends testCommandeFournisseurOther * The depends says test is run only if previous is ok */ public function testCommandeFournisseurDelete($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new CommandeFournisseur($this->savdb); - $result=$localobject->fetch($id); - $result=$localobject->delete($user); + $localobject=new CommandeFournisseur($this->savdb); + $result=$localobject->fetch($id); + $result=$localobject->delete($user); - print __METHOD__." id=".$id." result=".$result."\n"; - $this->assertLessThan($result, 0); - return $result; + print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $result; } } diff --git a/test/phpunit/CommandeTest.php b/test/phpunit/CommandeTest.php index 8a2e3f57120..0bb7788d33f 100644 --- a/test/phpunit/CommandeTest.php +++ b/test/phpunit/CommandeTest.php @@ -18,9 +18,9 @@ /** * \file test/phpunit/CommandeTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; @@ -29,11 +29,10 @@ global $conf,$user,$langs,$db; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/commande/class/commande.class.php'; -if (empty($user->id)) -{ - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -47,173 +46,176 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; */ class CommandeTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return CommandeTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return CommandeTest + */ + function __construct() { - global $conf,$user,$langs,$db; - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; - print __METHOD__."\n"; + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; - //print $db->getVersion()."\n"; + print __METHOD__."\n"; + //print $db->getVersion()."\n"; } - /** - * End phpunit tests - * - * @return void - */ + + /** + * End phpunit tests + * + * @return void + */ protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } /** * testCommandeCreate * - * @return void + * @return void */ public function testCommandeCreate() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Commande($this->savdb); - $localobject->initAsSpecimen(); - $result=$localobject->create($user); + $localobject=new Commande($this->savdb); + $localobject->initAsSpecimen(); + $result=$localobject->create($user); - $this->assertLessThan($result, 0); - print __METHOD__." result=".$result."\n"; - return $result; + $this->assertLessThan($result, 0); + print __METHOD__." result=".$result."\n"; + return $result; } /** * testCommandeFetch * - * @param int $id Id order - * @return Commande + * @param int $id Id order + * @return Commande * * @depends testCommandeCreate * The depends says test is run only if previous is ok */ public function testCommandeFetch($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Commande($this->savdb); - $result=$localobject->fetch($id); + $localobject=new Commande($this->savdb); + $result=$localobject->fetch($id); - $this->assertLessThan($result, 0); - print __METHOD__." id=".$id." result=".$result."\n"; - return $localobject; + $this->assertLessThan($result, 0); + print __METHOD__." id=".$id." result=".$result."\n"; + return $localobject; } /** * testCommandeValid * - * @param Object $localobject Order - * @return void + * @param Object $localobject Order + * @return void * * @depends testCommandeFetch * The depends says test is run only if previous is ok */ public function testCommandeValid($localobject) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $result=$localobject->valid($user); + $result=$localobject->valid($user); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); - return $localobject; + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $localobject; } /** * testCommandeCancel * - * @param Object $localobject Order - * @return void + * @param Object $localobject Order + * @return void * - * @depends testCommandeValid + * @depends testCommandeValid * The depends says test is run only if previous is ok */ public function testCommandeCancel($localobject) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $result=$localobject->cancel(); + $result=$localobject->cancel(); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); - return $localobject; + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $localobject; } /** * testCommandeOther * - * @param Object $localobject Order - * @return void + * @param Object $localobject Order + * @return void * * @depends testCommandeCancel * The depends says test is run only if previous is ok @@ -241,27 +243,27 @@ class CommandeTest extends PHPUnit_Framework_TestCase /** * testCommandeDelete * - * @param int $id Id of order - * @return void + * @param int $id Id of order + * @return void * - * @depends testCommandeOther + * @depends testCommandeOther * The depends says test is run only if previous is ok */ public function testCommandeDelete($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Commande($this->savdb); - $result=$localobject->fetch($id); - $result=$localobject->delete($user); + $localobject=new Commande($this->savdb); + $result=$localobject->fetch($id); + $result=$localobject->delete($user); - print __METHOD__." id=".$id." result=".$result."\n"; - $this->assertLessThan($result, 0); - return $result; + print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $result; } } diff --git a/test/phpunit/CommonObjectTest.php b/test/phpunit/CommonObjectTest.php index a22146dfc2a..18f96034fd1 100644 --- a/test/phpunit/CommonObjectTest.php +++ b/test/phpunit/CommonObjectTest.php @@ -18,9 +18,9 @@ /** * \file test/phpunit/CommonObjectTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; @@ -30,11 +30,10 @@ require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/commande/class/commande.class.php'; require_once dirname(__FILE__).'/../../htdocs/projet/class/project.class.php'; -if (empty($user->id)) -{ - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -48,138 +47,140 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; */ class CommonObjectTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return CommonObjectTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return CommonObjectTest + */ + function __construct() { - global $conf,$user,$langs,$db; - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; - print __METHOD__."\n"; + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * End phpunit tests - * - * @return void - */ + /** + * End phpunit tests + * + * @return void + */ protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } /** - * testFetchUser + * testFetchUser * - * @return void + * @return void */ public function testFetchUser() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Commande($this->savdb); - $localobject->fetch(1); + $localobject=new Commande($this->savdb); + $localobject->fetch(1); - $result=$localobject->fetch_user(1); + $result=$localobject->fetch_user(1); - print __METHOD__." result=".$result."\n"; - $this->assertLessThan($localobject->user->id, 0); - return $result; + print __METHOD__." result=".$result."\n"; + $this->assertLessThan($localobject->user->id, 0); + return $result; } /** - * testFetchProjet + * testFetchProjet * - * @return void + * @return void */ public function testFetchProjet() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Commande($this->savdb); - $localobject->fetch(1); - $result=$localobject->fetch_projet(); + $localobject=new Commande($this->savdb); + $localobject->fetch(1); + $result=$localobject->fetch_projet(); - print __METHOD__." result=".$result."\n"; - $this->assertLessThanOrEqual($result,0); - return $result; + print __METHOD__." result=".$result."\n"; + $this->assertLessThanOrEqual($result,0); + return $result; } /** - * testFetchThirdParty + * testFetchThirdParty * - * @return void + * @return void */ public function testFetchThirdParty() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Commande($this->savdb); - $localobject->fetch(1); + $localobject=new Commande($this->savdb); + $localobject->fetch(1); - $result=$localobject->fetch_thirdparty(); + $result=$localobject->fetch_thirdparty(); - print __METHOD__." result=".$result."\n"; - $this->assertLessThanOrEqual($result,0); - return $result; + print __METHOD__." result=".$result."\n"; + $this->assertLessThanOrEqual($result,0); + return $result; } } diff --git a/test/phpunit/CompanyBankAccountTest.php b/test/phpunit/CompanyBankAccountTest.php index a105bb37a53..95ea937a017 100644 --- a/test/phpunit/CompanyBankAccountTest.php +++ b/test/phpunit/CompanyBankAccountTest.php @@ -80,6 +80,8 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/ContactTest.php b/test/phpunit/ContactTest.php index 3c09df861f0..b638cdc776b 100755 --- a/test/phpunit/ContactTest.php +++ b/test/phpunit/ContactTest.php @@ -89,6 +89,8 @@ class ContactTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/ContratTest.php b/test/phpunit/ContratTest.php index c42d62cd3b1..5adf002c885 100644 --- a/test/phpunit/ContratTest.php +++ b/test/phpunit/ContratTest.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2010-2014 Laurent Destailleur * * 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 @@ -80,6 +80,8 @@ class ContratTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; @@ -162,37 +164,13 @@ class ContratTest extends PHPUnit_Framework_TestCase return $localobject; } - /** - * testContratValid - * - * @param Contrat $localobject Contract - * @return int - * - * @depends testContratFetch - * The depends says test is run only if previous is ok - */ - public function testContratValid($localobject) - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $result=$localobject->update_statut($user); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - - $this->assertLessThan($result, 0); - return $localobject; - } - /** - * testContratValid + * testContratOther * * @param Object $localobject Object contract * @return int * - * @depends testContratValid + * @depends testContratFetch * The depends says test is run only if previous is ok */ public function testContratOther($localobject) diff --git a/test/phpunit/CoreTest.php b/test/phpunit/CoreTest.php index 8d56b4a0b42..01f06e41af7 100755 --- a/test/phpunit/CoreTest.php +++ b/test/phpunit/CoreTest.php @@ -18,9 +18,9 @@ /** * \file test/phpunit/CoreTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; @@ -49,70 +49,72 @@ if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is */ class CoreTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return CoreTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - //print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return CoreTest + */ + function __construct() { - global $conf,$user,$langs,$db; - //$db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; - print __METHOD__."\n"; + //print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + //$db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - //$db->rollback(); + global $conf,$user,$langs,$db; + //$db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * End phpunit tests - * - * @return void - */ + /** + * End phpunit tests + * + * @return void + */ protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } @@ -123,177 +125,170 @@ class CoreTest extends PHPUnit_Framework_TestCase */ public function testDetectURLROOT() { - global $dolibarr_main_prod; + global $dolibarr_main_prod; - global $dolibarr_main_url_root; - global $dolibarr_main_data_root; - global $dolibarr_main_document_root; - global $dolibarr_main_data_root_alt; - global $dolibarr_main_document_root_alt; - global $dolibarr_main_db_host; - global $dolibarr_main_db_port; - global $dolibarr_main_db_type; - global $dolibarr_main_db_prefix; + global $dolibarr_main_url_root; + global $dolibarr_main_data_root; + global $dolibarr_main_document_root; + global $dolibarr_main_data_root_alt; + global $dolibarr_main_document_root_alt; + global $dolibarr_main_db_host; + global $dolibarr_main_db_port; + global $dolibarr_main_db_type; + global $dolibarr_main_db_prefix; - $testtodo=3; + $testtodo=3; - // Case 1: - // Test for subdir dolibarrnew (that point to htdocs) in root directory /var/www - // URL: http://localhost/dolibarrnew/admin/system/phpinfo.php - // To prepare this test: - // - Create link from htdocs to /var/www/dolibarrnew - // - Put into conf.php $dolibarr_main_document_root='/var/www/dolibarrnew'; - if ($testtodo == 1) - { - $_SERVER["HTTPS"]=''; - $_SERVER["SERVER_NAME"]='localhost'; - $_SERVER["SERVER_PORT"]='80'; - $_SERVER["DOCUMENT_ROOT"]='/var/www'; - $_SERVER["SCRIPT_NAME"]='/dolibarrnew/admin/system/phpinfo.php'; - $expectedresult='/dolibarrnew'; - } + // Case 1: + // Test for subdir dolibarrnew (that point to htdocs) in root directory /var/www + // URL: http://localhost/dolibarrnew/admin/system/phpinfo.php + // To prepare this test: + // - Create link from htdocs to /var/www/dolibarrnew + // - Put into conf.php $dolibarr_main_document_root='/var/www/dolibarrnew'; + if ($testtodo == 1) { + $_SERVER["HTTPS"]=''; + $_SERVER["SERVER_NAME"]='localhost'; + $_SERVER["SERVER_PORT"]='80'; + $_SERVER["DOCUMENT_ROOT"]='/var/www'; + $_SERVER["SCRIPT_NAME"]='/dolibarrnew/admin/system/phpinfo.php'; + $expectedresult='/dolibarrnew'; + } - // Case 2: - // Test for subdir aaa (that point to dolibarr) in root directory /var/www - // URL: http://localhost/aaa/htdocs/admin/system/phpinfo.php - // To prepare this test: - // - Create link from dolibarr to /var/www/aaa - // - Put into conf.php $dolibarr_main_document_root='/var/www/aaa/htdocs'; - if ($testtodo == 2) - { - $_SERVER["HTTPS"]=''; - $_SERVER["SERVER_NAME"]='localhost'; - $_SERVER["SERVER_PORT"]='80'; - $_SERVER["DOCUMENT_ROOT"]='/var/www'; - $_SERVER["SCRIPT_NAME"]='/aaa/htdocs/admin/system/phpinfo.php'; - $expectedresult='/aaa/htdocs'; - } + // Case 2: + // Test for subdir aaa (that point to dolibarr) in root directory /var/www + // URL: http://localhost/aaa/htdocs/admin/system/phpinfo.php + // To prepare this test: + // - Create link from dolibarr to /var/www/aaa + // - Put into conf.php $dolibarr_main_document_root='/var/www/aaa/htdocs'; + if ($testtodo == 2) { + $_SERVER["HTTPS"]=''; + $_SERVER["SERVER_NAME"]='localhost'; + $_SERVER["SERVER_PORT"]='80'; + $_SERVER["DOCUMENT_ROOT"]='/var/www'; + $_SERVER["SCRIPT_NAME"]='/aaa/htdocs/admin/system/phpinfo.php'; + $expectedresult='/aaa/htdocs'; + } - // Case 3: - // Test for virtual host localhostdolibarrnew that point to htdocs directory with - // a direct document root - // URL: http://localhostdolibarrnew/admin/system/phpinfo.php - // To prepare this test: - // - Create virtual host localhostdolibarrnew that point to /home/ldestailleur/git/dolibarr/htdocs - // - Put into conf.php $dolibarr_main_document_root='/home/ldestailleur/git/dolibarr/htdocs'; - if ($testtodo == 3) - { - $_SERVER["HTTPS"]=''; - $_SERVER["SERVER_NAME"]='localhostdolibarrnew'; - $_SERVER["SERVER_PORT"]='80'; - $_SERVER["DOCUMENT_ROOT"]='/home/ldestailleur/git/dolibarr/htdocs'; - $_SERVER["SCRIPT_NAME"]='/admin/system/phpinfo.php'; - $expectedresult=''; - } + // Case 3: + // Test for virtual host localhostdolibarrnew that point to htdocs directory with + // a direct document root + // URL: http://localhostdolibarrnew/admin/system/phpinfo.php + // To prepare this test: + // - Create virtual host localhostdolibarrnew that point to /home/ldestailleur/git/dolibarr/htdocs + // - Put into conf.php $dolibarr_main_document_root='/home/ldestailleur/git/dolibarr/htdocs'; + if ($testtodo == 3) { + $_SERVER["HTTPS"]=''; + $_SERVER["SERVER_NAME"]='localhostdolibarrnew'; + $_SERVER["SERVER_PORT"]='80'; + $_SERVER["DOCUMENT_ROOT"]='/home/ldestailleur/git/dolibarr/htdocs'; + $_SERVER["SCRIPT_NAME"]='/admin/system/phpinfo.php'; + $expectedresult=''; + } - // Case 4: - // Test for virtual host localhostdolibarrnew that point to htdocs directory with - // a symbolic link - // URL: http://localhostdolibarrnew/admin/system/phpinfo.php - if ($testtodo == 4) - { - $_SERVER["HTTPS"]=''; - $_SERVER["SERVER_NAME"]='localhostdolibarrnew'; - $_SERVER["SERVER_PORT"]='80'; - $_SERVER["DOCUMENT_ROOT"]='/var/www/dolibarr'; // This is a link that point to /home/ldestail/workspace/dolibarr/htdocs - $_SERVER["SCRIPT_NAME"]='/admin/system/phpinfo.php'; - $expectedresult=''; - } + // Case 4: + // Test for virtual host localhostdolibarrnew that point to htdocs directory with + // a symbolic link + // URL: http://localhostdolibarrnew/admin/system/phpinfo.php + if ($testtodo == 4) { + $_SERVER["HTTPS"]=''; + $_SERVER["SERVER_NAME"]='localhostdolibarrnew'; + $_SERVER["SERVER_PORT"]='80'; + $_SERVER["DOCUMENT_ROOT"]='/var/www/dolibarr'; // This is a link that point to /home/ldestail/workspace/dolibarr/htdocs + $_SERVER["SCRIPT_NAME"]='/admin/system/phpinfo.php'; + $expectedresult=''; + } - // Case 5: - // Test for alias /dolibarralias, Test when using nginx, Test when using lighttpd - // URL: http://localhost/dolibarralias/admin/system/phpinfo.php - // To prepare this test: - // - Copy content of dolibarr project into /var/www/dolibarr - // - Put into conf.php $dolibarr_main_document_root='/var/www/dolibarr/htdocs'; - // - Put into conf.php $dolibarr_main_url_root='http://localhost/dolibarralias'; (because autodetect will fails in this case) - if ($testtodo == 5) - { - $_SERVER["HTTPS"]=''; - $_SERVER["SERVER_NAME"]='localhost'; - $_SERVER["SERVER_PORT"]='80'; - $_SERVER["DOCUMENT_ROOT"]='/var/www'; - $_SERVER["SCRIPT_NAME"]='/dolibarralias/admin/system/phpinfo.php'; - $expectedresult='/dolibarralias'; - } + // Case 5: + // Test for alias /dolibarralias, Test when using nginx, Test when using lighttpd + // URL: http://localhost/dolibarralias/admin/system/phpinfo.php + // To prepare this test: + // - Copy content of dolibarr project into /var/www/dolibarr + // - Put into conf.php $dolibarr_main_document_root='/var/www/dolibarr/htdocs'; + // - Put into conf.php $dolibarr_main_url_root='http://localhost/dolibarralias'; (because autodetect will fails in this case) + if ($testtodo == 5) { + $_SERVER["HTTPS"]=''; + $_SERVER["SERVER_NAME"]='localhost'; + $_SERVER["SERVER_PORT"]='80'; + $_SERVER["DOCUMENT_ROOT"]='/var/www'; + $_SERVER["SCRIPT_NAME"]='/dolibarralias/admin/system/phpinfo.php'; + $expectedresult='/dolibarralias'; + } - // Force to rerun filefunc.inc.php - include dirname(__FILE__).'/../../htdocs/filefunc.inc.php'; + // Force to rerun filefunc.inc.php + include dirname(__FILE__).'/../../htdocs/filefunc.inc.php'; - print __METHOD__." DOL_MAIN_URL_ROOT=".DOL_MAIN_URL_ROOT."\n"; - print __METHOD__." DOL_URL_ROOT=".DOL_URL_ROOT."\n"; - $this->assertEquals(DOL_URL_ROOT,$expectedresult); + print __METHOD__." DOL_MAIN_URL_ROOT=".DOL_MAIN_URL_ROOT."\n"; + print __METHOD__." DOL_URL_ROOT=".DOL_URL_ROOT."\n"; + $this->assertEquals(DOL_URL_ROOT,$expectedresult); - return true; + return true; } /** * testSqlAndScriptInject * - * @return void + * @return void */ public function testSqlAndScriptInject() { - global $dolibarr_main_prod; + global $dolibarr_main_prod; - global $dolibarr_main_url_root; - global $dolibarr_main_data_root; - global $dolibarr_main_document_root; - global $dolibarr_main_data_root_alt; - global $dolibarr_main_document_root_alt; - global $dolibarr_main_db_host; - global $dolibarr_main_db_port; - global $dolibarr_main_db_type; - global $dolibarr_main_db_prefix; + global $dolibarr_main_url_root; + global $dolibarr_main_data_root; + global $dolibarr_main_document_root; + global $dolibarr_main_data_root_alt; + global $dolibarr_main_document_root_alt; + global $dolibarr_main_db_host; + global $dolibarr_main_db_port; + global $dolibarr_main_db_type; + global $dolibarr_main_db_prefix; - // This is code copied from main.inc.php + // This is code copied from main.inc.php - /** - * Security: SQL Injection and XSS Injection (scripts) protection (Filters on GET, POST, PHP_SELF). - * - * @param string $val Value - * @param string $type 1=GET, 0=POST, 2=PHP_SELF - * @return int >0 if there is an injection - */ - function test_sql_and_script_inject($val, $type) - { - $sql_inj = 0; - // For SQL Injection (only GET and POST are used to be included into bad escaped SQL requests) - if ($type != 2) - { - $sql_inj += preg_match('/delete[\s]+from/i', $val); - $sql_inj += preg_match('/create[\s]+table/i', $val); - $sql_inj += preg_match('/update.+set.+=/i', $val); - $sql_inj += preg_match('/insert[\s]+into/i', $val); - $sql_inj += preg_match('/select.+from/i', $val); - $sql_inj += preg_match('/union.+select/i', $val); - $sql_inj += preg_match('/(\.\.%2f)+/i', $val); - } - // For XSS Injection done by adding javascript with script - // This is all cases a browser consider text is javascript: - // When it found '0 if there is an injection + */ + function test_sql_and_script_inject($val, $type) + { + $sql_inj = 0; + // For SQL Injection (only GET and POST are used to be included into bad escaped SQL requests) + if ($type != 2) { + $sql_inj += preg_match('/delete[\s]+from/i', $val); + $sql_inj += preg_match('/create[\s]+table/i', $val); + $sql_inj += preg_match('/update.+set.+=/i', $val); + $sql_inj += preg_match('/insert[\s]+into/i', $val); + $sql_inj += preg_match('/select.+from/i', $val); + $sql_inj += preg_match('/union.+select/i', $val); + $sql_inj += preg_match('/(\.\.%2f)+/i', $val); + } + // For XSS Injection done by adding javascript with script + // This is all cases a browser consider text is javascript: + // When it found 'assertEquals($result,$expectedresult); + $this->assertEquals($result,$expectedresult); } } diff --git a/test/phpunit/DateLibTest.php b/test/phpunit/DateLibTest.php index f5d9e7d0cc4..9dd362cca9d 100644 --- a/test/phpunit/DateLibTest.php +++ b/test/phpunit/DateLibTest.php @@ -80,6 +80,8 @@ class DateLibTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/DateLibTzFranceTest.php b/test/phpunit/DateLibTzFranceTest.php index 22bfc12590e..668af000204 100644 --- a/test/phpunit/DateLibTzFranceTest.php +++ b/test/phpunit/DateLibTzFranceTest.php @@ -85,6 +85,8 @@ class DateLibTzFranceTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/DiscountTest.php b/test/phpunit/DiscountTest.php index d9f92c84bd1..cf4d5033597 100755 --- a/test/phpunit/DiscountTest.php +++ b/test/phpunit/DiscountTest.php @@ -80,6 +80,8 @@ class DiscountTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/EntrepotTest.php b/test/phpunit/EntrepotTest.php index 53788d71dab..d3d7c300308 100755 --- a/test/phpunit/EntrepotTest.php +++ b/test/phpunit/EntrepotTest.php @@ -83,6 +83,8 @@ class EntrepotTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php index 49695ab1946..e4ee73291be 100755 --- a/test/phpunit/ExportTest.php +++ b/test/phpunit/ExportTest.php @@ -84,6 +84,8 @@ class ExportTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/FactureFournisseurTest.php b/test/phpunit/FactureFournisseurTest.php index a5855b37a37..199d397f50d 100644 --- a/test/phpunit/FactureFournisseurTest.php +++ b/test/phpunit/FactureFournisseurTest.php @@ -80,6 +80,8 @@ class FactureFournisseurTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/FactureRecTest.php b/test/phpunit/FactureRecTest.php index 8933b9a73e0..f7f857fe317 100644 --- a/test/phpunit/FactureRecTest.php +++ b/test/phpunit/FactureRecTest.php @@ -81,6 +81,8 @@ class FactureRecTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; @@ -149,7 +151,7 @@ class FactureRecTest extends PHPUnit_Framework_TestCase /** * Edit an object to test updates * - * @param mixed &$localobject Object Facture + * @param mixed $localobject Object Facture * @return void */ public function changeProperties(&$localobject) diff --git a/test/phpunit/FactureTest.php b/test/phpunit/FactureTest.php index a16ddbbbf47..c68014e9606 100644 --- a/test/phpunit/FactureTest.php +++ b/test/phpunit/FactureTest.php @@ -18,9 +18,9 @@ /** * \file test/phpunit/FactureTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; @@ -29,11 +29,10 @@ global $conf,$user,$langs,$db; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/compta/facture/class/facture.class.php'; -if (empty($user->id)) -{ - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -47,74 +46,76 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; */ class FactureTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return FactureTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return FactureTest + */ + function __construct() { - global $conf,$user,$langs,$db; + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; + + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; + } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; if (! empty($conf->ecotaxdeee->enabled)) { print __METHOD__." ecotaxdeee module must not be enabled.\n"; die(); } - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. - print __METHOD__."\n"; + print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * End phpunit tests - * - * @return void - */ - protected function tearDown() + /** + * End phpunit tests + * + * @return void + */ + protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } /** @@ -124,107 +125,107 @@ class FactureTest extends PHPUnit_Framework_TestCase */ public function testFactureCreate() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Facture($this->savdb); - $localobject->initAsSpecimen(); - $result=$localobject->create($user); + $localobject=new Facture($this->savdb); + $localobject->initAsSpecimen(); + $result=$localobject->create($user); - $this->assertLessThan($result, 0); - print __METHOD__." result=".$result."\n"; - return $result; + $this->assertLessThan($result, 0); + print __METHOD__." result=".$result."\n"; + return $result; } /** * testFactureFetch * - * @param int $id Id invoice - * @return int + * @param int $id Id invoice + * @return int * - * @depends testFactureCreate + * @depends testFactureCreate * The depends says test is run only if previous is ok */ public function testFactureFetch($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Facture($this->savdb); - $result=$localobject->fetch($id); + $localobject=new Facture($this->savdb); + $result=$localobject->fetch($id); - $this->assertLessThan($result, 0); - print __METHOD__." id=".$id." result=".$result."\n"; - return $localobject; + $this->assertLessThan($result, 0); + print __METHOD__." id=".$id." result=".$result."\n"; + return $localobject; } /** * testFactureFetch * - * @param Object $localobject Invoice - * @return int + * @param Object $localobject Invoice + * @return int * - * @depends testFactureFetch + * @depends testFactureFetch * The depends says test is run only if previous is ok */ public function testFactureUpdate($localobject) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; $this->changeProperties($localobject); - $result=$localobject->update($user); + $result=$localobject->update($user); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); - return $localobject; + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $localobject; } /** * testFactureValid * - * @param Object $localobject Invoice - * @return void + * @param Object $localobject Invoice + * @return void * - * @depends testFactureUpdate + * @depends testFactureUpdate * The depends says test is run only if previous is ok */ public function testFactureValid($localobject) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $result=$localobject->validate($user); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $result=$localobject->validate($user); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); + $this->assertLessThan($result, 0); - // Test everything are still same than specimen - $newlocalobject=new Facture($this->savdb); - $newlocalobject->initAsSpecimen(); - $this->changeProperties($newlocalobject); - $this->assertEquals($this->objCompare($localobject,$newlocalobject,true,array('id','lines','client','thirdparty','brouillon','user_author','date_creation','date_validation','datem','ref','statut','paye','specimen','facnumber','actiontypecode','actionmsg2','actionmsg','mode_reglement','cond_reglement','cond_reglement_doc')), array()); // Actual, Expected + // Test everything are still same than specimen + $newlocalobject=new Facture($this->savdb); + $newlocalobject->initAsSpecimen(); + $this->changeProperties($newlocalobject); + $this->assertEquals($this->objCompare($localobject,$newlocalobject,true,array('newref','oldref','id','lines','client','thirdparty','brouillon','user_author','date_creation','date_validation','datem','ref','statut','paye','specimen','facnumber','actiontypecode','actionmsg2','actionmsg','mode_reglement','cond_reglement','cond_reglement_doc')), array()); // Actual, Expected - return $localobject; + return $localobject; } /** * testFactureOther * - * @param Object $localobject Invoice - * @return int + * @param Object $localobject Invoice + * @return int * * @depends testFactureValid * The depends says test is run only if previous is ok @@ -256,34 +257,34 @@ class FactureTest extends PHPUnit_Framework_TestCase /** * testFactureDelete * - * @param int $id Id of invoice - * @return int + * @param int $id Id of invoice + * @return int * - * @depends testFactureOther + * @depends testFactureOther * The depends says test is run only if previous is ok */ public function testFactureDelete($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Facture($this->savdb); - $result=$localobject->fetch($id); - $result=$localobject->delete($id); + $localobject=new Facture($this->savdb); + $result=$localobject->fetch($id); + $result=$localobject->delete($id); - print __METHOD__." id=".$id." result=".$result."\n"; - $this->assertGreaterThanOrEqual(0, $result); - return $result; + print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertGreaterThanOrEqual(0, $result); + return $result; } /** * Edit an object to test updates * - * @param mixed &$localobject Object Facture - * @return void + * @param mixed $localobject Object Facture + * @return void */ public function changeProperties(&$localobject) { @@ -294,11 +295,11 @@ class FactureTest extends PHPUnit_Framework_TestCase /** * Compare all public properties values of 2 objects * - * @param Object $oA Object operand 1 - * @param Object $oB Object operand 2 - * @param boolean $ignoretype False will not report diff if type of value differs - * @param array $fieldstoignorearray Array of fields to ignore in diff - * @return array Array with differences + * @param Object $oA Object operand 1 + * @param Object $oB Object operand 2 + * @param boolean $ignoretype False will not report diff if type of value differs + * @param array $fieldstoignorearray Array of fields to ignore in diff + * @return array Array with differences */ public function objCompare($oA,$oB,$ignoretype=true,$fieldstoignorearray=array('id')) { diff --git a/test/phpunit/FactureTestRounding.php b/test/phpunit/FactureTestRounding.php index d4bb8b9dff7..5fe0df4e5d0 100644 --- a/test/phpunit/FactureTestRounding.php +++ b/test/phpunit/FactureTestRounding.php @@ -80,6 +80,8 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/FichinterTest.php b/test/phpunit/FichinterTest.php new file mode 100644 index 00000000000..baa72b7020a --- /dev/null +++ b/test/phpunit/FichinterTest.php @@ -0,0 +1,246 @@ + + * + * 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 . + * or see http://www.gnu.org/ + */ + +/** + * \file test/phpunit/FichinterTest.php + * \ingroup test + * \brief PHPUnit test + * \remarks To run this script as CLI: phpunit filename.php + */ + +global $conf,$user,$langs,$db; +//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver +//require_once 'PHPUnit/Autoload.php'; +require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; +require_once dirname(__FILE__).'/../../htdocs/fichinter/class/fichinter.class.php'; + +if (empty($user->id)) +{ + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); +} +$conf->global->MAIN_DISABLE_ALL_MAILS=1; + + +/** + * Class for PHPUnit tests + * + * @backupGlobals disabled + * @backupStaticAttributes enabled + * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. + */ +class FichinterTest extends PHPUnit_Framework_TestCase +{ + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; + + /** + * Constructor + * We save global variables into local variables + * + * @return ContratTest + */ + function __construct() + { + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; + + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; + } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + // tear down after class + public static function tearDownAfterClass() + { + global $conf,$user,$langs,$db; + $db->rollback(); + + print __METHOD__."\n"; + } + + /** + * Init phpunit tests + * + * @return void + */ + protected function setUp() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + print __METHOD__."\n"; + } + /** + * End phpunit tests + * + * @return void + */ + protected function tearDown() + { + print __METHOD__."\n"; + } + + /** + * testFichinterCreate + * + * @return int + */ + public function testFichinterCreate() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $localobject=new Fichinter($this->savdb); + $localobject->initAsSpecimen(); + $result=$localobject->create($user); + + print __METHOD__." result=".$result."\n"; + $this->assertLessThan($result, 0); + + return $result; + } + + /** + * testFichinterFetch + * + * @param int $id Id of intervention + * @return int + * + * @depends testFichinterCreate + * The depends says test is run only if previous is ok + */ + public function testFichinterFetch($id) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $localobject=new Fichinter($this->savdb); + $result=$localobject->fetch($id); + + print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertLessThan($result, 0); + + return $localobject; + } + + /** + * testFichinterValid + * + * @param Fichinter $localobject Intervention + * @return int + * + * @depends testFichinterFetch + * The depends says test is run only if previous is ok + */ + public function testFichinterValid($localobject) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $result=$localobject->setValid($user); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + + $this->assertLessThan($result, 0); + return $localobject; + } + + /** + * testFichinterValid + * + * @param Object $localobject Object intervention + * @return int + * + * @depends testFichinterValid + * The depends says test is run only if previous is ok + */ + public function testFichinterOther($localobject) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + /*$result=$localobject->setstatus(0); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + */ + + $localobject->info($localobject->id); + print __METHOD__." localobject->date_creation=".$localobject->date_creation."\n"; + $this->assertNotEquals($localobject->date_creation, ''); + + return $localobject->id; + } + + /** + * testFichinterDelete + * + * @param int $id Id of intervention + * @return int + * + * @depends testFichinterOther + * The depends says test is run only if previous is ok + */ + public function testFichinterDelete($id) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $localobject=new Fichinter($this->savdb); + $result=$localobject->fetch($id); + $result=$localobject->delete($user); + + print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $result; + } + +} diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index 0e011c96d2c..4477784ae7d 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -81,6 +81,8 @@ class FilesLibTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/FormAdminTest.php b/test/phpunit/FormAdminTest.php index 265f8e62759..30c96600210 100644 --- a/test/phpunit/FormAdminTest.php +++ b/test/phpunit/FormAdminTest.php @@ -80,6 +80,8 @@ class FormAdminTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/Functions2LibTest.php b/test/phpunit/Functions2LibTest.php index 969810cb314..13462afc601 100755 --- a/test/phpunit/Functions2LibTest.php +++ b/test/phpunit/Functions2LibTest.php @@ -83,6 +83,8 @@ class Functions2LibTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index f26718f1dd9..6036909cd23 100755 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -83,6 +83,8 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; @@ -824,4 +826,32 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $this->assertEquals(dol_nl2br($string, 1, 1), "a
    a"); } + /** + * testDolPrice2Num + * + * @return boolean + */ + public function testDolPrice2Num() + { + $this->assertEquals(1000, price2num('1 000.0')); + $this->assertEquals(1000, price2num('1 000','MT')); + $this->assertEquals(1000, price2num('1 000','MU')); + + $this->assertEquals(1000.123456, price2num('1 000.123456')); + + // Round down + $this->assertEquals(1000.12, price2num('1 000.123452','MT')); + $this->assertEquals(1000.12345, price2num('1 000.123452','MU'),"Test MU"); + + // Round up + $this->assertEquals(1000.13, price2num('1 000.125456','MT')); + $this->assertEquals(1000.12546, price2num('1 000.125456','MU'),"Test MU"); + + // Text can't be converted + $this->assertEquals('12.4$',price2num('12.4$')); + $this->assertEquals('12r.4$',price2num('12r.4$')); + + return true; + } + } diff --git a/test/phpunit/HolidayTest.php b/test/phpunit/HolidayTest.php index e91305c21e2..36556fd9281 100644 --- a/test/phpunit/HolidayTest.php +++ b/test/phpunit/HolidayTest.php @@ -83,6 +83,8 @@ class HolidayTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/ImagesLibTest.php b/test/phpunit/ImagesLibTest.php index f43bfe1c169..41c7005e25d 100644 --- a/test/phpunit/ImagesLibTest.php +++ b/test/phpunit/ImagesLibTest.php @@ -81,6 +81,8 @@ class ImagesLibTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/ImportTest.php b/test/phpunit/ImportTest.php index 4d9590e7a1d..067b06910c9 100755 --- a/test/phpunit/ImportTest.php +++ b/test/phpunit/ImportTest.php @@ -82,6 +82,8 @@ class ImportTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/JsonLibTest.php b/test/phpunit/JsonLibTest.php index 1a7127c69b1..66999e31c65 100755 --- a/test/phpunit/JsonLibTest.php +++ b/test/phpunit/JsonLibTest.php @@ -82,6 +82,8 @@ class JsonLibTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/LangTest.php b/test/phpunit/LangTest.php index c0788feef8a..d0fba783064 100755 --- a/test/phpunit/LangTest.php +++ b/test/phpunit/LangTest.php @@ -92,6 +92,8 @@ class LangTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; @@ -163,10 +165,10 @@ class LangTest extends PHPUnit_Framework_TestCase // Test java string contains only d,M,y,/,-,. and not m,... $result=$tmplangs->trans("FormatDateShortJava"); print __METHOD__." FormatDateShortJava=".$result."\n"; - $this->assertRegExp('/^[dMy\/\-\.]+$/',$result,'FormatDateShortJava'); + $this->assertRegExp('/^[dMy\/\-\.]+$/',$result,'FormatDateShortJava KO for lang code '.$code); $result=$tmplangs->trans("FormatDateShortJavaInput"); print __METHOD__." FormatDateShortJavaInput=".$result."\n"; - $this->assertRegExp('/^[dMy\/\-\.]+$/',$result,'FormatDateShortJavaInput'); + $this->assertRegExp('/^[dMy\/\-\.]+$/',$result,'FormatDateShortJavaInput KO for lang code '.$code); unset($tmplangs); } diff --git a/test/phpunit/MarginsLibTest.php b/test/phpunit/MarginsLibTest.php index 7ae615e4934..7c2e8f68ef6 100644 --- a/test/phpunit/MarginsLibTest.php +++ b/test/phpunit/MarginsLibTest.php @@ -80,6 +80,8 @@ class MarginsLibTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/ModulesTest.php b/test/phpunit/ModulesTest.php index 974ce8ea70a..eff4b85c698 100755 --- a/test/phpunit/ModulesTest.php +++ b/test/phpunit/ModulesTest.php @@ -79,6 +79,8 @@ class ModulesTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; @@ -125,7 +127,7 @@ class ModulesTest extends PHPUnit_Framework_TestCase $langs=$this->savlangs; $db=$this->savdb; - $modulelist=array('Accounting','Adherent','Agenda','Banque','Barcode','Bookmark','Boutique', + $modulelist=array('Accounting','Adherent','Agenda','Banque','Barcode','Bookmark', 'CashDesk','Categorie','ClickToDial','Commande','Comptabilite','Contrat','Cron','Deplacement','Document','Don', 'ECM','Expedition','Export','ExternalRss','ExternalSite','Facture', 'Fckeditor','Ficheinter','Fournisseur','FTP','GeoIPMaxmind','Gravatar','Holiday','Import','Label','Ldap','Mailing', diff --git a/test/phpunit/NumberingModulesTest.php b/test/phpunit/NumberingModulesTest.php index a3788b309d1..904c102e0a8 100644 --- a/test/phpunit/NumberingModulesTest.php +++ b/test/phpunit/NumberingModulesTest.php @@ -79,6 +79,8 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; @@ -165,7 +167,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $this->assertEquals(1, $result); // Can be deleted $result=$localobject->is_erasable(); print __METHOD__." is_erasable=".$result."\n"; - $this->assertEquals(0, $result, 'Test for {yyyy}-{0000} that is_erasable is 0 for 1st invoice'); // 1 can no more be deleted (2 is more recent + $this->assertEquals(0, $result, 'Test for {yyyy}-{0000} that is_erasable is 0 for 1st invoice'); // 1 can no more be deleted (2 is more recent) // Now we try with a reset $conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}-{0000@1}'; @@ -500,7 +502,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $conf->global->SOCIETE_FISCAL_MONTH_START=6; $conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}{mm}-{0000@99}'; $conf->global->FACTURE_MERCURE_MASK_INVOICE='{yyyy}{mm}-{0000@99}'; - + $localobject=new Facture($this->savdb); $localobject->initAsSpecimen(); $localobject->date=dol_mktime(12, 0, 0, 1, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year @@ -510,7 +512,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $result3=$localobject->validate($user, $result); print __METHOD__." result=".$result."\n"; $this->assertEquals('198001-0001', $result); // counter must start to 1 - + $localobject=new Facture($this->savdb); $localobject->initAsSpecimen(); $localobject->date=dol_mktime(12, 0, 0, 1, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year @@ -520,7 +522,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $result3=$localobject->validate($user, $result); print __METHOD__." result=".$result."\n"; $this->assertEquals('198001-0002', $result); // counter must start to 2 - + $localobject=new Facture($this->savdb); $localobject->initAsSpecimen(); $localobject->date=dol_mktime(12, 0, 0, 2, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year @@ -530,7 +532,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $result3=$localobject->validate($user, $result); print __METHOD__." result=".$result."\n"; $this->assertEquals('198002-0001', $result); // counter must start to 1 - + $localobject=new Facture($this->savdb); $localobject->initAsSpecimen(); $localobject->date=dol_mktime(12, 0, 0, 1, 1, 1981); // we use year 1981 to be sure to not have existing invoice for this year @@ -540,7 +542,28 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $result3=$localobject->validate($user, $result); print __METHOD__." result=".$result."\n"; $this->assertEquals('198101-0001', $result); // counter must start to 1 - + + // Test with {t} tag + $conf->global->SOCIETE_FISCAL_MONTH_START=1; + $conf->global->FACTURE_MERCURE_MASK_CREDIT='{t}{yyyy}{mm}-{0000}'; + $conf->global->FACTURE_MERCURE_MASK_INVOICE='{t}{yyyy}{mm}-{0000}'; + + $tmpthirdparty=new Societe($this->savdb); + $tmpthirdparty->initAsSpecimen(); + $tmpthirdparty->typent_code = 'TE_ABC'; + + $localobject=new Facture($this->savdb); + $localobject->initAsSpecimen(); + $localobject->date=dol_mktime(12, 0, 0, 1, 1, 1982); // we use year 1982 to be sure to not have existing invoice for this year + $numbering=new mod_facture_mercure(); + $result=$numbering->getNextValue($tmpthirdparty, $localobject); + $result2=$localobject->create($user,1); + $result3=$localobject->validate($user, $result); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('A198201-0001', $result); // counter must start to 1 + + + return $result; } diff --git a/test/phpunit/PaypalTest.php b/test/phpunit/PaypalTest.php index 20feab6fb0a..fb48279cd66 100644 --- a/test/phpunit/PaypalTest.php +++ b/test/phpunit/PaypalTest.php @@ -84,6 +84,8 @@ class PaypalTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/PdfDocTest.php b/test/phpunit/PdfDocTest.php index 02d20a816a8..13cb1b59ae3 100755 --- a/test/phpunit/PdfDocTest.php +++ b/test/phpunit/PdfDocTest.php @@ -83,6 +83,8 @@ class PdfDocTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/PgsqlTest.php b/test/phpunit/PgsqlTest.php index 4fdca35eb82..04693c017ed 100755 --- a/test/phpunit/PgsqlTest.php +++ b/test/phpunit/PgsqlTest.php @@ -83,6 +83,8 @@ class PgsqlTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/PricesTest.php b/test/phpunit/PricesTest.php index 87ffd9c6066..c01a3701177 100755 --- a/test/phpunit/PricesTest.php +++ b/test/phpunit/PricesTest.php @@ -81,6 +81,8 @@ class PricesTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/ProductTest.php b/test/phpunit/ProductTest.php index 852292a0ad9..199aace802c 100755 --- a/test/phpunit/ProductTest.php +++ b/test/phpunit/ProductTest.php @@ -18,9 +18,9 @@ /** * \file test/phpunit/ProductTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; @@ -31,9 +31,9 @@ require_once dirname(__FILE__).'/../../htdocs/product/class/product.class.php'; if (empty($user->id)) { - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -43,169 +43,170 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * * @backupGlobals disabled * @backupStaticAttributes enabled - * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. + * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ class ProductTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return ProductTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return ProductTest + */ + function __construct() { - global $conf,$user,$langs,$db; + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; - if (empty($conf->produit->enabled)) { print __METHOD__." Module Product must be enabled.\n"; die(); } - - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. - - print __METHOD__."\n"; + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + + if (empty($conf->produit->enabled)) { print __METHOD__." Module Product must be enabled.\n"; die(); } + + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + // teardownafterclass public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * End phpunit tests - * - * @return void - */ + /** + * End phpunit tests + * + * @return void + */ protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } /** * testProductCreate * - * @return void + * @return void */ public function testProductCreate() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Product($this->savdb); - $localobject->initAsSpecimen(); - $result=$localobject->create($user); + $localobject=new Product($this->savdb); + $localobject->initAsSpecimen(); + $result=$localobject->create($user); print __METHOD__." result=".$result."\n"; - $this->assertLessThanOrEqual($result, 0); + $this->assertLessThanOrEqual($result, 0); - return $result; + return $result; } /** * testProductFetch * - * @param int $id Id product - * @return Product + * @param int $id Id product + * @return Product * - * @depends testProductCreate + * @depends testProductCreate * The depends says test is run only if previous is ok */ public function testProductFetch($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Product($this->savdb); - $result=$localobject->fetch($id); + $localobject=new Product($this->savdb); + $result=$localobject->fetch($id); print __METHOD__." id=".$id." result=".$result."\n"; - $this->assertLessThan($result, 0); + $this->assertLessThan($result, 0); - return $localobject; + return $localobject; } /** * testProductUpdate * - * @param Product $localobject Product - * @return void + * @param Product $localobject Product + * @return void * - * @depends testProductFetch + * @depends testProductFetch * The depends says test is run only if previous is ok */ public function testProductUpdate($localobject) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject->note='New note after update'; - $result=$localobject->update($localobject->id,$user); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); + $localobject->note='New note after update'; + $result=$localobject->update($localobject->id,$user); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); - return $localobject; + return $localobject; } /** * testProductOther * - * @param Product $localobject Product - * @return void + * @param Product $localobject Product + * @return void * * @depends testProductUpdate * The depends says test is run only if previous is ok */ public function testProductOther($localobject) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; return $localobject->id; @@ -214,34 +215,34 @@ class ProductTest extends PHPUnit_Framework_TestCase /** * testProductDelete * - * @param int $id Id of product - * @return void + * @param int $id Id of product + * @return void * - * @depends testProductOther + * @depends testProductOther * The depends says test is run only if previous is ok */ public function testProductDelete($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Product($this->savdb); - $result=$localobject->fetch($id); + $localobject=new Product($this->savdb); + $result=$localobject->fetch($id); - $result=$localobject->delete($id); - print __METHOD__." id=".$id." result=".$result."\n"; - $this->assertLessThan($result, 0); + $result=$localobject->delete($id); + print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertLessThan($result, 0); - return $result; + return $result; } /** * testProductStatic * - * @return void + * @return void */ public function testProductStatic() { diff --git a/test/phpunit/ProjectTest.php b/test/phpunit/ProjectTest.php index 8b97f9fe8ea..e27cd1e0223 100644 --- a/test/phpunit/ProjectTest.php +++ b/test/phpunit/ProjectTest.php @@ -81,6 +81,8 @@ class ProjectTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/PropalTest.php b/test/phpunit/PropalTest.php index 20b6a5afa38..707673e0d0f 100644 --- a/test/phpunit/PropalTest.php +++ b/test/phpunit/PropalTest.php @@ -80,6 +80,8 @@ class PropalTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/ScriptsTest.php b/test/phpunit/ScriptsTest.php index 76d59c6705b..b7916c39d9f 100755 --- a/test/phpunit/ScriptsTest.php +++ b/test/phpunit/ScriptsTest.php @@ -92,6 +92,8 @@ class ScriptsTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 0d92aee8b76..00714e7bfab 100755 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -92,6 +92,8 @@ class SecurityTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { global $conf,$user,$langs,$db; @@ -227,7 +229,7 @@ class SecurityTest extends PHPUnit_Framework_TestCase { global $conf; - $genpass1=getRandomPassword(true); // Should be a MD5 string return by dol_hash + $genpass1=getRandomPassword(true); // Should be a string return by dol_hash (if no option set, will be md5) print __METHOD__." genpass1=".$genpass1."\n"; $this->assertEquals(strlen($genpass1),32); diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php index 730d3d457a2..34fdee385f7 100755 --- a/test/phpunit/SocieteTest.php +++ b/test/phpunit/SocieteTest.php @@ -18,23 +18,22 @@ /** * \file test/phpunit/SocieteTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; -//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver +//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver //require_once 'PHPUnit/Autoload.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/societe/class/societe.class.php'; $langs->load("dict"); -if (empty($user->id)) -{ - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -48,35 +47,35 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; */ class SocieteTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return SocieteTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return SocieteTest + */ + function __construct() { - global $conf,$user,$langs,$db; + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; + + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; + } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; if ($conf->global->SOCIETE_CODECLIENT_ADDON != 'mod_codeclient_monkey') { print "\n".__METHOD__." third party ref checker must be setup to 'mod_codeclient_monkey' not to '".$conf->global->SOCIETE_CODECLIENT_ADDON."'.\n"; die(); } @@ -84,40 +83,42 @@ class SocieteTest extends PHPUnit_Framework_TestCase $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. - print __METHOD__."\n"; + print __METHOD__."\n"; } + + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * End phpunit tests - * - * @return void - */ + /** + * End phpunit tests + * + * @return void + */ protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } /** @@ -127,130 +128,130 @@ class SocieteTest extends PHPUnit_Framework_TestCase */ public function testSocieteCreate() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Societe($this->savdb); - $localobject->initAsSpecimen(); - $result=$localobject->create($user); + $localobject=new Societe($this->savdb); + $localobject->initAsSpecimen(); + $result=$localobject->create($user); print __METHOD__." result=".$result."\n"; - $this->assertLessThanOrEqual($result, 0); + $this->assertLessThanOrEqual($result, 0); - return $result; + return $result; } /** * testSocieteFetch * - * @param int $id Company id - * @return Societe $localobject Company - * + * @param int $id Company id + * @return Societe $localobject Company + * * @depends testSocieteCreate * The depends says test is run only if previous is ok */ public function testSocieteFetch($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Societe($this->savdb); - $result=$localobject->fetch($id); + $localobject=new Societe($this->savdb); + $result=$localobject->fetch($id); print __METHOD__." id=".$id." result=".$result."\n"; - $this->assertLessThan($result, 0); + $this->assertLessThan($result, 0); $result=$localobject->verify(); print __METHOD__." id=".$id." result=".$result."\n"; $this->assertEquals($result, 0); - return $localobject; + return $localobject; } /** * testSocieteUpdate * - * @param Societe $localobject Company - * @return Societe $localobject Company - * - * @depends testSocieteFetch + * @param Societe $localobject Company + * @return Societe $localobject Company + * + * @depends testSocieteFetch * The depends says test is run only if previous is ok */ public function testSocieteUpdate($localobject) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject->note_private='New private note after update'; - $localobject->note_public='New public note after update'; - $localobject->name='New name'; - $localobject->address='New address'; - $localobject->zip='New zip'; - $localobject->town='New town'; - $localobject->country_id=2; - $localobject->status=0; - $localobject->phone='New tel'; - $localobject->fax='New fax'; - $localobject->email='newemail@newemail.com'; - $localobject->url='New url'; - $localobject->idprof1='new idprof1'; - $localobject->idprof2='new idprof2'; - $localobject->idprof3='new idprof3'; - $localobject->idprof4='new idprof4'; + $localobject->note_private='New private note after update'; + $localobject->note_public='New public note after update'; + $localobject->name='New name'; + $localobject->address='New address'; + $localobject->zip='New zip'; + $localobject->town='New town'; + $localobject->country_id=2; + $localobject->status=0; + $localobject->phone='New tel'; + $localobject->fax='New fax'; + $localobject->email='newemail@newemail.com'; + $localobject->url='New url'; + $localobject->idprof1='new idprof1'; + $localobject->idprof2='new idprof2'; + $localobject->idprof3='new idprof3'; + $localobject->idprof4='new idprof4'; - $result=$localobject->update($localobject->id,$user); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); - - $result=$localobject->update_note($localobject->note_private,'_private'); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0, 'Holiday::update_note_private error'); - - $result=$localobject->update_note_public($localobject->note_public); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0, 'Holiday::update_note_public error'); - - $newobject=new Societe($this->savdb); - $result=$newobject->fetch($localobject->id); + $result=$localobject->update($localobject->id,$user); print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); + $this->assertLessThan($result, 0); - $this->assertEquals($localobject->note_private, $newobject->note_private); - //$this->assertEquals($localobject->note_public, $newobject->note_public); - $this->assertEquals($localobject->name, $newobject->name); - $this->assertEquals($localobject->address, $newobject->address); - $this->assertEquals($localobject->zip, $newobject->zip); - $this->assertEquals($localobject->town, $newobject->town); - $this->assertEquals($localobject->country_id, $newobject->country_id); - $this->assertEquals('BE', $newobject->country_code); - $this->assertEquals($localobject->status, $newobject->status); - $this->assertEquals($localobject->phone, $newobject->phone); - $this->assertEquals($localobject->fax, $newobject->fax); - $this->assertEquals($localobject->email, $newobject->email); - $this->assertEquals($localobject->url, $newobject->url); - $this->assertEquals($localobject->idprof1, $newobject->idprof1); - $this->assertEquals($localobject->idprof2, $newobject->idprof2); - $this->assertEquals($localobject->idprof3, $newobject->idprof3); - $this->assertEquals($localobject->idprof4, $newobject->idprof4); + $result=$localobject->update_note($localobject->note_private,'_private'); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0, 'Holiday::update_note_private error'); - return $localobject; + $result=$localobject->update_note_public($localobject->note_public); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0, 'Holiday::update_note_public error'); + + $newobject=new Societe($this->savdb); + $result=$newobject->fetch($localobject->id); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + + $this->assertEquals($localobject->note_private, $newobject->note_private); + //$this->assertEquals($localobject->note_public, $newobject->note_public); + $this->assertEquals($localobject->name, $newobject->name); + $this->assertEquals($localobject->address, $newobject->address); + $this->assertEquals($localobject->zip, $newobject->zip); + $this->assertEquals($localobject->town, $newobject->town); + $this->assertEquals($localobject->country_id, $newobject->country_id); + $this->assertEquals('BE', $newobject->country_code); + $this->assertEquals($localobject->status, $newobject->status); + $this->assertEquals($localobject->phone, $newobject->phone); + $this->assertEquals($localobject->fax, $newobject->fax); + $this->assertEquals($localobject->email, $newobject->email); + $this->assertEquals($localobject->url, $newobject->url); + $this->assertEquals($localobject->idprof1, $newobject->idprof1); + $this->assertEquals($localobject->idprof2, $newobject->idprof2); + $this->assertEquals($localobject->idprof3, $newobject->idprof3); + $this->assertEquals($localobject->idprof4, $newobject->idprof4); + + return $localobject; } /** * testIdProfCheck * - * @param Societe $localobject Company - * @return Societe $localobject Company + * @param Societe $localobject Company + * @return Societe $localobject Company * - * @depends testSocieteUpdate + * @depends testSocieteUpdate * The depends says test is run only if previous is ok */ public function testIdProfCheck($localobject) @@ -302,19 +303,19 @@ class SocieteTest extends PHPUnit_Framework_TestCase /** * testSocieteOther * - * @param Societe $localobject Company - * @return int $id Id of company + * @param Societe $localobject Company + * @return int $id Id of company * - * @depends testIdProfCheck + * @depends testIdProfCheck * The depends says test is run only if previous is ok */ public function testSocieteOther($localobject) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; $result=$localobject->set_as_client(); print __METHOD__." id=".$localobject->id." result=".$result."\n"; @@ -347,34 +348,34 @@ class SocieteTest extends PHPUnit_Framework_TestCase /** * testSocieteDelete * - * @param int $id Id of company - * @return int + * @param int $id Id of company + * @return int * - * @depends testSocieteOther + * @depends testSocieteOther * The depends says test is run only if previous is ok */ public function testSocieteDelete($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new Societe($this->savdb); - $result=$localobject->fetch($id); + $localobject=new Societe($this->savdb); + $result=$localobject->fetch($id); - $result=$localobject->delete($id); - print __METHOD__." id=".$id." result=".$result."\n"; - $this->assertLessThan($result, 0); + $result=$localobject->delete($id); + print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertLessThan($result, 0); - return $result; + return $result; } /** - * testSocieteStatic - * - * @return void + * testSocieteStatic + * + * @return void */ public function testSocieteStatic() { @@ -394,7 +395,7 @@ class SocieteTest extends PHPUnit_Framework_TestCase /** * testSocieteGetFullAddress * - * @return int $id Id of company + * @return int $id Id of company */ public function testSocieteGetFullAddress() { diff --git a/test/phpunit/SqlTest.php b/test/phpunit/SqlTest.php index 251709f8471..2587ff5e178 100755 --- a/test/phpunit/SqlTest.php +++ b/test/phpunit/SqlTest.php @@ -18,9 +18,9 @@ /** * \file test/phpunit/SqlTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; @@ -59,71 +59,73 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; */ class SqlTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return SecurityTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return SecurityTest + */ + function __construct() { - global $conf,$user,$langs,$db; - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; - print __METHOD__."\n"; + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * End phpunit tests - * - * @return void - */ + /** + * End phpunit tests + * + * @return void + */ protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } /** @@ -133,38 +135,37 @@ class SqlTest extends PHPUnit_Framework_TestCase */ public function testSql() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $listofsqldir = array(DOL_DOCUMENT_ROOT.'/install/mysql/tables', DOL_DOCUMENT_ROOT.'/install/mysql/migration'); + $listofsqldir = array(DOL_DOCUMENT_ROOT.'/install/mysql/tables', DOL_DOCUMENT_ROOT.'/install/mysql/migration'); - foreach ($listofsqldir as $dir) - { - print 'Process dir '.$dir."\n"; - $filesarray = scandir($dir); - foreach($filesarray as $key => $file) - { - if (! preg_match('/\.sql$/',$file)) continue; + foreach ($listofsqldir as $dir) { + print 'Process dir '.$dir."\n"; + $filesarray = scandir($dir); + foreach($filesarray as $key => $file) { + if (! preg_match('/\.sql$/',$file)) + continue; - print 'Check sql file '.$file."\n"; - $filecontent=file_get_contents($dir.'/'.$file); + print 'Check sql file '.$file."\n"; + $filecontent=file_get_contents($dir.'/'.$file); - $result=strpos($filecontent,'`'); - print __METHOD__." Result for checking we don't have back quote = ".$result."\n"; - $this->assertTrue($result===false, 'Found back quote into '.$file.'. Bad.'); + $result=strpos($filecontent,'`'); + print __METHOD__." Result for checking we don't have back quote = ".$result."\n"; + $this->assertTrue($result===false, 'Found back quote into '.$file.'. Bad.'); - $result=strpos($filecontent,'int('); - print __METHOD__." Result for checking we don't have 'int(' instead of 'integer' = ".$result."\n"; - $this->assertTrue($result===false, 'Found int(x) instead of integer into '.$file.'. Bad.'); + $result=strpos($filecontent,'int('); + print __METHOD__." Result for checking we don't have 'int(' instead of 'integer' = ".$result."\n"; + $this->assertTrue($result===false, 'Found int(x) instead of integer into '.$file.'. Bad.'); - $result=strpos($filecontent,'ON DELETE CASCADE'); - print __METHOD__." Result for checking we don't have 'ON DELETE CASCADE' = ".$result."\n"; - $this->assertTrue($result===false, 'Found ON DELETE CASCADE into '.$file.'. Bad.'); - } - } + $result=strpos($filecontent,'ON DELETE CASCADE'); + print __METHOD__." Result for checking we don't have 'ON DELETE CASCADE' = ".$result."\n"; + $this->assertTrue($result===false, 'Found ON DELETE CASCADE into '.$file.'. Bad.'); + } + } return; } @@ -176,28 +177,28 @@ class SqlTest extends PHPUnit_Framework_TestCase */ public function testInitData() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $filesarray = scandir(DOL_DOCUMENT_ROOT.'/../dev/initdata'); - foreach($filesarray as $key => $file) - { - if (! preg_match('/\.sql$/',$file)) continue; + $filesarray = scandir(DOL_DOCUMENT_ROOT.'/../dev/initdata'); + foreach($filesarray as $key => $file) { + if (! preg_match('/\.sql$/',$file)) + continue; - print 'Check sql file '.$file."\n"; - $filecontent=file_get_contents(DOL_DOCUMENT_ROOT.'/../dev/initdata/'.$file); + print 'Check sql file '.$file."\n"; + $filecontent=file_get_contents(DOL_DOCUMENT_ROOT.'/../dev/initdata/'.$file); - $result=strpos($filecontent,'@gmail.com'); - print __METHOD__." Result for checking we don't have personal data = ".$result."\n"; - $this->assertTrue($result===false, 'Found a bad key into file '.$file); + $result=strpos($filecontent,'@gmail.com'); + print __METHOD__." Result for checking we don't have personal data = ".$result."\n"; + $this->assertTrue($result===false, 'Found a bad key into file '.$file); - $result=strpos($filecontent,'eldy@'); - print __METHOD__." Result for checking we don't have personal data = ".$result."\n"; - $this->assertTrue($result===false, 'Found a bad key into file '.$file); - } + $result=strpos($filecontent,'eldy@'); + print __METHOD__." Result for checking we don't have personal data = ".$result."\n"; + $this->assertTrue($result===false, 'Found a bad key into file '.$file); + } return; } diff --git a/test/phpunit/UserGroupTest.php b/test/phpunit/UserGroupTest.php index 0e43b361e20..d41eefcbd39 100644 --- a/test/phpunit/UserGroupTest.php +++ b/test/phpunit/UserGroupTest.php @@ -18,22 +18,21 @@ /** * \file test/phpunit/UserGroupTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; -//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver +//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver //require_once 'PHPUnit/Autoload.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/user/class/usergroup.class.php'; -if (empty($user->id)) -{ - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -47,71 +46,73 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; */ class UserGroupTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return UserGroupTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return UserGroupTest + */ + function __construct() { - global $conf,$user,$langs,$db; - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; - print __METHOD__."\n"; + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * End phpunit tests - * - * @return void - */ + /** + * End phpunit tests + * + * @return void + */ protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } /** @@ -121,120 +122,120 @@ class UserGroupTest extends PHPUnit_Framework_TestCase */ public function testUserGroupCreate() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new UserGroup($this->savdb); - $localobject->initAsSpecimen(); - $result=$localobject->create($user); + $localobject=new UserGroup($this->savdb); + $localobject->initAsSpecimen(); + $result=$localobject->create($user); - $this->assertLessThan($result, 0); - print __METHOD__." result=".$result."\n"; - return $result; + $this->assertLessThan($result, 0); + print __METHOD__." result=".$result."\n"; + return $result; } /** * testUserGroupFetch * - * @param int $id Id of group - * @return void - * @depends testUserGroupCreate + * @param int $id Id of group + * @return void + * @depends testUserGroupCreate * The depends says test is run only if previous is ok */ public function testUserGroupFetch($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new UserGroup($this->savdb); - $result=$localobject->fetch($id); + $localobject=new UserGroup($this->savdb); + $result=$localobject->fetch($id); - $this->assertLessThan($result, 0); - print __METHOD__." id=".$id." result=".$result."\n"; - return $localobject; + $this->assertLessThan($result, 0); + print __METHOD__." id=".$id." result=".$result."\n"; + return $localobject; } /** * testUserGroupUpdate * - * @param Object $localobject Group - * @return void - * @depends testUserGroupFetch + * @param Object $localobject Group + * @return void + * @depends testUserGroupFetch * The depends says test is run only if previous is ok */ public function testUserGroupUpdate($localobject) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject->note='New note after update'; - $result=$localobject->update($user); + $localobject->note='New note after update'; + $result=$localobject->update($user); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); - return $localobject; + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $localobject; } /** * testUserGroupAddRight * - * @param Object $localobject Object to show - * @return void - * @depends testUserGroupUpdate + * @param Object $localobject Object to show + * @return void + * @depends testUserGroupUpdate * The depends says test is run only if previous is ok */ public function testUserGroupAddRight($localobject) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $result=$localobject->addrights(1,'bookmarks'); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $result=$localobject->addrights(1,'bookmarks'); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); - return $localobject; + $this->assertLessThan($result, 0); + return $localobject; } /** * testUserGroupDelRight * - * @param Object $localobject Object - * @return void - * @depends testUserGroupAddRight + * @param Object $localobject Object + * @return void + * @depends testUserGroupAddRight * The depends says test is run only if previous is ok */ public function testUserGroupDelRight($localobject) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $result=$localobject->delrights(1,'bookmarks'); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $result=$localobject->delrights(1,'bookmarks'); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); - return $localobject; + $this->assertLessThan($result, 0); + return $localobject; } /** * testUserGroupOther * - * @param Object $localobject Object - * @return void + * @param Object $localobject Object + * @return void * @depends testUserGroupDelRight * The depends says test is run only if previous is ok */ @@ -261,26 +262,26 @@ class UserGroupTest extends PHPUnit_Framework_TestCase /** * testUserGroupDelete * - * @param int $id Id of object - * @return void - * @depends testUserGroupOther + * @param int $id Id of object + * @return void + * @depends testUserGroupOther * The depends says test is run only if previous is ok */ public function testUserGroupDelete($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new UserGroup($this->savdb); - $result=$localobject->fetch($id); - $result=$localobject->delete($id); + $localobject=new UserGroup($this->savdb); + $result=$localobject->fetch($id); + $result=$localobject->delete($id); - print __METHOD__." id=".$id." result=".$result."\n"; - $this->assertLessThan($result, 0); - return $result; + print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $result; } } diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index 5df1549ea14..1e171737a6b 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -18,9 +18,9 @@ /** * \file test/phpunit/UserTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; @@ -29,11 +29,10 @@ global $conf,$user,$langs,$db; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/user/class/user.class.php'; -if (empty($user->id)) -{ - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -47,146 +46,148 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; */ class UserTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return UserTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return UserTest + */ + function __construct() { - global $conf,$user,$langs,$db; - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; - print __METHOD__."\n"; + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * End phpunit tests - * - * @return void - */ + /** + * End phpunit tests + * + * @return void + */ protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } /** * testUserCreate * - * @return void + * @return void */ public function testUserCreate() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new User($this->savdb); - $localobject->initAsSpecimen(); - $result=$localobject->create($user); + $localobject=new User($this->savdb); + $localobject->initAsSpecimen(); + $result=$localobject->create($user); - $this->assertLessThan($result, 0); - print __METHOD__." result=".$result."\n"; - return $result; + $this->assertLessThan($result, 0); + print __METHOD__." result=".$result."\n"; + return $result; } /** * testUserFetch * - * @param int $id Id of user - * @return void - * @depends testUserCreate + * @param int $id Id of user + * @return void + * @depends testUserCreate * The depends says test is run only if previous is ok */ public function testUserFetch($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new User($this->savdb); - $result=$localobject->fetch($id); + $localobject=new User($this->savdb); + $result=$localobject->fetch($id); - $this->assertLessThan($result, 0); - print __METHOD__." id=".$id." result=".$result."\n"; - return $localobject; + $this->assertLessThan($result, 0); + print __METHOD__." id=".$id." result=".$result."\n"; + return $localobject; } /** * testUserUpdate * - * @param Object $localobject User - * @return void - * @depends testUserFetch + * @param Object $localobject User + * @return void + * @depends testUserFetch * The depends says test is run only if previous is ok */ public function testUserUpdate($localobject) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $this->changeProperties($localobject); - $result=$localobject->update($user); + $this->changeProperties($localobject); + $result=$localobject->update($user); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); - // Test everything are still same than specimen - $newlocalobject=new User($this->savdb); - $newlocalobject->initAsSpecimen(); - $this->changeProperties($newlocalobject); - $this->assertEquals($this->objCompare($localobject,$newlocalobject,true,array('id','ref','pass_indatabase','pass_indatabase_crypted','datec','datem','datelastlogin','datepreviouslogin')), array()); // Actual, Expected + // Test everything are still same than specimen + $newlocalobject=new User($this->savdb); + $newlocalobject->initAsSpecimen(); + $this->changeProperties($newlocalobject); + $this->assertEquals($this->objCompare($localobject,$newlocalobject,true,array('id','ref','pass_indatabase','pass_indatabase_crypted','datec','datem','datelastlogin','datepreviouslogin')), array()); // Actual, Expected return $localobject; } @@ -194,32 +195,32 @@ class UserTest extends PHPUnit_Framework_TestCase /** * testUserDisable * - * @param Object $localobject User - * @return void - * @depends testUserUpdate + * @param Object $localobject User + * @return void + * @depends testUserUpdate * The depends says test is run only if previous is ok */ public function testUserDisable($localobject) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $result=$localobject->setstatus(0); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $result=$localobject->setstatus(0); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); + $this->assertLessThan($result, 0); - return $localobject; + return $localobject; } /** * testUserOther * - * @param Object $localobject User - * @return void + * @param Object $localobject User + * @return void * @depends testUserDisable * The depends says test is run only if previous is ok */ @@ -246,75 +247,70 @@ class UserTest extends PHPUnit_Framework_TestCase /** * testUserDelete * - * @param Object $id User - * @return void - * @depends testUserOther + * @param Object $id User + * @return void + * @depends testUserOther * The depends says test is run only if previous is ok */ public function testUserDelete($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $localobject=new User($this->savdb); - $result=$localobject->fetch($id); - $result=$localobject->delete($id); + $localobject=new User($this->savdb); + $result=$localobject->fetch($id); + $result=$localobject->delete($id); - print __METHOD__." id=".$id." result=".$result."\n"; - $this->assertLessThan($result, 0); - return $result; + print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $result; } /** * Edit an object to test updates * - * @param mixed &$localobject Object Facture - * @return void + * @param mixed $localobject Object Facture + * @return void */ public function changeProperties(&$localobject) { - $localobject->note='New note after update'; + $localobject->note='New note after update'; } /** * Compare all public properties values of 2 objects * - * @param Object $oA Object operand 1 - * @param Object $oB Object operand 2 - * @param boolean $ignoretype False will not report diff if type of value differs - * @param array $fieldstoignorearray Array of fields to ignore in diff - * @return array Array with differences + * @param Object $oA Object operand 1 + * @param Object $oB Object operand 2 + * @param boolean $ignoretype False will not report diff if type of value differs + * @param array $fieldstoignorearray Array of fields to ignore in diff + * @return array Array with differences */ public function objCompare($oA,$oB,$ignoretype=true,$fieldstoignorearray=array('id')) { - $retAr=array(); + $retAr=array(); - if (get_class($oA) !== get_class($oB)) - { - $retAr[]="Supplied objects are not of same class."; - } - else - { - $oVarsA=get_object_vars($oA); - $oVarsB=get_object_vars($oB); - $aKeys=array_keys($oVarsA); - foreach($aKeys as $sKey) - { - if (in_array($sKey,$fieldstoignorearray)) continue; - if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey]) - { - $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); - } - if ($ignoretype && $oVarsA[$sKey] != $oVarsB[$sKey]) - { - $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); - } - } - } - return $retAr; + if (get_class($oA) !== get_class($oB)) { + $retAr[]="Supplied objects are not of same class."; + } else { + $oVarsA=get_object_vars($oA); + $oVarsB=get_object_vars($oB); + $aKeys=array_keys($oVarsA); + foreach($aKeys as $sKey) { + if (in_array($sKey,$fieldstoignorearray)) + continue; + if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey]) { + $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); + } + if ($ignoretype && $oVarsA[$sKey] != $oVarsB[$sKey]) { + $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); + } + } + } + return $retAr; } } diff --git a/test/phpunit/WebservicesInvoicesTest.php b/test/phpunit/WebservicesInvoicesTest.php index 20e01595375..202f260bc84 100755 --- a/test/phpunit/WebservicesInvoicesTest.php +++ b/test/phpunit/WebservicesInvoicesTest.php @@ -18,9 +18,9 @@ /** * \file test/phpunit/WebservicesInvoicesTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; @@ -31,11 +31,10 @@ require_once dirname(__FILE__).'/../../htdocs/core/lib/date.lib.php'; require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP -if (empty($user->id)) -{ - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -45,75 +44,77 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * * @backupGlobals disabled * @backupStaticAttributes enabled - * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. + * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return DateLibTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return DateLibTest + */ + function __construct() { - global $conf,$user,$langs,$db; - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; - print __METHOD__."\n"; + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * End phpunit tests - * - * @return void - */ + /** + * End phpunit tests + * + * @return void + */ protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } @@ -124,60 +125,57 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase */ public function testWSInvoicesXxx() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_invoice.php'; - $WS_METHOD = 'getInvoice'; - $ns='http://www.dolibarr.org/ns/'; + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_invoice.php'; + $WS_METHOD = 'getInvoice'; + $ns='http://www.dolibarr.org/ns/'; - // Set the WebService URL - print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } + // Set the WebService URL + print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>'' + ); - // Test URL - $result=''; - $parameters = array('authentication'=>$authentication,'id'=>1); - print __METHOD__." call method ".$WS_METHOD."\n"; - try { - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - } - catch(SoapFault $exception) - { - echo $exception; - $result=0; - } - if (! $result || ! empty($result['faultstring'])) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "\n
    \n"; - print $soapclient->request; - print "\n
    \n"; - print $soapclient->response; - print "\n"; - } + // Test URL + $result=''; + $parameters = array('authentication'=>$authentication,'id'=>1); + print __METHOD__." call method ".$WS_METHOD."\n"; + try { + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + } catch(SoapFault $exception) { + echo $exception; + $result=0; + } + if (! $result || ! empty($result['faultstring'])) { + //var_dump($soapclient); + print $soapclient->error_str; + print "\n
    \n"; + print $soapclient->request; + print "\n
    \n"; + print $soapclient->response; + print "\n"; + } - print __METHOD__." result=".$result."\n"; - $this->assertEquals('OK',$result['result']['result_code']); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('OK',$result['result']['result_code']); - return $result; + return $result; } } diff --git a/test/phpunit/WebservicesOrdersTest.php b/test/phpunit/WebservicesOrdersTest.php index d76fc784722..06ead4f4873 100755 --- a/test/phpunit/WebservicesOrdersTest.php +++ b/test/phpunit/WebservicesOrdersTest.php @@ -18,24 +18,23 @@ /** * \file test/phpunit/WebservicesOrdersTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; -//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver +//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver //require_once 'PHPUnit/Autoload.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/core/lib/date.lib.php'; require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP -if (empty($user->id)) -{ - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -49,71 +48,73 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; */ class WebservicesOrdersTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return DateLibTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return DateLibTest + */ + function __construct() { - global $conf,$user,$langs,$db; - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; - print __METHOD__."\n"; + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * End phpunit tests - * - * @return void - */ + /** + * End phpunit tests + * + * @return void + */ protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } @@ -124,59 +125,56 @@ class WebservicesOrdersTest extends PHPUnit_Framework_TestCase */ public function testWSOrderGetOrder() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_order.php'; - $WS_METHOD = 'getOrder'; - $ns='http://www.dolibarr.org/ns/'; + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_order.php'; + $WS_METHOD = 'getOrder'; + $ns='http://www.dolibarr.org/ns/'; - // Set the WebService URL - print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } + // Set the WebService URL + print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>'' + ); - // Test URL - $parameters = array('authentication'=>$authentication,'id'=>1); - print __METHOD__." call method ".$WS_METHOD."\n"; - try { - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - } - catch(SoapFault $exception) - { - echo $exception; - $result=0; - } - if (! $result || ! empty($result['faultstring'])) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "\n
    \n"; - print $soapclient->request; - print "\n
    \n"; - print $soapclient->response; - print "\n"; - } + // Test URL + $parameters = array('authentication'=>$authentication,'id'=>1); + print __METHOD__." call method ".$WS_METHOD."\n"; + try { + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + } catch(SoapFault $exception) { + echo $exception; + $result=0; + } + if (! $result || ! empty($result['faultstring'])) { + //var_dump($soapclient); + print $soapclient->error_str; + print "\n
    \n"; + print $soapclient->request; + print "\n
    \n"; + print $soapclient->response; + print "\n"; + } - print __METHOD__." result=".$result."\n"; - $this->assertEquals('OK',$result['result']['result_code']); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('OK',$result['result']['result_code']); - return $result; + return $result; } } diff --git a/test/phpunit/WebservicesOtherTest.php b/test/phpunit/WebservicesOtherTest.php index 1ea80beb4bf..d04fc6b9b9c 100755 --- a/test/phpunit/WebservicesOtherTest.php +++ b/test/phpunit/WebservicesOtherTest.php @@ -18,9 +18,9 @@ /** * \file test/phpunit/WebservicesOtherTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; @@ -31,11 +31,10 @@ require_once dirname(__FILE__).'/../../htdocs/core/lib/date.lib.php'; require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP -if (empty($user->id)) -{ - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -49,71 +48,73 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; */ class WebservicesOtherTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return DateLibTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return DateLibTest + */ + function __construct() { - global $conf,$user,$langs,$db; - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; - print __METHOD__."\n"; + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * End phpunit tests - * - * @return void - */ + /** + * End phpunit tests + * + * @return void + */ protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } @@ -124,92 +125,85 @@ class WebservicesOtherTest extends PHPUnit_Framework_TestCase */ public function testWSOtherGetVersions() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_other.php'; - $WS_METHOD = 'getVersions'; - $ns='http://www.dolibarr.org/ns/'; + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_other.php'; + $WS_METHOD = 'getVersions'; + $ns='http://www.dolibarr.org/ns/'; - // Set the WebService URL - print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } + // Set the WebService URL + print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>'' + ); - // Test URL - $result=''; - $parameters = array('authentication'=>$authentication); - print __METHOD__." call method ".$WS_METHOD."\n"; - try { - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - } - catch(SoapFault $exception) - { - echo $exception; - $result=0; - } - if (! empty($result['faultstring'])) - { - print $result['faultstring']."\n"; - $result=0; - } - if (! $result) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "\n
    \n"; - print $soapclient->request; - print "\n
    \n"; - print $soapclient->response; - print "\n"; - } + // Test URL + $result=''; + $parameters = array('authentication'=>$authentication); + print __METHOD__." call method ".$WS_METHOD."\n"; + try { + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + } catch(SoapFault $exception) { + echo $exception; + $result=0; + } + if (! empty($result['faultstring'])) { + print $result['faultstring']."\n"; + $result=0; + } + if (! $result) { + //var_dump($soapclient); + print $soapclient->error_str; + print "\n
    \n"; + print $soapclient->request; + print "\n
    \n"; + print $soapclient->response; + print "\n"; + } - print __METHOD__." result=".$result."\n"; - $this->assertEquals('OK',$result['result']['result_code']); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('OK',$result['result']['result_code']); - // Test method that does not exists - $WS_METHOD='methodthatdoesnotexists'; - $result=''; - $parameters = array('authentication'=>$authentication); - print __METHOD__." call method ".$WS_METHOD."\n"; - try { - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - } - catch(SoapFault $exception) - { - echo $exception; - $result=0; - } - if (! $result || ! empty($result['faultstring'])) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "\n
    \n"; - print $soapclient->request; - print "\n
    \n"; - print $soapclient->response; - print "\n"; - } + // Test method that does not exists + $WS_METHOD='methodthatdoesnotexists'; + $result=''; + $parameters = array('authentication'=>$authentication); + print __METHOD__." call method ".$WS_METHOD."\n"; + try { + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + } catch(SoapFault $exception) { + echo $exception; + $result=0; + } + if (! $result || ! empty($result['faultstring'])) { + //var_dump($soapclient); + print $soapclient->error_str; + print "\n
    \n"; + print $soapclient->request; + print "\n
    \n"; + print $soapclient->response; + print "\n"; + } - print __METHOD__." result=".$result."\n"; - $this->assertEquals("SOAP-ENV:Client: Operation 'methodthatdoesnotexists' is not defined in the WSDL for this service", $soapclient->error_str); + print __METHOD__." result=".$result."\n"; + $this->assertEquals("SOAP-ENV:Client: Operation 'methodthatdoesnotexists' is not defined in the WSDL for this service", $soapclient->error_str); - return $result; + return $result; } } diff --git a/test/phpunit/WebservicesProductsTest.php b/test/phpunit/WebservicesProductsTest.php index a4ff7293091..77fd81c78f6 100755 --- a/test/phpunit/WebservicesProductsTest.php +++ b/test/phpunit/WebservicesProductsTest.php @@ -20,9 +20,9 @@ /** * \file test/phpunit/WebservicesProductsTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; @@ -33,11 +33,10 @@ require_once dirname(__FILE__).'/../../htdocs/core/lib/date.lib.php'; require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP -if (empty($user->id)) -{ - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -51,71 +50,72 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; */ class WebservicesProductsTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return DateLibTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return DateLibTest + */ + function __construct() { - global $conf,$user,$langs,$db; - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; - print __METHOD__."\n"; + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * End phpunit tests - * - * @return void - */ + /** + * End phpunit tests + * + * @return void + */ protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } @@ -126,198 +126,192 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase */ public function testWSProductsCreateProductOrService() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $datestring=dol_print_date(dol_now(),'dayhourlog'); + $datestring=dol_print_date(dol_now(),'dayhourlog'); - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_productorservice.php'; - $WS_METHOD = 'createProductOrService'; - $ns='http://www.dolibarr.org/ns/'; + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_productorservice.php'; + $WS_METHOD = 'createProductOrService'; + $ns='http://www.dolibarr.org/ns/'; - // Set the WebService URL - print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } + // Set the WebService URL + print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>'' + ); - // Test URL - $result=''; - $parameters = array('authentication'=>$authentication,'product'=>array( - 'ref'=>'NewProductFromWS'.$datestring, - 'label'=>'New Product From WS '.$datestring, - 'type'=>1, - 'description'=>'This is a new product created from WS PHPUnit test case')); - print __METHOD__." call method ".$WS_METHOD."\n"; - try { - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - } - catch(SoapFault $exception) - { - echo $exception; - $result=0; - } - if (! $result || ! empty($result['faultstring']) || $result['result']['result_code'] != 'OK') - { - //var_dump($soapclient); - print $soapclient->error_str; - print "\n
    \n"; - print $soapclient->request; - print "\n
    \n"; - print $soapclient->response; - print "\n"; - } + // Test URL + $result=''; + $parameters = array( + 'authentication'=>$authentication,'product'=>array( + 'ref'=>'NewProductFromWS'.$datestring, + 'label'=>'New Product From WS '.$datestring, + 'type'=>1, + 'description'=>'This is a new product created from WS PHPUnit test case' + ) + ); + print __METHOD__." call method ".$WS_METHOD."\n"; + try { + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + } catch(SoapFault $exception) { + echo $exception; + $result=0; + } + if (! $result || ! empty($result['faultstring']) || $result['result']['result_code'] != 'OK') { + //var_dump($soapclient); + print $soapclient->error_str; + print "\n
    \n"; + print $soapclient->request; + print "\n
    \n"; + print $soapclient->response; + print "\n"; + } - print __METHOD__." result=".$result."\n"; - $this->assertEquals('OK',$result['result']['result_code']); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('OK',$result['result']['result_code']); - return $result['id']; + return $result['id']; } /** * testWSProductsGetProductOrService * - * @param int $id Id of product or service - * @return int Id of product or service + * @param int $id Id of product or service + * @return int Id of product or service * * @depends testWSProductsCreateProductOrService */ public function testWSProductsGetProductOrService($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_productorservice.php'; - $WS_METHOD = 'getProductOrService'; - $ns='http://www.dolibarr.org/ns/'; + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_productorservice.php'; + $WS_METHOD = 'getProductOrService'; + $ns='http://www.dolibarr.org/ns/'; - // Set the WebService URL - print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } + // Set the WebService URL + print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>'' + ); - // Test URL - $result=''; - $parameters = array('authentication'=>$authentication,'id'=>$id,'ref'=>''); - print __METHOD__." call method ".$WS_METHOD."\n"; - try { - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - } - catch(SoapFault $exception) - { - echo $exception; - $result=0; - } - if (! $result || ! empty($result['faultstring'])) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "\n
    \n"; - print $soapclient->request; - print "\n
    \n"; - print $soapclient->response; - print "\n"; - } + // Test URL + $result=''; + $parameters = array('authentication'=>$authentication,'id'=>$id,'ref'=>''); + print __METHOD__." call method ".$WS_METHOD."\n"; + try { + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + } catch(SoapFault $exception) { + echo $exception; + $result=0; + } + if (! $result || ! empty($result['faultstring'])) { + //var_dump($soapclient); + print $soapclient->error_str; + print "\n
    \n"; + print $soapclient->request; + print "\n
    \n"; + print $soapclient->response; + print "\n"; + } - print __METHOD__." result=".$result."\n"; - $this->assertEquals('OK',$result['result']['result_code']); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('OK',$result['result']['result_code']); - return $id; + return $id; } /** * testWSProductsDeleteProductOrService * - * @param int $id Id of product or service - * @return int 0 + * @param int $id Id of product or service + * @return int 0 * - * @depends testWSProductsGetProductOrService + * @depends testWSProductsGetProductOrService */ public function testWSProductsDeleteProductOrService($id) { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_productorservice.php'; - $WS_METHOD = 'deleteProductOrService'; - $ns='http://www.dolibarr.org/ns/'; + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_productorservice.php'; + $WS_METHOD = 'deleteProductOrService'; + $ns='http://www.dolibarr.org/ns/'; - // Set the WebService URL - print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } + // Set the WebService URL + print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>'' + ); - // Test URL - $result=''; - $parameters = array('authentication'=>$authentication,'listofid'=>$id); - print __METHOD__." call method ".$WS_METHOD."\n"; - try { - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - } - catch(SoapFault $exception) - { - echo $exception; - $result=0; - } - if (! $result || ! empty($result['faultstring']) || $result['result']['result_code'] != 'OK') - { - //var_dump($soapclient); - print $soapclient->error_str; - print "\n
    \n"; - print $soapclient->request; - print "\n
    \n"; - print $soapclient->response; - print "\n"; - } + // Test URL + $result=''; + $parameters = array('authentication'=>$authentication,'listofid'=>$id); + print __METHOD__." call method ".$WS_METHOD."\n"; + try { + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + } catch(SoapFault $exception) { + echo $exception; + $result=0; + } + if (! $result || ! empty($result['faultstring']) || $result['result']['result_code'] != 'OK') { + //var_dump($soapclient); + print $soapclient->error_str; + print "\n
    \n"; + print $soapclient->request; + print "\n
    \n"; + print $soapclient->response; + print "\n"; + } - print __METHOD__." result=".$result."\n"; - $this->assertEquals('OK',$result['result']['result_code']); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('OK',$result['result']['result_code']); - return 0; + return 0; } } diff --git a/test/phpunit/WebservicesThirdpartyTest.php b/test/phpunit/WebservicesThirdpartyTest.php index 64753dcc502..0c99d7d362a 100755 --- a/test/phpunit/WebservicesThirdpartyTest.php +++ b/test/phpunit/WebservicesThirdpartyTest.php @@ -18,9 +18,9 @@ /** * \file test/phpunit/WebservicesThirdpartyTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; @@ -31,11 +31,10 @@ require_once dirname(__FILE__).'/../../htdocs/core/lib/date.lib.php'; require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP -if (empty($user->id)) -{ - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -45,75 +44,77 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * * @backupGlobals disabled * @backupStaticAttributes enabled - * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. + * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return DateLibTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return DateLibTest + */ + function __construct() { - global $conf,$user,$langs,$db; - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; - print __METHOD__."\n"; + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * End phpunit tests - * - * @return void - */ + /** + * End phpunit tests + * + * @return void + */ protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } @@ -124,60 +125,56 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase */ public function testWSThirdpartygetThirdParty() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php'; - $WS_METHOD = 'getThirdParty'; - $ns='http://www.dolibarr.org/ns/'; + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php'; + $WS_METHOD = 'getThirdParty'; + $ns='http://www.dolibarr.org/ns/'; - // Set the WebService URL - print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } + // Set the WebService URL + print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>''); - // Test URL - $result=''; - $parameters = array('authentication'=>$authentication, 'id'=>1); - print __METHOD__." call method ".$WS_METHOD."\n"; - try { - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - } - catch(SoapFault $exception) - { - echo $exception; - $result=0; - } - if (! $result || ! empty($result['faultstring'])) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "\n
    \n"; - print $soapclient->request; - print "\n
    \n"; - print $soapclient->response; - print "\n"; - } + // Test URL + $result=''; + $parameters = array('authentication'=>$authentication, 'id'=>1); + print __METHOD__." call method ".$WS_METHOD."\n"; + try { + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + } catch(SoapFault $exception) { + echo $exception; + $result=0; + } + if (! $result || ! empty($result['faultstring'])) { + //var_dump($soapclient); + print $soapclient->error_str; + print "\n
    \n"; + print $soapclient->request; + print "\n
    \n"; + print $soapclient->response; + print "\n"; + } - print __METHOD__." result=".$result."\n"; - $this->assertEquals('OK',$result['result']['result_code']); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('OK',$result['result']['result_code']); - return $result; + return $result; } } diff --git a/test/phpunit/WebservicesUserTest.php b/test/phpunit/WebservicesUserTest.php index e06b98d0921..9be97167104 100755 --- a/test/phpunit/WebservicesUserTest.php +++ b/test/phpunit/WebservicesUserTest.php @@ -18,9 +18,9 @@ /** * \file test/phpunit/WebservicesUserTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; @@ -31,11 +31,10 @@ require_once dirname(__FILE__).'/../../htdocs/core/lib/date.lib.php'; require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP -if (empty($user->id)) -{ - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -49,71 +48,73 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; */ class WebservicesUserTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return DateLibTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return DateLibTest + */ + function __construct() { - global $conf,$user,$langs,$db; - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; - print __METHOD__."\n"; + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * End phpunit tests - * - * @return void - */ + /** + * End phpunit tests + * + * @return void + */ protected function tearDown() { - print __METHOD__."\n"; + print __METHOD__."\n"; } @@ -124,91 +125,84 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase */ public function testWSUserGetUser() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_user.php'; - $WS_METHOD = 'getUser'; - $ns='http://www.dolibarr.org/ns/'; + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_user.php'; + $WS_METHOD = 'getUser'; + $ns='http://www.dolibarr.org/ns/'; - // Set the WebService URL - print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } + // Set the WebService URL + print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>'' + ); - // Test URL - $result=''; - $parameters = array('authentication'=>$authentication,'ref'=>'admin'); - print __METHOD__."Call method ".$WS_METHOD."\n"; - try { - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - } - catch(SoapFault $exception) - { - echo $exception; - $result=0; - } - if (! empty($result['faultstring'])) - { - print $result['faultstring']."\n"; - $result=0; - } - if (! $result) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "\n
    \n"; - print $soapclient->request; - print "\n
    \n"; - print $soapclient->response; - print "\n"; - } + // Test URL + $result=''; + $parameters = array('authentication'=>$authentication,'ref'=>'admin'); + print __METHOD__."Call method ".$WS_METHOD."\n"; + try { + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + } catch(SoapFault $exception) { + echo $exception; + $result=0; + } + if (! empty($result['faultstring'])) { + print $result['faultstring']."\n"; + $result=0; + } + if (! $result) { + //var_dump($soapclient); + print $soapclient->error_str; + print "\n
    \n"; + print $soapclient->request; + print "\n
    \n"; + print $soapclient->response; + print "\n"; + } - print __METHOD__." result=".$result."\n"; - $this->assertEquals('OK',$result['result']['result_code']); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('OK',$result['result']['result_code']); - // Test URL - $result=''; - $parameters = array('authentication'=>$authentication,'ref'=>'refthatdoesnotexists'); - print __METHOD__."Call method ".$WS_METHOD."\n"; - try { - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - } - catch(SoapFault $exception) - { - echo $exception; - $result=0; - } - if (! $result || ! empty($result['faultstring'])) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "\n
    \n"; - print $soapclient->request; - print "\n
    \n"; - print $soapclient->response; - print "\n"; - } + // Test URL + $result=''; + $parameters = array('authentication'=>$authentication,'ref'=>'refthatdoesnotexists'); + print __METHOD__."Call method ".$WS_METHOD."\n"; + try { + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + } catch(SoapFault $exception) { + echo $exception; + $result=0; + } + if (! $result || ! empty($result['faultstring'])) { + //var_dump($soapclient); + print $soapclient->error_str; + print "\n
    \n"; + print $soapclient->request; + print "\n
    \n"; + print $soapclient->response; + print "\n"; + } - print __METHOD__." result=".$result."\n"; - $this->assertEquals('NOT_FOUND',$result['result']['result_code']); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('NOT_FOUND',$result['result']['result_code']); - return $result; + return $result; } } diff --git a/test/phpunit/XCalLibTest.php b/test/phpunit/XCalLibTest.php index 6ec63912878..3bbf3469b17 100644 --- a/test/phpunit/XCalLibTest.php +++ b/test/phpunit/XCalLibTest.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2010-2012 Laurent Destailleur * * 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 @@ -18,22 +18,21 @@ /** * \file test/phpunit/XCalLibTest.php - * \ingroup test + * \ingroup test * \brief PHPUnit test - * \remarks To run this script as CLI: phpunit filename.php + * \remarks To run this script as CLI: phpunit filename.php */ global $conf,$user,$langs,$db; -//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver +//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver //require_once 'PHPUnit/Autoload.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/core/lib/xcal.lib.php'; -if (empty($user->id)) -{ - print "Load permissions for admin user nb 1\n"; - $user->fetch(1); - $user->getrights(); +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -43,98 +42,100 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * * @backupGlobals disabled * @backupStaticAttributes enabled - * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. + * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ class XCalLibTest extends PHPUnit_Framework_TestCase { - protected $savconf; - protected $savuser; - protected $savlangs; - protected $savdb; + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; - /** - * Constructor - * We save global variables into local variables - * - * @return FilesLibTest - */ - function __construct() - { - //$this->sharedFixture - global $conf,$user,$langs,$db; - $this->savconf=$conf; - $this->savuser=$user; - $this->savlangs=$langs; - $this->savdb=$db; - - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() + /** + * Constructor + * We save global variables into local variables + * + * @return FilesLibTest + */ + function __construct() { - global $conf,$user,$langs,$db; - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; - print __METHOD__."\n"; + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + // tear down after class public static function tearDownAfterClass() { - global $conf,$user,$langs,$db; - $db->rollback(); + global $conf,$user,$langs,$db; + $db->rollback(); - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * Init phpunit tests - * - * @return void - */ + /** + * Init phpunit tests + * + * @return void + */ protected function setUp() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - print __METHOD__."\n"; + print __METHOD__."\n"; } - /** - * End phpunit tests - * - * @return void - */ - protected function tearDown() - { - print __METHOD__."\n"; - } - - - /** - * testQuotedPrintEncodeDecode + /** + * End phpunit tests * * @return void + */ + protected function tearDown() + { + print __METHOD__."\n"; + } + + + /** + * testQuotedPrintEncodeDecode + * + * @return void */ public function testQuotedPrintEncodeDecode() { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; - $stringtoencode='ABCD=1234;'; - $result=quotedPrintEncode($stringtoencode); - print __METHOD__." result=".$result."\n"; - $this->assertEquals('ABCD=3D1234;',$result); + $stringtoencode='ABCD=1234;'; + $result=quotedPrintEncode($stringtoencode); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('ABCD=3D1234;',$result); - $resultback=quotedPrintDecode($result); - print __METHOD__." result=".$resultback."\n"; - $this->assertEquals($stringtoencode,$resultback); + $resultback=quotedPrintDecode($result); + print __METHOD__." result=".$resultback."\n"; + $this->assertEquals($stringtoencode,$resultback); } } diff --git a/test/phpunit/phpunittest.xml b/test/phpunit/phpunittest.xml index 8237367ebef..ac4e29df3b5 100644 --- a/test/phpunit/phpunittest.xml +++ b/test/phpunit/phpunittest.xml @@ -52,9 +52,8 @@ ../../htdocs/contact/canvas/ ../../htdocs/societe/canvas/ ../../htdocs/includes/ - ../../htdocs/boutique/osc_master.inc.php ../../htdocs/holiday/common.inc.php - \ No newline at end of file + diff --git a/test/selenium/test_thirdparty.xml b/test/selenium/test_thirdparty.xml index 47a9b8091a9..dbc24905cbf 100644 --- a/test/selenium/test_thirdparty.xml +++ b/test/selenium/test_thirdparty.xml @@ -13,7 +13,7 @@ open - /dolibarrnew/fourn/fiche.php?socid=14 + /dolibarrnew/fourn/card.php?socid=14 diff --git a/test/soapui/Dolibarr-soapui-project.xml b/test/soapui/Dolibarr-soapui-project.xml index 1ffd1ad0e3c..c81b1ac8e1f 100755 --- a/test/soapui/Dolibarr-soapui-project.xml +++ b/test/soapui/Dolibarr-soapui-project.xml @@ -27446,4 +27446,374 @@ -]]> \ No newline at end of file +]]>http://localhostalias/dolibarr_3.7/webservices/server_order.php?wsdl + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WS to get a particular invoice + + + + + WS to get all orders of a third party + + + + + WS to create an order + + + + + WS to update an order + + + + + WS to valid an order + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]>http://schemas.xmlsoap.org/wsdl/http://localhostalias/dolibarr_3.6/webservices/server_order.phphttp://localhostalias/dolibarr_3.7/webservices/server_order.php<xml-fragment/>UTF-8http://localhostalias/dolibarr_3.7/webservices/server_order.php + + + + + + dolibarrkey + aaa + admin + admin + + + + + + 123ext + ? + 1 + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + + + + + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + + + + + +]]>UTF-8http://localhostalias/dolibarr_3.7/webservices/server_order.php + + + + + + ? + ? + ? + ? + ? + + ? + ? + ? + + +]]>UTF-8http://localhostalias/dolibarr_3.7/webservices/server_order.php + + + + + + ? + ? + ? + ? + ? + + ? + + +]]>UTF-8http://localhostalias/dolibarr_3.7/webservices/server_order.php + + + + + + ? + ? + ? + ? + ? + + ? + + +]]><xml-fragment/>UTF-8http://localhostalias/dolibarr_3.7/webservices/server_order.php + + + + + + dolibarrkey + + admin + admin + + + + + 6 +0 + 2 + ? + ? + ? + ? + ? + ? + ? + ? + + + +]]> \ No newline at end of file